From bob.wilson at apple.com Mon Aug 17 00:04:02 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 17 Aug 2009 05:04:02 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79225 - /llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Message-ID: <200908170504.n7H542Wr024262@zion.cs.uiuc.edu> Author: bwilson Date: Mon Aug 17 00:04:01 2009 New Revision: 79225 URL: http://llvm.org/viewvc/llvm-project?rev=79225&view=rev Log: Canonicalize vector types for VBSL to use 32-bit integer elements. This fixes pr4731. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=79225&r1=79224&r2=79225&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Mon Aug 17 00:04:01 2009 @@ -1866,11 +1866,20 @@ break; } - case NEON_BUILTIN_vbsl: + case NEON_BUILTIN_vbsl: { + // Canonicalize the vector type to have 32-bit integer elements. + const VectorType *VTy = dyn_cast(Ops[0]->getType()); + assert(VTy && "expected a vector type"); + VTy = VectorType::get(Type::getInt32Ty(Context), VTy->getBitWidth() / 32); + Ops[0] = Builder.CreateBitCast(Ops[0], VTy); + Ops[1] = Builder.CreateBitCast(Ops[1], VTy); + Ops[2] = Builder.CreateBitCast(Ops[2], VTy); Result = Builder.CreateOr(Builder.CreateAnd(Ops[1], Ops[0]), Builder.CreateAnd(Ops[2], Builder.CreateNot(Ops[0]))); + Result = Builder.CreateBitCast(Result, ResultType); break; + } case NEON_BUILTIN_vtbl1: case NEON_BUILTIN_vtbl2: From nicholas at mxc.ca Mon Aug 17 00:37:31 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 17 Aug 2009 05:37:31 -0000 Subject: [llvm-commits] [llvm] r79226 - in /llvm/trunk: lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/2009-08-16-VLA.ll Message-ID: <200908170537.n7H5bVPj028344@zion.cs.uiuc.edu> Author: nicholas Date: Mon Aug 17 00:37:31 2009 New Revision: 79226 URL: http://llvm.org/viewvc/llvm-project?rev=79226&view=rev Log: Don't crash trying to promote VLAs. Added: llvm/trunk/test/Transforms/ScalarRepl/2009-08-16-VLA.ll Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=79226&r1=79225&r2=79226&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Aug 17 00:37:31 2009 @@ -255,9 +255,12 @@ // value cannot be decomposed at all. uint64_t AllocaSize = TD->getTypeAllocSize(AI->getAllocatedType()); + // Do not promote [0 x %struct]. + if (AllocaSize == 0) continue; + // Do not promote any struct whose size is too big. if (AllocaSize > SRThreshold) continue; - + if ((isa(AI->getAllocatedType()) || isa(AI->getAllocatedType())) && // Do not promote any struct into more than "32" separate vars. Added: llvm/trunk/test/Transforms/ScalarRepl/2009-08-16-VLA.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ScalarRepl/2009-08-16-VLA.ll?rev=79226&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ScalarRepl/2009-08-16-VLA.ll (added) +++ llvm/trunk/test/Transforms/ScalarRepl/2009-08-16-VLA.ll Mon Aug 17 00:37:31 2009 @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | opt -scalarrepl -disable-opt + + %struct.Item = type { [4 x i16], %struct.rule* } + %struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 } + %struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* } + %struct.plankMap = type { %struct.list*, i32, %struct.stateMap* } + %struct.list = type { i8*, %struct.list* } + %struct.stateMap = type { i8*, %struct.plank*, i32, i16* } + %struct.plank = type { i8*, %struct.list*, i32 } + %struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] } + %struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* } + %struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** } + %struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* } + %struct.Index_Map = type { i32, %struct.item_set** } + %struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* } + %struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** } + +define void @addHP_2_0() { +bb4.i: + %0 = malloc [0 x %struct.Item] ; <[0 x %struct.Item]*> [#uses=1] + %.sub.i.c.i = getelementptr [0 x %struct.Item]* %0, i32 0, i32 0 ; <%struct.Item*> [#uses=0] + unreachable +} From sabre at nondot.org Mon Aug 17 00:49:09 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 17 Aug 2009 05:49:09 -0000 Subject: [llvm-commits] [llvm] r79227 - in /llvm/trunk: include/llvm/MC/MCStreamer.h include/llvm/MC/MCSymbol.h include/llvm/MC/MCValue.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/MC/MCAsmStreamer.cpp lib/MC/MCNullStreamer.cpp Message-ID: <200908170549.n7H5n96Q029746@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 17 00:49:08 2009 New Revision: 79227 URL: http://llvm.org/viewvc/llvm-project?rev=79227&view=rev Log: change AsmPrinter to switch sections using AsmStreamer instead of doing it directly. This requires const'izing a bunch of stuff that took sections, but this seems like the right semantic thing to do: emitting a label to a section shouldn't mutate the MCSection object itself, for example. Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/include/llvm/MC/MCSymbol.h llvm/trunk/include/llvm/MC/MCValue.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCNullStreamer.cpp Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=79227&r1=79226&r2=79227&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Aug 17 00:49:08 2009 @@ -81,7 +81,7 @@ /// @param Section. /// /// This corresponds to assembler directives like .section, .text, etc. - virtual void SwitchSection(MCSection *Section) = 0; + virtual void SwitchSection(const MCSection *Section) = 0; /// EmitLabel - Emit a label for @param Symbol into the current section. /// Modified: llvm/trunk/include/llvm/MC/MCSymbol.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=79227&r1=79226&r2=79227&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) +++ llvm/trunk/include/llvm/MC/MCSymbol.h Mon Aug 17 00:49:08 2009 @@ -34,7 +34,7 @@ std::string Name; /// Section - The section the symbol is defined in, or null if the symbol /// has not been defined in the associated translation unit. - MCSection *Section; + const MCSection *Section; /// IsTemporary - True if this is an assembler temporary label, which /// typically does not survive in the .o file's symbol table. Usually @@ -55,8 +55,8 @@ void operator=(const MCSymbol&); // DO NOT IMPLEMENT public: - MCSection *getSection() const { return Section; } - void setSection(MCSection *Value) { Section = Value; } + const MCSection *getSection() const { return Section; } + void setSection(const MCSection *S) { Section = S; } bool isExternal() const { return IsExternal; } void setExternal(bool Value) { IsExternal = Value; } Modified: llvm/trunk/include/llvm/MC/MCValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCValue.h?rev=79227&r1=79226&r2=79227&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCValue.h (original) +++ llvm/trunk/include/llvm/MC/MCValue.h Mon Aug 17 00:49:08 2009 @@ -49,7 +49,7 @@ /// /// @result - The value's associated section, or null for external or constant /// values. - MCSection *getAssociatedSection() const { + const MCSection *getAssociatedSection() const { return SymA ? SymA->getSection() : 0; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=79227&r1=79226&r2=79227&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Aug 17 00:49:08 2009 @@ -98,23 +98,18 @@ /// FIXME: Remove support for null sections. /// void AsmPrinter::SwitchToSection(const MCSection *NS) { - // If we're already in this section, we're done. - if (CurrentSection == NS) return; - CurrentSection = NS; - - if (NS == 0) return; - - NS->PrintSwitchToSection(*TAI, O); + // FIXME: Remove support for null sections! + if (NS) + OutStreamer.SwitchSection(NS); } void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); MachineFunctionPass::getAnalysisUsage(AU); AU.addRequired(); - if (ExuberantAsm) { + if (ExuberantAsm) AU.addRequired(); - } } bool AsmPrinter::doInitialization(Module &M) { Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=79227&r1=79226&r2=79227&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Aug 17 00:49:08 2009 @@ -24,7 +24,7 @@ raw_ostream &OS; const TargetAsmInfo &TAI; AsmPrinter *Printer; - MCSection *CurSection; + const MCSection *CurSection; public: MCAsmStreamer(MCContext &Context, raw_ostream &_OS, const TargetAsmInfo &tai, AsmPrinter *_AsmPrinter) @@ -35,7 +35,7 @@ /// @name MCStreamer Interface /// @{ - virtual void SwitchSection(MCSection *Section); + virtual void SwitchSection(const MCSection *Section); virtual void EmitLabel(MCSymbol *Symbol); @@ -98,12 +98,10 @@ truncateToSize(Value.getConstant(), Bytes)); } -void MCAsmStreamer::SwitchSection(MCSection *Section) { +void MCAsmStreamer::SwitchSection(const MCSection *Section) { if (Section != CurSection) { CurSection = Section; - - // FIXME: Needs TargetAsmInfo! - Section->PrintSwitchToSection(*(const TargetAsmInfo*)0, OS); + Section->PrintSwitchToSection(TAI, OS); } } Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=79227&r1=79226&r2=79227&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Mon Aug 17 00:49:08 2009 @@ -26,7 +26,7 @@ /// @name MCStreamer Interface /// @{ - virtual void SwitchSection(MCSection *Section) {} + virtual void SwitchSection(const MCSection *Section) {} virtual void EmitLabel(MCSymbol *Symbol) {} From baldrick at free.fr Mon Aug 17 02:28:02 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 09:28:02 +0200 Subject: [llvm-commits] calling convention support for ARM AAPCS VFP "homogenous aggregates" In-Reply-To: <305d6f60908050315i4d781629wfe2ef4d477aa2891@mail.gmail.com> References: <305d6f60908050315i4d781629wfe2ef4d477aa2891@mail.gmail.com> Message-ID: <4A890682.5060200@free.fr> Hi Sandeep, > Attached is a patch to llvm-gcc to implement passing of homogenous > aggregates via FP registers per the ARM AAPCS VFP variant (a.k.a. hard > float). please indent using spaces and not tabs. Thanks, Duncan. From nicholas at mxc.ca Mon Aug 17 02:32:09 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 17 Aug 2009 07:32:09 -0000 Subject: [llvm-commits] [llvm] r79230 - /llvm/trunk/test/Transforms/SSI/ssiphi.ll Message-ID: <200908170732.n7H7W9c8010145@zion.cs.uiuc.edu> Author: nicholas Date: Mon Aug 17 02:32:08 2009 New Revision: 79230 URL: http://llvm.org/viewvc/llvm-project?rev=79230&view=rev Log: Add a test that shows that SSI is working correctly. Added: llvm/trunk/test/Transforms/SSI/ssiphi.ll Added: llvm/trunk/test/Transforms/SSI/ssiphi.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SSI/ssiphi.ll?rev=79230&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SSI/ssiphi.ll (added) +++ llvm/trunk/test/Transforms/SSI/ssiphi.ll Mon Aug 17 02:32:08 2009 @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | opt -ssi-everything | llvm-dis | FileCheck %s + +declare void @use(i32) +declare i32 @create() + +define i32 @foo() { +entry: + %x = call i32 @create() + %y = icmp slt i32 %x, 10 + br i1 %y, label %T, label %F +T: +; CHECK: SSI_sigma + call void @use(i32 %x) + br label %join +F: +; CHECK: SSI_sigma + call void @use(i32 %x) + br label %join +join: +; CHECK: SSI_phi + ret i32 %x +} From baldrick at free.fr Mon Aug 17 02:48:42 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 09:48:42 +0200 Subject: [llvm-commits] [patch][llvm-gcc] Port -no-canonical-prefixes In-Reply-To: <38a0d8450908160041k33186be4rfa183eee0023ad1e@mail.gmail.com> References: <38a0d8450908160041k33186be4rfa183eee0023ad1e@mail.gmail.com> Message-ID: <4A890B5A.5000203@free.fr> Rafael Espindola wrote: > The llvm-gcc-149702.patch patch is a port of > http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00110.html > > The summary is that with it > ./foo/bar/bin/gcc -c llvm-gcc-149702.patch > will run cc1 with > ./foor/bar/bin/../../libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/cc1 > Instead of > //foor/bar/bin/../../libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/cc1 > > Which is nice in an installation where gcc and cc1 are symbolic links > that point to files > in unrelated directories. > > The original patch was GPL3, but I have permission to port it to GPL2 > to use it on llvm-gcc. > > The llvm-gcc-119366.patch is a dependency since it defines > make_relative_prefix_ignore_links. > The original is GPL2. > > I would like to commit them (after adding the LLVM_LOCAL marks). Is that OK? It looks good to me. Ciao, Duncan. From evan.cheng at apple.com Mon Aug 17 02:53:34 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 17 Aug 2009 07:53:34 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79231 - in /llvm-gcc-4.2/trunk: GNUmakefile build_gcc Message-ID: <200908170753.n7H7rZkX021457@zion.cs.uiuc.edu> Author: evancheng Date: Mon Aug 17 02:53:34 2009 New Revision: 79231 URL: http://llvm.org/viewvc/llvm-project?rev=79231&view=rev Log: More apple style build horribleness. Modified: llvm-gcc-4.2/trunk/GNUmakefile llvm-gcc-4.2/trunk/build_gcc Modified: llvm-gcc-4.2/trunk/GNUmakefile URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/GNUmakefile?rev=79231&r1=79230&r2=79231&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/GNUmakefile (original) +++ llvm-gcc-4.2/trunk/GNUmakefile Mon Aug 17 02:53:34 2009 @@ -33,6 +33,9 @@ RC_ARCHS := ppc i386 HOSTS = $(RC_ARCHS) targets = echo $(RC_ARCHS) +ifeq ($(RC_ProjectName),llvmgcc42_Embedded) +targets += arm +endif TARGETS := $(shell $(targets)) SRCROOT = . Modified: llvm-gcc-4.2/trunk/build_gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=79231&r1=79230&r2=79231&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/build_gcc (original) +++ llvm-gcc-4.2/trunk/build_gcc Mon Aug 17 02:53:34 2009 @@ -171,7 +171,9 @@ echo "Error: $ARM_TOOLROOT directory is not installed" exit 1 fi - if [ "x$ARM_MULTILIB_ARCHS" = "x" ] ; then + if [ "x$RC_ProjectName" = "xllvmgcc42_Embedded" ]; then + ARM_MULTILIB_ARCHS=${ARCH_OPTIONS} + elif [ "x$ARM_MULTILIB_ARCHS" = "x" ] ; then ARM_MULTILIB_ARCHS=`/usr/bin/lipo -info $ARM_SYSROOT/usr/lib/libSystem.dylib | cut -d':' -f 3 | sed -e 's/x86_64//' -e 's/i386//' -e 's/ppc7400//' -e 's/ppc64//' -e 's/^ *//' -e 's/ $//'` fi; if [ "x$ARM_MULTILIB_ARCHS" == "x" ] ; then From mikael.lepisto at tut.fi Mon Aug 17 03:31:27 2009 From: mikael.lepisto at tut.fi (=?ISO-8859-1?Q?Mikael_Lepist=F6?=) Date: Mon, 17 Aug 2009 11:31:27 +0300 Subject: [llvm-commits] [PATCH llvm, clang llvm-gcc] Add TCE targt to LLVM and CLANG support for generating bytecode to TCE architecture. In-Reply-To: <314993E1-B60D-4C47-B14B-9D1577B1348C@apple.com> References: <4A82D63C.9080003@tut.fi> <4A82DF20.4030902@tut.fi> <314993E1-B60D-4C47-B14B-9D1577B1348C@apple.com> Message-ID: <4A89155F.3080108@tut.fi> Chris Lattner wrote: > On Aug 12, 2009, at 8:26 AM, Mikael Lepist? wrote: > >>> Here is patch, which adds TCE target to llvm, llvm-gcc and clang. >>> Hopefully we can moving llvm specific stuff from TCE to llvm >>> reposity step by step. I also added small test to testsuite to >>> check that tce target works as desired. Tests of llvm and clang >>> looks to run fine after the patches. >>> >>> Patch basically makes it possible to start using clang for >>> generating bitcode for TCE system. >>> >>> Mikael Lepist? >>> Tampere University of Technology >>> http://tce.cs.tut.fi >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> Fixed one comment in previous patch and moved configure regeneration >> to separate patch. >> > > Some initial comments: > > +++ lib/Target/TCE/TCETargetAsmInfo.cpp (revision 0) > @@ -0,0 +1,28 @@ > +//===-- TCETargetAsmInfo.cpp - TCE asm properties > ---------------------===// > > Please make sure these lines are exactly 80 columns wide, there are > several examples that aren't. > > In TCETargetAsmInfo, please only specify things that differ from the > default TargetAsmInfo implementation. There is no need to set > CommentSTring to "#", for example and others might go away too. > > +++ lib/Target/TCE/TargetInfo/TCETargetInfo.cpp (revision 0) > @@ -0,0 +1,22 @@ > +//===-- TCETargetInfo.cpp - TCE Target Implementation -----------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > =---------------------------------------------------------------------- > ===// > + > +#include "llvm/Module.h" > +#include "llvm/Target/TargetRegistry.h" > + > > I don't think you need the Module include. Please prune #includes to > the minimum. > > > +class TCESubtarget : public TargetSubtarget { > + > +public: > + > +protected: > > Please tidy this up. I don't think either of these are needed. > TCESubtarget.h shouldn't need to pull in TM.h > > > TCEAsmPrinter.cpp is nice and small, please prune the #includes though. > > TCETargetMachine.cpp: > > +#include > > Never use , this and several other #includes can be removed. > > > > High level question: what value does it add to LLVM to add this > target? The only test that you have shows it doesn't work at all > yet. If this is just a first step, we should probably wait until > after the 2.6 release. > > -Chris > Hi, thanks for the comments. The value of having tce target in llvm is to be able to use clang for generating bitcode with correct integer and floating point sizes and alignments for tce target. So in the best case we can get rid of llvm-gcc cross compiler, which we are currently using for generating the bitcode. I attached patches with trimmed include lists and start comments. I also added some definitions to TCETargetAsmInfo and cleaned up the files a bit. Mikael Lepist? Tampere University of Technology http://tce.cs.tut.fi -------------- next part -------------- A non-text attachment was scrubbed... Name: TCE-llvm-gcc-target-fix.patch Type: text/x-diff Size: 2130 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/aecb6adf/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: TCE-target-rc3.patch Type: text/x-diff Size: 18927 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/aecb6adf/attachment-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: TCE-target-configure-regen.patch Type: text/x-diff Size: 9195 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/aecb6adf/attachment-0002.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: TCE-clang-target-rc3.patch Type: text/x-diff Size: 2884 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/aecb6adf/attachment-0003.bin From rafael.espindola at gmail.com Mon Aug 17 04:08:41 2009 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 17 Aug 2009 09:08:41 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79232 - in /llvm-gcc-4.2/trunk: include/libiberty.h libiberty/make-relative-prefix.c Message-ID: <200908170908.n7H98fYf002885@zion.cs.uiuc.edu> Author: rafael Date: Mon Aug 17 04:08:36 2009 New Revision: 79232 URL: http://llvm.org/viewvc/llvm-project?rev=79232&view=rev Log: Backport of svn commit 119366. This adds make_relative_prefix_ignore_links. The original patch is GPL2. Modified: llvm-gcc-4.2/trunk/include/libiberty.h llvm-gcc-4.2/trunk/libiberty/make-relative-prefix.c Modified: llvm-gcc-4.2/trunk/include/libiberty.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/include/libiberty.h?rev=79232&r1=79231&r2=79232&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/include/libiberty.h (original) +++ llvm-gcc-4.2/trunk/include/libiberty.h Mon Aug 17 04:08:36 2009 @@ -197,6 +197,13 @@ extern char *make_relative_prefix (const char *, const char *, const char *) ATTRIBUTE_MALLOC; +/* Generate a relocated path to some installation directory without + attempting to follow any soft links. Allocates + return value using malloc. */ + +extern char *make_relative_prefix_ignore_links (const char *, const char *, + const char *) ATTRIBUTE_MALLOC; + /* Choose a temporary directory to use for scratch files. */ extern char *choose_temp_base (void) ATTRIBUTE_MALLOC; Modified: llvm-gcc-4.2/trunk/libiberty/make-relative-prefix.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libiberty/make-relative-prefix.c?rev=79232&r1=79231&r2=79232&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/libiberty/make-relative-prefix.c (original) +++ llvm-gcc-4.2/trunk/libiberty/make-relative-prefix.c Mon Aug 17 04:08:36 2009 @@ -1,6 +1,6 @@ /* Relative (relocatable) prefix support. Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2006 Free Software Foundation, Inc. This file is part of libiberty. @@ -217,9 +217,9 @@ If no relative prefix can be found, return NULL. */ -char * -make_relative_prefix (const char *progname, - const char *bin_prefix, const char *prefix) +static char * +make_relative_prefix_1 (const char *progname, const char *bin_prefix, + const char *prefix, const int resolve_links) { char **prog_dirs, **bin_dirs, **prefix_dirs; int prog_num, bin_num, prefix_num; @@ -289,9 +289,14 @@ } } - full_progname = lrealpath (progname); - if (full_progname == NULL) - return NULL; + if ( resolve_links ) + { + full_progname = lrealpath (progname); + if (full_progname == NULL) + return NULL; + } + else + full_progname = strdup(progname); prog_dirs = split_directories (full_progname, &prog_num); bin_dirs = split_directories (bin_prefix, &bin_num); @@ -387,3 +392,33 @@ return ret; } + + +/* Do the full job, including symlink resolution. + This path will find files installed in the same place as the + program even when a soft link has been made to the program + from somwhere else. */ + +char * +make_relative_prefix (progname, bin_prefix, prefix) + const char *progname; + const char *bin_prefix; + const char *prefix; +{ + return make_relative_prefix_1 (progname, bin_prefix, prefix, 1); +} + +/* Make the relative pathname without attempting to resolve any links. + '..' etc may also be left in the pathname. + This will find the files the user meant the program to find if the + installation is patched together with soft links. */ + +char * +make_relative_prefix_ignore_links (progname, bin_prefix, prefix) + const char *progname; + const char *bin_prefix; + const char *prefix; +{ + return make_relative_prefix_1 (progname, bin_prefix, prefix, 0); +} + From eli.friedman at gmail.com Mon Aug 17 04:09:19 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Mon, 17 Aug 2009 02:09:19 -0700 Subject: [llvm-commits] [PATCH llvm, clang llvm-gcc] Add TCE targt to LLVM and CLANG support for generating bytecode to TCE architecture. In-Reply-To: <4A89155F.3080108@tut.fi> References: <4A82D63C.9080003@tut.fi> <4A82DF20.4030902@tut.fi> <314993E1-B60D-4C47-B14B-9D1577B1348C@apple.com> <4A89155F.3080108@tut.fi> Message-ID: 2009/8/17 Mikael Lepist? : > The value of having tce target in llvm is to be able to use clang for > generating bitcode with correct integer and floating point sizes and > alignments for tce ?target. So in the best case we can get rid of llvm-gcc > cross compiler, which we are currently using for generating the bitcode. As this applies to TCE-target-rc3.patch: We generally don't add backend targets until they are at least somewhat usable. We don't want to clutter the tree with unusable and unmaintained targets, and having a somewhat complete target is a sign that you're planning to continue maintaining the target. In particular, adding this before 2.6 branches entails additional work writing the release notes, etc. for a target which is unusable. As this applies to TCE-clang-target-rc3.patch: It's not directly affected by the other patch, but it's hard to justify adding the target to clang when it's not usable by anyone else. In any case, the proper place to submit clang patches is cfe-commits. -Eli From rafael.espindola at gmail.com Mon Aug 17 04:12:43 2009 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 17 Aug 2009 09:12:43 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79233 - in /llvm-gcc-4.2/trunk/gcc: doc/invoke.texi gcc.c Message-ID: <200908170912.n7H9ChPU003399@zion.cs.uiuc.edu> Author: rafael Date: Mon Aug 17 04:12:42 2009 New Revision: 79233 URL: http://llvm.org/viewvc/llvm-project?rev=79233&view=rev Log: A port of http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00110.html. This adds the -no-canonical-prefixes option. It prevents gcc (the driver) from resolving symbolic links when looking for cc1. The original patch is GPL3, but I got permission to relicense it. Modified: llvm-gcc-4.2/trunk/gcc/doc/invoke.texi llvm-gcc-4.2/trunk/gcc/gcc.c Modified: llvm-gcc-4.2/trunk/gcc/doc/invoke.texi URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/invoke.texi?rev=79233&r1=79232&r2=79233&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/doc/invoke.texi (original) +++ llvm-gcc-4.2/trunk/gcc/doc/invoke.texi Mon Aug 17 04:12:42 2009 @@ -175,7 +175,8 @@ @table @emph @item Overall Options @xref{Overall Options,,Options Controlling the Kind of Output}. - at gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol + at gccoptlist{-c -S -E -o @var{file} -combine -no-canonical-prefixes @gol +-pipe -pass-exit-codes @gol @c APPLE LOCAL -ObjC 2001-08-03 --sts ** -ObjC (APPLE ONLY) -ObjC++ (APPLE ONLY) @gol @c APPLE LOCAL begin fat builds @@ -1237,6 +1238,12 @@ Print (on the standard output) a description of target specific command line options for each tool. + at item -no-canonical-prefixes + at opindex no-canonical-prefixes +Do not expand any symbolic links, resolve references to @samp{/../} +or @samp{/./}, or make the path absolute when generating a relative +prefix. + @item --version @opindex version Display the version number and copyrights of the invoked GCC at . Modified: llvm-gcc-4.2/trunk/gcc/gcc.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gcc.c?rev=79233&r1=79232&r2=79233&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/gcc.c (original) +++ llvm-gcc-4.2/trunk/gcc/gcc.c Mon Aug 17 04:12:42 2009 @@ -1190,6 +1190,7 @@ /* LLVM LOCAL end */ {"--machine", "-m", "aj"}, {"--machine-", "-m", "*j"}, + {"--no-canonical-prefixes", "-no-canonical-prefixes", 0}, {"--no-integrated-cpp", "-no-integrated-cpp", 0}, {"--no-line-commands", "-P", 0}, {"--no-precompiled-includes", "-noprecomp", 0}, @@ -3341,6 +3342,10 @@ fputs (_(" -Xlinker Pass on to the linker\n"), stdout); fputs (_(" -combine Pass multiple source files to compiler at once\n"), stdout); fputs (_(" -save-temps Do not delete intermediate files\n"), stdout); + fputs (_("\ + -no-canonical-prefixes Do not canonicalize paths when building relative\n\ + prefixes to other gcc components\n"), stdout); + fputs (_(" -pipe Use pipes rather than intermediate files\n"), stdout); fputs (_(" -time Time the execution of each subprocess\n"), stdout); fputs (_(" -specs= Override built-in specs with the contents of \n"), stdout); @@ -3433,6 +3438,8 @@ int is_modify_target_name; unsigned int j; #endif + char *(*get_relative_prefix) (const char *, const char *, + const char *) = NULL; GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX"); @@ -3519,6 +3526,28 @@ fatal ("couldn't run '%s': %s", new_argv0, xstrerror (errno)); } + /* Convert new-style -- options to old-style. */ + translate_options (&argc, (const char * const **) &argv); + + /* Do language-specific adjustment/addition of flags. */ + lang_specific_driver (&argc, (const char * const **) &argv, + &added_libraries); + + /* Handle any -no-canonical-prefixes flag early, to assign the function + that builds relative prefixes. This function creates default search + paths that are needed later in normal option handling. */ + + for (i = 1; i < argc; i++) + { + if (! strcmp (argv[i], "-no-canonical-prefixes")) + { + get_relative_prefix = make_relative_prefix_ignore_links; + break; + } + } + if (! get_relative_prefix) + get_relative_prefix = make_relative_prefix; + /* Set up the default search paths. If there is no GCC_EXEC_PREFIX, see if we can create it from the pathname specified in argv[0]. */ @@ -3527,11 +3556,12 @@ /* FIXME: make_relative_prefix doesn't yet work for VMS. */ if (!gcc_exec_prefix) { - gcc_exec_prefix = make_relative_prefix (argv[0], standard_bindir_prefix, - standard_exec_prefix); - gcc_libexec_prefix = make_relative_prefix (argv[0], - standard_bindir_prefix, - standard_libexec_prefix); + gcc_exec_prefix = get_relative_prefix (argv[0], + standard_bindir_prefix, + standard_exec_prefix); + gcc_libexec_prefix = get_relative_prefix (argv[0], + standard_bindir_prefix, + standard_libexec_prefix); if (gcc_exec_prefix) putenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL)); } @@ -3542,9 +3572,9 @@ / (which is ignored by make_relative_prefix), so append a program name. */ char *tmp_prefix = concat (gcc_exec_prefix, "gcc", NULL); - gcc_libexec_prefix = make_relative_prefix (tmp_prefix, - standard_exec_prefix, - standard_libexec_prefix); + gcc_libexec_prefix = get_relative_prefix (tmp_prefix, + standard_exec_prefix, + standard_libexec_prefix); free (tmp_prefix); } #else @@ -3674,12 +3704,6 @@ } } - /* Convert new-style -- options to old-style. */ - translate_options (&argc, (const char *const **) &argv); - - /* Do language-specific adjustment/addition of flags. */ - lang_specific_driver (&argc, (const char *const **) &argv, &added_libraries); - /* Scan argv twice. Here, the first time, just count how many switches there will be in their vector, and how many input files in theirs. Here we also parse the switches that cc itself uses (e.g. -v). */ @@ -3891,6 +3915,9 @@ n_infiles += 2; i++; } + else if (strcmp (argv[i], "-no-canonical-prefixes") == 0) + /* Already handled as a special case, so ignored here. */ + ; /* APPLE LOCAL end -weak_* (radar 3235250) */ else if (strcmp (argv[i], "-combine") == 0) { @@ -4224,9 +4251,9 @@ ``make_relative_prefix'' is not compiled for VMS, so don't call it. */ if (target_system_root && gcc_exec_prefix) { - char *tmp_prefix = make_relative_prefix (argv[0], - standard_bindir_prefix, - target_system_root); + char *tmp_prefix = get_relative_prefix (argv[0], + standard_bindir_prefix, + target_system_root); if (tmp_prefix && access_check (tmp_prefix, F_OK) == 0) { target_system_root = tmp_prefix; @@ -4268,6 +4295,8 @@ ; else if (! strncmp (argv[i], "-Wp,", 4)) ; + else if (! strcmp (argv[i], "-no-canonical-prefixes")) + ; else if (! strcmp (argv[i], "-pass-exit-codes")) ; else if (! strcmp (argv[i], "-print-search-dirs")) From pietreka at gmail.com Mon Aug 17 04:42:45 2009 From: pietreka at gmail.com (Artur Pietrek) Date: Mon, 17 Aug 2009 11:42:45 +0200 Subject: [llvm-commits] [llvm] r79065 - /llvm/trunk/lib/Support/FormattedStream.cpp In-Reply-To: <200908150202.n7F22xqb015324@zion.cs.uiuc.edu> References: <200908150202.n7F22xqb015324@zion.cs.uiuc.edu> Message-ID: On Sat, Aug 15, 2009 at 4:02 AM, Dan Gohman wrote: > > -/// ComputeColumn - Examine the current output and figure out which > +/// CountColumns - Examine the given char sequence and figure out which > /// column we end up in after output. > /// > -void formatted_raw_ostream::ComputeColumn() { > +static unsigned CountColumns(unsigned Column, const char *Ptr, size_t > Size) { > // Keep track of the current column by scanning the string for > // special characters > > - // The buffer may have been allocated underneath us. > - if (Scanned == 0 && GetNumBytesInBuffer() != 0) { > - Scanned = begin(); > - } > - > - while (Scanned != end()) { > - ++ColumnScanned; > - if (*Scanned == '\n' || *Scanned == '\r') > - ColumnScanned = 0; > - else if (*Scanned == '\t') > + for (const char *End = Ptr + Size; Ptr != End; ++Ptr) { > + ++Column; > + if (*Ptr == '\n' || *Ptr == '\r') > + Column = 0; > + else if (*Ptr == '\t') > // Assumes tab stop = 8 characters. > - ColumnScanned += (8 - (ColumnScanned & 0x7)) & 0x7; > - ++Scanned; > + Column += (8 - (Column & 0x7)) & 0x7; > } > + > + return Column; > +} Hi all, Is it legal to output Instruction or any Value using formatted stream like this: Out << *Instr; I was using it to print commented LLVM instructions to my assembly to check if I'm translating instructions correctly, but since the change above I get segfault after running my backend. Changing line: for (const char *End = Ptr + Size; Ptr != End; ++Ptr) { to: + for (const char *End = Ptr + Size; Ptr < End; ++Ptr) { helps. Is it bug or I just should not use it that way? Thanks, Artur -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/9c73eec2/attachment.html From lepisto.mikael at gmail.com Mon Aug 17 05:18:39 2009 From: lepisto.mikael at gmail.com (=?ISO-8859-1?Q?Mikael_Lepist=F6?=) Date: Mon, 17 Aug 2009 13:18:39 +0300 Subject: [llvm-commits] [PATCH llvm, clang llvm-gcc] Add TCE targt to LLVM and CLANG support for generating bytecode to TCE architecture. In-Reply-To: References: <4A82D63C.9080003@tut.fi> <4A82DF20.4030902@tut.fi> <314993E1-B60D-4C47-B14B-9D1577B1348C@apple.com> <4A89155F.3080108@tut.fi> Message-ID: <98564F41-4647-44C8-9269-34CC6471FD6E@tut.fi> On 17.8.2009, at 12:09, Eli Friedman wrote: > 2009/8/17 Mikael Lepist? : >> The value of having tce target in llvm is to be able to use clang for >> generating bitcode with correct integer and floating point sizes and >> alignments for tce target. So in the best case we can get rid of >> llvm-gcc >> cross compiler, which we are currently using for generating the >> bitcode. > > As this applies to TCE-target-rc3.patch: We generally don't add > backend targets until they are at least somewhat usable. We don't > want to clutter the tree with unusable and unmaintained targets, and > having a somewhat complete target is a sign that you're planning to > continue maintaining the target. In particular, adding this before > 2.6 branches entails additional work writing the release notes, etc. > for a target which is unusable. > Actually we would liked to add the target to llvm because, otherwise we cannot set correct target triplet and data layout information to bitcode which is generated with llvm-gcc cross-compiler (currently cross-compiler puts just mips data layout and triple even if code is compiled differently). I thought that clang target also would have required tce target to exists in llvm, but looks like I was wrong and that the clang tce target works without it just fine without additions to llvm. Our real target machine in our (publicly available) repository, because parts of the target machine must be compiled as plugin, to meet TCE target processor configuration's register files and instruction set. It is not ready to be imported to llvm because it uses our own libraries for builiding target binary and would cause tce dependency to llvm. It has been maintained since llvm 2.2. > As this applies to TCE-clang-target-rc3.patch: It's not directly > affected by the other patch, but it's hard to justify adding the > target to clang when it's not usable by anyone else. I'm not sure how it would be even possible to make it more usable for anyone else, since the TCE TTA application specific processor is developed by us and all the design tools as well. Design tools are publicly available (MIT licence) and takes program input in llvm bitcode format. So everyone who is developing TCE application specific processors and software for them can use the clang target. > In any case, the > proper place to submit clang patches is cfe-commits. I'll send clang patches there in future :) Basically we can live without llvm patching and continue using llvm- gcc target as we have used before (it's pretending to be mips target) and it's not strictly necessary to try to link clang and llvm-gcc generated code together. But for starting to use clang as our C compiler, we would need the clang patch to be applied. The reason why we would like to start using clang is the address space attribute. Also in future we would like to add or see restricted pointer support. Mikael Lepist? From baldrick at free.fr Mon Aug 17 05:18:35 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 12:18:35 +0200 Subject: [llvm-commits] [llvm] r79027 - /llvm/trunk/include/llvm/Support/IRBuilder.h In-Reply-To: <200908141941.n7EJfoit021865@zion.cs.uiuc.edu> References: <200908141941.n7EJfoit021865@zion.cs.uiuc.edu> Message-ID: <4A892E7B.4000700@free.fr> Hi Owen, > + /// getInt1Ty - Fetch the type representing a single bit missing full stop. Ciao, Duncan. From baldrick at free.fr Mon Aug 17 05:27:50 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 12:27:50 +0200 Subject: [llvm-commits] PATCH: PR4719 - llvm-gcc should not use duplicate definitions of the same inline function In-Reply-To: <889E4DE1-5252-4CE7-8B76-23F776E82D45@apple.com> References: <889E4DE1-5252-4CE7-8B76-23F776E82D45@apple.com> Message-ID: <4A8930A6.1070109@free.fr> Hi, > +/* LLVM LOCAL begin */ > +/* Don't use ill-defined extern-inline-with-non-inline-definition > + */ > +#if 0 > #if GCC_VERSION < 3004 || !defined (__cplusplus) does this mean that llvm-gcc can no longer be built with gcc before gcc-3.4? Also, do you understand why the test checks "defined (__cplusplus)"? > +/* LLVM LOCAL begin */ > +/* Use static inline for exact_log2/floor_log2 */ > + > /* Return log2, or -1 if not exact. */ > -extern int exact_log2 (unsigned HOST_WIDE_INT); > +static inline int exact_log2 (unsigned HOST_WIDE_INT); > > /* Return floor of log2, with -1 for zero. */ > -extern int floor_log2 (unsigned HOST_WIDE_INT); > +static inline int floor_log2 (unsigned HOST_WIDE_INT); Probably these should only be defined if the same test as above holds (GCC_VERSION < 3004 ...). In which case you wouldn't need the static inline changes for this bit. Ciao, Duncan. From deeppatel1987 at gmail.com Mon Aug 17 05:40:12 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Mon, 17 Aug 2009 10:40:12 +0000 Subject: [llvm-commits] calling convention support for ARM AAPCS VFP "homogenous aggregates" In-Reply-To: <4A890682.5060200@free.fr> References: <305d6f60908050315i4d781629wfe2ef4d477aa2891@mail.gmail.com> <4A890682.5060200@free.fr> Message-ID: <305d6f60908170340q21330a8av5df96460d759a101@mail.gmail.com> On Mon, Aug 17, 2009 at 7:28 AM, Duncan Sands wrote: > >> Attached is a patch to llvm-gcc to implement passing of homogenous >> aggregates via FP registers per the ARM AAPCS VFP variant (a.k.a. hard >> float). > > please indent using spaces and not tabs. I've certainly tried when editing files unique to LLVM. I thought that llvm-gcc code was still using the original 8 character tabs? It's easy to see how one could goof that up when working in llvm-gcc without being an emacs user. :) deep From baldrick at free.fr Mon Aug 17 05:44:08 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 12:44:08 +0200 Subject: [llvm-commits] [llvm] r78872 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp In-Reply-To: <200908130028.n7D0Sq09023507@zion.cs.uiuc.edu> References: <200908130028.n7D0Sq09023507@zion.cs.uiuc.edu> Message-ID: <4A893478.7040601@free.fr> Hi Dale, > Symbols with LinkerPrivateLinkage are weak. does this mean that isWeakForLinker and/or mayBeOverridden should return "true" for this linkage type? Ciao, Duncan. From eli.friedman at gmail.com Mon Aug 17 06:39:55 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Mon, 17 Aug 2009 04:39:55 -0700 Subject: [llvm-commits] [PATCH llvm, clang llvm-gcc] Add TCE targt to LLVM and CLANG support for generating bytecode to TCE architecture. In-Reply-To: <98564F41-4647-44C8-9269-34CC6471FD6E@tut.fi> References: <4A82D63C.9080003@tut.fi> <4A82DF20.4030902@tut.fi> <314993E1-B60D-4C47-B14B-9D1577B1348C@apple.com> <4A89155F.3080108@tut.fi> <98564F41-4647-44C8-9269-34CC6471FD6E@tut.fi> Message-ID: 2009/8/17 Mikael Lepist? : > Actually we would liked to add the target to llvm because, otherwise we > cannot set correct target triplet and data layout information to bitcode > which is generated with llvm-gcc cross-compiler (currently cross-compiler > puts just mips data layout and triple even if code is compiled differently). Ah, I wasn't aware of that restriction; that makes the whole thing make a lot more sense, although it's still not pretty. >> As this applies to TCE-clang-target-rc3.patch: It's not directly >> affected by the other patch, but it's hard to justify adding the >> target to clang when it's not usable by anyone else. > > I'm not sure how it would be even possible to make it more usable for anyone > else, since the TCE TTA application specific processor is developed by us > and all the design tools as well. > > Design tools are publicly available (MIT licence) and takes program input in > llvm bitcode format. So everyone who is developing TCE application specific > processors and software for them can use the clang target. Ah, so the tools are publicly available... I missed that bit. Since it isn't too invasive, I guess it's okay... but it would be nice to add a comment with a quick description, because otherwise it isn't obvious why clang supports a target which LLVM can't generate code for. Also, please send it separately to cfe-commits to see if anyone else has comments. -Eli From baldrick at free.fr Mon Aug 17 06:56:36 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 11:56:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79234 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200908171156.n7HBuaiD023367@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 17 06:56:35 2009 New Revision: 79234 URL: http://llvm.org/viewvc/llvm-project?rev=79234&view=rev Log: Revert r78039: it breaks the Ada build due to c_language being undefined. The use of c_dialect_cxx is only valid when building a C-like language. It happens to work with Fortran because an Apple local change to the Fortran front-end makes it define c_language, causing Fortran to be considered C! I think a different kind of solution needs to be found. 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=79234&r1=79233&r2=79234&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Aug 17 06:56:35 2009 @@ -421,11 +421,7 @@ // allows C functions declared as "T foo() {}" to be treated like // "T foo(void) {}" and allows us to handle functions with K&R-style // definitions correctly. - // Don't do this for c++. In c++ "T foo() {}" is not varargs and - // if the user typed "T foo(...)", he probably wants a varargs - // function. This also avoids a warning in instcombine. See - // llvm.org/PR4678 - if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0 && !c_dialect_cxx()) { + if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0) { FTy = TheTypeConverter->ConvertArgListToFnType(TREE_TYPE(FnDecl), DECL_ARGUMENTS(FnDecl), static_chain, From baldrick at free.fr Mon Aug 17 07:20:45 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 12:20:45 -0000 Subject: [llvm-commits] [llvm] r79235 - /llvm/trunk/test/FrontendC++/2009-08-03-Varargs.cpp Message-ID: <200908171220.n7HCKjtB026444@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 17 07:20:45 2009 New Revision: 79235 URL: http://llvm.org/viewvc/llvm-project?rev=79235&view=rev Log: XFAIL this test since the fix was reverted. Modified: llvm/trunk/test/FrontendC++/2009-08-03-Varargs.cpp Modified: llvm/trunk/test/FrontendC++/2009-08-03-Varargs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2009-08-03-Varargs.cpp?rev=79235&r1=79234&r2=79235&view=diff ============================================================================== --- llvm/trunk/test/FrontendC++/2009-08-03-Varargs.cpp (original) +++ llvm/trunk/test/FrontendC++/2009-08-03-Varargs.cpp Mon Aug 17 07:20:45 2009 @@ -1,4 +1,5 @@ // RUN: %llvmgxx %s -S -emit-llvm -o - | grep _Z1az\(\.\.\.\) +// XFAIL: * // PR4678 void a(...) { } From baldrick at free.fr Mon Aug 17 07:25:41 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 14:25:41 +0200 Subject: [llvm-commits] [llvm] r78707 - in /llvm/trunk: include/llvm/Constants.h include/llvm/InstrTypes.h include/llvm/Support/ConstantFolder.h include/llvm/Support/IRBuilder.h include/llvm/Support/NoFolder.h include/llvm/Support/TargetFolder.h lib/VMCore/Constants.cpp In-Reply-To: <200908112020.n7BKKeXj013134@zion.cs.uiuc.edu> References: <200908112020.n7BKKeXj013134@zion.cs.uiuc.edu> Message-ID: <4A894C45.9000402@free.fr> Hi Dan, > + /// CreateNSWAdd - Create an Add operator with the NSW flag set. > + /// > + static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2, > + const Twine &Name = "") { > + BinaryOperator *BO = CreateAdd(V1, V2, Name); > + cast(BO)->setHasNoSignedOverflow(true); > + return BO; > + } the names NSW and NoSignedOverflow are kind of inconsistent. Shouldn't NSW be NSO, or NoSignedOverflow be NoSignedWraparound? Ciao, Duncan. From pietreka at gmail.com Mon Aug 17 07:50:47 2009 From: pietreka at gmail.com (Artur Pietrek) Date: Mon, 17 Aug 2009 14:50:47 +0200 Subject: [llvm-commits] [PATCH] MSIL backend: Sign extension of operands of signed comparison instructions In-Reply-To: References: <1247565082.25975.4.camel@aslstation> Message-ID: On Wed, Jul 15, 2009 at 1:50 PM, Artur Pietrek wrote: > > > On Tue, Jul 14, 2009 at 11:51 AM, Anton Korobeynikov < > anton at korobeynikov.info> wrote: > >> Hi Artur >> >> > This patch adds sign extension of operands in sign comparison. This is >> > needed to get correct result. >> Unfortunately, patch does not apply cleanly for me. Could you please >> resubmit? >> > > I saw a big change in LLVM code. Here it is again. > Hi, Resubmitting that patch. Is it rubbish or just lost between all other mails? ;) Artur -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/5cd5eb16/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: sign_extension_in_int_comparison.patch Type: text/x-patch Size: 4181 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/5cd5eb16/attachment.bin From baldrick at free.fr Mon Aug 17 07:50:49 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 14:50:49 +0200 Subject: [llvm-commits] [llvm] r79139 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp In-Reply-To: <200908152127.n7FLRWJ7014429@zion.cs.uiuc.edu> References: <200908152127.n7FLRWJ7014429@zion.cs.uiuc.edu> Message-ID: <4A895229.3080201@free.fr> > An overhaul of the exception handling code. This is arguably more correct than > what was there before. This doesn't cause any failures in the Ada testsuite, which is usually a good sign for eh stuff :) Ciao, Duncan. From bob.wilson at apple.com Mon Aug 17 09:04:13 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 17 Aug 2009 07:04:13 -0700 Subject: [llvm-commits] calling convention support for ARM AAPCS VFP "homogenous aggregates" In-Reply-To: <305d6f60908170340q21330a8av5df96460d759a101@mail.gmail.com> References: <305d6f60908050315i4d781629wfe2ef4d477aa2891@mail.gmail.com> <4A890682.5060200@free.fr> <305d6f60908170340q21330a8av5df96460d759a101@mail.gmail.com> Message-ID: On Aug 17, 2009, at 3:40 AM, Sandeep Patel wrote: > On Mon, Aug 17, 2009 at 7:28 AM, Duncan Sands wrote: >> >>> Attached is a patch to llvm-gcc to implement passing of homogenous >>> aggregates via FP registers per the ARM AAPCS VFP variant (a.k.a. >>> hard >>> float). >> >> please indent using spaces and not tabs. > > I've certainly tried when editing files unique to LLVM. I thought that > llvm-gcc code was still using the original 8 character tabs? > > It's easy to see how one could goof that up when working in llvm-gcc > without being an emacs user. :) I changed a bunch of the tabs to spaces before I committed the changes, but I left a few tabs in a file that was already using them everywhere. From grosbach at apple.com Mon Aug 17 09:16:06 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 17 Aug 2009 07:16:06 -0700 Subject: [llvm-commits] calling convention support for ARM AAPCS VFP "homogenous aggregates" In-Reply-To: References: <305d6f60908050315i4d781629wfe2ef4d477aa2891@mail.gmail.com> <4A890682.5060200@free.fr> <305d6f60908170340q21330a8av5df96460d759a101@mail.gmail.com> Message-ID: <7357994E-9902-4554-8B49-75612F352FA4@apple.com> On Aug 17, 2009, at 7:04 AM, Bob Wilson wrote: > > On Aug 17, 2009, at 3:40 AM, Sandeep Patel wrote: > >> On Mon, Aug 17, 2009 at 7:28 AM, Duncan Sands >> wrote: >>> >>>> Attached is a patch to llvm-gcc to implement passing of homogenous >>>> aggregates via FP registers per the ARM AAPCS VFP variant (a.k.a. >>>> hard >>>> float). >>> >>> please indent using spaces and not tabs. >> >> I've certainly tried when editing files unique to LLVM. I thought >> that >> llvm-gcc code was still using the original 8 character tabs? >> >> It's easy to see how one could goof that up when working in llvm-gcc >> without being an emacs user. :) > > I changed a bunch of the tabs to spaces before I committed the > changes, but I left a few tabs in a file that was already using them > everywhere. Tab characters. *shudder* From ssen at apple.com Mon Aug 17 09:24:01 2009 From: ssen at apple.com (Shantonu Sen) Date: Mon, 17 Aug 2009 07:24:01 -0700 Subject: [llvm-commits] PATCH: PR4719 - llvm-gcc should not use duplicate definitions of the same inline function In-Reply-To: <4A8930A6.1070109@free.fr> References: <889E4DE1-5252-4CE7-8B76-23F776E82D45@apple.com> <4A8930A6.1070109@free.fr> Message-ID: On Aug 17, 2009, at 3:27 AM, Duncan Sands wrote: > Hi, > >> +/* LLVM LOCAL begin */ >> +/* Don't use ill-defined extern-inline-with-non-inline-definition >> + */ >> +#if 0 >> #if GCC_VERSION < 3004 || !defined (__cplusplus) > > does this mean that llvm-gcc can no longer be built with gcc before > gcc-3.4? Also, do you understand why the test checks > "defined (__cplusplus)"? My understanding of is that "static inline" is universally valid and should work for all versions of gcc and clang. >> +/* LLVM LOCAL begin */ >> +/* Use static inline for exact_log2/floor_log2 */ >> + >> /* Return log2, or -1 if not exact. */ >> -extern int exact_log2 (unsigned HOST_WIDE_INT); >> +static inline int exact_log2 (unsigned >> HOST_WIDE_INT); >> /* Return floor of log2, with -1 for zero. */ >> -extern int floor_log2 (unsigned HOST_WIDE_INT); >> +static inline int floor_log2 (unsigned >> HOST_WIDE_INT); > > Probably these should only be defined if the same test as above holds > (GCC_VERSION < 3004 ...). In which case you wouldn't need the static > inline changes for this bit. No, the original source code has an "extern" prototype unconditionally, and then for newer GCC's adds an extern inline definition underneath it: /* Return floor of log2, with -1 for zero. */ extern int floor_log2 (unsigned HOST_WIDE_INT); /* Inline versions of the above for speed. */ #if GCC_VERSION >= 3004 I guess we could eliminate the "extern" prototype" and unconditionally convert the "extern inline" to a "static inline" in the header. Also, what's the preferred way to delete code that's present in gcc 4.2.1? Is it with #if 0, or delete the code block outright? > Ciao, > > Duncan. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/0d344e3b/attachment.html From baldrick at free.fr Mon Aug 17 09:33:27 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Aug 2009 14:33:27 -0000 Subject: [llvm-commits] [llvm] r79237 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200908171433.n7HEXSsX010430@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 17 09:33:27 2009 New Revision: 79237 URL: http://llvm.org/viewvc/llvm-project?rev=79237&view=rev Log: Don't access the first element of a potentially empty vector (&Formals[0]). With this change llvm-gcc builds with expensive checking enabled for C, C++ and Fortran. While there, change a std::vector into a SmallVector. This is partly gratuitous, but mostly because not all STL vector implementations define the data method (and it should be faster). Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=79237&r1=79236&r2=79237&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Mon Aug 17 09:33:27 2009 @@ -2156,7 +2156,7 @@ /// successful, false if we can't evaluate it. ActualArgs contains the formal /// arguments for the function. static bool EvaluateFunction(Function *F, Constant *&RetVal, - const std::vector &ActualArgs, + const SmallVectorImpl &ActualArgs, std::vector &CallStack, DenseMap &MutatedMemory, std::vector &AllocaTmps) { @@ -2251,14 +2251,14 @@ Function *Callee = dyn_cast(getVal(Values, CI->getOperand(0))); if (!Callee) return false; // Cannot resolve. - std::vector Formals; + SmallVector Formals; for (User::op_iterator i = CI->op_begin() + 1, e = CI->op_end(); i != e; ++i) Formals.push_back(getVal(Values, *i)); - + if (Callee->isDeclaration()) { // If this is a function we can constant fold, do it. - if (Constant *C = ConstantFoldCall(Callee, &Formals[0], + if (Constant *C = ConstantFoldCall(Callee, Formals.data(), Formals.size())) { InstResult = C; } else { @@ -2353,8 +2353,9 @@ // Call the function. Constant *RetValDummy; - bool EvalSuccess = EvaluateFunction(F, RetValDummy, std::vector(), - CallStack, MutatedMemory, AllocaTmps); + bool EvalSuccess = EvaluateFunction(F, RetValDummy, + SmallVector(), CallStack, + MutatedMemory, AllocaTmps); if (EvalSuccess) { // We succeeded at evaluation: commit the result. DEBUG(errs() << "FULLY EVALUATED GLOBAL CTOR FUNCTION '" From brukman+llvm at gmail.com Mon Aug 17 10:20:16 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Mon, 17 Aug 2009 15:20:16 -0000 Subject: [llvm-commits] [TV] r79238 - in /television/trunk: README.txt autoconf/configure.ac Message-ID: <200908171520.n7HFKGDN016159@zion.cs.uiuc.edu> Author: brukman Date: Mon Aug 17 10:20:16 2009 New Revision: 79238 URL: http://llvm.org/viewvc/llvm-project?rev=79238&view=rev Log: * Added -with-poolalloc-{src,obj} switches to pick up DSA from poolalloc * Changed LLVM configure switches format to match those of poolalloc and improve readability: --with-llvm-{src,obj} Modified: television/trunk/README.txt television/trunk/autoconf/configure.ac Modified: television/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/television/trunk/README.txt?rev=79238&r1=79237&r2=79238&view=diff ============================================================================== --- television/trunk/README.txt (original) +++ television/trunk/README.txt Mon Aug 17 10:20:16 2009 @@ -20,19 +20,20 @@ How to compile: -1. You must have wxWindows installed on your system, and wx-config has to be +1. You must have wxWidgets installed on your system, and wx-config has to be in your path. - Make absolutely sure that wxwindows's configure picks up the same + Make absolutely sure that wxWidgets' configure picks up the same C++ compiler that you're using for llvm. Otherwise, you may get weird link errors when trying to link the llvm-tv tool. 2. Configure and compile llvm-tv (you need an LLVM source and build trees): % cd path/to/llvm-tv -% ./configure --with-llvmsrc=[path] --with-llvmobj=[path] - If you're building in llvm/projects/llvm-tv, then you don't need - to specify these --with options. +# If you're building in llvm/projects/llvm-tv, then you don't need +# to specify the --with-llvm-* options. +% ./configure --with-llvm-src=[path] --with-llvm-obj=[path] \ + --with-poolalloc-src=[path] --with-poolalloc-obj=[path] % gmake Example of usage: Modified: television/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/television/trunk/autoconf/configure.ac?rev=79238&r1=79237&r2=79238&view=diff ============================================================================== --- television/trunk/autoconf/configure.ac (original) +++ television/trunk/autoconf/configure.ac Mon Aug 17 10:20:16 2009 @@ -21,8 +21,29 @@ dnl have been specified by the user. By default, assume we've unpacked this dnl project in projects/, as is customary, and look in ../.. dnl for the main LLVM source and object trees. -AC_ARG_WITH(llvmsrc,AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),AC_SUBST(LLVM_SRC,[$withval]),AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) -AC_ARG_WITH(llvmobj,AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),AC_SUBST(LLVM_OBJ,[$withval]),AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) +AC_ARG_WITH(llvm-src, + AS_HELP_STRING([--with-llvm-src], + [Location of LLVM Source Code]), + AC_SUBST(LLVM_SRC, [$withval]), + AC_SUBST(LLVM_SRC, [`cd ${srcdir}/../..; pwd`])) +AC_ARG_WITH(llvm-obj, + AS_HELP_STRING([--with-llvm-obj], + [Location of LLVM Object Code]), + AC_SUBST(LLVM_OBJ, [$withval]), + AC_SUBST(LLVM_OBJ, [`cd ../..; pwd`])) + +dnl We need to get the DataStructure Analysis headers and libraries from +dnl poolalloc, since that is where they live now. +AC_ARG_WITH(poolalloc-src, + AS_HELP_STRING([--with-poolalloc-src], + [Location of PoolAlloc Source Code]), + AC_SUBST(POOLALLOC_SRC, [$withval]), + AC_SUBST(POOLALLOC_SRC, [`cd ${srcdir}/../..; pwd`])) +AC_ARG_WITH(poolalloc-obj, + AS_HELP_STRING([--with-poolalloc-obj], + [Location of PoolAlloc Object Code]), + AC_SUBST(POOLALLOC_OBJ, [$withval]), + AC_SUBST(POOLALLOC_OBJ, [`cd ../..; pwd`])) dnl Create the output files AC_OUTPUT From brukman+llvm at gmail.com Mon Aug 17 10:20:34 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Mon, 17 Aug 2009 15:20:34 -0000 Subject: [llvm-commits] [TV] r79239 - /television/trunk/configure Message-ID: <200908171520.n7HFKY0C016206@zion.cs.uiuc.edu> Author: brukman Date: Mon Aug 17 10:20:34 2009 New Revision: 79239 URL: http://llvm.org/viewvc/llvm-project?rev=79239&view=rev Log: Regenerated configure script. Modified: television/trunk/configure Modified: television/trunk/configure URL: http://llvm.org/viewvc/llvm-project/television/trunk/configure?rev=79239&r1=79238&r2=79239&view=diff ============================================================================== --- television/trunk/configure (original) +++ television/trunk/configure Mon Aug 17 10:20:34 2009 @@ -617,6 +617,8 @@ target_alias LLVM_SRC LLVM_OBJ +POOLALLOC_SRC +POOLALLOC_OBJ LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -1193,8 +1195,10 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-llvmsrc Location of LLVM Source Code - --with-llvmobj Location of LLVM Object Code + --with-llvm-src Location of LLVM Source Code + --with-llvm-obj Location of LLVM Object Code + --with-poolalloc-src Location of PoolAlloc Source Code + --with-poolalloc-obj Location of PoolAlloc Object Code Report bugs to . _ACEOF @@ -1680,9 +1684,9 @@ -# Check whether --with-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then - withval=$with_llvmsrc; LLVM_SRC=$withval +# Check whether --with-llvm-src was given. +if test "${with_llvm_src+set}" = set; then + withval=$with_llvm_src; LLVM_SRC=$withval else LLVM_SRC=`cd ${srcdir}/../..; pwd` @@ -1690,9 +1694,9 @@ fi -# Check whether --with-llvmobj was given. -if test "${with_llvmobj+set}" = set; then - withval=$with_llvmobj; LLVM_OBJ=$withval +# Check whether --with-llvm-obj was given. +if test "${with_llvm_obj+set}" = set; then + withval=$with_llvm_obj; LLVM_OBJ=$withval else LLVM_OBJ=`cd ../..; pwd` @@ -1700,6 +1704,27 @@ fi + +# Check whether --with-poolalloc-src was given. +if test "${with_poolalloc_src+set}" = set; then + withval=$with_poolalloc_src; POOLALLOC_SRC=$withval + +else + POOLALLOC_SRC=`cd ${srcdir}/../..; pwd` + +fi + + +# Check whether --with-poolalloc-obj was given. +if test "${with_poolalloc_obj+set}" = set; then + withval=$with_poolalloc_obj; POOLALLOC_OBJ=$withval + +else + POOLALLOC_OBJ=`cd ../..; pwd` + +fi + + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -2388,11 +2413,13 @@ target_alias!$target_alias$ac_delim LLVM_SRC!$LLVM_SRC$ac_delim LLVM_OBJ!$LLVM_OBJ$ac_delim +POOLALLOC_SRC!$POOLALLOC_SRC$ac_delim +POOLALLOC_OBJ!$POOLALLOC_OBJ$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 41; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 43; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 From gohman at apple.com Mon Aug 17 10:25:05 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 17 Aug 2009 15:25:05 -0000 Subject: [llvm-commits] [llvm] r79240 - in /llvm/trunk/lib/Transforms/Scalar: IndVarSimplify.cpp Reassociate.cpp SCCP.cpp Message-ID: <200908171525.n7HFP685016764@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 17 10:25:05 2009 New Revision: 79240 URL: http://llvm.org/viewvc/llvm-project?rev=79240&view=rev Log: Fix debug output to include a newline after printing a Value, now that Value's operator<< doesn't include one. Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=79240&r1=79239&r2=79240&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Aug 17 10:25:05 2009 @@ -183,7 +183,7 @@ Opcode = ICmpInst::ICMP_EQ; DOUT << "INDVARS: Rewriting loop exit condition to:\n" - << " LHS:" << *CmpIndVar // includes a newline + << " LHS:" << *CmpIndVar << '\n' << " op:\t" << (Opcode == ICmpInst::ICMP_NE ? "!=" : "==") << "\n" << " RHS:\t" << *RHS << "\n"; @@ -273,7 +273,7 @@ Value *ExitVal = Rewriter.expandCodeFor(ExitValue, PN->getType(), Inst); - DOUT << "INDVARS: RLEV: AfterLoopVal = " << *ExitVal + DOUT << "INDVARS: RLEV: AfterLoopVal = " << *ExitVal << '\n' << " LoopVal = " << *Inst << "\n"; PN->setIncomingValue(i, ExitVal); @@ -401,7 +401,7 @@ ++NumInserted; Changed = true; - DOUT << "INDVARS: New CanIV: " << *IndVar; + DOUT << "INDVARS: New CanIV: " << *IndVar << '\n'; // Now that the official induction variable is established, reinsert // the old canonical-looking variable after it so that the IR remains @@ -506,7 +506,7 @@ NewVal->takeName(Op); User->replaceUsesOfWith(Op, NewVal); UI->setOperandValToReplace(NewVal); - DOUT << "INDVARS: Rewrote IV '" << *AR << "' " << *Op + DOUT << "INDVARS: Rewrote IV '" << *AR << "' " << *Op << '\n' << " into = " << *NewVal << "\n"; ++NumRemoved; Changed = true; Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=79240&r1=79239&r2=79240&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Mon Aug 17 10:25:05 2009 @@ -222,7 +222,7 @@ isReassociableOp(RHS, I->getOpcode()) && "Not an expression that needs linearization?"); - DOUT << "Linear" << *LHS << *RHS << *I; + DOUT << "Linear" << *LHS << '\n' << *RHS << '\n' << *I << '\n'; // Move the RHS instruction to live immediately before I, avoiding breaking // dominator properties. @@ -235,7 +235,7 @@ ++NumLinear; MadeChange = true; - DOUT << "Linearized: " << *I; + DOUT << "Linearized: " << *I << '\n'; // If D is part of this expression tree, tail recurse. if (isReassociableOp(I->getOperand(1), I->getOpcode())) @@ -334,10 +334,10 @@ if (I->getOperand(0) != Ops[i].Op || I->getOperand(1) != Ops[i+1].Op) { Value *OldLHS = I->getOperand(0); - DOUT << "RA: " << *I; + DOUT << "RA: " << *I << '\n'; I->setOperand(0, Ops[i].Op); I->setOperand(1, Ops[i+1].Op); - DOUT << "TO: " << *I; + DOUT << "TO: " << *I << '\n'; MadeChange = true; ++NumChanged; @@ -350,9 +350,9 @@ assert(i+2 < Ops.size() && "Ops index out of range!"); if (I->getOperand(1) != Ops[i].Op) { - DOUT << "RA: " << *I; + DOUT << "RA: " << *I << '\n'; I->setOperand(1, Ops[i].Op); - DOUT << "TO: " << *I; + DOUT << "TO: " << *I << '\n'; MadeChange = true; ++NumChanged; } @@ -450,7 +450,7 @@ Sub->replaceAllUsesWith(New); Sub->eraseFromParent(); - DOUT << "Negated: " << *New; + DOUT << "Negated: " << *New << '\n'; return New; } Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=79240&r1=79239&r2=79240&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Mon Aug 17 10:25:05 2009 @@ -262,14 +262,14 @@ // inline void markConstant(LatticeVal &IV, Value *V, Constant *C) { if (IV.markConstant(C)) { - DEBUG(errs() << "markConstant: " << *C << ": " << *V); + DEBUG(errs() << "markConstant: " << *C << ": " << *V << '\n'); InstWorkList.push_back(V); } } inline void markForcedConstant(LatticeVal &IV, Value *V, Constant *C) { IV.markForcedConstant(C); - DEBUG(errs() << "markForcedConstant: " << *C << ": " << *V); + DEBUG(errs() << "markForcedConstant: " << *C << ": " << *V << '\n'); InstWorkList.push_back(V); } @@ -286,7 +286,7 @@ if (Function *F = dyn_cast(V)) errs() << "Function '" << F->getName() << "'\n"; else - errs() << *V); + errs() << *V << '\n'); // Only instructions go on the work list OverdefinedInstWorkList.push_back(V); } @@ -516,7 +516,7 @@ return false; } else { #ifndef NDEBUG - cerr << "Unknown terminator instruction: " << *TI; + cerr << "Unknown terminator instruction: " << *TI << '\n'; #endif llvm_unreachable(0); } @@ -1278,7 +1278,7 @@ Value *I = OverdefinedInstWorkList.back(); OverdefinedInstWorkList.pop_back(); - DEBUG(errs() << "\nPopped off OI-WL: " << *I); + DEBUG(errs() << "\nPopped off OI-WL: " << *I << '\n'); // "I" got into the work list because it either made the transition from // bottom to constant @@ -1296,7 +1296,7 @@ Value *I = InstWorkList.back(); InstWorkList.pop_back(); - DEBUG(errs() << "\nPopped off I-WL: " << *I); + DEBUG(errs() << "\nPopped off I-WL: " << *I << '\n'); // "I" got into the work list because it either made the transition from // bottom to constant @@ -1316,7 +1316,7 @@ BasicBlock *BB = BBWorkList.back(); BBWorkList.pop_back(); - DEBUG(errs() << "\nPopped off BBWL: " << *BB); + DEBUG(errs() << "\nPopped off BBWL: " << *BB << '\n'); // Notify all instructions in this basic block that they are newly // executable. From brukman+llvm at gmail.com Mon Aug 17 10:26:32 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Mon, 17 Aug 2009 15:26:32 -0000 Subject: [llvm-commits] [TV] r79241 - in /television/trunk: ./ lib/Snapshot/ tools/llvm-tv/ Message-ID: <200908171526.n7HFQWl9016974@zion.cs.uiuc.edu> Author: brukman Date: Mon Aug 17 10:26:31 2009 New Revision: 79241 URL: http://llvm.org/viewvc/llvm-project?rev=79241&view=rev Log: * Added a couple wxString utility functions * Updated usage of LLVM and wxWidgets APIs to fix the build Added: television/trunk/tools/llvm-tv/wxUtils.cpp television/trunk/tools/llvm-tv/wxUtils.h Modified: television/trunk/Makefile.common television/trunk/Makefile.config.in television/trunk/lib/Snapshot/Makefile television/trunk/tools/llvm-tv/CodeViewer.cpp television/trunk/tools/llvm-tv/GraphPrinters.cpp television/trunk/tools/llvm-tv/Makefile television/trunk/tools/llvm-tv/PictureFrame.cpp television/trunk/tools/llvm-tv/PictureFrame.h television/trunk/tools/llvm-tv/TVApplication.cpp television/trunk/tools/llvm-tv/TVApplication.h television/trunk/tools/llvm-tv/TVFrame.cpp television/trunk/tools/llvm-tv/TVSnapshot.cpp television/trunk/tools/llvm-tv/TVSnapshot.h television/trunk/tools/llvm-tv/TVSnapshotList.cpp television/trunk/tools/llvm-tv/TVSnapshotList.h television/trunk/tools/llvm-tv/TVTextCtrl.h television/trunk/tools/llvm-tv/TVTreeItem.cpp Modified: television/trunk/Makefile.common URL: http://llvm.org/viewvc/llvm-project/television/trunk/Makefile.common?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/Makefile.common (original) +++ television/trunk/Makefile.common Mon Aug 17 10:26:31 2009 @@ -16,3 +16,18 @@ # Include LLVM's Master Makefile. # include $(LLVM_SRC_ROOT)/Makefile.rules + +# Make sure we can access PoolAlloc's headers and libraries +PALibDir = $(POOLALLOC_OBJ_ROOT)/$(BuildMode)/lib +CPP.Flags += -I$(POOLALLOC_SRC_ROOT)/include +LD.Flags += -L$(PALibDir) + +# Link in PoolAlloc libraries +ifdef PALIBS +PALibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(PALIBS))) +PALibsOptions := $(patsubst %.o, $(PALibDir)/%.o, $(PALibsOptions)) +PAUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(PALIBS))) +PALibsPaths := $(addprefix $(PALibDir)/,$(PAUsedLibs)) + +ExtraLibs += $(PALibsPaths) +endif Modified: television/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/television/trunk/Makefile.config.in?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/Makefile.config.in (original) +++ television/trunk/Makefile.config.in Mon Aug 17 10:26:31 2009 @@ -10,17 +10,17 @@ PROJECT_NAME = @PACKAGE_NAME@ PROJ_VERSION = @PACKAGE_VERSION@ -# # Set this variable to the top of the LLVM source tree. -# LLVM_SRC_ROOT = @LLVM_SRC@ -# # Set this variable to the top level directory where LLVM was built # (this is *not* the same as OBJ_ROOT as defined in LLVM's Makefile.config). -# LLVM_OBJ_ROOT = @LLVM_OBJ@ +# PoolAlloc source and object directories. +POOLALLOC_SRC_ROOT = @POOLALLOC_SRC@ +POOLALLOC_OBJ_ROOT = @POOLALLOC_OBJ@ + # Set the directory root of this project's source files PROJ_SRC_ROOT := $(subst //,/, at abs_top_srcdir@) @@ -33,7 +33,7 @@ # Include LLVM's Master Makefile. include $(LLVM_OBJ_ROOT)/Makefile.config -#Set SourceDir for backwards compatbility. +# Set SourceDir for backwards compatbility. ifndef SourceDir SourceDir=$(PROJ_SRC_DIR) endif Modified: television/trunk/lib/Snapshot/Makefile URL: http://llvm.org/viewvc/llvm-project/television/trunk/lib/Snapshot/Makefile?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/lib/Snapshot/Makefile (original) +++ television/trunk/lib/Snapshot/Makefile Mon Aug 17 10:26:31 2009 @@ -1,5 +1,6 @@ LEVEL = ../.. LIBRARYNAME = LLVMTVSnapshot +BUILD_ARCHIVE = 1 SHARED_LIBRARY = 1 include $(LEVEL)/Makefile.common Modified: television/trunk/tools/llvm-tv/CodeViewer.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/CodeViewer.cpp?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/CodeViewer.cpp (original) +++ television/trunk/tools/llvm-tv/CodeViewer.cpp Mon Aug 17 10:26:31 2009 @@ -6,6 +6,7 @@ #include "llvm/Instruction.h" #include "llvm/Value.h" #include "llvm/ADT/StringExtras.h" +#include #include #include #include Modified: television/trunk/tools/llvm-tv/GraphPrinters.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/GraphPrinters.cpp?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/GraphPrinters.cpp (original) +++ television/trunk/tools/llvm-tv/GraphPrinters.cpp Mon Aug 17 10:26:31 2009 @@ -14,12 +14,12 @@ // //===----------------------------------------------------------------------===// +#include "dsa/DSGraph.h" +#include "dsa/DataStructure.h" +#include "llvm/Analysis/CallGraph.h" #include "llvm/Function.h" #include "llvm/Pass.h" #include "llvm/Value.h" -#include "llvm/Analysis/CallGraph.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/Support/GraphWriter.h" #include "llvm/Support/raw_ostream.h" #include @@ -51,7 +51,9 @@ return "Call Graph"; } - static std::string getNodeLabel(CallGraphNode *Node, CallGraph *Graph) { + static std::string getNodeLabel(CallGraphNode *Node, + CallGraph *Graph, + bool ShortName) { if (Node->getFunction()) return ((Value*)Node->getFunction())->getName(); else @@ -62,21 +64,27 @@ namespace { struct CallGraphPrinter : public ModulePass { + CallGraphPrinter() : ModulePass(&ID) {} + virtual bool runOnModule(Module &M) { WriteGraphToFile(std::cerr, "callgraph", &getAnalysis()); return false; } - void print(std::ostream &OS) const {} + //void print(std::ostream &OS) const {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.setPreservesAll(); } + + static const char ID; }; - RegisterAnalysis P2("print-callgraph", - "Print Call Graph to 'dot' file"); + const char CallGraphPrinter::ID = 0; + + RegisterPass P2("print-callgraph", + "Print Call Graph to 'dot' file"); } //===----------------------------------------------------------------------===// @@ -91,58 +99,70 @@ virtual std::string getFilename() = 0; public: + DSModulePrinter() : ModulePass(&ID) {} + bool runOnModule(Module &M) { DSType *DS = &getAnalysis(); std::string File = getFilename(); std::ofstream of(File.c_str()); if (of.good()) { - DS->getGlobalsGraph().print(of); + DS->getGlobalsGraph()->print(of); of.close(); } else errs() << "Error writing to " << File << "!\n"; return false; } - void print(std::ostream &os) const {} + //void print(std::ostream &os) const {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.template addRequired(); AU.setPreservesAll(); } + + static char ID; }; template + char DSModulePrinter::ID; + + template class DSFunctionPrinter : public ModulePass { protected: Function *F; virtual std::string getFilename(Function &F) = 0; public: - DSFunctionPrinter(Function *_F) : F(_F) {} + DSFunctionPrinter(Function *_F) : ModulePass(&ID), F(_F) {} bool runOnModule(Module &M) { DSType *DS = &getAnalysis(); std::string File = getFilename(*F); std::ofstream of(File.c_str()); if (of.good()) { - if (DS->hasGraph(*F)) { - DS->getDSGraph(*F).print(of); + if (DS->hasDSGraph(*F)) { + DS->getDSGraph(*F)->print(of); of.close(); } else // Can be more creative and print the analysis name here - std::cerr << "No DSGraph for: " << F->getName() << "\n"; + errs() << "No DSGraph for: " << F->getName() << "\n"; } else - std::cerr << "Error writing to " << File << "!\n"; + errs() << "Error writing to " << File << "!\n"; return false; } - void print(std::ostream &os) const {} + //void print(std::ostream &os) const {} void getAnalysisUsage(AnalysisUsage &AU) const { AU.template addRequired(); AU.setPreservesAll(); } + + static const char ID; }; + + template + const char DSFunctionPrinter::ID = 0; } //===----------------------------------------------------------------------===// @@ -156,7 +176,7 @@ struct BUFunctionPrinter : public DSFunctionPrinter { BUFunctionPrinter(Function *F) : DSFunctionPrinter(F) {} std::string getFilename(Function &F) { - return "buds." + F.getName() + ".dot"; + return "buds." + F.getName().str() + ".dot"; } }; } @@ -172,7 +192,7 @@ struct TDFunctionPrinter : public DSFunctionPrinter { TDFunctionPrinter(Function *F) : DSFunctionPrinter(F) {} std::string getFilename(Function &F) { - return "tdds." + F.getName() + ".dot"; + return "tdds." + F.getName().str() + ".dot"; } }; } @@ -189,7 +209,7 @@ LocalFunctionPrinter(Function *F) : DSFunctionPrinter(F) {} std::string getFilename(Function &F) { - return "localds." + F.getName() + ".dot"; + return "localds." + F.getName().str() + ".dot"; } }; } Modified: television/trunk/tools/llvm-tv/Makefile URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/Makefile?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/Makefile (original) +++ television/trunk/tools/llvm-tv/Makefile Mon Aug 17 10:26:31 2009 @@ -1,14 +1,16 @@ LEVEL = ../.. TOOLNAME = llvm-tv -LLVMLIBS = LLVMAnalysis.a LLVMBCReader LLVMBCWriter LLVMDataStructure \ - LLVMipa.a LLVMSupport.a LLVMTarget.a LLVMCore LLVMTransformUtils.a \ - LLVMSystem.a LLVMbzip2 +LLVMLIBS = LLVMAnalysis.a LLVMBitReader.a LLVMBitWriter.a \ + LLVMipa.a LLVMSupport.a LLVMTarget.a LLVMCore.a \ + LLVMTransformUtils.a LLVMSupport.a LLVMSystem.a -# note: delete when FileUtils is assimilated into libsupport -USEDLIBS = LLVMTVSnapshot +USEDLIBS = LLVMTVSnapshot.a -CPPFLAGS = $(shell wx-config --cflags) -TOOLLINKOPTSB = $(shell wx-config --libs) +# LLVMDataStructure.a comes from PoolAlloc, not LLVM proper. +PALIBS = LLVMDataStructure.a + +CPPFLAGS = $(shell wx-config --cxxflags) -fno-strict-aliasing +TOOLLINKOPTSB = $(shell wx-config --debug=yes --libs) WXDIR = $(shell wx-config --prefix) WXLIB = $(WXDIR)/lib @@ -17,14 +19,16 @@ all :: $(LLVMToolDir)/llvm-tv.exe \ $(LLVMToolDir)/opt-snap -LLVMTV = $(PROJ_OBJ_ROOT)/Debug/bin/llvm-tv +LLVMTV = $(PROJ_OBJ_ROOT)/$(BuildMode)/bin/llvm-tv $(LLVMToolDir)/llvm-tv.exe: Makefile - echo exec env LD_LIBRARY_PATH=$(WXLIB):\$$LD_LIBRARY_PATH $(LLVMTV) \ - "2&>1 > /dev/null" > $@ + echo "Creating llvm-tv.exe script" + echo exec env LD_LIBRARY_PATH=$(WXLIB):$(LibDir):\$$LD_LIBRARY_PATH $(LLVMTV) \ + > $@ chmod u+x $@ $(LLVMToolDir)/opt-snap: Makefile + echo "Creating opt-snap script" echo exec env LD_LIBRARY_PATH=$(WXLIB):\$$LD_LIBRARY_PATH \ OPTPASSES=\"$$\*\" opt -load=$(LibDir)/libLLVMTVSnapshot.so $$\* > $@ chmod u+x $@ Modified: television/trunk/tools/llvm-tv/PictureFrame.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/PictureFrame.cpp?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/PictureFrame.cpp (original) +++ television/trunk/tools/llvm-tv/PictureFrame.cpp Mon Aug 17 10:26:31 2009 @@ -3,12 +3,11 @@ // PictureFrame implementation -bool PictureFrame::OnClose (wxCloseEvent &event) { +void PictureFrame::OnClose(wxCloseEvent &event) { myApp->GoodbyeFrom (this); - Destroy (); - return true; + Destroy(); } -BEGIN_EVENT_TABLE (PictureFrame, wxFrame) - EVT_CLOSE (PictureFrame::OnClose) -END_EVENT_TABLE () +BEGIN_EVENT_TABLE(PictureFrame, wxFrame) + EVT_CLOSE(PictureFrame::OnClose) +END_EVENT_TABLE() Modified: television/trunk/tools/llvm-tv/PictureFrame.h URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/PictureFrame.h?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/PictureFrame.h (original) +++ television/trunk/tools/llvm-tv/PictureFrame.h Mon Aug 17 10:26:31 2009 @@ -1,10 +1,10 @@ //===-- PictureFrame.h - Window containing PictureCanvas ---------*- C++ -*-==// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // Window container for PictureCanvas objects. @@ -23,17 +23,18 @@ /// class PictureFrame : public wxFrame { TVApplication *myApp; - void setupAppearance () { - SetSize (wxRect (200, 200, 300, 300)); - Show (TRUE); + void setupAppearance() { + SetSize(wxRect(200, 200, 300, 300)); + Show(TRUE); } public: - PictureFrame (TVApplication *app, const char *windowTitle = "") - : wxFrame (NULL, -1, windowTitle), myApp (app) { + PictureFrame(TVApplication *app, const char *windowTitle = "") + : wxFrame (NULL, -1, wxString(windowTitle, wxConvUTF8)), myApp (app) { setupAppearance (); } - bool OnClose (wxCloseEvent &event); - DECLARE_EVENT_TABLE () + void OnClose(wxCloseEvent &event); + + DECLARE_EVENT_TABLE() }; #endif // PICTUREFRAME_H Modified: television/trunk/tools/llvm-tv/TVApplication.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVApplication.cpp?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVApplication.cpp (original) +++ television/trunk/tools/llvm-tv/TVApplication.cpp Mon Aug 17 10:26:31 2009 @@ -5,10 +5,13 @@ //===----------------------------------------------------------------------===// #include "CodeViewer.h" -#include "TVApplication.h" #include "TVFrame.h" #include "llvm-tv/Support/FileUtils.h" #include "llvm-tv/Config.h" +#undef _DEBUG +#undef __WXDEBUG__ +#include "TVApplication.h" +#include "wxUtils.h" #include #include #include @@ -35,32 +38,32 @@ /// FatalErrorBox - pop up an error message and quit. /// void FatalErrorBox (const std::string msg) { - wxMessageBox(msg.c_str (), "Fatal Error", wxOK | wxICON_ERROR); + wxMessageBox(wxS(msg), wxT("Fatal Error"), wxOK | wxICON_ERROR); exit (1); } static void setUpMenus (wxFrame *frame) { wxMenuBar *menuBar = new wxMenuBar (); - wxMenu *fileMenu = new wxMenu ("", 0); - fileMenu->Append (wxID_OPEN, "Add module..."); - fileMenu->Append (LLVM_TV_REFRESH, "Refresh list"); - fileMenu->Append (wxID_EXIT, "Quit"); - menuBar->Append (fileMenu, "File"); - - wxMenu *viewMenu = new wxMenu ("", 0); - viewMenu->Append (LLVM_TV_CALLGRAPHVIEW, "View call graph"); - viewMenu->Append (LLVM_TV_CFGVIEW, "View control-flow graph"); - viewMenu->Append (LLVM_TV_BUDS_VIEW, "View BU datastructure graph"); - viewMenu->Append (LLVM_TV_TDDS_VIEW, "View TD datastructure graph"); - viewMenu->Append (LLVM_TV_LOCALDS_VIEW, "View Local datastructure graph"); - viewMenu->Append (LLVM_TV_CODEVIEW, "View code (interactive)"); - menuBar->Append (viewMenu, "View"); - - wxMenu *helpMenu = new wxMenu ("", 0); - helpMenu->Append (wxID_HELP_CONTENTS, "Help with LLVM-TV"); - helpMenu->Append (wxID_ABOUT, "About LLVM-TV"); - menuBar->Append (helpMenu, "Help"); + wxMenu *fileMenu = new wxMenu (wxT(""), 0); + fileMenu->Append (wxID_OPEN, wxT("Add module...")); + fileMenu->Append (LLVM_TV_REFRESH, wxT("Refresh list")); + fileMenu->Append (wxID_EXIT, wxT("Quit")); + menuBar->Append (fileMenu, wxT("File")); + + wxMenu *viewMenu = new wxMenu (wxT(""), 0); + viewMenu->Append (LLVM_TV_CALLGRAPHVIEW, wxT("View call graph")); + viewMenu->Append (LLVM_TV_CFGVIEW, wxT("View control-flow graph")); + viewMenu->Append (LLVM_TV_BUDS_VIEW, wxT("View BU datastructure graph")); + viewMenu->Append (LLVM_TV_TDDS_VIEW, wxT("View TD datastructure graph")); + viewMenu->Append (LLVM_TV_LOCALDS_VIEW, wxT("View Local datastructure graph")); + viewMenu->Append (LLVM_TV_CODEVIEW, wxT("View code (interactive)")); + menuBar->Append (viewMenu, wxT("View")); + + wxMenu *helpMenu = new wxMenu (wxT(""), 0); + helpMenu->Append (wxID_HELP_CONTENTS, wxT("Help with LLVM-TV")); + helpMenu->Append (wxID_ABOUT, wxT("About LLVM-TV")); + menuBar->Append (helpMenu, wxT("Help")); frame->SetMenuBar (menuBar); } Modified: television/trunk/tools/llvm-tv/TVApplication.h URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVApplication.h?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVApplication.h (original) +++ television/trunk/tools/llvm-tv/TVApplication.h Mon Aug 17 10:26:31 2009 @@ -8,7 +8,7 @@ #define TVAPPLICATION_H #include "TVSnapshotList.h" -#include "wx/wx.h" +#include #include #include Modified: television/trunk/tools/llvm-tv/TVFrame.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVFrame.cpp?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVFrame.cpp (original) +++ television/trunk/tools/llvm-tv/TVFrame.cpp Mon Aug 17 10:26:31 2009 @@ -10,10 +10,14 @@ #include "DSAGraphDrawer.h" #include "PictureFrame.h" #include "TVApplication.h" -#include "TVFrame.h" #include "TVTextCtrl.h" #include "TVTreeItem.h" +#undef _DEBUG +#undef __WXDEBUG__ +#include "TVFrame.h" +#include "wxUtils.h" #include "llvm-tv/Config.h" +#include "llvm/System/Path.h" #include #include #include @@ -25,7 +29,7 @@ const wxPoint& pos, const wxSize& size, long style) : wxTreeCtrl(parent, id, pos, size, style), myFrame (frame) { - wxTreeItemId rootId = AddRoot("Snapshots", -1, -1,TVTreeRootItem::instance()); + AddRoot(wxT("Snapshots"), -1, -1, TVTreeRootItem::instance()); } /// AddSnapshotsToTree - Given a list of snapshots the tree is populated @@ -35,19 +39,19 @@ for (TVSnapshotList::iterator I = list->begin(), E = list->end(); I != E; ++I) { // Get the Module associated with this snapshot and add it to the tree - Module *M = I->getModule(); - wxTreeItemId id = AppendItem(rootId, I->label(), -1, -1, - new TVTreeModuleItem(I->label(), M)); + Module *M = (*I)->getModule(); + wxTreeItemId id = AppendItem(rootId, wxS((*I)->label()), -1, -1, + new TVTreeModuleItem(wxS((*I)->label()), M)); // Loop over functions in the module and add them to the tree as children for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) { Function *F = I; - if (!F->isExternal()) { - const char *FuncName = F->getName().c_str(); + if (!F->isDeclaration()) { + wxString FuncName = wxS(F->getName().str()); AppendItem(id, FuncName, -1, -1, new TVTreeFunctionItem(FuncName, I)); } } - } + } } /// updateSnapshotList - Update the tree with the current snapshot list @@ -80,8 +84,8 @@ void TVTextCtrl::displayItem (TVTreeItemData *item) { std::ostringstream Out; item->print (Out); - myTextCtrl->SetValue (""); - myTextCtrl->AppendText (Out.str ().c_str ()); + myTextCtrl->SetValue (wxT("")); + myTextCtrl->AppendText (wxS(Out.str ())); myTextCtrl->ShowPosition (0); myTextCtrl->SetInsertionPoint (0); } @@ -100,17 +104,17 @@ } void TVFrame::refreshSnapshotList () { - if (!myApp->getSnapshotList()->refreshList()) - FatalErrorBox ("trying to open directory " + myApp->getSnapshotList()->getSnapshotDirName() + ": " - + strerror(errno)); + FatalErrorBox ("trying to open directory " + + myApp->getSnapshotList()->getSnapshotDirName() + ": " + + strerror(errno)); if (myTreeCtrl != 0) myTreeCtrl->updateSnapshotList(myApp->getSnapshotList()); } void TVFrame::initializeSnapshotListAndView () { refreshSnapshotList (); - SetStatusText ("Snapshot list has been loaded."); + SetStatusText (wxT("Snapshot list has been loaded.")); } //==------------------------------------------------------------------------==// @@ -130,7 +134,7 @@ displayers.resize (1 + pageIndex); displayers[pageIndex] = displayer; return AddPage (displayer->getWindow (), - displayer->getDisplayTitle (0).c_str (), true); + wxS(displayer->getDisplayTitle (0)), true); } void TVNotebook::OnSelChanged (wxNotebookEvent &event) { @@ -146,16 +150,17 @@ //==------------------------------------------------------------------------==// -static const wxString Explanation - ("Click on a Module or Function in the left-hand pane\n" - "to display its code in the right-hand pane. Then, you\n" - "can choose from the View menu to see graphical code views.\n"); +static const wxString Explanation( + "Click on a Module or Function in the left-hand pane\n" + "to display its code in the right-hand pane. Then, you\n" + "can choose from the View menu to see graphical code views.\n", + wxConvUTF8); /// TVFrame constructor - used to set up typical appearance of visualizer's /// top-level window. /// TVFrame::TVFrame (TVApplication *app, const char *title) - : wxFrame (NULL, -1, title), myApp (app) { + : wxFrame (NULL, -1, wxS(title)), myApp (app) { // Set up appearance CreateStatusBar (); SetSize (wxRect (100, 100, 500, 200)); @@ -184,7 +189,7 @@ /// OnHelp - display the help dialog /// void TVFrame::OnHelp (wxCommandEvent &event) { - wxMessageBox (Explanation, "Help with LLVM-TV"); + wxMessageBox (Explanation, wxT("Help with LLVM-TV")); } /// OnExit - respond to a request to exit the program. @@ -196,10 +201,11 @@ /// OnExit - respond to a request to display the About box. /// void TVFrame::OnAbout (wxCommandEvent &event) { - wxMessageBox("LLVM Visualization Tool\n\n" - "By Misha Brukman, Tanya Brethour, and Brian Gaeke\n" - "Copyright (C) 2004 University of Illinois at Urbana-Champaign\n" - "http://llvm.cs.uiuc.edu", "About LLVM-TV"); + wxMessageBox(wxT("LLVM Visualization Tool\n\n" + "By Misha Brukman, Tanya Brethour, and Brian Gaeke\n" + "Copyright (C) 2004 University of Illinois at Urbana-Champaign\n" + "http://llvm.cs.uiuc.edu"), + wxT("About LLVM-TV")); } /// OnRefresh - respond to a request to refresh the list @@ -209,13 +215,20 @@ } void TVFrame::OnOpen (wxCommandEvent &event) { - wxFileDialog d (this, "Choose a bytecode file to display"); + wxFileDialog d (this, wxT("Choose a bytecode file to display")); int result = d.ShowModal (); if (result == wxID_CANCEL) return; // FIXME: the rest of this method can be moved into the "snapshots // list" object - std::string command = std::string("cp ") + std::string(d.GetPath ().c_str ()) + " " + snapshotsPath; - system (command.c_str ()); + llvm::sys::Path source(std::string(d.GetPath().mb_str())); + llvm::sys::Path dest(snapshotsPath); + dest.appendComponent(source.getLast()); + std::string ErrMsg; + llvm::sys::CopyFile(dest, source, &ErrMsg); + if (!ErrMsg.empty()) { + errs() << "Error copying bitcode file to snapshots dir: " << ErrMsg << "\n"; + return; + } refreshSnapshotList (); } @@ -231,7 +244,7 @@ PictureFrame *wind = new PictureFrame (this); allMyWindows.push_back (wind); ItemDisplayer *drawer = new Grapher (wind); - wind->SetTitle (drawer->getDisplayTitle (item).c_str ()); + wind->SetTitle (wxS(drawer->getDisplayTitle (item))); allMyDisplayers.push_back (drawer); drawer->displayItem (item); } Modified: television/trunk/tools/llvm-tv/TVSnapshot.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVSnapshot.cpp?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVSnapshot.cpp (original) +++ television/trunk/tools/llvm-tv/TVSnapshot.cpp Mon Aug 17 10:26:31 2009 @@ -1,13 +1,38 @@ +//===- TVSnapshots.cpp - Read bytecode file -------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// +//===----------------------------------------------------------------------===// + #include "TVSnapshot.h" -#include "llvm/Bytecode/Reader.h" +#include "llvm/Bitcode/ReaderWriter.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm-tv/Config.h" +#include "llvm/Support/raw_ostream.h" +#include using namespace llvm; void TVSnapshot::readBytecodeFile () { - std::string errorStr; - M = ParseBytecodeFile (filename, &errorStr); - if (!M) - throw std::string ("Error reading bytecode from '" + filename + "': " - + errorStr); -} + LLVMContext &Context = getGlobalContext(); + std::string ErrorMsg; + std::auto_ptr Buffer(MemoryBuffer::getFile(filename.c_str(), + &ErrorMsg)); + if (Buffer.get()) { + M = ParseBitcodeFile(Buffer.get(), Context, &ErrorMsg); + } else { + errs() << filename << ": could not load into memory.\n"; + errs() << "Reason: " << ErrorMsg << "\n"; + return; + } + if (0 == M) { + errs() << filename << ": bitcode didn't read correctly.\n"; + errs() << "Reason: " << ErrorMsg << "\n"; + } +} Modified: television/trunk/tools/llvm-tv/TVSnapshot.h URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVSnapshot.h?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVSnapshot.h (original) +++ television/trunk/tools/llvm-tv/TVSnapshot.h Mon Aug 17 10:26:31 2009 @@ -23,10 +23,13 @@ void readBytecodeFile (); void fixLabel () { myLabel = basename ((char*)myLabel.c_str ()) ; } public: - //TVSnapshot () : M (0), filename (), myLabel (filename) { } - TVSnapshot (const std::string &_name) : M (0), filename (_name), myLabel (filename) { fixLabel(); } - TVSnapshot (const char *_name) : M (0), filename (_name), myLabel (filename) { fixLabel(); } - const char *label () const { return myLabel.c_str (); } + explicit TVSnapshot (const std::string &_name) + : M (0), filename (_name), myLabel (filename) { fixLabel(); } + explicit TVSnapshot (const char *_name) + : M (0), filename (_name), myLabel (filename) { fixLabel(); } + ~TVSnapshot() { delete M; } + + const char *label () const { return myLabel.c_str (); } unsigned getTimestamp () const { return (unsigned) strtol (label(), 0, 0); } bool operator < (const TVSnapshot &s) const { return getTimestamp () < s.getTimestamp (); Modified: television/trunk/tools/llvm-tv/TVSnapshotList.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVSnapshotList.cpp?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVSnapshotList.cpp (original) +++ television/trunk/tools/llvm-tv/TVSnapshotList.cpp Mon Aug 17 10:26:31 2009 @@ -5,37 +5,53 @@ //===----------------------------------------------------------------------===// #include "TVSnapshotList.h" +#include "llvm/System/Path.h" +#include "llvm/Support/raw_ostream.h" #include +#include +#include +TVSnapshotList::~TVSnapshotList() { + for (std::vector::iterator i = mySnapshotList.begin(), + e = mySnapshotList.end(); i != e; ++i) { + delete *i; + } + mySnapshotList.clear(); +} -//Each time this function is called the directory is rescanned -//for any new snapshots +// Each time this function is called the directory is rescanned +// for any new snapshots. bool TVSnapshotList::refreshList() { - // re-load the list of snapshots - const char *directoryName = mySnapshotDirName.c_str(); - clearList(); - DIR *d = opendir(directoryName); - if (!d) - return false; - - while (struct dirent *de = readdir (d)) - if (memcmp(de->d_name, ".", 2) && memcmp(de->d_name, "..", 3)) - addSnapshot(mySnapshotDirName + "/" + de->d_name); - - sortList(); - - closedir (d); - return true; + clearList(); + llvm::sys::Path path(mySnapshotDirName); + std::set contents; + std::string ErrMsg; + path.getDirectoryContents(contents, &ErrMsg); + + if (!ErrMsg.empty()) { + errs() << "Error getting contents of dir: " << mySnapshotDirName + << " : " << ErrMsg << "\n"; + return false; + } + + for (std::set::const_iterator i = contents.begin(), + e = contents.end(); i != e; ++i) { + if (!(*i).isDirectory() && (*i).canRead()) { + errs() << "Processing: " << (*i).toString() << "\n"; + addSnapshot((*i).toString()); + } + } + + sortList(); + return true; } -//Sort the snapshot list +// Sort the snapshot list. void TVSnapshotList::sortList() { sort (mySnapshotList.begin (), mySnapshotList.end ()); } - -//Add a snapshot to our vector of snapshots -void TVSnapshotList::addSnapshot(std::string snapshotName) { - mySnapshotList.push_back(snapshotName); +// Add a snapshot to our vector of snapshots. +void TVSnapshotList::addSnapshot(const std::string &snapshotName) { + mySnapshotList.push_back(new TVSnapshot(snapshotName)); } - Modified: television/trunk/tools/llvm-tv/TVSnapshotList.h URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVSnapshotList.h?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVSnapshotList.h (original) +++ television/trunk/tools/llvm-tv/TVSnapshotList.h Mon Aug 17 10:26:31 2009 @@ -7,31 +7,34 @@ #ifndef TVSNAPSHOTLIST_H #define TVSNAPSHOTLIST_H +#include "TVSnapshot.h" #include #include -#include "TVSnapshot.h" /// Containts a list of snapshots and the directory they are in. /// Put into a class to easily pass between the application and frame /// class TVSnapshotList { - std::vector mySnapshotList; + std::vector mySnapshotList; std::string mySnapshotDirName; public: - TVSnapshotList(std::string dir) : mySnapshotDirName(dir) {} + TVSnapshotList(const std::string &dir) : mySnapshotDirName(dir) {} + ~TVSnapshotList(); + std::string getSnapshotDirName() { return mySnapshotDirName; } - void setSnapshotDirName(std::string dir) { mySnapshotDirName = dir; } - void addSnapshot(std::string snapshotName); + void setSnapshotDirName(const std::string &dir) { + mySnapshotDirName = dir; + } + + void addSnapshot(const std::string &snapshotName); void clearList() { mySnapshotList.clear(); } void sortList(); bool refreshList(); - //Iterators - typedef std::vector::iterator iterator; + // Iterators + typedef std::vector::iterator iterator; iterator begin() { return mySnapshotList.begin(); } iterator end() { return mySnapshotList.end(); } - }; - -#endif +#endif Modified: television/trunk/tools/llvm-tv/TVTextCtrl.h URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVTextCtrl.h?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVTextCtrl.h (original) +++ television/trunk/tools/llvm-tv/TVTextCtrl.h Mon Aug 17 10:26:31 2009 @@ -3,12 +3,12 @@ #include "TVWindowIDs.h" #include "ItemDisplayer.h" -#include "wx/textctrl.h" +#include class TVTextCtrl : public ItemDisplayer { wxTextCtrl *myTextCtrl; public: - TVTextCtrl (wxWindow *_parent, const wxString &_value = "") { + TVTextCtrl (wxWindow *_parent, const wxString &_value = wxT("")) { myTextCtrl = new wxTextCtrl (_parent, LLVM_TV_TEXT_CTRL, _value, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE | wxHSCROLL); Modified: television/trunk/tools/llvm-tv/TVTreeItem.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVTreeItem.cpp?rev=79241&r1=79240&r2=79241&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVTreeItem.cpp (original) +++ television/trunk/tools/llvm-tv/TVTreeItem.cpp Mon Aug 17 10:26:31 2009 @@ -1,24 +1,26 @@ #include "TVTreeItem.h" #include "llvm/Module.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; static TVTreeRootItem* theInstance = 0; TVTreeRootItem* TVTreeRootItem::instance() { if (theInstance == 0) { - theInstance = new TVTreeRootItem("Snapshot Root"); + theInstance = new TVTreeRootItem(wxT("Snapshot Root")); } return theInstance; } void TVTreeModuleItem::print(std::ostream &os) { - myModule->print(os); + // TODO: update to current LLVM API. + //myModule->print(os); } -void TVTreeFunctionItem::print(std::ostream &os) { +void TVTreeFunctionItem::print(std::ostream &os) { myFunc->print(os); } -std::string TVTreeFunctionItem::getTitle () { - return myFunc->getName () + "()"; +std::string TVTreeFunctionItem::getTitle() { + return myFunc->getName().str() + "()"; } Added: television/trunk/tools/llvm-tv/wxUtils.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/wxUtils.cpp?rev=79241&view=auto ============================================================================== --- television/trunk/tools/llvm-tv/wxUtils.cpp (added) +++ television/trunk/tools/llvm-tv/wxUtils.cpp Mon Aug 17 10:26:31 2009 @@ -0,0 +1,12 @@ + +#include "wxUtils.h" +#include +#include + +wxString wxS(const char* str) { + return wxString(str, wxConvUTF8); +} + +wxString wxS(const std::string &str) { + return wxString(str.c_str(), wxConvUTF8); +} Added: television/trunk/tools/llvm-tv/wxUtils.h URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/wxUtils.h?rev=79241&view=auto ============================================================================== --- television/trunk/tools/llvm-tv/wxUtils.h (added) +++ television/trunk/tools/llvm-tv/wxUtils.h Mon Aug 17 10:26:31 2009 @@ -0,0 +1,12 @@ + +#ifndef WX_UTILS_H +#define WX_UTILS_H + +#include +#include + +wxString wxS(const char* str); + +wxString wxS(const std::string &str); + +#endif From gohman at apple.com Mon Aug 17 10:27:30 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 17 Aug 2009 15:27:30 -0000 Subject: [llvm-commits] [llvm] r79242 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200908171527.n7HFRUXQ017102@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 17 10:27:30 2009 New Revision: 79242 URL: http://llvm.org/viewvc/llvm-project?rev=79242&view=rev Log: Always print at least one space before adding a comment. 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=79242&r1=79241&r2=79242&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Aug 17 10:27:30 2009 @@ -1690,11 +1690,11 @@ } if (BB->getParent() == 0) { - Out.PadToColumn(50); + Out.PadToColumn(50, 1); Out << "; Error: Block without parent!"; } else if (BB != &BB->getParent()->getEntryBlock()) { // Not the entry block? // Output predecessors for the block... - Out.PadToColumn(50); + Out.PadToColumn(50, 1); Out << ";"; pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB); @@ -1729,7 +1729,7 @@ /// void AssemblyWriter::printInfoComment(const Value &V) { if (V.getType() != Type::getVoidTy(V.getContext())) { - Out.PadToColumn(50); + Out.PadToColumn(50, 1); Out << "; <"; TypePrinter.print(V.getType(), Out); Out << "> [#uses=" << V.getNumUses() << ']'; // Output # uses From gohman at apple.com Mon Aug 17 10:28:08 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 17 Aug 2009 15:28:08 -0000 Subject: [llvm-commits] [llvm] r79243 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200908171528.n7HFS8ot017196@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 17 10:28:08 2009 New Revision: 79243 URL: http://llvm.org/viewvc/llvm-project?rev=79243&view=rev Log: Fix printing of instructions with null operands. 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=79243&r1=79242&r2=79243&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Aug 17 10:28:08 2009 @@ -689,7 +689,7 @@ !I->hasName()) CreateFunctionSlot(I); for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) - if (MDNode *N = dyn_cast(I->getOperand(i))) + if (MDNode *N = dyn_cast_or_null(I->getOperand(i))) CreateMetadataSlot(N); } } From gohman at apple.com Mon Aug 17 10:29:32 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 17 Aug 2009 15:29:32 -0000 Subject: [llvm-commits] [llvm] r79244 - /llvm/trunk/lib/Analysis/IVUsers.cpp Message-ID: <200908171529.n7HFTWGF017390@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 17 10:29:31 2009 New Revision: 79244 URL: http://llvm.org/viewvc/llvm-project?rev=79244&view=rev Log: Fix more missing newlines. Modified: llvm/trunk/lib/Analysis/IVUsers.cpp Modified: llvm/trunk/lib/Analysis/IVUsers.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IVUsers.cpp?rev=79244&r1=79243&r2=79244&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IVUsers.cpp (original) +++ llvm/trunk/lib/Analysis/IVUsers.cpp Mon Aug 17 10:29:31 2009 @@ -228,13 +228,13 @@ if (LI->getLoopFor(User->getParent()) != L) { if (isa(User) || Processed.count(User) || !AddUsersIfInteresting(User)) { - DOUT << "FOUND USER in other loop: " << *User + DOUT << "FOUND USER in other loop: " << *User << '\n' << " OF SCEV: " << *ISE << "\n"; AddUserToIVUsers = true; } } else if (Processed.count(User) || !AddUsersIfInteresting(User)) { - DOUT << "FOUND USER: " << *User + DOUT << "FOUND USER: " << *User << '\n' << " OF SCEV: " << *ISE << "\n"; AddUserToIVUsers = true; } From brukman+llvm at gmail.com Mon Aug 17 10:31:24 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Mon, 17 Aug 2009 15:31:24 -0000 Subject: [llvm-commits] [llvm] r79245 - /llvm/trunk/Makefile.rules Message-ID: <200908171531.n7HFVOXp017630@zion.cs.uiuc.edu> Author: brukman Date: Mon Aug 17 10:31:24 2009 New Revision: 79245 URL: http://llvm.org/viewvc/llvm-project?rev=79245&view=rev Log: Fixed indentation and spelling. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=79245&r1=79244&r2=79245&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Mon Aug 17 10:31:24 2009 @@ -891,7 +891,7 @@ LLVMLibsOptions += $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS)) LLVMLibsPaths += $(LLVM_CONFIG) \ - $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS)) + $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS)) endif endif @@ -963,7 +963,7 @@ # if we're building a library ... ifdef LIBRARYNAME -# Make sure there isn't any extranous whitespace on the LIBRARYNAME option +# Make sure there isn't any extraneous whitespace on the LIBRARYNAME option LIBRARYNAME := $(strip $(LIBRARYNAME)) ifdef LOADABLE_MODULE LibName.A := $(LibDir)/$(LIBRARYNAME).a From clattner at apple.com Mon Aug 17 10:31:29 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Aug 2009 08:31:29 -0700 Subject: [llvm-commits] [patch][llvm-gcc] Port -no-canonical-prefixes In-Reply-To: <38a0d8450908160041k33186be4rfa183eee0023ad1e@mail.gmail.com> References: <38a0d8450908160041k33186be4rfa183eee0023ad1e@mail.gmail.com> Message-ID: <022C59FB-0E96-408E-B9D7-9D52BA32A006@apple.com> On Aug 16, 2009, at 12:41 AM, Rafael Espindola wrote: > The llvm-gcc-149702.patch patch is a port of > http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00110.html > > The summary is that with it > ./foo/bar/bin/gcc -c llvm-gcc-149702.patch > will run cc1 with > ./foor/bar/bin/../../libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/cc1 > Instead of > //foor/bar/bin/../../libexec/gcc/x86_64-unknown-linux- > gnu/4.2.1/cc1 > > Which is nice in an installation where gcc and cc1 are symbolic links > that point to files > in unrelated directories. > > The original patch was GPL3, but I have permission to port it to GPL2 > to use it on llvm-gcc. Hi Rafael, can you get the author to send an email confirming that it is ok with them to license it under GPL2 to this list? While I believe you, a court might not :) -Chris > > > The llvm-gcc-119366.patch is a dependency since it defines > make_relative_prefix_ignore_links. > The original is GPL2. > > I would like to commit them (after adding the LLVM_LOCAL marks). Is > that OK? > > Cheers, > -- > Rafael Avila de Espindola > > Google | Gordon House | Barrow Street | Dublin 4 | Ireland > Registered in Dublin, Ireland | Registration Number: 368047 > gcc-149702.patch>_______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Aug 17 10:33:48 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Aug 2009 08:33:48 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r79233 - in /llvm-gcc-4.2/trunk/gcc: doc/invoke.texi gcc.c In-Reply-To: <200908170912.n7H9ChPU003399@zion.cs.uiuc.edu> References: <200908170912.n7H9ChPU003399@zion.cs.uiuc.edu> Message-ID: <9DA96D66-55A6-4548-BA8D-F0FB54F86D65@apple.com> On Aug 17, 2009, at 2:12 AM, Rafael Espindola wrote: > Author: rafael > Date: Mon Aug 17 04:12:42 2009 > New Revision: 79233 > > URL: http://llvm.org/viewvc/llvm-project?rev=79233&view=rev > Log: > A port of http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00110.html. > This adds the -no-canonical-prefixes option. It prevents gcc (the > driver) > from resolving symbolic links when looking for cc1. > > The original patch is GPL3, but I got permission to relicense it. Hi Rafael, Please revert this patch until the author sends an email to llvm- commits or llvmdev confirming this. Sorry for be a nuisance :( It might be easier just to make a GPL3 version of llvm-gcc. It could be based on llvm-gcc 4.2+patches or could be mainline. That might be easier in the short-term than dealing with gpl3 avoidance gymnastics, and would not depend on the gcc plugin work, which might take a while to form up. -Chris > > > > Modified: > llvm-gcc-4.2/trunk/gcc/doc/invoke.texi > llvm-gcc-4.2/trunk/gcc/gcc.c > > Modified: llvm-gcc-4.2/trunk/gcc/doc/invoke.texi > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/invoke.texi?rev=79233&r1=79232&r2=79233&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/doc/invoke.texi (original) > +++ llvm-gcc-4.2/trunk/gcc/doc/invoke.texi Mon Aug 17 04:12:42 2009 > @@ -175,7 +175,8 @@ > @table @emph > @item Overall Options > @xref{Overall Options,,Options Controlling the Kind of Output}. > - at gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit- > codes @gol > + at gccoptlist{-c -S -E -o @var{file} -combine -no-canonical- > prefixes @gol > +-pipe -pass-exit-codes @gol > @c APPLE LOCAL -ObjC 2001-08-03 --sts ** > -ObjC (APPLE ONLY) -ObjC++ (APPLE ONLY) @gol > @c APPLE LOCAL begin fat builds > @@ -1237,6 +1238,12 @@ > Print (on the standard output) a description of target specific > command > line options for each tool. > > + at item -no-canonical-prefixes > + at opindex no-canonical-prefixes > +Do not expand any symbolic links, resolve references to @samp{/../} > +or @samp{/./}, or make the path absolute when generating a relative > +prefix. > + > @item --version > @opindex version > Display the version number and copyrights of the invoked GCC at . > > Modified: llvm-gcc-4.2/trunk/gcc/gcc.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gcc.c?rev=79233&r1=79232&r2=79233&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/gcc.c (original) > +++ llvm-gcc-4.2/trunk/gcc/gcc.c Mon Aug 17 04:12:42 2009 > @@ -1190,6 +1190,7 @@ > /* LLVM LOCAL end */ > {"--machine", "-m", "aj"}, > {"--machine-", "-m", "*j"}, > + {"--no-canonical-prefixes", "-no-canonical-prefixes", 0}, > {"--no-integrated-cpp", "-no-integrated-cpp", 0}, > {"--no-line-commands", "-P", 0}, > {"--no-precompiled-includes", "-noprecomp", 0}, > @@ -3341,6 +3342,10 @@ > fputs (_(" -Xlinker Pass on to the linker > \n"), stdout); > fputs (_(" -combine Pass multiple source files to > compiler at once\n"), stdout); > fputs (_(" -save-temps Do not delete intermediate > files\n"), stdout); > + fputs (_("\ > + -no-canonical-prefixes Do not canonicalize paths when building > relative\n\ > + prefixes to other gcc components\n"), > stdout); > + > fputs (_(" -pipe Use pipes rather than > intermediate files\n"), stdout); > fputs (_(" -time Time the execution of each > subprocess\n"), stdout); > fputs (_(" -specs= Override built-in specs with > the contents of \n"), stdout); > @@ -3433,6 +3438,8 @@ > int is_modify_target_name; > unsigned int j; > #endif > + char *(*get_relative_prefix) (const char *, const char *, > + const char *) = NULL; > > GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX"); > > @@ -3519,6 +3526,28 @@ > fatal ("couldn't run '%s': %s", new_argv0, xstrerror (errno)); > } > > + /* Convert new-style -- options to old-style. */ > + translate_options (&argc, (const char * const **) &argv); > + > + /* Do language-specific adjustment/addition of flags. */ > + lang_specific_driver (&argc, (const char * const **) &argv, > + &added_libraries); > + > + /* Handle any -no-canonical-prefixes flag early, to assign the > function > + that builds relative prefixes. This function creates default > search > + paths that are needed later in normal option handling. */ > + > + for (i = 1; i < argc; i++) > + { > + if (! strcmp (argv[i], "-no-canonical-prefixes")) > + { > + get_relative_prefix = make_relative_prefix_ignore_links; > + break; > + } > + } > + if (! get_relative_prefix) > + get_relative_prefix = make_relative_prefix; > + > /* Set up the default search paths. If there is no GCC_EXEC_PREFIX, > see if we can create it from the pathname specified in > argv[0]. */ > > @@ -3527,11 +3556,12 @@ > /* FIXME: make_relative_prefix doesn't yet work for VMS. */ > if (!gcc_exec_prefix) > { > - gcc_exec_prefix = make_relative_prefix (argv[0], > standard_bindir_prefix, > - standard_exec_prefix); > - gcc_libexec_prefix = make_relative_prefix (argv[0], > - standard_bindir_prefix, > - standard_libexec_prefix); > + gcc_exec_prefix = get_relative_prefix (argv[0], > + standard_bindir_prefix, > + standard_exec_prefix); > + gcc_libexec_prefix = get_relative_prefix (argv[0], > + standard_bindir_prefix, > + standard_libexec_prefix); > if (gcc_exec_prefix) > putenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL)); > } > @@ -3542,9 +3572,9 @@ > / (which is ignored by make_relative_prefix), so append a > program name. */ > char *tmp_prefix = concat (gcc_exec_prefix, "gcc", NULL); > - gcc_libexec_prefix = make_relative_prefix (tmp_prefix, > - standard_exec_prefix, > - standard_libexec_prefix); > + gcc_libexec_prefix = get_relative_prefix (tmp_prefix, > + standard_exec_prefix, > + standard_libexec_prefix); > free (tmp_prefix); > } > #else > @@ -3674,12 +3704,6 @@ > } > } > > - /* Convert new-style -- options to old-style. */ > - translate_options (&argc, (const char *const **) &argv); > - > - /* Do language-specific adjustment/addition of flags. */ > - lang_specific_driver (&argc, (const char *const **) &argv, > &added_libraries); > - > /* Scan argv twice. Here, the first time, just count how many > switches > there will be in their vector, and how many input files in > theirs. > Here we also parse the switches that cc itself uses (e.g. -v). > */ > @@ -3891,6 +3915,9 @@ > n_infiles += 2; > i++; > } > + else if (strcmp (argv[i], "-no-canonical-prefixes") == 0) > + /* Already handled as a special case, so ignored here. */ > + ; > /* APPLE LOCAL end -weak_* (radar 3235250) */ > else if (strcmp (argv[i], "-combine") == 0) > { > @@ -4224,9 +4251,9 @@ > ``make_relative_prefix'' is not compiled for VMS, so don't call > it. */ > if (target_system_root && gcc_exec_prefix) > { > - char *tmp_prefix = make_relative_prefix (argv[0], > - standard_bindir_prefix, > - target_system_root); > + char *tmp_prefix = get_relative_prefix (argv[0], > + standard_bindir_prefix, > + target_system_root); > if (tmp_prefix && access_check (tmp_prefix, F_OK) == 0) > { > target_system_root = tmp_prefix; > @@ -4268,6 +4295,8 @@ > ; > else if (! strncmp (argv[i], "-Wp,", 4)) > ; > + else if (! strcmp (argv[i], "-no-canonical-prefixes")) > + ; > else if (! strcmp (argv[i], "-pass-exit-codes")) > ; > else if (! strcmp (argv[i], "-print-search-dirs")) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Mon Aug 17 10:48:09 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 17 Aug 2009 15:48:09 -0000 Subject: [llvm-commits] [llvm] r79246 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Support/FormattedStream.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp lib/VMCore/AsmWriter.cpp utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200908171548.n7HFm9Iw019730@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 17 10:48:08 2009 New Revision: 79246 URL: http://llvm.org/viewvc/llvm-project?rev=79246&view=rev Log: the MinPad argument to PadToColumn only really makes sense to be 1, just remove the argument and replace it with 1. Modified: llvm/trunk/include/llvm/Support/FormattedStream.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/Support/FormattedStream.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Modified: llvm/trunk/include/llvm/Support/FormattedStream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=79246&r1=79245&r2=79246&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) +++ llvm/trunk/include/llvm/Support/FormattedStream.h Mon Aug 17 10:48:08 2009 @@ -119,13 +119,12 @@ Scanned = begin(); } - /// PadToColumn - Align the output to some column number. + /// PadToColumn - Align the output to some column number. If the current + /// column is already equal to or more than NewCol, PadToColumn inserts one + /// space. /// /// \param NewCol - The column to move to. - /// \param MinPad - The minimum space to give after the most - /// recent I/O, even if the current column + minpad > newcol. - /// - void PadToColumn(unsigned NewCol, unsigned MinPad = 0); + void PadToColumn(unsigned NewCol); private: void releaseStream() { Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=79246&r1=79245&r2=79246&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Aug 17 10:48:08 2009 @@ -333,7 +333,7 @@ O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_' << CPI << ':'; if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " constant "; WriteTypeSymbolic(O, CPE.getType(), MF->getFunction()->getParent()); } @@ -606,7 +606,7 @@ void AsmPrinter::EOL(const std::string &Comment) const { if (VerboseAsm && !Comment.empty()) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << ' ' << Comment; @@ -616,7 +616,7 @@ void AsmPrinter::EOL(const char* Comment) const { if (VerboseAsm && *Comment) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << ' ' << Comment; @@ -1020,21 +1020,21 @@ if (TAI->getData64bitsDirective(AddrSpace)) { O << TAI->getData64bitsDirective(AddrSpace) << i; if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " double " << Val; } O << '\n'; } else if (TD->isBigEndian()) { O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " most significant word of double " << Val; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " least significant word of double " << Val; } @@ -1042,14 +1042,14 @@ } else { O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " least significant word of double " << Val; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " most significant word of double " << Val; } @@ -1061,7 +1061,7 @@ O << TAI->getData32bitsDirective(AddrSpace) << CFP->getValueAPF().bitcastToAPInt().getZExtValue(); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " float " << Val; } O << '\n'; @@ -1079,7 +1079,7 @@ if (TD->isBigEndian()) { O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " most significant halfword of x86_fp80 ~" << DoubleVal.convertToDouble(); @@ -1087,25 +1087,25 @@ O << '\n'; O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next halfword"; } O << '\n'; O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next halfword"; } O << '\n'; O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next halfword"; } O << '\n'; O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " least significant halfword"; } @@ -1113,7 +1113,7 @@ } else { O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " least significant halfword of x86_fp80 ~" << DoubleVal.convertToDouble(); @@ -1121,28 +1121,28 @@ O << '\n'; O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next halfword"; } O << '\n'; O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next halfword"; } O << '\n'; O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next halfword"; } O << '\n'; O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " most significant halfword"; } @@ -1159,28 +1159,28 @@ if (TD->isBigEndian()) { O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " most significant word of ppc_fp128"; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next word"; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next word"; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " least significant word"; } @@ -1188,28 +1188,28 @@ } else { O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " least significant word of ppc_fp128"; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next word"; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " next word"; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " most significant word"; } @@ -1242,14 +1242,14 @@ else if (TD->isBigEndian()) { O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " most significant half of i64 " << Val; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " least significant half of i64 " << Val; } @@ -1257,14 +1257,14 @@ } else { O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " least significant half of i64 " << Val; } O << '\n'; O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32); if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " most significant half of i64 " << Val; } @@ -1308,7 +1308,7 @@ if (const ConstantInt *CI = dyn_cast(CV)) { SmallString<40> S; CI->getValue().toStringUnsigned(S, 16); - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " 0x" << S.c_str(); } } @@ -1574,7 +1574,7 @@ /// that is an implicit def. void AsmPrinter::printImplicitDef(const MachineInstr *MI) const { if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " implicit-def: " << TRI->getAsmName(MI->getOperand(0).getReg()) << '\n'; } @@ -1635,7 +1635,7 @@ if (printComment) { if (const BasicBlock *BB = MBB->getBasicBlock()) if (BB->hasName()) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << ' '; WriteAsOperand(O, BB, /*PrintType=*/false); } @@ -1769,8 +1769,8 @@ DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc()); - // Print source line info - O.PadToColumn(TAI->getCommentColumn(), 1); + // Print source line info. + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " SrcLine "; if (DLT.CompileUnit->hasInitializer()) { Constant *Name = DLT.CompileUnit->getInitializer(); @@ -1791,7 +1791,7 @@ DebugLocTuple DLT = MF->getDebugLocTuple(MI.getDebugLoc()); // Print source line info - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " SrcLine "; if (DLT.CompileUnit->hasInitializer()) { Constant *Name = DLT.CompileUnit->getInitializer(); @@ -1817,11 +1817,11 @@ if (loop) { // Print a newline after bb# annotation. O << "\n"; - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " Loop Depth " << loop->getLoopDepth() << '\n'; - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); MachineBasicBlock *Header = loop->getHeader(); assert(Header && "No header for loop"); @@ -1837,7 +1837,7 @@ if (loop->empty()) { O << '\n'; - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " Inner Loop"; } @@ -1849,7 +1849,7 @@ assert(Header && "No header for loop"); O << '\n'; - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << Indent(CurLoop->getLoopDepth()-1) << " Inside Loop BB" << getFunctionNumber() << "_" << Header->getNumber() << " Depth " << CurLoop->getLoopDepth(); @@ -1868,7 +1868,7 @@ assert(Header && "No header for loop"); O << '\n'; - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << Indent((*cl)->getLoopDepth()-1) << " Child Loop BB" << getFunctionNumber() << "_" Modified: llvm/trunk/lib/Support/FormattedStream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=79246&r1=79245&r2=79246&view=diff ============================================================================== --- llvm/trunk/lib/Support/FormattedStream.cpp (original) +++ llvm/trunk/lib/Support/FormattedStream.cpp Mon Aug 17 10:48:08 2009 @@ -51,21 +51,20 @@ /// \param MinPad - The minimum space to give after the most recent /// I/O, even if the current column + minpad > newcol. /// -void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) { +void formatted_raw_ostream::PadToColumn(unsigned NewCol) { // Figure out what's in the buffer and add it to the column count. ComputeColumn(); // Output spaces until we reach the desired column. unsigned num = NewCol - ColumnScanned; - if (NewCol < ColumnScanned || num < MinPad) - num = MinPad; + if (NewCol < ColumnScanned || num < 1) + num = 1; // Keep a buffer of spaces handy to speed up processing. const char *Spaces = " " " "; assert(num < MAX_COLUMN_PAD && "Unexpectedly large column padding"); - write(Spaces, num); } 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=79246&r1=79245&r2=79246&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Aug 17 10:48:08 2009 @@ -217,7 +217,7 @@ O << CurrentFnName << ':'; if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << ' '; WriteAsOperand(O, F, /*PrintType=*/false, F->getParent()); } @@ -921,7 +921,7 @@ EmitAlignment(Align, GVar); O << name << ":"; if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << ' '; WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent()); } @@ -943,7 +943,7 @@ O << ',' << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); } if (VerboseAsm) { - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << ' '; WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent()); } @@ -987,7 +987,7 @@ EmitAlignment(Align, GVar); O << name << ":"; if (VerboseAsm){ - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << ' '; WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent()); } 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=79246&r1=79245&r2=79246&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Mon Aug 17 10:48:08 2009 @@ -524,7 +524,7 @@ O << name << ":"; if (VerboseAsm) - O.PadToColumn(TAI->getCommentColumn(), 1); + O.PadToColumn(TAI->getCommentColumn()); O << TAI->getCommentString() << " " << GV->getName(); O << '\n'; Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=79246&r1=79245&r2=79246&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Aug 17 10:48:08 2009 @@ -1690,11 +1690,11 @@ } if (BB->getParent() == 0) { - Out.PadToColumn(50, 1); + Out.PadToColumn(50); Out << "; Error: Block without parent!"; } else if (BB != &BB->getParent()->getEntryBlock()) { // Not the entry block? // Output predecessors for the block... - Out.PadToColumn(50, 1); + Out.PadToColumn(50); Out << ";"; pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB); @@ -1729,7 +1729,7 @@ /// void AssemblyWriter::printInfoComment(const Value &V) { if (V.getType() != Type::getVoidTy(V.getContext())) { - Out.PadToColumn(50, 1); + Out.PadToColumn(50); Out << "; <"; TypePrinter.print(V.getType(), Out); Out << "> [#uses=" << V.getNumUses() << ']'; // Output # uses Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=79246&r1=79245&r2=79246&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Mon Aug 17 10:48:08 2009 @@ -177,7 +177,7 @@ CurColumn++ * OperandSpacing; Operands.push_back( AsmWriterOperand("O.PadToColumn(" + - utostr(DestColumn) + ",1);\n", + utostr(DestColumn) + ");\n", AsmWriterOperand::isLiteralStatementOperand)); } break; @@ -211,7 +211,7 @@ unsigned DestColumn = FirstOperandColumn + CurColumn++ * OperandSpacing; Operands.push_back( - AsmWriterOperand("O.PadToColumn(" + utostr(DestColumn) + ", 1);\n", + AsmWriterOperand("O.PadToColumn(" + utostr(DestColumn) + ");\n", AsmWriterOperand::isLiteralStatementOperand)); break; } else if (std::string("${|}\\").find(AsmString[DollarPos+1]) From mrs at apple.com Mon Aug 17 10:53:36 2009 From: mrs at apple.com (Mike Stump) Date: Mon, 17 Aug 2009 08:53:36 -0700 Subject: [llvm-commits] PATCH: PR4719 - llvm-gcc should not use duplicate definitions of the same inline function In-Reply-To: References: <889E4DE1-5252-4CE7-8B76-23F776E82D45@apple.com> <4A8930A6.1070109@free.fr> Message-ID: On Aug 17, 2009, at 7:24 AM, Shantonu Sen wrote: >> does this mean that llvm-gcc can no longer be built with gcc before >> gcc-3.4? Also, do you understand why the test checks >> "defined (__cplusplus)"? > > My understanding of > is that "static inline" is universally valid and should work for > all versions of gcc and clang. No. Ignore any page that makes that claim. Take a look at the xmmintrin.h file: #ifdef __GNUC_STDC_INLINE__ #define __STATIC_INLINE __inline #else #define __STATIC_INLINE static __inline #endif for an example where static doesn't work. The above is fine for an internal gcc header file, but not ok for portable code... From david_goodwin at apple.com Mon Aug 17 11:02:58 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 17 Aug 2009 16:02:58 -0000 Subject: [llvm-commits] [llvm] r79247 - in /llvm/trunk: include/llvm/Target/TargetInstrItineraries.h include/llvm/Target/TargetSchedule.td lib/CodeGen/ExactHazardRecognizer.cpp utils/TableGen/SubtargetEmitter.cpp utils/TableGen/SubtargetEmitter.h Message-ID: <200908171602.n7HG2wbc021551@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Aug 17 11:02:57 2009 New Revision: 79247 URL: http://llvm.org/viewvc/llvm-project?rev=79247&view=rev Log: Extend the instruction itinerary model to include the ability to indicate the def and use cycle for each operand. This additional information is optional, so existing itineraries do not need to be changed. Modified: llvm/trunk/include/llvm/Target/TargetInstrItineraries.h llvm/trunk/include/llvm/Target/TargetSchedule.td llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp llvm/trunk/utils/TableGen/SubtargetEmitter.cpp llvm/trunk/utils/TableGen/SubtargetEmitter.h Modified: llvm/trunk/include/llvm/Target/TargetInstrItineraries.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrItineraries.h?rev=79247&r1=79246&r2=79247&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrItineraries.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrItineraries.h Mon Aug 17 11:02:57 2009 @@ -7,9 +7,9 @@ // //===----------------------------------------------------------------------===// // -// This file describes the structures used for instruction itineraries and -// stages. This is used by schedulers to determine instruction stages and -// latencies. +// This file describes the structures used for instruction +// itineraries, stages, and operand reads/writes. This is used by +// schedulers to determine instruction stages and latencies. // //===----------------------------------------------------------------------===// @@ -71,46 +71,50 @@ //===----------------------------------------------------------------------===// -/// Instruction itinerary - An itinerary represents a sequential series of steps -/// required to complete an instruction. Itineraries are represented as -/// sequences of instruction stages. +/// Instruction itinerary - An itinerary represents the scheduling +/// information for an instruction. This includes a set of stages +/// occupies by the instruction, and the pipeline cycle in which +/// operands are read and written. /// struct InstrItinerary { - unsigned First; ///< Index of first stage in itinerary - unsigned Last; ///< Index of last + 1 stage in itinerary + unsigned FirstStage; ///< Index of first stage in itinerary + unsigned LastStage; ///< Index of last + 1 stage in itinerary + unsigned FirstOperandCycle; ///< Index of first operand rd/wr + unsigned LastOperandCycle; ///< Index of last + 1 operand rd/wr }; - //===----------------------------------------------------------------------===// /// Instruction itinerary Data - Itinerary data supplied by a subtarget to be /// used by a target. /// struct InstrItineraryData { const InstrStage *Stages; ///< Array of stages selected + const unsigned *OperandCycles; ///< Array of operand cycles selected const InstrItinerary *Itineratries; ///< Array of itineraries selected /// Ctors. /// - InstrItineraryData() : Stages(0), Itineratries(0) {} - InstrItineraryData(const InstrStage *S, const InstrItinerary *I) - : Stages(S), Itineratries(I) {} + InstrItineraryData() : Stages(0), OperandCycles(0), Itineratries(0) {} + InstrItineraryData(const InstrStage *S, const unsigned *OS, + const InstrItinerary *I) + : Stages(S), OperandCycles(OS), Itineratries(I) {} /// isEmpty - Returns true if there are no itineraries. /// bool isEmpty() const { return Itineratries == 0; } - /// begin - Return the first stage of the itinerary. + /// beginStage - Return the first stage of the itinerary. /// - const InstrStage *begin(unsigned ItinClassIndx) const { - unsigned StageIdx = Itineratries[ItinClassIndx].First; + const InstrStage *beginStage(unsigned ItinClassIndx) const { + unsigned StageIdx = Itineratries[ItinClassIndx].FirstStage; return Stages + StageIdx; } - /// end - Return the last+1 stage of the itinerary. + /// endStage - Return the last+1 stage of the itinerary. /// - const InstrStage *end(unsigned ItinClassIndx) const { - unsigned StageIdx = Itineratries[ItinClassIndx].Last; + const InstrStage *endStage(unsigned ItinClassIndx) const { + unsigned StageIdx = Itineratries[ItinClassIndx].LastStage; return Stages + StageIdx; } @@ -129,8 +133,8 @@ // first stage and that all outputs are produced at the end of the // latest completing last stage. unsigned Latency = 0, StartCycle = 0; - for (const InstrStage *IS = begin(ItinClassIndx), *E = end(ItinClassIndx); - IS != E; ++IS) { + for (const InstrStage *IS = beginStage(ItinClassIndx), + *E = endStage(ItinClassIndx); IS != E; ++IS) { Latency = std::max(Latency, StartCycle + IS->getCycles()); StartCycle += IS->getNextCycles(); } Modified: llvm/trunk/include/llvm/Target/TargetSchedule.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetSchedule.td?rev=79247&r1=79246&r2=79247&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetSchedule.td (original) +++ llvm/trunk/include/llvm/Target/TargetSchedule.td Mon Aug 17 11:02:57 2009 @@ -62,9 +62,11 @@ // Instruction itinerary data - These values provide a runtime map of an // instruction itinerary class (name) to it's itinerary data. // -class InstrItinData stages> { +class InstrItinData stages, + list operandcycles = []> { InstrItinClass TheClass = Class; list Stages = stages; + list OperandCycles = operandcycles; } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp?rev=79247&r1=79246&r2=79247&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp (original) +++ llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Mon Aug 17 11:02:57 2009 @@ -33,7 +33,8 @@ for (unsigned idx = 0; ; ++idx) { // If the begin stage of an itinerary has 0 cycles and units, // then we have reached the end of the itineraries. - const InstrStage *IS = ItinData.begin(idx), *E = ItinData.end(idx); + const InstrStage *IS = ItinData.beginStage(idx); + const InstrStage *E = ItinData.endStage(idx); if ((IS->getCycles() == 0) && (IS->getUnits() == 0)) break; @@ -87,8 +88,8 @@ // Use the itinerary for the underlying instruction to check for // free FU's in the scoreboard at the appropriate future cycles. unsigned idx = SU->getInstr()->getDesc().getSchedClass(); - for (const InstrStage *IS = ItinData.begin(idx), *E = ItinData.end(idx); - IS != E; ++IS) { + for (const InstrStage *IS = ItinData.beginStage(idx), + *E = ItinData.endStage(idx); IS != E; ++IS) { // We must find one of the stage's units free for every cycle the // stage is occupied. FIXME it would be more accurate to find the // same unit free in all the cycles. @@ -119,8 +120,8 @@ // Use the itinerary for the underlying instruction to reserve FU's // in the scoreboard at the appropriate future cycles. unsigned idx = SU->getInstr()->getDesc().getSchedClass(); - for (const InstrStage *IS = ItinData.begin(idx), *E = ItinData.end(idx); - IS != E; ++IS) { + for (const InstrStage *IS = ItinData.beginStage(idx), + *E = ItinData.endStage(idx); IS != E; ++IS) { // We must reserve one of the stage's units for every cycle the // stage is occupied. FIXME it would be more accurate to reserve // the same unit free in all the cycles. Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.cpp?rev=79247&r1=79246&r2=79247&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Mon Aug 17 11:02:57 2009 @@ -199,12 +199,13 @@ } // -// FormItineraryString - Compose a string containing the data initialization -// for the specified itinerary. N is the number of stages. -// -void SubtargetEmitter::FormItineraryString(Record *ItinData, - std::string &ItinString, - unsigned &NStages) { +// FormItineraryStageString - Compose a string containing the stage +// data initialization for the specified itinerary. N is the number +// of stages. +// +void SubtargetEmitter::FormItineraryStageString(Record *ItinData, + std::string &ItinString, + unsigned &NStages) { // Get states list const std::vector &StageList = ItinData->getValueAsListOfDefs("Stages"); @@ -239,10 +240,32 @@ } // -// EmitStageData - Generate unique itinerary stages. Record itineraries for -// processors. +// FormItineraryOperandCycleString - Compose a string containing the +// operand cycle initialization for the specified itinerary. N is the +// number of operands that has cycles specified. +// +void SubtargetEmitter::FormItineraryOperandCycleString(Record *ItinData, + std::string &ItinString, unsigned &NOperandCycles) { + // Get operand cycle list + const std::vector &OperandCycleList = + ItinData->getValueAsListOfInts("OperandCycles"); + + // For each operand cycle + unsigned N = NOperandCycles = OperandCycleList.size(); + for (unsigned i = 0; i < N;) { + // Next operand cycle + const int OCycle = OperandCycleList[i]; + + ItinString += " " + itostr(OCycle); + if (++i < N) ItinString += ", "; + } +} + +// +// EmitStageAndOperandCycleData - Generate unique itinerary stages and +// operand cycle tables. Record itineraries for processors. // -void SubtargetEmitter::EmitStageData(raw_ostream &OS, +void SubtargetEmitter::EmitStageAndOperandCycleData(raw_ostream &OS, unsigned NItinClasses, std::map &ItinClassesMap, std::vector > &ProcList) { @@ -254,12 +277,16 @@ if (ProcItinList.size() < 2) return; // Begin stages table - OS << "static const llvm::InstrStage Stages[] = {\n" - " { 0, 0, 0 }, // No itinerary\n"; + std::string StageTable = "static const llvm::InstrStage Stages[] = {\n"; + StageTable += " { 0, 0, 0 }, // No itinerary\n"; - unsigned StageCount = 1; - unsigned ItinEnum = 1; - std::map ItinMap; + // Begin operand cycle table + std::string OperandCycleTable = "static const unsigned OperandCycles[] = {\n"; + OperandCycleTable += " 0, // No itinerary\n"; + + unsigned StageCount = 1, OperandCycleCount = 1; + unsigned ItinStageEnum = 1, ItinOperandCycleEnum = 1; + std::map ItinStageMap, ItinOperandCycleMap; for (unsigned i = 0, N = ProcItinList.size(); i < N; i++) { // Next record Record *Proc = ProcItinList[i]; @@ -283,29 +310,53 @@ Record *ItinData = ItinDataList[j]; // Get string and stage count - std::string ItinString; + std::string ItinStageString; unsigned NStages; - FormItineraryString(ItinData, ItinString, NStages); + FormItineraryStageString(ItinData, ItinStageString, NStages); - // Check to see if it already exists - unsigned Find = ItinMap[ItinString]; + // Get string and operand cycle count + std::string ItinOperandCycleString; + unsigned NOperandCycles; + FormItineraryOperandCycleString(ItinData, ItinOperandCycleString, + NOperandCycles); + + // Check to see if stage already exists and create if it doesn't + unsigned FindStage = 0; + if (NStages > 0) { + FindStage = ItinStageMap[ItinStageString]; + if (FindStage == 0) { + // Emit as { cycles, u1 | u2 | ... | un, timeinc }, // index + StageTable += ItinStageString + ", // " + itostr(ItinStageEnum) + "\n"; + // Record Itin class number. + ItinStageMap[ItinStageString] = FindStage = StageCount; + StageCount += NStages; + ItinStageEnum++; + } + } - // If new itinerary - if (Find == 0) { - // Emit as { cycles, u1 | u2 | ... | un, timeinc }, // index - OS << ItinString << ", // " << ItinEnum << "\n"; - // Record Itin class number. - ItinMap[ItinString] = Find = StageCount; - StageCount += NStages; - ItinEnum++; + // Check to see if operand cycle already exists and create if it doesn't + unsigned FindOperandCycle = 0; + if (NOperandCycles > 0) { + FindOperandCycle = ItinOperandCycleMap[ItinOperandCycleString]; + if (FindOperandCycle == 0) { + // Emit as cycle, // index + OperandCycleTable += ItinOperandCycleString + ", // " + + itostr(ItinOperandCycleEnum) + "\n"; + // Record Itin class number. + ItinOperandCycleMap[ItinOperandCycleString] = + FindOperandCycle = OperandCycleCount; + OperandCycleCount += NOperandCycles; + ItinOperandCycleEnum++; + } } // Set up itinerary as location and location + stage count - InstrItinerary Intinerary = { Find, Find + NStages }; + InstrItinerary Intinerary = { FindStage, FindStage + NStages, + FindOperandCycle, FindOperandCycle + NOperandCycles}; // Locate where to inject into processor itinerary table const std::string &Name = ItinData->getValueAsDef("TheClass")->getName(); - Find = ItinClassesMap[Name]; + unsigned Find = ItinClassesMap[Name]; // Inject - empty slots will be 0, 0 ItinList[Find] = Intinerary; @@ -316,13 +367,21 @@ } // Closing stage - OS << " { 0, 0, 0 } // End itinerary\n"; - // End stages table - OS << "};\n"; + StageTable += " { 0, 0, 0 } // End itinerary\n"; + StageTable += "};\n"; + + // Closing operand cycles + OperandCycleTable += " 0 // End itinerary\n"; + OperandCycleTable += "};\n"; + + // Emit tables. + OS << StageTable; + OS << OperandCycleTable; - // Emit size of table + // Emit size of tables OS<<"\nenum {\n"; - OS<<" StagesSize = sizeof(Stages)/sizeof(llvm::InstrStage)\n"; + OS<<" StagesSize = sizeof(Stages)/sizeof(llvm::InstrStage),\n"; + OS<<" OperandCyclesSize = sizeof(OperandCycles)/sizeof(unsigned)\n"; OS<<"};\n"; } @@ -357,11 +416,15 @@ for (unsigned j = 0, M = ItinList.size(); j < M;) { InstrItinerary &Intinerary = ItinList[j]; - // Emit in the form of { first, last } // index - if (Intinerary.First == 0) { - OS << " { 0, 0 }"; + // Emit in the form of + // { firstStage, lastStage, firstCycle, lastCycle } // index + if (Intinerary.FirstStage == 0) { + OS << " { 0, 0, 0, 0 }"; } else { - OS << " { " << Intinerary.First << ", " << Intinerary.Last << " }"; + OS << " { " << Intinerary.FirstStage << ", " << + Intinerary.LastStage << ", " << + Intinerary.FirstOperandCycle << ", " << + Intinerary.LastOperandCycle << " }"; } // If more in list add comma @@ -435,7 +498,7 @@ if (HasItineraries) { // Emit the stage data - EmitStageData(OS, NItinClasses, ItinClassesMap, ProcList); + EmitStageAndOperandCycleData(OS, NItinClasses, ItinClassesMap, ProcList); // Emit the processor itinerary data EmitProcessorData(OS, ProcList); // Emit the processor lookup data @@ -482,7 +545,7 @@ OS << "\n" << " InstrItinerary *Itinerary = (InstrItinerary *)" << "Features.getInfo(ProcItinKV, ProcItinKVSize);\n" - << " InstrItins = InstrItineraryData(Stages, Itinerary);\n"; + << " InstrItins = InstrItineraryData(Stages, OperandCycles, Itinerary);\n"; } OS << " return Features.getCPU();\n" Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.h?rev=79247&r1=79246&r2=79247&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/SubtargetEmitter.h (original) +++ llvm/trunk/utils/TableGen/SubtargetEmitter.h Mon Aug 17 11:02:57 2009 @@ -34,9 +34,11 @@ void CPUKeyValues(raw_ostream &OS); unsigned CollectAllItinClasses(raw_ostream &OS, std::map &ItinClassesMap); - void FormItineraryString(Record *ItinData, std::string &ItinString, - unsigned &NStages); - void EmitStageData(raw_ostream &OS, unsigned NItinClasses, + void FormItineraryStageString(Record *ItinData, std::string &ItinString, + unsigned &NStages); + void FormItineraryOperandCycleString(Record *ItinData, std::string &ItinString, + unsigned &NOperandCycles); + void EmitStageAndOperandCycleData(raw_ostream &OS, unsigned NItinClasses, std::map &ItinClassesMap, std::vector > &ProcList); void EmitProcessorData(raw_ostream &OS, From ssen at apple.com Mon Aug 17 11:19:31 2009 From: ssen at apple.com (Shantonu Sen) Date: Mon, 17 Aug 2009 09:19:31 -0700 Subject: [llvm-commits] PATCH: PR4719 - llvm-gcc should not use duplicate definitions of the same inline function In-Reply-To: References: <889E4DE1-5252-4CE7-8B76-23F776E82D45@apple.com> <4A8930A6.1070109@free.fr> Message-ID: OK... any other suggestions on how to "fix" llvm-gcc's source code so that it builds with clang? Shantonu Sen ssen at apple.com Sent from my Mac Pro On Aug 17, 2009, at 8:53 AM, Mike Stump wrote: > On Aug 17, 2009, at 7:24 AM, Shantonu Sen wrote: >>> does this mean that llvm-gcc can no longer be built with gcc before >>> gcc-3.4? Also, do you understand why the test checks >>> "defined (__cplusplus)"? >> >> My understanding of > > is that "static inline" is universally valid and should work for >> all versions of gcc and clang. > > No. Ignore any page that makes that claim. Take a look at the > xmmintrin.h file: > > #ifdef __GNUC_STDC_INLINE__ > #define __STATIC_INLINE __inline > #else > #define __STATIC_INLINE static __inline > #endif > > for an example where static doesn't work. The above is fine for an > internal gcc header file, but not ok for portable code... From gohman at apple.com Mon Aug 17 11:30:54 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 17 Aug 2009 09:30:54 -0700 Subject: [llvm-commits] [llvm] r79065 - /llvm/trunk/lib/Support/FormattedStream.cpp In-Reply-To: References: <200908150202.n7F22xqb015324@zion.cs.uiuc.edu> Message-ID: <017E3858-B88B-49F6-A87B-D887423B9978@apple.com> On Aug 17, 2009, at 2:42 AM, Artur Pietrek wrote: > > > On Sat, Aug 15, 2009 at 4:02 AM, Dan Gohman wrote: > > -/// ComputeColumn - Examine the current output and figure out which > +/// CountColumns - Examine the given char sequence and figure out > which > /// column we end up in after output. > /// > -void formatted_raw_ostream::ComputeColumn() { > +static unsigned CountColumns(unsigned Column, const char *Ptr, > size_t Size) { > // Keep track of the current column by scanning the string for > // special characters > > - // The buffer may have been allocated underneath us. > - if (Scanned == 0 && GetNumBytesInBuffer() != 0) { > - Scanned = begin(); > - } > - > - while (Scanned != end()) { > - ++ColumnScanned; > - if (*Scanned == '\n' || *Scanned == '\r') > - ColumnScanned = 0; > - else if (*Scanned == '\t') > + for (const char *End = Ptr + Size; Ptr != End; ++Ptr) { > + ++Column; > + if (*Ptr == '\n' || *Ptr == '\r') > + Column = 0; > + else if (*Ptr == '\t') > // Assumes tab stop = 8 characters. > - ColumnScanned += (8 - (ColumnScanned & 0x7)) & 0x7; > - ++Scanned; > + Column += (8 - (Column & 0x7)) & 0x7; > } > + > + return Column; > +} > > Hi all, > > Is it legal to output Instruction or any Value using formatted > stream like this: > Out << *Instr; Yes, that's fine. Fairly common, in fact. > > I was using it to print commented LLVM instructions to my assembly > to check if I'm translating instructions correctly, but since the > change above I get segfault after running my backend. > > Changing line: > for (const char *End = Ptr + Size; Ptr != End; ++Ptr) { > > to: > + for (const char *End = Ptr + Size; Ptr < End; ++Ptr) { > > helps. Is it bug or I just should not use it that way? The change shouldn't be necessary. It sounds like there's a bug. Is Ptr pointing to a valid string when this happens? Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/76ab0a70/attachment.html From richard at xmos.com Mon Aug 17 11:37:11 2009 From: richard at xmos.com (Richard Osborne) Date: Mon, 17 Aug 2009 16:37:11 -0000 Subject: [llvm-commits] [llvm] r79249 - in /llvm/trunk: lib/Target/TargetLoweringObjectFile.cpp test/CodeGen/XCore/constants.ll Message-ID: <200908171637.n7HGbBrv025932@zion.cs.uiuc.edu> Author: friedgold Date: Mon Aug 17 11:37:11 2009 New Revision: 79249 URL: http://llvm.org/viewvc/llvm-project?rev=79249&view=rev Log: Update getSectionForConstant() to to allow mergable sections to be nulled out if not supported by the ELF subtarget. Added: llvm/trunk/test/CodeGen/XCore/constants.ll Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=79249&r1=79248&r2=79249&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Mon Aug 17 11:37:11 2009 @@ -609,11 +609,11 @@ /// should be placed in. const MCSection *TargetLoweringObjectFileELF:: getSectionForConstant(SectionKind Kind) const { - if (Kind.isMergeableConst4()) + if (Kind.isMergeableConst4() && MergeableConst4Section) return MergeableConst4Section; - if (Kind.isMergeableConst8()) + if (Kind.isMergeableConst8() && MergeableConst8Section) return MergeableConst8Section; - if (Kind.isMergeableConst16()) + if (Kind.isMergeableConst16() && MergeableConst16Section) return MergeableConst16Section; if (Kind.isReadOnly()) return ReadOnlySection; Added: llvm/trunk/test/CodeGen/XCore/constants.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/constants.ll?rev=79249&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/XCore/constants.ll (added) +++ llvm/trunk/test/CodeGen/XCore/constants.ll Mon Aug 17 11:37:11 2009 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llc -march=xcore -mcpu=xs1b-generic | FileCheck %s + +; CHECK: .section .cp.rodata,"ac", at progbits +; CHECK: .LCPI1_0: +; CHECK: .long 12345678 +; CHECK: f: +; CHECK: ldw r0, cp[.LCPI1_0] +define i32 @f() { +entry: + ret i32 12345678 +} From grosbach at apple.com Mon Aug 17 11:41:22 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 17 Aug 2009 16:41:22 -0000 Subject: [llvm-commits] [llvm] r79250 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfException.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/SjLjEHPrepare.cpp Message-ID: <200908171641.n7HGfNZ8026479@zion.cs.uiuc.edu> Author: grosbach Date: Mon Aug 17 11:41:22 2009 New Revision: 79250 URL: http://llvm.org/viewvc/llvm-project?rev=79250&view=rev Log: Move the sjlj exception handling conversions to a back-end pass where they more properly belong. This allows removing the front-end conditionalized SJLJ code, and cleans up the generated IR considerably. All of the infrastructure code (calling _Unwind_SjLj_Register/Unregister, etc) is added by the SjLjEHPrepare pass. Added: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Modified: llvm/trunk/include/llvm/CodeGen/Passes.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Modified: llvm/trunk/include/llvm/CodeGen/Passes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=79250&r1=79249&r2=79250&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/Passes.h (original) +++ llvm/trunk/include/llvm/CodeGen/Passes.h Mon Aug 17 11:41:22 2009 @@ -193,6 +193,10 @@ /// adapted to code generation. Required if using dwarf exception handling. FunctionPass *createDwarfEHPass(const TargetLowering *tli, bool fast); + /// createSjLjEHPass - This pass adapts exception handling code to use + /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow. + FunctionPass *createSjLjEHPass(const TargetLowering *tli); + } // End llvm namespace #endif Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=79250&r1=79249&r2=79250&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug 17 11:41:22 2009 @@ -364,7 +364,6 @@ /// try-range address. void DwarfException:: ComputeCallSiteTable(SmallVectorImpl &CallSites, - std::map &CallSiteIndexMap, const RangeMapType &PadMap, const SmallVectorImpl &LandingPads, const SmallVectorImpl &FirstActions) { @@ -438,12 +437,6 @@ // Otherwise, create a new call-site. CallSites.push_back(Site); - // For SjLj handling, map the call site entry to its index - if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { - unsigned Index = - MF->getLandingPadCallSiteIndex(LandingPad->LandingPadBlock); - CallSiteIndexMap[Index] = &CallSites.back(); - } PreviousIsInvoke = true; } else { // Create a gap. @@ -520,9 +513,7 @@ // Compute the call-site table. SmallVector CallSites; - std::map CallSiteIndexMap; - ComputeCallSiteTable(CallSites, CallSiteIndexMap, PadMap, - LandingPads, FirstActions); + ComputeCallSiteTable(CallSites, PadMap, LandingPads, FirstActions); // Final tallies. @@ -537,8 +528,7 @@ if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj) { - SizeSites = (MF->getMaxCallSiteIndex() - CallSites.size()) * - TargetAsmInfo::getULEB128Size(0) * 2; + SizeSites = 0; } else SizeSites = CallSites.size() * (SiteStartSize + SiteLengthSize + LandingPadSize); @@ -546,7 +536,6 @@ SizeSites += TargetAsmInfo::getULEB128Size(CallSites[i].Action); if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj) SizeSites += TargetAsmInfo::getULEB128Size(i); - // FIXME: 'i' above should be the landing pad index } // Type infos. const unsigned TypeInfoSize = TD->getPointerSize(); // DW_EH_PE_absptr @@ -655,25 +644,11 @@ assert(MF->getCallSiteCount() == CallSites.size()); // Emit the landing pad site information. - // SjLj handling assigned the call site indices in the front end, so - // we need to make sure the table here lines up with that. That's pretty - // horrible, and should be fixed ASAP to do that stuff in the back end - // instead. - std::map::const_iterator I, E; - I = CallSiteIndexMap.begin(); - E = CallSiteIndexMap.end(); - for (unsigned CurrIdx = 1; I != E; ++I) { - // paranoia. - assert(CurrIdx <= I->first); - // Fill in any gaps in the table - while (CurrIdx++ < I->first) { - Asm->EmitULEB128Bytes(0); - Asm->EOL("Filler landing pad"); - Asm->EmitULEB128Bytes(0); - Asm->EOL("Filler action"); - } - const CallSiteEntry &S = *(I->second); - Asm->EmitULEB128Bytes(I->first - 1); + unsigned idx = 0; + for (SmallVectorImpl::const_iterator + I = CallSites.begin(), E = CallSites.end(); I != E; ++I, ++idx) { + const CallSiteEntry &S = *I; + Asm->EmitULEB128Bytes(idx); Asm->EOL("Landing pad"); Asm->EmitULEB128Bytes(S.Action); Asm->EOL("Action"); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=79250&r1=79249&r2=79250&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Mon Aug 17 11:41:22 2009 @@ -155,7 +155,6 @@ /// of any entry - they form gaps in the table. Entries must be ordered by /// try-range address. void ComputeCallSiteTable(SmallVectorImpl &CallSites, - std::map &CallSiteIndexMap, const RangeMapType &PadMap, const SmallVectorImpl &LPs, const SmallVectorImpl &FirstActions); Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=79250&r1=79249&r2=79250&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Aug 17 11:41:22 2009 @@ -241,8 +241,11 @@ // handle. switch (getTargetAsmInfo()->getExceptionHandlingType()) { - // SjLj piggy-backs on dwarf for this bit case ExceptionHandling::SjLj: + // SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both + PM.add(createDwarfEHPass(getTargetLowering(), OptLevel==CodeGenOpt::None)); + PM.add(createSjLjEHPass(getTargetLowering())); + break; case ExceptionHandling::Dwarf: PM.add(createDwarfEHPass(getTargetLowering(), OptLevel==CodeGenOpt::None)); break; Added: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=79250&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (added) +++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Mon Aug 17 11:41:22 2009 @@ -0,0 +1,527 @@ +//===- SjLjEHPass.cpp - Eliminate Invoke & Unwind instructions -----------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This transformation is designed for use by code generators which use SjLj +// based exception handling. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "sjljehprepare" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" +#include "llvm/Instructions.h" +#include "llvm/Intrinsics.h" +#include "llvm/LLVMContext.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/CodeGen/Passes.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Utils/Local.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetLowering.h" +#include +using namespace llvm; + +STATISTIC(NumInvokes, "Number of invokes replaced"); +STATISTIC(NumUnwinds, "Number of unwinds replaced"); +STATISTIC(NumSpilled, "Number of registers live across unwind edges"); + +namespace { + class VISIBILITY_HIDDEN SjLjEHPass : public FunctionPass { + + const TargetLowering *TLI; + + const Type *FunctionContextTy; + Constant *RegisterFn; + Constant *UnregisterFn; + Constant *ResumeFn; + Constant *BuiltinSetjmpFn; + Constant *FrameAddrFn; + Constant *LSDAAddrFn; + Value *PersonalityFn; + Constant *Selector32Fn; + Constant *Selector64Fn; + Constant *ExceptionFn; + + Value *CallSite; + public: + static char ID; // Pass identification, replacement for typeid + explicit SjLjEHPass(const TargetLowering *tli = NULL) + : FunctionPass(&ID), TLI(tli) { } + bool doInitialization(Module &M); + bool runOnFunction(Function &F); + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { } + const char *getPassName() const { + return "SJLJ Exception Handling preparation"; + } + + private: + void markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, + Value *CallSite, + SwitchInst *CatchSwitch); + void splitLiveRangesLiveAcrossInvokes(std::vector &Invokes); + bool insertSjLjEHSupport(Function &F); + }; +} // end anonymous namespace + +char SjLjEHPass::ID = 0; + +// Public Interface To the SjLjEHPass pass. +FunctionPass *llvm::createSjLjEHPass(const TargetLowering *TLI) { + return new SjLjEHPass(TLI); +} +// doInitialization - Make sure that there is a prototype for abort in the +// current module. +bool SjLjEHPass::doInitialization(Module &M) { + // Build the function context structure. + // builtin_setjmp uses a five word jbuf + const Type *VoidPtrTy = + PointerType::getUnqual(Type::getInt8Ty(M.getContext())); + const Type *Int32Ty = Type::getInt32Ty(M.getContext()); + FunctionContextTy = + StructType::get(M.getContext(), + VoidPtrTy, // __prev + Int32Ty, // call_site + ArrayType::get(Int32Ty, 4), // __data + VoidPtrTy, // __personality + VoidPtrTy, // __lsda + ArrayType::get(VoidPtrTy, 5), // __jbuf + NULL); + RegisterFn = M.getOrInsertFunction("_Unwind_SjLj_Register", + Type::getVoidTy(M.getContext()), + PointerType::getUnqual(FunctionContextTy), + (Type *)0); + UnregisterFn = + M.getOrInsertFunction("_Unwind_SjLj_Unregister", + Type::getVoidTy(M.getContext()), + PointerType::getUnqual(FunctionContextTy), + (Type *)0); + ResumeFn = + M.getOrInsertFunction("_Unwind_SjLj_Resume", + Type::getVoidTy(M.getContext()), + VoidPtrTy, + (Type *)0); + FrameAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::frameaddress); + BuiltinSetjmpFn = Intrinsic::getDeclaration(&M, Intrinsic::eh_sjlj_setjmp); + LSDAAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::eh_sjlj_lsda); + Selector32Fn = Intrinsic::getDeclaration(&M, Intrinsic::eh_selector_i32); + Selector64Fn = Intrinsic::getDeclaration(&M, Intrinsic::eh_selector_i64); + ExceptionFn = Intrinsic::getDeclaration(&M, Intrinsic::eh_exception); + + return true; +} + +/// markInvokeCallSite - Insert code to mark the call_site for this invoke +void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, + Value *CallSite, + SwitchInst *CatchSwitch) { + ConstantInt *CallSiteNoC= ConstantInt::get(Type::getInt32Ty(II->getContext()), + InvokeNo); + // The runtime comes back to the dispatcher with the call_site - 1 in + // the context. Odd, but there it is. + ConstantInt *SwitchValC = ConstantInt::get(Type::getInt32Ty(II->getContext()), + InvokeNo - 1); + + // If the unwind edge has phi nodes, split the edge. + if (isa(II->getUnwindDest()->begin())) { + SplitCriticalEdge(II, 1, this); + + // If there are any phi nodes left, they must have a single predecessor. + while (PHINode *PN = dyn_cast(II->getUnwindDest()->begin())) { + PN->replaceAllUsesWith(PN->getIncomingValue(0)); + PN->eraseFromParent(); + } + } + + // Insert a store of the invoke num before the invoke and store zero into the + // location afterward. + new StoreInst(CallSiteNoC, CallSite, true, II); // volatile + + // Add a switch case to our unwind block. + CatchSwitch->addCase(SwitchValC, II->getUnwindDest()); + // We still want this to look like an invoke so we emit the LSDA properly + // FIXME: ??? Or will this cause strangeness with mis-matched IDs like + // when it was in the front end? +} + +/// MarkBlocksLiveIn - Insert BB and all of its predescessors into LiveBBs until +/// we reach blocks we've already seen. +static void MarkBlocksLiveIn(BasicBlock *BB, std::set &LiveBBs) { + if (!LiveBBs.insert(BB).second) return; // already been here. + + for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) + MarkBlocksLiveIn(*PI, LiveBBs); +} + +// live across unwind edges. Each value that is live across an unwind edge +// we spill into a stack location, guaranteeing that there is nothing live +// across the unwind edge. This process also splits all critical edges +// coming out of invoke's. +void SjLjEHPass:: +splitLiveRangesLiveAcrossInvokes(std::vector &Invokes) { + // First step, split all critical edges from invoke instructions. + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) { + InvokeInst *II = Invokes[i]; + SplitCriticalEdge(II, 0, this); + SplitCriticalEdge(II, 1, this); + assert(!isa(II->getNormalDest()) && + !isa(II->getUnwindDest()) && + "critical edge splitting left single entry phi nodes?"); + } + + Function *F = Invokes.back()->getParent()->getParent(); + + // To avoid having to handle incoming arguments specially, we lower each arg + // to a copy instruction in the entry block. This ensures that the argument + // value itself cannot be live across the entry block. + BasicBlock::iterator AfterAllocaInsertPt = F->begin()->begin(); + while (isa(AfterAllocaInsertPt) && + isa(cast(AfterAllocaInsertPt)->getArraySize())) + ++AfterAllocaInsertPt; + for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); + AI != E; ++AI) { + // This is always a no-op cast because we're casting AI to AI->getType() so + // src and destination types are identical. BitCast is the only possibility. + CastInst *NC = new BitCastInst( + AI, AI->getType(), AI->getName()+".tmp", AfterAllocaInsertPt); + AI->replaceAllUsesWith(NC); + // Normally its is forbidden to replace a CastInst's operand because it + // could cause the opcode to reflect an illegal conversion. However, we're + // replacing it here with the same value it was constructed with to simply + // make NC its user. + NC->setOperand(0, AI); + } + + // Finally, scan the code looking for instructions with bad live ranges. + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) + for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E; ++II) { + // Ignore obvious cases we don't have to handle. In particular, most + // instructions either have no uses or only have a single use inside the + // current block. Ignore them quickly. + Instruction *Inst = II; + if (Inst->use_empty()) continue; + if (Inst->hasOneUse() && + cast(Inst->use_back())->getParent() == BB && + !isa(Inst->use_back())) continue; + + // If this is an alloca in the entry block, it's not a real register + // value. + if (AllocaInst *AI = dyn_cast(Inst)) + if (isa(AI->getArraySize()) && BB == F->begin()) + continue; + + // Avoid iterator invalidation by copying users to a temporary vector. + std::vector Users; + for (Value::use_iterator UI = Inst->use_begin(), E = Inst->use_end(); + UI != E; ++UI) { + Instruction *User = cast(*UI); + if (User->getParent() != BB || isa(User)) + Users.push_back(User); + } + + // Scan all of the uses and see if the live range is live across an unwind + // edge. If we find a use live across an invoke edge, create an alloca + // and spill the value. + std::set InvokesWithStoreInserted; + + // Find all of the blocks that this value is live in. + std::set LiveBBs; + LiveBBs.insert(Inst->getParent()); + while (!Users.empty()) { + Instruction *U = Users.back(); + Users.pop_back(); + + if (!isa(U)) { + MarkBlocksLiveIn(U->getParent(), LiveBBs); + } else { + // Uses for a PHI node occur in their predecessor block. + PHINode *PN = cast(U); + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) + if (PN->getIncomingValue(i) == Inst) + MarkBlocksLiveIn(PN->getIncomingBlock(i), LiveBBs); + } + } + + // Now that we know all of the blocks that this thing is live in, see if + // it includes any of the unwind locations. + bool NeedsSpill = false; + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) { + BasicBlock *UnwindBlock = Invokes[i]->getUnwindDest(); + if (UnwindBlock != BB && LiveBBs.count(UnwindBlock)) { + NeedsSpill = true; + } + } + + // If we decided we need a spill, do it. + if (NeedsSpill) { + ++NumSpilled; + DemoteRegToStack(*Inst, true); + } + } +} + +bool SjLjEHPass::insertSjLjEHSupport(Function &F) { + std::vector Returns; + std::vector Unwinds; + std::vector Invokes; + + // Look through the terminators of the basic blocks to find invokes, returns + // and unwinds + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) + if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { + // Remember all return instructions in case we insert an invoke into this + // function. + Returns.push_back(RI); + } else if (InvokeInst *II = dyn_cast(BB->getTerminator())) { + Invokes.push_back(II); + } else if (UnwindInst *UI = dyn_cast(BB->getTerminator())) { + Unwinds.push_back(UI); + } + // If we don't have any invokes or unwinds, there's nothing to do. + if (Unwinds.empty() && Invokes.empty()) return false; + + NumInvokes += Invokes.size(); + NumUnwinds += Unwinds.size(); + + + if (!Invokes.empty()) { + // We have invokes, so we need to add register/unregister calls to get + // this function onto the global unwind stack. + // + // First thing we need to do is scan the whole function for values that are + // live across unwind edges. Each value that is live across an unwind edge + // we spill into a stack location, guaranteeing that there is nothing live + // across the unwind edge. This process also splits all critical edges + // coming out of invoke's. + splitLiveRangesLiveAcrossInvokes(Invokes); + + BasicBlock *EntryBB = F.begin(); + // Create an alloca for the incoming jump buffer ptr and the new jump buffer + // that needs to be restored on all exits from the function. This is an + // alloca because the value needs to be added to the global context list. + unsigned Align = 4; // FIXME: Should be a TLI check? + AllocaInst *FunctionContext = + new AllocaInst(FunctionContextTy, 0, Align, + "fcn_context", F.begin()->begin()); + + Value *Idxs[2]; + const Type *Int32Ty = Type::getInt32Ty(F.getContext()); + Value *Zero = ConstantInt::get(Int32Ty, 0); + // We need to also keep around a reference to the call_site field + Idxs[0] = Zero; + Idxs[1] = ConstantInt::get(Int32Ty, 1); + CallSite = GetElementPtrInst::Create(FunctionContext, Idxs, Idxs+2, + "call_site", + EntryBB->getTerminator()); + + // The exception selector comes back in context->data[1] + Idxs[1] = ConstantInt::get(Int32Ty, 2); + Value *FCData = GetElementPtrInst::Create(FunctionContext, Idxs, Idxs+2, + "fc_data", + EntryBB->getTerminator()); + Idxs[1] = ConstantInt::get(Int32Ty, 1); + Value *SelectorAddr = GetElementPtrInst::Create(FCData, Idxs, Idxs+2, + "exc_selector_gep", + EntryBB->getTerminator()); + // The exception value comes back in context->data[0] + Idxs[1] = Zero; + Value *ExceptionAddr = GetElementPtrInst::Create(FCData, Idxs, Idxs+2, + "exception_gep", + EntryBB->getTerminator()); + + // Find the eh.selector.* and eh.exception calls. We'll use the first + // ex.selector to determine the right personality function to use. For + // SJLJ, we always use the same personality for the whole function, + // not on a per-selector basis. + // FIXME: That's a bit ugly. Better way? + std::vector EH_Selectors; + std::vector EH_Exceptions; + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { + // for (unsigned i = 0, e = Invokes.size(); i != e; ++i) { +// BasicBlock *Pad = Invokes[0]->getUnwindDest(); + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { + if (CallInst *CI = dyn_cast(I)) { + if (CI->getCalledFunction() == Selector32Fn || + CI->getCalledFunction() == Selector64Fn) { + if (!PersonalityFn) PersonalityFn = CI->getOperand(2); + EH_Selectors.push_back(CI); + } else if (CI->getCalledFunction() == ExceptionFn) { + EH_Exceptions.push_back(CI); + } + } + } + } + // The result of the eh.selector call will be replaced with a + // a reference to the selector value returned in the function + // context. We leave the selector itself so the EH analysis later + // can use it. + for (int i = 0, e = EH_Selectors.size(); i < e; ++i) { + CallInst *I = EH_Selectors[i]; + Value *SelectorVal = new LoadInst(SelectorAddr, "select_val", true, I); + I->replaceAllUsesWith(SelectorVal); + } + // eh.exception calls are replaced with references to the proper + // location in the context. Unlike eh.selector, the eh.exception + // calls are removed entirely. + for (int i = 0, e = EH_Exceptions.size(); i < e; ++i) { + CallInst *I = EH_Exceptions[i]; + // Possible for there to be duplicates, so check to make sure + // the instruction hasn't already been removed. + if (!I->getParent()) continue; + Value *Val = new LoadInst(ExceptionAddr, "exception", true, I); + Val = CastInst::Create(Instruction::IntToPtr, Val, + PointerType::getUnqual(Type::getInt8Ty(F.getContext())), + "", I); + + I->replaceAllUsesWith(Val); + I->eraseFromParent(); + } + + + + + // The entry block changes to have the eh.sjlj.setjmp, with a conditional + // branch to a dispatch block for non-zero returns. If we return normally, + // we're not handling an exception and just register the function context + // and continue. + + // Create the dispatch block. The dispatch block is basically a big switch + // statement that goes to all of the invoke landing pads. + BasicBlock *DispatchBlock = + BasicBlock::Create(F.getContext(), "eh.sjlj.setjmp.catch", &F); + + // Insert a load in the Catch block, and a switch on its value. By default, + // we go to a block that just does an unwind (which is the correct action + // for a standard call). + BasicBlock *UnwindBlock = BasicBlock::Create(F.getContext(), "unwindbb", &F); + Unwinds.push_back(new UnwindInst(F.getContext(), UnwindBlock)); + + Value *DispatchLoad = new LoadInst(CallSite, "invoke.num", true, + DispatchBlock); + SwitchInst *DispatchSwitch = + SwitchInst::Create(DispatchLoad, UnwindBlock, Invokes.size(), DispatchBlock); + // Split the entry block to insert the conditional branch for the setjmp. + BasicBlock *ContBlock = EntryBB->splitBasicBlock(EntryBB->getTerminator(), + "eh.sjlj.setjmp.cont"); + + // Populate the Function Context + // 1. LSDA address + // 2. Personality function address + // 3. jmpbuf (save FP and call eh.sjlj.setjmp) + + // LSDA address + Idxs[0] = Zero; + Idxs[1] = ConstantInt::get(Int32Ty, 4); + Value *LSDAFieldPtr = + GetElementPtrInst::Create(FunctionContext, Idxs, Idxs+2, + "lsda_gep", + EntryBB->getTerminator()); + Value *LSDA = CallInst::Create(LSDAAddrFn, "lsda_addr", + EntryBB->getTerminator()); + new StoreInst(LSDA, LSDAFieldPtr, true, EntryBB->getTerminator()); + + Idxs[1] = ConstantInt::get(Int32Ty, 3); + Value *PersonalityFieldPtr = + GetElementPtrInst::Create(FunctionContext, Idxs, Idxs+2, + "lsda_gep", + EntryBB->getTerminator()); + new StoreInst(PersonalityFn, PersonalityFieldPtr, true, + EntryBB->getTerminator()); + + // Save the frame pointer. + Idxs[1] = ConstantInt::get(Int32Ty, 5); + Value *FieldPtr + = GetElementPtrInst::Create(FunctionContext, Idxs, Idxs+2, + "jbuf_gep", + EntryBB->getTerminator()); + Idxs[1] = ConstantInt::get(Int32Ty, 0); + Value *ElemPtr = + GetElementPtrInst::Create(FieldPtr, Idxs, Idxs+2, "jbuf_fp_gep", + EntryBB->getTerminator()); + + Value *Val = CallInst::Create(FrameAddrFn, + ConstantInt::get(Int32Ty, 0), + "fp", + EntryBB->getTerminator()); + new StoreInst(Val, ElemPtr, true, EntryBB->getTerminator()); + // Call the setjmp instrinsic. It fills in the rest of the jmpbuf + Value *SetjmpArg = + CastInst::Create(Instruction::BitCast, FieldPtr, + Type::getInt8Ty(F.getContext())->getPointerTo(), "", + EntryBB->getTerminator()); + Value *DispatchVal = CallInst::Create(BuiltinSetjmpFn, SetjmpArg, + "dispatch", + EntryBB->getTerminator()); + // check the return value of the setjmp. non-zero goes to dispatcher + Value *IsNormal = new ICmpInst(EntryBB->getTerminator(), + ICmpInst::ICMP_EQ, DispatchVal, Zero, + "notunwind"); + // Nuke the uncond branch. + EntryBB->getTerminator()->eraseFromParent(); + + // Put in a new condbranch in its place. + BranchInst::Create(ContBlock, DispatchBlock, IsNormal, EntryBB); + + // Register the function context and make sure it's known to not throw + CallInst *Register = + CallInst::Create(RegisterFn, FunctionContext, "", + ContBlock->getTerminator()); + Register->setDoesNotThrow(); + + // At this point, we are all set up, update the invoke instructions + // to mark their call_site values, and fill in the dispatch switch + // accordingly. + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) + markInvokeCallSite(Invokes[i], i+1, CallSite, DispatchSwitch); + + // The front end has likely added calls to _Unwind_Resume. We need + // to find those calls and mark the call_site as -1 immediately prior. + // resume is a noreturn function, so any block that has a call to it + // should end in an 'unreachable' instruction with the call immediately + // prior. That's how we'll search. + // ??? There's got to be a better way. this is fugly. + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) + if ((dyn_cast(BB->getTerminator()))) { + BasicBlock::iterator I = BB->getTerminator(); + // Check the previous instruction and see if it's a resume call + if (I == BB->begin()) continue; + if (CallInst *CI = dyn_cast(--I)) { + if (CI->getCalledFunction() == ResumeFn) { + Value *NegativeOne = ConstantInt::get(Int32Ty, -1); + new StoreInst(NegativeOne, CallSite, true, I); // volatile + } + } + } + + // Replace all unwinds with a branch to the unwind handler. + // ??? Should this ever happen with sjlj exceptions? + for (unsigned i = 0, e = Unwinds.size(); i != e; ++i) { + BranchInst::Create(UnwindBlock, Unwinds[i]); + Unwinds[i]->eraseFromParent(); + } + + // Finally, for any returns from this function, if this function contains an + // invoke, add a call to unregister the function context. + for (unsigned i = 0, e = Returns.size(); i != e; ++i) + CallInst::Create(UnregisterFn, FunctionContext, "", Returns[i]); + } + + return true; +} + +bool SjLjEHPass::runOnFunction(Function &F) { + bool Res = insertSjLjEHSupport(F); + return Res; +} From richard at xmos.com Mon Aug 17 11:47:22 2009 From: richard at xmos.com (Richard Osborne) Date: Mon, 17 Aug 2009 17:47:22 +0100 Subject: [llvm-commits] [llvm] r79078 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp In-Reply-To: <200908150608.n7F68Ytn013443@zion.cs.uiuc.edu> References: <200908150608.n7F68Ytn013443@zion.cs.uiuc.edu> Message-ID: <4A89899A.4000702@xmos.com> Chris Lattner wrote: > Author: lattner > Date: Sat Aug 15 01:08:34 2009 > New Revision: 79078 > > URL: http://llvm.org/viewvc/llvm-project?rev=79078&view=rev > Log: > If ELF subtargets don't want to support 4/8/16-byte mergable sections, allow > them to null out the default section pointers. > > Modified: > llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp > > Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=79078&r1=79077&r2=79078&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) > +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Sat Aug 15 01:08:34 2009 > @@ -578,11 +578,11 @@ > } > > if (Kind.isMergeableConst()) { > - if (Kind.isMergeableConst4()) > + if (Kind.isMergeableConst4() && MergeableConst4Section) > return MergeableConst4Section; > - if (Kind.isMergeableConst8()) > + if (Kind.isMergeableConst8() && MergeableConst8Section) > return MergeableConst8Section; > - if (Kind.isMergeableConst16()) > + if (Kind.isMergeableConst16() && MergeableConst16Section) > return MergeableConst16Section; > return ReadOnlySection; // .const > } > Hi Chris, In order to handle null mergable sections getSectionForConstant() also needs to be updated. I've fixed this in in r79249: http://llvm.org/viewvc/llvm-project?rev=79249&view=rev Regards, Richard From grosbach at apple.com Mon Aug 17 11:50:09 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 17 Aug 2009 16:50:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79251 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h Message-ID: <200908171650.n7HGo9MT027610@zion.cs.uiuc.edu> Author: grosbach Date: Mon Aug 17 11:50:09 2009 New Revision: 79251 URL: http://llvm.org/viewvc/llvm-project?rev=79251&view=rev Log: Move the sjlj exception handling conversions to a back-end pass where they more properly belong. This allows removing the front-end conditionalized SJLJ code, and cleans up the generated IR considerably. All of the infrastructure code (calling _Unwind_SjLj_Register/Unregister, etc) is added by the SjLjEHPrepare pass. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h 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=79251&r1=79250&r2=79251&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Aug 17 11:50:09 2009 @@ -158,7 +158,7 @@ TD(getTargetData()), Builder(Context, *TheFolder) { FnDecl = fndecl; Fn = 0; - ReturnBB = UnwindBB = DispatchBB = 0; + ReturnBB = UnwindBB = 0; ReturnOffset = 0; if (TheDebugInfo) { @@ -635,114 +635,14 @@ EmitAutomaticVariableDecl(TREE_VALUE(t)); } - // Register the frame with the unwind machinery if there are exception - // handling regions in the function. - if (USING_SJLJ_EXCEPTIONS && current_function_has_exception_handlers()) { - // We have exception regions, but we may or may not actually end up - // needing to actively do anything about it. We'll know at the end - // of the function by whether any landing pads have been created. - // So for now, we just create a block for where to add the necessary - // bits. - SjLjEHSetupBB = BasicBlock::Create(Context, "setup_sjlj_eh"); - Builder.CreateBr(SjLjEHSetupBB); - PostEntryBB = BasicBlock::Create(Context, "post_entry"); - EmitBlock(PostEntryBB); - } - // Create a new block for the return node, but don't insert it yet. ReturnBB = BasicBlock::Create(Context, "return"); } Function *TreeToLLVM::FinishFunctionBody() { - // If we're using SJLJ exceptions and there are any landing pads for this - // function, we need to insert the setup code in the prologue, and add - // the unregister call here. - if (USING_SJLJ_EXCEPTIONS && current_function_has_exception_handlers()) { - // Send the current BB to the return block just like it would if we - // weren't doing this bit. - Builder.CreateBr(ReturnBB); - - assert(SjLjEHSetupBB && "Exception handling needed but no setup block??"); - EmitBlock(SjLjEHSetupBB); - - if (LandingPads.size() > 0) { - // Get a pointer to the function context - llvm::Value *Idxs[2]; - Idxs[0] = ConstantInt::get(Type::getInt32Ty(Context), 0); - - // Assign the unwind personality function address - Idxs[1] = ConstantInt::get(Type::getInt32Ty(Context), 3); - Value *FieldPtr = Builder.CreateGEP (FunctionContext.Ptr, Idxs, Idxs+2, - "personality_gep"); - const Type *FieldTy = - cast(FieldPtr->getType())->getElementType(); - Value *Val = - Builder.CreateBitCast(DECL_LLVM(llvm_eh_personality_libfunc), FieldTy); - Builder.CreateStore(Val, FieldPtr); - - // Load the address for the language specific data area (LSDA) - Idxs[1] = ConstantInt::get(Type::getInt32Ty(Context), 4); - FieldPtr - = Builder.CreateGEP (FunctionContext.Ptr, Idxs, Idxs+2, "lsda_gep"); - FieldTy = cast(FieldPtr->getType())->getElementType(); - Val = - Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::eh_sjlj_lsda), - "eh_lsda"); - Builder.CreateStore(Val, FieldPtr); - - // builtin_setjmp() stuff goes here. - // 1. Save the frame pointer. - Idxs[1] = ConstantInt::get(Type::getInt32Ty(Context), 5); - FieldPtr - = Builder.CreateGEP (FunctionContext.Ptr, Idxs, Idxs+2, "jbuf_gep"); - Idxs[1] = ConstantInt::get(Type::getInt32Ty(Context), 0); - Value *ElemPtr - = Builder.CreateGEP (FieldPtr, Idxs, Idxs+2, "jbuf_fp_gep"); - FieldTy = cast(ElemPtr->getType())->getElementType(); - // FIXME: The EmitBuiltinExtractReturnAddr() function comes close to - // what we want here. Refactor it so that it does, or make a common - // helper function. - Val = Builder.CreateCall - (Intrinsic::getDeclaration(TheModule, Intrinsic::frameaddress), - ConstantInt::get(Type::getInt32Ty(Context), 0)); - Val = BitCastToType(Val, FieldTy); - Builder.CreateStore(Val, ElemPtr); - - FieldPtr = - BitCastToType(FieldPtr, Type::getInt8Ty(Context)->getPointerTo()); - Value *DispatchVal = Builder.CreateCall - (Intrinsic::getDeclaration(TheModule, Intrinsic::eh_sjlj_setjmp), - FieldPtr); - // check the return value of the setjmp. non-zero goes to dispatcher - Value *Zero = ConstantInt::get(Type::getInt32Ty(Context), 0); - Value *Compare = Builder.CreateICmpEQ(DispatchVal, Zero); - - // Branch on the compare. - DispatchBB = BasicBlock::Create(Context, "dispatch"); - BasicBlock *PostSetupBB = BasicBlock::Create(Context, "sjlj_eh_register"); - Builder.CreateCondBr(Compare, PostSetupBB, DispatchBB); - EmitBlock(PostSetupBB); - - // Register the context and note that this call cannot throw - CallInst *RegisterCall = - Builder.CreateCall(DECL_LLVM(llvm_unwind_sjlj_register_libfunc), - FunctionContext.Ptr); - } - // Go back to the end of the prologue - Builder.CreateBr(PostEntryBB); - } - // Insert the return block at the end of the function. EmitBlock(ReturnBB); - if (USING_SJLJ_EXCEPTIONS && LandingPads.size() > 0) { - // Un-register the frame with the unwind machinery if there are exception - // handling regions in the function. - Builder.CreateCall(DECL_LLVM(llvm_unwind_sjlj_unregister_libfunc), - FunctionContext.Ptr); - } - SmallVector RetVals; // If the function returns a value, get it into a register and return it now. @@ -802,22 +702,15 @@ Builder.CreateAggregateRet(RetVals.data(), RetVals.size()); // Emit pending exception handling code. - if (USING_SJLJ_EXCEPTIONS) { - EmitSjLjLandingPads(); - EmitPostPads(); - EmitSjLjDispatcher(); - EmitUnwindBlock(); - } else { - EmitLandingPads(); - EmitPostPads(); - EmitUnwindBlock(); - } + EmitLandingPads(); + EmitPostPads(); + EmitUnwindBlock(); // If this function takes the address of a label, emit the indirect goto // block. if (IndirectGotoBlock) { EmitBlock(IndirectGotoBlock); - + // Change the default destination to go to one of the other destinations, if // there is any other dest. SwitchInst *SI = cast(IndirectGotoBlock->getTerminator()); @@ -2018,9 +1911,6 @@ (IntPtr == Type::getInt32Ty(Context) ? Intrinsic::eh_typeid_for_i32 : Intrinsic::eh_typeid_for_i64)); - // For SJLJ, create a function context on the stack - if (USING_SJLJ_EXCEPTIONS) - FunctionContext = CreateTempLoc (ConvertType(sjlj_fc_type_node)); } /// getPostPad - Return the post landing pad for the given exception handling @@ -2041,158 +1931,6 @@ ((std::vector *)data)->push_back(region); } -/// EmitSjLjDispatcher - Emit SJLJ EH dispatcher -void TreeToLLVM::EmitSjLjDispatcher () { - if (DispatchBB) { - assert(LandingPads.size() > 0 && "Dispatch block without landing pads?"); - - EmitBlock(DispatchBB); - - // Get the call_site value - llvm::Value *Idxs[2]; - Idxs[0] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); - Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 1); - Value *FieldPtr = Builder.CreateGEP (FunctionContext.Ptr, Idxs, Idxs+2, - "call_site_gep"); - Value *CallSite = Builder.CreateLoad(FieldPtr, "call_site"); - - // Figure out which landing pad to go to via the call_site - // FIXME: would this be better as a switch? Probably. - unsigned FirstPad = 0; - for (unsigned region = 1 ; region < LandingPads.size() ; ++region) { - if (LandingPads[region]) { - if (!FirstPad) FirstPad = region; - Value *RegionNo = ConstantInt::get(llvm::Type::getInt32Ty(Context), region - 1); - Value *Compare = Builder.CreateICmpEQ(CallSite, RegionNo); - // Branch on the compare. - BasicBlock *NextDispatch = BasicBlock::Create(Context, "dispatch"); - Builder.CreateCondBr(Compare, LandingPads[region], NextDispatch); - EmitBlock(NextDispatch); - } - } - assert(FirstPad && "EH dispatcher, but no landing pads present!"); - Builder.CreateBr(LandingPads[FirstPad]); - } -} - - -/// EmitSjLjLandingPads - Emit EH landing pads. -void TreeToLLVM::EmitSjLjLandingPads() { - std::vector Args; - std::vector Handlers; - - for (unsigned i = 1; i < LandingPads.size(); ++i) { - BasicBlock *LandingPad = LandingPads[i]; - - if (!LandingPad) - continue; - - CreateExceptionValues(); - EmitBlock(LandingPad); - - // Get the exception value from the function context - llvm::Value *Idxs[2]; - Idxs[0] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); - Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 2); - Value *FCDataPtr - = Builder.CreateGEP (FunctionContext.Ptr, Idxs, Idxs+2, "fc_data_gep"); - Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); - Value *ElemPtr - = Builder.CreateGEP (FCDataPtr, Idxs, Idxs+2, "exception_gep"); - Value *Ex = Builder.CreateLoad (ElemPtr); - const Type *ExceptionValueTy = - cast(ExceptionValue->getType())->getElementType(); - Ex = CastToAnyType(Ex, false, ExceptionValueTy, false); - Builder.CreateStore(Ex, ExceptionValue); - - - // The exception and the personality function. - Args.push_back(Builder.CreateLoad(ExceptionValue, "eh_ptr")); - assert(llvm_eh_personality_libfunc - && "no exception handling personality function!"); - Args.push_back(BitCastToType(DECL_LLVM(llvm_eh_personality_libfunc), - PointerType::getUnqual(Type::getInt8Ty(Context)))); - // Add selections for each handler. - foreach_reachable_handler(i, false, AddHandler, &Handlers); - - for (std::vector::iterator I = Handlers.begin(), - E = Handlers.end(); I != E; ++I) { - struct eh_region *region = *I; - - // Create a post landing pad for the handler. - getPostPad(get_eh_region_number(region)); - int RegionKind = classify_eh_handler(region); - if (RegionKind < 0) { - // Filter - note the length. - tree TypeList = get_eh_type_list(region); - unsigned Length = list_length(TypeList); - Args.reserve(Args.size() + Length + 1); - Args.push_back(ConstantInt::get(Type::getInt32Ty(Context), Length + 1)); - - // Add the type infos. - for (; TypeList; TypeList = TREE_CHAIN(TypeList)) { - tree TType = lookup_type_for_runtime(TREE_VALUE(TypeList)); - Args.push_back(Emit(TType, 0)); - } - } else if (RegionKind > 0) { - // Catch. - tree TypeList = get_eh_type_list(region); - - if (!TypeList) { - // Catch-all - push a null pointer. - Args.push_back(Constant::getNullValue( - PointerType::getUnqual(Type::getInt8Ty(Context)))); - } else { - // Add the type infos. - for (; TypeList; TypeList = TREE_CHAIN(TypeList)) { - tree TType = lookup_type_for_runtime(TREE_VALUE(TypeList)); - Args.push_back(Emit(TType, 0)); - } - } - } - } - if (can_throw_external_1(i, false)) { - // Some exceptions from this region may not be caught by any handler. - // Since invokes are required to branch to the unwind label no matter - // what exception is being unwound, append a catch-all. - - // The representation of a catch-all is language specific. - Value *Catch_All; - // SJLJ exception runtime handles "all cleanups" just fine, unlike - // DWARF. - if (USING_SJLJ_EXCEPTIONS || !lang_eh_catch_all) { - // Use a "cleanup" - this should be good enough for most languages. - Catch_All = ConstantInt::get(Type::getInt32Ty(Context), 0); - } else { - tree catch_all_type = lang_eh_catch_all(); - if (catch_all_type == NULL_TREE) - // Use a C++ style null catch-all object. - Catch_All = - Constant::getNullValue(PointerType::getUnqual(Type::getInt8Ty(Context))); - else - // This language has a type that catches all others. - Catch_All = Emit(catch_all_type, 0); - } - Args.push_back(Catch_All); - } - // Emit the selector call. - Builder.CreateCall(FuncEHSelector, Args.begin(), Args.end(), - "eh_select"); - // Fetch and store the exception selector. - Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 1); - ElemPtr = Builder.CreateGEP (FCDataPtr, Idxs, Idxs+2, "handler_gep"); - Value *Select = Builder.CreateLoad (ElemPtr); - Builder.CreateStore(Select, ExceptionSelectorValue); - // Branch to the post landing pad for the first reachable handler. - assert(!Handlers.empty() && "Landing pad but no handler?"); - Builder.CreateBr(getPostPad(get_eh_region_number(*Handlers.begin()))); - - Handlers.clear(); - Args.clear(); - } -} - - /// EmitLandingPads - Emit EH landing pads. void TreeToLLVM::EmitLandingPads() { std::vector Args; @@ -2270,7 +2008,7 @@ // The representation of a catch-all is language specific. Value *CatchAll; - if (!lang_eh_catch_all) { + if (USING_SJLJ_EXCEPTIONS || !lang_eh_catch_all) { // Use a "cleanup" - this should be good enough for most languages. CatchAll = ConstantInt::get(Type::getInt32Ty(Context), 0); } else { @@ -2418,17 +2156,6 @@ if (UnwindBB) { CreateExceptionValues(); EmitBlock(UnwindBB); - if (USING_SJLJ_EXCEPTIONS) { - // Mark the call_site as -1 since we're signalling to continue - // the unwind now. - llvm::Value *Idxs[2]; - Idxs[0] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); - Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 1); - Value *FieldPtr = Builder.CreateGEP (FunctionContext.Ptr, Idxs, Idxs+2, - "call_site_gep"); - const Type *FieldTy = cast(FieldPtr->getType())->getElementType(); - Builder.CreateStore(ConstantInt::get(FieldTy, (uint64_t)-1, true), FieldPtr); - } // Fetch and store exception handler. Value *Arg = Builder.CreateLoad(ExceptionValue, "eh_ptr"); assert(llvm_unwind_resume_libfunc && "no unwind resume function!"); @@ -2935,25 +2662,6 @@ ThisPad = BasicBlock::Create(Context, "lpad"); LandingPad = ThisPad; - - if (USING_SJLJ_EXCEPTIONS) { - CreateExceptionValues(); - // Mark the call site so we'll dispatch to the right landing pad - // when we get an exception passed back. - llvm::Value *Idxs[2]; - Idxs[0] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); - Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 1); - Value *FieldPtr = Builder.CreateGEP (FunctionContext.Ptr, - Idxs, Idxs+2, "call_site_gep"); - const Type *FieldTy = - cast(FieldPtr->getType())->getElementType(); - Constant *CallSiteIdx = ConstantInt::get(FieldTy, RegionNo, true); - Builder.CreateStore(CallSiteIdx, FieldPtr); - // Tell the back end what the call-site value is - Builder.CreateCall - (Intrinsic::getDeclaration(TheModule, Intrinsic::eh_sjlj_callsite), - CallSiteIdx); - } } else { assert(can_throw_external_1(RegionNo, false) && "Must-not-throw region handled by runtime?"); Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=79251&r1=79250&r2=79251&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Aug 17 11:50:09 2009 @@ -296,13 +296,9 @@ const TargetData &TD; tree_node *FnDecl; Function *Fn; - BasicBlock *SjLjEHSetupBB; - BasicBlock *PostEntryBB; BasicBlock *ReturnBB; BasicBlock *UnwindBB; - BasicBlock *DispatchBB; unsigned ReturnOffset; - MemRef FunctionContext; // For SJLJ exception handling // State that changes as the function is emitted. From nicholas at mxc.ca Mon Aug 17 12:00:57 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 17 Aug 2009 17:00:57 -0000 Subject: [llvm-commits] [llvm] r79252 - in /llvm/trunk: lib/Transforms/Utils/SSI.cpp test/Transforms/SSI/2009-08-17-CritEdge.ll Message-ID: <200908171700.n7HH0v8p028957@zion.cs.uiuc.edu> Author: nicholas Date: Mon Aug 17 12:00:57 2009 New Revision: 79252 URL: http://llvm.org/viewvc/llvm-project?rev=79252&view=rev Log: Don't crash on critical edge. Patch by Andre Tavares. Added: llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll Modified: llvm/trunk/lib/Transforms/Utils/SSI.cpp Modified: llvm/trunk/lib/Transforms/Utils/SSI.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSI.cpp?rev=79252&r1=79251&r2=79252&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SSI.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SSI.cpp Mon Aug 17 12:00:57 2009 @@ -95,7 +95,7 @@ // Next Basic Block BasicBlock *BB_next = TI->getSuccessor(j); if (BB_next != BB && - BB_next->getUniquePredecessor() != NULL && + BB_next->getSinglePredecessor() != NULL && dominateAny(BB_next, value[i])) { PHINode *PN = PHINode::Create( value[i]->getType(), SSI_SIG, BB_next->begin()); Added: llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll?rev=79252&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll (added) +++ llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll Mon Aug 17 12:00:57 2009 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | opt -abcd -disable-output + +define void @test(i32 %x) { +entry: + br label %label1 +label1: + %A = phi i32 [ 0, %entry ], [ %A.1, %label2 ] + %B = icmp slt i32 %A, %x + br i1 %B, label %label2, label %label2 +label2: + %A.1 = add i32 %A, 1 + br label %label1 +label3: ; No predecessors! + ret void +} From benny.kra at googlemail.com Mon Aug 17 12:05:44 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Mon, 17 Aug 2009 17:05:44 -0000 Subject: [llvm-commits] [llvm] r79253 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Message-ID: <200908171705.n7HH5iHV029556@zion.cs.uiuc.edu> Author: d0k Date: Mon Aug 17 12:05:44 2009 New Revision: 79253 URL: http://llvm.org/viewvc/llvm-project?rev=79253&view=rev Log: Clear the uniquing table when initializing TLOF to avoid a crash when the TLOF is reinitialized with a different MCContext. Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=79253&r1=79252&r2=79253&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Mon Aug 17 12:05:44 2009 @@ -304,6 +304,8 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx, const TargetMachine &TM) { + if (UniquingMap != 0) + ((ELFUniqueMapTy*)UniquingMap)->clear(); TargetLoweringObjectFile::Initialize(Ctx, TM); BSSSection = @@ -666,6 +668,8 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx, const TargetMachine &TM) { + if (UniquingMap != 0) + ((MachOUniqueMapTy*)UniquingMap)->clear(); TargetLoweringObjectFile::Initialize(Ctx, TM); TextSection // .text @@ -946,6 +950,8 @@ void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx, const TargetMachine &TM) { + if (UniquingMap != 0) + ((COFFUniqueMapTy*)UniquingMap)->clear(); TargetLoweringObjectFile::Initialize(Ctx, TM); TextSection = getCOFFSection("\t.text", true, SectionKind::getText()); DataSection = getCOFFSection("\t.data", true, SectionKind::getDataRel()); From resistor at mac.com Mon Aug 17 12:07:22 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 17 Aug 2009 17:07:22 -0000 Subject: [llvm-commits] [llvm] r79254 - /llvm/trunk/lib/System/Unix/Signals.inc Message-ID: <200908171707.n7HH7Mw7029765@zion.cs.uiuc.edu> Author: resistor Date: Mon Aug 17 12:07:22 2009 New Revision: 79254 URL: http://llvm.org/viewvc/llvm-project?rev=79254&view=rev Log: Add locking around signal handler registration. Modified: llvm/trunk/lib/System/Unix/Signals.inc Modified: llvm/trunk/lib/System/Unix/Signals.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Signals.inc?rev=79254&r1=79253&r2=79254&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Signals.inc (original) +++ llvm/trunk/lib/System/Unix/Signals.inc Mon Aug 17 12:07:22 2009 @@ -14,6 +14,7 @@ #include "Unix.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/System/Mutex.h" #include #include #if HAVE_EXECINFO_H @@ -33,6 +34,8 @@ static RETSIGTYPE SignalHandler(int Sig); // defined below. +static SmartMutex SignalsMutex; + /// InterruptFunction - The function to call if ctrl-c is pressed. static void (*InterruptFunction)() = 0; @@ -113,6 +116,7 @@ sigfillset(&SigMask); sigprocmask(SIG_UNBLOCK, &SigMask, 0); + SignalsMutex.acquire(); if (FilesToRemove != 0) while (!FilesToRemove->empty()) { FilesToRemove->back().eraseFromDisk(true); @@ -122,14 +126,19 @@ if (std::find(IntSigs, IntSigsEnd, Sig) != IntSigsEnd) { if (InterruptFunction) { void (*IF)() = InterruptFunction; + SignalsMutex.release(); InterruptFunction = 0; IF(); // run the interrupt function. return; } + + SignalsMutex.release(); raise(Sig); // Execute the default handler. return; } + SignalsMutex.release(); + // Otherwise if it is a fault (like SEGV) run any handler. if (CallBacksToRun) for (unsigned i = 0, e = CallBacksToRun->size(); i != e; ++i) @@ -139,18 +148,23 @@ void llvm::sys::SetInterruptFunction(void (*IF)()) { + SignalsMutex.acquire(); InterruptFunction = IF; + SignalsMutex.release(); RegisterHandlers(); } // RemoveFileOnSignal - The public API bool llvm::sys::RemoveFileOnSignal(const sys::Path &Filename, std::string* ErrMsg) { + SignalsMutex.acquire(); if (FilesToRemove == 0) FilesToRemove = new std::vector(); FilesToRemove->push_back(Filename); + SignalsMutex.release(); + RegisterHandlers(); return false; } From resistor at mac.com Mon Aug 17 12:10:58 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 17 Aug 2009 17:10:58 -0000 Subject: [llvm-commits] [llvm] r79255 - /llvm/trunk/lib/VMCore/Attributes.cpp Message-ID: <200908171710.n7HHAwGZ030263@zion.cs.uiuc.edu> Author: resistor Date: Mon Aug 17 12:10:58 2009 New Revision: 79255 URL: http://llvm.org/viewvc/llvm-project?rev=79255&view=rev Log: Add locking around the attributes list. Modified: llvm/trunk/lib/VMCore/Attributes.cpp Modified: llvm/trunk/lib/VMCore/Attributes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=79255&r1=79254&r2=79255&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Attributes.cpp (original) +++ llvm/trunk/lib/VMCore/Attributes.cpp Mon Aug 17 12:10:58 2009 @@ -15,6 +15,7 @@ #include "llvm/Type.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/FoldingSet.h" +#include "llvm/System/Mutex.h" #include "llvm/Support/Streams.h" #include "llvm/Support/ManagedStatic.h" using namespace llvm; @@ -124,9 +125,11 @@ }; } +static ManagedStatic > ALMutex; static ManagedStatic > AttributesLists; AttributeListImpl::~AttributeListImpl() { + sys::SmartScopedLock Lock(*ALMutex); AttributesLists->RemoveNode(this); } @@ -149,6 +152,9 @@ FoldingSetNodeID ID; AttributeListImpl::Profile(ID, Attrs, NumAttrs); void *InsertPos; + + sys::SmartScopedLock Lock(*ALMutex); + AttributeListImpl *PAL = AttributesLists->FindNodeOrInsertPos(ID, InsertPos); From clattner at apple.com Mon Aug 17 12:19:06 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Aug 2009 10:19:06 -0700 Subject: [llvm-commits] [llvm] r79078 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp In-Reply-To: <4A89899A.4000702@xmos.com> References: <200908150608.n7F68Ytn013443@zion.cs.uiuc.edu> <4A89899A.4000702@xmos.com> Message-ID: On Aug 17, 2009, at 9:47 AM, Richard Osborne wrote: > In order to handle null mergable sections getSectionForConstant() also > needs to be updated. I've fixed this in in r79249: > > http://llvm.org/viewvc/llvm-project?rev=79249&view=rev Looks great, thanks Richard! -Chris From espindola at google.com Mon Aug 17 12:19:55 2009 From: espindola at google.com (Rafael Espindola) Date: Mon, 17 Aug 2009 18:19:55 +0100 Subject: [llvm-commits] [patch][llvm-gcc] Port -no-canonical-prefixes In-Reply-To: <022C59FB-0E96-408E-B9D7-9D52BA32A006@apple.com> References: <38a0d8450908160041k33186be4rfa183eee0023ad1e@mail.gmail.com> <022C59FB-0E96-408E-B9D7-9D52BA32A006@apple.com> Message-ID: <38a0d8450908171019l3a2db97epf58a6900991255c1@mail.gmail.com> (now with llvm-commits included) 2009/8/17 Chris Lattner : > > On Aug 16, 2009, at 12:41 AM, Rafael Espindola wrote: > Hi Rafael, can you get the author to send an email confirming that it is ok > with them to license it under GPL2 to this list? ?While I believe you, a > court might not :) The patch was written by Simon Baldwin. He works for Google and was OK with us porting the patch. On similar cases before we also got approval from Daniel Berlin to port gcc patches written by Google. > -Chris Cheers, -- Rafael Avila de Espindola Google | Gordon House | Barrow Street | Dublin 4 | Ireland Registered in Dublin, Ireland | Registration Number: 368047 From resistor at mac.com Mon Aug 17 12:34:28 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 17 Aug 2009 17:34:28 -0000 Subject: [llvm-commits] [llvm] r79256 - in /llvm/trunk/lib/VMCore: LLVMContextImpl.h Type.cpp Message-ID: <200908171734.n7HHYSE6000682@zion.cs.uiuc.edu> Author: resistor Date: Mon Aug 17 12:34:27 2009 New Revision: 79256 URL: http://llvm.org/viewvc/llvm-project?rev=79256&view=rev Log: Move the TypeMap lock to a member on LLVMContextImpl. Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=79256&r1=79255&r2=79256&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Mon Aug 17 12:34:27 2009 @@ -20,6 +20,7 @@ #include "llvm/LLVMContext.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" +#include "llvm/System/Mutex.h" #include "llvm/System/RWMutex.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" @@ -132,6 +133,9 @@ ConstantInt *TheTrueVal; ConstantInt *TheFalseVal; + // Lock used for guarding access to the type maps. + sys::SmartMutex TypeMapLock; + TypeMap ArrayTypes; TypeMap VectorTypes; TypeMap PointerTypes; Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=79256&r1=79255&r2=79256&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Mon Aug 17 12:34:27 2009 @@ -47,9 +47,6 @@ // Type Class Implementation //===----------------------------------------------------------------------===// -// Lock used for guarding access to the type maps. -static ManagedStatic > TypeMapLock; - // Recursive lock used for guarding access to AbstractTypeUsers. // NOTE: The true template parameter means this will no-op when we're not in // multithreaded mode. @@ -759,7 +756,7 @@ // First, see if the type is already in the table, for which // a reader lock suffices. - sys::SmartScopedLock L(*TypeMapLock); + sys::SmartScopedLock L(pImpl->TypeMapLock); ITy = pImpl->IntegerTypes.get(IVT); if (!ITy) { @@ -801,7 +798,7 @@ LLVMContextImpl *pImpl = ReturnType->getContext().pImpl; - sys::SmartScopedLock L(*TypeMapLock); + sys::SmartScopedLock L(pImpl->TypeMapLock); FT = pImpl->FunctionTypes.get(VT); if (!FT) { @@ -826,7 +823,7 @@ LLVMContextImpl *pImpl = ElementType->getContext().pImpl; - sys::SmartScopedLock L(*TypeMapLock); + sys::SmartScopedLock L(pImpl->TypeMapLock); AT = pImpl->ArrayTypes.get(AVT); if (!AT) { @@ -860,7 +857,7 @@ LLVMContextImpl *pImpl = ElementType->getContext().pImpl; - sys::SmartScopedLock L(*TypeMapLock); + sys::SmartScopedLock L(pImpl->TypeMapLock); PT = pImpl->VectorTypes.get(PVT); if (!PT) { @@ -892,7 +889,7 @@ LLVMContextImpl *pImpl = Context.pImpl; - sys::SmartScopedLock L(*TypeMapLock); + sys::SmartScopedLock L(pImpl->TypeMapLock); ST = pImpl->StructTypes.get(STV); if (!ST) { @@ -948,7 +945,7 @@ LLVMContextImpl *pImpl = ValueType->getContext().pImpl; - sys::SmartScopedLock L(*TypeMapLock); + sys::SmartScopedLock L(pImpl->TypeMapLock); PT = pImpl->PointerTypes.get(PVT); if (!PT) { @@ -1108,7 +1105,7 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) { // All recursive calls will go through unlockedRefineAbstractTypeTo, // to avoid deadlock problems. - sys::SmartScopedLock L(*TypeMapLock); + sys::SmartScopedLock L(NewType->getContext().pImpl->TypeMapLock); unlockedRefineAbstractTypeTo(NewType); } From nicholas at mxc.ca Mon Aug 17 12:41:29 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 17 Aug 2009 17:41:29 -0000 Subject: [llvm-commits] [llvm] r79257 - /llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll Message-ID: <200908171741.n7HHfTT9001559@zion.cs.uiuc.edu> Author: nicholas Date: Mon Aug 17 12:41:29 2009 New Revision: 79257 URL: http://llvm.org/viewvc/llvm-project?rev=79257&view=rev Log: Test the pass the test is actually for, instead of one that doesn't exist. Modified: llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll Modified: llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll?rev=79257&r1=79256&r2=79257&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll (original) +++ llvm/trunk/test/Transforms/SSI/2009-08-17-CritEdge.ll Mon Aug 17 12:41:29 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -abcd -disable-output +; RUN: llvm-as < %s | opt -ssi-everything -disable-output define void @test(i32 %x) { entry: From resistor at mac.com Mon Aug 17 12:59:36 2009 From: resistor at mac.com (Owen Anderson) Date: Mon, 17 Aug 2009 17:59:36 -0000 Subject: [llvm-commits] [llvm] r79258 - in /llvm/trunk/lib/VMCore: LLVMContextImpl.h Type.cpp Message-ID: <200908171759.n7HHxaYm003835@zion.cs.uiuc.edu> Author: resistor Date: Mon Aug 17 12:59:35 2009 New Revision: 79258 URL: http://llvm.org/viewvc/llvm-project?rev=79258&view=rev Log: Privatize the last bits of static type state. Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=79258&r1=79257&r2=79258&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Mon Aug 17 12:59:35 2009 @@ -22,6 +22,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/System/Mutex.h" #include "llvm/System/RWMutex.h" +#include "llvm/Assembly/Writer.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/DenseMap.h" @@ -136,6 +137,18 @@ // Lock used for guarding access to the type maps. sys::SmartMutex TypeMapLock; + // Recursive lock used for guarding access to AbstractTypeUsers. + // NOTE: The true template parameter means this will no-op when we're not in + // multithreaded mode. + sys::SmartMutex AbstractTypeUsersLock; + + // Concrete/Abstract TypeDescriptions - We lazily calculate type descriptions + // for types as they are needed. Because resolution of types must invalidate + // all of the abstract type descriptions, we keep them in a seperate map to + // make this easy. + TypePrinting ConcreteTypeDescriptions; + TypePrinting AbstractTypeDescriptions; + TypeMap ArrayTypes; TypeMap VectorTypes; TypeMap PointerTypes; Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=79258&r1=79257&r2=79258&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Mon Aug 17 12:59:35 2009 @@ -47,18 +47,6 @@ // Type Class Implementation //===----------------------------------------------------------------------===// -// Recursive lock used for guarding access to AbstractTypeUsers. -// NOTE: The true template parameter means this will no-op when we're not in -// multithreaded mode. -static ManagedStatic > AbstractTypeUsersLock; - -// Concrete/Abstract TypeDescriptions - We lazily calculate type descriptions -// for types as they are needed. Because resolution of types must invalidate -// all of the abstract type descriptions, we keep them in a seperate map to make -// this easy. -static ManagedStatic ConcreteTypeDescriptions; -static ManagedStatic AbstractTypeDescriptions; - /// Because of the way Type subclasses are allocated, this function is necessary /// to use the correct kind of "delete" operator to deallocate the Type object. /// Some type objects (FunctionTy, StructTy) allocate additional space after @@ -273,8 +261,11 @@ std::string Type::getDescription() const { + LLVMContextImpl *pImpl = getContext().pImpl; TypePrinting &Map = - isAbstract() ? *AbstractTypeDescriptions : *ConcreteTypeDescriptions; + isAbstract() ? + pImpl->AbstractTypeDescriptions : + pImpl->ConcreteTypeDescriptions; std::string DescStr; raw_string_ostream DescOS(DescStr); @@ -983,9 +974,10 @@ // it. This function is called primarily by the PATypeHandle class. void Type::addAbstractTypeUser(AbstractTypeUser *U) const { assert(isAbstract() && "addAbstractTypeUser: Current type not abstract!"); - AbstractTypeUsersLock->acquire(); + LLVMContextImpl *pImpl = getContext().pImpl; + pImpl->AbstractTypeUsersLock.acquire(); AbstractTypeUsers.push_back(U); - AbstractTypeUsersLock->release(); + pImpl->AbstractTypeUsersLock.release(); } @@ -995,7 +987,8 @@ // is annihilated, because there is no way to get a reference to it ever again. // void Type::removeAbstractTypeUser(AbstractTypeUser *U) const { - AbstractTypeUsersLock->acquire(); + LLVMContextImpl *pImpl = getContext().pImpl; + pImpl->AbstractTypeUsersLock.acquire(); // Search from back to front because we will notify users from back to // front. Also, it is likely that there will be a stack like behavior to @@ -1024,7 +1017,7 @@ this->destroy(); } - AbstractTypeUsersLock->release(); + pImpl->AbstractTypeUsersLock.release(); } // unlockedRefineAbstractTypeTo - This function is used when it is discovered @@ -1038,9 +1031,10 @@ assert(this != NewType && "Can't refine to myself!"); assert(ForwardType == 0 && "This type has already been refined!"); + LLVMContextImpl *pImpl = getContext().pImpl; + // The descriptions may be out of date. Conservatively clear them all! - if (AbstractTypeDescriptions.isConstructed()) - AbstractTypeDescriptions->clear(); + pImpl->AbstractTypeDescriptions.clear(); #ifdef DEBUG_MERGE_TYPES DOUT << "REFINING abstract type [" << (void*)this << " " @@ -1075,7 +1069,7 @@ // will not cause users to drop off of the use list. If we resolve to ourself // we succeed! // - AbstractTypeUsersLock->acquire(); + pImpl->AbstractTypeUsersLock.acquire(); while (!AbstractTypeUsers.empty() && NewTy != this) { AbstractTypeUser *User = AbstractTypeUsers.back(); @@ -1091,7 +1085,7 @@ assert(AbstractTypeUsers.size() != OldSize && "AbsTyUser did not remove self from user list!"); } - AbstractTypeUsersLock->release(); + pImpl->AbstractTypeUsersLock.release(); // If we were successful removing all users from the type, 'this' will be // deleted when the last PATypeHolder is destroyed or updated from this type. @@ -1117,7 +1111,9 @@ DOUT << "typeIsREFINED type: " << (void*)this << " " << *this << "\n"; #endif - AbstractTypeUsersLock->acquire(); + LLVMContextImpl *pImpl = getContext().pImpl; + + pImpl->AbstractTypeUsersLock.acquire(); unsigned OldSize = AbstractTypeUsers.size(); OldSize=OldSize; while (!AbstractTypeUsers.empty()) { AbstractTypeUser *ATU = AbstractTypeUsers.back(); @@ -1126,7 +1122,7 @@ assert(AbstractTypeUsers.size() < OldSize-- && "AbstractTypeUser did not remove itself from the use list!"); } - AbstractTypeUsersLock->release(); + pImpl->AbstractTypeUsersLock.release(); } // refineAbstractType - Called when a contained type is found to be more From brukman+llvm at gmail.com Mon Aug 17 13:11:11 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Mon, 17 Aug 2009 18:11:11 -0000 Subject: [llvm-commits] [TV] r79260 - /television/trunk/Makefile.common Message-ID: <200908171811.n7HIBBIK005238@zion.cs.uiuc.edu> Author: brukman Date: Mon Aug 17 13:11:11 2009 New Revision: 79260 URL: http://llvm.org/viewvc/llvm-project?rev=79260&view=rev Log: We want to set ProjLibs* and ProjUsedLibs options, not ExtraLibs. Modified: television/trunk/Makefile.common Modified: television/trunk/Makefile.common URL: http://llvm.org/viewvc/llvm-project/television/trunk/Makefile.common?rev=79260&r1=79259&r2=79260&view=diff ============================================================================== --- television/trunk/Makefile.common (original) +++ television/trunk/Makefile.common Mon Aug 17 13:11:11 2009 @@ -7,14 +7,10 @@ # #===------------------------------------------------------------------------===# -# # Include the local config file -# include $(LEVEL)/Makefile.config -# # Include LLVM's Master Makefile. -# include $(LLVM_SRC_ROOT)/Makefile.rules # Make sure we can access PoolAlloc's headers and libraries @@ -29,5 +25,7 @@ PAUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(PALIBS))) PALibsPaths := $(addprefix $(PALibDir)/,$(PAUsedLibs)) -ExtraLibs += $(PALibsPaths) +ProjLibsOptions += $(PALibsOptions) +ProjLibsPaths += $(PALibsPaths) +ProjUsedLibs += $(PAUsedLibs) endif From stoklund at 2pi.dk Mon Aug 17 13:13:29 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 17 Aug 2009 20:13:29 +0200 Subject: [llvm-commits] [PATCH] Simplify RegScavenger::FindUnusedReg Message-ID: <9E88B301-C6D5-4CE2-A40B-47287E773FE2@2pi.dk> Hi, The attached patch simplifies RegScavenger::FindUnusedReg() by removing the "Candidates" argument. It also fixes a potential bug where FindUnusedReg() could return a register with in-use aliases. The RegScavenger is now tracking spilled callee saved registers, so there is no longer a need for the "Candidates" argument or the "ExCalleeSaved" variant. Since I am changing the RegScavenger API just before the upcoming code freeze, I thought I had better ask for a review before committing. /jakob -------------- next part -------------- A non-text attachment was scrubbed... Name: simpl-unused.patch Type: application/octet-stream Size: 7003 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/c41dda3c/attachment.obj -------------- next part -------------- From echristo at apple.com Mon Aug 17 13:21:56 2009 From: echristo at apple.com (Eric Christopher) Date: Mon, 17 Aug 2009 11:21:56 -0700 Subject: [llvm-commits] cross building fixes In-Reply-To: <305d6f60908120132j209c4b4fybdc6b12aaa3a44a6@mail.gmail.com> References: <305d6f60908050259l157641b6x8dcb87bf8a431536@mail.gmail.com> <305d6f60908051557t641e2f89if99c34e675c6b6df@mail.gmail.com> <305d6f60908120132j209c4b4fybdc6b12aaa3a44a6@mail.gmail.com> Message-ID: <1DB71460-2B97-4219-A8FD-4AC5471F3FFC@apple.com> On Aug 12, 2009, at 1:32 AM, Sandeep Patel wrote: > ping? Please also add *-*-elf along with *-*-eabi and then it's OK. thanks. -eric From daniel at zuster.org Mon Aug 17 13:41:42 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 17 Aug 2009 18:41:42 -0000 Subject: [llvm-commits] [llvm] r79262 - /llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Message-ID: <200908171841.n7HIfgC4009107@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 17 13:41:42 2009 New Revision: 79262 URL: http://llvm.org/viewvc/llvm-project?rev=79262&view=rev Log: Fix build warning. Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=79262&r1=79261&r2=79262&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (original) +++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Mon Aug 17 13:41:42 2009 @@ -499,7 +499,7 @@ if (I == BB->begin()) continue; if (CallInst *CI = dyn_cast(--I)) { if (CI->getCalledFunction() == ResumeFn) { - Value *NegativeOne = ConstantInt::get(Int32Ty, -1); + Value *NegativeOne = Constant::getAllOnesValue(Int32Ty); new StoreInst(NegativeOne, CallSite, true, I); // volatile } } From gohman at apple.com Mon Aug 17 13:45:32 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 17 Aug 2009 18:45:32 -0000 Subject: [llvm-commits] [llvm] r79263 - /llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp Message-ID: <200908171845.n7HIjWYC009598@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 17 13:45:31 2009 New Revision: 79263 URL: http://llvm.org/viewvc/llvm-project?rev=79263&view=rev Log: Update comments to new-style syntax. Modified: llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp Modified: llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp?rev=79263&r1=79262&r2=79263&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp Mon Aug 17 13:45:31 2009 @@ -29,8 +29,8 @@ STATISTIC(NumLowered, "Number of allocations lowered"); namespace { - /// LowerAllocations - Turn malloc and free instructions into %malloc and - /// %free calls. + /// LowerAllocations - Turn malloc and free instructions into @malloc and + /// @free calls. /// class VISIBILITY_HIDDEN LowerAllocations : public BasicBlockPass { Constant *MallocFunc; // Functions in the module we are processing From benny.kra at googlemail.com Mon Aug 17 13:47:11 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Mon, 17 Aug 2009 18:47:11 -0000 Subject: [llvm-commits] [llvm] r79264 - /llvm/trunk/lib/CodeGen/CMakeLists.txt Message-ID: <200908171847.n7HIlBjx009816@zion.cs.uiuc.edu> Author: d0k Date: Mon Aug 17 13:47:11 2009 New Revision: 79264 URL: http://llvm.org/viewvc/llvm-project?rev=79264&view=rev Log: Update CMakeLists. Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CMakeLists.txt?rev=79264&r1=79263&r2=79264&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CMakeLists.txt (original) +++ llvm/trunk/lib/CodeGen/CMakeLists.txt Mon Aug 17 13:47:11 2009 @@ -56,6 +56,7 @@ ShadowStackGC.cpp ShrinkWrapping.cpp SimpleRegisterCoalescing.cpp + SjLjEHPrepare.cpp Spiller.cpp StackProtector.cpp StackSlotColoring.cpp From isanbard at gmail.com Mon Aug 17 13:53:08 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 17 Aug 2009 18:53:08 -0000 Subject: [llvm-commits] [llvm] r79266 - /llvm/tags/Apple/llvmCore-2301/ Message-ID: <200908171853.n7HIr8vo010576@zion.cs.uiuc.edu> Author: void Date: Mon Aug 17 13:53:08 2009 New Revision: 79266 URL: http://llvm.org/viewvc/llvm-project?rev=79266&view=rev Log: Creating llvmCore-2301 from Leela. Added: llvm/tags/Apple/llvmCore-2301/ - copied from r79265, llvm/branches/Apple/Leela/ From isanbard at gmail.com Mon Aug 17 13:53:16 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 17 Aug 2009 18:53:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79267 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2301/ Message-ID: <200908171853.n7HIrGPh010608@zion.cs.uiuc.edu> Author: void Date: Mon Aug 17 13:53:16 2009 New Revision: 79267 URL: http://llvm.org/viewvc/llvm-project?rev=79267&view=rev Log: Creating llvmgcc42-2301 from Leela. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2301/ - copied from r79266, llvm-gcc-4.2/branches/Apple/Leela/ From grosbach at apple.com Mon Aug 17 15:25:04 2009 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 17 Aug 2009 20:25:04 -0000 Subject: [llvm-commits] [llvm] r79272 - in /llvm/trunk: docs/ExceptionHandling.html include/llvm/CodeGen/MachineFunction.h include/llvm/Intrinsics.td lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/MachineFunction.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200908172025.n7HKP4ZY022540@zion.cs.uiuc.edu> Author: grosbach Date: Mon Aug 17 15:25:04 2009 New Revision: 79272 URL: http://llvm.org/viewvc/llvm-project?rev=79272&view=rev Log: Remove a bit more cruft from the sjlj moving to a backend pass. Modified: llvm/trunk/docs/ExceptionHandling.html llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/Intrinsics.td llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/MachineFunction.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/docs/ExceptionHandling.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ExceptionHandling.html?rev=79272&r1=79271&r2=79272&view=diff ============================================================================== --- llvm/trunk/docs/ExceptionHandling.html (original) +++ llvm/trunk/docs/ExceptionHandling.html Mon Aug 17 15:25:04 2009 @@ -38,7 +38,6 @@
  • llvm.eh.sjlj.setjmp
  • llvm.eh.sjlj.longjmp
  • llvm.eh.sjlj.lsda
  • -
  • llvm.eh.sjlj.callsite
  • Asm Table Formats
      @@ -472,24 +471,6 @@ - - -
      - -
      -  void %llvm.eh.sjlj.callsite(i32)
      -
      - -

      The SJLJ front-end allocates call site indices for invoke instrucitons. - These values are passed to the back-end via the - llvm.eh.sjlj.callsite - intrinsic, where they are used to build the LSDA call-site table.

      - -
      - - Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=79272&r1=79271&r2=79272&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Aug 17 15:25:04 2009 @@ -115,15 +115,6 @@ // The alignment of the function. unsigned Alignment; - // The currently active call_site value - unsigned CallSiteIndex; - - // The largest call_site value encountered - unsigned MaxCallSiteIndex; - - // Call sites mapped to corresponding landing pads - std::map LandingPadCallSiteIndexMap; - public: MachineFunction(Function *Fn, const TargetMachine &TM); ~MachineFunction(); @@ -169,41 +160,6 @@ /// void setAlignment(unsigned A) { Alignment = A; } - /// getCallSiteIndex() - Get the current call site index - /// - unsigned getCallSiteIndex() { return CallSiteIndex; } - - /// setCallSiteIndex() - Set the current call site index - /// - void setCallSiteIndex(unsigned Idx) { - CallSiteIndex = Idx; - if (CallSiteIndex > MaxCallSiteIndex) - MaxCallSiteIndex = CallSiteIndex; - } - - /// getMaxCallSiteIndex() - Get the largest call site index issued - /// - unsigned getMaxCallSiteIndex() { return MaxCallSiteIndex; } - - /// setCallSiteIndexLandingPad() - Map the call site to a landing pad - /// - void setLandingPadCallSiteIndex(MachineBasicBlock *LandingPad, - unsigned CallSite) { - LandingPadCallSiteIndexMap[LandingPad] = CallSite; - } - - /// getCallSiteIndexLandingPad() - Get landing pad for the call site index - /// - unsigned getLandingPadCallSiteIndex(MachineBasicBlock *LandingPad) { - return LandingPadCallSiteIndexMap[LandingPad]; - } - - /// getCallSiteCount() - Get the count of call site entries - /// - unsigned getCallSiteCount() { - return LandingPadCallSiteIndexMap.size(); - } - /// MachineFunctionInfo - Keep track of various per-function pieces of /// information for backends that would like to do so. /// Modified: llvm/trunk/include/llvm/Intrinsics.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=79272&r1=79271&r2=79272&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.td (original) +++ llvm/trunk/include/llvm/Intrinsics.td Mon Aug 17 15:25:04 2009 @@ -310,9 +310,6 @@ def int_eh_sjlj_longjmp : Intrinsic<[llvm_void_ty], [llvm_ptr_ty]>; def int_eh_sjlj_lsda : Intrinsic<[llvm_ptr_ty]>; } -let Properties = [IntrWriteMem] in { - def int_eh_sjlj_callsite: Intrinsic<[llvm_void_ty], [llvm_i32_ty]>; -} //===---------------- Generic Variable Attribute Intrinsics----------------===// // Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=79272&r1=79271&r2=79272&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug 17 15:25:04 2009 @@ -640,9 +640,6 @@ Asm->EmitULEB128Bytes(SizeSites); Asm->EOL("Call-site table length"); - - assert(MF->getCallSiteCount() == CallSites.size()); - // Emit the landing pad site information. unsigned idx = 0; for (SmallVectorImpl::const_iterator Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=79272&r1=79271&r2=79272&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Mon Aug 17 15:25:04 2009 @@ -93,9 +93,6 @@ MachineConstantPool(TM.getTargetData()); Alignment = TM.getTargetLowering()->getFunctionAlignment(F); - CallSiteIndex = 0; - MaxCallSiteIndex = 0; - // Set up jump table. const TargetData &TD = *TM.getTargetData(); bool IsPic = TM.getRelocationModel() == Reloc::PIC_; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=79272&r1=79271&r2=79272&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Aug 17 15:25:04 2009 @@ -4084,11 +4084,6 @@ Offset)); return 0; } - case Intrinsic::eh_sjlj_callsite: { - MachineFunction &MF = DAG.getMachineFunction(); - MF.setCallSiteIndex(cast(getValue(I.getOperand(1)))->getZExtValue()); - return 0; - } case Intrinsic::convertff: case Intrinsic::convertfsi: case Intrinsic::convertfui: @@ -4452,14 +4447,10 @@ } if (LandingPad && MMI) { - MachineFunction &MF = DAG.getMachineFunction(); // Insert a label before the invoke call to mark the try range. This can be // used to detect deletion of the invoke via the MachineModuleInfo. BeginLabel = MMI->NextLabelID(); - // Map this landing pad to the current call site entry - MF.setLandingPadCallSiteIndex(LandingPad, MF.getCallSiteIndex()); - // Both PendingLoads and PendingExports must be flushed here; // this call might not return. (void)getRoot(); From isanbard at gmail.com Mon Aug 17 15:33:37 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 17 Aug 2009 13:33:37 -0700 Subject: [llvm-commits] [llvm] r79139 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp In-Reply-To: <4A895229.3080201@free.fr> References: <200908152127.n7FLRWJ7014429@zion.cs.uiuc.edu> <4A895229.3080201@free.fr> Message-ID: <16e5fdf90908171333x42b3785j72b34cca4a77b3d7@mail.gmail.com> On Mon, Aug 17, 2009 at 5:50 AM, Duncan Sands wrote: >> An overhaul of the exception handling code. This is arguably more correct >> than >> what was there before. > > This doesn't cause any failures in the Ada testsuite, which is usually a > good sign for eh stuff :) > Very welcome news! :-) -bw From dpatel at apple.com Mon Aug 17 15:36:20 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 17 Aug 2009 20:36:20 -0000 Subject: [llvm-commits] [llvm] r79274 - /llvm/trunk/lib/Analysis/DebugInfo.cpp Message-ID: <200908172036.n7HKaKh9023917@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 17 15:36:20 2009 New Revision: 79274 URL: http://llvm.org/viewvc/llvm-project?rev=79274&view=rev Log: Oops. find all llvm.dbg.global_variables. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=79274&r1=79273&r2=79274&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 17 15:36:20 2009 @@ -942,7 +942,7 @@ GVI != GVE; ++GVI) { GlobalVariable *GV = GVI; if (!GV->hasName() || !GV->isConstant() - || strcmp(GV->getName().data(), "llvm.dbg.global_variable") + || strncmp(GV->getName().data(), "llvm.dbg.global_variable", 24) || !GV->hasInitializer()) continue; DIGlobalVariable DIG(GV); From evan.cheng at apple.com Mon Aug 17 15:50:08 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 17 Aug 2009 13:50:08 -0700 Subject: [llvm-commits] [llvm] r79250 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfException.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/SjLjEHPrepare.cpp In-Reply-To: <200908171641.n7HGfNZ8026479@zion.cs.uiuc.edu> References: <200908171641.n7HGfNZ8026479@zion.cs.uiuc.edu> Message-ID: <5DAFD74B-AF04-4601-BA84-831E1A51E4F0@apple.com> On Aug 17, 2009, at 9:41 AM, Jim Grosbach wrote: > Author: grosbach > Date: Mon Aug 17 11:41:22 2009 > New Revision: 79250 > > URL: http://llvm.org/viewvc/llvm-project?rev=79250&view=rev > Log: > Move the sjlj exception handling conversions to a back-end pass > where they > more properly belong. This allows removing the front-end > conditionalized > SJLJ code, and cleans up the generated IR considerably. All of the > infrastructure code (calling _Unwind_SjLj_Register/Unregister, etc) is > added by the SjLjEHPrepare pass. Cool. Are we passing c++ tests now? Some preliminary (most cosmetic) comments inline below. Thanks, Evan > > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) > +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Aug 17 11:41:22 > 2009 > @@ -241,8 +241,11 @@ > // handle. > switch (getTargetAsmInfo()->getExceptionHandlingType()) > { > - // SjLj piggy-backs on dwarf for this bit > case ExceptionHandling::SjLj: > + // SjLj piggy-backs on dwarf for this bit. The cleanups done > apply to both > + PM.add(createDwarfEHPass(getTargetLowering(), > OptLevel==CodeGenOpt::None)); > + PM.add(createSjLjEHPass(getTargetLowering())); What part of the dwarf EH pass is needed for SJLJ EH? Is it possible to factor that part out? > + break; > case ExceptionHandling::Dwarf: > PM.add(createDwarfEHPass(getTargetLowering(), > OptLevel==CodeGenOpt::None)); > break; > > Added: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=79250&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (added) > +++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Mon Aug 17 11:41:22 2009 > @@ -0,0 +1,527 @@ > +//===- SjLjEHPass.cpp - Eliminate Invoke & Unwind instructions > -----------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// > +// This transformation is designed for use by code generators which > use SjLj > +// based exception handling. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +#define DEBUG_TYPE "sjljehprepare" > +#include "llvm/Transforms/Scalar.h" > +#include "llvm/Constants.h" > +#include "llvm/DerivedTypes.h" > +#include "llvm/Instructions.h" > +#include "llvm/Intrinsics.h" > +#include "llvm/LLVMContext.h" > +#include "llvm/Module.h" > +#include "llvm/Pass.h" > +#include "llvm/CodeGen/Passes.h" > +#include "llvm/Transforms/Utils/BasicBlockUtils.h" > +#include "llvm/Transforms/Utils/Local.h" > +#include "llvm/ADT/Statistic.h" > +#include "llvm/Support/CommandLine.h" > +#include "llvm/Support/Compiler.h" > +#include "llvm/Support/Debug.h" > +#include "llvm/Support/raw_ostream.h" > +#include "llvm/Target/TargetLowering.h" > +#include Can this be replaced with SmallPtrSet.h? > +using namespace llvm; > + > +STATISTIC(NumInvokes, "Number of invokes replaced"); > +STATISTIC(NumUnwinds, "Number of unwinds replaced"); > +STATISTIC(NumSpilled, "Number of registers live across unwind > edges"); > + > +namespace { > + class VISIBILITY_HIDDEN SjLjEHPass : public FunctionPass { > + > + const TargetLowering *TLI; > + > + const Type *FunctionContextTy; > + Constant *RegisterFn; > + Constant *UnregisterFn; > + Constant *ResumeFn; > + Constant *BuiltinSetjmpFn; > + Constant *FrameAddrFn; > + Constant *LSDAAddrFn; > + Value *PersonalityFn; > + Constant *Selector32Fn; > + Constant *Selector64Fn; > + Constant *ExceptionFn; > + > + Value *CallSite; > + public: > + static char ID; // Pass identification, replacement for typeid > + explicit SjLjEHPass(const TargetLowering *tli = NULL) > + : FunctionPass(&ID), TLI(tli) { } > + bool doInitialization(Module &M); > + bool runOnFunction(Function &F); > + > + virtual void getAnalysisUsage(AnalysisUsage &AU) const { } > + const char *getPassName() const { > + return "SJLJ Exception Handling preparation"; > + } > + > + private: > + void markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, > + Value *CallSite, > + SwitchInst *CatchSwitch); > + void splitLiveRangesLiveAcrossInvokes(std::vector > &Invokes); > + bool insertSjLjEHSupport(Function &F); > + }; > +} // end anonymous namespace > + > +char SjLjEHPass::ID = 0; > + > +// Public Interface To the SjLjEHPass pass. > +FunctionPass *llvm::createSjLjEHPass(const TargetLowering *TLI) { > + return new SjLjEHPass(TLI); > +} > +// doInitialization - Make sure that there is a prototype for abort > in the > +// current module. > +bool SjLjEHPass::doInitialization(Module &M) { > + // Build the function context structure. > + // builtin_setjmp uses a five word jbuf > + const Type *VoidPtrTy = > + PointerType::getUnqual(Type::getInt8Ty(M.getContext())); > + const Type *Int32Ty = Type::getInt32Ty(M.getContext()); > + FunctionContextTy = > + StructType::get(M.getContext(), > + VoidPtrTy, // __prev > + Int32Ty, // call_site > + ArrayType::get(Int32Ty, 4), // __data > + VoidPtrTy, // > __personality > + VoidPtrTy, // __lsda > + ArrayType::get(VoidPtrTy, 5), // __jbuf > + NULL); > + RegisterFn = M.getOrInsertFunction("_Unwind_SjLj_Register", > + Type::getVoidTy(M.getContext()), > + PointerType::getUnqual > (FunctionContextTy), > + (Type *)0); > + UnregisterFn = > + M.getOrInsertFunction("_Unwind_SjLj_Unregister", > + Type::getVoidTy(M.getContext()), > + PointerType::getUnqual(FunctionContextTy), > + (Type *)0); > + ResumeFn = > + M.getOrInsertFunction("_Unwind_SjLj_Resume", > + Type::getVoidTy(M.getContext()), > + VoidPtrTy, > + (Type *)0); > + FrameAddrFn = Intrinsic::getDeclaration(&M, > Intrinsic::frameaddress); > + BuiltinSetjmpFn = Intrinsic::getDeclaration(&M, > Intrinsic::eh_sjlj_setjmp); > + LSDAAddrFn = Intrinsic::getDeclaration(&M, > Intrinsic::eh_sjlj_lsda); > + Selector32Fn = Intrinsic::getDeclaration(&M, > Intrinsic::eh_selector_i32); > + Selector64Fn = Intrinsic::getDeclaration(&M, > Intrinsic::eh_selector_i64); > + ExceptionFn = Intrinsic::getDeclaration(&M, > Intrinsic::eh_exception); > + > + return true; > +} > + > +/// markInvokeCallSite - Insert code to mark the call_site for this > invoke > +void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned > InvokeNo, > + Value *CallSite, > + SwitchInst *CatchSwitch) { > + ConstantInt *CallSiteNoC= ConstantInt::get(Type::getInt32Ty(II- > >getContext()), > + InvokeNo); > + // The runtime comes back to the dispatcher with the call_site - > 1 in > + // the context. Odd, but there it is. > + ConstantInt *SwitchValC = ConstantInt::get(Type::getInt32Ty(II- > >getContext()), > + InvokeNo - 1); > + > + // If the unwind edge has phi nodes, split the edge. > + if (isa(II->getUnwindDest()->begin())) { > + SplitCriticalEdge(II, 1, this); > + > + // If there are any phi nodes left, they must have a single > predecessor. > + while (PHINode *PN = dyn_cast(II->getUnwindDest()- > >begin())) { > + PN->replaceAllUsesWith(PN->getIncomingValue(0)); > + PN->eraseFromParent(); > + } > + } > + > + // Insert a store of the invoke num before the invoke and store > zero into the > + // location afterward. > + new StoreInst(CallSiteNoC, CallSite, true, II); // volatile > + > + // Add a switch case to our unwind block. > + CatchSwitch->addCase(SwitchValC, II->getUnwindDest()); > + // We still want this to look like an invoke so we emit the LSDA > properly > + // FIXME: ??? Or will this cause strangeness with mis-matched IDs > like > + // when it was in the front end? > +} > + > +/// MarkBlocksLiveIn - Insert BB and all of its predescessors into > LiveBBs until > +/// we reach blocks we've already seen. > +static void MarkBlocksLiveIn(BasicBlock *BB, std::set > &LiveBBs) { > + if (!LiveBBs.insert(BB).second) return; // already been here. > + > + for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != > E; ++PI) > + MarkBlocksLiveIn(*PI, LiveBBs); > +} > + > +// live across unwind edges. Each value that is live across an > unwind edge > +// we spill into a stack location, guaranteeing that there is > nothing live > +// across the unwind edge. This process also splits all critical > edges > +// coming out of invoke's. Function level comment should start with "splitLiveRangesLiveAcrossInvokes -". > +void SjLjEHPass:: > +splitLiveRangesLiveAcrossInvokes(std::vector &Invokes) { > + // First step, split all critical edges from invoke instructions. > + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) { > + InvokeInst *II = Invokes[i]; > + SplitCriticalEdge(II, 0, this); > + SplitCriticalEdge(II, 1, this); > + assert(!isa(II->getNormalDest()) && > + !isa(II->getUnwindDest()) && > + "critical edge splitting left single entry phi nodes?"); > + } > + > + Function *F = Invokes.back()->getParent()->getParent(); > + > + // To avoid having to handle incoming arguments specially, we > lower each arg > + // to a copy instruction in the entry block. This ensures that > the argument > + // value itself cannot be live across the entry block. > + BasicBlock::iterator AfterAllocaInsertPt = F->begin()->begin(); > + while (isa(AfterAllocaInsertPt) && > + isa(cast(AfterAllocaInsertPt)- > >getArraySize())) > + ++AfterAllocaInsertPt; > + for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); > + AI != E; ++AI) { > + // This is always a no-op cast because we're casting AI to AI- > >getType() so > + // src and destination types are identical. BitCast is the only > possibility. > + CastInst *NC = new BitCastInst( > + AI, AI->getType(), AI->getName()+".tmp", AfterAllocaInsertPt); > + AI->replaceAllUsesWith(NC); > + // Normally its is forbidden to replace a CastInst's operand > because it > + // could cause the opcode to reflect an illegal conversion. > However, we're > + // replacing it here with the same value it was constructed > with to simply > + // make NC its user. > + NC->setOperand(0, AI); > + } > + > + // Finally, scan the code looking for instructions with bad live > ranges. > + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; + > +BB) > + for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II ! > = E; ++II) { > + // Ignore obvious cases we don't have to handle. In > particular, most > + // instructions either have no uses or only have a single use > inside the > + // current block. Ignore them quickly. > + Instruction *Inst = II; > + if (Inst->use_empty()) continue; > + if (Inst->hasOneUse() && > + cast(Inst->use_back())->getParent() == BB && > + !isa(Inst->use_back())) continue; > + > + // If this is an alloca in the entry block, it's not a real > register > + // value. > + if (AllocaInst *AI = dyn_cast(Inst)) > + if (isa(AI->getArraySize()) && BB == F->begin()) > + continue; > + > + // Avoid iterator invalidation by copying users to a > temporary vector. > + std::vector Users; > + for (Value::use_iterator UI = Inst->use_begin(), E = Inst- > >use_end(); > + UI != E; ++UI) { > + Instruction *User = cast(*UI); > + if (User->getParent() != BB || isa(User)) > + Users.push_back(User); > + } > + > + // Scan all of the uses and see if the live range is live > across an unwind > + // edge. If we find a use live across an invoke edge, create > an alloca > + // and spill the value. > + std::set InvokesWithStoreInserted; This std::set is not used anywhere? > + > + // Find all of the blocks that this value is live in. > + std::set LiveBBs; > + LiveBBs.insert(Inst->getParent()); > + while (!Users.empty()) { > + Instruction *U = Users.back(); > + Users.pop_back(); > + > + if (!isa(U)) { > + MarkBlocksLiveIn(U->getParent(), LiveBBs); > + } else { > + // Uses for a PHI node occur in their predecessor block. > + PHINode *PN = cast(U); > + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != > e; ++i) > + if (PN->getIncomingValue(i) == Inst) > + MarkBlocksLiveIn(PN->getIncomingBlock(i), LiveBBs); > + } > + } > + > + // Now that we know all of the blocks that this thing is live > in, see if > + // it includes any of the unwind locations. > + bool NeedsSpill = false; > + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) { > + BasicBlock *UnwindBlock = Invokes[i]->getUnwindDest(); > + if (UnwindBlock != BB && LiveBBs.count(UnwindBlock)) { > + NeedsSpill = true; > + } > + } > + > + // If we decided we need a spill, do it. > + if (NeedsSpill) { > + ++NumSpilled; > + DemoteRegToStack(*Inst, true); > + } > + } > +} > + > +bool SjLjEHPass::insertSjLjEHSupport(Function &F) { > + std::vector Returns; > + std::vector Unwinds; > + std::vector Invokes; SmallVector please. > + > + // Look through the terminators of the basic blocks to find > invokes, returns > + // and unwinds > + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) > + if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { > + // Remember all return instructions in case we insert an > invoke into this > + // function. > + Returns.push_back(RI); > + } else if (InvokeInst *II = dyn_cast(BB- > >getTerminator())) { > + Invokes.push_back(II); > + } else if (UnwindInst *UI = dyn_cast(BB- > >getTerminator())) { > + Unwinds.push_back(UI); > + } > + // If we don't have any invokes or unwinds, there's nothing to do. > + if (Unwinds.empty() && Invokes.empty()) return false; > + > + NumInvokes += Invokes.size(); > + NumUnwinds += Unwinds.size(); > + > + > + if (!Invokes.empty()) { > + // We have invokes, so we need to add register/unregister calls > to get > + // this function onto the global unwind stack. > + // > + // First thing we need to do is scan the whole function for > values that are > + // live across unwind edges. Each value that is live across an > unwind edge > + // we spill into a stack location, guaranteeing that there is > nothing live > + // across the unwind edge. This process also splits all > critical edges > + // coming out of invoke's. > + splitLiveRangesLiveAcrossInvokes(Invokes); > + > + BasicBlock *EntryBB = F.begin(); > + // Create an alloca for the incoming jump buffer ptr and the > new jump buffer > + // that needs to be restored on all exits from the function. > This is an > + // alloca because the value needs to be added to the global > context list. > + unsigned Align = 4; // FIXME: Should be a TLI check? > + AllocaInst *FunctionContext = > + new AllocaInst(FunctionContextTy, 0, Align, > + "fcn_context", F.begin()->begin()); > + > + Value *Idxs[2]; > + const Type *Int32Ty = Type::getInt32Ty(F.getContext()); > + Value *Zero = ConstantInt::get(Int32Ty, 0); > + // We need to also keep around a reference to the call_site field > + Idxs[0] = Zero; > + Idxs[1] = ConstantInt::get(Int32Ty, 1); > + CallSite = GetElementPtrInst::Create(FunctionContext, Idxs, Idxs > +2, > + "call_site", > + EntryBB->getTerminator()); > + > + // The exception selector comes back in context->data[1] > + Idxs[1] = ConstantInt::get(Int32Ty, 2); > + Value *FCData = GetElementPtrInst::Create(FunctionContext, > Idxs, Idxs+2, > + "fc_data", > + EntryBB->getTerminator > ()); > + Idxs[1] = ConstantInt::get(Int32Ty, 1); > + Value *SelectorAddr = GetElementPtrInst::Create(FCData, Idxs, > Idxs+2, > + > "exc_selector_gep", > + EntryBB- > >getTerminator()); > + // The exception value comes back in context->data[0] > + Idxs[1] = Zero; > + Value *ExceptionAddr = GetElementPtrInst::Create(FCData, Idxs, > Idxs+2, > + "exception_gep", > + EntryBB- > >getTerminator()); > + > + // Find the eh.selector.* and eh.exception calls. We'll use > the first > + // ex.selector to determine the right personality function to > use. For > + // SJLJ, we always use the same personality for the whole > function, > + // not on a per-selector basis. > + // FIXME: That's a bit ugly. Better way? > + std::vector EH_Selectors; > + std::vector EH_Exceptions; SmallVector. > + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; + > +BB) { > + // for (unsigned i = 0, e = Invokes.size(); i != e; ++i) { > +// BasicBlock *Pad = Invokes[0]->getUnwindDest(); Please delete this line? > + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I ! > = E; ++I) { > + if (CallInst *CI = dyn_cast(I)) { > + if (CI->getCalledFunction() == Selector32Fn || > + CI->getCalledFunction() == Selector64Fn) { > + if (!PersonalityFn) PersonalityFn = CI->getOperand(2); > + EH_Selectors.push_back(CI); > + } else if (CI->getCalledFunction() == ExceptionFn) { > + EH_Exceptions.push_back(CI); > + } > + } > + } > + } > + // The result of the eh.selector call will be replaced with a > + // a reference to the selector value returned in the function > + // context. We leave the selector itself so the EH analysis later > + // can use it. > + for (int i = 0, e = EH_Selectors.size(); i < e; ++i) { > + CallInst *I = EH_Selectors[i]; > + Value *SelectorVal = new LoadInst(SelectorAddr, "select_val", > true, I); > + I->replaceAllUsesWith(SelectorVal); > + } > + // eh.exception calls are replaced with references to the proper > + // location in the context. Unlike eh.selector, the eh.exception > + // calls are removed entirely. > + for (int i = 0, e = EH_Exceptions.size(); i < e; ++i) { > + CallInst *I = EH_Exceptions[i]; > + // Possible for there to be duplicates, so check to make sure > + // the instruction hasn't already been removed. > + if (!I->getParent()) continue; > + Value *Val = new LoadInst(ExceptionAddr, "exception", true, I); > + Val = CastInst::Create(Instruction::IntToPtr, Val, > + PointerType::getUnqual(Type::getInt8Ty > (F.getContext())), > + "", I); > + > + I->replaceAllUsesWith(Val); > + I->eraseFromParent(); > + } > + > + > + > + > + // The entry block changes to have the eh.sjlj.setjmp, with a > conditional > + // branch to a dispatch block for non-zero returns. If we > return normally, > + // we're not handling an exception and just register the > function context > + // and continue. > + > + // Create the dispatch block. The dispatch block is basically > a big switch > + // statement that goes to all of the invoke landing pads. > + BasicBlock *DispatchBlock = > + BasicBlock::Create(F.getContext(), > "eh.sjlj.setjmp.catch", &F); > + > + // Insert a load in the Catch block, and a switch on its > value. By default, > + // we go to a block that just does an unwind (which is the > correct action > + // for a standard call). > + BasicBlock *UnwindBlock = BasicBlock::Create(F.getContext(), > "unwindbb", &F); > + Unwinds.push_back(new UnwindInst(F.getContext(), UnwindBlock)); > + > + Value *DispatchLoad = new LoadInst(CallSite, "invoke.num", true, > + DispatchBlock); > + SwitchInst *DispatchSwitch = > + SwitchInst::Create(DispatchLoad, UnwindBlock, Invokes.size(), > DispatchBlock); > + // Split the entry block to insert the conditional branch for > the setjmp. > + BasicBlock *ContBlock = EntryBB->splitBasicBlock(EntryBB- > >getTerminator(), > + > "eh.sjlj.setjmp.cont"); > + > + // Populate the Function Context > + // 1. LSDA address > + // 2. Personality function address > + // 3. jmpbuf (save FP and call eh.sjlj.setjmp) > + > + // LSDA address > + Idxs[0] = Zero; > + Idxs[1] = ConstantInt::get(Int32Ty, 4); > + Value *LSDAFieldPtr = > + GetElementPtrInst::Create(FunctionContext, Idxs, Idxs+2, > + "lsda_gep", > + EntryBB->getTerminator()); > + Value *LSDA = CallInst::Create(LSDAAddrFn, "lsda_addr", > + EntryBB->getTerminator()); > + new StoreInst(LSDA, LSDAFieldPtr, true, EntryBB->getTerminator > ()); > + > + Idxs[1] = ConstantInt::get(Int32Ty, 3); > + Value *PersonalityFieldPtr = > + GetElementPtrInst::Create(FunctionContext, Idxs, Idxs+2, > + "lsda_gep", > + EntryBB->getTerminator()); > + new StoreInst(PersonalityFn, PersonalityFieldPtr, true, > + EntryBB->getTerminator()); > + > + // Save the frame pointer. > + Idxs[1] = ConstantInt::get(Int32Ty, 5); > + Value *FieldPtr > + = GetElementPtrInst::Create(FunctionContext, Idxs, Idxs+2, > + "jbuf_gep", > + EntryBB->getTerminator()); > + Idxs[1] = ConstantInt::get(Int32Ty, 0); > + Value *ElemPtr = > + GetElementPtrInst::Create(FieldPtr, Idxs, Idxs+2, > "jbuf_fp_gep", > + EntryBB->getTerminator()); > + > + Value *Val = CallInst::Create(FrameAddrFn, > + ConstantInt::get(Int32Ty, 0), > + "fp", > + EntryBB->getTerminator()); > + new StoreInst(Val, ElemPtr, true, EntryBB->getTerminator()); > + // Call the setjmp instrinsic. It fills in the rest of the jmpbuf > + Value *SetjmpArg = > + CastInst::Create(Instruction::BitCast, FieldPtr, > + Type::getInt8Ty(F.getContext())- > >getPointerTo(), "", > + EntryBB->getTerminator()); > + Value *DispatchVal = CallInst::Create(BuiltinSetjmpFn, SetjmpArg, > + "dispatch", > + EntryBB->getTerminator()); > + // check the return value of the setjmp. non-zero goes to > dispatcher > + Value *IsNormal = new ICmpInst(EntryBB->getTerminator(), > + ICmpInst::ICMP_EQ, DispatchVal, > Zero, > + "notunwind"); > + // Nuke the uncond branch. > + EntryBB->getTerminator()->eraseFromParent(); > + > + // Put in a new condbranch in its place. > + BranchInst::Create(ContBlock, DispatchBlock, IsNormal, EntryBB); > + > + // Register the function context and make sure it's known to > not throw > + CallInst *Register = > + CallInst::Create(RegisterFn, FunctionContext, "", > + ContBlock->getTerminator()); > + Register->setDoesNotThrow(); > + > + // At this point, we are all set up, update the invoke > instructions > + // to mark their call_site values, and fill in the dispatch > switch > + // accordingly. > + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) > + markInvokeCallSite(Invokes[i], i+1, CallSite, DispatchSwitch); > + > + // The front end has likely added calls to _Unwind_Resume. We > need > + // to find those calls and mark the call_site as -1 immediately > prior. > + // resume is a noreturn function, so any block that has a call > to it > + // should end in an 'unreachable' instruction with the call > immediately > + // prior. That's how we'll search. > + // ??? There's got to be a better way. this is fugly. > + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; + > +BB) > + if ((dyn_cast(BB->getTerminator()))) { > + BasicBlock::iterator I = BB->getTerminator(); > + // Check the previous instruction and see if it's a resume > call > + if (I == BB->begin()) continue; > + if (CallInst *CI = dyn_cast(--I)) { > + if (CI->getCalledFunction() == ResumeFn) { > + Value *NegativeOne = ConstantInt::get(Int32Ty, -1); > + new StoreInst(NegativeOne, CallSite, true, I); // > volatile > + } > + } > + } > + > + // Replace all unwinds with a branch to the unwind handler. > + // ??? Should this ever happen with sjlj exceptions? > + for (unsigned i = 0, e = Unwinds.size(); i != e; ++i) { > + BranchInst::Create(UnwindBlock, Unwinds[i]); > + Unwinds[i]->eraseFromParent(); > + } > + > + // Finally, for any returns from this function, if this > function contains an > + // invoke, add a call to unregister the function context. > + for (unsigned i = 0, e = Returns.size(); i != e; ++i) > + CallInst::Create(UnregisterFn, FunctionContext, "", Returns > [i]); > + } > + > + return true; > +} > + > +bool SjLjEHPass::runOnFunction(Function &F) { > + bool Res = insertSjLjEHSupport(F); > + return Res; > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From rjmccall at apple.com Mon Aug 17 16:07:37 2009 From: rjmccall at apple.com (John McCall) Date: Mon, 17 Aug 2009 21:07:37 -0000 Subject: [llvm-commits] [llvm] r79285 - /llvm/trunk/docs/tutorial/LangImpl2.html Message-ID: <200908172107.n7HL7boP027787@zion.cs.uiuc.edu> Author: rjmccall Date: Mon Aug 17 16:07:37 2009 New Revision: 79285 URL: http://llvm.org/viewvc/llvm-project?rev=79285&view=rev Log: #include in the code listing for strtod. Modified: llvm/trunk/docs/tutorial/LangImpl2.html Modified: llvm/trunk/docs/tutorial/LangImpl2.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl2.html?rev=79285&r1=79284&r2=79285&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl2.html (original) +++ llvm/trunk/docs/tutorial/LangImpl2.html Mon Aug 17 16:07:37 2009 @@ -815,6 +815,7 @@
       #include <cstdio>
      +#include <cstdlib>
       #include <string>
       #include <map>
       #include <vector>
      
      
      
      
      From isanbard at gmail.com  Mon Aug 17 16:20:55 2009
      From: isanbard at gmail.com (Bill Wendling)
      Date: Mon, 17 Aug 2009 21:20:55 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r79286 -
      	/llvm-gcc-4.2/trunk/gcc/llvm-main.cpp
      Message-ID: <200908172120.n7HLKtUa029406@zion.cs.uiuc.edu>
      
      Author: void
      Date: Mon Aug 17 16:20:55 2009
      New Revision: 79286
      
      URL: http://llvm.org/viewvc/llvm-project?rev=79286&view=rev
      Log:
      Hook up llvm-gcc to the llvm backend error reporting mechanism. This is similar
      to clang's implementation. I couldn't use the "fatal()" function because of
      dependency issues between the .o files.
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/llvm-main.cpp
      
      Modified: llvm-gcc-4.2/trunk/gcc/llvm-main.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-main.cpp?rev=79286&r1=79285&r2=79286&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/llvm-main.cpp (original)
      +++ llvm-gcc-4.2/trunk/gcc/llvm-main.cpp Mon Aug 17 16:20:55 2009
      @@ -19,21 +19,30 @@
       Software Foundation, 59 Temple Place - Suite 330, Boston, MA
       02111-1307, USA.  */
       
      +#include "llvm/Support/ErrorHandling.h"
       #include "llvm/Support/PrettyStackTrace.h"
       
       extern "C" {
       #include "config.h"
       #include "system.h"
       #include "coretypes.h"
      +#include "errors.h"
       #include "tm.h"
       #include "toplev.h"
      +
      +extern const char *progname;
      +}
      +
      +static void LLVMErrorHandler(void *UserData, const std::string &Message) {
      +  fprintf(stderr, "%s: error in backend: %s\n", progname, Message.c_str());
      +  exit(FATAL_EXIT_CODE);
       }
       
       // We define main() to call toplev_main(), which is defined in toplev.c.
       // We do this so that C++ code has its static constructors called as required.
      -//
       
       int main (int argc, char **argv) {
         llvm::PrettyStackTraceProgram X(argc, argv);
      +  llvm::llvm_install_error_handler(LLVMErrorHandler);
         return toplev_main (argc, (const char **) argv);
       }
      
      
      
      
      From grosbach at apple.com  Mon Aug 17 16:40:04 2009
      From: grosbach at apple.com (Jim Grosbach)
      Date: Mon, 17 Aug 2009 21:40:04 -0000
      Subject: [llvm-commits] [llvm] r79287 -
      	/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp
      Message-ID: <200908172140.n7HLe4GV031777@zion.cs.uiuc.edu>
      
      Author: grosbach
      Date: Mon Aug 17 16:40:03 2009
      New Revision: 79287
      
      URL: http://llvm.org/viewvc/llvm-project?rev=79287&view=rev
      Log:
      cleanups per review. Mostly cosmetic, plus use SmallVector in place of std::vector.
      
      Modified:
          llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=79287&r1=79286&r2=79287&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Mon Aug 17 16:40:03 2009
      @@ -25,12 +25,12 @@
       #include "llvm/Transforms/Utils/BasicBlockUtils.h"
       #include "llvm/Transforms/Utils/Local.h"
       #include "llvm/ADT/Statistic.h"
      +#include "llvm/ADT/SmallVector.h"
       #include "llvm/Support/CommandLine.h"
       #include "llvm/Support/Compiler.h"
       #include "llvm/Support/Debug.h"
       #include "llvm/Support/raw_ostream.h"
       #include "llvm/Target/TargetLowering.h"
      -#include 
       using namespace llvm;
       
       STATISTIC(NumInvokes, "Number of invokes replaced");
      @@ -71,7 +71,7 @@
           void markInvokeCallSite(InvokeInst *II, unsigned InvokeNo,
                                   Value *CallSite,
                                   SwitchInst *CatchSwitch);
      -    void splitLiveRangesLiveAcrossInvokes(std::vector &Invokes);
      +    void splitLiveRangesLiveAcrossInvokes(SmallVector &Invokes);
           bool insertSjLjEHSupport(Function &F);
         };
       } // end anonymous namespace
      @@ -165,12 +165,12 @@
           MarkBlocksLiveIn(*PI, LiveBBs);
       }
       
      -// live across unwind edges.  Each value that is live across an unwind edge
      -// we spill into a stack location, guaranteeing that there is nothing live
      -// across the unwind edge.  This process also splits all critical edges
      -// coming out of invoke's.
      +/// splitLiveRangesAcrossInvokes - Each value that is live across an unwind edge
      +/// we spill into a stack location, guaranteeing that there is nothing live
      +/// across the unwind edge.  This process also splits all critical edges
      +/// coming out of invoke's.
       void SjLjEHPass::
      -splitLiveRangesLiveAcrossInvokes(std::vector &Invokes) {
      +splitLiveRangesLiveAcrossInvokes(SmallVector &Invokes) {
         // First step, split all critical edges from invoke instructions.
         for (unsigned i = 0, e = Invokes.size(); i != e; ++i) {
           InvokeInst *II = Invokes[i];
      @@ -223,7 +223,7 @@
                 continue;
       
             // Avoid iterator invalidation by copying users to a temporary vector.
      -      std::vector Users;
      +      SmallVector Users;
             for (Value::use_iterator UI = Inst->use_begin(), E = Inst->use_end();
                  UI != E; ++UI) {
               Instruction *User = cast(*UI);
      @@ -231,11 +231,6 @@
                 Users.push_back(User);
             }
       
      -      // Scan all of the uses and see if the live range is live across an unwind
      -      // edge.  If we find a use live across an invoke edge, create an alloca
      -      // and spill the value.
      -      std::set InvokesWithStoreInserted;
      -
             // Find all of the blocks that this value is live in.
             std::set LiveBBs;
             LiveBBs.insert(Inst->getParent());
      @@ -273,9 +268,9 @@
       }
       
       bool SjLjEHPass::insertSjLjEHSupport(Function &F) {
      -  std::vector Returns;
      -  std::vector Unwinds;
      -  std::vector Invokes;
      +  SmallVector Returns;
      +  SmallVector Unwinds;
      +  SmallVector Invokes;
       
         // Look through the terminators of the basic blocks to find invokes, returns
         // and unwinds
      @@ -346,11 +341,9 @@
           // SJLJ, we always use the same personality for the whole function,
           // not on a per-selector basis.
           // FIXME: That's a bit ugly. Better way?
      -    std::vector EH_Selectors;
      -    std::vector EH_Exceptions;
      -  for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
      -  //  for (unsigned i = 0, e = Invokes.size(); i != e; ++i) {
      -//      BasicBlock *Pad = Invokes[0]->getUnwindDest();
      +    SmallVector EH_Selectors;
      +    SmallVector EH_Exceptions;
      +    for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
             for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
               if (CallInst *CI = dyn_cast(I)) {
                 if (CI->getCalledFunction() == Selector32Fn ||
      @@ -381,9 +374,8 @@
             // the instruction hasn't already been removed.
             if (!I->getParent()) continue;
             Value *Val = new LoadInst(ExceptionAddr, "exception", true, I);
      -      Val = CastInst::Create(Instruction::IntToPtr, Val,
      -                             PointerType::getUnqual(Type::getInt8Ty(F.getContext())),
      -                             "", I);
      +      Type *Ty = PointerType::getUnqual(Type::getInt8Ty(F.getContext()));
      +      Val = CastInst::Create(Instruction::IntToPtr, Val, Ty, "", I);
       
             I->replaceAllUsesWith(Val);
             I->eraseFromParent();
      
      
      
      
      From grosbach at apple.com  Mon Aug 17 16:41:08 2009
      From: grosbach at apple.com (Jim Grosbach)
      Date: Mon, 17 Aug 2009 14:41:08 -0700
      Subject: [llvm-commits] [llvm] r79250 - in /llvm/trunk:
      	include/llvm/CodeGen/Passes.h
      	lib/CodeGen/AsmPrinter/DwarfException.cpp
      	lib/CodeGen/AsmPrinter/DwarfException.h
      	lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/SjLjEHPrepare.cpp
      In-Reply-To: <5DAFD74B-AF04-4601-BA84-831E1A51E4F0@apple.com>
      References: <200908171641.n7HGfNZ8026479@zion.cs.uiuc.edu>
      	<5DAFD74B-AF04-4601-BA84-831E1A51E4F0@apple.com>
      Message-ID: <8F75B36C-234A-45B3-ACE8-4436736E050B@apple.com>
      
      
      On Aug 17, 2009, at 1:50 PM, Evan Cheng wrote:
      
      >
      > On Aug 17, 2009, at 9:41 AM, Jim Grosbach wrote:
      >
      >> Author: grosbach
      >> Date: Mon Aug 17 11:41:22 2009
      >> New Revision: 79250
      >>
      >> URL: http://llvm.org/viewvc/llvm-project?rev=79250&view=rev
      >> Log:
      >> Move the sjlj exception handling conversions to a back-end pass  
      >> where they
      >> more properly belong. This allows removing the front-end  
      >> conditionalized
      >> SJLJ code, and cleans up the generated IR considerably. All of the
      >> infrastructure code (calling _Unwind_SjLj_Register/Unregister, etc)  
      >> is
      >> added by the SjLjEHPrepare pass.
      >
      > Cool. Are we passing c++ tests now?
      
      We're doing better, yes. I'm running the tests to get a better feel  
      for just how much better. It's not perfect yet, but it's better.  
      There's a rethrow problem that's being squirrely at the moment.
      
      >
      > Some preliminary (most cosmetic) comments inline below.
      >
      
      r79287.
      
      >> = 
      >> = 
      >> = 
      >> = 
      >> = 
      >> = 
      >> = 
      >> = 
      >> = 
      >> =====================================================================
      >> --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
      >> +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Aug 17  
      >> 11:41:22 2009
      >> @@ -241,8 +241,11 @@
      >>  // handle.
      >>  switch (getTargetAsmInfo()->getExceptionHandlingType())
      >>  {
      >> -  // SjLj piggy-backs on dwarf for this bit
      >>  case ExceptionHandling::SjLj:
      >> +    // SjLj piggy-backs on dwarf for this bit. The cleanups done  
      >> apply to both
      >> +    PM.add(createDwarfEHPass(getTargetLowering(),  
      >> OptLevel==CodeGenOpt::None));
      >> +    PM.add(createSjLjEHPass(getTargetLowering()));
      >
      > What part of the dwarf EH pass is needed for SJLJ EH? Is it possible  
      > to factor that part out?
      
      It's mostly cleanup to make sure things are as the DwarfException  
      stuff expects it (selector calls always in landing pads and things  
      like that). It should be very possible to factor it out. I ran out of  
      steam around 1am and didn't get that far.
      
      >>
      >> +#include 
      >
      > Can this be replaced with SmallPtrSet.h?
      
      Don't think it's needed at all, actually. Removed.
      
      I'll poke about in a bit and see if there's other headers that can be  
      removed, too.
      
      >>
      >> +// live across unwind edges.  Each value that is live across an  
      >> unwind edge
      >> +// we spill into a stack location, guaranteeing that there is  
      >> nothing live
      >> +// across the unwind edge.  This process also splits all critical  
      >> edges
      >> +// coming out of invoke's.
      >
      > Function level comment should start with  
      > "splitLiveRangesLiveAcrossInvokes -".
      >
      
      Done.
      
      >> +      std::set InvokesWithStoreInserted;
      >
      > This std::set is not used anywhere?
      >
      
      Fixed.
      
      >>
      >> +bool SjLjEHPass::insertSjLjEHSupport(Function &F) {
      >> +  std::vector Returns;
      >> +  std::vector Unwinds;
      >> +  std::vector Invokes;
      >
      > SmallVector please.
      >
      >>
      >> +    std::vector EH_Selectors;
      >> +    std::vector EH_Exceptions;
      >
      > SmallVector.
      
      Will do.
      
      
      >
      >> +  for (Function::iterator BB = F.begin(), E = F.end(); BB != E; + 
      >> +BB) {
      >> +  //  for (unsigned i = 0, e = Invokes.size(); i != e; ++i) {
      >> +//      BasicBlock *Pad = Invokes[0]->getUnwindDest();
      >
      > Please delete this line?
      
      Ack. Oops. Done.
      
      
      
      From tonic at nondot.org  Mon Aug 17 17:24:37 2009
      From: tonic at nondot.org (Tanya Lattner)
      Date: Mon, 17 Aug 2009 17:24:37 -0500
      Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php
      Message-ID: <200908172224.n7HMObJd004767@zion.cs.uiuc.edu>
      
      
      
      Changes in directory llvm-www/devmtg/2009-10:
      
      index.php updated: 1.6 -> 1.7
      ---
      Log message:
      
      Add note about group code.
      
      
      ---
      Diffs of the changes:  (+2 -1)
      
       index.php |    3 ++-
       1 files changed, 2 insertions(+), 1 deletion(-)
      
      
      Index: llvm-www/devmtg/2009-10/index.php
      diff -u llvm-www/devmtg/2009-10/index.php:1.6 llvm-www/devmtg/2009-10/index.php:1.7
      --- llvm-www/devmtg/2009-10/index.php:1.6	Thu Aug  6 19:12:50 2009
      +++ llvm-www/devmtg/2009-10/index.php	Mon Aug 17 17:23:36 2009
      @@ -167,9 +167,10 @@
       is just blocks from the Apple Campus. Here is the information:

      Cut Off Date: Sept 17, 2009 (Limit 50 rooms)
      -Group Block Code: 100097
      +Group Block Code: 100097
      Rate: $120/night
      24 hour cancellation policy
      +The group block code does not work on the website. You must call to book for the discounted rate, or book online and call to get it adjusted. If you book online, you must call before the cut off date to get the rate adjusted.

      The following hotels are within walking distance of the Apple Campus:

      From clattner at apple.com Mon Aug 17 17:24:48 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Aug 2009 15:24:48 -0700 Subject: [llvm-commits] [patch][llvm-gcc] Port -no-canonical-prefixes In-Reply-To: <38a0d8450908171019l3a2db97epf58a6900991255c1@mail.gmail.com> References: <38a0d8450908160041k33186be4rfa183eee0023ad1e@mail.gmail.com> <022C59FB-0E96-408E-B9D7-9D52BA32A006@apple.com> <38a0d8450908171019l3a2db97epf58a6900991255c1@mail.gmail.com> Message-ID: On Aug 17, 2009, at 10:19 AM, Rafael Espindola wrote: > (now with llvm-commits included) > > 2009/8/17 Chris Lattner : >> >> On Aug 16, 2009, at 12:41 AM, Rafael Espindola wrote: >> Hi Rafael, can you get the author to send an email confirming that >> it is ok >> with them to license it under GPL2 to this list? While I believe >> you, a >> court might not :) > > The patch was written by Simon Baldwin. He works for Google and was > OK with us porting the patch. On similar cases > before we also got approval from Daniel Berlin to port gcc patches > written by Google. Simon, can you please post something to this list? I'd like it archived in the list for future references, thanks! -Chris From deeppatel1987 at gmail.com Mon Aug 17 17:48:55 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Mon, 17 Aug 2009 22:48:55 +0000 Subject: [llvm-commits] cross building fixes In-Reply-To: <1DB71460-2B97-4219-A8FD-4AC5471F3FFC@apple.com> References: <305d6f60908050259l157641b6x8dcb87bf8a431536@mail.gmail.com> <305d6f60908051557t641e2f89if99c34e675c6b6df@mail.gmail.com> <305d6f60908120132j209c4b4fybdc6b12aaa3a44a6@mail.gmail.com> <1DB71460-2B97-4219-A8FD-4AC5471F3FFC@apple.com> Message-ID: <305d6f60908171548o5299c1e8m7113d3868093de93@mail.gmail.com> On Mon, Aug 17, 2009 at 6:21 PM, Eric Christopher wrote: > > On Aug 12, 2009, at 1:32 AM, Sandeep Patel wrote: > >> ping? > > Please also add *-*-elf along with *-*-eabi and then it's OK. Attached are updated patches. deep -------------- next part -------------- A non-text attachment was scrubbed... Name: deep-llvm-llvm2cpp.diff Type: application/octet-stream Size: 740 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/56666a34/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: deep-llvm-cross-OS.diff Type: application/octet-stream Size: 10377 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/56666a34/attachment-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: deep-testsuite-cross.diff Type: application/octet-stream Size: 9095 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090817/56666a34/attachment-0002.obj From dpatel at apple.com Mon Aug 17 18:17:17 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 17 Aug 2009 23:17:17 -0000 Subject: [llvm-commits] [llvm] r79289 - in /llvm/trunk: lib/VMCore/Mangler.cpp test/FrontendObjC/2009-08-17-DebugInfo.m Message-ID: <200908172317.n7HNHH2N011246@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 17 18:17:17 2009 New Revision: 79289 URL: http://llvm.org/viewvc/llvm-project?rev=79289&view=rev Log: Add prefix only if it is needed. Added: llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m Modified: llvm/trunk/lib/VMCore/Mangler.cpp Modified: llvm/trunk/lib/VMCore/Mangler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Mangler.cpp?rev=79289&r1=79288&r2=79289&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Mangler.cpp (original) +++ llvm/trunk/lib/VMCore/Mangler.cpp Mon Aug 17 18:17:17 2009 @@ -105,8 +105,9 @@ return Result; } - - Result = X.substr(0, I-X.begin()); + + if (NeedPrefix) + Result = X.substr(0, I-X.begin()); // Otherwise, construct the string the expensive way. for (std::string::const_iterator E = X.end(); I != E; ++I) { Added: llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m?rev=79289&view=auto ============================================================================== --- llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m (added) +++ llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m Mon Aug 17 18:17:17 2009 @@ -0,0 +1,30 @@ +// This is a regression test on debug info to make sure that we can set a +// breakpoint on a objective message. +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc -o %t.s -f -O0 +// RUN: %compile_c %t.s -o %t.o +// RUN: %link %t.o -o %t.exe -framework Foundation +// RUN: echo {break randomFunc\n} > %t.in +// RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \ +// RUN: grep {Breakpoint 1 at 0x.*: file 2009-08-17-DebugInfo.m, line 22} +// XTARGETS: darwin + at interface MyClass +{ + int my; +} ++ init; +- randomFunc; + at end + + at implementation MyClass ++ init { +} +- randomFunc { + my = 42; +} + at end + +int main() { + id o = [MyClass init]; + [o randomFunc]; + return 0; +} From dalej at apple.com Mon Aug 17 19:18:39 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 18 Aug 2009 00:18:39 -0000 Subject: [llvm-commits] [llvm] r79292 - in /llvm/trunk: lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/PowerPC/PPCISelDAGToDAG.cpp test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll Message-ID: <200908180018.n7I0IdSf018856@zion.cs.uiuc.edu> Author: johannes Date: Mon Aug 17 19:18:39 2009 New Revision: 79292 URL: http://llvm.org/viewvc/llvm-project?rev=79292&view=rev Log: PowerPC inline asm was emitting two output operands for a single "m" constraint; this is wrong because the opcode of a load or store would have to change in parallel. This patch makes it always compute addresses into a register, which is correct but not as efficient as possible. 7144566. Added: llvm/trunk/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp 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=79292&r1=79291&r2=79292&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Mon Aug 17 19:18:39 2009 @@ -507,15 +507,17 @@ return false; } +// At the moment, all inline asm memory operands are a single register. +// In any case, the output of this routine should always be just one +// assembler operand. + bool PPCAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode) { if (ExtraCode && ExtraCode[0]) return true; // Unknown modifier. - if (MI->getOperand(OpNo).isReg()) - printMemRegReg(MI, OpNo); - else - printMemRegImm(MI, OpNo); + assert (MI->getOperand(OpNo).isReg()); + printOperand(MI, OpNo); return false; } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=79292&r1=79291&r2=79292&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Mon Aug 17 19:18:39 2009 @@ -143,30 +143,14 @@ } /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for - /// inline asm expressions. - virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op, + /// inline asm expressions. It is always correct to compute the value into + /// a register. The case of adding a (possibly relocatable) constant to a + /// register can be improved, but it is wrong to substitute Reg+Reg for + /// Reg in an asm, because the load or store opcode would have to change. + virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op, char ConstraintCode, std::vector &OutOps) { - SDValue Op0, Op1; - switch (ConstraintCode) { - default: return true; - case 'm': // memory - if (!SelectAddrIdx(Op, Op, Op0, Op1)) - SelectAddrImm(Op, Op, Op0, Op1); - break; - case 'o': // offsetable - if (!SelectAddrImm(Op, Op, Op0, Op1)) { - Op0 = Op; - Op1 = getSmallIPtrImm(0); - } - break; - case 'v': // not offsetable - SelectAddrIdxOnly(Op, Op, Op0, Op1); - break; - } - - OutOps.push_back(Op0); - OutOps.push_back(Op1); + OutOps.push_back(Op); return false; } Added: llvm/trunk/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll?rev=79292&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll Mon Aug 17 19:18:39 2009 @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | llc -march=ppc32 | grep add +; ModuleID = '' +target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128" +target triple = "powerpc-apple-darwin10.0" +; It is wrong on powerpc to substitute reg+reg for $0; the stw opcode +; would have to change. + + at x = external global [0 x i32] ; <[0 x i32]*> [#uses=1] + +define void @foo(i32 %y) nounwind ssp { +entry: + %y_addr = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i32 %y, i32* %y_addr + %0 = load i32* %y_addr, align 4 ; [#uses=1] + %1 = getelementptr inbounds [0 x i32]* @x, i32 0, i32 %0 ; [#uses=1] + call void asm sideeffect "isync\0A\09eieio\0A\09stw $1, $0", "=*o,r,~{memory}"(i32* %1, i32 0) nounwind + br label %return + +return: ; preds = %entry + ret void +} From gohman at apple.com Mon Aug 17 19:20:06 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 00:20:06 -0000 Subject: [llvm-commits] [llvm] r79293 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200908180020.n7I0K6ON019053@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 17 19:20:06 2009 New Revision: 79293 URL: http://llvm.org/viewvc/llvm-project?rev=79293&view=rev Log: Fix function alignment at -Os on x86 to be 1, not 2. getFunctionAlignment returns a log2 value. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=79293&r1=79292&r2=79293&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 17 19:20:06 2009 @@ -1052,7 +1052,7 @@ /// getFunctionAlignment - Return the Log2 alignment of this function. unsigned X86TargetLowering::getFunctionAlignment(const Function *F) const { - return F->hasFnAttr(Attribute::OptimizeForSize) ? 1 : 4; + return F->hasFnAttr(Attribute::OptimizeForSize) ? 0 : 4; } //===----------------------------------------------------------------------===// From eocallaghan at auroraux.org Mon Aug 17 19:24:37 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Tue, 18 Aug 2009 00:24:37 -0000 Subject: [llvm-commits] [llvm] r79295 - in /llvm/trunk: ./ bindings/ada/ bindings/ada/analysis/ bindings/ada/bitreader/ bindings/ada/bitwriter/ bindings/ada/executionengine/ bindings/ada/llvm/ bindings/ada/target/ bindings/ada/transforms/ Message-ID: <200908180024.n7I0OcKH019672@zion.cs.uiuc.edu> Author: evocallaghan Date: Mon Aug 17 19:24:36 2009 New Revision: 79295 URL: http://llvm.org/viewvc/llvm-project?rev=79295&view=rev Log: LLVM Ada language bindings. Credit to Rod Kay and the AuroraUX team. Added: llvm/trunk/bindings/ada/ llvm/trunk/bindings/ada/analysis/ llvm/trunk/bindings/ada/analysis/llvm_analysis-binding.ads llvm/trunk/bindings/ada/analysis/llvm_analysis.ads llvm/trunk/bindings/ada/analysis/llvm_analysis_wrap.cxx llvm/trunk/bindings/ada/bitreader/ llvm/trunk/bindings/ada/bitreader/llvm_bit_reader-binding.ads llvm/trunk/bindings/ada/bitreader/llvm_bit_reader.ads llvm/trunk/bindings/ada/bitreader/llvm_bitreader_wrap.cxx llvm/trunk/bindings/ada/bitwriter/ llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer-binding.ads llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer.ads llvm/trunk/bindings/ada/bitwriter/llvm_bitwriter_wrap.cxx llvm/trunk/bindings/ada/executionengine/ llvm/trunk/bindings/ada/executionengine/llvm_execution_engine-binding.ads llvm/trunk/bindings/ada/executionengine/llvm_execution_engine.ads llvm/trunk/bindings/ada/executionengine/llvm_executionengine_wrap.cxx llvm/trunk/bindings/ada/llvm/ llvm/trunk/bindings/ada/llvm.gpr llvm/trunk/bindings/ada/llvm/llvm-binding.ads llvm/trunk/bindings/ada/llvm/llvm.ads llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer-binding.ads llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer.ads llvm/trunk/bindings/ada/llvm/llvm_linktimeoptimizer_wrap.cxx llvm/trunk/bindings/ada/llvm/llvm_wrap.cxx llvm/trunk/bindings/ada/target/ llvm/trunk/bindings/ada/target/llvm_target-binding.ads llvm/trunk/bindings/ada/target/llvm_target.ads llvm/trunk/bindings/ada/target/llvm_target_wrap.cxx llvm/trunk/bindings/ada/transforms/ llvm/trunk/bindings/ada/transforms/llvm_transforms-binding.ads llvm/trunk/bindings/ada/transforms/llvm_transforms.ads llvm/trunk/bindings/ada/transforms/llvm_transforms_wrap.cxx Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=79295&r1=79294&r2=79295&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Mon Aug 17 19:24:36 2009 @@ -182,6 +182,10 @@ E: kowshik at uiuc.edu D: Author of the original C backend +N: Rod Kay +E: rkay at auroraux.org +D: Author of LLVM Ada bindings + N: Christopher Lamb E: christopher.lamb at gmail.com D: aligned load/store support, parts of noalias and restrict support Added: llvm/trunk/bindings/ada/analysis/llvm_analysis-binding.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/analysis/llvm_analysis-binding.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/analysis/llvm_analysis-binding.ads (added) +++ llvm/trunk/bindings/ada/analysis/llvm_analysis-binding.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,32 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with llvm; +with Interfaces.C.Strings; + + +package LLVM_Analysis.Binding is + + function LLVMVerifyModule + (M : in llvm.LLVMModuleRef; + Action : in LLVM_Analysis.LLVMVerifierFailureAction; + OutMessage : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + function LLVMVerifyFunction + (Fn : in llvm.LLVMValueRef; + Action : in LLVM_Analysis.LLVMVerifierFailureAction) + return Interfaces.C.int; + + procedure LLVMViewFunctionCFG (Fn : in llvm.LLVMValueRef); + + procedure LLVMViewFunctionCFGOnly (Fn : in llvm.LLVMValueRef); + +private + + pragma Import (C, LLVMVerifyModule, "Ada_LLVMVerifyModule"); + pragma Import (C, LLVMVerifyFunction, "Ada_LLVMVerifyFunction"); + pragma Import (C, LLVMViewFunctionCFG, "Ada_LLVMViewFunctionCFG"); + pragma Import (C, LLVMViewFunctionCFGOnly, "Ada_LLVMViewFunctionCFGOnly"); + +end LLVM_Analysis.Binding; Added: llvm/trunk/bindings/ada/analysis/llvm_analysis.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/analysis/llvm_analysis.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/analysis/llvm_analysis.ads (added) +++ llvm/trunk/bindings/ada/analysis/llvm_analysis.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,30 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with Interfaces.C; + + +package LLVM_Analysis is + + -- LLVMVerifierFailureAction + -- + type LLVMVerifierFailureAction is ( + LLVMAbortProcessAction, + LLVMPrintMessageAction, + LLVMReturnStatusAction); + + for LLVMVerifierFailureAction use + (LLVMAbortProcessAction => 0, + LLVMPrintMessageAction => 1, + LLVMReturnStatusAction => 2); + + pragma Convention (C, LLVMVerifierFailureAction); + + type LLVMVerifierFailureAction_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_Analysis.LLVMVerifierFailureAction; + + type LLVMVerifierFailureAction_view is access all + LLVM_Analysis.LLVMVerifierFailureAction; + +end LLVM_Analysis; Added: llvm/trunk/bindings/ada/analysis/llvm_analysis_wrap.cxx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/analysis/llvm_analysis_wrap.cxx?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/analysis/llvm_analysis_wrap.cxx (added) +++ llvm/trunk/bindings/ada/analysis/llvm_analysis_wrap.cxx Mon Aug 17 19:24:36 2009 @@ -0,0 +1,369 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.36 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#include +#include +#include +#if defined(_WIN32) || defined(__CYGWIN32__) +# define DllExport __declspec( dllexport ) +# define SWIGSTDCALL __stdcall +#else +# define DllExport +# define SWIGSTDCALL +#endif + + +#ifdef __cplusplus +# include +#endif + + + + +/* Support for throwing Ada exceptions from C/C++ */ + +typedef enum +{ + SWIG_AdaException, + SWIG_AdaOutOfMemoryException, + SWIG_AdaIndexOutOfRangeException, + SWIG_AdaDivideByZeroException, + SWIG_AdaArgumentOutOfRangeException, + SWIG_AdaNullReferenceException +} SWIG_AdaExceptionCodes; + + +typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *); + + +typedef struct +{ + SWIG_AdaExceptionCodes code; + SWIG_AdaExceptionCallback_t callback; +} + SWIG_AdaExceptions_t; + + +static +SWIG_AdaExceptions_t +SWIG_ada_exceptions[] = +{ + { SWIG_AdaException, NULL }, + { SWIG_AdaOutOfMemoryException, NULL }, + { SWIG_AdaIndexOutOfRangeException, NULL }, + { SWIG_AdaDivideByZeroException, NULL }, + { SWIG_AdaArgumentOutOfRangeException, NULL }, + { SWIG_AdaNullReferenceException, NULL } +}; + + +static +void +SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg) +{ + SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback; + if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) { + callback = SWIG_ada_exceptions[code].callback; + } + callback(msg); +} + + + +#ifdef __cplusplus +extern "C" +#endif + +DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_Analysis (SWIG_AdaExceptionCallback_t systemException, + SWIG_AdaExceptionCallback_t outOfMemory, + SWIG_AdaExceptionCallback_t indexOutOfRange, + SWIG_AdaExceptionCallback_t divideByZero, + SWIG_AdaExceptionCallback_t argumentOutOfRange, + SWIG_AdaExceptionCallback_t nullReference) +{ + SWIG_ada_exceptions [SWIG_AdaException].callback = systemException; + SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory; + SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange; + SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero; + SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange; + SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference; +} + + +/* Callback for returning strings to Ada without leaking memory */ + +typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *); +static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL; + + + +/* probably obsolete ... +#ifdef __cplusplus +extern "C" +#endif +DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_Analysis(SWIG_AdaStringHelperCallback callback) { + SWIG_ada_string_callback = callback; +} +*/ + + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else + + +#define protected public +#define private public + +#include "llvm-c/Analysis.h" +//#include "llvm-c/BitReader.h" +//#include "llvm-c/BitWriter.h" +//#include "llvm-c/Core.h" +//#include "llvm-c/ExecutionEngine.h" +//#include "llvm-c/LinkTimeOptimizer.h" +//#include "llvm-c/lto.h" +//#include "llvm-c/Target.h" + + + +// struct LLVMCtxt; + + +#undef protected +#undef private +#ifdef __cplusplus +extern "C" { +#endif +DllExport int SWIGSTDCALL Ada_LLVMVerifyModule ( + void * jarg1 + , + + int jarg2 + , + + void * jarg3 + ) +{ + int jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + LLVMVerifierFailureAction arg2 ; + char **arg3 = (char **) 0 ; + int result; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = (LLVMVerifierFailureAction) jarg2; + + arg3 = (char **)jarg3; + + result = (int)LLVMVerifyModule(arg1,arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMVerifyFunction ( + void * jarg1 + , + + int jarg2 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMVerifierFailureAction arg2 ; + int result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMVerifierFailureAction) jarg2; + + result = (int)LLVMVerifyFunction(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMViewFunctionCFG ( + void * jarg1 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + LLVMViewFunctionCFG(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMViewFunctionCFGOnly ( + void * jarg1 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + LLVMViewFunctionCFGOnly(arg1); + + +} + + + +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif + Added: llvm/trunk/bindings/ada/bitreader/llvm_bit_reader-binding.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/bitreader/llvm_bit_reader-binding.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/bitreader/llvm_bit_reader-binding.ads (added) +++ llvm/trunk/bindings/ada/bitreader/llvm_bit_reader-binding.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,52 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with llvm; +with Interfaces.C.Strings; + + +package LLVM_bit_Reader.Binding is + + function LLVMParseBitcode + (MemBuf : in llvm.LLVMMemoryBufferRef; + OutModule : access llvm.LLVMModuleRef; + OutMessage : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + function LLVMParseBitcodeInContext + (MemBuf : in llvm.LLVMMemoryBufferRef; + ContextRef : in llvm.LLVMContextRef; + OutModule : access llvm.LLVMModuleRef; + OutMessage : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + function LLVMGetBitcodeModuleProvider + (MemBuf : in llvm.LLVMMemoryBufferRef; + OutMP : access llvm.LLVMModuleProviderRef; + OutMessage : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + function LLVMGetBitcodeModuleProviderInContext + (MemBuf : in llvm.LLVMMemoryBufferRef; + ContextRef : in llvm.LLVMContextRef; + OutMP : access llvm.LLVMModuleProviderRef; + OutMessage : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + +private + + pragma Import (C, LLVMParseBitcode, "Ada_LLVMParseBitcode"); + pragma Import + (C, + LLVMParseBitcodeInContext, + "Ada_LLVMParseBitcodeInContext"); + pragma Import + (C, + LLVMGetBitcodeModuleProvider, + "Ada_LLVMGetBitcodeModuleProvider"); + pragma Import + (C, + LLVMGetBitcodeModuleProviderInContext, + "Ada_LLVMGetBitcodeModuleProviderInContext"); + +end LLVM_bit_Reader.Binding; Added: llvm/trunk/bindings/ada/bitreader/llvm_bit_reader.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/bitreader/llvm_bit_reader.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/bitreader/llvm_bit_reader.ads (added) +++ llvm/trunk/bindings/ada/bitreader/llvm_bit_reader.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,6 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +package LLVM_bit_Reader is + +end LLVM_bit_Reader; Added: llvm/trunk/bindings/ada/bitreader/llvm_bitreader_wrap.cxx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/bitreader/llvm_bitreader_wrap.cxx?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/bitreader/llvm_bitreader_wrap.cxx (added) +++ llvm/trunk/bindings/ada/bitreader/llvm_bitreader_wrap.cxx Mon Aug 17 19:24:36 2009 @@ -0,0 +1,423 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.36 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#include +#include +#include +#if defined(_WIN32) || defined(__CYGWIN32__) +# define DllExport __declspec( dllexport ) +# define SWIGSTDCALL __stdcall +#else +# define DllExport +# define SWIGSTDCALL +#endif + + +#ifdef __cplusplus +# include +#endif + + + + +/* Support for throwing Ada exceptions from C/C++ */ + +typedef enum +{ + SWIG_AdaException, + SWIG_AdaOutOfMemoryException, + SWIG_AdaIndexOutOfRangeException, + SWIG_AdaDivideByZeroException, + SWIG_AdaArgumentOutOfRangeException, + SWIG_AdaNullReferenceException +} SWIG_AdaExceptionCodes; + + +typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *); + + +typedef struct +{ + SWIG_AdaExceptionCodes code; + SWIG_AdaExceptionCallback_t callback; +} + SWIG_AdaExceptions_t; + + +static +SWIG_AdaExceptions_t +SWIG_ada_exceptions[] = +{ + { SWIG_AdaException, NULL }, + { SWIG_AdaOutOfMemoryException, NULL }, + { SWIG_AdaIndexOutOfRangeException, NULL }, + { SWIG_AdaDivideByZeroException, NULL }, + { SWIG_AdaArgumentOutOfRangeException, NULL }, + { SWIG_AdaNullReferenceException, NULL } +}; + + +static +void +SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg) +{ + SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback; + if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) { + callback = SWIG_ada_exceptions[code].callback; + } + callback(msg); +} + + + +#ifdef __cplusplus +extern "C" +#endif + +DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_bit_Reader (SWIG_AdaExceptionCallback_t systemException, + SWIG_AdaExceptionCallback_t outOfMemory, + SWIG_AdaExceptionCallback_t indexOutOfRange, + SWIG_AdaExceptionCallback_t divideByZero, + SWIG_AdaExceptionCallback_t argumentOutOfRange, + SWIG_AdaExceptionCallback_t nullReference) +{ + SWIG_ada_exceptions [SWIG_AdaException].callback = systemException; + SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory; + SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange; + SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero; + SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange; + SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference; +} + + +/* Callback for returning strings to Ada without leaking memory */ + +typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *); +static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL; + + + +/* probably obsolete ... +#ifdef __cplusplus +extern "C" +#endif +DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_bit_Reader(SWIG_AdaStringHelperCallback callback) { + SWIG_ada_string_callback = callback; +} +*/ + + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else + + +#define protected public +#define private public + +//#include "llvm-c/Analysis.h" +#include "llvm-c/BitReader.h" +//#include "llvm-c/BitWriter.h" +//#include "llvm-c/Core.h" +//#include "llvm-c/ExecutionEngine.h" +//#include "llvm-c/LinkTimeOptimizer.h" +//#include "llvm-c/lto.h" +//#include "llvm-c/Target.h" + + + +// struct LLVMCtxt; + + +#undef protected +#undef private +#ifdef __cplusplus +extern "C" { +#endif +DllExport int SWIGSTDCALL Ada_LLVMParseBitcode ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + int jresult ; + LLVMMemoryBufferRef arg1 = (LLVMMemoryBufferRef) 0 ; + LLVMModuleRef *arg2 = (LLVMModuleRef *) 0 ; + char **arg3 = (char **) 0 ; + int result; + + arg1 = (LLVMMemoryBufferRef)jarg1; + + arg2 = (LLVMModuleRef *)jarg2; + + arg3 = (char **)jarg3; + + result = (int)LLVMParseBitcode(arg1,arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMParseBitcodeInContext ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + void * jarg4 + ) +{ + int jresult ; + LLVMMemoryBufferRef arg1 = (LLVMMemoryBufferRef) 0 ; + LLVMContextRef arg2 = (LLVMContextRef) 0 ; + LLVMModuleRef *arg3 = (LLVMModuleRef *) 0 ; + char **arg4 = (char **) 0 ; + int result; + + arg1 = (LLVMMemoryBufferRef)jarg1; + + arg2 = (LLVMContextRef)jarg2; + + arg3 = (LLVMModuleRef *)jarg3; + + arg4 = (char **)jarg4; + + result = (int)LLVMParseBitcodeInContext(arg1,arg2,arg3,arg4); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMGetBitcodeModuleProvider ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + int jresult ; + LLVMMemoryBufferRef arg1 = (LLVMMemoryBufferRef) 0 ; + LLVMModuleProviderRef *arg2 = (LLVMModuleProviderRef *) 0 ; + char **arg3 = (char **) 0 ; + int result; + + arg1 = (LLVMMemoryBufferRef)jarg1; + + arg2 = (LLVMModuleProviderRef *)jarg2; + + arg3 = (char **)jarg3; + + result = (int)LLVMGetBitcodeModuleProvider(arg1,arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMGetBitcodeModuleProviderInContext ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + void * jarg4 + ) +{ + int jresult ; + LLVMMemoryBufferRef arg1 = (LLVMMemoryBufferRef) 0 ; + LLVMContextRef arg2 = (LLVMContextRef) 0 ; + LLVMModuleProviderRef *arg3 = (LLVMModuleProviderRef *) 0 ; + char **arg4 = (char **) 0 ; + int result; + + arg1 = (LLVMMemoryBufferRef)jarg1; + + arg2 = (LLVMContextRef)jarg2; + + arg3 = (LLVMModuleProviderRef *)jarg3; + + arg4 = (char **)jarg4; + + result = (int)LLVMGetBitcodeModuleProviderInContext(arg1,arg2,arg3,arg4); + jresult = result; + + + + return jresult; + +} + + + +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif + Added: llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer-binding.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer-binding.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer-binding.ads (added) +++ llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer-binding.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,28 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with llvm; +with Interfaces.C.Strings; + + +package LLVM_bit_Writer.Binding is + + function LLVMWriteBitcodeToFileHandle + (M : in llvm.LLVMModuleRef; + Handle : in Interfaces.C.int) + return Interfaces.C.int; + + function LLVMWriteBitcodeToFile + (M : in llvm.LLVMModuleRef; + Path : in Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + +private + + pragma Import + (C, + LLVMWriteBitcodeToFileHandle, + "Ada_LLVMWriteBitcodeToFileHandle"); + pragma Import (C, LLVMWriteBitcodeToFile, "Ada_LLVMWriteBitcodeToFile"); + +end LLVM_bit_Writer.Binding; Added: llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer.ads (added) +++ llvm/trunk/bindings/ada/bitwriter/llvm_bit_writer.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,6 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +package LLVM_bit_Writer is + +end LLVM_bit_Writer; Added: llvm/trunk/bindings/ada/bitwriter/llvm_bitwriter_wrap.cxx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/bitwriter/llvm_bitwriter_wrap.cxx?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/bitwriter/llvm_bitwriter_wrap.cxx (added) +++ llvm/trunk/bindings/ada/bitwriter/llvm_bitwriter_wrap.cxx Mon Aug 17 19:24:36 2009 @@ -0,0 +1,335 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.36 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#include +#include +#include +#if defined(_WIN32) || defined(__CYGWIN32__) +# define DllExport __declspec( dllexport ) +# define SWIGSTDCALL __stdcall +#else +# define DllExport +# define SWIGSTDCALL +#endif + + +#ifdef __cplusplus +# include +#endif + + + + +/* Support for throwing Ada exceptions from C/C++ */ + +typedef enum +{ + SWIG_AdaException, + SWIG_AdaOutOfMemoryException, + SWIG_AdaIndexOutOfRangeException, + SWIG_AdaDivideByZeroException, + SWIG_AdaArgumentOutOfRangeException, + SWIG_AdaNullReferenceException +} SWIG_AdaExceptionCodes; + + +typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *); + + +typedef struct +{ + SWIG_AdaExceptionCodes code; + SWIG_AdaExceptionCallback_t callback; +} + SWIG_AdaExceptions_t; + + +static +SWIG_AdaExceptions_t +SWIG_ada_exceptions[] = +{ + { SWIG_AdaException, NULL }, + { SWIG_AdaOutOfMemoryException, NULL }, + { SWIG_AdaIndexOutOfRangeException, NULL }, + { SWIG_AdaDivideByZeroException, NULL }, + { SWIG_AdaArgumentOutOfRangeException, NULL }, + { SWIG_AdaNullReferenceException, NULL } +}; + + +static +void +SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg) +{ + SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback; + if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) { + callback = SWIG_ada_exceptions[code].callback; + } + callback(msg); +} + + + +#ifdef __cplusplus +extern "C" +#endif + +DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_bit_Writer (SWIG_AdaExceptionCallback_t systemException, + SWIG_AdaExceptionCallback_t outOfMemory, + SWIG_AdaExceptionCallback_t indexOutOfRange, + SWIG_AdaExceptionCallback_t divideByZero, + SWIG_AdaExceptionCallback_t argumentOutOfRange, + SWIG_AdaExceptionCallback_t nullReference) +{ + SWIG_ada_exceptions [SWIG_AdaException].callback = systemException; + SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory; + SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange; + SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero; + SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange; + SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference; +} + + +/* Callback for returning strings to Ada without leaking memory */ + +typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *); +static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL; + + + +/* probably obsolete ... +#ifdef __cplusplus +extern "C" +#endif +DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_bit_Writer(SWIG_AdaStringHelperCallback callback) { + SWIG_ada_string_callback = callback; +} +*/ + + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else + + +#define protected public +#define private public + +#include "llvm-c/Analysis.h" +#include "llvm-c/BitReader.h" +#include "llvm-c/BitWriter.h" +#include "llvm-c/Core.h" +#include "llvm-c/ExecutionEngine.h" +#include "llvm-c/LinkTimeOptimizer.h" +#include "llvm-c/lto.h" +#include "llvm-c/Target.h" + + + +// struct LLVMCtxt; + + +#undef protected +#undef private +#ifdef __cplusplus +extern "C" { +#endif +DllExport int SWIGSTDCALL Ada_LLVMWriteBitcodeToFileHandle ( + void * jarg1 + , + + int jarg2 + ) +{ + int jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + int arg2 ; + int result; + + arg1 = (LLVMModuleRef)jarg1; + + + arg2 = (int) jarg2; + + + result = (int)LLVMWriteBitcodeToFileHandle(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMWriteBitcodeToFile ( + void * jarg1 + , + + char * jarg2 + ) +{ + int jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *arg2 = (char *) 0 ; + int result; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = jarg2; + + result = (int)LLVMWriteBitcodeToFile(arg1,(char const *)arg2); + jresult = result; + + + + return jresult; + +} + + + +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif + Added: llvm/trunk/bindings/ada/executionengine/llvm_execution_engine-binding.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/executionengine/llvm_execution_engine-binding.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/executionengine/llvm_execution_engine-binding.ads (added) +++ llvm/trunk/bindings/ada/executionengine/llvm_execution_engine-binding.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,192 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with llvm; +with Interfaces.C.Strings; + + +package LLVM_execution_Engine.Binding is + + procedure LLVMLinkInJIT; + + procedure LLVMLinkInInterpreter; + + function LLVMCreateGenericValueOfInt + (Ty : in llvm.LLVMTypeRef; + N : in Interfaces.C.Extensions.unsigned_long_long; + IsSigned : in Interfaces.C.int) + return LLVM_execution_Engine.LLVMGenericValueRef; + + function LLVMCreateGenericValueOfPointer + (P : access Interfaces.C.Extensions.void) + return LLVM_execution_Engine.LLVMGenericValueRef; + + function LLVMCreateGenericValueOfFloat + (Ty : in llvm.LLVMTypeRef; + N : in Interfaces.C.double) + return LLVM_execution_Engine.LLVMGenericValueRef; + + function LLVMGenericValueIntWidth + (GenValRef : in LLVM_execution_Engine.LLVMGenericValueRef) + return Interfaces.C.unsigned; + + function LLVMGenericValueToInt + (GenVal : in LLVM_execution_Engine.LLVMGenericValueRef; + IsSigned : in Interfaces.C.int) + return Interfaces.C.Extensions.unsigned_long_long; + + function LLVMGenericValueToPointer + (GenVal : in LLVM_execution_Engine.LLVMGenericValueRef) + return access Interfaces.C.Extensions.void; + + function LLVMGenericValueToFloat + (TyRef : in llvm.LLVMTypeRef; + GenVal : in LLVM_execution_Engine.LLVMGenericValueRef) + return Interfaces.C.double; + + procedure LLVMDisposeGenericValue + (GenVal : in LLVM_execution_Engine.LLVMGenericValueRef); + + function LLVMCreateExecutionEngine + (OutEE : access LLVM_execution_Engine.LLVMExecutionEngineRef; + MP : in llvm.LLVMModuleProviderRef; + OutError : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + function LLVMCreateInterpreter + (OutInterp : access LLVM_execution_Engine.LLVMExecutionEngineRef; + MP : in llvm.LLVMModuleProviderRef; + OutError : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + function LLVMCreateJITCompiler + (OutJIT : access LLVM_execution_Engine.LLVMExecutionEngineRef; + MP : in llvm.LLVMModuleProviderRef; + OptLevel : in Interfaces.C.unsigned; + OutError : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + procedure LLVMDisposeExecutionEngine + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef); + + procedure LLVMRunStaticConstructors + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef); + + procedure LLVMRunStaticDestructors + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef); + + function LLVMRunFunctionAsMain + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef; + F : in llvm.LLVMValueRef; + ArgC : in Interfaces.C.unsigned; + ArgV : access Interfaces.C.Strings.chars_ptr; + EnvP : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + function LLVMRunFunction + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef; + F : in llvm.LLVMValueRef; + NumArgs : in Interfaces.C.unsigned; + Args : access LLVM_execution_Engine.LLVMGenericValueRef) + return LLVM_execution_Engine.LLVMGenericValueRef; + + procedure LLVMFreeMachineCodeForFunction + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef; + F : in llvm.LLVMValueRef); + + procedure LLVMAddModuleProvider + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef; + MP : in llvm.LLVMModuleProviderRef); + + function LLVMRemoveModuleProvider + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef; + MP : in llvm.LLVMModuleProviderRef; + OutMod : access llvm.LLVMModuleRef; + OutError : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + function LLVMFindFunction + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef; + Name : in Interfaces.C.Strings.chars_ptr; + OutFn : access llvm.LLVMValueRef) + return Interfaces.C.int; + + function LLVMGetExecutionEngineTargetData + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef) + return LLVM_execution_Engine.LLVMTargetDataRef; + + procedure LLVMAddGlobalMapping + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef; + Global : in llvm.LLVMValueRef; + Addr : access Interfaces.C.Extensions.void); + + function LLVMGetPointerToGlobal + (EE : in LLVM_execution_Engine.LLVMExecutionEngineRef; + Global : in llvm.LLVMValueRef) + return access Interfaces.C.Extensions.void; + +private + + pragma Import (C, LLVMLinkInJIT, "Ada_LLVMLinkInJIT"); + pragma Import (C, LLVMLinkInInterpreter, "Ada_LLVMLinkInInterpreter"); + pragma Import + (C, + LLVMCreateGenericValueOfInt, + "Ada_LLVMCreateGenericValueOfInt"); + pragma Import + (C, + LLVMCreateGenericValueOfPointer, + "Ada_LLVMCreateGenericValueOfPointer"); + pragma Import + (C, + LLVMCreateGenericValueOfFloat, + "Ada_LLVMCreateGenericValueOfFloat"); + pragma Import + (C, + LLVMGenericValueIntWidth, + "Ada_LLVMGenericValueIntWidth"); + pragma Import (C, LLVMGenericValueToInt, "Ada_LLVMGenericValueToInt"); + pragma Import + (C, + LLVMGenericValueToPointer, + "Ada_LLVMGenericValueToPointer"); + pragma Import (C, LLVMGenericValueToFloat, "Ada_LLVMGenericValueToFloat"); + pragma Import (C, LLVMDisposeGenericValue, "Ada_LLVMDisposeGenericValue"); + pragma Import + (C, + LLVMCreateExecutionEngine, + "Ada_LLVMCreateExecutionEngine"); + pragma Import (C, LLVMCreateInterpreter, "Ada_LLVMCreateInterpreter"); + pragma Import (C, LLVMCreateJITCompiler, "Ada_LLVMCreateJITCompiler"); + pragma Import + (C, + LLVMDisposeExecutionEngine, + "Ada_LLVMDisposeExecutionEngine"); + pragma Import + (C, + LLVMRunStaticConstructors, + "Ada_LLVMRunStaticConstructors"); + pragma Import + (C, + LLVMRunStaticDestructors, + "Ada_LLVMRunStaticDestructors"); + pragma Import (C, LLVMRunFunctionAsMain, "Ada_LLVMRunFunctionAsMain"); + pragma Import (C, LLVMRunFunction, "Ada_LLVMRunFunction"); + pragma Import + (C, + LLVMFreeMachineCodeForFunction, + "Ada_LLVMFreeMachineCodeForFunction"); + pragma Import (C, LLVMAddModuleProvider, "Ada_LLVMAddModuleProvider"); + pragma Import + (C, + LLVMRemoveModuleProvider, + "Ada_LLVMRemoveModuleProvider"); + pragma Import (C, LLVMFindFunction, "Ada_LLVMFindFunction"); + pragma Import + (C, + LLVMGetExecutionEngineTargetData, + "Ada_LLVMGetExecutionEngineTargetData"); + pragma Import (C, LLVMAddGlobalMapping, "Ada_LLVMAddGlobalMapping"); + pragma Import (C, LLVMGetPointerToGlobal, "Ada_LLVMGetPointerToGlobal"); + +end LLVM_execution_Engine.Binding; Added: llvm/trunk/bindings/ada/executionengine/llvm_execution_engine.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/executionengine/llvm_execution_engine.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/executionengine/llvm_execution_engine.ads (added) +++ llvm/trunk/bindings/ada/executionengine/llvm_execution_engine.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,90 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with Interfaces.C.Extensions; + + +package LLVM_execution_Engine is + + -- LLVMOpaqueGenericValue + -- + type LLVMOpaqueGenericValue is new + Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueGenericValue_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_execution_Engine.LLVMOpaqueGenericValue; + + type LLVMOpaqueGenericValue_view is access all + LLVM_execution_Engine.LLVMOpaqueGenericValue; + + -- LLVMGenericValueRef + -- + type LLVMGenericValueRef is access all + LLVM_execution_Engine.LLVMOpaqueGenericValue; + + type LLVMGenericValueRef_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_execution_Engine.LLVMGenericValueRef; + + type LLVMGenericValueRef_view is access all + LLVM_execution_Engine.LLVMGenericValueRef; + + -- LLVMOpaqueExecutionEngine + -- + type LLVMOpaqueExecutionEngine is new + Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueExecutionEngine_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_execution_Engine.LLVMOpaqueExecutionEngine; + + type LLVMOpaqueExecutionEngine_view is access all + LLVM_execution_Engine.LLVMOpaqueExecutionEngine; + + -- LLVMExecutionEngineRef + -- + type LLVMExecutionEngineRef is access all + LLVM_execution_Engine.LLVMOpaqueExecutionEngine; + + type LLVMExecutionEngineRef_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_execution_Engine.LLVMExecutionEngineRef; + + type LLVMExecutionEngineRef_view is access all + LLVM_execution_Engine.LLVMExecutionEngineRef; + + -- LLVMTargetDataRef + -- + type LLVMTargetDataRef is new Interfaces.C.Extensions.opaque_structure_def; + + type LLVMTargetDataRef_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_execution_Engine.LLVMTargetDataRef; + + type LLVMTargetDataRef_view is access all + LLVM_execution_Engine.LLVMTargetDataRef; + + -- GenericValue + -- + type GenericValue is new Interfaces.C.Extensions.opaque_structure_def; + + type GenericValue_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_execution_Engine.GenericValue; + + type GenericValue_view is access all LLVM_execution_Engine.GenericValue; + + -- ExecutionEngine + -- + type ExecutionEngine is new Interfaces.C.Extensions.incomplete_class_def; + + type ExecutionEngine_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_execution_Engine.ExecutionEngine; + + type ExecutionEngine_view is access all + LLVM_execution_Engine.ExecutionEngine; + + +end LLVM_execution_Engine; Added: llvm/trunk/bindings/ada/executionengine/llvm_executionengine_wrap.cxx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/executionengine/llvm_executionengine_wrap.cxx?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/executionengine/llvm_executionengine_wrap.cxx (added) +++ llvm/trunk/bindings/ada/executionengine/llvm_executionengine_wrap.cxx Mon Aug 17 19:24:36 2009 @@ -0,0 +1,924 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.36 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#include +#include +#include +#if defined(_WIN32) || defined(__CYGWIN32__) +# define DllExport __declspec( dllexport ) +# define SWIGSTDCALL __stdcall +#else +# define DllExport +# define SWIGSTDCALL +#endif + + +#ifdef __cplusplus +# include +#endif + + + + +/* Support for throwing Ada exceptions from C/C++ */ + +typedef enum +{ + SWIG_AdaException, + SWIG_AdaOutOfMemoryException, + SWIG_AdaIndexOutOfRangeException, + SWIG_AdaDivideByZeroException, + SWIG_AdaArgumentOutOfRangeException, + SWIG_AdaNullReferenceException +} SWIG_AdaExceptionCodes; + + +typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *); + + +typedef struct +{ + SWIG_AdaExceptionCodes code; + SWIG_AdaExceptionCallback_t callback; +} + SWIG_AdaExceptions_t; + + +static +SWIG_AdaExceptions_t +SWIG_ada_exceptions[] = +{ + { SWIG_AdaException, NULL }, + { SWIG_AdaOutOfMemoryException, NULL }, + { SWIG_AdaIndexOutOfRangeException, NULL }, + { SWIG_AdaDivideByZeroException, NULL }, + { SWIG_AdaArgumentOutOfRangeException, NULL }, + { SWIG_AdaNullReferenceException, NULL } +}; + + +static +void +SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg) +{ + SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback; + if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) { + callback = SWIG_ada_exceptions[code].callback; + } + callback(msg); +} + + + +#ifdef __cplusplus +extern "C" +#endif + +DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_execution_Engine (SWIG_AdaExceptionCallback_t systemException, + SWIG_AdaExceptionCallback_t outOfMemory, + SWIG_AdaExceptionCallback_t indexOutOfRange, + SWIG_AdaExceptionCallback_t divideByZero, + SWIG_AdaExceptionCallback_t argumentOutOfRange, + SWIG_AdaExceptionCallback_t nullReference) +{ + SWIG_ada_exceptions [SWIG_AdaException].callback = systemException; + SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory; + SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange; + SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero; + SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange; + SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference; +} + + +/* Callback for returning strings to Ada without leaking memory */ + +typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *); +static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL; + + + +/* probably obsolete ... +#ifdef __cplusplus +extern "C" +#endif +DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_execution_Engine(SWIG_AdaStringHelperCallback callback) { + SWIG_ada_string_callback = callback; +} +*/ + + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else + + +#define protected public +#define private public + +#include "llvm-c/ExecutionEngine.h" + + + +// struct LLVMCtxt; + + +#undef protected +#undef private +#ifdef __cplusplus +extern "C" { +#endif +DllExport void SWIGSTDCALL Ada_LLVMLinkInJIT ( + ) +{ + LLVMLinkInJIT(); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMLinkInInterpreter ( + ) +{ + LLVMLinkInInterpreter(); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMCreateGenericValueOfInt ( + void * jarg1 + , + + unsigned long long jarg2 + , + + int jarg3 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned long long arg2 ; + int arg3 ; + LLVMGenericValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + + arg2 = (unsigned long long) jarg2; + + + + arg3 = (int) jarg3; + + + result = (LLVMGenericValueRef)LLVMCreateGenericValueOfInt(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMCreateGenericValueOfPointer ( + void* jarg1 + ) +{ + void * jresult ; + void *arg1 = (void *) 0 ; + LLVMGenericValueRef result; + + arg1 = (void *)jarg1; + + result = (LLVMGenericValueRef)LLVMCreateGenericValueOfPointer(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMCreateGenericValueOfFloat ( + void * jarg1 + , + + double jarg2 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + double arg2 ; + LLVMGenericValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + + arg2 = (double) jarg2; + + + result = (LLVMGenericValueRef)LLVMCreateGenericValueOfFloat(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMGenericValueIntWidth ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMGenericValueRef arg1 = (LLVMGenericValueRef) 0 ; + unsigned int result; + + arg1 = (LLVMGenericValueRef)jarg1; + + result = (unsigned int)LLVMGenericValueIntWidth(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned long long SWIGSTDCALL Ada_LLVMGenericValueToInt ( + void * jarg1 + , + + int jarg2 + ) +{ + unsigned long long jresult ; + LLVMGenericValueRef arg1 = (LLVMGenericValueRef) 0 ; + int arg2 ; + unsigned long long result; + + arg1 = (LLVMGenericValueRef)jarg1; + + + arg2 = (int) jarg2; + + + result = (unsigned long long)LLVMGenericValueToInt(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport void* SWIGSTDCALL Ada_LLVMGenericValueToPointer ( + void * jarg1 + ) +{ + void* jresult ; + LLVMGenericValueRef arg1 = (LLVMGenericValueRef) 0 ; + void *result = 0 ; + + arg1 = (LLVMGenericValueRef)jarg1; + + result = (void *)LLVMGenericValueToPointer(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport double SWIGSTDCALL Ada_LLVMGenericValueToFloat ( + void * jarg1 + , + + void * jarg2 + ) +{ + double jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMGenericValueRef arg2 = (LLVMGenericValueRef) 0 ; + double result; + + arg1 = (LLVMTypeRef)jarg1; + + arg2 = (LLVMGenericValueRef)jarg2; + + result = (double)LLVMGenericValueToFloat(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDisposeGenericValue ( + void * jarg1 + ) +{ + LLVMGenericValueRef arg1 = (LLVMGenericValueRef) 0 ; + + arg1 = (LLVMGenericValueRef)jarg1; + + LLVMDisposeGenericValue(arg1); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMCreateExecutionEngine ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + int jresult ; + LLVMExecutionEngineRef *arg1 = (LLVMExecutionEngineRef *) 0 ; + LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ; + char **arg3 = (char **) 0 ; + int result; + + arg1 = (LLVMExecutionEngineRef *)jarg1; + + arg2 = (LLVMModuleProviderRef)jarg2; + + arg3 = (char **)jarg3; + + result = (int)LLVMCreateExecutionEngine(arg1,arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMCreateInterpreter ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + int jresult ; + LLVMExecutionEngineRef *arg1 = (LLVMExecutionEngineRef *) 0 ; + LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ; + char **arg3 = (char **) 0 ; + int result; + + arg1 = (LLVMExecutionEngineRef *)jarg1; + + arg2 = (LLVMModuleProviderRef)jarg2; + + arg3 = (char **)jarg3; + + result = (int)LLVMCreateInterpreter(arg1,arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMCreateJITCompiler ( + void * jarg1 + , + + void * jarg2 + , + + unsigned int jarg3 + , + + void * jarg4 + ) +{ + int jresult ; + LLVMExecutionEngineRef *arg1 = (LLVMExecutionEngineRef *) 0 ; + LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ; + unsigned int arg3 ; + char **arg4 = (char **) 0 ; + int result; + + arg1 = (LLVMExecutionEngineRef *)jarg1; + + arg2 = (LLVMModuleProviderRef)jarg2; + + + arg3 = (unsigned int) jarg3; + + + arg4 = (char **)jarg4; + + result = (int)LLVMCreateJITCompiler(arg1,arg2,arg3,arg4); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDisposeExecutionEngine ( + void * jarg1 + ) +{ + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + LLVMDisposeExecutionEngine(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMRunStaticConstructors ( + void * jarg1 + ) +{ + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + LLVMRunStaticConstructors(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMRunStaticDestructors ( + void * jarg1 + ) +{ + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + LLVMRunStaticDestructors(arg1); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMRunFunctionAsMain ( + void * jarg1 + , + + void * jarg2 + , + + unsigned int jarg3 + , + + void * jarg4 + , + + void * jarg5 + ) +{ + int jresult ; + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + unsigned int arg3 ; + char **arg4 = (char **) 0 ; + char **arg5 = (char **) 0 ; + int result; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + + arg3 = (unsigned int) jarg3; + + + arg4 = (char **)jarg4; + + arg5 = (char **)jarg5; + + result = (int)LLVMRunFunctionAsMain(arg1,arg2,arg3,(char const *const *)arg4,(char const *const *)arg5); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMRunFunction ( + void * jarg1 + , + + void * jarg2 + , + + unsigned int jarg3 + , + + void * jarg4 + ) +{ + void * jresult ; + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + unsigned int arg3 ; + LLVMGenericValueRef *arg4 = (LLVMGenericValueRef *) 0 ; + LLVMGenericValueRef result; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + + arg3 = (unsigned int) jarg3; + + + arg4 = (LLVMGenericValueRef *)jarg4; + + result = (LLVMGenericValueRef)LLVMRunFunction(arg1,arg2,arg3,arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMFreeMachineCodeForFunction ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + LLVMFreeMachineCodeForFunction(arg1,arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddModuleProvider ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + arg2 = (LLVMModuleProviderRef)jarg2; + + LLVMAddModuleProvider(arg1,arg2); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMRemoveModuleProvider ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + void * jarg4 + ) +{ + int jresult ; + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + LLVMModuleProviderRef arg2 = (LLVMModuleProviderRef) 0 ; + LLVMModuleRef *arg3 = (LLVMModuleRef *) 0 ; + char **arg4 = (char **) 0 ; + int result; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + arg2 = (LLVMModuleProviderRef)jarg2; + + arg3 = (LLVMModuleRef *)jarg3; + + arg4 = (char **)jarg4; + + result = (int)LLVMRemoveModuleProvider(arg1,arg2,arg3,arg4); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMFindFunction ( + void * jarg1 + , + + char * jarg2 + , + + void * jarg3 + ) +{ + int jresult ; + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + char *arg2 = (char *) 0 ; + LLVMValueRef *arg3 = (LLVMValueRef *) 0 ; + int result; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + arg2 = jarg2; + + arg3 = (LLVMValueRef *)jarg3; + + result = (int)LLVMFindFunction(arg1,(char const *)arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport LLVMTargetDataRef SWIGSTDCALL Ada_LLVMGetExecutionEngineTargetData ( + void * jarg1 + ) +{ + LLVMTargetDataRef jresult ; + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + LLVMTargetDataRef result; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + result = LLVMGetExecutionEngineTargetData(arg1); + + jresult = result; + //jresult = new LLVMTargetDataRef ((LLVMTargetDataRef &) result); + + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddGlobalMapping ( + void * jarg1 + , + + void * jarg2 + , + + void* jarg3 + ) +{ + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + void *arg3 = (void *) 0 ; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (void *)jarg3; + + LLVMAddGlobalMapping(arg1,arg2,arg3); + + +} + + + +DllExport void* SWIGSTDCALL Ada_LLVMGetPointerToGlobal ( + void * jarg1 + , + + void * jarg2 + ) +{ + void* jresult ; + LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + void *result = 0 ; + + arg1 = (LLVMExecutionEngineRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (void *)LLVMGetPointerToGlobal(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif + Added: llvm/trunk/bindings/ada/llvm.gpr URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/llvm.gpr?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/llvm.gpr (added) +++ llvm/trunk/bindings/ada/llvm.gpr Mon Aug 17 19:24:36 2009 @@ -0,0 +1,34 @@ +project LLVM is + + for Languages use ("Ada", "C++"); + for Source_Dirs use (".", "analysis", "bitreader", "bitwriter", "executionengine", "llvm", "target", "transforms"); + for Object_Dir use "build"; + for Exec_Dir use "."; + for Library_Name use "llvm_ada"; + for Library_Dir use "lib"; + for Library_Ali_Dir use "objects"; + + package Naming is + for Specification_Suffix ("c++") use ".h"; + for Implementation_Suffix ("c++") use ".cxx"; + end Naming; + + package Builder is + for Default_Switches ("ada") use ("-g"); + end Builder; + + package Compiler is + for Default_Switches ("ada") use ("-gnato", "-fstack-check", "-g", "-gnata", "-gnat05", "-I/usr/local/include"); + for Default_Switches ("c++") use ("-D__STDC_LIMIT_MACROS", "-D__STDC_CONSTANT_MACROS", "-I../../include", "-g"); + end Compiler; + + package Binder is + for Default_Switches ("ada") use ("-E"); + end Binder; + + package Linker is + for Default_Switches ("c++") use ("-g"); + end Linker; + +end LLVM; + Added: llvm/trunk/bindings/ada/llvm/llvm-binding.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/llvm/llvm-binding.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/llvm/llvm-binding.ads (added) +++ llvm/trunk/bindings/ada/llvm/llvm-binding.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,1974 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with Interfaces.C.Strings; + + +package llvm.Binding is + + procedure LLVMDisposeMessage + (Message : in Interfaces.C.Strings.chars_ptr); + + function LLVMContextCreate return llvm.LLVMContextRef; + + function LLVMGetGlobalContext return llvm.LLVMContextRef; + + procedure LLVMContextDispose (C : in llvm.LLVMContextRef); + + function LLVMModuleCreateWithName + (ModuleID : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMModuleRef; + + function LLVMModuleCreateWithNameInContext + (ModuleID : in Interfaces.C.Strings.chars_ptr; + C : in llvm.LLVMContextRef) + return llvm.LLVMModuleRef; + + procedure LLVMDisposeModule (M : in llvm.LLVMModuleRef); + + function LLVMGetDataLayout + (M : in llvm.LLVMModuleRef) + return Interfaces.C.Strings.chars_ptr; + + procedure LLVMSetDataLayout + (M : in llvm.LLVMModuleRef; + Triple : in Interfaces.C.Strings.chars_ptr); + + function LLVMGetTarget + (M : in llvm.LLVMModuleRef) + return Interfaces.C.Strings.chars_ptr; + + procedure LLVMSetTarget + (M : in llvm.LLVMModuleRef; + Triple : in Interfaces.C.Strings.chars_ptr); + + function LLVMAddTypeName + (M : in llvm.LLVMModuleRef; + Name : in Interfaces.C.Strings.chars_ptr; + Ty : in llvm.LLVMTypeRef) + return Interfaces.C.int; + + procedure LLVMDeleteTypeName + (M : in llvm.LLVMModuleRef; + Name : in Interfaces.C.Strings.chars_ptr); + + function LLVMGetTypeByName + (M : in llvm.LLVMModuleRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMTypeRef; + + procedure LLVMDumpModule (M : in llvm.LLVMModuleRef); + + function LLVMGetTypeKind + (Ty : in llvm.LLVMTypeRef) + return llvm.LLVMTypeKind; + + function LLVMInt1Type return llvm.LLVMTypeRef; + + function LLVMInt8Type return llvm.LLVMTypeRef; + + function LLVMInt16Type return llvm.LLVMTypeRef; + + function LLVMInt32Type return llvm.LLVMTypeRef; + + function LLVMInt64Type return llvm.LLVMTypeRef; + + function LLVMIntType + (NumBits : in Interfaces.C.unsigned) + return llvm.LLVMTypeRef; + + function LLVMGetIntTypeWidth + (IntegerTy : in llvm.LLVMTypeRef) + return Interfaces.C.unsigned; + + function LLVMFloatType return llvm.LLVMTypeRef; + + function LLVMDoubleType return llvm.LLVMTypeRef; + + function LLVMX86FP80Type return llvm.LLVMTypeRef; + + function LLVMFP128Type return llvm.LLVMTypeRef; + + function LLVMPPCFP128Type return llvm.LLVMTypeRef; + + function LLVMFunctionType + (ReturnType : in llvm.LLVMTypeRef; + ParamTypes : access llvm.LLVMTypeRef; + ParamCount : in Interfaces.C.unsigned; + IsVarArg : in Interfaces.C.int) + return llvm.LLVMTypeRef; + + function LLVMIsFunctionVarArg + (FunctionTy : in llvm.LLVMTypeRef) + return Interfaces.C.int; + + function LLVMGetReturnType + (FunctionTy : in llvm.LLVMTypeRef) + return llvm.LLVMTypeRef; + + function LLVMCountParamTypes + (FunctionTy : in llvm.LLVMTypeRef) + return Interfaces.C.unsigned; + + procedure LLVMGetParamTypes + (FunctionTy : in llvm.LLVMTypeRef; + Dest : access llvm.LLVMTypeRef); + + function LLVMStructType + (ElementTypes : access llvm.LLVMTypeRef; + ElementCount : in Interfaces.C.unsigned; + Packed : in Interfaces.C.int) + return llvm.LLVMTypeRef; + + function LLVMCountStructElementTypes + (StructTy : in llvm.LLVMTypeRef) + return Interfaces.C.unsigned; + + procedure LLVMGetStructElementTypes + (StructTy : in llvm.LLVMTypeRef; + Dest : access llvm.LLVMTypeRef); + + function LLVMIsPackedStruct + (StructTy : in llvm.LLVMTypeRef) + return Interfaces.C.int; + + function LLVMArrayType + (ElementType : in llvm.LLVMTypeRef; + ElementCount : in Interfaces.C.unsigned) + return llvm.LLVMTypeRef; + + function LLVMPointerType + (ElementType : in llvm.LLVMTypeRef; + AddressSpace : in Interfaces.C.unsigned) + return llvm.LLVMTypeRef; + + function LLVMVectorType + (ElementType : in llvm.LLVMTypeRef; + ElementCount : in Interfaces.C.unsigned) + return llvm.LLVMTypeRef; + + function LLVMGetElementType + (Ty : in llvm.LLVMTypeRef) + return llvm.LLVMTypeRef; + + function LLVMGetArrayLength + (ArrayTy : in llvm.LLVMTypeRef) + return Interfaces.C.unsigned; + + function LLVMGetPointerAddressSpace + (PointerTy : in llvm.LLVMTypeRef) + return Interfaces.C.unsigned; + + function LLVMGetVectorSize + (VectorTy : in llvm.LLVMTypeRef) + return Interfaces.C.unsigned; + + function LLVMVoidType return llvm.LLVMTypeRef; + + function LLVMLabelType return llvm.LLVMTypeRef; + + function LLVMOpaqueType return llvm.LLVMTypeRef; + + function LLVMCreateTypeHandle + (PotentiallyAbstractTy : in llvm.LLVMTypeRef) + return llvm.LLVMTypeHandleRef; + + procedure LLVMRefineType + (AbstractTy : in llvm.LLVMTypeRef; + ConcreteTy : in llvm.LLVMTypeRef); + + function LLVMResolveTypeHandle + (TypeHandle : in llvm.LLVMTypeHandleRef) + return llvm.LLVMTypeRef; + + procedure LLVMDisposeTypeHandle (TypeHandle : in llvm.LLVMTypeHandleRef); + + function LLVMTypeOf (Val : in llvm.LLVMValueRef) return llvm.LLVMTypeRef; + + function LLVMGetValueName + (Val : in llvm.LLVMValueRef) + return Interfaces.C.Strings.chars_ptr; + + procedure LLVMSetValueName + (Val : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr); + + procedure LLVMDumpValue (Val : in llvm.LLVMValueRef); + + function LLVMIsAArgument + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsABasicBlock + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAInlineAsm + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAUser + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAConstant + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAConstantAggregateZero + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAConstantArray + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAConstantExpr + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAConstantFP + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAConstantInt + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAConstantPointerNull + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAConstantStruct + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAConstantVector + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAGlobalValue + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAFunction + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAGlobalAlias + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAGlobalVariable + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAUndefValue + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAInstruction + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsABinaryOperator + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsACallInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAIntrinsicInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsADbgInfoIntrinsic + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsADbgDeclareInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsADbgFuncStartInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsADbgRegionEndInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsADbgRegionStartInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsADbgStopPointInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAEHSelectorInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAMemIntrinsic + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAMemCpyInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAMemMoveInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAMemSetInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsACmpInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAFCmpInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAICmpInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAExtractElementInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAGetElementPtrInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAInsertElementInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAInsertValueInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAPHINode + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsASelectInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAShuffleVectorInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAStoreInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsATerminatorInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsABranchInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAInvokeInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAReturnInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsASwitchInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAUnreachableInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAUnwindInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAUnaryInstruction + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAAllocationInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAAllocaInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAMallocInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsACastInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsABitCastInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAFPExtInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAFPToSIInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAFPToUIInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAFPTruncInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAIntToPtrInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAPtrToIntInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsASExtInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsASIToFPInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsATruncInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAUIToFPInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAZExtInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAExtractValueInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAFreeInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsALoadInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMIsAVAArgInst + (Val : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstNull + (Ty : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstAllOnes + (Ty : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMGetUndef + (Ty : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMIsConstant + (Val : in llvm.LLVMValueRef) + return Interfaces.C.int; + + function LLVMIsNull (Val : in llvm.LLVMValueRef) return Interfaces.C.int; + + function LLVMIsUndef + (Val : in llvm.LLVMValueRef) + return Interfaces.C.int; + + function LLVMConstPointerNull + (Ty : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstInt + (IntTy : in llvm.LLVMTypeRef; + N : in Interfaces.C.Extensions.unsigned_long_long; + SignExtend : in Interfaces.C.int) + return llvm.LLVMValueRef; + + function LLVMConstReal + (RealTy : in llvm.LLVMTypeRef; + N : in Interfaces.C.double) + return llvm.LLVMValueRef; + + function LLVMConstRealOfString + (RealTy : in llvm.LLVMTypeRef; + Text : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMConstString + (Str : in Interfaces.C.Strings.chars_ptr; + Length : in Interfaces.C.unsigned; + DontNullTerminate : in Interfaces.C.int) + return llvm.LLVMValueRef; + + function LLVMConstArray + (ElementTy : in llvm.LLVMTypeRef; + ConstantVals : access llvm.LLVMValueRef; + Length : in Interfaces.C.unsigned) + return llvm.LLVMValueRef; + + function LLVMConstStruct + (ConstantVals : access llvm.LLVMValueRef; + Count : in Interfaces.C.unsigned; + packed : in Interfaces.C.int) + return llvm.LLVMValueRef; + + function LLVMConstVector + (ScalarConstantVals : access llvm.LLVMValueRef; + Size : in Interfaces.C.unsigned) + return llvm.LLVMValueRef; + + function LLVMSizeOf (Ty : in llvm.LLVMTypeRef) return llvm.LLVMValueRef; + + function LLVMConstNeg + (ConstantVal : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstNot + (ConstantVal : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstAdd + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstSub + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstMul + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstUDiv + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstSDiv + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstFDiv + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstURem + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstSRem + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstFRem + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstAnd + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstOr + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstXor + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstICmp + (Predicate : in llvm.LLVMIntPredicate; + LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstFCmp + (Predicate : in llvm.LLVMRealPredicate; + LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstShl + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstLShr + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstAShr + (LHSConstant : in llvm.LLVMValueRef; + RHSConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstGEP + (ConstantVal : in llvm.LLVMValueRef; + ConstantIndices : access llvm.LLVMValueRef; + NumIndices : in Interfaces.C.unsigned) + return llvm.LLVMValueRef; + + function LLVMConstTrunc + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstSExt + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstZExt + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstFPTrunc + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstFPExt + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstUIToFP + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstSIToFP + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstFPToUI + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstFPToSI + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstPtrToInt + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstIntToPtr + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstBitCast + (ConstantVal : in llvm.LLVMValueRef; + ToType : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMConstSelect + (ConstantCondition : in llvm.LLVMValueRef; + ConstantIfTrue : in llvm.LLVMValueRef; + ConstantIfFalse : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstExtractElement + (VectorConstant : in llvm.LLVMValueRef; + IndexConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstInsertElement + (VectorConstant : in llvm.LLVMValueRef; + ElementValueConstant : in llvm.LLVMValueRef; + IndexConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstShuffleVector + (VectorAConstant : in llvm.LLVMValueRef; + VectorBConstant : in llvm.LLVMValueRef; + MaskConstant : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMConstExtractValue + (AggConstant : in llvm.LLVMValueRef; + IdxList : access Interfaces.C.unsigned; + NumIdx : in Interfaces.C.unsigned) + return llvm.LLVMValueRef; + + function LLVMConstInsertValue + (AggConstant : in llvm.LLVMValueRef; + ElementValueConstant : in llvm.LLVMValueRef; + IdxList : access Interfaces.C.unsigned; + NumIdx : in Interfaces.C.unsigned) + return llvm.LLVMValueRef; + + function LLVMConstInlineAsm + (Ty : in llvm.LLVMTypeRef; + AsmString : in Interfaces.C.Strings.chars_ptr; + Constraints : in Interfaces.C.Strings.chars_ptr; + HasSideEffects : in Interfaces.C.int) + return llvm.LLVMValueRef; + + function LLVMGetGlobalParent + (Global : in llvm.LLVMValueRef) + return llvm.LLVMModuleRef; + + function LLVMIsDeclaration + (Global : in llvm.LLVMValueRef) + return Interfaces.C.int; + + function LLVMGetLinkage + (Global : in llvm.LLVMValueRef) + return llvm.LLVMLinkage; + + procedure LLVMSetLinkage + (Global : in llvm.LLVMValueRef; + Linkage : in llvm.LLVMLinkage); + + function LLVMGetSection + (Global : in llvm.LLVMValueRef) + return Interfaces.C.Strings.chars_ptr; + + procedure LLVMSetSection + (Global : in llvm.LLVMValueRef; + Section : in Interfaces.C.Strings.chars_ptr); + + function LLVMGetVisibility + (Global : in llvm.LLVMValueRef) + return llvm.LLVMVisibility; + + procedure LLVMSetVisibility + (Global : in llvm.LLVMValueRef; + Viz : in llvm.LLVMVisibility); + + function LLVMGetAlignment + (Global : in llvm.LLVMValueRef) + return Interfaces.C.unsigned; + + procedure LLVMSetAlignment + (Global : in llvm.LLVMValueRef; + Bytes : in Interfaces.C.unsigned); + + function LLVMAddGlobal + (M : in llvm.LLVMModuleRef; + Ty : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMGetNamedGlobal + (M : in llvm.LLVMModuleRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMGetFirstGlobal + (M : in llvm.LLVMModuleRef) + return llvm.LLVMValueRef; + + function LLVMGetLastGlobal + (M : in llvm.LLVMModuleRef) + return llvm.LLVMValueRef; + + function LLVMGetNextGlobal + (GlobalVar : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMGetPreviousGlobal + (GlobalVar : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + procedure LLVMDeleteGlobal (GlobalVar : in llvm.LLVMValueRef); + + function LLVMGetInitializer + (GlobalVar : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + procedure LLVMSetInitializer + (GlobalVar : in llvm.LLVMValueRef; + ConstantVal : in llvm.LLVMValueRef); + + function LLVMIsThreadLocal + (GlobalVar : in llvm.LLVMValueRef) + return Interfaces.C.int; + + procedure LLVMSetThreadLocal + (GlobalVar : in llvm.LLVMValueRef; + IsThreadLocal : in Interfaces.C.int); + + function LLVMIsGlobalConstant + (GlobalVar : in llvm.LLVMValueRef) + return Interfaces.C.int; + + procedure LLVMSetGlobalConstant + (GlobalVar : in llvm.LLVMValueRef; + IsConstant : in Interfaces.C.int); + + function LLVMAddAlias + (M : in llvm.LLVMModuleRef; + Ty : in llvm.LLVMTypeRef; + Aliasee : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMAddFunction + (M : in llvm.LLVMModuleRef; + Name : in Interfaces.C.Strings.chars_ptr; + FunctionTy : in llvm.LLVMTypeRef) + return llvm.LLVMValueRef; + + function LLVMGetNamedFunction + (M : in llvm.LLVMModuleRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMGetFirstFunction + (M : in llvm.LLVMModuleRef) + return llvm.LLVMValueRef; + + function LLVMGetLastFunction + (M : in llvm.LLVMModuleRef) + return llvm.LLVMValueRef; + + function LLVMGetNextFunction + (Fn : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMGetPreviousFunction + (Fn : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + procedure LLVMDeleteFunction (Fn : in llvm.LLVMValueRef); + + function LLVMGetIntrinsicID + (Fn : in llvm.LLVMValueRef) + return Interfaces.C.unsigned; + + function LLVMGetFunctionCallConv + (Fn : in llvm.LLVMValueRef) + return Interfaces.C.unsigned; + + procedure LLVMSetFunctionCallConv + (Fn : in llvm.LLVMValueRef; + CC : in Interfaces.C.unsigned); + + function LLVMGetGC + (Fn : in llvm.LLVMValueRef) + return Interfaces.C.Strings.chars_ptr; + + procedure LLVMSetGC + (Fn : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr); + + procedure LLVMAddFunctionAttr + (Fn : in llvm.LLVMValueRef; + PA : in llvm.LLVMAttribute); + + procedure LLVMRemoveFunctionAttr + (Fn : in llvm.LLVMValueRef; + PA : in llvm.LLVMAttribute); + + function LLVMCountParams + (Fn : in llvm.LLVMValueRef) + return Interfaces.C.unsigned; + + procedure LLVMGetParams + (Fn : in llvm.LLVMValueRef; + Params : access llvm.LLVMValueRef); + + function LLVMGetParam + (Fn : in llvm.LLVMValueRef; + Index : in Interfaces.C.unsigned) + return llvm.LLVMValueRef; + + function LLVMGetParamParent + (Inst : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMGetFirstParam + (Fn : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMGetLastParam + (Fn : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMGetNextParam + (Arg : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMGetPreviousParam + (Arg : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + procedure LLVMAddAttribute + (Arg : in llvm.LLVMValueRef; + PA : in llvm.LLVMAttribute); + + procedure LLVMRemoveAttribute + (Arg : in llvm.LLVMValueRef; + PA : in llvm.LLVMAttribute); + + procedure LLVMSetParamAlignment + (Arg : in llvm.LLVMValueRef; + align : in Interfaces.C.unsigned); + + function LLVMBasicBlockAsValue + (BB : in llvm.LLVMBasicBlockRef) + return llvm.LLVMValueRef; + + function LLVMValueIsBasicBlock + (Val : in llvm.LLVMValueRef) + return Interfaces.C.int; + + function LLVMValueAsBasicBlock + (Val : in llvm.LLVMValueRef) + return llvm.LLVMBasicBlockRef; + + function LLVMGetBasicBlockParent + (BB : in llvm.LLVMBasicBlockRef) + return llvm.LLVMValueRef; + + function LLVMCountBasicBlocks + (Fn : in llvm.LLVMValueRef) + return Interfaces.C.unsigned; + + procedure LLVMGetBasicBlocks + (Fn : in llvm.LLVMValueRef; + BasicBlocks : access llvm.LLVMBasicBlockRef); + + function LLVMGetFirstBasicBlock + (Fn : in llvm.LLVMValueRef) + return llvm.LLVMBasicBlockRef; + + function LLVMGetLastBasicBlock + (Fn : in llvm.LLVMValueRef) + return llvm.LLVMBasicBlockRef; + + function LLVMGetNextBasicBlock + (BB : in llvm.LLVMBasicBlockRef) + return llvm.LLVMBasicBlockRef; + + function LLVMGetPreviousBasicBlock + (BB : in llvm.LLVMBasicBlockRef) + return llvm.LLVMBasicBlockRef; + + function LLVMGetEntryBasicBlock + (Fn : in llvm.LLVMValueRef) + return llvm.LLVMBasicBlockRef; + + function LLVMAppendBasicBlock + (Fn : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMBasicBlockRef; + + function LLVMInsertBasicBlock + (InsertBeforeBB : in llvm.LLVMBasicBlockRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMBasicBlockRef; + + procedure LLVMDeleteBasicBlock (BB : in llvm.LLVMBasicBlockRef); + + function LLVMGetInstructionParent + (Inst : in llvm.LLVMValueRef) + return llvm.LLVMBasicBlockRef; + + function LLVMGetFirstInstruction + (BB : in llvm.LLVMBasicBlockRef) + return llvm.LLVMValueRef; + + function LLVMGetLastInstruction + (BB : in llvm.LLVMBasicBlockRef) + return llvm.LLVMValueRef; + + function LLVMGetNextInstruction + (Inst : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMGetPreviousInstruction + (Inst : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + procedure LLVMSetInstructionCallConv + (Instr : in llvm.LLVMValueRef; + CC : in Interfaces.C.unsigned); + + function LLVMGetInstructionCallConv + (Instr : in llvm.LLVMValueRef) + return Interfaces.C.unsigned; + + procedure LLVMAddInstrAttribute + (Instr : in llvm.LLVMValueRef; + index : in Interfaces.C.unsigned; + arg_1 : in llvm.LLVMAttribute); + + procedure LLVMRemoveInstrAttribute + (Instr : in llvm.LLVMValueRef; + index : in Interfaces.C.unsigned; + arg_1 : in llvm.LLVMAttribute); + + procedure LLVMSetInstrParamAlignment + (Instr : in llvm.LLVMValueRef; + index : in Interfaces.C.unsigned; + align : in Interfaces.C.unsigned); + + function LLVMIsTailCall + (CallInst : in llvm.LLVMValueRef) + return Interfaces.C.int; + + procedure LLVMSetTailCall + (CallInst : in llvm.LLVMValueRef; + IsTailCall : in Interfaces.C.int); + + procedure LLVMAddIncoming + (PhiNode : in llvm.LLVMValueRef; + IncomingValues : access llvm.LLVMValueRef; + IncomingBlocks : access llvm.LLVMBasicBlockRef; + Count : in Interfaces.C.unsigned); + + function LLVMCountIncoming + (PhiNode : in llvm.LLVMValueRef) + return Interfaces.C.unsigned; + + function LLVMGetIncomingValue + (PhiNode : in llvm.LLVMValueRef; + Index : in Interfaces.C.unsigned) + return llvm.LLVMValueRef; + + function LLVMGetIncomingBlock + (PhiNode : in llvm.LLVMValueRef; + Index : in Interfaces.C.unsigned) + return llvm.LLVMBasicBlockRef; + + function LLVMCreateBuilder return llvm.LLVMBuilderRef; + + procedure LLVMPositionBuilder + (Builder : in llvm.LLVMBuilderRef; + Block : in llvm.LLVMBasicBlockRef; + Instr : in llvm.LLVMValueRef); + + procedure LLVMPositionBuilderBefore + (Builder : in llvm.LLVMBuilderRef; + Instr : in llvm.LLVMValueRef); + + procedure LLVMPositionBuilderAtEnd + (Builder : in llvm.LLVMBuilderRef; + Block : in llvm.LLVMBasicBlockRef); + + function LLVMGetInsertBlock + (Builder : in llvm.LLVMBuilderRef) + return llvm.LLVMBasicBlockRef; + + procedure LLVMClearInsertionPosition (Builder : in llvm.LLVMBuilderRef); + + procedure LLVMInsertIntoBuilder + (Builder : in llvm.LLVMBuilderRef; + Instr : in llvm.LLVMValueRef); + + procedure LLVMDisposeBuilder (Builder : in llvm.LLVMBuilderRef); + + function LLVMBuildRetVoid + (arg_1 : in llvm.LLVMBuilderRef) + return llvm.LLVMValueRef; + + function LLVMBuildRet + (arg_1 : in llvm.LLVMBuilderRef; + V : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMBuildBr + (arg_1 : in llvm.LLVMBuilderRef; + Dest : in llvm.LLVMBasicBlockRef) + return llvm.LLVMValueRef; + + function LLVMBuildCondBr + (arg_1 : in llvm.LLVMBuilderRef; + the_If : in llvm.LLVMValueRef; + the_Then : in llvm.LLVMBasicBlockRef; + the_Else : in llvm.LLVMBasicBlockRef) + return llvm.LLVMValueRef; + + function LLVMBuildSwitch + (arg_1 : in llvm.LLVMBuilderRef; + V : in llvm.LLVMValueRef; + the_Else : in llvm.LLVMBasicBlockRef; + NumCases : in Interfaces.C.unsigned) + return llvm.LLVMValueRef; + + function LLVMBuildInvoke + (arg_1 : in llvm.LLVMBuilderRef; + Fn : in llvm.LLVMValueRef; + Args : access llvm.LLVMValueRef; + NumArgs : in Interfaces.C.unsigned; + the_Then : in llvm.LLVMBasicBlockRef; + Catch : in llvm.LLVMBasicBlockRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildUnwind + (arg_1 : in llvm.LLVMBuilderRef) + return llvm.LLVMValueRef; + + function LLVMBuildUnreachable + (arg_1 : in llvm.LLVMBuilderRef) + return llvm.LLVMValueRef; + + procedure LLVMAddCase + (Switch : in llvm.LLVMValueRef; + OnVal : in llvm.LLVMValueRef; + Dest : in llvm.LLVMBasicBlockRef); + + function LLVMBuildAdd + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildSub + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildMul + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildUDiv + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildSDiv + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildFDiv + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildURem + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildSRem + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildFRem + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildShl + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildLShr + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildAShr + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildAnd + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildOr + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildXor + (arg_1 : in llvm.LLVMBuilderRef; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildNeg + (arg_1 : in llvm.LLVMBuilderRef; + V : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildNot + (arg_1 : in llvm.LLVMBuilderRef; + V : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildMalloc + (arg_1 : in llvm.LLVMBuilderRef; + Ty : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildArrayMalloc + (arg_1 : in llvm.LLVMBuilderRef; + Ty : in llvm.LLVMTypeRef; + Val : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildAlloca + (arg_1 : in llvm.LLVMBuilderRef; + Ty : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildArrayAlloca + (arg_1 : in llvm.LLVMBuilderRef; + Ty : in llvm.LLVMTypeRef; + Val : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildFree + (arg_1 : in llvm.LLVMBuilderRef; + PointerVal : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMBuildLoad + (arg_1 : in llvm.LLVMBuilderRef; + PointerVal : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildStore + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + Ptr : in llvm.LLVMValueRef) + return llvm.LLVMValueRef; + + function LLVMBuildGEP + (B : in llvm.LLVMBuilderRef; + Pointer : in llvm.LLVMValueRef; + Indices : access llvm.LLVMValueRef; + NumIndices : in Interfaces.C.unsigned; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildTrunc + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildZExt + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildSExt + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildFPToUI + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildFPToSI + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildUIToFP + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildSIToFP + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildFPTrunc + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildFPExt + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildPtrToInt + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildIntToPtr + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildBitCast + (arg_1 : in llvm.LLVMBuilderRef; + Val : in llvm.LLVMValueRef; + DestTy : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildICmp + (arg_1 : in llvm.LLVMBuilderRef; + Op : in llvm.LLVMIntPredicate; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildFCmp + (arg_1 : in llvm.LLVMBuilderRef; + Op : in llvm.LLVMRealPredicate; + LHS : in llvm.LLVMValueRef; + RHS : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildPhi + (arg_1 : in llvm.LLVMBuilderRef; + Ty : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildCall + (arg_1 : in llvm.LLVMBuilderRef; + Fn : in llvm.LLVMValueRef; + Args : access llvm.LLVMValueRef; + NumArgs : in Interfaces.C.unsigned; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildSelect + (arg_1 : in llvm.LLVMBuilderRef; + the_If : in llvm.LLVMValueRef; + the_Then : in llvm.LLVMValueRef; + the_Else : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildVAArg + (arg_1 : in llvm.LLVMBuilderRef; + List : in llvm.LLVMValueRef; + Ty : in llvm.LLVMTypeRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildExtractElement + (arg_1 : in llvm.LLVMBuilderRef; + VecVal : in llvm.LLVMValueRef; + Index : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildInsertElement + (arg_1 : in llvm.LLVMBuilderRef; + VecVal : in llvm.LLVMValueRef; + EltVal : in llvm.LLVMValueRef; + Index : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildShuffleVector + (arg_1 : in llvm.LLVMBuilderRef; + V1 : in llvm.LLVMValueRef; + V2 : in llvm.LLVMValueRef; + Mask : in llvm.LLVMValueRef; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildExtractValue + (arg_1 : in llvm.LLVMBuilderRef; + AggVal : in llvm.LLVMValueRef; + Index : in Interfaces.C.unsigned; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMBuildInsertValue + (arg_1 : in llvm.LLVMBuilderRef; + AggVal : in llvm.LLVMValueRef; + EltVal : in llvm.LLVMValueRef; + Index : in Interfaces.C.unsigned; + Name : in Interfaces.C.Strings.chars_ptr) + return llvm.LLVMValueRef; + + function LLVMCreateModuleProviderForExistingModule + (M : in llvm.LLVMModuleRef) + return llvm.LLVMModuleProviderRef; + + procedure LLVMDisposeModuleProvider (MP : in llvm.LLVMModuleProviderRef); + + function LLVMCreateMemoryBufferWithContentsOfFile + (Path : in Interfaces.C.Strings.chars_ptr; + OutMemBuf : access llvm.LLVMMemoryBufferRef; + OutMessage : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + function LLVMCreateMemoryBufferWithSTDIN + (OutMemBuf : access llvm.LLVMMemoryBufferRef; + OutMessage : access Interfaces.C.Strings.chars_ptr) + return Interfaces.C.int; + + procedure LLVMDisposeMemoryBuffer (MemBuf : in llvm.LLVMMemoryBufferRef); + + function LLVMCreatePassManager return llvm.LLVMPassManagerRef; + + function LLVMCreateFunctionPassManager + (MP : in llvm.LLVMModuleProviderRef) + return llvm.LLVMPassManagerRef; + + function LLVMRunPassManager + (PM : in llvm.LLVMPassManagerRef; + M : in llvm.LLVMModuleRef) + return Interfaces.C.int; + + function LLVMInitializeFunctionPassManager + (FPM : in llvm.LLVMPassManagerRef) + return Interfaces.C.int; + + function LLVMRunFunctionPassManager + (FPM : in llvm.LLVMPassManagerRef; + F : in llvm.LLVMValueRef) + return Interfaces.C.int; + + function LLVMFinalizeFunctionPassManager + (FPM : in llvm.LLVMPassManagerRef) + return Interfaces.C.int; + + procedure LLVMDisposePassManager (PM : in llvm.LLVMPassManagerRef); + +private + + pragma Import (C, LLVMDisposeMessage, "Ada_LLVMDisposeMessage"); + pragma Import (C, LLVMContextCreate, "Ada_LLVMContextCreate"); + pragma Import (C, LLVMGetGlobalContext, "Ada_LLVMGetGlobalContext"); + pragma Import (C, LLVMContextDispose, "Ada_LLVMContextDispose"); + pragma Import + (C, + LLVMModuleCreateWithName, + "Ada_LLVMModuleCreateWithName"); + pragma Import + (C, + LLVMModuleCreateWithNameInContext, + "Ada_LLVMModuleCreateWithNameInContext"); + pragma Import (C, LLVMDisposeModule, "Ada_LLVMDisposeModule"); + pragma Import (C, LLVMGetDataLayout, "Ada_LLVMGetDataLayout"); + pragma Import (C, LLVMSetDataLayout, "Ada_LLVMSetDataLayout"); + pragma Import (C, LLVMGetTarget, "Ada_LLVMGetTarget"); + pragma Import (C, LLVMSetTarget, "Ada_LLVMSetTarget"); + pragma Import (C, LLVMAddTypeName, "Ada_LLVMAddTypeName"); + pragma Import (C, LLVMDeleteTypeName, "Ada_LLVMDeleteTypeName"); + pragma Import (C, LLVMGetTypeByName, "Ada_LLVMGetTypeByName"); + pragma Import (C, LLVMDumpModule, "Ada_LLVMDumpModule"); + pragma Import (C, LLVMGetTypeKind, "Ada_LLVMGetTypeKind"); + pragma Import (C, LLVMInt1Type, "Ada_LLVMInt1Type"); + pragma Import (C, LLVMInt8Type, "Ada_LLVMInt8Type"); + pragma Import (C, LLVMInt16Type, "Ada_LLVMInt16Type"); + pragma Import (C, LLVMInt32Type, "Ada_LLVMInt32Type"); + pragma Import (C, LLVMInt64Type, "Ada_LLVMInt64Type"); + pragma Import (C, LLVMIntType, "Ada_LLVMIntType"); + pragma Import (C, LLVMGetIntTypeWidth, "Ada_LLVMGetIntTypeWidth"); + pragma Import (C, LLVMFloatType, "Ada_LLVMFloatType"); + pragma Import (C, LLVMDoubleType, "Ada_LLVMDoubleType"); + pragma Import (C, LLVMX86FP80Type, "Ada_LLVMX86FP80Type"); + pragma Import (C, LLVMFP128Type, "Ada_LLVMFP128Type"); + pragma Import (C, LLVMPPCFP128Type, "Ada_LLVMPPCFP128Type"); + pragma Import (C, LLVMFunctionType, "Ada_LLVMFunctionType"); + pragma Import (C, LLVMIsFunctionVarArg, "Ada_LLVMIsFunctionVarArg"); + pragma Import (C, LLVMGetReturnType, "Ada_LLVMGetReturnType"); + pragma Import (C, LLVMCountParamTypes, "Ada_LLVMCountParamTypes"); + pragma Import (C, LLVMGetParamTypes, "Ada_LLVMGetParamTypes"); + pragma Import (C, LLVMStructType, "Ada_LLVMStructType"); + pragma Import + (C, + LLVMCountStructElementTypes, + "Ada_LLVMCountStructElementTypes"); + pragma Import + (C, + LLVMGetStructElementTypes, + "Ada_LLVMGetStructElementTypes"); + pragma Import (C, LLVMIsPackedStruct, "Ada_LLVMIsPackedStruct"); + pragma Import (C, LLVMArrayType, "Ada_LLVMArrayType"); + pragma Import (C, LLVMPointerType, "Ada_LLVMPointerType"); + pragma Import (C, LLVMVectorType, "Ada_LLVMVectorType"); + pragma Import (C, LLVMGetElementType, "Ada_LLVMGetElementType"); + pragma Import (C, LLVMGetArrayLength, "Ada_LLVMGetArrayLength"); + pragma Import + (C, + LLVMGetPointerAddressSpace, + "Ada_LLVMGetPointerAddressSpace"); + pragma Import (C, LLVMGetVectorSize, "Ada_LLVMGetVectorSize"); + pragma Import (C, LLVMVoidType, "Ada_LLVMVoidType"); + pragma Import (C, LLVMLabelType, "Ada_LLVMLabelType"); + pragma Import (C, LLVMOpaqueType, "Ada_LLVMOpaqueType"); + pragma Import (C, LLVMCreateTypeHandle, "Ada_LLVMCreateTypeHandle"); + pragma Import (C, LLVMRefineType, "Ada_LLVMRefineType"); + pragma Import (C, LLVMResolveTypeHandle, "Ada_LLVMResolveTypeHandle"); + pragma Import (C, LLVMDisposeTypeHandle, "Ada_LLVMDisposeTypeHandle"); + pragma Import (C, LLVMTypeOf, "Ada_LLVMTypeOf"); + pragma Import (C, LLVMGetValueName, "Ada_LLVMGetValueName"); + pragma Import (C, LLVMSetValueName, "Ada_LLVMSetValueName"); + pragma Import (C, LLVMDumpValue, "Ada_LLVMDumpValue"); + pragma Import (C, LLVMIsAArgument, "Ada_LLVMIsAArgument"); + pragma Import (C, LLVMIsABasicBlock, "Ada_LLVMIsABasicBlock"); + pragma Import (C, LLVMIsAInlineAsm, "Ada_LLVMIsAInlineAsm"); + pragma Import (C, LLVMIsAUser, "Ada_LLVMIsAUser"); + pragma Import (C, LLVMIsAConstant, "Ada_LLVMIsAConstant"); + pragma Import + (C, + LLVMIsAConstantAggregateZero, + "Ada_LLVMIsAConstantAggregateZero"); + pragma Import (C, LLVMIsAConstantArray, "Ada_LLVMIsAConstantArray"); + pragma Import (C, LLVMIsAConstantExpr, "Ada_LLVMIsAConstantExpr"); + pragma Import (C, LLVMIsAConstantFP, "Ada_LLVMIsAConstantFP"); + pragma Import (C, LLVMIsAConstantInt, "Ada_LLVMIsAConstantInt"); + pragma Import + (C, + LLVMIsAConstantPointerNull, + "Ada_LLVMIsAConstantPointerNull"); + pragma Import (C, LLVMIsAConstantStruct, "Ada_LLVMIsAConstantStruct"); + pragma Import (C, LLVMIsAConstantVector, "Ada_LLVMIsAConstantVector"); + pragma Import (C, LLVMIsAGlobalValue, "Ada_LLVMIsAGlobalValue"); + pragma Import (C, LLVMIsAFunction, "Ada_LLVMIsAFunction"); + pragma Import (C, LLVMIsAGlobalAlias, "Ada_LLVMIsAGlobalAlias"); + pragma Import (C, LLVMIsAGlobalVariable, "Ada_LLVMIsAGlobalVariable"); + pragma Import (C, LLVMIsAUndefValue, "Ada_LLVMIsAUndefValue"); + pragma Import (C, LLVMIsAInstruction, "Ada_LLVMIsAInstruction"); + pragma Import (C, LLVMIsABinaryOperator, "Ada_LLVMIsABinaryOperator"); + pragma Import (C, LLVMIsACallInst, "Ada_LLVMIsACallInst"); + pragma Import (C, LLVMIsAIntrinsicInst, "Ada_LLVMIsAIntrinsicInst"); + pragma Import (C, LLVMIsADbgInfoIntrinsic, "Ada_LLVMIsADbgInfoIntrinsic"); + pragma Import (C, LLVMIsADbgDeclareInst, "Ada_LLVMIsADbgDeclareInst"); + pragma Import (C, LLVMIsADbgFuncStartInst, "Ada_LLVMIsADbgFuncStartInst"); + pragma Import (C, LLVMIsADbgRegionEndInst, "Ada_LLVMIsADbgRegionEndInst"); + pragma Import + (C, + LLVMIsADbgRegionStartInst, + "Ada_LLVMIsADbgRegionStartInst"); + pragma Import (C, LLVMIsADbgStopPointInst, "Ada_LLVMIsADbgStopPointInst"); + pragma Import (C, LLVMIsAEHSelectorInst, "Ada_LLVMIsAEHSelectorInst"); + pragma Import (C, LLVMIsAMemIntrinsic, "Ada_LLVMIsAMemIntrinsic"); + pragma Import (C, LLVMIsAMemCpyInst, "Ada_LLVMIsAMemCpyInst"); + pragma Import (C, LLVMIsAMemMoveInst, "Ada_LLVMIsAMemMoveInst"); + pragma Import (C, LLVMIsAMemSetInst, "Ada_LLVMIsAMemSetInst"); + pragma Import (C, LLVMIsACmpInst, "Ada_LLVMIsACmpInst"); + pragma Import (C, LLVMIsAFCmpInst, "Ada_LLVMIsAFCmpInst"); + pragma Import (C, LLVMIsAICmpInst, "Ada_LLVMIsAICmpInst"); + pragma Import + (C, + LLVMIsAExtractElementInst, + "Ada_LLVMIsAExtractElementInst"); + pragma Import + (C, + LLVMIsAGetElementPtrInst, + "Ada_LLVMIsAGetElementPtrInst"); + pragma Import + (C, + LLVMIsAInsertElementInst, + "Ada_LLVMIsAInsertElementInst"); + pragma Import (C, LLVMIsAInsertValueInst, "Ada_LLVMIsAInsertValueInst"); + pragma Import (C, LLVMIsAPHINode, "Ada_LLVMIsAPHINode"); + pragma Import (C, LLVMIsASelectInst, "Ada_LLVMIsASelectInst"); + pragma Import + (C, + LLVMIsAShuffleVectorInst, + "Ada_LLVMIsAShuffleVectorInst"); + pragma Import (C, LLVMIsAStoreInst, "Ada_LLVMIsAStoreInst"); + pragma Import (C, LLVMIsATerminatorInst, "Ada_LLVMIsATerminatorInst"); + pragma Import (C, LLVMIsABranchInst, "Ada_LLVMIsABranchInst"); + pragma Import (C, LLVMIsAInvokeInst, "Ada_LLVMIsAInvokeInst"); + pragma Import (C, LLVMIsAReturnInst, "Ada_LLVMIsAReturnInst"); + pragma Import (C, LLVMIsASwitchInst, "Ada_LLVMIsASwitchInst"); + pragma Import (C, LLVMIsAUnreachableInst, "Ada_LLVMIsAUnreachableInst"); + pragma Import (C, LLVMIsAUnwindInst, "Ada_LLVMIsAUnwindInst"); + pragma Import (C, LLVMIsAUnaryInstruction, "Ada_LLVMIsAUnaryInstruction"); + pragma Import (C, LLVMIsAAllocationInst, "Ada_LLVMIsAAllocationInst"); + pragma Import (C, LLVMIsAAllocaInst, "Ada_LLVMIsAAllocaInst"); + pragma Import (C, LLVMIsAMallocInst, "Ada_LLVMIsAMallocInst"); + pragma Import (C, LLVMIsACastInst, "Ada_LLVMIsACastInst"); + pragma Import (C, LLVMIsABitCastInst, "Ada_LLVMIsABitCastInst"); + pragma Import (C, LLVMIsAFPExtInst, "Ada_LLVMIsAFPExtInst"); + pragma Import (C, LLVMIsAFPToSIInst, "Ada_LLVMIsAFPToSIInst"); + pragma Import (C, LLVMIsAFPToUIInst, "Ada_LLVMIsAFPToUIInst"); + pragma Import (C, LLVMIsAFPTruncInst, "Ada_LLVMIsAFPTruncInst"); + pragma Import (C, LLVMIsAIntToPtrInst, "Ada_LLVMIsAIntToPtrInst"); + pragma Import (C, LLVMIsAPtrToIntInst, "Ada_LLVMIsAPtrToIntInst"); + pragma Import (C, LLVMIsASExtInst, "Ada_LLVMIsASExtInst"); + pragma Import (C, LLVMIsASIToFPInst, "Ada_LLVMIsASIToFPInst"); + pragma Import (C, LLVMIsATruncInst, "Ada_LLVMIsATruncInst"); + pragma Import (C, LLVMIsAUIToFPInst, "Ada_LLVMIsAUIToFPInst"); + pragma Import (C, LLVMIsAZExtInst, "Ada_LLVMIsAZExtInst"); + pragma Import (C, LLVMIsAExtractValueInst, "Ada_LLVMIsAExtractValueInst"); + pragma Import (C, LLVMIsAFreeInst, "Ada_LLVMIsAFreeInst"); + pragma Import (C, LLVMIsALoadInst, "Ada_LLVMIsALoadInst"); + pragma Import (C, LLVMIsAVAArgInst, "Ada_LLVMIsAVAArgInst"); + pragma Import (C, LLVMConstNull, "Ada_LLVMConstNull"); + pragma Import (C, LLVMConstAllOnes, "Ada_LLVMConstAllOnes"); + pragma Import (C, LLVMGetUndef, "Ada_LLVMGetUndef"); + pragma Import (C, LLVMIsConstant, "Ada_LLVMIsConstant"); + pragma Import (C, LLVMIsNull, "Ada_LLVMIsNull"); + pragma Import (C, LLVMIsUndef, "Ada_LLVMIsUndef"); + pragma Import (C, LLVMConstPointerNull, "Ada_LLVMConstPointerNull"); + pragma Import (C, LLVMConstInt, "Ada_LLVMConstInt"); + pragma Import (C, LLVMConstReal, "Ada_LLVMConstReal"); + pragma Import (C, LLVMConstRealOfString, "Ada_LLVMConstRealOfString"); + pragma Import (C, LLVMConstString, "Ada_LLVMConstString"); + pragma Import (C, LLVMConstArray, "Ada_LLVMConstArray"); + pragma Import (C, LLVMConstStruct, "Ada_LLVMConstStruct"); + pragma Import (C, LLVMConstVector, "Ada_LLVMConstVector"); + pragma Import (C, LLVMSizeOf, "Ada_LLVMSizeOf"); + pragma Import (C, LLVMConstNeg, "Ada_LLVMConstNeg"); + pragma Import (C, LLVMConstNot, "Ada_LLVMConstNot"); + pragma Import (C, LLVMConstAdd, "Ada_LLVMConstAdd"); + pragma Import (C, LLVMConstSub, "Ada_LLVMConstSub"); + pragma Import (C, LLVMConstMul, "Ada_LLVMConstMul"); + pragma Import (C, LLVMConstUDiv, "Ada_LLVMConstUDiv"); + pragma Import (C, LLVMConstSDiv, "Ada_LLVMConstSDiv"); + pragma Import (C, LLVMConstFDiv, "Ada_LLVMConstFDiv"); + pragma Import (C, LLVMConstURem, "Ada_LLVMConstURem"); + pragma Import (C, LLVMConstSRem, "Ada_LLVMConstSRem"); + pragma Import (C, LLVMConstFRem, "Ada_LLVMConstFRem"); + pragma Import (C, LLVMConstAnd, "Ada_LLVMConstAnd"); + pragma Import (C, LLVMConstOr, "Ada_LLVMConstOr"); + pragma Import (C, LLVMConstXor, "Ada_LLVMConstXor"); + pragma Import (C, LLVMConstICmp, "Ada_LLVMConstICmp"); + pragma Import (C, LLVMConstFCmp, "Ada_LLVMConstFCmp"); + pragma Import (C, LLVMConstShl, "Ada_LLVMConstShl"); + pragma Import (C, LLVMConstLShr, "Ada_LLVMConstLShr"); + pragma Import (C, LLVMConstAShr, "Ada_LLVMConstAShr"); + pragma Import (C, LLVMConstGEP, "Ada_LLVMConstGEP"); + pragma Import (C, LLVMConstTrunc, "Ada_LLVMConstTrunc"); + pragma Import (C, LLVMConstSExt, "Ada_LLVMConstSExt"); + pragma Import (C, LLVMConstZExt, "Ada_LLVMConstZExt"); + pragma Import (C, LLVMConstFPTrunc, "Ada_LLVMConstFPTrunc"); + pragma Import (C, LLVMConstFPExt, "Ada_LLVMConstFPExt"); + pragma Import (C, LLVMConstUIToFP, "Ada_LLVMConstUIToFP"); + pragma Import (C, LLVMConstSIToFP, "Ada_LLVMConstSIToFP"); + pragma Import (C, LLVMConstFPToUI, "Ada_LLVMConstFPToUI"); + pragma Import (C, LLVMConstFPToSI, "Ada_LLVMConstFPToSI"); + pragma Import (C, LLVMConstPtrToInt, "Ada_LLVMConstPtrToInt"); + pragma Import (C, LLVMConstIntToPtr, "Ada_LLVMConstIntToPtr"); + pragma Import (C, LLVMConstBitCast, "Ada_LLVMConstBitCast"); + pragma Import (C, LLVMConstSelect, "Ada_LLVMConstSelect"); + pragma Import (C, LLVMConstExtractElement, "Ada_LLVMConstExtractElement"); + pragma Import (C, LLVMConstInsertElement, "Ada_LLVMConstInsertElement"); + pragma Import (C, LLVMConstShuffleVector, "Ada_LLVMConstShuffleVector"); + pragma Import (C, LLVMConstExtractValue, "Ada_LLVMConstExtractValue"); + pragma Import (C, LLVMConstInsertValue, "Ada_LLVMConstInsertValue"); + pragma Import (C, LLVMConstInlineAsm, "Ada_LLVMConstInlineAsm"); + pragma Import (C, LLVMGetGlobalParent, "Ada_LLVMGetGlobalParent"); + pragma Import (C, LLVMIsDeclaration, "Ada_LLVMIsDeclaration"); + pragma Import (C, LLVMGetLinkage, "Ada_LLVMGetLinkage"); + pragma Import (C, LLVMSetLinkage, "Ada_LLVMSetLinkage"); + pragma Import (C, LLVMGetSection, "Ada_LLVMGetSection"); + pragma Import (C, LLVMSetSection, "Ada_LLVMSetSection"); + pragma Import (C, LLVMGetVisibility, "Ada_LLVMGetVisibility"); + pragma Import (C, LLVMSetVisibility, "Ada_LLVMSetVisibility"); + pragma Import (C, LLVMGetAlignment, "Ada_LLVMGetAlignment"); + pragma Import (C, LLVMSetAlignment, "Ada_LLVMSetAlignment"); + pragma Import (C, LLVMAddGlobal, "Ada_LLVMAddGlobal"); + pragma Import (C, LLVMGetNamedGlobal, "Ada_LLVMGetNamedGlobal"); + pragma Import (C, LLVMGetFirstGlobal, "Ada_LLVMGetFirstGlobal"); + pragma Import (C, LLVMGetLastGlobal, "Ada_LLVMGetLastGlobal"); + pragma Import (C, LLVMGetNextGlobal, "Ada_LLVMGetNextGlobal"); + pragma Import (C, LLVMGetPreviousGlobal, "Ada_LLVMGetPreviousGlobal"); + pragma Import (C, LLVMDeleteGlobal, "Ada_LLVMDeleteGlobal"); + pragma Import (C, LLVMGetInitializer, "Ada_LLVMGetInitializer"); + pragma Import (C, LLVMSetInitializer, "Ada_LLVMSetInitializer"); + pragma Import (C, LLVMIsThreadLocal, "Ada_LLVMIsThreadLocal"); + pragma Import (C, LLVMSetThreadLocal, "Ada_LLVMSetThreadLocal"); + pragma Import (C, LLVMIsGlobalConstant, "Ada_LLVMIsGlobalConstant"); + pragma Import (C, LLVMSetGlobalConstant, "Ada_LLVMSetGlobalConstant"); + pragma Import (C, LLVMAddAlias, "Ada_LLVMAddAlias"); + pragma Import (C, LLVMAddFunction, "Ada_LLVMAddFunction"); + pragma Import (C, LLVMGetNamedFunction, "Ada_LLVMGetNamedFunction"); + pragma Import (C, LLVMGetFirstFunction, "Ada_LLVMGetFirstFunction"); + pragma Import (C, LLVMGetLastFunction, "Ada_LLVMGetLastFunction"); + pragma Import (C, LLVMGetNextFunction, "Ada_LLVMGetNextFunction"); + pragma Import (C, LLVMGetPreviousFunction, "Ada_LLVMGetPreviousFunction"); + pragma Import (C, LLVMDeleteFunction, "Ada_LLVMDeleteFunction"); + pragma Import (C, LLVMGetIntrinsicID, "Ada_LLVMGetIntrinsicID"); + pragma Import (C, LLVMGetFunctionCallConv, "Ada_LLVMGetFunctionCallConv"); + pragma Import (C, LLVMSetFunctionCallConv, "Ada_LLVMSetFunctionCallConv"); + pragma Import (C, LLVMGetGC, "Ada_LLVMGetGC"); + pragma Import (C, LLVMSetGC, "Ada_LLVMSetGC"); + pragma Import (C, LLVMAddFunctionAttr, "Ada_LLVMAddFunctionAttr"); + pragma Import (C, LLVMRemoveFunctionAttr, "Ada_LLVMRemoveFunctionAttr"); + pragma Import (C, LLVMCountParams, "Ada_LLVMCountParams"); + pragma Import (C, LLVMGetParams, "Ada_LLVMGetParams"); + pragma Import (C, LLVMGetParam, "Ada_LLVMGetParam"); + pragma Import (C, LLVMGetParamParent, "Ada_LLVMGetParamParent"); + pragma Import (C, LLVMGetFirstParam, "Ada_LLVMGetFirstParam"); + pragma Import (C, LLVMGetLastParam, "Ada_LLVMGetLastParam"); + pragma Import (C, LLVMGetNextParam, "Ada_LLVMGetNextParam"); + pragma Import (C, LLVMGetPreviousParam, "Ada_LLVMGetPreviousParam"); + pragma Import (C, LLVMAddAttribute, "Ada_LLVMAddAttribute"); + pragma Import (C, LLVMRemoveAttribute, "Ada_LLVMRemoveAttribute"); + pragma Import (C, LLVMSetParamAlignment, "Ada_LLVMSetParamAlignment"); + pragma Import (C, LLVMBasicBlockAsValue, "Ada_LLVMBasicBlockAsValue"); + pragma Import (C, LLVMValueIsBasicBlock, "Ada_LLVMValueIsBasicBlock"); + pragma Import (C, LLVMValueAsBasicBlock, "Ada_LLVMValueAsBasicBlock"); + pragma Import (C, LLVMGetBasicBlockParent, "Ada_LLVMGetBasicBlockParent"); + pragma Import (C, LLVMCountBasicBlocks, "Ada_LLVMCountBasicBlocks"); + pragma Import (C, LLVMGetBasicBlocks, "Ada_LLVMGetBasicBlocks"); + pragma Import (C, LLVMGetFirstBasicBlock, "Ada_LLVMGetFirstBasicBlock"); + pragma Import (C, LLVMGetLastBasicBlock, "Ada_LLVMGetLastBasicBlock"); + pragma Import (C, LLVMGetNextBasicBlock, "Ada_LLVMGetNextBasicBlock"); + pragma Import + (C, + LLVMGetPreviousBasicBlock, + "Ada_LLVMGetPreviousBasicBlock"); + pragma Import (C, LLVMGetEntryBasicBlock, "Ada_LLVMGetEntryBasicBlock"); + pragma Import (C, LLVMAppendBasicBlock, "Ada_LLVMAppendBasicBlock"); + pragma Import (C, LLVMInsertBasicBlock, "Ada_LLVMInsertBasicBlock"); + pragma Import (C, LLVMDeleteBasicBlock, "Ada_LLVMDeleteBasicBlock"); + pragma Import + (C, + LLVMGetInstructionParent, + "Ada_LLVMGetInstructionParent"); + pragma Import (C, LLVMGetFirstInstruction, "Ada_LLVMGetFirstInstruction"); + pragma Import (C, LLVMGetLastInstruction, "Ada_LLVMGetLastInstruction"); + pragma Import (C, LLVMGetNextInstruction, "Ada_LLVMGetNextInstruction"); + pragma Import + (C, + LLVMGetPreviousInstruction, + "Ada_LLVMGetPreviousInstruction"); + pragma Import + (C, + LLVMSetInstructionCallConv, + "Ada_LLVMSetInstructionCallConv"); + pragma Import + (C, + LLVMGetInstructionCallConv, + "Ada_LLVMGetInstructionCallConv"); + pragma Import (C, LLVMAddInstrAttribute, "Ada_LLVMAddInstrAttribute"); + pragma Import + (C, + LLVMRemoveInstrAttribute, + "Ada_LLVMRemoveInstrAttribute"); + pragma Import + (C, + LLVMSetInstrParamAlignment, + "Ada_LLVMSetInstrParamAlignment"); + pragma Import (C, LLVMIsTailCall, "Ada_LLVMIsTailCall"); + pragma Import (C, LLVMSetTailCall, "Ada_LLVMSetTailCall"); + pragma Import (C, LLVMAddIncoming, "Ada_LLVMAddIncoming"); + pragma Import (C, LLVMCountIncoming, "Ada_LLVMCountIncoming"); + pragma Import (C, LLVMGetIncomingValue, "Ada_LLVMGetIncomingValue"); + pragma Import (C, LLVMGetIncomingBlock, "Ada_LLVMGetIncomingBlock"); + pragma Import (C, LLVMCreateBuilder, "Ada_LLVMCreateBuilder"); + pragma Import (C, LLVMPositionBuilder, "Ada_LLVMPositionBuilder"); + pragma Import + (C, + LLVMPositionBuilderBefore, + "Ada_LLVMPositionBuilderBefore"); + pragma Import + (C, + LLVMPositionBuilderAtEnd, + "Ada_LLVMPositionBuilderAtEnd"); + pragma Import (C, LLVMGetInsertBlock, "Ada_LLVMGetInsertBlock"); + pragma Import + (C, + LLVMClearInsertionPosition, + "Ada_LLVMClearInsertionPosition"); + pragma Import (C, LLVMInsertIntoBuilder, "Ada_LLVMInsertIntoBuilder"); + pragma Import (C, LLVMDisposeBuilder, "Ada_LLVMDisposeBuilder"); + pragma Import (C, LLVMBuildRetVoid, "Ada_LLVMBuildRetVoid"); + pragma Import (C, LLVMBuildRet, "Ada_LLVMBuildRet"); + pragma Import (C, LLVMBuildBr, "Ada_LLVMBuildBr"); + pragma Import (C, LLVMBuildCondBr, "Ada_LLVMBuildCondBr"); + pragma Import (C, LLVMBuildSwitch, "Ada_LLVMBuildSwitch"); + pragma Import (C, LLVMBuildInvoke, "Ada_LLVMBuildInvoke"); + pragma Import (C, LLVMBuildUnwind, "Ada_LLVMBuildUnwind"); + pragma Import (C, LLVMBuildUnreachable, "Ada_LLVMBuildUnreachable"); + pragma Import (C, LLVMAddCase, "Ada_LLVMAddCase"); + pragma Import (C, LLVMBuildAdd, "Ada_LLVMBuildAdd"); + pragma Import (C, LLVMBuildSub, "Ada_LLVMBuildSub"); + pragma Import (C, LLVMBuildMul, "Ada_LLVMBuildMul"); + pragma Import (C, LLVMBuildUDiv, "Ada_LLVMBuildUDiv"); + pragma Import (C, LLVMBuildSDiv, "Ada_LLVMBuildSDiv"); + pragma Import (C, LLVMBuildFDiv, "Ada_LLVMBuildFDiv"); + pragma Import (C, LLVMBuildURem, "Ada_LLVMBuildURem"); + pragma Import (C, LLVMBuildSRem, "Ada_LLVMBuildSRem"); + pragma Import (C, LLVMBuildFRem, "Ada_LLVMBuildFRem"); + pragma Import (C, LLVMBuildShl, "Ada_LLVMBuildShl"); + pragma Import (C, LLVMBuildLShr, "Ada_LLVMBuildLShr"); + pragma Import (C, LLVMBuildAShr, "Ada_LLVMBuildAShr"); + pragma Import (C, LLVMBuildAnd, "Ada_LLVMBuildAnd"); + pragma Import (C, LLVMBuildOr, "Ada_LLVMBuildOr"); + pragma Import (C, LLVMBuildXor, "Ada_LLVMBuildXor"); + pragma Import (C, LLVMBuildNeg, "Ada_LLVMBuildNeg"); + pragma Import (C, LLVMBuildNot, "Ada_LLVMBuildNot"); + pragma Import (C, LLVMBuildMalloc, "Ada_LLVMBuildMalloc"); + pragma Import (C, LLVMBuildArrayMalloc, "Ada_LLVMBuildArrayMalloc"); + pragma Import (C, LLVMBuildAlloca, "Ada_LLVMBuildAlloca"); + pragma Import (C, LLVMBuildArrayAlloca, "Ada_LLVMBuildArrayAlloca"); + pragma Import (C, LLVMBuildFree, "Ada_LLVMBuildFree"); + pragma Import (C, LLVMBuildLoad, "Ada_LLVMBuildLoad"); + pragma Import (C, LLVMBuildStore, "Ada_LLVMBuildStore"); + pragma Import (C, LLVMBuildGEP, "Ada_LLVMBuildGEP"); + pragma Import (C, LLVMBuildTrunc, "Ada_LLVMBuildTrunc"); + pragma Import (C, LLVMBuildZExt, "Ada_LLVMBuildZExt"); + pragma Import (C, LLVMBuildSExt, "Ada_LLVMBuildSExt"); + pragma Import (C, LLVMBuildFPToUI, "Ada_LLVMBuildFPToUI"); + pragma Import (C, LLVMBuildFPToSI, "Ada_LLVMBuildFPToSI"); + pragma Import (C, LLVMBuildUIToFP, "Ada_LLVMBuildUIToFP"); + pragma Import (C, LLVMBuildSIToFP, "Ada_LLVMBuildSIToFP"); + pragma Import (C, LLVMBuildFPTrunc, "Ada_LLVMBuildFPTrunc"); + pragma Import (C, LLVMBuildFPExt, "Ada_LLVMBuildFPExt"); + pragma Import (C, LLVMBuildPtrToInt, "Ada_LLVMBuildPtrToInt"); + pragma Import (C, LLVMBuildIntToPtr, "Ada_LLVMBuildIntToPtr"); + pragma Import (C, LLVMBuildBitCast, "Ada_LLVMBuildBitCast"); + pragma Import (C, LLVMBuildICmp, "Ada_LLVMBuildICmp"); + pragma Import (C, LLVMBuildFCmp, "Ada_LLVMBuildFCmp"); + pragma Import (C, LLVMBuildPhi, "Ada_LLVMBuildPhi"); + pragma Import (C, LLVMBuildCall, "Ada_LLVMBuildCall"); + pragma Import (C, LLVMBuildSelect, "Ada_LLVMBuildSelect"); + pragma Import (C, LLVMBuildVAArg, "Ada_LLVMBuildVAArg"); + pragma Import (C, LLVMBuildExtractElement, "Ada_LLVMBuildExtractElement"); + pragma Import (C, LLVMBuildInsertElement, "Ada_LLVMBuildInsertElement"); + pragma Import (C, LLVMBuildShuffleVector, "Ada_LLVMBuildShuffleVector"); + pragma Import (C, LLVMBuildExtractValue, "Ada_LLVMBuildExtractValue"); + pragma Import (C, LLVMBuildInsertValue, "Ada_LLVMBuildInsertValue"); + pragma Import + (C, + LLVMCreateModuleProviderForExistingModule, + "Ada_LLVMCreateModuleProviderForExistingModule"); + pragma Import + (C, + LLVMDisposeModuleProvider, + "Ada_LLVMDisposeModuleProvider"); + pragma Import + (C, + LLVMCreateMemoryBufferWithContentsOfFile, + "Ada_LLVMCreateMemoryBufferWithContentsOfFile"); + pragma Import + (C, + LLVMCreateMemoryBufferWithSTDIN, + "Ada_LLVMCreateMemoryBufferWithSTDIN"); + pragma Import (C, LLVMDisposeMemoryBuffer, "Ada_LLVMDisposeMemoryBuffer"); + pragma Import (C, LLVMCreatePassManager, "Ada_LLVMCreatePassManager"); + pragma Import + (C, + LLVMCreateFunctionPassManager, + "Ada_LLVMCreateFunctionPassManager"); + pragma Import (C, LLVMRunPassManager, "Ada_LLVMRunPassManager"); + pragma Import + (C, + LLVMInitializeFunctionPassManager, + "Ada_LLVMInitializeFunctionPassManager"); + pragma Import + (C, + LLVMRunFunctionPassManager, + "Ada_LLVMRunFunctionPassManager"); + pragma Import + (C, + LLVMFinalizeFunctionPassManager, + "Ada_LLVMFinalizeFunctionPassManager"); + pragma Import (C, LLVMDisposePassManager, "Ada_LLVMDisposePassManager"); + +end llvm.Binding; Added: llvm/trunk/bindings/ada/llvm/llvm.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/llvm/llvm.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/llvm/llvm.ads (added) +++ llvm/trunk/bindings/ada/llvm/llvm.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,493 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with Interfaces.C.Extensions; + + +package llvm is + + -- LLVMCtxt + -- + type LLVMCtxt is new Interfaces.C.Extensions.opaque_structure_def; + + type LLVMCtxt_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMCtxt; + + type LLVMCtxt_view is access all llvm.LLVMCtxt; + + -- LLVMContextRef + -- + type LLVMContextRef is access all llvm.LLVMCtxt; + + type LLVMContextRef_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMContextRef; + + type LLVMContextRef_view is access all llvm.LLVMContextRef; + + -- LLVMOpaqueModule + -- + type LLVMOpaqueModule is new Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueModule_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMOpaqueModule; + + type LLVMOpaqueModule_view is access all llvm.LLVMOpaqueModule; + + -- LLVMModuleRef + -- + type LLVMModuleRef is access all llvm.LLVMOpaqueModule; + + type LLVMModuleRef_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMModuleRef; + + type LLVMModuleRef_view is access all llvm.LLVMModuleRef; + + -- LLVMOpaqueType + -- + type LLVMOpaqueType is new Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueType_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMOpaqueType; + + type LLVMOpaqueType_view is access all llvm.LLVMOpaqueType; + + -- LLVMTypeRef + -- + type LLVMTypeRef is access all llvm.LLVMOpaqueType; + + type LLVMTypeRef_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMTypeRef; + + type LLVMTypeRef_view is access all llvm.LLVMTypeRef; + + -- LLVMOpaqueTypeHandle + -- + type LLVMOpaqueTypeHandle is new + Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueTypeHandle_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMOpaqueTypeHandle; + + type LLVMOpaqueTypeHandle_view is access all llvm.LLVMOpaqueTypeHandle; + + -- LLVMTypeHandleRef + -- + type LLVMTypeHandleRef is access all llvm.LLVMOpaqueTypeHandle; + + type LLVMTypeHandleRef_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMTypeHandleRef; + + type LLVMTypeHandleRef_view is access all llvm.LLVMTypeHandleRef; + + -- LLVMOpaqueValue + -- + type LLVMOpaqueValue is new Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueValue_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMOpaqueValue; + + type LLVMOpaqueValue_view is access all llvm.LLVMOpaqueValue; + + -- LLVMValueRef + -- + type LLVMValueRef is access all llvm.LLVMOpaqueValue; + + type LLVMValueRef_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMValueRef; + + type LLVMValueRef_view is access all llvm.LLVMValueRef; + + -- LLVMOpaqueBasicBlock + -- + type LLVMOpaqueBasicBlock is new + Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueBasicBlock_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMOpaqueBasicBlock; + + type LLVMOpaqueBasicBlock_view is access all llvm.LLVMOpaqueBasicBlock; + + -- LLVMBasicBlockRef + -- + type LLVMBasicBlockRef is access all llvm.LLVMOpaqueBasicBlock; + + type LLVMBasicBlockRef_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMBasicBlockRef; + + type LLVMBasicBlockRef_view is access all llvm.LLVMBasicBlockRef; + + -- LLVMOpaqueBuilder + -- + type LLVMOpaqueBuilder is new Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueBuilder_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMOpaqueBuilder; + + type LLVMOpaqueBuilder_view is access all llvm.LLVMOpaqueBuilder; + + -- LLVMBuilderRef + -- + type LLVMBuilderRef is access all llvm.LLVMOpaqueBuilder; + + type LLVMBuilderRef_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMBuilderRef; + + type LLVMBuilderRef_view is access all llvm.LLVMBuilderRef; + + -- LLVMOpaqueModuleProvider + -- + type LLVMOpaqueModuleProvider is new + Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueModuleProvider_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMOpaqueModuleProvider; + + type LLVMOpaqueModuleProvider_view is access all + llvm.LLVMOpaqueModuleProvider; + + -- LLVMModuleProviderRef + -- + type LLVMModuleProviderRef is access all llvm.LLVMOpaqueModuleProvider; + + type LLVMModuleProviderRef_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMModuleProviderRef; + + type LLVMModuleProviderRef_view is access all llvm.LLVMModuleProviderRef; + + -- LLVMOpaqueMemoryBuffer + -- + type LLVMOpaqueMemoryBuffer is new + Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueMemoryBuffer_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMOpaqueMemoryBuffer; + + type LLVMOpaqueMemoryBuffer_view is access all llvm.LLVMOpaqueMemoryBuffer; + + -- LLVMMemoryBufferRef + -- + type LLVMMemoryBufferRef is access all llvm.LLVMOpaqueMemoryBuffer; + + type LLVMMemoryBufferRef_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMMemoryBufferRef; + + type LLVMMemoryBufferRef_view is access all llvm.LLVMMemoryBufferRef; + + -- LLVMOpaquePassManager + -- + type LLVMOpaquePassManager is new + Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaquePassManager_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMOpaquePassManager; + + type LLVMOpaquePassManager_view is access all llvm.LLVMOpaquePassManager; + + -- LLVMPassManagerRef + -- + type LLVMPassManagerRef is access all llvm.LLVMOpaquePassManager; + + type LLVMPassManagerRef_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMPassManagerRef; + + type LLVMPassManagerRef_view is access all llvm.LLVMPassManagerRef; + + -- LLVMAttribute + -- + type LLVMAttribute is ( + LLVMZExtAttribute, + LLVMSExtAttribute, + LLVMNoReturnAttribute, + LLVMInRegAttribute, + LLVMStructRetAttribute, + LLVMNoUnwindAttribute, + LLVMNoAliasAttribute, + LLVMByValAttribute, + LLVMNestAttribute, + LLVMReadNoneAttribute, + LLVMReadOnlyAttribute, + LLVMNoInlineAttribute, + LLVMAlwaysInlineAttribute, + LLVMOptimizeForSizeAttribute, + LLVMStackProtectAttribute, + LLVMStackProtectReqAttribute, + LLVMNoCaptureAttribute, + LLVMNoRedZoneAttribute, + LLVMNoImplicitFloatAttribute, + LLVMNakedAttribute); + + for LLVMAttribute use + (LLVMZExtAttribute => 1, + LLVMSExtAttribute => 2, + LLVMNoReturnAttribute => 4, + LLVMInRegAttribute => 8, + LLVMStructRetAttribute => 16, + LLVMNoUnwindAttribute => 32, + LLVMNoAliasAttribute => 64, + LLVMByValAttribute => 128, + LLVMNestAttribute => 256, + LLVMReadNoneAttribute => 512, + LLVMReadOnlyAttribute => 1024, + LLVMNoInlineAttribute => 2048, + LLVMAlwaysInlineAttribute => 4096, + LLVMOptimizeForSizeAttribute => 8192, + LLVMStackProtectAttribute => 16384, + LLVMStackProtectReqAttribute => 32768, + LLVMNoCaptureAttribute => 2097152, + LLVMNoRedZoneAttribute => 4194304, + LLVMNoImplicitFloatAttribute => 8388608, + LLVMNakedAttribute => 16777216); + + pragma Convention (C, LLVMAttribute); + + type LLVMAttribute_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMAttribute; + + type LLVMAttribute_view is access all llvm.LLVMAttribute; + + -- LLVMTypeKind + -- + type LLVMTypeKind is ( + LLVMVoidTypeKind, + LLVMFloatTypeKind, + LLVMDoubleTypeKind, + LLVMX86_FP80TypeKind, + LLVMFP128TypeKind, + LLVMPPC_FP128TypeKind, + LLVMLabelTypeKind, + LLVMIntegerTypeKind, + LLVMFunctionTypeKind, + LLVMStructTypeKind, + LLVMArrayTypeKind, + LLVMPointerTypeKind, + LLVMOpaqueTypeKind, + LLVMVectorTypeKind, + LLVMMetadataTypeKind); + + for LLVMTypeKind use + (LLVMVoidTypeKind => 0, + LLVMFloatTypeKind => 1, + LLVMDoubleTypeKind => 2, + LLVMX86_FP80TypeKind => 3, + LLVMFP128TypeKind => 4, + LLVMPPC_FP128TypeKind => 5, + LLVMLabelTypeKind => 6, + LLVMIntegerTypeKind => 7, + LLVMFunctionTypeKind => 8, + LLVMStructTypeKind => 9, + LLVMArrayTypeKind => 10, + LLVMPointerTypeKind => 11, + LLVMOpaqueTypeKind => 12, + LLVMVectorTypeKind => 13, + LLVMMetadataTypeKind => 14); + + pragma Convention (C, LLVMTypeKind); + + type LLVMTypeKind_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMTypeKind; + + type LLVMTypeKind_view is access all llvm.LLVMTypeKind; + + -- LLVMLinkage + -- + type LLVMLinkage is ( + LLVMExternalLinkage, + LLVMAvailableExternallyLinkage, + LLVMLinkOnceAnyLinkage, + LLVMLinkOnceODRLinkage, + LLVMWeakAnyLinkage, + LLVMWeakODRLinkage, + LLVMAppendingLinkage, + LLVMInternalLinkage, + LLVMPrivateLinkage, + LLVMDLLImportLinkage, + LLVMDLLExportLinkage, + LLVMExternalWeakLinkage, + LLVMGhostLinkage, + LLVMCommonLinkage, + LLVMLinkerPrivateLinkage); + + for LLVMLinkage use + (LLVMExternalLinkage => 0, + LLVMAvailableExternallyLinkage => 1, + LLVMLinkOnceAnyLinkage => 2, + LLVMLinkOnceODRLinkage => 3, + LLVMWeakAnyLinkage => 4, + LLVMWeakODRLinkage => 5, + LLVMAppendingLinkage => 6, + LLVMInternalLinkage => 7, + LLVMPrivateLinkage => 8, + LLVMDLLImportLinkage => 9, + LLVMDLLExportLinkage => 10, + LLVMExternalWeakLinkage => 11, + LLVMGhostLinkage => 12, + LLVMCommonLinkage => 13, + LLVMLinkerPrivateLinkage => 14); + + pragma Convention (C, LLVMLinkage); + + type LLVMLinkage_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMLinkage; + + type LLVMLinkage_view is access all llvm.LLVMLinkage; + + -- LLVMVisibility + -- + type LLVMVisibility is ( + LLVMDefaultVisibility, + LLVMHiddenVisibility, + LLVMProtectedVisibility); + + for LLVMVisibility use + (LLVMDefaultVisibility => 0, + LLVMHiddenVisibility => 1, + LLVMProtectedVisibility => 2); + + pragma Convention (C, LLVMVisibility); + + type LLVMVisibility_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMVisibility; + + type LLVMVisibility_view is access all llvm.LLVMVisibility; + + -- LLVMCallConv + -- + type LLVMCallConv is ( + LLVMCCallConv, + LLVMFastCallConv, + LLVMColdCallConv, + LLVMX86StdcallCallConv, + LLVMX86FastcallCallConv); + + for LLVMCallConv use + (LLVMCCallConv => 0, + LLVMFastCallConv => 8, + LLVMColdCallConv => 9, + LLVMX86StdcallCallConv => 64, + LLVMX86FastcallCallConv => 65); + + pragma Convention (C, LLVMCallConv); + + type LLVMCallConv_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMCallConv; + + type LLVMCallConv_view is access all llvm.LLVMCallConv; + + -- LLVMIntPredicate + -- + type LLVMIntPredicate is ( + LLVMIntEQ, + LLVMIntNE, + LLVMIntUGT, + LLVMIntUGE, + LLVMIntULT, + LLVMIntULE, + LLVMIntSGT, + LLVMIntSGE, + LLVMIntSLT, + LLVMIntSLE); + + for LLVMIntPredicate use + (LLVMIntEQ => 32, + LLVMIntNE => 33, + LLVMIntUGT => 34, + LLVMIntUGE => 35, + LLVMIntULT => 36, + LLVMIntULE => 37, + LLVMIntSGT => 38, + LLVMIntSGE => 39, + LLVMIntSLT => 40, + LLVMIntSLE => 41); + + pragma Convention (C, LLVMIntPredicate); + + type LLVMIntPredicate_array is + array (Interfaces.C.size_t range <>) of aliased llvm.LLVMIntPredicate; + + type LLVMIntPredicate_view is access all llvm.LLVMIntPredicate; + + -- LLVMRealPredicate + -- + type LLVMRealPredicate is ( + LLVMRealPredicateFalse, + LLVMRealOEQ, + LLVMRealOGT, + LLVMRealOGE, + LLVMRealOLT, + LLVMRealOLE, + LLVMRealONE, + LLVMRealORD, + LLVMRealUNO, + LLVMRealUEQ, + LLVMRealUGT, + LLVMRealUGE, + LLVMRealULT, + LLVMRealULE, + LLVMRealUNE, + LLVMRealPredicateTrue); + + for LLVMRealPredicate use + (LLVMRealPredicateFalse => 0, + LLVMRealOEQ => 1, + LLVMRealOGT => 2, + LLVMRealOGE => 3, + LLVMRealOLT => 4, + LLVMRealOLE => 5, + LLVMRealONE => 6, + LLVMRealORD => 7, + LLVMRealUNO => 8, + LLVMRealUEQ => 9, + LLVMRealUGT => 10, + LLVMRealUGE => 11, + LLVMRealULT => 12, + LLVMRealULE => 13, + LLVMRealUNE => 14, + LLVMRealPredicateTrue => 15); + + pragma Convention (C, LLVMRealPredicate); + + type LLVMRealPredicate_array is + array (Interfaces.C.size_t range <>) + of aliased llvm.LLVMRealPredicate; + + type LLVMRealPredicate_view is access all llvm.LLVMRealPredicate; + + -- ModuleProvider + -- + type ModuleProvider is new Interfaces.C.Extensions.incomplete_class_def; + + type ModuleProvider_array is + array (Interfaces.C.size_t range <>) of aliased llvm.ModuleProvider; + + type ModuleProvider_view is access all llvm.ModuleProvider; + + -- MemoryBuffer + -- + type MemoryBuffer is new Interfaces.C.Extensions.incomplete_class_def; + + type MemoryBuffer_array is + array (Interfaces.C.size_t range <>) of aliased llvm.MemoryBuffer; + + type MemoryBuffer_view is access all llvm.MemoryBuffer; + + -- PassManagerBase + -- + type PassManagerBase is new Interfaces.C.Extensions.incomplete_class_def; + + type PassManagerBase_array is + array (Interfaces.C.size_t range <>) of aliased llvm.PassManagerBase; + + type PassManagerBase_view is access all llvm.PassManagerBase; + +end llvm; Added: llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer-binding.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer-binding.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer-binding.ads (added) +++ llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer-binding.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,207 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with Interfaces.C.Strings; + + +package LLVM_link_time_Optimizer.Binding is + + LTO_H : constant := 1; + LTO_API_VERSION : constant := 3; + + function lto_get_version return Interfaces.C.Strings.chars_ptr; + + function lto_get_error_message return Interfaces.C.Strings.chars_ptr; + + function lto_module_is_object_file + (path : in Interfaces.C.Strings.chars_ptr) + return Interfaces.C.Extensions.bool; + + function lto_module_is_object_file_for_target + (path : in Interfaces.C.Strings.chars_ptr; + target_triple_prefix : in Interfaces.C.Strings.chars_ptr) + return Interfaces.C.Extensions.bool; + + function lto_module_is_object_file_in_memory + (mem : access Interfaces.C.Extensions.void; + length : in Interfaces.C.size_t) + return Interfaces.C.Extensions.bool; + + function lto_module_is_object_file_in_memory_for_target + (mem : access Interfaces.C.Extensions.void; + length : in Interfaces.C.size_t; + target_triple_prefix : in Interfaces.C.Strings.chars_ptr) + return Interfaces.C.Extensions.bool; + + function lto_module_create + (path : in Interfaces.C.Strings.chars_ptr) + return LLVM_link_time_Optimizer.lto_module_t; + + function lto_module_create_from_memory + (mem : access Interfaces.C.Extensions.void; + length : in Interfaces.C.size_t) + return LLVM_link_time_Optimizer.lto_module_t; + + procedure lto_module_dispose + (the_mod : in LLVM_link_time_Optimizer.lto_module_t); + + function lto_module_get_target_triple + (the_mod : in LLVM_link_time_Optimizer.lto_module_t) + return Interfaces.C.Strings.chars_ptr; + + function lto_module_get_num_symbols + (the_mod : in LLVM_link_time_Optimizer.lto_module_t) + return Interfaces.C.unsigned; + + function lto_module_get_symbol_name + (the_mod : in LLVM_link_time_Optimizer.lto_module_t; + index : in Interfaces.C.unsigned) + return Interfaces.C.Strings.chars_ptr; + + function lto_module_get_symbol_attribute + (the_mod : in LLVM_link_time_Optimizer.lto_module_t; + index : in Interfaces.C.unsigned) + return LLVM_link_time_Optimizer.lto_symbol_attributes; + + function lto_codegen_create return LLVM_link_time_Optimizer.lto_code_gen_t; + + procedure lto_codegen_dispose + (arg_1 : in LLVM_link_time_Optimizer.lto_code_gen_t); + + function lto_codegen_add_module + (cg : in LLVM_link_time_Optimizer.lto_code_gen_t; + the_mod : in LLVM_link_time_Optimizer.lto_module_t) + return Interfaces.C.Extensions.bool; + + function lto_codegen_set_debug_model + (cg : in LLVM_link_time_Optimizer.lto_code_gen_t; + arg_1 : in LLVM_link_time_Optimizer.lto_debug_model) + return Interfaces.C.Extensions.bool; + + function lto_codegen_set_pic_model + (cg : in LLVM_link_time_Optimizer.lto_code_gen_t; + arg_1 : in LLVM_link_time_Optimizer.lto_codegen_model) + return Interfaces.C.Extensions.bool; + + procedure lto_codegen_set_gcc_path + (cg : in LLVM_link_time_Optimizer.lto_code_gen_t; + path : in Interfaces.C.Strings.chars_ptr); + + procedure lto_codegen_set_assembler_path + (cg : in LLVM_link_time_Optimizer.lto_code_gen_t; + path : in Interfaces.C.Strings.chars_ptr); + + procedure lto_codegen_add_must_preserve_symbol + (cg : in LLVM_link_time_Optimizer.lto_code_gen_t; + symbol : in Interfaces.C.Strings.chars_ptr); + + function lto_codegen_write_merged_modules + (cg : in LLVM_link_time_Optimizer.lto_code_gen_t; + path : in Interfaces.C.Strings.chars_ptr) + return Interfaces.C.Extensions.bool; + + function lto_codegen_compile + (cg : in LLVM_link_time_Optimizer.lto_code_gen_t; + length : access Interfaces.C.size_t) + return access Interfaces.C.Extensions.void; + + procedure lto_codegen_debug_options + (cg : in LLVM_link_time_Optimizer.lto_code_gen_t; + arg_1 : in Interfaces.C.Strings.chars_ptr); + + function llvm_create_optimizer return + LLVM_link_time_Optimizer.llvm_lto_t; + + procedure llvm_destroy_optimizer + (lto : in LLVM_link_time_Optimizer.llvm_lto_t); + + function llvm_read_object_file + (lto : in LLVM_link_time_Optimizer.llvm_lto_t; + input_filename : in Interfaces.C.Strings.chars_ptr) + return LLVM_link_time_Optimizer.llvm_lto_status_t; + + function llvm_optimize_modules + (lto : in LLVM_link_time_Optimizer.llvm_lto_t; + output_filename : in Interfaces.C.Strings.chars_ptr) + return LLVM_link_time_Optimizer.llvm_lto_status_t; + +private + + pragma Import (C, lto_get_version, "Ada_lto_get_version"); + pragma Import (C, lto_get_error_message, "Ada_lto_get_error_message"); + pragma Import + (C, + lto_module_is_object_file, + "Ada_lto_module_is_object_file"); + pragma Import + (C, + lto_module_is_object_file_for_target, + "Ada_lto_module_is_object_file_for_target"); + pragma Import + (C, + lto_module_is_object_file_in_memory, + "Ada_lto_module_is_object_file_in_memory"); + pragma Import + (C, + lto_module_is_object_file_in_memory_for_target, + "Ada_lto_module_is_object_file_in_memory_for_target"); + pragma Import (C, lto_module_create, "Ada_lto_module_create"); + pragma Import + (C, + lto_module_create_from_memory, + "Ada_lto_module_create_from_memory"); + pragma Import (C, lto_module_dispose, "Ada_lto_module_dispose"); + pragma Import + (C, + lto_module_get_target_triple, + "Ada_lto_module_get_target_triple"); + pragma Import + (C, + lto_module_get_num_symbols, + "Ada_lto_module_get_num_symbols"); + pragma Import + (C, + lto_module_get_symbol_name, + "Ada_lto_module_get_symbol_name"); + pragma Import + (C, + lto_module_get_symbol_attribute, + "Ada_lto_module_get_symbol_attribute"); + pragma Import (C, lto_codegen_create, "Ada_lto_codegen_create"); + pragma Import (C, lto_codegen_dispose, "Ada_lto_codegen_dispose"); + pragma Import (C, lto_codegen_add_module, "Ada_lto_codegen_add_module"); + pragma Import + (C, + lto_codegen_set_debug_model, + "Ada_lto_codegen_set_debug_model"); + pragma Import + (C, + lto_codegen_set_pic_model, + "Ada_lto_codegen_set_pic_model"); + pragma Import + (C, + lto_codegen_set_gcc_path, + "Ada_lto_codegen_set_gcc_path"); + pragma Import + (C, + lto_codegen_set_assembler_path, + "Ada_lto_codegen_set_assembler_path"); + pragma Import + (C, + lto_codegen_add_must_preserve_symbol, + "Ada_lto_codegen_add_must_preserve_symbol"); + pragma Import + (C, + lto_codegen_write_merged_modules, + "Ada_lto_codegen_write_merged_modules"); + pragma Import (C, lto_codegen_compile, "Ada_lto_codegen_compile"); + pragma Import + (C, + lto_codegen_debug_options, + "Ada_lto_codegen_debug_options"); + pragma Import (C, llvm_create_optimizer, "Ada_llvm_create_optimizer"); + pragma Import (C, llvm_destroy_optimizer, "Ada_llvm_destroy_optimizer"); + pragma Import (C, llvm_read_object_file, "Ada_llvm_read_object_file"); + pragma Import (C, llvm_optimize_modules, "Ada_llvm_optimize_modules"); + +end LLVM_link_time_Optimizer.Binding; Added: llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer.ads (added) +++ llvm/trunk/bindings/ada/llvm/llvm_link_time_optimizer.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,184 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with Interfaces.C.Extensions; + + +package LLVM_link_time_Optimizer is + + -- lto_symbol_attributes + -- + type lto_symbol_attributes is ( + LTO_SYMBOL_ALIGNMENT_MASK, + LTO_SYMBOL_PERMISSIONS_RODATA, + LTO_SYMBOL_PERMISSIONS_CODE, + LTO_SYMBOL_PERMISSIONS_DATA, + LTO_SYMBOL_PERMISSIONS_MASK, + LTO_SYMBOL_DEFINITION_REGULAR, + LTO_SYMBOL_DEFINITION_TENTATIVE, + LTO_SYMBOL_DEFINITION_WEAK, + LTO_SYMBOL_DEFINITION_UNDEFINED, + LTO_SYMBOL_DEFINITION_WEAKUNDEF, + LTO_SYMBOL_DEFINITION_MASK, + LTO_SYMBOL_SCOPE_INTERNAL, + LTO_SYMBOL_SCOPE_HIDDEN, + LTO_SYMBOL_SCOPE_DEFAULT, + LTO_SYMBOL_SCOPE_PROTECTED, + LTO_SYMBOL_SCOPE_MASK); + + for lto_symbol_attributes use + (LTO_SYMBOL_ALIGNMENT_MASK => 31, + LTO_SYMBOL_PERMISSIONS_RODATA => 128, + LTO_SYMBOL_PERMISSIONS_CODE => 160, + LTO_SYMBOL_PERMISSIONS_DATA => 192, + LTO_SYMBOL_PERMISSIONS_MASK => 224, + LTO_SYMBOL_DEFINITION_REGULAR => 256, + LTO_SYMBOL_DEFINITION_TENTATIVE => 512, + LTO_SYMBOL_DEFINITION_WEAK => 768, + LTO_SYMBOL_DEFINITION_UNDEFINED => 1024, + LTO_SYMBOL_DEFINITION_WEAKUNDEF => 1280, + LTO_SYMBOL_DEFINITION_MASK => 1792, + LTO_SYMBOL_SCOPE_INTERNAL => 2048, + LTO_SYMBOL_SCOPE_HIDDEN => 4096, + LTO_SYMBOL_SCOPE_DEFAULT => 6144, + LTO_SYMBOL_SCOPE_PROTECTED => 8192, + LTO_SYMBOL_SCOPE_MASK => 14336); + + pragma Convention (C, lto_symbol_attributes); + + type lto_symbol_attributes_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_link_time_Optimizer.lto_symbol_attributes; + + type lto_symbol_attributes_view is access all + LLVM_link_time_Optimizer.lto_symbol_attributes; + + -- lto_debug_model + -- + type lto_debug_model is (LTO_DEBUG_MODEL_NONE, LTO_DEBUG_MODEL_DWARF); + + for lto_debug_model use + (LTO_DEBUG_MODEL_NONE => 0, + LTO_DEBUG_MODEL_DWARF => 1); + + pragma Convention (C, lto_debug_model); + + type lto_debug_model_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_link_time_Optimizer.lto_debug_model; + + type lto_debug_model_view is access all + LLVM_link_time_Optimizer.lto_debug_model; + + -- lto_codegen_model + -- + type lto_codegen_model is ( + LTO_CODEGEN_PIC_MODEL_STATIC, + LTO_CODEGEN_PIC_MODEL_DYNAMIC, + LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC); + + for lto_codegen_model use + (LTO_CODEGEN_PIC_MODEL_STATIC => 0, + LTO_CODEGEN_PIC_MODEL_DYNAMIC => 1, + LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC => 2); + + pragma Convention (C, lto_codegen_model); + + type lto_codegen_model_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_link_time_Optimizer.lto_codegen_model; + + type lto_codegen_model_view is access all + LLVM_link_time_Optimizer.lto_codegen_model; + + -- LTOModule + -- + type LTOModule is new Interfaces.C.Extensions.opaque_structure_def; + + type LTOModule_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_link_time_Optimizer.LTOModule; + + type LTOModule_view is access all LLVM_link_time_Optimizer.LTOModule; + + -- lto_module_t + -- + type lto_module_t is access all LLVM_link_time_Optimizer.LTOModule; + + type lto_module_t_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_link_time_Optimizer.lto_module_t; + + type lto_module_t_view is access all LLVM_link_time_Optimizer.lto_module_t; + + -- LTOCodeGenerator + -- + type LTOCodeGenerator is new Interfaces.C.Extensions.opaque_structure_def; + + type LTOCodeGenerator_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_link_time_Optimizer.LTOCodeGenerator; + + type LTOCodeGenerator_view is access all + LLVM_link_time_Optimizer.LTOCodeGenerator; + + -- lto_code_gen_t + -- + type lto_code_gen_t is access all LLVM_link_time_Optimizer.LTOCodeGenerator; + + type lto_code_gen_t_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_link_time_Optimizer.lto_code_gen_t; + + type lto_code_gen_t_view is access all + LLVM_link_time_Optimizer.lto_code_gen_t; + + -- llvm_lto_status_t + -- + type llvm_lto_status_t is ( + LLVM_LTO_UNKNOWN, + LLVM_LTO_OPT_SUCCESS, + LLVM_LTO_READ_SUCCESS, + LLVM_LTO_READ_FAILURE, + LLVM_LTO_WRITE_FAILURE, + LLVM_LTO_NO_TARGET, + LLVM_LTO_NO_WORK, + LLVM_LTO_MODULE_MERGE_FAILURE, + LLVM_LTO_ASM_FAILURE, + LLVM_LTO_NULL_OBJECT); + + for llvm_lto_status_t use + (LLVM_LTO_UNKNOWN => 0, + LLVM_LTO_OPT_SUCCESS => 1, + LLVM_LTO_READ_SUCCESS => 2, + LLVM_LTO_READ_FAILURE => 3, + LLVM_LTO_WRITE_FAILURE => 4, + LLVM_LTO_NO_TARGET => 5, + LLVM_LTO_NO_WORK => 6, + LLVM_LTO_MODULE_MERGE_FAILURE => 7, + LLVM_LTO_ASM_FAILURE => 8, + LLVM_LTO_NULL_OBJECT => 9); + + pragma Convention (C, llvm_lto_status_t); + + type llvm_lto_status_t_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_link_time_Optimizer.llvm_lto_status_t; + + type llvm_lto_status_t_view is access all + LLVM_link_time_Optimizer.llvm_lto_status_t; + + + -- llvm_lto_t + -- + type llvm_lto_t is access all Interfaces.C.Extensions.void; + + type llvm_lto_t_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_link_time_Optimizer.llvm_lto_t; + + type llvm_lto_t_view is access all + LLVM_link_time_Optimizer.llvm_lto_t; + + +end LLVM_link_time_Optimizer; Added: llvm/trunk/bindings/ada/llvm/llvm_linktimeoptimizer_wrap.cxx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/llvm/llvm_linktimeoptimizer_wrap.cxx?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/llvm/llvm_linktimeoptimizer_wrap.cxx (added) +++ llvm/trunk/bindings/ada/llvm/llvm_linktimeoptimizer_wrap.cxx Mon Aug 17 19:24:36 2009 @@ -0,0 +1,923 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.36 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#include +#include +#include +#if defined(_WIN32) || defined(__CYGWIN32__) +# define DllExport __declspec( dllexport ) +# define SWIGSTDCALL __stdcall +#else +# define DllExport +# define SWIGSTDCALL +#endif + + +#ifdef __cplusplus +# include +#endif + + + + +/* Support for throwing Ada exceptions from C/C++ */ + +typedef enum +{ + SWIG_AdaException, + SWIG_AdaOutOfMemoryException, + SWIG_AdaIndexOutOfRangeException, + SWIG_AdaDivideByZeroException, + SWIG_AdaArgumentOutOfRangeException, + SWIG_AdaNullReferenceException +} SWIG_AdaExceptionCodes; + + +typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *); + + +typedef struct +{ + SWIG_AdaExceptionCodes code; + SWIG_AdaExceptionCallback_t callback; +} + SWIG_AdaExceptions_t; + + +static +SWIG_AdaExceptions_t +SWIG_ada_exceptions[] = +{ + { SWIG_AdaException, NULL }, + { SWIG_AdaOutOfMemoryException, NULL }, + { SWIG_AdaIndexOutOfRangeException, NULL }, + { SWIG_AdaDivideByZeroException, NULL }, + { SWIG_AdaArgumentOutOfRangeException, NULL }, + { SWIG_AdaNullReferenceException, NULL } +}; + + +static +void +SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg) +{ + SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback; + if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) { + callback = SWIG_ada_exceptions[code].callback; + } + callback(msg); +} + + + +#ifdef __cplusplus +extern "C" +#endif + +DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_link_time_Optimizer (SWIG_AdaExceptionCallback_t systemException, + SWIG_AdaExceptionCallback_t outOfMemory, + SWIG_AdaExceptionCallback_t indexOutOfRange, + SWIG_AdaExceptionCallback_t divideByZero, + SWIG_AdaExceptionCallback_t argumentOutOfRange, + SWIG_AdaExceptionCallback_t nullReference) +{ + SWIG_ada_exceptions [SWIG_AdaException].callback = systemException; + SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory; + SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange; + SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero; + SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange; + SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference; +} + + +/* Callback for returning strings to Ada without leaking memory */ + +typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *); +static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL; + + + +/* probably obsolete ... +#ifdef __cplusplus +extern "C" +#endif +DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_link_time_Optimizer(SWIG_AdaStringHelperCallback callback) { + SWIG_ada_string_callback = callback; +} +*/ + + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else + + +#define protected public +#define private public + +#include "llvm-c/lto.h" +#include "llvm-c/LinkTimeOptimizer.h" + + + +// struct LLVMCtxt; + + +#undef protected +#undef private +#ifdef __cplusplus +extern "C" { +#endif +DllExport char * SWIGSTDCALL Ada_lto_get_version ( + ) +{ + char * jresult ; + char *result = 0 ; + + result = (char *)lto_get_version(); + jresult = result; + + + + return jresult; + +} + + + +DllExport char * SWIGSTDCALL Ada_lto_get_error_message ( + ) +{ + char * jresult ; + char *result = 0 ; + + result = (char *)lto_get_error_message(); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_lto_module_is_object_file ( + char * jarg1 + ) +{ + unsigned int jresult ; + char *arg1 = (char *) 0 ; + bool result; + + arg1 = jarg1; + + result = (bool)lto_module_is_object_file((char const *)arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_lto_module_is_object_file_for_target ( + char * jarg1 + , + + char * jarg2 + ) +{ + unsigned int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + bool result; + + arg1 = jarg1; + + arg2 = jarg2; + + result = (bool)lto_module_is_object_file_for_target((char const *)arg1,(char const *)arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_lto_module_is_object_file_in_memory ( + void* jarg1 + , + + size_t jarg2 + ) +{ + unsigned int jresult ; + void *arg1 = (void *) 0 ; + size_t arg2 ; + bool result; + + arg1 = (void *)jarg1; + + + arg2 = (size_t) jarg2; + + + result = (bool)lto_module_is_object_file_in_memory((void const *)arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_lto_module_is_object_file_in_memory_for_target ( + void* jarg1 + , + + size_t jarg2 + , + + char * jarg3 + ) +{ + unsigned int jresult ; + void *arg1 = (void *) 0 ; + size_t arg2 ; + char *arg3 = (char *) 0 ; + bool result; + + arg1 = (void *)jarg1; + + + arg2 = (size_t) jarg2; + + + arg3 = jarg3; + + result = (bool)lto_module_is_object_file_in_memory_for_target((void const *)arg1,arg2,(char const *)arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_lto_module_create ( + char * jarg1 + ) +{ + void * jresult ; + char *arg1 = (char *) 0 ; + lto_module_t result; + + arg1 = jarg1; + + result = (lto_module_t)lto_module_create((char const *)arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_lto_module_create_from_memory ( + void* jarg1 + , + + size_t jarg2 + ) +{ + void * jresult ; + void *arg1 = (void *) 0 ; + size_t arg2 ; + lto_module_t result; + + arg1 = (void *)jarg1; + + + arg2 = (size_t) jarg2; + + + result = (lto_module_t)lto_module_create_from_memory((void const *)arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_lto_module_dispose ( + void * jarg1 + ) +{ + lto_module_t arg1 = (lto_module_t) 0 ; + + arg1 = (lto_module_t)jarg1; + + lto_module_dispose(arg1); + + +} + + + +DllExport char * SWIGSTDCALL Ada_lto_module_get_target_triple ( + void * jarg1 + ) +{ + char * jresult ; + lto_module_t arg1 = (lto_module_t) 0 ; + char *result = 0 ; + + arg1 = (lto_module_t)jarg1; + + result = (char *)lto_module_get_target_triple(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_lto_module_get_num_symbols ( + void * jarg1 + ) +{ + unsigned int jresult ; + lto_module_t arg1 = (lto_module_t) 0 ; + unsigned int result; + + arg1 = (lto_module_t)jarg1; + + result = (unsigned int)lto_module_get_num_symbols(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport char * SWIGSTDCALL Ada_lto_module_get_symbol_name ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + char * jresult ; + lto_module_t arg1 = (lto_module_t) 0 ; + unsigned int arg2 ; + char *result = 0 ; + + arg1 = (lto_module_t)jarg1; + + + arg2 = (unsigned int) jarg2; + + + result = (char *)lto_module_get_symbol_name(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_lto_module_get_symbol_attribute ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + int jresult ; + lto_module_t arg1 = (lto_module_t) 0 ; + unsigned int arg2 ; + lto_symbol_attributes result; + + arg1 = (lto_module_t)jarg1; + + + arg2 = (unsigned int) jarg2; + + + result = (lto_symbol_attributes)lto_module_get_symbol_attribute(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_lto_codegen_create ( + ) +{ + void * jresult ; + lto_code_gen_t result; + + result = (lto_code_gen_t)lto_codegen_create(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_lto_codegen_dispose ( + void * jarg1 + ) +{ + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + + arg1 = (lto_code_gen_t)jarg1; + + lto_codegen_dispose(arg1); + + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_lto_codegen_add_module ( + void * jarg1 + , + + void * jarg2 + ) +{ + unsigned int jresult ; + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + lto_module_t arg2 = (lto_module_t) 0 ; + bool result; + + arg1 = (lto_code_gen_t)jarg1; + + arg2 = (lto_module_t)jarg2; + + result = (bool)lto_codegen_add_module(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_lto_codegen_set_debug_model ( + void * jarg1 + , + + int jarg2 + ) +{ + unsigned int jresult ; + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + lto_debug_model arg2 ; + bool result; + + arg1 = (lto_code_gen_t)jarg1; + + arg2 = (lto_debug_model) jarg2; + + result = (bool)lto_codegen_set_debug_model(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_lto_codegen_set_pic_model ( + void * jarg1 + , + + int jarg2 + ) +{ + unsigned int jresult ; + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + lto_codegen_model arg2 ; + bool result; + + arg1 = (lto_code_gen_t)jarg1; + + arg2 = (lto_codegen_model) jarg2; + + result = (bool)lto_codegen_set_pic_model(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_lto_codegen_set_gcc_path ( + void * jarg1 + , + + char * jarg2 + ) +{ + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (lto_code_gen_t)jarg1; + + arg2 = jarg2; + + lto_codegen_set_gcc_path(arg1,(char const *)arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_lto_codegen_set_assembler_path ( + void * jarg1 + , + + char * jarg2 + ) +{ + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (lto_code_gen_t)jarg1; + + arg2 = jarg2; + + lto_codegen_set_assembler_path(arg1,(char const *)arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_lto_codegen_add_must_preserve_symbol ( + void * jarg1 + , + + char * jarg2 + ) +{ + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (lto_code_gen_t)jarg1; + + arg2 = jarg2; + + lto_codegen_add_must_preserve_symbol(arg1,(char const *)arg2); + + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_lto_codegen_write_merged_modules ( + void * jarg1 + , + + char * jarg2 + ) +{ + unsigned int jresult ; + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + char *arg2 = (char *) 0 ; + bool result; + + arg1 = (lto_code_gen_t)jarg1; + + arg2 = jarg2; + + result = (bool)lto_codegen_write_merged_modules(arg1,(char const *)arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport void* SWIGSTDCALL Ada_lto_codegen_compile ( + void * jarg1 + , + + size_t* jarg2 + ) +{ + void* jresult ; + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + size_t *arg2 = (size_t *) 0 ; + void *result = 0 ; + + arg1 = (lto_code_gen_t)jarg1; + + + arg2 = (size_t *) jarg2; + + + result = (void *)lto_codegen_compile(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_lto_codegen_debug_options ( + void * jarg1 + , + + char * jarg2 + ) +{ + lto_code_gen_t arg1 = (lto_code_gen_t) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (lto_code_gen_t)jarg1; + + arg2 = jarg2; + + lto_codegen_debug_options(arg1,(char const *)arg2); + + +} + + + +DllExport void* SWIGSTDCALL Ada_llvm_create_optimizer ( + ) +{ + void* jresult ; + llvm_lto_t result; + + result = (llvm_lto_t)llvm_create_optimizer(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_llvm_destroy_optimizer ( + void* jarg1 + ) +{ + llvm_lto_t arg1 = (llvm_lto_t) 0 ; + + arg1 = (llvm_lto_t)jarg1; + + llvm_destroy_optimizer(arg1); + + +} + + + +DllExport int SWIGSTDCALL Ada_llvm_read_object_file ( + void* jarg1 + , + + char * jarg2 + ) +{ + int jresult ; + llvm_lto_t arg1 = (llvm_lto_t) 0 ; + char *arg2 = (char *) 0 ; + llvm_lto_status_t result; + + arg1 = (llvm_lto_t)jarg1; + + arg2 = jarg2; + + result = (llvm_lto_status_t)llvm_read_object_file(arg1,(char const *)arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_llvm_optimize_modules ( + void* jarg1 + , + + char * jarg2 + ) +{ + int jresult ; + llvm_lto_t arg1 = (llvm_lto_t) 0 ; + char *arg2 = (char *) 0 ; + llvm_lto_status_t result; + + arg1 = (llvm_lto_t)jarg1; + + arg2 = jarg2; + + result = (llvm_lto_status_t)llvm_optimize_modules(arg1,(char const *)arg2); + jresult = result; + + + + return jresult; + +} + + + +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif + Added: llvm/trunk/bindings/ada/llvm/llvm_wrap.cxx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/llvm/llvm_wrap.cxx?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/llvm/llvm_wrap.cxx (added) +++ llvm/trunk/bindings/ada/llvm/llvm_wrap.cxx Mon Aug 17 19:24:36 2009 @@ -0,0 +1,8817 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.36 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#include +#include +#include +#if defined(_WIN32) || defined(__CYGWIN32__) +# define DllExport __declspec( dllexport ) +# define SWIGSTDCALL __stdcall +#else +# define DllExport +# define SWIGSTDCALL +#endif + + +#ifdef __cplusplus +# include +#endif + + + + +/* Support for throwing Ada exceptions from C/C++ */ + +typedef enum +{ + SWIG_AdaException, + SWIG_AdaOutOfMemoryException, + SWIG_AdaIndexOutOfRangeException, + SWIG_AdaDivideByZeroException, + SWIG_AdaArgumentOutOfRangeException, + SWIG_AdaNullReferenceException +} SWIG_AdaExceptionCodes; + + +typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *); + + +typedef struct +{ + SWIG_AdaExceptionCodes code; + SWIG_AdaExceptionCallback_t callback; +} + SWIG_AdaExceptions_t; + + +static +SWIG_AdaExceptions_t +SWIG_ada_exceptions[] = +{ + { SWIG_AdaException, NULL }, + { SWIG_AdaOutOfMemoryException, NULL }, + { SWIG_AdaIndexOutOfRangeException, NULL }, + { SWIG_AdaDivideByZeroException, NULL }, + { SWIG_AdaArgumentOutOfRangeException, NULL }, + { SWIG_AdaNullReferenceException, NULL } +}; + + +static +void +SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg) +{ + SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback; + if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) { + callback = SWIG_ada_exceptions[code].callback; + } + callback(msg); +} + + + +#ifdef __cplusplus +extern "C" +#endif + +DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_llvm (SWIG_AdaExceptionCallback_t systemException, + SWIG_AdaExceptionCallback_t outOfMemory, + SWIG_AdaExceptionCallback_t indexOutOfRange, + SWIG_AdaExceptionCallback_t divideByZero, + SWIG_AdaExceptionCallback_t argumentOutOfRange, + SWIG_AdaExceptionCallback_t nullReference) +{ + SWIG_ada_exceptions [SWIG_AdaException].callback = systemException; + SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory; + SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange; + SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero; + SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange; + SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference; +} + + +/* Callback for returning strings to Ada without leaking memory */ + +typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *); +static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL; + + + +/* probably obsolete ... +#ifdef __cplusplus +extern "C" +#endif +DllExport void SWIGSTDCALL SWIGRegisterStringCallback_llvm(SWIG_AdaStringHelperCallback callback) { + SWIG_ada_string_callback = callback; +} +*/ + + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else + + +#define protected public +#define private public + +//#include "llvm-c/Analysis.h" +//#include "llvm-c/BitReader.h" +//#include "llvm-c/BitWriter.h" +#include "llvm-c/Core.h" +//#include "llvm-c/ExecutionEngine.h" +//#include "llvm-c/LinkTimeOptimizer.h" +//#include "llvm-c/lto.h" +//#include "llvm-c/Target.h" + + + + struct LLVMCtxt; +// struct LLVMOpaqueType; +// struct LLVMOpaqueValue; + +#undef protected +#undef private +#ifdef __cplusplus +extern "C" { +#endif +DllExport void SWIGSTDCALL Ada_LLVMDisposeMessage ( + char * jarg1 + ) +{ + char *arg1 = (char *) 0 ; + + arg1 = jarg1; + + LLVMDisposeMessage(arg1); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMContextCreate ( + ) +{ + void * jresult ; + LLVMContextRef result; + + result = (LLVMContextRef)LLVMContextCreate(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetGlobalContext ( + ) +{ + void * jresult ; + LLVMContextRef result; + + result = (LLVMContextRef)LLVMGetGlobalContext(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMContextDispose ( + void * jarg1 + ) +{ + LLVMContextRef arg1 = (LLVMContextRef) 0 ; + + arg1 = (LLVMContextRef)jarg1; + + LLVMContextDispose(arg1); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMModuleCreateWithName ( + char * jarg1 + ) +{ + void * jresult ; + char *arg1 = (char *) 0 ; + LLVMModuleRef result; + + arg1 = jarg1; + + result = (LLVMModuleRef)LLVMModuleCreateWithName((char const *)arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMModuleCreateWithNameInContext ( + char * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + char *arg1 = (char *) 0 ; + LLVMContextRef arg2 = (LLVMContextRef) 0 ; + LLVMModuleRef result; + + arg1 = jarg1; + + arg2 = (LLVMContextRef)jarg2; + + result = (LLVMModuleRef)LLVMModuleCreateWithNameInContext((char const *)arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDisposeModule ( + void * jarg1 + ) +{ + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + + arg1 = (LLVMModuleRef)jarg1; + + LLVMDisposeModule(arg1); + + +} + + + +DllExport char * SWIGSTDCALL Ada_LLVMGetDataLayout ( + void * jarg1 + ) +{ + char * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *result = 0 ; + + arg1 = (LLVMModuleRef)jarg1; + + result = (char *)LLVMGetDataLayout(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetDataLayout ( + void * jarg1 + , + + char * jarg2 + ) +{ + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = jarg2; + + LLVMSetDataLayout(arg1,(char const *)arg2); + + +} + + + +DllExport char * SWIGSTDCALL Ada_LLVMGetTarget ( + void * jarg1 + ) +{ + char * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *result = 0 ; + + arg1 = (LLVMModuleRef)jarg1; + + result = (char *)LLVMGetTarget(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetTarget ( + void * jarg1 + , + + char * jarg2 + ) +{ + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = jarg2; + + LLVMSetTarget(arg1,(char const *)arg2); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMAddTypeName ( + void * jarg1 + , + + char * jarg2 + , + + void * jarg3 + ) +{ + int jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *arg2 = (char *) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + int result; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + result = (int)LLVMAddTypeName(arg1,(char const *)arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDeleteTypeName ( + void * jarg1 + , + + char * jarg2 + ) +{ + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = jarg2; + + LLVMDeleteTypeName(arg1,(char const *)arg2); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetTypeByName ( + void * jarg1 + , + + char * jarg2 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *arg2 = (char *) 0 ; + LLVMTypeRef result; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = jarg2; + + result = (LLVMTypeRef)LLVMGetTypeByName(arg1,(char const *)arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDumpModule ( + void * jarg1 + ) +{ + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + + arg1 = (LLVMModuleRef)jarg1; + + LLVMDumpModule(arg1); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMGetTypeKind ( + void * jarg1 + ) +{ + int jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMTypeKind result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (LLVMTypeKind)LLVMGetTypeKind(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMInt1Type ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMInt1Type(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMInt8Type ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMInt8Type(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMInt16Type ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMInt16Type(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMInt32Type ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMInt32Type(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMInt64Type ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMInt64Type(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIntType ( + unsigned int jarg1 + ) +{ + void * jresult ; + unsigned int arg1 ; + LLVMTypeRef result; + + + arg1 = (unsigned int) jarg1; + + + result = (LLVMTypeRef)LLVMIntType(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMGetIntTypeWidth ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned int result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (unsigned int)LLVMGetIntTypeWidth(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMFloatType ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMFloatType(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMDoubleType ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMDoubleType(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMX86FP80Type ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMX86FP80Type(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMFP128Type ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMFP128Type(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMPPCFP128Type ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMPPCFP128Type(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMFunctionType ( + void * jarg1 + , + + void * jarg2 + , + + unsigned int jarg3 + , + + int jarg4 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMTypeRef *arg2 = (LLVMTypeRef *) 0 ; + unsigned int arg3 ; + int arg4 ; + LLVMTypeRef result; + + arg1 = (LLVMTypeRef)jarg1; + + arg2 = (LLVMTypeRef *)jarg2; + + + arg3 = (unsigned int) jarg3; + + + + arg4 = (int) jarg4; + + + result = (LLVMTypeRef)LLVMFunctionType(arg1,arg2,arg3,arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMIsFunctionVarArg ( + void * jarg1 + ) +{ + int jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + int result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (int)LLVMIsFunctionVarArg(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetReturnType ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMTypeRef result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (LLVMTypeRef)LLVMGetReturnType(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMCountParamTypes ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned int result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (unsigned int)LLVMCountParamTypes(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMGetParamTypes ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMTypeRef *arg2 = (LLVMTypeRef *) 0 ; + + arg1 = (LLVMTypeRef)jarg1; + + arg2 = (LLVMTypeRef *)jarg2; + + LLVMGetParamTypes(arg1,arg2); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMStructType ( + void * jarg1 + , + + unsigned int jarg2 + , + + int jarg3 + ) +{ + void * jresult ; + LLVMTypeRef *arg1 = (LLVMTypeRef *) 0 ; + unsigned int arg2 ; + int arg3 ; + LLVMTypeRef result; + + arg1 = (LLVMTypeRef *)jarg1; + + + arg2 = (unsigned int) jarg2; + + + + arg3 = (int) jarg3; + + + result = (LLVMTypeRef)LLVMStructType(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMCountStructElementTypes ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned int result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (unsigned int)LLVMCountStructElementTypes(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMGetStructElementTypes ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMTypeRef *arg2 = (LLVMTypeRef *) 0 ; + + arg1 = (LLVMTypeRef)jarg1; + + arg2 = (LLVMTypeRef *)jarg2; + + LLVMGetStructElementTypes(arg1,arg2); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMIsPackedStruct ( + void * jarg1 + ) +{ + int jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + int result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (int)LLVMIsPackedStruct(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMArrayType ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned int arg2 ; + LLVMTypeRef result; + + arg1 = (LLVMTypeRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + result = (LLVMTypeRef)LLVMArrayType(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMPointerType ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned int arg2 ; + LLVMTypeRef result; + + arg1 = (LLVMTypeRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + result = (LLVMTypeRef)LLVMPointerType(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMVectorType ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned int arg2 ; + LLVMTypeRef result; + + arg1 = (LLVMTypeRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + result = (LLVMTypeRef)LLVMVectorType(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetElementType ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMTypeRef result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (LLVMTypeRef)LLVMGetElementType(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMGetArrayLength ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned int result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (unsigned int)LLVMGetArrayLength(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMGetPointerAddressSpace ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned int result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (unsigned int)LLVMGetPointerAddressSpace(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMGetVectorSize ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned int result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (unsigned int)LLVMGetVectorSize(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMVoidType ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMVoidType(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMLabelType ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMLabelType(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMOpaqueType ( + ) +{ + void * jresult ; + LLVMTypeRef result; + + result = (LLVMTypeRef)LLVMOpaqueType(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMCreateTypeHandle ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMTypeHandleRef result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (LLVMTypeHandleRef)LLVMCreateTypeHandle(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMRefineType ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + + arg1 = (LLVMTypeRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + LLVMRefineType(arg1,arg2); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMResolveTypeHandle ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTypeHandleRef arg1 = (LLVMTypeHandleRef) 0 ; + LLVMTypeRef result; + + arg1 = (LLVMTypeHandleRef)jarg1; + + result = (LLVMTypeRef)LLVMResolveTypeHandle(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDisposeTypeHandle ( + void * jarg1 + ) +{ + LLVMTypeHandleRef arg1 = (LLVMTypeHandleRef) 0 ; + + arg1 = (LLVMTypeHandleRef)jarg1; + + LLVMDisposeTypeHandle(arg1); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMTypeOf ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMTypeRef)LLVMTypeOf(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport char * SWIGSTDCALL Ada_LLVMGetValueName ( + void * jarg1 + ) +{ + char * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + char *result = 0 ; + + arg1 = (LLVMValueRef)jarg1; + + result = (char *)LLVMGetValueName(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetValueName ( + void * jarg1 + , + + char * jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = jarg2; + + LLVMSetValueName(arg1,(char const *)arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDumpValue ( + void * jarg1 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + LLVMDumpValue(arg1); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAArgument ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAArgument(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsABasicBlock ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsABasicBlock(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAInlineAsm ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAInlineAsm(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAUser ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAUser(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAConstant ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAConstant(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAConstantAggregateZero ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAConstantAggregateZero(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAConstantArray ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAConstantArray(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAConstantExpr ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAConstantExpr(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAConstantFP ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAConstantFP(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAConstantInt ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAConstantInt(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAConstantPointerNull ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAConstantPointerNull(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAConstantStruct ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAConstantStruct(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAConstantVector ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAConstantVector(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAGlobalValue ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAGlobalValue(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAFunction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAFunction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAGlobalAlias ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAGlobalAlias(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAGlobalVariable ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAGlobalVariable(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAUndefValue ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAUndefValue(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAInstruction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAInstruction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsABinaryOperator ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsABinaryOperator(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsACallInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsACallInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAIntrinsicInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAIntrinsicInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsADbgInfoIntrinsic ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsADbgInfoIntrinsic(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsADbgDeclareInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsADbgDeclareInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsADbgFuncStartInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsADbgFuncStartInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsADbgRegionEndInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsADbgRegionEndInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsADbgRegionStartInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsADbgRegionStartInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsADbgStopPointInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsADbgStopPointInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAEHSelectorInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAEHSelectorInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAMemIntrinsic ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAMemIntrinsic(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAMemCpyInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAMemCpyInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAMemMoveInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAMemMoveInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAMemSetInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAMemSetInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsACmpInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsACmpInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAFCmpInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAFCmpInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAICmpInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAICmpInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAExtractElementInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAExtractElementInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAGetElementPtrInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAGetElementPtrInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAInsertElementInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAInsertElementInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAInsertValueInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAInsertValueInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAPHINode ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAPHINode(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsASelectInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsASelectInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAShuffleVectorInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAShuffleVectorInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAStoreInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAStoreInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsATerminatorInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsATerminatorInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsABranchInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsABranchInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAInvokeInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAInvokeInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAReturnInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAReturnInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsASwitchInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsASwitchInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAUnreachableInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAUnreachableInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAUnwindInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAUnwindInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAUnaryInstruction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAUnaryInstruction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAAllocationInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAAllocationInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAAllocaInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAAllocaInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAMallocInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAMallocInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsACastInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsACastInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsABitCastInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsABitCastInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAFPExtInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAFPExtInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAFPToSIInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAFPToSIInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAFPToUIInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAFPToUIInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAFPTruncInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAFPTruncInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAIntToPtrInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAIntToPtrInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAPtrToIntInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAPtrToIntInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsASExtInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsASExtInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsASIToFPInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsASIToFPInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsATruncInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsATruncInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAUIToFPInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAUIToFPInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAZExtInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAZExtInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAExtractValueInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAExtractValueInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAFreeInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAFreeInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsALoadInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsALoadInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIsAVAArgInst ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMIsAVAArgInst(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstNull ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (LLVMValueRef)LLVMConstNull(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstAllOnes ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (LLVMValueRef)LLVMConstAllOnes(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetUndef ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (LLVMValueRef)LLVMGetUndef(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMIsConstant ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (int)LLVMIsConstant(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMIsNull ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (int)LLVMIsNull(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMIsUndef ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (int)LLVMIsUndef(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstPointerNull ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (LLVMValueRef)LLVMConstPointerNull(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstInt ( + void * jarg1 + , + + unsigned long long jarg2 + , + + int jarg3 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + unsigned long long arg2 ; + int arg3 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + + arg2 = (unsigned long long) jarg2; + + + + arg3 = (int) jarg3; + + + result = (LLVMValueRef)LLVMConstInt(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstReal ( + void * jarg1 + , + + double jarg2 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + double arg2 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + + arg2 = (double) jarg2; + + + result = (LLVMValueRef)LLVMConstReal(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstRealOfString ( + void * jarg1 + , + + char * jarg2 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + char *arg2 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + arg2 = jarg2; + + result = (LLVMValueRef)LLVMConstRealOfString(arg1,(char const *)arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstString ( + char * jarg1 + , + + unsigned int jarg2 + , + + int jarg3 + ) +{ + void * jresult ; + char *arg1 = (char *) 0 ; + unsigned int arg2 ; + int arg3 ; + LLVMValueRef result; + + arg1 = jarg1; + + + arg2 = (unsigned int) jarg2; + + + + arg3 = (int) jarg3; + + + result = (LLVMValueRef)LLVMConstString((char const *)arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstArray ( + void * jarg1 + , + + void * jarg2 + , + + unsigned int jarg3 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMValueRef *arg2 = (LLVMValueRef *) 0 ; + unsigned int arg3 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + arg2 = (LLVMValueRef *)jarg2; + + + arg3 = (unsigned int) jarg3; + + + result = (LLVMValueRef)LLVMConstArray(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstStruct ( + void * jarg1 + , + + unsigned int jarg2 + , + + int jarg3 + ) +{ + void * jresult ; + LLVMValueRef *arg1 = (LLVMValueRef *) 0 ; + unsigned int arg2 ; + int arg3 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef *)jarg1; + + + arg2 = (unsigned int) jarg2; + + + + arg3 = (int) jarg3; + + + result = (LLVMValueRef)LLVMConstStruct(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstVector ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + void * jresult ; + LLVMValueRef *arg1 = (LLVMValueRef *) 0 ; + unsigned int arg2 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef *)jarg1; + + + arg2 = (unsigned int) jarg2; + + + result = (LLVMValueRef)LLVMConstVector(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMSizeOf ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + result = (LLVMValueRef)LLVMSizeOf(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstNeg ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMConstNeg(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstNot ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMConstNot(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstAdd ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstAdd(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstSub ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstSub(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstMul ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstMul(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstUDiv ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstUDiv(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstSDiv ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstSDiv(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstFDiv ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstFDiv(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstURem ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstURem(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstSRem ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstSRem(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstFRem ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstFRem(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstAnd ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstAnd(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstOr ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstOr(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstXor ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstXor(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstICmp ( + int jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + void * jresult ; + LLVMIntPredicate arg1 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMIntPredicate) jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + result = (LLVMValueRef)LLVMConstICmp(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstFCmp ( + int jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + void * jresult ; + LLVMRealPredicate arg1 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMRealPredicate) jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + result = (LLVMValueRef)LLVMConstFCmp(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstShl ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstShl(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstLShr ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstLShr(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstAShr ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstAShr(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstGEP ( + void * jarg1 + , + + void * jarg2 + , + + unsigned int jarg3 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef *arg2 = (LLVMValueRef *) 0 ; + unsigned int arg3 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef *)jarg2; + + + arg3 = (unsigned int) jarg3; + + + result = (LLVMValueRef)LLVMConstGEP(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstTrunc ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstTrunc(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstSExt ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstSExt(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstZExt ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstZExt(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstFPTrunc ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstFPTrunc(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstFPExt ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstFPExt(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstUIToFP ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstUIToFP(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstSIToFP ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstSIToFP(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstFPToUI ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstFPToUI(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstFPToSI ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstFPToSI(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstPtrToInt ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstPtrToInt(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstIntToPtr ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstIntToPtr(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstBitCast ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (LLVMValueRef)LLVMConstBitCast(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstSelect ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + result = (LLVMValueRef)LLVMConstSelect(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstExtractElement ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMConstExtractElement(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstInsertElement ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + result = (LLVMValueRef)LLVMConstInsertElement(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstShuffleVector ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + result = (LLVMValueRef)LLVMConstShuffleVector(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstExtractValue ( + void * jarg1 + , + + unsigned int* jarg2 + , + + unsigned int jarg3 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int *arg2 = (unsigned int *) 0 ; + unsigned int arg3 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int *) jarg2; + + + + arg3 = (unsigned int) jarg3; + + + result = (LLVMValueRef)LLVMConstExtractValue(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstInsertValue ( + void * jarg1 + , + + void * jarg2 + , + + unsigned int* jarg3 + , + + unsigned int jarg4 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + unsigned int *arg3 = (unsigned int *) 0 ; + unsigned int arg4 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + + arg3 = (unsigned int *) jarg3; + + + + arg4 = (unsigned int) jarg4; + + + result = (LLVMValueRef)LLVMConstInsertValue(arg1,arg2,arg3,arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMConstInlineAsm ( + void * jarg1 + , + + char * jarg2 + , + + char * jarg3 + , + + int jarg4 + ) +{ + void * jresult ; + LLVMTypeRef arg1 = (LLVMTypeRef) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + LLVMValueRef result; + + arg1 = (LLVMTypeRef)jarg1; + + arg2 = jarg2; + + arg3 = jarg3; + + + arg4 = (int) jarg4; + + + result = (LLVMValueRef)LLVMConstInlineAsm(arg1,(char const *)arg2,(char const *)arg3,arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetGlobalParent ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMModuleRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMModuleRef)LLVMGetGlobalParent(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMIsDeclaration ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (int)LLVMIsDeclaration(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMGetLinkage ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMLinkage result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMLinkage)LLVMGetLinkage(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetLinkage ( + void * jarg1 + , + + int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMLinkage arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMLinkage) jarg2; + + LLVMSetLinkage(arg1,arg2); + + +} + + + +DllExport char * SWIGSTDCALL Ada_LLVMGetSection ( + void * jarg1 + ) +{ + char * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + char *result = 0 ; + + arg1 = (LLVMValueRef)jarg1; + + result = (char *)LLVMGetSection(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetSection ( + void * jarg1 + , + + char * jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = jarg2; + + LLVMSetSection(arg1,(char const *)arg2); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMGetVisibility ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMVisibility result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMVisibility)LLVMGetVisibility(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetVisibility ( + void * jarg1 + , + + int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMVisibility arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMVisibility) jarg2; + + LLVMSetVisibility(arg1,arg2); + + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMGetAlignment ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (unsigned int)LLVMGetAlignment(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetAlignment ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + LLVMSetAlignment(arg1,arg2); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMAddGlobal ( + void * jarg1 + , + + void * jarg2 + , + + char * jarg3 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + char *arg3 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + arg3 = jarg3; + + result = (LLVMValueRef)LLVMAddGlobal(arg1,arg2,(char const *)arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetNamedGlobal ( + void * jarg1 + , + + char * jarg2 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *arg2 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = jarg2; + + result = (LLVMValueRef)LLVMGetNamedGlobal(arg1,(char const *)arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetFirstGlobal ( + void * jarg1 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMModuleRef)jarg1; + + result = (LLVMValueRef)LLVMGetFirstGlobal(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetLastGlobal ( + void * jarg1 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMModuleRef)jarg1; + + result = (LLVMValueRef)LLVMGetLastGlobal(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetNextGlobal ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetNextGlobal(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetPreviousGlobal ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetPreviousGlobal(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDeleteGlobal ( + void * jarg1 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + LLVMDeleteGlobal(arg1); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetInitializer ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetInitializer(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetInitializer ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + LLVMSetInitializer(arg1,arg2); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMIsThreadLocal ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (int)LLVMIsThreadLocal(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetThreadLocal ( + void * jarg1 + , + + int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (int) jarg2; + + + LLVMSetThreadLocal(arg1,arg2); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMIsGlobalConstant ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (int)LLVMIsGlobalConstant(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetGlobalConstant ( + void * jarg1 + , + + int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (int) jarg2; + + + LLVMSetGlobalConstant(arg1,arg2); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMAddAlias ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMAddAlias(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMAddFunction ( + void * jarg1 + , + + char * jarg2 + , + + void * jarg3 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *arg2 = (char *) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + result = (LLVMValueRef)LLVMAddFunction(arg1,(char const *)arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetNamedFunction ( + void * jarg1 + , + + char * jarg2 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + char *arg2 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMModuleRef)jarg1; + + arg2 = jarg2; + + result = (LLVMValueRef)LLVMGetNamedFunction(arg1,(char const *)arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetFirstFunction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMModuleRef)jarg1; + + result = (LLVMValueRef)LLVMGetFirstFunction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetLastFunction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMModuleRef)jarg1; + + result = (LLVMValueRef)LLVMGetLastFunction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetNextFunction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetNextFunction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetPreviousFunction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetPreviousFunction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDeleteFunction ( + void * jarg1 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + LLVMDeleteFunction(arg1); + + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMGetIntrinsicID ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (unsigned int)LLVMGetIntrinsicID(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMGetFunctionCallConv ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (unsigned int)LLVMGetFunctionCallConv(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetFunctionCallConv ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + LLVMSetFunctionCallConv(arg1,arg2); + + +} + + + +DllExport char * SWIGSTDCALL Ada_LLVMGetGC ( + void * jarg1 + ) +{ + char * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + char *result = 0 ; + + arg1 = (LLVMValueRef)jarg1; + + result = (char *)LLVMGetGC(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetGC ( + void * jarg1 + , + + char * jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = jarg2; + + LLVMSetGC(arg1,(char const *)arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddFunctionAttr ( + void * jarg1 + , + + int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMAttribute arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMAttribute) jarg2; + + LLVMAddFunctionAttr(arg1,arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMRemoveFunctionAttr ( + void * jarg1 + , + + int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMAttribute arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMAttribute) jarg2; + + LLVMRemoveFunctionAttr(arg1,arg2); + + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMCountParams ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (unsigned int)LLVMCountParams(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMGetParams ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef *arg2 = (LLVMValueRef *) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef *)jarg2; + + LLVMGetParams(arg1,arg2); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetParam ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + result = (LLVMValueRef)LLVMGetParam(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetParamParent ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetParamParent(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetFirstParam ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetFirstParam(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetLastParam ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetLastParam(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetNextParam ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetNextParam(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetPreviousParam ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetPreviousParam(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddAttribute ( + void * jarg1 + , + + int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMAttribute arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMAttribute) jarg2; + + LLVMAddAttribute(arg1,arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMRemoveAttribute ( + void * jarg1 + , + + int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMAttribute arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMAttribute) jarg2; + + LLVMRemoveAttribute(arg1,arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetParamAlignment ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + LLVMSetParamAlignment(arg1,arg2); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBasicBlockAsValue ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBasicBlockRef arg1 = (LLVMBasicBlockRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBasicBlockRef)jarg1; + + result = (LLVMValueRef)LLVMBasicBlockAsValue(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMValueIsBasicBlock ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (int)LLVMValueIsBasicBlock(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMValueAsBasicBlock ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMBasicBlockRef)LLVMValueAsBasicBlock(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetBasicBlockParent ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBasicBlockRef arg1 = (LLVMBasicBlockRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBasicBlockRef)jarg1; + + result = (LLVMValueRef)LLVMGetBasicBlockParent(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMCountBasicBlocks ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (unsigned int)LLVMCountBasicBlocks(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMGetBasicBlocks ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMBasicBlockRef *arg2 = (LLVMBasicBlockRef *) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMBasicBlockRef *)jarg2; + + LLVMGetBasicBlocks(arg1,arg2); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetFirstBasicBlock ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMBasicBlockRef)LLVMGetFirstBasicBlock(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetLastBasicBlock ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMBasicBlockRef)LLVMGetLastBasicBlock(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetNextBasicBlock ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBasicBlockRef arg1 = (LLVMBasicBlockRef) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMBasicBlockRef)jarg1; + + result = (LLVMBasicBlockRef)LLVMGetNextBasicBlock(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetPreviousBasicBlock ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBasicBlockRef arg1 = (LLVMBasicBlockRef) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMBasicBlockRef)jarg1; + + result = (LLVMBasicBlockRef)LLVMGetPreviousBasicBlock(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetEntryBasicBlock ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMBasicBlockRef)LLVMGetEntryBasicBlock(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMAppendBasicBlock ( + void * jarg1 + , + + char * jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + char *arg2 = (char *) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = jarg2; + + result = (LLVMBasicBlockRef)LLVMAppendBasicBlock(arg1,(char const *)arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMInsertBasicBlock ( + void * jarg1 + , + + char * jarg2 + ) +{ + void * jresult ; + LLVMBasicBlockRef arg1 = (LLVMBasicBlockRef) 0 ; + char *arg2 = (char *) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMBasicBlockRef)jarg1; + + arg2 = jarg2; + + result = (LLVMBasicBlockRef)LLVMInsertBasicBlock(arg1,(char const *)arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDeleteBasicBlock ( + void * jarg1 + ) +{ + LLVMBasicBlockRef arg1 = (LLVMBasicBlockRef) 0 ; + + arg1 = (LLVMBasicBlockRef)jarg1; + + LLVMDeleteBasicBlock(arg1); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetInstructionParent ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMBasicBlockRef)LLVMGetInstructionParent(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetFirstInstruction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBasicBlockRef arg1 = (LLVMBasicBlockRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBasicBlockRef)jarg1; + + result = (LLVMValueRef)LLVMGetFirstInstruction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetLastInstruction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBasicBlockRef arg1 = (LLVMBasicBlockRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBasicBlockRef)jarg1; + + result = (LLVMValueRef)LLVMGetLastInstruction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetNextInstruction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetNextInstruction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetPreviousInstruction ( + void * jarg1 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + result = (LLVMValueRef)LLVMGetPreviousInstruction(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetInstructionCallConv ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + LLVMSetInstructionCallConv(arg1,arg2); + + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMGetInstructionCallConv ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (unsigned int)LLVMGetInstructionCallConv(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddInstrAttribute ( + void * jarg1 + , + + unsigned int jarg2 + , + + int jarg3 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + LLVMAttribute arg3 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + arg3 = (LLVMAttribute) jarg3; + + LLVMAddInstrAttribute(arg1,arg2,arg3); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMRemoveInstrAttribute ( + void * jarg1 + , + + unsigned int jarg2 + , + + int jarg3 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + LLVMAttribute arg3 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + arg3 = (LLVMAttribute) jarg3; + + LLVMRemoveInstrAttribute(arg1,arg2,arg3); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetInstrParamAlignment ( + void * jarg1 + , + + unsigned int jarg2 + , + + unsigned int jarg3 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + unsigned int arg3 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + + arg3 = (unsigned int) jarg3; + + + LLVMSetInstrParamAlignment(arg1,arg2,arg3); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMIsTailCall ( + void * jarg1 + ) +{ + int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (int)LLVMIsTailCall(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMSetTailCall ( + void * jarg1 + , + + int jarg2 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + int arg2 ; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (int) jarg2; + + + LLVMSetTailCall(arg1,arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddIncoming ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + unsigned int jarg4 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef *arg2 = (LLVMValueRef *) 0 ; + LLVMBasicBlockRef *arg3 = (LLVMBasicBlockRef *) 0 ; + unsigned int arg4 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef *)jarg2; + + arg3 = (LLVMBasicBlockRef *)jarg3; + + + arg4 = (unsigned int) jarg4; + + + LLVMAddIncoming(arg1,arg2,arg3,arg4); + + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMCountIncoming ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int result; + + arg1 = (LLVMValueRef)jarg1; + + result = (unsigned int)LLVMCountIncoming(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetIncomingValue ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + LLVMValueRef result; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + result = (LLVMValueRef)LLVMGetIncomingValue(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetIncomingBlock ( + void * jarg1 + , + + unsigned int jarg2 + ) +{ + void * jresult ; + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + unsigned int arg2 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMValueRef)jarg1; + + + arg2 = (unsigned int) jarg2; + + + result = (LLVMBasicBlockRef)LLVMGetIncomingBlock(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMCreateBuilder ( + ) +{ + void * jresult ; + LLVMBuilderRef result; + + result = (LLVMBuilderRef)LLVMCreateBuilder(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMPositionBuilder ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMBasicBlockRef arg2 = (LLVMBasicBlockRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMBasicBlockRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + LLVMPositionBuilder(arg1,arg2,arg3); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMPositionBuilderBefore ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + LLVMPositionBuilderBefore(arg1,arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMPositionBuilderAtEnd ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMBasicBlockRef arg2 = (LLVMBasicBlockRef) 0 ; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMBasicBlockRef)jarg2; + + LLVMPositionBuilderAtEnd(arg1,arg2); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMGetInsertBlock ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMBasicBlockRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + result = (LLVMBasicBlockRef)LLVMGetInsertBlock(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMClearInsertionPosition ( + void * jarg1 + ) +{ + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + + arg1 = (LLVMBuilderRef)jarg1; + + LLVMClearInsertionPosition(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMInsertIntoBuilder ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + LLVMInsertIntoBuilder(arg1,arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDisposeBuilder ( + void * jarg1 + ) +{ + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + + arg1 = (LLVMBuilderRef)jarg1; + + LLVMDisposeBuilder(arg1); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildRetVoid ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + result = (LLVMValueRef)LLVMBuildRetVoid(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildRet ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMBuildRet(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildBr ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMBasicBlockRef arg2 = (LLVMBasicBlockRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMBasicBlockRef)jarg2; + + result = (LLVMValueRef)LLVMBuildBr(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildCondBr ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + void * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMBasicBlockRef arg3 = (LLVMBasicBlockRef) 0 ; + LLVMBasicBlockRef arg4 = (LLVMBasicBlockRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMBasicBlockRef)jarg3; + + arg4 = (LLVMBasicBlockRef)jarg4; + + result = (LLVMValueRef)LLVMBuildCondBr(arg1,arg2,arg3,arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildSwitch ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + unsigned int jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMBasicBlockRef arg3 = (LLVMBasicBlockRef) 0 ; + unsigned int arg4 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMBasicBlockRef)jarg3; + + + arg4 = (unsigned int) jarg4; + + + result = (LLVMValueRef)LLVMBuildSwitch(arg1,arg2,arg3,arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildInvoke ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + unsigned int jarg4 + , + + void * jarg5 + , + + void * jarg6 + , + + char * jarg7 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef *arg3 = (LLVMValueRef *) 0 ; + unsigned int arg4 ; + LLVMBasicBlockRef arg5 = (LLVMBasicBlockRef) 0 ; + LLVMBasicBlockRef arg6 = (LLVMBasicBlockRef) 0 ; + char *arg7 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef *)jarg3; + + + arg4 = (unsigned int) jarg4; + + + arg5 = (LLVMBasicBlockRef)jarg5; + + arg6 = (LLVMBasicBlockRef)jarg6; + + arg7 = jarg7; + + result = (LLVMValueRef)LLVMBuildInvoke(arg1,arg2,arg3,arg4,arg5,arg6,(char const *)arg7); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildUnwind ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + result = (LLVMValueRef)LLVMBuildUnwind(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildUnreachable ( + void * jarg1 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + result = (LLVMValueRef)LLVMBuildUnreachable(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddCase ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + LLVMValueRef arg1 = (LLVMValueRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMBasicBlockRef arg3 = (LLVMBasicBlockRef) 0 ; + + arg1 = (LLVMValueRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMBasicBlockRef)jarg3; + + LLVMAddCase(arg1,arg2,arg3); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildAdd ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildAdd(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildSub ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildSub(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildMul ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildMul(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildUDiv ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildUDiv(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildSDiv ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildSDiv(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildFDiv ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildFDiv(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildURem ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildURem(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildSRem ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildSRem(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildFRem ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildFRem(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildShl ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildShl(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildLShr ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildLShr(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildAShr ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildAShr(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildAnd ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildAnd(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildOr ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildOr(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildXor ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildXor(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildNeg ( + void * jarg1 + , + + void * jarg2 + , + + char * jarg3 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + char *arg3 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = jarg3; + + result = (LLVMValueRef)LLVMBuildNeg(arg1,arg2,(char const *)arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildNot ( + void * jarg1 + , + + void * jarg2 + , + + char * jarg3 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + char *arg3 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = jarg3; + + result = (LLVMValueRef)LLVMBuildNot(arg1,arg2,(char const *)arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildMalloc ( + void * jarg1 + , + + void * jarg2 + , + + char * jarg3 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + char *arg3 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + arg3 = jarg3; + + result = (LLVMValueRef)LLVMBuildMalloc(arg1,arg2,(char const *)arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildArrayMalloc ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildArrayMalloc(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildAlloca ( + void * jarg1 + , + + void * jarg2 + , + + char * jarg3 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + char *arg3 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + arg3 = jarg3; + + result = (LLVMValueRef)LLVMBuildAlloca(arg1,arg2,(char const *)arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildArrayAlloca ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildArrayAlloca(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildFree ( + void * jarg1 + , + + void * jarg2 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (LLVMValueRef)LLVMBuildFree(arg1,arg2); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildLoad ( + void * jarg1 + , + + void * jarg2 + , + + char * jarg3 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + char *arg3 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = jarg3; + + result = (LLVMValueRef)LLVMBuildLoad(arg1,arg2,(char const *)arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildStore ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + result = (LLVMValueRef)LLVMBuildStore(arg1,arg2,arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildGEP ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + unsigned int jarg4 + , + + char * jarg5 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef *arg3 = (LLVMValueRef *) 0 ; + unsigned int arg4 ; + char *arg5 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef *)jarg3; + + + arg4 = (unsigned int) jarg4; + + + arg5 = jarg5; + + result = (LLVMValueRef)LLVMBuildGEP(arg1,arg2,arg3,arg4,(char const *)arg5); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildTrunc ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildTrunc(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildZExt ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildZExt(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildSExt ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildSExt(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildFPToUI ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildFPToUI(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildFPToSI ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildFPToSI(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildUIToFP ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildUIToFP(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildSIToFP ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildSIToFP(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildFPTrunc ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildFPTrunc(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildFPExt ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildFPExt(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildPtrToInt ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildPtrToInt(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildIntToPtr ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildIntToPtr(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildBitCast ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildBitCast(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildICmp ( + void * jarg1 + , + + int jarg2 + , + + void * jarg3 + , + + void * jarg4 + , + + char * jarg5 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMIntPredicate arg2 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef arg4 = (LLVMValueRef) 0 ; + char *arg5 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMIntPredicate) jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = (LLVMValueRef)jarg4; + + arg5 = jarg5; + + result = (LLVMValueRef)LLVMBuildICmp(arg1,arg2,arg3,arg4,(char const *)arg5); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildFCmp ( + void * jarg1 + , + + int jarg2 + , + + void * jarg3 + , + + void * jarg4 + , + + char * jarg5 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMRealPredicate arg2 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef arg4 = (LLVMValueRef) 0 ; + char *arg5 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMRealPredicate) jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = (LLVMValueRef)jarg4; + + arg5 = jarg5; + + result = (LLVMValueRef)LLVMBuildFCmp(arg1,arg2,arg3,arg4,(char const *)arg5); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildPhi ( + void * jarg1 + , + + void * jarg2 + , + + char * jarg3 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + char *arg3 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + arg3 = jarg3; + + result = (LLVMValueRef)LLVMBuildPhi(arg1,arg2,(char const *)arg3); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildCall ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + unsigned int jarg4 + , + + char * jarg5 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef *arg3 = (LLVMValueRef *) 0 ; + unsigned int arg4 ; + char *arg5 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef *)jarg3; + + + arg4 = (unsigned int) jarg4; + + + arg5 = jarg5; + + result = (LLVMValueRef)LLVMBuildCall(arg1,arg2,arg3,arg4,(char const *)arg5); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildSelect ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + void * jarg4 + , + + char * jarg5 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef arg4 = (LLVMValueRef) 0 ; + char *arg5 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = (LLVMValueRef)jarg4; + + arg5 = jarg5; + + result = (LLVMValueRef)LLVMBuildSelect(arg1,arg2,arg3,arg4,(char const *)arg5); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildVAArg ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMTypeRef arg3 = (LLVMTypeRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMTypeRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildVAArg(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildExtractElement ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildExtractElement(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildInsertElement ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + void * jarg4 + , + + char * jarg5 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef arg4 = (LLVMValueRef) 0 ; + char *arg5 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = (LLVMValueRef)jarg4; + + arg5 = jarg5; + + result = (LLVMValueRef)LLVMBuildInsertElement(arg1,arg2,arg3,arg4,(char const *)arg5); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildShuffleVector ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + void * jarg4 + , + + char * jarg5 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + LLVMValueRef arg4 = (LLVMValueRef) 0 ; + char *arg5 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + arg4 = (LLVMValueRef)jarg4; + + arg5 = jarg5; + + result = (LLVMValueRef)LLVMBuildShuffleVector(arg1,arg2,arg3,arg4,(char const *)arg5); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildExtractValue ( + void * jarg1 + , + + void * jarg2 + , + + unsigned int jarg3 + , + + char * jarg4 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + unsigned int arg3 ; + char *arg4 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + + arg3 = (unsigned int) jarg3; + + + arg4 = jarg4; + + result = (LLVMValueRef)LLVMBuildExtractValue(arg1,arg2,arg3,(char const *)arg4); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMBuildInsertValue ( + void * jarg1 + , + + void * jarg2 + , + + void * jarg3 + , + + unsigned int jarg4 + , + + char * jarg5 + ) +{ + void * jresult ; + LLVMBuilderRef arg1 = (LLVMBuilderRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + LLVMValueRef arg3 = (LLVMValueRef) 0 ; + unsigned int arg4 ; + char *arg5 = (char *) 0 ; + LLVMValueRef result; + + arg1 = (LLVMBuilderRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + arg3 = (LLVMValueRef)jarg3; + + + arg4 = (unsigned int) jarg4; + + + arg5 = jarg5; + + result = (LLVMValueRef)LLVMBuildInsertValue(arg1,arg2,arg3,arg4,(char const *)arg5); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMCreateModuleProviderForExistingModule ( + void * jarg1 + ) +{ + void * jresult ; + LLVMModuleRef arg1 = (LLVMModuleRef) 0 ; + LLVMModuleProviderRef result; + + arg1 = (LLVMModuleRef)jarg1; + + result = (LLVMModuleProviderRef)LLVMCreateModuleProviderForExistingModule(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDisposeModuleProvider ( + void * jarg1 + ) +{ + LLVMModuleProviderRef arg1 = (LLVMModuleProviderRef) 0 ; + + arg1 = (LLVMModuleProviderRef)jarg1; + + LLVMDisposeModuleProvider(arg1); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMCreateMemoryBufferWithContentsOfFile ( + char * jarg1 + , + + void * jarg2 + , + + void * jarg3 + ) +{ + int jresult ; + char *arg1 = (char *) 0 ; + LLVMMemoryBufferRef *arg2 = (LLVMMemoryBufferRef *) 0 ; + char **arg3 = (char **) 0 ; + int result; + + arg1 = jarg1; + + arg2 = (LLVMMemoryBufferRef *)jarg2; + + arg3 = (char **)jarg3; + + result = (int)LLVMCreateMemoryBufferWithContentsOfFile((char const *)arg1,arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMCreateMemoryBufferWithSTDIN ( + void * jarg1 + , + + void * jarg2 + ) +{ + int jresult ; + LLVMMemoryBufferRef *arg1 = (LLVMMemoryBufferRef *) 0 ; + char **arg2 = (char **) 0 ; + int result; + + arg1 = (LLVMMemoryBufferRef *)jarg1; + + arg2 = (char **)jarg2; + + result = (int)LLVMCreateMemoryBufferWithSTDIN(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDisposeMemoryBuffer ( + void * jarg1 + ) +{ + LLVMMemoryBufferRef arg1 = (LLVMMemoryBufferRef) 0 ; + + arg1 = (LLVMMemoryBufferRef)jarg1; + + LLVMDisposeMemoryBuffer(arg1); + + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMCreatePassManager ( + ) +{ + void * jresult ; + LLVMPassManagerRef result; + + result = (LLVMPassManagerRef)LLVMCreatePassManager(); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMCreateFunctionPassManager ( + void * jarg1 + ) +{ + void * jresult ; + LLVMModuleProviderRef arg1 = (LLVMModuleProviderRef) 0 ; + LLVMPassManagerRef result; + + arg1 = (LLVMModuleProviderRef)jarg1; + + result = (LLVMPassManagerRef)LLVMCreateFunctionPassManager(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMRunPassManager ( + void * jarg1 + , + + void * jarg2 + ) +{ + int jresult ; + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + LLVMModuleRef arg2 = (LLVMModuleRef) 0 ; + int result; + + arg1 = (LLVMPassManagerRef)jarg1; + + arg2 = (LLVMModuleRef)jarg2; + + result = (int)LLVMRunPassManager(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMInitializeFunctionPassManager ( + void * jarg1 + ) +{ + int jresult ; + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + int result; + + arg1 = (LLVMPassManagerRef)jarg1; + + result = (int)LLVMInitializeFunctionPassManager(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMRunFunctionPassManager ( + void * jarg1 + , + + void * jarg2 + ) +{ + int jresult ; + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + int result; + + arg1 = (LLVMPassManagerRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (int)LLVMRunFunctionPassManager(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMFinalizeFunctionPassManager ( + void * jarg1 + ) +{ + int jresult ; + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + int result; + + arg1 = (LLVMPassManagerRef)jarg1; + + result = (int)LLVMFinalizeFunctionPassManager(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDisposePassManager ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMDisposePassManager(arg1); + + +} + + + +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif + Added: llvm/trunk/bindings/ada/target/llvm_target-binding.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/target/llvm_target-binding.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/target/llvm_target-binding.ads (added) +++ llvm/trunk/bindings/ada/target/llvm_target-binding.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,138 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with llvm; +with Interfaces.C.Strings; + + +package LLVM_Target.Binding is + + LLVMBigEndian : constant := 0; + LLVMLittleEndian : constant := 1; + + procedure LLVMInitializeAllTargets; + + function LLVMInitializeNativeTarget return Interfaces.C.int; + + function LLVMCreateTargetData + (StringRep : in Interfaces.C.Strings.chars_ptr) + return LLVM_Target.LLVMTargetDataRef; + + procedure LLVMAddTargetData + (arg_2_1 : in LLVM_Target.LLVMTargetDataRef; + arg_2_2 : in llvm.LLVMPassManagerRef); + + function LLVMCopyStringRepOfTargetData + (arg_1 : in LLVM_Target.LLVMTargetDataRef) + return Interfaces.C.Strings.chars_ptr; + + function LLVMByteOrder + (arg_1 : in LLVM_Target.LLVMTargetDataRef) + return LLVM_Target.LLVMByteOrdering; + + function LLVMPointerSize + (arg_1 : in LLVM_Target.LLVMTargetDataRef) + return Interfaces.C.unsigned; + + function LLVMIntPtrType + (arg_1 : in LLVM_Target.LLVMTargetDataRef) + return llvm.LLVMTypeRef; + + function LLVMSizeOfTypeInBits + (arg_2_1 : in LLVM_Target.LLVMTargetDataRef; + arg_2_2 : in llvm.LLVMTypeRef) + return Interfaces.C.Extensions.unsigned_long_long; + + function LLVMStoreSizeOfType + (arg_2_1 : in LLVM_Target.LLVMTargetDataRef; + arg_2_2 : in llvm.LLVMTypeRef) + return Interfaces.C.Extensions.unsigned_long_long; + + function LLVMABISizeOfType + (arg_2_1 : in LLVM_Target.LLVMTargetDataRef; + arg_2_2 : in llvm.LLVMTypeRef) + return Interfaces.C.Extensions.unsigned_long_long; + + function LLVMABIAlignmentOfType + (arg_2_1 : in LLVM_Target.LLVMTargetDataRef; + arg_2_2 : in llvm.LLVMTypeRef) + return Interfaces.C.unsigned; + + function LLVMCallFrameAlignmentOfType + (arg_2_1 : in LLVM_Target.LLVMTargetDataRef; + arg_2_2 : in llvm.LLVMTypeRef) + return Interfaces.C.unsigned; + + function LLVMPreferredAlignmentOfType + (arg_2_1 : in LLVM_Target.LLVMTargetDataRef; + arg_2_2 : in llvm.LLVMTypeRef) + return Interfaces.C.unsigned; + + function LLVMPreferredAlignmentOfGlobal + (arg_1 : in LLVM_Target.LLVMTargetDataRef; + GlobalVar : in llvm.LLVMValueRef) + return Interfaces.C.unsigned; + + function LLVMElementAtOffset + (arg_1 : in LLVM_Target.LLVMTargetDataRef; + StructTy : in llvm.LLVMTypeRef; + Offset : in Interfaces.C.Extensions.unsigned_long_long) + return Interfaces.C.unsigned; + + function LLVMOffsetOfElement + (arg_1 : in LLVM_Target.LLVMTargetDataRef; + StructTy : in llvm.LLVMTypeRef; + Element : in Interfaces.C.unsigned) + return Interfaces.C.Extensions.unsigned_long_long; + + procedure LLVMInvalidateStructLayout + (arg_1 : in LLVM_Target.LLVMTargetDataRef; + StructTy : in llvm.LLVMTypeRef); + + procedure LLVMDisposeTargetData + (arg_1 : in LLVM_Target.LLVMTargetDataRef); + +private + + pragma Import + (C, + LLVMInitializeAllTargets, + "Ada_LLVMInitializeAllTargets"); + pragma Import + (C, + LLVMInitializeNativeTarget, + "Ada_LLVMInitializeNativeTarget"); + pragma Import (C, LLVMCreateTargetData, "Ada_LLVMCreateTargetData"); + pragma Import (C, LLVMAddTargetData, "Ada_LLVMAddTargetData"); + pragma Import + (C, + LLVMCopyStringRepOfTargetData, + "Ada_LLVMCopyStringRepOfTargetData"); + pragma Import (C, LLVMByteOrder, "Ada_LLVMByteOrder"); + pragma Import (C, LLVMPointerSize, "Ada_LLVMPointerSize"); + pragma Import (C, LLVMIntPtrType, "Ada_LLVMIntPtrType"); + pragma Import (C, LLVMSizeOfTypeInBits, "Ada_LLVMSizeOfTypeInBits"); + pragma Import (C, LLVMStoreSizeOfType, "Ada_LLVMStoreSizeOfType"); + pragma Import (C, LLVMABISizeOfType, "Ada_LLVMABISizeOfType"); + pragma Import (C, LLVMABIAlignmentOfType, "Ada_LLVMABIAlignmentOfType"); + pragma Import + (C, + LLVMCallFrameAlignmentOfType, + "Ada_LLVMCallFrameAlignmentOfType"); + pragma Import + (C, + LLVMPreferredAlignmentOfType, + "Ada_LLVMPreferredAlignmentOfType"); + pragma Import + (C, + LLVMPreferredAlignmentOfGlobal, + "Ada_LLVMPreferredAlignmentOfGlobal"); + pragma Import (C, LLVMElementAtOffset, "Ada_LLVMElementAtOffset"); + pragma Import (C, LLVMOffsetOfElement, "Ada_LLVMOffsetOfElement"); + pragma Import + (C, + LLVMInvalidateStructLayout, + "Ada_LLVMInvalidateStructLayout"); + pragma Import (C, LLVMDisposeTargetData, "Ada_LLVMDisposeTargetData"); + +end LLVM_Target.Binding; Added: llvm/trunk/bindings/ada/target/llvm_target.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/target/llvm_target.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/target/llvm_target.ads (added) +++ llvm/trunk/bindings/ada/target/llvm_target.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,72 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with Interfaces.C.Extensions; + + +package LLVM_Target is + + -- LLVMOpaqueTargetData + -- + type LLVMOpaqueTargetData is new + Interfaces.C.Extensions.opaque_structure_def; + + type LLVMOpaqueTargetData_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_Target.LLVMOpaqueTargetData; + + type LLVMOpaqueTargetData_view is access all + LLVM_Target.LLVMOpaqueTargetData; + + -- LLVMTargetDataRef + -- + type LLVMTargetDataRef is access all LLVM_Target.LLVMOpaqueTargetData; + + type LLVMTargetDataRef_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_Target.LLVMTargetDataRef; + + type LLVMTargetDataRef_view is access all LLVM_Target.LLVMTargetDataRef; + + -- LLVMStructLayout + -- + type LLVMStructLayout is new Interfaces.C.Extensions.opaque_structure_def; + + type LLVMStructLayout_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_Target.LLVMStructLayout; + + type LLVMStructLayout_view is access all LLVM_Target.LLVMStructLayout; + + -- LLVMStructLayoutRef + -- + type LLVMStructLayoutRef is access all LLVM_Target.LLVMStructLayout; + + type LLVMStructLayoutRef_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_Target.LLVMStructLayoutRef; + + type LLVMStructLayoutRef_view is access all LLVM_Target.LLVMStructLayoutRef; + + -- TargetData + -- + type TargetData is new Interfaces.C.Extensions.incomplete_class_def; + + type TargetData_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_Target.TargetData; + + type TargetData_view is access all LLVM_Target.TargetData; + + -- LLVMByteOrdering + -- + type LLVMByteOrdering is new Interfaces.C.int; + + type LLVMByteOrdering_array is + array (Interfaces.C.size_t range <>) + of aliased LLVM_Target.LLVMByteOrdering; + + type LLVMByteOrdering_view is access all LLVM_Target.LLVMByteOrdering; + + +end LLVM_Target; Added: llvm/trunk/bindings/ada/target/llvm_target_wrap.cxx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/target/llvm_target_wrap.cxx?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/target/llvm_target_wrap.cxx (added) +++ llvm/trunk/bindings/ada/target/llvm_target_wrap.cxx Mon Aug 17 19:24:36 2009 @@ -0,0 +1,720 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.36 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#include +#include +#include +#if defined(_WIN32) || defined(__CYGWIN32__) +# define DllExport __declspec( dllexport ) +# define SWIGSTDCALL __stdcall +#else +# define DllExport +# define SWIGSTDCALL +#endif + + +#ifdef __cplusplus +# include +#endif + + + + +/* Support for throwing Ada exceptions from C/C++ */ + +typedef enum +{ + SWIG_AdaException, + SWIG_AdaOutOfMemoryException, + SWIG_AdaIndexOutOfRangeException, + SWIG_AdaDivideByZeroException, + SWIG_AdaArgumentOutOfRangeException, + SWIG_AdaNullReferenceException +} SWIG_AdaExceptionCodes; + + +typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *); + + +typedef struct +{ + SWIG_AdaExceptionCodes code; + SWIG_AdaExceptionCallback_t callback; +} + SWIG_AdaExceptions_t; + + +static +SWIG_AdaExceptions_t +SWIG_ada_exceptions[] = +{ + { SWIG_AdaException, NULL }, + { SWIG_AdaOutOfMemoryException, NULL }, + { SWIG_AdaIndexOutOfRangeException, NULL }, + { SWIG_AdaDivideByZeroException, NULL }, + { SWIG_AdaArgumentOutOfRangeException, NULL }, + { SWIG_AdaNullReferenceException, NULL } +}; + + +static +void +SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg) +{ + SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback; + if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) { + callback = SWIG_ada_exceptions[code].callback; + } + callback(msg); +} + + + +#ifdef __cplusplus +extern "C" +#endif + +DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_Target (SWIG_AdaExceptionCallback_t systemException, + SWIG_AdaExceptionCallback_t outOfMemory, + SWIG_AdaExceptionCallback_t indexOutOfRange, + SWIG_AdaExceptionCallback_t divideByZero, + SWIG_AdaExceptionCallback_t argumentOutOfRange, + SWIG_AdaExceptionCallback_t nullReference) +{ + SWIG_ada_exceptions [SWIG_AdaException].callback = systemException; + SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory; + SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange; + SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero; + SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange; + SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference; +} + + +/* Callback for returning strings to Ada without leaking memory */ + +typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *); +static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL; + + + +/* probably obsolete ... +#ifdef __cplusplus +extern "C" +#endif +DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_Target(SWIG_AdaStringHelperCallback callback) { + SWIG_ada_string_callback = callback; +} +*/ + + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else + + +#define protected public +#define private public + +#include "llvm-c/Target.h" + + + +// struct LLVMCtxt; + + +#undef protected +#undef private +#ifdef __cplusplus +extern "C" { +#endif +DllExport void SWIGSTDCALL Ada_LLVMInitializeAllTargets ( + ) +{ + LLVMInitializeAllTargets(); + + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMInitializeNativeTarget ( + ) +{ + int jresult ; + int result; + + result = (int)LLVMInitializeNativeTarget(); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMCreateTargetData ( + char * jarg1 + ) +{ + void * jresult ; + char *arg1 = (char *) 0 ; + LLVMTargetDataRef result; + + arg1 = jarg1; + + result = (LLVMTargetDataRef)LLVMCreateTargetData((char const *)arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddTargetData ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMPassManagerRef arg2 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMPassManagerRef)jarg2; + + LLVMAddTargetData(arg1,arg2); + + +} + + + +DllExport char * SWIGSTDCALL Ada_LLVMCopyStringRepOfTargetData ( + void * jarg1 + ) +{ + char * jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + char *result = 0 ; + + arg1 = (LLVMTargetDataRef)jarg1; + + result = (char *)LLVMCopyStringRepOfTargetData(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport int SWIGSTDCALL Ada_LLVMByteOrder ( + void * jarg1 + ) +{ + int jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMByteOrdering result; + + arg1 = (LLVMTargetDataRef)jarg1; + + result = (LLVMByteOrdering)LLVMByteOrder(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMPointerSize ( + void * jarg1 + ) +{ + unsigned int jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + unsigned int result; + + arg1 = (LLVMTargetDataRef)jarg1; + + result = (unsigned int)LLVMPointerSize(arg1); + jresult = result; + + + + return jresult; + +} + + + +DllExport void * SWIGSTDCALL Ada_LLVMIntPtrType ( + void * jarg1 + ) +{ + void * jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef result; + + arg1 = (LLVMTargetDataRef)jarg1; + + result = (LLVMTypeRef)LLVMIntPtrType(arg1); + jresult = (void *) result; + + + + return jresult; + +} + + + +DllExport unsigned long long SWIGSTDCALL Ada_LLVMSizeOfTypeInBits ( + void * jarg1 + , + + void * jarg2 + ) +{ + unsigned long long jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + unsigned long long result; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (unsigned long long)LLVMSizeOfTypeInBits(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned long long SWIGSTDCALL Ada_LLVMStoreSizeOfType ( + void * jarg1 + , + + void * jarg2 + ) +{ + unsigned long long jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + unsigned long long result; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (unsigned long long)LLVMStoreSizeOfType(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned long long SWIGSTDCALL Ada_LLVMABISizeOfType ( + void * jarg1 + , + + void * jarg2 + ) +{ + unsigned long long jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + unsigned long long result; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (unsigned long long)LLVMABISizeOfType(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMABIAlignmentOfType ( + void * jarg1 + , + + void * jarg2 + ) +{ + unsigned int jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + unsigned int result; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (unsigned int)LLVMABIAlignmentOfType(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMCallFrameAlignmentOfType ( + void * jarg1 + , + + void * jarg2 + ) +{ + unsigned int jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + unsigned int result; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (unsigned int)LLVMCallFrameAlignmentOfType(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMPreferredAlignmentOfType ( + void * jarg1 + , + + void * jarg2 + ) +{ + unsigned int jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + unsigned int result; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + result = (unsigned int)LLVMPreferredAlignmentOfType(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMPreferredAlignmentOfGlobal ( + void * jarg1 + , + + void * jarg2 + ) +{ + unsigned int jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMValueRef arg2 = (LLVMValueRef) 0 ; + unsigned int result; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMValueRef)jarg2; + + result = (unsigned int)LLVMPreferredAlignmentOfGlobal(arg1,arg2); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned int SWIGSTDCALL Ada_LLVMElementAtOffset ( + void * jarg1 + , + + void * jarg2 + , + + unsigned long long jarg3 + ) +{ + unsigned int jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + unsigned long long arg3 ; + unsigned int result; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + + arg3 = (unsigned long long) jarg3; + + + result = (unsigned int)LLVMElementAtOffset(arg1,arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport unsigned long long SWIGSTDCALL Ada_LLVMOffsetOfElement ( + void * jarg1 + , + + void * jarg2 + , + + unsigned int jarg3 + ) +{ + unsigned long long jresult ; + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + unsigned int arg3 ; + unsigned long long result; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + + arg3 = (unsigned int) jarg3; + + + result = (unsigned long long)LLVMOffsetOfElement(arg1,arg2,arg3); + jresult = result; + + + + return jresult; + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMInvalidateStructLayout ( + void * jarg1 + , + + void * jarg2 + ) +{ + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + LLVMTypeRef arg2 = (LLVMTypeRef) 0 ; + + arg1 = (LLVMTargetDataRef)jarg1; + + arg2 = (LLVMTypeRef)jarg2; + + LLVMInvalidateStructLayout(arg1,arg2); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMDisposeTargetData ( + void * jarg1 + ) +{ + LLVMTargetDataRef arg1 = (LLVMTargetDataRef) 0 ; + + arg1 = (LLVMTargetDataRef)jarg1; + + LLVMDisposeTargetData(arg1); + + +} + + + +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif + Added: llvm/trunk/bindings/ada/transforms/llvm_transforms-binding.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/transforms/llvm_transforms-binding.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/transforms/llvm_transforms-binding.ads (added) +++ llvm/trunk/bindings/ada/transforms/llvm_transforms-binding.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,206 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +with llvm; + + +package LLVM_Transforms.Binding is + + procedure LLVMAddArgumentPromotionPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddConstantMergePass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddDeadArgEliminationPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddDeadTypeEliminationPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddFunctionAttrsPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddFunctionInliningPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddGlobalDCEPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddGlobalOptimizerPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddIPConstantPropagationPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddLowerSetJmpPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddPruneEHPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddRaiseAllocationsPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddStripDeadPrototypesPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddStripSymbolsPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddAggressiveDCEPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddCFGSimplificationPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddCondPropagationPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddDeadStoreEliminationPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddGVNPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddIndVarSimplifyPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddInstructionCombiningPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddJumpThreadingPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddLICMPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddLoopDeletionPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddLoopIndexSplitPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddLoopRotatePass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddLoopUnrollPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddLoopUnswitchPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddMemCpyOptPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddPromoteMemoryToRegisterPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddReassociatePass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddSCCPPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddScalarReplAggregatesPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddSimplifyLibCallsPass (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddTailCallEliminationPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddConstantPropagationPass + (PM : in llvm.LLVMPassManagerRef); + + procedure LLVMAddDemoteMemoryToRegisterPass + (PM : in llvm.LLVMPassManagerRef); + +private + + pragma Import + (C, + LLVMAddArgumentPromotionPass, + "Ada_LLVMAddArgumentPromotionPass"); + pragma Import + (C, + LLVMAddConstantMergePass, + "Ada_LLVMAddConstantMergePass"); + pragma Import + (C, + LLVMAddDeadArgEliminationPass, + "Ada_LLVMAddDeadArgEliminationPass"); + pragma Import + (C, + LLVMAddDeadTypeEliminationPass, + "Ada_LLVMAddDeadTypeEliminationPass"); + pragma Import + (C, + LLVMAddFunctionAttrsPass, + "Ada_LLVMAddFunctionAttrsPass"); + pragma Import + (C, + LLVMAddFunctionInliningPass, + "Ada_LLVMAddFunctionInliningPass"); + pragma Import (C, LLVMAddGlobalDCEPass, "Ada_LLVMAddGlobalDCEPass"); + pragma Import + (C, + LLVMAddGlobalOptimizerPass, + "Ada_LLVMAddGlobalOptimizerPass"); + pragma Import + (C, + LLVMAddIPConstantPropagationPass, + "Ada_LLVMAddIPConstantPropagationPass"); + pragma Import (C, LLVMAddLowerSetJmpPass, "Ada_LLVMAddLowerSetJmpPass"); + pragma Import (C, LLVMAddPruneEHPass, "Ada_LLVMAddPruneEHPass"); + pragma Import + (C, + LLVMAddRaiseAllocationsPass, + "Ada_LLVMAddRaiseAllocationsPass"); + pragma Import + (C, + LLVMAddStripDeadPrototypesPass, + "Ada_LLVMAddStripDeadPrototypesPass"); + pragma Import (C, LLVMAddStripSymbolsPass, "Ada_LLVMAddStripSymbolsPass"); + pragma Import + (C, + LLVMAddAggressiveDCEPass, + "Ada_LLVMAddAggressiveDCEPass"); + pragma Import + (C, + LLVMAddCFGSimplificationPass, + "Ada_LLVMAddCFGSimplificationPass"); + pragma Import + (C, + LLVMAddCondPropagationPass, + "Ada_LLVMAddCondPropagationPass"); + pragma Import + (C, + LLVMAddDeadStoreEliminationPass, + "Ada_LLVMAddDeadStoreEliminationPass"); + pragma Import (C, LLVMAddGVNPass, "Ada_LLVMAddGVNPass"); + pragma Import + (C, + LLVMAddIndVarSimplifyPass, + "Ada_LLVMAddIndVarSimplifyPass"); + pragma Import + (C, + LLVMAddInstructionCombiningPass, + "Ada_LLVMAddInstructionCombiningPass"); + pragma Import + (C, + LLVMAddJumpThreadingPass, + "Ada_LLVMAddJumpThreadingPass"); + pragma Import (C, LLVMAddLICMPass, "Ada_LLVMAddLICMPass"); + pragma Import (C, LLVMAddLoopDeletionPass, "Ada_LLVMAddLoopDeletionPass"); + pragma Import + (C, + LLVMAddLoopIndexSplitPass, + "Ada_LLVMAddLoopIndexSplitPass"); + pragma Import (C, LLVMAddLoopRotatePass, "Ada_LLVMAddLoopRotatePass"); + pragma Import (C, LLVMAddLoopUnrollPass, "Ada_LLVMAddLoopUnrollPass"); + pragma Import (C, LLVMAddLoopUnswitchPass, "Ada_LLVMAddLoopUnswitchPass"); + pragma Import (C, LLVMAddMemCpyOptPass, "Ada_LLVMAddMemCpyOptPass"); + pragma Import + (C, + LLVMAddPromoteMemoryToRegisterPass, + "Ada_LLVMAddPromoteMemoryToRegisterPass"); + pragma Import (C, LLVMAddReassociatePass, "Ada_LLVMAddReassociatePass"); + pragma Import (C, LLVMAddSCCPPass, "Ada_LLVMAddSCCPPass"); + pragma Import + (C, + LLVMAddScalarReplAggregatesPass, + "Ada_LLVMAddScalarReplAggregatesPass"); + pragma Import + (C, + LLVMAddSimplifyLibCallsPass, + "Ada_LLVMAddSimplifyLibCallsPass"); + pragma Import + (C, + LLVMAddTailCallEliminationPass, + "Ada_LLVMAddTailCallEliminationPass"); + pragma Import + (C, + LLVMAddConstantPropagationPass, + "Ada_LLVMAddConstantPropagationPass"); + pragma Import + (C, + LLVMAddDemoteMemoryToRegisterPass, + "Ada_LLVMAddDemoteMemoryToRegisterPass"); + +end LLVM_Transforms.Binding; Added: llvm/trunk/bindings/ada/transforms/llvm_transforms.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/transforms/llvm_transforms.ads?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/transforms/llvm_transforms.ads (added) +++ llvm/trunk/bindings/ada/transforms/llvm_transforms.ads Mon Aug 17 19:24:36 2009 @@ -0,0 +1,6 @@ +-- This file is generated by SWIG. Do *not* modify by hand. +-- + +package LLVM_Transforms is + +end LLVM_Transforms; Added: llvm/trunk/bindings/ada/transforms/llvm_transforms_wrap.cxx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ada/transforms/llvm_transforms_wrap.cxx?rev=79295&view=auto ============================================================================== --- llvm/trunk/bindings/ada/transforms/llvm_transforms_wrap.cxx (added) +++ llvm/trunk/bindings/ada/transforms/llvm_transforms_wrap.cxx Mon Aug 17 19:24:36 2009 @@ -0,0 +1,828 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.36 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#include +#include +#include +#if defined(_WIN32) || defined(__CYGWIN32__) +# define DllExport __declspec( dllexport ) +# define SWIGSTDCALL __stdcall +#else +# define DllExport +# define SWIGSTDCALL +#endif + + +#ifdef __cplusplus +# include +#endif + + + + +/* Support for throwing Ada exceptions from C/C++ */ + +typedef enum +{ + SWIG_AdaException, + SWIG_AdaOutOfMemoryException, + SWIG_AdaIndexOutOfRangeException, + SWIG_AdaDivideByZeroException, + SWIG_AdaArgumentOutOfRangeException, + SWIG_AdaNullReferenceException +} SWIG_AdaExceptionCodes; + + +typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *); + + +typedef struct +{ + SWIG_AdaExceptionCodes code; + SWIG_AdaExceptionCallback_t callback; +} + SWIG_AdaExceptions_t; + + +static +SWIG_AdaExceptions_t +SWIG_ada_exceptions[] = +{ + { SWIG_AdaException, NULL }, + { SWIG_AdaOutOfMemoryException, NULL }, + { SWIG_AdaIndexOutOfRangeException, NULL }, + { SWIG_AdaDivideByZeroException, NULL }, + { SWIG_AdaArgumentOutOfRangeException, NULL }, + { SWIG_AdaNullReferenceException, NULL } +}; + + +static +void +SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg) +{ + SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback; + if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) { + callback = SWIG_ada_exceptions[code].callback; + } + callback(msg); +} + + + +#ifdef __cplusplus +extern "C" +#endif + +DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_Transforms (SWIG_AdaExceptionCallback_t systemException, + SWIG_AdaExceptionCallback_t outOfMemory, + SWIG_AdaExceptionCallback_t indexOutOfRange, + SWIG_AdaExceptionCallback_t divideByZero, + SWIG_AdaExceptionCallback_t argumentOutOfRange, + SWIG_AdaExceptionCallback_t nullReference) +{ + SWIG_ada_exceptions [SWIG_AdaException].callback = systemException; + SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback = outOfMemory; + SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback = indexOutOfRange; + SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback = divideByZero; + SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange; + SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback = nullReference; +} + + +/* Callback for returning strings to Ada without leaking memory */ + +typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *); +static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL; + + + +/* probably obsolete ... +#ifdef __cplusplus +extern "C" +#endif +DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_Transforms(SWIG_AdaStringHelperCallback callback) { + SWIG_ada_string_callback = callback; +} +*/ + + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else + + +#define protected public +#define private public + +#include "llvm-c/Transforms/IPO.h" +#include "llvm-c/Transforms/Scalar.h" + + + +// struct LLVMCtxt; + + +#undef protected +#undef private +#ifdef __cplusplus +extern "C" { +#endif +DllExport void SWIGSTDCALL Ada_LLVMAddArgumentPromotionPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddArgumentPromotionPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddConstantMergePass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddConstantMergePass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddDeadArgEliminationPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddDeadArgEliminationPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddDeadTypeEliminationPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddDeadTypeEliminationPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddFunctionAttrsPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddFunctionAttrsPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddFunctionInliningPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddFunctionInliningPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddGlobalDCEPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddGlobalDCEPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddGlobalOptimizerPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddGlobalOptimizerPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddIPConstantPropagationPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddIPConstantPropagationPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddLowerSetJmpPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddLowerSetJmpPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddPruneEHPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddPruneEHPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddRaiseAllocationsPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddRaiseAllocationsPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddStripDeadPrototypesPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddStripDeadPrototypesPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddStripSymbolsPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddStripSymbolsPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddAggressiveDCEPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddAggressiveDCEPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddCFGSimplificationPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddCFGSimplificationPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddCondPropagationPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddCondPropagationPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddDeadStoreEliminationPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddDeadStoreEliminationPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddGVNPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddGVNPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddIndVarSimplifyPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddIndVarSimplifyPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddInstructionCombiningPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddInstructionCombiningPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddJumpThreadingPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddJumpThreadingPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddLICMPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddLICMPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddLoopDeletionPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddLoopDeletionPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddLoopIndexSplitPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddLoopIndexSplitPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddLoopRotatePass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddLoopRotatePass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddLoopUnrollPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddLoopUnrollPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddLoopUnswitchPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddLoopUnswitchPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddMemCpyOptPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddMemCpyOptPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddPromoteMemoryToRegisterPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddPromoteMemoryToRegisterPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddReassociatePass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddReassociatePass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddSCCPPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddSCCPPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddScalarReplAggregatesPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddScalarReplAggregatesPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddSimplifyLibCallsPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddSimplifyLibCallsPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddTailCallEliminationPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddTailCallEliminationPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddConstantPropagationPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddConstantPropagationPass(arg1); + + +} + + + +DllExport void SWIGSTDCALL Ada_LLVMAddDemoteMemoryToRegisterPass ( + void * jarg1 + ) +{ + LLVMPassManagerRef arg1 = (LLVMPassManagerRef) 0 ; + + arg1 = (LLVMPassManagerRef)jarg1; + + LLVMAddDemoteMemoryToRegisterPass(arg1); + + +} + + + +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif + From asl at math.spbu.ru Mon Aug 17 19:40:33 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 18 Aug 2009 00:40:33 -0000 Subject: [llvm-commits] [llvm] r79296 - in /llvm/trunk: Makefile.config.in Makefile.rules autoconf/configure.ac lib/Transforms/Makefile test/Makefile test/lib/llvm2cpp.exp tools/Makefile tools/lto/Makefile utils/unittest/googletest/Makefile Message-ID: <200908180040.n7I0eX5a021606@zion.cs.uiuc.edu> Author: asl Date: Mon Aug 17 19:40:33 2009 New Revision: 79296 URL: http://llvm.org/viewvc/llvm-project?rev=79296&view=rev Log: The attached patches attempt to fix cross builds. For example, if you try to use i686-darwin to build for arm-eabi, you'll quickly run into several false assumptions that the target OS must be the same as the host OS. These patches split $(OS) into $(HOST_OS) and $(TARGET_OS) to help builds like "make check" and the test-suite able to cross compile. Along the way a target of *-unknown-eabi is defined as "Freestanding" so that TARGET_OS checks have something to work with. Patch by Sandeep Patel! Modified: llvm/trunk/Makefile.config.in llvm/trunk/Makefile.rules llvm/trunk/autoconf/configure.ac llvm/trunk/lib/Transforms/Makefile llvm/trunk/test/Makefile llvm/trunk/test/lib/llvm2cpp.exp llvm/trunk/tools/Makefile llvm/trunk/tools/lto/Makefile llvm/trunk/utils/unittest/googletest/Makefile Modified: llvm/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=79296&r1=79295&r2=79296&view=diff ============================================================================== --- llvm/trunk/Makefile.config.in (original) +++ llvm/trunk/Makefile.config.in Mon Aug 17 19:40:33 2009 @@ -89,8 +89,11 @@ LLVM_ON_UNIX:=@LLVM_ON_UNIX@ LLVM_ON_WIN32:=@LLVM_ON_WIN32@ -# Target operating system for which LLVM will be compiled. +# Host operating system for which LLVM will be run. OS=@OS@ +HOST_OS=@HOST_OS@ +# Target operating system for which LLVM will compile for. +TARGET_OS=@TARGET_OS@ # Target hardware architecture ARCH=@ARCH@ @@ -128,6 +131,7 @@ # Path to the library archiver program. AR_PATH = @AR@ +AR = @AR@ # Path to the nm program NM_PATH = @NM@ Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=79296&r1=79295&r2=79296&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Mon Aug 17 19:40:33 2009 @@ -287,7 +287,7 @@ # OPTIMIZE_OPTION - The optimization level option we want to build LLVM with # this can be overridden on the make command line. ifndef OPTIMIZE_OPTION - ifneq ($(OS),MingW) + ifneq ($(HOST_OS),MingW) OPTIMIZE_OPTION := -O3 else OPTIMIZE_OPTION := -O2 @@ -297,8 +297,8 @@ ifeq ($(ENABLE_OPTIMIZED),1) BuildMode := Release # Don't use -fomit-frame-pointer on Darwin or FreeBSD. - ifneq ($(OS),FreeBSD) - ifneq ($(OS),Darwin) + ifneq ($(HOST_OS),FreeBSD) + ifneq ($(HOST_OS),Darwin) OmitFramePointer := -fomit-frame-pointer endif endif @@ -306,7 +306,7 @@ # Darwin requires -fstrict-aliasing to be explicitly enabled. # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues # with -fstrict-aliasing and ipa-type-escape radr://6756684 - #ifeq ($(OS),Darwin) + #ifeq ($(HOST_OS),Darwin) # EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing #endif CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) @@ -379,10 +379,10 @@ endif ifeq ($(ENABLE_PIC),1) - ifeq ($(OS), $(filter $(OS), Cygwin MingW)) + ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) # Nothing. Win32 defaults to PIC and warns when given -fPIC else - ifeq ($(OS),Darwin) + ifeq ($(HOST_OS),Darwin) # Common symbols not allowed in dylib files CXX.Flags += -fno-common C.Flags += -fno-common @@ -393,7 +393,7 @@ endif endif else - ifeq ($(OS),Darwin) + ifeq ($(HOST_OS),Darwin) CXX.Flags += -mdynamic-no-pic C.Flags += -mdynamic-no-pic endif @@ -420,7 +420,7 @@ LD.Flags += -Wl,--no-relax endif -ifeq ($(OS),MingW) +ifeq ($(HOST_OS),MingW) ifeq ($(LLVM_CROSS_COMPILING),1) # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016 ifdef TOOLNAME @@ -502,7 +502,7 @@ # Adjust to user's request #-------------------------------------------------------------------- -ifeq ($(OS),Darwin) +ifeq ($(HOST_OS),Darwin) DARWIN_VERSION := `sw_vers -productVersion` # Strip a number like 10.4.7 to 10.4 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/') @@ -511,9 +511,8 @@ SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress \ -dynamiclib -mmacosx-version-min=$(DARWIN_VERSION) - TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION) else - ifeq ($(OS),Cygwin) + ifeq ($(HOST_OS),Cygwin) SharedLinkOptions=-shared -nostdlib -Wl,--export-all-symbols \ -Wl,--enable-auto-import -Wl,--enable-auto-image-base else @@ -521,6 +520,10 @@ endif endif +ifeq ($(TARGET_OS),Darwin) + TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION) +endif + # Adjust LD.Flags depending on the kind of library that is to be built. Note # that if LOADABLE_MODULE is specified then the resulting shared library can # be opened with dlopen. @@ -558,7 +561,7 @@ endif # Adjust linker flags for building an executable -ifneq ($(OS),Darwin) +ifneq ($(HOST_OS),Darwin) ifneq ($(DARWIN_MAJVERS),4) ifdef TOOLNAME ifdef EXAMPLE_TOOL @@ -580,7 +583,7 @@ CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \ $(EXTRA_OPTIONS) -ifeq ($(OS),HP-UX) +ifeq ($(HOST_OS),HP-UX) CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE endif @@ -608,7 +611,7 @@ # Building universal cannot compute dependencies automatically. DISABLE_AUTO_DEPENDENCIES=1 else - ifeq ($(OS),Darwin) + ifeq ($(TARGET_OS),Darwin) ifeq ($(ARCH),x86_64) TargetCommonOpts = -m64 else @@ -619,7 +622,7 @@ endif endif -ifeq ($(OS),SunOS) +ifeq ($(HOST_OS),SunOS) CPP.BaseFlags += -include llvm/System/Solaris.h endif @@ -1172,7 +1175,7 @@ # not exporting all of the weak symbols from the binary. This reduces dyld # startup time by 4x on darwin in some cases. ifdef TOOL_NO_EXPORTS -ifeq ($(OS),Darwin) +ifeq ($(HOST_OS),Darwin) # Tiger tools don't support this. ifneq ($(DARWIN_MAJVERS),4) @@ -1180,7 +1183,7 @@ endif endif -ifeq ($(OS), $(filter $(OS), Linux NetBSD FreeBSD)) +ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD)) LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map endif endif @@ -1234,7 +1237,7 @@ ############################################################################### # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX" -ifeq ($(OS),HP-UX) +ifeq ($(HOST_OS),HP-UX) DISABLE_AUTO_DEPENDENCIES=1 endif Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=79296&r1=79295&r2=79296&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Mon Aug 17 19:40:33 2009 @@ -175,6 +175,16 @@ llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_os_type="MingW" llvm_cv_platform_type="Win32" ;; + *-unknown-eabi*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Freestanding" + llvm_cv_platform_type="Unix" ;; + *-unknown-elf*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Freestanding" + llvm_cv_platform_type="Unix" ;; *) llvm_cv_link_all_option="" llvm_cv_no_link_all_option="" @@ -182,6 +192,43 @@ llvm_cv_platform_type="Unknown" ;; esac]) +AC_CACHE_CHECK([type of operating system we're going to target], + [llvm_cv_target_os_type], +[case $target in + *-*-aix*) + llvm_cv_target_os_type="AIX" ;; + *-*-irix*) + llvm_cv_target_os_type="IRIX" ;; + *-*-cygwin*) + llvm_cv_target_os_type="Cygwin" ;; + *-*-darwin*) + llvm_cv_target_os_type="Darwin" ;; + *-*-freebsd*) + llvm_cv_target_os_type="FreeBSD" ;; + *-*-openbsd*) + llvm_cv_target_os_type="OpenBSD" ;; + *-*-netbsd*) + llvm_cv_target_os_type="NetBSD" ;; + *-*-dragonfly*) + llvm_cv_target_os_type="DragonFly" ;; + *-*-hpux*) + llvm_cv_target_os_type="HP-UX" ;; + *-*-interix*) + llvm_cv_target_os_type="Interix" ;; + *-*-linux*) + llvm_cv_target_os_type="Linux" ;; + *-*-solaris*) + llvm_cv_target_os_type="SunOS" ;; + *-*-win32*) + llvm_cv_target_os_type="Win32" ;; + *-*-mingw*) + llvm_cv_target_os_type="MingW" ;; + *-unknown-eabi*) + llvm_cv_target_os_type="Freestanding" ;; + *) + llvm_cv_target_os_type="Unknown" ;; +esac]) + dnl Make sure we aren't attempting to configure for an unknown system if test "$llvm_cv_os_type" = "Unknown" ; then AC_MSG_ERROR([Operating system is unknown, configure can't continue]) @@ -190,6 +237,8 @@ dnl Set the "OS" Makefile variable based on the platform type so the dnl makefile can configure itself to specific build hosts AC_SUBST(OS,$llvm_cv_os_type) +AC_SUBST(HOST_OS,$llvm_cv_os_type) +AC_SUBST(TARGET_OS,$llvm_cv_target_os_type) dnl Set the LINKALL and NOLINKALL Makefile variables based on the platform AC_SUBST(LINKALL,$llvm_cv_link_all_option) Modified: llvm/trunk/lib/Transforms/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Makefile?rev=79296&r1=79295&r2=79296&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Makefile (original) +++ llvm/trunk/lib/Transforms/Makefile Mon Aug 17 19:40:33 2009 @@ -13,7 +13,7 @@ include $(LEVEL)/Makefile.config # No support for plugins on windows targets -ifeq ($(OS), $(filter $(OS), Cygwin MingW)) +ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) PARALLEL_DIRS := $(filter-out Hello, $(PARALLEL_DIRS)) endif Modified: llvm/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=79296&r1=79295&r2=79296&view=diff ============================================================================== --- llvm/trunk/test/Makefile (original) +++ llvm/trunk/test/Makefile Mon Aug 17 19:40:33 2009 @@ -53,7 +53,7 @@ endif # Both AuroraUX & Solaris do not have the -m flag for ulimit -ifeq ($(OS),SunOS) +ifeq ($(HOST_OS),SunOS) ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ; else ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 512000 ; @@ -93,7 +93,7 @@ $(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print` # dsymutil is used on the Darwin to manipulate DWARF debugging information. -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) DSYMUTIL=dsymutil else DSYMUTIL=true Modified: llvm/trunk/test/lib/llvm2cpp.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lib/llvm2cpp.exp?rev=79296&r1=79295&r2=79296&view=diff ============================================================================== --- llvm/trunk/test/lib/llvm2cpp.exp (original) +++ llvm/trunk/test/lib/llvm2cpp.exp Mon Aug 17 19:40:33 2009 @@ -73,7 +73,7 @@ } set retval [ catch { - exec -keepnewline gcc -g -D__STDC_LIMIT_MACROS -o $executable $generated -I$srcroot/include -I$objroot/include -L$llvmlibsdir -lLLVMCore -lLLVMSupport -lLLVMbzip2 -lLLVMSystem -lstdc++ } msg ] + exec -keepnewline gcc -g -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -o $executable $generated -I$srcroot/include -I$objroot/include -L$llvmlibsdir -lLLVMCore -lLLVMSupport -lLLVMSystem -lstdc++ } msg ] if { $retval != 0 } { fail "$test: gcc returned $retval\n$msg" continue Modified: llvm/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/Makefile?rev=79296&r1=79295&r2=79296&view=diff ============================================================================== --- llvm/trunk/tools/Makefile (original) +++ llvm/trunk/tools/Makefile Mon Aug 17 19:40:33 2009 @@ -39,7 +39,7 @@ endif # No support for lto / gold on windows targets -ifeq ($(OS), $(filter $(OS), Cygwin MingW)) +ifeq ($(TARGET_OS), $(filter $(TARGET_OS), Cygwin MingW)) DIRS := $(filter-out lto gold, $(DIRS)) endif Modified: llvm/trunk/tools/lto/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/Makefile?rev=79296&r1=79295&r2=79296&view=diff ============================================================================== --- llvm/trunk/tools/lto/Makefile (original) +++ llvm/trunk/tools/lto/Makefile Mon Aug 17 19:40:33 2009 @@ -22,7 +22,7 @@ include $(LEVEL)/Makefile.common -ifeq ($(OS),Darwin) +ifeq ($(HOST_OS),Darwin) # set dylib internal version number to llvmCore submission number ifdef LLVM_SUBMIT_VERSION LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \ Modified: llvm/trunk/utils/unittest/googletest/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/googletest/Makefile?rev=79296&r1=79295&r2=79296&view=diff ============================================================================== --- llvm/trunk/utils/unittest/googletest/Makefile (original) +++ llvm/trunk/utils/unittest/googletest/Makefile Mon Aug 17 19:40:33 2009 @@ -18,7 +18,7 @@ CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include CPP.Flags += $(NO_MISSING_FIELD_INITIALIZERS) $(NO_VARIADIC_MACROS) -ifeq ($(OS),MingW) +ifeq ($(HOST_OS),MingW) CPP.Flags += -DGTEST_OS_WINDOWS=1 endif From asl at math.spbu.ru Mon Aug 17 19:40:51 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 18 Aug 2009 00:40:51 -0000 Subject: [llvm-commits] [llvm] r79297 - /llvm/trunk/configure Message-ID: <200908180040.n7I0eq2w021660@zion.cs.uiuc.edu> Author: asl Date: Mon Aug 17 19:40:51 2009 New Revision: 79297 URL: http://llvm.org/viewvc/llvm-project?rev=79297&view=rev Log: Regenerate Modified: llvm/trunk/configure Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=79297&r1=79296&r2=79297&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Mon Aug 17 19:40:51 2009 @@ -808,6 +808,8 @@ target_vendor target_os OS +HOST_OS +TARGET_OS LINKALL NOLINKALL LLVM_ON_UNIX @@ -2341,6 +2343,16 @@ llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_os_type="MingW" llvm_cv_platform_type="Win32" ;; + *-unknown-eabi*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Freestanding" + llvm_cv_platform_type="Unix" ;; + *-unknown-elf*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Freestanding" + llvm_cv_platform_type="Unix" ;; *) llvm_cv_link_all_option="" llvm_cv_no_link_all_option="" @@ -2351,6 +2363,49 @@ { echo "$as_me:$LINENO: result: $llvm_cv_os_type" >&5 echo "${ECHO_T}$llvm_cv_os_type" >&6; } +{ echo "$as_me:$LINENO: checking type of operating system we're going to target" >&5 +echo $ECHO_N "checking type of operating system we're going to target... $ECHO_C" >&6; } +if test "${llvm_cv_target_os_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $target in + *-*-aix*) + llvm_cv_target_os_type="AIX" ;; + *-*-irix*) + llvm_cv_target_os_type="IRIX" ;; + *-*-cygwin*) + llvm_cv_target_os_type="Cygwin" ;; + *-*-darwin*) + llvm_cv_target_os_type="Darwin" ;; + *-*-freebsd*) + llvm_cv_target_os_type="FreeBSD" ;; + *-*-openbsd*) + llvm_cv_target_os_type="OpenBSD" ;; + *-*-netbsd*) + llvm_cv_target_os_type="NetBSD" ;; + *-*-dragonfly*) + llvm_cv_target_os_type="DragonFly" ;; + *-*-hpux*) + llvm_cv_target_os_type="HP-UX" ;; + *-*-interix*) + llvm_cv_target_os_type="Interix" ;; + *-*-linux*) + llvm_cv_target_os_type="Linux" ;; + *-*-solaris*) + llvm_cv_target_os_type="SunOS" ;; + *-*-win32*) + llvm_cv_target_os_type="Win32" ;; + *-*-mingw*) + llvm_cv_target_os_type="MingW" ;; + *-unknown-eabi*) + llvm_cv_target_os_type="Freestanding" ;; + *) + llvm_cv_target_os_type="Unknown" ;; +esac +fi +{ echo "$as_me:$LINENO: result: $llvm_cv_target_os_type" >&5 +echo "${ECHO_T}$llvm_cv_target_os_type" >&6; } + if test "$llvm_cv_os_type" = "Unknown" ; then { { echo "$as_me:$LINENO: error: Operating system is unknown, configure can't continue" >&5 echo "$as_me: error: Operating system is unknown, configure can't continue" >&2;} @@ -2359,6 +2414,10 @@ OS=$llvm_cv_os_type +HOST_OS=$llvm_cv_os_type + +TARGET_OS=$llvm_cv_target_os_type + LINKALL=$llvm_cv_link_all_option @@ -10929,7 +10988,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 13135 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14791,11 +14850,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:14794: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14853: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14798: \$? = $ac_status" >&5 + echo "$as_me:14857: \$? = $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. @@ -15059,11 +15118,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:15062: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15121: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15066: \$? = $ac_status" >&5 + echo "$as_me:15125: \$? = $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. @@ -15163,11 +15222,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:15166: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15225: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15170: \$? = $ac_status" >&5 + echo "$as_me:15229: \$? = $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 @@ -17615,7 +17674,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:20145: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:20090: \$? = $ac_status" >&5 + echo "$as_me:20149: \$? = $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. @@ -20187,11 +20246,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:20190: $lt_compile\"" >&5) + (eval echo "\"\$as_me:20249: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:20194: \$? = $ac_status" >&5 + echo "$as_me:20253: \$? = $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 @@ -21757,11 +21816,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:21760: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21819: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21764: \$? = $ac_status" >&5 + echo "$as_me:21823: \$? = $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. @@ -21861,11 +21920,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:21864: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21923: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21868: \$? = $ac_status" >&5 + echo "$as_me:21927: \$? = $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 @@ -24096,11 +24155,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:24099: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24158: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:24103: \$? = $ac_status" >&5 + echo "$as_me:24162: \$? = $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. @@ -24364,11 +24423,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:24367: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24426: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:24371: \$? = $ac_status" >&5 + echo "$as_me:24430: \$? = $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. @@ -24468,11 +24527,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:24471: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24530: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:24475: \$? = $ac_status" >&5 + echo "$as_me:24534: \$? = $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 @@ -36019,6 +36078,8 @@ target_vendor!$target_vendor$ac_delim target_os!$target_os$ac_delim OS!$OS$ac_delim +HOST_OS!$HOST_OS$ac_delim +TARGET_OS!$TARGET_OS$ac_delim LINKALL!$LINKALL$ac_delim NOLINKALL!$NOLINKALL$ac_delim LLVM_ON_UNIX!$LLVM_ON_UNIX$ac_delim @@ -36062,8 +36123,6 @@ ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim ENABLE_LLVMC_DYNAMIC_PLUGINS!$ENABLE_LLVMC_DYNAMIC_PLUGINS$ac_delim CXX!$CXX$ac_delim -CXXFLAGS!$CXXFLAGS$ac_delim -ac_ct_CXX!$ac_ct_CXX$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -36105,6 +36164,8 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +CXXFLAGS!$CXXFLAGS$ac_delim +ac_ct_CXX!$ac_ct_CXX$ac_delim NM!$NM$ac_delim ifGNUmake!$ifGNUmake$ac_delim LN_S!$LN_S$ac_delim @@ -36197,7 +36258,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 90; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 92; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 From gohman at apple.com Mon Aug 17 19:48:13 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 00:48:13 -0000 Subject: [llvm-commits] [llvm] r79298 - /llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Message-ID: <200908180048.n7I0mD2c022536@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 17 19:48:13 2009 New Revision: 79298 URL: http://llvm.org/viewvc/llvm-project?rev=79298&view=rev Log: Make TargetData optional in SimplifyLibCalls. Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=79298&r1=79297&r2=79298&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Mon Aug 17 19:48:13 2009 @@ -63,9 +63,9 @@ virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) =0; - Value *OptimizeCall(CallInst *CI, const TargetData &TD, IRBuilder<> &B) { + Value *OptimizeCall(CallInst *CI, const TargetData *TD, IRBuilder<> &B) { Caller = CI->getParent()->getParent(); - this->TD = &TD; + this->TD = TD; if (CI->getCalledFunction()) Context = &CI->getCalledFunction()->getContext(); return CallOptimizer(CI->getCalledFunction(), CI, B); @@ -573,7 +573,10 @@ // Handle the simple, do-nothing case: strcat(x, "") -> x if (Len == 0) return Dst; - + + // These optimizations require TargetData. + if (!TD) return 0; + EmitStrLenMemCpy(Src, Dst, Len, B); return Dst; } @@ -630,6 +633,9 @@ // strncat(x, c, 0) -> x if (SrcLen == 0 || Len == 0) return Dst; + // These optimizations require TargetData. + if (!TD) return 0; + // We don't optimize this case if (Len < SrcLen) return 0; @@ -658,6 +664,9 @@ // of the input string and turn this into memchr. ConstantInt *CharC = dyn_cast(CI->getOperand(2)); if (CharC == 0) { + // These optimizations require TargetData. + if (!TD) return 0; + uint64_t Len = GetStringLength(SrcStr); if (Len == 0 || FT->getParamType(1) != Type::getInt32Ty(*Context)) // memchr needs i32. return 0; @@ -728,6 +737,9 @@ uint64_t Len1 = GetStringLength(Str1P); uint64_t Len2 = GetStringLength(Str2P); if (Len1 && Len2) { + // These optimizations require TargetData. + if (!TD) return 0; + return EmitMemCmp(Str1P, Str2P, ConstantInt::get(TD->getIntPtrType(*Context), std::min(Len1, Len2)), B); @@ -799,6 +811,9 @@ if (Dst == Src) // strcpy(x,x) -> x return Src; + // These optimizations require TargetData. + if (!TD) return 0; + // See if we can get the length of the input string. uint64_t Len = GetStringLength(Src); if (Len == 0) return 0; @@ -846,6 +861,9 @@ if (Len == 0) return Dst; // strncpy(x, y, 0) -> x + // These optimizations require TargetData. + if (!TD) return 0; + // Let strncpy handle the zero padding if (Len > SrcLen+1) return 0; @@ -957,6 +975,9 @@ struct VISIBILITY_HIDDEN MemCpyOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { + // These optimizations require TargetData. + if (!TD) return 0; + const FunctionType *FT = Callee->getFunctionType(); if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) || !isa(FT->getParamType(0)) || @@ -975,6 +996,9 @@ struct VISIBILITY_HIDDEN MemMoveOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { + // These optimizations require TargetData. + if (!TD) return 0; + const FunctionType *FT = Callee->getFunctionType(); if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) || !isa(FT->getParamType(0)) || @@ -1002,6 +1026,9 @@ struct VISIBILITY_HIDDEN MemSetOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { + // These optimizations require TargetData. + if (!TD) return 0; + const FunctionType *FT = Callee->getFunctionType(); if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) || !isa(FT->getParamType(0)) || @@ -1352,7 +1379,10 @@ for (unsigned i = 0, e = FormatStr.size(); i != e; ++i) if (FormatStr[i] == '%') return 0; // we found a format specifier, bail out. - + + // These optimizations require TargetData. + if (!TD) return 0; + // sprintf(str, fmt) -> llvm.memcpy(str, fmt, strlen(fmt)+1, 1) EmitMemCpy(CI->getOperand(1), CI->getOperand(2), // Copy the nul byte. ConstantInt::get(TD->getIntPtrType(*Context), FormatStr.size()+1),1,B); @@ -1378,6 +1408,9 @@ } if (FormatStr[1] == 's') { + // These optimizations require TargetData. + if (!TD) return 0; + // sprintf(dest, "%s", str) -> llvm.memcpy(dest, str, strlen(str)+1, 1) if (!isa(CI->getOperand(3)->getType())) return 0; @@ -1434,6 +1467,9 @@ struct VISIBILITY_HIDDEN FPutsOpt : public LibCallOptimization { virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { + // These optimizations require TargetData. + if (!TD) return 0; + // Require two pointers. Also, we can't optimize if return value is used. const FunctionType *FT = Callee->getFunctionType(); if (FT->getNumParams() != 2 || !isa(FT->getParamType(0)) || @@ -1473,7 +1509,10 @@ for (unsigned i = 0, e = FormatStr.size(); i != e; ++i) if (FormatStr[i] == '%') // Could handle %% -> % if we cared. return 0; // We found a format specifier. - + + // These optimizations require TargetData. + if (!TD) return 0; + EmitFWrite(CI->getOperand(2), ConstantInt::get(TD->getIntPtrType(*Context), FormatStr.size()), CI->getOperand(1), B); @@ -1547,7 +1586,6 @@ bool doInitialization(Module &M); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); } }; char SimplifyLibCalls::ID = 0; @@ -1648,7 +1686,7 @@ if (Optimizations.empty()) InitOptimizations(); - const TargetData &TD = getAnalysis(); + const TargetData *TD = getAnalysisIfAvailable(); IRBuilder<> Builder(F.getContext()); From evan.cheng at apple.com Mon Aug 17 19:56:17 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 18 Aug 2009 00:56:17 -0000 Subject: [llvm-commits] [llvm] r79299 - /llvm/trunk/utils/buildit/build_llvm Message-ID: <200908180056.n7I0uHmU023538@zion.cs.uiuc.edu> Author: evancheng Date: Mon Aug 17 19:56:17 2009 New Revision: 79299 URL: http://llvm.org/viewvc/llvm-project?rev=79299&view=rev Log: Even more Apple style build horribleness. Modified: llvm/trunk/utils/buildit/build_llvm Modified: llvm/trunk/utils/buildit/build_llvm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=79299&r1=79298&r2=79299&view=diff ============================================================================== --- llvm/trunk/utils/buildit/build_llvm (original) +++ llvm/trunk/utils/buildit/build_llvm Mon Aug 17 19:56:17 2009 @@ -62,10 +62,19 @@ export CXX=/Developer/usr/bin/llvm-g++ if [ ! -x $CXX ] ; then unset CXX ; fi -DT_HOME=$DEST_DIR/Developer/usr -DEST_ROOT="/Developer$DEST_ROOT" +if [ "x$RC_ProjectName" = "xllvmCore_Embedded" ]; then + DT_HOME=$DEST_DIR/Developer/Platforms/iPhoneOS.platform/Developer/usr + DEST_ROOT="/Developer/Platforms/iPhoneOS.platform/Developer$DEST_ROOT" +else + DT_HOME=$DEST_DIR/Developer/usr + DEST_ROOT="/Developer$DEST_ROOT" +fi if [ "x$DEVELOPER_BIN" != "x" ]; then - DT_HOME=$DEST_DIR/$DEVELOPER_DIR/usr + if [ "x$RC_ProjectName" = "xllvmCore_Embedded" ]; then + DT_HOME=$DEST_DIR/Developer/Platforms/iPhoneOS.platform/$DEVELOPER_DIR/usr + else + DT_HOME=$DEST_DIR/$DEVELOPER_DIR/usr + fi DEST_ROOT="/$DEVELOPER_DIR$DEST_ROOT" fi From evan.cheng at apple.com Mon Aug 17 19:58:53 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 18 Aug 2009 00:58:53 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79300 - /llvm-gcc-4.2/trunk/build_gcc Message-ID: <200908180058.n7I0wrjc023884@zion.cs.uiuc.edu> Author: evancheng Date: Mon Aug 17 19:58:53 2009 New Revision: 79300 URL: http://llvm.org/viewvc/llvm-project?rev=79300&view=rev Log: Even more Apple style build horribleness. Modified: llvm-gcc-4.2/trunk/build_gcc Modified: llvm-gcc-4.2/trunk/build_gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=79300&r1=79299&r2=79300&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/build_gcc (original) +++ llvm-gcc-4.2/trunk/build_gcc Mon Aug 17 19:58:53 2009 @@ -86,9 +86,6 @@ # The eleventh parameter is the subversion number of the submission, e.g. 03. LLVM_SUBMIT_SUBVERSION="${11}" -# LLVM_BIN_DIR - This is the place where llvm-gcc/llvm-g++ symlinks get installed. -LLVM_BIN_DIR=$DEST_ROOT/../bin - # LLVM LOCAL end # The current working directory is where the build will happen. @@ -137,6 +134,7 @@ # iPhoneOS platform directory. if [ "x$RC_ProjectName" = "xllvmgcc42_Embedded" ]; then LLVMCORE_PATH="${ARM_PLATFORM}${LLVMCORE_PATH}" + DEST_ROOT="${ARM_PLATFORM}${DEST_ROOT}" fi else ARM_TOOLROOT=/ @@ -600,11 +598,17 @@ # LLVM LOCAL begin # Compress manpages gzip -f $MDIR/* -mkdir -p $DEST_DIR/Developer/usr/share/man/man1 -cp $ORIG_SRC_DIR/gcc/doc/llvm-gcc.1 $DEST_DIR/Developer/usr/share/man/man1/llvm-gcc.1 -cp $ORIG_SRC_DIR/gcc/doc/llvm-gcc.1 $DEST_DIR/Developer/usr/share/man/man1/llvm-g++.1 -gzip -f $DEST_DIR/Developer/usr/share/man/man1/llvm-gcc.1 -gzip -f $DEST_DIR/Developer/usr/share/man/man1/llvm-g++.1 + +if [ "x$RC_ProjectName" = "xllvmgcc42_Embedded" ]; then +MAN1_DIR=${DEST_DIR}${ARM_PLATFORM}/Developer/usr/share/man/man1 +else +MAN1_DIR=$DEST_DIR/Developer/usr/share/man/man1 +fi +mkdir -p ${MAN1_DIR} +cp $ORIG_SRC_DIR/gcc/doc/llvm-gcc.1 ${MAN1_DIR}/llvm-gcc.1 +cp $ORIG_SRC_DIR/gcc/doc/llvm-gcc.1 ${MAN1_DIR}/llvm-g++.1 +gzip -f ${MAN1_DIR}/llvm-gcc.1 +gzip -f ${MAN1_DIR}/llvm-g++.1 # LLVM LOCAL end # Build driver-driver using fully-named drivers @@ -690,6 +694,10 @@ # LLVM LOCAL begin # Set up the llvm-gcc/llvm-g++ symlinks. + +# LLVM_BIN_DIR - This is the place where llvm-gcc/llvm-g++ symlinks get installed. +LLVM_BIN_DIR=$DEST_ROOT/../bin + mkdir -p $DEST_DIR$LLVM_BIN_DIR cd $DEST_DIR$LLVM_BIN_DIR ln -s -f ../llvm-gcc-$MAJ_VERS/bin/llvm-gcc-$MAJ_VERS llvm-gcc-$MAJ_VERS || exit 1 @@ -715,11 +723,20 @@ ln -s ../../libllvmgcc.dylib done -if [ "x$LLVM_BUILT_ROOTS" == "x" ]; then - mkdir -p $DEST_DIR/usr/bin - cd $DEST_DIR/usr/bin - ln -s /Developer/usr/bin/llvm-gcc-4.2 llvm-gcc-4.2 - ln -s /Developer/usr/bin/llvm-g++-4.2 llvm-g++-4.2 +if [ "x$RC_ProjectName" == "xllvmgcc42_Embedded" ]; then + if [ "x$LLVM_BUILT_ROOTS" == "x" ]; then + mkdir -p $DEST_DIR${ARM_PLATFORM}/usr/bin + cd $DEST_DIR${ARM_PLATFORM}/usr/bin + ln -s ${ARM_PLATFORM}/Developer/usr/bin/llvm-gcc-4.2 llvm-gcc-4.2 + ln -s ${ARM_PLATFORM}/Developer/usr/bin/llvm-g++-4.2 llvm-g++-4.2 + fi +else + if [ "x$LLVM_BUILT_ROOTS" == "x" ]; then + mkdir -p $DEST_DIR/usr/bin + cd $DEST_DIR/usr/bin + ln -s /Developer/usr/bin/llvm-gcc-4.2 llvm-gcc-4.2 + ln -s /Developer/usr/bin/llvm-g++-4.2 llvm-g++-4.2 + fi fi # LLVM LOCAL end From isanbard at gmail.com Mon Aug 17 20:12:55 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 18 Aug 2009 01:12:55 -0000 Subject: [llvm-commits] [llvm] r79304 - /llvm/tags/Apple/llvmCore-2302/ Message-ID: <200908180112.n7I1CtF8025645@zion.cs.uiuc.edu> Author: void Date: Mon Aug 17 20:12:55 2009 New Revision: 79304 URL: http://llvm.org/viewvc/llvm-project?rev=79304&view=rev Log: Creating llvmCore-2302 from Leela. Added: llvm/tags/Apple/llvmCore-2302/ - copied from r79303, llvm/branches/Apple/Leela/ From isanbard at gmail.com Mon Aug 17 20:13:04 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 18 Aug 2009 01:13:04 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79305 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2302/ Message-ID: <200908180113.n7I1D4D2025678@zion.cs.uiuc.edu> Author: void Date: Mon Aug 17 20:13:04 2009 New Revision: 79305 URL: http://llvm.org/viewvc/llvm-project?rev=79305&view=rev Log: Creating llvmgcc42-2302 from Leela. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2302/ - copied from r79304, llvm-gcc-4.2/branches/Apple/Leela/ From gohman at apple.com Mon Aug 17 20:17:52 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 01:17:52 -0000 Subject: [llvm-commits] [llvm] r79306 - /llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Message-ID: <200908180117.n7I1Hq66026281@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 17 20:17:52 2009 New Revision: 79306 URL: http://llvm.org/viewvc/llvm-project?rev=79306&view=rev Log: Make TargetData optional in MemCpyOptimizer. Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=79306&r1=79305&r2=79306&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Aug 17 20:17:52 2009 @@ -309,10 +309,8 @@ AU.addRequired(); AU.addRequired(); AU.addRequired(); - AU.addRequired(); AU.addPreserved(); AU.addPreserved(); - AU.addPreserved(); } // Helper fuctions @@ -350,7 +348,8 @@ if (!ByteVal) return false; - TargetData &TD = getAnalysis(); + TargetData *TD = getAnalysisIfAvailable(); + if (!TD) return false; AliasAnalysis &AA = getAnalysis(); Module *M = SI->getParent()->getParent()->getParent(); @@ -358,7 +357,7 @@ // all subsequent stores of the same value to offset from the same pointer. // Join these together into ranges, so we can decide whether contiguous blocks // are stored. - MemsetRanges Ranges(TD); + MemsetRanges Ranges(*TD); Value *StartPtr = SI->getPointerOperand(); @@ -392,7 +391,7 @@ // Check to see if this store is to a constant offset from the start ptr. int64_t Offset; - if (!IsPointerOffset(StartPtr, NextStore->getPointerOperand(), Offset, TD)) + if (!IsPointerOffset(StartPtr, NextStore->getPointerOperand(), Offset, *TD)) break; Ranges.addStore(Offset, NextStore); @@ -421,7 +420,7 @@ if (Range.TheStores.size() == 1) continue; // If it is profitable to lower this range to memset, do so now. - if (!Range.isProfitableToUseMemset(TD)) + if (!Range.isProfitableToUseMemset(*TD)) continue; // Otherwise, we do want to transform this! Create a new memset. We put @@ -511,13 +510,14 @@ return false; // Check that all of src is copied to dest. - TargetData& TD = getAnalysis(); + TargetData* TD = getAnalysisIfAvailable(); + if (!TD) return false; ConstantInt* srcArraySize = dyn_cast(srcAlloca->getArraySize()); if (!srcArraySize) return false; - uint64_t srcSize = TD.getTypeAllocSize(srcAlloca->getAllocatedType()) * + uint64_t srcSize = TD->getTypeAllocSize(srcAlloca->getAllocatedType()) * srcArraySize->getZExtValue(); if (cpyLength->getZExtValue() < srcSize) @@ -532,7 +532,7 @@ if (!destArraySize) return false; - uint64_t destSize = TD.getTypeAllocSize(A->getAllocatedType()) * + uint64_t destSize = TD->getTypeAllocSize(A->getAllocatedType()) * destArraySize->getZExtValue(); if (destSize < srcSize) @@ -544,7 +544,7 @@ return false; const Type* StructTy = cast(A->getType())->getElementType(); - uint64_t destSize = TD.getTypeAllocSize(StructTy); + uint64_t destSize = TD->getTypeAllocSize(StructTy); if (destSize < srcSize) return false; From daniel at zuster.org Mon Aug 17 22:03:27 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 03:03:27 -0000 Subject: [llvm-commits] [llvm] r79307 - /llvm/trunk/include/llvm-c/Target.h Message-ID: <200908180303.n7I33RfC006904@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 17 22:03:27 2009 New Revision: 79307 URL: http://llvm.org/viewvc/llvm-project?rev=79307&view=rev Log: Add LLVMInitializeAllTargetInfos for C api, and update LLVMInitializeNativeTarget to initialize target info. - Patch by Jose Fonseca. Modified: llvm/trunk/include/llvm-c/Target.h Modified: llvm/trunk/include/llvm-c/Target.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=79307&r1=79306&r2=79307&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Target.h (original) +++ llvm/trunk/include/llvm-c/Target.h Mon Aug 17 22:03:27 2009 @@ -33,9 +33,20 @@ typedef struct LLVMStructLayout *LLVMStructLayoutRef; /* Declare all of the target-initialization functions that are available. */ +#define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##TargetInfo(); +#include "llvm/Config/Targets.def" + #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target(); #include "llvm/Config/Targets.def" +/** LLVMInitializeAllTargetInfos - The main program should call this function if + it wants access to all available targets that LLVM is configured to + support. */ +static inline void LLVMInitializeAllTargetInfos() { +#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo(); +#include "llvm/Config/Targets.def" +} + /** LLVMInitializeAllTargets - The main program should call this function if it wants to link in all available targets that LLVM is configured to support. */ @@ -50,7 +61,9 @@ static inline int LLVMInitializeNativeTarget() { /* If we have a native target, initialize it to ensure it is linked in. */ #ifdef LLVM_NATIVE_ARCH -#define DoInit2(TARG) LLVMInitialize ## TARG () +#define DoInit2(TARG) \ + LLVMInitialize ## TARG ## Info (); \ + LLVMInitialize ## TARG () #define DoInit(T) DoInit2(T) DoInit(LLVM_NATIVE_ARCH); return 0; From echristo at apple.com Mon Aug 17 22:23:47 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 18 Aug 2009 03:23:47 -0000 Subject: [llvm-commits] [llvm] r79308 - /llvm/trunk/Makefile.rules Message-ID: <200908180323.n7I3Nm65009418@zion.cs.uiuc.edu> Author: echristo Date: Mon Aug 17 22:23:40 2009 New Revision: 79308 URL: http://llvm.org/viewvc/llvm-project?rev=79308&view=rev Log: Separate out Makefile defines so that we can keep the llvm defined ones from the user defined ones. Propagate accordingly. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=79308&r1=79307&r2=79308&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Mon Aug 17 22:23:40 2009 @@ -399,11 +399,8 @@ endif endif -CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual -C.Flags += $(CFLAGS) -CPP.Defines += $(CPPFLAGS) +CXX.Flags += -Woverloaded-virtual CPP.BaseFlags += $(CPP.Defines) -LD.Flags += $(LDFLAGS) AR.Flags := cru # Make Floating point IEEE compliant on Alpha. @@ -636,31 +633,34 @@ $(CPP.BaseFlags) ifeq ($(BUILD_COMPONENT), 1) - Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) \ + Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) -c - Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) \ + Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \ + $(CPPFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) -c - Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(TargetCommonOpts) \ + Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \ $(CompileCommonOpts) $(CXX.Flags) -E - Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) \ + Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(LDFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip) else - Compile.C = $(CC) $(CPP.Flags) $(C.Flags) \ + Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) -c - Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) \ + Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) -c - Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) \ + Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \ $(CompileCommonOpts) $(CXX.Flags) -E - Link = $(CXX) $(CPP.Flags) $(CXX.Flags) \ + Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(LDFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip) endif -BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) \ +BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CFLAGS) \ + $(CPPFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) -Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) \ +Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) -E -BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) \ +BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \ + $(CPPFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755 From daniel at zuster.org Mon Aug 17 22:35:58 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 03:35:58 -0000 Subject: [llvm-commits] [llvm] r79309 - in /llvm/trunk/tools/bugpoint: BugDriver.cpp Miscompilation.cpp ToolRunner.cpp ToolRunner.h bugpoint.cpp Message-ID: <200908180335.n7I3ZxCZ010913@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 17 22:35:57 2009 New Revision: 79309 URL: http://llvm.org/viewvc/llvm-project?rev=79309&view=rev Log: Change bugpoint to use Triple to make runtime decisions. - This is cleaner, and makes bugpoint match the host instead of the build architecture. - Patch by Sandeep Patel! Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp llvm/trunk/tools/bugpoint/Miscompilation.cpp llvm/trunk/tools/bugpoint/ToolRunner.cpp llvm/trunk/tools/bugpoint/ToolRunner.h llvm/trunk/tools/bugpoint/bugpoint.cpp Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.cpp?rev=79309&r1=79308&r2=79309&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/BugDriver.cpp (original) +++ llvm/trunk/tools/bugpoint/BugDriver.cpp Mon Aug 17 22:35:57 2009 @@ -25,9 +25,14 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/System/Host.h" #include using namespace llvm; +namespace llvm { + Triple TargetTriple; +} + // Anonymous namespace to define command line options for debugging. // namespace { @@ -88,6 +93,20 @@ Result = 0; } + // If we don't have an override triple, use the first one to configure + // bugpoint, or use the host triple if none provided. + if (Result) { + if (TargetTriple.getTriple().empty()) { + Triple TheTriple(Result->getTargetTriple()); + + if (TheTriple.getTriple().empty()) + TheTriple.setTriple(sys::getHostTriple()); + + TargetTriple.setTriple(TheTriple.getTriple()); + } + + Result->setTargetTriple(TargetTriple.getTriple()); // override the triple + } return Result; } Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=79309&r1=79308&r2=79309&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original) +++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Mon Aug 17 22:35:57 2009 @@ -14,6 +14,7 @@ #include "BugDriver.h" #include "ListReducer.h" +#include "ToolRunner.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" @@ -937,13 +938,13 @@ outs() << '\n'; outs() << "The shared object was created with:\n llc -march=c " << SafeModuleBC << " -o temporary.c\n" - << " gcc -xc temporary.c -O2 -o " << SharedObject -#if defined(sparc) || defined(__sparc__) || defined(__sparcv9) - << " -G" // Compile a shared library, `-G' for Sparc -#else - << " -fPIC -shared" // `-shared' for Linux/X86, maybe others -#endif - << " -fno-strict-aliasing\n"; + << " gcc -xc temporary.c -O2 -o " << SharedObject; + if (TargetTriple.getArch() == Triple::sparc) + outs() << " -G"; // Compile a shared library, `-G' for Sparc + else + outs() << " -fPIC -shared"; // `-shared' for Linux/X86, maybe others + + outs() << " -fno-strict-aliasing\n"; return false; } Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=79309&r1=79308&r2=79309&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original) +++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Mon Aug 17 22:35:57 2009 @@ -604,7 +604,6 @@ // GCC abstraction // -#ifdef __APPLE__ static bool IsARMArchitecture(std::vector Args) { @@ -620,7 +619,6 @@ return false; } -#endif int GCC::ExecuteProgram(const std::string &ProgramFile, const std::vector &Args, @@ -645,13 +643,13 @@ GCCArgs.push_back("-fno-strict-aliasing"); } else { GCCArgs.push_back("assembler"); -#ifdef __APPLE__ + // For ARM architectures we don't want this flag. bugpoint isn't // explicitly told what architecture it is working on, so we get // it from gcc flags - if (!IsARMArchitecture(ArgsForGCC)) + if ((TargetTriple.getOS() == Triple::Darwin) && + !IsARMArchitecture(ArgsForGCC)) GCCArgs.push_back("-force_cpusubtype_ALL"); -#endif } GCCArgs.push_back(ProgramFile.c_str()); // Specify the input filename... GCCArgs.push_back("-x"); @@ -677,9 +675,8 @@ #if defined (HAVE_LINK_R) GCCArgs.push_back("-Wl,-R."); // Search this dir for .so files #endif -#ifdef __sparc__ - GCCArgs.push_back("-mcpu=v9"); -#endif + if (TargetTriple.getArch() == Triple::sparc) + GCCArgs.push_back("-mcpu=v9"); GCCArgs.push_back(0); // NULL terminator outs() << ""; outs().flush(); @@ -777,27 +774,27 @@ GCCArgs.push_back(InputFile.c_str()); // Specify the input filename. GCCArgs.push_back("-x"); GCCArgs.push_back("none"); -#if defined(sparc) || defined(__sparc__) || defined(__sparcv9) - GCCArgs.push_back("-G"); // Compile a shared library, `-G' for Sparc -#elif defined(__APPLE__) - // link all source files into a single module in data segment, rather than - // generating blocks. dynamic_lookup requires that you set - // MACOSX_DEPLOYMENT_TARGET=10.3 in your env. FIXME: it would be better for - // bugpoint to just pass that in the environment of GCC. - GCCArgs.push_back("-single_module"); - GCCArgs.push_back("-dynamiclib"); // `-dynamiclib' for MacOS X/PowerPC - GCCArgs.push_back("-undefined"); - GCCArgs.push_back("dynamic_lookup"); -#else - GCCArgs.push_back("-shared"); // `-shared' for Linux/X86, maybe others -#endif + if (TargetTriple.getArch() == Triple::sparc) + GCCArgs.push_back("-G"); // Compile a shared library, `-G' for Sparc + else if (TargetTriple.getOS() == Triple::Darwin) { + // link all source files into a single module in data segment, rather than + // generating blocks. dynamic_lookup requires that you set + // MACOSX_DEPLOYMENT_TARGET=10.3 in your env. FIXME: it would be better for + // bugpoint to just pass that in the environment of GCC. + GCCArgs.push_back("-single_module"); + GCCArgs.push_back("-dynamiclib"); // `-dynamiclib' for MacOS X/PowerPC + GCCArgs.push_back("-undefined"); + GCCArgs.push_back("dynamic_lookup"); + } else + GCCArgs.push_back("-shared"); // `-shared' for Linux/X86, maybe others + + if ((TargetTriple.getArch() == Triple::alpha) || + (TargetTriple.getArch() == Triple::x86_64)) + GCCArgs.push_back("-fPIC"); // Requires shared objs to contain PIC + + if (TargetTriple.getArch() == Triple::sparc) + GCCArgs.push_back("-mcpu=v9"); -#if defined(__ia64__) || defined(__alpha__) || defined(__amd64__) - GCCArgs.push_back("-fPIC"); // Requires shared objs to contain PIC -#endif -#ifdef __sparc__ - GCCArgs.push_back("-mcpu=v9"); -#endif GCCArgs.push_back("-o"); GCCArgs.push_back(OutputFile.c_str()); // Output to the right filename. GCCArgs.push_back("-O2"); // Optimize the program a bit. Modified: llvm/trunk/tools/bugpoint/ToolRunner.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.h?rev=79309&r1=79308&r2=79309&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ToolRunner.h (original) +++ llvm/trunk/tools/bugpoint/ToolRunner.h Mon Aug 17 22:35:57 2009 @@ -17,6 +17,7 @@ #ifndef BUGPOINT_TOOLRUNNER_H #define BUGPOINT_TOOLRUNNER_H +#include "llvm/ADT/Triple.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/SystemUtils.h" #include @@ -25,6 +26,7 @@ namespace llvm { extern cl::opt SaveTemps; +extern Triple TargetTriple; class CBE; class LLC; Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=79309&r1=79308&r2=79309&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/bugpoint.cpp (original) +++ llvm/trunk/tools/bugpoint/bugpoint.cpp Mon Aug 17 22:35:57 2009 @@ -66,6 +66,9 @@ StandardLinkOpts("std-link-opts", cl::desc("Include the standard link time optimizations")); +static cl::opt +OverrideTriple("mtriple", cl::desc("Override target triple for module")); + /// BugpointIsInterrupted - Set to true when the user presses ctrl-c. bool llvm::BugpointIsInterrupted = false; @@ -98,9 +101,15 @@ sys::SetInterruptFunction(BugpointInterruptFunction); LLVMContext& Context = getGlobalContext(); + // If we have an override, set it and then track the triple we want Modules + // to use. + if (!OverrideTriple.empty()) + TargetTriple.setTriple(OverrideTriple); + outs() << "override triple is " << OverrideTriple << '\n'; + BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit, Context); if (D.addSources(InputFilenames)) return 1; - + AddToDriver PM(D); if (StandardCompileOpts) { createStandardModulePasses(&PM, 3, From daniel at zuster.org Mon Aug 17 22:36:11 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 17 Aug 2009 20:36:11 -0700 Subject: [llvm-commits] [patch] make bugpoint more config-neutral In-Reply-To: <305d6f60908161920xcbfd489xa91bca423f15cf43@mail.gmail.com> References: <305d6f60908161920xcbfd489xa91bca423f15cf43@mail.gmail.com> Message-ID: <6a8523d60908172036y1f8abebfw6a29eef18eda1089@mail.gmail.com> Nice, thanks! Applied as r79309. - Daniel On Sun, Aug 16, 2009 at 7:20 PM, Sandeep Patel wrote: > Have bugpoint track either the first Module's triple or an override > triple (using -mtriple) and use that triple to make runtime behavioral > decisions. The decisions are a direct conversion of the preprocessor > logic, except that IA64 was dropped. > > This fixes bugpoint usage to not make target decisions based on host > compiler flags, such as Darwin cross targeting non-Darwin will now not > add Darwin-specific linker flags. > > Only one config.h flag use remains and that's HAVE_LINK_R, which > somebody who knows more about what it's for should replace if > possible. > > deep > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > From sabre at nondot.org Mon Aug 17 23:03:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 04:03:24 -0000 Subject: [llvm-commits] [llvm] r79310 - /llvm/trunk/tools/llvm-extract/llvm-extract.cpp Message-ID: <200908180403.n7I43OCJ014259@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 17 23:03:24 2009 New Revision: 79310 URL: http://llvm.org/viewvc/llvm-project?rev=79310&view=rev Log: "-" should write to stdout, not stderr. Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=79310&r1=79309&r2=79310&view=diff ============================================================================== --- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original) +++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Mon Aug 17 23:03:24 2009 @@ -124,14 +124,14 @@ return 1; } } else { // Specified stdout - // FIXME: errs() is not binary! - Out = &errs(); + // FIXME: outs() is not binary! + Out = &outs(); } Passes.add(createBitcodeWriterPass(*Out)); Passes.run(*M.get()); - if (Out != &errs()) + if (Out != &outs()) delete Out; return 0; } From sabre at nondot.org Mon Aug 17 23:30:35 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 04:30:35 -0000 Subject: [llvm-commits] [llvm] r79311 - /llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Message-ID: <200908180430.n7I4UZif017565@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 17 23:30:35 2009 New Revision: 79311 URL: http://llvm.org/viewvc/llvm-project?rev=79311&view=rev Log: turn this conditional into something humans might actually be able to understand ;-) Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=79311&r1=79310&r2=79311&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Mon Aug 17 23:30:35 2009 @@ -128,14 +128,31 @@ return I; } -bool -MachineBasicBlock::isOnlyReachableByFallthrough() const { - return !isLandingPad() && - !pred_empty() && - next(pred_begin()) == pred_end() && - (*pred_begin())->isLayoutSuccessor(this) && - ((*pred_begin())->empty() || - !(*pred_begin())->back().getDesc().isBarrier()); +bool MachineBasicBlock::isOnlyReachableByFallthrough() const { + // If this is a landing pad, it isn't a fall through. If it has no preds, + // then nothing falls through to it. + if (isLandingPad() || pred_empty()) + return false; + + // If there isn't exactly one predecessor, it can't be a fall through. + const_pred_iterator PI = pred_begin(), PI2 = PI; + ++PI; + if (PI != pred_end()) + return false; + + // The predecessor has to be immediately before this block. + const MachineBasicBlock *Pred = *PI; + + if (!Pred->isLayoutSuccessor(this)) + return false; + + // If the block is completely empty, then it definitely does fall through. + if (Pred->empty()) + return true; + + // Otherwise, check the last instruction. + const MachineInstr &LastInst = Pred->back(); + return LastInst.getDesc().isBarrier(); } void MachineBasicBlock::dump() const { From sabre at nondot.org Mon Aug 17 23:33:15 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 04:33:15 -0000 Subject: [llvm-commits] [llvm] r79312 - /llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Message-ID: <200908180433.n7I4XFgp017947@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 17 23:33:15 2009 New Revision: 79312 URL: http://llvm.org/viewvc/llvm-project?rev=79312&view=rev Log: fix accidentally inverted conditional and add comment. Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=79312&r1=79311&r2=79312&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Mon Aug 17 23:33:15 2009 @@ -128,6 +128,9 @@ return I; } +/// isOnlyReachableViaFallthough - Return true if this basic block has +/// exactly one predecessor and the control transfer mechanism between +/// the predecessor and this block is a fall-through. bool MachineBasicBlock::isOnlyReachableByFallthrough() const { // If this is a landing pad, it isn't a fall through. If it has no preds, // then nothing falls through to it. @@ -152,7 +155,7 @@ // Otherwise, check the last instruction. const MachineInstr &LastInst = Pred->back(); - return LastInst.getDesc().isBarrier(); + return !LastInst.getDesc().isBarrier(); } void MachineBasicBlock::dump() const { From sabre at nondot.org Mon Aug 17 23:34:36 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 04:34:36 -0000 Subject: [llvm-commits] [llvm] r79313 - /llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Message-ID: <200908180434.n7I4YaAY018120@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 17 23:34:36 2009 New Revision: 79313 URL: http://llvm.org/viewvc/llvm-project?rev=79313&view=rev Log: fix another bozo bug Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=79313&r1=79312&r2=79313&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Mon Aug 17 23:34:36 2009 @@ -139,8 +139,8 @@ // If there isn't exactly one predecessor, it can't be a fall through. const_pred_iterator PI = pred_begin(), PI2 = PI; - ++PI; - if (PI != pred_end()) + ++PI2; + if (PI2 != pred_end()) return false; // The predecessor has to be immediately before this block. From dannyb at google.com Mon Aug 17 17:49:46 2009 From: dannyb at google.com (Daniel Berlin) Date: Mon, 17 Aug 2009 18:49:46 -0400 Subject: [llvm-commits] [patch][llvm-gcc] Port -no-canonical-prefixes In-Reply-To: References: <38a0d8450908160041k33186be4rfa183eee0023ad1e@mail.gmail.com> <022C59FB-0E96-408E-B9D7-9D52BA32A006@apple.com> <38a0d8450908171019l3a2db97epf58a6900991255c1@mail.gmail.com> Message-ID: <2fbe2a060908171549w6c16a53radf5332e80c6292a@mail.gmail.com> Chris, to be clear, Simon can't actually give such permission, only I can (and I did ;P). Google owns these works under the various employment agreements (it was work done specifically for Google, on Google time, in the direct scope of their employment), and I am allowed to authorize Googlers to release code under whatever license. As such, Rafael has Google's permission to release this code as GPL2, regardless of who at Google wrote it. Since Google owns the code, and not Simon, and Simon isn't authorized to release code in Google's name, Simon actually can't write something to the list giving you permission, and if he did, it wouldn't be worth anything. ;) Not that i have something against Simon, i love the guy ;) On Mon, Aug 17, 2009 at 6:24 PM, Chris Lattner wrote: > > On Aug 17, 2009, at 10:19 AM, Rafael Espindola wrote: > >> (now with llvm-commits included) >> >> 2009/8/17 Chris Lattner : >>> >>> On Aug 16, 2009, at 12:41 AM, Rafael Espindola wrote: >>> Hi Rafael, can you get the author to send an email confirming that it is >>> ok >>> with them to license it under GPL2 to this list? ?While I believe you, a >>> court might not :) >> >> The patch was written by Simon Baldwin. He works for Google and was >> OK with us porting the patch. On similar cases >> before we also got approval from Daniel Berlin to port gcc patches >> written by Google. > > Simon, can you please post something to this list? ?I'd like it archived in > the list for future references, thanks! > > -Chris > From daniel at zuster.org Mon Aug 17 23:43:27 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 04:43:27 -0000 Subject: [llvm-commits] [llvm] r79314 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp Message-ID: <200908180443.n7I4hRtB019227@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 17 23:43:27 2009 New Revision: 79314 URL: http://llvm.org/viewvc/llvm-project?rev=79314&view=rev Log: Add Triple matching for pic16 arch and solaris OS. - Patch by Yonggang Luo. Modified: llvm/trunk/include/llvm/ADT/Triple.h llvm/trunk/lib/Support/Triple.cpp Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=79314&r1=79313&r2=79314&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Mon Aug 17 23:43:27 2009 @@ -43,6 +43,7 @@ mips, // MIPS: mips, mipsallegrex mipsel, // MIPSEL: mipsel, mipsallegrexel, psp msp430, // MPS430: msp430 + pic16, // PIC16: pic16 ppc, // PPC: powerpc ppc64, // PPC64: powerpc64 sparc, // Sparc: sparc @@ -73,6 +74,7 @@ MinGW64, NetBSD, OpenBSD, + Solaris, Win32 }; Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=79314&r1=79313&r2=79314&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Mon Aug 17 23:43:27 2009 @@ -28,6 +28,7 @@ case mips: return "mips"; case mipsel: return "mipsel"; case msp430: return "msp430"; + case pic16: return "pic16"; case ppc64: return "powerpc64"; case ppc: return "powerpc"; case sparc: return "sparc"; @@ -66,6 +67,7 @@ case MinGW64: return "mingw64"; case NetBSD: return "netbsd"; case OpenBSD: return "openbsd"; + case Solaris: return "solaris"; case Win32: return "win32"; } @@ -87,6 +89,8 @@ return mipsel; if (Name == "msp430") return msp430; + if (Name == "pic16") + return pic16; if (Name == "ppc64") return ppc64; if (Name == "ppc") @@ -119,6 +123,8 @@ Arch = x86; else if (ArchName == "amd64" || ArchName == "x86_64") Arch = x86_64; + else if (ArchName == "pic16") + Arch = pic16; else if (ArchName == "powerpc") Arch = ppc; else if (ArchName == "powerpc64") @@ -144,8 +150,6 @@ Arch = sparc; else if (ArchName == "s390x") Arch = systemz; - else if (ArchName == "bfin") - Arch = bfin; else Arch = UnknownArch; @@ -178,6 +182,8 @@ OS = NetBSD; else if (OSName.startswith("openbsd")) OS = OpenBSD; + else if (OSName.startswith("solaris")) + OS = Solaris; else if (OSName.startswith("win32")) OS = Win32; else From clattner at apple.com Mon Aug 17 23:50:45 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Aug 2009 21:50:45 -0700 Subject: [llvm-commits] [patch][llvm-gcc] Port -no-canonical-prefixes In-Reply-To: <2fbe2a060908171549w6c16a53radf5332e80c6292a@mail.gmail.com> References: <38a0d8450908160041k33186be4rfa183eee0023ad1e@mail.gmail.com> <022C59FB-0E96-408E-B9D7-9D52BA32A006@apple.com> <38a0d8450908171019l3a2db97epf58a6900991255c1@mail.gmail.com> <2fbe2a060908171549w6c16a53radf5332e80c6292a@mail.gmail.com> Message-ID: On Aug 17, 2009, at 3:49 PM, Daniel Berlin wrote: > Chris, to be clear, Simon can't actually give such permission, only I > can (and I did ;P). > > Google owns these works under the various employment agreements (it > was work done specifically for Google, on Google time, in the direct > scope of their employment), and I am allowed to authorize Googlers to > release code under whatever license. > As such, Rafael has Google's permission to release this code as GPL2, > regardless of who at Google wrote it. > Since Google owns the code, and not Simon, and Simon isn't authorized > to release code in Google's name, Simon actually can't write something > to the list giving you permission, and if he did, it wouldn't be worth > anything. > ;) > > Not that i have something against Simon, i love the guy ;) Great, thanks all! :) -Chris > > On Mon, Aug 17, 2009 at 6:24 PM, Chris Lattner > wrote: >> >> On Aug 17, 2009, at 10:19 AM, Rafael Espindola wrote: >> >>> (now with llvm-commits included) >>> >>> 2009/8/17 Chris Lattner : >>>> >>>> On Aug 16, 2009, at 12:41 AM, Rafael Espindola wrote: >>>> Hi Rafael, can you get the author to send an email confirming >>>> that it is >>>> ok >>>> with them to license it under GPL2 to this list? While I believe >>>> you, a >>>> court might not :) >>> >>> The patch was written by Simon Baldwin. He works for Google and was >>> OK with us porting the patch. On similar cases >>> before we also got approval from Daniel Berlin to port gcc patches >>> written by Google. >> >> Simon, can you please post something to this list? I'd like it >> archived in >> the list for future references, thanks! >> >> -Chris >> From daniel at zuster.org Mon Aug 17 23:51:26 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 04:51:26 -0000 Subject: [llvm-commits] [llvm] r79315 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp Message-ID: <200908180451.n7I4pQwv020188@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Aug 17 23:51:26 2009 New Revision: 79315 URL: http://llvm.org/viewvc/llvm-project?rev=79315&view=rev Log: Recognize xscale as an ARM arch. - Patch by Yonggang Luo. Modified: llvm/trunk/include/llvm/ADT/Triple.h llvm/trunk/lib/Support/Triple.cpp Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=79315&r1=79314&r2=79315&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Mon Aug 17 23:51:26 2009 @@ -37,7 +37,7 @@ UnknownArch, alpha, // Alpha: alpha - arm, // ARM; arm, armv.* + arm, // ARM; arm, armv.*, xscale bfin, // Blackfin: bfin cellspu, // CellSPU: spu, cellspu mips, // MIPS: mips, mipsallegrex Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=79315&r1=79314&r2=79315&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Mon Aug 17 23:51:26 2009 @@ -130,7 +130,8 @@ else if (ArchName == "powerpc64") Arch = ppc64; else if (ArchName == "arm" || - ArchName.startswith("armv")) + ArchName.startswith("armv") || + ArchName == "xscale") Arch = arm; else if (ArchName == "thumb" || ArchName.startswith("thumbv")) From eli.friedman at gmail.com Tue Aug 18 00:14:44 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Mon, 17 Aug 2009 22:14:44 -0700 Subject: [llvm-commits] [llvm] r79314 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp In-Reply-To: <200908180443.n7I4hRtB019227@zion.cs.uiuc.edu> References: <200908180443.n7I4hRtB019227@zion.cs.uiuc.edu> Message-ID: On Mon, Aug 17, 2009 at 9:43 PM, Daniel Dunbar wrote: > @@ -144,8 +150,6 @@ > ? ? Arch = sparc; > ? else if (ArchName == "s390x") > ? ? Arch = systemz; > - ?else if (ArchName == "bfin") > - ? ?Arch = bfin; > ? else > ? ? Arch = UnknownArch; Umm, was this bit intentional? -Eli From sabre at nondot.org Tue Aug 18 00:33:28 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 05:33:28 -0000 Subject: [llvm-commits] [llvm] r79317 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Message-ID: <200908180533.n7I5XS9s025282@zion.cs.uiuc.edu> Author: lattner Date: Tue Aug 18 00:33:27 2009 New Revision: 79317 URL: http://llvm.org/viewvc/llvm-project?rev=79317&view=rev Log: add support for some targetflags on GV operands. This allows us to send instructions like: NEW: movl "L___stack_chk_guard$non_lazy_ptr" - "L1$pb"(%esi), %eax OLD: movl L___stack_chk_guard$non_lazy_ptr-"L1$pb"(%esi), %eax through the streamer. Several fixmes. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp 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=79317&r1=79316&r2=79317&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Aug 18 00:33:27 2009 @@ -72,7 +72,7 @@ } else { assert(Subtarget->isTargetELF() && "Don't know how to print PIC label!"); Name = ".Lllvm$" + utostr(getFunctionNumber())+".$piclabel"; - } + } return OutContext.GetOrCreateSymbol(Name); } @@ -734,9 +734,51 @@ else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) FnStubs[Name] = Mang->getMangledName(GV); + + // Handle target operand flags. + // FIXME: This should be common between external symbols, constant pool etc. + MCSymbol *NegatedSymbol = 0; + + switch (MO.getTargetFlags()) { + default: + llvm_unreachable("Unknown target flag on GV operand"); + case X86II::MO_NO_FLAG: // No flag. + break; + case X86II::MO_DARWIN_NONLAZY: + case X86II::MO_DARWIN_HIDDEN_NONLAZY: + case X86II::MO_DLLIMPORT: + case X86II::MO_DARWIN_STUB: + // These affect the name of the symbol, not any suffix. + break; + case X86II::MO_GOT_ABSOLUTE_ADDRESS: + assert(0 && "Reloc mode unimp!"); + //O << " + [.-"; + //PrintPICBaseSymbol(); + //O << ']'; + break; + case X86II::MO_PIC_BASE_OFFSET: + case X86II::MO_DARWIN_NONLAZY_PIC_BASE: + case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: + // Subtract the pic base. + NegatedSymbol = GetPICBaseSymbol(); + break; + + // FIXME: These probably should be a modifier on the symbol or something?? + case X86II::MO_TLSGD: Name += "@TLSGD"; break; + case X86II::MO_GOTTPOFF: Name += "@GOTTPOFF"; break; + case X86II::MO_INDNTPOFF: Name += "@INDNTPOFF"; break; + case X86II::MO_TPOFF: Name += "@TPOFF"; break; + case X86II::MO_NTPOFF: Name += "@NTPOFF"; break; + case X86II::MO_GOTPCREL: Name += "@GOTPCREL"; break; + case X86II::MO_GOT: Name += "@GOT"; break; + case X86II::MO_GOTOFF: Name += "@GOTOFF"; break; + case X86II::MO_PLT: Name += "@PLT"; break; + } + // Create a symbol for the name. MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name); - return MCOperand::CreateMCValue(MCValue::get(Sym, 0, MO.getOffset())); + return MCOperand::CreateMCValue(MCValue::get(Sym, NegatedSymbol, + MO.getOffset())); } MCOperand X86ATTAsmPrinter:: From sanjiv.gupta at microchip.com Tue Aug 18 00:35:13 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Tue, 18 Aug 2009 11:05:13 +0530 Subject: [llvm-commits] [llvm] r78948 - in /llvm/trunk: docs/tutorial/ examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/Kaleidoscope/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm/ include/llvm/Support/ include/llvm/Target/ lib/Analysis/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/ lib/ExecutionEngine/Interpreter/ lib/ExecutionEngine/JIT/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CBackend/ l... In-Reply-To: <4A87DD3B.8040502@microchip.com> References: <200908132159.n7DLx2vb024441@zion.cs.uiuc.edu> <4A87DD3B.8040502@microchip.com> Message-ID: <4A8A3D91.2030601@microchip.com> Sanjiv Gupta wrote: > Owen Anderson wrote: > >> Author: resistor >> Date: Thu Aug 13 16:58:54 2009 >> New Revision: 78948 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=78948&view=rev >> Log: >> Push LLVMContexts through the IntegerType APIs. >> >> Modified: >> llvm/trunk/docs/tutorial/JITTutorial1.html >> llvm/trunk/docs/tutorial/JITTutorial2.html >> llvm/trunk/docs/tutorial/LangImpl3.html >> llvm/trunk/docs/tutorial/LangImpl4.html >> llvm/trunk/docs/tutorial/LangImpl5.html >> llvm/trunk/docs/tutorial/LangImpl6.html >> llvm/trunk/docs/tutorial/LangImpl7.html >> llvm/trunk/examples/BrainF/BrainF.cpp >> llvm/trunk/examples/BrainF/BrainFDriver.cpp >> llvm/trunk/examples/Fibonacci/fibonacci.cpp >> llvm/trunk/examples/HowToUseJIT/HowToUseJIT.cpp >> llvm/trunk/examples/Kaleidoscope/toy.cpp >> llvm/trunk/examples/ModuleMaker/ModuleMaker.cpp >> llvm/trunk/examples/ParallelJIT/ParallelJIT.cpp >> llvm/trunk/include/llvm/BasicBlock.h >> llvm/trunk/include/llvm/Constants.h >> llvm/trunk/include/llvm/DerivedTypes.h >> llvm/trunk/include/llvm/InstrTypes.h >> llvm/trunk/include/llvm/Instructions.h >> llvm/trunk/include/llvm/LLVMContext.h >> llvm/trunk/include/llvm/LinkAllVMCore.h >> >> > Build fails on Mingw: > > projects/objs/tools/opt/Debug/opt.o: In function `Force > VMCoreLinking': > C:/msys/home/auto-tester/projects/c16/include/llvm/LinkAllVMCore.h:49: > undefined > reference to `llvm::UnreachableInst::UnreachableInst(llvm::Instruction*)' > collect2: ld returned 1 exit status > > - Sanjiv > > I did clean everything , reconfigured and rebuilt. It builds fine now. - Sanjiv > _______________________________________________ > 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 Aug 18 00:43:24 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 18 Aug 2009 05:43:24 -0000 Subject: [llvm-commits] [llvm] r79318 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb.td lib/Target/ARM/ARMInstrThumb2.td test/CodeGen/Thumb2/thumb2-rev.ll Message-ID: <200908180543.n7I5hObh026561@zion.cs.uiuc.edu> Author: evancheng Date: Tue Aug 18 00:43:23 2009 New Revision: 79318 URL: http://llvm.org/viewvc/llvm-project?rev=79318&view=rev Log: Fix revsh pattern. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=79318&r1=79317&r2=79318&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Tue Aug 18 00:43:23 2009 @@ -543,7 +543,7 @@ "revsh", " $dst, $src", [(set tGPR:$dst, (sext_inreg - (or (srl (and tGPR:$src, 0xFFFF), (i32 8)), + (or (srl (and tGPR:$src, 0xFF00), (i32 8)), (shl tGPR:$src, (i32 8))), i16))]>, Requires<[IsThumb1Only, HasV6]>; Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=79318&r1=79317&r2=79318&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Aug 18 00:43:23 2009 @@ -951,7 +951,7 @@ "revsh", ".w $dst, $src", [(set GPR:$dst, (sext_inreg - (or (srl (and GPR:$src, 0xFFFF), (i32 8)), + (or (srl (and GPR:$src, 0xFF00), (i32 8)), (shl GPR:$src, (i32 8))), i16))]>; def t2PKHBT : T2I<(outs GPR:$dst), (ins GPR:$src1, GPR:$src2, i32imm:$shamt), Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll?rev=79318&r1=79317&r2=79318&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-rev.ll Tue Aug 18 00:43:23 2009 @@ -8,3 +8,16 @@ } declare i32 @llvm.bswap.i32(i32) nounwind readnone + +define i32 @f2(i32 %X) { +; CHECK: f2: +; CHECK: revsh r0, r0 + %tmp1 = lshr i32 %X, 8 + %tmp1.upgrd.1 = trunc i32 %tmp1 to i16 + %tmp3 = trunc i32 %X to i16 + %tmp2 = and i16 %tmp1.upgrd.1, 255 + %tmp4 = shl i16 %tmp3, 8 + %tmp5 = or i16 %tmp2, %tmp4 + %tmp5.upgrd.2 = sext i16 %tmp5 to i32 + ret i32 %tmp5.upgrd.2 +} From sabre at nondot.org Tue Aug 18 00:46:09 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 05:46:09 -0000 Subject: [llvm-commits] [test-suite] r79319 - /test-suite/trunk/Makefile.programs Message-ID: <200908180546.n7I5k97J026897@zion.cs.uiuc.edu> Author: lattner Date: Tue Aug 18 00:46:09 2009 New Revision: 79319 URL: http://llvm.org/viewvc/llvm-project?rev=79319&view=rev Log: disable asm-verbose for the nightly testers and everything else. -asm-verbose can slow down llc a lot and is not what the compilers use by default. we get more testing milage out of making the nightly testers more similar to the compilers. Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=79319&r1=79318&r2=79319&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Tue Aug 18 00:46:09 2009 @@ -330,6 +330,10 @@ endif # ifndef DISABLE_FOR_LLVM_PROGRAMS +# Disable asm-verbose. This can slow down compilation and is not what the +# compilers default to using. +LLCFLAGS += -asm-verbose=false + # If the program requires exception handling support, enable (potentially # expensive) support for it. ifdef REQUIRES_EH_SUPPORT From clattner at apple.com Tue Aug 18 00:47:57 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Aug 2009 22:47:57 -0700 Subject: [llvm-commits] [llvm] r78567 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/Support/IOManip.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp In-Reply-To: <200908111459.58233.greened@obbligato.org> References: <200908101638.n7AGc8CB032679@zion.cs.uiuc.edu> <26436859-13D1-4282-88A6-09EA06FB9839@apple.com> <200908111459.58233.greened@obbligato.org> Message-ID: <79628241-6979-4FC8-A4CC-BDF3029EAA09@apple.com> On Aug 11, 2009, at 12:59 PM, David A. Greene wrote: > On Tuesday 11 August 2009 12:22, Chris Lattner wrote: > >> Hi David, >> >> Thanks for working on this, why not just put this under -asm-verbose? >> The whole idea is that -asm-verbose is used when we don't care about >> compile time, I don't see a need for yet-another flag. Also: > > Because the nightly tester runs with -asm-verbose and I got into > enough > trouble last time. :) That's not a good reason, a better fix is to change the nightly testers to not use -asm-verbose. :) I just did this. Please eliminate exuberant asm. >>> +++ llvm/trunk/include/llvm/Support/IOManip.h Mon Aug 10 11:38:07 >>> 2009 >>> @@ -0,0 +1,43 @@ >>> +//===----------------- IOManip.h - iostream manipulators --------- >>> *- C++ -*===// >> >> Here we go again. *again*, please do not add this sort of thing. It >> is not appreciated. As discussed several times before, I do not want >> manipulators like this. Thanks. > > Ok, I didn't realize all manipulators are verboten. They are when they cause more complexity than they prevent. Please remove this. >>> + if (loop->empty()) { >> >> I don't think that loops can be empty, they have to at least have a >> header. I don't know why MachineLoop has an empty() predicate. > > I'm going to leave this here for now. When empty() goes away we can > fix it. Dan clarified that this is not dead it should stay. >>> + << " Inside Loop BB" << getFunctionNumber() << "_" >>> + << Header->getNumber() << " Depth " << CurLoop- >>> >>>> getLoopDepth(); >> >> This output seems like it would be very verbose and redundant. > > It is, on purpose. It makes writing tools easier. I thought the point was to make the .s files more human readable? IF you use a simple algorithm, surely any tools can adapt. Please eliminate IOManip.h and exuberant asm soon. -Chris From clattner at apple.com Tue Aug 18 00:50:57 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Aug 2009 22:50:57 -0700 Subject: [llvm-commits] [llvm] r79295 - in /llvm/trunk: ./ bindings/ada/ bindings/ada/analysis/ bindings/ada/bitreader/ bindings/ada/bitwriter/ bindings/ada/executionengine/ bindings/ada/llvm/ bindings/ada/target/ bindings/ada/transforms/ In-Reply-To: <200908180024.n7I0OcKH019672@zion.cs.uiuc.edu> References: <200908180024.n7I0OcKH019672@zion.cs.uiuc.edu> Message-ID: <761161FE-FDE7-45FC-ACC8-B13868AB9D4E@apple.com> On Aug 17, 2009, at 5:24 PM, Edward O'Callaghan wrote: > Author: evocallaghan > Date: Mon Aug 17 19:24:36 2009 > New Revision: 79295 > > URL: http://llvm.org/viewvc/llvm-project?rev=79295&view=rev > Log: > LLVM Ada language bindings. Credit to Rod Kay and the AuroraUX team. Hi Edward, Please keep the CREDITS.TXT file sorted. -Chris > > +++ llvm/trunk/CREDITS.TXT Mon Aug 17 19:24:36 2009 > @@ -182,6 +182,10 @@ > E: kowshik at uiuc.edu > D: Author of the original C backend > > +N: Rod Kay > +E: rkay at auroraux.org > +D: Author of LLVM Ada bindings > + > N: Christopher Lamb > E: christopher.lamb at gmail.com > D: aligned load/store support, parts of noalias and restrict support > From sabre at nondot.org Tue Aug 18 01:03:07 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 06:03:07 -0000 Subject: [llvm-commits] [llvm] r79321 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Message-ID: <200908180603.n7I637KC029047@zion.cs.uiuc.edu> Author: lattner Date: Tue Aug 18 01:03:07 2009 New Revision: 79321 URL: http://llvm.org/viewvc/llvm-project?rev=79321&view=rev Log: remove some pointless null switchtosections. The IntelAsmPrinter doesn't really work anyway. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp 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=79321&r1=79320&r2=79321&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Tue Aug 18 01:03:07 2009 @@ -493,14 +493,14 @@ case GlobalValue::LinkOnceODRLinkage: case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakODRLinkage: - SwitchToSection(0); + // FIXME: make a MCSection. O << name << "?\tSEGEMNT PARA common 'COMMON'\n"; bCustomSegment = true; // FIXME: the default alignment is 16 bytes, but 1, 2, 4, and 256 // are also available. break; case GlobalValue::AppendingLinkage: - SwitchToSection(0); + // FIXME: make a MCSection. O << name << "?\tSEGMENT PARA public 'DATA'\n"; bCustomSegment = true; // FIXME: the default alignment is 16 bytes, but 1, 2, 4, and 256 @@ -538,7 +538,6 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { // Output linker support code for dllexported globals if (!DLLExportedGVs.empty() || !DLLExportedFns.empty()) { - SwitchToSection(0); O << "; WARNING: The following code is valid only with MASM v8.x" << "and (possible) higher\n" << "; This version of MASM is usually shipped with Microsoft " @@ -564,7 +563,6 @@ // Bypass X86SharedAsmPrinter::doFinalization(). bool Result = AsmPrinter::doFinalization(M); - SwitchToSection(0); O << "\tend\n"; return Result; } From nicholas at mxc.ca Tue Aug 18 01:08:01 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 18 Aug 2009 06:08:01 -0000 Subject: [llvm-commits] [llvm] r79322 - /llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Message-ID: <200908180608.n7I681Nu029624@zion.cs.uiuc.edu> Author: nicholas Date: Tue Aug 18 01:08:01 2009 New Revision: 79322 URL: http://llvm.org/viewvc/llvm-project?rev=79322&view=rev Log: Include valgrind in the steps to reproduce if valgrind was used to reproduce the problem. Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/OptimizerDriver.cpp?rev=79322&r1=79321&r2=79322&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/OptimizerDriver.cpp (original) +++ llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Tue Aug 18 01:08:01 2009 @@ -77,6 +77,7 @@ outs() << "Emitted bitcode to '" << Filename << "'\n"; if (NoFlyer || PassesToRun.empty()) return; outs() << "\n*** You can reproduce the problem with: "; + if (UseValgrind) outs() << "valgrind "; outs() << "opt " << Filename << " "; outs() << getPassesString(PassesToRun) << "\n"; } From sabre at nondot.org Tue Aug 18 01:13:03 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 06:13:03 -0000 Subject: [llvm-commits] [llvm] r79323 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200908180613.n7I6D48q030243@zion.cs.uiuc.edu> Author: lattner Date: Tue Aug 18 01:13:03 2009 New Revision: 79323 URL: http://llvm.org/viewvc/llvm-project?rev=79323&view=rev Log: add a horrible hack to the dwarf printer. It looks like mingw is not specifying an EHFrame section, so we just emit ehframe data into a random section. This is clearly bad. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=79323&r1=79322&r2=79323&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Aug 18 01:13:03 2009 @@ -56,7 +56,10 @@ TD->getPointerSize() : -TD->getPointerSize(); // Begin eh frame section. - Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection()); + // FIXME: THIS IS A HORRIBLE HACK. MingW isn't specifying an EHFrame section. + if (const MCSection *EHFrameSec = + Asm->getObjFileLowering().getEHFrameSection()) + Asm->SwitchToSection(EHFrameSec); if (TAI->is_EHSymbolPrivate()) O << TAI->getPrivateGlobalPrefix(); @@ -150,8 +153,11 @@ const Function *TheFunc = EHFrameInfo.function; - Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection()); - + // FIXME: THIS IS A HORRIBLE HACK. MingW isn't specifying an EHFrame section. + if (const MCSection *EHFrameSec = + Asm->getObjFileLowering().getEHFrameSection()) + Asm->SwitchToSection(EHFrameSec); + // Externally visible entry into the functions eh frame info. If the // corresponding function is static, this should not be externally visible. if (!TheFunc->hasLocalLinkage()) From sabre at nondot.org Tue Aug 18 01:15:17 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 06:15:17 -0000 Subject: [llvm-commits] [llvm] r79324 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/MC/MCStreamer.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/MC/MCAsmStreamer.cpp lib/MC/MCStreamer.cpp Message-ID: <200908180615.n7I6FH7x030520@zion.cs.uiuc.edu> Author: lattner Date: Tue Aug 18 01:15:16 2009 New Revision: 79324 URL: http://llvm.org/viewvc/llvm-project?rev=79324&view=rev Log: Make AsmStreamer maintain a notion of the current section, pushing it up from the MCAsmStreamer. Based on this, eliminate the current section from AsmPrinter. While I'm at it, clean up the last of the horrible "switch to null section" stuff and add an assert. This change is in preparation for completely eliminating asmprinter::switchtosection. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCStreamer.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=79324&r1=79323&r2=79324&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Aug 18 01:15:16 2009 @@ -62,10 +62,6 @@ typedef gcp_map_type::iterator gcp_iterator; gcp_map_type GCMetadataPrinters; - /// CurrentSection - The current section we are emitting to. This is - /// controlled and used by the SwitchToSection method. - const MCSection *CurrentSection; - /// If ExuberantAsm is set, a pointer to the loop info for this /// function. /// @@ -127,7 +123,7 @@ std::string CurrentFnName; /// getCurrentSection() - Return the current section we are emitting to. - const MCSection *getCurrentSection() const { return CurrentSection; } + const MCSection *getCurrentSection() const; /// VerboseAsm - Emit comments in assembly output if this is true. Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=79324&r1=79323&r2=79324&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Tue Aug 18 01:15:16 2009 @@ -69,6 +69,9 @@ protected: MCStreamer(MCContext &Ctx); + /// CurSection - This is the current section code is being emitted to, it is + /// kept up to date by SwitchSection. + const MCSection *CurSection; public: virtual ~MCStreamer(); @@ -78,11 +81,16 @@ /// @{ /// SwitchSection - Set the current section where code is being emitted to - /// @param Section. + /// @param Section. This is required to update CurSection. /// /// This corresponds to assembler directives like .section, .text, etc. virtual void SwitchSection(const MCSection *Section) = 0; + + /// getCurrentSection - Return the current seciton that the streamer is + /// emitting code to. + const MCSection *getCurrentSection() const { return CurSection; } + /// EmitLabel - Emit a label for @param Symbol into the current section. /// /// This corresponds to an assembler statement such as: Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=79324&r1=79323&r2=79324&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Aug 18 01:15:16 2009 @@ -63,7 +63,6 @@ LastMI(0), LastFn(0), Counter(~0U), PrevDLT(0, ~0U, ~0U) { - CurrentSection = 0; DW = 0; MMI = 0; switch (AsmVerbose) { case cl::BOU_UNSET: VerboseAsm = VDef; break; @@ -91,19 +90,18 @@ } /// SwitchToSection - Switch to the specified section of the executable if we -/// are not already in it! If "NS" is null, then this causes us to exit the -/// current section and not reenter another one. This is generally used for -/// asmprinter hacks. -/// -/// FIXME: Remove support for null sections. -/// +/// are not already in it! void AsmPrinter::SwitchToSection(const MCSection *NS) { - CurrentSection = NS; - // FIXME: Remove support for null sections! - if (NS) - OutStreamer.SwitchSection(NS); + assert(NS != 0 && "Must specify a section to switch to"); + OutStreamer.SwitchSection(NS); +} + +/// getCurrentSection() - Return the current section we are emitting to. +const MCSection *AsmPrinter::getCurrentSection() const { + return OutStreamer.getCurrentSection(); } + void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); MachineFunctionPass::getAnalysisUsage(AU); @@ -143,8 +141,6 @@ << '\n' << TAI->getCommentString() << " End of file scope inline assembly\n"; - SwitchToSection(0); // Reset back to no section to close off sections. - if (TAI->doesSupportDebugInformation() || TAI->doesSupportExceptionHandling()) { MMI = getAnalysisIfAvailable(); @@ -174,7 +170,6 @@ // to stuff that is actually used. Note that doing so would require targets // to notice uses in operands (due to constant exprs etc). This should // happen with the MC stuff eventually. - SwitchToSection(0); // Print out module-level global variables here. for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); @@ -776,7 +771,7 @@ if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits; O << TAI->getAlignDirective() << NumBits; - if (CurrentSection && CurrentSection->getKind().isText()) + if (getCurrentSection()->getKind().isText()) if (unsigned FillValue = TAI->getTextAlignFillValue()) { O << ','; PrintHex(FillValue); Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=79324&r1=79323&r2=79324&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Aug 18 01:15:16 2009 @@ -24,12 +24,10 @@ raw_ostream &OS; const TargetAsmInfo &TAI; AsmPrinter *Printer; - const MCSection *CurSection; public: MCAsmStreamer(MCContext &Context, raw_ostream &_OS, const TargetAsmInfo &tai, AsmPrinter *_AsmPrinter) - : MCStreamer(Context), OS(_OS), TAI(tai), Printer(_AsmPrinter), - CurSection(0) {} + : MCStreamer(Context), OS(_OS), TAI(tai), Printer(_AsmPrinter) {} ~MCAsmStreamer() {} /// @name MCStreamer Interface Modified: llvm/trunk/lib/MC/MCStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=79324&r1=79323&r2=79324&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCStreamer.cpp Tue Aug 18 01:15:16 2009 @@ -11,7 +11,7 @@ using namespace llvm; -MCStreamer::MCStreamer(MCContext &_Context) : Context(_Context) { +MCStreamer::MCStreamer(MCContext &_Context) : Context(_Context), CurSection(0) { } MCStreamer::~MCStreamer() { From daniel at zuster.org Tue Aug 18 02:06:26 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 07:06:26 -0000 Subject: [llvm-commits] [llvm] r79325 - /llvm/trunk/lib/Support/Triple.cpp Message-ID: <200908180706.n7I76RmZ004366@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 02:06:26 2009 New Revision: 79325 URL: http://llvm.org/viewvc/llvm-project?rev=79325&view=rev Log: Fix Triple to recognize the 'bfin' arch. Modified: llvm/trunk/lib/Support/Triple.cpp Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=79325&r1=79324&r2=79325&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Tue Aug 18 02:06:26 2009 @@ -123,6 +123,8 @@ Arch = x86; else if (ArchName == "amd64" || ArchName == "x86_64") Arch = x86_64; + else if (ArchName == "bfin") + Arch = bfin; else if (ArchName == "pic16") Arch = pic16; else if (ArchName == "powerpc") From daniel at zuster.org Tue Aug 18 02:27:25 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 00:27:25 -0700 Subject: [llvm-commits] [llvm] r79314 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp In-Reply-To: References: <200908180443.n7I4hRtB019227@zion.cs.uiuc.edu> Message-ID: <6a8523d60908180027i6d6dec0cxb6238d8e4b0454e@mail.gmail.com> On Mon, Aug 17, 2009 at 10:14 PM, Eli Friedman wrote: > On Mon, Aug 17, 2009 at 9:43 PM, Daniel Dunbar wrote: >> @@ -144,8 +150,6 @@ >> ? ? Arch = sparc; >> ? else if (ArchName == "s390x") >> ? ? Arch = systemz; >> - ?else if (ArchName == "bfin") >> - ? ?Arch = bfin; >> ? else >> ? ? Arch = UnknownArch; > > Umm, was this bit intentional? Nope, thanks. -1 for manual merging. - Daniel From asl at math.spbu.ru Tue Aug 18 05:09:37 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 18 Aug 2009 10:09:37 -0000 Subject: [llvm-commits] [test-suite] r79329 - in /test-suite/trunk: ./ External/SPEC/CINT2000/186.crafty/ External/SPEC/CINT2000/197.parser/ External/SPEC/CINT2000/253.perlbmk/ External/SPEC/CINT2000/254.gap/ External/SPEC/CINT2006/400.perlbench/ External/SPEC/CINT2006/403.gcc/ External/SPEC/CINT2006/462.libquantum/ External/SPEC/CINT2006/483.xalancbmk/ MultiSource/Applications/ MultiSource/Applications/ClamAV/ MultiSource/Applications/minisat/ MultiSource/Benchmarks/Prolangs-C/archie-client/ SingleSource/ SingleSource/UnitTest... Message-ID: <200908181009.n7IA9b6u008024@zion.cs.uiuc.edu> Author: asl Date: Tue Aug 18 05:09:35 2009 New Revision: 79329 URL: http://llvm.org/viewvc/llvm-project?rev=79329&view=rev Log: Propagate recent cross-compile fixes to testsuite. Patch by Sandeep Patel! Modified: test-suite/trunk/External/SPEC/CINT2000/186.crafty/Makefile test-suite/trunk/External/SPEC/CINT2000/197.parser/Makefile test-suite/trunk/External/SPEC/CINT2000/253.perlbmk/Makefile test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile test-suite/trunk/External/SPEC/CINT2006/400.perlbench/Makefile test-suite/trunk/External/SPEC/CINT2006/403.gcc/Makefile test-suite/trunk/External/SPEC/CINT2006/462.libquantum/Makefile test-suite/trunk/External/SPEC/CINT2006/483.xalancbmk/Makefile test-suite/trunk/Makefile.rules test-suite/trunk/MultiSource/Applications/ClamAV/Makefile test-suite/trunk/MultiSource/Applications/Makefile test-suite/trunk/MultiSource/Applications/minisat/Makefile test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile test-suite/trunk/SingleSource/Makefile test-suite/trunk/SingleSource/UnitTests/Makefile test-suite/trunk/SingleSource/UnitTests/Threads/Makefile test-suite/trunk/SingleSource/UnitTests/Vector/build.c Modified: test-suite/trunk/External/SPEC/CINT2000/186.crafty/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2000/186.crafty/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT2000/186.crafty/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT2000/186.crafty/Makefile Tue Aug 18 05:09:35 2009 @@ -31,10 +31,10 @@ ifeq ($(TARGET_ARCH),ARM) CPPFLAGS += -DHAS_LONGLONG endif -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) CPPFLAGS += -DUNIX -DLINUX endif -ifeq ($(OS),Linux) +ifeq ($(TARGET_OS),Linux) CPPFLAGS += -DUNIX -DLINUX endif ifeq ($(ENDIAN),little) Modified: test-suite/trunk/External/SPEC/CINT2000/197.parser/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2000/197.parser/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT2000/197.parser/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT2000/197.parser/Makefile Tue Aug 18 05:09:35 2009 @@ -6,7 +6,7 @@ include $(LEVEL)/Makefile.config -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) CPPFLAGS += -D_ANSI_SOURCE=1 endif Modified: test-suite/trunk/External/SPEC/CINT2000/253.perlbmk/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2000/253.perlbmk/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT2000/253.perlbmk/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT2000/253.perlbmk/Makefile Tue Aug 18 05:09:35 2009 @@ -34,7 +34,7 @@ NT_SOURCES = nt_perlmain.c win32.c win32sck.c win32threads.c perllib.c UNIX_SOURCES = unix_perlmain.c -ifeq ($(strip $(OS)),Win32) +ifeq ($(strip $(TARGET_OS)),Win32) CPPFLAGS += -Iwin32 -I. -DWIN32 -D_CONSOLE LIBS += advapi32.lib wsock32.lib DO_NOT_COMPILE := $(UNIX_SOURCES) @@ -48,7 +48,7 @@ SPEC2K_DO_NOT_RECONFIGURE := 1 include $(LEVEL)/External/SPEC/Makefile.spec2000 -ifeq ($(strip $(OS)),Linux) +ifeq ($(strip $(TARGET_OS)),Linux) CPPFLAGS := $(filter-out -DSPEC_CPU2000,$(CPPFLAGS)) ifeq ($(ARCH),Alpha) CPPFLAGS += -DSPEC_CPU2000_LINUX_ALPHA Modified: test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT2000/254.gap/Makefile Tue Aug 18 05:09:35 2009 @@ -11,7 +11,7 @@ CPPFLAGS+= -DSPEC_CPU2000_LP64 endif -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) CPPFLAGS += -DSYS_IS_BSD else CPPFLAGS += -DSYS_IS_USG Modified: test-suite/trunk/External/SPEC/CINT2006/400.perlbench/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2006/400.perlbench/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT2006/400.perlbench/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT2006/400.perlbench/Makefile Tue Aug 18 05:09:35 2009 @@ -19,7 +19,7 @@ CPPFLAGS += -DPERL_CORE -DI_TIME -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) ifeq ($(ARCH),PowerPC) CPPFLAGS += -DSPEC_CPU_MACOSX_PPC endif Modified: test-suite/trunk/External/SPEC/CINT2006/403.gcc/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2006/403.gcc/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT2006/403.gcc/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT2006/403.gcc/Makefile Tue Aug 18 05:09:35 2009 @@ -10,7 +10,7 @@ CPPFLAGS += -DINLINE=__inline__ -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) CPPFLAGS += -DSPEC_CPU_MACOSX endif Modified: test-suite/trunk/External/SPEC/CINT2006/462.libquantum/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2006/462.libquantum/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT2006/462.libquantum/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT2006/462.libquantum/Makefile Tue Aug 18 05:09:35 2009 @@ -15,11 +15,11 @@ include ../../Makefile.spec2006 -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) CPPFLAGS += -DSPEC_CPU_MACOSX endif -ifeq ($(OS),Linux) +ifeq ($(TARGET_OS),Linux) CPPFLAGS += -DSPEC_CPU_LINUX endif Modified: test-suite/trunk/External/SPEC/CINT2006/483.xalancbmk/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2006/483.xalancbmk/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT2006/483.xalancbmk/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT2006/483.xalancbmk/Makefile Tue Aug 18 05:09:35 2009 @@ -20,10 +20,10 @@ -I$(SPEC_BENCH_DIR)/src/xercesc/util/Transcoders/Iconv \ -I$(SPEC_BENCH_DIR)/src/xalanc/include -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) CPPFLAGS += -DSPEC_CPU_MACOSX endif -ifeq ($(OS),Linux) +ifeq ($(TARGET_OS),Linux) CPPFLAGS += -DSPEC_CPU_LINUX endif Modified: test-suite/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.rules?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/Makefile.rules (original) +++ test-suite/trunk/Makefile.rules Tue Aug 18 05:09:35 2009 @@ -365,7 +365,7 @@ TARGET_LLIFLAGS += -relocation-model=pic -disable-fp-elim else TARGET_FLAGS += -fomit-frame-pointer - ifeq ($(OS),Darwin) + ifeq ($(TARGET_OS),Darwin) TARGET_FLAGS += -mdynamic-no-pic endif endif Modified: test-suite/trunk/MultiSource/Applications/ClamAV/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/ClamAV/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Applications/ClamAV/Makefile (original) +++ test-suite/trunk/MultiSource/Applications/ClamAV/Makefile Tue Aug 18 05:09:35 2009 @@ -37,40 +37,40 @@ # -- OS macros -- # It is especially important to get this correctly defined for windows. -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) CPPFLAGS += -DC_DARWIN endif -ifeq ($(OS),AIX) +ifeq ($(TARGET_OS),AIX) CPPFLAGS += -DC_AIX endif -ifeq ($(OS), IRIX) +ifeq ($(TARGET_OS), IRIX) CPPFLAGS += -DC_IRIX endif -ifeq ($(OS), Cygwin) +ifeq ($(TARGET_OS), Cygwin) CPPFLAGS += -DC_CYGWIN endif -ifeq ($(OS), FreeBSD) +ifeq ($(TARGET_OS), FreeBSD) CPPFLAGS += -DC_BSD endif -ifeq ($(OS), OpenBSD) +ifeq ($(TARGET_OS), OpenBSD) CPPFLAGS += -DC_BSD endif -ifeq ($(OS), NetBSD) +ifeq ($(TARGET_OS), NetBSD) CPPFLAGS += -DC_BSD endif -ifeq ($(OS), HP-UX) +ifeq ($(TARGET_OS), HP-UX) CPPFLAGS += -DC_HPUX endif -ifeq ($(OS), Interix) +ifeq ($(TARGET_OS), Interix) CPPFLAGS += -DC_INTERIX -DC_WINDOWS endif -ifeq ($(OS), Win32) +ifeq ($(TARGET_OS), Win32) CPPFLAGS += -DC_WINDOWS endif -ifeq ($(OS), mingw) +ifeq ($(TARGET_OS), mingw) CPPFLAGS += -DC_WINDOWS endif -ifeq ($(OS), Linux) +ifeq ($(TARGET_OS), Linux) CPPFLAGS += -DC_LINUX endif @@ -104,10 +104,10 @@ #compare debug output DIFFPROG := $(PROGDIR)/DiffOutput.sh "diff " -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) EXTRA_LLIFLAGS += -load=libz.dylib else -ifeq ($(OS),Linux) +ifeq ($(TARGET_OS),Linux) EXTRA_LLIFLAGS += -load=libz.so.1 else EXTRA_LLIFLAGS += -load=libz Modified: test-suite/trunk/MultiSource/Applications/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Applications/Makefile (original) +++ test-suite/trunk/MultiSource/Applications/Makefile Tue Aug 18 05:09:35 2009 @@ -12,16 +12,16 @@ endif # Obsequi uses Linux-only features; need to fix that -ifeq ($(OS),Linux) +ifeq ($(TARGET_OS),Linux) PARALLEL_DIRS += obsequi endif # kimwitu++ uses multi-byte chars, not available on sparc/solaris -ifneq ($(OS),SunOS) +ifneq ($(TARGET_OS),SunOS) PARALLEL_DIRS += kimwitu++ endif -ifeq ($(OS),SunOS) +ifeq ($(TARGET_OS),SunOS) PARALLEL_DIRS := $(filter-out SPASS, $(PARALLEL_DIRS)) PARALLEL_DIRS := $(filter-out hexxagon, $(PARALLEL_DIRS)) endif Modified: test-suite/trunk/MultiSource/Applications/minisat/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/minisat/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Applications/minisat/Makefile (original) +++ test-suite/trunk/MultiSource/Applications/minisat/Makefile Tue Aug 18 05:09:35 2009 @@ -17,7 +17,7 @@ include ../../Makefile.multisrc -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) SHLIBEXT := .dylib endif Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C/archie-client/Makefile Tue Aug 18 05:09:35 2009 @@ -9,6 +9,6 @@ include $(LEVEL)/MultiSource/Makefile.multisrc -ifeq ($(OS),SunOS) +ifeq ($(TARGET_OS),SunOS) LDFLAGS += -lsocket -lnsl endif Modified: test-suite/trunk/SingleSource/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/SingleSource/Makefile (original) +++ test-suite/trunk/SingleSource/Makefile Tue Aug 18 05:09:35 2009 @@ -1,6 +1,6 @@ LEVEL = .. -PARALLEL_DIRS = UnitTests Regression Benchmarks +PARALLEL_DIRS = UnitTests Regression Benchmarks CustomChecked LDFLAGS += -lm Modified: test-suite/trunk/SingleSource/UnitTests/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/SingleSource/UnitTests/Makefile (original) +++ test-suite/trunk/SingleSource/UnitTests/Makefile Tue Aug 18 05:09:35 2009 @@ -16,7 +16,7 @@ DIRS += SignlessTypes Threads # Only test Obj-C on darwin/x86 for time being. -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) ifeq ($(ARCH),x86) DIRS += ObjC ObjC++ endif @@ -27,7 +27,7 @@ # Darwin doesn't support weak/weak_import in a way that we can test in this # framework. -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) PROGRAMS_TO_SKIP := 2007-04-25-weak endif Modified: test-suite/trunk/SingleSource/UnitTests/Threads/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Threads/Makefile?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/SingleSource/UnitTests/Threads/Makefile (original) +++ test-suite/trunk/SingleSource/UnitTests/Threads/Makefile Tue Aug 18 05:09:35 2009 @@ -5,7 +5,7 @@ LDFLAGS += -lpthread # Darwin doesn't support tls. -ifeq ($(OS),Darwin) +ifeq ($(TARGET_OS),Darwin) PROGRAMS_TO_SKIP := tls endif Modified: test-suite/trunk/SingleSource/UnitTests/Vector/build.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Vector/build.c?rev=79329&r1=79328&r2=79329&view=diff ============================================================================== --- test-suite/trunk/SingleSource/UnitTests/Vector/build.c (original) +++ test-suite/trunk/SingleSource/UnitTests/Vector/build.c Tue Aug 18 05:09:35 2009 @@ -5,9 +5,11 @@ if (argc == 1123) X = 2.38213; FV A; A.V = (v4sf){ X, X, X, X }; // splat + printFV(&A); A.V = A.V * A.V; printFV(&A); A.V = (v4sf){ X, X, 0, 0 }; + printFV(&A); A.V = A.V+A.V; printFV(&A); return 0; From pietreka at gmail.com Tue Aug 18 05:27:00 2009 From: pietreka at gmail.com (Artur Pietrek) Date: Tue, 18 Aug 2009 12:27:00 +0200 Subject: [llvm-commits] [llvm] r79065 - /llvm/trunk/lib/Support/FormattedStream.cpp In-Reply-To: <017E3858-B88B-49F6-A87B-D887423B9978@apple.com> References: <200908150202.n7F22xqb015324@zion.cs.uiuc.edu> <017E3858-B88B-49F6-A87B-D887423B9978@apple.com> Message-ID: On Mon, Aug 17, 2009 at 6:30 PM, Dan Gohman wrote: > > > On Aug 17, 2009, at 2:42 AM, Artur Pietrek wrote: > > > > On Sat, Aug 15, 2009 at 4:02 AM, Dan Gohman < > gohman at apple.com> wrote: > >> >> -/// ComputeColumn - Examine the current output and figure out which >> +/// CountColumns - Examine the given char sequence and figure out which >> /// column we end up in after output. >> /// >> -void formatted_raw_ostream::ComputeColumn() { >> +static unsigned CountColumns(unsigned Column, const char *Ptr, size_t >> Size) { >> // Keep track of the current column by scanning the string for >> // special characters >> >> - // The buffer may have been allocated underneath us. >> - if (Scanned == 0 && GetNumBytesInBuffer() != 0) { >> - Scanned = begin(); >> - } >> - >> - while (Scanned != end()) { >> - ++ColumnScanned; >> - if (*Scanned == '\n' || *Scanned == '\r') >> - ColumnScanned = 0; >> - else if (*Scanned == '\t') >> + for (const char *End = Ptr + Size; Ptr != End; ++Ptr) { >> + ++Column; >> + if (*Ptr == '\n' || *Ptr == '\r') >> + Column = 0; >> + else if (*Ptr == '\t') >> // Assumes tab stop = 8 characters. >> - ColumnScanned += (8 - (ColumnScanned & 0x7)) & 0x7; >> - ++Scanned; >> + Column += (8 - (Column & 0x7)) & 0x7; >> } >> + >> + return Column; >> +} > > > Hi all, > > Is it legal to output Instruction or any Value using formatted stream like > this: > Out << *Instr; > > > Yes, that's fine. Fairly common, in fact. > > > I was using it to print commented LLVM instructions to my assembly to check > if I'm translating instructions correctly, but since the change above I get > segfault after running my backend. > > Changing line: > for (const char *End = Ptr + Size; Ptr != End; ++Ptr) { > > to: > + for (const char *End = Ptr + Size; Ptr < End; ++Ptr) { > > helps. Is it bug or I just should not use it that way? > > > The change shouldn't be necessary. It sounds like there's a bug. Is Ptr > pointing to a valid string when this happens? > Ptr is not a valid string and Size is 0x1000. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090818/60bc6c0c/attachment.html From eocallaghan at auroraux.org Tue Aug 18 06:07:59 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Tue, 18 Aug 2009 11:07:59 -0000 Subject: [llvm-commits] [compiler-rt] r79330 - in /compiler-rt/trunk: lib/endianness.h test/Unit/endianness.h Message-ID: <200908181107.n7IB7xmI015319@zion.cs.uiuc.edu> Author: evocallaghan Date: Tue Aug 18 06:07:59 2009 New Revision: 79330 URL: http://llvm.org/viewvc/llvm-project?rev=79330&view=rev Log: Fix pre-processor mistake for BSDs in endianness.h Modified: compiler-rt/trunk/lib/endianness.h compiler-rt/trunk/test/Unit/endianness.h Modified: compiler-rt/trunk/lib/endianness.h URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/endianness.h?rev=79330&r1=79329&r2=79330&view=diff ============================================================================== --- compiler-rt/trunk/lib/endianness.h (original) +++ compiler-rt/trunk/lib/endianness.h Tue Aug 18 06:07:59 2009 @@ -36,7 +36,7 @@ /* .. */ -#if defined(__FreeBSD__) && defined(__NetBSD__) && defined(__OpenBSD__) && defined(__DragonflyBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonflyBSD__) #include #if _BYTE_ORDER == _BIG_ENDIAN Modified: compiler-rt/trunk/test/Unit/endianness.h URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/endianness.h?rev=79330&r1=79329&r2=79330&view=diff ============================================================================== --- compiler-rt/trunk/test/Unit/endianness.h (original) +++ compiler-rt/trunk/test/Unit/endianness.h Tue Aug 18 06:07:59 2009 @@ -36,7 +36,7 @@ /* .. */ -#if defined(__FreeBSD__) && defined(__NetBSD__) && defined(__OpenBSD__) && defined(__DragonflyBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonflyBSD__) #include #if _BYTE_ORDER == _BIG_ENDIAN From eocallaghan at auroraux.org Tue Aug 18 06:50:23 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Tue, 18 Aug 2009 11:50:23 -0000 Subject: [llvm-commits] [compiler-rt] r79331 - /compiler-rt/trunk/test/Unit/endianness.h Message-ID: <200908181150.n7IBoN8b020833@zion.cs.uiuc.edu> Author: evocallaghan Date: Tue Aug 18 06:50:23 2009 New Revision: 79331 URL: http://llvm.org/viewvc/llvm-project?rev=79331&view=rev Log: Fix testsuit build on linux. Modified: compiler-rt/trunk/test/Unit/endianness.h Modified: compiler-rt/trunk/test/Unit/endianness.h URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/endianness.h?rev=79331&r1=79330&r2=79331&view=diff ============================================================================== --- compiler-rt/trunk/test/Unit/endianness.h (original) +++ compiler-rt/trunk/test/Unit/endianness.h Tue Aug 18 06:50:23 2009 @@ -72,7 +72,7 @@ /* .. */ -#if defined(__Linux__) +#if defined(__linux__) #include #if __BYTE_ORDER == __BIG_ENDIAN From eocallaghan at auroraux.org Tue Aug 18 06:54:44 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Tue, 18 Aug 2009 11:54:44 -0000 Subject: [llvm-commits] [compiler-rt] r79332 - in /compiler-rt/trunk: lib/endianness.h test/Unit/endianness.h Message-ID: <200908181154.n7IBsitK021390@zion.cs.uiuc.edu> Author: evocallaghan Date: Tue Aug 18 06:54:44 2009 New Revision: 79332 URL: http://llvm.org/viewvc/llvm-project?rev=79332&view=rev Log: Add support for ellcc, Credit to Richard Pennington. Modified: compiler-rt/trunk/lib/endianness.h compiler-rt/trunk/test/Unit/endianness.h Modified: compiler-rt/trunk/lib/endianness.h URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/endianness.h?rev=79332&r1=79331&r2=79332&view=diff ============================================================================== --- compiler-rt/trunk/lib/endianness.h (original) +++ compiler-rt/trunk/lib/endianness.h Tue Aug 18 06:54:44 2009 @@ -52,7 +52,7 @@ /* .. */ /* Mac OSX has __BIG_ENDIAN__ or __LITTLE_ENDIAN__ automatically set by the compiler (at least with GCC) */ -#if defined(__APPLE__) && defined(__MACH__) +#if defined(__APPLE__) && defined(__MACH__) || defined(__ellcc__ ) #ifdef __BIG_ENDIAN__ #if __BIG_ENDIAN__ Modified: compiler-rt/trunk/test/Unit/endianness.h URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/endianness.h?rev=79332&r1=79331&r2=79332&view=diff ============================================================================== --- compiler-rt/trunk/test/Unit/endianness.h (original) +++ compiler-rt/trunk/test/Unit/endianness.h Tue Aug 18 06:54:44 2009 @@ -52,7 +52,7 @@ /* .. */ /* Mac OSX has __BIG_ENDIAN__ or __LITTLE_ENDIAN__ automatically set by the compiler (at least with GCC) */ -#if defined(__APPLE__) && defined(__MACH__) +#if defined(__APPLE__) && defined(__MACH__) || defined(__ellcc__ ) #ifdef __BIG_ENDIAN__ #if __BIG_ENDIAN__ From brukman+llvm at gmail.com Tue Aug 18 08:50:30 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Tue, 18 Aug 2009 13:50:30 -0000 Subject: [llvm-commits] [llvm] r79333 - /llvm/trunk/include/llvm/ADT/Triple.h Message-ID: <200908181350.n7IDoUYn003392@zion.cs.uiuc.edu> Author: brukman Date: Tue Aug 18 08:50:28 2009 New Revision: 79333 URL: http://llvm.org/viewvc/llvm-project?rev=79333&view=rev Log: Fixed spelling of MSP430. Modified: llvm/trunk/include/llvm/ADT/Triple.h Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=79333&r1=79332&r2=79333&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Tue Aug 18 08:50:28 2009 @@ -42,7 +42,7 @@ cellspu, // CellSPU: spu, cellspu mips, // MIPS: mips, mipsallegrex mipsel, // MIPSEL: mipsel, mipsallegrexel, psp - msp430, // MPS430: msp430 + msp430, // MSP430: msp430 pic16, // PIC16: pic16 ppc, // PPC: powerpc ppc64, // PPC64: powerpc64 From asl at math.spbu.ru Tue Aug 18 09:06:13 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 18 Aug 2009 14:06:13 -0000 Subject: [llvm-commits] [llvm] r79334 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Message-ID: <200908181406.n7IE6Dis005421@zion.cs.uiuc.edu> Author: asl Date: Tue Aug 18 09:06:12 2009 New Revision: 79334 URL: http://llvm.org/viewvc/llvm-project?rev=79334&view=rev Log: Text sections should have 'exec' flag set. This seems to unbreak libstdc++ on linux. Patch by Dmitry Gorbachev! Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=79334&r1=79333&r2=79334&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Aug 18 09:06:12 2009 @@ -487,6 +487,9 @@ if (!K.isMetadata()) Flags |= MCSectionELF::SHF_ALLOC; + if (K.isText()) + Flags |= MCSectionELF::SHF_EXECINSTR; + if (K.isWriteable()) Flags |= MCSectionELF::SHF_WRITE; From brukman+llvm at gmail.com Tue Aug 18 09:17:49 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Tue, 18 Aug 2009 14:17:49 -0000 Subject: [llvm-commits] [TV] r79335 - /television/trunk/tools/llvm-tv/Makefile Message-ID: <200908181417.n7IEHnI6006863@zion.cs.uiuc.edu> Author: brukman Date: Tue Aug 18 09:17:49 2009 New Revision: 79335 URL: http://llvm.org/viewvc/llvm-project?rev=79335&view=rev Log: Add PALibDir to LD_LIBRARY_PATH to access libLLVMDataStructure.so . Modified: television/trunk/tools/llvm-tv/Makefile Modified: television/trunk/tools/llvm-tv/Makefile URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/Makefile?rev=79335&r1=79334&r2=79335&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/Makefile (original) +++ television/trunk/tools/llvm-tv/Makefile Tue Aug 18 09:17:49 2009 @@ -23,8 +23,9 @@ $(LLVMToolDir)/llvm-tv.exe: Makefile echo "Creating llvm-tv.exe script" - echo exec env LD_LIBRARY_PATH=$(WXLIB):$(LibDir):\$$LD_LIBRARY_PATH $(LLVMTV) \ - > $@ + echo exec env \ + LD_LIBRARY_PATH=$(WXLIB):$(LibDir):$(PALibDir):\$$LD_LIBRARY_PATH \ + $(LLVMTV) > $@ chmod u+x $@ $(LLVMToolDir)/opt-snap: Makefile From brukman+llvm at gmail.com Tue Aug 18 09:19:58 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Tue, 18 Aug 2009 14:19:58 -0000 Subject: [llvm-commits] [TV] r79336 - /television/trunk/README.txt Message-ID: <200908181419.n7IEJwIO007150@zion.cs.uiuc.edu> Author: brukman Date: Tue Aug 18 09:19:58 2009 New Revision: 79336 URL: http://llvm.org/viewvc/llvm-project?rev=79336&view=rev Log: Updated instructions to include checking out poolalloc, and using a recent-but-not-latest revision of LLVM to make it all work together. Modified: television/trunk/README.txt Modified: television/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/television/trunk/README.txt?rev=79336&r1=79335&r2=79336&view=diff ============================================================================== --- television/trunk/README.txt (original) +++ television/trunk/README.txt Tue Aug 18 09:19:58 2009 @@ -27,14 +27,40 @@ C++ compiler that you're using for llvm. Otherwise, you may get weird link errors when trying to link the llvm-tv tool. -2. Configure and compile llvm-tv (you need an LLVM source and build trees): +2. Check out LLVM: -% cd path/to/llvm-tv +# We're checking out this version and not trunk since poolalloc doesn't build +# with top of trunk LLVM. +% svn -q co -r 78786 http://llvm.org/svn/llvm-project/llvm/trunk llvm + +3. Configure and build LLVM: + +% cd path/to/llvm-obj +% ~/llvm/configure [configure opts] +% make + +4. Check out PoolAlloc (we need it for the DataStructure library): + +% svn -q co http://llvm.org/svn/llvm-project/poolalloc/trunk poolalloc + +5. Configure and build PoolAlloc: + +% cd path/to/poolalloc-obj +% ~/poolalloc/configure --with-llvmsrc=[path] \ + --with-llvmobj=[path] +% make + +2. Configure and compile llvm-tv: + +% cd path/to/llvm-tv-obj # If you're building in llvm/projects/llvm-tv, then you don't need # to specify the --with-llvm-* options. -% ./configure --with-llvm-src=[path] --with-llvm-obj=[path] \ - --with-poolalloc-src=[path] --with-poolalloc-obj=[path] -% gmake +% ~/llvm-tv/configure --with-llvm-src=[path] --with-llvm-obj=[path] \ + --with-poolalloc-src=[path] --with-poolalloc-obj=[path] +% make + +Note: the llvm-tv.exe and opt-snap scripts will be placed into LLVM's binary +directory, not the LLVM-TV binary directory. Example of usage: From gohman at apple.com Tue Aug 18 09:58:19 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 14:58:19 -0000 Subject: [llvm-commits] [llvm] r79337 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/globalsra-unknown-index.ll Message-ID: <200908181458.n7IEwJBE011961@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 09:58:19 2009 New Revision: 79337 URL: http://llvm.org/viewvc/llvm-project?rev=79337&view=rev Log: Fix a bug that caused globalopt to miscompile tramp3d: don't miss unruly indices for arrays that are members of structs. Added: llvm/trunk/test/Transforms/GlobalOpt/globalsra-unknown-index.ll Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=79337&r1=79336&r2=79337&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Tue Aug 18 09:58:19 2009 @@ -426,13 +426,18 @@ // Scalar replacing *just* the outer index of the array is probably not // going to be a win anyway, so just give up. for (++GEPI; // Skip array index. - GEPI != E && (isa(*GEPI) || isa(*GEPI)); + GEPI != E; ++GEPI) { uint64_t NumElements; if (const ArrayType *SubArrayTy = dyn_cast(*GEPI)) NumElements = SubArrayTy->getNumElements(); - else - NumElements = cast(*GEPI)->getNumElements(); + else if (const VectorType *SubVectorTy = dyn_cast(*GEPI)) + NumElements = SubVectorTy->getNumElements(); + else { + assert(isa(*GEPI) && + "Indexed GEP type is not array, vector, or struct!"); + continue; + } ConstantInt *IdxVal = dyn_cast(GEPI.getOperand()); if (!IdxVal || IdxVal->getZExtValue() >= NumElements) Added: llvm/trunk/test/Transforms/GlobalOpt/globalsra-unknown-index.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/globalsra-unknown-index.ll?rev=79337&view=auto ============================================================================== --- llvm/trunk/test/Transforms/GlobalOpt/globalsra-unknown-index.ll (added) +++ llvm/trunk/test/Transforms/GlobalOpt/globalsra-unknown-index.ll Tue Aug 18 09:58:19 2009 @@ -0,0 +1,41 @@ +; RUN: llvm-as < %s | opt -globalopt | llvm-dis > %t +; RUN: grep {@Y = internal global \\\[3 x \[%\]struct.X\\\] zeroinitializer} %t +; RUN: grep load %t | count 6 +; RUN: grep {add i32 \[%\]a, \[%\]b} %t | count 3 + +; globalopt should not sra the global, because it can't see the index. + +%struct.X = type { [3 x i32], [3 x i32] } + + at Y = internal global [3 x %struct.X] zeroinitializer + + at addr = external global i8 + +define void @frob() { + store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 ptrtoint (i8* @addr to i64)), align 4 + ret void +} +define i32 @borf(i64 %i, i64 %j) { + %p = getelementptr inbounds [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0 + %a = load i32* %p + %q = getelementptr inbounds [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 0 + %b = load i32* %q + %c = add i32 %a, %b + ret i32 %c +} +define i32 @borg(i64 %i, i64 %j) { + %p = getelementptr inbounds [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 1 + %a = load i32* %p + %q = getelementptr inbounds [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 1 + %b = load i32* %q + %c = add i32 %a, %b + ret i32 %c +} +define i32 @borh(i64 %i, i64 %j) { + %p = getelementptr inbounds [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 2 + %a = load i32* %p + %q = getelementptr inbounds [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 2 + %b = load i32* %q + %c = add i32 %a, %b + ret i32 %c +} From gohman at apple.com Tue Aug 18 10:18:18 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 15:18:18 -0000 Subject: [llvm-commits] [llvm] r79338 - in /llvm/trunk: lib/CodeGen/BranchFolding.cpp test/CodeGen/Thumb2/thumb2-ifcvt2.ll test/CodeGen/X86/2009-08-06-branchfolder-crash.ll test/CodeGen/X86/omit-label.ll Message-ID: <200908181518.n7IFII7x014625@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 10:18:18 2009 New Revision: 79338 URL: http://llvm.org/viewvc/llvm-project?rev=79338&view=rev Log: Make tail merging handle blocks with repeated predecessors correctly, and remove RemoveDuplicateSuccessor, as it is no longer necessary, and because it breaks assumptions made in MachineBasicBlock::isOnlyReachableByFallthrough. Convert test/CodeGen/X86/omit-label.ll to FileCheck and add a testcase for PR4732. test/CodeGen/Thumb2/thumb2-ifcvt2.ll sees a diff with this commit due to it being bugpoint-reduced to the point where it doesn't matter what the condition for the branch is. Add some more interesting code to test/CodeGen/X86/2009-08-06-branchfolder-crash.ll, which is the testcase that originally motivated the RemoveDuplicateSuccessor code, to help verify that the original problem isn't being re-broken. Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll llvm/trunk/test/CodeGen/X86/2009-08-06-branchfolder-crash.ll llvm/trunk/test/CodeGen/X86/omit-label.ll Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=79338&r1=79337&r2=79338&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Tue Aug 18 10:18:18 2009 @@ -700,6 +700,7 @@ for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { if (I->pred_size() >= 2 && I->pred_size() < TailMergeThreshold) { + SmallPtrSet UniquePreds; MachineBasicBlock *IBB = I; MachineBasicBlock *PredBB = prior(I); MergePotentials.clear(); @@ -710,6 +711,9 @@ // Skip blocks that loop to themselves, can't tail merge these. if (PBB==IBB) continue; + // Visit each predecessor only once. + if (!UniquePreds.insert(PBB)) + continue; MachineBasicBlock *TBB = 0, *FBB = 0; SmallVector Cond; if (!TII->AnalyzeBranch(*PBB, TBB, FBB, Cond, true)) { @@ -850,27 +854,6 @@ return CanFallThrough(CurBB, CurUnAnalyzable, TBB, FBB, Cond); } -/// RemoveDuplicateSuccessor - make sure block Pred has at most one -/// successor edge leading to Succ. This is only called in one place, -/// but Chris prefers that it be a separate function. -static void RemoveDuplicateSuccessor(MachineBasicBlock *Pred, - MachineBasicBlock *Succ) { - MachineBasicBlock::succ_iterator SI = Pred->succ_begin(); - bool found = false; - while (SI != Pred->succ_end()) { - if (*SI == Succ) { - if (!found) { - found = true; - ++SI; - } else { - SI = Pred->removeSuccessor(SI); - } - } else { - ++SI; - } - } -} - /// IsBetterFallthrough - Return true if it would be clearly better to /// fall-through to MBB1 than to fall through into MBB2. This has to return /// a strict ordering, returning true for both (MBB1,MBB2) and (MBB2,MBB1) will @@ -914,10 +897,6 @@ while (!MBB->pred_empty()) { MachineBasicBlock *Pred = *(MBB->pred_end()-1); Pred->ReplaceUsesOfBlockWith(MBB, FallThrough); - // If this resulted in a predecessor with true and false edges - // both going to the fallthrough block, clean up; - // BranchFolding doesn't like this. - RemoveDuplicateSuccessor(Pred, FallThrough); } // If MBB was the target of a jump table, update jump tables to go to the // fallthrough instead. Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll?rev=79338&r1=79337&r2=79338&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt2.ll Tue Aug 18 10:18:18 2009 @@ -82,7 +82,7 @@ entry: ; CHECK: t2: ; CHECK: cmp r0, #0 -; CHECK: bne.n +; CHECK: beq.n br i1 undef, label %bb.i.i3, label %growMapping.exit bb.i.i3: ; preds = %entry Modified: llvm/trunk/test/CodeGen/X86/2009-08-06-branchfolder-crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-08-06-branchfolder-crash.ll?rev=79338&r1=79337&r2=79338&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-08-06-branchfolder-crash.ll (original) +++ llvm/trunk/test/CodeGen/X86/2009-08-06-branchfolder-crash.ll Tue Aug 18 10:18:18 2009 @@ -88,3 +88,55 @@ } declare i32 @safe() + +define i32 @func_35(i8 signext %p_35) nounwind readonly { +entry: + %tobool = icmp eq i8 %p_35, 0 ; [#uses=1] + br i1 %tobool, label %lor.lhs.false, label %if.then + +lor.lhs.false: ; preds = %entry + %tmp1 = load i8* @g_3 ; [#uses=1] + %tobool3 = icmp eq i8 %tmp1, 0 ; [#uses=1] + br i1 %tobool3, label %return, label %if.then + +if.then: ; preds = %lor.lhs.false, %entry + %tmp4 = load i8* @g_3 ; [#uses=1] + %conv5 = sext i8 %tmp4 to i32 ; [#uses=1] + ret i32 %conv5 + +return: ; preds = %lor.lhs.false + ret i32 0 +} + +define void @bar(i32 %p_5) noreturn nounwind { +entry: + %cmp = icmp sgt i32 %p_5, 0 ; [#uses=2] + %call = tail call i32 @safe() nounwind ; [#uses=1] + %conv1 = trunc i32 %call to i8 ; [#uses=3] + %tobool.i = xor i1 %cmp, true ; [#uses=3] + %cmp.i = icmp sgt i8 %conv1, 0 ; [#uses=3] + %or.cond.i = or i1 %cmp.i, %tobool.i ; [#uses=1] + br i1 %or.cond.i, label %lor.rhs.i, label %land.lhs.true3.i + +land.lhs.true3.i: ; preds = %entry + %xor = zext i1 %cmp to i32 ; [#uses=1] + %conv5.i = sext i8 %conv1 to i32 ; [#uses=1] + %cmp7.i = icmp slt i32 %conv5.i, %xor ; [#uses=1] + %cmp7.i.not = xor i1 %cmp7.i, true ; [#uses=1] + %or.cond23.i = and i1 %cmp.i, %tobool.i ; [#uses=1] + %or.cond = and i1 %cmp7.i.not, %or.cond23.i ; [#uses=1] + br i1 %or.cond, label %lor.end.i, label %for.inc + +lor.rhs.i: ; preds = %entry + %or.cond23.i.old = and i1 %cmp.i, %tobool.i ; [#uses=1] + br i1 %or.cond23.i.old, label %lor.end.i, label %for.inc + +lor.end.i: ; preds = %lor.rhs.i, %land.lhs.true3.i + %tobool19.i = icmp eq i8 %conv1, 0 ; [#uses=0] + br label %for.inc + +for.inc: ; preds = %for.inc, %lor.end.i, %lor.rhs.i, %land.lhs.true3.i + br label %for.inc +} + +declare i32 @safe() Modified: llvm/trunk/test/CodeGen/X86/omit-label.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/omit-label.ll?rev=79338&r1=79337&r2=79338&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/omit-label.ll (original) +++ llvm/trunk/test/CodeGen/X86/omit-label.ll Tue Aug 18 10:18:18 2009 @@ -1,7 +1,11 @@ -; RUN: llvm-as < %s | llc -march=x86-64 | grep BB1_1: +; RUN: llvm-as < %s | llc -march=x86-64 -asm-verbose=false | FileCheck %s ; PR4126 +; PR4732 -; Don't omit this label's definition. +; Don't omit these labels' definitions. + +; CHECK: bux: +; CHECK: .LBB1_1: define void @bux(i32 %p_53) nounwind optsize { entry: @@ -21,3 +25,33 @@ } declare i32 @baz(...) + +; Don't omit this label in the assembly output. +; CHECK: int321: +; CHECK: jne .LBB2_1 +; CHECK: jle .LBB2_1 +; CHECK: .LBB2_1: + +define void @int321(i8 signext %p_103, i32 %uint8p_104) nounwind readnone { +entry: + %tobool = icmp eq i8 %p_103, 0 ; [#uses=1] + %cmp.i = icmp sgt i8 %p_103, 0 ; [#uses=1] + %or.cond = and i1 %tobool, %cmp.i ; [#uses=1] + br i1 %or.cond, label %land.end.i, label %for.cond.preheader + +land.end.i: ; preds = %entry + %conv3.i = sext i8 %p_103 to i32 ; [#uses=1] + %div.i = sdiv i32 1, %conv3.i ; [#uses=1] + %tobool.i = icmp eq i32 %div.i, -2147483647 ; [#uses=0] + br label %for.cond.preheader + +for.cond.preheader: ; preds = %land.end.i, %entry + %cmp = icmp sgt i8 %p_103, 1 ; [#uses=1] + br i1 %cmp, label %for.end.split, label %for.cond + +for.cond: ; preds = %for.cond.preheader, %for.cond + br label %for.cond + +for.end.split: ; preds = %for.cond.preheader + ret void +} From ofv at wanadoo.es Tue Aug 18 10:29:35 2009 From: ofv at wanadoo.es (Oscar Fuentes) Date: Tue, 18 Aug 2009 15:29:35 -0000 Subject: [llvm-commits] [llvm] r79339 - in /llvm/trunk: CMakeLists.txt docs/CMake.html Message-ID: <200908181529.n7IFTaxm016112@zion.cs.uiuc.edu> Author: ofv Date: Tue Aug 18 10:29:35 2009 New Revision: 79339 URL: http://llvm.org/viewvc/llvm-project?rev=79339&view=rev Log: CMake: LLVM_ENABLE_PIC now defaults to ON, as in `configure'. This is required on some platforms for building shared libraries that link to the LLVM libraries. Modified: llvm/trunk/CMakeLists.txt llvm/trunk/docs/CMake.html Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=79339&r1=79338&r2=79339&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Tue Aug 18 10:29:35 2009 @@ -159,7 +159,7 @@ include(config-ix) -option(LLVM_ENABLE_PIC "Build Position-Independent Code" OFF) +option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) set(ENABLE_PIC 0) if( LLVM_ENABLE_PIC ) Modified: llvm/trunk/docs/CMake.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CMake.html?rev=79339&r1=79338&r2=79339&view=diff ============================================================================== --- llvm/trunk/docs/CMake.html (original) +++ llvm/trunk/docs/CMake.html Tue Aug 18 10:29:35 2009 @@ -264,9 +264,9 @@ CMAKE_BUILD_TYPE is Release.
      LLVM_ENABLE_PIC:BOOL
      -
      Add the -fPIC flag to the compiler command-line, if the - compiler supports this flag. Some systems, like Windows, does not - need this flag. Defaults to OFF.
      +
      Add the -fPIC flag for the compiler command-line, if the + compiler supports this flag. Some systems, like Windows, do not + need this flag. Defaults to ON.
      LLVM_BUILD_32_BITS:BOOL
      Build 32-bits executables and libraries on 64-bits systems. This From asl at math.spbu.ru Tue Aug 18 10:40:32 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 18 Aug 2009 15:40:32 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79340 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200908181540.n7IFeWeF017519@zion.cs.uiuc.edu> Author: asl Date: Tue Aug 18 10:40:32 2009 New Revision: 79340 URL: http://llvm.org/viewvc/llvm-project?rev=79340&view=rev Log: gcc includes are not order-independent. We really should #include config.h + tm.h before any other headers. This unbreaks cross-mingw build 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=79340&r1=79339&r2=79340&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Aug 18 10:40:32 2009 @@ -59,6 +59,7 @@ #include "config.h" #include "system.h" #include "coretypes.h" +#include "tm.h" #include "except.h" #include "flags.h" #include "tree.h" @@ -67,7 +68,6 @@ #include "target.h" #include "toplev.h" #include "timevar.h" -#include "tm.h" #include "function.h" #include "tree-inline.h" #include "langhooks.h" From baldrick at free.fr Tue Aug 18 10:55:05 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Aug 2009 15:55:05 -0000 Subject: [llvm-commits] [gcc-plugin] r79341 - /gcc-plugin/trunk/llvm-backend.cpp Message-ID: <200908181555.n7IFt5A6019362@zion.cs.uiuc.edu> Author: baldrick Date: Tue Aug 18 10:55:05 2009 New Revision: 79341 URL: http://llvm.org/viewvc/llvm-project?rev=79341&view=rev Log: Use the same flags as the corresponding gcc pass. This means that the gimple we get will be in SSA form. I think this is a good idea, but it's not clear yet. Modified: gcc-plugin/trunk/llvm-backend.cpp Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=79341&r1=79340&r2=79341&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Tue Aug 18 10:55:05 2009 @@ -1879,12 +1879,12 @@ NULL, /* next */ 0, /* static_pass_number */ TV_EXPAND, /* tv_id */ - PROP_gimple_lcf | PROP_gimple_leh | - PROP_gimple_lomp | PROP_cfg, /* properties_required */ + PROP_ssa | PROP_gimple_leh + | PROP_gimple_lomp | PROP_cfg, /* properties_required */ 0, /* properties_provided */ PROP_ssa | PROP_trees, /* properties_destroyed */ - TODO_dump_func | TODO_verify_flow - | TODO_verify_stmts, /* todo_flags_start */ + TODO_dump_func | TODO_verify_ssa + | TODO_verify_flow | TODO_verify_stmts, /* todo_flags_start */ TODO_ggc_collect /* todo_flags_finish */ } }; From sabre at nondot.org Tue Aug 18 11:46:29 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 16:46:29 -0000 Subject: [llvm-commits] [llvm] r79343 - /llvm/trunk/lib/MC/MCNullStreamer.cpp Message-ID: <200908181646.n7IGkThe025901@zion.cs.uiuc.edu> Author: lattner Date: Tue Aug 18 11:46:29 2009 New Revision: 79343 URL: http://llvm.org/viewvc/llvm-project?rev=79343&view=rev Log: null streamer needs to maintain the current section as well. Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=79343&r1=79342&r2=79343&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Tue Aug 18 11:46:29 2009 @@ -26,7 +26,9 @@ /// @name MCStreamer Interface /// @{ - virtual void SwitchSection(const MCSection *Section) {} + virtual void SwitchSection(const MCSection *Section) { + CurSection = Section; + } virtual void EmitLabel(MCSymbol *Symbol) {} From gohman at apple.com Tue Aug 18 11:46:41 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 16:46:41 -0000 Subject: [llvm-commits] [llvm] r79344 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h include/llvm/Analysis/ScalarEvolutionExpander.h include/llvm/Analysis/ScalarEvolutionExpressions.h lib/Analysis/ScalarEvolution.cpp lib/Analysis/ScalarEvolutionExpander.cpp test/Transforms/IndVarSimplify/preserve-gep-nested.ll Message-ID: <200908181646.n7IGkfln025942@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 11:46:41 2009 New Revision: 79344 URL: http://llvm.org/viewvc/llvm-project?rev=79344&view=rev Log: Generalize ScalarEvolution to be able to analyze GEPs when TargetData is not present. It still uses TargetData when available. This generalization also fixed some limitations in the TargetData case; the attached testcase covers this. Added: llvm/trunk/test/Transforms/IndVarSimplify/preserve-gep-nested.ll Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=79344&r1=79343&r2=79344&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Tue Aug 18 11:46:41 2009 @@ -433,6 +433,8 @@ const SCEV *getUMaxExpr(SmallVectorImpl &Operands); const SCEV *getSMinExpr(const SCEV *LHS, const SCEV *RHS); const SCEV *getUMinExpr(const SCEV *LHS, const SCEV *RHS); + const SCEV *getFieldOffsetExpr(const StructType *STy, unsigned FieldNo); + const SCEV *getAllocSizeExpr(const Type *AllocTy); const SCEV *getUnknown(Value *V); const SCEV *getCouldNotCompute(); Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h?rev=79344&r1=79343&r2=79344&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h Tue Aug 18 11:46:41 2009 @@ -115,6 +115,10 @@ Value *visitUMaxExpr(const SCEVUMaxExpr *S); + Value *visitFieldOffsetExpr(const SCEVFieldOffsetExpr *S); + + Value *visitAllocSizeExpr(const SCEVAllocSizeExpr *S); + Value *visitUnknown(const SCEVUnknown *S) { return S->getValue(); } Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=79344&r1=79343&r2=79344&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Tue Aug 18 11:46:41 2009 @@ -26,8 +26,8 @@ // These should be ordered in terms of increasing complexity to make the // folders simpler. scConstant, scTruncate, scZeroExtend, scSignExtend, scAddExpr, scMulExpr, - scUDivExpr, scAddRecExpr, scUMaxExpr, scSMaxExpr, scUnknown, - scCouldNotCompute + scUDivExpr, scAddRecExpr, scUMaxExpr, scSMaxExpr, + scFieldOffset, scAllocSize, scUnknown, scCouldNotCompute }; //===--------------------------------------------------------------------===// @@ -488,6 +488,90 @@ } }; + //===--------------------------------------------------------------------===// + /// SCEVTargetDataConstant - This node is the base class for representing + /// target-dependent values in a target-independent way. + /// + class SCEVTargetDataConstant : public SCEV { + protected: + const Type *Ty; + SCEVTargetDataConstant(const FoldingSetNodeID &ID, enum SCEVTypes T, + const Type *ty) : + SCEV(ID, T), Ty(ty) {} + + public: + virtual bool isLoopInvariant(const Loop *) const { return true; } + virtual bool hasComputableLoopEvolution(const Loop *) const { + return false; // not computable + } + + virtual bool hasOperand(const SCEV *) const { + return false; + } + + bool dominates(BasicBlock *, DominatorTree *) const { + return true; + } + + virtual const Type *getType() const { return Ty; } + + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const SCEVTargetDataConstant *S) { return true; } + static inline bool classof(const SCEV *S) { + return S->getSCEVType() == scFieldOffset || + S->getSCEVType() == scAllocSize; + } + }; + + //===--------------------------------------------------------------------===// + /// SCEVFieldOffsetExpr - This node represents an offsetof expression. + /// + class SCEVFieldOffsetExpr : public SCEVTargetDataConstant { + friend class ScalarEvolution; + + const StructType *STy; + unsigned FieldNo; + SCEVFieldOffsetExpr(const FoldingSetNodeID &ID, const Type *ty, + const StructType *sty, unsigned fieldno) : + SCEVTargetDataConstant(ID, scFieldOffset, ty), + STy(sty), FieldNo(fieldno) {} + + public: + const StructType *getStructType() const { return STy; } + unsigned getFieldNo() const { return FieldNo; } + + virtual void print(raw_ostream &OS) const; + + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const SCEVFieldOffsetExpr *S) { return true; } + static inline bool classof(const SCEV *S) { + return S->getSCEVType() == scFieldOffset; + } + }; + + //===--------------------------------------------------------------------===// + /// SCEVAllocSize - This node represents a sizeof expression. + /// + class SCEVAllocSizeExpr : public SCEVTargetDataConstant { + friend class ScalarEvolution; + + const Type *AllocTy; + SCEVAllocSizeExpr(const FoldingSetNodeID &ID, + const Type *ty, const Type *allocty) : + SCEVTargetDataConstant(ID, scAllocSize, ty), + AllocTy(allocty) {} + + public: + const Type *getAllocType() const { return AllocTy; } + + virtual void print(raw_ostream &OS) const; + + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const SCEVAllocSizeExpr *S) { return true; } + static inline bool classof(const SCEV *S) { + return S->getSCEVType() == scAllocSize; + } + }; //===--------------------------------------------------------------------===// /// SCEVUnknown - This means that we are dealing with an entirely unknown SCEV @@ -552,6 +636,10 @@ return ((SC*)this)->visitSMaxExpr((const SCEVSMaxExpr*)S); case scUMaxExpr: return ((SC*)this)->visitUMaxExpr((const SCEVUMaxExpr*)S); + case scFieldOffset: + return ((SC*)this)->visitFieldOffsetExpr((const SCEVFieldOffsetExpr*)S); + case scAllocSize: + return ((SC*)this)->visitAllocSizeExpr((const SCEVAllocSizeExpr*)S); case scUnknown: return ((SC*)this)->visitUnknown((const SCEVUnknown*)S); case scCouldNotCompute: Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=79344&r1=79343&r2=79344&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Aug 18 11:46:41 2009 @@ -307,6 +307,15 @@ OS << "}<" << L->getHeader()->getName() + ">"; } +void SCEVFieldOffsetExpr::print(raw_ostream &OS) const { + // LLVM struct fields don't have names, so just print the field number. + OS << "offsetof(" << *STy << ", " << FieldNo << ")"; +} + +void SCEVAllocSizeExpr::print(raw_ostream &OS) const { + OS << "sizeof(" << *AllocTy << ")"; +} + bool SCEVUnknown::isLoopInvariant(const Loop *L) const { // All non-instruction values are loop invariant. All instructions are loop // invariant if they are not contained in the specified loop. @@ -335,6 +344,41 @@ // SCEV Utilities //===----------------------------------------------------------------------===// +static bool CompareTypes(const Type *A, const Type *B) { + if (A->getTypeID() != B->getTypeID()) + return A->getTypeID() < B->getTypeID(); + if (const IntegerType *AI = dyn_cast(A)) { + const IntegerType *BI = cast(B); + return AI->getBitWidth() < BI->getBitWidth(); + } + if (const PointerType *AI = dyn_cast(A)) { + const PointerType *BI = cast(B); + return CompareTypes(AI->getElementType(), BI->getElementType()); + } + if (const ArrayType *AI = dyn_cast(A)) { + const ArrayType *BI = cast(B); + if (AI->getNumElements() != BI->getNumElements()) + return AI->getNumElements() < BI->getNumElements(); + return CompareTypes(AI->getElementType(), BI->getElementType()); + } + if (const VectorType *AI = dyn_cast(A)) { + const VectorType *BI = cast(B); + if (AI->getNumElements() != BI->getNumElements()) + return AI->getNumElements() < BI->getNumElements(); + return CompareTypes(AI->getElementType(), BI->getElementType()); + } + if (const StructType *AI = dyn_cast(A)) { + const StructType *BI = cast(B); + if (AI->getNumElements() != BI->getNumElements()) + return AI->getNumElements() < BI->getNumElements(); + for (unsigned i = 0, e = AI->getNumElements(); i != e; ++i) + if (CompareTypes(AI->getElementType(i), BI->getElementType(i)) || + CompareTypes(BI->getElementType(i), AI->getElementType(i))) + return CompareTypes(AI->getElementType(i), BI->getElementType(i)); + } + return false; +} + namespace { /// SCEVComplexityCompare - Return true if the complexity of the LHS is less /// than the complexity of the RHS. This comparator is used to canonicalize @@ -447,6 +491,21 @@ return operator()(LC->getOperand(), RC->getOperand()); } + // Compare offsetof expressions. + if (const SCEVFieldOffsetExpr *LA = dyn_cast(LHS)) { + const SCEVFieldOffsetExpr *RA = cast(RHS); + if (CompareTypes(LA->getStructType(), RA->getStructType()) || + CompareTypes(RA->getStructType(), LA->getStructType())) + return CompareTypes(LA->getStructType(), RA->getStructType()); + return LA->getFieldNo() < RA->getFieldNo(); + } + + // Compare sizeof expressions by the allocation type. + if (const SCEVAllocSizeExpr *LA = dyn_cast(LHS)) { + const SCEVAllocSizeExpr *RA = cast(RHS); + return CompareTypes(LA->getAllocType(), RA->getAllocType()); + } + llvm_unreachable("Unknown SCEV kind!"); return false; } @@ -976,7 +1035,7 @@ /// unspecified bits out to the given type. /// const SCEV *ScalarEvolution::getAnyExtendExpr(const SCEV *Op, - const Type *Ty) { + const Type *Ty) { assert(getTypeSizeInBits(Op->getType()) < getTypeSizeInBits(Ty) && "This is not an extending conversion!"); assert(isSCEVable(Ty) && @@ -2001,6 +2060,76 @@ return getNotSCEV(getUMaxExpr(getNotSCEV(LHS), getNotSCEV(RHS))); } +const SCEV *ScalarEvolution::getFieldOffsetExpr(const StructType *STy, + unsigned FieldNo) { + // If we have TargetData we can determine the constant offset. + if (TD) { + const Type *IntPtrTy = TD->getIntPtrType(getContext()); + const StructLayout &SL = *TD->getStructLayout(STy); + uint64_t Offset = SL.getElementOffset(FieldNo); + return getIntegerSCEV(Offset, IntPtrTy); + } + + // Field 0 is always at offset 0. + if (FieldNo == 0) { + const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(STy)); + return getIntegerSCEV(0, Ty); + } + + // Okay, it looks like we really DO need an offsetof expr. Check to see if we + // already have one, otherwise create a new one. + FoldingSetNodeID ID; + ID.AddInteger(scFieldOffset); + ID.AddPointer(STy); + ID.AddInteger(FieldNo); + void *IP = 0; + if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; + SCEV *S = SCEVAllocator.Allocate(); + const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(STy)); + new (S) SCEVFieldOffsetExpr(ID, Ty, STy, FieldNo); + UniqueSCEVs.InsertNode(S, IP); + return S; +} + +const SCEV *ScalarEvolution::getAllocSizeExpr(const Type *AllocTy) { + // If we have TargetData we can determine the constant size. + if (TD && AllocTy->isSized()) { + const Type *IntPtrTy = TD->getIntPtrType(getContext()); + return getIntegerSCEV(TD->getTypeAllocSize(AllocTy), IntPtrTy); + } + + // Expand an array size into the element size times the number + // of elements. + if (const ArrayType *ATy = dyn_cast(AllocTy)) { + const SCEV *E = getAllocSizeExpr(ATy->getElementType()); + return getMulExpr( + E, getConstant(ConstantInt::get(cast(E->getType()), + ATy->getNumElements()))); + } + + // Expand a vector size into the element size times the number + // of elements. + if (const VectorType *VTy = dyn_cast(AllocTy)) { + const SCEV *E = getAllocSizeExpr(VTy->getElementType()); + return getMulExpr( + E, getConstant(ConstantInt::get(cast(E->getType()), + VTy->getNumElements()))); + } + + // Okay, it looks like we really DO need a sizeof expr. Check to see if we + // already have one, otherwise create a new one. + FoldingSetNodeID ID; + ID.AddInteger(scAllocSize); + ID.AddPointer(AllocTy); + void *IP = 0; + if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; + SCEV *S = SCEVAllocator.Allocate(); + const Type *Ty = getEffectiveSCEVType(PointerType::getUnqual(AllocTy)); + new (S) SCEVAllocSizeExpr(ID, Ty, AllocTy); + UniqueSCEVs.InsertNode(S, IP); + return S; +} + const SCEV *ScalarEvolution::getUnknown(Value *V) { // Don't attempt to do anything other than create a SCEVUnknown object // here. createSCEV only calls getUnknown after checking for all other @@ -2027,17 +2156,8 @@ /// can optionally include pointer types if the ScalarEvolution class /// has access to target-specific information. bool ScalarEvolution::isSCEVable(const Type *Ty) const { - // Integers are always SCEVable. - if (Ty->isInteger()) - return true; - - // Pointers are SCEVable if TargetData information is available - // to provide pointer size information. - if (isa(Ty)) - return TD != NULL; - - // Otherwise it's not SCEVable. - return false; + // Integers and pointers are always SCEVable. + return Ty->isInteger() || isa(Ty); } /// getTypeSizeInBits - Return the size in bits of the specified type, @@ -2049,9 +2169,14 @@ if (TD) return TD->getTypeSizeInBits(Ty); - // Otherwise, we support only integer types. - assert(Ty->isInteger() && "isSCEVable permitted a non-SCEVable type!"); - return Ty->getPrimitiveSizeInBits(); + // Integer types have fixed sizes. + if (Ty->isInteger()) + return Ty->getPrimitiveSizeInBits(); + + // The only other support type is pointer. Without TargetData, conservatively + // assume pointers are 64-bit. + assert(isa(Ty) && "isSCEVable permitted a non-SCEVable type!"); + return 64; } /// getEffectiveSCEVType - Return a type with the same bitwidth as @@ -2064,8 +2189,12 @@ if (Ty->isInteger()) return Ty; + // The only other support type is pointer. assert(isa(Ty) && "Unexpected non-pointer non-integer type!"); - return TD->getIntPtrType(getContext()); + if (TD) return TD->getIntPtrType(getContext()); + + // Without TargetData, conservatively assume pointers are 64-bit. + return Type::getInt64Ty(getContext()); } const SCEV *ScalarEvolution::getCouldNotCompute() { @@ -2132,8 +2261,8 @@ ScalarEvolution::getTruncateOrZeroExtend(const SCEV *V, const Type *Ty) { const Type *SrcTy = V->getType(); - assert((SrcTy->isInteger() || (TD && isa(SrcTy))) && - (Ty->isInteger() || (TD && isa(Ty))) && + assert((SrcTy->isInteger() || isa(SrcTy)) && + (Ty->isInteger() || isa(Ty)) && "Cannot truncate or zero extend with non-integer arguments!"); if (getTypeSizeInBits(SrcTy) == getTypeSizeInBits(Ty)) return V; // No conversion @@ -2149,8 +2278,8 @@ ScalarEvolution::getTruncateOrSignExtend(const SCEV *V, const Type *Ty) { const Type *SrcTy = V->getType(); - assert((SrcTy->isInteger() || (TD && isa(SrcTy))) && - (Ty->isInteger() || (TD && isa(Ty))) && + assert((SrcTy->isInteger() || isa(SrcTy)) && + (Ty->isInteger() || isa(Ty)) && "Cannot truncate or zero extend with non-integer arguments!"); if (getTypeSizeInBits(SrcTy) == getTypeSizeInBits(Ty)) return V; // No conversion @@ -2165,8 +2294,8 @@ const SCEV * ScalarEvolution::getNoopOrZeroExtend(const SCEV *V, const Type *Ty) { const Type *SrcTy = V->getType(); - assert((SrcTy->isInteger() || (TD && isa(SrcTy))) && - (Ty->isInteger() || (TD && isa(Ty))) && + assert((SrcTy->isInteger() || isa(SrcTy)) && + (Ty->isInteger() || isa(Ty)) && "Cannot noop or zero extend with non-integer arguments!"); assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) && "getNoopOrZeroExtend cannot truncate!"); @@ -2181,8 +2310,8 @@ const SCEV * ScalarEvolution::getNoopOrSignExtend(const SCEV *V, const Type *Ty) { const Type *SrcTy = V->getType(); - assert((SrcTy->isInteger() || (TD && isa(SrcTy))) && - (Ty->isInteger() || (TD && isa(Ty))) && + assert((SrcTy->isInteger() || isa(SrcTy)) && + (Ty->isInteger() || isa(Ty)) && "Cannot noop or sign extend with non-integer arguments!"); assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) && "getNoopOrSignExtend cannot truncate!"); @@ -2198,8 +2327,8 @@ const SCEV * ScalarEvolution::getNoopOrAnyExtend(const SCEV *V, const Type *Ty) { const Type *SrcTy = V->getType(); - assert((SrcTy->isInteger() || (TD && isa(SrcTy))) && - (Ty->isInteger() || (TD && isa(Ty))) && + assert((SrcTy->isInteger() || isa(SrcTy)) && + (Ty->isInteger() || isa(Ty)) && "Cannot noop or any extend with non-integer arguments!"); assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) && "getNoopOrAnyExtend cannot truncate!"); @@ -2213,8 +2342,8 @@ const SCEV * ScalarEvolution::getTruncateOrNoop(const SCEV *V, const Type *Ty) { const Type *SrcTy = V->getType(); - assert((SrcTy->isInteger() || (TD && isa(SrcTy))) && - (Ty->isInteger() || (TD && isa(Ty))) && + assert((SrcTy->isInteger() || isa(SrcTy)) && + (Ty->isInteger() || isa(Ty)) && "Cannot truncate or noop with non-integer arguments!"); assert(getTypeSizeInBits(SrcTy) >= getTypeSizeInBits(Ty) && "getTruncateOrNoop cannot extend!"); @@ -2433,7 +2562,7 @@ /// const SCEV *ScalarEvolution::createNodeForGEP(Operator *GEP) { - const Type *IntPtrTy = TD->getIntPtrType(getContext()); + const Type *IntPtrTy = getEffectiveSCEVType(GEP->getType()); Value *Base = GEP->getOperand(0); // Don't attempt to analyze GEPs over unsized objects. if (!cast(Base->getType())->getElementType()->isSized()) @@ -2447,19 +2576,16 @@ // Compute the (potentially symbolic) offset in bytes for this index. if (const StructType *STy = dyn_cast(*GTI++)) { // For a struct, add the member offset. - const StructLayout &SL = *TD->getStructLayout(STy); unsigned FieldNo = cast(Index)->getZExtValue(); - uint64_t Offset = SL.getElementOffset(FieldNo); - TotalOffset = getAddExpr(TotalOffset, getIntegerSCEV(Offset, IntPtrTy)); + TotalOffset = getAddExpr(TotalOffset, + getFieldOffsetExpr(STy, FieldNo)); } else { // For an array, add the element offset, explicitly scaled. const SCEV *LocalOffset = getSCEV(Index); if (!isa(LocalOffset->getType())) // Getelementptr indicies are signed. LocalOffset = getTruncateOrSignExtend(LocalOffset, IntPtrTy); - LocalOffset = - getMulExpr(LocalOffset, - getIntegerSCEV(TD->getTypeAllocSize(*GTI), IntPtrTy)); + LocalOffset = getMulExpr(LocalOffset, getAllocSizeExpr(*GTI)); TotalOffset = getAddExpr(TotalOffset, LocalOffset); } } @@ -2952,7 +3078,6 @@ // expressions we handle are GEPs and address literals. case Instruction::GetElementPtr: - if (!TD) break; // Without TD we can't analyze pointers. return createNodeForGEP(U); case Instruction::PHI: @@ -3947,6 +4072,9 @@ return getTruncateExpr(Op, Cast->getType()); } + if (isa(V)) + return V; + llvm_unreachable("Unknown SCEV type!"); return 0; } Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=79344&r1=79343&r2=79344&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Tue Aug 18 11:46:41 2009 @@ -158,53 +158,93 @@ /// check to see if the divide was folded. static bool FactorOutConstant(const SCEV *&S, const SCEV *&Remainder, - const APInt &Factor, - ScalarEvolution &SE) { + const SCEV *Factor, + ScalarEvolution &SE, + const TargetData *TD) { // Everything is divisible by one. - if (Factor == 1) + if (Factor->isOne()) + return true; + + // x/x == 1. + if (S == Factor) { + S = SE.getIntegerSCEV(1, S->getType()); return true; + } // For a Constant, check for a multiple of the given factor. if (const SCEVConstant *C = dyn_cast(S)) { - ConstantInt *CI = - ConstantInt::get(SE.getContext(), C->getValue()->getValue().sdiv(Factor)); - // If the quotient is zero and the remainder is non-zero, reject - // the value at this scale. It will be considered for subsequent - // smaller scales. - if (C->isZero() || !CI->isZero()) { - const SCEV *Div = SE.getConstant(CI); - S = Div; - Remainder = - SE.getAddExpr(Remainder, - SE.getConstant(C->getValue()->getValue().srem(Factor))); + // 0/x == 0. + if (C->isZero()) return true; + // Check for divisibility. + if (const SCEVConstant *FC = dyn_cast(Factor)) { + ConstantInt *CI = + ConstantInt::get(SE.getContext(), + C->getValue()->getValue().sdiv( + FC->getValue()->getValue())); + // If the quotient is zero and the remainder is non-zero, reject + // the value at this scale. It will be considered for subsequent + // smaller scales. + if (!CI->isZero()) { + const SCEV *Div = SE.getConstant(CI); + S = Div; + Remainder = + SE.getAddExpr(Remainder, + SE.getConstant(C->getValue()->getValue().srem( + FC->getValue()->getValue()))); + return true; + } } } // In a Mul, check if there is a constant operand which is a multiple // of the given factor. - if (const SCEVMulExpr *M = dyn_cast(S)) - if (const SCEVConstant *C = dyn_cast(M->getOperand(0))) - if (!C->getValue()->getValue().srem(Factor)) { - const SmallVectorImpl &MOperands = M->getOperands(); - SmallVector NewMulOps(MOperands.begin(), - MOperands.end()); - NewMulOps[0] = - SE.getConstant(C->getValue()->getValue().sdiv(Factor)); - S = SE.getMulExpr(NewMulOps); - return true; + if (const SCEVMulExpr *M = dyn_cast(S)) { + if (TD) { + // With TargetData, the size is known. Check if there is a constant + // operand which is a multiple of the given factor. If so, we can + // factor it. + const SCEVConstant *FC = cast(Factor); + if (const SCEVConstant *C = dyn_cast(M->getOperand(0))) + if (!C->getValue()->getValue().srem(FC->getValue()->getValue())) { + const SmallVectorImpl &MOperands = M->getOperands(); + SmallVector NewMulOps(MOperands.begin(), + MOperands.end()); + NewMulOps[0] = + SE.getConstant(C->getValue()->getValue().sdiv( + FC->getValue()->getValue())); + S = SE.getMulExpr(NewMulOps); + return true; + } + } else { + // Without TargetData, check if Factor can be factored out of any of the + // Mul's operands. If so, we can just remove it. + for (unsigned i = 0, e = M->getNumOperands(); i != e; ++i) { + const SCEV *SOp = M->getOperand(i); + const SCEV *Remainder = SE.getIntegerSCEV(0, SOp->getType()); + if (FactorOutConstant(SOp, Remainder, Factor, SE, TD) && + Remainder->isZero()) { + const SmallVectorImpl &MOperands = M->getOperands(); + SmallVector NewMulOps(MOperands.begin(), + MOperands.end()); + NewMulOps[i] = SOp; + S = SE.getMulExpr(NewMulOps); + return true; + } } + } + } // In an AddRec, check if both start and step are divisible. if (const SCEVAddRecExpr *A = dyn_cast(S)) { const SCEV *Step = A->getStepRecurrence(SE); const SCEV *StepRem = SE.getIntegerSCEV(0, Step->getType()); - if (!FactorOutConstant(Step, StepRem, Factor, SE)) + if (!FactorOutConstant(Step, StepRem, Factor, SE, TD)) return false; if (!StepRem->isZero()) return false; const SCEV *Start = A->getStart(); - if (!FactorOutConstant(Start, Remainder, Factor, SE)) + if (!FactorOutConstant(Start, Remainder, Factor, SE, TD)) return false; S = SE.getAddRecExpr(Start, Step, A->getLoop()); return true; @@ -213,9 +253,73 @@ return false; } +/// SimplifyAddOperands - Sort and simplify a list of add operands. NumAddRecs +/// is the number of SCEVAddRecExprs present, which are kept at the end of +/// the list. +/// +static void SimplifyAddOperands(SmallVectorImpl &Ops, + const Type *Ty, + ScalarEvolution &SE) { + unsigned NumAddRecs = 0; + for (unsigned i = Ops.size(); i > 0 && isa(Ops[i-1]); --i) + ++NumAddRecs; + // Group Ops into non-addrecs and addrecs. + SmallVector NoAddRecs(Ops.begin(), Ops.end() - NumAddRecs); + SmallVector AddRecs(Ops.end() - NumAddRecs, Ops.end()); + // Let ScalarEvolution sort and simplify the non-addrecs list. + const SCEV *Sum = NoAddRecs.empty() ? + SE.getIntegerSCEV(0, Ty) : + SE.getAddExpr(NoAddRecs); + // If it returned an add, use the operands. Otherwise it simplified + // the sum into a single value, so just use that. + if (const SCEVAddExpr *Add = dyn_cast(Sum)) + Ops = Add->getOperands(); + else { + Ops.clear(); + if (!Sum->isZero()) + Ops.push_back(Sum); + } + // Then append the addrecs. + Ops.insert(Ops.end(), AddRecs.begin(), AddRecs.end()); +} + +/// SplitAddRecs - Flatten a list of add operands, moving addrec start values +/// out to the top level. For example, convert {a + b,+,c} to a, b, {0,+,d}. +/// This helps expose more opportunities for folding parts of the expressions +/// into GEP indices. +/// +static void SplitAddRecs(SmallVectorImpl &Ops, + const Type *Ty, + ScalarEvolution &SE) { + // Find the addrecs. + SmallVector AddRecs; + for (unsigned i = 0, e = Ops.size(); i != e; ++i) + while (const SCEVAddRecExpr *A = dyn_cast(Ops[i])) { + const SCEV *Start = A->getStart(); + if (Start->isZero()) break; + const SCEV *Zero = SE.getIntegerSCEV(0, Ty); + AddRecs.push_back(SE.getAddRecExpr(Zero, + A->getStepRecurrence(SE), + A->getLoop())); + if (const SCEVAddExpr *Add = dyn_cast(Start)) { + Ops[i] = Zero; + Ops.insert(Ops.end(), Add->op_begin(), Add->op_end()); + e += Add->getNumOperands(); + } else { + Ops[i] = Start; + } + } + if (!AddRecs.empty()) { + // Add the addrecs onto the end of the list. + Ops.insert(Ops.end(), AddRecs.begin(), AddRecs.end()); + // Resort the operand list, moving any constants to the front. + SimplifyAddOperands(Ops, Ty, SE); + } +} + /// expandAddToGEP - Expand a SCEVAddExpr with a pointer type into a GEP /// instead of using ptrtoint+arithmetic+inttoptr. This helps -/// BasicAliasAnalysis analyze the result. +/// BasicAliasAnalysis and other passes analyze the result. /// /// Design note: This depends on ScalarEvolution not recognizing inttoptr /// and ptrtoint operators, as they may introduce pointer arithmetic @@ -246,52 +350,62 @@ SmallVector Ops(op_begin, op_end); bool AnyNonZeroIndices = false; + // Split AddRecs up into parts as either of the parts may be usable + // without the other. + SplitAddRecs(Ops, Ty, SE); + // Decend down the pointer's type and attempt to convert the other // operands into GEP indices, at each level. The first index in a GEP // indexes into the array implied by the pointer operand; the rest of // the indices index into the element or field type selected by the // preceding index. for (;;) { - APInt ElSize = APInt(SE.getTypeSizeInBits(Ty), - ElTy->isSized() ? SE.TD->getTypeAllocSize(ElTy) : 0); - SmallVector NewOps; + const SCEV *ElSize = SE.getAllocSizeExpr(ElTy); + // If the scale size is not 0, attempt to factor out a scale for + // array indexing. SmallVector ScaledOps; - for (unsigned i = 0, e = Ops.size(); i != e; ++i) { - // Split AddRecs up into parts as either of the parts may be usable - // without the other. - if (const SCEVAddRecExpr *A = dyn_cast(Ops[i])) - if (!A->getStart()->isZero()) { - const SCEV *Start = A->getStart(); - Ops.push_back(SE.getAddRecExpr(SE.getIntegerSCEV(0, A->getType()), - A->getStepRecurrence(SE), - A->getLoop())); - Ops[i] = Start; - ++e; - } - // If the scale size is not 0, attempt to factor out a scale. - if (ElSize != 0) { + if (ElTy->isSized() && !ElSize->isZero()) { + SmallVector NewOps; + for (unsigned i = 0, e = Ops.size(); i != e; ++i) { const SCEV *Op = Ops[i]; - const SCEV *Remainder = SE.getIntegerSCEV(0, Op->getType()); - if (FactorOutConstant(Op, Remainder, ElSize, SE)) { - ScaledOps.push_back(Op); // Op now has ElSize factored out. - NewOps.push_back(Remainder); - continue; + const SCEV *Remainder = SE.getIntegerSCEV(0, Ty); + if (FactorOutConstant(Op, Remainder, ElSize, SE, SE.TD)) { + // Op now has ElSize factored out. + ScaledOps.push_back(Op); + if (!Remainder->isZero()) + NewOps.push_back(Remainder); + AnyNonZeroIndices = true; + } else { + // The operand was not divisible, so add it to the list of operands + // we'll scan next iteration. + NewOps.push_back(Ops[i]); } } - // If the operand was not divisible, add it to the list of operands - // we'll scan next iteration. - NewOps.push_back(Ops[i]); + // If we made any changes, update Ops. + if (!ScaledOps.empty()) { + Ops = NewOps; + SimplifyAddOperands(Ops, Ty, SE); + } } - Ops = NewOps; - AnyNonZeroIndices |= !ScaledOps.empty(); + + // Record the scaled array index for this level of the type. If + // we didn't find any operands that could be factored, tentatively + // assume that element zero was selected (since the zero offset + // would obviously be folded away). Value *Scaled = ScaledOps.empty() ? Constant::getNullValue(Ty) : expandCodeFor(SE.getAddExpr(ScaledOps), Ty); GepIndices.push_back(Scaled); // Collect struct field index operands. - if (!Ops.empty()) - while (const StructType *STy = dyn_cast(ElTy)) { + while (const StructType *STy = dyn_cast(ElTy)) { + bool FoundFieldNo = false; + // An empty struct has no fields. + if (STy->getNumElements() == 0) break; + if (SE.TD) { + // With TargetData, field offsets are known. See if a constant offset + // falls within any of the struct fields. + if (Ops.empty()) break; if (const SCEVConstant *C = dyn_cast(Ops[0])) if (SE.getTypeSizeInBits(C->getType()) <= 64) { const StructLayout &SL = *SE.TD->getStructLayout(STy); @@ -304,25 +418,52 @@ Ops[0] = SE.getConstant(Ty, FullOffset - SL.getElementOffset(ElIdx)); AnyNonZeroIndices = true; - continue; + FoundFieldNo = true; } } - break; + } else { + // Without TargetData, just check for a SCEVFieldOffsetExpr of the + // appropriate struct type. + for (unsigned i = 0, e = Ops.size(); i != e; ++i) + if (const SCEVFieldOffsetExpr *FO = + dyn_cast(Ops[i])) + if (FO->getStructType() == STy) { + unsigned FieldNo = FO->getFieldNo(); + GepIndices.push_back( + ConstantInt::get(Type::getInt32Ty(Ty->getContext()), + FieldNo)); + ElTy = STy->getTypeAtIndex(FieldNo); + Ops[i] = SE.getConstant(Ty, 0); + AnyNonZeroIndices = true; + FoundFieldNo = true; + break; + } } + // If no struct field offsets were found, tentatively assume that + // field zero was selected (since the zero offset would obviously + // be folded away). + if (!FoundFieldNo) { + ElTy = STy->getTypeAtIndex(0u); + GepIndices.push_back( + Constant::getNullValue(Type::getInt32Ty(Ty->getContext()))); + } + } - if (const ArrayType *ATy = dyn_cast(ElTy)) { + if (const ArrayType *ATy = dyn_cast(ElTy)) ElTy = ATy->getElementType(); - continue; - } - break; + else + break; } // If none of the operands were convertable to proper GEP indices, cast // the base to i8* and do an ugly getelementptr with that. It's still // better than ptrtoint+arithmetic+inttoptr at least. if (!AnyNonZeroIndices) { + // Cast the base to i8*. V = InsertNoopCastOfTo(V, Type::getInt8Ty(Ty->getContext())->getPointerTo(PTy->getAddressSpace())); + + // Expand the operands for a plain byte offset. Value *Idx = expandCodeFor(SE.getAddExpr(Ops), Ty); // Fold a GEP with constant operands. @@ -345,7 +486,8 @@ } } - Value *GEP = Builder.CreateGEP(V, Idx, "scevgep"); + // Emit a GEP. + Value *GEP = Builder.CreateGEP(V, Idx, "uglygep"); InsertedValues.insert(GEP); return GEP; } @@ -368,11 +510,10 @@ // Turn things like ptrtoint+arithmetic+inttoptr into GEP. See the // comments on expandAddToGEP for details. - if (SE.TD) - if (const PointerType *PTy = dyn_cast(V->getType())) { - const SmallVectorImpl &Ops = S->getOperands(); - return expandAddToGEP(&Ops[0], &Ops[Ops.size() - 1], PTy, Ty, V); - } + if (const PointerType *PTy = dyn_cast(V->getType())) { + const SmallVectorImpl &Ops = S->getOperands(); + return expandAddToGEP(&Ops[0], &Ops[Ops.size() - 1], PTy, Ty, V); + } V = InsertNoopCastOfTo(V, Ty); @@ -484,21 +625,19 @@ // Turn things like ptrtoint+arithmetic+inttoptr into GEP. See the // comments on expandAddToGEP for details. - if (SE.TD) { - const SCEV *Base = S->getStart(); - const SCEV *RestArray[1] = { Rest }; - // Dig into the expression to find the pointer base for a GEP. - ExposePointerBase(Base, RestArray[0], SE); - // If we found a pointer, expand the AddRec with a GEP. - if (const PointerType *PTy = dyn_cast(Base->getType())) { - // Make sure the Base isn't something exotic, such as a multiplied - // or divided pointer value. In those cases, the result type isn't - // actually a pointer type. - if (!isa(Base) && !isa(Base)) { - Value *StartV = expand(Base); - assert(StartV->getType() == PTy && "Pointer type mismatch for GEP!"); - return expandAddToGEP(RestArray, RestArray+1, PTy, Ty, StartV); - } + const SCEV *Base = S->getStart(); + const SCEV *RestArray[1] = { Rest }; + // Dig into the expression to find the pointer base for a GEP. + ExposePointerBase(Base, RestArray[0], SE); + // If we found a pointer, expand the AddRec with a GEP. + if (const PointerType *PTy = dyn_cast(Base->getType())) { + // Make sure the Base isn't something exotic, such as a multiplied + // or divided pointer value. In those cases, the result type isn't + // actually a pointer type. + if (!isa(Base) && !isa(Base)) { + Value *StartV = expand(Base); + assert(StartV->getType() == PTy && "Pointer type mismatch for GEP!"); + return expandAddToGEP(RestArray, RestArray+1, PTy, Ty, StartV); } } @@ -656,6 +795,14 @@ return LHS; } +Value *SCEVExpander::visitFieldOffsetExpr(const SCEVFieldOffsetExpr *S) { + return ConstantExpr::getOffsetOf(S->getStructType(), S->getFieldNo()); +} + +Value *SCEVExpander::visitAllocSizeExpr(const SCEVAllocSizeExpr *S) { + return ConstantExpr::getSizeOf(S->getAllocType()); +} + Value *SCEVExpander::expandCodeFor(const SCEV *SH, const Type *Ty) { // Expand the code for this SCEV. Value *V = expand(SH); Added: llvm/trunk/test/Transforms/IndVarSimplify/preserve-gep-nested.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/preserve-gep-nested.ll?rev=79344&view=auto ============================================================================== --- llvm/trunk/test/Transforms/IndVarSimplify/preserve-gep-nested.ll (added) +++ llvm/trunk/test/Transforms/IndVarSimplify/preserve-gep-nested.ll Tue Aug 18 11:46:41 2009 @@ -0,0 +1,75 @@ +; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t +; Exactly one getelementptr for each load+store. +; RUN: grep getelementptr %t | count 6 +; Each getelementptr using %struct.Q* %s as a base and not i8*. +; RUN: grep {getelementptr \[%\]struct\\.Q\\* \[%\]s,} %t | count 6 +; No explicit integer multiplications! +; RUN: not grep {= mul} %t +; No i8* arithmetic or pointer casting anywhere! +; RUN: not grep {i8\\*} %t +; RUN: not grep bitcast %t +; RUN: not grep inttoptr %t +; RUN: not grep ptrtoint %t + +; FIXME: This test should pass with or without TargetData. Until opt +; supports running tests without targetdata, just hardware this in. +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" + +%struct.Q = type { [10 x %struct.N] } +%struct.N = type { %struct.S } +%struct.S = type { [100 x double], [100 x double] } + +define void @foo(%struct.Q* %s, i64 %n) nounwind { +entry: + br label %bb1 + +bb1: + %i = phi i64 [ 2, %entry ], [ %i.next, %bb ] + %j = phi i64 [ 0, %entry ], [ %j.next, %bb ] + %t5 = icmp slt i64 %i, %n + br i1 %t5, label %bb, label %return + +bb: + %t0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %i + %t1 = load double* %t0, align 8 + %t2 = fmul double %t1, 3.200000e+00 + %t3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %i + store double %t2, double* %t3, align 8 + + %s0 = getelementptr inbounds %struct.Q* %s, i64 13, i32 0, i64 7, i32 0, i32 1, i64 %i + %s1 = load double* %s0, align 8 + %s2 = fmul double %s1, 3.200000e+00 + %s3 = getelementptr inbounds %struct.Q* %s, i64 13, i32 0, i64 7, i32 0, i32 1, i64 %i + store double %s2, double* %s3, align 8 + + %u0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 7, i32 0, i32 1, i64 %j + %u1 = load double* %u0, align 8 + %u2 = fmul double %u1, 3.200000e+00 + %u3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 7, i32 0, i32 1, i64 %j + store double %u2, double* %u3, align 8 + + %v0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 1, i64 %i + %v1 = load double* %v0, align 8 + %v2 = fmul double %v1, 3.200000e+00 + %v3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 1, i64 %i + store double %v2, double* %v3, align 8 + + %w0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %j + %w1 = load double* %w0, align 8 + %w2 = fmul double %w1, 3.200000e+00 + %w3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %j + store double %w2, double* %w3, align 8 + + %x0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 3, i32 0, i32 0, i64 %i + %x1 = load double* %x0, align 8 + %x2 = fmul double %x1, 3.200000e+00 + %x3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 3, i32 0, i32 0, i64 %i + store double %x2, double* %x3, align 8 + + %i.next = add i64 %i, 1 + %j.next = add i64 %j, 1 + br label %bb1 + +return: + ret void +} From sabre at nondot.org Tue Aug 18 11:55:45 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 16:55:45 -0000 Subject: [llvm-commits] [llvm] r79345 - /llvm/trunk/test/CodeGen/X86/omit-label.ll Message-ID: <200908181655.n7IGtjqu027093@zion.cs.uiuc.edu> Author: lattner Date: Tue Aug 18 11:55:45 2009 New Revision: 79345 URL: http://llvm.org/viewvc/llvm-project?rev=79345&view=rev Log: force a triple so this passes on darwin Modified: llvm/trunk/test/CodeGen/X86/omit-label.ll Modified: llvm/trunk/test/CodeGen/X86/omit-label.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/omit-label.ll?rev=79345&r1=79344&r2=79345&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/omit-label.ll (original) +++ llvm/trunk/test/CodeGen/X86/omit-label.ll Tue Aug 18 11:55:45 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86-64 -asm-verbose=false | FileCheck %s +; RUN: llvm-as < %s | llc -asm-verbose=false -mtriple=x86_64-linux-gnu | FileCheck %s ; PR4126 ; PR4732 From sabre at nondot.org Tue Aug 18 11:56:17 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 16:56:17 -0000 Subject: [llvm-commits] [llvm] r79346 - in /llvm/trunk/lib: CodeGen/AsmPrinter/DwarfException.cpp Target/TargetLoweringObjectFile.cpp Message-ID: <200908181656.n7IGuHI6027173@zion.cs.uiuc.edu> Author: lattner Date: Tue Aug 18 11:56:17 2009 New Revision: 79346 URL: http://llvm.org/viewvc/llvm-project?rev=79346&view=rev Log: fix COFF targets (mingw/cygwin) to provide ehframe and LSDA sections Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=79346&r1=79345&r2=79346&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Aug 18 11:56:17 2009 @@ -56,10 +56,7 @@ TD->getPointerSize() : -TD->getPointerSize(); // Begin eh frame section. - // FIXME: THIS IS A HORRIBLE HACK. MingW isn't specifying an EHFrame section. - if (const MCSection *EHFrameSec = - Asm->getObjFileLowering().getEHFrameSection()) - Asm->SwitchToSection(EHFrameSec); + Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection()); if (TAI->is_EHSymbolPrivate()) O << TAI->getPrivateGlobalPrefix(); @@ -153,10 +150,7 @@ const Function *TheFunc = EHFrameInfo.function; - // FIXME: THIS IS A HORRIBLE HACK. MingW isn't specifying an EHFrame section. - if (const MCSection *EHFrameSec = - Asm->getObjFileLowering().getEHFrameSection()) - Asm->SwitchToSection(EHFrameSec); + Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection()); // Externally visible entry into the functions eh frame info. If the // corresponding function is static, this should not be externally visible. Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=79346&r1=79345&r2=79346&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original) +++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Aug 18 11:56:17 2009 @@ -963,6 +963,14 @@ StaticDtorSection = getCOFFSection(".dtors", false, SectionKind::getDataRel()); + // FIXME: We're emitting LSDA info into a readonly section on COFF, even + // though it contains relocatable pointers. In PIC mode, this is probably a + // big runtime hit for C++ apps. Either the contents of the LSDA need to be + // adjusted or this should be a data section. + LSDASection = + getCOFFSection(".gcc_except_table", false, SectionKind::getReadOnly()); + EHFrameSection = + getCOFFSection(".eh_frame", false, SectionKind::getDataRel()); // Debug info. // FIXME: Don't use 'directive' mode here. From sabre at nondot.org Tue Aug 18 12:04:44 2009 From: sabre at nondot.org (Chris Lattner) Date: Tue, 18 Aug 2009 17:04:44 -0000 Subject: [llvm-commits] [llvm] r79347 - /llvm/trunk/CREDITS.TXT Message-ID: <200908181704.n7IH4itZ028360@zion.cs.uiuc.edu> Author: lattner Date: Tue Aug 18 12:04:44 2009 New Revision: 79347 URL: http://llvm.org/viewvc/llvm-project?rev=79347&view=rev Log: alphabeticalize Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=79347&r1=79346&r2=79347&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Tue Aug 18 12:04:44 2009 @@ -168,6 +168,10 @@ E: kungfoomaster at nondot.org D: Support for packed types +N: Rod Kay +E: rkay at auroraux.org +D: Author of LLVM Ada bindings + N: Eric Kidd W: http://randomhacks.net/ D: llvm-config script @@ -182,10 +186,6 @@ E: kowshik at uiuc.edu D: Author of the original C backend -N: Rod Kay -E: rkay at auroraux.org -D: Author of LLVM Ada bindings - N: Christopher Lamb E: christopher.lamb at gmail.com D: aligned load/store support, parts of noalias and restrict support From gohman at apple.com Tue Aug 18 12:19:46 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 17:19:46 -0000 Subject: [llvm-commits] [llvm] r79348 - /llvm/trunk/test/CodeGen/X86/omit-label.ll Message-ID: <200908181719.n7IHJkqv030344@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 12:19:46 2009 New Revision: 79348 URL: http://llvm.org/viewvc/llvm-project?rev=79348&view=rev Log: Make this test less sensitive to assembler differences. Modified: llvm/trunk/test/CodeGen/X86/omit-label.ll Modified: llvm/trunk/test/CodeGen/X86/omit-label.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/omit-label.ll?rev=79348&r1=79347&r2=79348&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/omit-label.ll (original) +++ llvm/trunk/test/CodeGen/X86/omit-label.ll Tue Aug 18 12:19:46 2009 @@ -5,7 +5,7 @@ ; Don't omit these labels' definitions. ; CHECK: bux: -; CHECK: .LBB1_1: +; CHECK: LBB1_1: define void @bux(i32 %p_53) nounwind optsize { entry: @@ -28,9 +28,9 @@ ; Don't omit this label in the assembly output. ; CHECK: int321: -; CHECK: jne .LBB2_1 -; CHECK: jle .LBB2_1 -; CHECK: .LBB2_1: +; CHECK: LBB2_1 +; CHECK: LBB2_1 +; CHECK: LBB2_1: define void @int321(i8 signext %p_103, i32 %uint8p_104) nounwind readnone { entry: From baldrick at free.fr Tue Aug 18 12:21:21 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Aug 2009 17:21:21 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79349 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h except.c unwind-dw2.c Message-ID: <200908181721.n7IHLLTC030603@zion.cs.uiuc.edu> Author: baldrick Date: Tue Aug 18 12:21:21 2009 New Revision: 79349 URL: http://llvm.org/viewvc/llvm-project?rev=79349&view=rev Log: Starting from gcc-4.3, mainline gcc also uses_Unwind_GetCFA rather than _Unwind_GetIP in uw_identify_context. That means all machines where the system libgcc comes from gcc-4.3 or later are like darwin: for exception handing to work properly, llvm-gcc needs to use _Unwind_Resume_or_Rethrow rather than the less general (but more efficient) _Unwind_Resume. At the same time, there is no longer any point in having llvm-gcc's version of uw_identify_context make use of _Unwind_GetIP on non-darwin machines. This fixes PR2998. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h llvm-gcc-4.2/trunk/gcc/except.c llvm-gcc-4.2/trunk/gcc/unwind-dw2.c Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=79349&r1=79348&r2=79349&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Tue Aug 18 12:21:21 2009 @@ -1493,9 +1493,6 @@ argvec.push_back ("--relocation-model=static") #endif /* !TARGET_386 && !TARGET_ARM */ -/* On Darwin _Unwind_Resume is sensitive to the dynamic stack layout; we - use _Unwind_Resume_or_Rethrow instead. */ -#define LLVM_STACKSENSITIVE_UNWIND_RESUME 1 #endif /* LLVM LOCAL end */ Modified: llvm-gcc-4.2/trunk/gcc/except.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=79349&r1=79348&r2=79349&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/except.c (original) +++ llvm-gcc-4.2/trunk/gcc/except.c Tue Aug 18 12:21:21 2009 @@ -4094,11 +4094,7 @@ and even requires additional instructions on some targets. */ const char *name = USING_SJLJ_EXCEPTIONS ? "_Unwind_SjLj_Resume" -#ifdef LLVM_STACKSENSITIVE_UNWIND_RESUME : "_Unwind_Resume_or_Rethrow"; -#else - : "_Unwind_Resume"; -#endif tree decl = build_decl (FUNCTION_DECL, get_identifier (name), build_function_type_list (void_type_node, ptr_type_node, NULL_TREE)); Modified: llvm-gcc-4.2/trunk/gcc/unwind-dw2.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/unwind-dw2.c?rev=79349&r1=79348&r2=79349&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/unwind-dw2.c (original) +++ llvm-gcc-4.2/trunk/gcc/unwind-dw2.c Tue Aug 18 12:21:21 2009 @@ -1511,15 +1511,8 @@ static inline _Unwind_Ptr uw_identify_context (struct _Unwind_Context *context) { -/* LLVM LOCAL begin - This change is needed to match Apple's installed libgcc. */ -#ifdef LLVM_STACKSENSITIVE_UNWIND_RESUME /* APPLE LOCAL libgcc 6148462 */ return _Unwind_GetCFA (context); -#else - return _Unwind_GetIP (context); -#endif -/* LLVM LOCAL end */ } From daniel at zuster.org Tue Aug 18 12:38:27 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 17:38:27 -0000 Subject: [llvm-commits] [llvm] r79350 - /llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m Message-ID: <200908181738.n7IHcR3Z000348@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 12:38:27 2009 New Revision: 79350 URL: http://llvm.org/viewvc/llvm-project?rev=79350&view=rev Log: Attempt to normalize test results. Modified: llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m Modified: llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m?rev=79350&r1=79349&r2=79350&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m (original) +++ llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m Tue Aug 18 12:38:27 2009 @@ -5,7 +5,7 @@ // RUN: %link %t.o -o %t.exe -framework Foundation // RUN: echo {break randomFunc\n} > %t.in // RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \ -// RUN: grep {Breakpoint 1 at 0x.*: file 2009-08-17-DebugInfo.m, line 22} +// RUN: grep {Breakpoint 1 at 0x.*: file 2009-08-17-DebugInfo.m, line 21} // XTARGETS: darwin @interface MyClass { @@ -18,9 +18,7 @@ @implementation MyClass + init { } -- randomFunc { - my = 42; -} +- randomFunc { my = 42; } @end int main() { From baldrick at free.fr Tue Aug 18 12:38:37 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Aug 2009 19:38:37 +0200 Subject: [llvm-commits] [llvm] r77460 - /llvm/trunk/docs/LangRef.html In-Reply-To: <200907291600.n6TG0Wo6030195@zion.cs.uiuc.edu> References: <200907291600.n6TG0Wo6030195@zion.cs.uiuc.edu> Message-ID: <4A8AE71D.3040400@free.fr> Hi Dan, > Add one-past-the-end language to the inbounds keyword. is this useful for LLVM? Also, I hear that C has a rule like this for arrays, however I think in that case the address of the array element one off the end is valid, but that may in fact be many bytes off the end if the array element is large. It's not clear from your wording whether you mean one byte off the end is ok, or something closer to C. Ciao, Duncan. From baldrick at free.fr Tue Aug 18 12:47:36 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Aug 2009 19:47:36 +0200 Subject: [llvm-commits] [llvm] r78295 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/wide-integer-fold.ll In-Reply-To: <200908060919.n769J0Q1022762@zion.cs.uiuc.edu> References: <200908060919.n769J0Q1022762@zion.cs.uiuc.edu> Message-ID: <4A8AE938.6020209@free.fr> Hi Dan, > Fix a few places in DAGCombiner that were creating all-ones-bits > and high-bits values in ways that weren't correct for integer > types wider than 64 bits. This fixes a miscompile in > PPMacroExpansion.cpp in clang on x86-64. this is not a problem with your patch, but I notice that this part of the DAG combiner seems to make a lot of unsafe use of get?ExtValue. Any chance of adding this to your TODO list? :) Ciao, Duncan. From espindola at google.com Tue Aug 18 12:48:07 2009 From: espindola at google.com (Rafael Espindola) Date: Tue, 18 Aug 2009 18:48:07 +0100 Subject: [llvm-commits] [llvm] r79308 - /llvm/trunk/Makefile.rules In-Reply-To: <200908180323.n7I3Nm65009418@zion.cs.uiuc.edu> References: <200908180323.n7I3Nm65009418@zion.cs.uiuc.edu> Message-ID: <38a0d8450908181048o25068e60i52f89ffbe490c7a8@mail.gmail.com> 2009/8/18 Eric Christopher : > Author: echristo > Date: Mon Aug 17 22:23:40 2009 > New Revision: 79308 > > URL: http://llvm.org/viewvc/llvm-project?rev=79308&view=rev > Log: > Separate out Makefile defines so that we can keep the llvm > defined ones from the user defined ones. Propagate accordingly. Looks like this broke libLLVMgold.so build. Before your patch I would get ldd Debug/lib/libLLVMgold.so | grep LTO libLTO.so => ......./llvm-build/Debug/lib/libLTO.so (0x00007fd64f3d0000) now I get ldd Debug/lib/libLLVMgold.so | grep LTO Cheers, -- Rafael Avila de Espindola Google | Gordon House | Barrow Street | Dublin 4 | Ireland Registered in Dublin, Ireland | Registration Number: 368047 From baldrick at free.fr Tue Aug 18 12:53:54 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Aug 2009 19:53:54 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r77248 - in /llvm-gcc-4.2/trunk: boehm-gc/cord/de_win.h gcc/llvm-convert.cpp In-Reply-To: <200907272100.n6RL0aVM021385@zion.cs.uiuc.edu> References: <200907272100.n6RL0aVM021385@zion.cs.uiuc.edu> Message-ID: <4A8AEAB2.6050304@free.fr> Hi Owen, > Modified: llvm-gcc-4.2/trunk/boehm-gc/cord/de_win.h > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/boehm-gc/cord/de_win.h?rev=77248&r1=77247&r2=77248&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/boehm-gc/cord/de_win.h (original) > +++ llvm-gcc-4.2/trunk/boehm-gc/cord/de_win.h Mon Jul 27 16:00:35 2009 > @@ -100,4 +100,4 @@ > /* Invalidate line i on the screen. */ > > void de_error(char *s); > - /* Display error message. */ > \ No newline at end of file > + /* Display error message. */ > I guess this bit shouldn't be there. At least not without an LLVM local marker! :) Ciao, Duncan. From gohman at apple.com Tue Aug 18 12:54:46 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 10:54:46 -0700 Subject: [llvm-commits] [llvm] r78295 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/wide-integer-fold.ll In-Reply-To: <4A8AE938.6020209@free.fr> References: <200908060919.n769J0Q1022762@zion.cs.uiuc.edu> <4A8AE938.6020209@free.fr> Message-ID: <4E8DD8B5-5DCD-4AF5-928E-66C8B5866BA5@apple.com> On Aug 18, 2009, at 10:47 AM, Duncan Sands wrote: > Hi Dan, > > >> Fix a few places in DAGCombiner that were creating all-ones-bits >> >> and high-bits values in ways that weren't correct for integer >> >> types wider than 64 bits. This fixes a miscompile in >> >> PPMacroExpansion.cpp in clang on x86-64. >> > > this is not a problem with your patch, but I notice that this part > of the DAG combiner seems to make a lot of unsafe use of get?ExtValue. > Any chance of adding this to your TODO list? :) I scanned through all of DAGCombiner and fixed all the cases I found where getZExtValue was used for a purpose other than a shift count. For shift counts, values that don't fit in 64 bits are fairly rare ;-), so it's not a high priority. If I missed any places, I'd be happy to be shown them. Dan From richard at xmos.com Tue Aug 18 12:58:17 2009 From: richard at xmos.com (Richard Osborne) Date: Tue, 18 Aug 2009 17:58:17 -0000 Subject: [llvm-commits] [llvm] r79351 - in /llvm/trunk: lib/Target/XCore/XCoreTargetObjectFile.cpp test/CodeGen/XCore/globals.ll Message-ID: <200908181758.n7IHwHMB002891@zion.cs.uiuc.edu> Author: friedgold Date: Tue Aug 18 12:58:17 2009 New Revision: 79351 URL: http://llvm.org/viewvc/llvm-project?rev=79351&view=rev Log: Put data with relocations in the same sections as data without relocations. Modified: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp llvm/trunk/test/CodeGen/XCore/globals.ll Modified: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp?rev=79351&r1=79350&r2=79351&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp Tue Aug 18 12:58:17 2009 @@ -51,5 +51,11 @@ MCSectionXCore::Create(".cp.rodata", MCSectionELF::SHT_PROGBITS, MCSectionELF::SHF_ALLOC | MCSectionXCore::SHF_CP_SECTION, - SectionKind::getReadOnly(), false, getContext()); + SectionKind::getReadOnlyWithRel(), false, + getContext()); + + // Dynamic linking is not supported. Data with relocations is placed in the + // same section as data without relocations. + DataRelSection = DataRelLocalSection = DataSection; + DataRelROSection = DataRelROLocalSection = ReadOnlySection; } Modified: llvm/trunk/test/CodeGen/XCore/globals.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/globals.ll?rev=79351&r1=79350&r2=79351&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/XCore/globals.ll (original) +++ llvm/trunk/test/CodeGen/XCore/globals.ll Tue Aug 18 12:58:17 2009 @@ -22,6 +22,43 @@ ret i32* @G3 } +define i32 **@addr_G4() { +entry: +; CHECK: addr_G4: +; CHECK: ldaw r0, dp[G4] + ret i32** @G4 +} + +define i32 **@addr_G5() { +entry: +; CHECK: addr_G5: +; CHECK: ldaw r11, cp[G5] +; CHECK: mov r0, r11 + ret i32** @G5 +} + +define i32 **@addr_G6() { +entry: +; CHECK: addr_G6: +; CHECK: ldaw r0, dp[G6] + ret i32** @G6 +} + +define i32 **@addr_G7() { +entry: +; CHECK: addr_G7: +; CHECK: ldaw r11, cp[G7] +; CHECK: mov r0, r11 + ret i32** @G7 +} + +define i32 *@addr_G8() { +entry: +; CHECK: addr_G8: +; CHECK: ldaw r0, dp[G8] + ret i32* @G8 +} + @G1 = global i32 4712 ; CHECK: .section .dp.data,"awd", at progbits ; CHECK: G1: @@ -34,3 +71,22 @@ ; CHECK: .section .cp.rodata,"ac", at progbits ; CHECK: G3: + at G4 = global i32* @G1 +; CHECK: .section .dp.data,"awd", at progbits +; CHECK: G4: + + at G5 = constant i32* @G1 +; CHECK: .section .cp.rodata,"ac", at progbits +; CHECK: G5: + + at G6 = global i32* @G8 +; CHECK: .section .dp.data,"awd", at progbits +; CHECK: G6: + + at G7 = constant i32* @G8 +; CHECK: .section .cp.rodata,"ac", at progbits +; CHECK: G7: + + at G8 = internal global i32 9312 +; CHECK: .section .dp.data,"awd", at progbits +; CHECK: G8: From echristo at apple.com Tue Aug 18 12:59:59 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 18 Aug 2009 10:59:59 -0700 Subject: [llvm-commits] [llvm] r79308 - /llvm/trunk/Makefile.rules In-Reply-To: <38a0d8450908181048o25068e60i52f89ffbe490c7a8@mail.gmail.com> References: <200908180323.n7I3Nm65009418@zion.cs.uiuc.edu> <38a0d8450908181048o25068e60i52f89ffbe490c7a8@mail.gmail.com> Message-ID: <37C116C8-0646-49E8-B501-364A807737CD@apple.com> On Aug 18, 2009, at 10:48 AM, Rafael Espindola wrote: > 2009/8/18 Eric Christopher : >> Author: echristo >> Date: Mon Aug 17 22:23:40 2009 >> New Revision: 79308 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=79308&view=rev >> Log: >> Separate out Makefile defines so that we can keep the llvm >> defined ones from the user defined ones. Propagate accordingly. > > Looks like this broke libLLVMgold.so build. Before your patch I > would get > > ldd Debug/lib/libLLVMgold.so | grep LTO > libLTO.so => ......./llvm-build/Debug/lib/libLTO.so > (0x00007fd64f3d0000) > > now I get > > ldd Debug/lib/libLLVMgold.so | grep LTO > This is because I didn't put CXXFLAGS on the Link line and I'm guessing due to the case sensitivity of LIBS/CXXFLAGS that it didn't link in libLTO and tried for liblto. At any rate $(CXX.Flags) is on the LINK line so I'll add CXXFLAGS as well. -eric From baldrick at free.fr Tue Aug 18 13:06:06 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Aug 2009 20:06:06 +0200 Subject: [llvm-commits] [llvm] r78295 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/wide-integer-fold.ll In-Reply-To: <4E8DD8B5-5DCD-4AF5-928E-66C8B5866BA5@apple.com> References: <200908060919.n769J0Q1022762@zion.cs.uiuc.edu> <4A8AE938.6020209@free.fr> <4E8DD8B5-5DCD-4AF5-928E-66C8B5866BA5@apple.com> Message-ID: <4A8AED8E.9070907@free.fr> Hi Dan, >> this is not a problem with your patch, but I notice that this part >> of the DAG combiner seems to make a lot of unsafe use of get?ExtValue. >> Any chance of adding this to your TODO list? :) > > I scanned through all of DAGCombiner and fixed all the cases I > found where getZExtValue was used for a purpose other than a > shift count. For shift counts, values that don't fit in 64 bits > are fairly rare ;-), so it's not a high priority. If I missed > any places, I'd be happy to be shown them. I just went through DAGCombiner and couldn't find any examples either. I misread the uses of getZExtValue visible in your patch: they weren't for the transform I thought they were for, they were shift amounts. Sorry for the noise. Ciao, Duncan. From echristo at apple.com Tue Aug 18 13:07:35 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 18 Aug 2009 18:07:35 -0000 Subject: [llvm-commits] [llvm] r79352 - /llvm/trunk/Makefile.rules Message-ID: <200908181807.n7II7ZSC004085@zion.cs.uiuc.edu> Author: echristo Date: Tue Aug 18 13:07:35 2009 New Revision: 79352 URL: http://llvm.org/viewvc/llvm-project?rev=79352&view=rev Log: Add CXXFLAGS to the Link lines as well in case someone used those instead of LDFLAGS. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=79352&r1=79351&r2=79352&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Tue Aug 18 13:07:35 2009 @@ -640,7 +640,8 @@ $(TargetCommonOpts) $(CompileCommonOpts) -c Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \ $(CompileCommonOpts) $(CXX.Flags) -E - Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(LDFLAGS) \ + Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \ + $(LDFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip) else Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \ @@ -649,7 +650,7 @@ $(TargetCommonOpts) $(CompileCommonOpts) -c Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \ $(CompileCommonOpts) $(CXX.Flags) -E - Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(LDFLAGS) \ + Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LDFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip) endif From gohman at apple.com Tue Aug 18 13:07:37 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 11:07:37 -0700 Subject: [llvm-commits] [llvm] r77460 - /llvm/trunk/docs/LangRef.html In-Reply-To: <4A8AE71D.3040400@free.fr> References: <200907291600.n6TG0Wo6030195@zion.cs.uiuc.edu> <4A8AE71D.3040400@free.fr> Message-ID: On Aug 18, 2009, at 10:38 AM, Duncan Sands wrote: > Hi Dan, > > >> Add one-past-the-end language to the inbounds keyword. >> > > is this useful for LLVM? Also, I hear that C has a rule like this > for arrays, however I think in that case the address of the array > element one off the end is valid, but that may in fact be many > bytes off the end if the array element is large. It's not clear > from your wording whether you mean one byte off the end is ok, > or something closer to C. The one-past-the-end rule is entirely motivated by the need to support C, and programming models that lower to C-like semantics. From my reading of the standard, only one byte of address space is required to satisfy C's one-past-the-end rule. If I've misinterpreted the standard, or if there are programming models which require more than one byte and which could be accommodated by a reasonable change, I'm interested in hearing about it. Dan From gohman at apple.com Tue Aug 18 13:10:16 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 11:10:16 -0700 Subject: [llvm-commits] [llvm] r78707 - in /llvm/trunk: include/llvm/Constants.h include/llvm/InstrTypes.h include/llvm/Support/ConstantFolder.h include/llvm/Support/IRBuilder.h include/llvm/Support/NoFolder.h include/llvm/Support/TargetFolder.h lib/VMCore/Constants.cpp In-Reply-To: <4A894C45.9000402@free.fr> References: <200908112020.n7BKKeXj013134@zion.cs.uiuc.edu> <4A894C45.9000402@free.fr> Message-ID: <0A89F6B9-F921-4E1E-8D39-60E98B08E964@apple.com> On Aug 17, 2009, at 5:25 AM, Duncan Sands wrote: > Hi Dan, > > >> + /// CreateNSWAdd - Create an Add operator with the NSW flag set. >> >> + /// >> >> + static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2, >> >> + const Twine &Name = "") { >> >> + BinaryOperator *BO = CreateAdd(V1, V2, Name); >> >> + cast(BO)->setHasNoSignedOverflow(true); >> >> + return BO; >> >> + } >> > > the names NSW and NoSignedOverflow are kind of inconsistent. > Shouldn't > NSW be NSO, or NoSignedOverflow be NoSignedWraparound? Yes. I'll change NoSignedOverflow to NoSignedWrap. Dan From baldrick at free.fr Tue Aug 18 13:13:17 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Aug 2009 20:13:17 +0200 Subject: [llvm-commits] [llvm] r76895 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp In-Reply-To: <6a8523d60907241610i357156bbqe79eccef5a735dea@mail.gmail.com> References: <200907231900.n6NJ0RW8001985@zion.cs.uiuc.edu> <13C7FE1D-84FB-45B2-922F-C9C56364D3AC@apple.com> <4A69AE6C.7020906@free.fr> <6a8523d60907241610i357156bbqe79eccef5a735dea@mail.gmail.com> Message-ID: <4A8AEF3D.9000405@free.fr> Hi Daniel, > This sounds like we should figure out how to make llvm-gcc use > libgcc.a while running llvm-test. This doesn't seem intrinsically that > difficult... it looks like the gcc deja gnu testsuite uses LD_LIBRARY_PATH to ensure that tests are linked with the newly built libgcc. Check out the logic in gcc/testsuite/lib/target-libpath.exp Ciao, Duncan. From idadesub at users.sourceforge.net Tue Aug 18 13:20:37 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Tue, 18 Aug 2009 18:20:37 -0000 Subject: [llvm-commits] [llvm] r79353 - /llvm/trunk/lib/Support/APFloat.cpp Message-ID: <200908181820.n7IIKb0u005685@zion.cs.uiuc.edu> Author: erickt Date: Tue Aug 18 13:20:37 2009 New Revision: 79353 URL: http://llvm.org/viewvc/llvm-project?rev=79353&view=rev Log: Fix an uninitialized value warning in APFloat. Modified: llvm/trunk/lib/Support/APFloat.cpp Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=79353&r1=79352&r2=79353&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Tue Aug 18 13:20:37 2009 @@ -2132,7 +2132,7 @@ APFloat::convertFromHexadecimalString(const StringRef &s, roundingMode rounding_mode) { - lostFraction lost_fraction; + lostFraction lost_fraction = lfExactlyZero; integerPart *significand; unsigned int bitPos, partsCount; StringRef::iterator dot, firstSignificantDigit; @@ -2159,7 +2159,6 @@ hex_value = hexDigitValue(*p); if(hex_value == -1U) { - lost_fraction = lfExactlyZero; break; } From daniel at zuster.org Tue Aug 18 13:26:35 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 18:26:35 -0000 Subject: [llvm-commits] [llvm] r79354 - in /llvm/trunk: include/llvm/ADT/StringRef.h unittests/ADT/StringRefTest.cpp Message-ID: <200908181826.n7IIQZxP006408@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 13:26:35 2009 New Revision: 79354 URL: http://llvm.org/viewvc/llvm-project?rev=79354&view=rev Log: Add StringRef::count({char,StringRef}) Modified: llvm/trunk/include/llvm/ADT/StringRef.h llvm/trunk/unittests/ADT/StringRefTest.cpp Modified: llvm/trunk/include/llvm/ADT/StringRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=79354&r1=79353&r2=79354&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringRef.h (original) +++ llvm/trunk/include/llvm/ADT/StringRef.h Tue Aug 18 13:26:35 2009 @@ -172,6 +172,28 @@ return npos; } + /// count - Return the number of occurrences of \arg C in the string. + size_t count(char C) const { + size_t Count = 0; + for (size_t i = 0, e = Length; i != e; ++i) + if (Data[i] == C) + return i; + return Count; + } + + /// count - Return the number of non-overlapped occurrences of \arg Str in + /// the string. + size_t count(const StringRef &Str) const { + size_t Count = 0; + size_t N = Str.size(); + if (N > Length) + return 0; + for (size_t i = 0, e = Length - N + 1; i != e; ++i) + if (substr(i, N).equals(Str)) + ++Count; + return Count; + } + /// @} /// @name Substring Operations /// @{ Modified: llvm/trunk/unittests/ADT/StringRefTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringRefTest.cpp?rev=79354&r1=79353&r2=79354&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/StringRefTest.cpp (original) +++ llvm/trunk/unittests/ADT/StringRefTest.cpp Tue Aug 18 13:26:35 2009 @@ -94,6 +94,13 @@ EXPECT_TRUE(Str.find("hello") == 0); EXPECT_TRUE(Str.find("ello") == 1); EXPECT_TRUE(Str.find("zz") == StringRef::npos); + + EXPECT_TRUE(Str.count('l') == 2); + EXPECT_TRUE(Str.count('z') == 0); + EXPECT_TRUE(Str.count("helloworld") == 0); + EXPECT_TRUE(Str.count("hello") == 1); + EXPECT_TRUE(Str.count("ello") == 1); + EXPECT_TRUE(Str.count("zz") == 0); } } // end anonymous namespace From resistor at mac.com Tue Aug 18 13:28:58 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 18 Aug 2009 18:28:58 -0000 Subject: [llvm-commits] [llvm] r79355 - in /llvm/trunk/lib/VMCore: LLVMContextImpl.h Value.cpp Message-ID: <200908181828.n7IISw71006711@zion.cs.uiuc.edu> Author: resistor Date: Tue Aug 18 13:28:58 2009 New Revision: 79355 URL: http://llvm.org/viewvc/llvm-project?rev=79355&view=rev Log: Privatize the ValueHandle global map. Because this is used so heavily throughout the code base, locking all accesses to it is not practical performance-wise. Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/Value.cpp Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=79355&r1=79354&r2=79355&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Tue Aug 18 13:28:58 2009 @@ -171,6 +171,12 @@ const IntegerType *Int32Ty; const IntegerType *Int64Ty; + /// ValueHandles - This map keeps track of all of the value handles that are + /// watching a Value*. The Value::HasValueHandle bit is used to know + // whether or not a value has an entry in this map. + typedef DenseMap ValueHandlesTy; + ValueHandlesTy ValueHandles; + LLVMContextImpl(LLVMContext &C) : TheTrueVal(0), TheFalseVal(0), VoidTy(new Type(C, Type::VoidTyID)), LabelTy(new Type(C, Type::LabelTyID)), Modified: llvm/trunk/lib/VMCore/Value.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=79355&r1=79354&r2=79355&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Value.cpp (original) +++ llvm/trunk/lib/VMCore/Value.cpp Tue Aug 18 13:28:58 2009 @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "LLVMContextImpl.h" #include "llvm/Constant.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -378,13 +379,6 @@ // ValueHandleBase Class //===----------------------------------------------------------------------===// -/// ValueHandles - This map keeps track of all of the value handles that are -/// watching a Value*. The Value::HasValueHandle bit is used to know whether or -/// not a value has an entry in this map. -typedef DenseMap ValueHandlesTy; -static ManagedStatic ValueHandles; -static ManagedStatic > ValueHandlesLock; - /// AddToExistingUseList - Add this ValueHandle to the use list for VP, where /// List is known to point into the existing use list. void ValueHandleBase::AddToExistingUseList(ValueHandleBase **List) { @@ -403,11 +397,13 @@ /// AddToUseList - Add this ValueHandle to the use list for VP. void ValueHandleBase::AddToUseList() { assert(VP && "Null pointer doesn't have a use list!"); + + LLVMContextImpl *pImpl = VP->getContext().pImpl; + if (VP->HasValueHandle) { // If this value already has a ValueHandle, then it must be in the // ValueHandles map already. - sys::SmartScopedReader Reader(*ValueHandlesLock); - ValueHandleBase *&Entry = (*ValueHandles)[VP]; + ValueHandleBase *&Entry = pImpl->ValueHandles[VP]; assert(Entry != 0 && "Value doesn't have any handles?"); AddToExistingUseList(&Entry); return; @@ -418,8 +414,7 @@ // reallocate itself, which would invalidate all of the PrevP pointers that // point into the old table. Handle this by checking for reallocation and // updating the stale pointers only if needed. - sys::SmartScopedWriter Writer(*ValueHandlesLock); - ValueHandlesTy &Handles = *ValueHandles; + DenseMap &Handles = pImpl->ValueHandles; const void *OldBucketPtr = Handles.getPointerIntoBucketsArray(); ValueHandleBase *&Entry = Handles[VP]; @@ -435,8 +430,8 @@ } // Okay, reallocation did happen. Fix the Prev Pointers. - for (ValueHandlesTy::iterator I = Handles.begin(), E = Handles.end(); - I != E; ++I) { + for (DenseMap::iterator I = Handles.begin(), + E = Handles.end(); I != E; ++I) { assert(I->second && I->first == I->second->VP && "List invariant broken!"); I->second->setPrevPtr(&I->second); } @@ -460,8 +455,8 @@ // If the Next pointer was null, then it is possible that this was the last // ValueHandle watching VP. If so, delete its entry from the ValueHandles // map. - sys::SmartScopedWriter Writer(*ValueHandlesLock); - ValueHandlesTy &Handles = *ValueHandles; + LLVMContextImpl *pImpl = VP->getContext().pImpl; + DenseMap &Handles = pImpl->ValueHandles; if (Handles.isPointerIntoBucketsArray(PrevPtr)) { Handles.erase(VP); VP->HasValueHandle = false; @@ -474,9 +469,8 @@ // Get the linked list base, which is guaranteed to exist since the // HasValueHandle flag is set. - ValueHandlesLock->reader_acquire(); - ValueHandleBase *Entry = (*ValueHandles)[V]; - ValueHandlesLock->reader_release(); + LLVMContextImpl *pImpl = V->getContext().pImpl; + ValueHandleBase *Entry = pImpl->ValueHandles[V]; assert(Entry && "Value bit set but no entries exist"); while (Entry) { @@ -514,9 +508,9 @@ // Get the linked list base, which is guaranteed to exist since the // HasValueHandle flag is set. - ValueHandlesLock->reader_acquire(); - ValueHandleBase *Entry = (*ValueHandles)[Old]; - ValueHandlesLock->reader_release(); + LLVMContextImpl *pImpl = Old->getContext().pImpl; + ValueHandleBase *Entry = pImpl->ValueHandles[Old]; + assert(Entry && "Value bit set but no entries exist"); while (Entry) { From daniel at zuster.org Tue Aug 18 13:34:23 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 18:34:23 -0000 Subject: [llvm-commits] [llvm] r79356 - in /llvm/trunk: include/llvm/ADT/StringRef.h unittests/ADT/StringRefTest.cpp Message-ID: <200908181834.n7IIYNgK007370@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 13:34:22 2009 New Revision: 79356 URL: http://llvm.org/viewvc/llvm-project?rev=79356&view=rev Log: Fix pasto in StringRef::count(char) Modified: llvm/trunk/include/llvm/ADT/StringRef.h llvm/trunk/unittests/ADT/StringRefTest.cpp Modified: llvm/trunk/include/llvm/ADT/StringRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=79356&r1=79355&r2=79356&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringRef.h (original) +++ llvm/trunk/include/llvm/ADT/StringRef.h Tue Aug 18 13:34:22 2009 @@ -177,7 +177,7 @@ size_t Count = 0; for (size_t i = 0, e = Length; i != e; ++i) if (Data[i] == C) - return i; + ++Count; return Count; } Modified: llvm/trunk/unittests/ADT/StringRefTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringRefTest.cpp?rev=79356&r1=79355&r2=79356&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/StringRefTest.cpp (original) +++ llvm/trunk/unittests/ADT/StringRefTest.cpp Tue Aug 18 13:34:22 2009 @@ -96,6 +96,7 @@ EXPECT_TRUE(Str.find("zz") == StringRef::npos); EXPECT_TRUE(Str.count('l') == 2); + EXPECT_TRUE(Str.count('o') == 1); EXPECT_TRUE(Str.count('z') == 0); EXPECT_TRUE(Str.count("helloworld") == 0); EXPECT_TRUE(Str.count("hello") == 1); From edwintorok at gmail.com Tue Aug 18 14:08:59 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Tue, 18 Aug 2009 22:08:59 +0300 Subject: [llvm-commits] [llvm] r77460 - /llvm/trunk/docs/LangRef.html In-Reply-To: References: <200907291600.n6TG0Wo6030195@zion.cs.uiuc.edu> <4A8AE71D.3040400@free.fr> Message-ID: <4A8AFC4B.5000502@gmail.com> On 2009-08-18 21:07, Dan Gohman wrote: > On Aug 18, 2009, at 10:38 AM, Duncan Sands wrote: > > > >> Hi Dan, >> >> >> >>> Add one-past-the-end language to the inbounds keyword. >>> >>> >> is this useful for LLVM? Also, I hear that C has a rule like this >> for arrays, however I think in that case the address of the array >> element one off the end is valid, but that may in fact be many >> bytes off the end if the array element is large. It's not clear >> from your wording whether you mean one byte off the end is ok, >> or something closer to C. >> > > The one-past-the-end rule is entirely motivated by the need to > support C, and programming models that lower to C-like semantics. > From my reading of the standard, only one byte of address space > is required to satisfy C's one-past-the-end rule. > > If I've misinterpreted the standard, or if there are programming > models which require more than one byte and which could be > accommodated by a reasonable change, I'm interested in hearing > about it. > There are programs which read 2 bytes for 2-byte aligned addresses, 4-bytes for 4-byte aligned, etc. and rely on the fact that even though it reads uninitialized bytes, the memory is still valid (since memory is allocated in pages). I think this is why valgrind has the '--partial-loads-ok=yes' flag. Such code doesn't conform to the C standard strictly, however I remember doing that some glibc version used it in strcmp & friends, at least on x86-32 (not sure if it was in assembly code or C code, but it wouldn't surprise me if it were C code). I think allowing to read at least min(AlignOf(ptr),16)-1 at the end of an array/string is reasonable. Actually the computer pointer's start address is inbounds according to your rules, but the load/store itself is not. So how about allowing to read at most 16 bytes whenever the start address is inbounds? Also I thought SimplifyLibcalls was doing some strcmp->memcmp optimizations that relied on aligned loads being valid, but apparently it does the transform only if the length of both strings are known. P.S.: While looking at SimplifyLibcalls I also found a bug: it doesn't check whether the GV initializer can be overriden during linking via a non-weak def, I opened PR4738 about this. Best regards, --Edwin From brukman+llvm at gmail.com Tue Aug 18 14:18:40 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Tue, 18 Aug 2009 19:18:40 -0000 Subject: [llvm-commits] [llvm] r79357 - /llvm/trunk/docs/GetElementPtr.html Message-ID: <200908181918.n7IJIeZB012984@zion.cs.uiuc.edu> Author: brukman Date: Tue Aug 18 14:18:40 2009 New Revision: 79357 URL: http://llvm.org/viewvc/llvm-project?rev=79357&view=rev Log: Surrounded variable in tags for consistency. Modified: llvm/trunk/docs/GetElementPtr.html Modified: llvm/trunk/docs/GetElementPtr.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GetElementPtr.html?rev=79357&r1=79356&r2=79357&view=diff ============================================================================== --- llvm/trunk/docs/GetElementPtr.html (original) +++ llvm/trunk/docs/GetElementPtr.html Tue Aug 18 14:18:40 2009 @@ -303,13 +303,14 @@

      In this example, idx1 computes the address of the second integer - in the array that is in the structure in %MyVar, that is MyVar+4. The - type of idx1 is i32*. However, idx2 computes the - address of the next structure after %MyVar. The type of - idx2 is { [10 x i32] }* and its value is equivalent - to MyVar + 40 because it indexes past the ten 4-byte integers - in MyVar. Obviously, in such a situation, the pointers don't - alias.

      + in the array that is in the structure in %MyVar, that is + MyVar+4. The type of idx1 is i32*. However, + idx2 computes the address of the next structure after + %MyVar. The type of idx2 is { [10 x i32] }* and its + value is equivalent to MyVar + 40 because it indexes past the ten + 4-byte integers in MyVar. Obviously, in such a situation, the + pointers don't alias.

      + From greened at obbligato.org Tue Aug 18 14:22:55 2009 From: greened at obbligato.org (David Greene) Date: Tue, 18 Aug 2009 19:22:55 -0000 Subject: [llvm-commits] [llvm] r79358 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/Support/IOManip.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <200908181922.n7IJMtJB013528@zion.cs.uiuc.edu> Author: greened Date: Tue Aug 18 14:22:55 2009 New Revision: 79358 URL: http://llvm.org/viewvc/llvm-project?rev=79358&view=rev Log: Make various changes suggested by Chris. Removed: llvm/trunk/include/llvm/Support/IOManip.h Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=79358&r1=79357&r2=79358&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Aug 18 14:22:55 2009 @@ -17,6 +17,7 @@ #define LLVM_CODEGEN_ASMPRINTER_H #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/Support/DebugLoc.h" #include "llvm/Target/TargetMachine.h" #include "llvm/ADT/DenseMap.h" @@ -24,15 +25,22 @@ class GCStrategy; class Constant; class ConstantArray; + class ConstantFP; class ConstantInt; class ConstantStruct; class ConstantVector; class GCMetadataPrinter; + class GlobalValue; class GlobalVariable; + class MachineBasicBlock; + class MachineFunction; + class MachineInstr; class MachineLoopInfo; class MachineLoop; + class MachineConstantPool; class MachineConstantPoolEntry; class MachineConstantPoolValue; + class MachineJumpTableInfo; class MachineModuleInfo; class MCInst; class MCContext; @@ -67,11 +75,6 @@ /// MachineLoopInfo *LI; - /// PrintChildLoopComment - Print comments about child loops - /// within the loop for this basic block, with nesting. - /// - void PrintChildLoopComment(const MachineLoop *loop) const; - protected: /// MMI - If available, this is a pointer to the current MachineModuleInfo. MachineModuleInfo *MMI; Removed: llvm/trunk/include/llvm/Support/IOManip.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IOManip.h?rev=79357&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/IOManip.h (original) +++ llvm/trunk/include/llvm/Support/IOManip.h (removed) @@ -1,43 +0,0 @@ -//===----------------- IOManip.h - iostream manipulators ---------*- C++ -*===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Manipulators to do special-purpose formatting. -// -//===----------------------------------------------------------------------===// - -namespace llvm { - /// Indent - Insert spaces into the character output stream. The - /// "level" is multiplied by the "scale" to calculate the number of - /// spaces to insert. "level" can represent something like loop - /// nesting level, for example. - /// - class Indent { - public: - explicit Indent(int lvl, int amt = 2) - : level(lvl), scale(amt) {} - - template - OStream &operator()(OStream &out) const { - for(int i = 0; i < level*scale; ++i) { - out << " "; - } - return out; - } - - private: - int level; - int scale; - }; - - template - OStream &operator<<(OStream &out, const Indent &indent) - { - return(indent(out)); - } -} Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=79358&r1=79357&r2=79358&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Aug 18 14:22:55 2009 @@ -18,6 +18,7 @@ #include "llvm/Module.h" #include "llvm/CodeGen/GCMetadataPrinter.h" #include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h" @@ -30,7 +31,6 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" -#include "llvm/Support/IOManip.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" @@ -48,10 +48,6 @@ AsmVerbose("asm-verbose", cl::desc("Add comments to directives."), cl::init(cl::BOU_UNSET)); -static cl::opt -AsmExuberant("asm-exuberant", cl::desc("Add many comments."), - cl::init(cl::BOU_FALSE)); - char AsmPrinter::ID = 0; AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm, const TargetAsmInfo *T, bool VDef) @@ -69,11 +65,6 @@ case cl::BOU_TRUE: VerboseAsm = true; break; case cl::BOU_FALSE: VerboseAsm = false; break; } - switch (AsmExuberant) { - case cl::BOU_UNSET: ExuberantAsm = false; break; - case cl::BOU_TRUE: ExuberantAsm = true; break; - case cl::BOU_FALSE: ExuberantAsm = false; break; - } } AsmPrinter::~AsmPrinter() { @@ -106,7 +97,7 @@ AU.setPreservesAll(); MachineFunctionPass::getAnalysisUsage(AU); AU.addRequired(); - if (ExuberantAsm) + if (VerboseAsm) AU.addRequired(); } @@ -238,7 +229,7 @@ CurrentFnName = Mang->getMangledName(MF.getFunction()); IncrementFunctionNumber(); - if (ExuberantAsm) { + if (VerboseAsm) { LI = &getAnalysis(); } } @@ -1802,10 +1793,50 @@ } } +/// Indent - Insert spaces into the character output stream. The +/// "level" is multiplied by the "scale" to calculate the number of +/// spaces to insert. "level" can represent something like loop +/// nesting level, for example. +/// +static formatted_raw_ostream & +Indent(formatted_raw_ostream &out, int level, int scale = 2) { + for(int i = 0; i < level*scale; ++i) { + out << " "; + } + return out; +} + +/// PrintChildLoopComment - Print comments about child loops within +/// the loop for this basic block, with nesting. +/// +static void PrintChildLoopComment(formatted_raw_ostream &O, + const MachineLoop *loop, + const TargetAsmInfo *TAI, + int FunctionNumber) { + // Add child loop information + for(MachineLoop::iterator cl = loop->begin(), + clend = loop->end(); + cl != clend; + ++cl) { + MachineBasicBlock *Header = (*cl)->getHeader(); + assert(Header && "No header for loop"); + + O << '\n'; + O.PadToColumn(TAI->getCommentColumn()); + + O << TAI->getCommentString(); + Indent(O, (*cl)->getLoopDepth()-1) + << " Child Loop BB" << FunctionNumber << "_" + << Header->getNumber() << " Depth " << (*cl)->getLoopDepth(); + + PrintChildLoopComment(O, *cl, TAI, FunctionNumber); + } +} + /// EmitComments - Pretty-print comments for basic blocks void AsmPrinter::EmitComments(const MachineBasicBlock &MBB) const { - if (ExuberantAsm) { + if (VerboseAsm) { // Add loop depth information const MachineLoop *loop = LI->getLoopFor(&MBB); @@ -1823,7 +1854,7 @@ if (Header == &MBB) { O << TAI->getCommentString() << " Loop Header"; - PrintChildLoopComment(loop); + PrintChildLoopComment(O, loop, TAI, getFunctionNumber()); } else { O << TAI->getCommentString() << " Loop Header is BB" @@ -1845,30 +1876,11 @@ O << '\n'; O.PadToColumn(TAI->getCommentColumn()); - O << TAI->getCommentString() << Indent(CurLoop->getLoopDepth()-1) - << " Inside Loop BB" << getFunctionNumber() << "_" + O << TAI->getCommentString(); + Indent(O, CurLoop->getLoopDepth()-1) + << " Inside Loop BB" << getFunctionNumber() << "_" << Header->getNumber() << " Depth " << CurLoop->getLoopDepth(); } } } } - -void AsmPrinter::PrintChildLoopComment(const MachineLoop *loop) const { - // Add child loop information - for(MachineLoop::iterator cl = loop->begin(), - clend = loop->end(); - cl != clend; - ++cl) { - MachineBasicBlock *Header = (*cl)->getHeader(); - assert(Header && "No header for loop"); - - O << '\n'; - O.PadToColumn(TAI->getCommentColumn()); - - O << TAI->getCommentString() << Indent((*cl)->getLoopDepth()-1) - << " Child Loop BB" << getFunctionNumber() << "_" - << Header->getNumber() << " Depth " << (*cl)->getLoopDepth(); - - PrintChildLoopComment(*cl); - } -} From daniel at zuster.org Tue Aug 18 14:26:56 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 19:26:56 -0000 Subject: [llvm-commits] [llvm] r79359 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp unittests/ADT/TripleTest.cpp Message-ID: <200908181926.n7IJQuqc014031@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 14:26:55 2009 New Revision: 79359 URL: http://llvm.org/viewvc/llvm-project?rev=79359&view=rev Log: Improve Triple to recognize the OS in i386-mingw32. Modified: llvm/trunk/include/llvm/ADT/Triple.h llvm/trunk/lib/Support/Triple.cpp llvm/trunk/unittests/ADT/TripleTest.cpp Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=79359&r1=79358&r2=79359&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Tue Aug 18 14:26:55 2009 @@ -29,8 +29,22 @@ /// behavior for particular targets. This class isolates the mapping /// from the components of the target triple to well known IDs. /// -/// See autoconf/config.guess for a glimpse into what they look like -/// in practice. +/// At its core the Triple class is designed to be a wrapper for a triple +/// string; it does not normally change or normalize the triple string, instead +/// it provides additional APIs to parse normalized parts out of the triple. +/// +/// One curiosity this implies is that for some odd triples the results of, +/// e.g., getOSName() can be very different from the result of getOS(). For +/// example, for 'i386-mingw32', getOS() will return MinGW32, but since +/// getOSName() is purely based on the string structure that will return the +/// empty string. +/// +/// Clients should generally avoid using getOSName() and related APIs unless +/// they are familiar with the triple format (this is particularly true when +/// rewriting a triple). +/// +/// See autoconf/config.guess for a glimpse into what they look like in +/// practice. class Triple { public: enum ArchType { Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=79359&r1=79358&r2=79359&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Tue Aug 18 14:26:55 2009 @@ -117,6 +117,9 @@ assert(!isInitialized() && "Invalid parse call."); StringRef ArchName = getArchName(); + StringRef VendorName = getVendorName(); + StringRef OSName = getOSName(); + if (ArchName.size() == 4 && ArchName[0] == 'i' && ArchName[2] == '8' && ArchName[3] == '6' && ArchName[1] - '3' < 6) // i[3-9]86 @@ -156,7 +159,22 @@ else Arch = UnknownArch; - StringRef VendorName = getVendorName(); + + // Handle some exceptional cases where the OS / environment components are + // stuck into the vendor field. + if (StringRef(getTriple()).count('-') == 1) { + StringRef VendorName = getVendorName(); + + if (VendorName.startswith("mingw32")) { // 'i386-mingw32', etc. + Vendor = PC; + OS = MinGW32; + return; + } + + // arm-elf is another example, but we don't currently parse anything about + // the environment. + } + if (VendorName == "apple") Vendor = Apple; else if (VendorName == "pc") @@ -164,7 +182,6 @@ else Vendor = UnknownVendor; - StringRef OSName = getOSName(); if (OSName.startswith("auroraux")) OS = AuroraUX; else if (OSName.startswith("cygwin")) Modified: llvm/trunk/unittests/ADT/TripleTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=79359&r1=79358&r2=79359&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/TripleTest.cpp (original) +++ llvm/trunk/unittests/ADT/TripleTest.cpp Tue Aug 18 14:26:55 2009 @@ -92,6 +92,18 @@ T = Triple("huh"); EXPECT_EQ(Triple::UnknownArch, T.getArch()); + + // Two exceptional cases. + + T = Triple("i386-mingw32"); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ(Triple::PC, T.getVendor()); + EXPECT_EQ(Triple::MinGW32, T.getOS()); + + T = Triple("arm-elf"); + EXPECT_EQ(Triple::arm, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::UnknownOS, T.getOS()); } TEST(TripleTest, MutateName) { From brukman+llvm at gmail.com Tue Aug 18 14:58:30 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Tue, 18 Aug 2009 19:58:30 -0000 Subject: [llvm-commits] [TV] r79360 - /television/trunk/tools/llvm-tv/TVTreeItem.cpp Message-ID: <200908181958.n7IJwUs0017911@zion.cs.uiuc.edu> Author: brukman Date: Tue Aug 18 14:58:30 2009 New Revision: 79360 URL: http://llvm.org/viewvc/llvm-project?rev=79360&view=rev Log: Properly print out the Module to text. Modified: television/trunk/tools/llvm-tv/TVTreeItem.cpp Modified: television/trunk/tools/llvm-tv/TVTreeItem.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVTreeItem.cpp?rev=79360&r1=79359&r2=79360&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVTreeItem.cpp (original) +++ television/trunk/tools/llvm-tv/TVTreeItem.cpp Tue Aug 18 14:58:30 2009 @@ -13,8 +13,7 @@ } void TVTreeModuleItem::print(std::ostream &os) { - // TODO: update to current LLVM API. - //myModule->print(os); + os << *myModule; } void TVTreeFunctionItem::print(std::ostream &os) { From daniel at zuster.org Tue Aug 18 14:58:46 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 12:58:46 -0700 Subject: [llvm-commits] [llvm] r78924 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp In-Reply-To: <6C544359-4734-4A25-9225-D16A0A1C9566@apple.com> References: <200908131741.n7DHfelN003561@zion.cs.uiuc.edu> <6a8523d60908131055o18d35046g1ef95962b05b0d5f@mail.gmail.com> <6C544359-4734-4A25-9225-D16A0A1C9566@apple.com> Message-ID: <6a8523d60908181258l1bcac2e4xa9c5cec6e38a8d28@mail.gmail.com> I'm backing this out for now, it definitely made raw_{string,svector}_ostream slower in my timings (on a synthetic benchmark): std::string: -- r79347: name avg min med max SD total user 0.6161 0.6158 0.6158 0.6168 0.0005 1.8484 sys 0.0789 0.0780 0.0784 0.0805 0.0011 0.2368 wall 0.6967 0.6952 0.6958 0.6991 0.0017 2.0901 r79347 w/ 78924 backed out: name avg min med max SD total user 0.3787 0.3785 0.3787 0.3788 0.0001 1.1360 sys 0.0790 0.0786 0.0800 0.0783 0.0007 0.2370 wall 0.4591 0.4583 0.4603 0.4587 0.0008 1.3773 -- The svector stream shows the same change. For reference, these are the times for llvm::outs(): -- name avg min med max SD total user 0.2983 0.2981 0.2984 0.2985 0.0002 0.8950 sys 0.0019 0.0018 0.0020 0.0018 0.0001 0.0056 wall 0.3052 0.3008 0.3014 0.3134 0.0058 0.9156 -- I'll work today on getting rid of the unnecessary extra malloc/free calls for those kinds of streams. - Daniel On Thu, Aug 13, 2009 at 5:20 PM, Chris Lattner wrote: > > On Aug 13, 2009, at 10:55 AM, Daniel Dunbar wrote: > >> On Thu, Aug 13, 2009 at 10:41 AM, Dan Gohman wrote: >>> >>> Author: djg >>> Date: Thu Aug 13 12:41:40 2009 >>> New Revision: 78924 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=78924&view=rev >>> Log: >>> Set raw_os_ostream, raw_string_ostream, and raw_svector_ostream to be >>> unbuffered. std::ostream does its own buffering, and std::string and >>> SmallVector both have allocation strategies intended to handle frequent >>> appending. >> >> >> Eek! >> >> Did you profile the effects of this change? I expect that this >> dramatically slows down these streams. One of the main values of being >> buffered in raw_ostream is that we hit all the fast paths to quickly >> output small strings. Making all of these strings unbuffered nullifies >> several of these optimizations. > > Yes, I'm really scared of this too. ?The whole idea of raw_ostream is to > inline the trivial "o << 'c'" calls. ?This doesn't help if the inlined code > is always calling flush! > > -Chris > > From daniel at zuster.org Tue Aug 18 15:07:36 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 20:07:36 -0000 Subject: [llvm-commits] [llvm] r79361 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <200908182007.n7IK7aFR019047@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 15:07:36 2009 New Revision: 79361 URL: http://llvm.org/viewvc/llvm-project?rev=79361&view=rev Log: Revert r78924, disabling buffering defeats all the fast paths in raw_ostream. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=79361&r1=79360&r2=79361&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Aug 18 15:07:36 2009 @@ -376,7 +376,8 @@ virtual uint64_t current_pos(); public: - raw_os_ostream(std::ostream &O) : raw_ostream(true), OS(O) {} + raw_os_ostream(std::ostream &O) : OS(O) {} + ~raw_os_ostream(); /// tell - Return the current offset with the stream. uint64_t tell(); @@ -394,7 +395,8 @@ /// counting the bytes currently in the buffer. virtual uint64_t current_pos() { return OS.size(); } public: - explicit raw_string_ostream(std::string &O) : raw_ostream(true), OS(O) {} + explicit raw_string_ostream(std::string &O) : OS(O) {} + ~raw_string_ostream(); /// tell - Return the current offset with the stream. uint64_t tell() { return OS.size() + GetNumBytesInBuffer(); } @@ -420,8 +422,8 @@ /// counting the bytes currently in the buffer. virtual uint64_t current_pos(); public: - explicit raw_svector_ostream(SmallVectorImpl &O) - : raw_ostream(true), OS(O) {} + explicit raw_svector_ostream(SmallVectorImpl &O) : OS(O) {} + ~raw_svector_ostream(); /// tell - Return the current offset with the stream. uint64_t tell(); Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79361&r1=79360&r2=79361&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 18 15:07:36 2009 @@ -456,6 +456,10 @@ // raw_os_ostream //===----------------------------------------------------------------------===// +raw_os_ostream::~raw_os_ostream() { + flush(); +} + void raw_os_ostream::write_impl(const char *Ptr, size_t Size) { OS.write(Ptr, Size); } @@ -470,6 +474,10 @@ // raw_string_ostream //===----------------------------------------------------------------------===// +raw_string_ostream::~raw_string_ostream() { + flush(); +} + void raw_string_ostream::write_impl(const char *Ptr, size_t Size) { OS.append(Ptr, Size); } @@ -478,6 +486,10 @@ // raw_svector_ostream //===----------------------------------------------------------------------===// +raw_svector_ostream::~raw_svector_ostream() { + flush(); +} + void raw_svector_ostream::write_impl(const char *Ptr, size_t Size) { OS.append(Ptr, Ptr + Size); } From gohman at apple.com Tue Aug 18 15:09:59 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 20:09:59 -0000 Subject: [llvm-commits] [llvm] r79362 - /llvm/trunk/lib/Support/raw_ostream.cpp Message-ID: <200908182009.n7IK9xdS019357@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 15:09:59 2009 New Revision: 79362 URL: http://llvm.org/viewvc/llvm-project?rev=79362&view=rev Log: Fix a bug in raw_ostream::write(char) introduced by the change to allow underlying stream classes to decline buffering. After calling SetBuffered(), re-check whether the stream is Unbuffered in order to handle the case where the underlying stream has declined buffering. Modified: llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79362&r1=79361&r2=79362&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 18 15:09:59 2009 @@ -187,10 +187,17 @@ return *this; } - if (!OutBufStart) - SetBuffered(); - else + if (OutBufStart) flush_nonempty(); + else { + SetBuffered(); + // It's possible for the underlying stream to decline + // buffering, so check this condition again. + if (Unbuffered) { + write_impl(reinterpret_cast(&C), 1); + return *this; + } + } } *OutBufCur++ = C; From brukman+llvm at gmail.com Tue Aug 18 15:37:25 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Tue, 18 Aug 2009 20:37:25 -0000 Subject: [llvm-commits] [TV] r79363 - in /television/trunk/tools/llvm-tv: CodeViewer.cpp CodeViewer.h Message-ID: <200908182037.n7IKbQFg022891@zion.cs.uiuc.edu> Author: brukman Date: Tue Aug 18 15:37:25 2009 New Revision: 79363 URL: http://llvm.org/viewvc/llvm-project?rev=79363&view=rev Log: * Fixed comment deletion in strings -- instructions no longer have trailing EOL * Simplified code with new wxS() utility and updated wxWidgets API * Disabled Hide()/Show() as the latter doesn't seem to undo the former in wxWidgets 2.8.7 Modified: television/trunk/tools/llvm-tv/CodeViewer.cpp television/trunk/tools/llvm-tv/CodeViewer.h Modified: television/trunk/tools/llvm-tv/CodeViewer.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/CodeViewer.cpp?rev=79363&r1=79362&r2=79363&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/CodeViewer.cpp (original) +++ television/trunk/tools/llvm-tv/CodeViewer.cpp Tue Aug 18 15:37:25 2009 @@ -2,6 +2,7 @@ #include "TVApplication.h" #include "TVTreeItem.h" #include "TVFrame.h" +#include "wxUtils.h" #include "llvm/Function.h" #include "llvm/Instruction.h" #include "llvm/Value.h" @@ -20,7 +21,7 @@ label = BB->getName().str() + ":"; else if (Instruction *I = dyn_cast(Val)) { std::ostringstream out; - I->print(out); + out << *I; label = out.str(); // Post-processing for more attractive display for (unsigned i = 0; i != label.length(); ++i) @@ -30,33 +31,34 @@ label[i] = ' '; label.insert(label.begin()+i+1, ' '); } else if (label[i] == ';') { // Delete comments! - unsigned Idx = label.find('\n', i+1); // Find end of line - label.erase(label.begin()+i, label.begin()+Idx); + label.erase(label.begin()+i, label.end()); --i; } - } else label = ""; - SetText(wxString(label.c_str(), wxConvUTF8)); + SetText(wxS(label)); } //===----------------------------------------------------------------------===// +// FIXME: calling Show() after Hide() does not seem to bring back the display of +// items, so we are disabling them for now, but we'll need to revisit this if +// the refresh rate is too slow. void TVCodeListCtrl::refreshView() { // Hide the list while rewriting it from scratch to speed up rendering - Hide(); + // Hide(); // Clear out the list and then re-add all the items. long index = 0; ClearAll(); for (Items::iterator i = itemList.begin(), e = itemList.end(); i != e; ++i) { - InsertItem(index, (**i).m_text.c_str()); + InsertItem(index, (*i)->GetText()); ItemToIndex[*i] = index; ++index; } - Show(); + // Show(); } template void wipe (T x) { delete x; } Modified: television/trunk/tools/llvm-tv/CodeViewer.h URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/CodeViewer.h?rev=79363&r1=79362&r2=79363&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/CodeViewer.h (original) +++ television/trunk/tools/llvm-tv/CodeViewer.h Tue Aug 18 15:37:25 2009 @@ -7,12 +7,12 @@ #ifndef CODEVIEWER_H #define CODEVIEWER_H +#include "ItemDisplayer.h" #include #include #include #include #include -#include "ItemDisplayer.h" class TVApplication; From brukman+llvm at gmail.com Tue Aug 18 15:40:46 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Tue, 18 Aug 2009 20:40:46 -0000 Subject: [llvm-commits] [TV] r79364 - /television/trunk/tools/llvm-tv/TVFrame.cpp Message-ID: <200908182040.n7IKek5v023303@zion.cs.uiuc.edu> Author: brukman Date: Tue Aug 18 15:40:46 2009 New Revision: 79364 URL: http://llvm.org/viewvc/llvm-project?rev=79364&view=rev Log: * Updated name to show where the acronym "TV" comes from * Updated LLVM website URL Modified: television/trunk/tools/llvm-tv/TVFrame.cpp Modified: television/trunk/tools/llvm-tv/TVFrame.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVFrame.cpp?rev=79364&r1=79363&r2=79364&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/TVFrame.cpp (original) +++ television/trunk/tools/llvm-tv/TVFrame.cpp Tue Aug 18 15:40:46 2009 @@ -201,10 +201,10 @@ /// OnExit - respond to a request to display the About box. /// void TVFrame::OnAbout (wxCommandEvent &event) { - wxMessageBox(wxT("LLVM Visualization Tool\n\n" + wxMessageBox(wxT("LLVM Transformation Visualizer (LLVM-TV)\n\n" "By Misha Brukman, Tanya Brethour, and Brian Gaeke\n" "Copyright (C) 2004 University of Illinois at Urbana-Champaign\n" - "http://llvm.cs.uiuc.edu"), + "http://llvm.org"), wxT("About LLVM-TV")); } From tonic at nondot.org Tue Aug 18 15:48:13 2009 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 18 Aug 2009 15:48:13 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200908182048.n7IKmDen024287@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.7 -> 1.8 --- Log message: Give credit. --- Diffs of the changes: (+2 -1) index.php | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.7 llvm-www/devmtg/2009-10/index.php:1.8 --- llvm-www/devmtg/2009-10/index.php:1.7 Mon Aug 17 17:23:36 2009 +++ llvm-www/devmtg/2009-10/index.php Tue Aug 18 15:47:00 2009 @@ -52,7 +52,8 @@
      Questions?
      -

      If you have any questions, please feel free to contact the LLVM Developers' Meeting organizers.

      +

      If you have any questions, please feel free to contact the LLVM Developers' Meeting organizers. +This year's meeting is being coordinating by Ted Kremenek and Tanya Lattner.

      Registration
      From tonic at nondot.org Tue Aug 18 15:48:45 2009 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 18 Aug 2009 15:48:45 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200908182048.n7IKmjWA024389@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.8 -> 1.9 --- Log message: Typo. --- Diffs of the changes: (+1 -1) index.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.8 llvm-www/devmtg/2009-10/index.php:1.9 --- llvm-www/devmtg/2009-10/index.php:1.8 Tue Aug 18 15:47:00 2009 +++ llvm-www/devmtg/2009-10/index.php Tue Aug 18 15:48:29 2009 @@ -53,7 +53,7 @@
      Questions?

      If you have any questions, please feel free to contact the LLVM Developers' Meeting organizers. -This year's meeting is being coordinating by Ted Kremenek and Tanya Lattner.

      +This year's meeting is being coordinated by Ted Kremenek and Tanya Lattner.

      Registration
      From richard at xmos.com Tue Aug 18 16:14:31 2009 From: richard at xmos.com (Richard Osborne) Date: Tue, 18 Aug 2009 21:14:31 -0000 Subject: [llvm-commits] [llvm] r79368 - in /llvm/trunk: lib/Target/XCore/XCoreTargetObjectFile.cpp test/CodeGen/XCore/constants.ll test/CodeGen/XCore/globals.ll Message-ID: <200908182114.n7ILEVeV027643@zion.cs.uiuc.edu> Author: friedgold Date: Tue Aug 18 16:14:31 2009 New Revision: 79368 URL: http://llvm.org/viewvc/llvm-project?rev=79368&view=rev Log: Add support for mergeable sections back into the XCore backend. Modified: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp llvm/trunk/test/CodeGen/XCore/constants.ll llvm/trunk/test/CodeGen/XCore/globals.ll Modified: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp?rev=79368&r1=79367&r2=79368&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp Tue Aug 18 16:14:31 2009 @@ -28,11 +28,24 @@ MCSectionXCore::SHF_DP_SECTION, SectionKind::getBSS(), false, getContext()); - // For now, disable lowering of mergable sections, just drop everything into - // ReadOnly. - MergeableConst4Section = 0; - MergeableConst8Section = 0; - MergeableConst16Section = 0; + MergeableConst4Section = + MCSectionXCore::Create(".cp.rodata.cst4", MCSectionELF::SHT_PROGBITS, + MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE | + MCSectionXCore::SHF_CP_SECTION, + SectionKind::getMergeableConst4(), false, + getContext()); + MergeableConst8Section = + MCSectionXCore::Create(".cp.rodata.cst8", MCSectionELF::SHT_PROGBITS, + MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE | + MCSectionXCore::SHF_CP_SECTION, + SectionKind::getMergeableConst8(), false, + getContext()); + MergeableConst16Section = + MCSectionXCore::Create(".cp.rodata.cst16", MCSectionELF::SHT_PROGBITS, + MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE | + MCSectionXCore::SHF_CP_SECTION, + SectionKind::getMergeableConst16(), false, + getContext()); // TLS globals are lowered in the backend to arrays indexed by the current // thread id. After lowering they require no special handling by the linker Modified: llvm/trunk/test/CodeGen/XCore/constants.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/constants.ll?rev=79368&r1=79367&r2=79368&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/XCore/constants.ll (original) +++ llvm/trunk/test/CodeGen/XCore/constants.ll Tue Aug 18 16:14:31 2009 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s | llc -march=xcore -mcpu=xs1b-generic | FileCheck %s -; CHECK: .section .cp.rodata,"ac", at progbits +; CHECK: .section .cp.rodata.cst4,"aMc", at progbits,4 ; CHECK: .LCPI1_0: ; CHECK: .long 12345678 ; CHECK: f: Modified: llvm/trunk/test/CodeGen/XCore/globals.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/globals.ll?rev=79368&r1=79367&r2=79368&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/XCore/globals.ll (original) +++ llvm/trunk/test/CodeGen/XCore/globals.ll Tue Aug 18 16:14:31 2009 @@ -68,7 +68,7 @@ ; CHECK: G2: @G3 = constant i32 9401 -; CHECK: .section .cp.rodata,"ac", at progbits +; CHECK: .section .cp.rodata.cst4,"aMc", at progbits,4 ; CHECK: G3: @G4 = global i32* @G1 From stoklund at 2pi.dk Tue Aug 18 16:14:54 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 18 Aug 2009 21:14:54 -0000 Subject: [llvm-commits] [llvm] r79369 - in /llvm/trunk: include/llvm/CodeGen/RegisterScavenging.h lib/CodeGen/RegisterScavenging.cpp lib/Target/ARM/ARMBaseRegisterInfo.cpp lib/Target/ARM/ARMLoadStoreOptimizer.cpp lib/Target/Blackfin/BlackfinRegisterInfo.cpp lib/Target/PowerPC/PPCRegisterInfo.cpp Message-ID: <200908182114.n7ILEtOF027705@zion.cs.uiuc.edu> Author: stoklund Date: Tue Aug 18 16:14:54 2009 New Revision: 79369 URL: http://llvm.org/viewvc/llvm-project?rev=79369&view=rev Log: Simplify RegScavenger::FindUnusedReg. - Drop the Candidates argument and fix all callers. Now that RegScavenger tracks available registers accurately, there is no need to restict the search. - Make sure that no aliases of the found register are in use. This was a potential bug. Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h llvm/trunk/lib/CodeGen/RegisterScavenging.cpp llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp llvm/trunk/lib/Target/Blackfin/BlackfinRegisterInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h?rev=79369&r1=79368&r2=79369&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h (original) +++ llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h Tue Aug 18 16:14:54 2009 @@ -98,15 +98,9 @@ /// getRegsUsed - return all registers currently in use in used. void getRegsUsed(BitVector &used, bool includeReserved); - /// FindUnusedReg - Find a unused register of the specified register class - /// from the specified set of registers. It return 0 is none is found. - unsigned FindUnusedReg(const TargetRegisterClass *RegClass, - const BitVector &Candidates) const; - /// FindUnusedReg - Find a unused register of the specified register class. - /// Exclude callee saved registers if directed. It return 0 is none is found. - unsigned FindUnusedReg(const TargetRegisterClass *RegClass, - bool ExCalleeSaved = false) const; + /// Return 0 if none is found. + unsigned FindUnusedReg(const TargetRegisterClass *RegClass) const; /// setScavengingFrameIndex / getScavengingFrameIndex - accessor and setter of /// ScavengingFrameIndex. Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=79369&r1=79368&r2=79369&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Tue Aug 18 16:14:54 2009 @@ -248,36 +248,12 @@ Mask.set(*I); } -unsigned RegScavenger::FindUnusedReg(const TargetRegisterClass *RegClass, - const BitVector &Candidates) const { - // Mask off the registers which are not in the TargetRegisterClass. - BitVector RegsAvailableCopy(NumPhysRegs, false); - CreateRegClassMask(RegClass, RegsAvailableCopy); - RegsAvailableCopy &= RegsAvailable; - - // Restrict the search to candidates. - RegsAvailableCopy &= Candidates; - - // Returns the first unused (bit is set) register, or 0 is none is found. - int Reg = RegsAvailableCopy.find_first(); - return (Reg == -1) ? 0 : Reg; -} - -unsigned RegScavenger::FindUnusedReg(const TargetRegisterClass *RegClass, - bool ExCalleeSaved) const { - // Mask off the registers which are not in the TargetRegisterClass. - BitVector RegsAvailableCopy(NumPhysRegs, false); - CreateRegClassMask(RegClass, RegsAvailableCopy); - RegsAvailableCopy &= RegsAvailable; - - // If looking for a non-callee-saved register, mask off all the callee-saved - // registers. - if (ExCalleeSaved) - RegsAvailableCopy &= ~CalleeSavedRegs; - - // Returns the first unused (bit is set) register, or 0 is none is found. - int Reg = RegsAvailableCopy.find_first(); - return (Reg == -1) ? 0 : Reg; +unsigned RegScavenger::FindUnusedReg(const TargetRegisterClass *RC) const { + for (TargetRegisterClass::iterator I = RC->begin(), E = RC->end(); + I != E; ++I) + if (!isAliasUsed(*I)) + return *I; + return 0; } /// findSurvivorReg - Return the candidate register that is unused for the Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=79369&r1=79368&r2=79369&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Tue Aug 18 16:14:54 2009 @@ -1006,12 +1006,8 @@ static unsigned findScratchRegister(RegScavenger *RS, const TargetRegisterClass *RC, ARMFunctionInfo *AFI) { - unsigned Reg = RS ? RS->FindUnusedReg(RC, true) : (unsigned) ARM::R12; + unsigned Reg = RS ? RS->FindUnusedReg(RC) : (unsigned) ARM::R12; assert(!AFI->isThumb1OnlyFunction()); - if (Reg == 0) - // Try a already spilled CS register. - Reg = RS->FindUnusedReg(RC, AFI->getSpilledCSRegisters()); - return Reg; } Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=79369&r1=79368&r2=79369&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Tue Aug 18 16:14:54 2009 @@ -941,12 +941,8 @@ // Try to find a free register to use as a new base in case it's needed. // First advance to the instruction just before the start of the chain. AdvanceRS(MBB, MemOps); - // Find a scratch register. Make sure it's a call clobbered register or - // a spilled callee-saved register. - unsigned Scratch = RS->FindUnusedReg(&ARM::GPRRegClass, true); - if (!Scratch) - Scratch = RS->FindUnusedReg(&ARM::GPRRegClass, - AFI->getSpilledCSRegisters()); + // Find a scratch register. + unsigned Scratch = RS->FindUnusedReg(&ARM::GPRRegClass); // Process the load / store instructions. RS->forward(prior(MBBI)); Modified: llvm/trunk/lib/Target/Blackfin/BlackfinRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinRegisterInfo.cpp?rev=79369&r1=79368&r2=79369&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/BlackfinRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Blackfin/BlackfinRegisterInfo.cpp Tue Aug 18 16:14:54 2009 @@ -213,7 +213,7 @@ const TargetRegisterClass *RC, int SPAdj) { assert(RS && "Register scavenging must be on"); - unsigned Reg = RS->FindUnusedReg(RC, true); + unsigned Reg = RS->FindUnusedReg(RC); if (Reg == 0) Reg = RS->scavengeRegister(RC, II, SPAdj); return Reg; Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=79369&r1=79368&r2=79369&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Tue Aug 18 16:14:54 2009 @@ -527,7 +527,7 @@ unsigned findScratchRegister(MachineBasicBlock::iterator II, RegScavenger *RS, const TargetRegisterClass *RC, int SPAdj) { assert(RS && "Register scavenging must be on"); - unsigned Reg = RS->FindUnusedReg(RC, true); + unsigned Reg = RS->FindUnusedReg(RC); // FIXME: move ARM callee-saved reg scan to target independent code, then // search for already spilled CS register here. if (Reg == 0) From stoklund at 2pi.dk Tue Aug 18 16:23:12 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 18 Aug 2009 23:23:12 +0200 Subject: [llvm-commits] [PATCH] Simplify RegScavenger::FindUnusedReg In-Reply-To: <9E88B301-C6D5-4CE2-A40B-47287E773FE2@2pi.dk> References: <9E88B301-C6D5-4CE2-A40B-47287E773FE2@2pi.dk> Message-ID: <3A59390E-CFC3-42BD-B7A4-D6A232CF6A82@2pi.dk> On 17/08/2009, at 20.13, Jakob Stoklund Olesen wrote: > Since I am changing the RegScavenger API just before the upcoming > code freeze, I thought I had better ask for a review before > committing. I had some off-list replies. None were negative, so I have committed here: http://llvm.org/viewvc/llvm-project?rev=79369&view=rev From daniel at zuster.org Tue Aug 18 17:24:01 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 22:24:01 -0000 Subject: [llvm-commits] [llvm] r79375 - /llvm/trunk/lib/Support/raw_ostream.cpp Message-ID: <200908182224.n7IMO1nZ003928@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 17:24:00 2009 New Revision: 79375 URL: http://llvm.org/viewvc/llvm-project?rev=79375&view=rev Log: Speed up raw_ostream::<<(unsigned long long) for 32-bit systems by doing most div/mods in 32-bits. Modified: llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79375&r1=79374&r2=79375&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 18 17:24:00 2009 @@ -125,19 +125,24 @@ } raw_ostream &raw_ostream::operator<<(unsigned long long N) { - // Output using 32-bit div/mod when possible. + // Handle simple case when value fits in long already. if (N == static_cast(N)) return this->operator<<(static_cast(N)); - char NumberBuffer[20]; - char *EndPtr = NumberBuffer+sizeof(NumberBuffer); - char *CurPtr = EndPtr; - - while (N) { - *--CurPtr = '0' + char(N % 10); - N /= 10; - } - return write(CurPtr, EndPtr-CurPtr); + // Otherwise divide into at two or three 10**9 chunks and write out using + // long div/mod, this is substantially faster on a 32-bit system. + unsigned long Top = 0, Mid = 0, Bot = N % 1000000000; + N /= 1000000000; + if (N > 1000000000) { + Mid = N % 1000000000; + Top = N / 1000000000; + } else + Mid = N; + + if (Top) + this->operator<<(static_cast(Top)); + this->operator<<(static_cast(Mid)); + return this->operator<<(static_cast(Bot)); } raw_ostream &raw_ostream::operator<<(long long N) { From tonic at nondot.org Tue Aug 18 17:33:28 2009 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 18 Aug 2009 22:33:28 -0000 Subject: [llvm-commits] [llvm] r79376 - /llvm/trunk/docs/HowToReleaseLLVM.html Message-ID: <200908182233.n7IMXSGj005095@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Aug 18 17:33:28 2009 New Revision: 79376 URL: http://llvm.org/viewvc/llvm-project?rev=79376&view=rev Log: First steps to document new release plan. Modified: llvm/trunk/docs/HowToReleaseLLVM.html Modified: llvm/trunk/docs/HowToReleaseLLVM.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/HowToReleaseLLVM.html?rev=79376&r1=79375&r2=79376&view=diff ============================================================================== --- llvm/trunk/docs/HowToReleaseLLVM.html (original) +++ llvm/trunk/docs/HowToReleaseLLVM.html Tue Aug 18 17:33:28 2009 @@ -10,14 +10,15 @@
      How To Release LLVM To The Public
      1. Introduction
      2. +
      3. Qualification Criteria
      4. Release Timeline
      5. Release Process
      6. -
      7. Distribution Targets
      @@ -26,32 +27,23 @@

      - This document collects information about successfully releasing LLVM to the - public. It is the release manager's guide to ensuring that a high quality + This document collects information about successfully releasing LLVM + (including subprojects llvm-gcc and Clang) to the public. + It is the release manager's responsibility to ensure that a high quality build of LLVM is released.

      - -

      - The following is the basic criteria for releasing LLVM: -

      - -
        -
      1. Successful configure and build.
      2. -
      3. Clean 'make check'.
      4. -
      5. No regressions in the testsuite from the previous release. This may - include performance regressions for major benchmarks.
      6. -
      -The release manager should attempt to have a release every 3-4 months because LLVM -does time based releases (instead of feature based). The release schedule should -be roughly as follows: +

      LLVM is released on a time based schedule (currently every 6 months). We + do not have dot releases because of the nature of LLVM incremental + developement philosophy. The release schedule is roughly as follows: +

        -
      1. Set code freeze and branch creation date for 3 months after last release +
      2. Set code freeze and branch creation date for 6 months after last code freeze date. Announce release schedule to the LLVM community and update the website.
      3. Create release branch and begin release process.
      4. Send out pre-release for first round of testing. Testing will last 7-10 days. @@ -71,44 +63,76 @@ - - - + + +
        +This section describes a few administrative tasks that need to be done for the +release process to begin. Specifically, it involves creating the release branch, + resetting version numbers, and creating the release tarballs for the release + team to begin testing. +
        + + +

        Branch the Subversion HEAD using the following procedure:

        1. -

          Verify that the current Subversion HEAD is in decent shape by examining nightly - tester results.

        2. +

          Verify that the current Subversion HEAD is in decent shape by examining + nightly tester or buildbot results.

        3. Request all developers to refrain from committing. Offenders get commit rights taken away (temporarily).

        4. -

          Create the release branch for llvm, llvm-gcc4.2, and - the test-suite. The branch name will be release_XX, - where XX is the major and minor release numbers. These branches can - be created without checking out anything from subversion. +

          Create the release branch for llvm, llvm-gcc4.2, + clang, and the test-suite. The branch name will be + release_XX,where XX is the major and minor release numbers. + Clang will have a different release number than llvm/ + llvm-gcc4 since its first release was years later + (still deciding if this will be true or not). These branches + can be created without checking out anything from subversion.

          @@ -119,6 +143,8 @@ https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX svn copy https://llvm.org/svn/llvm-project/test-suite/trunk \ https://llvm.org/svn/llvm-project/test-suite/branches/release_XX +svn copy https://llvm.org/svn/llvm-project/cfe/trunk \ + https://llvm.org/svn/llvm-project/cfe/branches/release_XX
          @@ -135,6 +161,7 @@ svn co https://llvm.org/svn/llvm-project/llvm/branches/release_XX svn co https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX svn co https://llvm.org/svn/llvm-project/test-suite/branches/release_XX +svn co https://llvm.org/svn/llvm-project/cfe/branches/release_XX
      5. @@ -142,7 +169,7 @@
      - +

      After creating the LLVM release branch, update the release branches' @@ -150,18 +177,19 @@ as well to be the next version (X.X+1svn). Regenerated the configure script for both. This must be done for both llvm and the test-suite.

      +

      FIXME: Add a note about clang.

      In addition, the version number of all the Bugzilla components must be updated for the next release.

      - +

      - Create source distributions for LLVM, LLVM GCC, and the LLVM Test Suite by - exporting the source from Subversion and archiving it. This can be done with - the following commands: + Create source distributions for LLVM, LLVM GCC, Clang, and the LLVM Test + Suite by exporting the source from Subversion and archiving it. This can be + done with the following commands:

      @@ -169,15 +197,25 @@ svn export https://llvm.org/svn/llvm-project/llvm/branches/release_XX llvm-X.X svn export https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX llvm-gcc4.2-X.X.source svn export https://llvm.org/svn/llvm-project/test-suite/branches/release_XX llvm-test-X.X -tar -cvf - llvm-X.X | gzip > llvm-X.X.tar.gz -tar -cvf - llvm-test-X.X | gzip > llvm-test-X.X.tar.gz -tar -cvf - llvm-gcc4.2-X.X.source | gzip > llvm-gcc-4.2-X.X.source.tar.gz +svn export https://llvm.org/svn/llvm-project/cfe/branches/release_XX clang-X.X +tar -czvf - llvm-X.X | gzip > llvm-X.X.tar.gz +tar -czvf - llvm-test-X.X | gzip > llvm-test-X.X.tar.gz +tar -czvf - llvm-gcc4.2-X.X.source | gzip > llvm-gcc-4.2-X.X.source.tar.gz +tar -czvf - clang-X.X.source | gzip > clang-X.X.source.tar.gz
      - + + +
      +Info about this. Criteria for a successful build. +
      + + +

      Build both debug and release (optimized) versions of LLVM on all @@ -187,7 +225,7 @@

      - +

      Creating the LLVM GCC binary distribution (release/optimized) requires @@ -204,76 +242,81 @@

    1. Copy the installation directory to a directory named for the specific target. For example on Red Hat Enterprise Linux, the directory would be named - llvm-gcc4.0-2.1-x86-linux-RHEL4. Archive and compress the new directory. + llvm-gcc4.2-2.6-x86-linux-RHEL4. Archive and compress the new directory.
    - +

    - Using the newly built llvm-gcc and llvm, reconfigure llvm to locate llvm-gcc. - Run make check and ensure there are no unexpected failures. If there - are, resolve the failures or file a bug. If there is a fix commited to mainline, - merge back into the release branch, and restart testing by - re-building LLVM and llvm-gcc. If no - fix will be made, XFAIL the test and commit back to the release branch. + Creating the Clang binary distribution (release/optimized) requires + performing the following steps for each supported platform:

    +
      +
    1. + Instructions how to build it. +
    2. + +
    3. + Instructions on how to package +
    4. +
    +
    + + + + +

    - Ensure that 'make check' passes on all platforms for all targets. The - test suite must complete with "0 unexpected failures" before sending out the - pre-releases for testing. + Specify what is used to build llvm, llvm-gcc, clang on each target.

    + - + + +
    +How to qualify the release. +
    + + + +

    - Run the llvm-test suite and ensure there are no unacceptable - failures. Unacceptable failures are regression from the previous release - and (optionally) major performance regressions from the previous release. - If a regression is found a bug is filled, but the pre-releases may still go - out.

    + Details

    - +

    - You can, optionally, create source and binary RPM packages for LLVM. These may - make it easier to get LLVM into a distribution. This can be done with the - following commands: -

    + Details.

    +
    -
    -
    -make dist        # Build the distribution source tarball
    -make dist-check  # Check that the source tarball can build itself.
    -cp llvm-M.m.tar.gz /usr/src/redhat/SOURCES  # Required by rpmbuild
    -make srpm # for source rpm
    -make rpm  # for binary rpm
    -
    + + +
    +

    + Details.

    + + +

    - First, use make dist to simply build the distribution. Any failures - need to be corrected (on the branch). Once make dist can be - successful, do make dist-check. This target will do the same thing as - the 'dist' target but also test that distribution to make sure it can build - itself and runs make check as well. This ensures that needed files - are not missing and that the src tarball can be successfully unpacked, built, - installed, and cleaned. Once you have a reliable tarball, you need to copy it - to the /usr/src/redhat/SOURCES directory which is a requirement of - the rpmbuild tool. The last two make invocations just run rpmbuild to - build either a source (srpm) or binary (rpm) RPM package. -

    + Details

    - +

    Once all testing has been completed and appropriate bugs filed, the pre-release @@ -300,9 +343,26 @@ is determined to be ready and the release manager may move onto the next step.

    + + +
    +

    + Details

    +
    + + + + +
    +

    + Details

    +
    + - +

    Tag the release branch using the following procedure:

    @@ -318,7 +378,7 @@
    - +

    Review the documentation and ensure that it is up to date. The Release Notes @@ -340,7 +400,7 @@

    - +

    The website must be updated before the release announcement is sent out. Here is @@ -364,227 +424,12 @@

    - +

    Have Chris send out the release announcement when everything is finished.

    - - - - -
    Overview
    -
    -

    - The first thing you need to understand is that there are multiple make targets - to support this feature. Here's an overview, we'll delve into the details - later. -

    - -
      -
    • distdir - builds the distribution directory from which the - distribution will be packaged
    • -
    • dist - builds each of the distribution tarballs (tar.gz, - tar.bzip2, .zip). These can be built individually as well, with separate - targets.
    • -
    • dist-check - this is identical to dist but includes a - check on the distribution that ensures the tarball can: unpack - successfully, compile correctly, pass 'make check', and pass - 'make clean'.
    • -
    • dist-clean- this just does a normal clean but also cleans up the - stuff generated by the other three dist targets (above).
    • -
    - -

    - Okay, that's the basic functionality. When making a release, we want to ensure - that the tree you build the distribution from passes - dist-check. Beyond fixing the usual bugs, there is generally one - impediment to making the release in this fashion: missing files. The - dist-check process guards against that possibility. It will either - fail and that failure will indicate what's missing, or it will succeed meaning - that it has proved that the tarballs can actually succeed in building LLVM - correctly and that it passes make check. -

    -
    - - - -
    distdir
    -
    -

    - This target builds the distribution directory which is the directory from - which the tarballs are generated. The distribution directory has the same - name as the release, e.g. LLVM-1.7). This target goes through the following - process: -

    - -
      -
    1. First, if there was an old distribution directory (for the current - release), it is removed in its entirety and you see Removing old - LLVM-1.7
    2. -
    3. Second, it issues a make all ENABLE_OPTIMIZED=3D1 to ensure - that the everything in your tree can be built in release mode. Often - times there are discrepancies in building between debug and release - modes so it enforces release mode first. If that fails, the - distdir target fails too. This is preceded by the message - Making 'all' to verify build.
    4. -
    5. Next, it traverses your source tree and copies it to a new directory - that has the name of the release (LLVM-M.m in our current - case). This is the directory that will get tar'd. It contains all the - software that needs to be in the distribution. During the copying - process, it omits generated files, SVN directories, and any other - "cruft" that's in your build tree. This is done to eliminate the - possibility of huge distribution tarballs that include useless or - irrelevant stuff in them. This is the trickiest part of making the - distribution. Done manually you will either include stuff that - shouldn't be in the distribution or exclude stuff that should. This - step is preceded by the message Building Distribution Directory - LLVM-1.7
    6. -
    7. The distribution directory is then traversed and all CVS or - .svn directories are removed. You see: Eliminating CVS/.svn - directories from distribution
    8. -
    9. The recursive dist-hook target is executed. This gives each - directory a chance to modify the distribution in some way (more on this - below).
    10. -
    11. The distribution directory is traversed and the correct file - permissions and modes are set based on the type of file.
    12. -
    - -

    - To control the process of making the distribution directory correctly, each - Makefile can utilize two features: -

    - -
      -
    1. EXTRA_DIST - this make variable specifies which files - it should distribute. By default, all source files are automatically - included for distribution as well as certain well known files - (see DistAlways variable in Makefile.rules for details). Each Makefile - specifies, via the EXTRA_DIST variable, which additional files - need to be distributed. Only those files that are needed to build LLVM - should be added to EXTRA_DIST. EXTRA_DIST contains a - list of file or directory names that should be distributed. For example, - the top level Makefile contains EXTRA_DIST := test llvm.spec - include. This means that in addition to regular things that are - distributed at the top level (CREDITS.txt, LICENSE.txt, etc.) - the distribution should contain the entire test and - include directories as well as the llvm.spec file.
    2. -
    3. dist-hook - this make target can be used to alter the - content of the distribution directory. For example, in the top level - Makefile there is some logic to eliminate files in the include - subtree that are generated by the configure script. These should not be - distributed. Similarly, any dist-hook target found in any - directory can add or remove or modify things just before it gets - packaged. Any transformation is permitted. Generally, not much is - needed.
    4. -
    - -

    - You will see various messages if things go wrong: -

    - -
      -
    1. During the copying process, any files that are missing will be flagged - with: ===== WARNING: Distribution Source 'dir/file' Not Found! - These must be corrected by either adding the file or removing it from - EXTRA_DIST.
    2. -
    3. If you build the distribution with VERBOSE=1, then you might - also see: Skipping non-existent 'dir/file' in certain cases - where it's okay to skip the file.
    4. -
    5. The target can fail if any of the things it does fail. Error messages - should indicate what went wrong.
    6. -
    -
    - - -
    dist
    -
    -

    - This target does exactly what distdir target does, but also includes - assembling the tarballs. There are actually four related targets here: -

    - -
      -
    • dist-gzip: package the gzipped distribution tar - file. The distribution directory is packaged into a single file ending - in .tar.gz which is gzip compressed.
    • -
    • dist-bzip2: package the bzip2 distribution tar file. - The distribution directory is packaged into a single file ending in - .tar.bzip2 which is bzip2 compressed.
    • -
    • dist-zip: package the zip distribution file. The - distribution directory is packaged into a single file ending in - .zip which is zip compressed.
    • -
    • dist: does all three, dist-gzip, dist-bzip2, - dist-zip
    • -
    -
    - - -
    dist-check
    -
    -

    - This target checks the distribution. The basic idea is that it unpacks the - distribution tarball and ensures that it can build. It takes the following - actions: -

    - -
      -
    1. It depends on the dist-gzip target which, if it hasn't already - been built, builds the gzip tar bundle (see dist and distdir - above).
    2. -
    3. removes any pre-existing _distcheckdir at the top level.
    4. -
    5. creates a new _distcheckdir directory at the top level.
    6. -
    7. creates a build subdirectory and an install - subdirectory under _distcheckdir.
    8. -
    9. unzips and untars the release tarball into _distcheckdir, - creating LLVM-1.7 directory (from the tarball).
    10. -
    11. in the build subdirectory, it configures with appropriate options to - build from the unpacked source tarball into the build directory - with installation in the install directory.
    12. -
    13. runs make all
    14. -
    15. runs make check
    16. -
    17. runs make install
    18. -
    19. runs make uninstall
    20. -
    21. runs make dist
    22. -
    23. runs make clean
    24. -
    25. runs make dist-clean
    26. -
    - -

    - If it can pass all that, the distribution will be deemed distribution worth y - and you will see: -

    - -
    ===== LLVM-1.7.tar.gz Ready For Distribution =====
    - -

    - This means the tarball should then be tested on other platforms and have the - nightly test run against it. If those all pass, THEN it is ready for - distribution. -

    - -

    - A note about disk space: using dist-check will easily triple the - amount of disk space your build tree is using. You might want to check - available space before you begin. -

    -
    - - -
    dist-clean
    -
    -

    - In addition to doing a normal clean, this target will clean up the - files and directories created by the distribution targets. In particular the - distribution directory (LLVM-X.X), check directory - (_distcheckdir), and the various tarballs will be removed. You do - this after the release has shipped and you no longer need this stuff in your - build tree. -

    -
    - -
    Hi all, I'd like to add a new option (REQUIRES_FP) in Makefile.rules to disable the fomit-frame-pointer option when building. Here's the patch attached. I need this because vmkit needs to walk the stack of a thread, and functions from llvm may be in it. I don't know what's the policy for the Makefiles in general. Is it OK to apply that change? Thanks, Nicolas -------------- next part -------------- A non-text attachment was scrubbed... Name: fp.patch Type: text/x-patch Size: 559 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090819/057093c9/attachment.bin From echristo at apple.com Tue Aug 18 17:43:36 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 18 Aug 2009 15:43:36 -0700 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <4A8B2CE1.2000105@lip6.fr> References: <4A8B2CE1.2000105@lip6.fr> Message-ID: <9A550CA8-C19F-42F5-8731-9B1A234299CD@apple.com> On Aug 18, 2009, at 3:36 PM, Nicolas Geoffray wrote: > Hi all, > > I'd like to add a new option (REQUIRES_FP) in Makefile.rules to > disable the fomit-frame-pointer option when building. Here's the > patch attached. I need this because vmkit needs to walk the stack of > a thread, and functions from llvm may be in it. > Quick question: As in things that are currently being compiled? Seems a bit odd that it's not executing code that's being walked up but rather the compiler itself. > I don't know what's the policy for the Makefiles in general. Is it > OK to apply that change? Sure if it's really necessary :) -eric From echristo at apple.com Tue Aug 18 17:50:32 2009 From: echristo at apple.com (Eric Christopher) Date: Tue, 18 Aug 2009 22:50:32 -0000 Subject: [llvm-commits] [llvm] r79377 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86ISelLowering.h X86InstrFormats.td X86InstrSSE.td Message-ID: <200908182250.n7IMoX26007247@zion.cs.uiuc.edu> Author: echristo Date: Tue Aug 18 17:50:32 2009 New Revision: 79377 URL: http://llvm.org/viewvc/llvm-project?rev=79377&view=rev Log: Implement sse4.2 string/text processing instructions: Add patterns and instruction encoding information. Add custom lowering to deal with hardwired return register of uncertain type (xmm0). Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrFormats.td llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=79377&r1=79376&r2=79377&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Aug 18 17:50:32 2009 @@ -7596,6 +7596,43 @@ } MachineBasicBlock * +X86TargetLowering::EmitPCMP(MachineInstr *MI, MachineBasicBlock *BB, + unsigned numArgs, bool memArg) const { + + MachineFunction *F = BB->getParent(); + DebugLoc dl = MI->getDebugLoc(); + const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); + + unsigned Opc; + + if (memArg) { + Opc = numArgs == 3 ? + X86::PCMPISTRM128rm : + X86::PCMPESTRM128rm; + } else { + Opc = numArgs == 3 ? + X86::PCMPISTRM128rr : + X86::PCMPESTRM128rr; + } + + MachineInstrBuilder MIB = BuildMI(BB, dl, TII->get(Opc)); + + for (unsigned i = 0; i < numArgs; ++i) { + MachineOperand &Op = MI->getOperand(i+1); + + if (!(Op.isReg() && Op.isImplicit())) + MIB.addOperand(Op); + } + + BuildMI(BB, dl, TII->get(X86::MOVAPSrr), MI->getOperand(0).getReg()) + .addReg(X86::XMM0); + + F->DeleteMachineInstr(MI); + + return BB; +} + +MachineBasicBlock * X86TargetLowering::EmitVAStartSaveXMMRegsWithCustomInserter( MachineInstr *MI, MachineBasicBlock *MBB) const { @@ -7804,6 +7841,17 @@ F->DeleteMachineInstr(MI); // The pseudo instruction is gone now. return BB; } + // String/text processing lowering. + case X86::PCMPISTRM128REG: + return EmitPCMP(MI, BB, 3, false /* in-mem */); + case X86::PCMPISTRM128MEM: + return EmitPCMP(MI, BB, 3, true /* in-mem */); + case X86::PCMPESTRM128REG: + return EmitPCMP(MI, BB, 5, false /* in mem */); + case X86::PCMPESTRM128MEM: + return EmitPCMP(MI, BB, 5, true /* in mem */); + + // Atomic Lowering. case X86::ATOMAND32: return EmitAtomicBitwiseWithCustomInserter(MI, BB, X86::AND32rr, X86::AND32ri, X86::MOV32rm, Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=79377&r1=79376&r2=79377&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Aug 18 17:50:32 2009 @@ -693,6 +693,14 @@ const Value *DstSV, uint64_t DstSVOff, const Value *SrcSV, uint64_t SrcSVOff); + /// Utility function to emit string processing sse4.2 instructions + /// that return in xmm0. + // This takes the instruction to expand, the associated machine basic + // block, the number of args, and whether or not the second arg is + // in memory or not. + MachineBasicBlock *EmitPCMP(MachineInstr *BInstr, MachineBasicBlock *BB, + unsigned argNum, bool inMem) const; + /// Utility function to emit atomic bitwise operations (and, or, xor). // It takes the bitwise instruction to expand, the associated machine basic // block, and the associated X86 opcodes for reg/reg and reg/imm. Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=79377&r1=79376&r2=79377&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Tue Aug 18 17:50:32 2009 @@ -235,6 +235,11 @@ list pattern> : I, TF, Requires<[HasSSE42]>; +// SS42AI = SSE 4.2 instructions with TA prefix +class SS42AI o, Format F, dag outs, dag ins, string asm, + list pattern> + : I, TA, Requires<[HasSSE42]>; + // X86-64 Instruction templates... // @@ -288,4 +293,3 @@ : Ii8, XD, Requires<[HasMMX]>; class MMXIS o, Format F, dag outs, dag ins, string asm, list pattern> : Ii8, XS, Requires<[HasMMX]>; - Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=79377&r1=79376&r2=79377&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Aug 18 17:50:32 2009 @@ -3657,6 +3657,11 @@ "movntdqa\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (int_x86_sse41_movntdqa addr:$src))]>; + +//===----------------------------------------------------------------------===// +// SSE4.2 Instructions +//===----------------------------------------------------------------------===// + /// SS42I_binop_rm_int - Simple SSE 4.2 binary operator let Constraints = "$src1 = $dst" in { multiclass SS42I_binop_rm_int opc, string OpcodeStr, @@ -3739,3 +3744,115 @@ (int_x86_sse42_crc32_64 GR64:$src1, GR64:$src2))]>, OpSize, REX_W; } + +// String/text processing instructions. +let Defs = [EFLAGS], usesCustomDAGSchedInserter = 1 in { +def PCMPISTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), + (ins VR128:$src1, VR128:$src2, i8imm:$src3), + "#PCMPISTRM128rr PSEUDO!", + [(set VR128:$dst, + (int_x86_sse42_pcmpistrm128 VR128:$src1, VR128:$src2, + imm:$src3))]>, OpSize; +def PCMPISTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), + (ins VR128:$src1, i128mem:$src2, i8imm:$src3), + "#PCMPISTRM128rm PSEUDO!", + [(set VR128:$dst, + (int_x86_sse42_pcmpistrm128 VR128:$src1, + (load addr:$src2), + imm:$src3))]>, OpSize; +} + +let Defs = [XMM0, EFLAGS] in { +def PCMPISTRM128rr : SS42AI<0x62, MRMSrcReg, (outs), + (ins VR128:$src1, VR128:$src2, i8imm:$src3), + "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", + []>, OpSize; +def PCMPISTRM128rm : SS42AI<0x62, MRMSrcMem, (outs), + (ins VR128:$src1, i128mem:$src2, i8imm:$src3), + "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", + []>, OpSize; +} + +let Defs = [EFLAGS], Uses = [EAX, EDX], + usesCustomDAGSchedInserter = 1 in { +def PCMPESTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), + (ins VR128:$src1, VR128:$src3, i8imm:$src5), + "#PCMPESTRM128rr PSEUDO!", + [(set VR128:$dst, + (int_x86_sse42_pcmpestrm128 VR128:$src1, EAX, + VR128:$src3, + EDX, imm:$src5))]>, OpSize; +def PCMPESTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), + (ins VR128:$src1, i128mem:$src3, i8imm:$src5), + "#PCMPESTRM128rm PSEUDO!", + [(set VR128:$dst, + (int_x86_sse42_pcmpestrm128 VR128:$src1, EAX, + (load addr:$src3), + EDX, imm:$src5))]>, OpSize; +} + +let Defs = [XMM0, EFLAGS], Uses = [EAX, EDX] in { +def PCMPESTRM128rr : SS42AI<0x62, MRMSrcReg, (outs), + (ins VR128:$src1, VR128:$src3, i8imm:$src5), + "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", + []>, OpSize; +def PCMPESTRM128rm : SS42AI<0x62, MRMSrcMem, (outs), + (ins VR128:$src1, i128mem:$src3, i8imm:$src5), + "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", + []>, OpSize; +} + +let Defs = [ECX, EFLAGS] in { + multiclass SS42AI_pcmpistri { + def rr : SS42AI<0x63, MRMSrcReg, (outs), + (ins VR128:$src1, VR128:$src2, i8imm:$src3), + "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", + [(set ECX, + (IntId128 VR128:$src1, VR128:$src2, imm:$src3)), + (implicit EFLAGS)]>, + OpSize; + def rm : SS42AI<0x63, MRMSrcMem, (outs), + (ins VR128:$src1, i128mem:$src2, i8imm:$src3), + "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", + [(set ECX, + (IntId128 VR128:$src1, (load addr:$src2), imm:$src3)), + (implicit EFLAGS)]>, + OpSize; + } +} + +defm PCMPISTRI : SS42AI_pcmpistri; +defm PCMPISTRIA : SS42AI_pcmpistri; +defm PCMPISTRIC : SS42AI_pcmpistri; +defm PCMPISTRIO : SS42AI_pcmpistri; +defm PCMPISTRIS : SS42AI_pcmpistri; +defm PCMPISTRIZ : SS42AI_pcmpistri; + +let Defs = [ECX, EFLAGS] in { +let Uses = [EAX, EDX] in { + multiclass SS42AI_pcmpestri { + def rr : SS42AI<0x61, MRMSrcReg, (outs), + (ins VR128:$src1, VR128:$src3, i8imm:$src5), + "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", + [(set ECX, + (IntId128 VR128:$src1, EAX, VR128:$src3, EDX, imm:$src5)), + (implicit EFLAGS)]>, + OpSize; + def rm : SS42AI<0x61, MRMSrcMem, (outs), + (ins VR128:$src1, i128mem:$src3, i8imm:$src5), + "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", + [(set ECX, + (IntId128 VR128:$src1, EAX, (load addr:$src3), + EDX, imm:$src5)), + (implicit EFLAGS)]>, + OpSize; + } +} +} + +defm PCMPESTRI : SS42AI_pcmpestri; +defm PCMPESTRIA : SS42AI_pcmpestri; +defm PCMPESTRIC : SS42AI_pcmpestri; +defm PCMPESTRIO : SS42AI_pcmpestri; +defm PCMPESTRIS : SS42AI_pcmpestri; +defm PCMPESTRIZ : SS42AI_pcmpestri; From dalej at apple.com Tue Aug 18 17:56:22 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 18 Aug 2009 15:56:22 -0700 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <4A8B2CE1.2000105@lip6.fr> References: <4A8B2CE1.2000105@lip6.fr> Message-ID: <0E74A844-C83E-48B5-9AC8-204D19231787@apple.com> On Aug 18, 2009, at 3:36 PMPDT, Nicolas Geoffray wrote: > Hi all, > > I'd like to add a new option (REQUIRES_FP) in Makefile.rules to > disable the fomit-frame-pointer option when building. Here's the > patch attached. I need this because vmkit needs to walk the stack of > a thread, and functions from llvm may be in it. I suggest you name it something that doesn't look like Floating Point. > I don't know what's the policy for the Makefiles in general. Is it > OK to apply that change? > > Thanks, > Nicolas > Index: Makefile.rules > =================================================================== > --- Makefile.rules (revision 79109) > +++ Makefile.rules (working copy) > @@ -337,6 +337,12 @@ > CXX.Flags += -fno-exceptions > endif > > +ifdef REQUIRES_FP > + CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) > + C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) > + LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) > +endif > + > # IF REQUIRES_RTTI=1 is specified then don't disable run-time type id > ifndef REQUIRES_RTTI > # CXX.Flags += -fno-rtti > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From lhames at gmail.com Tue Aug 18 18:34:50 2009 From: lhames at gmail.com (Lang Hames) Date: Tue, 18 Aug 2009 23:34:50 -0000 Subject: [llvm-commits] [llvm] r79378 - /llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Message-ID: <200908182334.n7INYoYs012754@zion.cs.uiuc.edu> Author: lhames Date: Tue Aug 18 18:34:50 2009 New Revision: 79378 URL: http://llvm.org/viewvc/llvm-project?rev=79378&view=rev Log: Changes DOUT references in the PBQP allocator to use DEBUG(errs() ...) Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=79378&r1=79377&r2=79378&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Tue Aug 18 18:34:50 2009 @@ -702,7 +702,8 @@ // Get the physical reg, subtracting 1 to account for the spill option. unsigned physReg = allowedSets[node][allocSelection - 1]; - DOUT << "VREG " << virtReg << " -> " << tri->getName(physReg) << "\n"; + DEBUG(errs() << "VREG " << virtReg << " -> " + << tri->getName(physReg) << "\n"); assert(physReg != 0); @@ -724,8 +725,8 @@ lis->addIntervalsForSpills(*spillInterval, spillIs, loopInfo, *vrm); addStackInterval(spillInterval, mri); - DOUT << "VREG " << virtReg << " -> SPILLED (Cost: " - << oldSpillWeight << ", New vregs: "; + DEBUG(errs() << "VREG " << virtReg << " -> SPILLED (Cost: " + << oldSpillWeight << ", New vregs: "); // Copy any newly inserted live intervals into the list of regs to // allocate. @@ -735,12 +736,12 @@ assert(!(*itr)->empty() && "Empty spill range."); - DOUT << (*itr)->reg << " "; + DEBUG(errs() << (*itr)->reg << " "); vregIntervalsToAlloc.insert(*itr); } - DOUT << ")\n"; + DEBUG(errs() << ")\n"); // We need another round if spill intervals were added. anotherRoundNeeded |= !newSpills.empty(); @@ -863,12 +864,7 @@ PBQP::HeuristicSolver solver; problem.assignNodeIDs(); PBQP::Solution solution = solver.solve(problem); -/* - std::cerr << "Solution:\n"; - for (unsigned i = 0; i < solution.numNodes(); ++i) { - std::cerr << " " << i << " -> " << solution.getSelection(i) << "\n"; - } -*/ + pbqpAllocComplete = mapPBQPToRegAlloc(solution); ++round; From daniel at zuster.org Tue Aug 18 18:36:04 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 23:36:04 -0000 Subject: [llvm-commits] [llvm] r79379 - in /llvm/trunk: include/llvm/Support/FormattedStream.h include/llvm/Support/raw_ostream.h lib/Support/FormattedStream.cpp Message-ID: <200908182336.n7INa5Au012909@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 18:36:04 2009 New Revision: 79379 URL: http://llvm.org/viewvc/llvm-project?rev=79379&view=rev Log: raw_ostream: Reduce FormattedStream's reliance on raw_ostream's implementation. - Kill off begin(), end(), and iterator. It isn't clear what these mean. Instead provide getBufferStart(), which can be used with GetNumBytesInBuffer to the same effect. - Update ComputeColumn to take arguments for the buffer to scan, this simplifies the implementation of write_impl substantially. - This should also fix possible problems with the scanning pointer pointing outside of the current raw_ostream buffer. Modified: llvm/trunk/include/llvm/Support/FormattedStream.h llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/FormattedStream.cpp Modified: llvm/trunk/include/llvm/Support/FormattedStream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=79379&r1=79378&r2=79379&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) +++ llvm/trunk/include/llvm/Support/FormattedStream.h Tue Aug 18 18:36:04 2009 @@ -58,7 +58,7 @@ /// Scanned - This points to one past the last character in the /// buffer we've scanned. /// - iterator Scanned; + const char *Scanned; virtual void write_impl(const char *Ptr, size_t Size); @@ -70,10 +70,10 @@ return TheStream->tell() - TheStream->GetNumBytesInBuffer(); } - /// ComputeColumn - Examine the current output and figure out - /// which column we end up in after output. + /// ComputeColumn - Examine the given output buffer and figure out which + /// column we end up in after output. /// - void ComputeColumn(); + void ComputeColumn(const char *Ptr, size_t size); public: /// formatted_raw_ostream - Open the specified file for @@ -92,7 +92,7 @@ } explicit formatted_raw_ostream() : raw_ostream(), TheStream(0), DeleteStream(false), ColumnScanned(0) { - Scanned = begin(); + Scanned = 0; } ~formatted_raw_ostream() { @@ -116,7 +116,7 @@ SetUnbuffered(); TheStream->SetUnbuffered(); - Scanned = begin(); + Scanned = 0; } /// PadToColumn - Align the output to some column number. If the current Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=79379&r1=79378&r2=79379&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Aug 18 18:36:04 2009 @@ -251,9 +251,9 @@ /// been encountered. void error_detected() { Error = true; } - typedef char * iterator; - iterator begin() { return OutBufStart; } - iterator end() { return OutBufCur; } + /// getBufferStart - Return the beginning of the current stream buffer, or 0 + /// if the stream is unbuffered. + const char *getBufferStart() const { return OutBufStart; } //===--------------------------------------------------------------------===// // Private Interface Modified: llvm/trunk/lib/Support/FormattedStream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=79379&r1=79378&r2=79379&view=diff ============================================================================== --- llvm/trunk/lib/Support/FormattedStream.cpp (original) +++ llvm/trunk/lib/Support/FormattedStream.cpp Tue Aug 18 18:36:04 2009 @@ -36,13 +36,20 @@ /// ComputeColumn - Examine the current output and figure out which /// column we end up in after output. -void formatted_raw_ostream::ComputeColumn() { - // The buffer may have been allocated underneath us. - if (Scanned == 0) Scanned = begin(); - // Scan all characters added since our last scan to determine the new column. - ColumnScanned = CountColumns(ColumnScanned, Scanned, end() - Scanned); - // We're now current with everything in the buffer. - Scanned = end(); +void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t Size) { + // If our previous scan pointer is inside the buffer, assume we already + // scanned those bytes. This depends on raw_ostream to not change our buffer + // in unexpected ways. + if (Ptr <= Scanned && Scanned <= Ptr + Size) { + // Scan all characters added since our last scan to determine the new + // column. + ColumnScanned = CountColumns(ColumnScanned, Scanned, + Size - (Scanned - Ptr)); + } else + ColumnScanned = CountColumns(ColumnScanned, Ptr, Size); + + // Update the scanning pointer. + Scanned = Ptr + Size; } /// PadToColumn - Align the output to some column number. @@ -53,7 +60,7 @@ /// void formatted_raw_ostream::PadToColumn(unsigned NewCol) { // Figure out what's in the buffer and add it to the column count. - ComputeColumn(); + ComputeColumn(getBufferStart(), GetNumBytesInBuffer()); // Output spaces until we reach the desired column. unsigned num = NewCol - ColumnScanned; @@ -70,24 +77,14 @@ void formatted_raw_ostream::write_impl(const char *Ptr, size_t Size) { // Figure out what's in the buffer and add it to the column count. - ComputeColumn(); + ComputeColumn(Ptr, Size); // Write the data to the underlying stream (which is unbuffered, so // the data will be immediately written out). TheStream->write(Ptr, Size); - // If this FormattedStream is unbuffered, scan the string that - // was just written to determine the new column. - if (Ptr == begin()) { - // Buffered mode. The buffer is being flushed; reset the scanning - // position to the beginning of the buffer. - assert(Ptr + Size == end() && "Buffer is not being fully flushed!"); - Scanned = begin(); - } else { - // Unbuffered mode. Immediately scan the string that was just - // written to determine the new column. - ColumnScanned = CountColumns(ColumnScanned, Ptr, Size); - } + // Reset the scanning pointer. + Scanned = 0; } /// fouts() - This returns a reference to a formatted_raw_ostream for From gohman at apple.com Tue Aug 18 18:36:17 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 23:36:17 -0000 Subject: [llvm-commits] [llvm] r79380 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/X86/shift-parts.ll Message-ID: <200908182336.n7INaHL3012950@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 18:36:17 2009 New Revision: 79380 URL: http://llvm.org/viewvc/llvm-project?rev=79380&view=rev Log: Legalize the shift amount operand of SRL_PARTS, SHL_PARTS, and SRA_PARTS, as is done for SRL, SHL, and SRA. Added: llvm/trunk/test/CodeGen/X86/shift-parts.ll 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=79380&r1=79379&r2=79380&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Aug 18 18:36:17 2009 @@ -898,6 +898,13 @@ if (!Ops[1].getValueType().isVector()) Ops[1] = LegalizeOp(DAG.getShiftAmountOperand(Ops[1])); break; + case ISD::SRL_PARTS: + case ISD::SRA_PARTS: + case ISD::SHL_PARTS: + // Legalizing shifts/rotates requires adjusting the shift amount + // to the appropriate width. + if (!Ops[2].getValueType().isVector()) + Ops[2] = LegalizeOp(DAG.getShiftAmountOperand(Ops[2])); } Result = DAG.UpdateNodeOperands(Result.getValue(0), Ops.data(), Added: llvm/trunk/test/CodeGen/X86/shift-parts.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/shift-parts.ll?rev=79380&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/shift-parts.ll (added) +++ llvm/trunk/test/CodeGen/X86/shift-parts.ll Tue Aug 18 18:36:17 2009 @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | grep shrdq +; PR4736 + +%0 = type { i32, i8, [35 x i8] } + + at g_144 = external global %0, align 8 ; <%0*> [#uses=1] + +define i32 @int87(i32 %uint64p_8) nounwind { +entry: + %srcval4 = load i320* bitcast (%0* @g_144 to i320*), align 8 ; [#uses=1] + br label %for.cond + +for.cond: ; preds = %for.cond, %entry + %call3.in.in.in.v = select i1 undef, i320 192, i320 128 ; [#uses=1] + %call3.in.in.in = lshr i320 %srcval4, %call3.in.in.in.v ; [#uses=1] + %call3.in = trunc i320 %call3.in.in.in to i32 ; [#uses=1] + %tobool = icmp eq i32 %call3.in, 0 ; [#uses=1] + br i1 %tobool, label %for.cond, label %if.then + +if.then: ; preds = %for.cond + ret i32 1 +} From gohman at apple.com Tue Aug 18 18:39:52 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 23:39:52 -0000 Subject: [llvm-commits] [TV] r79381 - in /television/trunk: lib/Snapshot/FileUtils.cpp tools/llvm-tv/GraphPrinters.cpp Message-ID: <200908182339.n7INdqgG013390@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 18:39:52 2009 New Revision: 79381 URL: http://llvm.org/viewvc/llvm-project?rev=79381&view=rev Log: Add missing #includes. Modified: television/trunk/lib/Snapshot/FileUtils.cpp television/trunk/tools/llvm-tv/GraphPrinters.cpp Modified: television/trunk/lib/Snapshot/FileUtils.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/lib/Snapshot/FileUtils.cpp?rev=79381&r1=79380&r2=79381&view=diff ============================================================================== --- television/trunk/lib/Snapshot/FileUtils.cpp (original) +++ television/trunk/lib/Snapshot/FileUtils.cpp Tue Aug 18 18:39:52 2009 @@ -16,6 +16,7 @@ #include #include #include +#include /// Returns the number of entries in the directory named PATH. /// Modified: television/trunk/tools/llvm-tv/GraphPrinters.cpp URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/GraphPrinters.cpp?rev=79381&r1=79380&r2=79381&view=diff ============================================================================== --- television/trunk/tools/llvm-tv/GraphPrinters.cpp (original) +++ television/trunk/tools/llvm-tv/GraphPrinters.cpp Tue Aug 18 18:39:52 2009 @@ -23,6 +23,7 @@ #include "llvm/Support/GraphWriter.h" #include "llvm/Support/raw_ostream.h" #include +#include using namespace llvm; template From daniel at zuster.org Tue Aug 18 18:42:36 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 23:42:36 -0000 Subject: [llvm-commits] [llvm] r79382 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <200908182342.n7INgacp013763@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 18:42:36 2009 New Revision: 79382 URL: http://llvm.org/viewvc/llvm-project?rev=79382&view=rev Log: raw_ostream: Add the capability for subclasses to manually install an external buffer. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=79382&r1=79381&r2=79382&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Aug 18 18:42:36 2009 @@ -42,12 +42,25 @@ /// need to take the slow path to write a single character. /// /// The buffer is in one of three states: - /// 1. Unbuffered (Unbuffered == true) - /// 1. Uninitialized (Unbuffered == false && OutBufStart == 0). - /// 2. Buffered (Unbuffered == false && OutBufStart != 0 && + /// 1. Unbuffered (BufferMode == Unbuffered) + /// 1. Uninitialized (BufferMode != Unbuffered && OutBufStart == 0). + /// 2. Buffered (BufferMode != Unbuffered && OutBufStart != 0 && /// OutBufEnd - OutBufStart >= 64). + /// + /// If buffered, then the raw_ostream owns the buffer if (BufferMode == + /// InternalBuffer); otherwise the buffer has been set via SetBuffer and is + /// managed by the subclass. + /// + /// If a subclass installs an external buffer using SetBuffer then it can wait + /// for a \see write_impl() call to handle the data which has been put into + /// this buffer. char *OutBufStart, *OutBufEnd, *OutBufCur; - bool Unbuffered; + + enum BufferKind { + Unbuffered = 0, + InternalBuffer, + ExternalBuffer + } BufferMode; /// Error This flag is true if an error of any kind has been detected. /// @@ -68,7 +81,7 @@ }; explicit raw_ostream(bool unbuffered=false) - : Unbuffered(unbuffered), Error(false) { + : BufferMode(unbuffered ? Unbuffered : InternalBuffer), Error(false) { // Start out ready to flush. OutBufStart = OutBufEnd = OutBufCur = 0; } @@ -100,9 +113,12 @@ /// determined buffer size. void SetBuffered(); - /// SetBufferrSize - Set the stream to be buffered, using the + /// SetBufferSize - Set the stream to be buffered, using the /// specified buffer size. - void SetBufferSize(size_t Size); + void SetBufferSize(size_t Size) { + flush(); + SetBufferAndMode(new char[Size], Size, InternalBuffer); + } size_t GetBufferSize() { // If we're supposed to be buffered but haven't actually gotten around @@ -118,7 +134,10 @@ /// unbuffered, the stream will flush after every write. This routine /// will also flush the buffer immediately when the stream is being /// set to unbuffered. - void SetUnbuffered(); + void SetUnbuffered() { + flush(); + SetBufferAndMode(0, 0, Unbuffered); + } size_t GetNumBytesInBuffer() const { return OutBufCur - OutBufStart; @@ -175,7 +194,9 @@ return *this; } - raw_ostream &operator<<(const std::string& Str) { + raw_ostream &operator<<(const std::string &Str) { + // Avoid the fast path, it would only increase code size for a marginal win. + write(Str.data(), Str.length()); return *this; } @@ -232,6 +253,13 @@ /// by subclasses. This writes the \args Size bytes starting at /// \arg Ptr to the underlying stream. /// + /// This function is guaranteed to only be called at a point at which it is + /// safe for the subclass to install a new buffer via SetBuffer. + /// + /// \arg Ptr - The start of the data to be written. For buffered streams this + /// is guaranteed to be the start of the buffer. + /// \arg Size - The number of bytes to be written. + /// /// \invariant { Size > 0 } virtual void write_impl(const char *Ptr, size_t Size) = 0; @@ -243,6 +271,14 @@ virtual uint64_t current_pos() = 0; protected: + /// SetBuffer - Use the provided buffer as the raw_ostream buffer. This is + /// intended for use only by subclasses which can arrange for the output to go + /// directly into the desired output buffer, instead of being copied on each + /// flush. + void SetBuffer(char *BufferStart, size_t Size) { + SetBufferAndMode(BufferStart, Size, ExternalBuffer); + } + /// preferred_buffer_size - Return an efficient buffer size for the /// underlying output mechanism. virtual size_t preferred_buffer_size(); @@ -259,6 +295,9 @@ // Private Interface //===--------------------------------------------------------------------===// private: + /// SetBufferAndMode - Install the given buffer and mode. + void SetBufferAndMode(char *BufferStart, size_t Size, BufferKind Mode); + /// flush_nonempty - Flush the current buffer, which is known to be /// non-empty. This outputs the currently buffered data and resets /// the buffer to empty. @@ -422,7 +461,7 @@ /// counting the bytes currently in the buffer. virtual uint64_t current_pos(); public: - explicit raw_svector_ostream(SmallVectorImpl &O) : OS(O) {} + explicit raw_svector_ostream(SmallVectorImpl &O); ~raw_svector_ostream(); /// tell - Return the current offset with the stream. Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79382&r1=79381&r2=79382&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 18 18:42:36 2009 @@ -52,7 +52,8 @@ assert(OutBufCur == OutBufStart && "raw_ostream destructor called with non-empty buffer!"); - delete [] OutBufStart; + if (BufferMode == InternalBuffer) + delete [] OutBufStart; // If there are any pending errors, report them now. Clients wishing // to avoid llvm_report_error calls should check for errors with @@ -79,24 +80,21 @@ SetUnbuffered(); } -void raw_ostream::SetBufferSize(size_t Size) { - assert(Size >= 64 && - "Buffer size must be somewhat large for invariants to hold"); - flush(); - - delete [] OutBufStart; - OutBufStart = new char[Size]; +void raw_ostream::SetBufferAndMode(char *BufferStart, size_t Size, + BufferKind Mode) { + assert(((Mode == Unbuffered && BufferStart == 0 && Size == 0) || + (Mode != Unbuffered && BufferStart && Size >= 64)) && + "stream must be unbuffered, or have >= 64 bytes of buffer"); + // Make sure the current buffer is free of content (we can't flush here; the + // child buffer management logic will be in write_impl). + assert(GetNumBytesInBuffer() == 0 && "Current buffer is non-empty!"); + + if (BufferMode == InternalBuffer) + delete [] OutBufStart; + OutBufStart = BufferStart; OutBufEnd = OutBufStart+Size; OutBufCur = OutBufStart; - Unbuffered = false; -} - -void raw_ostream::SetUnbuffered() { - flush(); - - delete [] OutBufStart; - OutBufStart = OutBufEnd = OutBufCur = 0; - Unbuffered = true; + BufferMode = Mode; } raw_ostream &raw_ostream::operator<<(unsigned long N) { @@ -180,14 +178,15 @@ void raw_ostream::flush_nonempty() { assert(OutBufCur > OutBufStart && "Invalid call to flush_nonempty."); - write_impl(OutBufStart, OutBufCur - OutBufStart); - OutBufCur = OutBufStart; + size_t Length = OutBufCur - OutBufStart; + OutBufCur = OutBufStart; + write_impl(OutBufStart, Length); } raw_ostream &raw_ostream::write(unsigned char C) { // Group exceptional cases into a single branch. if (OutBufCur >= OutBufEnd) { - if (Unbuffered) { + if (BufferMode == Unbuffered) { write_impl(reinterpret_cast(&C), 1); return *this; } @@ -198,7 +197,7 @@ SetBuffered(); // It's possible for the underlying stream to decline // buffering, so check this condition again. - if (Unbuffered) { + if (BufferMode == Unbuffered) { write_impl(reinterpret_cast(&C), 1); return *this; } @@ -213,7 +212,7 @@ // Group exceptional cases into a single branch. if (BUILTIN_EXPECT(OutBufCur+Size > OutBufEnd, false)) { if (BUILTIN_EXPECT(!OutBufStart, false)) { - if (Unbuffered) { + if (BufferMode == Unbuffered) { write_impl(Ptr, Size); return *this; } @@ -498,6 +497,9 @@ // raw_svector_ostream //===----------------------------------------------------------------------===// +raw_svector_ostream::raw_svector_ostream(SmallVectorImpl &O) : OS(O) { +} + raw_svector_ostream::~raw_svector_ostream() { flush(); } From wendling at apple.com Tue Aug 18 18:45:53 2009 From: wendling at apple.com (Bill Wendling) Date: Tue, 18 Aug 2009 16:45:53 -0700 Subject: [llvm-commits] [llvm] r79380 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/X86/shift-parts.ll In-Reply-To: <200908182336.n7INaHL3012950@zion.cs.uiuc.edu> References: <200908182336.n7INaHL3012950@zion.cs.uiuc.edu> Message-ID: <63777242-0B40-40B0-9EBE-95660919645D@apple.com> On Aug 18, 2009, at 4:36 PM, Dan Gohman wrote: > Author: djg > Date: Tue Aug 18 18:36:17 2009 > New Revision: 79380 > > URL: http://llvm.org/viewvc/llvm-project?rev=79380&view=rev > Log: > Legalize the shift amount operand of SRL_PARTS, SHL_PARTS, and > SRA_PARTS, as is done for SRL, SHL, and SRA. > > Added: > llvm/trunk/test/CodeGen/X86/shift-parts.ll > 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=79380&r1=79379&r2=79380&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Aug 18 > 18:36:17 2009 > @@ -898,6 +898,13 @@ > if (!Ops[1].getValueType().isVector()) > Ops[1] = LegalizeOp(DAG.getShiftAmountOperand(Ops[1])); > break; > + case ISD::SRL_PARTS: > + case ISD::SRA_PARTS: > + case ISD::SHL_PARTS: > + // Legalizing shifts/rotates requires adjusting the shift > amount > + // to the appropriate width. > + if (!Ops[2].getValueType().isVector()) > + Ops[2] = LegalizeOp(DAG.getShiftAmountOperand(Ops[2])); Should there be a "break;" statement here? -bw > } > > Result = DAG.UpdateNodeOperands(Result.getValue(0), Ops.data(), > > Added: llvm/trunk/test/CodeGen/X86/shift-parts.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/shift-parts.ll?rev=79380&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/shift-parts.ll (added) > +++ llvm/trunk/test/CodeGen/X86/shift-parts.ll Tue Aug 18 18:36:17 > 2009 > @@ -0,0 +1,22 @@ > +; RUN: llvm-as < %s | llc -march=x86-64 | grep shrdq > +; PR4736 > + > +%0 = type { i32, i8, [35 x i8] } > + > + at g_144 = external global %0, align 8 ; <%0*> [#uses=1] > + > +define i32 @int87(i32 %uint64p_8) nounwind { > +entry: > + %srcval4 = load i320* bitcast (%0* @g_144 to i320*), align 8 ; > [#uses=1] > + br label %for.cond > + > +for.cond: ; preds = > %for.cond, %entry > + %call3.in.in.in.v = select i1 undef, i320 192, i320 128 ; > [#uses=1] > + %call3.in.in.in = lshr i320 %srcval4, %call3.in.in.in.v ; > [#uses=1] > + %call3.in = trunc i320 %call3.in.in.in to i32 ; [#uses=1] > + %tobool = icmp eq i32 %call3.in, 0 ; [#uses=1] > + br i1 %tobool, label %for.cond, label %if.then > + > +if.then: ; preds = %for.cond > + ret i32 1 > +} > > > _______________________________________________ > 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 Aug 18 18:52:49 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 23:52:49 -0000 Subject: [llvm-commits] [llvm] r79383 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200908182352.n7INqnff015063@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 18:52:48 2009 New Revision: 79383 URL: http://llvm.org/viewvc/llvm-project?rev=79383&view=rev Log: Be tidy and use a break to exit from a switch block rather than just falling through the end. 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=79383&r1=79382&r2=79383&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Aug 18 18:52:48 2009 @@ -905,6 +905,7 @@ // to the appropriate width. if (!Ops[2].getValueType().isVector()) Ops[2] = LegalizeOp(DAG.getShiftAmountOperand(Ops[2])); + break; } Result = DAG.UpdateNodeOperands(Result.getValue(0), Ops.data(), From gohman at apple.com Tue Aug 18 19:11:13 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 00:11:13 -0000 Subject: [llvm-commits] [llvm] r79384 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp lib/Transforms/Scalar/SimplifyLibCalls.cpp test/Transforms/SimplifyLibCalls/weak-symbols.ll Message-ID: <200908190011.n7J0BDEJ017334@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 19:11:12 2009 New Revision: 79384 URL: http://llvm.org/viewvc/llvm-project?rev=79384&view=rev Log: Fix SimplifyLibcalls and ValueTracking to check mayBeOverridden before performing optimizations based on constant string values. Added: llvm/trunk/test/Transforms/SimplifyLibCalls/weak-symbols.ll Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=79384&r1=79383&r2=79384&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Tue Aug 18 19:11:12 2009 @@ -1061,7 +1061,8 @@ // variable that is a constant and is initialized. The referenced constant // initializer is the array that we'll use for optimization. GlobalVariable* GV = dyn_cast(V); - if (!GV || !GV->isConstant() || !GV->hasInitializer()) + if (!GV || !GV->isConstant() || !GV->hasInitializer() || + GV->mayBeOverridden()) return false; Constant *GlobalInit = GV->getInitializer(); Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=79384&r1=79383&r2=79384&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Tue Aug 18 19:11:12 2009 @@ -438,7 +438,8 @@ // variable that is a constant and is initialized. The referenced constant // initializer is the array that we'll use for optimization. GlobalVariable* GV = dyn_cast(GEP->getOperand(0)); - if (!GV || !GV->isConstant() || !GV->hasInitializer()) + if (!GV || !GV->isConstant() || !GV->hasInitializer() || + GV->mayBeOverridden()) return 0; Constant *GlobalInit = GV->getInitializer(); Added: llvm/trunk/test/Transforms/SimplifyLibCalls/weak-symbols.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/weak-symbols.ll?rev=79384&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/weak-symbols.ll (added) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/weak-symbols.ll Tue Aug 18 19:11:12 2009 @@ -0,0 +1,26 @@ +; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | FileCheck %s +; PR4738 + +; SimplifyLibcalls shouldn't assume anything about weak symbols. + + at real_init = weak_odr constant [2 x i8] c"y\00" + at fake_init = weak constant [2 x i8] c"y\00" + at .str = private constant [2 x i8] c"y\00" + +; CHECK: define i32 @foo +; CHECK: call i32 @strcmp +define i32 @foo() nounwind { +entry: + %t0 = call i32 @strcmp(i8* getelementptr inbounds ([2 x i8]* @fake_init, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8]* @.str, i64 0, i64 0)) nounwind readonly + ret i32 %t0 +} + +; CHECK: define i32 @bar +; CHECK: ret i32 0 +define i32 @bar() nounwind { +entry: + %t0 = call i32 @strcmp(i8* getelementptr inbounds ([2 x i8]* @real_init, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8]* @.str, i64 0, i64 0)) nounwind readonly + ret i32 %t0 +} + +declare i32 @strcmp(i8*, i8*) nounwind readonly From daniel at zuster.org Tue Aug 18 19:14:25 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 00:14:25 -0000 Subject: [llvm-commits] [llvm] r79385 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <200908190014.n7J0EPgx017738@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 19:14:25 2009 New Revision: 79385 URL: http://llvm.org/viewvc/llvm-project?rev=79385&view=rev Log: raw_ostream: Remove pointless redefinitions of tell(). - The base class implementation is correct. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=79385&r1=79384&r2=79385&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Aug 18 19:14:25 2009 @@ -355,9 +355,6 @@ /// close - Manually flush the stream and close the file. void close(); - /// tell - Return the current offset with the file. - uint64_t tell() { return pos + GetNumBytesInBuffer(); } - /// seek - Flushes the stream and repositions the underlying file descriptor /// positition to the offset specified from the beginning of the file. uint64_t seek(uint64_t off); @@ -417,9 +414,6 @@ public: raw_os_ostream(std::ostream &O) : OS(O) {} ~raw_os_ostream(); - - /// tell - Return the current offset with the stream. - uint64_t tell(); }; /// raw_string_ostream - A raw_ostream that writes to an std::string. This is a @@ -437,9 +431,6 @@ explicit raw_string_ostream(std::string &O) : OS(O) {} ~raw_string_ostream(); - /// tell - Return the current offset with the stream. - uint64_t tell() { return OS.size() + GetNumBytesInBuffer(); } - /// str - Flushes the stream contents to the target string and returns /// the string's reference. std::string& str() { @@ -463,9 +454,6 @@ public: explicit raw_svector_ostream(SmallVectorImpl &O); ~raw_svector_ostream(); - - /// tell - Return the current offset with the stream. - uint64_t tell(); }; /// raw_null_ostream - A raw_ostream that discards all output. Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79385&r1=79384&r2=79385&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 18 19:14:25 2009 @@ -477,10 +477,6 @@ uint64_t raw_os_ostream::current_pos() { return OS.tellp(); } -uint64_t raw_os_ostream::tell() { - return (uint64_t)OS.tellp() + GetNumBytesInBuffer(); -} - //===----------------------------------------------------------------------===// // raw_string_ostream //===----------------------------------------------------------------------===// @@ -510,10 +506,6 @@ uint64_t raw_svector_ostream::current_pos() { return OS.size(); } -uint64_t raw_svector_ostream::tell() { - return OS.size() + GetNumBytesInBuffer(); -} - //===----------------------------------------------------------------------===// // raw_null_ostream //===----------------------------------------------------------------------===// From daniel at zuster.org Tue Aug 18 19:23:39 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 00:23:39 -0000 Subject: [llvm-commits] [llvm] r79386 - /llvm/trunk/lib/Support/raw_ostream.cpp Message-ID: <200908190023.n7J0NdIQ018910@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Aug 18 19:23:39 2009 New Revision: 79386 URL: http://llvm.org/viewvc/llvm-project?rev=79386&view=rev Log: raw_ostream: Simplify write(unsigned char) to match write(const char*, unsigned). Modified: llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79386&r1=79385&r2=79386&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 18 19:23:39 2009 @@ -185,23 +185,18 @@ raw_ostream &raw_ostream::write(unsigned char C) { // Group exceptional cases into a single branch. - if (OutBufCur >= OutBufEnd) { - if (BufferMode == Unbuffered) { - write_impl(reinterpret_cast(&C), 1); - return *this; - } - - if (OutBufStart) - flush_nonempty(); - else { - SetBuffered(); - // It's possible for the underlying stream to decline - // buffering, so check this condition again. + if (BUILTIN_EXPECT(OutBufCur >= OutBufEnd, false)) { + if (BUILTIN_EXPECT(!OutBufStart, false)) { if (BufferMode == Unbuffered) { write_impl(reinterpret_cast(&C), 1); return *this; } + // Set up a buffer and start over. + SetBuffered(); + return write(C); } + + flush_nonempty(); } *OutBufCur++ = C; @@ -220,6 +215,7 @@ SetBuffered(); return write(Ptr, Size); } + // Write out the data in buffer-sized blocks until the remainder // fits within the buffer. do { @@ -259,12 +255,6 @@ raw_ostream &raw_ostream::operator<<(const format_object_base &Fmt) { // If we have more than a few bytes left in our output buffer, try // formatting directly onto its end. - // - // FIXME: This test is a bit silly, since if we don't have enough - // space in the buffer we will have to flush the formatted output - // anyway. We should just flush upfront in such cases, and use the - // whole buffer as our scratch pad. Note, however, that this case is - // also necessary for correctness on unbuffered streams. size_t NextBufferSize = 127; if (OutBufEnd-OutBufCur > 3) { size_t BufferBytesLeft = OutBufEnd-OutBufCur; From resistor at mac.com Tue Aug 18 19:37:02 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 19 Aug 2009 00:37:02 -0000 Subject: [llvm-commits] [llvm] r79387 - in /llvm/trunk: include/llvm/Support/LeakDetector.h lib/VMCore/LLVMContextImpl.h lib/VMCore/LeakDetector.cpp Message-ID: <200908190037.n7J0b2TF020657@zion.cs.uiuc.edu> Author: resistor Date: Tue Aug 18 19:37:02 2009 New Revision: 79387 URL: http://llvm.org/viewvc/llvm-project?rev=79387&view=rev Log: Privatize part of the leak detector mechanism, which turned out to be heavily contended when trying to run opt in parallel. This lets parallel opt crunch 403.gcc in about a third of the time. Modified: llvm/trunk/include/llvm/Support/LeakDetector.h llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/LeakDetector.cpp Modified: llvm/trunk/include/llvm/Support/LeakDetector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/LeakDetector.h?rev=79387&r1=79386&r2=79387&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/LeakDetector.h (original) +++ llvm/trunk/include/llvm/Support/LeakDetector.h Tue Aug 18 19:37:02 2009 @@ -56,9 +56,9 @@ /// The specified message will be printed indicating when the check was /// performed. /// - static void checkForGarbage(const std::string &Message) { + static void checkForGarbage(LLVMContext &C, const std::string &Message) { #ifndef NDEBUG - checkForGarbageImpl(Message); + checkForGarbageImpl(C, Message); #endif } @@ -83,7 +83,7 @@ static void removeGarbageObjectImpl(const Value *Object); static void addGarbageObjectImpl(void *Object); static void removeGarbageObjectImpl(void *Object); - static void checkForGarbageImpl(const std::string &Message); + static void checkForGarbageImpl(LLVMContext &C, const std::string &Message); }; } // End llvm namespace Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=79387&r1=79386&r2=79387&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Tue Aug 18 19:37:02 2009 @@ -16,6 +16,7 @@ #define LLVM_LLVMCONTEXT_IMPL_H #include "ConstantsContext.h" +#include "LeaksContext.h" #include "TypesContext.h" #include "llvm/LLVMContext.h" #include "llvm/Constants.h" @@ -134,6 +135,10 @@ ConstantInt *TheTrueVal; ConstantInt *TheFalseVal; + // Lock used for guarding access to the leak detector + sys::SmartMutex LLVMObjectsLock; + LeakDetectorImpl LLVMObjects; + // Lock used for guarding access to the type maps. sys::SmartMutex TypeMapLock; Modified: llvm/trunk/lib/VMCore/LeakDetector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LeakDetector.cpp?rev=79387&r1=79386&r2=79387&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LeakDetector.cpp (original) +++ llvm/trunk/lib/VMCore/LeakDetector.cpp Tue Aug 18 19:37:02 2009 @@ -11,129 +11,63 @@ // //===----------------------------------------------------------------------===// +#include "LLVMContextImpl.h" #include "llvm/Support/LeakDetector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Streams.h" -#include "llvm/System/RWMutex.h" +#include "llvm/System/Mutex.h" #include "llvm/System/Threading.h" #include "llvm/Value.h" using namespace llvm; -namespace { - template - struct VISIBILITY_HIDDEN PrinterTrait { - static void print(const T* P) { cerr << P; } - }; - - template<> - struct VISIBILITY_HIDDEN PrinterTrait { - static void print(const Value* P) { cerr << *P; } - }; - - ManagedStatic > LeakDetectorLock; - - template - struct VISIBILITY_HIDDEN LeakDetectorImpl { - explicit LeakDetectorImpl(const char* const name = "") : - Cache(0), Name(name) { } - - void clear() { - Cache = 0; - Ts.clear(); - } - - void setName(const char* n) { - Name = n; - } - - // Because the most common usage pattern, by far, is to add a - // garbage object, then remove it immediately, we optimize this - // case. When an object is added, it is not added to the set - // immediately, it is added to the CachedValue Value. If it is - // immediately removed, no set search need be performed. - void addGarbage(const T* o) { - sys::SmartScopedWriter Writer(*LeakDetectorLock); - if (Cache) { - assert(Ts.count(Cache) == 0 && "Object already in set!"); - Ts.insert(Cache); - } - Cache = o; - } - - void removeGarbage(const T* o) { - sys::SmartScopedWriter Writer(*LeakDetectorLock); - if (o == Cache) - Cache = 0; // Cache hit - else - Ts.erase(o); - } - - bool hasGarbage(const std::string& Message) { - addGarbage(0); // Flush the Cache - - sys::SmartScopedReader Reader(*LeakDetectorLock); - assert(Cache == 0 && "No value should be cached anymore!"); - - if (!Ts.empty()) { - cerr << "Leaked " << Name << " objects found: " << Message << ":\n"; - for (typename SmallPtrSet::iterator I = Ts.begin(), - E = Ts.end(); I != E; ++I) { - cerr << "\t"; - PrinterTrait::print(*I); - cerr << "\n"; - } - cerr << '\n'; - - return true; - } - - return false; - } - - private: - SmallPtrSet Ts; - const T* Cache; - const char* Name; - }; - - static ManagedStatic > Objects; - static ManagedStatic > LLVMObjects; - - static void clearGarbage() { - Objects->clear(); - LLVMObjects->clear(); - } +static ManagedStatic > ObjectsLock; +static ManagedStatic > Objects; + +static void clearGarbage(LLVMContext &Context) { + Objects->clear(); + Context.pImpl->LLVMObjects.clear(); } void LeakDetector::addGarbageObjectImpl(void *Object) { + sys::SmartScopedLock Lock(*ObjectsLock); Objects->addGarbage(Object); } void LeakDetector::addGarbageObjectImpl(const Value *Object) { - LLVMObjects->addGarbage(Object); + LLVMContextImpl *pImpl = Object->getContext().pImpl; + sys::SmartScopedLock Lock(pImpl->LLVMObjectsLock); + pImpl->LLVMObjects.addGarbage(Object); } void LeakDetector::removeGarbageObjectImpl(void *Object) { + sys::SmartScopedLock Lock(*ObjectsLock); Objects->removeGarbage(Object); } void LeakDetector::removeGarbageObjectImpl(const Value *Object) { - LLVMObjects->removeGarbage(Object); + LLVMContextImpl *pImpl = Object->getContext().pImpl; + sys::SmartScopedLock Lock(pImpl->LLVMObjectsLock); + pImpl->LLVMObjects.removeGarbage(Object); } -void LeakDetector::checkForGarbageImpl(const std::string &Message) { +void LeakDetector::checkForGarbageImpl(LLVMContext &Context, + const std::string &Message) { + LLVMContextImpl *pImpl = Context.pImpl; + sys::SmartScopedLock Lock(*ObjectsLock); + sys::SmartScopedLock CLock(pImpl->LLVMObjectsLock); + Objects->setName("GENERIC"); - LLVMObjects->setName("LLVM"); + pImpl->LLVMObjects.setName("LLVM"); // use non-short-circuit version so that both checks are performed if (Objects->hasGarbage(Message) | - LLVMObjects->hasGarbage(Message)) + pImpl->LLVMObjects.hasGarbage(Message)) cerr << "\nThis is probably because you removed an object, but didn't " << "delete it. Please check your code for memory leaks.\n"; // Clear out results so we don't get duplicate warnings on // next call... - clearGarbage(); + clearGarbage(Context); } From resistor at mac.com Tue Aug 18 19:52:13 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 19 Aug 2009 00:52:13 -0000 Subject: [llvm-commits] [llvm] r79388 - in /llvm/trunk: include/llvm/Support/LeakDetector.h lib/VMCore/LLVMContextImpl.h lib/VMCore/LeakDetector.cpp Message-ID: <200908190052.n7J0qDIt022546@zion.cs.uiuc.edu> Author: resistor Date: Tue Aug 18 19:52:13 2009 New Revision: 79388 URL: http://llvm.org/viewvc/llvm-project?rev=79388&view=rev Log: Revert my last patch temporarily. Modified: llvm/trunk/include/llvm/Support/LeakDetector.h llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/LeakDetector.cpp Modified: llvm/trunk/include/llvm/Support/LeakDetector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/LeakDetector.h?rev=79388&r1=79387&r2=79388&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/LeakDetector.h (original) +++ llvm/trunk/include/llvm/Support/LeakDetector.h Tue Aug 18 19:52:13 2009 @@ -56,9 +56,9 @@ /// The specified message will be printed indicating when the check was /// performed. /// - static void checkForGarbage(LLVMContext &C, const std::string &Message) { + static void checkForGarbage(const std::string &Message) { #ifndef NDEBUG - checkForGarbageImpl(C, Message); + checkForGarbageImpl(Message); #endif } @@ -83,7 +83,7 @@ static void removeGarbageObjectImpl(const Value *Object); static void addGarbageObjectImpl(void *Object); static void removeGarbageObjectImpl(void *Object); - static void checkForGarbageImpl(LLVMContext &C, const std::string &Message); + static void checkForGarbageImpl(const std::string &Message); }; } // End llvm namespace Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=79388&r1=79387&r2=79388&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Tue Aug 18 19:52:13 2009 @@ -16,7 +16,6 @@ #define LLVM_LLVMCONTEXT_IMPL_H #include "ConstantsContext.h" -#include "LeaksContext.h" #include "TypesContext.h" #include "llvm/LLVMContext.h" #include "llvm/Constants.h" @@ -135,10 +134,6 @@ ConstantInt *TheTrueVal; ConstantInt *TheFalseVal; - // Lock used for guarding access to the leak detector - sys::SmartMutex LLVMObjectsLock; - LeakDetectorImpl LLVMObjects; - // Lock used for guarding access to the type maps. sys::SmartMutex TypeMapLock; Modified: llvm/trunk/lib/VMCore/LeakDetector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LeakDetector.cpp?rev=79388&r1=79387&r2=79388&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LeakDetector.cpp (original) +++ llvm/trunk/lib/VMCore/LeakDetector.cpp Tue Aug 18 19:52:13 2009 @@ -11,63 +11,129 @@ // //===----------------------------------------------------------------------===// -#include "LLVMContextImpl.h" #include "llvm/Support/LeakDetector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Streams.h" -#include "llvm/System/Mutex.h" +#include "llvm/System/RWMutex.h" #include "llvm/System/Threading.h" #include "llvm/Value.h" using namespace llvm; -static ManagedStatic > ObjectsLock; -static ManagedStatic > Objects; - -static void clearGarbage(LLVMContext &Context) { - Objects->clear(); - Context.pImpl->LLVMObjects.clear(); +namespace { + template + struct VISIBILITY_HIDDEN PrinterTrait { + static void print(const T* P) { cerr << P; } + }; + + template<> + struct VISIBILITY_HIDDEN PrinterTrait { + static void print(const Value* P) { cerr << *P; } + }; + + ManagedStatic > LeakDetectorLock; + + template + struct VISIBILITY_HIDDEN LeakDetectorImpl { + explicit LeakDetectorImpl(const char* const name = "") : + Cache(0), Name(name) { } + + void clear() { + Cache = 0; + Ts.clear(); + } + + void setName(const char* n) { + Name = n; + } + + // Because the most common usage pattern, by far, is to add a + // garbage object, then remove it immediately, we optimize this + // case. When an object is added, it is not added to the set + // immediately, it is added to the CachedValue Value. If it is + // immediately removed, no set search need be performed. + void addGarbage(const T* o) { + sys::SmartScopedWriter Writer(*LeakDetectorLock); + if (Cache) { + assert(Ts.count(Cache) == 0 && "Object already in set!"); + Ts.insert(Cache); + } + Cache = o; + } + + void removeGarbage(const T* o) { + sys::SmartScopedWriter Writer(*LeakDetectorLock); + if (o == Cache) + Cache = 0; // Cache hit + else + Ts.erase(o); + } + + bool hasGarbage(const std::string& Message) { + addGarbage(0); // Flush the Cache + + sys::SmartScopedReader Reader(*LeakDetectorLock); + assert(Cache == 0 && "No value should be cached anymore!"); + + if (!Ts.empty()) { + cerr << "Leaked " << Name << " objects found: " << Message << ":\n"; + for (typename SmallPtrSet::iterator I = Ts.begin(), + E = Ts.end(); I != E; ++I) { + cerr << "\t"; + PrinterTrait::print(*I); + cerr << "\n"; + } + cerr << '\n'; + + return true; + } + + return false; + } + + private: + SmallPtrSet Ts; + const T* Cache; + const char* Name; + }; + + static ManagedStatic > Objects; + static ManagedStatic > LLVMObjects; + + static void clearGarbage() { + Objects->clear(); + LLVMObjects->clear(); + } } void LeakDetector::addGarbageObjectImpl(void *Object) { - sys::SmartScopedLock Lock(*ObjectsLock); Objects->addGarbage(Object); } void LeakDetector::addGarbageObjectImpl(const Value *Object) { - LLVMContextImpl *pImpl = Object->getContext().pImpl; - sys::SmartScopedLock Lock(pImpl->LLVMObjectsLock); - pImpl->LLVMObjects.addGarbage(Object); + LLVMObjects->addGarbage(Object); } void LeakDetector::removeGarbageObjectImpl(void *Object) { - sys::SmartScopedLock Lock(*ObjectsLock); Objects->removeGarbage(Object); } void LeakDetector::removeGarbageObjectImpl(const Value *Object) { - LLVMContextImpl *pImpl = Object->getContext().pImpl; - sys::SmartScopedLock Lock(pImpl->LLVMObjectsLock); - pImpl->LLVMObjects.removeGarbage(Object); + LLVMObjects->removeGarbage(Object); } -void LeakDetector::checkForGarbageImpl(LLVMContext &Context, - const std::string &Message) { - LLVMContextImpl *pImpl = Context.pImpl; - sys::SmartScopedLock Lock(*ObjectsLock); - sys::SmartScopedLock CLock(pImpl->LLVMObjectsLock); - +void LeakDetector::checkForGarbageImpl(const std::string &Message) { Objects->setName("GENERIC"); - pImpl->LLVMObjects.setName("LLVM"); + LLVMObjects->setName("LLVM"); // use non-short-circuit version so that both checks are performed if (Objects->hasGarbage(Message) | - pImpl->LLVMObjects.hasGarbage(Message)) + LLVMObjects->hasGarbage(Message)) cerr << "\nThis is probably because you removed an object, but didn't " << "delete it. Please check your code for memory leaks.\n"; // Clear out results so we don't get duplicate warnings on // next call... - clearGarbage(Context); + clearGarbage(); } From gohman at apple.com Tue Aug 18 20:12:11 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 01:12:11 -0000 Subject: [llvm-commits] [test-suite] r79389 - /test-suite/trunk/External/SPEC/Makefile.spec Message-ID: <200908190112.n7J1CBtW025071@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 18 20:12:11 2009 New Revision: 79389 URL: http://llvm.org/viewvc/llvm-project?rev=79389&view=rev Log: Use bugpoint -std-compile-opts instead of the opt-pass-args trick. Modified: test-suite/trunk/External/SPEC/Makefile.spec Modified: test-suite/trunk/External/SPEC/Makefile.spec URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/Makefile.spec?rev=79389&r1=79388&r2=79389&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/Makefile.spec (original) +++ test-suite/trunk/External/SPEC/Makefile.spec Tue Aug 18 20:12:11 2009 @@ -119,17 +119,17 @@ # Rules to bugpoint the opt, llvm-ld, llc, or lli commands... $(PROGRAMS_TO_TEST:%=Output/%.bugpoint-opt): \ Output/%.bugpoint-opt: Output/%.noopt-llvm.bc $(LBUGPOINT) \ - Output/opt-pass-args Output/%.out-nat + Output/%.out-nat $(SPEC_SANDBOX) bugpoint-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - PWD=$(CURDIR) $(LBUGPOINT) -llc-safe ../$*.noopt-llvm.bc `cat Output/opt-pass-args` $(OPTPASSES) \ + PWD=$(CURDIR) $(LBUGPOINT) -llc-safe ../$*.noopt-llvm.bc -std-compile-opts $(OPTPASSES) \ $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS) @echo "===> Leaving Output/bugpoint-$(RUN_TYPE)" $(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llvm-ld): \ Output/%.bugpoint-llvm-ld: Output/%.nollvm-ldopt-llvm.bc $(LBUGPOINT) \ - Output/llvm-ld-pass-args Output/%.out-nat + Output/%.out-nat $(SPEC_SANDBOX) bugpoint-$(RUN_TYPE) $@ $(REF_IN_DIR) \ - PWD=$(CURDIR) $(LBUGPOINT) -llc-safe ../$*.nollvm-ldopt-llvm.bc `cat Output/llvm-ld-pass-args` $(OPTPASSES) \ + PWD=$(CURDIR) $(LBUGPOINT) -llc-safe ../$*.nollvm-ldopt-llvm.bc -std-link-opts $(OPTPASSES) \ $(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS) @echo "===> Leaving Output/bugpoint-$(RUN_TYPE)" From lhames at gmail.com Tue Aug 18 20:36:14 2009 From: lhames at gmail.com (Lang Hames) Date: Wed, 19 Aug 2009 01:36:14 -0000 Subject: [llvm-commits] [llvm] r79397 - /llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Message-ID: <200908190136.n7J1aEoU028285@zion.cs.uiuc.edu> Author: lhames Date: Tue Aug 18 20:36:14 2009 New Revision: 79397 URL: http://llvm.org/viewvc/llvm-project?rev=79397&view=rev Log: Added an option to have the PBQP allocator attempt coalescing during allocation. Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=79397&r1=79396&r2=79397&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Tue Aug 18 20:36:14 2009 @@ -59,6 +59,11 @@ registerPBQPRepAlloc("pbqp", "PBQP register allocator.", llvm::createPBQPRegisterAllocator); +static cl::opt +pbqpCoalescing("pbqp-coalescing", + cl::desc("Attempt coalescing during PBQP register allocation."), + cl::init(false), cl::Hidden); + namespace { /// @@ -537,7 +542,11 @@ } // Get the set of potential coalesces. - CoalesceMap coalesces;//(findCoalesces()); + CoalesceMap coalesces; + + if (pbqpCoalescing) { + coalesces = findCoalesces(); + } // Construct a PBQP solver for this problem PBQP::SimpleGraph problem; From isanbard at gmail.com Tue Aug 18 20:39:08 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 19 Aug 2009 01:39:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79398 - /llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm Message-ID: <200908190139.n7J1d86t028642@zion.cs.uiuc.edu> Author: void Date: Tue Aug 18 20:39:08 2009 New Revision: 79398 URL: http://llvm.org/viewvc/llvm-project?rev=79398&view=rev Log: Fix type-o noticed by Timm Hannon! Modified: llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm Modified: llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm?rev=79398&r1=79397&r2=79398&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm Tue Aug 18 20:39:08 2009 @@ -187,7 +187,7 @@ ldr lr, [sp], #8 ; \ bx lr /* APPLE LOCAL begin v7 support. Merge from mainline */ -#if definded (__thumb2__) +#if defined (__thumb2__) #define RETLDM1(...) \ pop {__VA_ARGS__, lr} ; \ bx lr From gohman at apple.com Tue Aug 18 20:48:48 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 18 Aug 2009 18:48:48 -0700 Subject: [llvm-commits] [llvm] r77460 - /llvm/trunk/docs/LangRef.html In-Reply-To: <4A8AFC4B.5000502@gmail.com> References: <200907291600.n6TG0Wo6030195@zion.cs.uiuc.edu> <4A8AE71D.3040400@free.fr> <4A8AFC4B.5000502@gmail.com> Message-ID: On Aug 18, 2009, at 12:08 PM, T?r?k Edwin wrote: > On 2009-08-18 21:07, Dan Gohman wrote: > >> On Aug 18, 2009, at 10:38 AM, Duncan Sands wrote: >> >> >> >> >> >> >> >>> Hi Dan, >>> >>> >>> >>> >>> >>> >>> >>>> Add one-past-the-end language to the inbounds keyword. >>>> >>>> >>>> >>>> >>>> >>> is this useful for LLVM? Also, I hear that C has a rule like this >>> >>> for arrays, however I think in that case the address of the array >>> >>> element one off the end is valid, but that may in fact be many >>> >>> bytes off the end if the array element is large. It's not clear >>> >>> from your wording whether you mean one byte off the end is ok, >>> >>> or something closer to C. >>> >>> >>> >> >> >> The one-past-the-end rule is entirely motivated by the need to >> >> support C, and programming models that lower to C-like semantics. >> >> From my reading of the standard, only one byte of address space >> >> is required to satisfy C's one-past-the-end rule. >> >> >> >> If I've misinterpreted the standard, or if there are programming >> >> models which require more than one byte and which could be >> >> accommodated by a reasonable change, I'm interested in hearing >> >> about it. >> >> >> > > There are programs which read 2 bytes for 2-byte aligned addresses, > 4-bytes for 4-byte aligned, etc. and rely on the fact > that even though it reads uninitialized bytes, the memory is still > valid > (since memory is allocated in pages). > I think this is why valgrind has the '--partial-loads-ok=yes' flag. > > Such code doesn't conform to the C standard strictly, however I > remember > doing that some glibc version used it in strcmp & friends, at least on > x86-32 (not sure if it was in assembly code or C code, but it wouldn't > surprise me if it were C code). > > I think allowing to read at least min(AlignOf(ptr),16)-1 at the end of > an array/string is reasonable. > Actually the computer pointer's start address is inbounds according to > your rules, but the load/store itself is not. > So how about allowing to read at most 16 bytes whenever the start > address is inbounds? This is an interesting problem, though it happens to be outside the scope of the inbounds keyword. The inbounds keyword just says that the address itself (as well as any implicit intermediate addresses) will stay within the range of the object plus one byte past the end. It doesn't say anything about what can be done with such a pointer value. Perhaps the problem can be solved by adding some wiggle room to the definitions of alloca and malloc, so say that they may allocate a target-dependent amount of additional space beyond what is requested. Dan From idadesub at users.sourceforge.net Tue Aug 18 21:53:07 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Wed, 19 Aug 2009 02:53:07 -0000 Subject: [llvm-commits] [llvm] r79401 - /llvm/trunk/include/llvm/CodeGen/ValueTypes.h Message-ID: <200908190253.n7J2r7Q9005307@zion.cs.uiuc.edu> Author: erickt Date: Tue Aug 18 21:53:07 2009 New Revision: 79401 URL: http://llvm.org/viewvc/llvm-project?rev=79401&view=rev Log: Fix gcc-4.4/fedora 11 by adding a sentinel value to SimpleValueType. gcc-4.4 was optimizing away comparisons against SimpleValueType when it was compared to a value larger than the largest value in the enum. This patch works around it by adding one extra item to the enum so that these tests will now be valid. Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=79401&r1=79400&r2=79401&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original) +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Tue Aug 18 21:53:07 2009 @@ -111,7 +111,12 @@ iPTR = 255, // LastSimpleValueType - The greatest valid SimpleValueType value. - LastSimpleValueType = 255 + LastSimpleValueType = 255, + + // FirstExtendedValueType - This sentinel is needed so that gcc 4.4 won't + // optimize away checks of a SimpleValueType compared to + // LastSimpleValueType+1. + FirstExtendedValueType = 256 }; SimpleValueType SimpleTy; From daniel at zuster.org Wed Aug 19 00:08:06 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 05:08:06 -0000 Subject: [llvm-commits] [llvm] r79403 - /llvm/trunk/lib/VMCore/Value.cpp Message-ID: <200908190508.n7J586Zs021762@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 00:08:06 2009 New Revision: 79403 URL: http://llvm.org/viewvc/llvm-project?rev=79403&view=rev Log: Make a SmallVector size more reasonable. Modified: llvm/trunk/lib/VMCore/Value.cpp Modified: llvm/trunk/lib/VMCore/Value.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=79403&r1=79402&r2=79403&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Value.cpp (original) +++ llvm/trunk/lib/VMCore/Value.cpp Wed Aug 19 00:08:06 2009 @@ -171,7 +171,7 @@ } void Value::setName(const Twine &NewName) { - SmallString<32> NameData; + SmallString<256> NameData; NewName.toVector(NameData); const char *NameStr = NameData.data(); From daniel at zuster.org Wed Aug 19 00:27:27 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 22:27:27 -0700 Subject: [llvm-commits] PATCH: Add raw_svector_ostream direct vector output Message-ID: <6a8523d60908182227x5bb096e7j5300ee3b54322ece@mail.gmail.com> Hi all, The attached patch changes raw_svector_ostream to use the vector buffer itself as the raw_ostream buffer. This is nice for a couple reasons: 1. It avoids the malloc/free of the raw_ostream buffer. This makes it very lightweight to use a raw_svector_ostream for simple string concatenation (e.g., the Twine::str method). 2. It avoids unnecessary copying of the data from the raw_ostream buffer to the vector buffer. I'm proposing as a patch because it has two downsides: 1. It exposes some bits of SmallVector; namely it adds a capacity() method, which gives the allocated size of the current buffer, and a set_size() method, which clients can use to forcibly set the vector size (without doing any construction or destruction). The use case is basically that clients will intentionally write past the end() of the vector (but not past the capacity() of the buffer), and then at some point call set_size() to update the vector size. 2. It forces clients of raw_svector_ostream to provide a SmallVector with at least 128 bytes free. This is probably a good thing, but it isn't enforced by the API (it is enforced by a runtime check, of course). Any objections? - Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: raw_svector_ostream.patch Type: application/octet-stream Size: 4222 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090818/20d95294/attachment.obj From sabre at nondot.org Wed Aug 19 00:49:37 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 19 Aug 2009 05:49:37 -0000 Subject: [llvm-commits] [llvm] r79405 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/ lib/Target/Blackfin/AsmPrinter/ lib/Target/CellSPU/AsmPrinter/ lib/Target/MSP430/AsmPrinter/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/AsmPrinter/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/AsmPrinter/ lib/Target/SystemZ/AsmPrinter/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/AsmPrinter/ Message-ID: <200908190549.n7J5ncdk027085@zion.cs.uiuc.edu> Author: lattner Date: Wed Aug 19 00:49:37 2009 New Revision: 79405 URL: http://llvm.org/viewvc/llvm-project?rev=79405&view=rev Log: eliminate AsmPrinter::SwitchToSection and just have clients talk to the MCStreamer directly instead. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Wed Aug 19 00:49:37 2009 @@ -158,10 +158,6 @@ /// bool isVerbose() const { return VerboseAsm; } - /// SwitchToSection - Switch to the specified section of the executable if - /// we are not already in it! - void SwitchToSection(const MCSection *NS); - /// getGlobalLinkName - Returns the asm/link name of of the specified /// global variable. Should be overridden by each target asm printer to /// generate the appropriate value. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -80,13 +80,6 @@ return TM.getTargetLowering()->getObjFileLowering(); } -/// SwitchToSection - Switch to the specified section of the executable if we -/// are not already in it! -void AsmPrinter::SwitchToSection(const MCSection *NS) { - assert(NS != 0 && "Must specify a section to switch to"); - OutStreamer.SwitchSection(NS); -} - /// getCurrentSection() - Return the current section we are emitting to. const MCSection *AsmPrinter::getCurrentSection() const { return OutStreamer.getCurrentSection(); @@ -300,7 +293,7 @@ // Now print stuff into the calculated sections. for (unsigned i = 0, e = CPSections.size(); i != e; ++i) { - SwitchToSection(CPSections[i].S); + OutStreamer.SwitchSection(CPSections[i].S); EmitAlignment(Log2_32(CPSections[i].Alignment)); unsigned Offset = 0; @@ -354,12 +347,13 @@ // function body itself, otherwise the label differences won't make sense. // We should also do if the section name is NULL or function is declared in // discardable section. - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, + TM)); } else { // Otherwise, drop it in the readonly section. const MCSection *ReadOnlySection = getObjFileLowering().getSectionForConstant(SectionKind::getReadOnly()); - SwitchToSection(ReadOnlySection); + OutStreamer.SwitchSection(ReadOnlySection); JTInDiffSection = true; } @@ -458,14 +452,14 @@ const TargetData *TD = TM.getTargetData(); unsigned Align = Log2_32(TD->getPointerPrefAlignment()); if (GV->getName() == "llvm.global_ctors") { - SwitchToSection(getObjFileLowering().getStaticCtorSection()); + OutStreamer.SwitchSection(getObjFileLowering().getStaticCtorSection()); EmitAlignment(Align, 0); EmitXXStructorList(GV->getInitializer()); return true; } if (GV->getName() == "llvm.global_dtors") { - SwitchToSection(getObjFileLowering().getStaticDtorSection()); + OutStreamer.SwitchSection(getObjFileLowering().getStaticDtorSection()); EmitAlignment(Align, 0); EmitXXStructorList(GV->getInitializer()); return true; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Aug 19 00:49:37 2009 @@ -15,6 +15,7 @@ #include "llvm/Module.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/MC/MCSection.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" @@ -787,9 +788,10 @@ std::string LinkageName; GV.getLinkageName(LinkageName); if (!LinkageName.empty()) { - // Skip special LLVM prefix that is used to inform the asm printer to not emit - // usual symbol prefix before the symbol name. This happens for Objective-C - // symbol names and symbol whose name is replaced using GCC's __asm__ attribute. + // Skip special LLVM prefix that is used to inform the asm printer to not + // emit usual symbol prefix before the symbol name. This happens for + // Objective-C symbol names and symbol whose name is replaced using GCC's + // __asm__ attribute. if (LinkageName[0] == 1) LinkageName = &LinkageName[1]; AddString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string, @@ -1362,14 +1364,14 @@ DebugTimer->startTimer(); // Standard sections final addresses. - Asm->SwitchToSection(Asm->getObjFileLowering().getTextSection()); + Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getTextSection()); EmitLabel("text_end", 0); - Asm->SwitchToSection(Asm->getObjFileLowering().getDataSection()); + Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getDataSection()); EmitLabel("data_end", 0); // End text sections. for (unsigned i = 1, N = SectionMap.size(); i <= N; ++i) { - Asm->SwitchToSection(SectionMap[i]); + Asm->OutStreamer.SwitchSection(SectionMap[i]); EmitLabel("section_end", i); } @@ -1863,39 +1865,40 @@ if (didInitial) return; didInitial = true; + const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); + // Dwarf sections base addresses. if (TAI->doesDwarfRequireFrameSection()) { - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfFrameSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDwarfFrameSection()); EmitLabel("section_debug_frame", 0); } - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfInfoSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDwarfInfoSection()); EmitLabel("section_info", 0); - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfAbbrevSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDwarfAbbrevSection()); EmitLabel("section_abbrev", 0); - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfARangesSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDwarfARangesSection()); EmitLabel("section_aranges", 0); - if (const MCSection *LineInfoDirective = - Asm->getObjFileLowering().getDwarfMacroInfoSection()) { - Asm->SwitchToSection(LineInfoDirective); + if (const MCSection *LineInfoDirective = TLOF.getDwarfMacroInfoSection()) { + Asm->OutStreamer.SwitchSection(LineInfoDirective); EmitLabel("section_macinfo", 0); } - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLineSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDwarfLineSection()); EmitLabel("section_line", 0); - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLocSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDwarfLocSection()); EmitLabel("section_loc", 0); - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfPubNamesSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDwarfPubNamesSection()); EmitLabel("section_pubnames", 0); - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfStrSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDwarfStrSection()); EmitLabel("section_str", 0); - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfRangesSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDwarfRangesSection()); EmitLabel("section_ranges", 0); - Asm->SwitchToSection(Asm->getObjFileLowering().getTextSection()); + Asm->OutStreamer.SwitchSection(TLOF.getTextSection()); EmitLabel("text_begin", 0); - Asm->SwitchToSection(Asm->getObjFileLowering().getDataSection()); + Asm->OutStreamer.SwitchSection(TLOF.getDataSection()); EmitLabel("data_begin", 0); } @@ -1997,7 +2000,8 @@ void DwarfDebug::EmitDebugInfo() { // Start debug info section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfInfoSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfInfoSection()); EmitDebugInfoPerCU(ModuleCU); } @@ -2008,7 +2012,8 @@ // Check to see if it is worth the effort. if (!Abbreviations.empty()) { // Start the debug abbrev section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfAbbrevSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfAbbrevSection()); EmitLabel("abbrev_begin", 0); @@ -2065,7 +2070,8 @@ const int MaxLineDelta = 255 + MinLineDelta; // Start the dwarf line section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLineSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfLineSection()); // Construct the section header. EmitDifference("line_end", 0, "line_begin", 0, true); @@ -2224,7 +2230,8 @@ TD->getPointerSize() : -TD->getPointerSize(); // Start the dwarf frame section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfFrameSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfFrameSection()); EmitLabel("debug_frame_common", 0); EmitDifference("debug_frame_common_end", 0, @@ -2264,7 +2271,8 @@ return; // Start the dwarf frame section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfFrameSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfFrameSection()); EmitDifference("debug_frame_end", DebugFrameInfo.Number, "debug_frame_begin", DebugFrameInfo.Number, true); @@ -2328,7 +2336,8 @@ /// void DwarfDebug::EmitDebugPubNames() { // Start the dwarf pubnames section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfPubNamesSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfPubNamesSection()); EmitDebugPubNamesPerCU(ModuleCU); } @@ -2339,7 +2348,8 @@ // Check to see if it is worth the effort. if (!StringPool.empty()) { // Start the dwarf str section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfStrSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfStrSection()); // For each of strings in the string pool. for (unsigned StringID = 1, N = StringPool.size(); @@ -2360,7 +2370,8 @@ /// void DwarfDebug::EmitDebugLoc() { // Start the dwarf loc section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLocSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfLocSection()); Asm->EOL(); } @@ -2368,7 +2379,8 @@ /// void DwarfDebug::EmitDebugARanges() { // Start the dwarf aranges section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfARangesSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfARangesSection()); // FIXME - Mock up #if 0 @@ -2404,7 +2416,8 @@ /// void DwarfDebug::EmitDebugRanges() { // Start the dwarf ranges section. - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfRangesSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfRangesSection()); Asm->EOL(); } @@ -2414,7 +2427,7 @@ if (const MCSection *LineInfo = Asm->getObjFileLowering().getDwarfMacroInfoSection()) { // Start the dwarf macinfo section. - Asm->SwitchToSection(LineInfo); + Asm->OutStreamer.SwitchSection(LineInfo); Asm->EOL(); } } @@ -2444,7 +2457,8 @@ if (!ModuleCU) return; - Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfDebugInlineSection()); + Asm->OutStreamer.SwitchSection( + Asm->getObjFileLowering().getDwarfDebugInlineSection()); Asm->EOL(); EmitDifference("debug_inlined_end", 1, "debug_inlined_begin", 1, true); @@ -2469,9 +2483,10 @@ if (LName.empty()) Asm->EmitString(Name); else { - // Skip special LLVM prefix that is used to inform the asm printer to not emit - // usual symbol prefix before the symbol name. This happens for Objective-C - // symbol names and symbol whose name is replaced using GCC's __asm__ attribute. + // Skip special LLVM prefix that is used to inform the asm printer to not + // emit usual symbol prefix before the symbol name. This happens for + // Objective-C symbol names and symbol whose name is replaced using GCC's + // __asm__ attribute. if (LName[0] == 1) LName = &LName[1]; Asm->EmitString(LName); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Wed Aug 19 00:49:37 2009 @@ -16,15 +16,16 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineLocation.h" -#include "llvm/Support/Dwarf.h" -#include "llvm/Support/Timer.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegisterInfo.h" +#include "llvm/Support/Dwarf.h" +#include "llvm/Support/Timer.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/ADT/StringExtras.h" using namespace llvm; @@ -56,7 +57,7 @@ TD->getPointerSize() : -TD->getPointerSize(); // Begin eh frame section. - Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection()); + Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection()); if (TAI->is_EHSymbolPrivate()) O << TAI->getPrivateGlobalPrefix(); @@ -150,7 +151,7 @@ const Function *TheFunc = EHFrameInfo.function; - Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection()); + Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection()); // Externally visible entry into the functions eh frame info. If the // corresponding function is static, this should not be externally visible. @@ -555,7 +556,7 @@ // Begin the exception table. const MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection(); - Asm->SwitchToSection(LSDASection); + Asm->OutStreamer.SwitchSection(LSDASection); Asm->EmitAlignment(2, 0, 0, false); O << "GCC_except_table" << SubprogramCount << ":\n"; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -15,13 +15,14 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/GCMetadataPrinter.h" #include "llvm/Module.h" -#include "llvm/Support/Compiler.h" -#include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; namespace { @@ -64,10 +65,10 @@ void OcamlGCMetadataPrinter::beginAssembly(raw_ostream &OS, AsmPrinter &AP, const TargetAsmInfo &TAI) { - AP.SwitchToSection(AP.getObjFileLowering().getTextSection()); + AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getTextSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "code_begin"); - AP.SwitchToSection(AP.getObjFileLowering().getDataSection()); + AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "data_begin"); } @@ -99,16 +100,16 @@ AddressAlignLog = 3; } - AP.SwitchToSection(AP.getObjFileLowering().getTextSection()); + AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getTextSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "code_end"); - AP.SwitchToSection(AP.getObjFileLowering().getDataSection()); + AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "data_end"); OS << AddressDirective << 0; // FIXME: Why does ocaml emit this?? AP.EOL(); - AP.SwitchToSection(AP.getObjFileLowering().getDataSection()); + AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "frametable"); for (iterator I = begin(), IE = end(); I != IE; ++I) { Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Aug 19 00:49:37 2009 @@ -97,6 +97,7 @@ } void MCAsmStreamer::SwitchSection(const MCSection *Section) { + assert(Section && "Cannot switch to a null section!"); if (Section != CurSection) { CurSection = Section; Section->PrintSwitchToSection(TAI, OS); 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=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -28,6 +28,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/MC/MCSectionMachO.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLoweringObjectFile.h" @@ -260,7 +261,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unknown linkage type!"); @@ -1162,7 +1163,7 @@ const MCSection *TheSection = getObjFileLowering().SectionForGlobal(GVar, Mang, TM); - SwitchToSection(TheSection); + OutStreamer.SwitchSection(TheSection); // FIXME: get this stuff from section kind flags. if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() && @@ -1188,7 +1189,7 @@ O << TAI->getCOMMDirective() << name << "," << Size << ',' << Align; } else { - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang,TM)); + OutStreamer.SwitchSection(TheSection); O << "\t.globl " << name << '\n' << TAI->getWeakDefDirective() << name << '\n'; EmitAlignment(Align, GVar); @@ -1297,7 +1298,7 @@ E = FnStubs.end(); I != E; ++I) { const FnStubInfo &Info = I->second; - SwitchToSection(StubSection); + OutStreamer.SwitchSection(StubSection); EmitAlignment(2); O << "\t.code\t32\n"; @@ -1315,7 +1316,7 @@ O << "-(" << Info.SCV << "+8)"; O << '\n'; - SwitchToSection(LazySymbolPointerSection); + OutStreamer.SwitchSection(LazySymbolPointerSection); O << Info.LazyPtr << ":\n"; O << "\t.indirect_symbol " << I->getKeyData() << "\n"; O << "\t.long\tdyld_stub_binding_helper\n"; @@ -1326,7 +1327,7 @@ // Output non-lazy-pointers for external and common global variables. if (!GVNonLazyPtrs.empty()) { // Switch with ".non_lazy_symbol_pointer" directive. - SwitchToSection(TLOFMacho.getNonLazySymbolPointerSection()); + OutStreamer.SwitchSection(TLOFMacho.getNonLazySymbolPointerSection()); EmitAlignment(2); for (StringMap::iterator I = GVNonLazyPtrs.begin(), E = GVNonLazyPtrs.end(); I != E; ++I) { @@ -1337,7 +1338,7 @@ } if (!HiddenGVNonLazyPtrs.empty()) { - SwitchToSection(getObjFileLowering().getDataSection()); + OutStreamer.SwitchSection(getObjFileLowering().getDataSection()); EmitAlignment(2); for (StringMap::iterator I = HiddenGVNonLazyPtrs.begin(), E = HiddenGVNonLazyPtrs.end(); I != E; ++I) { Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -21,6 +21,7 @@ #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" @@ -138,7 +139,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(MF.getAlignment(), F); switch (F->getLinkage()) { @@ -210,7 +211,8 @@ unsigned Align = TD->getPreferredAlignmentLog(GVar); // 0: Switch to section - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang, + TM)); // 1: Check visibility printVisibility(name, GVar->getVisibility()); Modified: llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -23,6 +23,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineInstr.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLoweringObjectFile.h" @@ -95,7 +96,8 @@ std::string name = Mang->getMangledName(GV); Constant *C = GV->getInitializer(); - SwitchToSection(getObjFileLowering().SectionForGlobal(GV, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang, + TM)); emitLinkage(name, GV->getLinkage()); EmitAlignment(TD->getPreferredAlignmentLog(GV), GV); printVisibility(name, GV->getVisibility()); @@ -115,7 +117,7 @@ EmitJumpTableInfo(MF.getJumpTableInfo(), MF); const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(2, F); emitLinkage(CurrentFnName, F->getLinkage()); printVisibility(CurrentFnName, F->getVisibility()); Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -25,13 +25,7 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/Support/Mangler.h" -#include "llvm/Support/MathExtras.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/Compiler.h" -#include "llvm/Support/FormattedStream.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetInstrInfo.h" @@ -40,6 +34,13 @@ #include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Mangler.h" +#include "llvm/Support/MathExtras.h" #include using namespace llvm; @@ -427,7 +428,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(MF.getAlignment(), F); switch (F->getLinkage()) { @@ -512,7 +513,8 @@ unsigned Size = TD->getTypeAllocSize(Type); unsigned Align = TD->getPreferredAlignmentLog(GVar); - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang, + TM)); if (C->isNullValue() && /* FIXME: Verify correct */ !GVar->hasSection() && Modified: llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -26,6 +26,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineInstr.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegistry.h" @@ -78,7 +79,7 @@ void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); unsigned FnAlign = MF.getAlignment(); EmitAlignment(FnAlign, F); Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -28,6 +28,7 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstr.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLoweringObjectFile.h" @@ -210,7 +211,7 @@ void MipsAsmPrinter::emitFunctionStart(MachineFunction &MF) { // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); // 2 bits aligned EmitAlignment(MF.getAlignment(), F); @@ -420,7 +421,7 @@ } bool MipsAsmPrinter::doInitialization(Module &M) { - // FIXME: Use SwitchToSection. + // FIXME: Use SwitchSection. // Tell the assembler which ABI we are using O << "\t.section .mdebug." << emitCurrentABIString() << '\n'; @@ -468,7 +469,8 @@ printVisibility(name, GVar->getVisibility()); - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang, + TM)); if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && Modified: llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -22,6 +22,7 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Support/ErrorHandling.h" @@ -73,7 +74,7 @@ getObjFileLowering().getSectionForFunction(CurrentFnName); // Start the Code Section. O << "\n"; - SwitchToSection(fCodeSection); + OutStreamer.SwitchSection(fCodeSection); // Emit the frame address of the function at the beginning of code. O << "\tretlw low(" << PAN::getFrameLabel(CurrentFnName) << ")\n"; @@ -314,7 +315,7 @@ const std::vector &Items = ROSections[i]->Items; if (!Items.size()) continue; O << "\n"; - SwitchToSection(PTOF->ROSections[i]->S_); + OutStreamer.SwitchSection(PTOF->ROSections[i]->S_); for (unsigned j = 0; j < Items.size(); j++) { O << Mang->getMangledName(Items[j]); Constant *C = Items[j]->getInitializer(); @@ -341,7 +342,7 @@ const MCSection *fPDataSection = getObjFileLowering().getSectionForFunctionFrame(CurrentFnName); - SwitchToSection(fPDataSection); + OutStreamer.SwitchSection(fPDataSection); // Emit function frame label O << PAN::getFrameLabel(CurrentFnName) << ":\n"; @@ -384,7 +385,7 @@ O << "\n"; if (IDATASections[i]->S_->getName().find("llvm.") != std::string::npos) continue; - SwitchToSection(IDATASections[i]->S_); + OutStreamer.SwitchSection(IDATASections[i]->S_); std::vector Items = IDATASections[i]->Items; for (unsigned j = 0; j < Items.size(); j++) { std::string Name = Mang->getMangledName(Items[j]); @@ -403,7 +404,7 @@ const std::vector &BSSSections = PTOF->BSSSections; for (unsigned i = 0; i < BSSSections.size(); i++) { O << "\n"; - SwitchToSection(BSSSections[i]->S_); + OutStreamer.SwitchSection(BSSSections[i]->S_); std::vector Items = BSSSections[i]->Items; for (unsigned j = 0; j < Items.size(); j++) { std::string Name = Mang->getMangledName(Items[j]); @@ -428,7 +429,7 @@ if (AutosSections[i]->S_->getName() == SectionName) { // Set the printing status to true AutosSections[i]->setPrintedStatus(true); - SwitchToSection(AutosSections[i]->S_); + OutStreamer.SwitchSection(AutosSections[i]->S_); const std::vector &Items = AutosSections[i]->Items; for (unsigned j = 0; j < Items.size(); j++) { std::string VarName = Mang->getMangledName(Items[j]); @@ -460,7 +461,7 @@ AutosSections[i]->setPrintedStatus(true); O << "\n"; - SwitchToSection(AutosSections[i]->S_); + OutStreamer.SwitchSection(AutosSections[i]->S_); const std::vector &Items = AutosSections[i]->Items; for (unsigned j = 0; j < Items.size(); j++) { std::string VarName = Mang->getMangledName(Items[j]); 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=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -32,6 +32,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/MC/MCSectionMachO.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegisterInfo.h" @@ -614,7 +615,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unknown linkage type!"); @@ -675,7 +676,7 @@ // Print out jump tables referenced by the function. EmitJumpTableInfo(MF.getJumpTableInfo(), MF); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); // Emit post-function debug information. DW->EndFunction(&MF); @@ -703,7 +704,8 @@ unsigned Size = TD->getTypeAllocSize(Type); unsigned Align = TD->getPreferredAlignmentLog(GVar); - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang, + TM)); if (C->isNullValue() && /* FIXME: Verify correct */ !GVar->hasSection() && @@ -802,7 +804,7 @@ // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unknown linkage type!"); @@ -894,19 +896,21 @@ // large data or debug section causes a branch to exceed 16M limit. TargetLoweringObjectFileMachO &TLOFMacho = static_cast(getObjFileLowering()); - SwitchToSection(TLOFMacho.getTextCoalSection()); + OutStreamer.SwitchSection(TLOFMacho.getTextCoalSection()); if (TM.getRelocationModel() == Reloc::PIC_) { - SwitchToSection(TLOFMacho.getMachOSection("__TEXT", "__picsymbolstub1", - MCSectionMachO::S_SYMBOL_STUBS | - MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, - 32, SectionKind::getText())); + OutStreamer.SwitchSection( + TLOFMacho.getMachOSection("__TEXT", "__picsymbolstub1", + MCSectionMachO::S_SYMBOL_STUBS | + MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, + 32, SectionKind::getText())); } else if (TM.getRelocationModel() == Reloc::DynamicNoPIC) { - SwitchToSection(TLOFMacho.getMachOSection("__TEXT","__symbol_stub1", - MCSectionMachO::S_SYMBOL_STUBS | - MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, - 16, SectionKind::getText())); + OutStreamer.SwitchSection( + TLOFMacho.getMachOSection("__TEXT","__symbol_stub1", + MCSectionMachO::S_SYMBOL_STUBS | + MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, + 16, SectionKind::getText())); } - SwitchToSection(getObjFileLowering().getTextSection()); + OutStreamer.SwitchSection(getObjFileLowering().getTextSection()); return Result; } @@ -938,7 +942,7 @@ const MCSection *TheSection = getObjFileLowering().SectionForGlobal(GVar, Mang, TM); - SwitchToSection(TheSection); + OutStreamer.SwitchSection(TheSection); /// FIXME: Drive this off the section! if (C->isNullValue() && /* FIXME: Verify correct */ @@ -1043,7 +1047,7 @@ 32, SectionKind::getText()); for (StringMap::iterator I = FnStubs.begin(), E = FnStubs.end(); I != E; ++I) { - SwitchToSection(StubSection); + OutStreamer.SwitchSection(StubSection); EmitAlignment(4); const FnStubInfo &Info = I->second; O << Info.Stub << ":\n"; @@ -1060,7 +1064,7 @@ O << "\tmtctr r12\n"; O << "\tbctr\n"; - SwitchToSection(LSPSection); + OutStreamer.SwitchSection(LSPSection); O << Info.LazyPtr << ":\n"; O << "\t.indirect_symbol " << I->getKeyData() << '\n'; O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n"; @@ -1074,7 +1078,7 @@ for (StringMap::iterator I = FnStubs.begin(), E = FnStubs.end(); I != E; ++I) { - SwitchToSection(StubSection); + OutStreamer.SwitchSection(StubSection); EmitAlignment(4); const FnStubInfo &Info = I->second; O << Info.Stub << ":\n"; @@ -1084,7 +1088,7 @@ O << Info.LazyPtr << ")(r11)\n"; O << "\tmtctr r12\n"; O << "\tbctr\n"; - SwitchToSection(LSPSection); + OutStreamer.SwitchSection(LSPSection); O << Info.LazyPtr << ":\n"; O << "\t.indirect_symbol " << I->getKeyData() << '\n'; O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n"; @@ -1108,7 +1112,7 @@ // Output macho stubs for external and common global variables. if (!GVStubs.empty()) { // Switch with ".non_lazy_symbol_pointer" directive. - SwitchToSection(TLOFMacho.getNonLazySymbolPointerSection()); + OutStreamer.SwitchSection(TLOFMacho.getNonLazySymbolPointerSection()); EmitAlignment(isPPC64 ? 3 : 2); for (StringMap::iterator I = GVStubs.begin(), @@ -1120,7 +1124,7 @@ } if (!HiddenGVStubs.empty()) { - SwitchToSection(getObjFileLowering().getDataSection()); + OutStreamer.SwitchSection(getObjFileLowering().getDataSection()); EmitAlignment(isPPC64 ? 3 : 2); for (StringMap::iterator I = HiddenGVStubs.begin(), E = HiddenGVStubs.end(); I != E; ++I) { Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -24,15 +24,16 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineInstr.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegistry.h" -#include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/FormattedStream.h" -#include "llvm/Support/Mangler.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Mangler.h" #include "llvm/Support/MathExtras.h" #include #include @@ -95,7 +96,7 @@ // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(MF.getAlignment(), F); O << "\t.globl\t" << CurrentFnName << '\n'; @@ -227,7 +228,8 @@ printVisibility(name, GVar->getVisibility()); - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang, + TM)); if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && Modified: llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -26,6 +26,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineInstr.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLoweringObjectFile.h" @@ -84,7 +85,7 @@ unsigned FnAlign = MF.getAlignment(); const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(FnAlign, F); @@ -317,7 +318,8 @@ O << "\t.type\t" << name << ", at object\n"; - SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang, + TM)); if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() && 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=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -174,7 +174,7 @@ if (Subtarget->isTargetCygMing()) DecorateCygMingName(CurrentFnName, F); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); EmitAlignment(FnAlign, F); switch (F->getLinkage()) { @@ -933,7 +933,7 @@ SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GVar, TM); const MCSection *TheSection = getObjFileLowering().SectionForGlobal(GVar, GVKind, Mang, TM); - SwitchToSection(TheSection); + OutStreamer.SwitchSection(TheSection); // FIXME: get this stuff from section kind flags. if (C->isNullValue() && !GVar->hasSection() && @@ -1074,7 +1074,7 @@ MCSectionMachO::S_ATTR_SELF_MODIFYING_CODE | MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, 5, SectionKind::getMetadata()); - SwitchToSection(TheSection); + OutStreamer.SwitchSection(TheSection); for (StringMap::iterator I = FnStubs.begin(), E = FnStubs.end(); I != E; ++I) O << I->getKeyData() << ":\n" << "\t.indirect_symbol " << I->second @@ -1088,7 +1088,7 @@ TLOFMacho.getMachOSection("__IMPORT", "__pointers", MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS, SectionKind::getMetadata()); - SwitchToSection(TheSection); + OutStreamer.SwitchSection(TheSection); for (StringMap::iterator I = GVStubs.begin(), E = GVStubs.end(); I != E; ++I) O << I->getKeyData() << ":\n\t.indirect_symbol " @@ -1096,7 +1096,7 @@ } if (!HiddenGVStubs.empty()) { - SwitchToSection(getObjFileLowering().getDataSection()); + OutStreamer.SwitchSection(getObjFileLowering().getDataSection()); EmitAlignment(2); for (StringMap::iterator I = HiddenGVStubs.begin(), E = HiddenGVStubs.end(); I != E; ++I) @@ -1128,8 +1128,8 @@ TargetLoweringObjectFileCOFF &TLOFMacho = static_cast(getObjFileLowering()); - SwitchToSection(TLOFMacho.getCOFFSection(".section .drectve", true, - SectionKind::getMetadata())); + OutStreamer.SwitchSection(TLOFMacho.getCOFFSection(".section .drectve",true, + SectionKind::getMetadata())); for (StringSet<>::iterator i = DLLExportedGVs.begin(), e = DLLExportedGVs.end(); i != e; ++i) 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=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -26,11 +26,12 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/DwarfWriter.h" -#include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/Mangler.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/Mangler.h" using namespace llvm; STATISTIC(EmittedInsts, "Number of machine instrs printed"); @@ -143,7 +144,7 @@ decorateName(CurrentFnName, F); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); switch (F->getLinkage()) { default: llvm_unreachable("Unsupported linkage type!"); @@ -513,7 +514,7 @@ O << "\tpublic " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - SwitchToSection(getObjFileLowering().getDataSection()); + OutStreamer.SwitchSection(getObjFileLowering().getDataSection()); break; default: llvm_unreachable("Unknown linkage type!"); Modified: llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp?rev=79405&r1=79404&r2=79405&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp Wed Aug 19 00:49:37 2009 @@ -27,15 +27,16 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineInstr.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegistry.h" -#include "llvm/Support/Mangler.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Mangler.h" #include "llvm/Support/MathExtras.h" #include #include @@ -134,7 +135,7 @@ const TargetData *TD = TM.getTargetData(); - SwitchToSection(getObjFileLowering().SectionForGlobal(GV, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang,TM)); std::string name = Mang->getMangledName(GV); Constant *C = GV->getInitializer(); @@ -205,7 +206,7 @@ // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); + OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM)); // Mark the start of the function O << "\t.cc_top " << CurrentFnName << ".function," << CurrentFnName << "\n"; From astifter at gmx.at Wed Aug 19 00:44:40 2009 From: astifter at gmx.at (Andreas Neustifter) Date: Wed, 19 Aug 2009 05:44:40 -0000 Subject: [llvm-commits] [llvm] r79404 - /llvm/trunk/lib/Analysis/ProfileInfo.cpp Message-ID: <200908190544.n7J5ieC8026311@zion.cs.uiuc.edu> Author: astifter Date: Wed Aug 19 00:44:39 2009 New Revision: 79404 URL: http://llvm.org/viewvc/llvm-project?rev=79404&view=rev Log: Broke line before break. Modified: llvm/trunk/lib/Analysis/ProfileInfo.cpp Modified: llvm/trunk/lib/Analysis/ProfileInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfo.cpp?rev=79404&r1=79403&r2=79404&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ProfileInfo.cpp (original) +++ llvm/trunk/lib/Analysis/ProfileInfo.cpp Wed Aug 19 00:44:39 2009 @@ -54,7 +54,8 @@ if (ProcessedPreds.insert(*PI).second) { double w = getEdgeWeight(getEdge(*PI, BB)); if (w == MissingValue) { - Count = MissingValue; break; + Count = MissingValue; + break; } Count += w; } From kremenek at apple.com Wed Aug 19 01:06:36 2009 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 18 Aug 2009 23:06:36 -0700 Subject: [llvm-commits] PATCH: Add raw_svector_ostream direct vector output In-Reply-To: <6a8523d60908182227x5bb096e7j5300ee3b54322ece@mail.gmail.com> References: <6a8523d60908182227x5bb096e7j5300ee3b54322ece@mail.gmail.com> Message-ID: <6126FF4C-EE4E-4A07-BA92-E424483328E2@apple.com> On Aug 18, 2009, at 10:27 PM, Daniel Dunbar wrote: > I'm proposing as a patch because it has two downsides: > 1. It exposes some bits of SmallVector; namely it adds a capacity() > method, which gives the allocated size of the current buffer, and a > set_size() method, which clients can use to forcibly set the vector > size (without doing any construction or destruction). The use case is > basically that clients will intentionally write past the end() of the > vector (but not past the capacity() of the buffer), and then at some > point call set_size() to update the vector size. Although there may be some aesthetic disagreement on this, I'm fine with 'set_size()' being private and having raw_svector_ostream being a friend of SmallVector. Exposing 'set_size()' as part of SmallVector's general interface seems like a bad idea. > > 2. It forces clients of raw_svector_ostream to provide a SmallVector > with at least 128 bytes free. This is probably a good thing, but it > isn't enforced by the API (it is enforced by a runtime check, of > course). I certainly am probably missing something here, but since you're doing a dynamic check anyway, why not just have raw_svector_ostream increase the capacity on its own? For example, instead of using 'llvm_report_error', can we just grow the small vector? + if (OS.capacity() - OS.size() < 128) + llvm_report_error("Invalid argument, must have at least 128 bytes free!"); From sabre at nondot.org Wed Aug 19 01:12:02 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 19 Aug 2009 06:12:02 -0000 Subject: [llvm-commits] [llvm] r79406 - in /llvm/trunk/lib: CodeGen/AsmPrinter/AsmPrinter.cpp MC/MCAsmStreamer.cpp Message-ID: <200908190612.n7J6C2ks029865@zion.cs.uiuc.edu> Author: lattner Date: Wed Aug 19 01:12:02 2009 New Revision: 79406 URL: http://llvm.org/viewvc/llvm-project?rev=79406&view=rev Log: switch asmprinter to emit alignments through OutStreamer. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/MC/MCAsmStreamer.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=79406&r1=79405&r2=79406&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Aug 19 01:12:02 2009 @@ -753,15 +753,12 @@ NumBits = std::max(NumBits, ForcedAlignBits); if (NumBits == 0) return; // No need to emit alignment. - if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits; - O << TAI->getAlignDirective() << NumBits; - + + unsigned FillValue = 0; if (getCurrentSection()->getKind().isText()) - if (unsigned FillValue = TAI->getTextAlignFillValue()) { - O << ','; - PrintHex(FillValue); - } - O << '\n'; + FillValue = TAI->getTextAlignFillValue(); + + OutStreamer.EmitValueToAlignment(1 << NumBits, FillValue, 1, 0); } /// EmitZeros - Emit a block of zeros. Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=79406&r1=79405&r2=79406&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Aug 19 01:12:02 2009 @@ -14,7 +14,9 @@ #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" +#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -224,24 +226,37 @@ void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value, unsigned ValueSize, unsigned MaxBytesToEmit) { - // Some assemblers don't support .balign, so we always emit as .p2align if - // this is a power of two. Otherwise we assume the client knows the target - // supports .balign and use that. - unsigned Pow2 = Log2_32(ByteAlignment); - bool IsPow2 = (1U << Pow2) == ByteAlignment; + // Some assemblers don't support non-power of two alignments, so we always + // emit alignments as a power of two if possible. + if (isPowerOf2_32(ByteAlignment)) { + OS << TAI.getAlignDirective(); + + if (TAI.getAlignmentIsInBytes()) + OS << ByteAlignment; + else + OS << Log2_32(ByteAlignment); + + if (Value || MaxBytesToEmit) { + OS << ", " << truncateToSize(Value, ValueSize); + if (MaxBytesToEmit) + OS << ", " << MaxBytesToEmit; + } + OS << '\n'; + return; + } + + // Non-power of two alignment. This is not widely supported by assemblers. + // FIXME: Parameterize this based on TAI. switch (ValueSize) { - default: - llvm_unreachable("Invalid size for machine code value!"); - case 8: - llvm_unreachable("Unsupported alignment size!"); - case 1: OS << (IsPow2 ? ".p2align" : ".balign"); break; - case 2: OS << (IsPow2 ? ".p2alignw" : ".balignw"); break; - case 4: OS << (IsPow2 ? ".p2alignl" : ".balignl"); break; + default: llvm_unreachable("Invalid size for machine code value!"); + case 1: OS << ".balign"; break; + case 2: OS << ".balignw"; break; + case 4: OS << ".balignl"; break; + case 8: llvm_unreachable("Unsupported alignment size!"); } - OS << ' ' << (IsPow2 ? Pow2 : ByteAlignment); - + OS << ' ' << ByteAlignment; OS << ", " << truncateToSize(Value, ValueSize); if (MaxBytesToEmit) OS << ", " << MaxBytesToEmit; From nicholas at mxc.ca Wed Aug 19 01:24:33 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 19 Aug 2009 06:24:33 -0000 Subject: [llvm-commits] [llvm] r79407 - /llvm/trunk/lib/Transforms/Utils/SSI.cpp Message-ID: <200908190624.n7J6OXbZ031519@zion.cs.uiuc.edu> Author: nicholas Date: Wed Aug 19 01:24:33 2009 New Revision: 79407 URL: http://llvm.org/viewvc/llvm-project?rev=79407&view=rev Log: Be more careful when modifying PHI nodes. Patch by Andre Tavares. Modified: llvm/trunk/lib/Transforms/Utils/SSI.cpp Modified: llvm/trunk/lib/Transforms/Utils/SSI.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSI.cpp?rev=79407&r1=79406&r2=79407&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SSI.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SSI.cpp Wed Aug 19 01:24:33 2009 @@ -316,7 +316,8 @@ for (unsigned i = 0, e = PN->getNumIncomingValues(); i < e; ++i) { PHINode *PN_father; if ((PN_father = dyn_cast(PN->getIncomingValue(i))) && - PN->getParent() == PN_father->getParent()) { + PN->getParent() == PN_father->getParent() && + !DT_->dominates(PN->getParent(), PN->getIncomingBlock(i))) { BasicBlock *BB = PN->getIncomingBlock(i); int pos = PN_father->getBasicBlockIndex(BB); PN->setIncomingValue(i, PN_father->getIncomingValue(pos)); From lattner at cs.uiuc.edu Wed Aug 19 01:25:09 2009 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 19 Aug 2009 01:25:09 -0500 Subject: [llvm-commits] CVS: llvm-www/developers.txt Message-ID: <200908190625.n7J6P9Z6031607@zion.cs.uiuc.edu> Changes in directory llvm-www: developers.txt updated: 1.18 -> 1.19 --- Log message: Add Zhongxing Xu. We're missing a lot of other people from http://llvm.org/developers.cgi as well! --- Diffs of the changes: (+1 -0) developers.txt | 1 + 1 files changed, 1 insertion(+) Index: llvm-www/developers.txt diff -u llvm-www/developers.txt:1.18 llvm-www/developers.txt:1.19 --- llvm-www/developers.txt:1.18 Wed Mar 25 17:53:12 2009 +++ llvm-www/developers.txt Wed Aug 19 01:24:12 2009 @@ -24,4 +24,5 @@ Devang Patel href=mailto:dpatel at apple.com img=PhotoDevang.jpg width=145 height=172 alt=Devang Reid Spencer href=http://illuvium.net/rspencer/ img=PhotoReid.jpg width=145 height=172 alt=Reid Bill Wendling href=http://www.isanbard.org/~wendling/ img=PhotoBill.jpg width=173 height=240 alt=Bill +Zhongxing Xu href=mailto:xuzhongxing at gmail.com img=PhotoZhongxing.jpg width=125 height=175 alt=Zhongxing Sheng Zhou href=mailto:zhousheng at gmail.com img=PhotoSheng.jpg width=200 height=231 alt=Sheng From sabre at nondot.org Wed Aug 19 01:25:09 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 19 Aug 2009 01:25:09 -0500 Subject: [llvm-commits] CVS: llvm-www/img/PhotoZhongxing.jpg Message-ID: <200908190625.n7J6P9S5031606@zion.cs.uiuc.edu> Changes in directory llvm-www/img: PhotoZhongxing.jpg added (r1.1) --- Log message: Add Zhongxing Xu. We're missing a lot of other people from http://llvm.org/developers.cgi as well! --- Diffs of the changes: (+0 -0) PhotoZhongxing.jpg | 0 1 files changed Index: llvm-www/img/PhotoZhongxing.jpg From sabre at nondot.org Wed Aug 19 01:25:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 19 Aug 2009 01:25:24 -0500 Subject: [llvm-commits] CVS: llvm-www/developers.txt Message-ID: <200908190625.n7J6POqt031861@zion.cs.uiuc.edu> Changes in directory llvm-www: developers.txt updated: 1.19 -> 1.20 --- Log message: update url --- Diffs of the changes: (+1 -1) developers.txt | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/developers.txt diff -u llvm-www/developers.txt:1.19 llvm-www/developers.txt:1.20 --- llvm-www/developers.txt:1.19 Wed Aug 19 01:24:12 2009 +++ llvm-www/developers.txt Wed Aug 19 01:25:04 2009 @@ -24,5 +24,5 @@ Devang Patel href=mailto:dpatel at apple.com img=PhotoDevang.jpg width=145 height=172 alt=Devang Reid Spencer href=http://illuvium.net/rspencer/ img=PhotoReid.jpg width=145 height=172 alt=Reid Bill Wendling href=http://www.isanbard.org/~wendling/ img=PhotoBill.jpg width=173 height=240 alt=Bill -Zhongxing Xu href=mailto:xuzhongxing at gmail.com img=PhotoZhongxing.jpg width=125 height=175 alt=Zhongxing +Zhongxing Xu href=http://lcs.ios.ac.cn/~xzx/ img=PhotoZhongxing.jpg width=125 height=175 alt=Zhongxing Sheng Zhou href=mailto:zhousheng at gmail.com img=PhotoSheng.jpg width=200 height=231 alt=Sheng From sabre at nondot.org Wed Aug 19 01:35:36 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 19 Aug 2009 06:35:36 -0000 Subject: [llvm-commits] [llvm] r79408 - in /llvm/trunk: lib/MC/MCAsmStreamer.cpp test/MC/AsmParser/directive_align.s Message-ID: <200908190635.n7J6Za2g000705@zion.cs.uiuc.edu> Author: lattner Date: Wed Aug 19 01:35:36 2009 New Revision: 79408 URL: http://llvm.org/viewvc/llvm-project?rev=79408&view=rev Log: fix asmstreaming of 2/4 byte elements with pow-2 alignments. Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/test/MC/AsmParser/directive_align.s Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=79408&r1=79407&r2=79408&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Aug 19 01:35:36 2009 @@ -229,7 +229,14 @@ // Some assemblers don't support non-power of two alignments, so we always // emit alignments as a power of two if possible. if (isPowerOf2_32(ByteAlignment)) { - OS << TAI.getAlignDirective(); + switch (ValueSize) { + default: llvm_unreachable("Invalid size for machine code value!"); + case 1: OS << TAI.getAlignDirective(); break; + // FIXME: use TAI for this! + case 2: OS << ".p2alignw "; break; + case 4: OS << ".p2alignl "; break; + case 8: llvm_unreachable("Unsupported alignment size!"); + } if (TAI.getAlignmentIsInBytes()) OS << ByteAlignment; Modified: llvm/trunk/test/MC/AsmParser/directive_align.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_align.s?rev=79408&r1=79407&r2=79408&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/directive_align.s (original) +++ llvm/trunk/test/MC/AsmParser/directive_align.s Wed Aug 19 01:35:36 2009 @@ -1,7 +1,7 @@ -# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s +# RUN: llvm-mc -triple i386-apple-darwin9 %s | FileCheck %s # CHECK: TEST0: -# CHECK: .p2align 1, 0 +# CHECK: align 1 TEST0: .align 1 From sabre at nondot.org Wed Aug 19 01:36:30 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 19 Aug 2009 06:36:30 -0000 Subject: [llvm-commits] [llvm] r79409 - /llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Message-ID: <200908190636.n7J6aUOD000817@zion.cs.uiuc.edu> Author: lattner Date: Wed Aug 19 01:36:30 2009 New Revision: 79409 URL: http://llvm.org/viewvc/llvm-project?rev=79409&view=rev Log: ExuberantAsm is no more. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=79409&r1=79408&r2=79409&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Wed Aug 19 01:36:30 2009 @@ -70,7 +70,7 @@ typedef gcp_map_type::iterator gcp_iterator; gcp_map_type GCMetadataPrinters; - /// If ExuberantAsm is set, a pointer to the loop info for this + /// If VerboseAsm is set, a pointer to the loop info for this /// function. /// MachineLoopInfo *LI; From clattner at apple.com Wed Aug 19 01:37:18 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 18 Aug 2009 23:37:18 -0700 Subject: [llvm-commits] PATCH: Add raw_svector_ostream direct vector output In-Reply-To: <6a8523d60908182227x5bb096e7j5300ee3b54322ece@mail.gmail.com> References: <6a8523d60908182227x5bb096e7j5300ee3b54322ece@mail.gmail.com> Message-ID: On Aug 18, 2009, at 10:27 PM, Daniel Dunbar wrote: > Hi all, > > The attached patch changes raw_svector_ostream to use the vector > buffer itself as the raw_ostream buffer. This is nice for a couple > reasons: > 1. It avoids the malloc/free of the raw_ostream buffer. This makes it > very lightweight to use a raw_svector_ostream for simple string > concatenation (e.g., the Twine::str method). > > 2. It avoids unnecessary copying of the data from the raw_ostream > buffer to the vector buffer. > > I'm proposing as a patch because it has two downsides: > 1. It exposes some bits of SmallVector; namely it adds a capacity() > method, which gives the allocated size of the current buffer, and a > set_size() method, which clients can use to forcibly set the vector > size (without doing any construction or destruction). The use case is > basically that clients will intentionally write past the end() of the > vector (but not past the capacity() of the buffer), and then at some > point call set_size() to update the vector size. > > 2. It forces clients of raw_svector_ostream to provide a SmallVector > with at least 128 bytes free. This is probably a good thing, but it > isn't enforced by the API (it is enforced by a runtime check, of > course). This approach seems reasonable to me. -Chris From clattner at apple.com Wed Aug 19 01:39:08 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 18 Aug 2009 23:39:08 -0700 Subject: [llvm-commits] [llvm] r79377 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86ISelLowering.h X86InstrFormats.td X86InstrSSE.td In-Reply-To: <200908182250.n7IMoX26007247@zion.cs.uiuc.edu> References: <200908182250.n7IMoX26007247@zion.cs.uiuc.edu> Message-ID: <66AB710C-E746-45BB-90DB-7AA49A371B78@apple.com> On Aug 18, 2009, at 3:50 PM, Eric Christopher wrote: > Author: echristo > Date: Tue Aug 18 17:50:32 2009 > New Revision: 79377 > > URL: http://llvm.org/viewvc/llvm-project?rev=79377&view=rev > Log: > Implement sse4.2 string/text processing instructions: > Add patterns and instruction encoding information. > Add custom lowering to deal with hardwired return register of > uncertain type (xmm0). Hey Eric, Did you try writing the pattern as (set XMM0, (...))? Fixed registers work for other instructions, for example, we have: let Defs = [ECX, EFLAGS] in { multiclass SS42AI_pcmpistri { def rr : SS42AI<0x63, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2, i8imm:$src3), "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", [(set ECX, (IntId128 VR128:$src1, VR128:$src2, imm:$src3)), (implicit EFLAGS)]>, OpSize; which produces a fixed result in ECX, doesn't the same work for XMM0? -Chris > > Modified: > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.h > llvm/trunk/lib/Target/X86/X86InstrFormats.td > llvm/trunk/lib/Target/X86/X86InstrSSE.td > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=79377&r1=79376&r2=79377&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Aug 18 > 17:50:32 2009 > @@ -7596,6 +7596,43 @@ > } > > MachineBasicBlock * > +X86TargetLowering::EmitPCMP(MachineInstr *MI, MachineBasicBlock *BB, > + unsigned numArgs, bool memArg) const { > + > + MachineFunction *F = BB->getParent(); > + DebugLoc dl = MI->getDebugLoc(); > + const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); > + > + unsigned Opc; > + > + if (memArg) { > + Opc = numArgs == 3 ? > + X86::PCMPISTRM128rm : > + X86::PCMPESTRM128rm; > + } else { > + Opc = numArgs == 3 ? > + X86::PCMPISTRM128rr : > + X86::PCMPESTRM128rr; > + } > + > + MachineInstrBuilder MIB = BuildMI(BB, dl, TII->get(Opc)); > + > + for (unsigned i = 0; i < numArgs; ++i) { > + MachineOperand &Op = MI->getOperand(i+1); > + > + if (!(Op.isReg() && Op.isImplicit())) > + MIB.addOperand(Op); > + } > + > + BuildMI(BB, dl, TII->get(X86::MOVAPSrr), MI->getOperand(0).getReg > ()) > + .addReg(X86::XMM0); > + > + F->DeleteMachineInstr(MI); > + > + return BB; > +} > + > +MachineBasicBlock * > X86TargetLowering::EmitVAStartSaveXMMRegsWithCustomInserter( > MachineInstr *MI, > MachineBasicBlock > *MBB) const { > @@ -7804,6 +7841,17 @@ > F->DeleteMachineInstr(MI); // The pseudo instruction is gone > now. > return BB; > } > + // String/text processing lowering. > + case X86::PCMPISTRM128REG: > + return EmitPCMP(MI, BB, 3, false /* in-mem */); > + case X86::PCMPISTRM128MEM: > + return EmitPCMP(MI, BB, 3, true /* in-mem */); > + case X86::PCMPESTRM128REG: > + return EmitPCMP(MI, BB, 5, false /* in mem */); > + case X86::PCMPESTRM128MEM: > + return EmitPCMP(MI, BB, 5, true /* in mem */); > + > + // Atomic Lowering. > case X86::ATOMAND32: > return EmitAtomicBitwiseWithCustomInserter(MI, BB, X86::AND32rr, > X86::AND32ri, > X86::MOV32rm, > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=79377&r1=79376&r2=79377&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Aug 18 17:50:32 > 2009 > @@ -693,6 +693,14 @@ > const Value *DstSV, uint64_t > DstSVOff, > const Value *SrcSV, uint64_t > SrcSVOff); > > + /// Utility function to emit string processing sse4.2 > instructions > + /// that return in xmm0. > + // This takes the instruction to expand, the associated machine > basic > + // block, the number of args, and whether or not the second arg > is > + // in memory or not. > + MachineBasicBlock *EmitPCMP(MachineInstr *BInstr, > MachineBasicBlock *BB, > + unsigned argNum, bool inMem) const; > + > /// Utility function to emit atomic bitwise operations (and, or, > xor). > // It takes the bitwise instruction to expand, the associated > machine basic > // block, and the associated X86 opcodes for reg/reg and reg/imm. > > Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=79377&r1=79376&r2=79377&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Tue Aug 18 17:50:32 > 2009 > @@ -235,6 +235,11 @@ > list pattern> > : I, TF, Requires<[HasSSE42]>; > > +// SS42AI = SSE 4.2 instructions with TA prefix > +class SS42AI o, Format F, dag outs, dag ins, string asm, > + list pattern> > + : I, TA, Requires<[HasSSE42]>; > + > // X86-64 Instruction templates... > // > > @@ -288,4 +293,3 @@ > : Ii8, XD, Requires<[HasMMX]>; > class MMXIS o, Format F, dag outs, dag ins, string asm, > list pattern> > : Ii8, XS, Requires<[HasMMX]>; > - > > Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=79377&r1=79376&r2=79377&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Aug 18 17:50:32 2009 > @@ -3657,6 +3657,11 @@ > "movntdqa\t{$src, $dst|$dst, $src}", > [(set VR128:$dst, (int_x86_sse41_movntdqa > addr:$src))]>; > > + > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// SSE4.2 Instructions > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > /// SS42I_binop_rm_int - Simple SSE 4.2 binary operator > let Constraints = "$src1 = $dst" in { > multiclass SS42I_binop_rm_int opc, string OpcodeStr, > @@ -3739,3 +3744,115 @@ > (int_x86_sse42_crc32_64 GR64:$src1, > GR64:$src2))]>, > OpSize, REX_W; > } > + > +// String/text processing instructions. > +let Defs = [EFLAGS], usesCustomDAGSchedInserter = 1 in { > +def PCMPISTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), > + (ins VR128:$src1, VR128:$src2, i8imm:$src3), > + "#PCMPISTRM128rr PSEUDO!", > + [(set VR128:$dst, > + (int_x86_sse42_pcmpistrm128 VR128:$src1, VR128:$src2, > + imm:$src3))]>, OpSize; > +def PCMPISTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), > + (ins VR128:$src1, i128mem:$src2, i8imm:$src3), > + "#PCMPISTRM128rm PSEUDO!", > + [(set VR128:$dst, > + (int_x86_sse42_pcmpistrm128 VR128:$src1, > + (load addr:$src2), > + imm:$src3))]>, OpSize; > +} > + > +let Defs = [XMM0, EFLAGS] in { > +def PCMPISTRM128rr : SS42AI<0x62, MRMSrcReg, (outs), > + (ins VR128:$src1, VR128:$src2, i8imm:$src3), > + "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", > + []>, OpSize; > +def PCMPISTRM128rm : SS42AI<0x62, MRMSrcMem, (outs), > + (ins VR128:$src1, i128mem:$src2, i8imm:$src3), > + "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", > + []>, OpSize; > +} > + > +let Defs = [EFLAGS], Uses = [EAX, EDX], > + usesCustomDAGSchedInserter = 1 in { > +def PCMPESTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), > + (ins VR128:$src1, VR128:$src3, i8imm:$src5), > + "#PCMPESTRM128rr PSEUDO!", > + [(set VR128:$dst, > + (int_x86_sse42_pcmpestrm128 VR128:$src1, EAX, > + VR128:$src3, > + EDX, imm:$src5))]>, OpSize; > +def PCMPESTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), > + (ins VR128:$src1, i128mem:$src3, i8imm:$src5), > + "#PCMPESTRM128rm PSEUDO!", > + [(set VR128:$dst, > + (int_x86_sse42_pcmpestrm128 VR128:$src1, EAX, > + (load addr:$src3), > + EDX, imm:$src5))]>, OpSize; > +} > + > +let Defs = [XMM0, EFLAGS], Uses = [EAX, EDX] in { > +def PCMPESTRM128rr : SS42AI<0x62, MRMSrcReg, (outs), > + (ins VR128:$src1, VR128:$src3, i8imm:$src5), > + "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", > + []>, OpSize; > +def PCMPESTRM128rm : SS42AI<0x62, MRMSrcMem, (outs), > + (ins VR128:$src1, i128mem:$src3, i8imm:$src5), > + "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", > + []>, OpSize; > +} > + > +let Defs = [ECX, EFLAGS] in { > + multiclass SS42AI_pcmpistri { > + def rr : SS42AI<0x63, MRMSrcReg, (outs), > + (ins VR128:$src1, VR128:$src2, i8imm:$src3), > + "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", > + [(set ECX, > + (IntId128 VR128:$src1, VR128:$src2, imm:$src3)), > + (implicit EFLAGS)]>, > + OpSize; > + def rm : SS42AI<0x63, MRMSrcMem, (outs), > + (ins VR128:$src1, i128mem:$src2, i8imm:$src3), > + "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", > + [(set ECX, > + (IntId128 VR128:$src1, (load addr:$src2), imm:$src3)), > + (implicit EFLAGS)]>, > + OpSize; > + } > +} > + > +defm PCMPISTRI : SS42AI_pcmpistri; > +defm PCMPISTRIA : SS42AI_pcmpistri; > +defm PCMPISTRIC : SS42AI_pcmpistri; > +defm PCMPISTRIO : SS42AI_pcmpistri; > +defm PCMPISTRIS : SS42AI_pcmpistri; > +defm PCMPISTRIZ : SS42AI_pcmpistri; > + > +let Defs = [ECX, EFLAGS] in { > +let Uses = [EAX, EDX] in { > + multiclass SS42AI_pcmpestri { > + def rr : SS42AI<0x61, MRMSrcReg, (outs), > + (ins VR128:$src1, VR128:$src3, i8imm:$src5), > + "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", > + [(set ECX, > + (IntId128 VR128:$src1, EAX, VR128:$src3, EDX, imm:$src5)), > + (implicit EFLAGS)]>, > + OpSize; > + def rm : SS42AI<0x61, MRMSrcMem, (outs), > + (ins VR128:$src1, i128mem:$src3, i8imm:$src5), > + "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", > + [(set ECX, > + (IntId128 VR128:$src1, EAX, (load addr:$src3), > + EDX, imm:$src5)), > + (implicit EFLAGS)]>, > + OpSize; > + } > +} > +} > + > +defm PCMPESTRI : SS42AI_pcmpestri; > +defm PCMPESTRIA : SS42AI_pcmpestri; > +defm PCMPESTRIC : SS42AI_pcmpestri; > +defm PCMPESTRIO : SS42AI_pcmpestri; > +defm PCMPESTRIS : SS42AI_pcmpestri; > +defm PCMPESTRIZ : SS42AI_pcmpestri; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From idadesub at users.sourceforge.net Wed Aug 19 01:40:29 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Wed, 19 Aug 2009 06:40:29 -0000 Subject: [llvm-commits] [llvm] r79410 - in /llvm/trunk: bindings/ocaml/bitreader/bitreader_ocaml.c bindings/ocaml/bitreader/llvm_bitreader.ml bindings/ocaml/bitreader/llvm_bitreader.mli bindings/ocaml/llvm/llvm.ml bindings/ocaml/llvm/llvm.mli bindings/ocaml/llvm/llvm_ocaml.c test/Bindings/Ocaml/analysis.ml test/Bindings/Ocaml/bitreader.ml test/Bindings/Ocaml/bitwriter.ml test/Bindings/Ocaml/executionengine.ml test/Bindings/Ocaml/scalar_opts.ml test/Bindings/Ocaml/target.ml test/Bindings/Ocaml/vmcore.ml Message-ID: <200908190640.n7J6eUjg001342@zion.cs.uiuc.edu> Author: erickt Date: Wed Aug 19 01:40:29 2009 New Revision: 79410 URL: http://llvm.org/viewvc/llvm-project?rev=79410&view=rev Log: Allow passing around LLVMContext in ocaml. Modified: llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli llvm/trunk/bindings/ocaml/llvm/llvm.ml llvm/trunk/bindings/ocaml/llvm/llvm.mli llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c llvm/trunk/test/Bindings/Ocaml/analysis.ml llvm/trunk/test/Bindings/Ocaml/bitreader.ml llvm/trunk/test/Bindings/Ocaml/bitwriter.ml llvm/trunk/test/Bindings/Ocaml/executionengine.ml llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml llvm/trunk/test/Bindings/Ocaml/target.ml llvm/trunk/test/Bindings/Ocaml/vmcore.ml Modified: llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c Wed Aug 19 01:40:29 2009 @@ -45,27 +45,29 @@ /*===-- Modules -----------------------------------------------------------===*/ -/* Llvm.llmemorybuffer -> Llvm.module */ -CAMLprim value llvm_get_module_provider(LLVMMemoryBufferRef MemBuf) { +/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */ +CAMLprim value llvm_get_module_provider(LLVMContextRef C, + LLVMMemoryBufferRef MemBuf) { CAMLparam0(); CAMLlocal2(Variant, MessageVal); char *Message; LLVMModuleProviderRef MP; - if (LLVMGetBitcodeModuleProvider(MemBuf, &MP, &Message)) + if (LLVMGetBitcodeModuleProviderInContext(C, MemBuf, &MP, &Message)) llvm_raise(llvm_bitreader_error_exn, Message); CAMLreturn((value) MemBuf); } -/* Llvm.llmemorybuffer -> Llvm.llmodule */ -CAMLprim value llvm_parse_bitcode(LLVMMemoryBufferRef MemBuf) { +/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */ +CAMLprim value llvm_parse_bitcode(LLVMContextRef C, + LLVMMemoryBufferRef MemBuf) { CAMLparam0(); CAMLlocal2(Variant, MessageVal); LLVMModuleRef M; char *Message; - if (LLVMParseBitcode(MemBuf, &M, &Message)) + if (LLVMParseBitcodeInContext(C, MemBuf, &M, &Message)) llvm_raise(llvm_bitreader_error_exn, Message); CAMLreturn((value) M); Modified: llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml (original) +++ llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml Wed Aug 19 01:40:29 2009 @@ -13,7 +13,9 @@ external register_exns : exn -> unit = "llvm_register_bitreader_exns" let _ = register_exns (Error "") -external get_module_provider : Llvm.llmemorybuffer -> Llvm.llmoduleprovider +external get_module_provider : Llvm.llcontext -> Llvm.llmemorybuffer -> + Llvm.llmoduleprovider = "llvm_get_module_provider" -external parse_bitcode : Llvm.llmemorybuffer -> Llvm.llmodule + +external parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule = "llvm_parse_bitcode" Modified: llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli (original) +++ llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli Wed Aug 19 01:40:29 2009 @@ -14,16 +14,18 @@ exception Error of string -(** [read_bitcode_file path] reads the bitcode for a new module [m] from the - file at [path]. Returns [Success m] if successful, and [Failure msg] - otherwise, where [msg] is a description of the error encountered. - See the function [llvm::getBitcodeModuleProvider]. *) -external get_module_provider : Llvm.llmemorybuffer -> Llvm.llmoduleprovider +(** [get_module_provider context mb] reads the bitcode for a new + module provider [m] from the memory buffer [mb] in the context [context]. + Returns [m] if successful, or raises [Error msg] otherwise, where [msg] is a + description of the error encountered. See the function + [llvm::getBitcodeModuleProvider]. *) +external get_module_provider : Llvm.llcontext -> Llvm.llmemorybuffer -> + Llvm.llmoduleprovider = "llvm_get_module_provider" -(** [parse_bitcode mb] parses the bitcode for a new module [m] from the memory - buffer [mb]. Returns [Success m] if successful, and [Failure msg] otherwise, - where [msg] is a description of the error encountered. - See the function [llvm::ParseBitcodeFile]. *) -external parse_bitcode : Llvm.llmemorybuffer -> Llvm.llmodule +(** [parse_bitcode context mb] parses the bitcode for a new module [m] from the + memory buffer [mb] in the context [context]. Returns [m] if successful, or + raises [Error msg] otherwise, where [msg] is a description of the error + encountered. See the function [llvm::ParseBitcodeFile]. *) +external parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule = "llvm_parse_bitcode" Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.ml (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Wed Aug 19 01:40:29 2009 @@ -8,6 +8,7 @@ *===----------------------------------------------------------------------===*) +type llcontext type llmodule type lltype type lltypehandle @@ -127,10 +128,13 @@ | At_start of 'a | After of 'b +(*===-- Contexts ----------------------------------------------------------===*) +external create_context : unit -> llcontext = "llvm_create_context" +external dispose_context : unit -> llcontext = "llvm_dispose_context" +external global_context : unit -> llcontext = "llvm_global_context" (*===-- Modules -----------------------------------------------------------===*) - -external create_module : string -> llmodule = "llvm_create_module" +external create_module : llcontext -> string -> llmodule = "llvm_create_module" external dispose_module : llmodule -> unit = "llvm_dispose_module" external target_triple: llmodule -> string = "llvm_target_triple" @@ -147,8 +151,8 @@ external dump_module : llmodule -> unit = "llvm_dump_module" (*===-- Types -------------------------------------------------------------===*) - external classify_type : lltype -> TypeKind.t = "llvm_classify_type" +external type_context : lltype -> llcontext = "llvm_type_context" (*--... Operations on integer types ........................................--*) external _i1_type : unit -> lltype = "llvm_i1_type" @@ -188,8 +192,9 @@ external param_types : lltype -> lltype array = "llvm_param_types" (*--... Operations on struct types .........................................--*) -external struct_type : lltype array -> lltype = "llvm_struct_type" -external packed_struct_type : lltype array -> lltype = "llvm_packed_struct_type" +external struct_type : llcontext -> lltype array -> lltype = "llvm_struct_type" +external packed_struct_type : llcontext -> lltype array -> lltype + = "llvm_packed_struct_type" external element_types : lltype -> lltype array = "llvm_element_types" external is_packed : lltype -> bool = "llvm_is_packed" @@ -247,8 +252,9 @@ external const_string : string -> llvalue = "llvm_const_string" external const_stringz : string -> llvalue = "llvm_const_stringz" external const_array : lltype -> llvalue array -> llvalue = "llvm_const_array" -external const_struct : llvalue array -> llvalue = "llvm_const_struct" -external const_packed_struct : llvalue array -> llvalue +external const_struct : llcontext -> llvalue array -> llvalue + = "llvm_const_struct" +external const_packed_struct : llcontext -> llvalue array -> llvalue = "llvm_const_packed_struct" external const_vector : llvalue array -> llvalue = "llvm_const_vector" @@ -654,20 +660,20 @@ (*===-- Instruction builders ----------------------------------------------===*) -external builder : unit -> llbuilder = "llvm_builder" +external builder : llcontext -> llbuilder = "llvm_builder" external position_builder : (llbasicblock, llvalue) llpos -> llbuilder -> unit = "llvm_position_builder" external insertion_block : llbuilder -> llbasicblock = "llvm_insertion_block" external insert_into_builder : llvalue -> string -> llbuilder -> unit = "llvm_insert_into_builder" -let builder_at ip = - let b = builder () in +let builder_at context ip = + let b = builder context in position_builder ip b; b -let builder_before i = builder_at (Before i) -let builder_at_end bb = builder_at (At_end bb) +let builder_before context i = builder_at context (Before i) +let builder_at_end context bb = builder_at context (At_end bb) let position_before i = position_builder (Before i) let position_at_end bb = position_builder (At_end bb) Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Wed Aug 19 01:40:29 2009 @@ -17,6 +17,10 @@ These abstract types correlate directly to the LLVM VMCore classes. *) +(** The top-level container for all LLVM global data. See the + [llvm::LLVMContext] class. *) +type llcontext + (** The top-level container for all other LLVM Intermediate Representation (IR) objects. See the [llvm::Module] class. *) type llmodule @@ -188,12 +192,27 @@ exception IoError of string +(** {6 Contexts} *) + +(** [create_context ()] creates a context for storing the "global" state in + LLVM. See the constructor [llvm::LLVMContext]. *) +external create_context : unit -> llcontext = "llvm_create_context" + +(** [destroy_context ()] destroys a context. See the destructor + [llvm::LLVMContext::~LLVMContext]. *) +external dispose_context : unit -> llcontext = "llvm_dispose_context" + +(** See the function [llvm::getGlobalContext]. *) +external global_context : unit -> llcontext = "llvm_global_context" + + (** {6 Modules} *) -(** [create_module id] creates a module with the supplied module ID. Modules are - not garbage collected; it is mandatory to call {!dispose_module} to free - memory. See the constructor [llvm::Module::Module]. *) -external create_module : string -> llmodule = "llvm_create_module" +(** [create_module context id] creates a module with the supplied module ID in + the context [context]. Modules are not garbage collected; it is mandatory + to call {!dispose_module} to free memory. See the constructor + [llvm::Module::Module]. *) +external create_module : llcontext -> string -> llmodule = "llvm_create_module" (** [dispose_module m] destroys a module [m] and all of the IR objects it contained. All references to subordinate objects are invalidated; @@ -245,6 +264,10 @@ See the method [llvm::Type::getTypeID]. *) external classify_type : lltype -> TypeKind.t = "llvm_classify_type" +(** [type_context ty] returns the {!llcontext} corresponding to the type [ty]. + See the method [llvm::Type::getContext]. *) +external type_context : lltype -> llcontext = "llvm_type_context" + (** [string_of_lltype ty] returns a string describing the type [ty]. *) val string_of_lltype : lltype -> string @@ -321,13 +344,17 @@ (** {7 Operations on struct types} *) -(** [struct_type tys] returns the structure type containing in the types in the - array [tys]. See the method [llvm::StructType::get]. *) -external struct_type : lltype array -> lltype = "llvm_struct_type" - -(** [packed_struct_type tys] returns the packed structure type containing in the - types in the array [tys]. See the method [llvm::StructType::get]. *) -external packed_struct_type : lltype array -> lltype = "llvm_packed_struct_type" +(** [struct_type context tys] returns the structure type in the context + [context] containing in the types in the array [tys]. See the method + [llvm::StructType::get]. *) +external struct_type : llcontext -> lltype array -> lltype + = "llvm_struct_type" + +(** [packed_struct_type context ys] returns the packed structure type in the + context [context] containing in the types in the array [tys]. See the method + [llvm::StructType::get]. *) +external packed_struct_type : llcontext -> lltype array -> lltype + = "llvm_packed_struct_type" (** [element_types sty] returns the constituent types of the struct type [sty]. See the method [llvm::StructType::getElementType]. *) @@ -504,17 +531,19 @@ See the method [llvm::ConstantArray::get]. *) external const_array : lltype -> llvalue array -> llvalue = "llvm_const_array" -(** [const_struct elts] returns the structured constant of type - [struct_type (Array.map type_of elts)] and containing the values [elts]. - This value can in turn be used as the initializer for a global variable. - See the method [llvm::ConstantStruct::get]. *) -external const_struct : llvalue array -> llvalue = "llvm_const_struct" - -(** [const_packed_struct elts] returns the structured constant of type - {!packed_struct_type} [(Array.map type_of elts)] and containing the values - [elts]. This value can in turn be used as the initializer for a global - variable. See the method [llvm::ConstantStruct::get]. *) -external const_packed_struct : llvalue array -> llvalue +(** [const_struct context elts] returns the structured constant of type + [struct_type (Array.map type_of elts)] and containing the values [elts] + in the context [context]. This value can in turn be used as the initializer + for a global variable. See the method [llvm::ConstantStruct::get]. *) +external const_struct : llcontext -> llvalue array -> llvalue + = "llvm_const_struct" + +(** [const_packed_struct context elts] returns the structured constant of + type {!packed_struct_type} [(Array.map type_of elts)] and containing the + values [elts] in the context [context]. This value can in turn be used as + the initializer for a global variable. See the method + [llvm::ConstantStruct::get]. *) +external const_packed_struct : llcontext -> llvalue array -> llvalue = "llvm_const_packed_struct" (** [const_vector elts] returns the vector constant of type @@ -590,7 +619,7 @@ (** [const_exact_sdiv c1 c2] returns the constant quotient [c1 / c2] of two signed integer constants. The result is undefined if the result is rounded - or overflows. See the method [llvm::ConstantExpr::getExactSDiv]. *) + or overflows. See the method [llvm::ConstantExpr::getExactSDiv]. *) external const_exact_sdiv : llvalue -> llvalue -> llvalue = "LLVMConstExactSDiv" (** [const_fdiv c1 c2] returns the constant quotient [c1 / c2] of two floating @@ -757,7 +786,7 @@ = "LLVMConstIntCast" (** [const_fpcast c ty] returns a constant fpext, bitcast, or fptrunc for fp -> - fp casts of constant [c] to type [ty]. + fp casts of constant [c] to type [ty]. See the method [llvm::ConstantExpr::getFPCast]. *) external const_fpcast : llvalue -> lltype -> llvalue = "LLVMConstFPCast" @@ -1297,22 +1326,23 @@ (** {6 Instruction builders} *) -(** [builder ()] creates an instruction builder with no position. It is invalid - to use this builder until its position is set with {!position_before} or - {!position_at_end}. See the constructor for [llvm::LLVMBuilder]. *) -external builder : unit -> llbuilder = "llvm_builder" +(** [builder context] creates an instruction builder with no position in + the context [context]. It is invalid to use this builder until its position + is set with {!position_before} or {!position_at_end}. See the constructor + for [llvm::LLVMBuilder]. *) +external builder : llcontext -> llbuilder = "llvm_builder" (** [builder_at ip] creates an instruction builder positioned at [ip]. See the constructor for [llvm::LLVMBuilder]. *) -val builder_at : (llbasicblock, llvalue) llpos -> llbuilder +val builder_at : llcontext -> (llbasicblock, llvalue) llpos -> llbuilder (** [builder_before ins] creates an instruction builder positioned before the instruction [isn]. See the constructor for [llvm::LLVMBuilder]. *) -val builder_before : llvalue -> llbuilder +val builder_before : llcontext -> llvalue -> llbuilder (** [builder_at_end bb] creates an instruction builder positioned at the end of the basic block [bb]. See the constructor for [llvm::LLVMBuilder]. *) -val builder_at_end : llbasicblock -> llbuilder +val builder_at_end : llcontext -> llbasicblock -> llbuilder (** [position_builder ip bb] moves the instruction builder [bb] to the position [ip]. @@ -1648,7 +1678,7 @@ (** [build_global_stringptr str name b] creates a series of instructions that adds a global string pointer at the position specified by the instruction - builder [b]. + builder [b]. See the method [llvm::LLVMBuilder::CreateGlobalStringPtr]. *) external build_global_stringptr : string -> string -> llbuilder -> llvalue = "llvm_build_global_stringptr" @@ -1876,7 +1906,7 @@ (** [build_ptrdiff lhs rhs name b] creates a series of instructions that measure the difference between two pointer values at the position specified by the - instruction builder [b]. + instruction builder [b]. See the method [llvm::LLVMBuilder::CreatePtrDiff]. *) external build_ptrdiff : llvalue -> llvalue -> string -> llbuilder -> llvalue = "llvm_build_ptrdiff" Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Wed Aug 19 01:40:29 2009 @@ -92,6 +92,24 @@ } +/*===-- Contexts ----------------------------------------------------------===*/ + +/* unit -> llcontext */ +CAMLprim LLVMContextRef llvm_create_context(value Unit) { + return LLVMContextCreate(); +} + +/* llcontext -> unit */ +CAMLprim value llvm_dispose_context(LLVMContextRef C) { + LLVMContextDispose(C); + return Val_unit; +} + +/* unit -> llcontext */ +CAMLprim LLVMContextRef llvm_global_context(value Unit) { + return LLVMGetGlobalContext(); +} + /*===-- Modules -----------------------------------------------------------===*/ /* string -> llmodule */ @@ -153,6 +171,11 @@ return Val_int(LLVMGetTypeKind(Ty)); } +/* lltype -> llcontext */ +CAMLprim LLVMContextRef llvm_type_context(LLVMTypeRef Ty) { + return LLVMGetTypeContext(Ty); +} + /*--... Operations on integer types ........................................--*/ /* unit -> lltype */ @@ -228,16 +251,17 @@ /*--... Operations on struct types .........................................--*/ -/* lltype array -> lltype */ -CAMLprim LLVMTypeRef llvm_struct_type(value ElementTypes) { - return LLVMStructType((LLVMTypeRef *) ElementTypes, - Wosize_val(ElementTypes), 0); +/* llcontext -> lltype array -> lltype */ +CAMLprim LLVMTypeRef llvm_struct_type(LLVMContextRef C, value ElementTypes) { + return LLVMStructTypeInContext(C, (LLVMTypeRef *) ElementTypes, + Wosize_val(ElementTypes), 0); } -/* lltype array -> lltype */ -CAMLprim LLVMTypeRef llvm_packed_struct_type(value ElementTypes) { - return LLVMStructType((LLVMTypeRef *) ElementTypes, - Wosize_val(ElementTypes), 1); +/* llcontext -> lltype array -> lltype */ +CAMLprim LLVMTypeRef llvm_packed_struct_type(LLVMContextRef C, + value ElementTypes) { + return LLVMStructTypeInContext(C, (LLVMTypeRef *) ElementTypes, + Wosize_val(ElementTypes), 1); } /* lltype -> lltype array */ @@ -425,16 +449,17 @@ Wosize_val(ElementVals)); } -/* llvalue array -> llvalue */ -CAMLprim LLVMValueRef llvm_const_struct(value ElementVals) { - return LLVMConstStruct((LLVMValueRef *) Op_val(ElementVals), - Wosize_val(ElementVals), 0); +/* llcontext -> llvalue array -> llvalue */ +CAMLprim LLVMValueRef llvm_const_struct(LLVMContextRef C, value ElementVals) { + return LLVMConstStructInContext(C, (LLVMValueRef *) Op_val(ElementVals), + Wosize_val(ElementVals), 0); } -/* llvalue array -> llvalue */ -CAMLprim LLVMValueRef llvm_const_packed_struct(value ElementVals) { - return LLVMConstStruct((LLVMValueRef *) Op_val(ElementVals), - Wosize_val(ElementVals), 1); +/* llcontext -> llvalue array -> llvalue */ +CAMLprim LLVMValueRef llvm_const_packed_struct(LLVMContextRef C, + value ElementVals) { + return LLVMConstStructInContext(C, (LLVMValueRef *) Op_val(ElementVals), + Wosize_val(ElementVals), 1); } /* llvalue array -> llvalue */ @@ -905,9 +930,9 @@ return V; } -/* unit-> llbuilder */ -CAMLprim value llvm_builder(value Unit) { - return alloc_builder(LLVMCreateBuilder()); +/* llcontext -> llbuilder */ +CAMLprim value llvm_builder(LLVMContextRef C) { + return alloc_builder(LLVMCreateBuilderInContext(C)); } /* (llbasicblock, llvalue) llpos -> llbuilder -> unit */ Modified: llvm/trunk/test/Bindings/Ocaml/analysis.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/analysis.ml?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/analysis.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/analysis.ml Wed Aug 19 01:40:29 2009 @@ -16,9 +16,9 @@ let _ = let fty = function_type void_type [| |] in - let m = create_module "valid_m" in + let m = create_module (global_context ()) "valid_m" in let fn = define_function "valid_fn" fty m in - let at_entry = builder_at_end (entry_block fn) in + let at_entry = builder_at_end (global_context ()) (entry_block fn) in ignore (build_ret_void at_entry); Modified: llvm/trunk/test/Bindings/Ocaml/bitreader.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/bitreader.ml?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/bitreader.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/bitreader.ml Wed Aug 19 01:40:29 2009 @@ -6,11 +6,13 @@ (* Note that this takes a moment to link, so it's best to keep the number of individual tests low. *) +let context = Llvm.global_context () + let test x = if not x then exit 1 else () let _ = let fn = Sys.argv.(1) in - let m = Llvm.create_module "ocaml_test_module" in + let m = Llvm.create_module context "ocaml_test_module" in ignore (Llvm.define_type_name "caml_int_ty" Llvm.i32_type m); @@ -22,7 +24,7 @@ begin let mb = Llvm.MemoryBuffer.of_file fn in begin try - let m = Llvm_bitreader.parse_bitcode mb in + let m = Llvm_bitreader.parse_bitcode context mb in Llvm.dispose_module m with x -> Llvm.MemoryBuffer.dispose mb; @@ -43,7 +45,7 @@ begin let mb = Llvm.MemoryBuffer.of_file fn in let mp = begin try - Llvm_bitreader.get_module_provider mb + Llvm_bitreader.get_module_provider context mb with x -> Llvm.MemoryBuffer.dispose mb; raise x @@ -63,7 +65,7 @@ try let mb = Llvm.MemoryBuffer.of_file fn in let mp = begin try - Llvm_bitreader.get_module_provider mb + Llvm_bitreader.get_module_provider context mb with x -> Llvm.MemoryBuffer.dispose mb; raise x Modified: llvm/trunk/test/Bindings/Ocaml/bitwriter.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/bitwriter.ml?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/bitwriter.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/bitwriter.ml Wed Aug 19 01:40:29 2009 @@ -9,7 +9,7 @@ let test x = if not x then exit 1 else () let _ = - let m = Llvm.create_module "ocaml_test_module" in + let m = Llvm.create_module (Llvm.global_context ()) "ocaml_test_module" in ignore (Llvm.define_type_name "caml_int_ty" Llvm.i32_type m); Modified: llvm/trunk/test/Bindings/Ocaml/executionengine.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/executionengine.ml?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/executionengine.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/executionengine.ml Wed Aug 19 01:40:29 2009 @@ -19,14 +19,14 @@ define_function "main" (function_type i32_type [| i32_type; str_arr_type; str_arr_type |]) m in - let b = builder_at_end (entry_block fn) in + let b = builder_at_end (global_context ()) (entry_block fn) in ignore (build_ret (const_int i32_type retval) b); fn let define_plus m = let fn = define_function "plus" (function_type i32_type [| i32_type; i32_type |]) m in - let b = builder_at_end (entry_block fn) in + let b = builder_at_end (global_context ()) (entry_block fn) in let add = build_add (param fn 0) (param fn 1) "sum" b in ignore (build_ret add b) @@ -52,10 +52,10 @@ let test_executionengine () = (* create *) - let m = create_module "test_module" in + let m = create_module (global_context ()) "test_module" in let main = define_main_fn m 42 in - let m2 = create_module "test_module2" in + let m2 = create_module (global_context ()) "test_module2" in define_plus m2; let ee = ExecutionEngine.create (ModuleProvider.create m) in Modified: llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml Wed Aug 19 01:40:29 2009 @@ -19,7 +19,7 @@ (*===-- Fixture -----------------------------------------------------------===*) let filename = Sys.argv.(1) -let m = create_module filename +let m = create_module (global_context ()) filename let mp = ModuleProvider.create m @@ -30,7 +30,7 @@ let fty = function_type void_type [| |] in let fn = define_function "fn" fty m in - ignore (build_ret_void (builder_at_end (entry_block fn))); + ignore (build_ret_void (builder_at_end (global_context ()) (entry_block fn))); let td = TargetData.create (target_triple m) in Modified: llvm/trunk/test/Bindings/Ocaml/target.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/target.ml?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/target.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/target.ml Wed Aug 19 01:40:29 2009 @@ -8,7 +8,6 @@ open Llvm open Llvm_target - (* Tiny unit test framework - really just to help find which line is busted *) let suite name f = prerr_endline (name ^ ":"); @@ -18,14 +17,14 @@ (*===-- Fixture -----------------------------------------------------------===*) let filename = Sys.argv.(1) -let m = create_module filename +let m = create_module (global_context ()) filename (*===-- Target Data -------------------------------------------------------===*) let test_target_data () = let td = TargetData.create (target_triple m) in - let sty = struct_type [| i32_type; i64_type |] in + let sty = struct_type (global_context ()) [| i32_type; i64_type |] in ignore (TargetData.as_string td); ignore (TargetData.invalidate_struct_layout td sty); Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/vmcore.ml?rev=79410&r1=79409&r2=79410&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Wed Aug 19 01:40:29 2009 @@ -17,6 +17,7 @@ let group_name = ref "" let case_num = ref 0 let print_checkpoints = false +let context = global_context () let group name = group_name := !suite_name ^ "/" ^ name; @@ -47,7 +48,7 @@ (*===-- Fixture -----------------------------------------------------------===*) let filename = Sys.argv.(1) -let m = create_module filename +let m = create_module context filename let mp = ModuleProvider.create m @@ -270,20 +271,20 @@ one; two; one; two |] in ignore (define_global "Const08" c m); insist ((vector_type i16_type 8) = (type_of c)); - + (* RUN: grep {Const09.*.i16 1, i16 2, i32 3, i32 4} < %t.ll *) group "structure"; - let c = const_struct [| one; two; three; four |] in + let c = const_struct context [| one; two; three; four |] in ignore (define_global "Const09" c m); - insist ((struct_type [| i16_type; i16_type; i32_type; i32_type |]) + insist ((struct_type context [| i16_type; i16_type; i32_type; i32_type |]) = (type_of c)); (* RUN: grep {Const10.*zeroinit} < %t.ll *) group "null"; - let c = const_null (packed_struct_type [| i1_type; i8_type; - i64_type; double_type |]) in + let c = const_null (packed_struct_type context [| i1_type; i8_type; i64_type; + double_type |]) in ignore (define_global "Const10" c m); (* RUN: grep {Const11.*-1} < %t.ll @@ -496,7 +497,7 @@ insist (is_global_constant g); begin group "iteration"; - let m = create_module "temp" in + let m = create_module context "temp" in insist (At_end m = global_begin m); insist (At_start m = global_end m); @@ -556,7 +557,7 @@ let fn = define_function "Fn3" ty m in insist (not (is_declaration fn)); insist (1 = Array.length (basic_blocks fn)); - ignore (build_unreachable (builder_at_end (entry_block fn))); + ignore (build_unreachable (builder_at_end context (entry_block fn))); (* RUN: grep {define.*Fn4.*Param1.*Param2} < %t.ll *) @@ -570,7 +571,7 @@ insist (i64_type = type_of params.(1)); set_value_name "Param1" params.(0); set_value_name "Param2" params.(1); - ignore (build_unreachable (builder_at_end (entry_block fn))); + ignore (build_unreachable (builder_at_end context (entry_block fn))); (* RUN: grep {fastcc.*Fn5} < %t.ll *) @@ -579,7 +580,7 @@ insist (CallConv.c = function_call_conv fn); set_function_call_conv CallConv.fast fn; insist (CallConv.fast = function_call_conv fn); - ignore (build_unreachable (builder_at_end (entry_block fn))); + ignore (build_unreachable (builder_at_end context (entry_block fn))); begin group "gc"; (* RUN: grep {Fn6.*gc.*shadowstack} < %t.ll @@ -591,11 +592,11 @@ set_gc None fn; insist (None = gc fn); set_gc (Some "shadowstack") fn; - ignore (build_unreachable (builder_at_end (entry_block fn))); + ignore (build_unreachable (builder_at_end context (entry_block fn))); end; begin group "iteration"; - let m = create_module "temp" in + let m = create_module context "temp" in insist (At_end m = function_begin m); insist (At_start m = function_end m); @@ -625,7 +626,7 @@ let test_params () = begin group "iteration"; - let m = create_module "temp" in + let m = create_module context "temp" in let vf = define_function "void" (function_type void_type [| |]) m in @@ -674,7 +675,7 @@ let fn = declare_function "X" ty m in let bb = append_block "Bb1" fn in insist (bb = entry_block fn); - ignore (build_unreachable (builder_at_end bb)); + ignore (build_unreachable (builder_at_end context bb)); (* RUN: grep -v Bb2 < %t.ll *) @@ -688,15 +689,15 @@ let bbb = append_block "b" fn in let bba = insert_block "a" bbb in insist ([| bba; bbb |] = basic_blocks fn); - ignore (build_unreachable (builder_at_end bba)); - ignore (build_unreachable (builder_at_end bbb)); + ignore (build_unreachable (builder_at_end context bba)); + ignore (build_unreachable (builder_at_end context bbb)); (* RUN: grep Bb3 < %t.ll *) group "name/value"; let fn = define_function "X4" ty m in let bb = entry_block fn in - ignore (build_unreachable (builder_at_end bb)); + ignore (build_unreachable (builder_at_end context bb)); let bbv = value_of_block bb in set_value_name "Bb3" bbv; insist ("Bb3" = value_name bbv); @@ -704,13 +705,13 @@ group "casts"; let fn = define_function "X5" ty m in let bb = entry_block fn in - ignore (build_unreachable (builder_at_end bb)); + ignore (build_unreachable (builder_at_end context bb)); insist (bb = block_of_value (value_of_block bb)); insist (value_is_block (value_of_block bb)); insist (not (value_is_block (const_null i32_type))); begin group "iteration"; - let m = create_module "temp" in + let m = create_module context "temp" in let f = declare_function "Temp" (function_type i32_type [| |]) m in insist (At_end f = block_begin f); @@ -741,11 +742,11 @@ let test_instructions () = begin group "iteration"; - let m = create_module "temp" in + let m = create_module context "temp" in let fty = function_type void_type [| i32_type; i32_type |] in let f = define_function "f" fty m in let bb = entry_block f in - let b = builder_at (At_end bb) in + let b = builder_at context (At_end bb) in insist (At_end bb = instr_begin bb); insist (At_start bb = instr_end bb); @@ -778,7 +779,7 @@ begin group "parent"; insist (try - ignore (insertion_block (builder ())); + ignore (insertion_block (builder context)); false with Not_found -> true); @@ -786,7 +787,7 @@ let fty = function_type void_type [| i32_type |] in let fn = define_function "BuilderParent" fty m in let bb = entry_block fn in - let b = builder_at_end bb in + let b = builder_at_end context bb in let p = param fn 0 in let sum = build_add p p "sum" b in ignore (build_ret_void b); @@ -803,21 +804,21 @@ *) let fty = function_type void_type [| |] in let fn = declare_function "X6" fty m in - let b = builder_at_end (append_block "Bb01" fn) in + let b = builder_at_end context (append_block "Bb01" fn) in ignore (build_ret_void b) end; (* The rest of the tests will use one big function. *) let fty = function_type i32_type [| i32_type; i32_type |] in let fn = define_function "X7" fty m in - let atentry = builder_at_end (entry_block fn) in + let atentry = builder_at_end context (entry_block fn) in let p1 = param fn 0 ++ set_value_name "P1" in let p2 = param fn 1 ++ set_value_name "P2" in let f1 = build_uitofp p1 float_type "F1" atentry in let f2 = build_uitofp p2 float_type "F2" atentry in let bb00 = append_block "Bb00" fn in - ignore (build_unreachable (builder_at_end bb00)); + ignore (build_unreachable (builder_at_end context bb00)); group "ret"; begin (* RUN: grep {ret.*P1} < %t.ll @@ -830,7 +831,7 @@ (* RUN: grep {br.*Bb02} < %t.ll *) let bb02 = append_block "Bb02" fn in - let b = builder_at_end bb02 in + let b = builder_at_end context bb02 in ignore (build_br bb02 b) end; @@ -838,7 +839,7 @@ (* RUN: grep {br.*Inst01.*Bb03.*Bb00} < %t.ll *) let bb03 = append_block "Bb03" fn in - let b = builder_at_end bb03 in + let b = builder_at_end context bb03 in let cond = build_trunc p1 i1_type "Inst01" b in ignore (build_cond_br cond bb03 bb00 b) end; @@ -849,10 +850,10 @@ *) let bb1 = append_block "SwiBlock1" fn in let bb2 = append_block "SwiBlock2" fn in - ignore (build_unreachable (builder_at_end bb2)); + ignore (build_unreachable (builder_at_end context bb2)); let bb3 = append_block "SwiBlock3" fn in - ignore (build_unreachable (builder_at_end bb3)); - let si = build_switch p1 bb3 1 (builder_at_end bb1) in + ignore (build_unreachable (builder_at_end context bb3)); + let si = build_switch p1 bb3 1 (builder_at_end context bb1) in ignore (add_case si (const_int i32_type 2) bb2) end; @@ -861,7 +862,7 @@ * RUN: grep {to.*Bb04.*unwind.*Bb00} < %t.ll *) let bb04 = append_block "Bb04" fn in - let b = builder_at_end bb04 in + let b = builder_at_end context bb04 in ignore (build_invoke fn [| p1; p2 |] bb04 bb00 "Inst02" b) end; @@ -869,7 +870,7 @@ (* RUN: grep {unwind} < %t.ll *) let bb05 = append_block "Bb05" fn in - let b = builder_at_end bb05 in + let b = builder_at_end context bb05 in ignore (build_unwind b) end; @@ -877,13 +878,13 @@ (* RUN: grep {unreachable} < %t.ll *) let bb06 = append_block "Bb06" fn in - let b = builder_at_end bb06 in + let b = builder_at_end context bb06 in ignore (build_unreachable b) end; group "arithmetic"; begin let bb07 = append_block "Bb07" fn in - let b = builder_at_end bb07 in + let b = builder_at_end context bb07 in (* RUN: grep {Inst03.*add.*P1.*P2} < %t.ll * RUN: grep {Inst04.*sub.*P1.*Inst03} < %t.ll @@ -925,7 +926,7 @@ group "memory"; begin let bb08 = append_block "Bb08" fn in - let b = builder_at_end bb08 in + let b = builder_at_end context bb08 in (* RUN: grep {Inst20.*malloc.*i8 } < %t.ll * RUN: grep {Inst21.*malloc.*i8.*P1} < %t.ll @@ -1037,9 +1038,9 @@ let b2 = append_block "PhiBlock2" fn in let jb = append_block "PhiJoinBlock" fn in - ignore (build_br jb (builder_at_end b1)); - ignore (build_br jb (builder_at_end b2)); - let at_jb = builder_at_end jb in + ignore (build_br jb (builder_at_end context b1)); + ignore (build_br jb (builder_at_end context b2)); + let at_jb = builder_at_end context jb in let phi = build_phi [(p1, b1)] "PhiNode" at_jb in insist ([(p1, b1)] = incoming phi); @@ -1054,7 +1055,7 @@ (*===-- Module Provider ---------------------------------------------------===*) let test_module_provider () = - let m = create_module "test" in + let m = create_module context "test" in let mp = ModuleProvider.create m in ModuleProvider.dispose mp @@ -1073,7 +1074,7 @@ begin group "function pass manager"; let fty = function_type void_type [| |] in let fn = define_function "FunctionPassManager" fty m in - ignore (build_ret_void (builder_at_end (entry_block fn))); + ignore (build_ret_void (builder_at_end context (entry_block fn))); ignore (PassManager.create_function mp ++ PassManager.initialize From daniel at zuster.org Wed Aug 19 01:42:52 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 18 Aug 2009 23:42:52 -0700 Subject: [llvm-commits] PATCH: Add raw_svector_ostream direct vector output In-Reply-To: <6126FF4C-EE4E-4A07-BA92-E424483328E2@apple.com> References: <6a8523d60908182227x5bb096e7j5300ee3b54322ece@mail.gmail.com> <6126FF4C-EE4E-4A07-BA92-E424483328E2@apple.com> Message-ID: <6a8523d60908182342h3dbac381y636c7f087002fe85@mail.gmail.com> On Tue, Aug 18, 2009 at 11:06 PM, Ted Kremenek wrote: > On Aug 18, 2009, at 10:27 PM, Daniel Dunbar wrote: > >> I'm proposing as a patch because it has two downsides: >> 1. It exposes some bits of SmallVector; namely it adds a capacity() >> method, which gives the allocated size of the current buffer, and a >> set_size() method, which clients can use to forcibly set the vector >> size (without doing any construction or destruction). The use case is >> basically that clients will intentionally write past the end() of the >> vector (but not past the capacity() of the buffer), and then at some >> point call set_size() to update the vector size. > > Although there may be some aesthetic disagreement on this, I'm fine with > 'set_size()' being private and having raw_svector_ostream being a friend of > SmallVector. ?Exposing 'set_size()' as part of SmallVector's general > interface seems like a bad idea. I'm not really sure. Its not really an "unreasonable" API to expose, and there are definitely other places that I have wanted it. And I don't think it really constraints the SmallVector implementation, since there is more or less only one sensible implementation. But I agree it is non-standard; however I marginally treating it as part of the API instead of keeping it private. >> 2. It forces clients of raw_svector_ostream to provide a SmallVector >> with at least 128 bytes free. This is probably a good thing, but it >> isn't enforced by the API (it is enforced by a runtime check, of >> course). > > I certainly am probably missing something here, but since you're doing a > dynamic check anyway, why not just have raw_svector_ostream increase the > capacity on its own? > > For example, instead of using 'llvm_report_error', can we just grow the > small vector? We could, yes, but that would necessarily require an allocation, which we don't want. Instead we want to force clients to pass in a large enough buffer that the common case will be no allocation occurs. - Daniel From clattner at apple.com Wed Aug 19 01:42:54 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 18 Aug 2009 23:42:54 -0700 Subject: [llvm-commits] [llvm] r79358 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/Support/IOManip.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp In-Reply-To: <200908181922.n7IJMtJB013528@zion.cs.uiuc.edu> References: <200908181922.n7IJMtJB013528@zion.cs.uiuc.edu> Message-ID: <3B60E36A-F20A-45B2-8392-C8E3ABB2150F@apple.com> On Aug 18, 2009, at 12:22 PM, David Greene wrote: > Author: greened > Date: Tue Aug 18 14:22:55 2009 > New Revision: 79358 > > URL: http://llvm.org/viewvc/llvm-project?rev=79358&view=rev > Log: > > Make various changes suggested by Chris. Thanks David, Why did you add all the forward declarations and #include to AsmPrinter.h? -Chris > > Removed: > llvm/trunk/include/llvm/Support/IOManip.h > Modified: > llvm/trunk/include/llvm/CodeGen/AsmPrinter.h > llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=79358&r1=79357&r2=79358&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) > +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Aug 18 14:22:55 > 2009 > @@ -17,6 +17,7 @@ > #define LLVM_CODEGEN_ASMPRINTER_H > > #include "llvm/CodeGen/MachineFunctionPass.h" > +#include "llvm/Support/DebugLoc.h" > #include "llvm/Target/TargetMachine.h" > #include "llvm/ADT/DenseMap.h" > > @@ -24,15 +25,22 @@ > class GCStrategy; > class Constant; > class ConstantArray; > + class ConstantFP; > class ConstantInt; > class ConstantStruct; > class ConstantVector; > class GCMetadataPrinter; > + class GlobalValue; > class GlobalVariable; > + class MachineBasicBlock; > + class MachineFunction; > + class MachineInstr; > class MachineLoopInfo; > class MachineLoop; > + class MachineConstantPool; > class MachineConstantPoolEntry; > class MachineConstantPoolValue; > + class MachineJumpTableInfo; > class MachineModuleInfo; > class MCInst; > class MCContext; > @@ -67,11 +75,6 @@ > /// > MachineLoopInfo *LI; > > - /// PrintChildLoopComment - Print comments about child loops > - /// within the loop for this basic block, with nesting. > - /// > - void PrintChildLoopComment(const MachineLoop *loop) const; > - > protected: > /// MMI - If available, this is a pointer to the current > MachineModuleInfo. > MachineModuleInfo *MMI; > > Removed: llvm/trunk/include/llvm/Support/IOManip.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IOManip.h?rev=79357&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Support/IOManip.h (original) > +++ llvm/trunk/include/llvm/Support/IOManip.h (removed) > @@ -1,43 +0,0 @@ > -//===----------------- IOManip.h - iostream manipulators --------- > *- C++ -*===// > -// > -// The LLVM Compiler Infrastructure > -// > -// This file is distributed under the University of Illinois Open > Source > -// License. See LICENSE.TXT for details. > -// > -// > = > = > = > ----------------------------------------------------------------------= > ==// > -// > -// Manipulators to do special-purpose formatting. > -// > -// > = > = > = > ----------------------------------------------------------------------= > ==// > - > -namespace llvm { > - /// Indent - Insert spaces into the character output stream. The > - /// "level" is multiplied by the "scale" to calculate the number of > - /// spaces to insert. "level" can represent something like loop > - /// nesting level, for example. > - /// > - class Indent { > - public: > - explicit Indent(int lvl, int amt = 2) > - : level(lvl), scale(amt) {} > - > - template > - OStream &operator()(OStream &out) const { > - for(int i = 0; i < level*scale; ++i) { > - out << " "; > - } > - return out; > - } > - > - private: > - int level; > - int scale; > - }; > - > - template > - OStream &operator<<(OStream &out, const Indent &indent) > - { > - return(indent(out)); > - } > -} > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=79358&r1=79357&r2=79358&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Aug 18 > 14:22:55 2009 > @@ -18,6 +18,7 @@ > #include "llvm/Module.h" > #include "llvm/CodeGen/GCMetadataPrinter.h" > #include "llvm/CodeGen/MachineConstantPool.h" > +#include "llvm/CodeGen/MachineFunction.h" > #include "llvm/CodeGen/MachineJumpTableInfo.h" > #include "llvm/CodeGen/MachineLoopInfo.h" > #include "llvm/CodeGen/MachineModuleInfo.h" > @@ -30,7 +31,6 @@ > #include "llvm/Support/CommandLine.h" > #include "llvm/Support/ErrorHandling.h" > #include "llvm/Support/FormattedStream.h" > -#include "llvm/Support/IOManip.h" > #include "llvm/Support/Mangler.h" > #include "llvm/Target/TargetAsmInfo.h" > #include "llvm/Target/TargetData.h" > @@ -48,10 +48,6 @@ > AsmVerbose("asm-verbose", cl::desc("Add comments to directives."), > cl::init(cl::BOU_UNSET)); > > -static cl::opt > -AsmExuberant("asm-exuberant", cl::desc("Add many comments."), > - cl::init(cl::BOU_FALSE)); > - > char AsmPrinter::ID = 0; > AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm, > const TargetAsmInfo *T, bool VDef) > @@ -69,11 +65,6 @@ > case cl::BOU_TRUE: VerboseAsm = true; break; > case cl::BOU_FALSE: VerboseAsm = false; break; > } > - switch (AsmExuberant) { > - case cl::BOU_UNSET: ExuberantAsm = false; break; > - case cl::BOU_TRUE: ExuberantAsm = true; break; > - case cl::BOU_FALSE: ExuberantAsm = false; break; > - } > } > > AsmPrinter::~AsmPrinter() { > @@ -106,7 +97,7 @@ > AU.setPreservesAll(); > MachineFunctionPass::getAnalysisUsage(AU); > AU.addRequired(); > - if (ExuberantAsm) > + if (VerboseAsm) > AU.addRequired(); > } > > @@ -238,7 +229,7 @@ > CurrentFnName = Mang->getMangledName(MF.getFunction()); > IncrementFunctionNumber(); > > - if (ExuberantAsm) { > + if (VerboseAsm) { > LI = &getAnalysis(); > } > } > @@ -1802,10 +1793,50 @@ > } > } > > +/// Indent - Insert spaces into the character output stream. The > +/// "level" is multiplied by the "scale" to calculate the number of > +/// spaces to insert. "level" can represent something like loop > +/// nesting level, for example. > +/// > +static formatted_raw_ostream & > +Indent(formatted_raw_ostream &out, int level, int scale = 2) { > + for(int i = 0; i < level*scale; ++i) { > + out << " "; > + } > + return out; > +} > + > +/// PrintChildLoopComment - Print comments about child loops within > +/// the loop for this basic block, with nesting. > +/// > +static void PrintChildLoopComment(formatted_raw_ostream &O, > + const MachineLoop *loop, > + const TargetAsmInfo *TAI, > + int FunctionNumber) { > + // Add child loop information > + for(MachineLoop::iterator cl = loop->begin(), > + clend = loop->end(); > + cl != clend; > + ++cl) { > + MachineBasicBlock *Header = (*cl)->getHeader(); > + assert(Header && "No header for loop"); > + > + O << '\n'; > + O.PadToColumn(TAI->getCommentColumn()); > + > + O << TAI->getCommentString(); > + Indent(O, (*cl)->getLoopDepth()-1) > + << " Child Loop BB" << FunctionNumber << "_" > + << Header->getNumber() << " Depth " << (*cl)->getLoopDepth(); > + > + PrintChildLoopComment(O, *cl, TAI, FunctionNumber); > + } > +} > + > /// EmitComments - Pretty-print comments for basic blocks > void AsmPrinter::EmitComments(const MachineBasicBlock &MBB) const > { > - if (ExuberantAsm) { > + if (VerboseAsm) { > // Add loop depth information > const MachineLoop *loop = LI->getLoopFor(&MBB); > > @@ -1823,7 +1854,7 @@ > > if (Header == &MBB) { > O << TAI->getCommentString() << " Loop Header"; > - PrintChildLoopComment(loop); > + PrintChildLoopComment(O, loop, TAI, getFunctionNumber()); > } > else { > O << TAI->getCommentString() << " Loop Header is BB" > @@ -1845,30 +1876,11 @@ > > O << '\n'; > O.PadToColumn(TAI->getCommentColumn()); > - O << TAI->getCommentString() << Indent(CurLoop->getLoopDepth > ()-1) > - << " Inside Loop BB" << getFunctionNumber() << "_" > + O << TAI->getCommentString(); > + Indent(O, CurLoop->getLoopDepth()-1) > + << " Inside Loop BB" << getFunctionNumber() << "_" > << Header->getNumber() << " Depth " << CurLoop- > >getLoopDepth(); > } > } > } > } > - > -void AsmPrinter::PrintChildLoopComment(const MachineLoop *loop) > const { > - // Add child loop information > - for(MachineLoop::iterator cl = loop->begin(), > - clend = loop->end(); > - cl != clend; > - ++cl) { > - MachineBasicBlock *Header = (*cl)->getHeader(); > - assert(Header && "No header for loop"); > - > - O << '\n'; > - O.PadToColumn(TAI->getCommentColumn()); > - > - O << TAI->getCommentString() << Indent((*cl)->getLoopDepth()-1) > - << " Child Loop BB" << getFunctionNumber() << "_" > - << Header->getNumber() << " Depth " << (*cl)->getLoopDepth(); > - > - PrintChildLoopComment(*cl); > - } > -} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From nicholas at mxc.ca Wed Aug 19 02:16:57 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 19 Aug 2009 07:16:57 -0000 Subject: [llvm-commits] [llvm] r79411 - in /llvm/trunk: lib/Transforms/Utils/SSI.cpp test/Transforms/SSI/2009-08-19-UnreachableBB2.ll Message-ID: <200908190716.n7J7Gvqr005931@zion.cs.uiuc.edu> Author: nicholas Date: Wed Aug 19 02:16:57 2009 New Revision: 79411 URL: http://llvm.org/viewvc/llvm-project?rev=79411&view=rev Log: Fix up PHI nodes correctly in the presence of unreachable BBs, part two. Also delete a newed pointer, and improve readability a little bit. Added: llvm/trunk/test/Transforms/SSI/2009-08-19-UnreachableBB2.ll Modified: llvm/trunk/lib/Transforms/Utils/SSI.cpp Modified: llvm/trunk/lib/Transforms/Utils/SSI.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSI.cpp?rev=79411&r1=79410&r2=79411&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SSI.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SSI.cpp Wed Aug 19 02:16:57 2009 @@ -226,10 +226,9 @@ for (BasicBlock::iterator begin = BB_succ->begin(), notPhi = BB_succ->getFirstNonPHI(); begin != *notPhi; ++begin) { Instruction *I = begin; - PHINode *PN; + PHINode *PN = dyn_cast(I); int position; - if ((PN = dyn_cast(I)) && ((position - = getPositionPhi(PN)) != -1)) { + if (PN && ((position = getPositionPhi(PN)) != -1)) { PN->addIncoming(value_stack[position].back(), BB); } } @@ -254,6 +253,8 @@ } } } + + delete defined; } /// Substitute any use in this instruction for the last definition of @@ -307,16 +308,16 @@ /// as an operand of another phi function used in the same BasicBlock, /// LLVM looks this as an error. So on the second phi, the first phi is called /// P and the BasicBlock it incomes is B. This P will be replaced by the value -/// it has for BasicBlock B. +/// it has for BasicBlock B. It also includes undef values for predecessors +/// that were not included in the phi. /// void SSI::fixPhis() { for (SmallPtrSet::iterator begin = phisToFix.begin(), end = phisToFix.end(); begin != end; ++begin) { PHINode *PN = *begin; for (unsigned i = 0, e = PN->getNumIncomingValues(); i < e; ++i) { - PHINode *PN_father; - if ((PN_father = dyn_cast(PN->getIncomingValue(i))) && - PN->getParent() == PN_father->getParent() && + PHINode *PN_father = dyn_cast(PN->getIncomingValue(i)); + if (PN_father && PN->getParent() == PN_father->getParent() && !DT_->dominates(PN->getParent(), PN->getIncomingBlock(i))) { BasicBlock *BB = PN->getIncomingBlock(i); int pos = PN_father->getBasicBlockIndex(BB); @@ -324,6 +325,28 @@ } } } + + for (DenseMapIterator begin = phis.begin(), + end = phis.end(); begin != end; ++begin) { + PHINode *PN = begin->first; + BasicBlock *BB = PN->getParent(); + pred_iterator PI = pred_begin(BB), PE = pred_end(BB); + SmallVector Preds(PI, PE); + for (unsigned size = Preds.size(); + PI != PE && PN->getNumIncomingValues() != size; ++PI) { + bool found = false; + for (unsigned i = 0, pn_end = PN->getNumIncomingValues(); + i < pn_end; ++i) { + if (PN->getIncomingBlock(i) == *PI) { + found = true; + break; + } + } + if (!found) { + PN->addIncoming(UndefValue::get(PN->getType()), *PI); + } + } + } } /// Return which variable (position on the vector of variables) this phi Added: llvm/trunk/test/Transforms/SSI/2009-08-19-UnreachableBB2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SSI/2009-08-19-UnreachableBB2.ll?rev=79411&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SSI/2009-08-19-UnreachableBB2.ll (added) +++ llvm/trunk/test/Transforms/SSI/2009-08-19-UnreachableBB2.ll Wed Aug 19 02:16:57 2009 @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | opt -ssi-everything -disable-output + +define void @foo() { +entry: + %tmp0 = load i64* undef, align 4 ; [#uses=3] + br i1 undef, label %end_stmt_playback, label %bb16 + +readJournalHdr.exit: ; No predecessors! + br label %end_stmt_playback + +bb16: ; preds = %bb7 + %tmp1 = icmp slt i64 0, %tmp0 ; [#uses=1] + br i1 %tmp1, label %bb16, label %bb17 + +bb17: ; preds = %bb16 + store i64 %tmp0, i64* undef, align 4 + br label %end_stmt_playback + +end_stmt_playback: ; preds = %bb17, %readJournalHdr.exit, %bb6, %bb2 + store i64 %tmp0, i64* undef, align 4 + ret void +} From nicholas at mxc.ca Wed Aug 19 02:22:51 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 19 Aug 2009 00:22:51 -0700 Subject: [llvm-commits] [llvm] r79411 - in /llvm/trunk: lib/Transforms/Utils/SSI.cpp test/Transforms/SSI/2009-08-19-UnreachableBB2.ll In-Reply-To: <200908190716.n7J7Gvqr005931@zion.cs.uiuc.edu> References: <200908190716.n7J7Gvqr005931@zion.cs.uiuc.edu> Message-ID: <4A8BA84B.4020206@mxc.ca> Nick Lewycky wrote: > Author: nicholas > Date: Wed Aug 19 02:16:57 2009 > New Revision: 79411 > > URL: http://llvm.org/viewvc/llvm-project?rev=79411&view=rev > Log: > Fix up PHI nodes correctly in the presence of unreachable BBs, part two. Also > delete a newed pointer, and improve readability a little bit. I forgot to attribute this. Patch by Andre Tavares! From baldrick at free.fr Wed Aug 19 02:29:48 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Aug 2009 09:29:48 +0200 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <4A8B2CE1.2000105@lip6.fr> References: <4A8B2CE1.2000105@lip6.fr> Message-ID: <4A8BA9EC.8090007@free.fr> Hi Nicolas, > I'd like to add a new option (REQUIRES_FP) in Makefile.rules to disable > the fomit-frame-pointer option when building. Here's the patch attached. > I need this because vmkit needs to walk the stack of a thread, and > functions from llvm may be in it. it should be possible to walk the stack without a frame pointer (the exception unwinder can do this for example). Ciao, Duncan. From baldrick at free.fr Wed Aug 19 02:33:21 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Aug 2009 09:33:21 +0200 Subject: [llvm-commits] [llvm] r79384 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp lib/Transforms/Scalar/SimplifyLibCalls.cpp test/Transforms/SimplifyLibCalls/weak-symbols.ll In-Reply-To: <200908190011.n7J0BDEJ017334@zion.cs.uiuc.edu> References: <200908190011.n7J0BDEJ017334@zion.cs.uiuc.edu> Message-ID: <4A8BAAC1.7090201@free.fr> Hi Dan, > - if (!GV || !GV->isConstant() || !GV->hasInitializer()) > + if (!GV || !GV->isConstant() || !GV->hasInitializer() || > + GV->mayBeOverridden()) there is a special method for testing this: GV->hasDefinitiveInitializer(). Ciao, Duncan. From echristo at apple.com Wed Aug 19 02:43:07 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 19 Aug 2009 00:43:07 -0700 Subject: [llvm-commits] [llvm] r79377 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86ISelLowering.h X86InstrFormats.td X86InstrSSE.td In-Reply-To: <66AB710C-E746-45BB-90DB-7AA49A371B78@apple.com> References: <200908182250.n7IMoX26007247@zion.cs.uiuc.edu> <66AB710C-E746-45BB-90DB-7AA49A371B78@apple.com> Message-ID: <7AB29094-CDF9-484A-825B-7A5A747DDB10@apple.com> > > Did you try writing the pattern as (set XMM0, (...))? > > Fixed registers work for other instructions, for example, we have: > > let Defs = [ECX, EFLAGS] in { > multiclass SS42AI_pcmpistri { > def rr : SS42AI<0x63, MRMSrcReg, (outs), > (ins VR128:$src1, VR128:$src2, i8imm:$src3), > "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", > [(set ECX, > (IntId128 VR128:$src1, VR128:$src2, imm:$src3)), > (implicit EFLAGS)]>, > OpSize; > > which produces a fixed result in ECX, doesn't the same work for XMM0? Nope, it can be any of a number of different register types and there is no register class for just XMM0. i.e. it comes out as MVT::Other. We could define a custom register class for it as about the only other way. -eric From idadesub at users.sourceforge.net Wed Aug 19 03:36:50 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Wed, 19 Aug 2009 08:36:50 -0000 Subject: [llvm-commits] [llvm] r79413 - /llvm/trunk/include/llvm-c/Core.h Message-ID: <200908190836.n7J8aofa028588@zion.cs.uiuc.edu> Author: erickt Date: Wed Aug 19 03:36:49 2009 New Revision: 79413 URL: http://llvm.org/viewvc/llvm-project?rev=79413&view=rev Log: Expose some extra functions to llvm-c Modified: llvm/trunk/include/llvm-c/Core.h Modified: llvm/trunk/include/llvm-c/Core.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=79413&r1=79412&r2=79413&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Core.h (original) +++ llvm/trunk/include/llvm-c/Core.h Wed Aug 19 03:36:49 2009 @@ -463,6 +463,7 @@ LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size); /* Constant expressions */ +LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty); LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty); LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal); LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal); @@ -674,7 +675,7 @@ /* Terminators */ LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef); LLVMValueRef LLVMBuildRet(LLVMBuilderRef, LLVMValueRef V); -LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef, LLVMValueRef RetVals, +LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef, LLVMValueRef *RetVals, unsigned N); LLVMValueRef LLVMBuildBr(LLVMBuilderRef, LLVMBasicBlockRef Dest); LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef, LLVMValueRef If, From idadesub at users.sourceforge.net Wed Aug 19 03:37:00 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Wed, 19 Aug 2009 08:37:00 -0000 Subject: [llvm-commits] [llvm] r79414 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Message-ID: <200908190837.n7J8b0rc028623@zion.cs.uiuc.edu> Author: erickt Date: Wed Aug 19 03:37:00 2009 New Revision: 79414 URL: http://llvm.org/viewvc/llvm-project?rev=79414&view=rev Log: Add the ocaml binding to LLVMBuildAggregateRet. Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=79414&r1=79413&r2=79414&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Wed Aug 19 03:37:00 2009 @@ -974,6 +974,12 @@ return LLVMBuildRet(Builder_val(B), Val); } +/* llvalue array -> llbuilder -> llvalue */ +CAMLprim LLVMValueRef llvm_build_aggregate_ret(value RetVals, value B) { + return LLVMBuildAggregateRet(Builder_val(B), (LLVMValueRef *) Op_val(RetVals), + Wosize_val(RetVals)); +} + /* llbasicblock -> llbuilder -> llvalue */ CAMLprim LLVMValueRef llvm_build_br(LLVMBasicBlockRef BB, value B) { return LLVMBuildBr(Builder_val(B), BB); From eli.friedman at gmail.com Wed Aug 19 03:46:10 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 19 Aug 2009 08:46:10 -0000 Subject: [llvm-commits] [llvm] r79415 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll Message-ID: <200908190846.n7J8kAOx029973@zion.cs.uiuc.edu> Author: efriedma Date: Wed Aug 19 03:46:10 2009 New Revision: 79415 URL: http://llvm.org/viewvc/llvm-project?rev=79415&view=rev Log: PR4737: Fix a nasty bug in load narrowing with non-power-of-two types. Added: llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=79415&r1=79414&r2=79415&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Aug 19 03:46:10 2009 @@ -3466,7 +3466,8 @@ // Is the shift amount a multiple of size of VT? if ((ShAmt & (EVTBits-1)) == 0) { N0 = N0.getOperand(0); - if (N0.getValueType().getSizeInBits() <= EVTBits) + // Is the load width a multiple of size of VT? + if ((N0.getValueType().getSizeInBits() & (EVTBits-1)) != 0) return SDValue(); } } Added: llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll?rev=79415&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll Wed Aug 19 03:46:10 2009 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=x86 | FileCheck %s + + at a = external global i96, align 4 + at b = external global i64, align 8 + +define void @c() nounwind { +; CHECK: movl a+8, %eax + %srcval1 = load i96* @a, align 4 + %sroa.store.elt2 = lshr i96 %srcval1, 64 + %tmp = trunc i96 %sroa.store.elt2 to i64 +; CHECK: movl %eax, b +; CHECK: movl $0, b+4 + store i64 %tmp, i64* @b, align 8 + ret void +} From baldrick at free.fr Wed Aug 19 06:53:12 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Aug 2009 13:53:12 +0200 Subject: [llvm-commits] [llvm] r79415 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll In-Reply-To: <200908190846.n7J8kAOx029973@zion.cs.uiuc.edu> References: <200908190846.n7J8kAOx029973@zion.cs.uiuc.edu> Message-ID: <4A8BE7A8.3040400@free.fr> Hi Eli, > + // Is the load width a multiple of size of VT? > + if ((N0.getValueType().getSizeInBits() & (EVTBits-1)) != 0) if EVTBits is not a power of two, then this doesn't check that VT.getSizeInBits() is a multiple of EVTBits. For example, if EVTBits is 3 and VT.getSizeInBits() is 4. Ciao, Duncan. From benny.kra at googlemail.com Wed Aug 19 07:16:17 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 19 Aug 2009 12:16:17 -0000 Subject: [llvm-commits] [llvm] r79417 - /llvm/trunk/tools/bugpoint/ToolRunner.cpp Message-ID: <200908191216.n7JCGIrL026719@zion.cs.uiuc.edu> Author: d0k Date: Wed Aug 19 07:16:17 2009 New Revision: 79417 URL: http://llvm.org/viewvc/llvm-project?rev=79417&view=rev Log: Add a hack to unbreak MSVC builds. str(n)casecmp are POSIX functions and aren't available on windows (mingw defines them though). Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=79417&r1=79416&r2=79417&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original) +++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Wed Aug 19 07:16:17 2009 @@ -604,6 +604,11 @@ // GCC abstraction // +#ifdef _MSC_VER +#define strcasecmp(s1, s2) _stricmp(s1, s2) +#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) +#endif + static bool IsARMArchitecture(std::vector Args) { From xerxes at zafena.se Wed Aug 19 07:33:33 2009 From: xerxes at zafena.se (=?ISO-8859-1?Q?Xerxes_R=E5nby?=) Date: Wed, 19 Aug 2009 14:33:33 +0200 Subject: [llvm-commits] [patch] select correct cmake nativetarget CodeGen when ARCH!=X86 Message-ID: <4A8BF11D.6010000@zafena.se> This patch fixes cmake configuration issues, like the output below on ARM, for non X86 cmake builds. xerxes at debian:/usr/src/build/llvm-cmake$ cmake ../llvm -- Looking for mkdtemp -- Looking for mkdtemp - not found. -- Looking for mkstemp -- Looking for mkstemp - not found. -- Looking for mktemp -- Looking for mktemp - not found. -- Target triple: -- LLVM_HOSTTRIPLE: armv5tejl-unknown-linux-gnu -- Native target architecture is ARM -- Threads enabled. -- Targeting ARM -- Targeting CBackend -- Targeting CppBackend -- Target triple: CMake Error at cmake/modules/LLVMConfig.cmake:88 (message): Library LLVMX86CodeGen not found in list of llvm libraries. Call Stack (most recent call first): cmake/modules/LLVMConfig.cmake:27 (explicit_map_components_to_libraries) cmake/modules/LLVMConfig.cmake:20 (explicit_llvm_config) cmake/modules/AddLLVM.cmake:34 (llvm_config) cmake/modules/AddLLVM.cmake:48 (add_llvm_executable) tools/lli/CMakeLists.txt:3 (add_llvm_tool) ok to commit? Cheers Xerxes -------------- next part -------------- A non-text attachment was scrubbed... Name: cmake_nativetarget_CodeGen.patch Type: text/x-patch Size: 878 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090819/8217555f/attachment.bin From benny.kra at googlemail.com Wed Aug 19 07:38:51 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 19 Aug 2009 12:38:51 -0000 Subject: [llvm-commits] [llvm] r79418 - /llvm/trunk/tools/bugpoint/ToolRunner.cpp Message-ID: <200908191238.n7JCcpaG029462@zion.cs.uiuc.edu> Author: d0k Date: Wed Aug 19 07:38:51 2009 New Revision: 79418 URL: http://llvm.org/viewvc/llvm-project?rev=79418&view=rev Log: Proper MSVC build fix (and remove my hack again). Patch by Yonggang Luo. Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=79418&r1=79417&r2=79418&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original) +++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Wed Aug 19 07:38:51 2009 @@ -604,19 +604,14 @@ // GCC abstraction // -#ifdef _MSC_VER -#define strcasecmp(s1, s2) _stricmp(s1, s2) -#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) -#endif - static bool IsARMArchitecture(std::vector Args) { for (std::vector::const_iterator I = Args.begin(), E = Args.end(); I != E; ++I) { - if (!strcasecmp(I->c_str(), "-arch")) { + if (!StringsEqualNoCase(*I, "-arch")) { ++I; - if ((I != E) && !strncasecmp(I->c_str(), "arm", strlen("arm"))) { + if ((I != E) && !StringsEqualNoCase(I->c_str(), "arm", strlen("arm"))) { return true; } } From baldrick at free.fr Wed Aug 19 07:41:53 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Aug 2009 12:41:53 -0000 Subject: [llvm-commits] [llvm] r79419 - /llvm/trunk/cmake/modules/LLVMConfig.cmake Message-ID: <200908191241.n7JCfrDF029857@zion.cs.uiuc.edu> Author: baldrick Date: Wed Aug 19 07:41:52 2009 New Revision: 79419 URL: http://llvm.org/viewvc/llvm-project?rev=79419&view=rev Log: Fix cmake build on non-x86 targets. Patch by Xerxes R?nby. Modified: llvm/trunk/cmake/modules/LLVMConfig.cmake Modified: llvm/trunk/cmake/modules/LLVMConfig.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMConfig.cmake?rev=79419&r1=79418&r2=79419&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVMConfig.cmake (original) +++ llvm/trunk/cmake/modules/LLVMConfig.cmake Wed Aug 19 07:41:52 2009 @@ -59,11 +59,9 @@ list(APPEND expanded_components "LLVM${c}Info") endif() elseif( c STREQUAL "native" ) - # TODO: we assume ARCH is X86. - list(APPEND expanded_components "LLVMX86CodeGen") + list(APPEND expanded_components "LLVM${LLVM_NATIVE_ARCH}CodeGen") elseif( c STREQUAL "nativecodegen" ) - # TODO: we assume ARCH is X86. - list(APPEND expanded_components "LLVMX86CodeGen") + list(APPEND expanded_components "LLVM${LLVM_NATIVE_ARCH}CodeGen") elseif( c STREQUAL "backend" ) # same case as in `native'. elseif( c STREQUAL "engine" ) From baldrick at free.fr Wed Aug 19 07:42:17 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Aug 2009 14:42:17 +0200 Subject: [llvm-commits] [patch] select correct cmake nativetarget CodeGen when ARCH!=X86 In-Reply-To: <4A8BF11D.6010000@zafena.se> References: <4A8BF11D.6010000@zafena.se> Message-ID: <4A8BF329.9010903@free.fr> Hi Xerxes, > This patch fixes cmake configuration issues, like the output below on > ARM, for non X86 cmake builds. I've applied it - thanks! Ciao, Duncan. From edwintorok at gmail.com Wed Aug 19 07:54:55 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Wed, 19 Aug 2009 15:54:55 +0300 Subject: [llvm-commits] [patch] select correct cmake nativetarget CodeGen when ARCH!=X86 In-Reply-To: <4A8BF329.9010903@free.fr> References: <4A8BF11D.6010000@zafena.se> <4A8BF329.9010903@free.fr> Message-ID: <4A8BF61F.40006@gmail.com> On 2009-08-19 15:42, Duncan Sands wrote: > Hi Xerxes, > > >> This patch fixes cmake configuration issues, like the output below on >> ARM, for non X86 cmake builds. >> > > I've applied it - thanks! > > I think he could have commited it himself. On 2009-08-19 15:33, Xerxes R?nby wrote: > ok to commit? > And was only asking for permission. Best regards, --Edwin From mrs at apple.com Wed Aug 19 08:25:31 2009 From: mrs at apple.com (Mike Stump) Date: Wed, 19 Aug 2009 06:25:31 -0700 Subject: [llvm-commits] [llvm] r79415 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll In-Reply-To: <200908190846.n7J8kAOx029973@zion.cs.uiuc.edu> References: <200908190846.n7J8kAOx029973@zion.cs.uiuc.edu> Message-ID: <0B1E8F71-EF2F-406E-8094-9D29022DAF46@apple.com> On Aug 19, 2009, at 1:46 AM, Eli Friedman wrote: > Author: efriedma > Date: Wed Aug 19 03:46:10 2009 > New Revision: 79415 > > URL: http://llvm.org/viewvc/llvm-project?rev=79415&view=rev > Log: > PR4737: Fix a nasty bug in load narrowing with non-power-of-two types. This fails on i386-darwin9, powerpc-darwin8, x86_64-darwin10.... :-( From deeppatel1987 at gmail.com Wed Aug 19 10:07:40 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Wed, 19 Aug 2009 15:07:40 -0000 Subject: [llvm-commits] [llvm] r79424 - /llvm/trunk/CREDITS.TXT Message-ID: <200908191507.n7JF7e9Y018485@zion.cs.uiuc.edu> Author: sandeep Date: Wed Aug 19 10:07:40 2009 New Revision: 79424 URL: http://llvm.org/viewvc/llvm-project?rev=79424&view=rev Log: Test commit access with a first act of vanity. Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=79424&r1=79423&r2=79424&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Wed Aug 19 10:07:40 2009 @@ -269,6 +269,10 @@ D: GCC PCH Integration (llvm-gcc), llvm-gcc improvements D: Optimizer improvements, Loop Index Split +N: Sandeep Patel +E: deeppatel1987 at gmail.com +D: ARM calling conventions rewrite, hard float support + N: Vladimir Prus W: http://vladimir_prus.blogspot.com E: ghost at cs.msu.su From nicolas.geoffray at lip6.fr Wed Aug 19 11:00:07 2009 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 19 Aug 2009 18:00:07 +0200 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <4A8BA9EC.8090007@free.fr> References: <4A8B2CE1.2000105@lip6.fr> <4A8BA9EC.8090007@free.fr> Message-ID: <4A8C2187.1020808@lip6.fr> Duncan Sands wrote: > it should be possible to walk the stack without a frame pointer (the > exception unwinder can do this for example). > Yes I know , but I don't want to use the unwinder library (too heavy and inefficient). The frame pointer is the simplest thing. And using the unwider requires to set REQUIRES_EH in the make command line, so that doesn't make any difference (except that REQUIRES_EH is already there :)) Cheers, Nicolas > Ciao, > > Duncan. From baldrick at free.fr Wed Aug 19 11:08:00 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Aug 2009 18:08:00 +0200 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <4A8C2187.1020808@lip6.fr> References: <4A8B2CE1.2000105@lip6.fr> <4A8BA9EC.8090007@free.fr> <4A8C2187.1020808@lip6.fr> Message-ID: <4A8C2360.3010203@free.fr> Hi Nicolas, > Yes I know , but I don't want to use the unwinder library (too heavy and > inefficient). did you try libunwind? Was it also inefficient? Also, I think llvm itself has some intrinsics for walking the stack. Do they require a frame pointer? Ciao, Duncan. From david_goodwin at apple.com Wed Aug 19 11:08:58 2009 From: david_goodwin at apple.com (David Goodwin) Date: Wed, 19 Aug 2009 16:08:58 -0000 Subject: [llvm-commits] [llvm] r79425 - in /llvm/trunk: include/llvm/CodeGen/ScheduleDAG.h include/llvm/Target/TargetInstrItineraries.h include/llvm/Target/TargetSubtarget.h lib/CodeGen/ScheduleDAGInstrs.cpp lib/CodeGen/ScheduleDAGInstrs.h lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Message-ID: <200908191608.n7JG8wBC027883@zion.cs.uiuc.edu> Author: david_goodwin Date: Wed Aug 19 11:08:58 2009 New Revision: 79425 URL: http://llvm.org/viewvc/llvm-project?rev=79425&view=rev Log: Use the schedule itinerary operand use/def cycle information to adjust dependence edge latency for post-RA scheduling. Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h llvm/trunk/include/llvm/Target/TargetInstrItineraries.h llvm/trunk/include/llvm/Target/TargetSubtarget.h llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.h llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=79425&r1=79424&r2=79425&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Wed Aug 19 11:08:58 2009 @@ -495,6 +495,12 @@ /// virtual void ComputeLatency(SUnit *SU) = 0; + /// ComputeOperandLatency - Override dependence edge latency using + /// operand use/def information + /// + virtual void ComputeOperandLatency(SUnit *Def, SUnit *Use, + SDep& dep) const { }; + /// Schedule - Order nodes according to selected style, filling /// in the Sequence member. /// Modified: llvm/trunk/include/llvm/Target/TargetInstrItineraries.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrItineraries.h?rev=79425&r1=79424&r2=79425&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrItineraries.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrItineraries.h Wed Aug 19 11:08:58 2009 @@ -103,7 +103,7 @@ /// isEmpty - Returns true if there are no itineraries. /// bool isEmpty() const { return Itineratries == 0; } - + /// beginStage - Return the first stage of the itinerary. /// const InstrStage *beginStage(unsigned ItinClassIndx) const { @@ -118,20 +118,17 @@ return Stages + StageIdx; } - /// getLatency - Return the scheduling latency of the given class. A - /// simple latency value for an instruction is an over-simplification - /// for some architectures, but it's a reasonable first approximation. + /// getStageLatency - Return the total stage latency of the given + /// class. The latency is the maximum completion time for any stage + /// in the itinerary. /// - unsigned getLatency(unsigned ItinClassIndx) const { - // If the target doesn't provide latency information, use a simple - // non-zero default value for all instructions. + unsigned getStageLatency(unsigned ItinClassIndx) const { + // If the target doesn't provide itinerary information, use a + // simple non-zero default value for all instructions. if (isEmpty()) return 1; - // Caclulate the maximum completion time for any stage. The - // assumption is that all inputs are consumed at the start of the - // first stage and that all outputs are produced at the end of the - // latest completing last stage. + // Calculate the maximum completion time for any stage. unsigned Latency = 0, StartCycle = 0; for (const InstrStage *IS = beginStage(ItinClassIndx), *E = endStage(ItinClassIndx); IS != E; ++IS) { @@ -141,6 +138,21 @@ return Latency; } + + /// getOperandCycle - Return the cycle for the given class and + /// operand. Return -1 if no cycle is specified for the operand. + /// + int getOperandCycle(unsigned ItinClassIndx, unsigned OperandIdx) const { + if (isEmpty()) + return -1; + + unsigned FirstIdx = Itineratries[ItinClassIndx].FirstOperandCycle; + unsigned LastIdx = Itineratries[ItinClassIndx].LastOperandCycle; + if ((FirstIdx + OperandIdx) >= LastIdx) + return -1; + + return (int)OperandCycles[FirstIdx + OperandIdx]; + } }; Modified: llvm/trunk/include/llvm/Target/TargetSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetSubtarget.h?rev=79425&r1=79424&r2=79425&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetSubtarget.h (original) +++ llvm/trunk/include/llvm/Target/TargetSubtarget.h Wed Aug 19 11:08:58 2009 @@ -17,6 +17,7 @@ namespace llvm { class SDep; +class SUnit; //===----------------------------------------------------------------------===// /// @@ -40,7 +41,8 @@ // adjustSchedDependency - Perform target specific adjustments to // the latency of a schedule dependency. - virtual void adjustSchedDependency(SDep&) const { }; + virtual void adjustSchedDependency(SUnit *def, SUnit *use, + SDep& dep) const { }; }; } // End llvm namespace Modified: llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp?rev=79425&r1=79424&r2=79425&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp (original) +++ llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp Wed Aug 19 11:08:58 2009 @@ -210,6 +210,10 @@ // Optionally add in a special extra latency for nodes that // feed addresses. // TODO: Do this for register aliases too. + // TODO: Perhaps we should get rid of + // SpecialAddressLatency and just move this into + // adjustSchedDependency for the targets that care about + // it. if (SpecialAddressLatency != 0 && !UnitLatencies) { MachineInstr *UseMI = UseSU->getInstr(); const TargetInstrDesc &UseTID = UseMI->getDesc(); @@ -220,8 +224,14 @@ UseTID.OpInfo[RegUseIndex].isLookupPtrRegClass()) LDataLatency += SpecialAddressLatency; } + // Adjust the dependence latency using operand def/use + // information (if any), and then allow the target to + // perform its own adjustments. const SDep& dep = SDep(SU, SDep::Data, LDataLatency, Reg); - ST.adjustSchedDependency((SDep &)dep); + if (!UnitLatencies) { + ComputeOperandLatency(SU, UseSU, (SDep &)dep); + ST.adjustSchedDependency(SU, UseSU, (SDep &)dep); + } UseSU->addPred(dep); } } @@ -231,7 +241,10 @@ SUnit *UseSU = UseList[i]; if (UseSU != SU) { const SDep& dep = SDep(SU, SDep::Data, DataLatency, *Alias); - ST.adjustSchedDependency((SDep &)dep); + if (!UnitLatencies) { + ComputeOperandLatency(SU, UseSU, (SDep &)dep); + ST.adjustSchedDependency(SU, UseSU, (SDep &)dep); + } UseSU->addPred(dep); } } @@ -410,7 +423,7 @@ // Compute the latency for the node. SU->Latency = - InstrItins.getLatency(SU->getInstr()->getDesc().getSchedClass()); + InstrItins.getStageLatency(SU->getInstr()->getDesc().getSchedClass()); // Simplistic target-independent heuristic: assume that loads take // extra time. @@ -419,6 +432,50 @@ SU->Latency += 2; } +void ScheduleDAGInstrs::ComputeOperandLatency(SUnit *Def, SUnit *Use, + SDep& dep) const { + const InstrItineraryData &InstrItins = TM.getInstrItineraryData(); + if (InstrItins.isEmpty()) + return; + + // For a data dependency with a known register... + if ((dep.getKind() != SDep::Data) || (dep.getReg() == 0)) + return; + + const unsigned Reg = dep.getReg(); + + // ... find the definition of the register in the defining + // instruction + MachineInstr *DefMI = Def->getInstr(); + int DefIdx = DefMI->findRegisterDefOperandIdx(Reg); + if (DefIdx != -1) { + int DefCycle = InstrItins.getOperandCycle(DefMI->getDesc().getSchedClass(), DefIdx); + if (DefCycle >= 0) { + MachineInstr *UseMI = Use->getInstr(); + const unsigned UseClass = UseMI->getDesc().getSchedClass(); + + // For all uses of the register, calculate the maxmimum latency + int Latency = -1; + for (unsigned i = 0, e = UseMI->getNumOperands(); i != e; ++i) { + const MachineOperand &MO = UseMI->getOperand(i); + if (!MO.isReg() || !MO.isUse()) + continue; + unsigned MOReg = MO.getReg(); + if (MOReg != Reg) + continue; + + int UseCycle = InstrItins.getOperandCycle(UseClass, i); + if (UseCycle >= 0) + Latency = std::max(Latency, DefCycle - UseCycle + 1); + } + + // If we found a latency, then replace the existing dependence latency. + if (Latency >= 0) + dep.setLatency(Latency); + } + } +} + void ScheduleDAGInstrs::dumpNode(const SUnit *SU) const { SU->getInstr()->dump(); } Modified: llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.h?rev=79425&r1=79424&r2=79425&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.h (original) +++ llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.h Wed Aug 19 11:08:58 2009 @@ -160,6 +160,12 @@ /// virtual void ComputeLatency(SUnit *SU); + /// ComputeOperandLatency - Override dependence edge latency using + /// operand use/def information + /// + virtual void ComputeOperandLatency(SUnit *Def, SUnit *Use, + SDep& dep) const; + virtual MachineBasicBlock *EmitSchedule(); /// StartBlock - Prepare to perform scheduling in the given block. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp?rev=79425&r1=79424&r2=79425&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Wed Aug 19 11:08:58 2009 @@ -155,6 +155,9 @@ void ScheduleDAGSDNodes::AddSchedEdges() { const TargetSubtarget &ST = TM.getSubtarget(); + // Check to see if the scheduler cares about latencies. + bool UnitLatencies = ForceUnitLatencies(); + // Pass 2: add the preds, succs, etc. for (unsigned su = 0, e = SUnits.size(); su != e; ++su) { SUnit *SU = &SUnits[su]; @@ -212,8 +215,10 @@ const SDep& dep = SDep(OpSU, isChain ? SDep::Order : SDep::Data, OpSU->Latency, PhysReg); - if (!isChain) - ST.adjustSchedDependency((SDep &)dep); + if (!isChain && !UnitLatencies) { + ComputeOperandLatency(OpSU, SU, (SDep &)dep); + ST.adjustSchedDependency(OpSU, SU, (SDep &)dep); + } SU->addPred(dep); } @@ -242,8 +247,8 @@ for (SDNode *N = SU->getNode(); N; N = N->getFlaggedNode()) if (N->isMachineOpcode()) { SawMachineOpcode = true; - SU->Latency += - InstrItins.getLatency(TII->get(N->getMachineOpcode()).getSchedClass()); + SU->Latency += InstrItins. + getStageLatency(TII->get(N->getMachineOpcode()).getSchedClass()); } } From nicolas.geoffray at lip6.fr Wed Aug 19 11:10:09 2009 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 19 Aug 2009 18:10:09 +0200 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <9A550CA8-C19F-42F5-8731-9B1A234299CD@apple.com> References: <4A8B2CE1.2000105@lip6.fr> <9A550CA8-C19F-42F5-8731-9B1A234299CD@apple.com> Message-ID: <4A8C23E1.3040604@lip6.fr> Eric Christopher wrote: > > On Aug 18, 2009, at 3:36 PM, Nicolas Geoffray wrote: > >> Hi all, >> >> I'd like to add a new option (REQUIRES_FP) in Makefile.rules to >> disable the fomit-frame-pointer option when building. Here's the >> patch attached. I need this because vmkit needs to walk the stack of >> a thread, and functions from llvm may be in it. >> > > Quick question: As in things that are currently being compiled? No, C++ llvm functions that are in the llvm codebase. Like functions from JITEmitter and stuff. > Seems a bit odd that it's not executing code that's being walked up > but rather the compiler itself. When I'm using the JIT, functions from the llvm code base may be executing. > >> I don't know what's the policy for the Makefiles in general. Is it OK >> to apply that change? > > Sure if it's really necessary :) Great! Nicolas > > -eric From daniel at zuster.org Wed Aug 19 11:25:26 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 16:25:26 -0000 Subject: [llvm-commits] [llvm] r79426 - /llvm/trunk/lib/Support/raw_ostream.cpp Message-ID: <200908191625.n7JGPQBj030413@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 11:25:25 2009 New Revision: 79426 URL: http://llvm.org/viewvc/llvm-project?rev=79426&view=rev Log: Speculatively revert r79375, which may be breaking bootstrap, although in a rather obscure way (the other candidate is r79377). Modified: llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79426&r1=79425&r2=79426&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Aug 19 11:25:25 2009 @@ -123,24 +123,19 @@ } raw_ostream &raw_ostream::operator<<(unsigned long long N) { - // Handle simple case when value fits in long already. + // Output using 32-bit div/mod when possible. if (N == static_cast(N)) return this->operator<<(static_cast(N)); - // Otherwise divide into at two or three 10**9 chunks and write out using - // long div/mod, this is substantially faster on a 32-bit system. - unsigned long Top = 0, Mid = 0, Bot = N % 1000000000; - N /= 1000000000; - if (N > 1000000000) { - Mid = N % 1000000000; - Top = N / 1000000000; - } else - Mid = N; - - if (Top) - this->operator<<(static_cast(Top)); - this->operator<<(static_cast(Mid)); - return this->operator<<(static_cast(Bot)); + char NumberBuffer[20]; + char *EndPtr = NumberBuffer+sizeof(NumberBuffer); + char *CurPtr = EndPtr; + + while (N) { + *--CurPtr = '0' + char(N % 10); + N /= 10; + } + return write(CurPtr, EndPtr-CurPtr); } raw_ostream &raw_ostream::operator<<(long long N) { From daniel at zuster.org Wed Aug 19 11:25:53 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 16:25:53 -0000 Subject: [llvm-commits] [llvm] r79427 - /llvm/trunk/tools/llvm-mc/llvm-mc.cpp Message-ID: <200908191625.n7JGPrYn030484@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 11:25:53 2009 New Revision: 79427 URL: http://llvm.org/viewvc/llvm-project?rev=79427&view=rev Log: Fix a commento. Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=79427&r1=79426&r2=79427&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Wed Aug 19 11:25:53 2009 @@ -199,7 +199,7 @@ SourceMgr SrcMgr; - // Tell SrcMgr about this buffer, which is what TGParser will pick up. + // Tell SrcMgr about this buffer, which is what the parser will pick up. SrcMgr.AddNewSourceBuffer(Buffer, SMLoc()); // Record the location of the include directories so that the lexer can find From clattner at apple.com Wed Aug 19 11:32:37 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 19 Aug 2009 09:32:37 -0700 Subject: [llvm-commits] [llvm] r79418 - /llvm/trunk/tools/bugpoint/ToolRunner.cpp In-Reply-To: <200908191238.n7JCcpaG029462@zion.cs.uiuc.edu> References: <200908191238.n7JCcpaG029462@zion.cs.uiuc.edu> Message-ID: <2E66D807-EBB7-4704-819B-B3C6CC0C40CF@apple.com> On Aug 19, 2009, at 5:38 AM, Benjamin Kramer wrote: > Author: d0k > Date: Wed Aug 19 07:38:51 2009 > New Revision: 79418 > > URL: http://llvm.org/viewvc/llvm-project?rev=79418&view=rev > Log: > Proper MSVC build fix (and remove my hack again). Patch by Yonggang > Luo. Hi David, I see that you wrote "IsARMArchitecture". Would it make sense to pass the vector in by const reference instead of by copy? -Chris > > Modified: > llvm/trunk/tools/bugpoint/ToolRunner.cpp > > Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=79418&r1=79417&r2=79418&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original) > +++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Wed Aug 19 07:38:51 2009 > @@ -604,19 +604,14 @@ > // GCC abstraction > // > > -#ifdef _MSC_VER > -#define strcasecmp(s1, s2) _stricmp(s1, s2) > -#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) > -#endif > - > static bool > IsARMArchitecture(std::vector Args) > { > for (std::vector::const_iterator > I = Args.begin(), E = Args.end(); I != E; ++I) { > - if (!strcasecmp(I->c_str(), "-arch")) { > + if (!StringsEqualNoCase(*I, "-arch")) { > ++I; > - if ((I != E) && !strncasecmp(I->c_str(), "arm", > strlen("arm"))) { > + if ((I != E) && !StringsEqualNoCase(I->c_str(), "arm", > strlen("arm"))) { > return true; > } > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From rnk at mit.edu Wed Aug 19 11:44:51 2009 From: rnk at mit.edu (Reid Kleckner) Date: Wed, 19 Aug 2009 09:44:51 -0700 Subject: [llvm-commits] [llvm] r75828 - in /llvm/trunk/lib: CodeGen/ELF.h CodeGen/ELFCodeEmitter.cpp CodeGen/ELFWriter.cpp CodeGen/ELFWriter.h Target/X86/X86ELFWriterInfo.cpp In-Reply-To: <275e64e40907152033n32d71457p485084b17a6e856f@mail.gmail.com> References: <200907152049.n6FKnAiE002699@zion.cs.uiuc.edu> <16e5fdf90907151621o45abc01dkc493c6e1fa9eed94@mail.gmail.com> <275e64e40907152033n32d71457p485084b17a6e856f@mail.gmail.com> Message-ID: <9a9942200908190944p52139527j576263a308a6678c@mail.gmail.com> I just noticed that this patch introduces a memory leak for the ELFSym objects. When you clear out the vector, you need to delete all the pointers, or you could switch it back to being pass-by-value. Reid On Wed, Jul 15, 2009 at 8:33 PM, Bruno Cardoso Lopes wrote: > Hi Bill, > > On Wed, Jul 15, 2009 at 8:21 PM, Bill Wendling wrote: >> Hi Bruno, >> >>> --- llvm/trunk/lib/CodeGen/ELF.h (original) >>> +++ llvm/trunk/lib/CodeGen/ELF.h Wed Jul 15 15:49:10 2009 >>> @@ -52,6 +52,70 @@ >>> ? ? EV_CURRENT = 1 >>> ? }; >>> >>> + ?/// ELFSym - This struct contains information about each symbol that is >>> + ?/// added to logical symbol table for the module. ?This is eventually >>> + ?/// turned into a real symbol table in the file. >>> + ?struct ELFSym { >>> + ? ?// The global value this symbol matches. This should be null if the symbol >>> + ? ?// is not a global value. >>> + ? ?const GlobalValue *GV; >>> + >>> + ? ?// ELF specific fields >>> + ? ?unsigned NameIdx; ? ? ? ? // Index in .strtab of name, once emitted. >>> + ? ?uint64_t Value; >>> + ? ?unsigned Size; >>> + ? ?uint8_t Info; >>> + ? ?uint8_t Other; >>> + ? ?unsigned short SectionIdx; >>> + >>> + ? ?// Symbol index into the Symbol table >>> + ? ?unsigned SymTabIdx; >>> + >>> + ? ?enum { >>> + ? ? ?STB_LOCAL = 0, >>> + ? ? ?STB_GLOBAL = 1, >>> + ? ? ?STB_WEAK = 2 >>> + ? ?}; >>> + >>> + ? ?enum { >>> + ? ? ?STT_NOTYPE = 0, >>> + ? ? ?STT_OBJECT = 1, >>> + ? ? ?STT_FUNC = 2, >>> + ? ? ?STT_SECTION = 3, >>> + ? ? ?STT_FILE = 4 >>> + ? ?}; >>> + >> >> Please comment what these enums are for. >> >>> + ?// Emit a symbol for each section created until now, skip null section >>> + ?for (unsigned i = 1, e = SectionList.size(); i < e; ++i) { >> >> Please use iterators to go through this vector. >> >> >>> + ?for (unsigned i=0, e=SectionList.size(); i < e; ++i) { >>> + ? ?ELFSection &S = *SectionList[i]; >>> >> Same here. >> >> >>> + ?for (unsigned i = 0, e = SymbolList.size(); i < e; ++i) { >>> + ? ?ELFSym &Sym = *SymbolList[i]; >>> >> And here. >> >>> + ?for (i = 0, e = SymbolList.size(); i < e; ++i) { >> >> Ditto. >> >> >>> + ?for (i = 0, e = OtherSyms.size(); i < e; ++i) >> >> Same. >> >>> + ?// Emit all the symbols to the symbol table. >>> + ?for (unsigned i = 0, e = SymbolList.size(); i < e; ++i) { >> >> Ditto. >> >> >>> + ?for (unsigned i=0, e=SectionList.size(); i < e; ++i) { >> >> Here. >> >>> + ?// Adjust alignment of all section if needed, skip the null section. >>> + ?for (unsigned i=1, e=SectionList.size(); i < e; ++i) { >> >> Here. >> >> >>> + ?for (unsigned i=0, e=SectionList.size(); i < e; ++i) { >> >> Here. > > Ok! thanks :) > >> Thanks! >> -bw >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > > > -- > Bruno Cardoso Lopes > http://www.brunocardoso.cc > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From e0325716 at student.tuwien.ac.at Wed Aug 19 08:09:02 2009 From: e0325716 at student.tuwien.ac.at (Andreas Neustifter) Date: Wed, 19 Aug 2009 15:09:02 +0200 Subject: [llvm-commits] [PATCH] Add tests for Profiling Infrastructure Message-ID: <4A8BF96E.60100@student.tuwien.ac.at> Hi, I am working currently on the Profiling Infrastructure for LLVM, I have done some preliminary work and I also want to include some test files. I attach two files that I think can act as basis for further expanding the test coverage. What do you think of this tests? I'm planning to put them under test/Analysis/Profiling Thanks, Andi -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test0.c-O3.ll Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090819/0063f168/attachment.pl -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test1.c-O0.ll Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090819/0063f168/attachment-0001.pl From e0325716 at student.tuwien.ac.at Wed Aug 19 09:42:15 2009 From: e0325716 at student.tuwien.ac.at (Andreas Neustifter) Date: Wed, 19 Aug 2009 16:42:15 +0200 Subject: [llvm-commits] [PATCH] Clean up ProfileInfo Message-ID: <4A8C0F47.2020206@student.tuwien.ac.at> Hi, this patch cleans up the ProfileInfo by *) introducing new data type and export function of edge info for whole function (preparation for next patch) *) renaming variables to make clear distinction between data and containers that contain this data *) updated comments and whitespaces *) made ProfileInfo::MissingValue a double (as it should be...) Andi -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-r79420.rename.profile.info.patch Type: text/x-patch Size: 4191 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090819/4db53a35/attachment.bin From e0325716 at student.tuwien.ac.at Wed Aug 19 11:09:30 2009 From: e0325716 at student.tuwien.ac.at (Andreas Neustifter) Date: Wed, 19 Aug 2009 18:09:30 +0200 Subject: [llvm-commits] [PATCH] Preparation for Optimal Edge Profiling: Add calculation of maximum spanning tree. Message-ID: <4A8C23BA.5060800@student.tuwien.ac.at> Hi, this is a preparation patch for Optimal Edge Profiling, it adds a module to calculate the maximum spanning tree of an function according to an given ProfileInformation. Andi -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-r79423.max.spanning.tree.patch Type: text/x-patch Size: 8886 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090819/cea3d50e/attachment.bin From e0325716 at student.tuwien.ac.at Wed Aug 19 11:33:12 2009 From: e0325716 at student.tuwien.ac.at (Andreas Neustifter) Date: Wed, 19 Aug 2009 18:33:12 +0200 Subject: [llvm-commits] [PATCH] Preparation for Optimal Edge Profiling: Build libprofile as bytecode. Message-ID: <4A8C2948.9050504@student.tuwien.ac.at> Hi, this is a preparation patch for Optimal Edge Profiling, it provides building of the runtime library for profiling (./runtime/libprofile) as llvm bytecode. Andi -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-r79420.add.profile_rt.to.artifacts.patch Type: text/x-patch Size: 690 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090819/db36952b/attachment.bin From e0325716 at student.tuwien.ac.at Wed Aug 19 11:36:27 2009 From: e0325716 at student.tuwien.ac.at (Andreas Neustifter) Date: Wed, 19 Aug 2009 18:36:27 +0200 Subject: [llvm-commits] [PATCH] Cleanup and Improve ProfileEstimator and MaximumSpanningTree Message-ID: <4A8C2A0B.4010103@student.tuwien.ac.at> Since Daniel had some comments (see http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-August/024735.html) to an previous patch of mine that were not addressed, this is the follow-up to correct this issues. -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-r79423.comments.incooperated.patch Type: text/x-patch Size: 12363 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090819/ada500dd/attachment.bin From bob.wilson at apple.com Wed Aug 19 12:03:43 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 19 Aug 2009 17:03:43 -0000 Subject: [llvm-commits] [llvm] r79428 - in /llvm/trunk: lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMISelLowering.h lib/Target/ARM/ARMInstrNEON.td test/CodeGen/ARM/vext.ll Message-ID: <200908191703.n7JH3hQO003119@zion.cs.uiuc.edu> Author: bwilson Date: Wed Aug 19 12:03:43 2009 New Revision: 79428 URL: http://llvm.org/viewvc/llvm-project?rev=79428&view=rev Log: Add support for Neon VEXT (vector extract) shuffles. This is derived from a patch by Anton Korzh. I modified it to recognize the VEXT shuffles during legalization and lower them to a target-specific DAG node. Added: llvm/trunk/test/CodeGen/ARM/vext.ll Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=79428&r1=79427&r2=79428&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Aug 19 12:03:43 2009 @@ -487,6 +487,7 @@ case ARMISD::VST2D: return "ARMISD::VST2D"; case ARMISD::VST3D: return "ARMISD::VST3D"; case ARMISD::VST4D: return "ARMISD::VST4D"; + case ARMISD::VEXT: return "ARMISD::VEXT"; case ARMISD::VREV64: return "ARMISD::VREV64"; case ARMISD::VREV32: return "ARMISD::VREV32"; case ARMISD::VREV16: return "ARMISD::VREV16"; @@ -2343,6 +2344,41 @@ SplatBitSize, DAG); } +static bool isVEXTMask(ShuffleVectorSDNode *N, bool &ReverseVEXT, + unsigned &Imm) { + EVT VT = N->getValueType(0); + unsigned NumElts = VT.getVectorNumElements(); + ReverseVEXT = false; + Imm = N->getMaskElt(0); + + // If this is a VEXT shuffle, the immediate value is the index of the first + // element. The other shuffle indices must be the successive elements after + // the first one. + unsigned ExpectedElt = Imm; + for (unsigned i = 1; i < NumElts; ++i) { + + // Increment the expected index. If it wraps around, it may still be + // a VEXT but the source vectors must be swapped. + ExpectedElt += 1; + if (ExpectedElt == NumElts * 2) { + ExpectedElt = 0; + ReverseVEXT = true; + } + + if (ExpectedElt != static_cast(N->getMaskElt(i))) + return false; + } + + // Adjust the index value if the source operands will be swapped. + if (ReverseVEXT) + Imm -= NumElts; + + // VEXT only handles 8-bit elements so scale the index for larger elements. + Imm *= VT.getVectorElementType().getSizeInBits() / 8; + + return true; +} + /// isVREVMask - Check if a vector shuffle corresponds to a VREV /// instruction with the specified blocksize. (The order of the elements /// within each block of the vector is reversed.) @@ -2458,8 +2494,20 @@ return DAG.getNode(ARMISD::VDUP, dl, VT, Op0.getOperand(0)); } return DAG.getNode(ARMISD::VDUPLANE, dl, VT, SVN->getOperand(0), - DAG.getConstant(Lane, MVT::i32)); + DAG.getConstant(Lane, MVT::i32)); } + + bool ReverseVEXT; + unsigned Imm; + if (isVEXTMask(SVN, ReverseVEXT, Imm)) { + SDValue Op0 = SVN->getOperand(0); + SDValue Op1 = SVN->getOperand(1); + if (ReverseVEXT) + std::swap(Op0, Op1); + return DAG.getNode(ARMISD::VEXT, dl, VT, Op0, Op1, + DAG.getConstant(Imm, MVT::i32)); + } + if (isVREVMask(SVN, 64)) return DAG.getNode(ARMISD::VREV64, dl, VT, SVN->getOperand(0)); if (isVREVMask(SVN, 32)) Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=79428&r1=79427&r2=79428&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Wed Aug 19 12:03:43 2009 @@ -128,6 +128,7 @@ VST4D, // Vector shuffles: + VEXT, // extract VREV64, // reverse elements within 64-bit doublewords VREV32, // reverse elements within 32-bit words VREV16 // reverse elements within 16-bit halfwords Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=79428&r1=79427&r2=79428&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Wed Aug 19 12:03:43 2009 @@ -100,6 +100,10 @@ def NEONvst4d : SDNode<"ARMISD::VST4D", SDTARMVST4, [SDNPHasChain, SDNPMayStore]>; +def SDTARMVEXT : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>, + SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>; +def NEONvext : SDNode<"ARMISD::VEXT", SDTARMVEXT>; + def SDTARMVSHUF : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0, 1>]>; def NEONvrev64 : SDNode<"ARMISD::VREV64", SDTARMVSHUF>; def NEONvrev32 : SDNode<"ARMISD::VREV32", SDTARMVSHUF>; @@ -1941,6 +1945,21 @@ def VREV16d8 : VREV16D<0b00, "vrev16.8", v8i8>; def VREV16q8 : VREV16Q<0b00, "vrev16.8", v16i8>; +// Other Vector Shuffles. + +// VEXT : Vector Extract + +def VEXTd : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst), + (ins DPR:$lhs, DPR:$rhs, i32imm:$index), NoItinerary, + "vext.8\t$dst, $lhs, $rhs, $index", "", + [(set DPR:$dst, (v8i8 (NEONvext (v8i8 DPR:$lhs), + (v8i8 DPR:$rhs), imm:$index)))]>; +def VEXTq : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst), + (ins QPR:$lhs, QPR:$rhs, i32imm:$index), NoItinerary, + "vext.8\t$dst, $lhs, $rhs, $index", "", + [(set QPR:$dst, (v16i8 (NEONvext (v16i8 QPR:$lhs), + (v16i8 QPR:$rhs), imm:$index)))]>; + // VTRN : Vector Transpose def VTRNd8 : N2VDShuffle<0b00, 0b00001, "vtrn.8">; Added: llvm/trunk/test/CodeGen/ARM/vext.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vext.ll?rev=79428&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vext.ll (added) +++ llvm/trunk/test/CodeGen/ARM/vext.ll Wed Aug 19 12:03:43 2009 @@ -0,0 +1,37 @@ +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s + +define arm_apcscc <8 x i8> @test_vextd(<8 x i8>* %A, <8 x i8>* %B) nounwind { +;CHECK: test_vextd: +;CHECK: vext + %tmp1 = load <8 x i8>* %A + %tmp2 = load <8 x i8>* %B + %tmp3 = shufflevector <8 x i8> %tmp1, <8 x i8> %tmp2, <8 x i32> + ret <8 x i8> %tmp3 +} + +define arm_apcscc <8 x i8> @test_vextRd(<8 x i8>* %A, <8 x i8>* %B) nounwind { +;CHECK: test_vextRd: +;CHECK: vext + %tmp1 = load <8 x i8>* %A + %tmp2 = load <8 x i8>* %B + %tmp3 = shufflevector <8 x i8> %tmp1, <8 x i8> %tmp2, <8 x i32> + ret <8 x i8> %tmp3 +} + +define arm_apcscc <16 x i8> @test_vextq(<16 x i8>* %A, <16 x i8>* %B) nounwind { +;CHECK: test_vextq: +;CHECK: vext + %tmp1 = load <16 x i8>* %A + %tmp2 = load <16 x i8>* %B + %tmp3 = shufflevector <16 x i8> %tmp1, <16 x i8> %tmp2, <16 x i32> + ret <16 x i8> %tmp3 +} + +define arm_apcscc <16 x i8> @test_vextRq(<16 x i8>* %A, <16 x i8>* %B) nounwind { +;CHECK: test_vextRq: +;CHECK: vext + %tmp1 = load <16 x i8>* %A + %tmp2 = load <16 x i8>* %B + %tmp3 = shufflevector <16 x i8> %tmp1, <16 x i8> %tmp2, <16 x i32> + ret <16 x i8> %tmp3 +} From resistor at mac.com Wed Aug 19 12:07:46 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 19 Aug 2009 17:07:46 -0000 Subject: [llvm-commits] [llvm] r79429 - in /llvm/trunk: include/llvm/Support/LeakDetector.h lib/VMCore/LLVMContextImpl.h lib/VMCore/LeakDetector.cpp lib/VMCore/LeaksContext.h Message-ID: <200908191707.n7JH7kfx003634@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 19 12:07:46 2009 New Revision: 79429 URL: http://llvm.org/viewvc/llvm-project?rev=79429&view=rev Log: Reapply my less-lock-contention-in-leak-detector patch, now with new files actually added. Added: llvm/trunk/lib/VMCore/LeaksContext.h Modified: llvm/trunk/include/llvm/Support/LeakDetector.h llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/LeakDetector.cpp Modified: llvm/trunk/include/llvm/Support/LeakDetector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/LeakDetector.h?rev=79429&r1=79428&r2=79429&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/LeakDetector.h (original) +++ llvm/trunk/include/llvm/Support/LeakDetector.h Wed Aug 19 12:07:46 2009 @@ -56,9 +56,9 @@ /// The specified message will be printed indicating when the check was /// performed. /// - static void checkForGarbage(const std::string &Message) { + static void checkForGarbage(LLVMContext &C, const std::string &Message) { #ifndef NDEBUG - checkForGarbageImpl(Message); + checkForGarbageImpl(C, Message); #endif } @@ -83,7 +83,7 @@ static void removeGarbageObjectImpl(const Value *Object); static void addGarbageObjectImpl(void *Object); static void removeGarbageObjectImpl(void *Object); - static void checkForGarbageImpl(const std::string &Message); + static void checkForGarbageImpl(LLVMContext &C, const std::string &Message); }; } // End llvm namespace Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=79429&r1=79428&r2=79429&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Wed Aug 19 12:07:46 2009 @@ -16,6 +16,7 @@ #define LLVM_LLVMCONTEXT_IMPL_H #include "ConstantsContext.h" +#include "LeaksContext.h" #include "TypesContext.h" #include "llvm/LLVMContext.h" #include "llvm/Constants.h" @@ -134,6 +135,10 @@ ConstantInt *TheTrueVal; ConstantInt *TheFalseVal; + // Lock used for guarding access to the leak detector + sys::SmartMutex LLVMObjectsLock; + LeakDetectorImpl LLVMObjects; + // Lock used for guarding access to the type maps. sys::SmartMutex TypeMapLock; Modified: llvm/trunk/lib/VMCore/LeakDetector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LeakDetector.cpp?rev=79429&r1=79428&r2=79429&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LeakDetector.cpp (original) +++ llvm/trunk/lib/VMCore/LeakDetector.cpp Wed Aug 19 12:07:46 2009 @@ -11,129 +11,63 @@ // //===----------------------------------------------------------------------===// +#include "LLVMContextImpl.h" #include "llvm/Support/LeakDetector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Streams.h" -#include "llvm/System/RWMutex.h" +#include "llvm/System/Mutex.h" #include "llvm/System/Threading.h" #include "llvm/Value.h" using namespace llvm; -namespace { - template - struct VISIBILITY_HIDDEN PrinterTrait { - static void print(const T* P) { cerr << P; } - }; - - template<> - struct VISIBILITY_HIDDEN PrinterTrait { - static void print(const Value* P) { cerr << *P; } - }; - - ManagedStatic > LeakDetectorLock; - - template - struct VISIBILITY_HIDDEN LeakDetectorImpl { - explicit LeakDetectorImpl(const char* const name = "") : - Cache(0), Name(name) { } - - void clear() { - Cache = 0; - Ts.clear(); - } - - void setName(const char* n) { - Name = n; - } - - // Because the most common usage pattern, by far, is to add a - // garbage object, then remove it immediately, we optimize this - // case. When an object is added, it is not added to the set - // immediately, it is added to the CachedValue Value. If it is - // immediately removed, no set search need be performed. - void addGarbage(const T* o) { - sys::SmartScopedWriter Writer(*LeakDetectorLock); - if (Cache) { - assert(Ts.count(Cache) == 0 && "Object already in set!"); - Ts.insert(Cache); - } - Cache = o; - } - - void removeGarbage(const T* o) { - sys::SmartScopedWriter Writer(*LeakDetectorLock); - if (o == Cache) - Cache = 0; // Cache hit - else - Ts.erase(o); - } - - bool hasGarbage(const std::string& Message) { - addGarbage(0); // Flush the Cache - - sys::SmartScopedReader Reader(*LeakDetectorLock); - assert(Cache == 0 && "No value should be cached anymore!"); - - if (!Ts.empty()) { - cerr << "Leaked " << Name << " objects found: " << Message << ":\n"; - for (typename SmallPtrSet::iterator I = Ts.begin(), - E = Ts.end(); I != E; ++I) { - cerr << "\t"; - PrinterTrait::print(*I); - cerr << "\n"; - } - cerr << '\n'; - - return true; - } - - return false; - } - - private: - SmallPtrSet Ts; - const T* Cache; - const char* Name; - }; - - static ManagedStatic > Objects; - static ManagedStatic > LLVMObjects; - - static void clearGarbage() { - Objects->clear(); - LLVMObjects->clear(); - } +static ManagedStatic > ObjectsLock; +static ManagedStatic > Objects; + +static void clearGarbage(LLVMContext &Context) { + Objects->clear(); + Context.pImpl->LLVMObjects.clear(); } void LeakDetector::addGarbageObjectImpl(void *Object) { + sys::SmartScopedLock Lock(*ObjectsLock); Objects->addGarbage(Object); } void LeakDetector::addGarbageObjectImpl(const Value *Object) { - LLVMObjects->addGarbage(Object); + LLVMContextImpl *pImpl = Object->getContext().pImpl; + sys::SmartScopedLock Lock(pImpl->LLVMObjectsLock); + pImpl->LLVMObjects.addGarbage(Object); } void LeakDetector::removeGarbageObjectImpl(void *Object) { + sys::SmartScopedLock Lock(*ObjectsLock); Objects->removeGarbage(Object); } void LeakDetector::removeGarbageObjectImpl(const Value *Object) { - LLVMObjects->removeGarbage(Object); + LLVMContextImpl *pImpl = Object->getContext().pImpl; + sys::SmartScopedLock Lock(pImpl->LLVMObjectsLock); + pImpl->LLVMObjects.removeGarbage(Object); } -void LeakDetector::checkForGarbageImpl(const std::string &Message) { +void LeakDetector::checkForGarbageImpl(LLVMContext &Context, + const std::string &Message) { + LLVMContextImpl *pImpl = Context.pImpl; + sys::SmartScopedLock Lock(*ObjectsLock); + sys::SmartScopedLock CLock(pImpl->LLVMObjectsLock); + Objects->setName("GENERIC"); - LLVMObjects->setName("LLVM"); + pImpl->LLVMObjects.setName("LLVM"); // use non-short-circuit version so that both checks are performed if (Objects->hasGarbage(Message) | - LLVMObjects->hasGarbage(Message)) + pImpl->LLVMObjects.hasGarbage(Message)) cerr << "\nThis is probably because you removed an object, but didn't " << "delete it. Please check your code for memory leaks.\n"; // Clear out results so we don't get duplicate warnings on // next call... - clearGarbage(); + clearGarbage(Context); } Added: llvm/trunk/lib/VMCore/LeaksContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LeaksContext.h?rev=79429&view=auto ============================================================================== --- llvm/trunk/lib/VMCore/LeaksContext.h (added) +++ llvm/trunk/lib/VMCore/LeaksContext.h Wed Aug 19 12:07:46 2009 @@ -0,0 +1,90 @@ +//===---------------- ----LeaksContext.h - Implementation ------*- C++ -*--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines various helper methods and classes used by +// LLVMContextImpl for leaks detectors. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Value.h" +#include "llvm/Support/Streams.h" +#include "llvm/ADT/SmallPtrSet.h" + +using namespace llvm; + +template +struct PrinterTrait { + static void print(const T* P) { cerr << P; } +}; + +template<> +struct PrinterTrait { + static void print(const Value* P) { cerr << *P; } +}; + +template +struct LeakDetectorImpl { + explicit LeakDetectorImpl(const char* const name = "") : + Cache(0), Name(name) { } + + void clear() { + Cache = 0; + Ts.clear(); + } + + void setName(const char* n) { + Name = n; + } + + // Because the most common usage pattern, by far, is to add a + // garbage object, then remove it immediately, we optimize this + // case. When an object is added, it is not added to the set + // immediately, it is added to the CachedValue Value. If it is + // immediately removed, no set search need be performed. + void addGarbage(const T* o) { + if (Cache) { + assert(Ts.count(Cache) == 0 && "Object already in set!"); + Ts.insert(Cache); + } + Cache = o; + } + + void removeGarbage(const T* o) { + if (o == Cache) + Cache = 0; // Cache hit + else + Ts.erase(o); + } + + bool hasGarbage(const std::string& Message) { + addGarbage(0); // Flush the Cache + + assert(Cache == 0 && "No value should be cached anymore!"); + + if (!Ts.empty()) { + cerr << "Leaked " << Name << " objects found: " << Message << ":\n"; + for (typename SmallPtrSet::iterator I = Ts.begin(), + E = Ts.end(); I != E; ++I) { + cerr << "\t"; + PrinterTrait::print(*I); + cerr << "\n"; + } + cerr << '\n'; + + return true; + } + + return false; + } + +private: + SmallPtrSet Ts; + const T* Cache; + const char* Name; +}; From echristo at apple.com Wed Aug 19 12:17:54 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 19 Aug 2009 10:17:54 -0700 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <4A8C23E1.3040604@lip6.fr> References: <4A8B2CE1.2000105@lip6.fr> <9A550CA8-C19F-42F5-8731-9B1A234299CD@apple.com> <4A8C23E1.3040604@lip6.fr> Message-ID: <0475CCF6-A5E1-43C1-A4BC-7DCB9FEF8CC8@apple.com> >> >> Quick question: As in things that are currently being compiled? > > No, C++ llvm functions that are in the llvm codebase. Like functions > from JITEmitter and stuff. > >> Seems a bit odd that it's not executing code that's being walked up >> but rather the compiler itself. > > When I'm using the JIT, functions from the llvm code base may be > executing. > Yes, but I wouldn't imagine anything could be executing in a way that would require you walking up llvm code. Can you give me a quick example? -eric From idadesub at users.sourceforge.net Wed Aug 19 12:32:24 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Wed, 19 Aug 2009 17:32:24 -0000 Subject: [llvm-commits] [llvm] r79430 - in /llvm/trunk: bindings/ocaml/llvm/llvm.ml bindings/ocaml/llvm/llvm.mli bindings/ocaml/llvm/llvm_ocaml.c test/Bindings/Ocaml/analysis.ml test/Bindings/Ocaml/bitreader.ml test/Bindings/Ocaml/bitwriter.ml test/Bindings/Ocaml/executionengine.ml test/Bindings/Ocaml/scalar_opts.ml test/Bindings/Ocaml/target.ml test/Bindings/Ocaml/vmcore.ml Message-ID: <200908191732.n7JHWOZL006929@zion.cs.uiuc.edu> Author: erickt Date: Wed Aug 19 12:32:24 2009 New Revision: 79430 URL: http://llvm.org/viewvc/llvm-project?rev=79430&view=rev Log: Convert the rest of the ocaml types and functions to use context. Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml llvm/trunk/bindings/ocaml/llvm/llvm.mli llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c llvm/trunk/test/Bindings/Ocaml/analysis.ml llvm/trunk/test/Bindings/Ocaml/bitreader.ml llvm/trunk/test/Bindings/Ocaml/bitwriter.ml llvm/trunk/test/Bindings/Ocaml/executionengine.ml llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml llvm/trunk/test/Bindings/Ocaml/target.ml llvm/trunk/test/Bindings/Ocaml/vmcore.ml Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.ml (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Wed Aug 19 12:32:24 2009 @@ -155,33 +155,21 @@ external type_context : lltype -> llcontext = "llvm_type_context" (*--... Operations on integer types ........................................--*) -external _i1_type : unit -> lltype = "llvm_i1_type" -external _i8_type : unit -> lltype = "llvm_i8_type" -external _i16_type : unit -> lltype = "llvm_i16_type" -external _i32_type : unit -> lltype = "llvm_i32_type" -external _i64_type : unit -> lltype = "llvm_i64_type" - -let i1_type = _i1_type () -let i8_type = _i8_type () -let i16_type = _i16_type () -let i32_type = _i32_type () -let i64_type = _i64_type () +external i1_type : llcontext -> lltype = "llvm_i1_type" +external i8_type : llcontext -> lltype = "llvm_i8_type" +external i16_type : llcontext -> lltype = "llvm_i16_type" +external i32_type : llcontext -> lltype = "llvm_i32_type" +external i64_type : llcontext -> lltype = "llvm_i64_type" -external integer_type : int -> lltype = "llvm_integer_type" +external integer_type : llcontext -> int -> lltype = "llvm_integer_type" external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth" (*--... Operations on real types ...........................................--*) -external _float_type : unit -> lltype = "llvm_float_type" -external _double_type : unit -> lltype = "llvm_double_type" -external _x86fp80_type : unit -> lltype = "llvm_x86fp80_type" -external _fp128_type : unit -> lltype = "llvm_fp128_type" -external _ppc_fp128_type : unit -> lltype = "llvm_ppc_fp128_type" - -let float_type = _float_type () -let double_type = _double_type () -let x86fp80_type = _x86fp80_type () -let fp128_type = _fp128_type () -let ppc_fp128_type = _ppc_fp128_type () +external float_type : llcontext -> lltype = "llvm_float_type" +external double_type : llcontext -> lltype = "llvm_double_type" +external x86fp80_type : llcontext -> lltype = "llvm_x86fp80_type" +external fp128_type : llcontext -> lltype = "llvm_fp128_type" +external ppc_fp128_type : llcontext -> lltype = "llvm_ppc_fp128_type" (*--... Operations on function types .......................................--*) external function_type : lltype -> lltype array -> lltype = "llvm_function_type" @@ -211,12 +199,9 @@ external vector_size : lltype -> int = "llvm_vector_size" (*--... Operations on other types ..........................................--*) -external opaque_type : unit -> lltype = "llvm_opaque_type" -external _void_type : unit -> lltype = "llvm_void_type" -external _label_type : unit -> lltype = "llvm_label_type" - -let void_type = _void_type () -let label_type = _label_type () +external opaque_type : llcontext -> lltype = "llvm_opaque_type" +external void_type : llcontext -> lltype = "llvm_void_type" +external label_type : llcontext -> lltype = "llvm_label_type" (*--... Operations on type handles .........................................--*) external handle_to_type : lltype -> lltypehandle = "llvm_handle_to_type" @@ -249,8 +234,8 @@ = "llvm_const_float_of_string" (*--... Operations on composite constants ..................................--*) -external const_string : string -> llvalue = "llvm_const_string" -external const_stringz : string -> llvalue = "llvm_const_stringz" +external const_string : llcontext -> string -> llvalue = "llvm_const_string" +external const_stringz : llcontext -> string -> llvalue = "llvm_const_stringz" external const_array : lltype -> llvalue array -> llvalue = "llvm_const_array" external const_struct : llcontext -> llvalue array -> llvalue = "llvm_const_struct" @@ -535,8 +520,9 @@ external basic_blocks : llvalue -> llbasicblock array = "llvm_basic_blocks" external entry_block : llvalue -> llbasicblock = "LLVMGetEntryBasicBlock" external delete_block : llbasicblock -> unit = "llvm_delete_block" -external append_block : string -> llvalue -> llbasicblock = "llvm_append_block" -external insert_block : string -> llbasicblock -> llbasicblock +external append_block : llcontext -> string -> llvalue -> llbasicblock + = "llvm_append_block" +external insert_block : llcontext -> string -> llbasicblock -> llbasicblock = "llvm_insert_block" external block_begin : llvalue -> (llvalue, llbasicblock) llpos = "llvm_block_begin" Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Wed Aug 19 12:32:24 2009 @@ -273,46 +273,56 @@ (** {7 Operations on integer types} *) -(** The 1-bit integer type. See [llvm::Type::Int1Ty]. *) -val i1_type : lltype +(** [i1_type c] returns an integer type of bitwidth 1 in the context [c]. See + [llvm::Type::Int1Ty]. *) +external i1_type : llcontext -> lltype = "llvm_i1_type" + +(** [i8_type c] returns an integer type of bitwidth 8 in the context [c]. See + [llvm::Type::Int8Ty]. *) +external i8_type : llcontext -> lltype = "llvm_i8_type" + +(** [i16_type c] returns an integer type of bitwidth 16 in the context [c]. See + [llvm::Type::Int16Ty]. *) +external i16_type : llcontext -> lltype = "llvm_i16_type" + +(** [i32_type c] returns an integer type of bitwidth 32 in the context [c]. See + [llvm::Type::Int32Ty]. *) +external i32_type : llcontext -> lltype = "llvm_i32_type" + +(** [i64_type c] returns an integer type of bitwidth 64 in the context [c]. See + [llvm::Type::Int64Ty]. *) +external i64_type : llcontext -> lltype = "llvm_i64_type" + +(** [integer_type c n] returns an integer type of bitwidth [n] in the context + [c]. See the method [llvm::IntegerType::get]. *) +external integer_type : llcontext -> int -> lltype = "llvm_integer_type" -(** The 8-bit integer type. See [llvm::Type::Int8Ty]. *) -val i8_type : lltype - -(** The 16-bit integer type. See [llvm::Type::Int16Ty]. *) -val i16_type : lltype - -(** The 32-bit integer type. See [llvm::Type::Int32Ty]. *) -val i32_type : lltype - -(** The 64-bit integer type. See [llvm::Type::Int64Ty]. *) -val i64_type : lltype - -(** [integer_type n] returns an integer type of bitwidth [n]. - See the method [llvm::IntegerType::get]. *) -external integer_type : int -> lltype = "llvm_integer_type" - -(** [integer_bitwidth ty] returns the number of bits in the integer type [ty]. - See the method [llvm::IntegerType::getBitWidth]. *) +(** [integer_bitwidth c ty] returns the number of bits in the integer type [ty] + in the context [c]. See the method [llvm::IntegerType::getBitWidth]. *) external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth" (** {7 Operations on real types} *) -(** The IEEE 32-bit floating point type. See [llvm::Type::FloatTy]. *) -val float_type : lltype - -(** The IEEE 64-bit floating point type. See [llvm::Type::DoubleTy]. *) -val double_type : lltype - -(** The x87 80-bit floating point type. See [llvm::Type::X86_FP80Ty]. *) -val x86fp80_type : lltype - -(** The IEEE 128-bit floating point type. See [llvm::Type::FP128Ty]. *) -val fp128_type : lltype - -(** The PowerPC 128-bit floating point type. See [llvm::Type::PPC_FP128Ty]. *) -val ppc_fp128_type : lltype +(** [float_type c] returns the IEEE 32-bit floating point type in the context + [c]. See [llvm::Type::FloatTy]. *) +external float_type : llcontext -> lltype = "llvm_float_type" + +(** [double_type c] returns the IEEE 64-bit floating point type in the context + [c]. See [llvm::Type::DoubleTy]. *) +external double_type : llcontext -> lltype = "llvm_double_type" + +(** [x86fp80_type c] returns the x87 80-bit floating point type in the context + [c]. See [llvm::Type::X86_FP80Ty]. *) +external x86fp80_type : llcontext -> lltype = "llvm_x86fp80_type" + +(** [fp128_type c] returns the IEEE 128-bit floating point type in the context + [c]. See [llvm::Type::FP128Ty]. *) +external fp128_type : llcontext -> lltype = "llvm_fp128_type" + +(** [ppc_fp128_type c] returns the PowerPC 128-bit floating point type in the + context [c]. See [llvm::Type::PPC_FP128Ty]. *) +external ppc_fp128_type : llcontext -> lltype = "llvm_ppc_fp128_type" (** {7 Operations on function types} *) @@ -405,18 +415,18 @@ (** {7 Operations on other types} *) -(** [opaque_type ()] creates a new opaque type distinct from any other. - Opaque types are useful for building recursive types in combination with - {!refine_type}. - See [llvm::OpaqueType::get]. *) -external opaque_type : unit -> lltype = "llvm_opaque_type" - -(** [void_type] is the type of a function which does not return any value. - See [llvm::Type::VoidTy]. *) -val void_type : lltype - -(** [label_type] is the type of a basic block. See [llvm::Type::LabelTy]. *) -val label_type : lltype +(** [opaque_type c] creates a new opaque type distinct from any other in the + context [c]. Opaque types are useful for building recursive types in + combination with {!refine_type}. See [llvm::OpaqueType::get]. *) +external opaque_type : llcontext -> lltype = "llvm_opaque_type" + +(** [void_type c] creates a type of a function which does not return any + value in the context [c]. See [llvm::Type::VoidTy]. *) +external void_type : llcontext -> lltype = "llvm_void_type" + +(** [label_type c] creates a type of a basic block in the context [c]. See + [llvm::Type::LabelTy]. *) +external label_type : llcontext -> lltype = "llvm_label_type" (** {7 Operations on type handles} *) @@ -513,17 +523,18 @@ (** {7 Operations on composite constants} *) -(** [const_string s] returns the constant [i8] array with the values of the - characters in the string [s]. The array is not null-terminated (but see - {!const_stringz}). This value can in turn be used as the initializer for a - global variable. See the method [llvm::ConstantArray::get]. *) -external const_string : string -> llvalue = "llvm_const_string" - -(** [const_stringz s] returns the constant [i8] array with the values of the - characters in the string [s] and a null terminator. This value can in turn - be used as the initializer for a global variable. +(** [const_string c s] returns the constant [i8] array with the values of the + characters in the string [s] in the context [c]. The array is not + null-terminated (but see {!const_stringz}). This value can in turn be used + as the initializer for a global variable. See the method + [llvm::ConstantArray::get]. *) +external const_string : llcontext -> string -> llvalue = "llvm_const_string" + +(** [const_stringz c s] returns the constant [i8] array with the values of the + characters in the string [s] and a null terminator in the context [c]. This + value can in turn be used as the initializer for a global variable. See the method [llvm::ConstantArray::get]. *) -external const_stringz : string -> llvalue = "llvm_const_stringz" +external const_stringz : llcontext -> string -> llvalue = "llvm_const_stringz" (** [const_array ty elts] returns the constant array of type [array_type ty (Array.length elts)] and containing the values [elts]. @@ -1159,15 +1170,16 @@ See the method [llvm::BasicBlock::eraseFromParent]. *) external delete_block : llbasicblock -> unit = "llvm_delete_block" -(** [append_block name f] creates a new basic block named [name] at the end of - function [f]. +(** [append_block c name f] creates a new basic block named [name] at the end of + function [f] in the context [c]. See the constructor of [llvm::BasicBlock]. *) -external append_block : string -> llvalue -> llbasicblock = "llvm_append_block" +external append_block : llcontext -> string -> llvalue -> llbasicblock + = "llvm_append_block" -(** [insert_block name bb] creates a new basic block named [name] before the - basic block [bb]. +(** [insert_block c name bb] creates a new basic block named [name] before the + basic block [bb] in the context [c]. See the constructor of [llvm::BasicBlock]. *) -external insert_block : string -> llbasicblock -> llbasicblock +external insert_block : llcontext -> string -> llbasicblock -> llbasicblock = "llvm_insert_block" (** [block_parent bb] returns the parent function that owns the basic block. Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Wed Aug 19 12:32:24 2009 @@ -178,16 +178,34 @@ /*--... Operations on integer types ........................................--*/ -/* unit -> lltype */ -CAMLprim LLVMTypeRef llvm_i1_type (value Unit) { return LLVMInt1Type(); } -CAMLprim LLVMTypeRef llvm_i8_type (value Unit) { return LLVMInt8Type(); } -CAMLprim LLVMTypeRef llvm_i16_type(value Unit) { return LLVMInt16Type(); } -CAMLprim LLVMTypeRef llvm_i32_type(value Unit) { return LLVMInt32Type(); } -CAMLprim LLVMTypeRef llvm_i64_type(value Unit) { return LLVMInt64Type(); } - -/* int -> lltype */ -CAMLprim LLVMTypeRef llvm_integer_type(value Width) { - return LLVMIntType(Int_val(Width)); +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_i1_type (LLVMContextRef Context) { + return LLVMInt1TypeInContext(Context); +} + +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_i8_type (LLVMContextRef Context) { + return LLVMInt8TypeInContext(Context); +} + +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_i16_type (LLVMContextRef Context) { + return LLVMInt16TypeInContext(Context); +} + +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_i32_type (LLVMContextRef Context) { + return LLVMInt32TypeInContext(Context); +} + +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_i64_type (LLVMContextRef Context) { + return LLVMInt64TypeInContext(Context); +} + +/* llcontext -> int -> lltype */ +CAMLprim LLVMTypeRef llvm_integer_type(LLVMContextRef Context, value Width) { + return LLVMIntTypeInContext(Context, Int_val(Width)); } /* lltype -> int */ @@ -197,29 +215,29 @@ /*--... Operations on real types ...........................................--*/ -/* unit -> lltype */ -CAMLprim LLVMTypeRef llvm_float_type(value Unit) { - return LLVMFloatType(); +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_float_type(LLVMContextRef Context) { + return LLVMFloatTypeInContext(Context); } -/* unit -> lltype */ -CAMLprim LLVMTypeRef llvm_double_type(value Unit) { - return LLVMDoubleType(); +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_double_type(LLVMContextRef Context) { + return LLVMDoubleTypeInContext(Context); } -/* unit -> lltype */ -CAMLprim LLVMTypeRef llvm_x86fp80_type(value Unit) { - return LLVMX86FP80Type(); +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_x86fp80_type(LLVMContextRef Context) { + return LLVMX86FP80TypeInContext(Context); } -/* unit -> lltype */ -CAMLprim LLVMTypeRef llvm_fp128_type(value Unit) { - return LLVMFP128Type(); +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_fp128_type(LLVMContextRef Context) { + return LLVMFP128TypeInContext(Context); } -/* unit -> lltype */ -CAMLprim LLVMTypeRef llvm_ppc_fp128_type(value Unit) { - return LLVMPPCFP128Type(); +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_ppc_fp128_type(LLVMContextRef Context) { + return LLVMPPCFP128TypeInContext(Context); } /*--... Operations on function types .......................................--*/ @@ -316,13 +334,19 @@ /*--... Operations on other types ..........................................--*/ -/* unit -> lltype */ -CAMLprim LLVMTypeRef llvm_void_type (value Unit) { return LLVMVoidType(); } -CAMLprim LLVMTypeRef llvm_label_type(value Unit) { return LLVMLabelType(); } - -/* unit -> lltype */ -CAMLprim LLVMTypeRef llvm_opaque_type(value Unit) { - return LLVMOpaqueType(); +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_void_type (LLVMContextRef Context) { + return LLVMVoidTypeInContext(Context); +} + +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_label_type(LLVMContextRef Context) { + return LLVMLabelTypeInContext(Context); +} + +/* llcontext -> lltype */ +CAMLprim LLVMTypeRef llvm_opaque_type(LLVMContextRef Context) { + return LLVMOpaqueTypeInContext(Context); } /*--... Operations on type handles .........................................--*/ @@ -432,14 +456,18 @@ /*--... Operations on composite constants ..................................--*/ -/* string -> llvalue */ -CAMLprim LLVMValueRef llvm_const_string(value Str, value NullTerminate) { - return LLVMConstString(String_val(Str), string_length(Str), 1); +/* llcontext -> string -> llvalue */ +CAMLprim LLVMValueRef llvm_const_string(LLVMContextRef Context, value Str, + value NullTerminate) { + return LLVMConstStringInContext(Context, String_val(Str), string_length(Str), + 1); } -/* string -> llvalue */ -CAMLprim LLVMValueRef llvm_const_stringz(value Str, value NullTerminate) { - return LLVMConstString(String_val(Str), string_length(Str), 0); +/* llcontext -> string -> llvalue */ +CAMLprim LLVMValueRef llvm_const_stringz(LLVMContextRef Context, value Str, + value NullTerminate) { + return LLVMConstStringInContext(Context, String_val(Str), string_length(Str), + 0); } /* lltype -> llvalue array -> llvalue */ @@ -697,7 +725,7 @@ CAMLprim LLVMValueRef llvm_define_function(value Name, LLVMTypeRef Ty, LLVMModuleRef M) { LLVMValueRef Fn = LLVMAddFunction(M, String_val(Name), Ty); - LLVMAppendBasicBlock(Fn, "entry"); + LLVMAppendBasicBlockInContext(LLVMGetTypeContext(Ty), Fn, "entry"); return Fn; } @@ -810,13 +838,15 @@ } /* string -> llvalue -> llbasicblock */ -CAMLprim LLVMBasicBlockRef llvm_append_block(value Name, LLVMValueRef Fn) { - return LLVMAppendBasicBlock(Fn, String_val(Name)); +CAMLprim LLVMBasicBlockRef llvm_append_block(LLVMContextRef Context, value Name, + LLVMValueRef Fn) { + return LLVMAppendBasicBlockInContext(Context, Fn, String_val(Name)); } /* string -> llbasicblock -> llbasicblock */ -CAMLprim LLVMBasicBlockRef llvm_insert_block(value Name, LLVMBasicBlockRef BB) { - return LLVMInsertBasicBlock(BB, String_val(Name)); +CAMLprim LLVMBasicBlockRef llvm_insert_block(LLVMContextRef Context, value Name, + LLVMBasicBlockRef BB) { + return LLVMInsertBasicBlockInContext(Context, BB, String_val(Name)); } /* llvalue -> bool */ Modified: llvm/trunk/test/Bindings/Ocaml/analysis.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/analysis.ml?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/analysis.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/analysis.ml Wed Aug 19 12:32:24 2009 @@ -8,6 +8,8 @@ (* Note that this takes a moment to link, so it's best to keep the number of individual tests low. *) +let context = global_context () + let test x = if not x then exit 1 else () let bomb msg = @@ -15,10 +17,10 @@ exit 2 let _ = - let fty = function_type void_type [| |] in - let m = create_module (global_context ()) "valid_m" in + let fty = function_type (void_type context) [| |] in + let m = create_module context "valid_m" in let fn = define_function "valid_fn" fty m in - let at_entry = builder_at_end (global_context ()) (entry_block fn) in + let at_entry = builder_at_end context (entry_block fn) in ignore (build_ret_void at_entry); Modified: llvm/trunk/test/Bindings/Ocaml/bitreader.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/bitreader.ml?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/bitreader.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/bitreader.ml Wed Aug 19 12:32:24 2009 @@ -14,7 +14,7 @@ let fn = Sys.argv.(1) in let m = Llvm.create_module context "ocaml_test_module" in - ignore (Llvm.define_type_name "caml_int_ty" Llvm.i32_type m); + ignore (Llvm.define_type_name "caml_int_ty" (Llvm.i32_type context) m); test (Llvm_bitwriter.write_bitcode_file m fn); Modified: llvm/trunk/test/Bindings/Ocaml/bitwriter.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/bitwriter.ml?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/bitwriter.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/bitwriter.ml Wed Aug 19 12:32:24 2009 @@ -6,11 +6,13 @@ (* Note that this takes a moment to link, so it's best to keep the number of individual tests low. *) +let context = Llvm.global_context () + let test x = if not x then exit 1 else () let _ = - let m = Llvm.create_module (Llvm.global_context ()) "ocaml_test_module" in + let m = Llvm.create_module context "ocaml_test_module" in - ignore (Llvm.define_type_name "caml_int_ty" Llvm.i32_type m); + ignore (Llvm.define_type_name "caml_int_ty" (Llvm.i32_type context) m); test (Llvm_bitwriter.write_bitcode_file m Sys.argv.(1)) Modified: llvm/trunk/test/Bindings/Ocaml/executionengine.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/executionengine.ml?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/executionengine.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/executionengine.ml Wed Aug 19 12:32:24 2009 @@ -9,6 +9,12 @@ (* Note that this takes a moment to link, so it's best to keep the number of individual tests low. *) +let context = global_context () +let i8_type = Llvm.i8_type context +let i32_type = Llvm.i32_type context +let i64_type = Llvm.i64_type context +let double_type = Llvm.double_type context + let bomb msg = prerr_endline msg; exit 2 Modified: llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/scalar_opts.ml Wed Aug 19 12:32:24 2009 @@ -9,6 +9,8 @@ open Llvm_scalar_opts open Llvm_target +let context = global_context () +let void_type = Llvm.void_type context (* Tiny unit test framework - really just to help find which line is busted *) let suite name f = @@ -19,7 +21,7 @@ (*===-- Fixture -----------------------------------------------------------===*) let filename = Sys.argv.(1) -let m = create_module (global_context ()) filename +let m = create_module context filename let mp = ModuleProvider.create m @@ -30,7 +32,7 @@ let fty = function_type void_type [| |] in let fn = define_function "fn" fty m in - ignore (build_ret_void (builder_at_end (global_context ()) (entry_block fn))); + ignore (build_ret_void (builder_at_end context (entry_block fn))); let td = TargetData.create (target_triple m) in Modified: llvm/trunk/test/Bindings/Ocaml/target.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/target.ml?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/target.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/target.ml Wed Aug 19 12:32:24 2009 @@ -8,6 +8,10 @@ open Llvm open Llvm_target +let context = global_context () +let i32_type = Llvm.i32_type context +let i64_type = Llvm.i64_type context + (* Tiny unit test framework - really just to help find which line is busted *) let suite name f = prerr_endline (name ^ ":"); @@ -17,14 +21,14 @@ (*===-- Fixture -----------------------------------------------------------===*) let filename = Sys.argv.(1) -let m = create_module (global_context ()) filename +let m = create_module context filename (*===-- Target Data -------------------------------------------------------===*) let test_target_data () = let td = TargetData.create (target_triple m) in - let sty = struct_type (global_context ()) [| i32_type; i64_type |] in + let sty = struct_type context [| i32_type; i64_type |] in ignore (TargetData.as_string td); ignore (TargetData.invalidate_struct_layout td sty); Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/vmcore.ml?rev=79430&r1=79429&r2=79430&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Wed Aug 19 12:32:24 2009 @@ -18,6 +18,15 @@ let case_num = ref 0 let print_checkpoints = false let context = global_context () +let i1_type = Llvm.i1_type context +let i8_type = Llvm.i8_type context +let i16_type = Llvm.i16_type context +let i32_type = Llvm.i32_type context +let i64_type = Llvm.i64_type context +let void_type = Llvm.void_type context +let float_type = Llvm.float_type context +let double_type = Llvm.double_type context +let fp128_type = Llvm.fp128_type context let group name = group_name := !suite_name ^ "/" ^ name; @@ -94,7 +103,7 @@ (* RUN: grep {Ty04.*i42} < %t.ll *) group "i42"; - let ty = integer_type 42 in + let ty = integer_type context 42 in insist (define_type_name "Ty04" ty m); (* RUN: grep {Ty05.*float} < %t.ll @@ -165,22 +174,22 @@ (* RUN: grep {Ty12.*opaque} < %t.ll *) group "opaque"; - let ty = opaque_type () in + let ty = opaque_type context in insist (define_type_name "Ty12" ty m); insist (ty == ty); - insist (ty <> opaque_type ()); + insist (ty <> opaque_type context); (* RUN: grep -v {Ty13} < %t.ll *) group "delete"; - let ty = opaque_type () in + let ty = opaque_type context in insist (define_type_name "Ty13" ty m); delete_type_name "Ty13" m; (* RUN: grep -v {RecursiveTy.*RecursiveTy} < %t.ll *) group "recursive"; - let ty = opaque_type () in + let ty = opaque_type context in let th = handle_to_type ty in refine_type ty (pointer_type ty); let ty = type_of_handle th in @@ -223,14 +232,14 @@ (* RUN: grep {Const04.*"cruel\\\\00world"} < %t.ll *) group "string"; - let c = const_string "cruel\000world" in + let c = const_string context "cruel\000world" in ignore (define_global "Const04" c m); insist ((array_type i8_type 11) = type_of c); (* RUN: grep {Const05.*"hi\\\\00again\\\\00"} < %t.ll *) group "stringz"; - let c = const_stringz "hi\000again" in + let c = const_stringz context "hi\000again" in ignore (define_global "Const05" c m); insist ((array_type i8_type 9) = type_of c); @@ -356,7 +365,7 @@ * RUN: grep {ConstIntToPtr.*inttoptr} < %t.ll * RUN: grep {ConstBitCast.*bitcast} < %t.ll *) - let i128_type = integer_type 128 in + let i128_type = integer_type context 128 in ignore (define_global "ConstTrunc" (const_trunc (const_add foldbomb five) i8_type) m); ignore (define_global "ConstSExt" (const_sext foldbomb i128_type) m); @@ -673,7 +682,7 @@ *) group "entry"; let fn = declare_function "X" ty m in - let bb = append_block "Bb1" fn in + let bb = append_block context "Bb1" fn in insist (bb = entry_block fn); ignore (build_unreachable (builder_at_end context bb)); @@ -681,13 +690,13 @@ *) group "delete"; let fn = declare_function "X2" ty m in - let bb = append_block "Bb2" fn in + let bb = append_block context "Bb2" fn in delete_block bb; group "insert"; let fn = declare_function "X3" ty m in - let bbb = append_block "b" fn in - let bba = insert_block "a" bbb in + let bbb = append_block context "b" fn in + let bba = insert_block context "a" bbb in insist ([| bba; bbb |] = basic_blocks fn); ignore (build_unreachable (builder_at_end context bba)); ignore (build_unreachable (builder_at_end context bbb)); @@ -717,8 +726,8 @@ insist (At_end f = block_begin f); insist (At_start f = block_end f); - let b1 = append_block "One" f in - let b2 = append_block "Two" f in + let b1 = append_block context "One" f in + let b2 = append_block context "Two" f in insist (Before b1 = block_begin f); insist (Before b2 = block_succ b1); @@ -804,7 +813,7 @@ *) let fty = function_type void_type [| |] in let fn = declare_function "X6" fty m in - let b = builder_at_end context (append_block "Bb01" fn) in + let b = builder_at_end context (append_block context "Bb01" fn) in ignore (build_ret_void b) end; @@ -817,7 +826,7 @@ let f1 = build_uitofp p1 float_type "F1" atentry in let f2 = build_uitofp p2 float_type "F2" atentry in - let bb00 = append_block "Bb00" fn in + let bb00 = append_block context "Bb00" fn in ignore (build_unreachable (builder_at_end context bb00)); group "ret"; begin @@ -830,7 +839,7 @@ group "br"; begin (* RUN: grep {br.*Bb02} < %t.ll *) - let bb02 = append_block "Bb02" fn in + let bb02 = append_block context "Bb02" fn in let b = builder_at_end context bb02 in ignore (build_br bb02 b) end; @@ -838,7 +847,7 @@ group "cond_br"; begin (* RUN: grep {br.*Inst01.*Bb03.*Bb00} < %t.ll *) - let bb03 = append_block "Bb03" fn in + let bb03 = append_block context "Bb03" fn in let b = builder_at_end context bb03 in let cond = build_trunc p1 i1_type "Inst01" b in ignore (build_cond_br cond bb03 bb00 b) @@ -848,10 +857,10 @@ (* RUN: grep {switch.*P1.*SwiBlock3} < %t.ll * RUN: grep {2,.*SwiBlock2} < %t.ll *) - let bb1 = append_block "SwiBlock1" fn in - let bb2 = append_block "SwiBlock2" fn in + let bb1 = append_block context "SwiBlock1" fn in + let bb2 = append_block context "SwiBlock2" fn in ignore (build_unreachable (builder_at_end context bb2)); - let bb3 = append_block "SwiBlock3" fn in + let bb3 = append_block context "SwiBlock3" fn in ignore (build_unreachable (builder_at_end context bb3)); let si = build_switch p1 bb3 1 (builder_at_end context bb1) in ignore (add_case si (const_int i32_type 2) bb2) @@ -861,7 +870,7 @@ (* RUN: grep {Inst02.*invoke.*P1.*P2} < %t.ll * RUN: grep {to.*Bb04.*unwind.*Bb00} < %t.ll *) - let bb04 = append_block "Bb04" fn in + let bb04 = append_block context "Bb04" fn in let b = builder_at_end context bb04 in ignore (build_invoke fn [| p1; p2 |] bb04 bb00 "Inst02" b) end; @@ -869,7 +878,7 @@ group "unwind"; begin (* RUN: grep {unwind} < %t.ll *) - let bb05 = append_block "Bb05" fn in + let bb05 = append_block context "Bb05" fn in let b = builder_at_end context bb05 in ignore (build_unwind b) end; @@ -877,13 +886,13 @@ group "unreachable"; begin (* RUN: grep {unreachable} < %t.ll *) - let bb06 = append_block "Bb06" fn in + let bb06 = append_block context "Bb06" fn in let b = builder_at_end context bb06 in ignore (build_unreachable b) end; group "arithmetic"; begin - let bb07 = append_block "Bb07" fn in + let bb07 = append_block context "Bb07" fn in let b = builder_at_end context bb07 in (* RUN: grep {Inst03.*add.*P1.*P2} < %t.ll @@ -925,7 +934,7 @@ end; group "memory"; begin - let bb08 = append_block "Bb08" fn in + let bb08 = append_block context "Bb08" fn in let b = builder_at_end context bb08 in (* RUN: grep {Inst20.*malloc.*i8 } < %t.ll @@ -1034,10 +1043,10 @@ group "phi"; begin (* RUN: grep {PhiNode.*P1.*PhiBlock1.*P2.*PhiBlock2} < %t.ll *) - let b1 = append_block "PhiBlock1" fn in - let b2 = append_block "PhiBlock2" fn in + let b1 = append_block context "PhiBlock1" fn in + let b2 = append_block context "PhiBlock2" fn in - let jb = append_block "PhiJoinBlock" fn in + let jb = append_block context "PhiJoinBlock" fn in ignore (build_br jb (builder_at_end context b1)); ignore (build_br jb (builder_at_end context b2)); let at_jb = builder_at_end context jb in From idadesub at users.sourceforge.net Wed Aug 19 12:32:38 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Wed, 19 Aug 2009 17:32:38 -0000 Subject: [llvm-commits] [llvm] r79431 - in /llvm/trunk/docs/tutorial: OCamlLangImpl3.html OCamlLangImpl4.html OCamlLangImpl5.html OCamlLangImpl6.html OCamlLangImpl7.html Message-ID: <200908191732.n7JHWc5Z006983@zion.cs.uiuc.edu> Author: erickt Date: Wed Aug 19 12:32:38 2009 New Revision: 79431 URL: http://llvm.org/viewvc/llvm-project?rev=79431&view=rev Log: Update the ocaml docs to work with LLVMContext. Modified: llvm/trunk/docs/tutorial/OCamlLangImpl3.html llvm/trunk/docs/tutorial/OCamlLangImpl4.html llvm/trunk/docs/tutorial/OCamlLangImpl5.html llvm/trunk/docs/tutorial/OCamlLangImpl6.html llvm/trunk/docs/tutorial/OCamlLangImpl7.html Modified: llvm/trunk/docs/tutorial/OCamlLangImpl3.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl3.html?rev=79431&r1=79430&r2=79431&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl3.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl3.html Wed Aug 19 12:32:38 2009 @@ -95,8 +95,8 @@
     exception Error of string
     
    -let the_module = create_module "my cool jit"
    -let builder = builder ()
    +let the_module = create_module (global_context ()) "my cool jit"
    +let builder = builder (global_context ())
     let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
     
    @@ -899,8 +899,9 @@ exception Error of string -let the_module = create_module "my cool jit" -let builder = builder () +let context = global_context () +let the_module = create_module context "my cool jit" +let builder = builder context let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10 let rec codegen_expr = function Modified: llvm/trunk/docs/tutorial/OCamlLangImpl4.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl4.html?rev=79431&r1=79430&r2=79431&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl4.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl4.html Wed Aug 19 12:32:38 2009 @@ -795,8 +795,9 @@ exception Error of string -let the_module = create_module "my cool jit" -let builder = builder () +let context = global_context () +let the_module = create_module context "my cool jit" +let builder = builder context let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10 let rec codegen_expr = function Modified: llvm/trunk/docs/tutorial/OCamlLangImpl5.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl5.html?rev=79431&r1=79430&r2=79431&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl5.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl5.html Wed Aug 19 12:32:38 2009 @@ -1200,8 +1200,9 @@ exception Error of string -let the_module = create_module "my cool jit" -let builder = builder () +let context = global_context () +let the_module = create_module context "my cool jit" +let builder = builder context let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10 let rec codegen_expr = function Modified: llvm/trunk/docs/tutorial/OCamlLangImpl6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl6.html?rev=79431&r1=79430&r2=79431&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl6.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl6.html Wed Aug 19 12:32:38 2009 @@ -1173,8 +1173,9 @@ exception Error of string -let the_module = create_module "my cool jit" -let builder = builder () +let context = global_context () +let the_module = create_module context "my cool jit" +let builder = builder context let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10 let rec codegen_expr = function Modified: llvm/trunk/docs/tutorial/OCamlLangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/OCamlLangImpl7.html?rev=79431&r1=79430&r2=79431&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/OCamlLangImpl7.html (original) +++ llvm/trunk/docs/tutorial/OCamlLangImpl7.html Wed Aug 19 12:32:38 2009 @@ -1384,14 +1384,15 @@ exception Error of string -let the_module = create_module "my cool jit" -let builder = builder () +let context = global_context () +let the_module = create_module context "my cool jit" +let builder = builder context let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10 (* Create an alloca instruction in the entry block of the function. This * is used for mutable variables etc. *) let create_entry_block_alloca the_function var_name = - let builder = builder_at (instr_begin (entry_block the_function)) in + let builder = builder_at context (instr_begin (entry_block the_function)) in build_alloca double_type var_name builder let rec codegen_expr = function From idadesub at users.sourceforge.net Wed Aug 19 12:40:05 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Wed, 19 Aug 2009 17:40:05 -0000 Subject: [llvm-commits] [llvm] r79432 - /llvm/trunk/include/llvm/BasicBlock.h Message-ID: <200908191740.n7JHe5lW008109@zion.cs.uiuc.edu> Author: erickt Date: Wed Aug 19 12:40:05 2009 New Revision: 79432 URL: http://llvm.org/viewvc/llvm-project?rev=79432&view=rev Log: BasicBlock::getContext can no longer return a NULL so update the doc. Modified: llvm/trunk/include/llvm/BasicBlock.h Modified: llvm/trunk/include/llvm/BasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=79432&r1=79431&r2=79432&view=diff ============================================================================== --- llvm/trunk/include/llvm/BasicBlock.h (original) +++ llvm/trunk/include/llvm/BasicBlock.h Wed Aug 19 12:40:05 2009 @@ -86,8 +86,7 @@ explicit BasicBlock(LLVMContext &C, const Twine &Name = "", Function *Parent = 0, BasicBlock *InsertBefore = 0); public: - /// getContext - Get the context in which this basic block lives, - /// or null if it is not currently attached to a function. + /// getContext - Get the context in which this basic block lives. LLVMContext &getContext() const; /// Instruction iterators... From daniel at zuster.org Wed Aug 19 12:48:28 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 17:48:28 -0000 Subject: [llvm-commits] [llvm] r79433 - in /llvm/trunk: include/llvm/ADT/SmallVector.h unittests/ADT/SmallVectorTest.cpp Message-ID: <200908191748.n7JHmSXC009149@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 12:48:28 2009 New Revision: 79433 URL: http://llvm.org/viewvc/llvm-project?rev=79433&view=rev Log: Add SmallVector::{capacity,set_size}. - These allow clients to make use of the extra elements in the vector which have already been allocated, without requiring them to be value initialized. Modified: llvm/trunk/include/llvm/ADT/SmallVector.h llvm/trunk/unittests/ADT/SmallVectorTest.cpp Modified: llvm/trunk/include/llvm/ADT/SmallVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=79433&r1=79432&r2=79433&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallVector.h Wed Aug 19 12:48:28 2009 @@ -122,11 +122,11 @@ reference operator[](unsigned idx) { - assert (Begin + idx < End); + assert(Begin + idx < End); return Begin[idx]; } const_reference operator[](unsigned idx) const { - assert (Begin + idx < End); + assert(Begin + idx < End); return Begin[idx]; } @@ -399,6 +399,24 @@ RHS.begin(), RHS.end()); } + /// capacity - Return the total number of elements in the currently allocated + /// buffer. + size_t capacity() const { return Capacity - Begin; } + + /// set_size - Set the array size to \arg N, which the current array must have + /// enough capacity for. + /// + /// This does not construct or destroy any elements in the vector. + /// + /// Clients can use this in conjunction with capacity() to write past the end + /// of the buffer when they know that more elements are available, and only + /// update the size later. This avoids the cost of value initializing elements + /// which will only be overwritten. + void set_size(unsigned N) { + assert(N <= capacity()); + End = Begin + N; + } + private: /// isSmall - Return true if this is a smallvector which has not had dynamic /// memory allocated for it. Modified: llvm/trunk/unittests/ADT/SmallVectorTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallVectorTest.cpp?rev=79433&r1=79432&r2=79433&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/SmallVectorTest.cpp (original) +++ llvm/trunk/unittests/ADT/SmallVectorTest.cpp Wed Aug 19 12:48:28 2009 @@ -381,4 +381,22 @@ EXPECT_TRUE(constVector.begin() == constVector.end()); } +// Direct array access. +TEST_F(SmallVectorTest, DirectVectorTest) { + EXPECT_EQ(0u, theVector.size()); + EXPECT_EQ(4u, theVector.capacity()); + EXPECT_EQ(0, Constructable::getNumConstructorCalls()); + theVector.end()[0] = 1; + theVector.end()[1] = 2; + theVector.end()[2] = 3; + theVector.end()[3] = 4; + theVector.set_size(4); + EXPECT_EQ(4u, theVector.size()); + EXPECT_EQ(4, Constructable::getNumConstructorCalls()); + EXPECT_EQ(1, theVector[0].getValue()); + EXPECT_EQ(2, theVector[1].getValue()); + EXPECT_EQ(3, theVector[2].getValue()); + EXPECT_EQ(4, theVector[3].getValue()); +} + } From daniel at zuster.org Wed Aug 19 12:54:29 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 17:54:29 -0000 Subject: [llvm-commits] [llvm] r79434 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <200908191754.n7JHsTQY009917@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 12:54:29 2009 New Revision: 79434 URL: http://llvm.org/viewvc/llvm-project?rev=79434&view=rev Log: Switch raw_svector_ostream to use the vector as the ostream buffer. - This avoids unnecessary malloc/free overhead in the common case, and unnecessary copying from the ostream buffer into the output vector. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=79434&r1=79433&r2=79434&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Wed Aug 19 12:54:29 2009 @@ -452,6 +452,10 @@ /// counting the bytes currently in the buffer. virtual uint64_t current_pos(); public: + /// Construct a new raw_svector_ostream. + /// + /// \arg O - The vector to write to; this *must* have at least 128 bytes of + /// free space in it. explicit raw_svector_ostream(SmallVectorImpl &O); ~raw_svector_ostream(); }; Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79434&r1=79433&r2=79434&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Aug 19 12:54:29 2009 @@ -95,6 +95,8 @@ OutBufEnd = OutBufStart+Size; OutBufCur = OutBufStart; BufferMode = Mode; + + assert(OutBufStart <= OutBufEnd && "Invalid size!"); } raw_ostream &raw_ostream::operator<<(unsigned long N) { @@ -478,15 +480,41 @@ // raw_svector_ostream //===----------------------------------------------------------------------===// +// The raw_svector_ostream implementation uses the SmallVector itself as the +// buffer for the raw_ostream. We guarantee that the raw_ostream buffer is +// always pointing past the end of the vector, but within the vector +// capacity. This allows raw_ostream to write directly into the correct place, +// and we only need to set the vector size when the data is flushed. + raw_svector_ostream::raw_svector_ostream(SmallVectorImpl &O) : OS(O) { + // Set up the initial external buffer. We enforce that the buffer must have at + // least 128 bytes free; raw_ostream itself only requires 64, but we want to + // make sure that we don't grow the buffer unnecessarily on destruction (when + // the data is flushed). See the FIXME below. + if (OS.capacity() - OS.size() < 128) + llvm_report_error("Invalid argument, must have at least 128 bytes free!"); + SetBuffer(OS.end(), OS.capacity() - OS.size()); } raw_svector_ostream::~raw_svector_ostream() { + // FIXME: Prevent resizing during this flush(). flush(); } void raw_svector_ostream::write_impl(const char *Ptr, size_t Size) { - OS.append(Ptr, Ptr + Size); + assert(Ptr == OS.end() && OS.size() + Size <= OS.capacity() && + "Invalid write_impl() call!"); + + // We don't need to copy the bytes, just commit the bytes to the + // SmallVector. + OS.set_size(OS.size() + Size); + + // Grow the vector if necessary. + if (OS.capacity() - OS.size() < 64) + OS.reserve(OS.capacity() * 2); + + // Update the buffer position. + SetBuffer(OS.end(), OS.capacity() - OS.size()); } uint64_t raw_svector_ostream::current_pos() { return OS.size(); } From resistor at mac.com Wed Aug 19 12:58:52 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 19 Aug 2009 17:58:52 -0000 Subject: [llvm-commits] [llvm] r79435 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200908191758.n7JHwqK6010473@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 19 12:58:52 2009 New Revision: 79435 URL: http://llvm.org/viewvc/llvm-project?rev=79435&view=rev Log: Add a first stab at describing LLVMContext. 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=79435&r1=79434&r2=79435&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Wed Aug 19 12:58:52 2009 @@ -147,6 +147,7 @@
  • Ending execution with llvm_shutdown()
  • Lazy initialization with ManagedStatic
  • +
  • Achieving Isolation with LLVMContext
  • @@ -2402,6 +2403,50 @@

    + + + +
    +

    +LLVMContext is an opaque class in the LLVM API which clients can use +to operate multiple, isolated instances of LLVM concurrently within the same +address space. For instance, in a hypothetical compile-server, the compilation +of an individual translation unit is conceptually independent from all the +others, and it would be desirable to be able to compile incoming translation +units concurrently on independent server threads. Fortunately, +LLVMContext exists to enable just this kind of scenario! +

    + +

    +Conceptually, LLVMContext provides isolation. Every LLVM entity +(Modules, Values, Types, Constants, etc.) +in LLVM's in-memory IR belongs to an LLVMContext. Entities in +different contexts cannot interact with each other: Modules in +different contexts cannot be linked together, Functions cannot be added +to Modules in different contexts, etc. What this means is that is is +safe to compile on multiple threads simultaneously, as long as no two threads +operate on entities within the same context. +

    + +

    +In practice, very few places in the API require the explicit specification of a +LLVMContext, other than the Type creation/lookup APIs. +Because every Type carries a reference to its owning context, most +other entities can determine what context they belong to by looking at their +own Type. If you are adding new entities to LLVM IR, please try to +maintain this interface design. +

    + +

    +For clients that do not require the benefits of isolation, LLVM +provides a convenience API getGlobalContext(). This returns a global, +lazily initialized LLVMContext that may be used in situations where +isolation is not a concern. +

    +
    +
    Advanced Topics From david_goodwin at apple.com Wed Aug 19 13:00:44 2009 From: david_goodwin at apple.com (David Goodwin) Date: Wed, 19 Aug 2009 18:00:44 -0000 Subject: [llvm-commits] [llvm] r79436 - in /llvm/trunk/lib/Target/ARM: ARMInstrInfo.td ARMInstrThumb.td ARMInstrThumb2.td ARMSchedule.td ARMScheduleV6.td ARMScheduleV7.td Message-ID: <200908191800.n7JI0jjf010730@zion.cs.uiuc.edu> Author: david_goodwin Date: Wed Aug 19 13:00:44 2009 New Revision: 79436 URL: http://llvm.org/viewvc/llvm-project?rev=79436&view=rev Log: Update Cortex-A8 instruction itineraries for integer instructions. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/lib/Target/ARM/ARMSchedule.td llvm/trunk/lib/Target/ARM/ARMScheduleV6.td llvm/trunk/lib/Target/ARM/ARMScheduleV7.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=79436&r1=79435&r2=79436&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Wed Aug 19 13:00:44 2009 @@ -344,18 +344,18 @@ multiclass AsI1_bin_irs opcod, string opc, PatFrag opnode, bit Commutable = 0> { def ri : AsI1 { let Inst{25} = 1; } def rr : AsI1 { let Inst{25} = 0; let isCommutable = Commutable; } def rs : AsI1 { let Inst{25} = 0; } @@ -367,18 +367,18 @@ multiclass AI1_bin_s_irs opcod, string opc, PatFrag opnode, bit Commutable = 0> { def ri : AI1 { let Inst{25} = 1; } def rr : AI1 { let isCommutable = Commutable; let Inst{25} = 0; } def rs : AI1 { let Inst{25} = 0; } @@ -391,18 +391,18 @@ let Defs = [CPSR] in { multiclass AI1_cmp_irs opcod, string opc, PatFrag opnode, bit Commutable = 0> { - def ri : AI1 { let Inst{25} = 1; } - def rr : AI1 { let Inst{25} = 0; let isCommutable = Commutable; } - def rs : AI1 { let Inst{25} = 0; @@ -414,15 +414,15 @@ /// register and one whose operand is a register rotated by 8/16/24. /// FIXME: Remove the 'r' variant. Its rot_imm is zero. multiclass AI_unary_rrot opcod, string opc, PatFrag opnode> { - def r : AExtI, + def r : AExtI, Requires<[IsARM, HasV6]> { let Inst{19-16} = 0b1111; } - def r_rot : AExtI, + def r_rot : AExtI, Requires<[IsARM, HasV6]> { let Inst{19-16} = 0b1111; } @@ -432,11 +432,11 @@ /// register and one whose operand is a register rotated by 8/16/24. multiclass AI_bin_rrot opcod, string opc, PatFrag opnode> { def rr : AExtI, Requires<[IsARM, HasV6]>; def rr_rot : AExtI, Requires<[IsARM, HasV6]>; @@ -447,41 +447,41 @@ multiclass AI1_adde_sube_irs opcod, string opc, PatFrag opnode, bit Commutable = 0> { def ri : AsI1, Requires<[IsARM, CarryDefIsUnused]> { let Inst{25} = 1; } def rr : AsI1, Requires<[IsARM, CarryDefIsUnused]> { let isCommutable = Commutable; let Inst{25} = 0; } def rs : AsI1, Requires<[IsARM, CarryDefIsUnused]> { let Inst{25} = 0; } // Carry setting variants def Sri : AXI1, Requires<[IsARM, CarryDefIsUsed]> { let Defs = [CPSR]; let Inst{25} = 1; } def Srr : AXI1, Requires<[IsARM, CarryDefIsUsed]> { let Defs = [CPSR]; let Inst{25} = 0; } def Srs : AXI1, Requires<[IsARM, CarryDefIsUsed]> { let Defs = [CPSR]; @@ -529,42 +529,42 @@ // Address computation and loads and stores in PIC mode. let isNotDuplicable = 1 in { def PICADD : AXI1<0b0100, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p), - Pseudo, IIC_iALU, "$cp:\n\tadd$p $dst, pc, $a", + Pseudo, IIC_iALUr, "$cp:\n\tadd$p $dst, pc, $a", [(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>; let AddedComplexity = 10 in { let canFoldAsLoad = 1 in def PICLDR : AXI2ldw<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoad, "${addr:label}:\n\tldr$p $dst, $addr", + Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr$p $dst, $addr", [(set GPR:$dst, (load addrmodepc:$addr))]>; def PICLDRH : AXI3ldh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoad, "${addr:label}:\n\tldr${p}h $dst, $addr", + Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr${p}h $dst, $addr", [(set GPR:$dst, (zextloadi16 addrmodepc:$addr))]>; def PICLDRB : AXI2ldb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoad, "${addr:label}:\n\tldr${p}b $dst, $addr", + Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr${p}b $dst, $addr", [(set GPR:$dst, (zextloadi8 addrmodepc:$addr))]>; def PICLDRSH : AXI3ldsh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoad, "${addr:label}:\n\tldr${p}sh $dst, $addr", + Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr${p}sh $dst, $addr", [(set GPR:$dst, (sextloadi16 addrmodepc:$addr))]>; def PICLDRSB : AXI3ldsb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoad, "${addr:label}:\n\tldr${p}sb $dst, $addr", + Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr${p}sb $dst, $addr", [(set GPR:$dst, (sextloadi8 addrmodepc:$addr))]>; } let AddedComplexity = 10 in { def PICSTR : AXI2stw<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p), - Pseudo, IIC_iStore, "${addr:label}:\n\tstr$p $src, $addr", + Pseudo, IIC_iStorer, "${addr:label}:\n\tstr$p $src, $addr", [(store GPR:$src, addrmodepc:$addr)]>; def PICSTRH : AXI3sth<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p), - Pseudo, IIC_iStore, "${addr:label}:\n\tstr${p}h $src, $addr", + Pseudo, IIC_iStorer, "${addr:label}:\n\tstr${p}h $src, $addr", [(truncstorei16 GPR:$src, addrmodepc:$addr)]>; def PICSTRB : AXI2stb<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p), - Pseudo, IIC_iStore, "${addr:label}:\n\tstr${p}b $src, $addr", + Pseudo, IIC_iStorer, "${addr:label}:\n\tstr${p}b $src, $addr", [(truncstorei8 GPR:$src, addrmodepc:$addr)]>; } } // isNotDuplicable = 1 @@ -573,7 +573,7 @@ // LEApcrel - Load a pc-relative address into a register without offending the // assembler. def LEApcrel : AXI1<0x0, (outs GPR:$dst), (ins i32imm:$label, pred:$p), - Pseudo, IIC_iLoad, + Pseudo, IIC_iALUi, !strconcat(!strconcat(".set ${:private}PCRELV${:uid}, ($label-(", "${:private}PCRELL${:uid}+8))\n"), !strconcat("${:private}PCRELL${:uid}:\n\t", @@ -582,7 +582,7 @@ def LEApcrelJT : AXI1<0x0, (outs GPR:$dst), (ins i32imm:$label, lane_cst:$id, pred:$p), - Pseudo, IIC_iLoad, + Pseudo, IIC_iALUi, !strconcat(!strconcat(".set ${:private}PCRELV${:uid}, " "(${label}_${id}-(", "${:private}PCRELL${:uid}+8))\n"), @@ -736,139 +736,140 @@ // Load let canFoldAsLoad = 1 in -def LDR : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoad, +def LDR : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoadr, "ldr", " $dst, $addr", [(set GPR:$dst, (load addrmode2:$addr))]>; // Special LDR for loads from non-pc-relative constpools. let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in -def LDRcp : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoad, +def LDRcp : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoadr, "ldr", " $dst, $addr", []>; // Loads with zero extension -def LDRH : AI3ldh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm, IIC_iLoad, - "ldr", "h $dst, $addr", - [(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>; - -def LDRB : AI2ldb<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoad, - "ldr", "b $dst, $addr", - [(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>; +def LDRH : AI3ldh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm, + IIC_iLoadr, "ldr", "h $dst, $addr", + [(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>; + +def LDRB : AI2ldb<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, + IIC_iLoadr, "ldr", "b $dst, $addr", + [(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>; // Loads with sign extension -def LDRSH : AI3ldsh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm, IIC_iLoad, - "ldr", "sh $dst, $addr", - [(set GPR:$dst, (sextloadi16 addrmode3:$addr))]>; - -def LDRSB : AI3ldsb<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm, IIC_iLoad, - "ldr", "sb $dst, $addr", - [(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>; +def LDRSH : AI3ldsh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm, + IIC_iLoadr, "ldr", "sh $dst, $addr", + [(set GPR:$dst, (sextloadi16 addrmode3:$addr))]>; + +def LDRSB : AI3ldsb<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm, + IIC_iLoadr, "ldr", "sb $dst, $addr", + [(set GPR:$dst, (sextloadi8 addrmode3:$addr))]>; let mayLoad = 1 in { // Load doubleword def LDRD : AI3ldd<(outs GPR:$dst1, GPR:$dst2), (ins addrmode3:$addr), LdMiscFrm, - IIC_iLoad, "ldr", "d $dst1, $addr", []>, Requires<[IsARM, HasV5T]>; + IIC_iLoadr, "ldr", "d $dst1, $addr", + []>, Requires<[IsARM, HasV5T]>; // Indexed loads def LDR_PRE : AI2ldwpr<(outs GPR:$dst, GPR:$base_wb), - (ins addrmode2:$addr), LdFrm, IIC_iLoad, + (ins addrmode2:$addr), LdFrm, IIC_iLoadru, "ldr", " $dst, $addr!", "$addr.base = $base_wb", []>; def LDR_POST : AI2ldwpo<(outs GPR:$dst, GPR:$base_wb), - (ins GPR:$base, am2offset:$offset), LdFrm, IIC_iLoad, + (ins GPR:$base, am2offset:$offset), LdFrm, IIC_iLoadru, "ldr", " $dst, [$base], $offset", "$base = $base_wb", []>; def LDRH_PRE : AI3ldhpr<(outs GPR:$dst, GPR:$base_wb), - (ins addrmode3:$addr), LdMiscFrm, IIC_iLoad, + (ins addrmode3:$addr), LdMiscFrm, IIC_iLoadru, "ldr", "h $dst, $addr!", "$addr.base = $base_wb", []>; def LDRH_POST : AI3ldhpo<(outs GPR:$dst, GPR:$base_wb), - (ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoad, + (ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoadru, "ldr", "h $dst, [$base], $offset", "$base = $base_wb", []>; def LDRB_PRE : AI2ldbpr<(outs GPR:$dst, GPR:$base_wb), - (ins addrmode2:$addr), LdFrm, IIC_iLoad, + (ins addrmode2:$addr), LdFrm, IIC_iLoadru, "ldr", "b $dst, $addr!", "$addr.base = $base_wb", []>; def LDRB_POST : AI2ldbpo<(outs GPR:$dst, GPR:$base_wb), - (ins GPR:$base,am2offset:$offset), LdFrm, IIC_iLoad, + (ins GPR:$base,am2offset:$offset), LdFrm, IIC_iLoadru, "ldr", "b $dst, [$base], $offset", "$base = $base_wb", []>; def LDRSH_PRE : AI3ldshpr<(outs GPR:$dst, GPR:$base_wb), - (ins addrmode3:$addr), LdMiscFrm, IIC_iLoad, + (ins addrmode3:$addr), LdMiscFrm, IIC_iLoadru, "ldr", "sh $dst, $addr!", "$addr.base = $base_wb", []>; def LDRSH_POST: AI3ldshpo<(outs GPR:$dst, GPR:$base_wb), - (ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoad, + (ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoadru, "ldr", "sh $dst, [$base], $offset", "$base = $base_wb", []>; def LDRSB_PRE : AI3ldsbpr<(outs GPR:$dst, GPR:$base_wb), - (ins addrmode3:$addr), LdMiscFrm, IIC_iLoad, + (ins addrmode3:$addr), LdMiscFrm, IIC_iLoadru, "ldr", "sb $dst, $addr!", "$addr.base = $base_wb", []>; def LDRSB_POST: AI3ldsbpo<(outs GPR:$dst, GPR:$base_wb), - (ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoad, + (ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoadru, "ldr", "sb $dst, [$base], $offset", "$base = $base_wb", []>; } // Store -def STR : AI2stw<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStore, +def STR : AI2stw<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStorer, "str", " $src, $addr", [(store GPR:$src, addrmode2:$addr)]>; // Stores with truncate -def STRH : AI3sth<(outs), (ins GPR:$src, addrmode3:$addr), StMiscFrm, IIC_iStore, +def STRH : AI3sth<(outs), (ins GPR:$src, addrmode3:$addr), StMiscFrm, IIC_iStorer, "str", "h $src, $addr", [(truncstorei16 GPR:$src, addrmode3:$addr)]>; -def STRB : AI2stb<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStore, +def STRB : AI2stb<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStorer, "str", "b $src, $addr", [(truncstorei8 GPR:$src, addrmode2:$addr)]>; // Store doubleword let mayStore = 1 in def STRD : AI3std<(outs), (ins GPR:$src1, GPR:$src2, addrmode3:$addr), - StMiscFrm, IIC_iStore, + StMiscFrm, IIC_iStorer, "str", "d $src1, $addr", []>, Requires<[IsARM, HasV5T]>; // Indexed stores def STR_PRE : AI2stwpr<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base, am2offset:$offset), - StFrm, IIC_iStore, + StFrm, IIC_iStoreru, "str", " $src, [$base, $offset]!", "$base = $base_wb", [(set GPR:$base_wb, (pre_store GPR:$src, GPR:$base, am2offset:$offset))]>; def STR_POST : AI2stwpo<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base,am2offset:$offset), - StFrm, IIC_iStore, + StFrm, IIC_iStoreru, "str", " $src, [$base], $offset", "$base = $base_wb", [(set GPR:$base_wb, (post_store GPR:$src, GPR:$base, am2offset:$offset))]>; def STRH_PRE : AI3sthpr<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base,am3offset:$offset), - StMiscFrm, IIC_iStore, + StMiscFrm, IIC_iStoreru, "str", "h $src, [$base, $offset]!", "$base = $base_wb", [(set GPR:$base_wb, (pre_truncsti16 GPR:$src, GPR:$base,am3offset:$offset))]>; def STRH_POST: AI3sthpo<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base,am3offset:$offset), - StMiscFrm, IIC_iStore, + StMiscFrm, IIC_iStoreru, "str", "h $src, [$base], $offset", "$base = $base_wb", [(set GPR:$base_wb, (post_truncsti16 GPR:$src, GPR:$base, am3offset:$offset))]>; def STRB_PRE : AI2stbpr<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base,am2offset:$offset), - StFrm, IIC_iStore, + StFrm, IIC_iStoreru, "str", "b $src, [$base, $offset]!", "$base = $base_wb", [(set GPR:$base_wb, (pre_truncsti8 GPR:$src, GPR:$base, am2offset:$offset))]>; def STRB_POST: AI2stbpo<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base,am2offset:$offset), - StFrm, IIC_iStore, + StFrm, IIC_iStoreru, "str", "b $src, [$base], $offset", "$base = $base_wb", [(set GPR:$base_wb, (post_truncsti8 GPR:$src, GPR:$base, am2offset:$offset))]>; @@ -881,13 +882,13 @@ let mayLoad = 1 in def LDM : AXI4ld<(outs), (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops), - LdStMulFrm, IIC_iLoad, "ldm${p}${addr:submode} $addr, $dst1", + LdStMulFrm, IIC_iLoadm, "ldm${p}${addr:submode} $addr, $dst1", []>; let mayStore = 1 in def STM : AXI4st<(outs), (ins addrmode4:$addr, pred:$p, reglist:$src1, variable_ops), - LdStMulFrm, IIC_iStore, "stm${p}${addr:submode} $addr, $src1", + LdStMulFrm, IIC_iStorem, "stm${p}${addr:submode} $addr, $src1", []>; //===----------------------------------------------------------------------===// @@ -895,17 +896,17 @@ // let neverHasSideEffects = 1 in -def MOVr : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), DPFrm, IIC_iALU, +def MOVr : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), DPFrm, IIC_iMOVr, "mov", " $dst, $src", []>, UnaryDP; def MOVs : AsI1<0b1101, (outs GPR:$dst), (ins so_reg:$src), - DPSoRegFrm, IIC_iALU, + DPSoRegFrm, IIC_iMOVsr, "mov", " $dst, $src", [(set GPR:$dst, so_reg:$src)]>, UnaryDP; let isReMaterializable = 1, isAsCheapAsAMove = 1 in -def MOVi : AsI1<0b1101, (outs GPR:$dst), (ins so_imm:$src), DPFrm, IIC_iALU, +def MOVi : AsI1<0b1101, (outs GPR:$dst), (ins so_imm:$src), DPFrm, IIC_iMOVi, "mov", " $dst, $src", [(set GPR:$dst, so_imm:$src)]>, UnaryDP; -def MOVrx : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo, IIC_iALU, +def MOVrx : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo, IIC_iMOVsi, "mov", " $dst, $src, rrx", [(set GPR:$dst, (ARMrrx GPR:$src))]>, UnaryDP; @@ -914,10 +915,10 @@ let Defs = [CPSR] in { def MOVsrl_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo, - IIC_iALU, "mov", "s $dst, $src, lsr #1", + IIC_iMOVsi, "mov", "s $dst, $src, lsr #1", [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>, UnaryDP; def MOVsra_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo, - IIC_iALU, "mov", "s $dst, $src, asr #1", + IIC_iMOVsi, "mov", "s $dst, $src, asr #1", [(set GPR:$dst, (ARMsra_flag GPR:$src))]>, UnaryDP; } @@ -987,30 +988,30 @@ // These don't define reg/reg forms, because they are handled above. def RSBri : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm, - IIC_iALU, "rsb", " $dst, $a, $b", + IIC_iALUi, "rsb", " $dst, $a, $b", [(set GPR:$dst, (sub so_imm:$b, GPR:$a))]>; def RSBrs : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm, - IIC_iALU, "rsb", " $dst, $a, $b", + IIC_iALUsr, "rsb", " $dst, $a, $b", [(set GPR:$dst, (sub so_reg:$b, GPR:$a))]>; // RSB with 's' bit set. let Defs = [CPSR] in { def RSBSri : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm, - IIC_iALU, "rsb", "s $dst, $a, $b", + IIC_iALUi, "rsb", "s $dst, $a, $b", [(set GPR:$dst, (subc so_imm:$b, GPR:$a))]>; def RSBSrs : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm, - IIC_iALU, "rsb", "s $dst, $a, $b", + IIC_iALUsr, "rsb", "s $dst, $a, $b", [(set GPR:$dst, (subc so_reg:$b, GPR:$a))]>; } let Uses = [CPSR] in { def RSCri : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), - DPFrm, IIC_iALU, "rsc", " $dst, $a, $b", + DPFrm, IIC_iALUi, "rsc", " $dst, $a, $b", [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>, Requires<[IsARM, CarryDefIsUnused]>; def RSCrs : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), - DPSoRegFrm, IIC_iALU, "rsc", " $dst, $a, $b", + DPSoRegFrm, IIC_iALUsr, "rsc", " $dst, $a, $b", [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>, Requires<[IsARM, CarryDefIsUnused]>; } @@ -1018,11 +1019,11 @@ // FIXME: Allow these to be predicated. let Defs = [CPSR], Uses = [CPSR] in { def RSCSri : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), - DPFrm, IIC_iALU, "rscs $dst, $a, $b", + DPFrm, IIC_iALUi, "rscs $dst, $a, $b", [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>, Requires<[IsARM, CarryDefIsUnused]>; def RSCSrs : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), - DPSoRegFrm, IIC_iALU, "rscs $dst, $a, $b", + DPSoRegFrm, IIC_iALUsr, "rscs $dst, $a, $b", [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>, Requires<[IsARM, CarryDefIsUnused]>; } @@ -1057,7 +1058,7 @@ BinOpFrag<(and node:$LHS, (not node:$RHS))>>; def BFC : I<(outs GPR:$dst), (ins GPR:$src, bf_inv_mask_imm:$imm), - AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iALU, + AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iALUi, "bfc", " $dst, $imm", "$src = $dst", [(set GPR:$dst, (and GPR:$src, bf_inv_mask_imm:$imm))]>, Requires<[IsARM, HasV6T2]> { @@ -1065,15 +1066,15 @@ let Inst{6-0} = 0b0011111; } -def MVNr : AsI1<0b1111, (outs GPR:$dst), (ins GPR:$src), DPFrm, IIC_iALU, +def MVNr : AsI1<0b1111, (outs GPR:$dst), (ins GPR:$src), DPFrm, IIC_iMOVr, "mvn", " $dst, $src", [(set GPR:$dst, (not GPR:$src))]>, UnaryDP; def MVNs : AsI1<0b1111, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm, - IIC_iALU, "mvn", " $dst, $src", + IIC_iMOVsr, "mvn", " $dst, $src", [(set GPR:$dst, (not so_reg:$src))]>, UnaryDP; let isReMaterializable = 1, isAsCheapAsAMove = 1 in -def MVNi : AsI1<0b1111, (outs GPR:$dst), (ins so_imm:$imm), DPFrm, IIC_iALU, - "mvn", " $dst, $imm", +def MVNi : AsI1<0b1111, (outs GPR:$dst), (ins so_imm:$imm), DPFrm, + IIC_iMOVi, "mvn", " $dst, $imm", [(set GPR:$dst, so_imm_not:$imm)]>,UnaryDP; def : ARMPat<(and GPR:$src, so_imm_not:$imm), @@ -1084,16 +1085,16 @@ // let isCommutable = 1 in -def MUL : AsMul1I<0b0000000, (outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMPYw, - "mul", " $dst, $a, $b", +def MUL : AsMul1I<0b0000000, (outs GPR:$dst), (ins GPR:$a, GPR:$b), + IIC_iMUL32, "mul", " $dst, $a, $b", [(set GPR:$dst, (mul GPR:$a, GPR:$b))]>; def MLA : AsMul1I<0b0000001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), - IIC_iMPYw, "mla", " $dst, $a, $b, $c", + IIC_iMAC32, "mla", " $dst, $a, $b, $c", [(set GPR:$dst, (add (mul GPR:$a, GPR:$b), GPR:$c))]>; def MLS : AMul1I<0b0000011, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), - IIC_iMPYw, "mls", " $dst, $a, $b, $c", + IIC_iMAC32, "mls", " $dst, $a, $b, $c", [(set GPR:$dst, (sub GPR:$c, (mul GPR:$a, GPR:$b)))]>, Requires<[IsARM, HasV6T2]>; @@ -1101,32 +1102,32 @@ let neverHasSideEffects = 1 in { let isCommutable = 1 in { def SMULL : AsMul1I<0b0000110, (outs GPR:$ldst, GPR:$hdst), - (ins GPR:$a, GPR:$b), IIC_iMPYl, + (ins GPR:$a, GPR:$b), IIC_iMUL64, "smull", " $ldst, $hdst, $a, $b", []>; def UMULL : AsMul1I<0b0000100, (outs GPR:$ldst, GPR:$hdst), - (ins GPR:$a, GPR:$b), IIC_iMPYl, + (ins GPR:$a, GPR:$b), IIC_iMUL64, "umull", " $ldst, $hdst, $a, $b", []>; } // Multiply + accumulate def SMLAL : AsMul1I<0b0000111, (outs GPR:$ldst, GPR:$hdst), - (ins GPR:$a, GPR:$b), IIC_iMPYl, + (ins GPR:$a, GPR:$b), IIC_iMAC64, "smlal", " $ldst, $hdst, $a, $b", []>; def UMLAL : AsMul1I<0b0000101, (outs GPR:$ldst, GPR:$hdst), - (ins GPR:$a, GPR:$b), IIC_iMPYl, + (ins GPR:$a, GPR:$b), IIC_iMAC64, "umlal", " $ldst, $hdst, $a, $b", []>; def UMAAL : AMul1I <0b0000010, (outs GPR:$ldst, GPR:$hdst), - (ins GPR:$a, GPR:$b), IIC_iMPYl, + (ins GPR:$a, GPR:$b), IIC_iMAC64, "umaal", " $ldst, $hdst, $a, $b", []>, Requires<[IsARM, HasV6]>; } // neverHasSideEffects // Most significant word multiply def SMMUL : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b), - IIC_iMPYw, "smmul", " $dst, $a, $b", + IIC_iMUL32, "smmul", " $dst, $a, $b", [(set GPR:$dst, (mulhs GPR:$a, GPR:$b))]>, Requires<[IsARM, HasV6]> { let Inst{7-4} = 0b0001; @@ -1134,7 +1135,7 @@ } def SMMLA : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), - IIC_iMPYw, "smmla", " $dst, $a, $b, $c", + IIC_iMAC32, "smmla", " $dst, $a, $b, $c", [(set GPR:$dst, (add (mulhs GPR:$a, GPR:$b), GPR:$c))]>, Requires<[IsARM, HasV6]> { let Inst{7-4} = 0b0001; @@ -1142,7 +1143,7 @@ def SMMLS : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), - IIC_iMPYw, "smmls", " $dst, $a, $b, $c", + IIC_iMAC32, "smmls", " $dst, $a, $b, $c", [(set GPR:$dst, (sub GPR:$c, (mulhs GPR:$a, GPR:$b)))]>, Requires<[IsARM, HasV6]> { let Inst{7-4} = 0b1101; @@ -1150,7 +1151,7 @@ multiclass AI_smul { def BB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b), - IIC_iMPYw, !strconcat(opc, "bb"), " $dst, $a, $b", + IIC_iMUL32, !strconcat(opc, "bb"), " $dst, $a, $b", [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16), (sext_inreg GPR:$b, i16)))]>, Requires<[IsARM, HasV5TE]> { @@ -1159,7 +1160,7 @@ } def BT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b), - IIC_iMPYw, !strconcat(opc, "bt"), " $dst, $a, $b", + IIC_iMUL32, !strconcat(opc, "bt"), " $dst, $a, $b", [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16), (sra GPR:$b, (i32 16))))]>, Requires<[IsARM, HasV5TE]> { @@ -1168,7 +1169,7 @@ } def TB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b), - IIC_iMPYw, !strconcat(opc, "tb"), " $dst, $a, $b", + IIC_iMUL32, !strconcat(opc, "tb"), " $dst, $a, $b", [(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)), (sext_inreg GPR:$b, i16)))]>, Requires<[IsARM, HasV5TE]> { @@ -1177,7 +1178,7 @@ } def TT : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b), - IIC_iMPYw, !strconcat(opc, "tt"), " $dst, $a, $b", + IIC_iMUL32, !strconcat(opc, "tt"), " $dst, $a, $b", [(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)), (sra GPR:$b, (i32 16))))]>, Requires<[IsARM, HasV5TE]> { @@ -1186,7 +1187,7 @@ } def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b), - IIC_iMPYh, !strconcat(opc, "wb"), " $dst, $a, $b", + IIC_iMUL16, !strconcat(opc, "wb"), " $dst, $a, $b", [(set GPR:$dst, (sra (opnode GPR:$a, (sext_inreg GPR:$b, i16)), (i32 16)))]>, Requires<[IsARM, HasV5TE]> { @@ -1195,7 +1196,7 @@ } def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b), - IIC_iMPYh, !strconcat(opc, "wt"), " $dst, $a, $b", + IIC_iMUL16, !strconcat(opc, "wt"), " $dst, $a, $b", [(set GPR:$dst, (sra (opnode GPR:$a, (sra GPR:$b, (i32 16))), (i32 16)))]>, Requires<[IsARM, HasV5TE]> { @@ -1207,7 +1208,7 @@ multiclass AI_smla { def BB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), - IIC_iMPYw, !strconcat(opc, "bb"), " $dst, $a, $b, $acc", + IIC_iMAC16, !strconcat(opc, "bb"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16), (sext_inreg GPR:$b, i16))))]>, @@ -1217,7 +1218,7 @@ } def BT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), - IIC_iMPYw, !strconcat(opc, "bt"), " $dst, $a, $b, $acc", + IIC_iMAC16, !strconcat(opc, "bt"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16), (sra GPR:$b, (i32 16)))))]>, Requires<[IsARM, HasV5TE]> { @@ -1226,7 +1227,7 @@ } def TB : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), - IIC_iMPYw, !strconcat(opc, "tb"), " $dst, $a, $b, $acc", + IIC_iMAC16, !strconcat(opc, "tb"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)), (sext_inreg GPR:$b, i16))))]>, Requires<[IsARM, HasV5TE]> { @@ -1235,7 +1236,7 @@ } def TT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), - IIC_iMPYw, !strconcat(opc, "tt"), " $dst, $a, $b, $acc", + IIC_iMAC16, !strconcat(opc, "tt"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)), (sra GPR:$b, (i32 16)))))]>, Requires<[IsARM, HasV5TE]> { @@ -1244,7 +1245,7 @@ } def WB : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), - IIC_iMPYw, !strconcat(opc, "wb"), " $dst, $a, $b, $acc", + IIC_iMAC16, !strconcat(opc, "wb"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a, (sext_inreg GPR:$b, i16)), (i32 16))))]>, Requires<[IsARM, HasV5TE]> { @@ -1253,7 +1254,7 @@ } def WT : AMulxyI<0b0001001, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), - IIC_iMPYw, !strconcat(opc, "wt"), " $dst, $a, $b, $acc", + IIC_iMAC16, !strconcat(opc, "wt"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a, (sra GPR:$b, (i32 16))), (i32 16))))]>, Requires<[IsARM, HasV5TE]> { @@ -1272,7 +1273,7 @@ // Misc. Arithmetic Instructions. // -def CLZ : AMiscA1I<0b000010110, (outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def CLZ : AMiscA1I<0b000010110, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr, "clz", " $dst, $src", [(set GPR:$dst, (ctlz GPR:$src))]>, Requires<[IsARM, HasV5T]> { let Inst{7-4} = 0b0001; @@ -1280,7 +1281,7 @@ let Inst{19-16} = 0b1111; } -def REV : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def REV : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr, "rev", " $dst, $src", [(set GPR:$dst, (bswap GPR:$src))]>, Requires<[IsARM, HasV6]> { let Inst{7-4} = 0b0011; @@ -1288,7 +1289,7 @@ let Inst{19-16} = 0b1111; } -def REV16 : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def REV16 : AMiscA1I<0b01101011, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr, "rev16", " $dst, $src", [(set GPR:$dst, (or (and (srl GPR:$src, (i32 8)), 0xFF), @@ -1301,7 +1302,7 @@ let Inst{19-16} = 0b1111; } -def REVSH : AMiscA1I<0b01101111, (outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def REVSH : AMiscA1I<0b01101111, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr, "revsh", " $dst, $src", [(set GPR:$dst, (sext_inreg @@ -1315,7 +1316,7 @@ def PKHBT : AMiscA1I<0b01101000, (outs GPR:$dst), (ins GPR:$src1, GPR:$src2, i32imm:$shamt), - IIC_iALU, "pkhbt", " $dst, $src1, $src2, LSL $shamt", + IIC_iALUsi, "pkhbt", " $dst, $src1, $src2, LSL $shamt", [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF), (and (shl GPR:$src2, (i32 imm:$shamt)), 0xFFFF0000)))]>, @@ -1332,7 +1333,7 @@ def PKHTB : AMiscA1I<0b01101000, (outs GPR:$dst), (ins GPR:$src1, GPR:$src2, i32imm:$shamt), - IIC_iALU, "pkhtb", " $dst, $src1, $src2, ASR $shamt", + IIC_iALUsi, "pkhtb", " $dst, $src1, $src2, ASR $shamt", [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000), (and (sra GPR:$src2, imm16_31:$shamt), 0xFFFF)))]>, Requires<[IsARM, HasV6]> { @@ -1378,18 +1379,18 @@ // FIXME: should be able to write a pattern for ARMcmov, but can't use // a two-value operand where a dag node expects two operands. :( def MOVCCr : AI1<0b1101, (outs GPR:$dst), (ins GPR:$false, GPR:$true), DPFrm, - IIC_iALU, "mov", " $dst, $true", + IIC_iCMOVr, "mov", " $dst, $true", [/*(set GPR:$dst, (ARMcmov GPR:$false, GPR:$true, imm:$cc, CCR:$ccr))*/]>, RegConstraint<"$false = $dst">, UnaryDP; def MOVCCs : AI1<0b1101, (outs GPR:$dst), - (ins GPR:$false, so_reg:$true), DPSoRegFrm, IIC_iALU, + (ins GPR:$false, so_reg:$true), DPSoRegFrm, IIC_iCMOVsr, "mov", " $dst, $true", [/*(set GPR:$dst, (ARMcmov GPR:$false, so_reg:$true, imm:$cc, CCR:$ccr))*/]>, RegConstraint<"$false = $dst">, UnaryDP; def MOVCCi : AI1<0b1101, (outs GPR:$dst), - (ins GPR:$false, so_imm:$true), DPFrm, IIC_iALU, + (ins GPR:$false, so_imm:$true), DPFrm, IIC_iCMOVi, "mov", " $dst, $true", [/*(set GPR:$dst, (ARMcmov GPR:$false, so_imm:$true, imm:$cc, CCR:$ccr))*/]>, RegConstraint<"$false = $dst">, UnaryDP; @@ -1451,7 +1452,7 @@ // Two piece so_imms. let isReMaterializable = 1 in def MOVi2pieces : AI1x2<(outs GPR:$dst), (ins so_imm2part:$src), - Pseudo, IIC_iALU, + Pseudo, IIC_iMOVi, "mov", " $dst, $src", [(set GPR:$dst, so_imm2part:$src)]>; Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=79436&r1=79435&r2=79436&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Wed Aug 19 13:00:44 2009 @@ -129,32 +129,32 @@ // For both thumb1 and thumb2. let isNotDuplicable = 1 in -def tPICADD : TIt<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp), IIC_iALU, +def tPICADD : TIt<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp), IIC_iALUr, "$cp:\n\tadd $dst, pc", [(set GPR:$dst, (ARMpic_add GPR:$lhs, imm:$cp))]>; // PC relative add. -def tADDrPCi : T1I<(outs tGPR:$dst), (ins i32imm:$rhs), IIC_iALU, +def tADDrPCi : T1I<(outs tGPR:$dst), (ins i32imm:$rhs), IIC_iALUi, "add $dst, pc, $rhs * 4", []>; // ADD rd, sp, #imm8 -def tADDrSPi : T1I<(outs tGPR:$dst), (ins GPR:$sp, i32imm:$rhs), IIC_iALU, +def tADDrSPi : T1I<(outs tGPR:$dst), (ins GPR:$sp, i32imm:$rhs), IIC_iALUi, "add $dst, $sp, $rhs * 4 @ addrspi", []>; // ADD sp, sp, #imm7 -def tADDspi : TIt<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), IIC_iALU, +def tADDspi : TIt<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), IIC_iALUi, "add $dst, $rhs * 4", []>; // SUB sp, sp, #imm7 -def tSUBspi : TIt<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), IIC_iALU, +def tSUBspi : TIt<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), IIC_iALUi, "sub $dst, $rhs * 4", []>; // ADD rm, sp -def tADDrSP : TIt<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, +def tADDrSP : TIt<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr, "add $dst, $rhs", []>; // ADD sp, rm -def tADDspr : TIt<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, +def tADDspr : TIt<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr, "add $dst, $rhs", []>; // Pseudo instruction that will expand into a tSUBspi + a copy. @@ -276,71 +276,71 @@ // let canFoldAsLoad = 1 in -def tLDR : T1pI4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr), IIC_iLoad, +def tLDR : T1pI4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr), IIC_iLoadr, "ldr", " $dst, $addr", [(set tGPR:$dst, (load t_addrmode_s4:$addr))]>; -def tLDRB : T1pI1<(outs tGPR:$dst), (ins t_addrmode_s1:$addr), IIC_iLoad, +def tLDRB : T1pI1<(outs tGPR:$dst), (ins t_addrmode_s1:$addr), IIC_iLoadr, "ldrb", " $dst, $addr", [(set tGPR:$dst, (zextloadi8 t_addrmode_s1:$addr))]>; -def tLDRH : T1pI2<(outs tGPR:$dst), (ins t_addrmode_s2:$addr), IIC_iLoad, +def tLDRH : T1pI2<(outs tGPR:$dst), (ins t_addrmode_s2:$addr), IIC_iLoadr, "ldrh", " $dst, $addr", [(set tGPR:$dst, (zextloadi16 t_addrmode_s2:$addr))]>; let AddedComplexity = 10 in -def tLDRSB : T1pI1<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), IIC_iLoad, +def tLDRSB : T1pI1<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), IIC_iLoadr, "ldrsb", " $dst, $addr", [(set tGPR:$dst, (sextloadi8 t_addrmode_rr:$addr))]>; let AddedComplexity = 10 in -def tLDRSH : T1pI2<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), IIC_iLoad, +def tLDRSH : T1pI2<(outs tGPR:$dst), (ins t_addrmode_rr:$addr), IIC_iLoadr, "ldrsh", " $dst, $addr", [(set tGPR:$dst, (sextloadi16 t_addrmode_rr:$addr))]>; let canFoldAsLoad = 1 in -def tLDRspi : T1pIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), IIC_iLoad, +def tLDRspi : T1pIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), IIC_iLoadi, "ldr", " $dst, $addr", [(set tGPR:$dst, (load t_addrmode_sp:$addr))]>; // Special instruction for restore. It cannot clobber condition register // when it's expanded by eliminateCallFramePseudoInstr(). let canFoldAsLoad = 1, mayLoad = 1 in -def tRestore : T1pIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), IIC_iLoad, +def tRestore : T1pIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), IIC_iLoadi, "ldr", " $dst, $addr", []>; // Load tconstpool // FIXME: Added .n suffix to workaround a Darwin assembler bug. let canFoldAsLoad = 1 in -def tLDRpci : T1pIs<(outs tGPR:$dst), (ins i32imm:$addr), IIC_iLoad, +def tLDRpci : T1pIs<(outs tGPR:$dst), (ins i32imm:$addr), IIC_iLoadi, "ldr", ".n $dst, $addr", [(set tGPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>; // Special LDR for loads from non-pc-relative constpools. let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in -def tLDRcp : T1pIs<(outs tGPR:$dst), (ins i32imm:$addr), IIC_iLoad, +def tLDRcp : T1pIs<(outs tGPR:$dst), (ins i32imm:$addr), IIC_iLoadi, "ldr", " $dst, $addr", []>; -def tSTR : T1pI4<(outs), (ins tGPR:$src, t_addrmode_s4:$addr), IIC_iStore, +def tSTR : T1pI4<(outs), (ins tGPR:$src, t_addrmode_s4:$addr), IIC_iStorer, "str", " $src, $addr", [(store tGPR:$src, t_addrmode_s4:$addr)]>; -def tSTRB : T1pI1<(outs), (ins tGPR:$src, t_addrmode_s1:$addr), IIC_iStore, +def tSTRB : T1pI1<(outs), (ins tGPR:$src, t_addrmode_s1:$addr), IIC_iStorer, "strb", " $src, $addr", [(truncstorei8 tGPR:$src, t_addrmode_s1:$addr)]>; -def tSTRH : T1pI2<(outs), (ins tGPR:$src, t_addrmode_s2:$addr), IIC_iStore, +def tSTRH : T1pI2<(outs), (ins tGPR:$src, t_addrmode_s2:$addr), IIC_iStorer, "strh", " $src, $addr", [(truncstorei16 tGPR:$src, t_addrmode_s2:$addr)]>; -def tSTRspi : T1pIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), IIC_iStore, +def tSTRspi : T1pIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), IIC_iStorei, "str", " $src, $addr", [(store tGPR:$src, t_addrmode_sp:$addr)]>; let mayStore = 1 in { // Special instruction for spill. It cannot clobber condition register // when it's expanded by eliminateCallFramePseudoInstr(). -def tSpill : T1pIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), IIC_iStore, +def tSpill : T1pIs<(outs), (ins tGPR:$src, t_addrmode_sp:$addr), IIC_iStorei, "str", " $src, $addr", []>; } @@ -352,13 +352,13 @@ let mayLoad = 1 in def tLDM : T1I<(outs), (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops), - IIC_iLoad, + IIC_iLoadm, "ldm${addr:submode}${p} $addr, $dst1", []>; let mayStore = 1 in def tSTM : T1I<(outs), (ins addrmode4:$addr, pred:$p, reglist:$src1, variable_ops), - IIC_iStore, + IIC_iStorem, "stm${addr:submode}${p} $addr, $src1", []>; let mayLoad = 1, Uses = [SP], Defs = [SP] in @@ -375,66 +375,66 @@ // Add with carry register let isCommutable = 1, Uses = [CPSR] in -def tADC : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tADC : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALUr, "adc", " $dst, $rhs", [(set tGPR:$dst, (adde tGPR:$lhs, tGPR:$rhs))]>; // Add immediate -def tADDi3 : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALU, +def tADDi3 : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALUi, "add", " $dst, $lhs, $rhs", [(set tGPR:$dst, (add tGPR:$lhs, imm0_7:$rhs))]>; -def tADDi8 : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALU, +def tADDi8 : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALUi, "add", " $dst, $rhs", [(set tGPR:$dst, (add tGPR:$lhs, imm8_255:$rhs))]>; // Add register let isCommutable = 1 in -def tADDrr : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tADDrr : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALUr, "add", " $dst, $lhs, $rhs", [(set tGPR:$dst, (add tGPR:$lhs, tGPR:$rhs))]>; let neverHasSideEffects = 1 in -def tADDhirr : T1pIt<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, +def tADDhirr : T1pIt<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr, "add", " $dst, $rhs @ addhirr", []>; // And register let isCommutable = 1 in -def tAND : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tAND : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALUr, "and", " $dst, $rhs", [(set tGPR:$dst, (and tGPR:$lhs, tGPR:$rhs))]>; // ASR immediate -def tASRri : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALU, +def tASRri : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iMOVsi, "asr", " $dst, $lhs, $rhs", [(set tGPR:$dst, (sra tGPR:$lhs, (i32 imm:$rhs)))]>; // ASR register -def tASRrr : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tASRrr : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iMOVsr, "asr", " $dst, $rhs", [(set tGPR:$dst, (sra tGPR:$lhs, tGPR:$rhs))]>; // BIC register -def tBIC : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tBIC : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALUr, "bic", " $dst, $rhs", [(set tGPR:$dst, (and tGPR:$lhs, (not tGPR:$rhs)))]>; // CMN register let Defs = [CPSR] in { -def tCMN : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tCMN : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iCMPr, "cmn", " $lhs, $rhs", [(ARMcmp tGPR:$lhs, (ineg tGPR:$rhs))]>; -def tCMNZ : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tCMNZ : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iCMPr, "cmn", " $lhs, $rhs", [(ARMcmpZ tGPR:$lhs, (ineg tGPR:$rhs))]>; } // CMP immediate let Defs = [CPSR] in { -def tCMPi8 : T1pI<(outs), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALU, +def tCMPi8 : T1pI<(outs), (ins tGPR:$lhs, i32imm:$rhs), IIC_iCMPi, "cmp", " $lhs, $rhs", [(ARMcmp tGPR:$lhs, imm0_255:$rhs)]>; -def tCMPzi8 : T1pI<(outs), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALU, +def tCMPzi8 : T1pI<(outs), (ins tGPR:$lhs, i32imm:$rhs), IIC_iCMPi, "cmp", " $lhs, $rhs", [(ARMcmpZ tGPR:$lhs, imm0_255:$rhs)]>; @@ -442,48 +442,48 @@ // CMP register let Defs = [CPSR] in { -def tCMPr : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tCMPr : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iCMPr, "cmp", " $lhs, $rhs", [(ARMcmp tGPR:$lhs, tGPR:$rhs)]>; -def tCMPzr : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tCMPzr : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iCMPr, "cmp", " $lhs, $rhs", [(ARMcmpZ tGPR:$lhs, tGPR:$rhs)]>; -def tCMPhir : T1pI<(outs), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, +def tCMPhir : T1pI<(outs), (ins GPR:$lhs, GPR:$rhs), IIC_iCMPr, "cmp", " $lhs, $rhs", []>; -def tCMPzhir : T1pI<(outs), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, +def tCMPzhir : T1pI<(outs), (ins GPR:$lhs, GPR:$rhs), IIC_iCMPr, "cmp", " $lhs, $rhs", []>; } // XOR register let isCommutable = 1 in -def tEOR : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tEOR : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALUr, "eor", " $dst, $rhs", [(set tGPR:$dst, (xor tGPR:$lhs, tGPR:$rhs))]>; // LSL immediate -def tLSLri : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALU, +def tLSLri : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iMOVsi, "lsl", " $dst, $lhs, $rhs", [(set tGPR:$dst, (shl tGPR:$lhs, (i32 imm:$rhs)))]>; // LSL register -def tLSLrr : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tLSLrr : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iMOVsr, "lsl", " $dst, $rhs", [(set tGPR:$dst, (shl tGPR:$lhs, tGPR:$rhs))]>; // LSR immediate -def tLSRri : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALU, +def tLSRri : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iMOVsi, "lsr", " $dst, $lhs, $rhs", [(set tGPR:$dst, (srl tGPR:$lhs, (i32 imm:$rhs)))]>; // LSR register -def tLSRrr : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tLSRrr : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iMOVsr, "lsr", " $dst, $rhs", [(set tGPR:$dst, (srl tGPR:$lhs, tGPR:$rhs))]>; // move register -def tMOVi8 : T1sI<(outs tGPR:$dst), (ins i32imm:$src), IIC_iALU, +def tMOVi8 : T1sI<(outs tGPR:$dst), (ins i32imm:$src), IIC_iMOVi, "mov", " $dst, $src", [(set tGPR:$dst, imm0_255:$src)]>; @@ -492,45 +492,45 @@ let neverHasSideEffects = 1 in { // FIXME: Make this predicable. -def tMOVr : T1I<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tMOVr : T1I<(outs tGPR:$dst), (ins tGPR:$src), IIC_iMOVr, "mov $dst, $src", []>; let Defs = [CPSR] in -def tMOVSr : T1I<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tMOVSr : T1I<(outs tGPR:$dst), (ins tGPR:$src), IIC_iMOVr, "movs $dst, $src", []>; // FIXME: Make these predicable. -def tMOVgpr2tgpr : T1I<(outs tGPR:$dst), (ins GPR:$src), IIC_iALU, +def tMOVgpr2tgpr : T1I<(outs tGPR:$dst), (ins GPR:$src), IIC_iMOVr, "mov $dst, $src\t@ hir2lor", []>; -def tMOVtgpr2gpr : T1I<(outs GPR:$dst), (ins tGPR:$src), IIC_iALU, +def tMOVtgpr2gpr : T1I<(outs GPR:$dst), (ins tGPR:$src), IIC_iMOVr, "mov $dst, $src\t@ lor2hir", []>; -def tMOVgpr2gpr : T1I<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def tMOVgpr2gpr : T1I<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVr, "mov $dst, $src\t@ hir2hir", []>; } // neverHasSideEffects // multiply register let isCommutable = 1 in -def tMUL : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iMPYw, +def tMUL : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iMUL32, "mul", " $dst, $rhs", [(set tGPR:$dst, (mul tGPR:$lhs, tGPR:$rhs))]>; // move inverse register -def tMVN : T1sI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tMVN : T1sI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iMOVr, "mvn", " $dst, $src", [(set tGPR:$dst, (not tGPR:$src))]>; // bitwise or register let isCommutable = 1 in -def tORR : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tORR : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALUr, "orr", " $dst, $rhs", [(set tGPR:$dst, (or tGPR:$lhs, tGPR:$rhs))]>; // swaps -def tREV : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tREV : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iUNAr, "rev", " $dst, $src", [(set tGPR:$dst, (bswap tGPR:$src))]>, Requires<[IsThumb1Only, HasV6]>; -def tREV16 : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tREV16 : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iUNAr, "rev16", " $dst, $src", [(set tGPR:$dst, (or (and (srl tGPR:$src, (i32 8)), 0xFF), @@ -539,7 +539,7 @@ (and (shl tGPR:$src, (i32 8)), 0xFF000000)))))]>, Requires<[IsThumb1Only, HasV6]>; -def tREVSH : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tREVSH : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iUNAr, "revsh", " $dst, $src", [(set tGPR:$dst, (sext_inreg @@ -548,63 +548,63 @@ Requires<[IsThumb1Only, HasV6]>; // rotate right register -def tROR : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tROR : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iMOVsr, "ror", " $dst, $rhs", [(set tGPR:$dst, (rotr tGPR:$lhs, tGPR:$rhs))]>; // negate register -def tRSB : T1sI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tRSB : T1sI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALUi, "rsb", " $dst, $src, #0", [(set tGPR:$dst, (ineg tGPR:$src))]>; // Subtract with carry register let Uses = [CPSR] in -def tSBC : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tSBC : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALUr, "sbc", " $dst, $rhs", [(set tGPR:$dst, (sube tGPR:$lhs, tGPR:$rhs))]>; // Subtract immediate -def tSUBi3 : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALU, +def tSUBi3 : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALUi, "sub", " $dst, $lhs, $rhs", [(set tGPR:$dst, (add tGPR:$lhs, imm0_7_neg:$rhs))]>; -def tSUBi8 : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALU, +def tSUBi8 : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iALUi, "sub", " $dst, $rhs", [(set tGPR:$dst, (add tGPR:$lhs, imm8_255_neg:$rhs))]>; // subtract register -def tSUBrr : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tSUBrr : T1sI<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALUr, "sub", " $dst, $lhs, $rhs", [(set tGPR:$dst, (sub tGPR:$lhs, tGPR:$rhs))]>; // TODO: A7-96: STMIA - store multiple. // sign-extend byte -def tSXTB : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tSXTB : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iUNAr, "sxtb", " $dst, $src", [(set tGPR:$dst, (sext_inreg tGPR:$src, i8))]>, Requires<[IsThumb1Only, HasV6]>; // sign-extend short -def tSXTH : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tSXTH : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iUNAr, "sxth", " $dst, $src", [(set tGPR:$dst, (sext_inreg tGPR:$src, i16))]>, Requires<[IsThumb1Only, HasV6]>; // test let isCommutable = 1, Defs = [CPSR] in -def tTST : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iALU, +def tTST : T1pI<(outs), (ins tGPR:$lhs, tGPR:$rhs), IIC_iCMPr, "tst", " $lhs, $rhs", [(ARMcmpZ (and tGPR:$lhs, tGPR:$rhs), 0)]>; // zero-extend byte -def tUXTB : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tUXTB : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iUNAr, "uxtb", " $dst, $src", [(set tGPR:$dst, (and tGPR:$src, 0xFF))]>, Requires<[IsThumb1Only, HasV6]>; // zero-extend short -def tUXTH : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iALU, +def tUXTH : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iUNAr, "uxth", " $dst, $src", [(set tGPR:$dst, (and tGPR:$src, 0xFFFF))]>, Requires<[IsThumb1Only, HasV6]>; @@ -620,20 +620,20 @@ // 16-bit movcc in IT blocks for Thumb2. -def tMOVCCr : T1pIt<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, +def tMOVCCr : T1pIt<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iCMOVr, "mov", " $dst, $rhs", []>; -def tMOVCCi : T1pIt<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), IIC_iALU, +def tMOVCCi : T1pIt<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), IIC_iCMOVi, "mov", " $dst, $rhs", []>; // tLEApcrel - Load a pc-relative address into a register without offending the // assembler. -def tLEApcrel : T1I<(outs tGPR:$dst), (ins i32imm:$label, pred:$p), IIC_iALU, +def tLEApcrel : T1I<(outs tGPR:$dst), (ins i32imm:$label, pred:$p), IIC_iALUi, "adr$p $dst, #$label", []>; def tLEApcrelJT : T1I<(outs tGPR:$dst), (ins i32imm:$label, lane_cst:$id, pred:$p), - IIC_iALU, "adr$p $dst, #${label}_${id}", []>; + IIC_iALUi, "adr$p $dst, #${label}_${id}", []>; //===----------------------------------------------------------------------===// // TLS Instructions Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=79436&r1=79435&r2=79436&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Wed Aug 19 13:00:44 2009 @@ -155,18 +155,18 @@ /// changed to modify CPSR. multiclass T2I_un_irs{ // shifted imm - def i : T2sI<(outs GPR:$dst), (ins t2_so_imm:$src), IIC_iALU, + def i : T2sI<(outs GPR:$dst), (ins t2_so_imm:$src), IIC_iMOVi, opc, " $dst, $src", [(set GPR:$dst, (opnode t2_so_imm:$src))]> { let isAsCheapAsAMove = Cheap; let isReMaterializable = ReMat; } // register - def r : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, + def r : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVr, opc, ".w $dst, $src", [(set GPR:$dst, (opnode GPR:$src))]>; // shifted register - def s : T2I<(outs GPR:$dst), (ins t2_so_reg:$src), IIC_iALU, + def s : T2I<(outs GPR:$dst), (ins t2_so_reg:$src), IIC_iMOVsi, opc, ".w $dst, $src", [(set GPR:$dst, (opnode t2_so_reg:$src))]>; } @@ -177,17 +177,17 @@ multiclass T2I_bin_irs { // shifted imm - def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALU, + def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALUi, opc, " $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>; // register - def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, + def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr, opc, !strconcat(wide, " $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]> { let isCommutable = Commutable; } // shifted register - def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALU, + def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALUsi, opc, !strconcat(wide, " $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>; } @@ -202,11 +202,11 @@ /// T2I_bin_irs counterpart. multiclass T2I_rbin_is { // shifted imm - def ri : T2I<(outs GPR:$dst), (ins GPR:$rhs, t2_so_imm:$lhs), IIC_iALU, + def ri : T2I<(outs GPR:$dst), (ins GPR:$rhs, t2_so_imm:$lhs), IIC_iALUi, opc, ".w $dst, $rhs, $lhs", [(set GPR:$dst, (opnode t2_so_imm:$lhs, GPR:$rhs))]>; // shifted register - def rs : T2I<(outs GPR:$dst), (ins GPR:$rhs, t2_so_reg:$lhs), IIC_iALU, + def rs : T2I<(outs GPR:$dst), (ins GPR:$rhs, t2_so_reg:$lhs), IIC_iALUsi, opc, " $dst, $rhs, $lhs", [(set GPR:$dst, (opnode t2_so_reg:$lhs, GPR:$rhs))]>; } @@ -216,17 +216,17 @@ let Defs = [CPSR] in { multiclass T2I_bin_s_irs { // shifted imm - def ri : T2I<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALU, + def ri : T2I<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALUi, !strconcat(opc, "s"), ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>; // register - def rr : T2I<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, + def rr : T2I<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr, !strconcat(opc, "s"), ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]> { let isCommutable = Commutable; } // shifted register - def rs : T2I<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALU, + def rs : T2I<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALUsi, !strconcat(opc, "s"), ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>; } @@ -236,21 +236,21 @@ /// patterns for a binary operation that produces a value. multiclass T2I_bin_ii12rs { // shifted imm - def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALU, + def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALUi, opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>; // 12-bit imm - def ri12 : T2sI<(outs GPR:$dst), (ins GPR:$lhs, imm0_4095:$rhs), IIC_iALU, + def ri12 : T2sI<(outs GPR:$dst), (ins GPR:$lhs, imm0_4095:$rhs), IIC_iALUi, !strconcat(opc, "w"), " $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, imm0_4095:$rhs))]>; // register - def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, + def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr, opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]> { let isCommutable = Commutable; } // shifted register - def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALU, + def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALUsi, opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>; } @@ -261,32 +261,32 @@ let Uses = [CPSR] in { multiclass T2I_adde_sube_irs { // shifted imm - def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALU, + def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALUi, opc, " $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>, Requires<[IsThumb2, CarryDefIsUnused]>; // register - def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, + def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr, opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>, Requires<[IsThumb2, CarryDefIsUnused]> { let isCommutable = Commutable; } // shifted register - def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALU, + def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALUsi, opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>, Requires<[IsThumb2, CarryDefIsUnused]>; // Carry setting variants // shifted imm - def Sri : T2XI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALU, + def Sri : T2XI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALUi, !strconcat(opc, "s $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>, Requires<[IsThumb2, CarryDefIsUsed]> { let Defs = [CPSR]; } // register - def Srr : T2XI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, + def Srr : T2XI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr, !strconcat(opc, "s.w $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>, Requires<[IsThumb2, CarryDefIsUsed]> { @@ -294,7 +294,7 @@ let isCommutable = Commutable; } // shifted register - def Srs : T2XI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALU, + def Srs : T2XI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALUsi, !strconcat(opc, "s.w $dst, $lhs, $rhs"), [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>, Requires<[IsThumb2, CarryDefIsUsed]> { @@ -308,12 +308,12 @@ multiclass T2I_rbin_s_is { // shifted imm def ri : T2XI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_imm:$lhs, cc_out:$s), - IIC_iALU, + IIC_iALUi, !strconcat(opc, "${s}.w $dst, $rhs, $lhs"), [(set GPR:$dst, (opnode t2_so_imm:$lhs, GPR:$rhs))]>; // shifted register def rs : T2XI<(outs GPR:$dst), (ins GPR:$rhs, t2_so_reg:$lhs, cc_out:$s), - IIC_iALU, + IIC_iALUsi, !strconcat(opc, "${s} $dst, $rhs, $lhs"), [(set GPR:$dst, (opnode t2_so_reg:$lhs, GPR:$rhs))]>; } @@ -323,30 +323,30 @@ // rotate operation that produces a value. multiclass T2I_sh_ir { // 5-bit imm - def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), IIC_iALU, + def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), IIC_iMOVsi, opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, imm1_31:$rhs))]>; // register - def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, + def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iMOVsr, opc, ".w $dst, $lhs, $rhs", [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>; } -/// T21_cmp_irs - Defines a set of (op r, {so_imm|r|so_reg}) cmp / test +/// T2I_cmp_is - Defines a set of (op r, {so_imm|r|so_reg}) cmp / test /// patterns. Similar to T2I_bin_irs except the instruction does not produce /// a explicit result, only implicitly set CPSR. let Defs = [CPSR] in { multiclass T2I_cmp_is { // shifted imm - def ri : T2I<(outs), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALU, + def ri : T2I<(outs), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iCMPi, opc, ".w $lhs, $rhs", [(opnode GPR:$lhs, t2_so_imm:$rhs)]>; // register - def rr : T2I<(outs), (ins GPR:$lhs, GPR:$rhs), IIC_iALU, + def rr : T2I<(outs), (ins GPR:$lhs, GPR:$rhs), IIC_iCMPr, opc, ".w $lhs, $rhs", [(opnode GPR:$lhs, GPR:$rhs)]>; // shifted register - def rs : T2I<(outs), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALU, + def rs : T2I<(outs), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iCMPsi, opc, ".w $lhs, $rhs", [(opnode GPR:$lhs, t2_so_reg:$rhs)]>; } @@ -354,42 +354,42 @@ /// T2I_ld - Defines a set of (op r, {imm12|imm8|so_reg}) load patterns. multiclass T2I_ld { - def i12 : T2Ii12<(outs GPR:$dst), (ins t2addrmode_imm12:$addr), IIC_iLoad, + def i12 : T2Ii12<(outs GPR:$dst), (ins t2addrmode_imm12:$addr), IIC_iLoadi, opc, ".w $dst, $addr", [(set GPR:$dst, (opnode t2addrmode_imm12:$addr))]>; - def i8 : T2Ii8 <(outs GPR:$dst), (ins t2addrmode_imm8:$addr), IIC_iLoad, + def i8 : T2Ii8 <(outs GPR:$dst), (ins t2addrmode_imm8:$addr), IIC_iLoadi, opc, " $dst, $addr", [(set GPR:$dst, (opnode t2addrmode_imm8:$addr))]>; - def s : T2Iso <(outs GPR:$dst), (ins t2addrmode_so_reg:$addr), IIC_iLoad, + def s : T2Iso <(outs GPR:$dst), (ins t2addrmode_so_reg:$addr), IIC_iLoadr, opc, ".w $dst, $addr", [(set GPR:$dst, (opnode t2addrmode_so_reg:$addr))]>; - def pci : T2Ipc <(outs GPR:$dst), (ins i32imm:$addr), IIC_iLoad, + def pci : T2Ipc <(outs GPR:$dst), (ins i32imm:$addr), IIC_iLoadi, opc, ".w $dst, $addr", [(set GPR:$dst, (opnode (ARMWrapper tconstpool:$addr)))]>; } /// T2I_st - Defines a set of (op r, {imm12|imm8|so_reg}) store patterns. multiclass T2I_st { - def i12 : T2Ii12<(outs), (ins GPR:$src, t2addrmode_imm12:$addr), IIC_iStore, + def i12 : T2Ii12<(outs), (ins GPR:$src, t2addrmode_imm12:$addr), IIC_iStorei, opc, ".w $src, $addr", [(opnode GPR:$src, t2addrmode_imm12:$addr)]>; - def i8 : T2Ii8 <(outs), (ins GPR:$src, t2addrmode_imm8:$addr), IIC_iStore, + def i8 : T2Ii8 <(outs), (ins GPR:$src, t2addrmode_imm8:$addr), IIC_iStorei, opc, " $src, $addr", [(opnode GPR:$src, t2addrmode_imm8:$addr)]>; - def s : T2Iso <(outs), (ins GPR:$src, t2addrmode_so_reg:$addr), IIC_iStore, + def s : T2Iso <(outs), (ins GPR:$src, t2addrmode_so_reg:$addr), IIC_iStorer, opc, ".w $src, $addr", [(opnode GPR:$src, t2addrmode_so_reg:$addr)]>; } /// T2I_picld - Defines the PIC load pattern. class T2I_picld : - T2I<(outs GPR:$dst), (ins addrmodepc:$addr), IIC_iLoad, + T2I<(outs GPR:$dst), (ins addrmodepc:$addr), IIC_iLoadi, !strconcat("${addr:label}:\n\t", opc), " $dst, $addr", [(set GPR:$dst, (opnode addrmodepc:$addr))]>; /// T2I_picst - Defines the PIC store pattern. class T2I_picst : - T2I<(outs), (ins GPR:$src, addrmodepc:$addr), IIC_iStore, + T2I<(outs), (ins GPR:$src, addrmodepc:$addr), IIC_iStorer, !strconcat("${addr:label}:\n\t", opc), " $src, $addr", [(opnode GPR:$src, addrmodepc:$addr)]>; @@ -397,22 +397,22 @@ /// T2I_unary_rrot - A unary operation with two forms: one whose operand is a /// register and one whose operand is a register rotated by 8/16/24. multiclass T2I_unary_rrot { - def r : T2I<(outs GPR:$dst), (ins GPR:$Src), IIC_iALU, - opc, ".w $dst, $Src", - [(set GPR:$dst, (opnode GPR:$Src))]>; - def r_rot : T2I<(outs GPR:$dst), (ins GPR:$Src, i32imm:$rot), IIC_iALU, - opc, ".w $dst, $Src, ror $rot", - [(set GPR:$dst, (opnode (rotr GPR:$Src, rot_imm:$rot)))]>; + def r : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iUNAr, + opc, ".w $dst, $src", + [(set GPR:$dst, (opnode GPR:$src))]>; + def r_rot : T2I<(outs GPR:$dst), (ins GPR:$src, i32imm:$rot), IIC_iUNAsi, + opc, ".w $dst, $src, ror $rot", + [(set GPR:$dst, (opnode (rotr GPR:$src, rot_imm:$rot)))]>; } /// T2I_bin_rrot - A binary operation with two forms: one whose operand is a /// register and one whose operand is a register rotated by 8/16/24. multiclass T2I_bin_rrot { - def rr : T2I<(outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS), IIC_iALU, + def rr : T2I<(outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS), IIC_iALUr, opc, " $dst, $LHS, $RHS", [(set GPR:$dst, (opnode GPR:$LHS, GPR:$RHS))]>; def rr_rot : T2I<(outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS, i32imm:$rot), - IIC_iALU, opc, " $dst, $LHS, $RHS, ror $rot", + IIC_iALUsr, opc, " $dst, $LHS, $RHS, ror $rot", [(set GPR:$dst, (opnode GPR:$LHS, (rotr GPR:$RHS, rot_imm:$rot)))]>; } @@ -427,31 +427,32 @@ // LEApcrel - Load a pc-relative address into a register without offending the // assembler. -def t2LEApcrel : T2XI<(outs GPR:$dst), (ins i32imm:$label, pred:$p), IIC_iALU, +def t2LEApcrel : T2XI<(outs GPR:$dst), (ins i32imm:$label, pred:$p), IIC_iALUi, "adr$p.w $dst, #$label", []>; def t2LEApcrelJT : T2XI<(outs GPR:$dst), - (ins i32imm:$label, lane_cst:$id, pred:$p), IIC_iALU, + (ins i32imm:$label, lane_cst:$id, pred:$p), IIC_iALUi, "adr$p.w $dst, #${label}_${id}", []>; // ADD r, sp, {so_imm|i12} -def t2ADDrSPi : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_imm:$imm), IIC_iALU, - "add", ".w $dst, $sp, $imm", []>; -def t2ADDrSPi12 : T2I<(outs GPR:$dst), (ins GPR:$sp, imm0_4095:$imm), IIC_iALU, - "addw", " $dst, $sp, $imm", []>; +def t2ADDrSPi : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_imm:$imm), + IIC_iALUi, "add", ".w $dst, $sp, $imm", []>; +def t2ADDrSPi12 : T2I<(outs GPR:$dst), (ins GPR:$sp, imm0_4095:$imm), + IIC_iALUi, "addw", " $dst, $sp, $imm", []>; // ADD r, sp, so_reg -def t2ADDrSPs : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_reg:$rhs), IIC_iALU, - "add", ".w $dst, $sp, $rhs", []>; +def t2ADDrSPs : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_reg:$rhs), + IIC_iALUsi, "add", ".w $dst, $sp, $rhs", []>; // SUB r, sp, {so_imm|i12} -def t2SUBrSPi : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_imm:$imm), IIC_iALU, - "sub", ".w $dst, $sp, $imm", []>; -def t2SUBrSPi12 : T2I<(outs GPR:$dst), (ins GPR:$sp, imm0_4095:$imm), IIC_iALU, - "subw", " $dst, $sp, $imm", []>; +def t2SUBrSPi : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_imm:$imm), + IIC_iALUi, "sub", ".w $dst, $sp, $imm", []>; +def t2SUBrSPi12 : T2I<(outs GPR:$dst), (ins GPR:$sp, imm0_4095:$imm), + IIC_iALUi, "subw", " $dst, $sp, $imm", []>; // SUB r, sp, so_reg -def t2SUBrSPs : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_reg:$rhs), IIC_iALU, +def t2SUBrSPs : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_reg:$rhs), + IIC_iALUsi, "sub", " $dst, $sp, $rhs", []>; @@ -485,8 +486,8 @@ let mayLoad = 1 in { // Load doubleword def t2LDRDi8 : T2Ii8s4<(outs GPR:$dst), (ins t2addrmode_imm8s4:$addr), - IIC_iLoad, "ldrd", " $dst, $addr", []>; -def t2LDRDpci : T2Ii8s4<(outs GPR:$dst), (ins i32imm:$addr), IIC_iLoad, + IIC_iLoadi, "ldrd", " $dst, $addr", []>; +def t2LDRDpci : T2Ii8s4<(outs GPR:$dst), (ins i32imm:$addr), IIC_iLoadi, "ldrd", " $dst, $addr", []>; } @@ -534,57 +535,57 @@ let mayLoad = 1 in { def t2LDR_PRE : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins t2addrmode_imm8:$addr), - AddrModeT2_i8, IndexModePre, IIC_iLoad, + AddrModeT2_i8, IndexModePre, IIC_iLoadiu, "ldr", " $dst, $addr!", "$addr.base = $base_wb", []>; def t2LDR_POST : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePost, IIC_iLoad, + AddrModeT2_i8, IndexModePost, IIC_iLoadiu, "ldr", " $dst, [$base], $offset", "$base = $base_wb", []>; def t2LDRB_PRE : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins t2addrmode_imm8:$addr), - AddrModeT2_i8, IndexModePre, IIC_iLoad, + AddrModeT2_i8, IndexModePre, IIC_iLoadiu, "ldrb", " $dst, $addr!", "$addr.base = $base_wb", []>; def t2LDRB_POST : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePost, IIC_iLoad, + AddrModeT2_i8, IndexModePost, IIC_iLoadiu, "ldrb", " $dst, [$base], $offset", "$base = $base_wb", []>; def t2LDRH_PRE : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins t2addrmode_imm8:$addr), - AddrModeT2_i8, IndexModePre, IIC_iLoad, + AddrModeT2_i8, IndexModePre, IIC_iLoadiu, "ldrh", " $dst, $addr!", "$addr.base = $base_wb", []>; def t2LDRH_POST : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePost, IIC_iLoad, + AddrModeT2_i8, IndexModePost, IIC_iLoadiu, "ldrh", " $dst, [$base], $offset", "$base = $base_wb", []>; def t2LDRSB_PRE : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins t2addrmode_imm8:$addr), - AddrModeT2_i8, IndexModePre, IIC_iLoad, + AddrModeT2_i8, IndexModePre, IIC_iLoadiu, "ldrsb", " $dst, $addr!", "$addr.base = $base_wb", []>; def t2LDRSB_POST : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePost, IIC_iLoad, + AddrModeT2_i8, IndexModePost, IIC_iLoadiu, "ldrsb", " $dst, [$base], $offset", "$base = $base_wb", []>; def t2LDRSH_PRE : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins t2addrmode_imm8:$addr), - AddrModeT2_i8, IndexModePre, IIC_iLoad, + AddrModeT2_i8, IndexModePre, IIC_iLoadiu, "ldrsh", " $dst, $addr!", "$addr.base = $base_wb", []>; def t2LDRSH_POST : T2Iidxldst<(outs GPR:$dst, GPR:$base_wb), (ins GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePost, IIC_iLoad, + AddrModeT2_i8, IndexModePost, IIC_iLoadiu, "ldrsh", " $dst, [$base], $offset", "$base = $base_wb", []>; } @@ -597,47 +598,47 @@ // Store doubleword let mayLoad = 1 in def t2STRDi8 : T2Ii8s4<(outs), (ins GPR:$src, t2addrmode_imm8s4:$addr), - IIC_iStore, "strd", " $src, $addr", []>; + IIC_iStorer, "strd", " $src, $addr", []>; // Indexed stores def t2STR_PRE : T2Iidxldst<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePre, IIC_iStore, + AddrModeT2_i8, IndexModePre, IIC_iStoreiu, "str", " $src, [$base, $offset]!", "$base = $base_wb", [(set GPR:$base_wb, (pre_store GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>; def t2STR_POST : T2Iidxldst<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePost, IIC_iStore, + AddrModeT2_i8, IndexModePost, IIC_iStoreiu, "str", " $src, [$base], $offset", "$base = $base_wb", [(set GPR:$base_wb, (post_store GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>; def t2STRH_PRE : T2Iidxldst<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePre, IIC_iStore, + AddrModeT2_i8, IndexModePre, IIC_iStoreiu, "strh", " $src, [$base, $offset]!", "$base = $base_wb", [(set GPR:$base_wb, (pre_truncsti16 GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>; def t2STRH_POST : T2Iidxldst<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePost, IIC_iStore, + AddrModeT2_i8, IndexModePost, IIC_iStoreiu, "strh", " $src, [$base], $offset", "$base = $base_wb", [(set GPR:$base_wb, (post_truncsti16 GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>; def t2STRB_PRE : T2Iidxldst<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePre, IIC_iStore, + AddrModeT2_i8, IndexModePre, IIC_iStoreiu, "strb", " $src, [$base, $offset]!", "$base = $base_wb", [(set GPR:$base_wb, (pre_truncsti8 GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>; def t2STRB_POST : T2Iidxldst<(outs GPR:$base_wb), (ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset), - AddrModeT2_i8, IndexModePost, IIC_iStore, + AddrModeT2_i8, IndexModePost, IIC_iStoreiu, "strb", " $src, [$base], $offset", "$base = $base_wb", [(set GPR:$base_wb, (post_truncsti8 GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>; @@ -652,34 +653,34 @@ let mayLoad = 1 in def t2LDM : T2XI<(outs), (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops), - IIC_iLoad, "ldm${addr:submode}${p}${addr:wide} $addr, $dst1", []>; + IIC_iLoadm, "ldm${addr:submode}${p}${addr:wide} $addr, $dst1", []>; let mayStore = 1 in def t2STM : T2XI<(outs), (ins addrmode4:$addr, pred:$p, reglist:$src1, variable_ops), - IIC_iStore, "stm${addr:submode}${p}${addr:wide} $addr, $src1", []>; + IIC_iStorem, "stm${addr:submode}${p}${addr:wide} $addr, $src1", []>; //===----------------------------------------------------------------------===// // Move Instructions. // let neverHasSideEffects = 1 in -def t2MOVr : T2sI<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def t2MOVr : T2sI<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVr, "mov", ".w $dst, $src", []>; let isReMaterializable = 1, isAsCheapAsAMove = 1 in -def t2MOVi : T2sI<(outs GPR:$dst), (ins t2_so_imm:$src), IIC_iALU, +def t2MOVi : T2sI<(outs GPR:$dst), (ins t2_so_imm:$src), IIC_iMOVi, "mov", ".w $dst, $src", [(set GPR:$dst, t2_so_imm:$src)]>; let isReMaterializable = 1, isAsCheapAsAMove = 1 in -def t2MOVi16 : T2I<(outs GPR:$dst), (ins i32imm:$src), IIC_iALU, +def t2MOVi16 : T2I<(outs GPR:$dst), (ins i32imm:$src), IIC_iMOVi, "movw", " $dst, $src", [(set GPR:$dst, imm0_65535:$src)]>; // FIXME: Also available in ARM mode. let Constraints = "$src = $dst" in -def t2MOVTi16 : T2sI<(outs GPR:$dst), (ins GPR:$src, i32imm:$imm), IIC_iALU, +def t2MOVTi16 : T2sI<(outs GPR:$dst), (ins GPR:$src, i32imm:$imm), IIC_iMOVi, "movt", " $dst, $imm", [(set GPR:$dst, (or (and GPR:$src, 0xffff), t2_lo16AllZero:$imm))]>; @@ -755,15 +756,15 @@ defm t2ASR : T2I_sh_ir<"asr", BinOpFrag<(sra node:$LHS, node:$RHS)>>; defm t2ROR : T2I_sh_ir<"ror", BinOpFrag<(rotr node:$LHS, node:$RHS)>>; -def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def t2MOVrx : T2sI<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVsi, "rrx", ".w $dst, $src", [(set GPR:$dst, (ARMrrx GPR:$src))]>; let Defs = [CPSR] in { -def t2MOVsrl_flag : T2XI<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def t2MOVsrl_flag : T2XI<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVsi, "lsrs.w $dst, $src, #1", [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>; -def t2MOVsra_flag : T2XI<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def t2MOVsra_flag : T2XI<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVsi, "asrs.w $dst, $src, #1", [(set GPR:$dst, (ARMsra_flag GPR:$src))]>; } @@ -779,8 +780,8 @@ defm t2BIC : T2I_bin_w_irs<"bic", BinOpFrag<(and node:$LHS, (not node:$RHS))>>; let Constraints = "$src = $dst" in -def t2BFC : T2I<(outs GPR:$dst), (ins GPR:$src, bf_inv_mask_imm:$imm), IIC_iALU, - "bfc", " $dst, $imm", +def t2BFC : T2I<(outs GPR:$dst), (ins GPR:$src, bf_inv_mask_imm:$imm), + IIC_iALUi, "bfc", " $dst, $imm", [(set GPR:$dst, (and GPR:$src, bf_inv_mask_imm:$imm))]>; // FIXME: A8.6.18 BFI - Bitfield insert (Encoding T1) @@ -807,80 +808,80 @@ // Multiply Instructions. // let isCommutable = 1 in -def t2MUL: T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMPYw, +def t2MUL: T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32, "mul", " $dst, $a, $b", [(set GPR:$dst, (mul GPR:$a, GPR:$b))]>; -def t2MLA: T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMPYw, +def t2MLA: T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32, "mla", " $dst, $a, $b, $c", [(set GPR:$dst, (add (mul GPR:$a, GPR:$b), GPR:$c))]>; -def t2MLS: T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMPYw, +def t2MLS: T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32, "mls", " $dst, $a, $b, $c", [(set GPR:$dst, (sub GPR:$c, (mul GPR:$a, GPR:$b)))]>; // Extra precision multiplies with low / high results let neverHasSideEffects = 1 in { let isCommutable = 1 in { -def t2SMULL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMPYl, +def t2SMULL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMUL64, "smull", " $ldst, $hdst, $a, $b", []>; -def t2UMULL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMPYl, +def t2UMULL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMUL64, "umull", " $ldst, $hdst, $a, $b", []>; } // Multiply + accumulate -def t2SMLAL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMPYl, +def t2SMLAL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMAC64, "smlal", " $ldst, $hdst, $a, $b", []>; -def t2UMLAL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMPYl, +def t2UMLAL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMAC64, "umlal", " $ldst, $hdst, $a, $b", []>; -def t2UMAAL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMPYl, +def t2UMAAL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMAC64, "umaal", " $ldst, $hdst, $a, $b", []>; } // neverHasSideEffects // Most significant word multiply -def t2SMMUL : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMPYw, +def t2SMMUL : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32, "smmul", " $dst, $a, $b", [(set GPR:$dst, (mulhs GPR:$a, GPR:$b))]>; -def t2SMMLA : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMPYw, +def t2SMMLA : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32, "smmla", " $dst, $a, $b, $c", [(set GPR:$dst, (add (mulhs GPR:$a, GPR:$b), GPR:$c))]>; -def t2SMMLS : T2I <(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMPYw, +def t2SMMLS : T2I <(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32, "smmls", " $dst, $a, $b, $c", [(set GPR:$dst, (sub GPR:$c, (mulhs GPR:$a, GPR:$b)))]>; multiclass T2I_smul { - def BB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMPYw, + def BB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32, !strconcat(opc, "bb"), " $dst, $a, $b", [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16), (sext_inreg GPR:$b, i16)))]>; - def BT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMPYw, + def BT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32, !strconcat(opc, "bt"), " $dst, $a, $b", [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16), (sra GPR:$b, (i32 16))))]>; - def TB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMPYw, + def TB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32, !strconcat(opc, "tb"), " $dst, $a, $b", [(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)), (sext_inreg GPR:$b, i16)))]>; - def TT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMPYw, + def TT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32, !strconcat(opc, "tt"), " $dst, $a, $b", [(set GPR:$dst, (opnode (sra GPR:$a, (i32 16)), (sra GPR:$b, (i32 16))))]>; - def WB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMPYh, + def WB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL16, !strconcat(opc, "wb"), " $dst, $a, $b", [(set GPR:$dst, (sra (opnode GPR:$a, (sext_inreg GPR:$b, i16)), (i32 16)))]>; - def WT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMPYh, + def WT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL16, !strconcat(opc, "wt"), " $dst, $a, $b", [(set GPR:$dst, (sra (opnode GPR:$a, (sra GPR:$b, (i32 16))), (i32 16)))]>; @@ -888,33 +889,33 @@ multiclass T2I_smla { - def BB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMPYw, + def BB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16, !strconcat(opc, "bb"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16), (sext_inreg GPR:$b, i16))))]>; - def BT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMPYw, + def BT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16, !strconcat(opc, "bt"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16), (sra GPR:$b, (i32 16)))))]>; - def TB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMPYw, + def TB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16, !strconcat(opc, "tb"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)), (sext_inreg GPR:$b, i16))))]>; - def TT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMPYw, + def TT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16, !strconcat(opc, "tt"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)), (sra GPR:$b, (i32 16)))))]>; - def WB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMPYw, + def WB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16, !strconcat(opc, "wb"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a, (sext_inreg GPR:$b, i16)), (i32 16))))]>; - def WT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMPYw, + def WT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16, !strconcat(opc, "wt"), " $dst, $a, $b, $acc", [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a, (sra GPR:$b, (i32 16))), (i32 16))))]>; @@ -931,15 +932,15 @@ // Misc. Arithmetic Instructions. // -def t2CLZ : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def t2CLZ : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iUNAr, "clz", " $dst, $src", [(set GPR:$dst, (ctlz GPR:$src))]>; -def t2REV : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def t2REV : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iUNAr, "rev", ".w $dst, $src", [(set GPR:$dst, (bswap GPR:$src))]>; -def t2REV16 : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def t2REV16 : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iUNAr, "rev16", ".w $dst, $src", [(set GPR:$dst, (or (and (srl GPR:$src, (i32 8)), 0xFF), @@ -947,7 +948,7 @@ (or (and (srl GPR:$src, (i32 8)), 0xFF0000), (and (shl GPR:$src, (i32 8)), 0xFF000000)))))]>; -def t2REVSH : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iALU, +def t2REVSH : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iUNAr, "revsh", ".w $dst, $src", [(set GPR:$dst, (sext_inreg @@ -955,7 +956,7 @@ (shl GPR:$src, (i32 8))), i16))]>; def t2PKHBT : T2I<(outs GPR:$dst), (ins GPR:$src1, GPR:$src2, i32imm:$shamt), - IIC_iALU, "pkhbt", " $dst, $src1, $src2, LSL $shamt", + IIC_iALUsi, "pkhbt", " $dst, $src1, $src2, LSL $shamt", [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF), (and (shl GPR:$src2, (i32 imm:$shamt)), 0xFFFF0000)))]>; @@ -967,7 +968,7 @@ (t2PKHBT GPR:$src1, GPR:$src2, imm16_31:$shamt)>; def t2PKHTB : T2I<(outs GPR:$dst), (ins GPR:$src1, GPR:$src2, i32imm:$shamt), - IIC_iALU, "pkhtb", " $dst, $src1, $src2, ASR $shamt", + IIC_iALUsi, "pkhtb", " $dst, $src1, $src2, ASR $shamt", [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000), (and (sra GPR:$src2, imm16_31:$shamt), 0xFFFF)))]>; @@ -1013,27 +1014,27 @@ // Conditional moves // FIXME: should be able to write a pattern for ARMcmov, but can't use // a two-value operand where a dag node expects two operands. :( -def t2MOVCCr : T2I<(outs GPR:$dst), (ins GPR:$false, GPR:$true), IIC_iALU, +def t2MOVCCr : T2I<(outs GPR:$dst), (ins GPR:$false, GPR:$true), IIC_iCMOVr, "mov", ".w $dst, $true", [/*(set GPR:$dst, (ARMcmov GPR:$false, GPR:$true, imm:$cc, CCR:$ccr))*/]>, RegConstraint<"$false = $dst">; -def t2MOVCCi : T2I<(outs GPR:$dst), (ins GPR:$false, t2_so_imm:$true), IIC_iALU, - "mov", ".w $dst, $true", +def t2MOVCCi : T2I<(outs GPR:$dst), (ins GPR:$false, t2_so_imm:$true), + IIC_iCMOVi, "mov", ".w $dst, $true", [/*(set GPR:$dst, (ARMcmov GPR:$false, t2_so_imm:$true, imm:$cc, CCR:$ccr))*/]>, RegConstraint<"$false = $dst">; def t2MOVCClsl : T2I<(outs GPR:$dst), (ins GPR:$false, GPR:$true, i32imm:$rhs), - IIC_iALU, "lsl", ".w $dst, $true, $rhs", []>, + IIC_iCMOVsi, "lsl", ".w $dst, $true, $rhs", []>, RegConstraint<"$false = $dst">; def t2MOVCClsr : T2I<(outs GPR:$dst), (ins GPR:$false, GPR:$true, i32imm:$rhs), - IIC_iALU, "lsr", ".w $dst, $true, $rhs", []>, + IIC_iCMOVsi, "lsr", ".w $dst, $true, $rhs", []>, RegConstraint<"$false = $dst">; def t2MOVCCasr : T2I<(outs GPR:$dst), (ins GPR:$false, GPR:$true, i32imm:$rhs), - IIC_iALU, "asr", ".w $dst, $true, $rhs", []>, + IIC_iCMOVsi, "asr", ".w $dst, $true, $rhs", []>, RegConstraint<"$false = $dst">; def t2MOVCCror : T2I<(outs GPR:$dst), (ins GPR:$false, GPR:$true, i32imm:$rhs), - IIC_iALU, "ror", ".w $dst, $true, $rhs", []>, + IIC_iCMOVsi, "ror", ".w $dst, $true, $rhs", []>, RegConstraint<"$false = $dst">; //===----------------------------------------------------------------------===// @@ -1131,7 +1132,7 @@ // IT block def t2IT : Thumb2XI<(outs), (ins it_pred:$cc, it_mask:$mask), - AddrModeNone, Size2Bytes, IIC_iALU, + AddrModeNone, Size2Bytes, IIC_iALUx, "it$mask $cc", "", []>; //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/ARM/ARMSchedule.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSchedule.td?rev=79436&r1=79435&r2=79436&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSchedule.td (original) +++ llvm/trunk/lib/Target/ARM/ARMSchedule.td Wed Aug 19 13:00:44 2009 @@ -19,29 +19,103 @@ //===----------------------------------------------------------------------===// // Instruction Itinerary classes used for ARM // -def IIC_iALU : InstrItinClass; -def IIC_iMPYh : InstrItinClass; -def IIC_iMPYw : InstrItinClass; -def IIC_iMPYl : InstrItinClass; -def IIC_iLoad : InstrItinClass; -def IIC_iStore : InstrItinClass; -def IIC_fpALU : InstrItinClass; -def IIC_fpMPY : InstrItinClass; -def IIC_fpLoad : InstrItinClass; -def IIC_fpStore : InstrItinClass; -def IIC_Br : InstrItinClass; +def IIC_iALUx : InstrItinClass; +def IIC_iALUi : InstrItinClass; +def IIC_iALUr : InstrItinClass; +def IIC_iALUsi : InstrItinClass; +def IIC_iALUsr : InstrItinClass; +def IIC_iUNAr : InstrItinClass; +def IIC_iUNAsi : InstrItinClass; +def IIC_iUNAsr : InstrItinClass; +def IIC_iCMPi : InstrItinClass; +def IIC_iCMPr : InstrItinClass; +def IIC_iCMPsi : InstrItinClass; +def IIC_iCMPsr : InstrItinClass; +def IIC_iMOVi : InstrItinClass; +def IIC_iMOVr : InstrItinClass; +def IIC_iMOVsi : InstrItinClass; +def IIC_iMOVsr : InstrItinClass; +def IIC_iCMOVi : InstrItinClass; +def IIC_iCMOVr : InstrItinClass; +def IIC_iCMOVsi : InstrItinClass; +def IIC_iCMOVsr : InstrItinClass; +def IIC_iMUL16 : InstrItinClass; +def IIC_iMAC16 : InstrItinClass; +def IIC_iMUL32 : InstrItinClass; +def IIC_iMAC32 : InstrItinClass; +def IIC_iMUL64 : InstrItinClass; +def IIC_iMAC64 : InstrItinClass; +def IIC_iLoadi : InstrItinClass; +def IIC_iLoadr : InstrItinClass; +def IIC_iLoadsi : InstrItinClass; +def IIC_iLoadiu : InstrItinClass; +def IIC_iLoadru : InstrItinClass; +def IIC_iLoadsiu : InstrItinClass; +def IIC_iLoadm : InstrItinClass; +def IIC_iStorei : InstrItinClass; +def IIC_iStorer : InstrItinClass; +def IIC_iStoresi : InstrItinClass; +def IIC_iStoreiu : InstrItinClass; +def IIC_iStoreru : InstrItinClass; +def IIC_iStoresiu : InstrItinClass; +def IIC_iStorem : InstrItinClass; +def IIC_fpALU : InstrItinClass; +def IIC_fpMPY : InstrItinClass; +def IIC_fpLoad : InstrItinClass; +def IIC_fpStore : InstrItinClass; +def IIC_Br : InstrItinClass; //===----------------------------------------------------------------------===// // Processor instruction itineraries. def GenericItineraries : ProcessorItineraries<[ - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData, InstrStage<1, [FU_LdSt0]>]>, - InstrItinData]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<2, [FU_LdSt0]>]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, Modified: llvm/trunk/lib/Target/ARM/ARMScheduleV6.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMScheduleV6.td?rev=79436&r1=79435&r2=79436&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMScheduleV6.td (original) +++ llvm/trunk/lib/Target/ARM/ARMScheduleV6.td Wed Aug 19 13:00:44 2009 @@ -14,13 +14,53 @@ // TODO: this should model an ARM11 // Single issue pipeline so every itinerary starts with FU_pipe0 def V6Itineraries : ProcessorItineraries<[ - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData, InstrStage<1, [FU_LdSt0]>]>, - InstrItinData]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<2, [FU_LdSt0]>]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, Modified: llvm/trunk/lib/Target/ARM/ARMScheduleV7.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMScheduleV7.td?rev=79436&r1=79435&r2=79436&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMScheduleV7.td (original) +++ llvm/trunk/lib/Target/ARM/ARMScheduleV7.td Wed Aug 19 13:00:44 2009 @@ -11,25 +11,154 @@ // //===----------------------------------------------------------------------===// +// +// Scheduling information derived from "Cortex-A8 Technical Reference Manual". +// // Dual issue pipeline so every itinerary starts with FU_Pipe0 | FU_Pipe1 +// def CortexA8Itineraries : ProcessorItineraries<[ - // two fully-pipelined integer ALU pipelines - InstrItinData]>, - // integer Multiply pipeline - InstrItinData]>, - InstrItinData, - InstrStage<2, [FU_Pipe0]>]>, - InstrItinData, - InstrStage<3, [FU_Pipe0]>]>, + + // Two fully-pipelined integer ALU pipelines + // + // No operand cycles + InstrItinData]>, + // + // Binary Instructions that produce a result + InstrItinData], [2, 2]>, + InstrItinData], [2, 2, 2]>, + InstrItinData], [2, 2, 1]>, + InstrItinData], [2, 2, 1, 1]>, + // + // Unary Instructions that produce a result + InstrItinData], [2, 2]>, + InstrItinData], [2, 1]>, + InstrItinData], [2, 1, 1]>, + // + // Compare instructions + InstrItinData], [2]>, + InstrItinData], [2, 2]>, + InstrItinData], [2, 1]>, + InstrItinData], [2, 1, 1]>, + // + // Move instructions, unconditional + InstrItinData], [1]>, + InstrItinData], [1, 1]>, + InstrItinData], [1, 1]>, + InstrItinData], [1, 1, 1]>, + // + // Move instructions, conditional + InstrItinData], [2]>, + InstrItinData], [2, 1]>, + InstrItinData], [2, 1]>, + InstrItinData], [2, 1, 1]>, + + // Integer multiply pipeline + // Result written in E5, but that is relative to the last cycle of multicycle, + // so we use 6 for those cases + // + InstrItinData], [5, 1, 1]>, + InstrItinData, + InstrStage<2, [FU_Pipe0]>], [6, 1, 1, 4]>, + InstrItinData, + InstrStage<2, [FU_Pipe0]>], [6, 1, 1]>, + InstrItinData, + InstrStage<2, [FU_Pipe0]>], [6, 1, 1, 4]>, + InstrItinData, + InstrStage<3, [FU_Pipe0]>], [6, 6, 1, 1]>, + InstrItinData, + InstrStage<3, [FU_Pipe0]>], [6, 6, 1, 1]>, + + // Integer load pipeline + // // loads have an extra cycle of latency, but are fully pipelined // use FU_Issue to enforce the 1 load/store per cycle limit - InstrItinData, - InstrStage<1, [FU_Pipe0, FU_Pipe1]>, - InstrStage<1, [FU_LdSt0]>]>, - // fully-pipelined stores + // + // Immediate offset + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [3, 1]>, + // + // Register offset + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [3, 1, 1]>, + // + // Scaled register offset, issues over 2 cycles + InstrItinData, + InstrStage<1, [FU_Pipe0], 0>, + InstrStage<1, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [4, 1, 1]>, + // + // Immediate offset with update + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [3, 2, 1]>, + // + // Register offset with update + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [3, 2, 1, 1]>, + // + // Scaled register offset with update, issues over 2 cycles + InstrItinData, + InstrStage<1, [FU_Pipe0], 0>, + InstrStage<1, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [4, 3, 1, 1]>, + // + // Load multiple + InstrItinData, + InstrStage<2, [FU_Pipe0], 0>, + InstrStage<2, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>]>, + + // Integer store pipeline + // // use FU_Issue to enforce the 1 load/store per cycle limit - InstrItinData, - InstrStage<1, [FU_Pipe0, FU_Pipe1]>]>, + // + // Immediate offset + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>], [3, 1]>, + // + // Register offset + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>], [3, 1, 1]>, + // + // Scaled register offset, issues over 2 cycles + InstrItinData, + InstrStage<1, [FU_Pipe0], 0>, + InstrStage<1, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [3, 1, 1]>, + // + // Immediate offset with update + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [2, 3, 1]>, + // + // Register offset with update + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [2, 3, 1, 1]>, + // + // Scaled register offset with update, issues over 2 cycles + InstrItinData, + InstrStage<1, [FU_Pipe0], 0>, + InstrStage<1, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [3, 3, 1, 1]>, + // + // Store multiple + InstrItinData, + InstrStage<2, [FU_Pipe0], 0>, + InstrStage<2, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>]>, + + // Branch + // // no delay slots, so the latency of a branch is unimportant InstrItinData]>, @@ -51,13 +180,53 @@ // FIXME def CortexA9Itineraries : ProcessorItineraries<[ - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, InstrStage<1, [FU_LdSt0]>]>, - InstrItinData]>, + InstrItinData, + InstrStage<2, [FU_LdSt0]>]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, InstrItinData]>, InstrItinData]>, InstrItinData]>, From daniel at zuster.org Wed Aug 19 13:09:48 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 18:09:48 -0000 Subject: [llvm-commits] [llvm] r79437 - /llvm/trunk/lib/Support/Twine.cpp Message-ID: <200908191809.n7JI9mmp011868@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 13:09:47 2009 New Revision: 79437 URL: http://llvm.org/viewvc/llvm-project?rev=79437&view=rev Log: Switch Twine::str() to use toVector(), which is now efficient. Modified: llvm/trunk/lib/Support/Twine.cpp Modified: llvm/trunk/lib/Support/Twine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Twine.cpp?rev=79437&r1=79436&r2=79437&view=diff ============================================================================== --- llvm/trunk/lib/Support/Twine.cpp (original) +++ llvm/trunk/lib/Support/Twine.cpp Wed Aug 19 13:09:47 2009 @@ -8,27 +8,17 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/Twine.h" +#include "llvm/ADT/SmallString.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; std::string Twine::str() const { - // FIXME: This should probably use the toVector implementation, once that is - // efficient. - std::string Res; - raw_string_ostream OS(Res); - print(OS); - OS.flush(); - return Res; + SmallString<256> Vec; + toVector(Vec); + return std::string(Vec.begin(), Vec.end()); } void Twine::toVector(SmallVectorImpl &Out) const { - // FIXME: This is very inefficient, since we are creating a large raw_ostream - // buffer -- hitting malloc, which we were supposed to avoid -- all when we - // have this pretty little small vector available. - // - // The best way to fix this is to make raw_svector_ostream do the right thing - // and be efficient, by augmenting the base raw_ostream with the ability to - // have the buffer managed by a concrete implementation. raw_svector_ostream OS(Out); print(OS); } From gohman at apple.com Wed Aug 19 13:16:18 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 18:16:18 -0000 Subject: [llvm-commits] [llvm] r79439 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/live-out-reg-info.ll test/CodeGen/X86/test-shrink.ll Message-ID: <200908191816.n7JIGJfC012754@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 13:16:17 2009 New Revision: 79439 URL: http://llvm.org/viewvc/llvm-project?rev=79439&view=rev Log: Add an x86 peep that narrows TEST instructions to forms that use a smaller encoding. These kinds of patterns are very frequent in sqlite3, for example. Added: llvm/trunk/test/CodeGen/X86/test-shrink.ll Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/test/CodeGen/X86/live-out-reg-info.ll Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=79439&r1=79438&r2=79439&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Aug 19 13:16:17 2009 @@ -686,6 +686,11 @@ const std::vector &ResultTys, const SDValue *Ops, unsigned NumOps); + /// getTargetExtractSubreg - A convenience function for creating + /// TargetInstrInfo::EXTRACT_SUBREG nodes. + SDValue getTargetExtractSubreg(int SRIdx, DebugLoc DL, EVT VT, + SDValue Operand); + /// getNodeIfExists - Get the specified node if it's already available, or /// else return NULL. SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=79439&r1=79438&r2=79439&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Aug 19 13:16:17 2009 @@ -4586,6 +4586,17 @@ return getNode(~Opcode, dl, ResultTys, Ops, NumOps).getNode(); } +/// getTargetExtractSubreg - A convenience function for creating +/// TargetInstrInfo::EXTRACT_SUBREG nodes. +SDValue +SelectionDAG::getTargetExtractSubreg(int SRIdx, DebugLoc DL, EVT VT, + SDValue Operand) { + SDValue SRIdxVal = getTargetConstant(SRIdx, MVT::i32); + SDNode *Subreg = getTargetNode(TargetInstrInfo::EXTRACT_SUBREG, DL, + VT, Operand, SRIdxVal); + return SDValue(Subreg, 0); +} + /// getNodeIfExists - Get the specified node if it's already available, or /// else return NULL. SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList, Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=79439&r1=79438&r2=79439&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Aug 19 13:16:17 2009 @@ -1743,9 +1743,8 @@ Result, CurDAG->getTargetConstant(8, MVT::i8)), 0); // Then truncate it down to i8. - SDValue SRIdx = CurDAG->getTargetConstant(X86::SUBREG_8BIT, MVT::i32); - Result = SDValue(CurDAG->getTargetNode(X86::EXTRACT_SUBREG, dl, - MVT::i8, Result, SRIdx), 0); + Result = CurDAG->getTargetExtractSubreg(X86::SUBREG_8BIT, dl, + MVT::i8, Result); } else { Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl, HiReg, NVT, InFlag); @@ -1919,9 +1918,8 @@ CurDAG->getTargetConstant(8, MVT::i8)), 0); // Then truncate it down to i8. - SDValue SRIdx = CurDAG->getTargetConstant(X86::SUBREG_8BIT, MVT::i32); - Result = SDValue(CurDAG->getTargetNode(X86::EXTRACT_SUBREG, dl, - MVT::i8, Result, SRIdx), 0); + Result = CurDAG->getTargetExtractSubreg(X86::SUBREG_8BIT, dl, + MVT::i8, Result); } else { Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl, HiReg, NVT, InFlag); @@ -1944,6 +1942,105 @@ return NULL; } + case X86ISD::CMP: { + if (getenv("NOCMP")) break; + SDValue N0 = Node->getOperand(0); + SDValue N1 = Node->getOperand(1); + + // Look for (X86cmp (and $op, $imm), 0) and see if we can convert it to + // use a smaller encoding. + if (N0.getNode()->getOpcode() == ISD::AND && N0.getNode()->hasOneUse() && + N0.getValueType() != MVT::i8 && + X86::isZeroNode(N1)) { + ConstantSDNode *C = dyn_cast(N0.getNode()->getOperand(1)); + if (!C) break; + + // For example, convert "testl %eax, $8" to "testb %al, $8" + if ((C->getZExtValue() & ~UINT64_C(0xff)) == 0) { + SDValue Imm = CurDAG->getTargetConstant(C->getZExtValue(), MVT::i8); + SDValue Reg = N0.getNode()->getOperand(0); + + // On x86-32, only the ABCD registers have 8-bit subregisters. + if (!Subtarget->is64Bit()) { + TargetRegisterClass *TRC = 0; + switch (N0.getValueType().getSimpleVT().SimpleTy) { + case MVT::i32: TRC = &X86::GR32_ABCDRegClass; break; + case MVT::i16: TRC = &X86::GR16_ABCDRegClass; break; + default: llvm_unreachable("Unsupported TEST operand type!"); + } + SDValue RC = CurDAG->getTargetConstant(TRC->getID(), MVT::i32); + Reg = SDValue(CurDAG->getTargetNode(X86::COPY_TO_REGCLASS, dl, + Reg.getValueType(), Reg, RC), 0); + } + + // Extract the l-register. + SDValue Subreg = CurDAG->getTargetExtractSubreg(X86::SUBREG_8BIT, dl, + MVT::i8, Reg); + + // Emit a testb. + return CurDAG->getTargetNode(X86::TEST8ri, dl, MVT::i32, Subreg, Imm); + } + + // For example, "testl %eax, $2048" to "testb %ah, $8". + if ((C->getZExtValue() & ~UINT64_C(0xff00)) == 0) { + // Shift the immediate right by 8 bits. + SDValue ShiftedImm = CurDAG->getTargetConstant(C->getZExtValue() >> 8, + MVT::i8); + SDValue Reg = N0.getNode()->getOperand(0); + + // Put the value in an ABCD register. + TargetRegisterClass *TRC = 0; + switch (N0.getValueType().getSimpleVT().SimpleTy) { + case MVT::i64: TRC = &X86::GR64_ABCDRegClass; break; + case MVT::i32: TRC = &X86::GR32_ABCDRegClass; break; + case MVT::i16: TRC = &X86::GR16_ABCDRegClass; break; + default: llvm_unreachable("Unsupported TEST operand type!"); + } + SDValue RC = CurDAG->getTargetConstant(TRC->getID(), MVT::i32); + Reg = SDValue(CurDAG->getTargetNode(X86::COPY_TO_REGCLASS, dl, + Reg.getValueType(), Reg, RC), 0); + + // Extract the h-register. + SDValue Subreg = CurDAG->getTargetExtractSubreg(X86::SUBREG_8BIT_HI, dl, + MVT::i8, Reg); + + // Emit a testb. No special NOREX tricks are needed since there's + // only one GPR operand! + return CurDAG->getTargetNode(X86::TEST8ri, dl, MVT::i32, + Subreg, ShiftedImm); + } + + // For example, "testl %eax, $32776" to "testw %ax, $32776". + if ((C->getZExtValue() & ~UINT64_C(0xffff)) == 0 && + N0.getValueType() != MVT::i16) { + SDValue Imm = CurDAG->getTargetConstant(C->getZExtValue(), MVT::i16); + SDValue Reg = N0.getNode()->getOperand(0); + + // Extract the 16-bit subregister. + SDValue Subreg = CurDAG->getTargetExtractSubreg(X86::SUBREG_16BIT, dl, + MVT::i16, Reg); + + // Emit a testw. + return CurDAG->getTargetNode(X86::TEST16ri, dl, MVT::i32, Subreg, Imm); + } + + // For example, "testq %rax, $268468232" to "testl %eax, $268468232". + if ((C->getZExtValue() & ~UINT64_C(0xffffffff)) == 0 && + N0.getValueType() == MVT::i64) { + SDValue Imm = CurDAG->getTargetConstant(C->getZExtValue(), MVT::i32); + SDValue Reg = N0.getNode()->getOperand(0); + + // Extract the 32-bit subregister. + SDValue Subreg = CurDAG->getTargetExtractSubreg(X86::SUBREG_32BIT, dl, + MVT::i32, Reg); + + // Emit a testl. + return CurDAG->getTargetNode(X86::TEST32ri, dl, MVT::i32, Subreg, Imm); + } + } + break; + } + case ISD::DECLARE: { // Handle DECLARE nodes here because the second operand may have been // wrapped in X86ISD::Wrapper. Modified: llvm/trunk/test/CodeGen/X86/live-out-reg-info.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/live-out-reg-info.ll?rev=79439&r1=79438&r2=79439&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/live-out-reg-info.ll (original) +++ llvm/trunk/test/CodeGen/X86/live-out-reg-info.ll Wed Aug 19 13:16:17 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86-64 | grep testl +; RUN: llvm-as < %s | llc -march=x86-64 | grep {testb \[$\]1,} ; Make sure dagcombine doesn't eliminate the comparison due ; to an off-by-one bug with ComputeMaskedBits information. Added: llvm/trunk/test/CodeGen/X86/test-shrink.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/test-shrink.ll?rev=79439&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/test-shrink.ll (added) +++ llvm/trunk/test/CodeGen/X86/test-shrink.ll Wed Aug 19 13:16:17 2009 @@ -0,0 +1,158 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | FileCheck %s --check-prefix=CHECK-64 +; RUN: llvm-as < %s | llc -march=x86 | FileCheck %s --check-prefix=CHECK-32 + +; CHECK-64: g64xh: +; CHECK-64: testb $8, %ah +; CHECK-64: ret +; CHECK-32: g64xh: +; CHECK-32: testb $8, %ah +; CHECK-32: ret +define void @g64xh(i64 inreg %x) nounwind { + %t = and i64 %x, 2048 + %s = icmp eq i64 %t, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} +; CHECK-64: g64xl: +; CHECK-64: testb $8, %dil +; CHECK-64: ret +; CHECK-32: g64xl: +; CHECK-32: testb $8, %al +; CHECK-32: ret +define void @g64xl(i64 inreg %x) nounwind { + %t = and i64 %x, 8 + %s = icmp eq i64 %t, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} +; CHECK-64: g32xh: +; CHECK-64: testb $8, %ah +; CHECK-64: ret +; CHECK-32: g32xh: +; CHECK-32: testb $8, %ah +; CHECK-32: ret +define void @g32xh(i32 inreg %x) nounwind { + %t = and i32 %x, 2048 + %s = icmp eq i32 %t, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} +; CHECK-64: g32xl: +; CHECK-64: testb $8, %dil +; CHECK-64: ret +; CHECK-32: g32xl: +; CHECK-32: testb $8, %al +; CHECK-32: ret +define void @g32xl(i32 inreg %x) nounwind { + %t = and i32 %x, 8 + %s = icmp eq i32 %t, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} +; CHECK-64: g16xh: +; CHECK-64: testb $8, %ah +; CHECK-64: ret +; CHECK-32: g16xh: +; CHECK-32: testb $8, %ah +; CHECK-32: ret +define void @g16xh(i16 inreg %x) nounwind { + %t = and i16 %x, 2048 + %s = icmp eq i16 %t, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} +; CHECK-64: g16xl: +; CHECK-64: testb $8, %dil +; CHECK-64: ret +; CHECK-32: g16xl: +; CHECK-32: testb $8, %al +; CHECK-32: ret +define void @g16xl(i16 inreg %x) nounwind { + %t = and i16 %x, 8 + %s = icmp eq i16 %t, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} +; CHECK-64: g64x16: +; CHECK-64: testw $32896, %di +; CHECK-64: ret +; CHECK-32: g64x16: +; CHECK-32: testw $32896, %ax +; CHECK-32: ret +define void @g64x16(i64 inreg %x) nounwind { + %t = and i64 %x, 32896 + %s = icmp eq i64 %t, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} +; CHECK-64: g32x16: +; CHECK-64: testw $32896, %di +; CHECK-64: ret +; CHECK-32: g32x16: +; CHECK-32: testw $32896, %ax +; CHECK-32: ret +define void @g32x16(i32 inreg %x) nounwind { + %t = and i32 %x, 32896 + %s = icmp eq i32 %t, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} +; CHECK-64: g64x32: +; CHECK-64: testl $268468352, %edi +; CHECK-64: ret +; CHECK-32: g64x32: +; CHECK-32: testl $268468352, %eax +; CHECK-32: ret +define void @g64x32(i64 inreg %x) nounwind { + %t = and i64 %x, 268468352 + %s = icmp eq i64 %t, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} + +declare void @bar() From gohman at apple.com Wed Aug 19 13:18:36 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 18:18:36 -0000 Subject: [llvm-commits] [llvm] r79440 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp test/Transforms/InstCombine/constant-fold-gep.ll Message-ID: <200908191818.n7JIIaww013043@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 13:18:36 2009 New Revision: 79440 URL: http://llvm.org/viewvc/llvm-project?rev=79440&view=rev Log: Canonicalize indices in a constantexpr GEP. If Indices exceed the static extents of the static array type, it causes GlobalOpt and other passes to be more conservative. This canonicalization also allows the constant folder to add "inbounds" to GEPs. Added: llvm/trunk/test/Transforms/InstCombine/constant-fold-gep.ll Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=79440&r1=79439&r2=79440&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed Aug 19 13:18:36 2009 @@ -131,6 +131,7 @@ return 0; uint64_t BasePtr = 0; + bool BaseIsInt = true; if (!Ptr->isNullValue()) { // If this is a inttoptr from a constant int, we can fold this as the base, // otherwise we can't. @@ -140,19 +141,62 @@ BasePtr = Base->getZExtValue(); if (BasePtr == 0) - return 0; + BaseIsInt = false; } // If this is a constant expr gep that is effectively computing an // "offsetof", fold it into 'cast int Size to T*' instead of 'gep 0, 0, 12' for (unsigned i = 1; i != NumOps; ++i) if (!isa(Ops[i])) - return false; + return 0; uint64_t Offset = TD->getIndexedOffset(Ptr->getType(), (Value**)Ops+1, NumOps-1); - Constant *C = ConstantInt::get(TD->getIntPtrType(Context), Offset+BasePtr); - return ConstantExpr::getIntToPtr(C, ResultTy); + // If the base value for this address is a literal integer value, fold the + // getelementptr to the resulting integer value casted to the pointer type. + if (BaseIsInt) { + Constant *C = ConstantInt::get(TD->getIntPtrType(Context), Offset+BasePtr); + return ConstantExpr::getIntToPtr(C, ResultTy); + } + + // Otherwise form a regular getelementptr. Recompute the indices so that + // we eliminate over-indexing of the notional static type array bounds. + // This makes it easy to determine if the getelementptr is "inbounds". + // Also, this helps GlobalOpt do SROA on GlobalVariables. + const Type *Ty = Ptr->getType(); + SmallVector NewIdxs; + for (unsigned Index = 1; Index != NumOps; ++Index) { + if (const SequentialType *ATy = dyn_cast(Ty)) { + // Determine which element of the array the offset points into. + uint64_t ElemSize = TD->getTypeAllocSize(ATy->getElementType()); + if (ElemSize == 0) + return 0; + uint64_t NewIdx = Offset / ElemSize; + Offset -= NewIdx * ElemSize; + NewIdxs.push_back(ConstantInt::get(TD->getIntPtrType(Context), NewIdx)); + Ty = ATy->getElementType(); + } else if (const StructType *STy = dyn_cast(Ty)) { + // Determine which field of the struct the offset points into. + const StructLayout &SL = *TD->getStructLayout(STy); + unsigned ElIdx = SL.getElementContainingOffset(Offset); + NewIdxs.push_back(ConstantInt::get(Type::getInt32Ty(Context), ElIdx)); + Offset -= SL.getElementOffset(ElIdx); + Ty = STy->getTypeAtIndex(ElIdx); + } else { + return 0; + } + } + + // If the base is the start of a GlobalVariable and all the array indices + // remain in their static bounds, the GEP is inbounds. We can check that + // all indices are in bounds by just checking the first index only + // because we've just normalized all the indices. + if (isa(Ptr) && NewIdxs[0]->isNullValue()) + return ConstantExpr::getInBoundsGetElementPtr(Ptr, + &NewIdxs[0], NewIdxs.size()); + + // Otherwise it may not be inbounds. + return ConstantExpr::getGetElementPtr(Ptr, &NewIdxs[0], NewIdxs.size()); } /// FoldBitCast - Constant fold bitcast, symbolically evaluating it with Added: llvm/trunk/test/Transforms/InstCombine/constant-fold-gep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/constant-fold-gep.ll?rev=79440&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/constant-fold-gep.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/constant-fold-gep.ll Wed Aug 19 13:18:36 2009 @@ -0,0 +1,50 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | FileCheck %s + +; Constant folding should fix notionally out-of-bounds indices +; and add inbounds keywords. + +%struct.X = type { [3 x i32], [3 x i32] } + + at Y = internal global [3 x %struct.X] zeroinitializer + +define void @frob() { +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 0), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 3), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 4), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 2), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 5), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 6), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 7), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 2), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 8), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 0), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 9), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 10), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 2), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 11), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 12), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 13), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 2), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 14), align 8 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 15), align 8 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 1), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 16), align 8 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 2), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 17), align 8 +; CHECK: store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 18), align 8 + ret void +} From gohman at apple.com Wed Aug 19 13:20:44 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 18:20:44 -0000 Subject: [llvm-commits] [llvm] r79441 - in /llvm/trunk/lib: Analysis/IPA/Andersens.cpp Analysis/ScalarEvolution.cpp Analysis/ValueTracking.cpp Transforms/IPO/ConstantMerge.cpp Transforms/IPO/GlobalOpt.cpp Transforms/IPO/InlineSimple.cpp Message-ID: <200908191820.n7JIKi2V013323@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 13:20:44 2009 New Revision: 79441 URL: http://llvm.org/viewvc/llvm-project?rev=79441&view=rev Log: Use hasDefinitiveInitializer() instead of testing the same thing by hand, and fix a few places that were using hasInitializer() that appear to depend on the initializer value. Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/Analysis/ValueTracking.cpp llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=79441&r1=79440&r2=79441&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Wed Aug 19 13:20:44 2009 @@ -1061,7 +1061,7 @@ Constraints.push_back(Constraint(Constraint::AddressOf, getNodeValue(*I), ObjectIndex)); - if (I->hasInitializer()) { + if (I->hasDefinitiveInitializer()) { AddGlobalInitializerConstraints(ObjectIndex, I->getInitializer()); } else { // If it doesn't have an initializer (i.e. it's defined in another Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=79441&r1=79440&r2=79441&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Aug 19 13:20:44 2009 @@ -3638,7 +3638,7 @@ // Make sure that it is really a constant global we are gepping, with an // initializer, and make sure the first IDX is really 0. GlobalVariable *GV = dyn_cast(GEP->getOperand(0)); - if (!GV || !GV->isConstant() || !GV->hasInitializer() || + if (!GV || !GV->isConstant() || !GV->hasDefinitiveInitializer() || GEP->getNumOperands() < 3 || !isa(GEP->getOperand(1)) || !cast(GEP->getOperand(1))->isNullValue()) return getCouldNotCompute(); Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=79441&r1=79440&r2=79441&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Aug 19 13:20:44 2009 @@ -1061,8 +1061,7 @@ // variable that is a constant and is initialized. The referenced constant // initializer is the array that we'll use for optimization. GlobalVariable* GV = dyn_cast(V); - if (!GV || !GV->isConstant() || !GV->hasInitializer() || - GV->mayBeOverridden()) + if (!GV || !GV->isConstant() || !GV->hasDefinitiveInitializer()) return false; Constant *GlobalInit = GV->getInitializer(); Modified: llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp?rev=79441&r1=79440&r2=79441&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp Wed Aug 19 13:20:44 2009 @@ -78,7 +78,7 @@ } // Only process constants with initializers. - if (GV->isConstant() && GV->hasInitializer()) { + if (GV->isConstant() && GV->hasDefinitiveInitializer()) { Constant *Init = GV->getInitializer(); // Check to see if the initializer is already known. Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=79441&r1=79440&r2=79441&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Wed Aug 19 13:20:44 2009 @@ -1913,7 +1913,7 @@ return 0; // Verify that the initializer is simple enough for us to handle. - if (!I->hasInitializer()) return 0; + if (!I->hasDefinitiveInitializer()) return 0; ConstantArray *CA = dyn_cast(I->getInitializer()); if (!CA) return 0; for (User::op_iterator i = CA->op_begin(), e = CA->op_end(); i != e; ++i) @@ -2139,7 +2139,7 @@ // Access it. if (GlobalVariable *GV = dyn_cast(P)) { - if (GV->hasInitializer()) + if (GV->hasDefinitiveInitializer()) return GV->getInitializer(); return 0; } @@ -2149,7 +2149,7 @@ if (CE->getOpcode() == Instruction::GetElementPtr && isa(CE->getOperand(0))) { GlobalVariable *GV = cast(CE->getOperand(0)); - if (GV->hasInitializer()) + if (GV->hasDefinitiveInitializer()) return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE, Context); } Modified: llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp?rev=79441&r1=79440&r2=79441&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp Wed Aug 19 13:20:44 2009 @@ -78,7 +78,7 @@ return false; // Don't crash on invalid code - if (!GV->hasInitializer()) + if (!GV->hasDefinitiveInitializer()) return false; const ConstantArray *InitList = dyn_cast(GV->getInitializer()); From gohman at apple.com Wed Aug 19 13:22:18 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 18:22:18 -0000 Subject: [llvm-commits] [llvm] r79442 - in /llvm/trunk/lib/Transforms/Scalar: PredicateSimplifier.cpp ScalarReplAggregates.cpp Message-ID: <200908191822.n7JIMIjf013516@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 13:22:18 2009 New Revision: 79442 URL: http://llvm.org/viewvc/llvm-project?rev=79442&view=rev Log: Make SROA and PredicateSimplifier cope if TargetData is not available. This is very conservative for now. Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=79442&r1=79441&r2=79442&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Aug 19 13:22:18 2009 @@ -2284,8 +2284,6 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredID(BreakCriticalEdgesID); AU.addRequired(); - AU.addRequired(); - AU.addPreserved(); } private: @@ -2409,7 +2407,13 @@ bool PredicateSimplifier::runOnFunction(Function &F) { DominatorTree *DT = &getAnalysis(); DTDFS = new DomTreeDFS(DT); - TargetData *TD = &getAnalysis(); + TargetData *TD = getAnalysisIfAvailable(); + + // FIXME: PredicateSimplifier should still be able to do basic + // optimizations without TargetData. But for now, just exit if + // it's not available. + if (!TD) return false; + Context = &F.getContext(); DEBUG(errs() << "Entering Function: " << F.getName() << "\n"); Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=79442&r1=79441&r2=79442&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Wed Aug 19 13:22:18 2009 @@ -68,7 +68,6 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.addRequired(); - AU.addRequired(); AU.setPreservesCFG(); } @@ -150,9 +149,16 @@ bool SROA::runOnFunction(Function &F) { - TD = &getAnalysis(); - + TD = getAnalysisIfAvailable(); + bool Changed = performPromotion(F); + + // FIXME: ScalarRepl currently depends on TargetData more than it + // theoretically needs to. It should be refactored in order to support + // target-independent IR. Until this is done, just skip the actual + // scalar-replacement portion of this pass. + if (!TD) return Changed; + while (1) { bool LocalChange = performScalarRepl(F); if (!LocalChange) break; // No need to repromote if no scalarrepl From bruno.cardoso at gmail.com Wed Aug 19 13:22:32 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Wed, 19 Aug 2009 15:22:32 -0300 Subject: [llvm-commits] [llvm] r75828 - in /llvm/trunk/lib: CodeGen/ELF.h CodeGen/ELFCodeEmitter.cpp CodeGen/ELFWriter.cpp CodeGen/ELFWriter.h Target/X86/X86ELFWriterInfo.cpp In-Reply-To: <9a9942200908190944p52139527j576263a308a6678c@mail.gmail.com> References: <200907152049.n6FKnAiE002699@zion.cs.uiuc.edu> <16e5fdf90907151621o45abc01dkc493c6e1fa9eed94@mail.gmail.com> <275e64e40907152033n32d71457p485084b17a6e856f@mail.gmail.com> <9a9942200908190944p52139527j576263a308a6678c@mail.gmail.com> Message-ID: <275e64e40908191122g765aa929k6adb768b8809b2ee@mail.gmail.com> On Wed, Aug 19, 2009 at 1:44 PM, Reid Kleckner wrote: > I just noticed that this patch introduces a memory leak for the ELFSym > objects. ?When you clear out the vector, you need to delete all the > pointers, or you could switch it back to being pass-by-value. Ok, I'll investigate it! Thanks Reid -- Bruno Cardoso Lopes http://www.brunocardoso.cc From gohman at apple.com Wed Aug 19 13:27:09 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 18:27:09 -0000 Subject: [llvm-commits] [llvm] r79443 - /llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200908191827.n7JIR9SM014111@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 13:27:08 2009 New Revision: 79443 URL: http://llvm.org/viewvc/llvm-project?rev=79443&view=rev Log: Remove temporary testing code. 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=79443&r1=79442&r2=79443&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Aug 19 13:27:08 2009 @@ -1943,7 +1943,6 @@ } case X86ISD::CMP: { - if (getenv("NOCMP")) break; SDValue N0 = Node->getOperand(0); SDValue N1 = Node->getOperand(1); From daniel at zuster.org Wed Aug 19 13:35:54 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 18:35:54 -0000 Subject: [llvm-commits] [llvm] r79445 - /llvm/trunk/test/MC/AsmParser/directive_align.s Message-ID: <200908191835.n7JIZsUW015189@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 13:35:54 2009 New Revision: 79445 URL: http://llvm.org/viewvc/llvm-project?rev=79445&view=rev Log: Fix typo Modified: llvm/trunk/test/MC/AsmParser/directive_align.s Modified: llvm/trunk/test/MC/AsmParser/directive_align.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_align.s?rev=79445&r1=79444&r2=79445&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/directive_align.s (original) +++ llvm/trunk/test/MC/AsmParser/directive_align.s Wed Aug 19 13:35:54 2009 @@ -1,7 +1,7 @@ # RUN: llvm-mc -triple i386-apple-darwin9 %s | FileCheck %s # CHECK: TEST0: -# CHECK: align 1 +# CHECK: .align 1 TEST0: .align 1 From daniel at zuster.org Wed Aug 19 13:40:58 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 18:40:58 -0000 Subject: [llvm-commits] [llvm] r79446 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <200908191840.n7JIexxe015860@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 13:40:58 2009 New Revision: 79446 URL: http://llvm.org/viewvc/llvm-project?rev=79446&view=rev Log: Change raw_svector_ostream to reserve the input buffer if necessary, Ted was right. - This class turns out to be much more convenient to use if we do this; clients can make sure the buffer is always big enough if they care (since our current idiom tends to be to use a SmallString<256> for the input to this we should generally be avoiding an unnecessary malloc). Also, add a convenience raw_svector_ostream::str method which flushes the buffer and returns a StringRef for the vector contents. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=79446&r1=79445&r2=79446&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Wed Aug 19 13:40:58 2009 @@ -454,10 +454,14 @@ public: /// Construct a new raw_svector_ostream. /// - /// \arg O - The vector to write to; this *must* have at least 128 bytes of - /// free space in it. + /// \arg O - The vector to write to; this should generally have at least 128 + /// bytes free to avoid any extraneous memory overhead. explicit raw_svector_ostream(SmallVectorImpl &O); ~raw_svector_ostream(); + + /// str - Flushes the stream contents to the target vector and return a + /// StringRef for the vector contents. + StringRef str(); }; /// raw_null_ostream - A raw_ostream that discards all output. Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79446&r1=79445&r2=79446&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Aug 19 13:40:58 2009 @@ -487,12 +487,11 @@ // and we only need to set the vector size when the data is flushed. raw_svector_ostream::raw_svector_ostream(SmallVectorImpl &O) : OS(O) { - // Set up the initial external buffer. We enforce that the buffer must have at + // Set up the initial external buffer. We make sure that the buffer has at // least 128 bytes free; raw_ostream itself only requires 64, but we want to // make sure that we don't grow the buffer unnecessarily on destruction (when // the data is flushed). See the FIXME below. - if (OS.capacity() - OS.size() < 128) - llvm_report_error("Invalid argument, must have at least 128 bytes free!"); + OS.reserve(OS.size() + 128); SetBuffer(OS.end(), OS.capacity() - OS.size()); } @@ -519,6 +518,11 @@ uint64_t raw_svector_ostream::current_pos() { return OS.size(); } +StringRef raw_svector_ostream::str() { + flush(); + return StringRef(OS.begin(), OS.size()); +} + //===----------------------------------------------------------------------===// // raw_null_ostream //===----------------------------------------------------------------------===// From wendling at apple.com Wed Aug 19 13:44:55 2009 From: wendling at apple.com (Bill Wendling) Date: Wed, 19 Aug 2009 11:44:55 -0700 Subject: [llvm-commits] [llvm] r79401 - /llvm/trunk/include/llvm/CodeGen/ValueTypes.h In-Reply-To: <200908190253.n7J2r7Q9005307@zion.cs.uiuc.edu> References: <200908190253.n7J2r7Q9005307@zion.cs.uiuc.edu> Message-ID: <1787732E-914F-48C8-A088-7590AE0C61E8@apple.com> On Aug 18, 2009, at 7:53 PM, Erick Tryzelaar wrote: > Author: erickt > Date: Tue Aug 18 21:53:07 2009 > New Revision: 79401 > > URL: http://llvm.org/viewvc/llvm-project?rev=79401&view=rev > Log: > Fix gcc-4.4/fedora 11 by adding a sentinel value to SimpleValueType. > > gcc-4.4 was optimizing away comparisons against SimpleValueType when > it was compared to a value larger than the largest value in the enum. > This patch works around it by adding one extra item to the enum so > that these tests will now be valid. > Hi Erick, Why did you choose the name "FirstExtendedValueType"? If it's a sentinel, maybe just name it so... -bw > Modified: > llvm/trunk/include/llvm/CodeGen/ValueTypes.h > > Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=79401&r1=79400&r2=79401&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original) > +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Tue Aug 18 21:53:07 > 2009 > @@ -111,7 +111,12 @@ > iPTR = 255, > > // LastSimpleValueType - The greatest valid SimpleValueType > value. > - LastSimpleValueType = 255 > + LastSimpleValueType = 255, > + > + // FirstExtendedValueType - This sentinel is needed so that > gcc 4.4 won't > + // optimize away checks of a SimpleValueType compared to > + // LastSimpleValueType+1. > + FirstExtendedValueType = 256 > }; > > SimpleValueType SimpleTy; > > > _______________________________________________ > 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 Aug 19 13:51:46 2009 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 19 Aug 2009 18:51:46 -0000 Subject: [llvm-commits] [llvm] r79447 - /llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll Message-ID: <200908191851.n7JIpkUt017258@zion.cs.uiuc.edu> Author: void Date: Wed Aug 19 13:51:45 2009 New Revision: 79447 URL: http://llvm.org/viewvc/llvm-project?rev=79447&view=rev Log: Make this test platform neutral. Modified: llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll Modified: llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll?rev=79447&r1=79446&r2=79447&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll (original) +++ llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll Wed Aug 19 13:51:45 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 | FileCheck %s +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-pc-linux | FileCheck %s @a = external global i96, align 4 @b = external global i64, align 8 From daniel at zuster.org Wed Aug 19 14:22:52 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 19:22:52 -0000 Subject: [llvm-commits] [llvm] r79449 - /llvm/trunk/lib/VMCore/ValueSymbolTable.cpp Message-ID: <200908191922.n7JJMqtL021166@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 14:22:52 2009 New Revision: 79449 URL: http://llvm.org/viewvc/llvm-project?rev=79449&view=rev Log: Change ValueSymbolTable to use raw_svector_ostream for string concatenation. Modified: llvm/trunk/lib/VMCore/ValueSymbolTable.cpp Modified: llvm/trunk/lib/VMCore/ValueSymbolTable.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ValueSymbolTable.cpp?rev=79449&r1=79448&r2=79449&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ValueSymbolTable.cpp (original) +++ llvm/trunk/lib/VMCore/ValueSymbolTable.cpp Wed Aug 19 14:22:52 2009 @@ -43,16 +43,17 @@ } // Otherwise, there is a naming conflict. Rename this value. - SmallString<128> UniqueName(V->getName().begin(), V->getName().end()); + SmallString<256> UniqueName(V->getName().begin(), V->getName().end()); // The name is too already used, just free it so we can allocate a new name. V->Name->Destroy(); unsigned BaseSize = UniqueName.size(); while (1) { - // Trim any suffix off. + // Trim any suffix off and append the next number. UniqueName.resize(BaseSize); - UniqueName.append_uint_32(++LastUnique); + raw_svector_ostream(UniqueName) << ++LastUnique; + // Try insert the vmap entry with this suffix. ValueName &NewName = vmap.GetOrCreateValue(StringRef(UniqueName.data(), @@ -90,9 +91,9 @@ SmallString<128> UniqueName(Name.begin(), Name.end()); while (1) { - // Trim any suffix off. + // Trim any suffix off and append the next number. UniqueName.resize(Name.size()); - UniqueName.append_uint_32(++LastUnique); + raw_svector_ostream(UniqueName) << ++LastUnique; // Try insert the vmap entry with this suffix. ValueName &NewName = From daniel at zuster.org Wed Aug 19 14:28:18 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 19:28:18 -0000 Subject: [llvm-commits] [llvm] r79450 - /llvm/trunk/include/llvm/ADT/SmallString.h Message-ID: <200908191928.n7JJSITh021877@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 14:28:18 2009 New Revision: 79450 URL: http://llvm.org/viewvc/llvm-project?rev=79450&view=rev Log: Remove SmallString::append_*int* methods; how many copies of int -> str conversion code do we really need? - S.append_uint(N) can be replaced with 'raw_svector_ostream(S) << N' which is somewhat slower due to the extra set up cost, but still plenty fast (especially if the svector set up cost can be amortized). Modified: llvm/trunk/include/llvm/ADT/SmallString.h Modified: llvm/trunk/include/llvm/ADT/SmallString.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallString.h?rev=79450&r1=79449&r2=79450&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallString.h (original) +++ llvm/trunk/include/llvm/ADT/SmallString.h Wed Aug 19 14:28:18 2009 @@ -59,47 +59,6 @@ this->push_back(C); return *this; } - - SmallString &append_uint_32(uint32_t N) { - char Buffer[20]; - char *BufPtr = Buffer+20; - - if (N == 0) *--BufPtr = '0'; // Handle special case. - - while (N) { - *--BufPtr = '0' + char(N % 10); - N /= 10; - } - this->append(BufPtr, Buffer+20); - return *this; - } - - SmallString &append_uint(uint64_t N) { - if (N == uint32_t(N)) - return append_uint_32(uint32_t(N)); - - char Buffer[40]; - char *BufPtr = Buffer+40; - - if (N == 0) *--BufPtr = '0'; // Handle special case... - - while (N) { - *--BufPtr = '0' + char(N % 10); - N /= 10; - } - - this->append(BufPtr, Buffer+40); - return *this; - } - - SmallString &append_sint(int64_t N) { - if (N < 0) { - this->push_back('-'); - N = -N; - } - return append_uint((uint64_t)N); - } - }; From baldrick at free.fr Wed Aug 19 14:29:29 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Aug 2009 21:29:29 +0200 Subject: [llvm-commits] [llvm] r79439 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/live-out-reg-info.ll test/CodeGen/X86/test-shrink.ll In-Reply-To: <200908191816.n7JIGJfC012754@zion.cs.uiuc.edu> References: <200908191816.n7JIGJfC012754@zion.cs.uiuc.edu> Message-ID: <4A8C5299.2040908@free.fr> Hi Dan, > + case X86ISD::CMP: { > + if (getenv("NOCMP")) break; I guess this shouldn't be there :) Ciao, Duncan. From benny.kra at googlemail.com Wed Aug 19 14:41:05 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 19 Aug 2009 19:41:05 -0000 Subject: [llvm-commits] [llvm] r79451 - /llvm/trunk/unittests/ADT/SmallStringTest.cpp Message-ID: <200908191941.n7JJf5Id023481@zion.cs.uiuc.edu> Author: d0k Date: Wed Aug 19 14:41:05 2009 New Revision: 79451 URL: http://llvm.org/viewvc/llvm-project?rev=79451&view=rev Log: Remove SmallString::append_*int* unit tests. Modified: llvm/trunk/unittests/ADT/SmallStringTest.cpp Modified: llvm/trunk/unittests/ADT/SmallStringTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallStringTest.cpp?rev=79451&r1=79450&r2=79451&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/SmallStringTest.cpp (original) +++ llvm/trunk/unittests/ADT/SmallStringTest.cpp Wed Aug 19 14:41:05 2009 @@ -44,21 +44,5 @@ EXPECT_TRUE(theString.rbegin() == theString.rend()); } -TEST_F(SmallStringTest, AppendUINT64_MAX) { - SCOPED_TRACE("AppendUINT64_MAX"); - theString.clear(); - assertEmpty(theString); - theString.append_uint(UINT64_MAX); - EXPECT_TRUE(0 == strcmp(theString.c_str(),"18446744073709551615")); -} - -TEST_F(SmallStringTest, AppendINT64_MIN) { - SCOPED_TRACE("AppendINT64_MIN"); - theString.clear(); - assertEmpty(theString); - theString.append_sint(INT64_MIN); - EXPECT_TRUE(0 == strcmp(theString.c_str(),"-9223372036854775808")); -} - } From baldrick at free.fr Wed Aug 19 14:49:08 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Aug 2009 19:49:08 -0000 Subject: [llvm-commits] [gcc-plugin] r79452 - in /gcc-plugin/trunk: i386/llvm-i386-target.h i386/llvm-i386.cpp llvm-abi.h llvm-backend.cpp llvm-convert.cpp llvm-debug.cpp llvm-internal.h llvm-types.cpp Message-ID: <200908191949.n7JJn9qZ024485@zion.cs.uiuc.edu> Author: baldrick Date: Wed Aug 19 14:49:08 2009 New Revision: 79452 URL: http://llvm.org/viewvc/llvm-project?rev=79452&view=rev Log: Resync with llvm-gcc revision 79340. This gets things compiling again. Modified: gcc-plugin/trunk/i386/llvm-i386-target.h gcc-plugin/trunk/i386/llvm-i386.cpp gcc-plugin/trunk/llvm-abi.h gcc-plugin/trunk/llvm-backend.cpp gcc-plugin/trunk/llvm-convert.cpp gcc-plugin/trunk/llvm-debug.cpp gcc-plugin/trunk/llvm-internal.h gcc-plugin/trunk/llvm-types.cpp Modified: gcc-plugin/trunk/i386/llvm-i386-target.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/i386/llvm-i386-target.h?rev=79452&r1=79451&r2=79452&view=diff ============================================================================== --- gcc-plugin/trunk/i386/llvm-i386-target.h (original) +++ gcc-plugin/trunk/i386/llvm-i386-target.h Wed Aug 19 14:49:08 2009 @@ -210,7 +210,7 @@ llvm_x86_32_should_pass_aggregate_in_mixed_regs(tree, const Type *Ty, std::vector&); -#define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, E) \ +#define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E) \ (TARGET_64BIT ? \ llvm_x86_64_should_pass_aggregate_in_mixed_regs((T), (TY), (E)) : \ llvm_x86_32_should_pass_aggregate_in_mixed_regs((T), (TY), (E))) @@ -220,7 +220,7 @@ std::vector&, bool); -#define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, ISR) \ +#define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, ISR, CC) \ (TARGET_64BIT ? \ llvm_x86_64_aggregate_partially_passed_in_regs((E), (SE), (ISR)) : \ false) Modified: gcc-plugin/trunk/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/i386/llvm-i386.cpp?rev=79452&r1=79451&r2=79452&view=diff ============================================================================== --- gcc-plugin/trunk/i386/llvm-i386.cpp (original) +++ gcc-plugin/trunk/i386/llvm-i386.cpp Wed Aug 19 14:49:08 2009 @@ -125,11 +125,11 @@ case IX86_BUILTIN_ANDNPD: if (cast(ResultType)->getNumElements() == 4) // v4f32 Ops[0] = Builder.CreateBitCast(Ops[0], - Context.getVectorType(Type::Int32Ty, 4), + VectorType::get(Type::getInt32Ty(Context), 4), "tmp"); else // v2f64 Ops[0] = Builder.CreateBitCast(Ops[0], - Context.getVectorType(Type::Int64Ty, 2), + VectorType::get(Type::getInt64Ty(Context), 2), "tmp"); Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "tmp"); @@ -285,25 +285,25 @@ Result = BuildVectorShuffle(Ops[0], Ops[1], 2, 1); return true; case IX86_BUILTIN_MOVQ: { - Value *Zero = Context.getConstantInt(Type::Int32Ty, 0); + Value *Zero = ConstantInt::get(Type::getInt32Ty(Context), 0); Result = BuildVector(Zero, Zero, Zero, Zero, NULL); Result = BuildVectorShuffle(Result, Ops[0], 4, 5, 2, 3); return true; } case IX86_BUILTIN_LOADQ: { - PointerType *i64Ptr = Context.getPointerTypeUnqual(Type::Int64Ty); + PointerType *i64Ptr = PointerType::getUnqual(Type::getInt64Ty(Context)); Ops[0] = Builder.CreateBitCast(Ops[0], i64Ptr, "tmp"); Ops[0] = Builder.CreateLoad(Ops[0], "tmp"); - Value *Zero = Context.getConstantInt(Type::Int64Ty, 0); + Value *Zero = ConstantInt::get(Type::getInt64Ty(Context), 0); Result = BuildVector(Zero, Zero, NULL); - Value *Idx = Context.getConstantInt(Type::Int32Ty, 0); + Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), 0); Result = Builder.CreateInsertElement(Result, Ops[0], Idx, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; } case IX86_BUILTIN_LOADUPS: { - VectorType *v4f32 = Context.getVectorType(Type::FloatTy, 4); - PointerType *v4f32Ptr = Context.getPointerTypeUnqual(v4f32); + VectorType *v4f32 = VectorType::get(Type::getFloatTy(Context), 4); + PointerType *v4f32Ptr = PointerType::getUnqual(v4f32); Value *BC = Builder.CreateBitCast(Ops[0], v4f32Ptr, "tmp"); LoadInst *LI = Builder.CreateLoad(BC, "tmp"); LI->setAlignment(1); @@ -311,8 +311,8 @@ return true; } case IX86_BUILTIN_LOADUPD: { - VectorType *v2f64 = Context.getVectorType(Type::DoubleTy, 2); - PointerType *v2f64Ptr = Context.getPointerTypeUnqual(v2f64); + VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2); + PointerType *v2f64Ptr = PointerType::getUnqual(v2f64); Value *BC = Builder.CreateBitCast(Ops[0], v2f64Ptr, "tmp"); LoadInst *LI = Builder.CreateLoad(BC, "tmp"); LI->setAlignment(1); @@ -320,8 +320,8 @@ return true; } case IX86_BUILTIN_LOADDQU: { - VectorType *v16i8 = Context.getVectorType(Type::Int8Ty, 16); - PointerType *v16i8Ptr = Context.getPointerTypeUnqual(v16i8); + VectorType *v16i8 = VectorType::get(Type::getInt8Ty(Context), 16); + PointerType *v16i8Ptr = PointerType::getUnqual(v16i8); Value *BC = Builder.CreateBitCast(Ops[0], v16i8Ptr, "tmp"); LoadInst *LI = Builder.CreateLoad(BC, "tmp"); LI->setAlignment(1); @@ -329,8 +329,8 @@ return true; } case IX86_BUILTIN_STOREUPS: { - VectorType *v4f32 = Context.getVectorType(Type::FloatTy, 4); - PointerType *v4f32Ptr = Context.getPointerTypeUnqual(v4f32); + VectorType *v4f32 = VectorType::get(Type::getFloatTy(Context), 4); + PointerType *v4f32Ptr = PointerType::getUnqual(v4f32); Value *BC = Builder.CreateBitCast(Ops[0], v4f32Ptr, "tmp"); StoreInst *SI = Builder.CreateStore(Ops[1], BC); SI->setAlignment(1); @@ -338,8 +338,8 @@ return true; } case IX86_BUILTIN_STOREUPD: { - VectorType *v2f64 = Context.getVectorType(Type::DoubleTy, 2); - PointerType *v2f64Ptr = Context.getPointerTypeUnqual(v2f64); + VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2); + PointerType *v2f64Ptr = PointerType::getUnqual(v2f64); Value *BC = Builder.CreateBitCast(Ops[0], v2f64Ptr, "tmp"); StoreInst *SI = Builder.CreateStore(Ops[1], BC); SI->setAlignment(1); @@ -347,8 +347,8 @@ return true; } case IX86_BUILTIN_STOREDQU: { - VectorType *v16i8 = Context.getVectorType(Type::Int8Ty, 16); - PointerType *v16i8Ptr = Context.getPointerTypeUnqual(v16i8); + VectorType *v16i8 = VectorType::get(Type::getInt8Ty(Context), 16); + PointerType *v16i8Ptr = PointerType::getUnqual(v16i8); Value *BC = Builder.CreateBitCast(Ops[0], v16i8Ptr, "tmp"); StoreInst *SI = Builder.CreateStore(Ops[1], BC); SI->setAlignment(1); @@ -356,20 +356,20 @@ return true; } case IX86_BUILTIN_LOADHPS: { - PointerType *f64Ptr = Context.getPointerTypeUnqual(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::getDoubleTy(Context)); Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp"); Value *Load = Builder.CreateLoad(Ops[1], "tmp"); - Ops[1] = BuildVector(Load, Context.getUndef(Type::DoubleTy), NULL); + Ops[1] = BuildVector(Load, UndefValue::get(Type::getDoubleTy(Context)), NULL); Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 1, 4, 5); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; } case IX86_BUILTIN_LOADLPS: { - PointerType *f64Ptr = Context.getPointerTypeUnqual(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::getDoubleTy(Context)); Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp"); Value *Load = Builder.CreateLoad(Ops[1], "tmp"); - Ops[1] = BuildVector(Load, Context.getUndef(Type::DoubleTy), NULL); + Ops[1] = BuildVector(Load, UndefValue::get(Type::getDoubleTy(Context)), NULL); Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); Result = BuildVectorShuffle(Ops[0], Ops[1], 4, 5, 2, 3); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); @@ -377,7 +377,7 @@ } case IX86_BUILTIN_LOADHPD: { Value *Load = Builder.CreateLoad(Ops[1], "tmp"); - Ops[1] = BuildVector(Load, Context.getUndef(Type::DoubleTy), NULL); + Ops[1] = BuildVector(Load, UndefValue::get(Type::getDoubleTy(Context)), NULL); Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 2); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); @@ -385,27 +385,27 @@ } case IX86_BUILTIN_LOADLPD: { Value *Load = Builder.CreateLoad(Ops[1], "tmp"); - Ops[1] = BuildVector(Load, Context.getUndef(Type::DoubleTy), NULL); + Ops[1] = BuildVector(Load, UndefValue::get(Type::getDoubleTy(Context)), NULL); Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); Result = BuildVectorShuffle(Ops[0], Ops[1], 2, 1); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; } case IX86_BUILTIN_STOREHPS: { - VectorType *v2f64 = Context.getVectorType(Type::DoubleTy, 2); - PointerType *f64Ptr = Context.getPointerTypeUnqual(Type::DoubleTy); + VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2); + PointerType *f64Ptr = PointerType::getUnqual(Type::getDoubleTy(Context)); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); - Value *Idx = Context.getConstantInt(Type::Int32Ty, 1); + Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), 1); Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp"); Ops[1] = Builder.CreateExtractElement(Ops[1], Idx, "tmp"); Result = Builder.CreateStore(Ops[1], Ops[0]); return true; } case IX86_BUILTIN_STORELPS: { - VectorType *v2f64 = Context.getVectorType(Type::DoubleTy, 2); - PointerType *f64Ptr = Context.getPointerTypeUnqual(Type::DoubleTy); + VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2); + PointerType *f64Ptr = PointerType::getUnqual(Type::getDoubleTy(Context)); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); - Value *Idx = Context.getConstantInt(Type::Int32Ty, 0); + Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), 0); Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp"); Ops[1] = Builder.CreateExtractElement(Ops[1], Idx, "tmp"); Result = Builder.CreateStore(Ops[1], Ops[0]); @@ -423,13 +423,13 @@ case IX86_BUILTIN_VEC_INIT_V4HI: // Sometimes G++ promotes arguments to int. for (unsigned i = 0; i != 4; ++i) - Ops[i] = Builder.CreateIntCast(Ops[i], Type::Int16Ty, false, "tmp"); + Ops[i] = Builder.CreateIntCast(Ops[i], Type::getInt16Ty(Context), false, "tmp"); Result = BuildVector(Ops[0], Ops[1], Ops[2], Ops[3], NULL); return true; case IX86_BUILTIN_VEC_INIT_V8QI: // Sometimes G++ promotes arguments to int. for (unsigned i = 0; i != 8; ++i) - Ops[i] = Builder.CreateIntCast(Ops[i], Type::Int8Ty, false, "tmp"); + Ops[i] = Builder.CreateIntCast(Ops[i], Type::getInt8Ty(Context), false, "tmp"); Result = BuildVector(Ops[0], Ops[1], Ops[2], Ops[3], Ops[4], Ops[5], Ops[6], Ops[7], NULL); return true; @@ -443,10 +443,21 @@ case IX86_BUILTIN_VEC_EXT_V16QI: Result = Builder.CreateExtractElement(Ops[0], Ops[1], "tmp"); return true; + case IX86_BUILTIN_VEC_SET_V16QI: + // Sometimes G++ promotes arguments to int. + Ops[1] = Builder.CreateIntCast(Ops[1], Type::getInt8Ty(Context), false, "tmp"); + Result = Builder.CreateInsertElement(Ops[0], Ops[1], Ops[2], "tmp"); + return true; case IX86_BUILTIN_VEC_SET_V4HI: case IX86_BUILTIN_VEC_SET_V8HI: // GCC sometimes doesn't produce the right element type. - Ops[1] = Builder.CreateIntCast(Ops[1], Type::Int16Ty, false, "tmp"); + Ops[1] = Builder.CreateIntCast(Ops[1], Type::getInt16Ty(Context), false, "tmp"); + Result = Builder.CreateInsertElement(Ops[0], Ops[1], Ops[2], "tmp"); + return true; + case IX86_BUILTIN_VEC_SET_V4SI: + Result = Builder.CreateInsertElement(Ops[0], Ops[1], Ops[2], "tmp"); + return true; + case IX86_BUILTIN_VEC_SET_V2DI: Result = Builder.CreateInsertElement(Ops[0], Ops[1], Ops[2], "tmp"); return true; case IX86_BUILTIN_CMPEQPS: @@ -480,7 +491,7 @@ case IX86_BUILTIN_CMPNGEPS: PredCode = 6; flip = true; break; case IX86_BUILTIN_CMPORDPS: PredCode = 7; break; } - Value *Pred = Context.getConstantInt(Type::Int8Ty, PredCode); + Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode); Value *Arg0 = Ops[0]; Value *Arg1 = Ops[1]; if (flip) std::swap(Arg0, Arg1); @@ -513,7 +524,7 @@ case IX86_BUILTIN_CMPNLESS: PredCode = 6; break; case IX86_BUILTIN_CMPORDSS: PredCode = 7; break; } - Value *Pred = Context.getConstantInt(Type::Int8Ty, PredCode); + Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode); Value *CallOps[3] = { Ops[0], Ops[1], Pred }; Result = Builder.CreateCall(cmpss, CallOps, CallOps+3, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); @@ -550,7 +561,7 @@ case IX86_BUILTIN_CMPNGEPD: PredCode = 6; flip = true; break; case IX86_BUILTIN_CMPORDPD: PredCode = 7; break; } - Value *Pred = Context.getConstantInt(Type::Int8Ty, PredCode); + Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode); Value *Arg0 = Ops[0]; Value *Arg1 = Ops[1]; if (flip) std::swap(Arg0, Arg1); @@ -582,7 +593,7 @@ case IX86_BUILTIN_CMPNLESD: PredCode = 6; break; case IX86_BUILTIN_CMPORDSD: PredCode = 7; break; } - Value *Pred = Context.getConstantInt(Type::Int8Ty, PredCode); + Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode); Value *CallOps[3] = { Ops[0], Ops[1], Pred }; Result = Builder.CreateCall(cmpsd, CallOps, CallOps+3, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); @@ -591,18 +602,19 @@ case IX86_BUILTIN_LDMXCSR: { Function *ldmxcsr = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_ldmxcsr); - Value *Ptr = CreateTemporary(Type::Int32Ty); + Value *Ptr = CreateTemporary(Type::getInt32Ty(Context)); Builder.CreateStore(Ops[0], Ptr); - Ptr = Builder.CreateBitCast(Ptr, Context.getPointerTypeUnqual(Type::Int8Ty), "tmp"); + Ptr = Builder.CreateBitCast(Ptr, + PointerType::getUnqual(Type::getInt8Ty(Context)), "tmp"); Result = Builder.CreateCall(ldmxcsr, Ptr); return true; } case IX86_BUILTIN_STMXCSR: { Function *stmxcsr = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_stmxcsr); - Value *Ptr = CreateTemporary(Type::Int32Ty); - Value *BPtr = Builder.CreateBitCast(Ptr, Context.getPointerTypeUnqual(Type::Int8Ty), - "tmp"); + Value *Ptr = CreateTemporary(Type::getInt32Ty(Context)); + Value *BPtr = Builder.CreateBitCast(Ptr, + PointerType::getUnqual(Type::getInt8Ty(Context)), "tmp"); Builder.CreateCall(stmxcsr, BPtr); Result = Builder.CreateLoad(Ptr, "tmp"); @@ -672,10 +684,10 @@ // 32 and 64-bit integers are fine, as are float and double. Long double // (which can be picked as the type for a union of 16 bytes) is not fine, // as loads and stores of it get only 10 bytes. - if (EltTy == Type::Int32Ty || - EltTy == Type::Int64Ty || - EltTy == Type::FloatTy || - EltTy == Type::DoubleTy || + if (EltTy == Type::getInt32Ty(Context) || + EltTy == Type::getInt64Ty(Context) || + EltTy == Type::getFloatTy(Context) || + EltTy == Type::getDoubleTy(Context) || isa(EltTy)) { Elts.push_back(EltTy); continue; @@ -704,10 +716,10 @@ // short in 32-bit. const Type *EltTy = STy->getElementType(0); return !((TARGET_64BIT && (EltTy->isInteger() || - EltTy == Type::FloatTy || - EltTy == Type::DoubleTy)) || - EltTy == Type::Int16Ty || - EltTy == Type::Int8Ty); + EltTy == Type::getFloatTy(Context) || + EltTy == Type::getDoubleTy(Context))) || + EltTy == Type::getInt16Ty(Context) || + EltTy == Type::getInt8Ty(Context)); } /* Target hook for llvm-abi.h. It returns true if an aggregate of the @@ -748,7 +760,7 @@ ++NumXMMs; } else if (Ty->isInteger() || isa(Ty)) { ++NumGPRs; - } else if (Ty==Type::VoidTy) { + } else if (Ty==Type::getVoidTy(Context)) { // Padding bytes that are not passed anywhere ; } else { @@ -836,7 +848,7 @@ switch (Class[i]) { case X86_64_INTEGER_CLASS: case X86_64_INTEGERSI_CLASS: - Elts.push_back(Type::Int64Ty); + Elts.push_back(Type::getInt64Ty(Context)); totallyEmpty = false; Bytes -= 8; break; @@ -851,10 +863,10 @@ // 5. 2 x SSE, size is 16: 2 x Double. if ((NumClasses-i) == 1) { if (Bytes == 8) { - Elts.push_back(Type::DoubleTy); + Elts.push_back(Type::getDoubleTy(Context)); Bytes -= 8; } else if (Bytes == 4) { - Elts.push_back (Type::FloatTy); + Elts.push_back (Type::getFloatTy(Context)); Bytes -= 4; } else assert(0 && "Not yet handled!"); @@ -868,46 +880,46 @@ if (const VectorType *VTy = dyn_cast(Ty)) { if (VTy->getNumElements() == 2) { if (VTy->getElementType()->isInteger()) { - Elts.push_back(Context.getVectorType(Type::Int64Ty, 2)); + Elts.push_back(VectorType::get(Type::getInt64Ty(Context), 2)); } else { - Elts.push_back(Context.getVectorType(Type::DoubleTy, 2)); + Elts.push_back(VectorType::get(Type::getDoubleTy(Context), 2)); } Bytes -= 8; } else { assert(VTy->getNumElements() == 4); if (VTy->getElementType()->isInteger()) { - Elts.push_back(Context.getVectorType(Type::Int32Ty, 4)); + Elts.push_back(VectorType::get(Type::getInt32Ty(Context), 4)); } else { - Elts.push_back(Context.getVectorType(Type::FloatTy, 4)); + Elts.push_back(VectorType::get(Type::getFloatTy(Context), 4)); } Bytes -= 4; } } else if (llvm_x86_is_all_integer_types(Ty)) { - Elts.push_back(Context.getVectorType(Type::Int32Ty, 4)); + Elts.push_back(VectorType::get(Type::getInt32Ty(Context), 4)); Bytes -= 4; } else { - Elts.push_back(Context.getVectorType(Type::FloatTy, 4)); + Elts.push_back(VectorType::get(Type::getFloatTy(Context), 4)); Bytes -= 4; } } else if (Class[i+1] == X86_64_SSESF_CLASS) { assert(Bytes == 12 && "Not yet handled!"); - Elts.push_back(Type::DoubleTy); - Elts.push_back(Type::FloatTy); + Elts.push_back(Type::getDoubleTy(Context)); + Elts.push_back(Type::getFloatTy(Context)); Bytes -= 12; } else if (Class[i+1] == X86_64_SSE_CLASS) { - Elts.push_back(Type::DoubleTy); - Elts.push_back(Type::DoubleTy); + Elts.push_back(Type::getDoubleTy(Context)); + Elts.push_back(Type::getDoubleTy(Context)); Bytes -= 16; } else if (Class[i+1] == X86_64_SSEDF_CLASS && Bytes == 16) { - Elts.push_back(Context.getVectorType(Type::FloatTy, 2)); - Elts.push_back(Type::DoubleTy); + Elts.push_back(VectorType::get(Type::getFloatTy(Context), 2)); + Elts.push_back(Type::getDoubleTy(Context)); } else if (Class[i+1] == X86_64_INTEGER_CLASS) { - Elts.push_back(Context.getVectorType(Type::FloatTy, 2)); - Elts.push_back(Type::Int64Ty); + Elts.push_back(VectorType::get(Type::getFloatTy(Context), 2)); + Elts.push_back(Type::getInt64Ty(Context)); } else if (Class[i+1] == X86_64_NO_CLASS) { // padding bytes, don't pass - Elts.push_back(Type::DoubleTy); - Elts.push_back(Type::VoidTy); + Elts.push_back(Type::getDoubleTy(Context)); + Elts.push_back(Type::getVoidTy(Context)); Bytes -= 16; } else assert(0 && "Not yet handled!"); @@ -917,12 +929,12 @@ break; case X86_64_SSESF_CLASS: totallyEmpty = false; - Elts.push_back(Type::FloatTy); + Elts.push_back(Type::getFloatTy(Context)); Bytes -= 4; break; case X86_64_SSEDF_CLASS: totallyEmpty = false; - Elts.push_back(Type::DoubleTy); + Elts.push_back(Type::getDoubleTy(Context)); Bytes -= 8; break; case X86_64_X87_CLASS: @@ -932,7 +944,7 @@ case X86_64_NO_CLASS: // Padding bytes that are not passed (unless the entire object consists // of padding) - Elts.push_back(Type::VoidTy); + Elts.push_back(Type::getVoidTy(Context)); Bytes -= 8; break; default: assert(0 && "Unexpected register class!"); @@ -1092,13 +1104,13 @@ const Type *Ty = ConvertType(type); unsigned Size = getTargetData().getTypeAllocSize(Ty); if (Size == 0) - return Type::VoidTy; + return Type::getVoidTy(Context); else if (Size == 1) - return Type::Int8Ty; + return Type::getInt8Ty(Context); else if (Size == 2) - return Type::Int16Ty; + return Type::getInt16Ty(Context); else if (Size <= 4) - return Type::Int32Ty; + return Type::getInt32Ty(Context); // Check if Ty should be returned using multiple value return instruction. if (llvm_suitable_multiple_ret_value_type(Ty, type)) @@ -1111,7 +1123,7 @@ enum machine_mode Mode = type_natural_mode(type, NULL); int NumClasses = classify_argument(Mode, type, Class, 0); if (NumClasses == 0) - return Type::Int64Ty; + return Type::getInt64Ty(Context); if (NumClasses == 1) { if (Class[0] == X86_64_INTEGERSI_CLASS || @@ -1121,13 +1133,13 @@ (Mode == BLKmode) ? int_size_in_bytes(type) : (int) GET_MODE_SIZE(Mode); if (Bytes>4) - return Type::Int64Ty; + return Type::getInt64Ty(Context); else if (Bytes>2) - return Type::Int32Ty; + return Type::getInt32Ty(Context); else if (Bytes>1) - return Type::Int16Ty; + return Type::getInt16Ty(Context); else - return Type::Int8Ty; + return Type::getInt8Ty(Context); } assert(0 && "Unexpected type!"); } @@ -1136,22 +1148,22 @@ if (Class[0] == X86_64_INTEGER_CLASS || Class[0] == X86_64_NO_CLASS || Class[0] == X86_64_INTEGERSI_CLASS) - return Type::Int64Ty; + return Type::getInt64Ty(Context); else if (Class[0] == X86_64_SSE_CLASS || Class[0] == X86_64_SSEDF_CLASS) - return Type::DoubleTy; + return Type::getDoubleTy(Context); else if (Class[0] == X86_64_SSESF_CLASS) - return Type::FloatTy; + return Type::getFloatTy(Context); assert(0 && "Unexpected type!"); } if (Class[0] == X86_64_NO_CLASS) { *Offset = 8; if (Class[1] == X86_64_INTEGERSI_CLASS || Class[1] == X86_64_INTEGER_CLASS) - return Type::Int64Ty; + return Type::getInt64Ty(Context); else if (Class[1] == X86_64_SSE_CLASS || Class[1] == X86_64_SSEDF_CLASS) - return Type::DoubleTy; + return Type::getDoubleTy(Context); else if (Class[1] == X86_64_SSESF_CLASS) - return Type::FloatTy; + return Type::getFloatTy(Context); assert(0 && "Unexpected type!"); } assert(0 && "Unexpected type!"); @@ -1159,11 +1171,11 @@ assert(0 && "Unexpected type!"); } else { if (Size <= 8) - return Type::Int64Ty; + return Type::getInt64Ty(Context); else if (Size <= 16) - return Context.getIntegerType(128); + return IntegerType::get(Context, 128); else if (Size <= 32) - return Context.getIntegerType(256); + return IntegerType::get(Context, 256); } return NULL; } @@ -1201,7 +1213,7 @@ switch (Class[i]) { case X86_64_INTEGER_CLASS: case X86_64_INTEGERSI_CLASS: - Elts.push_back(Type::Int64Ty); + Elts.push_back(Type::getInt64Ty(Context)); Bytes -= 8; break; case X86_64_SSE_CLASS: @@ -1215,10 +1227,10 @@ // 6. 1 x SSE, 1 x NO: Second is padding, pass as double. if ((NumClasses-i) == 1) { if (Bytes == 8) { - Elts.push_back(Type::DoubleTy); + Elts.push_back(Type::getDoubleTy(Context)); Bytes -= 8; } else if (Bytes == 4) { - Elts.push_back(Type::FloatTy); + Elts.push_back(Type::getFloatTy(Context)); Bytes -= 4; } else assert(0 && "Not yet handled!"); @@ -1232,42 +1244,42 @@ if (const VectorType *VTy = dyn_cast(Ty)) { if (VTy->getNumElements() == 2) { if (VTy->getElementType()->isInteger()) - Elts.push_back(Context.getVectorType(Type::Int64Ty, 2)); + Elts.push_back(VectorType::get(Type::getInt64Ty(Context), 2)); else - Elts.push_back(Context.getVectorType(Type::DoubleTy, 2)); + Elts.push_back(VectorType::get(Type::getDoubleTy(Context), 2)); Bytes -= 8; } else { assert(VTy->getNumElements() == 4); if (VTy->getElementType()->isInteger()) - Elts.push_back(Context.getVectorType(Type::Int32Ty, 4)); + Elts.push_back(VectorType::get(Type::getInt32Ty(Context), 4)); else - Elts.push_back(Context.getVectorType(Type::FloatTy, 4)); + Elts.push_back(VectorType::get(Type::getFloatTy(Context), 4)); Bytes -= 4; } } else if (llvm_x86_is_all_integer_types(Ty)) { - Elts.push_back(Context.getVectorType(Type::Int32Ty, 4)); + Elts.push_back(VectorType::get(Type::getInt32Ty(Context), 4)); Bytes -= 4; } else { - Elts.push_back(Context.getVectorType(Type::FloatTy, 4)); + Elts.push_back(VectorType::get(Type::getFloatTy(Context), 4)); Bytes -= 4; } } else if (Class[i+1] == X86_64_SSESF_CLASS) { assert(Bytes == 12 && "Not yet handled!"); - Elts.push_back(Type::DoubleTy); - Elts.push_back(Type::FloatTy); + Elts.push_back(Type::getDoubleTy(Context)); + Elts.push_back(Type::getFloatTy(Context)); Bytes -= 12; } else if (Class[i+1] == X86_64_SSE_CLASS) { - Elts.push_back(Type::DoubleTy); - Elts.push_back(Type::DoubleTy); + Elts.push_back(Type::getDoubleTy(Context)); + Elts.push_back(Type::getDoubleTy(Context)); Bytes -= 16; } else if (Class[i+1] == X86_64_SSEDF_CLASS && Bytes == 16) { - Elts.push_back(Context.getVectorType(Type::FloatTy, 2)); - Elts.push_back(Type::DoubleTy); + Elts.push_back(VectorType::get(Type::getFloatTy(Context), 2)); + Elts.push_back(Type::getDoubleTy(Context)); } else if (Class[i+1] == X86_64_INTEGER_CLASS) { - Elts.push_back(Context.getVectorType(Type::FloatTy, 2)); - Elts.push_back(Type::Int64Ty); + Elts.push_back(VectorType::get(Type::getFloatTy(Context), 2)); + Elts.push_back(Type::getInt64Ty(Context)); } else if (Class[i+1] == X86_64_NO_CLASS) { - Elts.push_back(Type::DoubleTy); + Elts.push_back(Type::getDoubleTy(Context)); Bytes -= 16; } else { assert(0 && "Not yet handled!"); @@ -1277,21 +1289,21 @@ assert(0 && "Not yet handled!"); break; case X86_64_SSESF_CLASS: - Elts.push_back(Type::FloatTy); + Elts.push_back(Type::getFloatTy(Context)); Bytes -= 4; break; case X86_64_SSEDF_CLASS: - Elts.push_back(Type::DoubleTy); + Elts.push_back(Type::getDoubleTy(Context)); Bytes -= 8; break; case X86_64_X87_CLASS: case X86_64_X87UP_CLASS: case X86_64_COMPLEX_X87_CLASS: - Elts.push_back(Type::X86_FP80Ty); + Elts.push_back(Type::getX86_FP80Ty(Context)); break; case X86_64_NO_CLASS: // padding bytes. - Elts.push_back(Type::Int64Ty); + Elts.push_back(Type::getInt64Ty(Context)); break; default: assert(0 && "Unexpected register class!"); } @@ -1311,14 +1323,14 @@ // Special handling for _Complex. if (llvm_x86_should_not_return_complex_in_memory(type)) { - ElementTypes.push_back(Type::X86_FP80Ty); - ElementTypes.push_back(Type::X86_FP80Ty); - return Context.getStructType(ElementTypes, STy->isPacked()); + ElementTypes.push_back(Type::getX86_FP80Ty(Context)); + ElementTypes.push_back(Type::getX86_FP80Ty(Context)); + return StructType::get(Context, ElementTypes, STy->isPacked()); } std::vector GCCElts; llvm_x86_64_get_multiple_return_reg_classes(type, Ty, GCCElts); - return Context.getStructType(GCCElts, false); + return StructType::get(Context, GCCElts, false); } // llvm_x86_extract_mrv_array_element - Helper function that help extract @@ -1338,12 +1350,12 @@ Value *EVI = Builder.CreateExtractValue(Src, SrcFieldNo, "mrv_gr"); const StructType *STy = cast(Src->getType()); llvm::Value *Idxs[3]; - Idxs[0] = Context.getConstantInt(llvm::Type::Int32Ty, 0); - Idxs[1] = Context.getConstantInt(llvm::Type::Int32Ty, DestFieldNo); - Idxs[2] = Context.getConstantInt(llvm::Type::Int32Ty, DestElemNo); + Idxs[0] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); + Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), DestFieldNo); + Idxs[2] = ConstantInt::get(llvm::Type::getInt32Ty(Context), DestElemNo); Value *GEP = Builder.CreateGEP(Dest, Idxs, Idxs+3, "mrv_gep"); if (isa(STy->getElementType(SrcFieldNo))) { - Value *ElemIndex = Context.getConstantInt(Type::Int32Ty, SrcElemNo); + Value *ElemIndex = ConstantInt::get(Type::getInt32Ty(Context), SrcElemNo); Value *EVIElem = Builder.CreateExtractElement(EVI, ElemIndex, "mrv"); Builder.CreateStore(EVIElem, GEP, isVolatile); } else { @@ -1376,12 +1388,12 @@ Value *EVI = Builder.CreateExtractValue(Src, 0, "mrv_gr"); - Value *E0Index = Context.getConstantInt(Type::Int32Ty, 0); + Value *E0Index = ConstantInt::get(Type::getInt32Ty(Context), 0); Value *EVI0 = Builder.CreateExtractElement(EVI, E0Index, "mrv.v"); Value *GEP0 = Builder.CreateStructGEP(Dest, 0, "mrv_gep"); Builder.CreateStore(EVI0, GEP0, isVolatile); - Value *E1Index = Context.getConstantInt(Type::Int32Ty, 1); + Value *E1Index = ConstantInt::get(Type::getInt32Ty(Context), 1); Value *EVI1 = Builder.CreateExtractElement(EVI, E1Index, "mrv.v"); Value *GEP1 = Builder.CreateStructGEP(Dest, 1, "mrv_gep"); Builder.CreateStore(EVI1, GEP1, isVolatile); @@ -1408,16 +1420,16 @@ // Special treatement for _Complex. if (const StructType *ComplexType = dyn_cast(DestElemType)) { llvm::Value *Idxs[3]; - Idxs[0] = Context.getConstantInt(llvm::Type::Int32Ty, 0); - Idxs[1] = Context.getConstantInt(llvm::Type::Int32Ty, DNO); + Idxs[0] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); + Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), DNO); - Idxs[2] = Context.getConstantInt(llvm::Type::Int32Ty, 0); + Idxs[2] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); Value *GEP = Builder.CreateGEP(Dest, Idxs, Idxs+3, "mrv_gep"); Value *EVI = Builder.CreateExtractValue(Src, 0, "mrv_gr"); Builder.CreateStore(EVI, GEP, isVolatile); ++SNO; - Idxs[2] = Context.getConstantInt(llvm::Type::Int32Ty, 1); + Idxs[2] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 1); GEP = Builder.CreateGEP(Dest, Idxs, Idxs+3, "mrv_gep"); EVI = Builder.CreateExtractValue(Src, 1, "mrv_gr"); Builder.CreateStore(EVI, GEP, isVolatile); Modified: gcc-plugin/trunk/llvm-abi.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-abi.h?rev=79452&r1=79451&r2=79452&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-abi.h (original) +++ gcc-plugin/trunk/llvm-abi.h Wed Aug 19 14:49:08 2009 @@ -29,9 +29,9 @@ #define LLVM_ABI_H // LLVM headers +#include "llvm/Attributes.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" -#include "llvm/Attributes.h" #include "llvm/Target/TargetData.h" // System headers @@ -218,19 +218,19 @@ unsigned Size = getTargetData().getTypeAllocSize(Ty); *Offset = 0; if (Size == 0) - return Type::VoidTy; + return Type::getVoidTy(getGlobalContext()); else if (Size == 1) - return Type::Int8Ty; + return Type::getInt8Ty(getGlobalContext()); else if (Size == 2) - return Type::Int16Ty; + return Type::getInt16Ty(getGlobalContext()); else if (Size <= 4) - return Type::Int32Ty; + return Type::getInt32Ty(getGlobalContext()); else if (Size <= 8) - return Type::Int64Ty; + return Type::getInt64Ty(getGlobalContext()); else if (Size <= 16) - return IntegerType::get(128); + return IntegerType::get(getGlobalContext(), 128); else if (Size <= 32) - return IntegerType::get(256); + return IntegerType::get(getGlobalContext(), 256); return NULL; } @@ -277,7 +277,7 @@ // registers. The routine should also return by reference a vector of the // types of the registers being used. The default is false. #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS -#define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, E) \ +#define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E) \ false #endif @@ -287,12 +287,12 @@ // the aggregate. Note, this routine should return false if none of the needed // registers are available. #ifndef LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS -#define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, ISR) \ +#define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, ISR, CC) \ false #endif // LLVM_BYVAL_ALIGNMENT - Returns the alignment of the type in bytes, if known, -// in the context of its use as a function parameter. +// in the getGlobalContext() of its use as a function parameter. // Note that the alignment in the TYPE node is usually the alignment appropriate // when the type is used within a struct, which may or may not be appropriate // here. @@ -384,7 +384,7 @@ void HandleReturnType(tree type, tree fn, bool isBuiltin) { unsigned Offset = 0; const Type *Ty = ConvertType(type); - if (Ty->getTypeID() == Type::VectorTyID) { + if (isa(Ty)) { // Vector handling is weird on x86. In particular builtin and // non-builtin function of the same return types can use different // calling conventions. @@ -395,7 +395,7 @@ C.HandleScalarShadowResult(PointerType::getUnqual(Ty), false); else C.HandleScalarResult(Ty); - } else if (Ty->isSingleValueType() || Ty == Type::VoidTy) { + } else if (Ty->isSingleValueType() || Ty == Type::getVoidTy(getGlobalContext())) { // Return scalar values normally. C.HandleScalarResult(Ty); } else if (doNotUseShadowReturn(type, fn)) { @@ -441,11 +441,16 @@ // Figure out if this field is zero bits wide, e.g. {} or [0 x int]. Do // not include variable sized fields here. std::vector Elts; - if (isPassedByInvisibleReference(type)) { // variable size -> by-ref. + if (Ty == Type::getVoidTy(getGlobalContext())) { + // Handle void explicitly as an opaque type. + const Type *OpTy = OpaqueType::get(getGlobalContext()); + C.HandleScalarArgument(OpTy, type); + ScalarElts.push_back(OpTy); + } else if (isPassedByInvisibleReference(type)) { // variable size -> by-ref. const Type *PtrTy = PointerType::getUnqual(Ty); C.HandleByInvisibleReferenceArgument(PtrTy, type); ScalarElts.push_back(PtrTy); - } else if (Ty->getTypeID()==Type::VectorTyID) { + } else if (isa(Ty)) { if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) { PassInIntegerRegisters(type, Ty, ScalarElts, 0, false); } else if (LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(type)) { @@ -464,9 +469,12 @@ ScalarElts.push_back(Ty); } else if (LLVM_SHOULD_PASS_AGGREGATE_AS_FCA(type, Ty)) { C.HandleFCAArgument(Ty, type); - } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(type, Ty, Elts)) { + } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(type, Ty, + C.getCallingConv(), + Elts)) { if (!LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(Elts, ScalarElts, - C.isShadowReturn())) + C.isShadowReturn(), + C.getCallingConv())) PassInMixedRegisters(type, Ty, Elts, ScalarElts); else { C.HandleByValArgument(Ty, type); @@ -591,7 +599,8 @@ // don't bitcast aggregate value to Int64 if its alignment is different // from Int64 alignment. ARM backend needs this. unsigned Align = TYPE_ALIGN(type)/8; - unsigned Int64Align = getTargetData().getABITypeAlignment(Type::Int64Ty); + unsigned Int64Align = + getTargetData().getABITypeAlignment(Type::getInt64Ty(getGlobalContext())); bool UseInt64 = DontCheckAlignment ? true : (Align >= Int64Align); // FIXME: In cases where we can, we should use the original struct. @@ -606,25 +615,26 @@ const Type *ArrayElementType = NULL; if (ArraySize) { Size = Size % ElementSize; - ArrayElementType = (UseInt64)?Type::Int64Ty:Type::Int32Ty; + ArrayElementType = (UseInt64) ? + Type::getInt64Ty(getGlobalContext()) : Type::getInt32Ty(getGlobalContext()); ATy = ArrayType::get(ArrayElementType, ArraySize); Elts.push_back(ATy); } if (Size >= 4) { - Elts.push_back(Type::Int32Ty); + Elts.push_back(Type::getInt32Ty(getGlobalContext())); Size -= 4; } if (Size >= 2) { - Elts.push_back(Type::Int16Ty); + Elts.push_back(Type::getInt16Ty(getGlobalContext())); Size -= 2; } if (Size >= 1) { - Elts.push_back(Type::Int8Ty); + Elts.push_back(Type::getInt8Ty(getGlobalContext())); Size -= 1; } assert(Size == 0 && "Didn't cover value?"); - const StructType *STy = StructType::get(Elts, false); + const StructType *STy = StructType::get(getGlobalContext(), Elts, false); unsigned i = 0; if (ArraySize) { @@ -656,13 +666,13 @@ // that occupies storage but has no useful information, and is not passed // anywhere". Happens on x86-64. std::vector Elts(OrigElts); - const Type* wordType = getTargetData().getPointerSize() == 4 ? Type::Int32Ty : - Type::Int64Ty; + const Type* wordType = getTargetData().getPointerSize() == 4 ? + Type::getInt32Ty(getGlobalContext()) : Type::getInt64Ty(getGlobalContext()); for (unsigned i=0, e=Elts.size(); i!=e; ++i) - if (OrigElts[i]==Type::VoidTy) + if (OrigElts[i]==Type::getVoidTy(getGlobalContext())) Elts[i] = wordType; - const StructType *STy = StructType::get(Elts, false); + const StructType *STy = StructType::get(getGlobalContext(), Elts, false); unsigned Size = getTargetData().getTypeAllocSize(STy); const StructType *InSTy = dyn_cast(Ty); @@ -681,7 +691,7 @@ } } for (unsigned i = 0, e = Elts.size(); i != e; ++i) { - if (OrigElts[i] != Type::VoidTy) { + if (OrigElts[i] != Type::getVoidTy(getGlobalContext())) { C.EnterField(i, STy); unsigned RealSize = 0; if (LastEltSizeDiff && i == (e - 1)) @@ -730,7 +740,7 @@ void HandleReturnType(tree type, tree fn, bool isBuiltin) { unsigned Offset = 0; const Type *Ty = ConvertType(type); - if (Ty->getTypeID() == Type::VectorTyID) { + if (isa(Ty)) { // Vector handling is weird on x86. In particular builtin and // non-builtin function of the same return types can use different // calling conventions. @@ -741,7 +751,7 @@ C.HandleScalarShadowResult(PointerType::getUnqual(Ty), false); else C.HandleScalarResult(Ty); - } else if (Ty->isSingleValueType() || Ty == Type::VoidTy) { + } else if (Ty->isSingleValueType() || Ty == Type::getVoidTy(getGlobalContext())) { // Return scalar values normally. C.HandleScalarResult(Ty); } else if (doNotUseShadowReturn(type, fn)) { @@ -819,7 +829,7 @@ if (Attributes) { *Attributes |= Attr; } - } else if (Ty->getTypeID()==Type::VectorTyID) { + } else if (isa(Ty)) { if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) { PassInIntegerRegisters(type, Ty, ScalarElts, 0, false); } else if (LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(type)) { @@ -858,7 +868,7 @@ Attr |= Attribute::InReg; NumGPR = NumArgRegs; } - } else if (Ty->getTypeID() == Type::PointerTyID) { + } else if (isa(Ty)) { if (NumGPR < NumArgRegs) { NumGPR++; } else { @@ -866,15 +876,16 @@ } // We don't care about arguments passed in Floating-point or vector // registers. - } else if (!(Ty->isFloatingPoint() || - Ty->getTypeID() == Type::VectorTyID)) { + } else if (!(Ty->isFloatingPoint() || isa(Ty))) { abort(); } if (Attributes) { *Attributes |= Attr; } - } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(type, Ty, Elts)) { + } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(type, Ty, + C.getCallingConv(), + Elts)) { HOST_WIDE_INT SrcSize = int_size_in_bytes(type); // With the SVR4 ABI, the only aggregates which are passed in registers @@ -1031,7 +1042,8 @@ // don't bitcast aggregate value to Int64 if its alignment is different // from Int64 alignment. ARM backend needs this. unsigned Align = TYPE_ALIGN(type)/8; - unsigned Int64Align = getTargetData().getABITypeAlignment(Type::Int64Ty); + unsigned Int64Align = + getTargetData().getABITypeAlignment(Type::getInt64Ty(getGlobalContext())); bool UseInt64 = DontCheckAlignment ? true : (Align >= Int64Align); // FIXME: In cases where we can, we should use the original struct. @@ -1046,25 +1058,26 @@ const Type *ArrayElementType = NULL; if (ArraySize) { Size = Size % ElementSize; - ArrayElementType = (UseInt64)?Type::Int64Ty:Type::Int32Ty; + ArrayElementType = (UseInt64) ? + Type::getInt64Ty(getGlobalContext()) : Type::getInt32Ty(getGlobalContext()); ATy = ArrayType::get(ArrayElementType, ArraySize); Elts.push_back(ATy); } if (Size >= 4) { - Elts.push_back(Type::Int32Ty); + Elts.push_back(Type::getInt32Ty(getGlobalContext())); Size -= 4; } if (Size >= 2) { - Elts.push_back(Type::Int16Ty); + Elts.push_back(Type::getInt16Ty(getGlobalContext())); Size -= 2; } if (Size >= 1) { - Elts.push_back(Type::Int8Ty); + Elts.push_back(Type::getInt8Ty(getGlobalContext())); Size -= 1; } assert(Size == 0 && "Didn't cover value?"); - const StructType *STy = StructType::get(Elts, false); + const StructType *STy = StructType::get(getGlobalContext(), Elts, false); unsigned i = 0; if (ArraySize) { @@ -1098,13 +1111,13 @@ // that occupies storage but has no useful information, and is not passed // anywhere". Happens on x86-64. std::vector Elts(OrigElts); - const Type* wordType = getTargetData().getPointerSize() == 4 ? Type::Int32Ty : - Type::Int64Ty; + const Type* wordType = getTargetData().getPointerSize() == 4 + ? Type::getInt32Ty(getGlobalContext()) : Type::getInt64Ty(getGlobalContext()); for (unsigned i=0, e=Elts.size(); i!=e; ++i) - if (OrigElts[i]==Type::VoidTy) + if (OrigElts[i]==Type::getVoidTy(getGlobalContext())) Elts[i] = wordType; - const StructType *STy = StructType::get(Elts, false); + const StructType *STy = StructType::get(getGlobalContext(), Elts, false); unsigned Size = getTargetData().getTypeAllocSize(STy); const StructType *InSTy = dyn_cast(Ty); @@ -1123,7 +1136,7 @@ } } for (unsigned i = 0, e = Elts.size(); i != e; ++i) { - if (OrigElts[i] != Type::VoidTy) { + if (OrigElts[i] != Type::getVoidTy(getGlobalContext())) { C.EnterField(i, STy); unsigned RealSize = 0; if (LastEltSizeDiff && i == (e - 1)) Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=79452&r1=79451&r2=79452&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Wed Aug 19 14:49:08 2009 @@ -67,6 +67,7 @@ #include "cgraph.h" #include "diagnostic.h" +#include "except.h" #include "flags.h" #include "function.h" #include "gcc-plugin.h" @@ -75,7 +76,6 @@ #include "output.h" #include "params.h" #include "plugin-version.h" -#include "tm.h" #include "toplev.h" #include "tree-inline.h" #include "tree-flow.h" @@ -117,6 +117,7 @@ std::vector > StaticCtors, StaticDtors; SmallSetVector AttributeUsedGlobals; +SmallSetVector AttributeCompilerUsedGlobals; std::vector AttributeAnnotateGlobals; /// PerFunctionPasses - This is the list of cleanup passes run per-function @@ -151,7 +152,7 @@ //TODO/// function-local decls to be recycled after the function is done. //TODOstatic std::vector LocalLLVMValueIDs; //TODO -//TODO// Remember the LLVM value for GCC tree node. +//TODO/// llvm_set_decl - Remember the LLVM value for GCC tree node. //TODOvoid llvm_set_decl(tree Tr, Value *V) { //TODO //TODO // If there is not any value then do not add new LLVMValues entry. @@ -179,7 +180,8 @@ //TODO LocalLLVMValueIDs.push_back(Index); //TODO} //TODO -//TODO// Return TRUE if there is a LLVM Value associate with GCC tree node. +//TODO/// llvm_set_decl_p - Return TRUE if there is a LLVM Value associate with GCC +//TODO/// tree node. //TODObool llvm_set_decl_p(tree Tr) { //TODO unsigned Index = GET_DECL_LLVM_INDEX(Tr); //TODO if (Index == 0) @@ -188,10 +190,10 @@ //TODO return LLVMValues[Index - 1] != 0; //TODO} //TODO -//TODO// Get LLVM Value for the GCC tree node based on LLVMValues vector index. -//TODO// If there is not any value associated then use make_decl_llvm() to -//TODO// make LLVM value. When GCC tree node is initialized, it has 0 as the -//TODO// index value. This is why all recorded indices are offset by 1. +//TODO/// llvm_get_decl - Get LLVM Value for the GCC tree node based on LLVMValues +//TODO/// vector index. If there is not any value associated then use +//TODO/// make_decl_llvm() to make LLVM value. When GCC tree node is initialized, it +//TODO/// has 0 as the index value. This is why all recorded indices are offset by 1. //TODOValue *llvm_get_decl(tree Tr) { //TODO //TODO unsigned Index = GET_DECL_LLVM_INDEX(Tr); @@ -219,6 +221,11 @@ //TODO AttributeUsedGlobals.insert(New); //TODO } //TODO +//TODO if (AttributeCompilerUsedGlobals.count(Old)) { +//TODO AttributeCompilerUsedGlobals.remove(Old); +//TODO AttributeCompilerUsedGlobals.insert(New); +//TODO } +//TODO //TODO for (unsigned i = 0, e = StaticCtors.size(); i != e; ++i) { //TODO if (StaticCtors[i].first == Old) //TODO StaticCtors[i].first = New; @@ -250,7 +257,7 @@ //TODO LLVMValuesMap[New] = Idx+1; //TODO} //TODO -//TODO// Read LLVM Types string table +//TODO/// readLLVMValues - Read LLVM Types string table //TODOvoid readLLVMValues() { //TODO GlobalValue *V = TheModule->getNamedGlobal("llvm.pch.values"); //TODO if (!V) @@ -279,9 +286,9 @@ //TODO GV->eraseFromParent(); //TODO} //TODO -//TODO// GCC tree's uses LLVMValues vector's index to reach LLVM Values. -//TODO// Create a string table to hold these LLVM Values' names. This string -//TODO// table will be used to recreate LTypes vector after loading PCH. +//TODO/// writeLLVMValues - GCC tree's uses LLVMValues vector's index to reach LLVM +//TODO/// Values. Create a string table to hold these LLVM Values' names. This string +//TODO/// table will be used to recreate LTypes vector after loading PCH. //TODOvoid writeLLVMValues() { //TODO if (LLVMValues.empty()) //TODO return; @@ -296,11 +303,11 @@ //TODO else //TODO // Non constant values, e.g. arguments, are not at global scope. //TODO // When PCH is read, only global scope values are used. -//TODO ValuesForPCH.push_back(Context.getNullValue(Type::Int32Ty)); +//TODO ValuesForPCH.push_back(Constant::getNullValue(Type::getInt32Ty(Context))); //TODO } //TODO //TODO // Create string table. -//TODO Constant *LLVMValuesTable = Context.getConstantStruct(ValuesForPCH, false); +//TODO Constant *LLVMValuesTable = ConstantStruct::get(Context, ValuesForPCH, false); //TODO //TODO // Create variable to hold this string table. //TODO new GlobalVariable(*TheModule, LLVMValuesTable->getType(), true, @@ -328,8 +335,7 @@ //TODO } //TODO} - -// Forward decl visibility style to global. +/// handleVisibility - Forward decl visibility style to global. void handleVisibility(tree decl, GlobalValue *GV) { // If decl has visibility specified explicitely (via attribute) - honour // it. Otherwise (e.g. visibility specified via -fvisibility=hidden) honour @@ -485,8 +491,9 @@ // Create the TargetMachine we will be generating code with. // FIXME: Figure out how to select the target and pass down subtarget info. std::string Err; + std::string Triple = TheModule->getTargetTriple(); const Target *TME = - TargetRegistry::getClosestStaticTargetForModule(*TheModule, Err); + TargetRegistry::lookupTarget(Triple, Err); if (!TME) llvm_report_error(Err); @@ -499,7 +506,7 @@ //TODO LLVM_SET_SUBTARGET_FEATURES(Features); //TODO FeatureStr = Features.getString(); //TODO#endif - TheTarget = TME->createTargetMachine(*TheModule, FeatureStr); + TheTarget = TME->createTargetMachine(Triple, FeatureStr); assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN); TheFolder = new TargetFolder(TheTarget->getTargetData(), getGlobalContext()); @@ -520,10 +527,14 @@ //TODO TheDebugInfo = new DebugInfo(TheModule); //TODO} //TODO -//TODO/// Set backend options that may only be known at codegen time. +//TODO/// performLateBackendInitialization - Set backend options that may only be +//TODO/// known at codegen time. //TODOvoid performLateBackendInitialization(void) { //TODO // The Ada front-end sets flag_exceptions only after processing the file. -//TODO ExceptionHandling = flag_exceptions; +//TODO if (USING_SJLJ_EXCEPTIONS) +//TODO SjLjExceptionHandling = flag_exceptions; +//TODO else +//TODO DwarfExceptionHandling = flag_exceptions; //TODO for (Module::iterator I = TheModule->begin(), E = TheModule->end(); //TODO I != E; ++I) //TODO if (!I->isDeclaration()) { @@ -554,7 +565,7 @@ //TODOstatic formatted_raw_ostream *AsmOutRawStream = 0; //TODOoFILEstream *AsmIntermediateOutStream = 0; //TODO -//TODO/// Read bytecode from PCH file. Initialize TheModule and setup +//TODO/// llvm_pch_read - Read bytecode from PCH file. Initialize TheModule and setup //TODO/// LTypes vector. //TODOvoid llvm_pch_read(const unsigned char *Buffer, unsigned Size) { //TODO std::string ModuleName = TheModule->getModuleIdentifier(); @@ -598,7 +609,7 @@ //TODO flag_llvm_pch_read = 1; //TODO} //TODO -//TODO// Initialize PCH writing. +//TODO/// llvm_pch_write_init - Initialize PCH writing. //TODOvoid llvm_pch_write_init(void) { //TODO timevar_push(TV_LLVM_INIT); //TODO AsmOutStream = new oFILEstream(asm_out_file); @@ -805,7 +816,7 @@ //TODO } //TODO} //TODO -//TODO// llvm_asm_file_start - Start the .s file. +//TODO/// llvm_asm_file_start - Start the .s file. //TODOvoid llvm_asm_file_start(void) { //TODO timevar_push(TV_LLVM_INIT); //TODO AsmOutStream = new oFILEstream(asm_out_file); @@ -827,6 +838,7 @@ //TODO sys::Program::ChangeStdoutToBinary(); //TODO //TODO AttributeUsedGlobals.clear(); +//TODO AttributeCompilerUsedGlobals.clear(); //TODO timevar_pop(TV_LLVM_INIT); //TODO} @@ -834,32 +846,33 @@ /// initializer suitable for the llvm.global_[cd]tors globals. static void CreateStructorsList(std::vector > &Tors, const char *Name) { - LLVMContext &Context = getGlobalContext(); - std::vector InitList; std::vector StructInit; StructInit.resize(2); + LLVMContext &Context = getGlobalContext(); + const Type *FPTy = - Context.getFunctionType(Type::VoidTy, std::vector(), false); - FPTy = Context.getPointerTypeUnqual(FPTy); + FunctionType::get(Type::getVoidTy(Context), + std::vector(), false); + FPTy = PointerType::getUnqual(FPTy); for (unsigned i = 0, e = Tors.size(); i != e; ++i) { - StructInit[0] = Context.getConstantInt(Type::Int32Ty, Tors[i].second); + StructInit[0] = ConstantInt::get(Type::getInt32Ty(Context), Tors[i].second); // __attribute__(constructor) can be on a function with any type. Make sure // the pointer is void()*. StructInit[1] = TheFolder->CreateBitCast(Tors[i].first, FPTy); - InitList.push_back(Context.getConstantStruct(StructInit, false)); + InitList.push_back(ConstantStruct::get(Context, StructInit, false)); } - Constant *Array = Context.getConstantArray( - Context.getArrayType(InitList[0]->getType(), InitList.size()), InitList); + Constant *Array = ConstantArray::get( + ArrayType::get(InitList[0]->getType(), InitList.size()), InitList); new GlobalVariable(*TheModule, Array->getType(), false, GlobalValue::AppendingLinkage, Array, Name); } -//TODO// llvm_asm_file_end - Finish the .s file. +//TODO/// llvm_asm_file_end - Finish the .s file. //TODOvoid llvm_asm_file_end(void) { //TODO timevar_push(TV_LLVM_PERFILE); //TODO LLVMContext &Context = getGlobalContext(); @@ -881,26 +894,46 @@ //TODO //TODO if (!AttributeUsedGlobals.empty()) { //TODO std::vector AUGs; -//TODO const Type *SBP= Context.getPointerTypeUnqual(Type::Int8Ty); -//TODO for (SmallSetVector::iterator AI = AttributeUsedGlobals.begin(), +//TODO const Type *SBP= PointerType::getUnqual(Type::getInt8Ty(Context)); +//TODO for (SmallSetVector::iterator +//TODO AI = AttributeUsedGlobals.begin(), //TODO AE = AttributeUsedGlobals.end(); AI != AE; ++AI) { //TODO Constant *C = *AI; //TODO AUGs.push_back(TheFolder->CreateBitCast(C, SBP)); //TODO } //TODO -//TODO ArrayType *AT = Context.getArrayType(SBP, AUGs.size()); -//TODO Constant *Init = Context.getConstantArray(AT, AUGs); +//TODO ArrayType *AT = ArrayType::get(SBP, AUGs.size()); +//TODO Constant *Init = ConstantArray::get(AT, AUGs); //TODO GlobalValue *gv = new GlobalVariable(*TheModule, AT, false, -//TODO GlobalValue::AppendingLinkage, Init, -//TODO "llvm.used"); +//TODO GlobalValue::AppendingLinkage, Init, +//TODO "llvm.used"); //TODO gv->setSection("llvm.metadata"); //TODO AttributeUsedGlobals.clear(); //TODO } //TODO +//TODO if (!AttributeCompilerUsedGlobals.empty()) { +//TODO std::vector ACUGs; +//TODO const Type *SBP= PointerType::getUnqual(Type::getInt8Ty(Context)); +//TODO for (SmallSetVector::iterator +//TODO AI = AttributeCompilerUsedGlobals.begin(), +//TODO AE = AttributeCompilerUsedGlobals.end(); AI != AE; ++AI) { +//TODO Constant *C = *AI; +//TODO ACUGs.push_back(TheFolder->CreateBitCast(C, SBP)); +//TODO } +//TODO +//TODO ArrayType *AT = ArrayType::get(SBP, ACUGs.size()); +//TODO Constant *Init = ConstantArray::get(AT, ACUGs); +//TODO GlobalValue *gv = new GlobalVariable(*TheModule, AT, false, +//TODO GlobalValue::AppendingLinkage, Init, +//TODO "llvm.compiler.used"); +//TODO gv->setSection("llvm.metadata"); +//TODO AttributeCompilerUsedGlobals.clear(); +//TODO } +//TODO //TODO // Add llvm.global.annotations //TODO if (!AttributeAnnotateGlobals.empty()) { -//TODO Constant *Array = Context.getConstantArray( -//TODO Context.getArrayType(AttributeAnnotateGlobals[0]->getType(), +//TODO Constant *Array = ConstantArray::get( +//TODO ArrayType::get(AttributeAnnotateGlobals[0]->getType(), //TODO AttributeAnnotateGlobals.size()), //TODO AttributeAnnotateGlobals); //TODO GlobalValue *gv = new GlobalVariable(*TheModule, Array->getType(), false, @@ -976,8 +1009,8 @@ //TODO llvm_shutdown(); //TODO} //TODO -//TODO// llvm_emit_code_for_current_function - Top level interface for emitting a -//TODO// function to the .s file. +//TODO/// llvm_emit_code_for_current_function - Top level interface for emitting a +//TODO/// function to the .s file. //TODOvoid llvm_emit_code_for_current_function(tree fndecl) { //TODO if (cfun->nonlocal_goto_save_area) //TODO sorry("%Jnon-local gotos not supported by LLVM", fndecl); @@ -1028,7 +1061,7 @@ //TODO timevar_pop(TV_LLVM_FUNCS); //TODO} -// emit_alias_to_llvm - Given decl and target emit alias to target. +/// emit_alias_to_llvm - Given decl and target emit alias to target. void emit_alias_to_llvm(tree decl, tree target, tree target_decl) { if (errorcount || sorrycount) { TREE_ASM_WRITTEN(decl) = 1; @@ -1090,6 +1123,8 @@ // A weak alias has TREE_PUBLIC set but not the other bits. if (false)//FIXME DECL_LLVM_PRIVATE(decl)) Linkage = GlobalValue::PrivateLinkage; + else if (false)//FIXME DECL_LLVM_LINKER_PRIVATE(decl)) + Linkage = GlobalValue::LinkerPrivateLinkage; else if (DECL_WEAK(decl)) // The user may have explicitly asked for weak linkage - ignore flag_odr. Linkage = GlobalValue::WeakAnyLinkage; @@ -1104,7 +1139,7 @@ handleVisibility(decl, GA); if (GA->getType()->canLosslesslyBitCastTo(V->getType())) - V->replaceAllUsesWith(Context.getConstantExprBitCast(GA, V->getType())); + V->replaceAllUsesWith(ConstantExpr::getBitCast(GA, V->getType())); else if (!V->use_empty()) { error ("%J Alias %qD used with invalid type!", decl, decl); //TODO timevar_pop(TV_LLVM_GLOBALS); @@ -1128,10 +1163,11 @@ return; } -// Convert string to global value. Use existing global if possible. +/// ConvertMetadataStringToGV - Convert string to global value. Use existing +/// global if possible. Constant* ConvertMetadataStringToGV(const char *str) { - Constant *Init = getGlobalContext().getConstantArray(std::string(str)); + Constant *Init = ConstantArray::get(getGlobalContext(), std::string(str)); // Use cached string if it exists. static std::map StringCSTCache; @@ -1148,8 +1184,8 @@ } -/// AddAnnotateAttrsToGlobal - Adds decls that have a -/// annotate attribute to a vector to be emitted later. +/// AddAnnotateAttrsToGlobal - Adds decls that have a annotate attribute to a +/// vector to be emitted later. void AddAnnotateAttrsToGlobal(GlobalValue *GV, tree decl) { LLVMContext &Context = getGlobalContext(); @@ -1159,10 +1195,10 @@ return; // Get file and line number - Constant *lineNo = - Context.getConstantInt(Type::Int32Ty, DECL_SOURCE_LINE(decl)); + Constant *lineNo = ConstantInt::get(Type::getInt32Ty(Context), + DECL_SOURCE_LINE(decl)); Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl)); - const Type *SBP= Context.getPointerTypeUnqual(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::getInt8Ty(Context)); file = TheFolder->CreateBitCast(file, SBP); // There may be multiple annotate attributes. Pass return of lookup_attr @@ -1191,7 +1227,7 @@ }; AttributeAnnotateGlobals.push_back( - Context.getConstantStruct(Element, 4, false)); + ConstantStruct::get(Context, Element, 4, false)); } // Get next annotate attribute. @@ -1242,7 +1278,7 @@ handleVisibility(decl, GV); // Temporary to avoid infinite recursion (see comments emit_global_to_llvm) - GV->setInitializer(Context.getUndef(GV->getType()->getElementType())); + GV->setInitializer(UndefValue::get(GV->getType()->getElementType())); // Convert the initializer over. Constant *Init = TreeConstantToLLVM::Convert(DECL_INITIAL(decl)); @@ -1310,7 +1346,7 @@ // This global should be zero initialized. Reconvert the type in case the // forward def of the global and the real def differ in type (e.g. declared // as 'int A[]', and defined as 'int A[100]'). - Init = getGlobalContext().getNullValue(ConvertType(TREE_TYPE(decl))); + Init = Constant::getNullValue(ConvertType(TREE_TYPE(decl))); } else { assert((TREE_CONSTANT(DECL_INITIAL(decl)) || TREE_CODE(DECL_INITIAL(decl)) == STRING_CST) && @@ -1322,7 +1358,7 @@ // on it". When constructing the initializer it might refer to itself. // this can happen for things like void *G = &G; // - GV->setInitializer(Context.getUndef(GV->getType()->getElementType())); + GV->setInitializer(UndefValue::get(GV->getType()->getElementType())); Init = TreeConstantToLLVM::Convert(DECL_INITIAL(decl)); } @@ -1351,10 +1387,14 @@ GV->setThreadLocal(true); // Set the linkage. - GlobalValue::LinkageTypes Linkage = GV->getLinkage(); + GlobalValue::LinkageTypes Linkage; + if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS) && false) {// FIXME DECL_LLVM_PRIVATE(decl)) { Linkage = GlobalValue::PrivateLinkage; + } else if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS) + && false) {//FIXME DECL_LLVM_LINKER_PRIVATE(decl)) { + Linkage = GlobalValue::LinkerPrivateLinkage; } else if (!TREE_PUBLIC(decl)) { Linkage = GlobalValue::InternalLinkage; } else if (DECL_WEAK(decl)) { @@ -1368,6 +1408,8 @@ Linkage = GlobalValue::CommonLinkage; } else if (DECL_COMDAT(decl)) { Linkage = GlobalValue::getLinkOnceLinkage(flag_odr); + } else { + Linkage = GV->getLinkage(); } // Allow loads from constants to be folded even if the constant has weak @@ -1412,8 +1454,12 @@ } // Handle used decls - if (DECL_PRESERVE_P (decl)) - AttributeUsedGlobals.insert(GV); + if (DECL_PRESERVE_P (decl)) { + if (false)//FIXME DECL_LLVM_LINKER_PRIVATE (decl)) + AttributeCompilerUsedGlobals.insert(GV); + else + AttributeUsedGlobals.insert(GV); + } // Add annotate attributes for globals if (DECL_ATTRIBUTES(decl)) @@ -1453,12 +1499,9 @@ int RegNumber = decode_reg_name(extractRegisterName(decl)); const Type *Ty = ConvertType(TREE_TYPE(decl)); - // If this has already been processed, don't emit duplicate error messages. - if (DECL_LLVM_SET_P(decl)) { - // Error state encoded into DECL_LLVM. - return cast(DECL_LLVM(decl))->getZExtValue(); - } - + if (errorcount || sorrycount) + return true; // Do not process broken code. + /* Detect errors in declaring global registers. */ if (RegNumber == -1) error("%Jregister name not specified for %qD", decl, decl); @@ -1479,25 +1522,23 @@ else { if (TREE_THIS_VOLATILE(decl)) warning(0, "volatile register variables don%'t work as you might wish"); - - SET_DECL_LLVM(decl, Context.getFalse()); + return false; // Everything ok. } - SET_DECL_LLVM(decl, Context.getTrue()); + return true; } -// make_decl_llvm - Create the DECL_RTL for a VAR_DECL or FUNCTION_DECL. DECL -// should have static storage duration. In other words, it should not be an -// automatic variable, including PARM_DECLs. -// -// There is, however, one exception: this function handles variables explicitly -// placed in a particular register by the user. -// -// This function corresponds to make_decl_rtl in varasm.c, and is implicitly -// called by DECL_LLVM if a decl doesn't have an LLVM set. -// +/// make_decl_llvm - Create the DECL_RTL for a VAR_DECL or FUNCTION_DECL. DECL +/// should have static storage duration. In other words, it should not be an +/// automatic variable, including PARM_DECLs. +/// +/// There is, however, one exception: this function handles variables explicitly +/// placed in a particular register by the user. +/// +/// This function corresponds to make_decl_rtl in varasm.c, and is implicitly +/// called by DECL_LLVM if a decl doesn't have an LLVM set. void make_decl_llvm(tree decl) { #ifdef ENABLE_CHECKING // Check that we are not being given an automatic variable. @@ -1569,7 +1610,7 @@ // when we have something like __builtin_memset and memset in the same file. Function *FnEntry = TheModule->getFunction(Name); if (FnEntry == 0) { - unsigned CC; + CallingConv::ID CC; AttrListPtr PAL; const FunctionType *Ty = TheTypeConverter->ConvertFunctionType(TREE_TYPE(decl), decl, NULL, @@ -1618,7 +1659,8 @@ // If we have "extern void foo", make the global have type {} instead of // type void. - if (Ty == Type::VoidTy) Ty = Context.getStructType(NULL, NULL); + if (Ty == Type::getVoidTy(Context)) + Ty = StructType::get(Context); if (Name[0] == 0) { // Global has no name. GV = new GlobalVariable(*TheModule, Ty, false, @@ -1718,9 +1760,9 @@ return ""; } -// llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be -// weak, but it already had an llvm object created for it. This marks the LLVM -// object weak as well. +/// llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be +/// weak, but it already had an llvm object created for it. This marks the LLVM +/// object weak as well. void llvm_mark_decl_weak(tree decl) { assert(DECL_LLVM_SET_P(decl) && DECL_WEAK(decl) && isa(DECL_LLVM(decl)) && "Decl isn't marked weak!"); @@ -1747,10 +1789,9 @@ } } -// llvm_emit_ctor_dtor - Called to emit static ctors/dtors to LLVM code. fndecl -// is a 'void()' FUNCTION_DECL for the code, initprio is the init priority, and -// isCtor indicates whether this is a ctor or dtor. -// +/// llvm_emit_ctor_dtor - Called to emit static ctors/dtors to LLVM code. +/// fndecl is a 'void()' FUNCTION_DECL for the code, initprio is the init +/// priority, and isCtor indicates whether this is a ctor or dtor. void llvm_emit_ctor_dtor(tree FnDecl, int InitPrio, int isCtor) { mark_decl_referenced(FnDecl); // Inform cgraph that we used the global. @@ -1765,9 +1806,8 @@ return; } -// llvm_emit_file_scope_asm - Emit the specified string as a file-scope inline -// asm block. -// +/// llvm_emit_file_scope_asm - Emit the specified string as a file-scope inline +/// asm block. void llvm_emit_file_scope_asm(const char *string) { if (TheModule->getModuleInlineAsm().empty()) TheModule->setModuleInlineAsm(string); @@ -1776,18 +1816,16 @@ string); } -//FIXME// print_llvm - Print the specified LLVM chunk like an operand, called by -//FIXME// print-tree.c for tree dumps. -//FIXME// +//FIXME/// print_llvm - Print the specified LLVM chunk like an operand, called by +//FIXME/// print-tree.c for tree dumps. //FIXMEvoid print_llvm(FILE *file, void *LLVM) { //FIXME oFILEstream FS(file); //FIXME FS << "LLVM: "; //FIXME WriteAsOperand(FS, (Value*)LLVM, true, TheModule); //FIXME} //FIXME -//FIXME// print_llvm_type - Print the specified LLVM type symbolically, called by -//FIXME// print-tree.c for tree dumps. -//FIXME// +//FIXME/// print_llvm_type - Print the specified LLVM type symbolically, called by +//FIXME/// print-tree.c for tree dumps. //FIXMEvoid print_llvm_type(FILE *file, void *LLVM) { //FIXME oFILEstream FS(file); //FIXME FS << "LLVM: "; @@ -1799,13 +1837,12 @@ //FIXME WriteTypeSymbolic(RO, (const Type*)LLVM, TheModule); //FIXME} -// Get a register name given its decl. In 4.2 unlike 4.0 these names -// have been run through set_user_assembler_name which means they may -// have a leading \1 at this point; compensate. - +/// extractRegisterName - Get a register name given its decl. In 4.2 unlike 4.0 +/// these names have been run through set_user_assembler_name which means they +/// may have a leading \1 at this point; compensate. const char* extractRegisterName(tree decl) { const char* Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl)); - return (*Name==1) ? Name+1 : Name; + return (*Name == 1) ? Name + 1 : Name; } Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=79452&r1=79451&r2=79452&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Wed Aug 19 14:49:08 2009 @@ -36,7 +36,6 @@ #include "llvm/System/Host.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" @@ -215,7 +214,7 @@ if (DECL_NAME(LabelDecl)) Name = IDENTIFIER_POINTER(DECL_NAME(LabelDecl)); - BasicBlock *NewBB = BasicBlock::Create(Name); + BasicBlock *NewBB = BasicBlock::Create(Context, Name); SET_DECL_LLVM(LabelDecl, NewBB); return NewBB; } @@ -231,7 +230,7 @@ assert(!BYTES_BIG_ENDIAN && "Unsupported case - please report"); // Do byte wise store because actual argument type does not match LLVMTy. assert(isa(ArgVal->getType()) && "Expected an integer value!"); - const Type *StoreType = Context.getIntegerType(RealSize * 8); + const Type *StoreType = IntegerType::get(Context, RealSize * 8); Loc = Builder.CreateBitCast(Loc, StoreType->getPointerTo()); if (ArgVal->getType()->getPrimitiveSizeInBits() >= StoreType->getPrimitiveSizeInBits()) @@ -241,7 +240,7 @@ Builder.CreateStore(ArgVal, Loc); } else { // This cast only involves pointers, therefore BitCast. - Loc = Builder.CreateBitCast(Loc, Context.getPointerTypeUnqual(LLVMTy)); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(LLVMTy)); Builder.CreateStore(ArgVal, Loc); } } @@ -263,13 +262,17 @@ std::vector LocStack; std::vector NameStack; unsigned Offset; + CallingConv::ID &CallingConv; bool isShadowRet; FunctionPrologArgumentConversion(tree FnDecl, Function::arg_iterator &ai, - const LLVMBuilder &B) - : FunctionDecl(FnDecl), AI(ai), Builder(B), Offset(0), + const LLVMBuilder &B, CallingConv::ID &CC) + : FunctionDecl(FnDecl), AI(ai), Builder(B), Offset(0), CallingConv(CC), isShadowRet(false) {} + /// getCallingConv - This provides the desired CallingConv for the function. + CallingConv::ID& getCallingConv(void) { return CallingConv; } + bool isShadowReturn() { return isShadowRet; } @@ -337,7 +340,7 @@ // If this is GCC being sloppy about pointer types, insert a bitcast. // See PR1083 for an example. ArgVal = Builder.CreateBitCast(ArgVal, LLVMTy); - } else if (ArgVal->getType() == Type::DoubleTy) { + } else if (ArgVal->getType() == Type::getDoubleTy(Context)) { // If this is a K&R float parameter, it got promoted to double. Insert // the truncation to float now. ArgVal = Builder.CreateFPTrunc(ArgVal, LLVMTy, @@ -346,7 +349,8 @@ // If this is just a mismatch between integer types, this is due // to K&R prototypes, where the forward proto defines the arg as int // and the actual impls is a short or char. - assert(ArgVal->getType() == Type::Int32Ty && LLVMTy->isInteger() && + assert(ArgVal->getType() == Type::getInt32Ty(Context) && + LLVMTy->isInteger() && "Lowerings don't match?"); ArgVal = Builder.CreateTrunc(ArgVal, LLVMTy,NameStack.back().c_str()); } @@ -381,7 +385,7 @@ Value *Loc = LocStack.back(); // This cast only involves pointers, therefore BitCast. - Loc = Builder.CreateBitCast(Loc, Context.getPointerTypeUnqual(StructTy)); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(StructTy)); Loc = Builder.CreateStructGEP(Loc, FieldNo); LocStack.push_back(Loc); @@ -397,13 +401,14 @@ // passed in memory byval. static bool isPassedByVal(tree type, const Type *Ty, std::vector &ScalarArgs, - bool isShadowRet) { + bool isShadowRet, CallingConv::ID &CC) { if (LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(type, Ty)) return true; std::vector Args; - if (LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(type, Ty, Args) && - LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(Args, ScalarArgs, isShadowRet)) + if (LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(type, Ty, CC, Args) && + LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(Args, ScalarArgs, isShadowRet, + CC)) // We want to pass the whole aggregate in registers but only some of the // registers are available. return true; @@ -419,7 +424,7 @@ // Determine the FunctionType and calling convention for this function. tree static_chain = cfun->static_chain_decl; const FunctionType *FTy; - unsigned CallingConv; + CallingConv::ID CallingConv; AttrListPtr PAL; // If the function has no arguments and is varargs (...), turn it into a @@ -445,7 +450,7 @@ if (DECL_LLVM_SET_P(FnDecl) && cast(DECL_LLVM(FnDecl)->getType())->getElementType() == FTy){ Fn = cast(DECL_LLVM(FnDecl)); - assert(Fn->getCallingConv() == CallingConv && + assert(Fn->getCallingConv() == static_cast(CallingConv) && "Calling convention disagreement between prototype and impl!"); // The visibility can be changed from the last time we've seen this // function. Set to current. @@ -457,7 +462,7 @@ assert(FnEntry->isDeclaration() && "Multiple fns with same name and neither are external!"); FnEntry->setName(""); // Clear name to avoid conflicts. - assert(FnEntry->getCallingConv() == CallingConv && + assert(FnEntry->getCallingConv() == static_cast(CallingConv) && "Calling convention disagreement between prototype and impl!"); } @@ -486,6 +491,8 @@ // Compute the linkage that the function should get. if (false) {//FIXME DECL_LLVM_PRIVATE(FnDecl)) { Fn->setLinkage(Function::PrivateLinkage); + } else if (false) {//FIXME DECL_LLVM_LINKER_PRIVATE(FnDecl)) { + Fn->setLinkage(Function::LinkerPrivateLinkage); } else if (!TREE_PUBLIC(FnDecl) /*|| lang_hooks.llvm_is_in_anon(subr)*/) { Fn->setLinkage(Function::InternalLinkage); } else if (DECL_COMDAT(FnDecl)) { @@ -544,7 +551,7 @@ Fn->setDoesNotThrow(); // Create a new basic block for the function. - Builder.SetInsertPoint(BasicBlock::Create("entry", Fn)); + Builder.SetInsertPoint(BasicBlock::Create(Context, "entry", Fn)); if (TheDebugInfo) TheDebugInfo->EmitFunctionStart(FnDecl, Fn, Builder.GetInsertBlock()); @@ -555,7 +562,7 @@ Function::arg_iterator AI = Fn->arg_begin(); // Rename and alloca'ify real arguments. - FunctionPrologArgumentConversion Client(FnDecl, AI, Builder); + FunctionPrologArgumentConversion Client(FnDecl, AI, Builder, CallingConv); TheLLVMABI ABIConverter(Client); // Handle the DECL_RESULT. @@ -576,11 +583,11 @@ const Type *ArgTy = ConvertType(TREE_TYPE(Args)); bool isInvRef = isPassedByInvisibleReference(TREE_TYPE(Args)); if (isInvRef || - (ArgTy->getTypeID()==Type::VectorTyID && + (isa(ArgTy) && LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(TREE_TYPE(Args))) || (!ArgTy->isSingleValueType() && isPassedByVal(TREE_TYPE(Args), ArgTy, ScalarArgs, - Client.isShadowReturn()))) { + Client.isShadowReturn(), CallingConv))) { // If the value is passed by 'invisible reference' or 'byval reference', // the l-value for the argument IS the argument itself. AI->setName(Name); @@ -638,19 +645,19 @@ //TODO if (!DECL_LLVM_SET_P(TREE_VALUE(t))) //TODO EmitAutomaticVariableDecl(TREE_VALUE(t)); //TODO } - + // Create a new block for the return node, but don't insert it yet. - ReturnBB = BasicBlock::Create("return"); + ReturnBB = BasicBlock::Create(Context, "return"); } Function *TreeToLLVM::FinishFunctionBody() { // Insert the return block at the end of the function. EmitBlock(ReturnBB); - + SmallVector RetVals; // If the function returns a value, get it into a register and return it now. - if (Fn->getReturnType() != Type::VoidTy) { + if (Fn->getReturnType() != Type::getVoidTy(Context)) { if (!isAggregateTreeType(TREE_TYPE(DECL_RESULT(FnDecl)))) { // If the DECL_RESULT is a scalar type, just load out the return value // and return it. @@ -664,12 +671,12 @@ } else { Value *RetVal = DECL_LLVM(DECL_RESULT(FnDecl)); if (const StructType *STy = dyn_cast(Fn->getReturnType())) { - Value *R1 = BitCastToType(RetVal, Context.getPointerTypeUnqual(STy)); + Value *R1 = BitCastToType(RetVal, PointerType::getUnqual(STy)); llvm::Value *Idxs[2]; - Idxs[0] = Context.getConstantInt(llvm::Type::Int32Ty, 0); + Idxs[0] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); for (unsigned ri = 0; ri < STy->getNumElements(); ++ri) { - Idxs[1] = Context.getConstantInt(llvm::Type::Int32Ty, ri); + Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), ri); Value *GEP = Builder.CreateGEP(R1, Idxs, Idxs+2, "mrv_gep"); Value *E = Builder.CreateLoad(GEP, "mrv"); RetVals.push_back(E); @@ -682,12 +689,12 @@ // beginning of the aggregate (x86-64). if (ReturnOffset) { RetVal = BitCastToType(RetVal, - Context.getPointerTypeUnqual(Type::Int8Ty)); + PointerType::getUnqual(Type::getInt8Ty(Context))); RetVal = Builder.CreateGEP(RetVal, - Context.getConstantInt(TD.getIntPtrType(), ReturnOffset)); + ConstantInt::get(TD.getIntPtrType(Context), ReturnOffset)); } RetVal = BitCastToType(RetVal, - Context.getPointerTypeUnqual(Fn->getReturnType())); + PointerType::getUnqual(Fn->getReturnType())); RetVal = Builder.CreateLoad(RetVal, "retval"); RetVals.push_back(RetVal); } @@ -714,7 +721,7 @@ // block. if (IndirectGotoBlock) { EmitBlock(IndirectGotoBlock); - + // Change the default destination to go to one of the other destinations, if // there is any other dest. SwitchInst *SI = cast(IndirectGotoBlock->getTerminator()); @@ -777,7 +784,7 @@ break; if (e && e->dest != bb->next_bb) { Builder.CreateBr(getLabelDeclBlock(gimple_block_label (e->dest))); - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); } } @@ -983,6 +990,10 @@ // result is not used then GCC sometimes sets the tree type to VOID_TYPE, so // don't take VOID_TYPE too seriously here. assert((Result == 0 || VOID_TYPE_P(TREE_TYPE(exp)) || + // FIXME: The vector stuff isn't straight-forward. Sometimes X86 can + // pass it back as a scalar value. Disable checking if it's a + // vector. This should be made better, though. + isa(ConvertType(TREE_TYPE(exp))) || Result->getType() == ConvertType(TREE_TYPE(exp))) && "Value has wrong type!"); return Result; @@ -1090,11 +1101,11 @@ // Handle 'trunc (zext i1 X to T2) to i1' as X, because this occurs all over // the place. if (ZExtInst *CI = dyn_cast(V)) - if (Ty == Type::Int1Ty && CI->getOperand(0)->getType() == Type::Int1Ty) + if (Ty == Type::getInt1Ty(Context) && CI->getOperand(0)->getType() == Type::getInt1Ty(Context)) return CI->getOperand(0); return Builder.CreateCast(Instruction::CastOps(opcode), V, Ty, - V->getNameStart()); + V->getName().data()); } /// CastToAnyType - Cast the specified value to the specified type making no @@ -1174,8 +1185,8 @@ // it is dead. This allows us to insert allocas in order without having to // scan for an insertion point. Use BitCast for int -> int AllocaInsertionPoint = CastInst::Create(Instruction::BitCast, - Context.getNullValue(Type::Int32Ty), - Type::Int32Ty, "alloca point"); + Constant::getNullValue(Type::getInt32Ty(Context)), + Type::getInt32Ty(Context), "alloca point"); // Insert it as the first instruction in the entry block. Fn->begin()->getInstList().insert(Fn->begin()->begin(), AllocaInsertionPoint); @@ -1324,9 +1335,9 @@ // Don't copy tons of tiny elements. CountAggregateElements(LLVMTy) <= 8) { DestLoc.Ptr = BitCastToType(DestLoc.Ptr, - Context.getPointerTypeUnqual(LLVMTy)); + PointerType::getUnqual(LLVMTy)); SrcLoc.Ptr = BitCastToType(SrcLoc.Ptr, - Context.getPointerTypeUnqual(LLVMTy)); + PointerType::getUnqual(LLVMTy)); CopyAggregate(DestLoc, SrcLoc, Builder, type); return; } @@ -1343,7 +1354,7 @@ const Type *ElTy = cast(DestLoc.Ptr->getType())->getElementType(); if (ElTy->isSingleValueType()) { - StoreInst *St = Builder.CreateStore(Context.getNullValue(ElTy), + StoreInst *St = Builder.CreateStore(Constant::getNullValue(ElTy), DestLoc.Ptr, DestLoc.Volatile); St->setAlignment(DestLoc.getAlignment()); } else if (const StructType *STy = dyn_cast(ElTy)) { @@ -1379,25 +1390,25 @@ // Don't zero tons of tiny elements. CountAggregateElements(LLVMTy) <= 8) { DestLoc.Ptr = BitCastToType(DestLoc.Ptr, - Context.getPointerTypeUnqual(LLVMTy)); + PointerType::getUnqual(LLVMTy)); ZeroAggregate(DestLoc, Builder); return; } } - EmitMemSet(DestLoc.Ptr, Context.getConstantInt(Type::Int8Ty, 0), + EmitMemSet(DestLoc.Ptr, ConstantInt::get(Type::getInt8Ty(Context), 0), Emit(TYPE_SIZE_UNIT(type), 0), DestLoc.getAlignment()); } Value *TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align) { - const Type *SBP = Context.getPointerTypeUnqual(Type::Int8Ty); - const Type *IntPtr = TD.getIntPtrType(); + const Type *SBP = PointerType::getUnqual(Type::getInt8Ty(Context)); + const Type *IntPtr = TD.getIntPtrType(Context); Value *Ops[4] = { BitCastToType(DestPtr, SBP), BitCastToType(SrcPtr, SBP), CastToSIntType(Size, IntPtr), - Context.getConstantInt(Type::Int32Ty, Align) + ConstantInt::get(Type::getInt32Ty(Context), Align) }; Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memcpy, @@ -1407,13 +1418,13 @@ Value *TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align) { - const Type *SBP = Context.getPointerTypeUnqual(Type::Int8Ty); - const Type *IntPtr = TD.getIntPtrType(); + const Type *SBP = PointerType::getUnqual(Type::getInt8Ty(Context)); + const Type *IntPtr = TD.getIntPtrType(Context); Value *Ops[4] = { BitCastToType(DestPtr, SBP), BitCastToType(SrcPtr, SBP), CastToSIntType(Size, IntPtr), - Context.getConstantInt(Type::Int32Ty, Align) + ConstantInt::get(Type::getInt32Ty(Context), Align) }; Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memmove, @@ -1423,13 +1434,13 @@ Value *TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align) { - const Type *SBP = Context.getPointerTypeUnqual(Type::Int8Ty); - const Type *IntPtr = TD.getIntPtrType(); + const Type *SBP = PointerType::getUnqual(Type::getInt8Ty(Context)); + const Type *IntPtr = TD.getIntPtrType(Context); Value *Ops[4] = { BitCastToType(DestPtr, SBP), - CastToSIntType(SrcVal, Type::Int8Ty), + CastToSIntType(SrcVal, Type::getInt8Ty(Context)), CastToSIntType(Size, IntPtr), - Context.getConstantInt(Type::Int32Ty, Align) + ConstantInt::get(Type::getInt32Ty(Context), Align) }; Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memset, @@ -1448,12 +1459,12 @@ // The idea is that it's a pointer to type "Value" // which is opaque* but the routine expects i8** and i8*. - const PointerType *Ty = Context.getPointerTypeUnqual(Type::Int8Ty); - V = Builder.CreateBitCast(V, Context.getPointerTypeUnqual(Ty)); + const PointerType *Ty = PointerType::getUnqual(Type::getInt8Ty(Context)); + V = Builder.CreateBitCast(V, PointerType::getUnqual(Ty)); Value *Ops[2] = { V, - Context.getConstantPointerNull(Ty) + ConstantPointerNull::get(Ty) }; Builder.CreateCall(gcrootFun, Ops, Ops+2); @@ -1473,9 +1484,9 @@ // Get file and line number Constant *lineNo = - Context.getConstantInt(Type::Int32Ty, DECL_SOURCE_LINE(decl)); + ConstantInt::get(Type::getInt32Ty(Context), DECL_SOURCE_LINE(decl)); Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl)); - const Type *SBP= Context.getPointerTypeUnqual(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::getInt8Ty(Context)); file = Builder.getFolder().CreateBitCast(file, SBP); // There may be multiple annotate attributes. Pass return of lookup_attr @@ -1495,7 +1506,7 @@ // Assert its a string, and then get that string. assert(TREE_CODE(val) == STRING_CST && "Annotate attribute arg should always be a string"); - const Type *SBP = Context.getPointerTypeUnqual(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::getInt8Ty(Context)); Constant *strGV = TreeConstantToLLVM::EmitLV_STRING_CST(val); Value *Ops[4] = { BitCastToType(V, SBP), @@ -1585,9 +1596,9 @@ } else { // Compute the variable's size in bytes. Size = Emit(DECL_SIZE_UNIT(decl), 0); - Ty = Type::Int8Ty; + Ty = Type::getInt8Ty(Context); } - Size = CastToUIntType(Size, Type::Int32Ty); + Size = CastToUIntType(Size, Type::getInt32Ty(Context)); } unsigned Alignment = 0; // Alignment in bytes. @@ -1634,7 +1645,7 @@ // before initialization doesn't get garbage results to follow. const Type *T = cast(AI->getType())->getElementType(); EmitTypeGcroot(AI, decl); - Builder.CreateStore(Context.getNullValue(T), AI); + Builder.CreateStore(Constant::getNullValue(T), AI); } if (TheDebugInfo) { @@ -1663,7 +1674,7 @@ // Assign the new ID, update AddressTakenBBNumbers to remember it. uint64_t BlockNo = ++NumAddressTakenBlocks; BlockNo &= ~0ULL >> (64-TD.getPointerSizeInBits()); - Val = Context.getConstantInt(TD.getIntPtrType(), BlockNo); + Val = ConstantInt::get(TD.getIntPtrType(Context), BlockNo); // Add it to the switch statement in the indirect goto block. cast(getIndirectGotoBlock()->getTerminator())->addCase(Val, BB); @@ -1676,10 +1687,10 @@ if (IndirectGotoBlock) return IndirectGotoBlock; // Create a temporary for the value to be switched on. - IndirectGotoValue = CreateTemporary(TD.getIntPtrType()); + IndirectGotoValue = CreateTemporary(TD.getIntPtrType(Context)); // Create the block, emit a load, and emit the switch in the block. - IndirectGotoBlock = BasicBlock::Create("indirectgoto"); + IndirectGotoBlock = BasicBlock::Create(Context, "indirectgoto"); Value *Ld = new LoadInst(IndirectGotoValue, "gotodest", IndirectGotoBlock); SwitchInst::Create(Ld, IndirectGotoBlock, 0, IndirectGotoBlock); @@ -1710,7 +1721,7 @@ // Store the destination block to the GotoValue alloca. Value *V = Emit(TREE_OPERAND(exp, 0), 0); - V = CastToType(Instruction::PtrToInt, V, TD.getIntPtrType()); + V = CastToType(Instruction::PtrToInt, V, TD.getIntPtrType(Context)); Builder.CreateStore(V, IndirectGotoValue); // NOTE: This is HORRIBLY INCORRECT in the presence of exception handlers. @@ -1719,7 +1730,7 @@ // Builder.CreateBr(DestBB); } - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); return 0; } @@ -1740,7 +1751,7 @@ // Emit a branch to the exit label. Builder.CreateBr(ReturnBB); - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); return 0; } @@ -1797,11 +1808,11 @@ if (FPPred == ~0U) { Cond = Emit(exp_cond, 0); // Comparison against zero to convert the result to i1. - if (Cond->getType() != Type::Int1Ty) + if (Cond->getType() != Type::getInt1Ty(Context)) Cond = Builder.CreateIsNotNull(Cond, "toBool"); } else { - Cond = EmitCompare(exp_cond, UIPred, SIPred, FPPred, Type::Int1Ty); - assert(Cond->getType() == Type::Int1Ty); + Cond = EmitCompare(exp_cond, UIPred, SIPred, FPPred, Type::getInt1Ty(Context)); + assert(Cond->getType() == Type::getInt1Ty(Context)); } tree Then = COND_EXPR_THEN(exp); @@ -1812,7 +1823,7 @@ BasicBlock *ThenDest = getLabelDeclBlock(TREE_OPERAND(Then, 0)); BasicBlock *ElseDest = getLabelDeclBlock(TREE_OPERAND(Else, 0)); Builder.CreateCondBr(Cond, ThenDest, ElseDest); - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); return 0; } @@ -1826,7 +1837,7 @@ // Emit the switch instruction. SwitchInst *SI = Builder.CreateSwitch(SwitchExp, Builder.GetInsertBlock(), TREE_VEC_LENGTH(Cases)); - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); // Default location starts out as fall-through SI->setSuccessor(0, Builder.GetInsertBlock()); @@ -1869,13 +1880,14 @@ SI->addCase(LowC, Dest); if (LowC == HighC) break; // Emitted the last one. CurrentValue++; - LowC = Context.getConstantInt(CurrentValue); + LowC = ConstantInt::get(Context, CurrentValue); } } else { // The range is too big to add to the switch - emit an "if". Value *Diff = Builder.CreateSub(SwitchExp, LowC); - Value *Cond = Builder.CreateICmpULE(Diff, Context.getConstantInt(Range)); - BasicBlock *False_Block = BasicBlock::Create("case_false"); + Value *Cond = Builder.CreateICmpULE(Diff, + ConstantInt::get(Context, Range)); + BasicBlock *False_Block = BasicBlock::Create(Context, "case_false"); Builder.CreateCondBr(Cond, Dest, False_Block); EmitBlock(False_Block); } @@ -1887,7 +1899,7 @@ else { Builder.CreateBr(DefaultDest); // Emit a "fallthrough" block, which is almost certainly dead. - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); } } @@ -1900,9 +1912,9 @@ // Check to see if the exception values have been constructed. if (ExceptionValue) return; - const Type *IntPtr = TD.getIntPtrType(); + const Type *IntPtr = TD.getIntPtrType(Context); - ExceptionValue = CreateTemporary(Context.getPointerTypeUnqual(Type::Int8Ty)); + ExceptionValue = CreateTemporary(PointerType::getUnqual(Type::getInt8Ty(Context))); ExceptionValue->setName("eh_exception"); ExceptionSelectorValue = CreateTemporary(IntPtr); @@ -1911,11 +1923,11 @@ FuncEHException = Intrinsic::getDeclaration(TheModule, Intrinsic::eh_exception); FuncEHSelector = Intrinsic::getDeclaration(TheModule, - (IntPtr == Type::Int32Ty ? + (IntPtr == Type::getInt32Ty(Context) ? Intrinsic::eh_selector_i32 : Intrinsic::eh_selector_i64)); FuncEHGetTypeID = Intrinsic::getDeclaration(TheModule, - (IntPtr == Type::Int32Ty ? + (IntPtr == Type::getInt32Ty(Context) ? Intrinsic::eh_typeid_for_i32 : Intrinsic::eh_typeid_for_i64)); } @@ -1927,7 +1939,7 @@ BasicBlock *&PostPad = PostPads[RegionNo]; if (!PostPad) - PostPad = BasicBlock::Create("ppad"); + PostPad = BasicBlock::Create(Context, "ppad"); return PostPad; } @@ -1965,7 +1977,7 @@ //FIXME assert(llvm_eh_personality_libfunc //FIXME && "no exception handling personality function!"); //FIXME Args.push_back(BitCastToType(DECL_LLVM(llvm_eh_personality_libfunc), -//FIXME Context.getPointerTypeUnqual(Type::Int8Ty))); +//FIXME PointerType::getUnqual(Type::getInt8Ty(Context)))); // Add selections for each handler. foreach_reachable_handler(i, false, false, AddHandler, &Handlers); @@ -1984,7 +1996,7 @@ //FIXME tree TypeList = get_eh_type_list(region); //FIXME unsigned Length = list_length(TypeList); //FIXME Args.reserve(Args.size() + Length + 1); -//FIXME Args.push_back(Context.getConstantInt(Type::Int32Ty, Length + 1)); +//FIXME Args.push_back(ConstantInt::get(Type::getInt32Ty, Length + 1)); //FIXME //FIXME // Add the type infos. //FIXME for (; TypeList; TypeList = TREE_CHAIN(TypeList)) { @@ -1998,7 +2010,7 @@ //FIXME if (!TypeList) { //FIXME // Catch-all - push a null pointer. //FIXME Args.push_back( -//FIXME Context.getNullValue(Context.getPointerTypeUnqual(Type::Int8Ty)) +//FIXME Constant::getNullValue(PointerType::getUnqual(Type::getInt8Ty(Context))) //FIXME ); //FIXME } else { //FIXME // Add the type infos. @@ -2016,29 +2028,28 @@ // what exception is being unwound, append a catch-all. // The representation of a catch-all is language specific. - Value *Catch_All; + Value *CatchAll; abort();//FIXME -//FIXME if (!lang_eh_catch_all) { +//FIXME if (USING_SJLJ_EXCEPTIONS || !lang_eh_catch_all) { //FIXME // Use a "cleanup" - this should be good enough for most languages. -//FIXME Catch_All = Context.getConstantInt(Type::Int32Ty, 0); +//FIXME CatchAll = ConstantInt::get(Type::getInt32Ty, 0); //FIXME } else { //FIXME tree catch_all_type = lang_eh_catch_all(); //FIXME if (catch_all_type == NULL_TREE) //FIXME // Use a C++ style null catch-all object. -//FIXME Catch_All = Context.getNullValue( -//FIXME Context.getPointerTypeUnqual(Type::Int8Ty)); +//FIXME CatchAll = Constant::getNullValue( +//FIXME PointerType::getUnqual(Type::getInt8Ty(Context))); //FIXME else //FIXME // This language has a type that catches all others. -//FIXME Catch_All = Emit(catch_all_type, 0); +//FIXME CatchAll = Emit(catch_all_type, 0); //FIXME } - Args.push_back(Catch_All); + Args.push_back(CatchAll); } // Emit the selector call. Value *Select = Builder.CreateCall(FuncEHSelector, Args.begin(), Args.end(), "eh_select"); Builder.CreateStore(Select, ExceptionSelectorValue); - // Branch to the post landing pad for the first reachable handler. assert(!Handlers.empty() && "Landing pad but no handler?"); Builder.CreateBr(getPostPad(get_eh_region_number(*Handlers.begin()))); @@ -2077,11 +2088,11 @@ //FIXME Value *Select = Builder.CreateLoad(ExceptionSelectorValue); //FIXME //FIXME // Compare with the filter action value. -//FIXME Value *Zero = Context.getConstantInt(Select->getType(), 0); +//FIXME Value *Zero = ConstantInt::get(Select->getType(), 0); //FIXME Value *Compare = Builder.CreateICmpSLT(Select, Zero); //FIXME //FIXME // Branch on the compare. -//FIXME BasicBlock *NoFilterBB = BasicBlock::Create("nofilter"); +//FIXME BasicBlock *NoFilterBB = BasicBlock::Create(Context, "nofilter"); //FIXME Builder.CreateCondBr(Compare, Dest, NoFilterBB); //FIXME EmitBlock(NoFilterBB); //FIXME } else if (RegionKind > 0) { @@ -2092,7 +2103,7 @@ //FIXME for (; TypeList; TypeList = TREE_CHAIN (TypeList)) { //FIXME Value *TType = Emit(lookup_type_for_runtime(TREE_VALUE(TypeList)), 0); //FIXME TType = BitCastToType(TType, -//FIXME Context.getPointerTypeUnqual(Type::Int8Ty)); +//FIXME PointerType::getUnqual(Type::getInt8Ty(Context))); //FIXME //FIXME // Call get eh type id. //FIXME Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, TType, "eh_typeid"); @@ -2126,7 +2137,7 @@ //FIXME } //FIXME //FIXME // If there is no such catch, execute a RESX if the comparison fails. -//FIXME NoCatchBB = BasicBlock::Create("nocatch"); +//FIXME NoCatchBB = BasicBlock::Create(Context, "nocatch"); //FIXME // Branch on the compare. //FIXME Builder.CreateCondBr(Cond, Dest, NoCatchBB); //FIXME EmitBlock(NoCatchBB); @@ -2155,7 +2166,7 @@ "Must-not-throw region handled by runtime?"); // Unwinding continues in the caller. if (!UnwindBB) - UnwindBB = BasicBlock::Create("Unwind"); + UnwindBB = BasicBlock::Create(Context, "Unwind"); Builder.CreateBr(UnwindBB); } @@ -2238,7 +2249,7 @@ if (!LV.isBitfield()) { if (!DestLoc) { // Scalar value: emit a load. - Value *Ptr = BitCastToType(LV.Ptr, Context.getPointerTypeUnqual(Ty)); + Value *Ptr = BitCastToType(LV.Ptr, PointerType::getUnqual(Ty)); LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile); LI->setAlignment(Alignment); return LI; @@ -2250,7 +2261,7 @@ } else { // This is a bitfield reference. if (!LV.BitSize) - return Context.getNullValue(Ty); + return Constant::getNullValue(Ty); const Type *ValTy = cast(LV.Ptr->getType())->getElementType(); unsigned ValSizeInBits = ValTy->getPrimitiveSizeInBits(); @@ -2276,7 +2287,7 @@ Value *Ptr = Index ? Builder.CreateGEP(LV.Ptr, - Context.getConstantInt(Type::Int32Ty, Index)) : + ConstantInt::get(Type::getInt32Ty(Context), Index)) : LV.Ptr; LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile); LI->setAlignment(Alignment); @@ -2293,7 +2304,7 @@ // expression. if (FirstBitInVal+BitsInVal != ValSizeInBits) { - Value *ShAmt = Context.getConstantInt(ValTy, ValSizeInBits - + Value *ShAmt = ConstantInt::get(ValTy, ValSizeInBits - (FirstBitInVal+BitsInVal)); Val = Builder.CreateShl(Val, ShAmt); } @@ -2301,13 +2312,13 @@ // Shift right required? if (ValSizeInBits != BitsInVal) { bool AddSignBits = !TYPE_UNSIGNED(TREE_TYPE(exp)) && !Result; - Value *ShAmt = Context.getConstantInt(ValTy, ValSizeInBits-BitsInVal); + Value *ShAmt = ConstantInt::get(ValTy, ValSizeInBits-BitsInVal); Val = AddSignBits ? Builder.CreateAShr(Val, ShAmt) : Builder.CreateLShr(Val, ShAmt); } if (Result) { - Value *ShAmt = Context.getConstantInt(ValTy, BitsInVal); + Value *ShAmt = ConstantInt::get(ValTy, BitsInVal); Result = Builder.CreateShl(Result, ShAmt); Result = Builder.CreateOr(Result, Val); } else { @@ -2355,7 +2366,7 @@ TREE_CODE(TREE_TYPE (TREE_OPERAND (exp, 0))) == REFERENCE_TYPE) && "Not calling a function pointer?"); tree function_type = TREE_TYPE(TREE_TYPE (TREE_OPERAND (exp, 0))); - unsigned CallingConv; + CallingConv::ID CallingConv; AttrListPtr PAL; const Type *Ty = TheTypeConverter->ConvertFunctionType(function_type, @@ -2366,7 +2377,7 @@ // If this is a direct call to a function using a static chain then we need // to ensure the function type is the one just calculated: it has an extra // parameter for the chain. - Callee = BitCastToType(Callee, Context.getPointerTypeUnqual(Ty)); + Callee = BitCastToType(Callee, PointerType::getUnqual(Ty)); // EmitCall(exp, DestLoc); Value *Result = EmitCallOf(Callee, exp, DestLoc, PAL); @@ -2377,7 +2388,7 @@ // if (fndecl && TREE_THIS_VOLATILE(fndecl)) { Builder.CreateUnreachable(); - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); } return Result; } @@ -2388,12 +2399,12 @@ unsigned RealSize, LLVMBuilder &Builder) { if (!RealSize) - return Context.getUndef(LLVMTy); + return UndefValue::get(LLVMTy); // Not clear what this is supposed to do on big endian machines... assert(!BYTES_BIG_ENDIAN && "Unsupported case - please report"); assert(isa(LLVMTy) && "Expected an integer value!"); - const Type *LoadType = Context.getIntegerType(RealSize * 8); + const Type *LoadType = IntegerType::get(Context, RealSize * 8); L = Builder.CreateBitCast(L, LoadType->getPointerTo()); Value *Val = Builder.CreateLoad(L); if (LoadType->getPrimitiveSizeInBits() >= LLVMTy->getPrimitiveSizeInBits()) @@ -2421,6 +2432,7 @@ LLVMBuilder &Builder; Value *TheValue; MemRef RetBuf; + CallingConv::ID &CallingConv; bool isShadowRet; bool isAggrRet; unsigned Offset; @@ -2429,10 +2441,14 @@ const FunctionType *FnTy, const MemRef *destloc, bool ReturnSlotOpt, - LLVMBuilder &b) + LLVMBuilder &b, + CallingConv::ID &CC) : CallOperands(ops), FTy(FnTy), DestLoc(destloc), - useReturnSlot(ReturnSlotOpt), Builder(b), isShadowRet(false), - isAggrRet(false), Offset(0) { } + useReturnSlot(ReturnSlotOpt), Builder(b), CallingConv(CC), + isShadowRet(false), isAggrRet(false), Offset(0) { } + + /// getCallingConv - This provides the desired CallingConv for the function. + CallingConv::ID& getCallingConv(void) { return CallingConv; } // Push the address of an argument. void pushAddress(Value *Loc) { @@ -2466,7 +2482,7 @@ Value *Loc = LocStack.back(); if (Loc) { // An address. Convert to the right type and load the value out. - Loc = Builder.CreateBitCast(Loc, Context.getPointerTypeUnqual(Ty)); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(Ty)); return Builder.CreateLoad(Loc, "val"); } else { // A value - just return it. @@ -2609,7 +2625,7 @@ /// reference with an additional parameter attribute "ByVal". void HandleByValArgument(const llvm::Type *LLVMTy, tree type) { Value *Loc = getAddress(); - assert(Context.getPointerTypeUnqual(LLVMTy) == Loc->getType()); + assert(PointerType::getUnqual(LLVMTy) == Loc->getType()); CallOperands.push_back(Loc); } @@ -2617,7 +2633,7 @@ /// argument is passed as a first class aggregate. void HandleFCAArgument(const llvm::Type *LLVMTy, tree type) { Value *Loc = getAddress(); - assert(Context.getPointerTypeUnqual(LLVMTy) == Loc->getType()); + assert(PointerType::getUnqual(LLVMTy) == Loc->getType()); CallOperands.push_back(Builder.CreateLoad(Loc)); } @@ -2626,7 +2642,7 @@ /// LLVM Struct, StructTy is the LLVM type of the struct we are entering. void EnterField(unsigned FieldNo, const llvm::Type *StructTy) { Value *Loc = getAddress(); - Loc = Builder.CreateBitCast(Loc, Context.getPointerTypeUnqual(StructTy)); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(StructTy)); pushAddress(Builder.CreateStructGEP(Loc, FieldNo, "elt")); } void ExitField() { @@ -2667,7 +2683,7 @@ // Create a landing pad if one didn't exist already. if (!ThisPad) - ThisPad = BasicBlock::Create("lpad"); + ThisPad = BasicBlock::Create(Context, "lpad"); LandingPad = ThisPad; } else { @@ -2692,7 +2708,7 @@ const FunctionType *FTy = cast(PFTy->getElementType()); FunctionCallArgumentConversion Client(CallOperands, FTy, DestLoc, CALL_EXPR_RETURN_SLOT_OPT(exp), - Builder); + Builder, CallingConvention); TheLLVMABI ABIConverter(Client); // Handle the result, including struct returns. @@ -2771,7 +2787,7 @@ cast(Call)->setCallingConv(CallingConvention); cast(Call)->setAttributes(PAL); } else { - BasicBlock *NextBlock = BasicBlock::Create("invcont"); + BasicBlock *NextBlock = BasicBlock::Create(Context, "invcont"); Call = Builder.CreateInvoke(Callee, NextBlock, LandingPad, CallOperands.begin(), CallOperands.end()); cast(Call)->setCallingConv(CallingConvention); @@ -2782,12 +2798,12 @@ if (Client.isShadowReturn()) return Client.EmitShadowResult(TREE_TYPE(exp), DestLoc); - if (Call->getType() == Type::VoidTy) + if (Call->getType() == Type::getVoidTy(Context)) return 0; if (Client.isAggrReturn()) { Value *Dest = BitCastToType(DestLoc->Ptr, - Context.getPointerTypeUnqual(Call->getType())); + PointerType::getUnqual(Call->getType())); LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Call,Dest,DestLoc->Volatile,Builder); return 0; } @@ -2803,11 +2819,11 @@ Value *Ptr = DestLoc->Ptr; if (Client.Offset) { - Ptr = BitCastToType(Ptr, Context.getPointerTypeUnqual(Type::Int8Ty)); + Ptr = BitCastToType(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context))); Ptr = Builder.CreateGEP(Ptr, - Context.getConstantInt(TD.getIntPtrType(), Client.Offset)); + ConstantInt::get(TD.getIntPtrType(Context), Client.Offset)); } - Ptr = BitCastToType(Ptr, Context.getPointerTypeUnqual(Call->getType())); + Ptr = BitCastToType(Ptr, PointerType::getUnqual(Call->getType())); StoreInst *St = Builder.CreateStore(Call, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->getAlignment()); return 0; @@ -2901,7 +2917,7 @@ // defined - ensure it can be uniquely identified by not folding the cast. Instruction::CastOps opc = CastInst::getCastOpcode(RHS, RHSSigned, LHSTy, LHSSigned); - CastInst *Cast = CastInst::Create(opc, RHS, LHSTy, RHS->getNameStart()); + CastInst *Cast = CastInst::Create(opc, RHS, LHSTy, RHS->getName()); if (opc == Instruction::BitCast && RHS->getType() == LHSTy) // Simplify this no-op bitcast once the function is emitted. UniquedValues.push_back(cast(Cast)); @@ -2939,7 +2955,7 @@ RHS = CastToAnyType(RHS, RHSSigned, PT->getElementType(), LHSSigned); else LV.Ptr = BitCastToType(LV.Ptr, - Context.getPointerTypeUnqual(RHS->getType())); + PointerType::getUnqual(RHS->getType())); StoreInst *SI = Builder.CreateStore(RHS, LV.Ptr, isVolatile); SI->setAlignment(Alignment); return RHS; @@ -2986,7 +3002,7 @@ ThisLastBitPlusOne = LV.BitStart+LV.BitSize; Value *Ptr = Index ? - Builder.CreateGEP(LV.Ptr, Context.getConstantInt(Type::Int32Ty, Index)) : + Builder.CreateGEP(LV.Ptr, ConstantInt::get(Type::getInt32Ty(Context), Index)) : LV.Ptr; LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile); LI->setAlignment(Alignment); @@ -3001,14 +3017,14 @@ // If not storing into the zero'th bit, shift the Src value to the left. if (FirstBitInVal) { - Value *ShAmt = Context.getConstantInt(ValTy, FirstBitInVal); + Value *ShAmt = ConstantInt::get(ValTy, FirstBitInVal); NewVal = Builder.CreateShl(NewVal, ShAmt); } // Next, if this doesn't touch the top bit, mask out any bits that shouldn't // be set in the result. uint64_t MaskVal = ((1ULL << BitsInVal)-1) << FirstBitInVal; - Constant *Mask = Context.getConstantInt(Type::Int64Ty, MaskVal); + Constant *Mask = ConstantInt::get(Type::getInt64Ty(Context), MaskVal); Mask = Builder.getFolder().CreateTruncOrBitCast(Mask, ValTy); if (FirstBitInVal+BitsInVal != ValSizeInBits) @@ -3025,7 +3041,7 @@ SI->setAlignment(Alignment); if (I + 1 < Strides) { - Value *ShAmt = Context.getConstantInt(ValTy, BitsInVal); + Value *ShAmt = ConstantInt::get(ValTy, BitsInVal); BitSource = Builder.CreateLShr(BitSource, ShAmt); } } @@ -3046,12 +3062,12 @@ assert(!isAggregateTreeType(TREE_TYPE(Op)) && "Aggregate to scalar nop_expr!"); Value *OpVal = Emit(Op, DestLoc); - if (Ty == Type::VoidTy) return 0; + if (Ty == Type::getVoidTy(Context)) return 0; return CastToAnyType(OpVal, OpIsSigned, Ty, ExpIsSigned); } else if (isAggregateTreeType(TREE_TYPE(Op))) { // Aggregate to aggregate copy. MemRef NewLoc = *DestLoc; - NewLoc.Ptr = BitCastToType(DestLoc->Ptr, Context.getPointerTypeUnqual(Ty)); + NewLoc.Ptr = BitCastToType(DestLoc->Ptr, PointerType::getUnqual(Ty)); Value *OpVal = Emit(Op, &NewLoc); assert(OpVal == 0 && "Shouldn't cast scalar to aggregate!"); return 0; @@ -3060,7 +3076,7 @@ // Scalar to aggregate copy. Value *OpVal = Emit(Op, 0); Value *Ptr = BitCastToType(DestLoc->Ptr, - Context.getPointerTypeUnqual(OpVal->getType())); + PointerType::getUnqual(OpVal->getType())); StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->getAlignment()); return 0; @@ -3088,7 +3104,7 @@ // Make the destination look like the source type. const Type *OpTy = ConvertType(TREE_TYPE(Op)); - Target.Ptr = BitCastToType(Target.Ptr, Context.getPointerTypeUnqual(OpTy)); + Target.Ptr = BitCastToType(Target.Ptr, PointerType::getUnqual(OpTy)); // Needs to be in sync with EmitLV. switch (TREE_CODE(Op)) { @@ -3128,7 +3144,7 @@ // Target holds the temporary created above. const Type *ExpTy = ConvertType(TREE_TYPE(exp)); return Builder.CreateLoad(BitCastToType(Target.Ptr, - Context.getPointerTypeUnqual(ExpTy))); + PointerType::getUnqual(ExpTy))); } if (DestLoc) { @@ -3137,7 +3153,7 @@ Value *OpVal = Emit(Op, 0); assert(OpVal && "Expected a scalar result!"); Value *Ptr = BitCastToType(DestLoc->Ptr, - Context.getPointerTypeUnqual(OpVal->getType())); + PointerType::getUnqual(OpVal->getType())); StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->getAlignment()); return 0; @@ -3154,7 +3170,7 @@ if (isa(DestTy)) // ptr->ptr is a simple bitcast. return Builder.CreateBitCast(OpVal, DestTy); // Otherwise, ptrtoint to intptr_t first. - OpVal = Builder.CreatePtrToInt(OpVal, TD.getIntPtrType()); + OpVal = Builder.CreatePtrToInt(OpVal, TD.getIntPtrType(Context)); } // If the destination type is a pointer, use inttoptr. @@ -3175,7 +3191,7 @@ // GCC allows NEGATE_EXPR on pointers as well. Cast to int, negate, cast // back. - V = CastToAnyType(V, false, TD.getIntPtrType(), false); + V = CastToAnyType(V, false, TD.getIntPtrType(Context), false); V = Builder.CreateNeg(V); return CastToType(Instruction::IntToPtr, V, ConvertType(TREE_TYPE(exp))); } @@ -3222,11 +3238,11 @@ Value *TreeToLLVM::EmitABS_EXPR(tree exp) { Value *Op = Emit(TREE_OPERAND(exp, 0), 0); if (!Op->getType()->isFloatingPoint()) { - Value *OpN = Builder.CreateNeg(Op, (Op->getName()+"neg").c_str()); + Value *OpN = Builder.CreateNeg(Op, (Op->getNameStr()+"neg").c_str()); ICmpInst::Predicate pred = TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0))) ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_SGE; Value *Cmp = Builder.CreateICmp(pred, Op, - Context.getNullValue(Op->getType()), "abscond"); + Constant::getNullValue(Op->getType()), "abscond"); return Builder.CreateSelect(Cmp, Op, OpN, "abs"); } @@ -3257,10 +3273,10 @@ if (const VectorType *VTy = dyn_cast(Ty)) { unsigned NumElements = VTy->getNumElements(); const Type *EltTy = VTy->getElementType(); - return Context.getVectorType( - Context.getIntegerType(EltTy->getPrimitiveSizeInBits()), NumElements); + return VectorType::get( + IntegerType::get(Context, EltTy->getPrimitiveSizeInBits()), NumElements); } - return Context.getIntegerType(Ty->getPrimitiveSizeInBits()); + return IntegerType::get(Context, Ty->getPrimitiveSizeInBits()); } Value *TreeToLLVM::EmitBIT_NOT_EXPR(tree exp) { @@ -3276,15 +3292,16 @@ cast(Ty)->getElementType()->isFloatingPoint())) { Op = BitCastToType(Op, getSuitableBitCastIntType(Ty)); } - return BitCastToType(Builder.CreateNot(Op, (Op->getName()+"not").c_str()),Ty); + return BitCastToType(Builder.CreateNot(Op, + (Op->getNameStr()+"not").c_str()),Ty); } Value *TreeToLLVM::EmitTRUTH_NOT_EXPR(tree exp) { Value *V = Emit(TREE_OPERAND(exp, 0), 0); - if (V->getType() != Type::Int1Ty) + if (V->getType() != Type::getInt1Ty(Context)) V = Builder.CreateICmpNE(V, - Context.getNullValue(V->getType()), "toBool"); - V = Builder.CreateNot(V, (V->getName()+"not").c_str()); + Constant::getNullValue(V->getType()), "toBool"); + V = Builder.CreateNot(V, (V->getNameStr()+"not").c_str()); return CastToUIntType(V, ConvertType(TREE_TYPE(exp))); } @@ -3329,7 +3346,7 @@ Result = Builder.CreateICmp(pred, LHS, RHS); } } - assert(Result->getType() == Type::Int1Ty && "Expected i1 result for compare"); + assert(Result->getType() == Type::getInt1Ty(Context) && "Expected i1 result for compare"); if (DestTy == 0) DestTy = ConvertType(TREE_TYPE(exp)); @@ -3360,6 +3377,8 @@ bool LHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0))); bool RHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 1))); bool TyIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp)); + bool IsExactDiv = TREE_CODE(exp) == EXACT_DIV_EXPR; + bool IsPlus = TREE_CODE(exp) == PLUS_EXPR; LHS = CastToAnyType(LHS, LHSIsSigned, Ty, TyIsSigned); RHS = CastToAnyType(RHS, RHSIsSigned, Ty, TyIsSigned); @@ -3378,7 +3397,13 @@ RHS = BitCastToType(RHS, Ty); } - Value *V = Builder.CreateBinOp((Instruction::BinaryOps)Opc, LHS, RHS); + Value *V; + if (Opc == Instruction::SDiv && IsExactDiv) + V = Builder.CreateExactSDiv(LHS, RHS); + else if (Opc == Instruction::Add && IsPlus && TyIsSigned && !flag_wrapv) + V = Builder.CreateNSWAdd(LHS, RHS); + else + V = Builder.CreateBinOp((Instruction::BinaryOps)Opc, LHS, RHS); if (ResTy != Ty) V = BitCastToType(V, ResTy); return V; @@ -3413,8 +3438,10 @@ // If this is a subtract, we want to step backwards. if (Opc == Instruction::Sub) EltOffset = -EltOffset; - Constant *C = Context.getConstantInt(Type::Int64Ty, EltOffset); - Value *V = Builder.CreateGEP(LHS, C); + Constant *C = ConstantInt::get(Type::getInt64Ty(Context), EltOffset); + Value *V = flag_wrapv ? + Builder.CreateGEP(LHS, C) : + Builder.CreateInBoundsGEP(LHS, C); return BitCastToType(V, ConvertType(TREE_TYPE(exp))); } } @@ -3423,7 +3450,7 @@ Value *RHS = Emit(TREE_OPERAND(exp, 1), 0); - const Type *IntPtrTy = TD.getIntPtrType(); + const Type *IntPtrTy = TD.getIntPtrType(Context); bool LHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 0))); bool RHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 1))); LHS = CastToAnyType(LHS, LHSIsSigned, IntPtrTy, false); @@ -3442,10 +3469,10 @@ // This is a truth operation like the strict &&,||,^^. Convert to bool as // a test against zero LHS = Builder.CreateICmpNE(LHS, - Context.getNullValue(LHS->getType()), + Constant::getNullValue(LHS->getType()), "toBool"); RHS = Builder.CreateICmpNE(RHS, - Context.getNullValue(RHS->getType()), + Constant::getNullValue(RHS->getType()), "toBool"); Value *Res = Builder.CreateBinOp((Instruction::BinaryOps)Opc, LHS, RHS); @@ -3462,7 +3489,7 @@ Value *RHS = Emit(TREE_OPERAND(exp, 1), 0); if (RHS->getType() != LHS->getType()) RHS = Builder.CreateIntCast(RHS, LHS->getType(), false, - (RHS->getName()+".cast").c_str()); + (RHS->getNameStr()+".cast").c_str()); return Builder.CreateBinOp((Instruction::BinaryOps)Opc, LHS, RHS); } @@ -3472,10 +3499,10 @@ Value *Amt = Emit(TREE_OPERAND(exp, 1), 0); if (Amt->getType() != In->getType()) Amt = Builder.CreateIntCast(Amt, In->getType(), false, - (Amt->getName()+".cast").c_str()); + (Amt->getNameStr()+".cast").c_str()); Value *TypeSize = - Context.getConstantInt(In->getType(), + ConstantInt::get(In->getType(), In->getType()->getPrimitiveSizeInBits()); // Do the two shifts. @@ -3523,22 +3550,7 @@ // Unsigned EXACT_DIV_EXPR -> normal udiv. if (TYPE_UNSIGNED(TREE_TYPE(exp))) return EmitBinOp(exp, DestLoc, Instruction::UDiv); - - // If this is a signed EXACT_DIV_EXPR by a constant, and we know that - // the RHS is a multiple of two, we strength reduce the result to use - // a signed SHR here. We have no way in LLVM to represent EXACT_DIV_EXPR - // precisely, so this transform can't currently be performed at the LLVM - // level. This is commonly used for pointer subtraction. - if (TREE_CODE(TREE_OPERAND(exp, 1)) == INTEGER_CST) { - uint64_t IntValue = getINTEGER_CSTVal(TREE_OPERAND(exp, 1)); - if (isPowerOf2_64(IntValue)) { - // Create an ashr instruction, by the log of the division amount. - Value *LHS = Emit(TREE_OPERAND(exp, 0), 0); - return Builder.CreateAShr(LHS, Context.getConstantInt(LHS->getType(), - Log2_64(IntValue))); - } - } - + // Otherwise, emit this as a normal signed divide. return EmitBinOp(exp, DestLoc, Instruction::SDiv); } @@ -3555,7 +3567,7 @@ return EmitBinOp(exp, DestLoc, Instruction::URem); const Type *Ty = ConvertType(TREE_TYPE(exp)); - Constant *Zero = Context.getConstantInt(Ty, 0); + Constant *Zero = ConstantInt::get(Ty, 0); Value *LHS = Emit(TREE_OPERAND(exp, 0), 0); Value *RHS = Emit(TREE_OPERAND(exp, 1), 0); @@ -3586,9 +3598,9 @@ // otherwise. const Type *Ty = ConvertType(TREE_TYPE(exp)); - Constant *Zero = Context.getConstantInt(Ty, 0); - Constant *One = Context.getConstantInt(Ty, 1); - Constant *MinusOne = Context.getAllOnesValue(Ty); + Constant *Zero = ConstantInt::get(Ty, 0); + Constant *One = ConstantInt::get(Ty, 1); + Constant *MinusOne = Constant::getAllOnesValue(Ty); Value *LHS = Emit(TREE_OPERAND(exp, 0), 0); Value *RHS = Emit(TREE_OPERAND(exp, 1), 0); @@ -3658,9 +3670,9 @@ return Builder.CreateUDiv(LHS, RHS, "fdiv"); const Type *Ty = ConvertType(TREE_TYPE(exp)); - Constant *Zero = Context.getConstantInt(Ty, 0); - Constant *One = Context.getConstantInt(Ty, 1); - Constant *MinusOne = Context.getAllOnesValue(Ty); + Constant *Zero = ConstantInt::get(Ty, 0); + Constant *One = ConstantInt::get(Ty, 1); + Constant *MinusOne = Constant::getAllOnesValue(Ty); // In the case of signed arithmetic, we calculate FDiv as follows: // LHS FDiv RHS = (LHS + Sign(RHS) * Offset) Div RHS - Offset, @@ -3704,8 +3716,8 @@ // we are doing signed or unsigned arithmetic. const Type *Ty = ConvertType(TREE_TYPE(exp)); - Constant *Zero = Context.getConstantInt(Ty, 0); - Constant *Two = Context.getConstantInt(Ty, 2); + Constant *Zero = ConstantInt::get(Ty, 0); + Constant *Two = ConstantInt::get(Ty, 2); Value *LHS = Emit(TREE_OPERAND(exp, 0), 0); Value *RHS = Emit(TREE_OPERAND(exp, 1), 0); @@ -3813,11 +3825,11 @@ "Must-not-throw region handled by runtime?"); // Unwinding continues in the caller. if (!UnwindBB) - UnwindBB = BasicBlock::Create("Unwind"); + UnwindBB = BasicBlock::Create(Context, "Unwind"); Builder.CreateBr(UnwindBB); } - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); return 0; } @@ -3835,13 +3847,12 @@ // If there was an error, return something bogus. if (ValidateRegisterVariable(decl)) { if (Ty->isSingleValueType()) - return Context.getUndef(Ty); + return UndefValue::get(Ty); return 0; // Just don't copy something into DestLoc. } // Turn this into a 'tmp = call Ty asm "", "={reg}"()'. - FunctionType *FTy = - Context.getFunctionType(Ty, std::vector(),false); + FunctionType *FTy = FunctionType::get(Ty, std::vector(),false); const char *Name = reg_names[decode_reg_name(extractRegisterName(decl))]; @@ -3861,7 +3872,7 @@ // Turn this into a 'call void asm sideeffect "", "{reg}"(Ty %RHS)'. std::vector ArgTys; ArgTys.push_back(ConvertType(TREE_TYPE(decl))); - FunctionType *FTy = Context.getFunctionType(Type::VoidTy, ArgTys, false); + FunctionType *FTy = FunctionType::get(Type::getVoidTy(Context), ArgTys, false); const char *Name = reg_names[decode_reg_name(extractRegisterName(decl))]; @@ -4446,9 +4457,9 @@ uint64_t TySize = TD.getTypeSizeInBits(LLVMTy); if (TySize == 1 || TySize == 8 || TySize == 16 || TySize == 32 || TySize == 64) { - LLVMTy = Context.getIntegerType(TySize); + LLVMTy = IntegerType::get(Context, TySize); Op = Builder.CreateLoad(BitCastToType(LV.Ptr, - Context.getPointerTypeUnqual(LLVMTy))); + PointerType::getUnqual(LLVMTy))); } else { // Otherwise, emit our value as a lvalue and let the codegen deal with // it. @@ -4490,7 +4501,7 @@ Op = CastToAnyType(Op, !TYPE_UNSIGNED(type), OTy, CallResultIsSigned[Match]); if (BYTES_BIG_ENDIAN) { - Constant *ShAmt = Context.getConstantInt(Op->getType(), + Constant *ShAmt = ConstantInt::get(Op->getType(), OTyBits-OpTyBits); Op = Builder.CreateLShr(Op, ShAmt); } @@ -4567,17 +4578,17 @@ const Type *CallResultType; switch (CallResultTypes.size()) { - case 0: CallResultType = Type::VoidTy; break; + case 0: CallResultType = Type::getVoidTy(Context); break; case 1: CallResultType = CallResultTypes[0]; break; default: std::vector TmpVec(CallResultTypes.begin(), CallResultTypes.end()); - CallResultType = Context.getStructType(TmpVec); + CallResultType = StructType::get(Context, TmpVec); break; } const FunctionType *FTy = - Context.getFunctionType(CallResultType, CallArgTypes, false); + FunctionType::get(CallResultType, CallArgTypes, false); // Remove the leading comma if we have operands. if (!ConstraintStr.empty()) @@ -4634,16 +4645,16 @@ std::vector CstOps; for (unsigned i = 0, e = Ops.size(); i != e; ++i) CstOps.push_back(cast(Ops[i])); - return Context.getConstantVector(CstOps); + return ConstantVector::get(CstOps); } // Otherwise, insertelement the values to build the vector. Value *Result = - Context.getUndef(Context.getVectorType(Ops[0]->getType(), Ops.size())); + UndefValue::get(VectorType::get(Ops[0]->getType(), Ops.size())); for (unsigned i = 0, e = Ops.size(); i != e; ++i) Result = Builder.CreateInsertElement(Result, Ops[i], - Context.getConstantInt(Type::Int32Ty, i)); + ConstantInt::get(Type::getInt32Ty(Context), i)); return Result; } @@ -4683,17 +4694,17 @@ for (unsigned i = 0; i != NumElements; ++i) { int idx = va_arg(VA, int); if (idx == -1) - Idxs.push_back(Context.getUndef(Type::Int32Ty)); + Idxs.push_back(UndefValue::get(Type::getInt32Ty(Context))); else { assert((unsigned)idx < 2*NumElements && "Element index out of range!"); - Idxs.push_back(Context.getConstantInt(Type::Int32Ty, idx)); + Idxs.push_back(ConstantInt::get(Type::getInt32Ty(Context), idx)); } } va_end(VA); // Turn this into the appropriate shuffle operation. return Builder.CreateShuffleVector(InVec1, InVec2, - Context.getConstantVector(Idxs)); + ConstantVector::get(Idxs)); } //===----------------------------------------------------------------------===// @@ -4714,8 +4725,16 @@ // Get the result type and operand line in an easy to consume format. const Type *ResultType = ConvertType(TREE_TYPE(TREE_TYPE(fndecl))); std::vector Operands; - for (tree Op = TREE_OPERAND(exp, 1); Op; Op = TREE_CHAIN(Op)) - Operands.push_back(Emit(TREE_VALUE(Op), 0)); + for (tree Op = TREE_OPERAND(exp, 1); Op; Op = TREE_CHAIN(Op)) { + tree OpVal = TREE_VALUE(Op); + if (isAggregateTreeType(TREE_TYPE(OpVal))) { + MemRef OpLoc = CreateTempLoc(ConvertType(TREE_TYPE(OpVal))); + Emit(OpVal, &OpLoc); + Operands.push_back(Builder.CreateLoad(OpLoc.Ptr)); + } else { + Operands.push_back(Emit(OpVal, NULL)); + } + } unsigned FnCode = DECL_FUNCTION_CODE(fndecl); return LLVM_TARGET_INTRINSIC_LOWER(exp, FnCode, DestLoc, Result, ResultType, @@ -4734,12 +4753,12 @@ void TreeToLLVM::EmitMemoryBarrier(bool ll, bool ls, bool sl, bool ss) { Value* C[5]; - C[0] = Context.getConstantInt(Type::Int1Ty, ll); - C[1] = Context.getConstantInt(Type::Int1Ty, ls); - C[2] = Context.getConstantInt(Type::Int1Ty, sl); - C[3] = Context.getConstantInt(Type::Int1Ty, ss); + C[0] = ConstantInt::get(Type::getInt1Ty(Context), ll); + C[1] = ConstantInt::get(Type::getInt1Ty(Context), ls); + C[2] = ConstantInt::get(Type::getInt1Ty(Context), sl); + C[3] = ConstantInt::get(Type::getInt1Ty(Context), ss); // Be conservatively safe. - C[4] = Context.getConstantInt(Type::Int1Ty, true); + C[4] = ConstantInt::get(Type::getInt1Ty(Context), true); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memory_barrier), @@ -4756,7 +4775,7 @@ }; const Type* Ty[2]; Ty[0] = ResultTy; - Ty[1] = Context.getPointerTypeUnqual(ResultTy); + Ty[1] = PointerType::getUnqual(ResultTy); C[0] = Builder.CreateBitCast(C[0], Ty[1]); C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast"); // The gcc builtins are also full memory barriers. @@ -4781,7 +4800,7 @@ }; const Type* Ty[2]; Ty[0] = ResultTy; - Ty[1] = Context.getPointerTypeUnqual(ResultTy); + Ty[1] = PointerType::getUnqual(ResultTy); C[0] = Builder.CreateBitCast(C[0], Ty[1]); C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast"); C[2] = Builder.CreateIntCast(C[2], Ty[0], "cast"); @@ -4837,7 +4856,7 @@ BuiltinName); const Type *ResTy = ConvertType(TREE_TYPE(exp)); if (ResTy->isSingleValueType()) - Result = Context.getUndef(ResTy); + Result = UndefValue::get(ResTy); return true; } @@ -4921,9 +4940,9 @@ // This treats everything as unknown, and is minimally defensible as // correct, although completely useless. if (tree_low_cst (ObjSizeTree, 0) < 2) - Result = Context.getAllOnesValue(TD.getIntPtrType()); + Result = Constant::getAllOnesValue(TD.getIntPtrType(Context)); else - Result = Context.getConstantInt(TD.getIntPtrType(), 0); + Result = ConstantInt::get(TD.getIntPtrType(Context), 0); return true; } // Unary bit counting intrinsics. @@ -4953,7 +4972,7 @@ Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctpop); Result = Builder.CreateBinOp(Instruction::And, Result, - Context.getConstantInt(Result->getType(), 1)); + ConstantInt::get(Result->getType(), 1)); return true; } case BUILT_IN_POPCOUNT: // These GCC builtins always return int. @@ -5061,13 +5080,13 @@ Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0); EmitBuiltinUnaryOp(Amt, Result, Intrinsic::cttz); Result = Builder.CreateAdd(Result, - Context.getConstantInt(Result->getType(), 1)); + ConstantInt::get(Result->getType(), 1)); Result = CastToUIntType(Result, ConvertType(TREE_TYPE(exp))); Value *Cond = Builder.CreateICmpEQ(Amt, - Context.getNullValue(Amt->getType())); + Constant::getNullValue(Amt->getType())); Result = Builder.CreateSelect(Cond, - Context.getNullValue(Result->getType()), + Constant::getNullValue(Result->getType()), Result); return true; } @@ -5082,7 +5101,7 @@ Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::trap)); // Emit an explicit unreachable instruction. Builder.CreateUnreachable(); - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); return true; //TODO // Convert annotation built-in to llvm.annotation intrinsic. @@ -5090,9 +5109,9 @@ //TODO //TODO // Get file and line number //TODO location_t locus = EXPR_LOCATION (exp); -//TODO Constant *lineNo = ConstantInt::get(Type::Int32Ty, LOCATION_LINE(locus)); +//TODO Constant *lineNo = ConstantInt::get(Type::getInt32Ty, LOCATION_LINE(locus)); //TODO Constant *file = ConvertMetadataStringToGV(LOCATION_FILE(locus)); -//TODO const Type *SBP= PointerType::getUnqual(Type::Int8Ty); +//TODO const Type *SBP= PointerType::getUnqual(Type::getInt8Ty(Context)); //TODO file = Builder.getFolder().CreateBitCast(file, SBP); //TODO //TODO // Get arguments. @@ -5119,8 +5138,8 @@ case BUILT_IN_SYNCHRONIZE: { // We assume like gcc appears to, that this only applies to cached memory. Value* C[5]; - C[0] = C[1] = C[2] = C[3] = Context.getConstantInt(Type::Int1Ty, 1); - C[4] = Context.getConstantInt(Type::Int1Ty, 0); + C[0] = C[1] = C[2] = C[3] = ConstantInt::get(Type::getInt1Ty(Context), 1); + C[4] = ConstantInt::get(Type::getInt1Ty(Context), 0); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memory_barrier), @@ -5265,7 +5284,7 @@ }; const Type* Ty[2]; Ty[0] = ResultTy; - Ty[1] = Context.getPointerTypeUnqual(ResultTy); + Ty[1] = PointerType::getUnqual(ResultTy); C[0] = Builder.CreateBitCast(C[0], Ty[1]); C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast"); @@ -5303,7 +5322,7 @@ }; const Type* Ty[2]; Ty[0] = ResultTy; - Ty[1] = Context.getPointerTypeUnqual(ResultTy); + Ty[1] = PointerType::getUnqual(ResultTy); C[0] = Builder.CreateBitCast(C[0], Ty[1]); C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast"); @@ -5341,7 +5360,7 @@ }; const Type* Ty[2]; Ty[0] = ResultTy; - Ty[1] = Context.getPointerTypeUnqual(ResultTy); + Ty[1] = PointerType::getUnqual(ResultTy); C[0] = Builder.CreateBitCast(C[0], Ty[1]); C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast"); @@ -5379,7 +5398,7 @@ }; const Type* Ty[2]; Ty[0] = ResultTy; - Ty[1] = Context.getPointerTypeUnqual(ResultTy); + Ty[1] = PointerType::getUnqual(ResultTy); C[0] = Builder.CreateBitCast(C[0], Ty[1]); C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast"); @@ -5417,7 +5436,7 @@ }; const Type* Ty[2]; Ty[0] = ResultTy; - Ty[1] = Context.getPointerTypeUnqual(ResultTy); + Ty[1] = PointerType::getUnqual(ResultTy); C[0] = Builder.CreateBitCast(C[0], Ty[1]); C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast"); @@ -5455,7 +5474,7 @@ }; const Type* Ty[2]; Ty[0] = ResultTy; - Ty[1] = Context.getPointerTypeUnqual(ResultTy); + Ty[1] = PointerType::getUnqual(ResultTy); C[0] = Builder.CreateBitCast(C[0], Ty[1]); C[1] = Builder.CreateIntCast(C[1], Ty[0], "cast"); @@ -5544,8 +5563,8 @@ // FIXME: HACK: Just ignore these. { const Type *Ty = ConvertType(TREE_TYPE(exp)); - if (Ty != Type::VoidTy) - Result = Context.getNullValue(Ty); + if (Ty != Type::getVoidTy(Context)) + Result = Constant::getNullValue(Ty); return true; } #endif // FIXME: Should handle these GCC extensions eventually. @@ -5582,7 +5601,7 @@ Value *Val = Emit(TREE_VALUE(ArgList), 0); Value *Pow = Emit(TREE_VALUE(TREE_CHAIN(ArgList)), 0); const Type *Ty = Val->getType(); - Pow = CastToSIntType(Pow, Type::Int32Ty); + Pow = CastToSIntType(Pow, Type::getInt32Ty(Context)); SmallVector Args; Args.push_back(Val); @@ -5610,7 +5629,7 @@ } bool TreeToLLVM::EmitBuiltinConstantP(tree exp, Value *&Result) { - Result = Context.getNullValue(ConvertType(TREE_TYPE(exp))); + Result = Constant::getNullValue(ConvertType(TREE_TYPE(exp))); return true; } @@ -5725,7 +5744,7 @@ unsigned DstAlign = getPointerAlignment(Dst); Value *DstV = Emit(Dst, 0); - Value *Val = Context.getNullValue(Type::Int32Ty); + Value *Val = Constant::getNullValue(Type::getInt32Ty(Context)); Value *Len = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); EmitMemSet(DstV, Val, Len, DstAlign); return true; @@ -5751,7 +5770,7 @@ ReadWrite = 0; } else { ReadWrite = Builder.getFolder().CreateIntCast(cast(ReadWrite), - Type::Int32Ty, false); + Type::getInt32Ty(Context), false); } if (TREE_CHAIN(TREE_CHAIN(arglist))) { @@ -5764,18 +5783,18 @@ Locality = 0; } else { Locality = Builder.getFolder().CreateIntCast(cast(Locality), - Type::Int32Ty, false); + Type::getInt32Ty(Context), false); } } } // Default to highly local read. if (ReadWrite == 0) - ReadWrite = Context.getNullValue(Type::Int32Ty); + ReadWrite = Constant::getNullValue(Type::getInt32Ty(Context)); if (Locality == 0) - Locality = Context.getConstantInt(Type::Int32Ty, 3); + Locality = ConstantInt::get(Type::getInt32Ty(Context), 3); - Ptr = BitCastToType(Ptr, Context.getPointerTypeUnqual(Type::Int8Ty)); + Ptr = BitCastToType(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context))); Value *Ops[3] = { Ptr, ReadWrite, Locality }; Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::prefetch), @@ -5818,7 +5837,7 @@ // Unfortunately, these constants are defined as RTL expressions and // should be handled separately. - Result = BitCastToType(Ptr, Context.getPointerTypeUnqual(Type::Int8Ty)); + Result = BitCastToType(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context))); return true; } @@ -5834,7 +5853,7 @@ // needed for: MIPS, Sparc. Unfortunately, these constants are defined // as RTL expressions and should be handled separately. - Result = BitCastToType(Ptr, Context.getPointerTypeUnqual(Type::Int8Ty)); + Result = BitCastToType(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context))); return true; } @@ -5885,7 +5904,7 @@ // FIXME: is i32 always enough here? Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::eh_dwarf_cfa), - Context.getConstantInt(Type::Int32Ty, cfa_offset)); + ConstantInt::get(Type::getInt32Ty(Context), cfa_offset)); return true; } @@ -5895,7 +5914,7 @@ return false; unsigned int dwarf_regnum = DWARF_FRAME_REGNUM(STACK_POINTER_REGNUM); - Result = Context.getConstantInt(ConvertType(TREE_TYPE(exp)), dwarf_regnum); + Result = ConstantInt::get(ConvertType(TREE_TYPE(exp)), dwarf_regnum); return true; } @@ -5922,7 +5941,7 @@ iwhich = DWARF_FRAME_REGNUM (iwhich); - Result = Context.getConstantInt(ConvertType(TREE_TYPE(exp)), iwhich); + Result = ConstantInt::get(ConvertType(TREE_TYPE(exp)), iwhich); #endif return true; @@ -5934,15 +5953,15 @@ if (!validate_arglist(arglist, INTEGER_TYPE, POINTER_TYPE, VOID_TYPE)) return false; - const Type *IntPtr = TD.getIntPtrType(); + const Type *IntPtr = TD.getIntPtrType(Context); Value *Offset = Emit(TREE_VALUE(arglist), 0); Value *Handler = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); - Intrinsic::ID IID = (IntPtr == Type::Int32Ty ? + Intrinsic::ID IID = (IntPtr == Type::getInt32Ty(Context) ? Intrinsic::eh_return_i32 : Intrinsic::eh_return_i64); Offset = Builder.CreateIntCast(Offset, IntPtr, true); - Handler = BitCastToType(Handler, Context.getPointerTypeUnqual(Type::Int8Ty)); + Handler = BitCastToType(Handler, PointerType::getUnqual(Type::getInt8Ty(Context))); SmallVector Args; Args.push_back(Offset); @@ -5950,7 +5969,7 @@ Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Args.begin(), Args.end()); Result = Builder.CreateUnreachable(); - EmitBlock(BasicBlock::Create("")); + EmitBlock(BasicBlock::Create(Context, "")); return true; } @@ -5971,7 +5990,7 @@ } Value *Addr = BitCastToType(Emit(TREE_VALUE(arglist), 0), - Context.getPointerTypeUnqual(Type::Int8Ty)); + PointerType::getUnqual(Type::getInt8Ty(Context))); Constant *Size, *Idx; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { @@ -5992,21 +6011,21 @@ if (rnum < 0) continue; - Size = Context.getConstantInt(Type::Int8Ty, size); - Idx = Context.getConstantInt(Type::Int32Ty, rnum); + Size = ConstantInt::get(Type::getInt8Ty(Context), size); + Idx = ConstantInt::get(Type::getInt32Ty(Context), rnum); Builder.CreateStore(Size, Builder.CreateGEP(Addr, Idx), false); } } if (!wrote_return_column) { - Size = Context.getConstantInt(Type::Int8Ty, GET_MODE_SIZE (Pmode)); - Idx = Context.getConstantInt(Type::Int32Ty, DWARF_FRAME_RETURN_COLUMN); + Size = ConstantInt::get(Type::getInt8Ty(Context), GET_MODE_SIZE (Pmode)); + Idx = ConstantInt::get(Type::getInt32Ty(Context), DWARF_FRAME_RETURN_COLUMN); Builder.CreateStore(Size, Builder.CreateGEP(Addr, Idx), false); } #ifdef DWARF_ALT_FRAME_RETURN_COLUMN - Size = Context.getConstantInt(Type::Int8Ty, GET_MODE_SIZE (Pmode)); - Idx = Context.getConstantInt(Type::Int32Ty, DWARF_ALT_FRAME_RETURN_COLUMN); + Size = ConstantInt::get(Type::getInt8Ty(Context), GET_MODE_SIZE (Pmode)); + Idx = ConstantInt::get(Type::getInt32Ty(Context), DWARF_ALT_FRAME_RETURN_COLUMN); Builder.CreateStore(Size, Builder.CreateGEP(Addr, Idx), false); #endif @@ -6033,7 +6052,7 @@ return false; Value *Ptr = Emit(TREE_VALUE(arglist), 0); - Ptr = BitCastToType(Ptr, Context.getPointerTypeUnqual(Type::Int8Ty)); + Ptr = BitCastToType(Ptr, PointerType::getUnqual(Type::getInt8Ty(Context))); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::stackrestore), Ptr); @@ -6046,8 +6065,8 @@ if (!validate_arglist(arglist, INTEGER_TYPE, VOID_TYPE)) return false; Value *Amt = Emit(TREE_VALUE(arglist), 0); - Amt = CastToSIntType(Amt, Type::Int32Ty); - Result = Builder.CreateAlloca(Type::Int8Ty, Amt); + Amt = CastToSIntType(Amt, Type::getInt32Ty(Context)); + Result = Builder.CreateAlloca(Type::getInt8Ty(Context), Amt); return true; } @@ -6087,14 +6106,14 @@ Intrinsic::vastart); const Type *FTy = cast(llvm_va_start_fn->getType())->getElementType(); - ArgVal = BitCastToType(ArgVal, Context.getPointerTypeUnqual(Type::Int8Ty)); + ArgVal = BitCastToType(ArgVal, PointerType::getUnqual(Type::getInt8Ty(Context))); Builder.CreateCall(llvm_va_start_fn, ArgVal); return true; } bool TreeToLLVM::EmitBuiltinVAEnd(tree exp) { Value *Arg = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0); - Arg = BitCastToType(Arg, Context.getPointerTypeUnqual(Type::Int8Ty)); + Arg = BitCastToType(Arg, PointerType::getUnqual(Type::getInt8Ty(Context))); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::vaend), Arg); return true; @@ -6119,7 +6138,7 @@ Arg2 = Emit(Arg2T, 0); } - static const Type *VPTy = Context.getPointerTypeUnqual(Type::Int8Ty); + static const Type *VPTy = PointerType::getUnqual(Type::getInt8Ty(Context)); // FIXME: This ignores alignment and volatility of the arguments. SmallVector Args; @@ -6137,7 +6156,7 @@ VOID_TYPE)) return false; - static const Type *VPTy = Context.getPointerTypeUnqual(Type::Int8Ty); + static const Type *VPTy = PointerType::getUnqual(Type::getInt8Ty(Context)); Value *Tramp = Emit(TREE_VALUE(arglist), 0); Tramp = BitCastToType(Tramp, VPTy); @@ -6332,7 +6351,7 @@ tree AnnotateAttr = lookup_attribute("annotate", DECL_ATTRIBUTES(FieldDecl)); const Type *OrigPtrTy = FieldPtr->getType(); - const Type *SBP = Context.getPointerTypeUnqual(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::getInt8Ty(Context)); Function *Fn = Intrinsic::getDeclaration(TheModule, Intrinsic::ptr_annotation, @@ -6340,7 +6359,7 @@ // Get file and line number. FIXME: Should this be for the decl or the // use. Is there a location info for the use? - Constant *LineNo = Context.getConstantInt(Type::Int32Ty, + Constant *LineNo = ConstantInt::get(Type::getInt32Ty(Context), DECL_SOURCE_LINE(FieldDecl)); Constant *File = ConvertMetadataStringToGV(DECL_SOURCE_FILE(FieldDecl)); @@ -6370,7 +6389,7 @@ // attribute on a whole struct from one on the first element of the // struct. BitCastInst *CastFieldPtr = new BitCastInst(FieldPtr, SBP, - FieldPtr->getNameStart()); + FieldPtr->getName()); Builder.Insert(CastFieldPtr); Value *Ops[4] = { @@ -6431,7 +6450,7 @@ Value *IndexVal = Emit(Index, 0); - const Type *IntPtrTy = getTargetData().getIntPtrType(); + const Type *IntPtrTy = getTargetData().getIntPtrType(Context); if (TYPE_UNSIGNED(IndexType)) // if the index is unsigned // ZExt it to retain its value in the larger type IndexVal = CastToUIntType(IndexVal, IntPtrTy); @@ -6443,14 +6462,16 @@ if (isSequentialCompatible(ArrayTreeType)) { SmallVector Idx; if (TREE_CODE(ArrayTreeType) == ARRAY_TYPE) - Idx.push_back(Context.getConstantInt(IntPtrTy, 0)); + Idx.push_back(ConstantInt::get(IntPtrTy, 0)); Idx.push_back(IndexVal); - Value *Ptr = Builder.CreateGEP(ArrayAddr, Idx.begin(), Idx.end()); + Value *Ptr = flag_wrapv ? + Builder.CreateGEP(ArrayAddr, Idx.begin(), Idx.end()) : + Builder.CreateInBoundsGEP(ArrayAddr, Idx.begin(), Idx.end()); const Type *ElementTy = ConvertType(ElementType); unsigned Alignment = MinAlign(ArrayAlign, TD.getABITypeAlignment(ElementTy)); return LValue(BitCastToType(Ptr, - Context.getPointerTypeUnqual(ConvertType(TREE_TYPE(exp)))), + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))), Alignment); } @@ -6459,7 +6480,7 @@ // float foo(int w, float A[][w], int g) { return A[g][0]; } ArrayAddr = BitCastToType(ArrayAddr, - Context.getPointerTypeUnqual(Type::Int8Ty)); + PointerType::getUnqual(Type::getInt8Ty(Context))); if (VOID_TYPE_P(TREE_TYPE(ArrayTreeType))) return LValue(Builder.CreateGEP(ArrayAddr, IndexVal), 1); @@ -6470,9 +6491,11 @@ if (isa(IndexVal)) Alignment = MinAlign(ArrayAlign, cast(IndexVal)->getZExtValue()); - Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal); + Value *Ptr = flag_wrapv ? + Builder.CreateGEP(ArrayAddr, IndexVal) : + Builder.CreateInBoundsGEP(ArrayAddr, IndexVal); return LValue(BitCastToType(Ptr, - Context.getPointerTypeUnqual(ConvertType(TREE_TYPE(exp)))), + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))), Alignment); } @@ -6498,19 +6521,19 @@ if (unsigned UnitOffset = BitStart / ValueSizeInBits) { // TODO: If Ptr.Ptr is a struct type or something, we can do much better // than this. e.g. check out when compiling unwind-dw2-fde-darwin.c. - Ptr.Ptr = BitCastToType(Ptr.Ptr, Context.getPointerTypeUnqual(ValTy)); + Ptr.Ptr = BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)); Ptr.Ptr = Builder.CreateGEP(Ptr.Ptr, - Context.getConstantInt(Type::Int32Ty, UnitOffset)); + ConstantInt::get(Type::getInt32Ty(Context), UnitOffset)); BitStart -= UnitOffset*ValueSizeInBits; } // If this is referring to the whole field, return the whole thing. if (BitStart == 0 && BitSize == ValueSizeInBits) { - return LValue(BitCastToType(Ptr.Ptr, Context.getPointerTypeUnqual(ValTy)), + return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)), Ptr.getAlignment()); } - return LValue(BitCastToType(Ptr.Ptr, Context.getPointerTypeUnqual(ValTy)), 1, + return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)), 1, BitStart, BitSize); } @@ -6533,7 +6556,7 @@ StructAddrLV.BitStart == 0) && "structs cannot be bitfields!"); StructAddrLV.Ptr = BitCastToType(StructAddrLV.Ptr, - Context.getPointerTypeUnqual(StructTy)); + PointerType::getUnqual(StructTy)); const Type *FieldTy = ConvertType(getDeclaredType(FieldDecl)); // BitStart - This is the actual offset of the field from the start of the @@ -6590,7 +6613,7 @@ unsigned ByteOffset = BitStart/8; if (ByteOffset > 0) { Offset = Builder.CreateAdd(Offset, - Context.getConstantInt(Offset->getType(), ByteOffset)); + ConstantInt::get(Offset->getType(), ByteOffset)); BitStart -= ByteOffset*8; // If the base is known to be 8-byte aligned, and we're adding a 4-byte // offset, the field is known to be 4-byte aligned. @@ -6601,7 +6624,7 @@ Offset->getType()); Ptr = Builder.CreateAdd(Ptr, Offset); FieldPtr = CastToType(Instruction::IntToPtr, Ptr, - Context.getPointerTypeUnqual(FieldTy)); + PointerType::getUnqual(FieldTy)); } if (isBitfield(FieldDecl)) { @@ -6634,14 +6657,14 @@ // sized like an i24 there may be trouble: incrementing a T* will move // the position by 32 bits not 24, leaving the upper 8 of those 32 bits // inaccessible. Avoid this by rounding up the size appropriately. - FieldTy = Context.getIntegerType(TD.getTypeAllocSizeInBits(FieldTy)); + FieldTy = IntegerType::get(Context, TD.getTypeAllocSizeInBits(FieldTy)); assert(FieldTy->getPrimitiveSizeInBits() == TD.getTypeAllocSizeInBits(FieldTy) && "Field type not sequential!"); // If this is a bitfield, the field may span multiple fields in the LLVM // type. As such, cast the pointer to be a pointer to the declared type. - FieldPtr = BitCastToType(FieldPtr, Context.getPointerTypeUnqual(FieldTy)); + FieldPtr = BitCastToType(FieldPtr, PointerType::getUnqual(FieldTy)); unsigned LLVMValueBitSize = FieldTy->getPrimitiveSizeInBits(); // Finally, because bitfields can span LLVM fields, and because the start @@ -6668,12 +6691,12 @@ unsigned ByteOffset = NumAlignmentUnits*ByteAlignment; LVAlign = MinAlign(LVAlign, ByteOffset); - Constant *Offset = Context.getConstantInt(TD.getIntPtrType(), ByteOffset); + Constant *Offset = ConstantInt::get(TD.getIntPtrType(Context), ByteOffset); FieldPtr = CastToType(Instruction::PtrToInt, FieldPtr, Offset->getType()); FieldPtr = Builder.CreateAdd(FieldPtr, Offset); FieldPtr = CastToType(Instruction::IntToPtr, FieldPtr, - Context.getPointerTypeUnqual(FieldTy)); + PointerType::getUnqual(FieldTy)); // Adjust bitstart to account for the pointer movement. BitStart -= ByteOffset*8; @@ -6694,7 +6717,7 @@ } else { // Make sure we return a pointer to the right type. const Type *EltTy = ConvertType(TREE_TYPE(exp)); - FieldPtr = BitCastToType(FieldPtr, Context.getPointerTypeUnqual(EltTy)); + FieldPtr = BitCastToType(FieldPtr, PointerType::getUnqual(EltTy)); } assert(BitStart == 0 && @@ -6735,8 +6758,8 @@ if (Decl == 0) { if (errorcount || sorrycount) { const Type *Ty = ConvertType(TREE_TYPE(exp)); - const PointerType *PTy = Context.getPointerTypeUnqual(Ty); - LValue LV(Context.getConstantPointerNull(PTy), 1); + const PointerType *PTy = PointerType::getUnqual(Ty); + LValue LV(ConstantPointerNull::get(PTy), 1); return LV; } assert(0 && "INTERNAL ERROR: Referencing decl that hasn't been laid out"); @@ -6772,8 +6795,8 @@ const Type *Ty = ConvertType(TREE_TYPE(exp)); // If we have "extern void foo", make the global have type {} instead of // type void. - if (Ty == Type::VoidTy) Ty = Context.getStructType(NULL, NULL); - const PointerType *PTy = Context.getPointerTypeUnqual(Ty); + if (Ty == Type::getVoidTy(Context)) Ty = StructType::get(Context); + const PointerType *PTy = PointerType::getUnqual(Ty); unsigned Alignment = Ty->isSized() ? TD.getABITypeAlignment(Ty) : 1; if (DECL_ALIGN(exp)) { if (DECL_USER_ALIGN(exp) || 8 * Alignment < (unsigned)DECL_ALIGN(exp)) @@ -6789,7 +6812,7 @@ unsigned Alignment = TD.getABITypeAlignment(cast(ExceptionValue-> getType())->getElementType()); return LValue(BitCastToType(ExceptionValue, - Context.getPointerTypeUnqual(ConvertType(TREE_TYPE(exp)))), + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))), Alignment); } @@ -6818,7 +6841,7 @@ LValue LV = EmitLV(Op); // The type is the type of the expression. LV.Ptr = BitCastToType(LV.Ptr, - Context.getPointerTypeUnqual(ConvertType(TREE_TYPE(exp)))); + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); return LV; } else { // If the input is a scalar, emit to a temporary. @@ -6826,7 +6849,7 @@ StoreInst *S = Builder.CreateStore(Emit(Op, 0), Dest); // The type is the type of the expression. Dest = BitCastToType(Dest, - Context.getPointerTypeUnqual(ConvertType(TREE_TYPE(exp)))); + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); return LValue(Dest, 1); } } @@ -6867,7 +6890,7 @@ std::vector BuildVecOps; // Insert zero initializers for any uninitialized values. - Constant *Zero = Context.getNullValue(PTy->getElementType()); + Constant *Zero = Constant::getNullValue(PTy->getElementType()); BuildVecOps.resize(cast(Ty)->getNumElements(), Zero); // Insert all of the elements here. @@ -6921,7 +6944,7 @@ // Scalar value. Evaluate to a register, then do the store. Value *V = Emit(tree_value, 0); Value *Ptr = BitCastToType(DestLoc->Ptr, - Context.getPointerTypeUnqual(V->getType())); + PointerType::getUnqual(V->getType())); StoreInst *St = Builder.CreateStore(V, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->getAlignment()); } @@ -6966,14 +6989,14 @@ assert(HOST_BITS_PER_WIDE_INT == 64 && "i128 only supported on 64-bit system"); uint64_t Bits[] = { TREE_INT_CST_LOW(exp), TREE_INT_CST_HIGH(exp) }; - return Context.getConstantInt(APInt(128, 2, Bits)); + return ConstantInt::get(Context, APInt(128, 2, Bits)); } } // Build the value as a ulong constant, then constant fold it to the right // type. This handles overflow and other things appropriately. uint64_t IntValue = getINTEGER_CSTVal(exp); - ConstantInt *C = Context.getConstantInt(Type::Int64Ty, IntValue); + ConstantInt *C = ConstantInt::get(Type::getInt64Ty(Context), IntValue); // The destination type can be a pointer, integer or floating point // so we need a generalized cast here Instruction::CastOps opcode = CastInst::getCastOpcode(C, false, Ty, @@ -6989,7 +7012,7 @@ int UArr[2]; double V; }; - if (Ty==Type::FloatTy || Ty==Type::DoubleTy) { + if (Ty==Type::getFloatTy(Context) || Ty==Type::getDoubleTy(Context)) { REAL_VALUE_TO_TARGET_DOUBLE(TREE_REAL_CST(exp), RealArr); // Here's how this works: @@ -7006,7 +7029,7 @@ // do not match. FLOAT_WORDS_BIG_ENDIAN describes the target endianness. // The host's used to be available in HOST_WORDS_BIG_ENDIAN, but the gcc // maintainers removed this in a fit of cleanliness between 4.0 - // and 4.2. For now, host and target endianness must match. + // and 4.2. llvm::sys has a substitute. UArr[0] = RealArr[0]; // Long -> int convert UArr[1] = RealArr[1]; @@ -7015,16 +7038,17 @@ std::swap(UArr[0], UArr[1]); return - Context.getConstantFP(Ty==Type::FloatTy ? APFloat((float)V) : APFloat(V)); - } else if (Ty==Type::X86_FP80Ty) { + ConstantFP::get(Context, Ty==Type::getFloatTy(Context) ? + APFloat((float)V) : APFloat(V)); + } else if (Ty==Type::getX86_FP80Ty(Context)) { long RealArr[4]; uint64_t UArr[2]; REAL_VALUE_TO_TARGET_LONG_DOUBLE(TREE_REAL_CST(exp), RealArr); UArr[0] = ((uint64_t)((uint32_t)RealArr[0])) | ((uint64_t)((uint32_t)RealArr[1]) << 32); UArr[1] = (uint16_t)RealArr[2]; - return Context.getConstantFP(APFloat(APInt(80, 2, UArr))); - } else if (Ty==Type::PPC_FP128Ty) { + return ConstantFP::get(Context, APFloat(APInt(80, 2, UArr))); + } else if (Ty==Type::getPPC_FP128Ty(Context)) { long RealArr[4]; uint64_t UArr[2]; REAL_VALUE_TO_TARGET_LONG_DOUBLE(TREE_REAL_CST(exp), RealArr); @@ -7033,7 +7057,7 @@ ((uint64_t)((uint32_t)RealArr[1])); UArr[1] = ((uint64_t)((uint32_t)RealArr[2]) << 32) | ((uint64_t)((uint32_t)RealArr[3])); - return Context.getConstantFP(APFloat(APInt(128, 2, UArr))); + return ConstantFP::get(Context, APFloat(APInt(128, 2, UArr))); } assert(0 && "Floating point type not handled yet"); return 0; // outwit compiler warning @@ -7041,7 +7065,7 @@ Constant *TreeConstantToLLVM::ConvertVECTOR_CST(tree exp) { if (!TREE_VECTOR_CST_ELTS(exp)) - return Context.getNullValue(ConvertType(TREE_TYPE(exp))); + return Constant::getNullValue(ConvertType(TREE_TYPE(exp))); std::vector Elts; for (tree elt = TREE_VECTOR_CST_ELTS(exp); elt; elt = TREE_CHAIN(elt)) @@ -7050,12 +7074,12 @@ // The vector should be zero filled if insufficient elements are provided. if (Elts.size() < TYPE_VECTOR_SUBPARTS(TREE_TYPE(exp))) { tree EltType = TREE_TYPE(TREE_TYPE(exp)); - Constant *Zero = Context.getNullValue(ConvertType(EltType)); + Constant *Zero = Constant::getNullValue(ConvertType(EltType)); while (Elts.size() < TYPE_VECTOR_SUBPARTS(TREE_TYPE(exp))) Elts.push_back(Zero); } - return Context.getConstantVector(Elts); + return ConstantVector::get(Elts); } Constant *TreeConstantToLLVM::ConvertSTRING_CST(tree exp) { @@ -7065,23 +7089,37 @@ unsigned Len = (unsigned)TREE_STRING_LENGTH(exp); std::vector Elts; - if (ElTy == Type::Int8Ty) { + if (ElTy == Type::getInt8Ty(Context)) { const unsigned char *InStr =(const unsigned char *)TREE_STRING_POINTER(exp); for (unsigned i = 0; i != Len; ++i) - Elts.push_back(Context.getConstantInt(Type::Int8Ty, InStr[i])); - } else if (ElTy == Type::Int16Ty) { + Elts.push_back(ConstantInt::get(Type::getInt8Ty(Context), InStr[i])); + } else if (ElTy == Type::getInt16Ty(Context)) { assert((Len&1) == 0 && "Length in bytes should be a multiple of element size"); - const unsigned short *InStr = + const uint16_t *InStr = (const unsigned short *)TREE_STRING_POINTER(exp); - for (unsigned i = 0; i != Len/2; ++i) - Elts.push_back(Context.getConstantInt(Type::Int16Ty, InStr[i])); - } else if (ElTy == Type::Int32Ty) { + for (unsigned i = 0; i != Len/2; ++i) { + // gcc has constructed the initializer elements in the target endianness, + // but we're going to treat them as ordinary shorts from here, with + // host endianness. Adjust if necessary. + if (llvm::sys::isBigEndianHost() == BYTES_BIG_ENDIAN) + Elts.push_back(ConstantInt::get(Type::getInt16Ty(Context), InStr[i])); + else + Elts.push_back(ConstantInt::get(Type::getInt16Ty(Context), ByteSwap_16(InStr[i]))); + } + } else if (ElTy == Type::getInt32Ty(Context)) { assert((Len&3) == 0 && "Length in bytes should be a multiple of element size"); - const unsigned *InStr = (const unsigned *)TREE_STRING_POINTER(exp); - for (unsigned i = 0; i != Len/4; ++i) - Elts.push_back(Context.getConstantInt(Type::Int32Ty, InStr[i])); + const uint32_t *InStr = (const unsigned *)TREE_STRING_POINTER(exp); + for (unsigned i = 0; i != Len/4; ++i) { + // gcc has constructed the initializer elements in the target endianness, + // but we're going to treat them as ordinary ints from here, with + // host endianness. Adjust if necessary. + if (llvm::sys::isBigEndianHost() == BYTES_BIG_ENDIAN) + Elts.push_back(ConstantInt::get(Type::getInt32Ty(Context), InStr[i])); + else + Elts.push_back(ConstantInt::get(Type::getInt32Ty(Context), ByteSwap_32(InStr[i]))); + } } else { assert(0 && "Unknown character type!"); } @@ -7096,7 +7134,7 @@ tree Domain = TYPE_DOMAIN(TREE_TYPE(exp)); if (!Domain || !TYPE_MAX_VALUE(Domain)) { ConstantSize = LenInElts; - StrTy = Context.getArrayType(ElTy, LenInElts); + StrTy = ArrayType::get(ElTy, LenInElts); } } @@ -7105,19 +7143,19 @@ Elts.resize(ConstantSize); } else { // Fill the end of the string with nulls. - Constant *C = Context.getNullValue(ElTy); + Constant *C = Constant::getNullValue(ElTy); for (; LenInElts != ConstantSize; ++LenInElts) Elts.push_back(C); } } - return Context.getConstantArray(StrTy, Elts); + return ConstantArray::get(StrTy, Elts); } Constant *TreeConstantToLLVM::ConvertCOMPLEX_CST(tree exp) { std::vector Elts; Elts.push_back(Convert(TREE_REALPART(exp))); Elts.push_back(Convert(TREE_IMAGPART(exp))); - return Context.getConstantStruct(Elts, false); + return ConstantStruct::get(Context, Elts, false); } Constant *TreeConstantToLLVM::ConvertNOP_EXPR(tree exp) { @@ -7153,7 +7191,7 @@ bool RHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp,1))); Instruction::CastOps opcode; if (isa(LHS->getType())) { - const Type *IntPtrTy = getTargetData().getIntPtrType(); + const Type *IntPtrTy = getTargetData().getIntPtrType(Context); opcode = CastInst::getCastOpcode(LHS, LHSIsSigned, IntPtrTy, false); LHS = TheFolder->CreateCast(opcode, LHS, IntPtrTy); opcode = CastInst::getCastOpcode(RHS, RHSIsSigned, IntPtrTy, false); @@ -7179,7 +7217,7 @@ // when array is filled during program initialization. if (CONSTRUCTOR_ELTS(exp) == 0 || VEC_length(constructor_elt, CONSTRUCTOR_ELTS(exp)) == 0) // All zeros? - return Context.getNullValue(ConvertType(TREE_TYPE(exp))); + return Constant::getNullValue(ConvertType(TREE_TYPE(exp))); switch (TREE_CODE(TREE_TYPE(exp))) { default: @@ -7274,7 +7312,7 @@ // Zero length array. if (ResultElts.empty()) - return Context.getConstantArray( + return ConstantArray::get( cast(ConvertType(TREE_TYPE(exp))), ResultElts); assert(SomeVal && "If we had some initializer, we should have some value!"); @@ -7286,7 +7324,7 @@ // of an array. This can occur in cases where we have an array of // unions, and the various unions had different pieces init'd. const Type *ElTy = SomeVal->getType(); - Constant *Filler = Context.getNullValue(ElTy); + Constant *Filler = Constant::getNullValue(ElTy); bool AllEltsSameType = true; for (unsigned i = 0, e = ResultElts.size(); i != e; ++i) { if (ResultElts[i] == 0) @@ -7297,13 +7335,13 @@ if (TREE_CODE(InitType) == VECTOR_TYPE) { assert(AllEltsSameType && "Vector of heterogeneous element types?"); - return Context.getConstantVector(ResultElts); + return ConstantVector::get(ResultElts); } if (AllEltsSameType) - return Context.getConstantArray( - Context.getArrayType(ElTy, ResultElts.size()), ResultElts); - return Context.getConstantStruct(ResultElts, false); + return ConstantArray::get( + ArrayType::get(ElTy, ResultElts.size()), ResultElts); + return ConstantStruct::get(Context, ResultElts, false); } @@ -7368,11 +7406,14 @@ } // Otherwise, there is padding here. Insert explicit zeros. - const Type *PadTy = Type::Int8Ty; + const Type *PadTy = Type::getInt8Ty(Context); if (AlignedEltOffs-EltOffs != 1) - PadTy = Context.getArrayType(PadTy, AlignedEltOffs-EltOffs); + PadTy = ArrayType::get(PadTy, AlignedEltOffs-EltOffs); ResultElts.insert(ResultElts.begin()+i, - Context.getNullValue(PadTy)); + Constant::getNullValue(PadTy)); + + // The padding is now element "i" and just bumped us up to "AlignedEltOffs". + EltOffs = AlignedEltOffs; ++e; // One extra element to scan. } @@ -7452,11 +7493,11 @@ // Insert enough padding to fully fill in the hole. Insert padding from // NextFieldByteStart (not LLVMNaturalByteOffset) because the padding will // not get the same alignment as "Val". - const Type *FillTy = Type::Int8Ty; + const Type *FillTy = Type::getInt8Ty(Context); if (GCCFieldOffsetInBits/8-NextFieldByteStart != 1) - FillTy = Context.getArrayType(FillTy, + FillTy = ArrayType::get(FillTy, GCCFieldOffsetInBits/8-NextFieldByteStart); - ResultElts.push_back(Context.getNullValue(FillTy)); + ResultElts.push_back(Constant::getNullValue(FillTy)); NextFieldByteStart = GCCFieldOffsetInBits/8; @@ -7483,7 +7524,7 @@ // been an anonymous bitfield or other thing that shoved it over. No matter, // just insert some i8 padding until there are bits to fill in. while (GCCFieldOffsetInBits > NextFieldByteStart*8) { - ResultElts.push_back(Context.getConstantInt(Type::Int8Ty, 0)); + ResultElts.push_back(ConstantInt::get(Type::getInt8Ty(Context), 0)); ++NextFieldByteStart; } @@ -7506,7 +7547,7 @@ if (GCCFieldOffsetInBits < NextFieldByteStart*8) { unsigned ValBitSize = ValC->getBitWidth(); assert(!ResultElts.empty() && "Bitfield starts before first element?"); - assert(ResultElts.back()->getType() == Type::Int8Ty && + assert(ResultElts.back()->getType() == Type::getInt8Ty(Context) && isa(ResultElts.back()) && "Merging bitfield with non-bitfield value?"); assert(NextFieldByteStart*8 - GCCFieldOffsetInBits < 8 && @@ -7532,7 +7573,7 @@ APInt Tmp = ValC->getValue(); Tmp = Tmp.lshr(BitsInPreviousField); Tmp = Tmp.trunc(ValBitSize-BitsInPreviousField); - ValC = Context.getConstantInt(Tmp); + ValC = ConstantInt::get(Context, Tmp); } else { // Big endian, take bits from the top of the field value. ValForPrevField = ValForPrevField.lshr(ValBitSize-BitsInPreviousField); @@ -7540,7 +7581,7 @@ APInt Tmp = ValC->getValue(); Tmp = Tmp.trunc(ValBitSize-BitsInPreviousField); - ValC = Context.getConstantInt(Tmp); + ValC = ConstantInt::get(Context, Tmp); } // Okay, we're going to insert ValForPrevField into the previous i8, extend @@ -7557,7 +7598,7 @@ // "or" in the previous value and install it. const APInt &LastElt = cast(ResultElts.back())->getValue(); - ResultElts.back() = Context.getConstantInt(ValForPrevField | LastElt); + ResultElts.back() = ConstantInt::get(Context, ValForPrevField | LastElt); // If the whole bit-field fit into the previous field, we're done. if (ValC == 0) return; @@ -7575,7 +7616,7 @@ // Little endian lays out low bits first. APInt Tmp = Val; Tmp.trunc(8); - ValToAppend = Context.getConstantInt(Tmp); + ValToAppend = ConstantInt::get(Context, Tmp); Val = Val.lshr(8); } else { @@ -7583,17 +7624,17 @@ APInt Tmp = Val; Tmp = Tmp.lshr(Tmp.getBitWidth()-8); Tmp.trunc(8); - ValToAppend = Context.getConstantInt(Tmp); + ValToAppend = ConstantInt::get(Context, Tmp); } } else if (Val.getBitWidth() == 8) { - ValToAppend = Context.getConstantInt(Val); + ValToAppend = ConstantInt::get(Context, Val); } else { APInt Tmp = Val; Tmp.zext(8); if (BYTES_BIG_ENDIAN) Tmp = Tmp << 8-Val.getBitWidth(); - ValToAppend = Context.getConstantInt(Tmp); + ValToAppend = ConstantInt::get(Context, Tmp); } ResultElts.push_back(ValToAppend); @@ -7639,10 +7680,10 @@ // If the LLVM Size is too small, add some tail padding to fill it in. if (LLVMNaturalSize < GCCStructSize) { - const Type *FillTy = Type::Int8Ty; + const Type *FillTy = Type::getInt8Ty(Context); if (GCCStructSize - NextFieldByteStart != 1) - FillTy = Context.getArrayType(FillTy, GCCStructSize - NextFieldByteStart); - ResultElts.push_back(Context.getNullValue(FillTy)); + FillTy = ArrayType::get(FillTy, GCCStructSize - NextFieldByteStart); + ResultElts.push_back(Constant::getNullValue(FillTy)); NextFieldByteStart = GCCStructSize; // At this point, we know that our struct should have the right size. @@ -7695,19 +7736,31 @@ if (!isBitfield(Field)) LayoutInfo.AddFieldToRecordConstant(Val, GCCFieldOffsetInBits); else { - assert(isa(Val) && "Can only init bitfield with constant"); + // Bitfields can only be initialized with constants (integer constant + // expressions). + ConstantInt *ValC = cast(Val); uint64_t FieldSizeInBits = getInt64(DECL_SIZE(Field), true); uint64_t ValueSizeInBits = Val->getType()->getPrimitiveSizeInBits(); + + // G++ has various bugs handling {} initializers where it doesn't + // synthesize a zero node of the right type. Instead of figuring out G++, + // just hack around it by special casing zero and allowing it to be the + // wrong size. + if (ValueSizeInBits < FieldSizeInBits && ValC->isZero()) { + APInt ValAsInt = ValC->getValue(); + ValC = ConstantInt::get(Context, ValAsInt.zext(FieldSizeInBits)); + ValueSizeInBits = FieldSizeInBits; + } + assert(ValueSizeInBits >= FieldSizeInBits && "disagreement between LLVM and GCC on bitfield size"); if (ValueSizeInBits != FieldSizeInBits) { // Fields are allowed to be smaller than their type. Simply discard // the unwanted upper bits in the field value. - APInt ValAsInt = cast(Val)->getValue(); - Val = Context.getConstantInt(ValAsInt.trunc(FieldSizeInBits)); + APInt ValAsInt = ValC->getValue(); + ValC = ConstantInt::get(Context, ValAsInt.trunc(FieldSizeInBits)); } - LayoutInfo.AddBitFieldToRecordConstant(cast(Val), - GCCFieldOffsetInBits); + LayoutInfo.AddBitFieldToRecordConstant(ValC, GCCFieldOffsetInBits); } } @@ -7720,8 +7773,8 @@ LayoutInfo.HandleTailPadding(getInt64(StructTypeSizeTree, true)); // Okay, we're done, return the computed elements. - return - Context.getConstantStruct(LayoutInfo.ResultElts, LayoutInfo.StructIsPacked); + return ConstantStruct::get(Context, LayoutInfo.ResultElts, + LayoutInfo.StructIsPacked); } Constant *TreeConstantToLLVM::ConvertUnionCONSTRUCTOR(tree exp) { @@ -7747,13 +7800,13 @@ const Type *FillTy; assert(UnionSize > InitSize && "Init shouldn't be larger than union!"); if (UnionSize - InitSize == 1) - FillTy = Type::Int8Ty; + FillTy = Type::getInt8Ty(Context); else - FillTy = Context.getArrayType(Type::Int8Ty, UnionSize - InitSize); - Elts.push_back(Context.getNullValue(FillTy)); + FillTy = ArrayType::get(Type::getInt8Ty(Context), UnionSize - InitSize); + Elts.push_back(Constant::getNullValue(FillTy)); } } - return Context.getConstantStruct(Elts, false); + return ConstantStruct::get(Context, Elts, false); } //===----------------------------------------------------------------------===// @@ -7847,7 +7900,7 @@ // itself (allowed in GCC but not in LLVM) then the global is changed to have // the type of the initializer. Correct for this now. const Type *Ty = ConvertType(TREE_TYPE(exp)); - if (Ty == Type::VoidTy) Ty = Type::Int8Ty; // void* -> i8*. + if (Ty == Type::getVoidTy(Context)) Ty = Type::getInt8Ty(Context); // void* -> i8*. return TheFolder->CreateBitCast(Val, Ty->getPointerTo()); } @@ -7868,7 +7921,7 @@ BasicBlock *BB = getLabelDeclBlock(exp); Constant *C = TheTreeToLLVM->getIndirectGotoBlockNumber(BB); return - TheFolder->CreateIntToPtr(C, Context.getPointerTypeUnqual(Type::Int8Ty)); + TheFolder->CreateIntToPtr(C, PointerType::getUnqual(Type::getInt8Ty(Context))); } Constant *TreeConstantToLLVM::EmitLV_COMPLEX_CST(tree exp) { @@ -7906,13 +7959,6 @@ GV->setAlignment(TYPE_ALIGN(TREE_TYPE(exp)) / 8); if (SlotP) *SlotP = GV; -#ifdef LLVM_CSTRING_SECTION - // For Darwin, try to put it into the .cstring section. - const TargetAsmInfo *TAI = TheTarget->getTargetAsmInfo(); - if (TAI && TAI->SectionKindForGlobal(GV) == SectionKind::RODataMergeStr) - // The Darwin linker will coalesce strings in this section. - GV->setSection(LLVM_CSTRING_SECTION); -#endif // LLVM_CSTRING_SECTION return GV; } @@ -7945,14 +7991,14 @@ Constant *IndexVal = Convert(Index); - const Type *IntPtrTy = getTargetData().getIntPtrType(); + const Type *IntPtrTy = getTargetData().getIntPtrType(Context); if (IndexVal->getType() != IntPtrTy) IndexVal = TheFolder->CreateIntCast(IndexVal, IntPtrTy, !TYPE_UNSIGNED(IndexType)); std::vector Idx; if (TREE_CODE(ArrayType) == ARRAY_TYPE) - Idx.push_back(Context.getConstantInt(IntPtrTy, 0)); + Idx.push_back(ConstantInt::get(IntPtrTy, 0)); Idx.push_back(IndexVal); return TheFolder->CreateGetElementPtr(ArrayAddr, &Idx[0], Idx.size()); @@ -7968,7 +8014,7 @@ tree FieldDecl = TREE_OPERAND(exp, 1); StructAddrLV = TheFolder->CreateBitCast(StructAddrLV, - Context.getPointerTypeUnqual(StructTy)); + PointerType::getUnqual(StructTy)); const Type *FieldTy = ConvertType(getDeclaredType(FieldDecl)); // BitStart - This is the actual offset of the field from the start of the @@ -7985,8 +8031,8 @@ Constant *Ops[] = { StructAddrLV, - Context.getNullValue(Type::Int32Ty), - Context.getConstantInt(Type::Int32Ty, MemberIndex) + Constant::getNullValue(Type::getInt32Ty(Context)), + ConstantInt::get(Type::getInt32Ty(Context), MemberIndex) }; FieldPtr = TheFolder->CreateGetElementPtr(StructAddrLV, Ops+1, 2); @@ -8006,13 +8052,13 @@ Constant *Ptr = TheFolder->CreatePtrToInt(StructAddrLV, Offset->getType()); Ptr = TheFolder->CreateAdd(Ptr, Offset); FieldPtr = TheFolder->CreateIntToPtr(Ptr, - Context.getPointerTypeUnqual(FieldTy)); + PointerType::getUnqual(FieldTy)); } // Make sure we return a result of the right type. - if (Context.getPointerTypeUnqual(FieldTy) != FieldPtr->getType()) + if (PointerType::getUnqual(FieldTy) != FieldPtr->getType()) FieldPtr = TheFolder->CreateBitCast(FieldPtr, - Context.getPointerTypeUnqual(FieldTy)); + PointerType::getUnqual(FieldTy)); assert(BitStart == 0 && "It's a bitfield reference or we didn't get to the field!"); Modified: gcc-plugin/trunk/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-debug.cpp?rev=79452&r1=79451&r2=79452&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-debug.cpp (original) +++ gcc-plugin/trunk/llvm-debug.cpp Wed Aug 19 14:49:08 2009 @@ -200,7 +200,7 @@ // Use llvm value name as linkage name if it is available. if (DECL_LLVM_SET_P(Node)) { Value *V = DECL_LLVM(Node); - return V->getNameStart(); + return V->getName().data(); } tree decl_name = DECL_NAME(Node); @@ -500,12 +500,13 @@ // FIXME - handle dynamic ranges tree MinValue = TYPE_MIN_VALUE(Domain); tree MaxValue = TYPE_MAX_VALUE(Domain); - if (MinValue && MaxValue && - isInt64(MinValue, 0) && isInt64(MaxValue, 0)) { - uint64_t Low = getINTEGER_CSTVal(MinValue); - uint64_t Hi = getINTEGER_CSTVal(MaxValue); - Subscripts.push_back(DebugFactory.GetOrCreateSubrange(Low, Hi)); - } + uint64_t Low = 0; + uint64_t Hi = 0; + if (MinValue && isInt64(MinValue, 0)) + Low = getINTEGER_CSTVal(MinValue); + if (MaxValue && isInt64(MaxValue, 0)) + Hi = getINTEGER_CSTVal(MaxValue); + Subscripts.push_back(DebugFactory.GetOrCreateSubrange(Low, Hi)); } EltTy = TREE_TYPE(atype); } @@ -589,7 +590,7 @@ // recursive) and replace all uses of the forward declaration with the // final definition. expanded_location Loc = GetNodeLocation(TREE_CHAIN(type), false); - llvm::DIType FwdDecl = + llvm::DICompositeType FwdDecl = DebugFactory.CreateCompositeType(Tag, findRegion(type), GetNodeName(type), @@ -698,7 +699,7 @@ llvm::DIArray Elements = DebugFactory.GetOrCreateArray(EltTys.data(), EltTys.size()); - llvm::DIType RealDecl = + llvm::DICompositeType RealDecl = DebugFactory.CreateCompositeType(Tag, findRegion(type), GetNodeName(type), getOrCreateCompileUnit(Loc.file), @@ -709,8 +710,7 @@ // Now that we have a real decl for the struct, replace anything using the // old decl with the new one. This will recursively update the debug info. - FwdDecl.getGV()->replaceAllUsesWith(RealDecl.getGV()); - FwdDecl.getGV()->eraseFromParent(); + FwdDecl.replaceAllUsesWith(RealDecl); return RealDecl; } Modified: gcc-plugin/trunk/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=79452&r1=79451&r2=79452&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-internal.h (original) +++ gcc-plugin/trunk/llvm-internal.h Wed Aug 19 14:49:08 2009 @@ -28,6 +28,7 @@ #define LLVM_INTERNAL_H // LLVM headers +#include "llvm/CallingConv.h" #include "llvm/Intrinsics.h" #include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/SmallVector.h" @@ -151,7 +152,7 @@ const FunctionType *ConvertFunctionType(tree_node *type, tree_node *decl, tree_node *static_chain, - unsigned &CallingConv, + CallingConv::ID &CallingConv, AttrListPtr &PAL); /// ConvertArgListToFnType - Given a DECL_ARGUMENTS list on an GCC tree, @@ -160,7 +161,7 @@ const FunctionType *ConvertArgListToFnType(tree_node *type, tree_node *arglist, tree_node *static_chain, - unsigned &CallingConv, + CallingConv::ID &CallingConv, AttrListPtr &PAL); private: @@ -445,6 +446,12 @@ Value *EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align); Value *EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align); + /// EmitSjLjDispatcher - Emit SJLJ EH dispatcher + void EmitSjLjDispatcher(); + + /// EmitSjLjLandingPads - Emit SJLJ EH landing pads. + void EmitSjLjLandingPads(); + /// EmitLandingPads - Emit EH landing pads. void EmitLandingPads(); Modified: gcc-plugin/trunk/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-types.cpp?rev=79452&r1=79451&r2=79452&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-types.cpp (original) +++ gcc-plugin/trunk/llvm-types.cpp Wed Aug 19 14:49:08 2009 @@ -169,11 +169,11 @@ //TODO } //TODO //TODO const std::string &TypeName = TypeNameMap[*I]; -//TODO LTypesNames.push_back(Context.getConstantArray(TypeName, false)); +//TODO LTypesNames.push_back(ConstantArray::get(Context, TypeName, false)); //TODO } //TODO //TODO // Create string table. -//TODO Constant *LTypesNameTable = Context.getConstantStruct(LTypesNames, false); +//TODO Constant *LTypesNameTable = ConstantStruct::get(Context, LTypesNames, false); //TODO //TODO // Create variable to hold this string table. //TODO GlobalVariable *GV = new GlobalVariable(*TheModule, @@ -204,7 +204,7 @@ for (unsigned i = 0, e = ArgTys.size(); i != e; ++i) ArgTysP.push_back(ArgTys[i]); - return Context.getFunctionType(Res, ArgTysP, isVarArg); + return FunctionType::get(Res, ArgTysP, isVarArg); } //===----------------------------------------------------------------------===// @@ -672,7 +672,7 @@ //===----------------------------------------------------------------------===// const Type *TypeConverter::ConvertType(tree orig_type) { - if (orig_type == error_mark_node) return Type::Int32Ty; + if (orig_type == error_mark_node) return Type::getInt32Ty(Context); // LLVM doesn't care about variants such as const, volatile, or restrict. tree type = TYPE_MAIN_VARIANT(orig_type); @@ -682,7 +682,7 @@ fprintf(stderr, "Unknown type to convert:\n"); debug_tree(type); abort(); - case VOID_TYPE: return SET_TYPE_LLVM(type, Type::VoidTy); + case VOID_TYPE: return SET_TYPE_LLVM(type, Type::getVoidTy(Context)); case RECORD_TYPE: return ConvertRECORD(type, orig_type); case QUAL_UNION_TYPE: case UNION_TYPE: return ConvertUNION(type, orig_type); @@ -690,7 +690,7 @@ if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty; return SET_TYPE_LLVM(type, - Context.getIntegerType(TREE_INT_CST_LOW(TYPE_SIZE(type)))); + IntegerType::get(Context, TREE_INT_CST_LOW(TYPE_SIZE(type)))); } case ENUMERAL_TYPE: // Use of an enum that is implicitly declared? @@ -699,15 +699,19 @@ if (const Type *Ty = GET_TYPE_LLVM(orig_type)) return Ty; - const Type *Ty = Context.getOpaqueType(); + const Type *Ty = OpaqueType::get(Context); TheModule->addTypeName(GetTypeName("enum.", orig_type), Ty); return TypeDB.setType(orig_type, Ty); } // FALL THROUGH. type = orig_type; - case INTEGER_TYPE: + case INTEGER_TYPE: { if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty; - return SET_TYPE_LLVM(type, Context.getIntegerType(TYPE_PRECISION(type))); + // The ARM port defines __builtin_neon_xi as a 511-bit type because GCC's + // type precision field has only 9 bits. Treat this as a special case. + int precision = TYPE_PRECISION(type) == 511 ? 512 : TYPE_PRECISION(type); + return SET_TYPE_LLVM(type, IntegerType::get(Context, precision)); + } case REAL_TYPE: if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty; switch (TYPE_PRECISION(type)) { @@ -715,20 +719,20 @@ fprintf(stderr, "Unknown FP type!\n"); debug_tree(type); abort(); - case 32: return SET_TYPE_LLVM(type, Type::FloatTy); - case 64: return SET_TYPE_LLVM(type, Type::DoubleTy); - case 80: return SET_TYPE_LLVM(type, Type::X86_FP80Ty); + case 32: return SET_TYPE_LLVM(type, Type::getFloatTy(Context)); + case 64: return SET_TYPE_LLVM(type, Type::getDoubleTy(Context)); + case 80: return SET_TYPE_LLVM(type, Type::getX86_FP80Ty(Context)); case 128: #ifdef TARGET_POWERPC - return SET_TYPE_LLVM(type, Type::PPC_FP128Ty); + return SET_TYPE_LLVM(type, Type::getPPC_FP128Ty(Context)); #elif 0 // This is for IEEE double extended, e.g. Sparc - return SET_TYPE_LLVM(type, Type::FP128Ty); + return SET_TYPE_LLVM(type, Type::getFP128Ty(Context)); #else // 128-bit long doubles map onto { double, double }. return SET_TYPE_LLVM(type, - Context.getStructType(Type::DoubleTy, Type::DoubleTy, - NULL)); + StructType::get(Context, Type::getDoubleTy(Context), + Type::getDoubleTy(Context), NULL)); #endif } @@ -736,13 +740,13 @@ if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty; const Type *Ty = ConvertType(TREE_TYPE(type)); assert(!Ty->isAbstract() && "should use TypeDB.setType()"); - return SET_TYPE_LLVM(type, Context.getStructType(Ty, Ty, NULL)); + return SET_TYPE_LLVM(type, StructType::get(Context, Ty, Ty, NULL)); } case VECTOR_TYPE: { if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty; const Type *Ty = ConvertType(TREE_TYPE(type)); assert(!Ty->isAbstract() && "should use TypeDB.setType()"); - Ty = Context.getVectorType(Ty, TYPE_VECTOR_SUBPARTS(type)); + Ty = VectorType::get(Ty, TYPE_VECTOR_SUBPARTS(type)); return SET_TYPE_LLVM(type, Ty); } @@ -779,8 +783,8 @@ // Restore ConvertingStruct for the caller. ConvertingStruct = false; - if (Actual->getTypeID() == Type::VoidTyID) - Actual = Type::Int8Ty; // void* -> sbyte* + if (Actual == Type::getVoidTy(Context)) + Actual = Type::getInt8Ty(Context); // void* -> sbyte* // Update the type, potentially updating TYPE_LLVM(type). const OpaqueType *OT = cast(Ty->getElementType()); @@ -798,7 +802,7 @@ if (Ty == 0) { PointersToReresolve.push_back(type); return TypeDB.setType(type, - Context.getPointerTypeUnqual(Context.getOpaqueType())); + PointerType::getUnqual(OpaqueType::get(Context))); } // A type has already been computed. However, this may be some sort of @@ -814,9 +818,9 @@ Ty = ConvertType(TREE_TYPE(type)); } - if (Ty->getTypeID() == Type::VoidTyID) - Ty = Type::Int8Ty; // void* -> sbyte* - return TypeDB.setType(type, Context.getPointerTypeUnqual(Ty)); + if (Ty == Type::getVoidTy(Context)) + Ty = Type::getInt8Ty(Context); // void* -> sbyte* + return TypeDB.setType(type, PointerType::getUnqual(Ty)); } case METHOD_TYPE: @@ -825,7 +829,7 @@ return Ty; // No declaration to pass through, passing NULL. - unsigned CallingConv; + CallingConv::ID CallingConv; AttrListPtr PAL; return TypeDB.setType(type, ConvertFunctionType(type, NULL, NULL, CallingConv, PAL)); @@ -847,7 +851,7 @@ // that the gcc array type has constant size, using an i8 for the element // type ensures we can produce an LLVM array of the right size. ElementSize = 8; - ElementTy = Type::Int8Ty; + ElementTy = Type::getInt8Ty(Context); } uint64_t NumElements; @@ -878,7 +882,7 @@ NumElements /= ElementSize; } - return TypeDB.setType(type, Context.getArrayType(ElementTy, NumElements)); + return TypeDB.setType(type, ArrayType::get(ElementTy, NumElements)); } case OFFSET_TYPE: // Handle OFFSET_TYPE specially. This is used for pointers to members, @@ -886,8 +890,8 @@ // integer directly. switch (getTargetData().getPointerSize()) { default: assert(0 && "Unknown pointer size!"); - case 4: return Type::Int32Ty; - case 8: return Type::Int64Ty; + case 4: return Type::getInt32Ty(Context); + case 8: return Type::getInt64Ty(Context); } } } @@ -900,18 +904,21 @@ class FunctionTypeConversion : public DefaultABIClient { PATypeHolder &RetTy; std::vector &ArgTypes; - unsigned &CallingConv; + CallingConv::ID &CallingConv; bool isShadowRet; bool KNRPromotion; unsigned Offset; public: FunctionTypeConversion(PATypeHolder &retty, std::vector &AT, - unsigned &CC, bool KNR) + CallingConv::ID &CC, bool KNR) : RetTy(retty), ArgTypes(AT), CallingConv(CC), KNRPromotion(KNR), Offset(0) { CallingConv = CallingConv::C; isShadowRet = false; } + /// getCallingConv - This provides the desired CallingConv for the function. + CallingConv::ID& getCallingConv(void) { return CallingConv; } + bool isShadowReturn() const { return isShadowRet; } /// HandleScalarResult - This callback is invoked if the function returns a @@ -938,7 +945,7 @@ void HandleShadowResult(const PointerType *PtrArgTy, bool RetPtr) { // This function either returns void or the shadow argument, // depending on the target. - RetTy = RetPtr ? PtrArgTy : Type::VoidTy; + RetTy = RetPtr ? PtrArgTy : Type::getVoidTy(Context); // In any case, there is a dummy shadow argument though! ArgTypes.push_back(PtrArgTy); @@ -969,9 +976,9 @@ if (KNRPromotion) { if (type == float_type_node) LLVMTy = ConvertType(double_type_node); - else if (LLVMTy == Type::Int16Ty || LLVMTy == Type::Int8Ty || - LLVMTy == Type::Int1Ty) - LLVMTy = Type::Int32Ty; + else if (LLVMTy == Type::getInt16Ty(Context) || LLVMTy == Type::getInt8Ty(Context) || + LLVMTy == Type::getInt1Ty(Context)) + LLVMTy = Type::getInt32Ty(Context); } ArgTypes.push_back(LLVMTy); } @@ -986,7 +993,7 @@ /// argument is passed by value. It is lowered to a parameter passed by /// reference with an additional parameter attribute "ByVal". void HandleByValArgument(const llvm::Type *LLVMTy, tree type) { - HandleScalarArgument(Context.getPointerTypeUnqual(LLVMTy), type); + HandleScalarArgument(PointerType::getUnqual(LLVMTy), type); } /// HandleFCAArgument - This callback is invoked if the aggregate function @@ -1021,10 +1028,10 @@ /// specified result type for the function. const FunctionType *TypeConverter:: ConvertArgListToFnType(tree type, tree Args, tree static_chain, - unsigned &CallingConv, AttrListPtr &PAL) { + CallingConv::ID &CallingConv, AttrListPtr &PAL) { tree ReturnType = TREE_TYPE(type); std::vector ArgTys; - PATypeHolder RetTy(Type::VoidTy); + PATypeHolder RetTy(Type::getVoidTy(Context)); FunctionTypeConversion Client(RetTy, ArgTys, CallingConv, true /*K&R*/); TheLLVMABI ABIConverter(Client); @@ -1085,8 +1092,8 @@ const FunctionType *TypeConverter:: ConvertFunctionType(tree type, tree decl, tree static_chain, - unsigned &CallingConv, AttrListPtr &PAL) { - PATypeHolder RetTy = Type::VoidTy; + CallingConv::ID &CallingConv, AttrListPtr &PAL) { + PATypeHolder RetTy = Type::getVoidTy(Context); std::vector ArgTypes; bool isVarArg = false; FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv, false/*not K&R*/); @@ -1331,7 +1338,7 @@ const Type *getLLVMType() const { // Use Packed type if Packed is set or all struct fields are bitfields. // Empty struct is not packed unless packed is set. - return Context.getStructType(Elements, + return StructType::get(Context, Elements, Packed || (!Elements.empty() && AllBitFields)); } @@ -1370,13 +1377,13 @@ const Type *LastType = Elements.back(); unsigned PadBytes = 0; - if (LastType == Type::Int8Ty) + if (LastType == Type::getInt8Ty(Context)) PadBytes = 1 - NoOfBytesToRemove; - else if (LastType == Type::Int16Ty) + else if (LastType == Type::getInt16Ty(Context)) PadBytes = 2 - NoOfBytesToRemove; - else if (LastType == Type::Int32Ty) + else if (LastType == Type::getInt32Ty(Context)) PadBytes = 4 - NoOfBytesToRemove; - else if (LastType == Type::Int64Ty) + else if (LastType == Type::getInt64Ty(Context)) PadBytes = 8 - NoOfBytesToRemove; else return; @@ -1384,7 +1391,7 @@ assert (PadBytes > 0 && "Unable to remove extra bytes"); // Update last element type and size, element offset is unchanged. - const Type *Pad = Context.getArrayType(Type::Int8Ty, PadBytes); + const Type *Pad = ArrayType::get(Type::getInt8Ty(Context), PadBytes); unsigned OriginalSize = ElementSizeInBytes.back(); Elements.pop_back(); Elements.push_back(Pad); @@ -1419,9 +1426,9 @@ // field we just popped. Otherwise we might end up with a // gcc non-bitfield being mapped to an LLVM field with a // different offset. - const Type *Pad = Type::Int8Ty; + const Type *Pad = Type::getInt8Ty(Context); if (PoppedOffset != EndOffset + 1) - Pad = Context.getArrayType(Pad, PoppedOffset - EndOffset); + Pad = ArrayType::get(Pad, PoppedOffset - EndOffset); addElement(Pad, EndOffset, PoppedOffset - EndOffset); } } @@ -1442,7 +1449,7 @@ // padding. if (NextByteOffset < ByteOffset) { uint64_t CurOffset = getNewElementByteOffset(1); - const Type *Pad = Type::Int8Ty; + const Type *Pad = Type::getInt8Ty(Context); if (SavedTy && LastFieldStartsAtNonByteBoundry) // We want to reuse SavedType to access this bit field. // e.g. struct __attribute__((packed)) { @@ -1453,7 +1460,7 @@ // In this example, previous field is C and D is current field. addElement(SavedTy, CurOffset, ByteOffset - CurOffset); else if (ByteOffset - CurOffset != 1) - Pad = Context.getArrayType(Pad, ByteOffset - CurOffset); + Pad = ArrayType::get(Pad, ByteOffset - CurOffset); addElement(Pad, CurOffset, ByteOffset - CurOffset); } return true; @@ -1579,21 +1586,21 @@ // additional bits required after FirstunallocatedByte to cover new field. const Type *NewFieldTy; if (Size <= 8) - NewFieldTy = Type::Int8Ty; + NewFieldTy = Type::getInt8Ty(Context); else if (Size <= 16) - NewFieldTy = Type::Int16Ty; + NewFieldTy = Type::getInt16Ty(Context); else if (Size <= 32) - NewFieldTy = Type::Int32Ty; + NewFieldTy = Type::getInt32Ty(Context); else { assert(Size <= 64 && "Bitfield too large!"); - NewFieldTy = Type::Int64Ty; + NewFieldTy = Type::getInt64Ty(Context); } // Check that the alignment of NewFieldTy won't cause a gap in the structure! unsigned ByteAlignment = getTypeAlignment(NewFieldTy); if (FirstUnallocatedByte & (ByteAlignment-1)) { // Instead of inserting a nice whole field, insert a small array of ubytes. - NewFieldTy = Context.getArrayType(Type::Int8Ty, (Size+7)/8); + NewFieldTy = ArrayType::get(Type::getInt8Ty(Context), (Size+7)/8); } // Finally, add the new field. @@ -1824,9 +1831,9 @@ PadBytes = StartOffsetInBits/8-FirstUnallocatedByte; if (PadBytes) { - const Type *Pad = Type::Int8Ty; + const Type *Pad = Type::getInt8Ty(Context); if (PadBytes != 1) - Pad = Context.getArrayType(Pad, PadBytes); + Pad = ArrayType::get(Pad, PadBytes); Info.addElement(Pad, FirstUnallocatedByte, PadBytes); } @@ -1878,7 +1885,7 @@ } if (TYPE_SIZE(type) == 0) { // Forward declaration? - const Type *Ty = Context.getOpaqueType(); + const Type *Ty = OpaqueType::get(Context); TheModule->addTypeName(GetTypeName("struct.", orig_type), Ty); return TypeDB.setType(type, Ty); } @@ -1928,20 +1935,20 @@ // If only one byte is needed then insert i8. if (GCCTypeSize-LLVMLastElementEnd == 1) - Info->addElement(Type::Int8Ty, 1, 1); + Info->addElement(Type::getInt8Ty(Context), 1, 1); else { if (((GCCTypeSize-LLVMStructSize) % 4) == 0 && (Info->getAlignmentAsLLVMStruct() % - Info->getTypeAlignment(Type::Int32Ty)) == 0) { + Info->getTypeAlignment(Type::getInt32Ty(Context))) == 0) { // insert array of i32 unsigned Int32ArraySize = (GCCTypeSize-LLVMStructSize)/4; const Type *PadTy = - Context.getArrayType(Type::Int32Ty, Int32ArraySize); + ArrayType::get(Type::getInt32Ty(Context), Int32ArraySize); Info->addElement(PadTy, GCCTypeSize - LLVMLastElementEnd, Int32ArraySize, true /* Padding Element */); } else { const Type *PadTy = - Context.getArrayType(Type::Int8Ty, GCCTypeSize-LLVMStructSize); + ArrayType::get(Type::getInt8Ty(Context), GCCTypeSize-LLVMStructSize); Info->addElement(PadTy, GCCTypeSize - LLVMLastElementEnd, GCCTypeSize - LLVMLastElementEnd, true /* Padding Element */); @@ -2046,7 +2053,7 @@ } if (TYPE_SIZE(type) == 0) { // Forward declaraion? - const Type *Ty = Context.getOpaqueType(); + const Type *Ty = OpaqueType::get(Context); TheModule->addTypeName(GetTypeName("union.", orig_type), Ty); return TypeDB.setType(type, Ty); } @@ -2172,15 +2179,15 @@ if (EltSize != GCCTypeSize) { assert(EltSize < GCCTypeSize && "LLVM type size doesn't match GCC type size!"); - const Type *PadTy = Type::Int8Ty; + const Type *PadTy = Type::getInt8Ty(Context); if (GCCTypeSize-EltSize != 1) - PadTy = Context.getArrayType(PadTy, GCCTypeSize-EltSize); + PadTy = ArrayType::get(PadTy, GCCTypeSize-EltSize); UnionElts.push_back(PadTy); } } bool isPacked = 8 * EltAlign > TYPE_ALIGN(type); - const Type *ResultTy = Context.getStructType(UnionElts, isPacked); + const Type *ResultTy = StructType::get(Context, UnionElts, isPacked); const OpaqueType *OldTy = cast_or_null(GET_TYPE_LLVM(type)); TypeDB.setType(type, ResultTy); From eli.friedman at gmail.com Wed Aug 19 14:50:30 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 19 Aug 2009 12:50:30 -0700 Subject: [llvm-commits] [llvm] r79447 - /llvm/trunk/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll In-Reply-To: <200908191851.n7JIpkUt017258@zion.cs.uiuc.edu> References: <200908191851.n7JIpkUt017258@zion.cs.uiuc.edu> Message-ID: On Wed, Aug 19, 2009 at 11:51 AM, Bill Wendling wrote: > Author: void > Date: Wed Aug 19 13:51:45 2009 > New Revision: 79447 > > URL: http://llvm.org/viewvc/llvm-project?rev=79447&view=rev > Log: > Make this test platform neutral. Thanks. -Eli From daniel at zuster.org Wed Aug 19 14:57:55 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 19:57:55 -0000 Subject: [llvm-commits] [llvm] r79453 - /llvm/trunk/include/llvm/ADT/SmallString.h Message-ID: <200908191957.n7JJvt7L025571@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 14:57:55 2009 New Revision: 79453 URL: http://llvm.org/viewvc/llvm-project?rev=79453&view=rev Log: Add SmallString::str (which returns a StringRef); this is more efficient than c_str(). Modified: llvm/trunk/include/llvm/ADT/SmallString.h Modified: llvm/trunk/include/llvm/ADT/SmallString.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallString.h?rev=79453&r1=79452&r2=79453&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallString.h (original) +++ llvm/trunk/include/llvm/ADT/SmallString.h Wed Aug 19 14:57:55 2009 @@ -15,6 +15,7 @@ #define LLVM_ADT_SMALLSTRING_H #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" #include @@ -45,6 +46,8 @@ return this->begin(); } + StringRef str() const { return StringRef(this->begin(), this->size()); } + // Extra operators. const SmallString &operator=(const char *RHS) { this->clear(); From daniel at zuster.org Wed Aug 19 14:58:19 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 19:58:19 -0000 Subject: [llvm-commits] [llvm] r79454 - /llvm/trunk/unittests/Support/raw_ostream_test.cpp Message-ID: <200908191958.n7JJwJOe025634@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 14:58:19 2009 New Revision: 79454 URL: http://llvm.org/viewvc/llvm-project?rev=79454&view=rev Log: Add min and max tests. Modified: llvm/trunk/unittests/Support/raw_ostream_test.cpp Modified: llvm/trunk/unittests/Support/raw_ostream_test.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/raw_ostream_test.cpp?rev=79454&r1=79453&r2=79454&view=diff ============================================================================== --- llvm/trunk/unittests/Support/raw_ostream_test.cpp (original) +++ llvm/trunk/unittests/Support/raw_ostream_test.cpp Wed Aug 19 14:58:19 2009 @@ -53,6 +53,10 @@ EXPECT_EQ("0x0", printToString((void*) 0)); EXPECT_EQ("0xbeef", printToString((void*) 0xbeef)); EXPECT_EQ("0xdeadbeef", printToString((void*) 0xdeadbeef)); + + // Min and max. + EXPECT_EQ("18446744073709551615", printToString(UINT64_MAX)); + EXPECT_EQ("-9223372036854775808", printToString(INT64_MIN)); } TEST(raw_ostreamTest, Types_Unbuffered) { @@ -80,6 +84,10 @@ EXPECT_EQ("0x0", printToStringUnbuffered((void*) 0)); EXPECT_EQ("0xbeef", printToStringUnbuffered((void*) 0xbeef)); EXPECT_EQ("0xdeadbeef", printToStringUnbuffered((void*) 0xdeadbeef)); + + // Min and max. + EXPECT_EQ("18446744073709551615", printToStringUnbuffered(UINT64_MAX)); + EXPECT_EQ("-9223372036854775808", printToStringUnbuffered(INT64_MIN)); } } From daniel at zuster.org Wed Aug 19 15:07:04 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 20:07:04 -0000 Subject: [llvm-commits] [llvm] r79456 - in /llvm/trunk: include/llvm/ADT/SmallString.h lib/Bitcode/Reader/BitcodeReader.cpp lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Support/APInt.cpp lib/Support/PrettyStackTrace.cpp Message-ID: <200908192007.n7JK74Go026772@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 15:07:03 2009 New Revision: 79456 URL: http://llvm.org/viewvc/llvm-project?rev=79456&view=rev Log: Switch to SmallString::str from SmallString::c_str, and remove SmallString::c_str. Modified: llvm/trunk/include/llvm/ADT/SmallString.h llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/Support/APInt.cpp llvm/trunk/lib/Support/PrettyStackTrace.cpp Modified: llvm/trunk/include/llvm/ADT/SmallString.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallString.h?rev=79456&r1=79455&r2=79456&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallString.h (original) +++ llvm/trunk/include/llvm/ADT/SmallString.h Wed Aug 19 15:07:03 2009 @@ -38,14 +38,6 @@ // Extra methods. - const char *c_str() const { - SmallString *This = const_cast(this); - // Ensure that there is a \0 at the end of the string. - This->reserve(this->size()+1); - This->End[0] = 0; - return this->begin(); - } - StringRef str() const { return StringRef(this->begin(), this->size()); } // Extra operators. Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=79456&r1=79455&r2=79456&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Aug 19 15:07:03 2009 @@ -792,7 +792,7 @@ if (MetadataBase *B = dyn_cast(MD)) Elts.push_back(B); } - Value *V = NamedMDNode::Create(Context, Name.c_str(), Elts.data(), + Value *V = NamedMDNode::Create(Context, Name.str(), Elts.data(), Elts.size(), TheModule); MDValueList.AssignValue(V, NextValueNo++); break; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=79456&r1=79455&r2=79456&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Aug 19 15:07:03 2009 @@ -867,7 +867,7 @@ SmallString<40> S; ptrMask.toStringUnsigned(S); - O << ") & " << S.c_str() << ')'; + O << ") & " << S.str() << ')'; break; } case Instruction::Add: @@ -1286,7 +1286,7 @@ SmallString<40> S; CI->getValue().toStringUnsigned(S, 16); O.PadToColumn(TAI->getCommentColumn()); - O << TAI->getCommentString() << " 0x" << S.c_str(); + O << TAI->getCommentString() << " 0x" << S.str(); } } O << '\n'; Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=79456&r1=79455&r2=79456&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Wed Aug 19 15:07:03 2009 @@ -2168,7 +2168,7 @@ std::string APInt::toString(unsigned Radix = 10, bool Signed = true) const { SmallString<40> S; toString(S, Radix, Signed); - return S.c_str(); + return S.str(); } @@ -2176,13 +2176,14 @@ SmallString<40> S, U; this->toStringUnsigned(U); this->toStringSigned(S); - fprintf(stderr, "APInt(%db, %su %ss)", BitWidth, U.c_str(), S.c_str()); + errs() << "APInt(" << BitWidth << "b, " + << U.str() << "u " << S.str() << "s)"; } void APInt::print(raw_ostream &OS, bool isSigned) const { SmallString<40> S; this->toString(S, 10, isSigned); - OS << S.c_str(); + OS << S.str(); } std::ostream &llvm::operator<<(std::ostream &o, const APInt &I) { Modified: llvm/trunk/lib/Support/PrettyStackTrace.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PrettyStackTrace.cpp?rev=79456&r1=79455&r2=79456&view=diff ============================================================================== --- llvm/trunk/lib/Support/PrettyStackTrace.cpp (original) +++ llvm/trunk/lib/Support/PrettyStackTrace.cpp Wed Aug 19 15:07:03 2009 @@ -71,8 +71,8 @@ } if (!TmpStr.empty()) { - __crashreporter_info__ = strdup(TmpStr.c_str()); - errs() << __crashreporter_info__; + __crashreporter_info__ = strdup(std::string(TmpStr.str()).c_str()); + errs() << TmpStr.str(); } #endif From daniel at zuster.org Wed Aug 19 15:08:02 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 20:08:02 -0000 Subject: [llvm-commits] [llvm] r79457 - in /llvm/trunk: lib/Target/Blackfin/ lib/Target/Blackfin/AsmPrinter/ lib/Target/Blackfin/TargetInfo/ utils/FileUpdate/ Message-ID: <200908192008.n7JK82W1026907@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 15:08:02 2009 New Revision: 79457 URL: http://llvm.org/viewvc/llvm-project?rev=79457&view=rev Log: Tweak svn:ignore Modified: llvm/trunk/lib/Target/Blackfin/ (props changed) llvm/trunk/lib/Target/Blackfin/AsmPrinter/ (props changed) llvm/trunk/lib/Target/Blackfin/TargetInfo/ (props changed) llvm/trunk/utils/FileUpdate/ (props changed) Propchange: llvm/trunk/lib/Target/Blackfin/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Aug 19 15:08:02 2009 @@ -10,3 +10,4 @@ BlackfinGenRegisterInfo.inc BlackfinGenRegisterNames.inc BlackfinGenSubtarget.inc +Debug+Checks Propchange: llvm/trunk/lib/Target/Blackfin/AsmPrinter/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Aug 19 15:08:02 2009 @@ -1,3 +1,4 @@ Debug Release-Asserts Release +Debug+Checks Propchange: llvm/trunk/lib/Target/Blackfin/TargetInfo/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Aug 19 15:08:02 2009 @@ -1,3 +1,4 @@ Debug Release-Asserts Release +Debug+Checks Propchange: llvm/trunk/utils/FileUpdate/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Aug 19 15:08:02 2009 @@ -1,3 +1,4 @@ Debug Release-Asserts Release +Debug+Checks From eli.friedman at gmail.com Wed Aug 19 15:12:24 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 19 Aug 2009 13:12:24 -0700 Subject: [llvm-commits] [llvm] r79439 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/live-out-reg-info.ll test/CodeGen/X86/test-shrink.ll In-Reply-To: <200908191816.n7JIGJfC012754@zion.cs.uiuc.edu> References: <200908191816.n7JIGJfC012754@zion.cs.uiuc.edu> Message-ID: On Wed, Aug 19, 2009 at 11:16 AM, Dan Gohman wrote: > Author: djg > Date: Wed Aug 19 13:16:17 2009 > New Revision: 79439 > > URL: http://llvm.org/viewvc/llvm-project?rev=79439&view=rev > Log: > Add an x86 peep that narrows TEST instructions to forms that use > a smaller encoding. These kinds of patterns are very frequent in > sqlite3, for example. Hmm... the one issue I can think of is that the way it's implemented, this might actually make the code worse if the operand is in memory; have you thought about that at all? -Eli From gohman at apple.com Wed Aug 19 15:24:47 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 13:24:47 -0700 Subject: [llvm-commits] [llvm] r79439 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/live-out-reg-info.ll test/CodeGen/X86/test-shrink.ll In-Reply-To: References: <200908191816.n7JIGJfC012754@zion.cs.uiuc.edu> Message-ID: <6BAD6AB5-51EA-4328-8C1A-23D000AF1DAE@apple.com> On Aug 19, 2009, at 1:12 PM, Eli Friedman wrote: > On Wed, Aug 19, 2009 at 11:16 AM, Dan Gohman wrote: > >> Author: djg >> >> Date: Wed Aug 19 13:16:17 2009 >> >> New Revision: 79439 >> >> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=79439&view=rev >> >> Log: >> >> Add an x86 peep that narrows TEST instructions to forms that use >> >> a smaller encoding. These kinds of patterns are very frequent in >> >> sqlite3, for example. >> > > Hmm... the one issue I can think of is that the way it's implemented, > this might actually make the code worse if the operand is in memory; > have you thought about that at all? The DAGCombiner already shrinks loads and optionally adjusts the addresses in order to do comparisons on smaller types. It would be possible to do these new transforms as target-specific DAGCombines, but handling the h-register case that way would be awkward. Dan From gohman at apple.com Wed Aug 19 15:27:57 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 20:27:57 -0000 Subject: [llvm-commits] [llvm] r79458 - /llvm/trunk/include/llvm/Support/raw_ostream.h Message-ID: <200908192027.n7JKRvgT029413@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 15:27:57 2009 New Revision: 79458 URL: http://llvm.org/viewvc/llvm-project?rev=79458&view=rev Log: Unbreak GetBufferSize() on uninitialized streams. This fixes a problem that led to errs() getting made buffered. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=79458&r1=79457&r2=79458&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Wed Aug 19 15:27:57 2009 @@ -123,7 +123,7 @@ size_t GetBufferSize() { // If we're supposed to be buffered but haven't actually gotten around // to allocating the buffer yet, return the value that would be used. - if (!Unbuffered && !OutBufStart) + if (BufferMode != Unbuffered && OutBufStart == 0) return preferred_buffer_size(); // Otherwise just return the size of the allocated buffer. From eli.friedman at gmail.com Wed Aug 19 15:46:04 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 19 Aug 2009 20:46:04 -0000 Subject: [llvm-commits] [llvm] r79461 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp Message-ID: <200908192046.n7JKk44C031705@zion.cs.uiuc.edu> Author: efriedma Date: Wed Aug 19 15:46:03 2009 New Revision: 79461 URL: http://llvm.org/viewvc/llvm-project?rev=79461&view=rev Log: Add triple parsing support for TCE. Modified: llvm/trunk/include/llvm/ADT/Triple.h llvm/trunk/lib/Support/Triple.cpp Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=79461&r1=79460&r2=79461&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Wed Aug 19 15:46:03 2009 @@ -62,6 +62,7 @@ ppc64, // PPC64: powerpc64 sparc, // Sparc: sparc systemz, // SystemZ: s390x + tce, // TCE (http://tce.cs.tut.fi/): tce thumb, // Thumb: thumb, thumbv.* x86, // X86: i[3-9]86 x86_64, // X86-64: amd64, x86_64 Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=79461&r1=79460&r2=79461&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Wed Aug 19 15:46:03 2009 @@ -33,6 +33,7 @@ case ppc: return "powerpc"; case sparc: return "sparc"; case systemz: return "s390x"; + case tce: return "tce"; case thumb: return "thumb"; case x86: return "i386"; case x86_64: return "x86_64"; @@ -99,6 +100,8 @@ return sparc; if (Name == "systemz") return systemz; + if (Name == "tce") + return tce; if (Name == "thumb") return thumb; if (Name == "x86") @@ -156,6 +159,8 @@ Arch = sparc; else if (ArchName == "s390x") Arch = systemz; + else if (ArchName == "tce") + Arch = tce; else Arch = UnknownArch; From greened at obbligato.org Wed Aug 19 15:52:55 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 20:52:55 -0000 Subject: [llvm-commits] [llvm] r79463 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200908192052.n7JKqtnC032562@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 15:52:54 2009 New Revision: 79463 URL: http://llvm.org/viewvc/llvm-project?rev=79463&view=rev Log: Add missing header. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=79463&r1=79462&r2=79463&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Aug 19 15:52:54 2009 @@ -20,6 +20,7 @@ #ifndef LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H #define LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/LiveInterval.h" #include "llvm/ADT/BitVector.h" From daniel at zuster.org Wed Aug 19 16:09:45 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 21:09:45 -0000 Subject: [llvm-commits] [llvm] r79465 - /llvm/trunk/Makefile Message-ID: <200908192109.n7JL9jdF002231@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 16:09:45 2009 New Revision: 79465 URL: http://llvm.org/viewvc/llvm-project?rev=79465&view=rev Log: Build runtime libraries by default. Modified: llvm/trunk/Makefile Modified: llvm/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile?rev=79465&r1=79464&r2=79465&view=diff ============================================================================== --- llvm/trunk/Makefile (original) +++ llvm/trunk/Makefile Wed Aug 19 16:09:45 2009 @@ -36,7 +36,7 @@ # FIXME: Remove runtime entirely once we have an understanding of where # libprofile etc should go. #ifeq ($(LLVMGCC_MAJVERS),4) - DIRS := $(filter-out runtime, $(DIRS)) +# DIRS := $(filter-out runtime, $(DIRS)) #endif ifeq ($(MAKECMDGOALS),libs-only) From greened at obbligato.org Wed Aug 19 16:17:28 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 21:17:28 -0000 Subject: [llvm-commits] [llvm] r79467 - /llvm/trunk/include/llvm/CodeGen/LiveVariables.h Message-ID: <200908192117.n7JLHSIa003182@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 16:17:28 2009 New Revision: 79467 URL: http://llvm.org/viewvc/llvm-project?rev=79467&view=rev Log: Add missing includes. Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=79467&r1=79466&r2=79467&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Wed Aug 19 16:17:28 2009 @@ -29,7 +29,9 @@ #ifndef LLVM_CODEGEN_LIVEVARIABLES_H #define LLVM_CODEGEN_LIVEVARIABLES_H +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineInstr.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" From greened at obbligato.org Wed Aug 19 16:19:41 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 21:19:41 -0000 Subject: [llvm-commits] [llvm] r79468 - /llvm/trunk/include/llvm/CodeGen/MachineDominators.h Message-ID: <200908192119.n7JLJf6o003455@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 16:19:41 2009 New Revision: 79468 URL: http://llvm.org/viewvc/llvm-project?rev=79468&view=rev Log: Add missing includes. Modified: llvm/trunk/include/llvm/CodeGen/MachineDominators.h Modified: llvm/trunk/include/llvm/CodeGen/MachineDominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDominators.h?rev=79468&r1=79467&r2=79468&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineDominators.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineDominators.h Wed Aug 19 16:19:41 2009 @@ -15,6 +15,8 @@ #ifndef LLVM_CODEGEN_MACHINEDOMINATORS_H #define LLVM_CODEGEN_MACHINEDOMINATORS_H +#include "llvm/CodeGen/MachineBasicBlock.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/DominatorInternals.h" From greened at obbligato.org Wed Aug 19 16:22:19 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 21:22:19 -0000 Subject: [llvm-commits] [llvm] r79469 - /llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Message-ID: <200908192122.n7JLMJFd003801@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 16:22:18 2009 New Revision: 79469 URL: http://llvm.org/viewvc/llvm-project?rev=79469&view=rev Log: Add missing includes. Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=79469&r1=79468&r2=79469&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Wed Aug 19 16:22:18 2009 @@ -15,6 +15,7 @@ #define LLVM_CODEGEN_MACHINEFRAMEINFO_H #include "llvm/ADT/BitVector.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/Support/DataTypes.h" #include #include From bob.wilson at apple.com Wed Aug 19 16:25:05 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 19 Aug 2009 21:25:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79470 - /llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Message-ID: <200908192125.n7JLP5JQ004165@zion.cs.uiuc.edu> Author: bwilson Date: Wed Aug 19 16:25:05 2009 New Revision: 79470 URL: http://llvm.org/viewvc/llvm-project?rev=79470&view=rev Log: Revise the fix for pr4731. The vector types should be canonicalized in code gen, not in the front-end. The revised patch is essentially what Sandeep Patel proposed in the bug report. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=79470&r1=79469&r2=79470&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Wed Aug 19 16:25:05 2009 @@ -1866,20 +1866,13 @@ break; } - case NEON_BUILTIN_vbsl: { - // Canonicalize the vector type to have 32-bit integer elements. - const VectorType *VTy = dyn_cast(Ops[0]->getType()); - assert(VTy && "expected a vector type"); - VTy = VectorType::get(Type::getInt32Ty(Context), VTy->getBitWidth() / 32); - Ops[0] = Builder.CreateBitCast(Ops[0], VTy); - Ops[1] = Builder.CreateBitCast(Ops[1], VTy); - Ops[2] = Builder.CreateBitCast(Ops[2], VTy); + case NEON_BUILTIN_vbsl: + Ops[1] = BitCastToType(Ops[1], Ops[0]->getType()); + Ops[2] = BitCastToType(Ops[2], Ops[0]->getType()); Result = Builder.CreateOr(Builder.CreateAnd(Ops[1], Ops[0]), Builder.CreateAnd(Ops[2], Builder.CreateNot(Ops[0]))); - Result = Builder.CreateBitCast(Result, ResultType); break; - } case NEON_BUILTIN_vtbl1: case NEON_BUILTIN_vtbl2: From greened at obbligato.org Wed Aug 19 16:38:57 2009 From: greened at obbligato.org (David A. Greene) Date: Wed, 19 Aug 2009 16:38:57 -0500 Subject: [llvm-commits] [llvm] r79358 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/Support/IOManip.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp In-Reply-To: <3B60E36A-F20A-45B2-8392-C8E3ABB2150F@apple.com> References: <200908181922.n7IJMtJB013528@zion.cs.uiuc.edu> <3B60E36A-F20A-45B2-8392-C8E3ABB2150F@apple.com> Message-ID: <200908191638.58996.greened@obbligato.org> On Wednesday 19 August 2009 01:42, Chris Lattner wrote: > On Aug 18, 2009, at 12:22 PM, David Greene wrote: > > Author: greened > > Date: Tue Aug 18 14:22:55 2009 > > New Revision: 79358 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=79358&view=rev > > Log: > > > > Make various changes suggested by Chris. > > Thanks David, > > Why did you add all the forward declarations and #include to > AsmPrinter.h? Sorry, leakage from another fix. I've discovered that lots of source files are missing #includes they should have. I found this out when making some changes to add the AsmPrinter MachineInstr flags we've discussed. I'm in the midst of checking in a bunch of fixes of this nature. -Dave From resistor at mac.com Wed Aug 19 16:48:34 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 19 Aug 2009 21:48:34 -0000 Subject: [llvm-commits] [llvm] r79472 - /llvm/trunk/lib/System/Unix/Process.inc Message-ID: <200908192148.n7JLmYpD007114@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 19 16:48:34 2009 New Revision: 79472 URL: http://llvm.org/viewvc/llvm-project?rev=79472&view=rev Log: Get rid of a helgrind warning. If this is _actually_ a performance problem, we can find a way to cache the answer that isn't racy. Modified: llvm/trunk/lib/System/Unix/Process.inc Modified: llvm/trunk/lib/System/Unix/Process.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Process.inc?rev=79472&r1=79471&r2=79472&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Process.inc (original) +++ llvm/trunk/lib/System/Unix/Process.inc Wed Aug 19 16:48:34 2009 @@ -46,11 +46,11 @@ // On Cygwin, getpagesize() returns 64k but the page size for the purposes of // memory protection and mmap() is 4k. // See http://www.cygwin.com/ml/cygwin/2009-01/threads.html#00492 - static const int page_size = 0x1000; + const int page_size = 0x1000; #elif defined(HAVE_GETPAGESIZE) - static const int page_size = ::getpagesize(); + const int page_size = ::getpagesize(); #elif defined(HAVE_SYSCONF) - static long page_size = ::sysconf(_SC_PAGE_SIZE); + long page_size = ::sysconf(_SC_PAGE_SIZE); #else #warning Cannot get the page size on this machine #endif From daniel at zuster.org Wed Aug 19 16:50:05 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 14:50:05 -0700 Subject: [llvm-commits] [PATCH] Add tests for Profiling Infrastructure In-Reply-To: <4A8BF96E.60100@student.tuwien.ac.at> References: <4A8BF96E.60100@student.tuwien.ac.at> Message-ID: <6a8523d60908191450m62fd9baclf40c29e9908db049@mail.gmail.com> On Wed, Aug 19, 2009 at 6:09 AM, Andreas Neustifter wrote: > Hi, > > I am working currently on the Profiling Infrastructure for LLVM, I have done > some preliminary work and I also want to include some test files. Excellent, thanks! > I attach two files that I think can act as basis for further expanding the > test coverage. > > What do you think of this tests? ?I'm planning to put them under > test/Analysis/Profiling I don't understand the names, but otherwise looks fine to me. Note that you will need to replace '.so' with '%shlibext' to make the tests portable. I changed the Makefiles to build the runtime library by default as well... Please apply! If you aren't familiar with the DejaGNU set up, you will need to drop dg.exp in the new Profiling directory for the tests to be found. You can just copy the one from Analysis/Andersens, for example. Thanks, - Daniel From daniel at zuster.org Wed Aug 19 16:51:29 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 14:51:29 -0700 Subject: [llvm-commits] [llvm] r79468 - /llvm/trunk/include/llvm/CodeGen/MachineDominators.h In-Reply-To: <200908192119.n7JLJf6o003455@zion.cs.uiuc.edu> References: <200908192119.n7JLJf6o003455@zion.cs.uiuc.edu> Message-ID: <6a8523d60908191451t32ea3c1fl9a9c9b0117ccb178@mail.gmail.com> I don't understand these changes; everything was building fine? - Daniel On Wed, Aug 19, 2009 at 2:19 PM, David Greene wrote: > Author: greened > Date: Wed Aug 19 16:19:41 2009 > New Revision: 79468 > > URL: http://llvm.org/viewvc/llvm-project?rev=79468&view=rev > Log: > > Add missing includes. > > Modified: > ? ?llvm/trunk/include/llvm/CodeGen/MachineDominators.h > > Modified: llvm/trunk/include/llvm/CodeGen/MachineDominators.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDominators.h?rev=79468&r1=79467&r2=79468&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineDominators.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineDominators.h Wed Aug 19 16:19:41 2009 > @@ -15,6 +15,8 @@ > ?#ifndef LLVM_CODEGEN_MACHINEDOMINATORS_H > ?#define LLVM_CODEGEN_MACHINEDOMINATORS_H > > +#include "llvm/CodeGen/MachineBasicBlock.h" > +#include "llvm/CodeGen/MachineFunction.h" > ?#include "llvm/CodeGen/MachineFunctionPass.h" > ?#include "llvm/Analysis/Dominators.h" > ?#include "llvm/Analysis/DominatorInternals.h" > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From greened at obbligato.org Wed Aug 19 16:52:55 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 21:52:55 -0000 Subject: [llvm-commits] [llvm] r79473 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200908192152.n7JLquv0007686@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 16:52:55 2009 New Revision: 79473 URL: http://llvm.org/viewvc/llvm-project?rev=79473&view=rev Log: Add missing includes. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=79473&r1=79472&r2=79473&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Aug 19 16:52:55 2009 @@ -13,6 +13,7 @@ #include "DwarfDebug.h" #include "llvm/Module.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCStreamer.h" From greened at obbligato.org Wed Aug 19 16:54:35 2009 From: greened at obbligato.org (David A. Greene) Date: Wed, 19 Aug 2009 16:54:35 -0500 Subject: [llvm-commits] [llvm] r79468 - /llvm/trunk/include/llvm/CodeGen/MachineDominators.h In-Reply-To: <6a8523d60908191451t32ea3c1fl9a9c9b0117ccb178@mail.gmail.com> References: <200908192119.n7JLJf6o003455@zion.cs.uiuc.edu> <6a8523d60908191451t32ea3c1fl9a9c9b0117ccb178@mail.gmail.com> Message-ID: <200908191654.36200.greened@obbligato.org> On Wednesday 19 August 2009 16:51, Daniel Dunbar wrote: > I don't understand these changes; everything was building fine? Because it won't be building fine as soon as I remove #include "llvm/CodeGen/MachineFunction.h" from MachineFunctionPass.h. -Dave From greened at obbligato.org Wed Aug 19 16:55:33 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 21:55:33 -0000 Subject: [llvm-commits] [llvm] r79474 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <200908192155.n7JLtXPd008033@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 16:55:33 2009 New Revision: 79474 URL: http://llvm.org/viewvc/llvm-project?rev=79474&view=rev Log: Add missing includes. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=79474&r1=79473&r2=79474&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Wed Aug 19 16:55:33 2009 @@ -15,6 +15,7 @@ #include "llvm/Module.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineLocation.h" #include "llvm/MC/MCStreamer.h" #include "llvm/Target/TargetAsmInfo.h" From greened at obbligato.org Wed Aug 19 16:59:19 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 21:59:19 -0000 Subject: [llvm-commits] [llvm] r79475 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Message-ID: <200908192159.n7JLxJtK008541@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 16:59:18 2009 New Revision: 79475 URL: http://llvm.org/viewvc/llvm-project?rev=79475&view=rev Log: Add missing includes. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=79475&r1=79474&r2=79475&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Wed Aug 19 16:59:18 2009 @@ -15,6 +15,7 @@ #include "llvm/Module.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/ErrorHandling.h" From nicolas.geoffray at lip6.fr Wed Aug 19 17:00:09 2009 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 20 Aug 2009 00:00:09 +0200 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <0475CCF6-A5E1-43C1-A4BC-7DCB9FEF8CC8@apple.com> References: <4A8B2CE1.2000105@lip6.fr> <9A550CA8-C19F-42F5-8731-9B1A234299CD@apple.com> <4A8C23E1.3040604@lip6.fr> <0475CCF6-A5E1-43C1-A4BC-7DCB9FEF8CC8@apple.com> Message-ID: <4A8C75E9.2060707@lip6.fr> Eric Christopher wrote: > > Yes, but I wouldn't imagine anything could be executing in a way that > would require you walking up llvm code. Can you give me a quick example? > Sure! When vmkit wants to do a garbage collection, all threads must execute a "safe GC point", where the thread joins the collection cooperatively. If the thread is currently materializing a function (hence executing vmkit code), and a GC is required, all objects on the stack must be scanned. To walk the stack, I must know each function on the call stack. You can image a stack like this: vmkit method (start_thread) Java method Java method Java method LLVM callback for lazy compilation LLVM JIT emitter ModuleProvider::materializeFunction vmkit method vmkit method (<--- safe point entered here) I hope the example is clear. Nicolas From greened at obbligato.org Wed Aug 19 17:02:07 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 22:02:07 -0000 Subject: [llvm-commits] [llvm] r79476 - /llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Message-ID: <200908192202.n7JM27hH008919@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 17:02:07 2009 New Revision: 79476 URL: http://llvm.org/viewvc/llvm-project?rev=79476&view=rev Log: Add missing includes. Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp?rev=79476&r1=79475&r2=79476&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Wed Aug 19 17:02:07 2009 @@ -17,6 +17,7 @@ #include "llvm/Function.h" #include "llvm/CodeGen/BinaryObject.h" #include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineRelocation.h" #include "llvm/Target/TargetData.h" From daniel at zuster.org Wed Aug 19 17:03:38 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 15:03:38 -0700 Subject: [llvm-commits] [llvm] r79468 - /llvm/trunk/include/llvm/CodeGen/MachineDominators.h In-Reply-To: <200908191654.36200.greened@obbligato.org> References: <200908192119.n7JLJf6o003455@zion.cs.uiuc.edu> <6a8523d60908191451t32ea3c1fl9a9c9b0117ccb178@mail.gmail.com> <200908191654.36200.greened@obbligato.org> Message-ID: <6a8523d60908191503m4d4d5d2bs3c61e3b64fce06bd@mail.gmail.com> On Wed, Aug 19, 2009 at 2:54 PM, David A. Greene wrote: > On Wednesday 19 August 2009 16:51, Daniel Dunbar wrote: >> I don't understand these changes; everything was building fine? > > Because it won't be building fine as soon as I remove > #include "llvm/CodeGen/MachineFunction.h" from MachineFunctionPass.h. Gotcha. - Daniel From nicolas.geoffray at lip6.fr Wed Aug 19 17:04:44 2009 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 19 Aug 2009 22:04:44 -0000 Subject: [llvm-commits] [llvm] r79477 - /llvm/trunk/Makefile.rules Message-ID: <200908192204.n7JM4iNa009237@zion.cs.uiuc.edu> Author: geoffray Date: Wed Aug 19 17:04:44 2009 New Revision: 79477 URL: http://llvm.org/viewvc/llvm-project?rev=79477&view=rev Log: Add a REQUIRES_FRAME_POINTER option to disable the frame pointer elimination optimization on the LLVM code base. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=79477&r1=79476&r2=79477&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Wed Aug 19 17:04:44 2009 @@ -337,6 +337,12 @@ CXX.Flags += -fno-exceptions endif +ifdef REQUIRES_FRAME_POINTER + CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) + C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) + LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) +endif + # IF REQUIRES_RTTI=1 is specified then don't disable run-time type id ifndef REQUIRES_RTTI # CXX.Flags += -fno-rtti From greened at obbligato.org Wed Aug 19 17:05:21 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 22:05:21 -0000 Subject: [llvm-commits] [llvm] r79478 - /llvm/trunk/lib/CodeGen/LazyLiveness.cpp Message-ID: <200908192205.n7JM5LKf009328@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 17:05:21 2009 New Revision: 79478 URL: http://llvm.org/viewvc/llvm-project?rev=79478&view=rev Log: Add missing includes. Modified: llvm/trunk/lib/CodeGen/LazyLiveness.cpp Modified: llvm/trunk/lib/CodeGen/LazyLiveness.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LazyLiveness.cpp?rev=79478&r1=79477&r2=79478&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LazyLiveness.cpp (original) +++ llvm/trunk/lib/CodeGen/LazyLiveness.cpp Wed Aug 19 17:05:21 2009 @@ -15,6 +15,7 @@ #define DEBUG_TYPE "lazyliveness" #include "llvm/CodeGen/LazyLiveness.h" #include "llvm/CodeGen/MachineDominators.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/ADT/DepthFirstIterator.h" From echristo at apple.com Wed Aug 19 17:05:22 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 19 Aug 2009 15:05:22 -0700 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <4A8C75E9.2060707@lip6.fr> References: <4A8B2CE1.2000105@lip6.fr> <9A550CA8-C19F-42F5-8731-9B1A234299CD@apple.com> <4A8C23E1.3040604@lip6.fr> <0475CCF6-A5E1-43C1-A4BC-7DCB9FEF8CC8@apple.com> <4A8C75E9.2060707@lip6.fr> Message-ID: <2A75BA19-8AF9-4C48-9BD1-20B924E319A7@apple.com> On Aug 19, 2009, at 3:00 PM, Nicolas Geoffray wrote: > Eric Christopher wrote: >> >> Yes, but I wouldn't imagine anything could be executing in a way >> that would require you walking up llvm code. Can you give me a >> quick example? >> > > Sure! When vmkit wants to do a garbage collection, all threads must > execute a "safe GC point", where the thread joins the collection > cooperatively. If the thread is currently materializing a function > (hence executing vmkit code), and a GC is required, all objects on > the stack must be scanned. To walk the stack, I must know each > function on the call stack. You can image a stack like this: > > > vmkit method (start_thread) > Java method > Java method > Java method > LLVM callback for lazy compilation > LLVM JIT emitter > ModuleProvider::materializeFunction > vmkit method > vmkit method (<--- safe point entered here) > > > I hope the example is clear. It is, perhaps that's a bad point to have as a safe point? At any rate, I'm not against the option in general so feel free to commit :) thanks. -eric From greened at obbligato.org Wed Aug 19 17:08:26 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 22:08:26 -0000 Subject: [llvm-commits] [llvm] r79479 - /llvm/trunk/lib/CodeGen/MachOCodeEmitter.cpp Message-ID: <200908192208.n7JM8QUW009728@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 17:08:26 2009 New Revision: 79479 URL: http://llvm.org/viewvc/llvm-project?rev=79479&view=rev Log: Add missing includes. Modified: llvm/trunk/lib/CodeGen/MachOCodeEmitter.cpp Modified: llvm/trunk/lib/CodeGen/MachOCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOCodeEmitter.cpp?rev=79479&r1=79478&r2=79479&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachOCodeEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/MachOCodeEmitter.cpp Wed Aug 19 17:08:26 2009 @@ -14,6 +14,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Function.h" #include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineRelocation.h" #include "llvm/Target/TargetAsmInfo.h" From greened at obbligato.org Wed Aug 19 17:16:11 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 22:16:11 -0000 Subject: [llvm-commits] [llvm] r79480 - /llvm/trunk/lib/CodeGen/MachineFunction.cpp Message-ID: <200908192216.n7JMGBq2010711@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 17:16:11 2009 New Revision: 79480 URL: http://llvm.org/viewvc/llvm-project?rev=79480&view=rev Log: Add missing includes. Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=79480&r1=79479&r2=79480&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Wed Aug 19 17:16:11 2009 @@ -19,6 +19,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Config/config.h" #include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstr.h" From greened at obbligato.org Wed Aug 19 17:19:44 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 22:19:44 -0000 Subject: [llvm-commits] [llvm] r79481 - /llvm/trunk/lib/CodeGen/MachOWriter.h Message-ID: <200908192219.n7JMJjgM011195@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 17:19:44 2009 New Revision: 79481 URL: http://llvm.org/viewvc/llvm-project?rev=79481&view=rev Log: Add missing forward declaration. Modified: llvm/trunk/lib/CodeGen/MachOWriter.h Modified: llvm/trunk/lib/CodeGen/MachOWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.h?rev=79481&r1=79480&r2=79481&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachOWriter.h (original) +++ llvm/trunk/lib/CodeGen/MachOWriter.h Wed Aug 19 17:19:44 2009 @@ -22,6 +22,7 @@ class Constant; class GlobalVariable; class Mangler; + class MachineBasicBlock; class MachineRelocation; class MachOCodeEmitter; struct MachODySymTab; From daniel at zuster.org Wed Aug 19 17:34:21 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 22:34:21 -0000 Subject: [llvm-commits] [llvm] r79482 - /llvm/trunk/include/llvm/Support/IRBuilder.h Message-ID: <200908192234.n7JMYLd4013006@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 17:34:21 2009 New Revision: 79482 URL: http://llvm.org/viewvc/llvm-project?rev=79482&view=rev Log: Switch IRBuilder to using Twine references for names. 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=79482&r1=79481&r2=79482&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Aug 19 17:34:21 2009 @@ -21,6 +21,7 @@ #include "llvm/GlobalVariable.h" #include "llvm/Function.h" #include "llvm/LLVMContext.h" +#include "llvm/ADT/Twine.h" #include "llvm/Support/ConstantFolder.h" namespace llvm { @@ -109,7 +110,7 @@ /// Insert - Insert and return the specified instruction. template - InstTy *Insert(InstTy *I, const char *Name = "") const { + InstTy *Insert(InstTy *I, const Twine &Name = "") const { InsertHelper(I, Name); return I; } @@ -117,9 +118,9 @@ /// InsertHelper - Insert the specified instruction at the specified insertion /// point. This is split out of Insert so that it isn't duplicated for every /// template instantiation. - void InsertHelper(Instruction *I, const char *Name) const { + void InsertHelper(Instruction *I, const Twine &Name) const { if (BB) BB->getInstList().insert(InsertPt, I); - if (preserveNames && Name[0]) + if (preserveNames) I->setName(Name); } @@ -220,7 +221,7 @@ template InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest, BasicBlock *UnwindDest, InputIterator ArgBegin, - InputIterator ArgEnd, const char *Name = "") { + InputIterator ArgEnd, const Twine &Name = "") { return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest, ArgBegin, ArgEnd), Name); } @@ -237,121 +238,121 @@ // Instruction creation methods: Binary Operators //===--------------------------------------------------------------------===// - Value *CreateAdd(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateAdd(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateAdd(LC, RC); return Insert(BinaryOperator::CreateAdd(LHS, RHS), Name); } - Value *CreateNSWAdd(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateNSWAdd(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateNSWAdd(LC, RC); return Insert(BinaryOperator::CreateNSWAdd(LHS, RHS), Name); } - Value *CreateFAdd(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFAdd(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateFAdd(LC, RC); return Insert(BinaryOperator::CreateFAdd(LHS, RHS), Name); } - Value *CreateSub(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateSub(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateSub(LC, RC); return Insert(BinaryOperator::CreateSub(LHS, RHS), Name); } - Value *CreateFSub(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFSub(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateFSub(LC, RC); return Insert(BinaryOperator::CreateFSub(LHS, RHS), Name); } - Value *CreateMul(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateMul(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateMul(LC, RC); return Insert(BinaryOperator::CreateMul(LHS, RHS), Name); } - Value *CreateFMul(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFMul(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateFMul(LC, RC); return Insert(BinaryOperator::CreateFMul(LHS, RHS), Name); } - Value *CreateUDiv(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateUDiv(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateUDiv(LC, RC); return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name); } - Value *CreateSDiv(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateSDiv(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateSDiv(LC, RC); return Insert(BinaryOperator::CreateSDiv(LHS, RHS), Name); } - Value *CreateExactSDiv(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateExactSDiv(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateExactSDiv(LC, RC); return Insert(BinaryOperator::CreateExactSDiv(LHS, RHS), Name); } - Value *CreateFDiv(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFDiv(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateFDiv(LC, RC); return Insert(BinaryOperator::CreateFDiv(LHS, RHS), Name); } - Value *CreateURem(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateURem(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateURem(LC, RC); return Insert(BinaryOperator::CreateURem(LHS, RHS), Name); } - Value *CreateSRem(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateSRem(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateSRem(LC, RC); return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name); } - Value *CreateFRem(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFRem(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateFRem(LC, RC); return Insert(BinaryOperator::CreateFRem(LHS, RHS), Name); } - Value *CreateShl(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateShl(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateShl(LC, RC); return Insert(BinaryOperator::CreateShl(LHS, RHS), Name); } - Value *CreateLShr(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateLShr(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateLShr(LC, RC); return Insert(BinaryOperator::CreateLShr(LHS, RHS), Name); } - Value *CreateAShr(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateAShr(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateAShr(LC, RC); return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name); } - Value *CreateAnd(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateAnd(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateAnd(LC, RC); return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name); } - Value *CreateOr(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateOr(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateOr(LC, RC); return Insert(BinaryOperator::CreateOr(LHS, RHS), Name); } - Value *CreateXor(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateXor(Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateXor(LC, RC); @@ -359,24 +360,24 @@ } Value *CreateBinOp(Instruction::BinaryOps Opc, - Value *LHS, Value *RHS, const char *Name = "") { + Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateBinOp(Opc, LC, RC); return Insert(BinaryOperator::Create(Opc, LHS, RHS), Name); } - Value *CreateNeg(Value *V, const char *Name = "") { + Value *CreateNeg(Value *V, const Twine &Name = "") { if (Constant *VC = dyn_cast(V)) return Folder.CreateNeg(VC); return Insert(BinaryOperator::CreateNeg(V), Name); } - Value *CreateFNeg(Value *V, const char *Name = "") { + Value *CreateFNeg(Value *V, const Twine &Name = "") { if (Constant *VC = dyn_cast(V)) return Folder.CreateFNeg(VC); return Insert(BinaryOperator::CreateFNeg(V), Name); } - Value *CreateNot(Value *V, const char *Name = "") { + Value *CreateNot(Value *V, const Twine &Name = "") { if (Constant *VC = dyn_cast(V)) return Folder.CreateNot(VC); return Insert(BinaryOperator::CreateNot(V), Name); @@ -387,20 +388,26 @@ //===--------------------------------------------------------------------===// MallocInst *CreateMalloc(const Type *Ty, Value *ArraySize = 0, - const char *Name = "") { + const Twine &Name = "") { return Insert(new MallocInst(Ty, ArraySize), Name); } AllocaInst *CreateAlloca(const Type *Ty, Value *ArraySize = 0, - const char *Name = "") { + const Twine &Name = "") { return Insert(new AllocaInst(Ty, ArraySize), Name); } FreeInst *CreateFree(Value *Ptr) { return Insert(new FreeInst(Ptr)); } - LoadInst *CreateLoad(Value *Ptr, const char *Name = "") { + // Provided to resolve 'CreateLoad(Ptr, "...")' correctly, instead of + // converting the string to 'bool' for the isVolatile parameter. + LoadInst *CreateLoad(Value *Ptr, const char *Name) { return Insert(new LoadInst(Ptr), Name); } - LoadInst *CreateLoad(Value *Ptr, bool isVolatile, const char *Name = "") { + LoadInst *CreateLoad(Value *Ptr, const Twine &Name = "") { + return Insert(new LoadInst(Ptr), Name); + } + LoadInst *CreateLoad(Value *Ptr, bool isVolatile, + const Twine &Name = "") { return Insert(new LoadInst(Ptr, 0, isVolatile), Name); } StoreInst *CreateStore(Value *Val, Value *Ptr, bool isVolatile = false) { @@ -408,7 +415,7 @@ } template Value *CreateGEP(Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd, - const char *Name = "") { + const Twine &Name = "") { if (Constant *PC = dyn_cast(Ptr)) { // Every index must be constant. InputIterator i; @@ -422,7 +429,7 @@ } template Value *CreateInBoundsGEP(Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd, - const char *Name = "") { + const Twine &Name = "") { if (Constant *PC = dyn_cast(Ptr)) { // Every index must be constant. InputIterator i; @@ -437,19 +444,19 @@ return Insert(GetElementPtrInst::CreateInBounds(Ptr, IdxBegin, IdxEnd), Name); } - Value *CreateGEP(Value *Ptr, Value *Idx, const char *Name = "") { + Value *CreateGEP(Value *Ptr, Value *Idx, const Twine &Name = "") { if (Constant *PC = dyn_cast(Ptr)) if (Constant *IC = dyn_cast(Idx)) return Folder.CreateGetElementPtr(PC, &IC, 1); return Insert(GetElementPtrInst::Create(Ptr, Idx), Name); } - Value *CreateInBoundsGEP(Value *Ptr, Value *Idx, const char *Name = "") { + Value *CreateInBoundsGEP(Value *Ptr, Value *Idx, const Twine &Name = "") { if (Constant *PC = dyn_cast(Ptr)) if (Constant *IC = dyn_cast(Idx)) return Folder.CreateInBoundsGetElementPtr(PC, &IC, 1); return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idx), Name); } - Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const char *Name = "") { + Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name = "") { Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Idx0); if (Constant *PC = dyn_cast(Ptr)) @@ -458,7 +465,7 @@ return Insert(GetElementPtrInst::Create(Ptr, &Idx, &Idx+1), Name); } Value *CreateConstInBoundsGEP1_32(Value *Ptr, unsigned Idx0, - const char *Name = "") { + const Twine &Name = "") { Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Idx0); if (Constant *PC = dyn_cast(Ptr)) @@ -467,7 +474,7 @@ return Insert(GetElementPtrInst::CreateInBounds(Ptr, &Idx, &Idx+1), Name); } Value *CreateConstGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1, - const char *Name = "") { + const Twine &Name = "") { Value *Idxs[] = { ConstantInt::get(Type::getInt32Ty(Context), Idx0), ConstantInt::get(Type::getInt32Ty(Context), Idx1) @@ -479,7 +486,7 @@ return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name); } Value *CreateConstInBoundsGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1, - const char *Name = "") { + const Twine &Name = "") { Value *Idxs[] = { ConstantInt::get(Type::getInt32Ty(Context), Idx0), ConstantInt::get(Type::getInt32Ty(Context), Idx1) @@ -490,7 +497,7 @@ return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idxs, Idxs+2), Name); } - Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const char *Name = "") { + Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name = "") { Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0); if (Constant *PC = dyn_cast(Ptr)) @@ -499,7 +506,7 @@ return Insert(GetElementPtrInst::Create(Ptr, &Idx, &Idx+1), Name); } Value *CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0, - const char *Name = "") { + const Twine &Name = "") { Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0); if (Constant *PC = dyn_cast(Ptr)) @@ -508,7 +515,7 @@ return Insert(GetElementPtrInst::CreateInBounds(Ptr, &Idx, &Idx+1), Name); } Value *CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, - const char *Name = "") { + const Twine &Name = "") { Value *Idxs[] = { ConstantInt::get(Type::getInt64Ty(Context), Idx0), ConstantInt::get(Type::getInt64Ty(Context), Idx1) @@ -520,7 +527,7 @@ return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name); } Value *CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1, - const char *Name = "") { + const Twine &Name = "") { Value *Idxs[] = { ConstantInt::get(Type::getInt64Ty(Context), Idx0), ConstantInt::get(Type::getInt64Ty(Context), Idx1) @@ -531,10 +538,10 @@ return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idxs, Idxs+2), Name); } - Value *CreateStructGEP(Value *Ptr, unsigned Idx, const char *Name = "") { + Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name = "") { return CreateConstInBoundsGEP2_32(Ptr, 0, Idx, Name); } - Value *CreateGlobalString(const char *Str = "", const char *Name = "") { + Value *CreateGlobalString(const char *Str = "", const Twine &Name = "") { Constant *StrConstant = ConstantArray::get(Context, Str, true); Module &M = *BB->getParent()->getParent(); GlobalVariable *gv = new GlobalVariable(M, @@ -548,7 +555,7 @@ gv->setName(Name); return gv; } - Value *CreateGlobalStringPtr(const char *Str = "", const char *Name = "") { + Value *CreateGlobalStringPtr(const char *Str = "", const Twine &Name = "") { Value *gv = CreateGlobalString(Str, Name); Value *zero = ConstantInt::get(Type::getInt32Ty(Context), 0); Value *Args[] = { zero, zero }; @@ -558,48 +565,48 @@ // Instruction creation methods: Cast/Conversion Operators //===--------------------------------------------------------------------===// - Value *CreateTrunc(Value *V, const Type *DestTy, const char *Name = "") { + Value *CreateTrunc(Value *V, const Type *DestTy, const Twine &Name = "") { return CreateCast(Instruction::Trunc, V, DestTy, Name); } - Value *CreateZExt(Value *V, const Type *DestTy, const char *Name = "") { + Value *CreateZExt(Value *V, const Type *DestTy, const Twine &Name = "") { return CreateCast(Instruction::ZExt, V, DestTy, Name); } - Value *CreateSExt(Value *V, const Type *DestTy, const char *Name = "") { + Value *CreateSExt(Value *V, const Type *DestTy, const Twine &Name = "") { return CreateCast(Instruction::SExt, V, DestTy, Name); } - Value *CreateFPToUI(Value *V, const Type *DestTy, const char *Name = ""){ + Value *CreateFPToUI(Value *V, const Type *DestTy, const Twine &Name = ""){ return CreateCast(Instruction::FPToUI, V, DestTy, Name); } - Value *CreateFPToSI(Value *V, const Type *DestTy, const char *Name = ""){ + Value *CreateFPToSI(Value *V, const Type *DestTy, const Twine &Name = ""){ return CreateCast(Instruction::FPToSI, V, DestTy, Name); } - Value *CreateUIToFP(Value *V, const Type *DestTy, const char *Name = ""){ + Value *CreateUIToFP(Value *V, const Type *DestTy, const Twine &Name = ""){ return CreateCast(Instruction::UIToFP, V, DestTy, Name); } - Value *CreateSIToFP(Value *V, const Type *DestTy, const char *Name = ""){ + Value *CreateSIToFP(Value *V, const Type *DestTy, const Twine &Name = ""){ return CreateCast(Instruction::SIToFP, V, DestTy, Name); } Value *CreateFPTrunc(Value *V, const Type *DestTy, - const char *Name = "") { + const Twine &Name = "") { return CreateCast(Instruction::FPTrunc, V, DestTy, Name); } - Value *CreateFPExt(Value *V, const Type *DestTy, const char *Name = "") { + Value *CreateFPExt(Value *V, const Type *DestTy, const Twine &Name = "") { return CreateCast(Instruction::FPExt, V, DestTy, Name); } Value *CreatePtrToInt(Value *V, const Type *DestTy, - const char *Name = "") { + const Twine &Name = "") { return CreateCast(Instruction::PtrToInt, V, DestTy, Name); } Value *CreateIntToPtr(Value *V, const Type *DestTy, - const char *Name = "") { + const Twine &Name = "") { return CreateCast(Instruction::IntToPtr, V, DestTy, Name); } Value *CreateBitCast(Value *V, const Type *DestTy, - const char *Name = "") { + const Twine &Name = "") { return CreateCast(Instruction::BitCast, V, DestTy, Name); } Value *CreateZExtOrBitCast(Value *V, const Type *DestTy, - const char *Name = "") { + const Twine &Name = "") { if (V->getType() == DestTy) return V; if (Constant *VC = dyn_cast(V)) @@ -607,7 +614,7 @@ return Insert(CastInst::CreateZExtOrBitCast(V, DestTy), Name); } Value *CreateSExtOrBitCast(Value *V, const Type *DestTy, - const char *Name = "") { + const Twine &Name = "") { if (V->getType() == DestTy) return V; if (Constant *VC = dyn_cast(V)) @@ -615,7 +622,7 @@ return Insert(CastInst::CreateSExtOrBitCast(V, DestTy), Name); } Value *CreateTruncOrBitCast(Value *V, const Type *DestTy, - const char *Name = "") { + const Twine &Name = "") { if (V->getType() == DestTy) return V; if (Constant *VC = dyn_cast(V)) @@ -623,7 +630,7 @@ return Insert(CastInst::CreateTruncOrBitCast(V, DestTy), Name); } Value *CreateCast(Instruction::CastOps Op, Value *V, const Type *DestTy, - const char *Name = "") { + const Twine &Name = "") { if (V->getType() == DestTy) return V; if (Constant *VC = dyn_cast(V)) @@ -631,7 +638,7 @@ return Insert(CastInst::Create(Op, V, DestTy), Name); } Value *CreatePointerCast(Value *V, const Type *DestTy, - const char *Name = "") { + const Twine &Name = "") { if (V->getType() == DestTy) return V; if (Constant *VC = dyn_cast(V)) @@ -639,14 +646,14 @@ return Insert(CastInst::CreatePointerCast(V, DestTy), Name); } Value *CreateIntCast(Value *V, const Type *DestTy, bool isSigned, - const char *Name = "") { + const Twine &Name = "") { if (V->getType() == DestTy) return V; if (Constant *VC = dyn_cast(V)) return Folder.CreateIntCast(VC, DestTy, isSigned); return Insert(CastInst::CreateIntegerCast(V, DestTy, isSigned), Name); } - Value *CreateFPCast(Value *V, const Type *DestTy, const char *Name = "") { + Value *CreateFPCast(Value *V, const Type *DestTy, const Twine &Name = "") { if (V->getType() == DestTy) return V; if (Constant *VC = dyn_cast(V)) @@ -658,89 +665,89 @@ // Instruction creation methods: Compare Instructions //===--------------------------------------------------------------------===// - Value *CreateICmpEQ(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_EQ, LHS, RHS, Name); } - Value *CreateICmpNE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_NE, LHS, RHS, Name); } - Value *CreateICmpUGT(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpUGT(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_UGT, LHS, RHS, Name); } - Value *CreateICmpUGE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpUGE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_UGE, LHS, RHS, Name); } - Value *CreateICmpULT(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_ULT, LHS, RHS, Name); } - Value *CreateICmpULE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpULE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_ULE, LHS, RHS, Name); } - Value *CreateICmpSGT(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpSGT(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_SGT, LHS, RHS, Name); } - Value *CreateICmpSGE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpSGE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_SGE, LHS, RHS, Name); } - Value *CreateICmpSLT(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpSLT(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_SLT, LHS, RHS, Name); } - Value *CreateICmpSLE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateICmpSLE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateICmp(ICmpInst::ICMP_SLE, LHS, RHS, Name); } - Value *CreateFCmpOEQ(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_OEQ, LHS, RHS, Name); } - Value *CreateFCmpOGT(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpOGT(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_OGT, LHS, RHS, Name); } - Value *CreateFCmpOGE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpOGE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_OGE, LHS, RHS, Name); } - Value *CreateFCmpOLT(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpOLT(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_OLT, LHS, RHS, Name); } - Value *CreateFCmpOLE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpOLE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_OLE, LHS, RHS, Name); } - Value *CreateFCmpONE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpONE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_ONE, LHS, RHS, Name); } - Value *CreateFCmpORD(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpORD(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_ORD, LHS, RHS, Name); } - Value *CreateFCmpUNO(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpUNO(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_UNO, LHS, RHS, Name); } - Value *CreateFCmpUEQ(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpUEQ(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_UEQ, LHS, RHS, Name); } - Value *CreateFCmpUGT(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpUGT(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_UGT, LHS, RHS, Name); } - Value *CreateFCmpUGE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpUGE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_UGE, LHS, RHS, Name); } - Value *CreateFCmpULT(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpULT(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_ULT, LHS, RHS, Name); } - Value *CreateFCmpULE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpULE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_ULE, LHS, RHS, Name); } - Value *CreateFCmpUNE(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreateFCmpUNE(Value *LHS, Value *RHS, const Twine &Name = "") { return CreateFCmp(FCmpInst::FCMP_UNE, LHS, RHS, Name); } Value *CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, - const char *Name = "") { + const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateICmp(P, LC, RC); return Insert(new ICmpInst(Context, P, LHS, RHS), Name); } Value *CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, - const char *Name = "") { + const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateFCmp(P, LC, RC); @@ -751,40 +758,40 @@ // Instruction creation methods: Other Instructions //===--------------------------------------------------------------------===// - PHINode *CreatePHI(const Type *Ty, const char *Name = "") { + PHINode *CreatePHI(const Type *Ty, const Twine &Name = "") { return Insert(PHINode::Create(Ty), Name); } - CallInst *CreateCall(Value *Callee, const char *Name = "") { + CallInst *CreateCall(Value *Callee, const Twine &Name = "") { return Insert(CallInst::Create(Callee), Name); } - CallInst *CreateCall(Value *Callee, Value *Arg, const char *Name = "") { + CallInst *CreateCall(Value *Callee, Value *Arg, const Twine &Name = "") { return Insert(CallInst::Create(Callee, Arg), Name); } CallInst *CreateCall2(Value *Callee, Value *Arg1, Value *Arg2, - const char *Name = "") { + const Twine &Name = "") { Value *Args[] = { Arg1, Arg2 }; return Insert(CallInst::Create(Callee, Args, Args+2), Name); } CallInst *CreateCall3(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3, - const char *Name = "") { + const Twine &Name = "") { Value *Args[] = { Arg1, Arg2, Arg3 }; return Insert(CallInst::Create(Callee, Args, Args+3), Name); } CallInst *CreateCall4(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3, - Value *Arg4, const char *Name = "") { + Value *Arg4, const Twine &Name = "") { Value *Args[] = { Arg1, Arg2, Arg3, Arg4 }; return Insert(CallInst::Create(Callee, Args, Args+4), Name); } template CallInst *CreateCall(Value *Callee, InputIterator ArgBegin, - InputIterator ArgEnd, const char *Name = "") { + InputIterator ArgEnd, const Twine &Name = "") { return Insert(CallInst::Create(Callee, ArgBegin, ArgEnd), Name); } Value *CreateSelect(Value *C, Value *True, Value *False, - const char *Name = "") { + const Twine &Name = "") { if (Constant *CC = dyn_cast(C)) if (Constant *TC = dyn_cast(True)) if (Constant *FC = dyn_cast(False)) @@ -792,12 +799,12 @@ return Insert(SelectInst::Create(C, True, False), Name); } - VAArgInst *CreateVAArg(Value *List, const Type *Ty, const char *Name = "") { + VAArgInst *CreateVAArg(Value *List, const Type *Ty, const Twine &Name = "") { return Insert(new VAArgInst(List, Ty), Name); } Value *CreateExtractElement(Value *Vec, Value *Idx, - const char *Name = "") { + const Twine &Name = "") { if (Constant *VC = dyn_cast(Vec)) if (Constant *IC = dyn_cast(Idx)) return Folder.CreateExtractElement(VC, IC); @@ -805,7 +812,7 @@ } Value *CreateInsertElement(Value *Vec, Value *NewElt, Value *Idx, - const char *Name = "") { + const Twine &Name = "") { if (Constant *VC = dyn_cast(Vec)) if (Constant *NC = dyn_cast(NewElt)) if (Constant *IC = dyn_cast(Idx)) @@ -814,7 +821,7 @@ } Value *CreateShuffleVector(Value *V1, Value *V2, Value *Mask, - const char *Name = "") { + const Twine &Name = "") { if (Constant *V1C = dyn_cast(V1)) if (Constant *V2C = dyn_cast(V2)) if (Constant *MC = dyn_cast(Mask)) @@ -823,7 +830,7 @@ } Value *CreateExtractValue(Value *Agg, unsigned Idx, - const char *Name = "") { + const Twine &Name = "") { if (Constant *AggC = dyn_cast(Agg)) return Folder.CreateExtractValue(AggC, &Idx, 1); return Insert(ExtractValueInst::Create(Agg, Idx), Name); @@ -833,14 +840,14 @@ Value *CreateExtractValue(Value *Agg, InputIterator IdxBegin, InputIterator IdxEnd, - const char *Name = "") { + const Twine &Name = "") { if (Constant *AggC = dyn_cast(Agg)) return Folder.CreateExtractValue(AggC, IdxBegin, IdxEnd - IdxBegin); return Insert(ExtractValueInst::Create(Agg, IdxBegin, IdxEnd), Name); } Value *CreateInsertValue(Value *Agg, Value *Val, unsigned Idx, - const char *Name = "") { + const Twine &Name = "") { if (Constant *AggC = dyn_cast(Agg)) if (Constant *ValC = dyn_cast(Val)) return Folder.CreateInsertValue(AggC, ValC, &Idx, 1); @@ -851,7 +858,7 @@ Value *CreateInsertValue(Value *Agg, Value *Val, InputIterator IdxBegin, InputIterator IdxEnd, - const char *Name = "") { + const Twine &Name = "") { if (Constant *AggC = dyn_cast(Agg)) if (Constant *ValC = dyn_cast(Val)) return Folder.CreateInsertValue(AggC, ValC, @@ -864,13 +871,13 @@ //===--------------------------------------------------------------------===// /// CreateIsNull - Return an i1 value testing if \arg Arg is null. - Value *CreateIsNull(Value *Arg, const char *Name = "") { + Value *CreateIsNull(Value *Arg, const Twine &Name = "") { return CreateICmpEQ(Arg, Constant::getNullValue(Arg->getType()), Name); } /// CreateIsNotNull - Return an i1 value testing if \arg Arg is not null. - Value *CreateIsNotNull(Value *Arg, const char *Name = "") { + Value *CreateIsNotNull(Value *Arg, const Twine &Name = "") { return CreateICmpNE(Arg, Constant::getNullValue(Arg->getType()), Name); } @@ -880,7 +887,7 @@ /// implement C-style pointer subtraction. As such, the pointers must be /// appropriately aligned for their element types and pointing into the /// same object. - Value *CreatePtrDiff(Value *LHS, Value *RHS, const char *Name = "") { + Value *CreatePtrDiff(Value *LHS, Value *RHS, const Twine &Name = "") { assert(LHS->getType() == RHS->getType() && "Pointer subtraction operand types must match!"); const PointerType *ArgType = cast(LHS->getType()); From reid at kleckner.net Wed Aug 19 17:38:37 2009 From: reid at kleckner.net (Reid Kleckner) Date: Wed, 19 Aug 2009 22:38:37 -0000 Subject: [llvm-commits] [llvm] r79483 - /llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Message-ID: <200908192238.n7JMcbec013535@zion.cs.uiuc.edu> Author: rnk Date: Wed Aug 19 17:38:37 2009 New Revision: 79483 URL: http://llvm.org/viewvc/llvm-project?rev=79483&view=rev Log: Fixed error in CPPBackend from a contextification API change. Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=79483&r1=79482&r2=79483&view=diff ============================================================================== --- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original) +++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Wed Aug 19 17:38:37 2009 @@ -1162,8 +1162,9 @@ << bbname << ");"; break; } - case Instruction::Unreachable:{ + case Instruction::Unreachable: { Out << "new UnreachableInst(" + << "getGlobalContext(), " << bbname << ");"; break; } @@ -1239,7 +1240,7 @@ break; } case Instruction::ICmp: { - Out << "ICmpInst* " << iName << " = new ICmpInst("; + Out << "ICmpInst* " << iName << " = new ICmpInst(*" << bbname << ", "; switch (cast(I)->getPredicate()) { case ICmpInst::ICMP_EQ: Out << "ICmpInst::ICMP_EQ"; break; case ICmpInst::ICMP_NE: Out << "ICmpInst::ICMP_NE"; break; @@ -1255,7 +1256,7 @@ } Out << ", " << opNames[0] << ", " << opNames[1] << ", \""; printEscapedString(I->getName()); - Out << "\", " << bbname << ");"; + Out << "\");"; break; } case Instruction::Malloc: { From dalej at apple.com Wed Aug 19 17:44:41 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Aug 2009 22:44:41 -0000 Subject: [llvm-commits] [llvm] r79484 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll Message-ID: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> Author: johannes Date: Wed Aug 19 17:44:41 2009 New Revision: 79484 URL: http://llvm.org/viewvc/llvm-project?rev=79484&view=rev Log: Handle 'a' modifier in X86 asms. PR 4742. Added: llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp 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=79484&r1=79483&r2=79484&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Aug 19 17:44:41 2009 @@ -620,6 +620,18 @@ switch (ExtraCode[0]) { default: return true; // Unknown modifier. + case 'a': // This is an address. Currently only 'i' and 'r' are expected. + if (MO.isImm()) { + O << MO.getImm(); + return false; + } else if (MO.isReg()) { + O << '('; + printOperand(MI, OpNo); + O << ')'; + return false; + } + return true; + case 'c': // Don't print "$" before a global var name or constant. if (MO.isImm()) O << MO.getImm(); Added: llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll?rev=79484&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll Wed Aug 19 17:44:41 2009 @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | llc | grep {%gs:6} +; RUN: llvm-as < %s | llc | grep {%gs:\\\(%*\\\)} +; ModuleID = 'asm.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-darwin9.6" + +define i32 @main() nounwind { +entry: + %asmtmp.i = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 6) nounwind ; [#uses=1] + %0 = zext i16 %asmtmp.i to i32 ; [#uses=1] + ret i32 %0 +} + +define zeroext i16 @readgsword2(i32 %address) nounwind { +entry: + %asmtmp = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 %address) nounwind ; [#uses=1] + ret i16 %asmtmp +} From gohman at apple.com Wed Aug 19 17:46:59 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 22:46:59 -0000 Subject: [llvm-commits] [llvm] r79485 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp test/Transforms/InstCombine/constant-fold-gep-overindex.ll Message-ID: <200908192246.n7JMkxYT014589@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 17:46:59 2009 New Revision: 79485 URL: http://llvm.org/viewvc/llvm-project?rev=79485&view=rev Log: Fix a bug in the over-index constant folding. When over-indexing an array member of a struct, it's possible to land in an arbitrary position inside that struct, such that attempting to find further getelementptr indices will fail. In such cases, folding cannot be done. Added: llvm/trunk/test/Transforms/InstCombine/constant-fold-gep-overindex.ll Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=79485&r1=79484&r2=79485&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed Aug 19 17:46:59 2009 @@ -165,8 +165,11 @@ // Also, this helps GlobalOpt do SROA on GlobalVariables. const Type *Ty = Ptr->getType(); SmallVector NewIdxs; - for (unsigned Index = 1; Index != NumOps; ++Index) { + do { if (const SequentialType *ATy = dyn_cast(Ty)) { + // The only pointer indexing we'll do is on the first index of the GEP. + if (isa(ATy) && ATy != Ptr->getType()) + break; // Determine which element of the array the offset points into. uint64_t ElemSize = TD->getTypeAllocSize(ATy->getElementType()); if (ElemSize == 0) @@ -183,20 +186,33 @@ Offset -= SL.getElementOffset(ElIdx); Ty = STy->getTypeAtIndex(ElIdx); } else { - return 0; + // We've reached some non-indexable type. + break; } - } + } while (Ty != cast(ResultTy)->getElementType()); + + // If we haven't used up the entire offset by descending the static + // type, then the offset is pointing into the middle of an indivisible + // member, so we can't simplify it. + if (Offset != 0) + return 0; // If the base is the start of a GlobalVariable and all the array indices // remain in their static bounds, the GEP is inbounds. We can check that // all indices are in bounds by just checking the first index only // because we've just normalized all the indices. - if (isa(Ptr) && NewIdxs[0]->isNullValue()) - return ConstantExpr::getInBoundsGetElementPtr(Ptr, - &NewIdxs[0], NewIdxs.size()); + Constant *C = isa(Ptr) && NewIdxs[0]->isNullValue() ? + ConstantExpr::getInBoundsGetElementPtr(Ptr, &NewIdxs[0], NewIdxs.size()) : + ConstantExpr::getGetElementPtr(Ptr, &NewIdxs[0], NewIdxs.size()); + assert(cast(C->getType())->getElementType() == Ty && + "Computed GetElementPtr has unexpected type!"); + + // If we ended up indexing a member with a type that doesn't match + // type type of what the original indices indexed, add a cast. + if (Ty != cast(ResultTy)->getElementType()) + C = ConstantExpr::getBitCast(C, ResultTy); - // Otherwise it may not be inbounds. - return ConstantExpr::getGetElementPtr(Ptr, &NewIdxs[0], NewIdxs.size()); + return C; } /// FoldBitCast - Constant fold bitcast, symbolically evaluating it with Added: llvm/trunk/test/Transforms/InstCombine/constant-fold-gep-overindex.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/constant-fold-gep-overindex.ll?rev=79485&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/constant-fold-gep-overindex.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/constant-fold-gep-overindex.ll Wed Aug 19 17:46:59 2009 @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | opt -instcombine +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-darwin10.0" + +%0 = type { i8*, [19 x i8] } +%1 = type { i8*, [0 x i8] } + + at s = external global %0 ; <%0*> [#uses=1] +@"\01LC8" = external constant [17 x i8] ; <[17 x i8]*> [#uses=1] + +define i32 @main() nounwind { +entry: + %0 = call i32 (i8*, ...)* @printf(i8* getelementptr ([17 x i8]* @"\01LC8", i32 0, i32 0), i8* undef, i8* getelementptr (%1* bitcast (%0* @s to %1*), i32 0, i32 1, i32 0)) nounwind ; [#uses=0] + ret i32 0 +} + +declare i32 @printf(i8*, ...) nounwind From resistor at mac.com Wed Aug 19 17:58:34 2009 From: resistor at mac.com (Owen Anderson) Date: Wed, 19 Aug 2009 22:58:34 -0000 Subject: [llvm-commits] [llvm] r79486 - /llvm/trunk/lib/VMCore/Attributes.cpp Message-ID: <200908192258.n7JMwY8K016069@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 19 17:58:34 2009 New Revision: 79486 URL: http://llvm.org/viewvc/llvm-project?rev=79486&view=rev Log: AttrListPtr operations need to be atomic. Modified: llvm/trunk/lib/VMCore/Attributes.cpp Modified: llvm/trunk/lib/VMCore/Attributes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=79486&r1=79485&r2=79486&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Attributes.cpp (original) +++ llvm/trunk/lib/VMCore/Attributes.cpp Wed Aug 19 17:58:34 2009 @@ -175,14 +175,17 @@ //===----------------------------------------------------------------------===// AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) { + sys::SmartScopedLock Lock(*ALMutex); if (LI) LI->AddRef(); } AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) { + sys::SmartScopedLock Lock(*ALMutex); if (AttrList) AttrList->AddRef(); } const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) { + sys::SmartScopedLock Lock(*ALMutex); if (AttrList == RHS.AttrList) return *this; if (AttrList) AttrList->DropRef(); AttrList = RHS.AttrList; @@ -191,6 +194,7 @@ } AttrListPtr::~AttrListPtr() { + sys::SmartScopedLock Lock(*ALMutex); if (AttrList) AttrList->DropRef(); } From greened at obbligato.org Wed Aug 19 18:00:07 2009 From: greened at obbligato.org (David Greene) Date: Wed, 19 Aug 2009 23:00:07 -0000 Subject: [llvm-commits] [llvm] r79487 - /llvm/trunk/include/llvm/CodeGen/MachineFunctionPass.h Message-ID: <200908192300.n7JN07eN016269@zion.cs.uiuc.edu> Author: greened Date: Wed Aug 19 18:00:07 2009 New Revision: 79487 URL: http://llvm.org/viewvc/llvm-project?rev=79487&view=rev Log: Remove an unnecessary include. Now we won't have circular include problems later on. Modified: llvm/trunk/include/llvm/CodeGen/MachineFunctionPass.h Modified: llvm/trunk/include/llvm/CodeGen/MachineFunctionPass.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunctionPass.h?rev=79487&r1=79486&r2=79487&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunctionPass.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunctionPass.h Wed Aug 19 18:00:07 2009 @@ -20,10 +20,11 @@ #define LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H #include "llvm/Pass.h" -#include "llvm/CodeGen/MachineFunction.h" namespace llvm { +class MachineFunction; + /// MachineFunctionPass - This class adapts the FunctionPass interface to /// allow convenient creation of passes that operate on the MachineFunction /// representation. Instead of overriding runOnFunction, subclasses From clattner at apple.com Wed Aug 19 18:06:03 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 19 Aug 2009 16:06:03 -0700 Subject: [llvm-commits] [llvm] r79484 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll In-Reply-To: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> References: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> Message-ID: On Aug 19, 2009, at 3:44 PM, Dale Johannesen wrote: > Author: johannes > Date: Wed Aug 19 17:44:41 2009 > New Revision: 79484 > > URL: http://llvm.org/viewvc/llvm-project?rev=79484&view=rev > Log: > Handle 'a' modifier in X86 asms. PR 4742. hi Dale, Any reason not to make this be a FileCheck style test? If you do that, you can merge it together with other tests as well. Also, no reason to use 'else if' after a return, just use 'if'. -Chris > +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed > Aug 19 17:44:41 2009 > @@ -620,6 +620,18 @@ > > switch (ExtraCode[0]) { > default: return true; // Unknown modifier. > + case 'a': // This is an address. Currently only 'i' and 'r' > are expected. > + if (MO.isImm()) { > + O << MO.getImm(); > + return false; > + } else if (MO.isReg()) { > + O << '('; > + printOperand(MI, OpNo); > + O << ')'; > + return false; > + } > + return true; > + > case 'c': // Don't print "$" before a global var name or constant. > if (MO.isImm()) > O << MO.getImm(); > > Added: llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll?rev=79484&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll > (added) > +++ llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll > Wed Aug 19 17:44:41 2009 > @@ -0,0 +1,18 @@ > +; RUN: llvm-as < %s | llc | grep {%gs:6} > +; RUN: llvm-as < %s | llc | grep {%gs:\\\(%*\\\)} > +; ModuleID = 'asm.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-darwin9.6" > + > +define i32 @main() nounwind { > +entry: > + %asmtmp.i = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", > "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 6) nounwind ; [#uses=1] > + %0 = zext i16 %asmtmp.i to i32 ; [#uses=1] > + ret i32 %0 > +} > + > +define zeroext i16 @readgsword2(i32 %address) nounwind { > +entry: > + %asmtmp = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", > "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 %address) nounwind ; > [#uses=1] > + ret i16 %asmtmp > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Aug 19 18:06:57 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 19 Aug 2009 16:06:57 -0700 Subject: [llvm-commits] [llvm] r79468 - /llvm/trunk/include/llvm/CodeGen/MachineDominators.h In-Reply-To: <6a8523d60908191503m4d4d5d2bs3c61e3b64fce06bd@mail.gmail.com> References: <200908192119.n7JLJf6o003455@zion.cs.uiuc.edu> <6a8523d60908191451t32ea3c1fl9a9c9b0117ccb178@mail.gmail.com> <200908191654.36200.greened@obbligato.org> <6a8523d60908191503m4d4d5d2bs3c61e3b64fce06bd@mail.gmail.com> Message-ID: On Aug 19, 2009, at 3:03 PM, Daniel Dunbar wrote: > On Wed, Aug 19, 2009 at 2:54 PM, David A. > Greene wrote: >> On Wednesday 19 August 2009 16:51, Daniel Dunbar wrote: >>> I don't understand these changes; everything was building fine? >> >> Because it won't be building fine as soon as I remove >> #include "llvm/CodeGen/MachineFunction.h" from MachineFunctionPass.h. > > Gotcha. Thanks for doing this David, pushing #includes "down" is great :) -Chris From tonic at nondot.org Wed Aug 19 18:07:37 2009 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 19 Aug 2009 23:07:37 -0000 Subject: [llvm-commits] [llvm] r79488 - /llvm/trunk/docs/HowToReleaseLLVM.html Message-ID: <200908192307.n7JN7b9i017253@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Aug 19 18:07:37 2009 New Revision: 79488 URL: http://llvm.org/viewvc/llvm-project?rev=79488&view=rev Log: Update the release process some more. Lots of good details now. Modified: llvm/trunk/docs/HowToReleaseLLVM.html Modified: llvm/trunk/docs/HowToReleaseLLVM.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/HowToReleaseLLVM.html?rev=79488&r1=79487&r2=79488&view=diff ============================================================================== --- llvm/trunk/docs/HowToReleaseLLVM.html (original) +++ llvm/trunk/docs/HowToReleaseLLVM.html Wed Aug 19 18:07:37 2009 @@ -93,8 +93,8 @@
  • Release final tasks
    1. -
    2. Tag the LLVM Release Branch
    3. Update Documentation
    4. +
    5. Tag the LLVM Release Branch
    6. Update the LLVM Demo Page
    7. Update the LLVM Website
    8. Announce the Release
    9. @@ -129,7 +129,7 @@

      Create the release branch for llvm, llvm-gcc4.2, clang, and the test-suite. The branch name will be release_XX,where XX is the major and minor release numbers. - Clang will have a different release number than llvm/ + Clang will have a different release number than llvm/ llvm-gcc4 since its first release was years later (still deciding if this will be true or not). These branches can be created without checking out anything from subversion. @@ -175,9 +175,10 @@ After creating the LLVM release branch, update the release branches' autoconf/configure.ac version from X.Xsvn to just X.X. Update it on mainline as well to be the next version (X.X+1svn). Regenerated the configure script - for both. This must be done for both llvm and the test-suite. + for both. This must be done for both llvm and the + test-suite.

      -

      FIXME: Add a note about clang.

      +

      FIXME: Add a note about clang.

      In addition, the version number of all the Bugzilla components must be updated for the next release.

      @@ -187,9 +188,9 @@

      - Create source distributions for LLVM, LLVM GCC, Clang, and the LLVM Test - Suite by exporting the source from Subversion and archiving it. This can be - done with the following commands: + Create source distributions for LLVM, LLVM-GCC, + clang, and the llvm test-suite by exporting the source from + Subversion and archiving it. This can be done with the following commands:

      @@ -211,16 +212,18 @@ Building the Release
      -Info about this. Criteria for a successful build. +The build of llvm, llvm-gcc, and clang must be free +of errors and warnings in both debug and release modes. If both debug and +release builds are clean, then the release passes build qualification.

      - Build both debug and release (optimized) versions of LLVM on all - platforms. Ensure the build is warning and error free on each platform. - Note that when building the LLVM GCC Binary, use a release build of LLVM. + Build both debug and release (optimized) versions of LLVM on all supported + platforms. Direction to build llvm are + here.

      @@ -235,7 +238,9 @@
      1. Build the LLVM GCC front-end by following the directions in the README.LLVM - file. Be sure to build with LLVM_VERSION_INFO=X.X, where X is the major and + file. The frontend must be compiled with c, c++, objc (mac only), + objc++ (mac only) and fortran support. + Be sure to build with LLVM_VERSION_INFO=X.X, where X is the major and minor release numbers.
      2. @@ -248,7 +253,8 @@
      - +

      Creating the Clang binary distribution (release/optimized) requires @@ -257,11 +263,15 @@

      1. - Instructions how to build it. + Build clang according to the directions + here.
      2. + +
      3. Build both a debug and release version of clang, but the binary + will be a release build.
      4. - Instructions on how to package + Package clang (details to follow).
      @@ -272,8 +282,24 @@ Details

    - Specify what is used to build llvm, llvm-gcc, clang on each target. + The table below specifies which compilers are used for each arch/os combination + when qualifying the build of llvm, llvm-gcc, clang. +

    + +

    + + + + + + + + + + +
    ArchitectureOScompiler
    x86-32Mac OS 10.5gcc 4.0.1
    x86-32Linuxgcc 4.2.X, gcc 4.3.X
    x86-32FreeBSDgcc ?
    x86-32mingwgcc ?
    x86-64Mac OS 10.5gcc 4.0.1
    x86-64Linuxgcc 4.2.X, gcc 4.3.X
    x86-64FreeBSDgcc?

    +
    @@ -282,7 +308,10 @@ Building the Release
    -How to qualify the release. + A release is qualified when it has no regressions from the previous + release (or baseline). Regressions are related to correctness only and not + performance at this time. Regressions are new failures in the set of tests that + are used to qualify each product and do not include anything not in the list.
    @@ -290,29 +319,45 @@

    - Details

    + LLVM is qualified when it has a clean dejagnu test run without a frontend and + it has no regressions when using either llvm-gcc or clang + with the test-suite from the previous release. +

    - Details.

    + LLVM-GCC is qualified when front-end specific tests in the + llvm dejagnu test suite all pass and there are no regressions in + the test-suite.

    +

    We do not use the gcc dejagnu test suite as release criteria.

    -

    - Details.

    + Clang is qualified when front-end specific tests in the + llvm dejagnu test suite all pass, clang's own test suite passes + cleanly, and there are no regressions in the test-suite.

    -

    - Details

    +

    + + + + + + + + +
    ArchitectureOSllvm-gcc baselineclang baseline + tests
    x86-32Mac OS 10.5last releasenonellvm dejagnu, clang tests, test-suite (including spec)
    x86-32Linuxlast releasenonellvm dejagnu, clang tests, test-suite (including spec)
    x86-32FreeBSDnonenonellvm dejagnu, clang tests, test-suite
    x86-32mingwlast releasenoneQT
    x86-64Mac OS 10.5last releasenonellvm dejagnu, clang tests, test-suite (including spec)
    x86-64Linuxlast releasenonellvm dejagnu, clang tests, test-suite (including spec)
    x86-64FreeBSDnonenonellvm dejagnu, clang tests, test-suite

    @@ -323,24 +368,28 @@ tar balls may be put on the website and the LLVM community is notified. Ask that all LLVM developers test the release in 2 ways:

      -
    1. Download llvm-X.X, llvm-test-X.X, and the appropriate llvm-gcc4 binary. - Run "make check" and the full llvm-test suite (make TEST=nightly report).
    2. -
    3. Download llvm-X.X, llvm-test-X.X, and the llvm-gcc4 source. Compile - everything. Run "make check" and the full llvm-test suite (make TEST=nightly +
    4. Download llvm-X.X, llvm-test-X.X, and the appropriate llvm-gcc4 + and/or clang binary. Build LLVM. + Run "make check" and the full llvm-test suite (make TEST=nightly report).
    5. +
    6. Download llvm-X.X, llvm-test-X.X, and the llvm-gcc4 and/or clang source. + Compile everything. Run "make check" and the full llvm-test suite (make TEST=nightly report).

    Ask LLVM developers to submit the report and make check results to the list. - Verify that there are no regressions from the previous release. For - unsupported targets, verify that make check at least is clean.

    + Attempt to verify that there are no regressions from the previous release. + The results are not used to qualify a release, but to spot other potential + problems. For unsupported targets, verify that make check at least is + clean.

    -

    The first round of pre-release testing will be the longest. During this time, - all regressions must be fixed before the second pre-release is created (repeat - steps 4-8).

    +

    During the first round of testing time, + all regressions must be fixed before the second pre-release is created.

    -

    If this is the second round of testing, this is only to ensure the bug fixes - previously merged in have not created new major problems. This is not the time - to solve additional and unrelated bugs. If no patches are merged in, the release - is determined to be ready and the release manager may move onto the next step.

    +

    If this is the second round of testing, this is only to ensure the bug + fixes previously merged in have not created new major problems. This is not + the time to solve additional and unrelated bugs. If no patches are merged in, + the release is determined to be ready and the release manager may move onto + the next step. +

    @@ -348,7 +397,19 @@

    - Details

    + Below are the rules regarding patching the release branch.

    +

    +

  • Patches applied to the release branch are only applied by the release + manager.
  • +
  • During the first round of testing, patches that fix regressions or that + are small and relatively risk free (verified by the appropriate code owner) + are applied to the branch. Code owners are asked to be very conservative in + approving patches for the branch and we reserve the right to reject any patch + that does not fix a regression as previously defined.
  • +
  • During the remaining rounds of testing, only patches that fix regressions + may be applied.
  • + +

    @@ -357,11 +418,28 @@

    - Details

    + The final stages of the release process involving taging the release branch, + updating documentation that refers to the release, and updating the demo + page.

    +

    FIXME: Add a note if anything needs to be done to the clang website. + Eventually the websites will be merged hopefully.

    + +
    +

    + Review the documentation and ensure that it is up to date. The Release Notes + must be updated to reflect bug fixes, new known issues, and changes in the + list of supported platforms. The Getting Started Guide should be updated to + reflect the new release version number tag avaiable from Subversion and + changes in basic system requirements. Merge both changes from mainline into + the release branch. +

    +
    + +

    Tag the release branch using the following procedure:

    @@ -377,18 +455,7 @@
    - - -
    -

    - Review the documentation and ensure that it is up to date. The Release Notes - must be updated to reflect bug fixes, new known issues, and changes in the - list of supported platforms. The Getting Started Guide should be updated to - reflect the new release version number tag avaiable from Subversion and - changes in basic system requirements. Merge both changes from mainline into - the release branch. -

    -
    + @@ -408,7 +475,8 @@
    1. Check out the website module from CVS.
    2. Create a new subdirectory X.X in the releases directory.
    3. -
    4. Commit the llvm, test-suite, llvm-gcc source, +
    5. Commit the llvm, test-suite, llvm-gcc source, + clang source, clang binaries, and llvm-gcc binaries in this new directory.
    6. Copy and commit the llvm/docs and LICENSE.txt files into this new directory. The docs should be built with BUILD_FOR_WEBSITE=1.
    7. From clattner at apple.com Wed Aug 19 18:08:01 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 19 Aug 2009 16:08:01 -0700 Subject: [llvm-commits] [llvm] r79472 - /llvm/trunk/lib/System/Unix/Process.inc In-Reply-To: <200908192148.n7JLmYpD007114@zion.cs.uiuc.edu> References: <200908192148.n7JLmYpD007114@zion.cs.uiuc.edu> Message-ID: <7A51ACE3-FF57-493E-A9AF-D6629B8C3A85@apple.com> On Aug 19, 2009, at 2:48 PM, Owen Anderson wrote: > Author: resistor > Date: Wed Aug 19 16:48:34 2009 > New Revision: 79472 > > URL: http://llvm.org/viewvc/llvm-project?rev=79472&view=rev > Log: > Get rid of a helgrind warning. If this is _actually_ a performance > problem, > we can find a way to cache the answer that isn't racy. Hi Owen, We really don't want to do a syscall every time this function is called. -Chris > > Modified: > llvm/trunk/lib/System/Unix/Process.inc > > Modified: llvm/trunk/lib/System/Unix/Process.inc > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Process.inc?rev=79472&r1=79471&r2=79472&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/System/Unix/Process.inc (original) > +++ llvm/trunk/lib/System/Unix/Process.inc Wed Aug 19 16:48:34 2009 > @@ -46,11 +46,11 @@ > // On Cygwin, getpagesize() returns 64k but the page size for the > purposes of > // memory protection and mmap() is 4k. > // See http://www.cygwin.com/ml/cygwin/2009-01/threads.html#00492 > - static const int page_size = 0x1000; > + const int page_size = 0x1000; > #elif defined(HAVE_GETPAGESIZE) > - static const int page_size = ::getpagesize(); > + const int page_size = ::getpagesize(); > #elif defined(HAVE_SYSCONF) > - static long page_size = ::sysconf(_SC_PAGE_SIZE); > + long page_size = ::sysconf(_SC_PAGE_SIZE); > #else > #warning Cannot get the page size on this machine > #endif > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Aug 19 18:08:31 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 19 Aug 2009 16:08:31 -0700 Subject: [llvm-commits] [llvm] r79358 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/Support/IOManip.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp In-Reply-To: <200908191638.58996.greened@obbligato.org> References: <200908181922.n7IJMtJB013528@zion.cs.uiuc.edu> <3B60E36A-F20A-45B2-8392-C8E3ABB2150F@apple.com> <200908191638.58996.greened@obbligato.org> Message-ID: On Aug 19, 2009, at 2:38 PM, David A. Greene wrote: > On Wednesday 19 August 2009 01:42, Chris Lattner wrote: >> On Aug 18, 2009, at 12:22 PM, David Greene wrote: >>> Author: greened >>> Date: Tue Aug 18 14:22:55 2009 >>> New Revision: 79358 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=79358&view=rev >>> Log: >>> >>> Make various changes suggested by Chris. >> >> Thanks David, >> >> Why did you add all the forward declarations and #include to >> AsmPrinter.h? > > Sorry, leakage from another fix. I've discovered that lots of > source files are missing #includes they should have. I found > this out when making some changes to add the AsmPrinter MachineInstr > flags we've discussed. I'm in the midst of checking in a bunch > of fixes of this nature. Ok! -Chris From gohman at apple.com Wed Aug 19 18:18:49 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 23:18:49 -0000 Subject: [llvm-commits] [llvm] r79490 - in /llvm/trunk/test/Transforms/SimplifyLibCalls: FPrintF.ll Puts.ll SPrintF.ll StrCat.ll StrChr.ll StrCpy.ll StrNCat.ll StrNCpy.ll Message-ID: <200908192318.n7JNInF2018721@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 18:18:49 2009 New Revision: 79490 URL: http://llvm.org/viewvc/llvm-project?rev=79490&view=rev Log: Add targetdata strings to these tests, since SimplifyLibCalls uses TargetData to find the pointer size. Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/FPrintF.ll llvm/trunk/test/Transforms/SimplifyLibCalls/Puts.ll llvm/trunk/test/Transforms/SimplifyLibCalls/SPrintF.ll llvm/trunk/test/Transforms/SimplifyLibCalls/StrCat.ll llvm/trunk/test/Transforms/SimplifyLibCalls/StrChr.ll llvm/trunk/test/Transforms/SimplifyLibCalls/StrCpy.ll llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCat.ll llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCpy.ll Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/FPrintF.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/FPrintF.ll?rev=79490&r1=79489&r2=79490&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/FPrintF.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/FPrintF.ll Wed Aug 19 18:18:49 2009 @@ -1,7 +1,10 @@ ; Test that the FPrintFOptimizer works correctly ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \ ; RUN: not grep {call.*fprintf} -; + +; This transformation requires the pointer size, as it assumes that size_t is +; the size of a pointer. +target datalayout = "-p:64:64:64" %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [52 x i8] } %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 } Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/Puts.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/Puts.ll?rev=79490&r1=79489&r2=79490&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/Puts.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/Puts.ll Wed Aug 19 18:18:49 2009 @@ -1,7 +1,10 @@ ; Test that the PutsCatOptimizer works correctly ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \ ; RUN: not grep {call.*fputs} -; + +; This transformation requires the pointer size, as it assumes that size_t is +; the size of a pointer. +target datalayout = "-p:64:64:64" %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [52 x i8] } %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 } Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/SPrintF.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/SPrintF.ll?rev=79490&r1=79489&r2=79490&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/SPrintF.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/SPrintF.ll Wed Aug 19 18:18:49 2009 @@ -2,6 +2,10 @@ ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \ ; RUN: not grep {call.*sprintf} +; This transformation requires the pointer size, as it assumes that size_t is +; the size of a pointer. +target datalayout = "-p:64:64:64" + @hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1] @null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] @null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1] Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/StrCat.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/StrCat.ll?rev=79490&r1=79489&r2=79490&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/StrCat.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/StrCat.ll Wed Aug 19 18:18:49 2009 @@ -5,6 +5,10 @@ ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \ ; RUN: grep {puts.*%arg1} +; This transformation requires the pointer size, as it assumes that size_t is +; the size of a pointer. +target datalayout = "-p:64:64:64" + @hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1] @null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] @null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1] Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/StrChr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/StrChr.ll?rev=79490&r1=79489&r2=79490&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/StrChr.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/StrChr.ll Wed Aug 19 18:18:49 2009 @@ -2,6 +2,10 @@ ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \ ; RUN: not grep {call.*@strchr} +; This transformation requires the pointer size, as it assumes that size_t is +; the size of a pointer. +target datalayout = "-p:64:64:64" + @hello = constant [14 x i8] c"hello world\5Cn\00" ; <[14 x i8]*> [#uses=1] @null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/StrCpy.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/StrCpy.ll?rev=79490&r1=79489&r2=79490&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/StrCpy.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/StrCpy.ll Wed Aug 19 18:18:49 2009 @@ -2,6 +2,10 @@ ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \ ; RUN: not grep {call.*strcpy} +; This transformation requires the pointer size, as it assumes that size_t is +; the size of a pointer. +target datalayout = "-p:64:64:64" + @hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1] @null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] @null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1] Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCat.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCat.ll?rev=79490&r1=79489&r2=79490&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCat.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCat.ll Wed Aug 19 18:18:49 2009 @@ -4,6 +4,10 @@ ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \ ; RUN: grep {puts.*%arg1} +; This transformation requires the pointer size, as it assumes that size_t is +; the size of a pointer. +target datalayout = "-p:64:64:64" + @hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1] @null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] @null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1] Modified: llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCpy.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCpy.ll?rev=79490&r1=79489&r2=79490&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCpy.ll (original) +++ llvm/trunk/test/Transforms/SimplifyLibCalls/StrNCpy.ll Wed Aug 19 18:18:49 2009 @@ -2,6 +2,10 @@ ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \ ; RUN: not grep {call.*strncpy} +; This transformation requires the pointer size, as it assumes that size_t is +; the size of a pointer. +target datalayout = "-p:64:64:64" + @hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1] @null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] @null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1] From gohman at apple.com Wed Aug 19 18:19:36 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 23:19:36 -0000 Subject: [llvm-commits] [llvm] r79491 - /llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll Message-ID: <200908192319.n7JNJaTb018827@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 18:19:36 2009 New Revision: 79491 URL: http://llvm.org/viewvc/llvm-project?rev=79491&view=rev Log: Loosen up the regex for this test so that it doesn't implicitly depend on TargetData information. Modified: llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll Modified: llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll?rev=79491&r1=79490&r2=79491&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll Wed Aug 19 18:19:36 2009 @@ -1,5 +1,7 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ -; RUN: | grep {\{%d,+,4\}} +; RUN: | grep {\{%d,+,\[^\{\}\]\*\}} + +; ScalarEvolution should be able to understand the loop and eliminate the casts. define void @foo(i32* nocapture %d, i32 %n) nounwind { entry: From idadesub at users.sourceforge.net Wed Aug 19 18:24:51 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Wed, 19 Aug 2009 16:24:51 -0700 Subject: [llvm-commits] [llvm] r79401 - /llvm/trunk/include/llvm/CodeGen/ValueTypes.h In-Reply-To: <1787732E-914F-48C8-A088-7590AE0C61E8@apple.com> References: <200908190253.n7J2r7Q9005307@zion.cs.uiuc.edu> <1787732E-914F-48C8-A088-7590AE0C61E8@apple.com> Message-ID: <1ef034530908191624w3628421fvad6cd27d342d5701@mail.gmail.com> On Wed, Aug 19, 2009 at 11:44 AM, Bill Wendling wrote: > On Aug 18, 2009, at 7:53 PM, Erick Tryzelaar wrote: > > Hi Erick, > > Why did you choose the name "FirstExtendedValueType"? If it's a sentinel, > maybe just name it so... I named it that since it appears that extended value types start at 256. But you're right, I probably should have named it something else. Following the other variants, does "INVALID_SIMPLE_VALUE_TYPE" sound reasonable? I can also rename all of the LastSimpleValueType+1 expressions with it. From dalej at apple.com Wed Aug 19 18:31:11 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Aug 2009 16:31:11 -0700 Subject: [llvm-commits] [llvm] r79484 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll In-Reply-To: References: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> Message-ID: <55BEFEE3-7A09-487D-BD9D-C8CA116098D5@apple.com> On Aug 19, 2009, at 4:06 PMPDT, Chris Lattner wrote: >> >> URL: http://llvm.org/viewvc/llvm-project?rev=79484&view=rev >> Log: >> Handle 'a' modifier in X86 asms. PR 4742. > > hi Dale, > > Any reason not to make this be a FileCheck style test? If you do > that, you can merge it together with other tests as well. It uses a regexp. FileCheck doesn't support those, right? > Also, no reason to use 'else if' after a return, just use 'if'. All right, I suppose, to me it reads much better this way, but it's not really important. From daniel at zuster.org Wed Aug 19 18:37:24 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 19 Aug 2009 23:37:24 -0000 Subject: [llvm-commits] [llvm] r79492 - in /llvm/trunk: include/llvm/ADT/Twine.h lib/VMCore/Value.cpp Message-ID: <200908192337.n7JNbOJg021059@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 19 18:37:23 2009 New Revision: 79492 URL: http://llvm.org/viewvc/llvm-project?rev=79492&view=rev Log: Add a fast path for setName("") on an unnamed value. Modified: llvm/trunk/include/llvm/ADT/Twine.h llvm/trunk/lib/VMCore/Value.cpp Modified: llvm/trunk/include/llvm/ADT/Twine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Twine.h?rev=79492&r1=79491&r2=79492&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Twine.h (original) +++ llvm/trunk/include/llvm/ADT/Twine.h Wed Aug 19 18:37:23 2009 @@ -321,6 +321,16 @@ } /// @} + /// @name Predicate Operations + /// @{ + + /// isTriviallyEmpty - Check if this twine is trivially empty; a false + /// return value does not necessarily mean the twine is empty. + bool isTriviallyEmpty() const { + return isNullary(); + } + + /// @} /// @name String Operations /// @{ Modified: llvm/trunk/lib/VMCore/Value.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=79492&r1=79491&r2=79492&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Value.cpp (original) +++ llvm/trunk/lib/VMCore/Value.cpp Wed Aug 19 18:37:23 2009 @@ -171,6 +171,10 @@ } void Value::setName(const Twine &NewName) { + // Fast path for common IRBuilder case of setName("") when there is no name. + if (NewName.isTriviallyEmpty() && !hasName()) + return; + SmallString<256> NameData; NewName.toVector(NameData); From gohman at apple.com Wed Aug 19 18:38:22 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 19 Aug 2009 23:38:22 -0000 Subject: [llvm-commits] [llvm] r79493 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200908192338.n7JNcNX2021194@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 18:38:22 2009 New Revision: 79493 URL: http://llvm.org/viewvc/llvm-project?rev=79493&view=rev Log: Fix a few places to check if TargetData is available before using it. 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=79493&r1=79492&r2=79493&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Aug 19 18:38:22 2009 @@ -478,9 +478,9 @@ // We don't want to form an inttoptr or ptrtoint that converts to an integer // type that differs from the pointer size. if ((Res == Instruction::IntToPtr && - SrcTy != TD->getIntPtrType(CI->getContext())) || + (!TD || SrcTy != TD->getIntPtrType(CI->getContext()))) || (Res == Instruction::PtrToInt && - DstTy != TD->getIntPtrType(CI->getContext()))) + (!TD || DstTy != TD->getIntPtrType(CI->getContext())))) Res = 0; return Instruction::CastOps(Res); From reid at kleckner.net Wed Aug 19 18:40:00 2009 From: reid at kleckner.net (Reid Kleckner) Date: Wed, 19 Aug 2009 23:40:00 -0000 Subject: [llvm-commits] [llvm] r79494 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200908192340.n7JNe0vo021397@zion.cs.uiuc.edu> Author: rnk Date: Wed Aug 19 18:39:59 2009 New Revision: 79494 URL: http://llvm.org/viewvc/llvm-project?rev=79494&view=rev Log: Modify an assert to avoid what looks like a GCC 4.2.4 signed-ness bug. Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=79494&r1=79493&r2=79494&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Wed Aug 19 18:39:59 2009 @@ -495,9 +495,11 @@ // complains about casting a function pointer to a normal pointer. JCE.startGVStub(F, Stub, 5); JCE.emitByte(0xE9); -#if defined (X86_64_JIT) - assert(((((intptr_t)Fn-JCE.getCurrentPCValue()-5) << 32) >> 32) == - ((intptr_t)Fn-JCE.getCurrentPCValue()-5) +#if defined (X86_64_JIT) && !defined (NDEBUG) + // Yes, we need both of these casts, or some broken versions of GCC (4.2.4) + // get the signed-ness of the expression wrong. Go figure. + intptr_t Displacement = (intptr_t)Fn - (intptr_t)JCE.getCurrentPCValue() - 5; + assert(((Displacement << 32) >> 32) == Displacement && "PIC displacement does not fit in displacement field!"); #endif JCE.emitWordLE((intptr_t)Fn-JCE.getCurrentPCValue()-4); From dalej at apple.com Wed Aug 19 18:44:02 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Aug 2009 23:44:02 -0000 Subject: [llvm-commits] [llvm] r79495 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Message-ID: <200908192344.n7JNi21Z021907@zion.cs.uiuc.edu> Author: johannes Date: Wed Aug 19 18:44:01 2009 New Revision: 79495 URL: http://llvm.org/viewvc/llvm-project?rev=79495&view=rev Log: Add an extra line to conform with preferred style. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp 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=79495&r1=79494&r2=79495&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Aug 19 18:44:01 2009 @@ -624,7 +624,8 @@ if (MO.isImm()) { O << MO.getImm(); return false; - } else if (MO.isReg()) { + } + if (MO.isReg()) { O << '('; printOperand(MI, OpNo); O << ')'; From clattner at apple.com Wed Aug 19 19:20:40 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 19 Aug 2009 17:20:40 -0700 Subject: [llvm-commits] [llvm] r79484 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll In-Reply-To: <55BEFEE3-7A09-487D-BD9D-C8CA116098D5@apple.com> References: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> <55BEFEE3-7A09-487D-BD9D-C8CA116098D5@apple.com> Message-ID: On Aug 19, 2009, at 4:31 PM, Dale Johannesen wrote: > > On Aug 19, 2009, at 4:06 PMPDT, Chris Lattner wrote: >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=79484&view=rev >>> Log: >>> Handle 'a' modifier in X86 asms. PR 4742. >> >> hi Dale, >> >> Any reason not to make this be a FileCheck style test? If you do >> that, you can merge it together with other tests as well. > > It uses a regexp. FileCheck doesn't support those, right? Filecheck doesn't support regex's yet, why does it need to be a regex? >> Also, no reason to use 'else if' after a return, just use 'if'. > > All right, I suppose, to me it reads much better this way, but it's > not really important. I'd prefer it for consistency. -Chris From dalej at apple.com Wed Aug 19 19:23:38 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Aug 2009 17:23:38 -0700 Subject: [llvm-commits] [llvm] r79484 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll In-Reply-To: References: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> <55BEFEE3-7A09-487D-BD9D-C8CA116098D5@apple.com> Message-ID: <5EABEA63-FDE4-4B3E-9745-646380B7B69D@apple.com> On Aug 19, 2009, at 5:20 PMPDT, Chris Lattner wrote: > On Aug 19, 2009, at 4:31 PM, Dale Johannesen wrote: >> On Aug 19, 2009, at 4:06 PMPDT, Chris Lattner wrote: >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=79484&view=rev >>>> Log: >>>> Handle 'a' modifier in X86 asms. PR 4742. >>> >>> hi Dale, >>> >>> Any reason not to make this be a FileCheck style test? If you do >>> that, you can merge it together with other tests as well. >> >> It uses a regexp. FileCheck doesn't support those, right? > > Filecheck doesn't support regex's yet, why does it need to be a regex? Because the test has nothing to do with whatever register RA is currently assigning, and shouldn't be dependent on it. >>> Also, no reason to use 'else if' after a return, just use 'if'. >> >> All right, I suppose, to me it reads much better this way, but it's >> not really important. > > I'd prefer it for consistency. Done. From clattner at apple.com Wed Aug 19 19:27:37 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 19 Aug 2009 17:27:37 -0700 Subject: [llvm-commits] [llvm] r79484 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll In-Reply-To: <5EABEA63-FDE4-4B3E-9745-646380B7B69D@apple.com> References: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> <55BEFEE3-7A09-487D-BD9D-C8CA116098D5@apple.com> <5EABEA63-FDE4-4B3E-9745-646380B7B69D@apple.com> Message-ID: On Aug 19, 2009, at 5:23 PM, Dale Johannesen wrote: > On Aug 19, 2009, at 5:20 PMPDT, Chris Lattner wrote: >> On Aug 19, 2009, at 4:31 PM, Dale Johannesen wrote: >>> On Aug 19, 2009, at 4:06 PMPDT, Chris Lattner wrote: >>>>> >>>>> URL: http://llvm.org/viewvc/llvm-project?rev=79484&view=rev >>>>> Log: >>>>> Handle 'a' modifier in X86 asms. PR 4742. >>>> >>>> hi Dale, >>>> >>>> Any reason not to make this be a FileCheck style test? If you do >>>> that, you can merge it together with other tests as well. >>> >>> It uses a regexp. FileCheck doesn't support those, right? >> >> Filecheck doesn't support regex's yet, why does it need to be a >> regex? > > Because the test has nothing to do with whatever register RA is > currently assigning, and shouldn't be dependent on it. If regalloc picks a register other than eax, it's a bug that would be good to catch because that would be increasing number of used registers. > >>>> Also, no reason to use 'else if' after a return, just use 'if'. >>> >>> All right, I suppose, to me it reads much better this way, but >>> it's not really important. >> >> I'd prefer it for consistency. > > Done. Thanks! -Chris From sabre at nondot.org Wed Aug 19 19:29:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 20 Aug 2009 00:29:24 -0000 Subject: [llvm-commits] [llvm] r79498 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200908200029.n7K0TOpD027571@zion.cs.uiuc.edu> Author: lattner Date: Wed Aug 19 19:29:24 2009 New Revision: 79498 URL: http://llvm.org/viewvc/llvm-project?rev=79498&view=rev Log: minor grammar tweak 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=79498&r1=79497&r2=79498&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Wed Aug 19 19:29:24 2009 @@ -2422,7 +2422,7 @@

      Conceptually, LLVMContext provides isolation. Every LLVM entity (Modules, Values, Types, Constants, etc.) -in LLVM's in-memory IR belongs to an LLVMContext. Entities in +in LLVM's in-memory IR belong to an LLVMContext. Entities in different contexts cannot interact with each other: Modules in different contexts cannot be linked together, Functions cannot be added to Modules in different contexts, etc. What this means is that is is From dalej at apple.com Wed Aug 19 19:40:44 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Aug 2009 17:40:44 -0700 Subject: [llvm-commits] [llvm] r79484 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll In-Reply-To: References: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> <55BEFEE3-7A09-487D-BD9D-C8CA116098D5@apple.com> <5EABEA63-FDE4-4B3E-9745-646380B7B69D@apple.com> Message-ID: On Aug 19, 2009, at 5:27 PMPDT, Chris Lattner wrote: > On Aug 19, 2009, at 5:23 PM, Dale Johannesen wrote: >> On Aug 19, 2009, at 5:20 PMPDT, Chris Lattner wrote: >>> On Aug 19, 2009, at 4:31 PM, Dale Johannesen wrote: >>>> On Aug 19, 2009, at 4:06 PMPDT, Chris Lattner wrote: >>>>>> >>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=79484&view=rev >>>>>> Log: >>>>>> Handle 'a' modifier in X86 asms. PR 4742. >>>>> >>>>> hi Dale, >>>>> >>>>> Any reason not to make this be a FileCheck style test? If you >>>>> do that, you can merge it together with other tests as well. >>>> >>>> It uses a regexp. FileCheck doesn't support those, right? >>> >>> Filecheck doesn't support regex's yet, why does it need to be a >>> regex? >> >> Because the test has nothing to do with whatever register RA is >> currently assigning, and shouldn't be dependent on it. > > If regalloc picks a register other than eax, it's a bug that would > be good to catch because that would be increasing number of used > registers. No, using ecx or edx would not make the code quality any worse. From grosbach at apple.com Wed Aug 19 20:03:49 2009 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 20 Aug 2009 01:03:49 -0000 Subject: [llvm-commits] [llvm] r79501 - /llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Message-ID: <200908200103.n7K13nkn031873@zion.cs.uiuc.edu> Author: grosbach Date: Wed Aug 19 20:03:48 2009 New Revision: 79501 URL: http://llvm.org/viewvc/llvm-project?rev=79501&view=rev Log: Check for shared landing pads when assigning call site values. Invokes which share a landing pad should also use the same call site value. Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=79501&r1=79500&r2=79501&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (original) +++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Wed Aug 19 20:03:48 2009 @@ -24,6 +24,7 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Local.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/CommandLine.h" @@ -69,8 +70,7 @@ private: void markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, - Value *CallSite, - SwitchInst *CatchSwitch); + Value *CallSite); void splitLiveRangesLiveAcrossInvokes(SmallVector &Invokes); bool insertSjLjEHSupport(Function &F); }; @@ -125,14 +125,9 @@ /// markInvokeCallSite - Insert code to mark the call_site for this invoke void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, - Value *CallSite, - SwitchInst *CatchSwitch) { + Value *CallSite) { ConstantInt *CallSiteNoC= ConstantInt::get(Type::getInt32Ty(II->getContext()), InvokeNo); - // The runtime comes back to the dispatcher with the call_site - 1 in - // the context. Odd, but there it is. - ConstantInt *SwitchValC = ConstantInt::get(Type::getInt32Ty(II->getContext()), - InvokeNo - 1); // If the unwind edge has phi nodes, split the edge. if (isa(II->getUnwindDest()->begin())) { @@ -149,8 +144,6 @@ // location afterward. new StoreInst(CallSiteNoC, CallSite, true, II); // volatile - // Add a switch case to our unwind block. - CatchSwitch->addCase(SwitchValC, II->getUnwindDest()); // We still want this to look like an invoke so we emit the LSDA properly // FIXME: ??? Or will this cause strangeness with mis-matched IDs like // when it was in the front end? @@ -294,13 +287,6 @@ if (!Invokes.empty()) { // We have invokes, so we need to add register/unregister calls to get // this function onto the global unwind stack. - // - // First thing we need to do is scan the whole function for values that are - // live across unwind edges. Each value that is live across an unwind edge - // we spill into a stack location, guaranteeing that there is nothing live - // across the unwind edge. This process also splits all critical edges - // coming out of invoke's. - splitLiveRangesLiveAcrossInvokes(Invokes); BasicBlock *EntryBB = F.begin(); // Create an alloca for the incoming jump buffer ptr and the new jump buffer @@ -472,11 +458,32 @@ ContBlock->getTerminator()); Register->setDoesNotThrow(); - // At this point, we are all set up, update the invoke instructions + // At this point, we are all set up. Update the invoke instructions // to mark their call_site values, and fill in the dispatch switch // accordingly. - for (unsigned i = 0, e = Invokes.size(); i != e; ++i) - markInvokeCallSite(Invokes[i], i+1, CallSite, DispatchSwitch); + DenseMap PadSites; + unsigned NextCallSiteValue = 1; + for (SmallVector::iterator I = Invokes.begin(), + E = Invokes.end(); I < E; ++I) { + unsigned CallSiteValue; + BasicBlock *LandingPad = (*I)->getSuccessor(1); + // landing pads can be shared. If we see a landing pad again, we + // want to make sure to use the same call site index so the dispatch + // will go to the right place. + CallSiteValue = PadSites[LandingPad]; + if (!CallSiteValue) { + CallSiteValue = NextCallSiteValue++; + PadSites[LandingPad] = CallSiteValue; + // Add a switch case to our unwind block. The runtime comes back + // to the dispatcher with the call_site - 1 in the context. Odd, + // but there it is. + ConstantInt *SwitchValC = + ConstantInt::get(Type::getInt32Ty((*I)->getContext()), + CallSiteValue - 1); + DispatchSwitch->addCase(SwitchValC, (*I)->getUnwindDest()); + } + markInvokeCallSite(*I, CallSiteValue, CallSite); + } // The front end has likely added calls to _Unwind_Resume. We need // to find those calls and mark the call_site as -1 immediately prior. @@ -504,6 +511,13 @@ Unwinds[i]->eraseFromParent(); } + // Scan the whole function for values that are live across unwind edges. + // Each value that is live across an unwind edge we spill into a stack + // location, guaranteeing that there is nothing live across the unwind + // edge. This process also splits all critical edges coming out of + // invoke's. + splitLiveRangesLiveAcrossInvokes(Invokes); + // Finally, for any returns from this function, if this function contains an // invoke, add a call to unregister the function context. for (unsigned i = 0, e = Returns.size(); i != e; ++i) From eli.friedman at gmail.com Wed Aug 19 20:21:04 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 19 Aug 2009 18:21:04 -0700 Subject: [llvm-commits] [llvm] r79498 - /llvm/trunk/docs/ProgrammersManual.html In-Reply-To: <200908200029.n7K0TOpD027571@zion.cs.uiuc.edu> References: <200908200029.n7K0TOpD027571@zion.cs.uiuc.edu> Message-ID: On Wed, Aug 19, 2009 at 5:29 PM, Chris Lattner wrote: > @@ -2422,7 +2422,7 @@ > ?

      > ?Conceptually, LLVMContext provides isolation. ?Every LLVM entity > ?(Modules, Values, Types, Constants, etc.) > -in LLVM's in-memory IR belongs to an LLVMContext. ?Entities in > +in LLVM's in-memory IR belong to an LLVMContext. ?Entities in I don't mean to be pedantic, but I think "belongs" is right here: "entity" is singular, even though the sentence is referring to a set of entities. -Eli From gohman at apple.com Wed Aug 19 20:33:25 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 20 Aug 2009 01:33:25 -0000 Subject: [llvm-commits] [llvm] r79503 - /llvm/trunk/include/llvm/Target/TargetInstrInfo.h Message-ID: <200908200133.n7K1XPwa003229@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 20:33:25 2009 New Revision: 79503 URL: http://llvm.org/viewvc/llvm-project?rev=79503&view=rev Log: Reword a few comments for AnalyzeBranch and InsertBranch, and fix a few typos. Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=79503&r1=79502&r2=79503&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Wed Aug 19 20:33:25 2009 @@ -211,15 +211,15 @@ /// 2. If this block ends with only an unconditional branch, it sets TBB to be /// the destination block. /// 3. If this block ends with an conditional branch and it falls through to - /// an successor block, it sets TBB to be the branch destination block and + /// a successor block, it sets TBB to be the branch destination block and /// a list of operands that evaluate the condition. These /// operands can be passed to other TargetInstrInfo methods to create new /// branches. - /// 4. If this block ends with an conditional branch and an unconditional - /// block, it returns the 'true' destination in TBB, the 'false' - /// destination in FBB, and a list of operands that evaluate the condition. - /// These operands can be passed to other TargetInstrInfo methods to create - /// new branches. + /// 4. If this block ends with a conditional branch followed by an + /// unconditional branch, it returns the 'true' destination in TBB, the + /// 'false' destination in FBB, and a list of operands that evaluate the + /// condition. These operands can be passed to other TargetInstrInfo + /// methods to create new branches. /// /// Note that RemoveBranch and InsertBranch must be implemented to support /// cases where this method returns success. @@ -233,7 +233,7 @@ bool AllowModify = false) const { return true; } - + /// RemoveBranch - Remove the branching code at the end of the specific MBB. /// This is only invoked in cases where AnalyzeBranch returns success. It /// returns the number of instructions that were removed. @@ -241,13 +241,12 @@ assert(0 && "Target didn't implement TargetInstrInfo::RemoveBranch!"); return 0; } - - /// InsertBranch - Insert a branch into the end of the specified - /// MachineBasicBlock. This operands to this method are the same as those - /// returned by AnalyzeBranch. This is invoked in cases where AnalyzeBranch - /// returns success and when an unconditional branch (TBB is non-null, FBB is - /// null, Cond is empty) needs to be inserted. It returns the number of - /// instructions inserted. + + /// InsertBranch - Insert branch code into the end of the specified + /// MachineBasicBlock. The operands to this method are the same as those + /// returned by AnalyzeBranch. This is only invoked in cases where + /// AnalyzeBranch returns success. It returns the number of instructions + /// inserted. /// /// It is also invoked by tail merging to add unconditional branches in /// cases where AnalyzeBranch doesn't apply because there was no original From rjmccall at apple.com Wed Aug 19 20:36:04 2009 From: rjmccall at apple.com (John McCall) Date: Wed, 19 Aug 2009 18:36:04 -0700 Subject: [llvm-commits] [llvm] r79498 - /llvm/trunk/docs/ProgrammersManual.html In-Reply-To: References: <200908200029.n7K0TOpD027571@zion.cs.uiuc.edu> Message-ID: <4A8CA884.7090003@apple.com> Eli Friedman wrote: > On Wed, Aug 19, 2009 at 5:29 PM, Chris Lattner wrote: > >> @@ -2422,7 +2422,7 @@ >>

      >> Conceptually, LLVMContext provides isolation. Every LLVM entity >> (Modules, Values, Types, Constants, etc.) >> -in LLVM's in-memory IR belongs to an LLVMContext. Entities in >> +in LLVM's in-memory IR belong to an LLVMContext. Entities in >> > > I don't mean to be pedantic, but I think "belongs" is right here: > "entity" is singular, even though the sentence is referring to a set > of entities. > I agree. That said, the old wording jarred with the parenthetical list; the better fix would be s/Every LLVM entity/All entities/ John. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090819/b8b0e28b/attachment.html From gohman at apple.com Wed Aug 19 20:46:24 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 20 Aug 2009 01:46:24 -0000 Subject: [llvm-commits] [llvm] r79505 - /llvm/trunk/include/llvm/Support/ErrorHandling.h Message-ID: <200908200146.n7K1kO5G004948@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 19 20:46:24 2009 New Revision: 79505 URL: http://llvm.org/viewvc/llvm-project?rev=79505&view=rev Log: Add some comments clarifying what appear to be the intent of various error handling mechanisms. Please correct these if I've misunderstood something. Modified: llvm/trunk/include/llvm/Support/ErrorHandling.h Modified: llvm/trunk/include/llvm/Support/ErrorHandling.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ErrorHandling.h?rev=79505&r1=79504&r2=79505&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/ErrorHandling.h (original) +++ llvm/trunk/include/llvm/Support/ErrorHandling.h Wed Aug 19 20:46:24 2009 @@ -37,6 +37,11 @@ /// printed to stderr. If the error handler returns, then exit(1) will be /// called. /// + /// It is dangerous to naively use an error handler which throws an exception. + /// Even though some applications desire to gracefully recover from arbitrary + /// faults, blindly throwing exceptions through unfamiliar code isn't a way to + /// achieve this. + /// /// \param user_data - An argument which will be passed to the install error /// handler. void llvm_install_error_handler(llvm_error_handler_t handler, @@ -47,7 +52,10 @@ /// llvm_stop_multithreaded(). void llvm_remove_error_handler(); - /// Reports a serious error, calling any installed error handler. + /// Reports a serious error, calling any installed error handler. These + /// functions are intended to be used for error conditions which are outside + /// the control of the compiler (I/O errors, invalid user input, etc.) + /// /// If no error handler is installed the default is to print the message to /// standard error, followed by a newline. /// After the error handler is called this function will call exit(1), it @@ -64,6 +72,9 @@ } /// Prints the message and location info to stderr in !NDEBUG builds. +/// This is intended to be used for "impossible" situations that imply +/// a bug in the compiler. +/// /// In NDEBUG mode it only prints "UNREACHABLE executed". /// Use this instead of assert(0), so that the compiler knows this path /// is not reachable even for NDEBUG builds. @@ -74,4 +85,3 @@ #endif #endif - From sabre at nondot.org Wed Aug 19 22:10:15 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 20 Aug 2009 03:10:15 -0000 Subject: [llvm-commits] [llvm] r79508 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200908200310.n7K3AFYP015238@zion.cs.uiuc.edu> Author: lattner Date: Wed Aug 19 22:10:14 2009 New Revision: 79508 URL: http://llvm.org/viewvc/llvm-project?rev=79508&view=rev Log: fix this back, thanks Eli 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=79508&r1=79507&r2=79508&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Wed Aug 19 22:10:14 2009 @@ -2422,7 +2422,7 @@

      Conceptually, LLVMContext provides isolation. Every LLVM entity (Modules, Values, Types, Constants, etc.) -in LLVM's in-memory IR belong to an LLVMContext. Entities in +in LLVM's in-memory IR belongs to an LLVMContext. Entities in different contexts cannot interact with each other: Modules in different contexts cannot be linked together, Functions cannot be added to Modules in different contexts, etc. What this means is that is is From clattner at apple.com Wed Aug 19 22:16:07 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 19 Aug 2009 20:16:07 -0700 Subject: [llvm-commits] [llvm] r79484 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll In-Reply-To: References: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> <55BEFEE3-7A09-487D-BD9D-C8CA116098D5@apple.com> <5EABEA63-FDE4-4B3E-9745-646380B7B69D@apple.com> Message-ID: <24F20C3D-421A-4129-8A12-8CF6CD3E4871@apple.com> On Aug 19, 2009, at 5:40 PM, Dale Johannesen wrote: >> >> If regalloc picks a register other than eax, it's a bug that would >> be good to catch because that would be increasing number of used >> registers. > > No, using ecx or edx would not make the code quality any worse. They would clobber an extra register. If/when we start doing interprocedural regalloc, that is bad. Forcing the test to check for eax does not make the test any more fragile. -Chris From daniel at zuster.org Thu Aug 20 00:02:42 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 20 Aug 2009 05:02:42 -0000 Subject: [llvm-commits] [llvm] r79512 - in /llvm/trunk/runtime: Makefile libprofile/Makefile Message-ID: <200908200502.n7K52gQL029016@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Aug 20 00:02:41 2009 New Revision: 79512 URL: http://llvm.org/viewvc/llvm-project?rev=79512&view=rev Log: Remove cruft for installing runtime/ libraries directly into the LLVMGCCDIR; that is totally bogus. Modified: llvm/trunk/runtime/Makefile llvm/trunk/runtime/libprofile/Makefile Modified: llvm/trunk/runtime/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/Makefile?rev=79512&r1=79511&r2=79512&view=diff ============================================================================== --- llvm/trunk/runtime/Makefile (original) +++ llvm/trunk/runtime/Makefile Thu Aug 20 00:02:41 2009 @@ -10,16 +10,7 @@ LEVEL = .. include $(LEVEL)/Makefile.config -ifneq ($(wildcard $(LLVMGCC)),) PARALLEL_DIRS := libprofile -else -PARALLEL_DIRS := -install all :: - @echo '********' Warning: Your LLVMGCCDIR is set incorrectly. Check - @echo '********' Warning: llvm/Makefile.config to make sure it matches - @echo '********' Warning: the directory where the C front-end is - @echo '********' Warning: installed,and re-run configure if it does not. -endif # Disable libprofile: a faulty libtool is generated by autoconf which breaks the # build on Sparc @@ -29,7 +20,5 @@ include $(LEVEL)/Makefile.common -# Install target for libraries: Copy into $LLVMGCCDIR/bytecode-libs -# install:: Modified: llvm/trunk/runtime/libprofile/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/Makefile?rev=79512&r1=79511&r2=79512&view=diff ============================================================================== --- llvm/trunk/runtime/libprofile/Makefile (original) +++ llvm/trunk/runtime/libprofile/Makefile Thu Aug 20 00:02:41 2009 @@ -14,6 +14,5 @@ LIBRARYNAME = profile_rt EXTRA_DIST = exported_symbols.lst EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/exported_symbols.lst -BYTECODE_DESTINATION = $(CFERuntimeLibDir) include $(LEVEL)/Makefile.common From idadesub at users.sourceforge.net Thu Aug 20 00:09:43 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Thu, 20 Aug 2009 05:09:43 -0000 Subject: [llvm-commits] [llvm] r79513 - /llvm/trunk/include/llvm/CodeGen/ValueTypes.h Message-ID: <200908200509.n7K59hUs029866@zion.cs.uiuc.edu> Author: erickt Date: Thu Aug 20 00:09:43 2009 New Revision: 79513 URL: http://llvm.org/viewvc/llvm-project?rev=79513&view=rev Log: Rename FirstExtendedValueType to INVALID_SIMPLE_VALUE_TYPE as that's a bit more descriptive of what we're testing for. Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=79513&r1=79512&r2=79513&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original) +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Thu Aug 20 00:09:43 2009 @@ -113,15 +113,14 @@ // LastSimpleValueType - The greatest valid SimpleValueType value. LastSimpleValueType = 255, - // FirstExtendedValueType - This sentinel is needed so that gcc 4.4 won't - // optimize away checks of a SimpleValueType compared to - // LastSimpleValueType+1. - FirstExtendedValueType = 256 + // INVALID_SIMPLE_VALUE_TYPE - Simple value types greater than or equal + // to this are considered extended value types. + INVALID_SIMPLE_VALUE_TYPE = LastSimpleValueType + 1 }; SimpleValueType SimpleTy; - MVT() : SimpleTy((SimpleValueType)(LastSimpleValueType+1)) {} + MVT() : SimpleTy((SimpleValueType)(INVALID_SIMPLE_VALUE_TYPE)) {} MVT(SimpleValueType SVT) : SimpleTy(SVT) { } bool operator>(const MVT& S) const { return SimpleTy > S.SimpleTy; } @@ -171,7 +170,7 @@ MVT getVectorElementType() const { switch (SimpleTy) { default: - return (MVT::SimpleValueType)(MVT::LastSimpleValueType+1); + return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); case v2i8 : case v4i8 : case v8i8 : @@ -284,7 +283,7 @@ static MVT getIntegerVT(unsigned BitWidth) { switch (BitWidth) { default: - return (MVT::SimpleValueType)(MVT::LastSimpleValueType+1); + return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); case 1: return MVT::i1; case 8: @@ -337,12 +336,12 @@ if (NumElements == 4) return MVT::v4f64; break; } - return (MVT::SimpleValueType)(MVT::LastSimpleValueType+1); + return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); } static MVT getIntVectorWithNumElements(unsigned NumElts) { switch (NumElts) { - default: return (MVT::SimpleValueType)(MVT::LastSimpleValueType+1); + default: return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); case 1: return MVT::v1i64; case 2: return MVT::v2i32; case 4: return MVT::v4i16; @@ -358,13 +357,14 @@ const Type *LLVMTy; public: - EVT() : V((MVT::SimpleValueType)(MVT::LastSimpleValueType+1)), LLVMTy(0) {} + EVT() : V((MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE)), + LLVMTy(0) {} EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(0) { } EVT(MVT S) : V(S), LLVMTy(0) {} bool operator==(const EVT VT) const { if (V.SimpleTy == VT.V.SimpleTy) { - if (V.SimpleTy == MVT::LastSimpleValueType+1) + if (V.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE) return LLVMTy == VT.LLVMTy; return true; } @@ -372,7 +372,7 @@ } bool operator!=(const EVT VT) const { if (V.SimpleTy == VT.V.SimpleTy) { - if (V.SimpleTy == MVT::LastSimpleValueType+1) + if (V.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE) return LLVMTy != VT.LLVMTy; return false; } @@ -390,7 +390,7 @@ /// number of bits. static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth) { MVT M = MVT::getIntegerVT(BitWidth); - if (M.SimpleTy == MVT::LastSimpleValueType+1) + if (M.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE) return getExtendedIntegerVT(Context, BitWidth); else return M; @@ -400,7 +400,7 @@ /// length, where each element is of type VT. static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements) { MVT M = MVT::getVectorVT(VT.V, NumElements); - if (M.SimpleTy == MVT::LastSimpleValueType+1) + if (M.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE) return getExtendedVectorVT(Context, VT, NumElements); else return M; @@ -410,7 +410,7 @@ /// the specified number of elements. static EVT getIntVectorWithNumElements(LLVMContext &C, unsigned NumElts) { MVT M = MVT::getIntVectorWithNumElements(NumElts); - if (M.SimpleTy == MVT::LastSimpleValueType+1) + if (M.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE) return getVectorVT(C, MVT::i8, NumElts); else return M; From idadesub at users.sourceforge.net Thu Aug 20 00:10:37 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Wed, 19 Aug 2009 22:10:37 -0700 Subject: [llvm-commits] [llvm] r79401 - /llvm/trunk/include/llvm/CodeGen/ValueTypes.h In-Reply-To: <1ef034530908191624w3628421fvad6cd27d342d5701@mail.gmail.com> References: <200908190253.n7J2r7Q9005307@zion.cs.uiuc.edu> <1787732E-914F-48C8-A088-7590AE0C61E8@apple.com> <1ef034530908191624w3628421fvad6cd27d342d5701@mail.gmail.com> Message-ID: <1ef034530908192210g52c2d206n9163b73cfff5aaf0@mail.gmail.com> On Wed, Aug 19, 2009 at 4:24 PM, Erick Tryzelaar wrote: > On Wed, Aug 19, 2009 at 11:44 AM, Bill Wendling wrote: > > I named it that since it appears that extended value types start at > 256. But you're right, I probably should have named it something else. > Following the other variants, does "INVALID_SIMPLE_VALUE_TYPE" sound > reasonable? I can also rename all of the LastSimpleValueType+1 > expressions with it. > Fyi, I've committed this change. From daniel at zuster.org Thu Aug 20 00:12:55 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 20 Aug 2009 05:12:55 -0000 Subject: [llvm-commits] [llvm] r79514 - /llvm/trunk/runtime/libprofile/Makefile Message-ID: <200908200512.n7K5Ct8N030267@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Aug 20 00:12:55 2009 New Revision: 79514 URL: http://llvm.org/viewvc/llvm-project?rev=79514&view=rev Log: Don't try to build .bc version of libprofile if LLVMGCC isn't available. Modified: llvm/trunk/runtime/libprofile/Makefile Modified: llvm/trunk/runtime/libprofile/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/Makefile?rev=79514&r1=79513&r2=79514&view=diff ============================================================================== --- llvm/trunk/runtime/libprofile/Makefile (original) +++ llvm/trunk/runtime/libprofile/Makefile Thu Aug 20 00:12:55 2009 @@ -8,7 +8,9 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. +ifneq ($(wildcard $(LLVMGCC)),) BYTECODE_LIBRARY = 1 +endif SHARED_LIBRARY = 1 LOADABLE_MODULE = 1 LIBRARYNAME = profile_rt From kremenek at apple.com Thu Aug 20 00:15:16 2009 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 20 Aug 2009 05:15:16 -0000 Subject: [llvm-commits] [llvm] r79516 - /llvm/tags/checker/checker-0.215/ Message-ID: <200908200515.n7K5FGpi030591@zion.cs.uiuc.edu> Author: kremenek Date: Thu Aug 20 00:15:16 2009 New Revision: 79516 URL: http://llvm.org/viewvc/llvm-project?rev=79516&view=rev Log: Tagging checker-0.215. Added: llvm/tags/checker/checker-0.215/ - copied from r79515, llvm/trunk/ From e0325716 at student.tuwien.ac.at Thu Aug 20 02:14:57 2009 From: e0325716 at student.tuwien.ac.at (Andreas Neustifter) Date: Thu, 20 Aug 2009 09:14:57 +0200 Subject: [llvm-commits] [PATCH] Add tests for Profiling Infrastructure In-Reply-To: <6a8523d60908191450m62fd9baclf40c29e9908db049@mail.gmail.com> References: <4A8BF96E.60100@student.tuwien.ac.at> <6a8523d60908191450m62fd9baclf40c29e9908db049@mail.gmail.com> Message-ID: <4A8CF7F1.9010507@student.tuwien.ac.at> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! Daniel Dunbar wrote: > On Wed, Aug 19, 2009 at 6:09 AM, Andreas > Neustifter wrote: >> Hi, >> >> I am working currently on the Profiling Infrastructure for LLVM, I have done >> some preliminary work and I also want to include some test files. > > Excellent, thanks! Your welcome! >> I attach two files that I think can act as basis for further expanding the >> test coverage. >> >> What do you think of this tests? I'm planning to put them under >> test/Analysis/Profiling > > I don't understand the names, but otherwise looks fine to me. Note > that you will need to replace '.so' with '%shlibext' to make the tests > portable. I changed the Makefiles to build the runtime library by > default as well... > > Please apply! If you aren't familiar with the DejaGNU set up, you will > need to drop dg.exp in the new Profiling directory for the tests to be > found. You can just copy the one from Analysis/Andersens, for example. Well, since the files test for nothing specific the are called test, I will invent proper names for them before checking in. Thanks for the %shlibext hint. Otherwise I had them running already, dg.exp and all. I'm at my "other work" today, I will do this stuff tomorrow. Andi - -- ========================================================================== This email is signed, for more information see http://web.student.tuwien.ac.at/~e0325716/gpg.html -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqM9+wACgkQPiYq0rq7s/AECgCeLVLwBm+zRFWvYzljbuTA0cM6 KzsAn3CZAnnxvHahg2Z7n5cGk3YwWnTu =awmq -----END PGP SIGNATURE----- From baldrick at free.fr Thu Aug 20 03:15:28 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 08:15:28 -0000 Subject: [llvm-commits] [gcc-plugin] r79522 - /gcc-plugin/trunk/README Message-ID: <200908200815.n7K8FSm7001182@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 03:15:27 2009 New Revision: 79522 URL: http://llvm.org/viewvc/llvm-project?rev=79522&view=rev Log: Build and usage instructions for the plugin. Added: gcc-plugin/trunk/README Added: gcc-plugin/trunk/README URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/README?rev=79522&view=auto ============================================================================== --- gcc-plugin/trunk/README (added) +++ gcc-plugin/trunk/README Thu Aug 20 03:15:27 2009 @@ -0,0 +1,39 @@ +---------------------- +- BUILD INSTRUCTIONS - +---------------------- + +Step 1: Build gcc +----------------- + +Check out gcc mainline from the gcc subversion repository: + svn checkout svn://gcc.gnu.org/svn/gcc/trunk SomeLocalDir +Apply the patches in the gcc-patches subdirectory, if any. Hopefully one day +the plugin will work with an unpatched gcc, but for the moment a few small +patches need to be applied. +Build gcc, and install it somewhere. + +Step 2: Build the plugin +------------------------ + +In the Makefile, set the GCCSOURCE_DIR variable to point to the place you +checked out the gcc repository, rather than to where I checked it out. +Set the GCCOBJECT_DIR to point to the place you built the repository. +Admire the awfulness of the build system, and make a mental note to rewrite +it properly. + +Build the plugin using "make". The end result of the build is a shared +library, llvm.so. + +---------------------- +- USAGE INSTRUCTIONS - +---------------------- + +Run gcc as usual, but pass -fplugin=./llvm.so as an extra command line argument. +Make sure you use the gcc you installed above, not the system gcc! + +Currently the plugin isn't capable of compiling much - you have been warned. + +The plugin accepts a few command line arguments, for example +-fplugin-arg-llvm-enable-gcc-optzns +Search for the comment "Process any plugin arguments" in llvm-backend.cpp, +the argument parsing code is just after this. From baldrick at free.fr Thu Aug 20 03:16:12 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 08:16:12 -0000 Subject: [llvm-commits] [gcc-plugin] r79523 - /gcc-plugin/trunk/Makefile Message-ID: <200908200816.n7K8GCgJ001272@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 03:16:10 2009 New Revision: 79523 URL: http://llvm.org/viewvc/llvm-project?rev=79523&view=rev Log: Put variables that need to be adjusted at the top of the Makefile. Modified: gcc-plugin/trunk/Makefile Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=79523&r1=79522&r2=79523&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Thu Aug 20 03:16:10 2009 @@ -1,11 +1,11 @@ +GCCSOURCE_DIR=/home/duncan/tmp/gcc.fsf.master +GCCOBJECT_DIR=/home/duncan/tmp/gcc.fsf.master-objects +#GCCPLUGIN_DIR:=$(shell $(GCC) -print-file-name=plugin) + C_SOURCE_FILES=llvm-cache.c CPP_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp llvm-target.cpp llvm-types.cpp bits_and_bobs.cpp PLUGIN_OBJECT_FILES=$(C_SOURCE_FILES:.c=.o) $(CPP_SOURCE_FILES:.cpp=.o) -#GCCPLUGIN_DIR:=$(shell $(GCC) -print-file-name=plugin) -GCCSOURCE_DIR=/home/duncan/tmp/gcc.fsf.master -GCCOBJECT_DIR=/home/duncan/tmp/gcc.fsf.master-objects - #CFLAGS+=-I$(GCCPLUGINS_DIR)/include -fPIC -O2 CFLAGS+=-Werror -fPIC -g -O2 From baldrick at free.fr Thu Aug 20 03:35:07 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 10:35:07 +0200 Subject: [llvm-commits] [llvm] r79472 - /llvm/trunk/lib/System/Unix/Process.inc In-Reply-To: <200908192148.n7JLmYpD007114@zion.cs.uiuc.edu> References: <200908192148.n7JLmYpD007114@zion.cs.uiuc.edu> Message-ID: <4A8D0ABB.5030001@free.fr> Hi Owen, > Get rid of a helgrind warning. valgrind also has the drd tool which finds races using a different method to helgrind. Might be worth trying it too (perhaps you already did!). Ciao, Duncan. From baldrick at free.fr Thu Aug 20 06:44:04 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 11:44:04 -0000 Subject: [llvm-commits] [gcc-plugin] r79524 - /gcc-plugin/trunk/llvm-cache.c Message-ID: <200908201144.n7KBi4dA028074@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 06:44:03 2009 New Revision: 79524 URL: http://llvm.org/viewvc/llvm-project?rev=79524&view=rev Log: Return the value passed in. The lack of a return statement explains some nasty crashes! Modified: gcc-plugin/trunk/llvm-cache.c Modified: gcc-plugin/trunk/llvm-cache.c URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-cache.c?rev=79524&r1=79523&r2=79524&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-cache.c (original) +++ gcc-plugin/trunk/llvm-cache.c Thu Aug 20 06:44:03 2009 @@ -86,4 +86,6 @@ } (*slot)->val = val; + + return val; } From baldrick at free.fr Thu Aug 20 06:52:09 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 11:52:09 -0000 Subject: [llvm-commits] [gcc-plugin] r79525 - /gcc-plugin/trunk/llvm-cache.c Message-ID: <200908201152.n7KBq9vf029190@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 06:52:09 2009 New Revision: 79525 URL: http://llvm.org/viewvc/llvm-project?rev=79525&view=rev Log: Mark the GTY debugging routine with attribute used: it is used, but by passing its name to the gty system. Modified: gcc-plugin/trunk/llvm-cache.c Modified: gcc-plugin/trunk/llvm-cache.c URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-cache.c?rev=79525&r1=79524&r2=79525&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-cache.c (original) +++ gcc-plugin/trunk/llvm-cache.c Thu Aug 20 06:52:09 2009 @@ -37,12 +37,12 @@ #define tree_llvm_map_hash tree_map_base_hash #define tree_llvm_map_marked_p tree_map_base_marked_p -static int debugging_tree_llvm_map_marked_p (const void *p) {//QQ - printf("debugging_ggc call for %p\n", p); +__attribute__((used)) static int debug_tree_llvm_map_marked_p (const void *p) {//QQ + printf("debug_ggc call for %p\n", p); return tree_map_base_marked_p(p); } -static GTY ((if_marked ("debugging_tree_llvm_map_marked_p"), +static GTY ((if_marked ("debug_tree_llvm_map_marked_p"), param_is (struct tree_llvm_map))) htab_t llvm_cache; From baldrick at free.fr Thu Aug 20 07:27:21 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 12:27:21 -0000 Subject: [llvm-commits] [gcc-plugin] r79526 - /gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff Message-ID: <200908201227.n7KCRMSE001041@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 07:27:21 2009 New Revision: 79526 URL: http://llvm.org/viewvc/llvm-project?rev=79526&view=rev Log: Expose the gimple_to_tree utility. Added: gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff Added: gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff?rev=79526&view=auto ============================================================================== --- gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff (added) +++ gcc-plugin/trunk/gcc-patches/gimple_to_tree.diff Thu Aug 20 07:27:21 2009 @@ -0,0 +1,13 @@ +Index: gcc.fsf.master/gcc/cfgexpand.c +=================================================================== +--- gcc.fsf.master.orig/gcc/cfgexpand.c 2009-08-20 14:04:30.060847582 +0200 ++++ gcc.fsf.master/gcc/cfgexpand.c 2009-08-20 14:04:36.327849397 +0200 +@@ -124,7 +124,7 @@ + GIMPLE tuple STMT and returns the same statement in the form of a + tree. */ + +-static tree ++tree + gimple_to_tree (gimple stmt) + { + tree t; From baldrick at free.fr Thu Aug 20 07:28:18 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 12:28:18 -0000 Subject: [llvm-commits] [gcc-plugin] r79527 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200908201228.n7KCSIMa001164@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 07:28:18 2009 New Revision: 79527 URL: http://llvm.org/viewvc/llvm-project?rev=79527&view=rev Log: For the moment, convert gimple into trees rather than trying to handle gimple directly. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=79527&r1=79526&r2=79527&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Thu Aug 20 07:28:18 2009 @@ -747,6 +747,8 @@ return Fn; } +extern "C" tree gimple_to_tree(gimple); + Function *TreeToLLVM::EmitFunction() { // Set up parameters and prepare for return, for the function. StartFunctionBody(); @@ -758,9 +760,9 @@ FOR_EACH_BB (bb) { for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple stmt = gsi_stmt (gsi); + gimple gimple_stmt = gsi_stmt (gsi); - switch (gimple_code(stmt)) { + switch (gimple_code(gimple_stmt)) { case GIMPLE_ASSIGN: case GIMPLE_COND: case GIMPLE_GOTO: @@ -771,11 +773,25 @@ case GIMPLE_SWITCH: case GIMPLE_NOP: case GIMPLE_PREDICT: - case GIMPLE_RESX: + case GIMPLE_RESX: { + // TODO Handle gimple directly, rather than converting to a tree. + MemRef DestLoc; + tree stmt = gimple_to_tree(gimple_stmt); + + // If this stmt returns an aggregate value (e.g. a call whose result is + // ignored), create a temporary to receive the value. Note that we don't + // do this for MODIFY_EXPRs as an efficiency hack. + if (isAggregateTreeType(TREE_TYPE(stmt)) && + TREE_CODE(stmt)!= MODIFY_EXPR && TREE_CODE(stmt)!=INIT_EXPR) + DestLoc = CreateTempLoc(ConvertType(TREE_TYPE(stmt))); + + Emit(stmt, DestLoc.Ptr ? &DestLoc : NULL); + break; + } + default: - print_gimple_stmt(stderr, stmt, 0, TDF_RAW); + print_gimple_stmt(stderr, gimple_stmt, 0, TDF_RAW); llvm_report_error("Unhandled GIMPLE statement during LLVM emission!"); - break; } } From baldrick at free.fr Thu Aug 20 07:50:45 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 12:50:45 -0000 Subject: [llvm-commits] [gcc-plugin] r79528 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200908201250.n7KCojSW003927@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 07:50:45 2009 New Revision: 79528 URL: http://llvm.org/viewvc/llvm-project?rev=79528&view=rev Log: Erasure of local values isn't implemented yet - just turn it off. Now that we don't cache inside trees, this could be done differently - add a note about this. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=79528&r1=79527&r2=79528&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Thu Aug 20 07:50:45 2009 @@ -729,9 +729,11 @@ SI->setSuccessor(0, SI->getSuccessor(1)); } - // Remove any cached LLVM values that are local to this function. Such values - // may be deleted when the optimizers run, so would be dangerous to keep. - eraseLocalLLVMValues(); +// Local llvm values should probably just be cached in a local map, making this +// routine unnecessary. +//TODO // Remove any cached LLVM values that are local to this function. Such values +//TODO // may be deleted when the optimizers run, so would be dangerous to keep. +//TODO eraseLocalLLVMValues(); // Simplify any values that were uniqued using a no-op bitcast. for (std::vector::iterator I = UniquedValues.begin(), From baldrick at free.fr Thu Aug 20 08:22:51 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 15:22:51 +0200 Subject: [llvm-commits] [llvm] r79287 - /llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp In-Reply-To: <200908172140.n7HLe4GV031777@zion.cs.uiuc.edu> References: <200908172140.n7HLe4GV031777@zion.cs.uiuc.edu> Message-ID: <4A8D4E2B.40807@free.fr> Hi Jim, any chance of you writing a small document explaining the design of sjlj eh support? Thanks, Duncan. From nicolas.geoffray at lip6.fr Thu Aug 20 09:20:31 2009 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 20 Aug 2009 16:20:31 +0200 Subject: [llvm-commits] REQUIRES_FP in Makefile.rules In-Reply-To: <2A75BA19-8AF9-4C48-9BD1-20B924E319A7@apple.com> References: <4A8B2CE1.2000105@lip6.fr> <9A550CA8-C19F-42F5-8731-9B1A234299CD@apple.com> <4A8C23E1.3040604@lip6.fr> <0475CCF6-A5E1-43C1-A4BC-7DCB9FEF8CC8@apple.com> <4A8C75E9.2060707@lip6.fr> <2A75BA19-8AF9-4C48-9BD1-20B924E319A7@apple.com> Message-ID: <4A8D5BAF.8090603@lip6.fr> Eric Christopher wrote: >> >> >> >> vmkit method (start_thread) >> Java method >> Java method >> Java method >> LLVM callback for lazy compilation >> LLVM JIT emitter >> ModuleProvider::materializeFunction >> vmkit method >> vmkit method (<--- safe point entered here) >> >> >> I hope the example is clear. > > It is, perhaps that's a bad point to have as a safe point? No because, vmkit methods may be interblocked with each other (materializing a function takes locks), and if a thread that owns a lock joins the collection, another thread that wants to take the lock must also be able to join the collection. > > At any rate, I'm not against the option in general so feel free to > commit :) > Yes, just did. Thanks! Nicolas From baldrick at free.fr Thu Aug 20 09:23:15 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 14:23:15 -0000 Subject: [llvm-commits] [gcc-plugin] r79529 - in /gcc-plugin/trunk: llvm-backend.cpp llvm-file-ostream.h Message-ID: <200908201423.n7KENFtP015837@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 09:23:14 2009 New Revision: 79529 URL: http://llvm.org/viewvc/llvm-project?rev=79529&view=rev Log: When gcc is dumping RTL for debugging purposes, output the LLVM IR for each function to the dump file as soon as it is generated. This should be turned on using the -fdump-rtl-all switch. Added: gcc-plugin/trunk/llvm-file-ostream.h - copied unchanged from r79523, llvm-gcc-4.2/trunk/gcc/llvm-file-ostream.h Modified: gcc-plugin/trunk/llvm-backend.cpp Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=79529&r1=79528&r2=79529&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Thu Aug 20 09:23:14 2009 @@ -85,6 +85,7 @@ // Plugin headers #include "llvm-internal.h" #include "llvm-debug.h" +#include "llvm-file-ostream.h" #include "llvm-target.h" //TODO#include "llvm-file-ostream.h" #include "bits_and_bobs.h" @@ -1901,6 +1902,13 @@ TREE_ASM_WRITTEN(current_function_decl) = 1; execute_free_datastructures (); + + // When debugging, append the LLVM IR to the dump file. + if (dump_file) { + oFILEstream dump_stream(dump_file); + Fn->print(dump_stream); + } + return 0; } From grosbach at apple.com Thu Aug 20 09:27:15 2009 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 20 Aug 2009 07:27:15 -0700 Subject: [llvm-commits] [llvm] r79287 - /llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp In-Reply-To: <4A8D4E2B.40807@free.fr> References: <200908172140.n7HLe4GV031777@zion.cs.uiuc.edu> <4A8D4E2B.40807@free.fr> Message-ID: <6CE8DC57-F603-4BC5-93A2-AC6C68DD4297@apple.com> On Aug 20, 2009, at 6:22 AM, Duncan Sands wrote: > Hi Jim, any chance of you writing a small document explaining the > design of sjlj eh support? > Hi Duncan, Yep, I'm planning on it. I'll likely do it by adding more content about it to the current ExceptionHandling page. -Jim From deeppatel1987 at gmail.com Thu Aug 20 10:01:17 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Thu, 20 Aug 2009 15:01:17 -0000 Subject: [llvm-commits] [llvm] r79530 - /llvm/trunk/docs/ReleaseNotes-2.6.html Message-ID: <200908201501.n7KF1Hw4020502@zion.cs.uiuc.edu> Author: sandeep Date: Thu Aug 20 10:01:16 2009 New Revision: 79530 URL: http://llvm.org/viewvc/llvm-project?rev=79530&view=rev Log: Correct ARM v7-A architecture name spelling and add note about hard float. Modified: llvm/trunk/docs/ReleaseNotes-2.6.html Modified: llvm/trunk/docs/ReleaseNotes-2.6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes-2.6.html?rev=79530&r1=79529&r2=79530&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes-2.6.html (original) +++ llvm/trunk/docs/ReleaseNotes-2.6.html Thu Aug 20 10:01:16 2009 @@ -407,10 +407,12 @@

      • Preliminary support for processors, such as the Cortex-A8 and Cortex-A9, -that implement version 7 of the ARM architecture. The ARM backend now -supports both the Thumb2 and Advanced SIMD (Neon) instruction sets. -These features are still somewhat experimental and subject to change. -The Neon intrinsics, in particular, may change in future releases of LLVM. +that implement version v7-A of the ARM architecture. The ARM backend now +supports both the Thumb2 and Advanced SIMD (Neon) instruction sets. The +AAPCS-VFP "hard float" calling conventions are also supported with the +-float-abi=hard flag. These features are still somewhat experimental +and subject to change. The Neon intrinsics, in particular, may change in future +releases of LLVM.
      From benny.kra at googlemail.com Thu Aug 20 10:20:15 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Thu, 20 Aug 2009 15:20:15 -0000 Subject: [llvm-commits] [llvm] r79531 - /llvm/trunk/CREDITS.TXT Message-ID: <200908201520.n7KFKFGI022940@zion.cs.uiuc.edu> Author: d0k Date: Thu Aug 20 10:20:15 2009 New Revision: 79531 URL: http://llvm.org/viewvc/llvm-project?rev=79531&view=rev Log: Add myself to the blame list. Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=79531&r1=79530&r2=79531&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Thu Aug 20 10:20:15 2009 @@ -186,6 +186,10 @@ E: kowshik at uiuc.edu D: Author of the original C backend +N: Benjamin Kramer +E: benny.kra at gmail.com +D: Miscellaneous bug fixes + N: Christopher Lamb E: christopher.lamb at gmail.com D: aligned load/store support, parts of noalias and restrict support From mrs at apple.com Thu Aug 20 10:23:43 2009 From: mrs at apple.com (Mike Stump) Date: Thu, 20 Aug 2009 08:23:43 -0700 Subject: [llvm-commits] [gcc-plugin] r79524 - /gcc-plugin/trunk/llvm-cache.c In-Reply-To: <200908201144.n7KBi4dA028074@zion.cs.uiuc.edu> References: <200908201144.n7KBi4dA028074@zion.cs.uiuc.edu> Message-ID: <3B5CDB48-2C5F-42DA-ADBF-62081DC74C50@apple.com> On Aug 20, 2009, at 4:44 AM, Duncan Sands wrote: > = > = > = > = > = > = > = > = > ====================================================================== > --- gcc-plugin/trunk/llvm-cache.c (original) > +++ gcc-plugin/trunk/llvm-cache.c Thu Aug 20 06:44:03 2009 > @@ -86,4 +86,6 @@ > } > > (*slot)->val = val; > + > + return val; > } Turn on -Wreturn-type or compile with clang. :-) From baldrick at free.fr Thu Aug 20 10:30:31 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 17:30:31 +0200 Subject: [llvm-commits] [gcc-plugin] r79524 - /gcc-plugin/trunk/llvm-cache.c In-Reply-To: <3B5CDB48-2C5F-42DA-ADBF-62081DC74C50@apple.com> References: <200908201144.n7KBi4dA028074@zion.cs.uiuc.edu> <3B5CDB48-2C5F-42DA-ADBF-62081DC74C50@apple.com> Message-ID: <4A8D6C17.5090409@free.fr> Hi Mike, > Turn on -Wreturn-type or compile with clang. :-) I had turned warnings off because I was getting a lot of them due to commenting out large parts of llvm-gcc. That was a mistake :) Ciao, Duncan. From lattner at apple.com Thu Aug 20 11:09:23 2009 From: lattner at apple.com (Tanya Lattner) Date: Thu, 20 Aug 2009 09:09:23 -0700 Subject: [llvm-commits] [llvm] r79287 - /llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp In-Reply-To: <6CE8DC57-F603-4BC5-93A2-AC6C68DD4297@apple.com> References: <200908172140.n7HLe4GV031777@zion.cs.uiuc.edu> <4A8D4E2B.40807@free.fr> <6CE8DC57-F603-4BC5-93A2-AC6C68DD4297@apple.com> Message-ID: On Aug 20, 2009, at 7:27 AM, Jim Grosbach wrote: > On Aug 20, 2009, at 6:22 AM, Duncan Sands wrote: > >> Hi Jim, any chance of you writing a small document explaining the >> design of sjlj eh support? >> > > Hi Duncan, > > Yep, I'm planning on it. I'll likely do it by adding more content > about it to the current ExceptionHandling page. > 2.6 code freeze is tomorrow. It would be good to get this in before then. -Tanya > -Jim > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090820/dcb2a416/attachment.html From edwintorok at gmail.com Thu Aug 20 11:16:30 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 20 Aug 2009 19:16:30 +0300 Subject: [llvm-commits] [llvm] r79505 - /llvm/trunk/include/llvm/Support/ErrorHandling.h In-Reply-To: <200908200146.n7K1kO5G004948@zion.cs.uiuc.edu> References: <200908200146.n7K1kO5G004948@zion.cs.uiuc.edu> Message-ID: <4A8D76DE.2040405@gmail.com> On 2009-08-20 04:46, Dan Gohman wrote: > Author: djg > Date: Wed Aug 19 20:46:24 2009 > New Revision: 79505 > > URL: http://llvm.org/viewvc/llvm-project?rev=79505&view=rev > Log: > Add some comments clarifying what appear to be the intent of various > error handling mechanisms. Please correct these if I've misunderstood > something. > > > - /// Reports a serious error, calling any installed error handler. > + /// Reports a serious error, calling any installed error handler. These > + /// functions are intended to be used for error conditions which are outside > + /// the control of the compiler (I/O errors, invalid user input, etc.) > + /// > Yes, errors that could in theory be recovered from. IMHO anything that is not an assert and can fail should use this mechanism. > /// If no error handler is installed the default is to print the message to > /// standard error, followed by a newline. > /// After the error handler is called this function will call exit(1), it > The initial idea was to also change code that calls llvm_report_error to recover from such errors. Currently this is not possible (the error handler is not allowed to return to LLVM), but I'd like to slowly change things after llvm 2.6 is released. For example if the JIT encounters inline asm, or unresolved external symbol, it could try to recover. Best regards, --Edwin From gohman at apple.com Thu Aug 20 11:27:10 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 20 Aug 2009 16:27:10 -0000 Subject: [llvm-commits] [llvm] r79532 - /llvm/trunk/lib/Target/TargetData.cpp Message-ID: <200908201627.n7KGRABV031468@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 20 11:27:10 2009 New Revision: 79532 URL: http://llvm.org/viewvc/llvm-project?rev=79532&view=rev Log: Update and fix some comments. Modified: llvm/trunk/lib/Target/TargetData.cpp Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=79532&r1=79531&r2=79532&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Thu Aug 20 11:27:10 2009 @@ -156,13 +156,13 @@

      @verbatim::@endverbatim: Numeric type alignment. Type is - one of i|f|v|a, corresponding to integer, floating point, vector (aka - packed) or aggregate. Size indicates the size, e.g., 32 or 64 bits. + one of i|f|v|a, corresponding to integer, floating point, vector, or + aggregate. Size indicates the size, e.g., 32 or 64 bits. \p - The default string, fully specified is: + The default string, fully specified, is:

      - "E-p:64:64:64-a0:0:0-f32:32:32-f64:0:64" - "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:0:64" + "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64" "-v64:64:64-v128:128:128"

      Note that in the case of aggregates, 0 is the default ABI and preferred @@ -185,9 +185,9 @@ setAlignment(INTEGER_ALIGN, 4, 8, 64); // i64 setAlignment(FLOAT_ALIGN, 4, 4, 32); // float setAlignment(FLOAT_ALIGN, 8, 8, 64); // double - setAlignment(VECTOR_ALIGN, 8, 8, 64); // v2i32 + setAlignment(VECTOR_ALIGN, 8, 8, 64); // v2i32, v1i64, ... setAlignment(VECTOR_ALIGN, 16, 16, 128); // v16i8, v8i16, v4i32, ... - setAlignment(AGGREGATE_ALIGN, 0, 8, 0); // struct, union, class, ... + setAlignment(AGGREGATE_ALIGN, 0, 8, 0); // struct while (!temp.empty()) { std::string token = getToken(temp, "-"); From brukman at gmail.com Thu Aug 20 11:27:49 2009 From: brukman at gmail.com (Misha Brukman) Date: Thu, 20 Aug 2009 12:27:49 -0400 Subject: [llvm-commits] [PATCH] Fixing LDRD and STRD definitions for ARM Message-ID: Attached is a patch to partly address http://llvm.org/PR4687 -- LDRD and STRD require ARMv5TE, not just ARMv5T.See the bug for links to supporting documentation. This doesn't completely fix the bug, but is still required for correctness. Misha -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090820/0d6972d6/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: strd-ldrd-v5te.patch Type: text/x-patch Size: 883 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090820/0d6972d6/attachment.bin From gohman at apple.com Thu Aug 20 11:42:56 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 20 Aug 2009 16:42:56 -0000 Subject: [llvm-commits] [llvm] r79533 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolutionExpander.h lib/Analysis/ConstantFolding.cpp lib/Analysis/ScalarEvolution.cpp lib/Analysis/ScalarEvolutionExpander.cpp Message-ID: <200908201642.n7KGguCQ001017@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 20 11:42:55 2009 New Revision: 79533 URL: http://llvm.org/viewvc/llvm-project?rev=79533&view=rev Log: Various comment and whitespace cleanups. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h?rev=79533&r1=79532&r2=79533&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h Thu Aug 20 11:42:55 2009 @@ -24,7 +24,7 @@ /// rewrite expressions in canonical form. /// /// Clients should create an instance of this class when rewriting is needed, - /// and destroy it when finished to allow the release of the associated + /// and destroy it when finished to allow the release of the associated /// memory. struct SCEVExpander : public SCEVVisitor { ScalarEvolution &SE; @@ -62,7 +62,7 @@ private: LLVMContext &getContext() const { return SE.getContext(); } - + /// InsertBinop - Insert the specified binary operator, doing a small amount /// of work to avoid inserting an obviously redundant operation. Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS, Value *RHS); @@ -126,4 +126,3 @@ } #endif - Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=79533&r1=79532&r2=79533&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Thu Aug 20 11:42:55 2009 @@ -208,7 +208,7 @@ "Computed GetElementPtr has unexpected type!"); // If we ended up indexing a member with a type that doesn't match - // type type of what the original indices indexed, add a cast. + // the type of what the original indices indexed, add a cast. if (Ty != cast(ResultTy)->getElementType()) C = ConstantExpr::getBitCast(C, ResultTy); Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=79533&r1=79532&r2=79533&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Thu Aug 20 11:42:55 2009 @@ -1682,7 +1682,7 @@ if (const SCEVConstant *RHSC = dyn_cast(RHS)) { if (RHSC->getValue()->equalsInt(1)) - return LHS; // X udiv 1 --> x + return LHS; // X udiv 1 --> x if (RHSC->isZero()) return getIntegerSCEV(0, LHS->getType()); // value is undefined @@ -3533,8 +3533,8 @@ if (!isa(TC)) return TC; break; } - case ICmpInst::ICMP_EQ: { - // Convert to: while (X-Y == 0) // while (X == Y) + case ICmpInst::ICMP_EQ: { // while (X == Y) + // Convert to: while (X-Y == 0) const SCEV *TC = HowFarToNonZero(getMinusSCEV(LHS, RHS), L); if (!isa(TC)) return TC; break; @@ -3986,7 +3986,7 @@ getContext()); else C = ConstantFoldInstOperands(I->getOpcode(), I->getType(), - &Operands[0], Operands.size(), + &Operands[0], Operands.size(), getContext()); Pair.first->second = C; return getSCEV(C); @@ -4235,7 +4235,7 @@ // First, handle unitary steps. if (StepC->getValue()->equalsInt(1)) // 1*N = -Start (mod 2^BW), so: - return getNegativeSCEV(Start); // N = -Start (as unsigned) + return getNegativeSCEV(Start); // N = -Start (as unsigned) if (StepC->getValue()->isAllOnesValue()) // -1*N = -Start (mod 2^BW), so: return Start; // N = Start (as unsigned) Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=79533&r1=79532&r2=79533&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Thu Aug 20 11:42:55 2009 @@ -53,10 +53,9 @@ return CE->getOperand(0); } - // FIXME: keep track of the cast instruction. if (Constant *C = dyn_cast(V)) return ConstantExpr::getCast(Op, C, Ty); - + if (Argument *A = dyn_cast(V)) { // Check to see if there is already a cast! for (Value::use_iterator UI = A->use_begin(), E = A->use_end(); @@ -317,13 +316,17 @@ } } -/// expandAddToGEP - Expand a SCEVAddExpr with a pointer type into a GEP -/// instead of using ptrtoint+arithmetic+inttoptr. This helps -/// BasicAliasAnalysis and other passes analyze the result. +/// expandAddToGEP - Expand an addition expression with a pointer type into +/// a GEP instead of using ptrtoint+arithmetic+inttoptr. This helps +/// BasicAliasAnalysis and other passes analyze the result. See the rules +/// for getelementptr vs. inttoptr in +/// http://llvm.org/docs/LangRef.html#pointeraliasing +/// for details. /// -/// Design note: This depends on ScalarEvolution not recognizing inttoptr -/// and ptrtoint operators, as they may introduce pointer arithmetic -/// which may not be safely converted into getelementptr. +/// Design note: The correctness of using getelmeentptr here depends on +/// ScalarEvolution not recognizing inttoptr and ptrtoint operators, as +/// they may introduce pointer arithmetic which may not be safely converted +/// into getelementptr. /// /// Design note: It might seem desirable for this function to be more /// loop-aware. If some of the indices are loop-invariant while others From brukman at gmail.com Thu Aug 20 11:43:31 2009 From: brukman at gmail.com (Misha Brukman) Date: Thu, 20 Aug 2009 12:43:31 -0400 Subject: [llvm-commits] [PATCH] Fixing LDRD and STRD definitions for ARM In-Reply-To: References: Message-ID: This time, actually cc: Evan's actual email address. On Thu, Aug 20, 2009 at 12:27 PM, Misha Brukman wrote: > Attached is a patch to partly address http://llvm.org/PR4687 -- LDRD and > STRD require ARMv5TE, not just ARMv5T.See the bug for links to supporting > documentation. > > This doesn't completely fix the bug, but is still required for correctness. > > Misha > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090820/0681abd6/attachment.html From dalej at apple.com Thu Aug 20 11:58:04 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 20 Aug 2009 16:58:04 -0000 Subject: [llvm-commits] [llvm] r79534 - /llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll Message-ID: <200908201658.n7KGw4qJ003006@zion.cs.uiuc.edu> Author: johannes Date: Thu Aug 20 11:58:04 2009 New Revision: 79534 URL: http://llvm.org/viewvc/llvm-project?rev=79534&view=rev Log: Use FileCheck for the test run where it's appropriate. Modified: llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll Modified: llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll?rev=79534&r1=79533&r2=79534&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll (original) +++ llvm/trunk/test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll Thu Aug 20 11:58:04 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc | grep {%gs:6} +; RUN: llvm-as < %s | llc | FileCheck %s ; RUN: llvm-as < %s | llc | grep {%gs:\\\(%*\\\)} ; ModuleID = 'asm.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" @@ -6,6 +6,7 @@ define i32 @main() nounwind { entry: +; CHECK: %gs:6 %asmtmp.i = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 6) nounwind ; [#uses=1] %0 = zext i16 %asmtmp.i to i32 ; [#uses=1] ret i32 %0 From evan.cheng at apple.com Thu Aug 20 12:01:05 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 20 Aug 2009 17:01:05 -0000 Subject: [llvm-commits] [llvm] r79535 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb.td test/CodeGen/Thumb/2009-08-20-ISelBug.ll Message-ID: <200908201701.n7KH156F003401@zion.cs.uiuc.edu> Author: evancheng Date: Thu Aug 20 12:01:04 2009 New Revision: 79535 URL: http://llvm.org/viewvc/llvm-project?rev=79535&view=rev Log: Fix an obvious copy-n-paste bug. Added: llvm/trunk/test/CodeGen/Thumb/2009-08-20-ISelBug.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=79535&r1=79534&r2=79535&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Thu Aug 20 12:01:04 2009 @@ -655,7 +655,7 @@ def : T1Pat<(addc tGPR:$lhs, imm0_7:$rhs), (tADDi3 tGPR:$lhs, imm0_7:$rhs)>; def : T1Pat<(addc tGPR:$lhs, imm8_255:$rhs), - (tADDi3 tGPR:$lhs, imm8_255:$rhs)>; + (tADDi8 tGPR:$lhs, imm8_255:$rhs)>; def : T1Pat<(addc tGPR:$lhs, tGPR:$rhs), (tADDrr tGPR:$lhs, tGPR:$rhs)>; Added: llvm/trunk/test/CodeGen/Thumb/2009-08-20-ISelBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb/2009-08-20-ISelBug.ll?rev=79535&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb/2009-08-20-ISelBug.ll (added) +++ llvm/trunk/test/CodeGen/Thumb/2009-08-20-ISelBug.ll Thu Aug 20 12:01:04 2009 @@ -0,0 +1,66 @@ +; RUN: llvm-as < %s | llc -mtriple=thumbv6-apple-darwin -relocation-model=pic -disable-fp-elim -mattr=+v6 | FileCheck %s +; rdar://7157006 + +%struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } +%struct.__sFILEX = type opaque +%struct.__sbuf = type { i8*, i32 } +%struct.asl_file_t = type { i32, i32, i32, %struct.file_string_t*, i64, i64, i64, i64, i64, i64, i32, %struct.FILE*, i8*, i8* } +%struct.file_string_t = type { i64, i32, %struct.file_string_t*, [0 x i8] } + + at llvm.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.asl_file_t*, i64, i64*)* @t to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] + +define arm_apcscc i32 @t(%struct.asl_file_t* %s, i64 %off, i64* %out) nounwind optsize { +; CHECK: t: +; CHECK: adds r4, #8 +entry: + %val = alloca i64, align 4 ; [#uses=3] + %0 = icmp eq %struct.asl_file_t* %s, null ; [#uses=1] + br i1 %0, label %bb13, label %bb1 + +bb1: ; preds = %entry + %1 = getelementptr inbounds %struct.asl_file_t* %s, i32 0, i32 11 ; <%struct.FILE**> [#uses=2] + %2 = load %struct.FILE** %1, align 4 ; <%struct.FILE*> [#uses=2] + %3 = icmp eq %struct.FILE* %2, null ; [#uses=1] + br i1 %3, label %bb13, label %bb3 + +bb3: ; preds = %bb1 + %4 = add nsw i64 %off, 8 ; [#uses=1] + %5 = getelementptr inbounds %struct.asl_file_t* %s, i32 0, i32 10 ; [#uses=1] + %6 = load i32* %5, align 4 ; [#uses=1] + %7 = zext i32 %6 to i64 ; [#uses=1] + %8 = icmp sgt i64 %4, %7 ; [#uses=1] + br i1 %8, label %bb13, label %bb5 + +bb5: ; preds = %bb3 + %9 = call arm_apcscc i32 @fseeko(%struct.FILE* %2, i64 %off, i32 0) nounwind ; [#uses=1] + %10 = icmp eq i32 %9, 0 ; [#uses=1] + br i1 %10, label %bb7, label %bb13 + +bb7: ; preds = %bb5 + store i64 0, i64* %val, align 4 + %11 = load %struct.FILE** %1, align 4 ; <%struct.FILE*> [#uses=1] + %val8 = bitcast i64* %val to i8* ; [#uses=1] + %12 = call arm_apcscc i32 @fread(i8* noalias %val8, i32 8, i32 1, %struct.FILE* noalias %11) nounwind ; [#uses=1] + %13 = icmp eq i32 %12, 1 ; [#uses=1] + br i1 %13, label %bb10, label %bb13 + +bb10: ; preds = %bb7 + %14 = icmp eq i64* %out, null ; [#uses=1] + br i1 %14, label %bb13, label %bb11 + +bb11: ; preds = %bb10 + %15 = load i64* %val, align 4 ; [#uses=1] + %16 = call arm_apcscc i64 @asl_core_ntohq(i64 %15) nounwind ; [#uses=1] + store i64 %16, i64* %out, align 4 + ret i32 0 + +bb13: ; preds = %bb10, %bb7, %bb5, %bb3, %bb1, %entry + %.0 = phi i32 [ 2, %entry ], [ 2, %bb1 ], [ 7, %bb3 ], [ 7, %bb5 ], [ 7, %bb7 ], [ 0, %bb10 ] ; [#uses=1] + ret i32 %.0 +} + +declare arm_apcscc i32 @fseeko(%struct.FILE* nocapture, i64, i32) nounwind + +declare arm_apcscc i32 @fread(i8* noalias nocapture, i32, i32, %struct.FILE* noalias nocapture) nounwind + +declare arm_apcscc i64 @asl_core_ntohq(i64) From brukman+llvm at gmail.com Thu Aug 20 12:01:14 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Thu, 20 Aug 2009 17:01:14 -0000 Subject: [llvm-commits] [llvm] r79536 - /llvm/trunk/unittests/Support/MathExtrasTest.cpp Message-ID: <200908201701.n7KH1Eu2003433@zion.cs.uiuc.edu> Author: brukman Date: Thu Aug 20 12:01:14 2009 New Revision: 79536 URL: http://llvm.org/viewvc/llvm-project?rev=79536&view=rev Log: Fixed header comment. Modified: llvm/trunk/unittests/Support/MathExtrasTest.cpp Modified: llvm/trunk/unittests/Support/MathExtrasTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/MathExtrasTest.cpp?rev=79536&r1=79535&r2=79536&view=diff ============================================================================== --- llvm/trunk/unittests/Support/MathExtrasTest.cpp (original) +++ llvm/trunk/unittests/Support/MathExtrasTest.cpp Thu Aug 20 12:01:14 2009 @@ -1,4 +1,4 @@ -//===- llvm/unittest/Support/MathExtrasTest.cpp - math utils tests --------===// +//===- unittests/Support/MathExtrasTest.cpp - math utils tests ------------===// // // The LLVM Compiler Infrastructure // From gohman at apple.com Thu Aug 20 12:08:17 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 20 Aug 2009 17:08:17 -0000 Subject: [llvm-commits] [llvm] r79538 - /llvm/trunk/docs/LangRef.html Message-ID: <200908201708.n7KH8Hs4004379@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 20 12:08:17 2009 New Revision: 79538 URL: http://llvm.org/viewvc/llvm-project?rev=79538&view=rev Log: Clarify a few things in the inbounds description. Describing inbounds in terms of infinitely precise arithmetic prohibits the assumption address-space-sized integer arithmetic will wrap, with a wrapped-around value landing within the same object. 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=79538&r1=79537&r2=79538&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Thu Aug 20 12:08:17 2009 @@ -4004,11 +4004,11 @@

      If the inbounds keyword is present, the result value of the getelementptr is undefined if the base pointer is not an in bounds address of an allocated object, or if any of the addresses - formed by successive addition of the offsets implied by the indices to - the base address are not an in bounds address of that allocated - object. + that would be formed by successive addition of the offsets implied by the + indices to the base address with infinitely precise arithmetic are not an + in bounds address of that allocated object. The in bounds addresses for an allocated object are all the addresses - that point into the object, plus the address one past the end.

      + that point into the object, plus the address one byte past the end.

      If the inbounds keyword is not present, the offsets are added to the base address with silently-wrapping two's complement arithmetic, and From dalej at apple.com Thu Aug 20 12:09:27 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 20 Aug 2009 10:09:27 -0700 Subject: [llvm-commits] [llvm] r79484 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/2009-08-19-inline-asm-a-modifier.ll In-Reply-To: <24F20C3D-421A-4129-8A12-8CF6CD3E4871@apple.com> References: <200908192244.n7JMigYf014298@zion.cs.uiuc.edu> <55BEFEE3-7A09-487D-BD9D-C8CA116098D5@apple.com> <5EABEA63-FDE4-4B3E-9745-646380B7B69D@apple.com> <24F20C3D-421A-4129-8A12-8CF6CD3E4871@apple.com> Message-ID: <4C339971-56A5-4FEA-A3A8-7AD2E6CEB319@apple.com> On Aug 19, 2009, at 8:16 PMPDT, Chris Lattner wrote: > > On Aug 19, 2009, at 5:40 PM, Dale Johannesen wrote: > >>> >>> If regalloc picks a register other than eax, it's a bug that would >>> be good to catch because that would be increasing number of used >>> registers. >> >> No, using ecx or edx would not make the code quality any worse. > > They would clobber an extra register. If/when we start doing > interprocedural regalloc, that is bad. Forcing the test to check > for eax does not make the test any more fragile. Yes it does. The choice of register has nothing to do with what the test is testing. The test is run twice, and one run is appropriate for FileCheck. It occurred to me a mix might work, and it seems to, so I've checked that in. You may be looking at this the wrong way; using FileCheck shouldn't be a goal in itself. If it's adequate to express what you're trying to test for, there are good reasons to use it, but here that's not the case. From gohman at apple.com Thu Aug 20 12:11:38 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 20 Aug 2009 17:11:38 -0000 Subject: [llvm-commits] [llvm] r79539 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolutionExpressions.h include/llvm/Bitcode/LLVMBitCodes.h include/llvm/InstrTypes.h include/llvm/Operator.h lib/Analysis/ScalarEvolution.cpp lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/Constants.cpp Message-ID: <200908201711.n7KHBdFa004863@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 20 12:11:38 2009 New Revision: 79539 URL: http://llvm.org/viewvc/llvm-project?rev=79539&view=rev Log: Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrap and hasNoSignedWrap, for consistency with the nuw and nsw properties. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h llvm/trunk/include/llvm/InstrTypes.h llvm/trunk/include/llvm/Operator.h llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Thu Aug 20 12:11:38 2009 @@ -426,12 +426,12 @@ return cast(SE.getAddExpr(this, getStepRecurrence(SE))); } - bool hasNoUnsignedOverflow() const { return SubclassData & (1 << 0); } - void setHasNoUnsignedOverflow(bool B) { + bool hasNoUnsignedWrap() const { return SubclassData & (1 << 0); } + void setHasNoUnsignedWrap(bool B) { SubclassData = (SubclassData & ~(1 << 0)) | (B << 0); } - bool hasNoSignedOverflow() const { return SubclassData & (1 << 1); } - void setHasNoSignedOverflow(bool B) { + bool hasNoSignedWrap() const { return SubclassData & (1 << 1); } + void setHasNoSignedWrap(bool B) { SubclassData = (SubclassData & ~(1 << 1)) | (B << 1); } Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original) +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Thu Aug 20 12:11:38 2009 @@ -180,8 +180,8 @@ /// OverflowingBinaryOperatorOptionalFlags - Flags for serializing /// OverflowingBinaryOperator's SubclassOptionalData contents. enum OverflowingBinaryOperatorOptionalFlags { - OBO_NO_UNSIGNED_OVERFLOW = 0, - OBO_NO_SIGNED_OVERFLOW = 1 + OBO_NO_UNSIGNED_WRAP = 0, + OBO_NO_SIGNED_WRAP = 1 }; /// SDivOperatorOptionalFlags - Flags for serializing SDivOperator's Modified: llvm/trunk/include/llvm/InstrTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/include/llvm/InstrTypes.h (original) +++ llvm/trunk/include/llvm/InstrTypes.h Thu Aug 20 12:11:38 2009 @@ -201,19 +201,19 @@ static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2, const Twine &Name = "") { BinaryOperator *BO = CreateAdd(V1, V2, Name); - cast(BO)->setHasNoSignedOverflow(true); + cast(BO)->setHasNoSignedWrap(true); return BO; } static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2, const Twine &Name, BasicBlock *BB) { BinaryOperator *BO = CreateAdd(V1, V2, Name, BB); - cast(BO)->setHasNoSignedOverflow(true); + cast(BO)->setHasNoSignedWrap(true); return BO; } static BinaryOperator *CreateNSWAdd(Value *V1, Value *V2, const Twine &Name, Instruction *I) { BinaryOperator *BO = CreateAdd(V1, V2, Name, I); - cast(BO)->setHasNoSignedOverflow(true); + cast(BO)->setHasNoSignedWrap(true); return BO; } Modified: llvm/trunk/include/llvm/Operator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/include/llvm/Operator.h (original) +++ llvm/trunk/include/llvm/Operator.h Thu Aug 20 12:11:38 2009 @@ -69,21 +69,21 @@ class OverflowingBinaryOperator : public Operator { ~OverflowingBinaryOperator(); // do not implement public: - /// hasNoUnsignedOverflow - Test whether this operation is known to never - /// undergo unsigned overflow. - bool hasNoUnsignedOverflow() const { + /// hasNoUnsignedWrap - Test whether this operation is known to never + /// undergo unsigned overflow, aka the nuw property. + bool hasNoUnsignedWrap() const { return SubclassOptionalData & (1 << 0); } - void setHasNoUnsignedOverflow(bool B) { + void setHasNoUnsignedWrap(bool B) { SubclassOptionalData = (SubclassOptionalData & ~(1 << 0)) | (B << 0); } - /// hasNoSignedOverflow - Test whether this operation is known to never - /// undergo signed overflow. - bool hasNoSignedOverflow() const { + /// hasNoSignedWrap - Test whether this operation is known to never + /// undergo signed overflow, aka the nsw property. + bool hasNoSignedWrap() const { return SubclassOptionalData & (1 << 1); } - void setHasNoSignedOverflow(bool B) { + void setHasNoSignedWrap(bool B) { SubclassOptionalData = (SubclassOptionalData & ~(1 << 1)) | (B << 1); } Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Thu Aug 20 12:11:38 2009 @@ -795,7 +795,7 @@ // If we have special knowledge that this addrec won't overflow, // we don't need to do any further analysis. - if (AR->hasNoUnsignedOverflow()) + if (AR->hasNoUnsignedWrap()) return getAddRecExpr(getZeroExtendExpr(Start, Ty), getZeroExtendExpr(Step, Ty), L); @@ -934,7 +934,7 @@ // If we have special knowledge that this addrec won't overflow, // we don't need to do any further analysis. - if (AR->hasNoSignedOverflow()) + if (AR->hasNoSignedWrap()) return getAddRecExpr(getSignExtendExpr(Start, Ty), getSignExtendExpr(Step, Ty), L); @@ -2497,17 +2497,17 @@ getSCEV(OBO->getOperand(1)) == PHISCEV->getStepRecurrence(*this)) { const SCEVAddRecExpr *PostInc = PHISCEV->getPostIncExpr(*this); - if (OBO->hasNoUnsignedOverflow()) { + if (OBO->hasNoUnsignedWrap()) { const_cast(PHISCEV) - ->setHasNoUnsignedOverflow(true); + ->setHasNoUnsignedWrap(true); const_cast(PostInc) - ->setHasNoUnsignedOverflow(true); + ->setHasNoUnsignedWrap(true); } - if (OBO->hasNoSignedOverflow()) { + if (OBO->hasNoSignedWrap()) { const_cast(PHISCEV) - ->setHasNoSignedOverflow(true); + ->setHasNoSignedWrap(true); const_cast(PostInc) - ->setHasNoSignedOverflow(true); + ->setHasNoSignedWrap(true); } } Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Aug 20 12:11:38 2009 @@ -2082,9 +2082,9 @@ return Error(ID.Loc,"constexpr requires integer, fp, or vector operands"); Constant *C = ConstantExpr::get(Opc, Val0, Val1); if (NUW) - cast(C)->setHasNoUnsignedOverflow(true); + cast(C)->setHasNoUnsignedWrap(true); if (NSW) - cast(C)->setHasNoSignedOverflow(true); + cast(C)->setHasNoSignedWrap(true); if (Exact) cast(C)->setIsExact(true); ID.ConstantVal = C; @@ -2665,9 +2665,9 @@ return Error(ModifierLoc, "nsw only applies to integer operations"); } if (NUW) - cast(Inst)->setHasNoUnsignedOverflow(true); + cast(Inst)->setHasNoUnsignedWrap(true); if (NSW) - cast(Inst)->setHasNoSignedOverflow(true); + cast(Inst)->setHasNoSignedWrap(true); } return Result; } Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Thu Aug 20 12:11:38 2009 @@ -883,10 +883,10 @@ static void SetOptimizationFlags(Value *V, uint64_t Flags) { if (OverflowingBinaryOperator *OBO = dyn_cast(V)) { - if (Flags & (1 << bitc::OBO_NO_SIGNED_OVERFLOW)) - OBO->setHasNoSignedOverflow(true); - if (Flags & (1 << bitc::OBO_NO_UNSIGNED_OVERFLOW)) - OBO->setHasNoUnsignedOverflow(true); + if (Flags & (1 << bitc::OBO_NO_SIGNED_WRAP)) + OBO->setHasNoSignedWrap(true); + if (Flags & (1 << bitc::OBO_NO_UNSIGNED_WRAP)) + OBO->setHasNoUnsignedWrap(true); } else if (SDivOperator *Div = dyn_cast(V)) { if (Flags & (1 << bitc::SDIV_EXACT)) Div->setIsExact(true); Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Thu Aug 20 12:11:38 2009 @@ -461,10 +461,10 @@ if (const OverflowingBinaryOperator *OBO = dyn_cast(V)) { - if (OBO->hasNoSignedOverflow()) - Flags |= 1 << bitc::OBO_NO_SIGNED_OVERFLOW; - if (OBO->hasNoUnsignedOverflow()) - Flags |= 1 << bitc::OBO_NO_UNSIGNED_OVERFLOW; + if (OBO->hasNoSignedWrap()) + Flags |= 1 << bitc::OBO_NO_SIGNED_WRAP; + if (OBO->hasNoUnsignedWrap()) + Flags |= 1 << bitc::OBO_NO_UNSIGNED_WRAP; } else if (const SDivOperator *Div = dyn_cast(V)) { if (Div->isExact()) Flags |= 1 << bitc::SDIV_EXACT; Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Aug 20 12:11:38 2009 @@ -3084,7 +3084,7 @@ if (SubOperator *Sub = dyn_cast(Op0)) if (isa(Sub->getOperand(0)) && cast(Sub->getOperand(0))->isNullValue() && - Sub->hasNoSignedOverflow()) + Sub->hasNoSignedWrap()) return BinaryOperator::CreateSDiv(Sub->getOperand(1), ConstantExpr::getNeg(RHS)); } Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Thu Aug 20 12:11:38 2009 @@ -895,9 +895,9 @@ static void WriteOptimizationInfo(raw_ostream &Out, const User *U) { if (const OverflowingBinaryOperator *OBO = dyn_cast(U)) { - if (OBO->hasNoUnsignedOverflow()) + if (OBO->hasNoUnsignedWrap()) Out << " nuw"; - if (OBO->hasNoSignedOverflow()) + if (OBO->hasNoSignedWrap()) Out << " nsw"; } else if (const SDivOperator *Div = dyn_cast(U)) { if (Div->isExact()) Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=79539&r1=79538&r2=79539&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Thu Aug 20 12:11:38 2009 @@ -634,7 +634,7 @@ // Set nsw attribute, assuming constant folding didn't eliminate the // Add. if (AddOperator *Add = dyn_cast(C)) - Add->setHasNoSignedOverflow(true); + Add->setHasNoSignedWrap(true); return C; } From daniel at zuster.org Thu Aug 20 12:12:33 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 20 Aug 2009 17:12:33 -0000 Subject: [llvm-commits] [llvm] r79540 - in /llvm/trunk: lib/Support/APFloat.cpp unittests/ADT/APFloatTest.cpp Message-ID: <200908201712.n7KHCXwk004996@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Aug 20 12:12:33 2009 New Revision: 79540 URL: http://llvm.org/viewvc/llvm-project?rev=79540&view=rev Log: Fix two APFloat bugs in converting hexadecimal constants. Modified: llvm/trunk/lib/Support/APFloat.cpp llvm/trunk/unittests/ADT/APFloatTest.cpp Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=79540&r1=79539&r2=79540&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Thu Aug 20 12:12:33 2009 @@ -2153,7 +2153,7 @@ integerPart hex_value; if(*p == '.') { - assert(dot == 0); + assert(dot == s.end()); dot = p++; } @@ -2190,7 +2190,7 @@ int expAdjustment; /* Implicit hexadecimal point? */ - if(!dot) + if (dot == s.end()) dot = p; /* Calculate the exponent adjustment implicit in the number of Modified: llvm/trunk/unittests/ADT/APFloatTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APFloatTest.cpp?rev=79540&r1=79539&r2=79540&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/APFloatTest.cpp (original) +++ llvm/trunk/unittests/ADT/APFloatTest.cpp Thu Aug 20 12:12:33 2009 @@ -60,6 +60,8 @@ EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1234").convertToDouble()); EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1234").convertToDouble()); EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0.p1234").convertToDouble()); + EXPECT_EQ(1.0625, APFloat(APFloat::IEEEdouble, "0x1.1p0").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "0x1p0").convertToDouble()); EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, StringRef("0e1\02", 3)).convertToDouble()); } From gohman at apple.com Thu Aug 20 12:15:20 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 20 Aug 2009 17:15:20 -0000 Subject: [llvm-commits] [llvm] r79541 - /llvm/trunk/lib/Support/ErrorHandling.cpp Message-ID: <200908201715.n7KHFKBp005359@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 20 12:15:19 2009 New Revision: 79541 URL: http://llvm.org/viewvc/llvm-project?rev=79541&view=rev Log: Add a comment explaining why llvm_unreachable_internal doesn't call the ErrorHandler callback. Modified: llvm/trunk/lib/Support/ErrorHandling.cpp Modified: llvm/trunk/lib/Support/ErrorHandling.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ErrorHandling.cpp?rev=79541&r1=79540&r2=79541&view=diff ============================================================================== --- llvm/trunk/lib/Support/ErrorHandling.cpp (original) +++ llvm/trunk/lib/Support/ErrorHandling.cpp Thu Aug 20 12:15:19 2009 @@ -58,6 +58,9 @@ void llvm_unreachable_internal(const char *msg, const char *file, unsigned line) { + // This code intentionally doesn't call the ErrorHandler callback, because + // llvm_unreachable is intended to be used to indicate "impossible" + // situations, and not legitimate runtime errors. if (msg) errs() << msg << "\n"; errs() << "UNREACHABLE executed"; From bob.wilson at apple.com Thu Aug 20 12:18:39 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 20 Aug 2009 17:18:39 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79542 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Message-ID: <200908201718.n7KHIdp3005778@zion.cs.uiuc.edu> Author: bwilson Date: Thu Aug 20 12:18:38 2009 New Revision: 79542 URL: http://llvm.org/viewvc/llvm-project?rev=79542&view=rev Log: Propagate the LLVM-specific change to default_strip_name_encoding (from gcc/varasm.c) to the ARM version in arm_strip_name_encoding. This fixes a problem where duplicate symbol declarations with asm renaming cause warnings because the extra '\1' character is not stripped off and it looks like the asm renaming is not the same. Radar 7155137. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=79542&r1=79541&r2=79542&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Thu Aug 20 12:18:38 2009 @@ -2163,6 +2163,16 @@ #define SUBTARGET_NAME_ENCODING_LENGTHS #endif +/* LLVM LOCAL begin default name encoding */ +#ifndef ENABLE_LLVM +#define DEFAULT_NAME_ENCODING_LENGTHS \ + case '*': return 1; +#else +#define DEFAULT_NAME_ENCODING_LENGTHS \ + case '\1': return 1; +#endif +/* LLVM LOCAL end default name encoding */ + /* This is a C fragment for the inside of a switch statement. Each case label should return the number of characters to be stripped from the start of a function's name, if that @@ -2170,14 +2180,14 @@ /* LLVM LOCAL */ #if TARGET_MACHO #define ARM_NAME_ENCODING_LENGTHS \ - case '*': return 1; \ + DEFAULT_NAME_ENCODING_LENGTHS \ SUBTARGET_NAME_ENCODING_LENGTHS /* LLVM LOCAL begin name encoding */ #else #define ARM_NAME_ENCODING_LENGTHS \ case SHORT_CALL_FLAG_CHAR: return 1; \ case LONG_CALL_FLAG_CHAR: return 1; \ - case '*': return 1; \ + DEFAULT_NAME_ENCODING_LENGTHS \ SUBTARGET_NAME_ENCODING_LENGTHS #endif /* LLVM LOCAL end name encoding */ From brukman at cs.uiuc.edu Thu Aug 20 12:19:32 2009 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu, 20 Aug 2009 12:19:32 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/pubs.js Message-ID: <200908201719.n7KHJWGI005912@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: pubs.js updated: 1.48 -> 1.49 --- Log message: A chart with blue bars (instead of bright yellow) looks better on this page. --- Diffs of the changes: (+3 -1) pubs.js | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm-www/pubs/pubs.js diff -u llvm-www/pubs/pubs.js:1.48 llvm-www/pubs/pubs.js:1.49 --- llvm-www/pubs/pubs.js:1.48 Mon Jun 29 16:28:53 2009 +++ llvm-www/pubs/pubs.js Thu Aug 20 12:18:35 2009 @@ -897,8 +897,10 @@ var container = document.getElementById(id); var image = document.createElement('img'); - image.src = 'http://chart.apis.google.com/chart?cht=bvs' + // vertical bars + image.src = 'http://chart.apis.google.com/chart' + + '?cht=bvs' + // vertical bars '&chs=300x200' + // size + '&chco=76A4FB' + // color '&chtt=Histogram' + // title '&chdl=Count' + // label in legend '&chxt=x,y' + // axes From brukman at cs.uiuc.edu Thu Aug 20 12:19:57 2009 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu, 20 Aug 2009 12:19:57 -0500 Subject: [llvm-commits] CVS: llvm-www/developers.txt Message-ID: <200908201719.n7KHJvOV005974@zion.cs.uiuc.edu> Changes in directory llvm-www: developers.txt updated: 1.20 -> 1.21 --- Log message: Updated URL to my home page. --- Diffs of the changes: (+1 -1) developers.txt | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/developers.txt diff -u llvm-www/developers.txt:1.20 llvm-www/developers.txt:1.21 --- llvm-www/developers.txt:1.20 Wed Aug 19 01:25:04 2009 +++ llvm-www/developers.txt Thu Aug 20 12:19:40 2009 @@ -3,7 +3,7 @@ Henrik Bach href=mailto:henrik.bach.llvm at gmail.com img=PhotoHenrik.jpg width=156 height=178 alt=Henrik Nate Begeman href=http://sampo.lasthome.net/ img=PhotoNate.jpg width=160 height=130 alt=Sampo Rob Bocchino href=http://llvm.cs.uiuc.edu/~bocchino img=PhotoRob.jpg width=140 height=187 alt=Rob -Misha Brukman href=http://misha.brukman.net/code/llvm/ img=PhotoMisha.png width=175 height=198 alt=Misha +Misha Brukman href=http://misha.brukman.net/ img=PhotoMisha.png width=175 height=198 alt=Misha Evan Cheng href=mailto:evan.cheng at apple.com img=PhotoEvan.jpg width=152 height=198 alt=Grawp Jeff Cohen href=http://jolt-lang.org/ img=PhotoJeffCohen.jpg width=165 height=134 alt=jeffc John Criswell href=http://www.bigw.org/~jcriswel/ img=PhotoJohn.gif width=76 height=76 alt=Dogbert From daniel at zuster.org Thu Aug 20 12:41:54 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 20 Aug 2009 17:41:54 -0000 Subject: [llvm-commits] [test-suite] r79543 - /test-suite/trunk/SingleSource/UnitTests/ObjC/exceptions.m Message-ID: <200908201741.n7KHfs2A008802@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Aug 20 12:41:53 2009 New Revision: 79543 URL: http://llvm.org/viewvc/llvm-project?rev=79543&view=rev Log: Don't depend on the value of __FILE__ in output Modified: test-suite/trunk/SingleSource/UnitTests/ObjC/exceptions.m Modified: test-suite/trunk/SingleSource/UnitTests/ObjC/exceptions.m URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/ObjC/exceptions.m?rev=79543&r1=79542&r2=79543&view=diff ============================================================================== --- test-suite/trunk/SingleSource/UnitTests/ObjC/exceptions.m (original) +++ test-suite/trunk/SingleSource/UnitTests/ObjC/exceptions.m Thu Aug 20 12:41:53 2009 @@ -2,7 +2,7 @@ #include #include -#define D() printf("%s:%d\n", __FILE__, __LINE__) +#define D() printf("exceptions.m:%d\n", __LINE__) @interface A @end @implementation A @end From bob.wilson at apple.com Thu Aug 20 12:44:50 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 20 Aug 2009 10:44:50 -0700 Subject: [llvm-commits] calling convention support for ARM AAPCS VFP "homogenous aggregates" In-Reply-To: <305d6f60908160453m3e002946h1b110ece7db4c431@mail.gmail.com> References: <305d6f60908050315i4d781629wfe2ef4d477aa2891@mail.gmail.com> <23BAC688-10C7-40F8-82E8-A82EA8F527AB@apple.com> <305d6f60908140206p5767ce36v3db86a55f7cc8368@mail.gmail.com> <305d6f60908150744hbe2a8f7i1e1510884089126@mail.gmail.com> <305d6f60908150847u1abcfcb6obbb1370ee9d09198@mail.gmail.com> <305d6f60908160453m3e002946h1b110ece7db4c431@mail.gmail.com> Message-ID: <979CBA90-1989-4A1C-B473-A6510B147BE4@apple.com> On Aug 16, 2009, at 4:53 AM, Sandeep Patel wrote: > Attached is the retyping from unsigned to CallingConv::ID in LLVM > proper. It's largely mechanical. I left the C API signatures the same, > but changed the C++ ones. I don't see anyone else commenting on this. It looks fine to me, but just to be on the safe side, please wait and commit it after the 2.6 release branches. From baldrick at free.fr Thu Aug 20 12:50:25 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 17:50:25 -0000 Subject: [llvm-commits] [gcc-plugin] r79545 - in /gcc-plugin/trunk: Makefile llvm-backend.cpp Message-ID: <200908201750.n7KHoPiX009938@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 12:50:25 2009 New Revision: 79545 URL: http://llvm.org/viewvc/llvm-project?rev=79545&view=rev Log: Determine the target triple automagically, rather than hard-wiring it. Modified: gcc-plugin/trunk/Makefile gcc-plugin/trunk/llvm-backend.cpp Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=79545&r1=79544&r2=79545&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Thu Aug 20 12:50:25 2009 @@ -8,8 +8,10 @@ #CFLAGS+=-I$(GCCPLUGINS_DIR)/include -fPIC -O2 +TARGET_TRIPLE:=$(shell $(GCCOBJECT_DIR)/gcc/xgcc -v 2>&1 | grep "^Target:" | sed -e "s/^Target: *//") + CFLAGS+=-Werror -fPIC -g -O2 -CFLAGS+=-DIN_GCC +CFLAGS+=-DIN_GCC -DTARGET_NAME=\"$(TARGET_TRIPLE)\" CFLAGS+=-I${GCCOBJECT_DIR}/gcc -I${GCCOBJECT_DIR}/gcc/include \ -I${GCCSOURCE_DIR}/gcc -I${GCCSOURCE_DIR}/include \ -I${GCCSOURCE_DIR}/libcpp/include -I${GCCSOURCE_DIR}/libdecnumber \ Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=79545&r1=79544&r2=79545&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Thu Aug 20 12:50:25 2009 @@ -468,23 +468,22 @@ // If the target wants to override the architecture, e.g. turning // powerpc-darwin-... into powerpc64-darwin-... when -m64 is enabled, do so // now. - std::string TargetTriple = "x86_64-linux-gnu"; // FIXME! -//TODO std::string TargetTriple = TARGET_NAME; -//TODO#ifdef LLVM_OVERRIDE_TARGET_ARCH -//TODO std::string Arch = LLVM_OVERRIDE_TARGET_ARCH(); -//TODO if (!Arch.empty()) { -//TODO std::string::size_type DashPos = TargetTriple.find('-'); -//TODO if (DashPos != std::string::npos)// If we have a sane t-t, replace the arch. -//TODO TargetTriple = Arch + TargetTriple.substr(DashPos); -//TODO } -//TODO#endif -//TODO#ifdef LLVM_OVERRIDE_TARGET_VERSION -//TODO char *NewTriple; -//TODO bool OverRidden = LLVM_OVERRIDE_TARGET_VERSION(TargetTriple.c_str(), -//TODO &NewTriple); -//TODO if (OverRidden) -//TODO TargetTriple = std::string(NewTriple); -//TODO#endif + std::string TargetTriple = TARGET_NAME; +#ifdef LLVM_OVERRIDE_TARGET_ARCH + std::string Arch = LLVM_OVERRIDE_TARGET_ARCH(); + if (!Arch.empty()) { + std::string::size_type DashPos = TargetTriple.find('-'); + if (DashPos != std::string::npos)// If we have a sane t-t, replace the arch. + TargetTriple = Arch + TargetTriple.substr(DashPos); + } +#endif +#ifdef LLVM_OVERRIDE_TARGET_VERSION + char *NewTriple; + bool OverRidden = LLVM_OVERRIDE_TARGET_VERSION(TargetTriple.c_str(), + &NewTriple); + if (OverRidden) + TargetTriple = std::string(NewTriple); +#endif TheModule->setTargetTriple(TargetTriple); TheTypeConverter = new TypeConverter(); From sanjiv.gupta at microchip.com Thu Aug 20 13:11:42 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Thu, 20 Aug 2009 23:41:42 +0530 Subject: [llvm-commits] [llvm] r79274 - /llvm/trunk/lib/Analysis/DebugInfo.cpp In-Reply-To: <200908172036.n7HKaKh9023917@zion.cs.uiuc.edu> References: <200908172036.n7HKaKh9023917@zion.cs.uiuc.edu> Message-ID: <4A8D91DE.9010502@microchip.com> Devang Patel wrote: > Author: dpatel > Date: Mon Aug 17 15:36:20 2009 > New Revision: 79274 > > URL: http://llvm.org/viewvc/llvm-project?rev=79274&view=rev > Log: > Oops. find all llvm.dbg.global_variables. > > Modified: > llvm/trunk/lib/Analysis/DebugInfo.cpp > > Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=79274&r1=79273&r2=79274&view=diff > > ============================================================================== > --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) > +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 17 15:36:20 2009 > @@ -942,7 +942,7 @@ > GVI != GVE; ++GVI) { > GlobalVariable *GV = GVI; > if (!GV->hasName() || !GV->isConstant() > - || strcmp(GV->getName().data(), "llvm.dbg.global_variable") > + || strncmp(GV->getName().data(), "llvm.dbg.global_variable", 24) > || !GV->hasInitializer()) > continue; > DIGlobalVariable DIG(GV); > > > This breaks PIC16's debug info again. Try a simple case below with clang-cc -g -triple=pic16 , llc -march=pic16, char *ptr = (char *)0xA0; struct _st_1{ int s1_1; struct _nested { int nest_var; }nested; }st_1={10,10}; int a; int main() { a = st_1.nested.nest_var; *ptr = a; } > _______________________________________________ > 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 Aug 20 13:19:02 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 18:19:02 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79551 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200908201819.n7KIJ37g013697@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 13:19:02 2009 New Revision: 79551 URL: http://llvm.org/viewvc/llvm-project?rev=79551&view=rev Log: The target triple is already available in TargetTriple. No need to recompute it. 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=79551&r1=79550&r2=79551&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Thu Aug 20 13:19:02 2009 @@ -454,13 +454,12 @@ TheModule->setTargetTriple(TargetTriple); TheTypeConverter = new TypeConverter(); - + // Create the TargetMachine we will be generating code with. // FIXME: Figure out how to select the target and pass down subtarget info. std::string Err; - std::string Triple = TheModule->getTargetTriple(); const Target *TME = - TargetRegistry::lookupTarget(Triple, Err); + TargetRegistry::lookupTarget(TargetTriple, Err); if (!TME) { cerr << "Did not get a target machine! Triplet is " << TargetTriple << '\n'; exit(1); @@ -475,7 +474,7 @@ LLVM_SET_SUBTARGET_FEATURES(Features); FeatureStr = Features.getString(); #endif - TheTarget = TME->createTargetMachine(Triple, FeatureStr); + TheTarget = TME->createTargetMachine(TargetTriple, FeatureStr); assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN); TheFolder = new TargetFolder(TheTarget->getTargetData(), getGlobalContext()); From baldrick at free.fr Thu Aug 20 13:20:04 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 18:20:04 -0000 Subject: [llvm-commits] [gcc-plugin] r79552 - /gcc-plugin/trunk/llvm-backend.cpp Message-ID: <200908201820.n7KIK4dk013839@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 13:20:04 2009 New Revision: 79552 URL: http://llvm.org/viewvc/llvm-project?rev=79552&view=rev Log: Bring up to llvm-gcc revision 79551. Modified: gcc-plugin/trunk/llvm-backend.cpp Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=79552&r1=79551&r2=79552&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Thu Aug 20 13:20:04 2009 @@ -491,9 +491,8 @@ // Create the TargetMachine we will be generating code with. // FIXME: Figure out how to select the target and pass down subtarget info. std::string Err; - std::string Triple = TheModule->getTargetTriple(); const Target *TME = - TargetRegistry::lookupTarget(Triple, Err); + TargetRegistry::lookupTarget(TargetTriple, Err); if (!TME) llvm_report_error(Err); @@ -506,7 +505,7 @@ //TODO LLVM_SET_SUBTARGET_FEATURES(Features); //TODO FeatureStr = Features.getString(); //TODO#endif - TheTarget = TME->createTargetMachine(Triple, FeatureStr); + TheTarget = TME->createTargetMachine(TargetTriple, FeatureStr); assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN); TheFolder = new TargetFolder(TheTarget->getTargetData(), getGlobalContext()); From gohman at apple.com Thu Aug 20 13:23:44 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 20 Aug 2009 18:23:44 -0000 Subject: [llvm-commits] [llvm] r79553 - in /llvm/trunk: lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/abi-isel.ll test/CodeGen/X86/codemodel.ll test/CodeGen/X86/rip-rel-address.ll Message-ID: <200908201823.n7KINiWA014298@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 20 13:23:44 2009 New Revision: 79553 URL: http://llvm.org/viewvc/llvm-project?rev=79553&view=rev Log: Fix an x86 code size regression: prefer RIP-relative addressing over absolute addressing even in non-PIC mode (unless the address has an index or something else incompatible), because it has a smaller encoding. Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/test/CodeGen/X86/abi-isel.ll llvm/trunk/test/CodeGen/X86/codemodel.ll llvm/trunk/test/CodeGen/X86/rip-rel-address.ll Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=79553&r1=79552&r2=79553&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Aug 20 13:23:44 2009 @@ -813,6 +813,19 @@ AM.Scale = 1; } + // Post-processing: Convert foo to foo(%rip), even in non-PIC mode, + // because it has a smaller encoding. + // TODO: Which other code models can use this? + if (TM.getCodeModel() == CodeModel::Small && + Subtarget->is64Bit() && + AM.Scale == 1 && + AM.BaseType == X86ISelAddressMode::RegBase && + AM.Base.Reg.getNode() == 0 && + AM.IndexReg.getNode() == 0 && + AM.SymbolFlags == 0 && + AM.hasSymbolicDisplacement()) + AM.Base.Reg = CurDAG->getRegister(X86::RIP, MVT::i64); + return false; } Modified: llvm/trunk/test/CodeGen/X86/abi-isel.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/abi-isel.ll?rev=79553&r1=79552&r2=79553&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/abi-isel.ll (original) +++ llvm/trunk/test/CodeGen/X86/abi-isel.ll Thu Aug 20 13:23:44 2009 @@ -191,7 +191,7 @@ ret void ; LINUX-64-STATIC: foo00: -; LINUX-64-STATIC: movl src, %eax +; LINUX-64-STATIC: movl src(%rip), %eax ; LINUX-64-STATIC: movl %eax, dst ; LINUX-64-STATIC: ret } @@ -203,7 +203,7 @@ ret void ; LINUX-64-STATIC: fxo00: -; LINUX-64-STATIC: movl xsrc, %eax +; LINUX-64-STATIC: movl xsrc(%rip), %eax ; LINUX-64-STATIC: movl %eax, xdst ; LINUX-64-STATIC: ret } @@ -233,8 +233,8 @@ store i32 %1, i32* %0, align 4 ret void ; LINUX-64-STATIC: foo02: -; LINUX-64-STATIC: movl src, % -; LINUX-64-STATIC: movq ptr, % +; LINUX-64-STATIC: movl src(%rip), % +; LINUX-64-STATIC: movq ptr(%rip), % ; LINUX-64-STATIC: movl ; LINUX-64-STATIC: ret } @@ -245,8 +245,8 @@ %1 = load i32* getelementptr ([32 x i32]* @xsrc, i32 0, i64 0), align 4 store i32 %1, i32* %0, align 4 ; LINUX-64-STATIC: fxo02: -; LINUX-64-STATIC: movl xsrc, % -; LINUX-64-STATIC: movq ptr, % +; LINUX-64-STATIC: movl xsrc(%rip), % +; LINUX-64-STATIC: movq ptr(%rip), % ; LINUX-64-STATIC: movl ; LINUX-64-STATIC: ret ret void @@ -258,7 +258,7 @@ store i32 %0, i32* getelementptr ([131072 x i32]* @ddst, i32 0, i64 0), align 32 ret void ; LINUX-64-STATIC: foo03: -; LINUX-64-STATIC: movl dsrc, %eax +; LINUX-64-STATIC: movl dsrc(%rip), %eax ; LINUX-64-STATIC: movl %eax, ddst ; LINUX-64-STATIC: ret } @@ -279,8 +279,8 @@ store i32 %1, i32* %0, align 4 ret void ; LINUX-64-STATIC: foo05: -; LINUX-64-STATIC: movl dsrc, % -; LINUX-64-STATIC: movq dptr, % +; LINUX-64-STATIC: movl dsrc(%rip), % +; LINUX-64-STATIC: movq dptr(%rip), % ; LINUX-64-STATIC: movl ; LINUX-64-STATIC: ret } @@ -291,8 +291,8 @@ store i32 %0, i32* getelementptr ([131072 x i32]* @ldst, i32 0, i64 0), align 4 ret void ; LINUX-64-STATIC: foo06: -; LINUX-64-STATIC: movl lsrc, %eax -; LINUX-64-STATIC: movl %eax, ldst +; LINUX-64-STATIC: movl lsrc(%rip), %eax +; LINUX-64-STATIC: movl %eax, ldst(%rip) ; LINUX-64-STATIC: ret } @@ -312,8 +312,8 @@ store i32 %1, i32* %0, align 4 ret void ; LINUX-64-STATIC: foo08: -; LINUX-64-STATIC: movl lsrc, % -; LINUX-64-STATIC: movq lptr, % +; LINUX-64-STATIC: movl lsrc(%rip), % +; LINUX-64-STATIC: movq lptr(%rip), % ; LINUX-64-STATIC: movl ; LINUX-64-STATIC: ret } @@ -324,8 +324,8 @@ store i32 %0, i32* getelementptr ([131072 x i32]* @dst, i32 0, i64 16), align 4 ret void ; LINUX-64-STATIC: qux00: -; LINUX-64-STATIC: movl src+64, %eax -; LINUX-64-STATIC: movl %eax, dst+64 +; LINUX-64-STATIC: movl src+64(%rip), %eax +; LINUX-64-STATIC: movl %eax, dst+64(%rip) ; LINUX-64-STATIC: ret } @@ -335,8 +335,8 @@ store i32 %0, i32* getelementptr ([32 x i32]* @xdst, i32 0, i64 16), align 4 ret void ; LINUX-64-STATIC: qxx00: -; LINUX-64-STATIC: movl xsrc+64, %eax -; LINUX-64-STATIC: movl %eax, xdst+64 +; LINUX-64-STATIC: movl xsrc+64(%rip), %eax +; LINUX-64-STATIC: movl %eax, xdst+64(%rip) ; LINUX-64-STATIC: ret } @@ -365,8 +365,8 @@ %2 = getelementptr i32* %0, i64 16 store i32 %1, i32* %2, align 4 ; LINUX-64-STATIC: qux02: -; LINUX-64-STATIC: movl src+64, %eax -; LINUX-64-STATIC: movq ptr, %rcx +; LINUX-64-STATIC: movl src+64(%rip), %eax +; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx) ; LINUX-64-STATIC: ret ret void @@ -379,8 +379,8 @@ %2 = getelementptr i32* %0, i64 16 store i32 %1, i32* %2, align 4 ; LINUX-64-STATIC: qxx02: -; LINUX-64-STATIC: movl xsrc+64, %eax -; LINUX-64-STATIC: movq ptr, %rcx +; LINUX-64-STATIC: movl xsrc+64(%rip), %eax +; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx) ; LINUX-64-STATIC: ret ret void @@ -392,8 +392,8 @@ store i32 %0, i32* getelementptr ([131072 x i32]* @ddst, i32 0, i64 16), align 32 ret void ; LINUX-64-STATIC: qux03: -; LINUX-64-STATIC: movl dsrc+64, %eax -; LINUX-64-STATIC: movl %eax, ddst+64 +; LINUX-64-STATIC: movl dsrc+64(%rip), %eax +; LINUX-64-STATIC: movl %eax, ddst+64(%rip) ; LINUX-64-STATIC: ret } @@ -402,7 +402,7 @@ store i32* getelementptr ([131072 x i32]* @ddst, i32 0, i64 16), i32** @dptr, align 8 ret void ; LINUX-64-STATIC: qux04: -; LINUX-64-STATIC: movq $ddst+64, dptr +; LINUX-64-STATIC: movq $ddst+64, dptr(%rip) ; LINUX-64-STATIC: ret } @@ -413,8 +413,8 @@ %2 = getelementptr i32* %0, i64 16 store i32 %1, i32* %2, align 4 ; LINUX-64-STATIC: qux05: -; LINUX-64-STATIC: movl dsrc+64, %eax -; LINUX-64-STATIC: movq dptr, %rcx +; LINUX-64-STATIC: movl dsrc+64(%rip), %eax +; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx) ; LINUX-64-STATIC: ret ret void @@ -426,7 +426,7 @@ store i32 %0, i32* getelementptr ([131072 x i32]* @ldst, i32 0, i64 16), align 4 ret void ; LINUX-64-STATIC: qux06: -; LINUX-64-STATIC: movl lsrc+64, %eax +; LINUX-64-STATIC: movl lsrc+64(%rip), %eax ; LINUX-64-STATIC: movl %eax, ldst+64 ; LINUX-64-STATIC: ret } @@ -447,8 +447,8 @@ %2 = getelementptr i32* %0, i64 16 store i32 %1, i32* %2, align 4 ; LINUX-64-STATIC: qux08: -; LINUX-64-STATIC: movl lsrc+64, %eax -; LINUX-64-STATIC: movq lptr, %rcx +; LINUX-64-STATIC: movl lsrc+64(%rip), %eax +; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx) ; LINUX-64-STATIC: ret ret void @@ -512,7 +512,7 @@ ret void ; LINUX-64-STATIC: ind02: ; LINUX-64-STATIC: movl src(,%rdi,4), %eax -; LINUX-64-STATIC: movq ptr, %rcx +; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, (%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -527,7 +527,7 @@ ret void ; LINUX-64-STATIC: ixd02: ; LINUX-64-STATIC: movl xsrc(,%rdi,4), %eax -; LINUX-64-STATIC: movq ptr, %rcx +; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, (%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -566,7 +566,7 @@ ret void ; LINUX-64-STATIC: ind05: ; LINUX-64-STATIC: movl dsrc(,%rdi,4), %eax -; LINUX-64-STATIC: movq dptr, %rcx +; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, (%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -605,7 +605,7 @@ ret void ; LINUX-64-STATIC: ind08: ; LINUX-64-STATIC: movl lsrc(,%rdi,4), %eax -; LINUX-64-STATIC: movq lptr, %rcx +; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, (%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -673,7 +673,7 @@ ret void ; LINUX-64-STATIC: off02: ; LINUX-64-STATIC: movl src+64(,%rdi,4), %eax -; LINUX-64-STATIC: movq ptr, %rcx +; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -689,7 +689,7 @@ ret void ; LINUX-64-STATIC: oxf02: ; LINUX-64-STATIC: movl xsrc+64(,%rdi,4), %eax -; LINUX-64-STATIC: movq ptr, %rcx +; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -731,7 +731,7 @@ ret void ; LINUX-64-STATIC: off05: ; LINUX-64-STATIC: movl dsrc+64(,%rdi,4), %eax -; LINUX-64-STATIC: movq dptr, %rcx +; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -773,7 +773,7 @@ ret void ; LINUX-64-STATIC: off08: ; LINUX-64-STATIC: movl lsrc+64(,%rdi,4), %eax -; LINUX-64-STATIC: movq lptr, %rcx +; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -784,8 +784,8 @@ store i32 %0, i32* getelementptr ([131072 x i32]* @dst, i32 0, i64 65536), align 4 ret void ; LINUX-64-STATIC: moo00: -; LINUX-64-STATIC: movl src+262144, %eax -; LINUX-64-STATIC: movl %eax, dst+262144 +; LINUX-64-STATIC: movl src+262144(%rip), %eax +; LINUX-64-STATIC: movl %eax, dst+262144(%rip) ; LINUX-64-STATIC: ret } @@ -794,7 +794,7 @@ store i32* getelementptr ([131072 x i32]* @dst, i32 0, i64 65536), i32** @ptr, align 8 ret void ; LINUX-64-STATIC: moo01: -; LINUX-64-STATIC: movq $dst+262144, ptr +; LINUX-64-STATIC: movq $dst+262144, ptr(%rip) ; LINUX-64-STATIC: ret } @@ -806,8 +806,8 @@ store i32 %1, i32* %2, align 4 ret void ; LINUX-64-STATIC: moo02: -; LINUX-64-STATIC: movl src+262144, %eax -; LINUX-64-STATIC: movq ptr, %rcx +; LINUX-64-STATIC: movl src+262144(%rip), %eax +; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx) ; LINUX-64-STATIC: ret } @@ -818,8 +818,8 @@ store i32 %0, i32* getelementptr ([131072 x i32]* @ddst, i32 0, i64 65536), align 32 ret void ; LINUX-64-STATIC: moo03: -; LINUX-64-STATIC: movl dsrc+262144, %eax -; LINUX-64-STATIC: movl %eax, ddst+262144 +; LINUX-64-STATIC: movl dsrc+262144(%rip), %eax +; LINUX-64-STATIC: movl %eax, ddst+262144(%rip) ; LINUX-64-STATIC: ret } @@ -840,8 +840,8 @@ store i32 %1, i32* %2, align 4 ret void ; LINUX-64-STATIC: moo05: -; LINUX-64-STATIC: movl dsrc+262144, %eax -; LINUX-64-STATIC: movq dptr, %rcx +; LINUX-64-STATIC: movl dsrc+262144(%rip), %eax +; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx) ; LINUX-64-STATIC: ret } @@ -852,8 +852,8 @@ store i32 %0, i32* getelementptr ([131072 x i32]* @ldst, i32 0, i64 65536), align 4 ret void ; LINUX-64-STATIC: moo06: -; LINUX-64-STATIC: movl lsrc+262144, %eax -; LINUX-64-STATIC: movl %eax, ldst+262144 +; LINUX-64-STATIC: movl lsrc+262144(%rip), %eax +; LINUX-64-STATIC: movl %eax, ldst+262144(%rip) ; LINUX-64-STATIC: ret } @@ -874,8 +874,8 @@ store i32 %1, i32* %2, align 4 ret void ; LINUX-64-STATIC: moo08: -; LINUX-64-STATIC: movl lsrc+262144, %eax -; LINUX-64-STATIC: movq lptr, %rcx +; LINUX-64-STATIC: movl lsrc+262144(%rip), %eax +; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx) ; LINUX-64-STATIC: ret } @@ -902,7 +902,7 @@ ret void ; LINUX-64-STATIC: big01: ; LINUX-64-STATIC: leaq dst+262144(,%rdi,4), %rax -; LINUX-64-STATIC: movq %rax, ptr +; LINUX-64-STATIC: movq %rax, ptr(%rip) ; LINUX-64-STATIC: ret } @@ -917,7 +917,7 @@ ret void ; LINUX-64-STATIC: big02: ; LINUX-64-STATIC: movl src+262144(,%rdi,4), %eax -; LINUX-64-STATIC: movq ptr, %rcx +; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -959,7 +959,7 @@ ret void ; LINUX-64-STATIC: big05: ; LINUX-64-STATIC: movl dsrc+262144(,%rdi,4), %eax -; LINUX-64-STATIC: movq dptr, %rcx +; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -1001,7 +1001,7 @@ ret void ; LINUX-64-STATIC: big08: ; LINUX-64-STATIC: movl lsrc+262144(,%rdi,4), %eax -; LINUX-64-STATIC: movq lptr, %rcx +; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx,%rdi,4) ; LINUX-64-STATIC: ret } @@ -1132,7 +1132,7 @@ %1 = bitcast i32* %0 to i8* ret i8* %1 ; LINUX-64-STATIC: har02: -; LINUX-64-STATIC: movq ptr, %rax +; LINUX-64-STATIC: movq ptr(%rip), %rax ; LINUX-64-STATIC: ret } @@ -1158,7 +1158,7 @@ %1 = bitcast i32* %0 to i8* ret i8* %1 ; LINUX-64-STATIC: har05: -; LINUX-64-STATIC: movq dptr, %rax +; LINUX-64-STATIC: movq dptr(%rip), %rax ; LINUX-64-STATIC: ret } @@ -1184,7 +1184,7 @@ %1 = bitcast i32* %0 to i8* ret i8* %1 ; LINUX-64-STATIC: har08: -; LINUX-64-STATIC: movq lptr, %rax +; LINUX-64-STATIC: movq lptr(%rip), %rax ; LINUX-64-STATIC: ret } @@ -1227,7 +1227,7 @@ %2 = bitcast i32* %1 to i8* ret i8* %2 ; LINUX-64-STATIC: bat02: -; LINUX-64-STATIC: movq ptr, %rax +; LINUX-64-STATIC: movq ptr(%rip), %rax ; LINUX-64-STATIC: addq $64, %rax ; LINUX-64-STATIC: ret } @@ -1255,7 +1255,7 @@ %2 = bitcast i32* %1 to i8* ret i8* %2 ; LINUX-64-STATIC: bat05: -; LINUX-64-STATIC: movq dptr, %rax +; LINUX-64-STATIC: movq dptr(%rip), %rax ; LINUX-64-STATIC: addq $64, %rax ; LINUX-64-STATIC: ret } @@ -1283,7 +1283,7 @@ %2 = bitcast i32* %1 to i8* ret i8* %2 ; LINUX-64-STATIC: bat08: -; LINUX-64-STATIC: movq lptr, %rax +; LINUX-64-STATIC: movq lptr(%rip), %rax ; LINUX-64-STATIC: addq $64, %rax ; LINUX-64-STATIC: ret } @@ -1320,7 +1320,7 @@ ret i8* %2 ; LINUX-64-STATIC: bam02: ; LINUX-64-STATIC: movl $262144, %eax -; LINUX-64-STATIC: addq ptr, %rax +; LINUX-64-STATIC: addq ptr(%rip), %rax ; LINUX-64-STATIC: ret } @@ -1348,7 +1348,7 @@ ret i8* %2 ; LINUX-64-STATIC: bam05: ; LINUX-64-STATIC: movl $262144, %eax -; LINUX-64-STATIC: addq dptr, %rax +; LINUX-64-STATIC: addq dptr(%rip), %rax ; LINUX-64-STATIC: ret } @@ -1376,7 +1376,7 @@ ret i8* %2 ; LINUX-64-STATIC: bam08: ; LINUX-64-STATIC: movl $262144, %eax -; LINUX-64-STATIC: addq lptr, %rax +; LINUX-64-STATIC: addq lptr(%rip), %rax ; LINUX-64-STATIC: ret } @@ -1432,7 +1432,7 @@ %3 = bitcast i32* %2 to i8* ret i8* %3 ; LINUX-64-STATIC: cat02: -; LINUX-64-STATIC: movq ptr, %rax +; LINUX-64-STATIC: movq ptr(%rip), %rax ; LINUX-64-STATIC: leaq 64(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret } @@ -1467,7 +1467,7 @@ %3 = bitcast i32* %2 to i8* ret i8* %3 ; LINUX-64-STATIC: cat05: -; LINUX-64-STATIC: movq dptr, %rax +; LINUX-64-STATIC: movq dptr(%rip), %rax ; LINUX-64-STATIC: leaq 64(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret } @@ -1502,7 +1502,7 @@ %3 = bitcast i32* %2 to i8* ret i8* %3 ; LINUX-64-STATIC: cat08: -; LINUX-64-STATIC: movq lptr, %rax +; LINUX-64-STATIC: movq lptr(%rip), %rax ; LINUX-64-STATIC: leaq 64(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret } @@ -1559,7 +1559,7 @@ %3 = bitcast i32* %2 to i8* ret i8* %3 ; LINUX-64-STATIC: cam02: -; LINUX-64-STATIC: movq ptr, %rax +; LINUX-64-STATIC: movq ptr(%rip), %rax ; LINUX-64-STATIC: leaq 262144(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret } @@ -1594,7 +1594,7 @@ %3 = bitcast i32* %2 to i8* ret i8* %3 ; LINUX-64-STATIC: cam05: -; LINUX-64-STATIC: movq dptr, %rax +; LINUX-64-STATIC: movq dptr(%rip), %rax ; LINUX-64-STATIC: leaq 262144(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret } @@ -1629,7 +1629,7 @@ %3 = bitcast i32* %2 to i8* ret i8* %3 ; LINUX-64-STATIC: cam08: -; LINUX-64-STATIC: movq lptr, %rax +; LINUX-64-STATIC: movq lptr(%rip), %rax ; LINUX-64-STATIC: leaq 262144(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret } Modified: llvm/trunk/test/CodeGen/X86/codemodel.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/codemodel.ll?rev=79553&r1=79552&r2=79553&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/codemodel.ll (original) +++ llvm/trunk/test/CodeGen/X86/codemodel.ll Thu Aug 20 13:23:44 2009 @@ -8,7 +8,7 @@ define i32 @foo() nounwind readonly { entry: ; CHECK-SMALL: foo: -; CHECK-SMALL: movl data, %eax +; CHECK-SMALL: movl data(%rip), %eax ; CHECK-KERNEL: foo: ; CHECK-KERNEL: movl data, %eax %0 = load i32* getelementptr ([0 x i32]* @data, i64 0, i64 0), align 4 ; [#uses=1] @@ -18,7 +18,7 @@ define i32 @foo2() nounwind readonly { entry: ; CHECK-SMALL: foo2: -; CHECK-SMALL: movl data+40, %eax +; CHECK-SMALL: movl data+40(%rip), %eax ; CHECK-KERNEL: foo2: ; CHECK-KERNEL: movl data+40, %eax %0 = load i32* getelementptr ([0 x i32]* @data, i32 0, i64 10), align 4 ; [#uses=1] @@ -28,7 +28,7 @@ define i32 @foo3() nounwind readonly { entry: ; CHECK-SMALL: foo3: -; CHECK-SMALL: movl data-40, %eax +; CHECK-SMALL: movl data-40(%rip), %eax ; CHECK-KERNEL: foo3: ; CHECK-KERNEL: movq $-40, %rax %0 = load i32* getelementptr ([0 x i32]* @data, i32 0, i64 -10), align 4 ; [#uses=1] @@ -50,7 +50,7 @@ define i32 @foo1() nounwind readonly { entry: ; CHECK-SMALL: foo1: -; CHECK-SMALL: movl data+16777212, %eax +; CHECK-SMALL: movl data+16777212(%rip), %eax ; CHECK-KERNEL: foo1: ; CHECK-KERNEL: movl data+16777212, %eax %0 = load i32* getelementptr ([0 x i32]* @data, i32 0, i64 4194303), align 4 ; [#uses=1] @@ -59,7 +59,7 @@ define i32 @foo5() nounwind readonly { entry: ; CHECK-SMALL: foo5: -; CHECK-SMALL: movl data-16777216, %eax +; CHECK-SMALL: movl data-16777216(%rip), %eax ; CHECK-KERNEL: foo5: ; CHECK-KERNEL: movq $-16777216, %rax %0 = load i32* getelementptr ([0 x i32]* @data, i32 0, i64 -4194304), align 4 ; [#uses=1] Modified: llvm/trunk/test/CodeGen/X86/rip-rel-address.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/rip-rel-address.ll?rev=79553&r1=79552&r2=79553&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/rip-rel-address.ll (original) +++ llvm/trunk/test/CodeGen/X86/rip-rel-address.ll Thu Aug 20 13:23:44 2009 @@ -1,11 +1,14 @@ ; RUN: llvm-as < %s | llc -march=x86-64 -relocation-model=pic -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=PIC64 ; RUN: llvm-as < %s | llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=static | FileCheck %s -check-prefix=STATIC64 +; Use %rip-relative addressing even in static mode on x86-64, because +; it has a smaller encoding. + @a = internal global double 3.4 define double @foo() nounwind { %a = load double* @a ret double %a ; PIC64: movsd _a(%rip), %xmm0 -; STATIC64: movsd a, %xmm0 +; STATIC64: movsd a(%rip), %xmm0 } From scallanan at apple.com Thu Aug 20 13:24:28 2009 From: scallanan at apple.com (Sean Callanan) Date: Thu, 20 Aug 2009 18:24:28 -0000 Subject: [llvm-commits] [llvm] r79554 - /llvm/trunk/lib/Target/X86/X86InstrSSE.td Message-ID: <200908201824.n7KIOSI3014405@zion.cs.uiuc.edu> Author: spyffe Date: Thu Aug 20 13:24:27 2009 New Revision: 79554 URL: http://llvm.org/viewvc/llvm-project?rev=79554&view=rev Log: Fixed PCMPESTRM128 to have opcode 0x60 instead of 0x62, as specified by the Intel documentation. Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=79554&r1=79553&r2=79554&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu Aug 20 13:24:27 2009 @@ -3792,11 +3792,11 @@ } let Defs = [XMM0, EFLAGS], Uses = [EAX, EDX] in { -def PCMPESTRM128rr : SS42AI<0x62, MRMSrcReg, (outs), +def PCMPESTRM128rr : SS42AI<0x60, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src3, i8imm:$src5), "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", []>, OpSize; -def PCMPESTRM128rm : SS42AI<0x62, MRMSrcMem, (outs), +def PCMPESTRM128rm : SS42AI<0x60, MRMSrcMem, (outs), (ins VR128:$src1, i128mem:$src3, i8imm:$src5), "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", []>, OpSize; From resistor at mac.com Thu Aug 20 13:26:03 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 20 Aug 2009 18:26:03 -0000 Subject: [llvm-commits] [llvm] r79555 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp Message-ID: <200908201826.n7KIQ36l014613@zion.cs.uiuc.edu> Author: resistor Date: Thu Aug 20 13:26:03 2009 New Revision: 79555 URL: http://llvm.org/viewvc/llvm-project?rev=79555&view=rev Log: Make the StructType->StructLayout table private to TargetData, allowing us to avoid locking on it. Modified: llvm/trunk/include/llvm/Target/TargetData.h llvm/trunk/lib/Target/TargetData.cpp Modified: llvm/trunk/include/llvm/Target/TargetData.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=79555&r1=79554&r2=79555&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetData.h (original) +++ llvm/trunk/include/llvm/Target/TargetData.h Thu Aug 20 13:26:03 2009 @@ -91,6 +91,9 @@ */ static const TargetAlignElem InvalidAlignmentElem; + /// Opaque pointer for the StructType -> StructLayout map + void* LayoutMap; + //! Set/initialize target alignments void setAlignment(AlignTypeEnum align_type, unsigned char abi_align, unsigned char pref_align, uint32_t bit_width); @@ -107,6 +110,9 @@ return (&align != &InvalidAlignmentElem); } + // DO NOT IMPLEMENT + void operator=(const TargetData&); + public: /// Default ctor. /// @@ -118,22 +124,11 @@ } /// Constructs a TargetData from a specification string. See init(). - explicit TargetData(const std::string &TargetDescription) - : ImmutablePass(&ID) { - init(TargetDescription); - } + explicit TargetData(const std::string &TargetDescription); /// Initialize target data from properties stored in the module. explicit TargetData(const Module *M); - - TargetData(const TargetData &TD) : - ImmutablePass(&ID), - LittleEndian(TD.isLittleEndian()), - PointerMemSize(TD.PointerMemSize), - PointerABIAlign(TD.PointerABIAlign), - PointerPrefAlign(TD.PointerPrefAlign), - Alignments(TD.Alignments) - { } + TargetData(const TargetData &TD); ~TargetData(); // Not virtual, do not subclass this class Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=79555&r1=79554&r2=79555&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Thu Aug 20 13:26:03 2009 @@ -24,7 +24,6 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/System/Mutex.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringExtras.h" #include @@ -132,6 +131,8 @@ // TargetData Class Implementation //===----------------------------------------------------------------------===// +typedef DenseMap LayoutInfoTy; + /*! A TargetDescription string consists of a sequence of hyphen-delimited specifiers for target endianness, pointer size and alignments, and various @@ -170,6 +171,7 @@ alignment will be used. */ void TargetData::init(const std::string &TargetDescription) { + LayoutMap = static_cast(new LayoutInfoTy()); std::string temp = TargetDescription; LittleEndian = false; @@ -234,11 +236,28 @@ } } +TargetData::TargetData(const std::string &TargetDescription) + : ImmutablePass(&ID) { + init(TargetDescription); +} + TargetData::TargetData(const Module *M) : ImmutablePass(&ID) { init(M->getDataLayout()); } +TargetData::TargetData(const TargetData &TD) : + ImmutablePass(&ID), + LittleEndian(TD.isLittleEndian()), + PointerMemSize(TD.PointerMemSize), + PointerABIAlign(TD.PointerABIAlign), + PointerPrefAlign(TD.PointerPrefAlign), + Alignments(TD.Alignments) { + LayoutInfoTy *Other = static_cast(TD.LayoutMap); + LayoutMap = static_cast(new LayoutInfoTy(*Other)); +} + + void TargetData::setAlignment(AlignTypeEnum align_type, unsigned char abi_align, unsigned char pref_align, uint32_t bit_width) { @@ -317,61 +336,26 @@ : Alignments[BestMatchIdx].PrefAlign; } -namespace { - -/// LayoutInfo - The lazy cache of structure layout information maintained by -/// TargetData. Note that the struct types must have been free'd before -/// llvm_shutdown is called (and thus this is deallocated) because all the -/// targets with cached elements should have been destroyed. -/// -typedef std::pair LayoutKey; - -struct DenseMapLayoutKeyInfo { - static inline LayoutKey getEmptyKey() { return LayoutKey(0, 0); } - static inline LayoutKey getTombstoneKey() { - return LayoutKey((TargetData*)(intptr_t)-1, 0); - } - static unsigned getHashValue(const LayoutKey &Val) { - return DenseMapInfo::getHashValue(Val.first) ^ - DenseMapInfo::getHashValue(Val.second); - } - static bool isEqual(const LayoutKey &LHS, const LayoutKey &RHS) { - return LHS == RHS; - } - - static bool isPod() { return true; } -}; - -typedef DenseMap LayoutInfoTy; - -} - -static ManagedStatic LayoutInfo; -static ManagedStatic > LayoutLock; - TargetData::~TargetData() { - if (!LayoutInfo.isConstructed()) - return; - - sys::SmartScopedLock Lock(*LayoutLock); + assert(LayoutMap && "LayoutMap not initialized?"); + LayoutInfoTy &TheMap = *static_cast(LayoutMap); + // Remove any layouts for this TD. - LayoutInfoTy &TheMap = *LayoutInfo; for (LayoutInfoTy::iterator I = TheMap.begin(), E = TheMap.end(); I != E; ) { - if (I->first.first == this) { - I->second->~StructLayout(); - free(I->second); - TheMap.erase(I++); - } else { - ++I; - } + I->second->~StructLayout(); + free(I->second); + TheMap.erase(I++); } + + delete static_cast(LayoutMap); + LayoutMap = 0; } const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { - LayoutInfoTy &TheMap = *LayoutInfo; + assert(LayoutMap && "LayoutMap not initialized?"); + LayoutInfoTy &TheMap = *static_cast(LayoutMap); - sys::SmartScopedLock Lock(*LayoutLock); - StructLayout *&SL = TheMap[LayoutKey(this, Ty)]; + StructLayout *&SL = TheMap[Ty]; if (SL) return SL; // Otherwise, create the struct layout. Because it is variable length, we @@ -393,10 +377,9 @@ /// removed, this method must be called whenever a StructType is removed to /// avoid a dangling pointer in this cache. void TargetData::InvalidateStructLayoutInfo(const StructType *Ty) const { - if (!LayoutInfo.isConstructed()) return; // No cache. - - sys::SmartScopedLock Lock(*LayoutLock); - LayoutInfoTy::iterator I = LayoutInfo->find(LayoutKey(this, Ty)); + assert(LayoutMap && "LayoutMap not initialized?"); + LayoutInfoTy *LayoutInfo = static_cast(LayoutMap); + LayoutInfoTy::iterator I = LayoutInfo->find(Ty); if (I == LayoutInfo->end()) return; I->second->~StructLayout(); From dalej at apple.com Thu Aug 20 13:28:41 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 20 Aug 2009 18:28:41 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r79556 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp opts.c tree.c tree.h Message-ID: <200908201828.n7KISfER014970@zion.cs.uiuc.edu> Author: johannes Date: Thu Aug 20 13:28:41 2009 New Revision: 79556 URL: http://llvm.org/viewvc/llvm-project?rev=79556&view=rev Log: Hook up -finline-limit so it controls llvm's inlining. Mapping is not exact, to put it mildly. Should be no functional change unless -finline-limit (or --param max-inline-insns-auto) is used. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/opts.c llvm-gcc-4.2/trunk/gcc/tree.c llvm-gcc-4.2/trunk/gcc/tree.h 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=79556&r1=79555&r2=79556&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Thu Aug 20 13:28:41 2009 @@ -351,6 +351,32 @@ #undef Declare2 } +// GuessAtInliningThreshold - Figure out a reasonable threshold to pass llvm's +// inliner. There are 12 user-settable gcc params that affect inlining. llvm +// (so far) only has one knob; the param that corresponds most closely, and +// which we use, is max-inline-insns-auto (set by -finline-limit, which is +// what most users actually use). This maps only very approximately to what +// llvm's inliner is doing, but it's the best we've got. +static unsigned GuessAtInliningThreshold() { + unsigned threshold = 200; + // Get the default value for gcc's max-inline-insns-auto. This is the value + // after all language and target dependent changes to the global default are + // applied, but before parsing the command line. + unsigned default_miia = default_max_inline_insns_auto; + // See if the actual value is the same as the default. + unsigned miia = MAX_INLINE_INSNS_AUTO; + if (miia == default_miia) { + if (optimize_size || optimize < 3) + // Reduce inline limit. + threshold = 50; + } else { + // We have an overriding user-specified value. Multiply by 20/9, which is + // the Magic Number converting 90 to 200. + threshold = miia * 20 / 9; + } + return threshold; +} + void llvm_initialize_backend(void) { // Initialize the LLVM backend. #define DoInit2(TARG, MOD) LLVMInitialize ## TARG ## MOD() @@ -394,9 +420,6 @@ Args.push_back("--debug-pass=Structure"); if (flag_debug_pass_arguments) Args.push_back("--debug-pass=Arguments"); - if (optimize_size || optimize < 3) - // Reduce inline limit. Default limit is 200. - Args.push_back("--inline-threshold=50"); if (flag_unwind_tables) Args.push_back("--unwind-tables"); @@ -405,6 +428,12 @@ // purposes, and shouldn't really be for general use. std::vector ArgStrings; + if (flag_inline_trees > 1) { + unsigned threshold = GuessAtInliningThreshold(); + std::string Arg("--inline-threshold="+utostr(threshold)); + ArgStrings.push_back(Arg); + } + if (flag_limited_precision > 0) { std::string Arg("--limit-float-precision="+utostr(flag_limited_precision)); ArgStrings.push_back(Arg); Modified: llvm-gcc-4.2/trunk/gcc/opts.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/opts.c?rev=79556&r1=79555&r2=79556&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/opts.c (original) +++ llvm-gcc-4.2/trunk/gcc/opts.c Thu Aug 20 13:28:41 2009 @@ -682,6 +682,12 @@ OPTIMIZATION_OPTIONS (optimize, optimize_size); #endif + /* LLVM LOCAL begin hook up -finline-limit */ + /* Remember the value of MAX_INLINE_INSNS_AUTO after applying target-dependent + changes to the defaults, but before command line options are parsed. */ + default_max_inline_insns_auto = MAX_INLINE_INSNS_AUTO; + /* LLVM LOCAL end */ + /* APPLE LOCAL begin AV 3846092 */ /* We have apple local patch to disable -fstrict-aliasing when -O2 is used. However do not disable it when -ftree-vectorize is used. Clobber its value Modified: llvm-gcc-4.2/trunk/gcc/tree.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.c?rev=79556&r1=79555&r2=79556&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree.c Thu Aug 20 13:28:41 2009 @@ -73,6 +73,13 @@ tree generic_block_literal_struct_type; /* APPLE LOCAL end 6353006 */ +/* LLVM LOCAL begin */ +/* The value of MAX_INLINE_INSNS_AUTO after all target-dependent changes + are applied to the global default (which many targets do), but before + command line flags are handled. */ +unsigned default_max_inline_insns_auto; +/* LLVM LOCAL end */ + /* obstack.[ch] explicitly declined to prototype this. */ extern int _obstack_allocated_p (struct obstack *h, void *obj); Modified: llvm-gcc-4.2/trunk/gcc/tree.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.h?rev=79556&r1=79555&r2=79556&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.h (original) +++ llvm-gcc-4.2/trunk/gcc/tree.h Thu Aug 20 13:28:41 2009 @@ -4892,4 +4892,10 @@ /* APPLE LOCAL end radar 6300081 */ +/* LLVM LOCAL begin */ +/* The value of MAX_INLINE_INSNS_AUTO after all target-dependent changes + are applied to the global default (which many targets do), but before + command line flags are handled. */ +extern unsigned default_max_inline_insns_auto; +/* LLVM LOCAL end */ #endif /* GCC_TREE_H */ From echristo at apple.com Thu Aug 20 13:44:44 2009 From: echristo at apple.com (Eric Christopher) Date: Thu, 20 Aug 2009 11:44:44 -0700 Subject: [llvm-commits] [llvm] r79554 - /llvm/trunk/lib/Target/X86/X86InstrSSE.td In-Reply-To: <200908201824.n7KIOSI3014405@zion.cs.uiuc.edu> References: <200908201824.n7KIOSI3014405@zion.cs.uiuc.edu> Message-ID: <41AB1572-E8E8-47DE-8674-03B482A4B5D8@apple.com> On Aug 20, 2009, at 11:24 AM, Sean Callanan wrote: > Author: spyffe > Date: Thu Aug 20 13:24:27 2009 > New Revision: 79554 > > URL: http://llvm.org/viewvc/llvm-project?rev=79554&view=rev > Log: > Fixed PCMPESTRM128 to have opcode 0x60 instead of 0x62, as specified > by the > Intel documentation. Thanks, cut and paste-o :) -eric From resistor at mac.com Thu Aug 20 14:03:20 2009 From: resistor at mac.com (Owen Anderson) Date: Thu, 20 Aug 2009 19:03:20 -0000 Subject: [llvm-commits] [llvm] r79560 - /llvm/trunk/lib/VMCore/Attributes.cpp Message-ID: <200908201903.n7KJ3KEd019366@zion.cs.uiuc.edu> Author: resistor Date: Thu Aug 20 14:03:20 2009 New Revision: 79560 URL: http://llvm.org/viewvc/llvm-project?rev=79560&view=rev Log: Reduce contention on the Attributes lock by using atomic operations for reference counting rather than locking. Modified: llvm/trunk/lib/VMCore/Attributes.cpp Modified: llvm/trunk/lib/VMCore/Attributes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=79560&r1=79559&r2=79560&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Attributes.cpp (original) +++ llvm/trunk/lib/VMCore/Attributes.cpp Thu Aug 20 14:03:20 2009 @@ -15,6 +15,7 @@ #include "llvm/Type.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/FoldingSet.h" +#include "llvm/System/Atomic.h" #include "llvm/System/Mutex.h" #include "llvm/Support/Streams.h" #include "llvm/Support/ManagedStatic.h" @@ -97,7 +98,7 @@ namespace llvm { class AttributeListImpl : public FoldingSetNode { - unsigned RefCount; + sys::cas_flag RefCount; // AttributesList is uniqued, these should not be publicly available. void operator=(const AttributeListImpl &); // Do not implement @@ -111,8 +112,11 @@ RefCount = 0; } - void AddRef() { ++RefCount; } - void DropRef() { if (--RefCount == 0) delete this; } + void AddRef() { sys::AtomicIncrement(&RefCount); } + void DropRef() { + sys::cas_flag old = sys::AtomicDecrement(&RefCount); + if (old == 0) delete this; + } void Profile(FoldingSetNodeID &ID) const { Profile(ID, Attrs.data(), Attrs.size()); @@ -175,17 +179,14 @@ //===----------------------------------------------------------------------===// AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) { - sys::SmartScopedLock Lock(*ALMutex); if (LI) LI->AddRef(); } AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) { - sys::SmartScopedLock Lock(*ALMutex); if (AttrList) AttrList->AddRef(); } const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) { - sys::SmartScopedLock Lock(*ALMutex); if (AttrList == RHS.AttrList) return *this; if (AttrList) AttrList->DropRef(); AttrList = RHS.AttrList; @@ -194,7 +195,6 @@ } AttrListPtr::~AttrListPtr() { - sys::SmartScopedLock Lock(*ALMutex); if (AttrList) AttrList->DropRef(); } From baldrick at free.fr Thu Aug 20 14:17:52 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Aug 2009 19:17:52 -0000 Subject: [llvm-commits] [gcc-plugin] r79561 - in /gcc-plugin/trunk: Makefile get_arch_dir i386/llvm-i386-target.h i386/llvm-i386.cpp i386/llvm-target.cpp i386/llvm-target.h llvm-target.cpp llvm-target.h Message-ID: <200908201917.n7KJHqxm021270@zion.cs.uiuc.edu> Author: baldrick Date: Thu Aug 20 14:17:52 2009 New Revision: 79561 URL: http://llvm.org/viewvc/llvm-project?rev=79561&view=rev Log: Use some horrible hacks to automagically determine the architecture directory. For example, if the triple is x86_64-unknown-linux-gnu then it works out that the arch directory is i386. This should all be done in a configure script, only I couldn't write one of those to save my life. Also, give the x86 specific files architecture neutral names. Added: gcc-plugin/trunk/get_arch_dir gcc-plugin/trunk/i386/llvm-target.cpp - copied unchanged from r79452, gcc-plugin/trunk/i386/llvm-i386.cpp gcc-plugin/trunk/i386/llvm-target.h - copied unchanged from r79452, gcc-plugin/trunk/i386/llvm-i386-target.h Removed: gcc-plugin/trunk/i386/llvm-i386-target.h gcc-plugin/trunk/i386/llvm-i386.cpp gcc-plugin/trunk/llvm-target.cpp gcc-plugin/trunk/llvm-target.h Modified: gcc-plugin/trunk/Makefile Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=79561&r1=79560&r2=79561&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Thu Aug 20 14:17:52 2009 @@ -2,20 +2,20 @@ GCCOBJECT_DIR=/home/duncan/tmp/gcc.fsf.master-objects #GCCPLUGIN_DIR:=$(shell $(GCC) -print-file-name=plugin) +TARGET_TRIPLE:=$(shell $(GCCOBJECT_DIR)/gcc/xgcc -v 2>&1 | grep "^Target:" | sed -e "s/^Target: *//") +ARCH_DIR:=$(shell TARGET_TRIPLE=$(TARGET_TRIPLE) GCCSOURCE_DIR=$(GCCSOURCE_DIR) $(SHELL) ./get_arch_dir) + C_SOURCE_FILES=llvm-cache.c -CPP_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp llvm-target.cpp llvm-types.cpp bits_and_bobs.cpp +CPP_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp \ + $(ARCH_DIR)/llvm-target.cpp llvm-types.cpp bits_and_bobs.cpp PLUGIN_OBJECT_FILES=$(C_SOURCE_FILES:.c=.o) $(CPP_SOURCE_FILES:.cpp=.o) -#CFLAGS+=-I$(GCCPLUGINS_DIR)/include -fPIC -O2 - -TARGET_TRIPLE:=$(shell $(GCCOBJECT_DIR)/gcc/xgcc -v 2>&1 | grep "^Target:" | sed -e "s/^Target: *//") - CFLAGS+=-Werror -fPIC -g -O2 -CFLAGS+=-DIN_GCC -DTARGET_NAME=\"$(TARGET_TRIPLE)\" +CFLAGS+=-DIN_GCC -DTARGET_NAME=\"$(TARGET_TRIPLE)\" -I$(ARCH_DIR) CFLAGS+=-I${GCCOBJECT_DIR}/gcc -I${GCCOBJECT_DIR}/gcc/include \ -I${GCCSOURCE_DIR}/gcc -I${GCCSOURCE_DIR}/include \ -I${GCCSOURCE_DIR}/libcpp/include -I${GCCSOURCE_DIR}/libdecnumber \ - -I${GCCOBJECT_DIR}/libdecnumber + -I${GCCOBJECT_DIR}/libdecnumber -I. CXXFLAGS+=$(CFLAGS) $(shell llvm-config --cppflags) LDFLAGS+=$(shell llvm-config --ldflags) $(shell llvm-config --libs analysis core target x86) Added: gcc-plugin/trunk/get_arch_dir URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/get_arch_dir?rev=79561&view=auto ============================================================================== --- gcc-plugin/trunk/get_arch_dir (added) +++ gcc-plugin/trunk/get_arch_dir Thu Aug 20 14:17:52 2009 @@ -0,0 +1,3 @@ +export target=$TARGET_TRIPLE +. $GCCSOURCE_DIR/gcc/config.gcc +echo $cpu_type Removed: gcc-plugin/trunk/i386/llvm-i386-target.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/i386/llvm-i386-target.h?rev=79560&view=auto ============================================================================== --- gcc-plugin/trunk/i386/llvm-i386-target.h (original) +++ gcc-plugin/trunk/i386/llvm-i386-target.h (removed) @@ -1,898 +0,0 @@ -/* Some target-specific hooks for gcc->llvm conversion -Copyright (C) 2007 Free Software Foundation, Inc. -Contributed by Anton Korobeynikov (asl at math.spbu.ru) - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -#ifndef LLVM_I386_TARGET_H -#define LLVM_I386_TARGET_H - -/* LLVM specific stuff for supporting calling convention output */ -#define TARGET_ADJUST_LLVM_CC(CC, type) \ - { \ - tree type_attributes = TYPE_ATTRIBUTES (type); \ - if (lookup_attribute ("stdcall", type_attributes)) { \ - CC = CallingConv::X86_StdCall; \ - } else if (lookup_attribute("fastcall", type_attributes)) { \ - CC = CallingConv::X86_FastCall; \ - } \ - } - -#define TARGET_ADJUST_LLVM_RETATTR(Rattributes, type) \ - { \ - tree type_attributes = TYPE_ATTRIBUTES (type); \ - if (!TARGET_64BIT && (TARGET_SSEREGPARM || \ - lookup_attribute("sseregparm", type_attributes)))\ - RAttributes |= Attribute::InReg; \ - } - -/* LLVM specific stuff for converting gcc's `regparm` attribute to LLVM's - `inreg` parameter attribute */ -#define LLVM_TARGET_ENABLE_REGPARM - -extern "C" int ix86_regparm; - -#define LLVM_TARGET_INIT_REGPARM(local_regparm, local_fp_regparm, type) \ - { \ - tree attr; \ - local_regparm = ix86_regparm; \ - local_fp_regparm = TARGET_SSEREGPARM ? 3 : 0; \ - attr = lookup_attribute ("regparm", \ - TYPE_ATTRIBUTES (type)); \ - if (attr) { \ - local_regparm = TREE_INT_CST_LOW (TREE_VALUE \ - (TREE_VALUE (attr))); \ - } \ - attr = lookup_attribute("sseregparm", \ - TYPE_ATTRIBUTES (type)); \ - if (attr) \ - local_fp_regparm = 3; \ - } - -#define LLVM_ADJUST_REGPARM_ATTRIBUTE(PAttribute, Type, Size, \ - local_regparm, \ - local_fp_regparm) \ - { \ - if (!TARGET_64BIT) { \ - if (TREE_CODE(Type) == REAL_TYPE && \ - (TYPE_PRECISION(Type)==32 || \ - TYPE_PRECISION(Type)==64)) { \ - local_fp_regparm -= 1; \ - if (local_fp_regparm >= 0) \ - PAttribute |= Attribute::InReg; \ - else \ - local_fp_regparm = 0; \ - } else if (INTEGRAL_TYPE_P(Type) || \ - POINTER_TYPE_P(Type)) { \ - int words = \ - (Size + BITS_PER_WORD - 1) / BITS_PER_WORD; \ - local_regparm -= words; \ - if (local_regparm>=0) \ - PAttribute |= Attribute::InReg; \ - else \ - local_regparm = 0; \ - } \ - } \ - } - -#define LLVM_SET_RED_ZONE_FLAG(disable_red_zone) \ - if (TARGET_64BIT && TARGET_NO_RED_ZONE) \ - disable_red_zone = 1; - -#ifdef LLVM_ABI_H - -/* On x86-32 objects containing SSE vectors are 16 byte aligned, everything - else 4. On x86-64 vectors are 8-byte aligned, everything else can - be figured out by the back end. */ -extern "C" bool contains_aligned_value_p(tree); -#define LLVM_BYVAL_ALIGNMENT(T) \ - (TARGET_64BIT ? (TREE_CODE(T)==VECTOR_TYPE ? 8 : 0) : \ - TARGET_SSE && contains_aligned_value_p(T) ? 16 : 4) - -extern tree llvm_x86_should_return_selt_struct_as_scalar(tree); - -/* Structs containing a single data field plus zero-length fields are - considered as if they were the type of the data field. On x86-64, - if the element type is an MMX vector, return it as double (which will - get it into XMM0). */ - -#define LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR(X) \ - llvm_x86_should_return_selt_struct_as_scalar((X)) - -extern bool llvm_x86_should_pass_aggregate_in_integer_regs(tree, - unsigned*, bool*); - -/* LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS - Return true if this aggregate - value should be passed in integer registers. This differs from the usual - handling in that x86-64 passes 128-bit structs and unions which only - contain data in the first 64 bits, as 64-bit objects. (These can be - created by abusing __attribute__((aligned)). */ -#define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y, Z) \ - llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y), (Z)) - -extern const Type *llvm_x86_scalar_type_for_struct_return(tree type, - unsigned *Offset); - -/* LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be - returned as a scalar, otherwise return NULL. */ -#define LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(X, Y) \ - llvm_x86_scalar_type_for_struct_return((X), (Y)) - -extern const Type *llvm_x86_aggr_type_for_struct_return(tree type); - -/* LLVM_AGGR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be - returned as an aggregate, otherwise return NULL. */ -#define LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(X) \ - llvm_x86_aggr_type_for_struct_return(X) - -extern void llvm_x86_extract_multiple_return_value(Value *Src, Value *Dest, - bool isVolatile, - LLVMBuilder &B); - -/* LLVM_EXTRACT_MULTIPLE_RETURN_VALUE - Extract multiple return value from - SRC and assign it to DEST. */ -#define LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Src,Dest,V,B) \ - llvm_x86_extract_multiple_return_value((Src),(Dest),(V),(B)) - -extern bool llvm_x86_should_pass_vector_using_byval_attr(tree); - -/* On x86-64, vectors which are not MMX nor SSE should be passed byval. */ -#define LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(X) \ - llvm_x86_should_pass_vector_using_byval_attr((X)) - -extern bool llvm_x86_should_pass_vector_in_integer_regs(tree); - -/* On x86-32, vectors which are not MMX nor SSE should be passed as integers. */ -#define LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(X) \ - llvm_x86_should_pass_vector_in_integer_regs((X)) - -extern tree llvm_x86_should_return_vector_as_scalar(tree, bool); - -/* The MMX vector v1i64 is returned in EAX and EDX on Darwin. Communicate - this by returning i64 here. Likewise, (generic) vectors such as v2i16 - are returned in EAX. - On Darwin x86-64, MMX vectors are returned in XMM0. Communicate this by - returning f64. */ -#define LLVM_SHOULD_RETURN_VECTOR_AS_SCALAR(X,isBuiltin)\ - llvm_x86_should_return_vector_as_scalar((X), (isBuiltin)) - -extern bool llvm_x86_should_return_vector_as_shadow(tree, bool); - -/* MMX vectors v2i32, v4i16, v8i8, v2f32 are returned using sret on Darwin - 32-bit. Vectors bigger than 128 are returned using sret. */ -#define LLVM_SHOULD_RETURN_VECTOR_AS_SHADOW(X,isBuiltin)\ - llvm_x86_should_return_vector_as_shadow((X),(isBuiltin)) - -extern bool -llvm_x86_should_not_return_complex_in_memory(tree type); - -/* LLVM_SHOULD_NOT_RETURN_COMPLEX_IN_MEMORY - A hook to allow - special _Complex handling. Return true if X should be returned using - multiple value return instruction. */ -#define LLVM_SHOULD_NOT_RETURN_COMPLEX_IN_MEMORY(X) \ - llvm_x86_should_not_return_complex_in_memory((X)) - -extern bool -llvm_x86_should_pass_aggregate_as_fca(tree type, const Type *); - -/* LLVM_SHOULD_PASS_AGGREGATE_AS_FCA - Return true if an aggregate of the - specified type should be passed as a first-class aggregate. */ -#ifndef LLVM_SHOULD_PASS_AGGREGATE_AS_FCA -#define LLVM_SHOULD_PASS_AGGREGATE_AS_FCA(X, TY) \ - llvm_x86_should_pass_aggregate_as_fca(X, TY) -#endif - -extern bool llvm_x86_should_pass_aggregate_in_memory(tree, const Type *); - -#define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X, TY) \ - llvm_x86_should_pass_aggregate_in_memory(X, TY) - - -extern bool -llvm_x86_64_should_pass_aggregate_in_mixed_regs(tree, const Type *Ty, - std::vector&); -extern bool -llvm_x86_32_should_pass_aggregate_in_mixed_regs(tree, const Type *Ty, - std::vector&); - -#define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E) \ - (TARGET_64BIT ? \ - llvm_x86_64_should_pass_aggregate_in_mixed_regs((T), (TY), (E)) : \ - llvm_x86_32_should_pass_aggregate_in_mixed_regs((T), (TY), (E))) - -extern -bool llvm_x86_64_aggregate_partially_passed_in_regs(std::vector&, - std::vector&, - bool); - -#define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, ISR, CC) \ - (TARGET_64BIT ? \ - llvm_x86_64_aggregate_partially_passed_in_regs((E), (SE), (ISR)) : \ - false) - -#endif /* LLVM_ABI_H */ - -/* Register class used for passing given 64bit part of the argument. - These represent classes as documented by the PS ABI, with the exception - of SSESF, SSEDF classes, that are basically SSE class, just gcc will - use SF or DFmode move instead of DImode to avoid reformatting penalties. - - Similarly we play games with INTEGERSI_CLASS to use cheaper SImode moves - whenever possible (upper half does contain padding). - */ -enum x86_64_reg_class - { - X86_64_NO_CLASS, - X86_64_INTEGER_CLASS, - X86_64_INTEGERSI_CLASS, - X86_64_SSE_CLASS, - X86_64_SSESF_CLASS, - X86_64_SSEDF_CLASS, - X86_64_SSEUP_CLASS, - X86_64_X87_CLASS, - X86_64_X87UP_CLASS, - X86_64_COMPLEX_X87_CLASS, - X86_64_MEMORY_CLASS - }; - -/* Codes for all the SSE/MMX builtins. */ -enum ix86_builtins -{ - IX86_BUILTIN_ADDPS, - IX86_BUILTIN_ADDSS, - IX86_BUILTIN_DIVPS, - IX86_BUILTIN_DIVSS, - IX86_BUILTIN_MULPS, - IX86_BUILTIN_MULSS, - IX86_BUILTIN_SUBPS, - IX86_BUILTIN_SUBSS, - - IX86_BUILTIN_CMPEQPS, - IX86_BUILTIN_CMPLTPS, - IX86_BUILTIN_CMPLEPS, - IX86_BUILTIN_CMPGTPS, - IX86_BUILTIN_CMPGEPS, - IX86_BUILTIN_CMPNEQPS, - IX86_BUILTIN_CMPNLTPS, - IX86_BUILTIN_CMPNLEPS, - IX86_BUILTIN_CMPNGTPS, - IX86_BUILTIN_CMPNGEPS, - IX86_BUILTIN_CMPORDPS, - IX86_BUILTIN_CMPUNORDPS, - IX86_BUILTIN_CMPNEPS, - IX86_BUILTIN_CMPEQSS, - IX86_BUILTIN_CMPLTSS, - IX86_BUILTIN_CMPLESS, - IX86_BUILTIN_CMPNEQSS, - IX86_BUILTIN_CMPNLTSS, - IX86_BUILTIN_CMPNLESS, - IX86_BUILTIN_CMPNGTSS, - IX86_BUILTIN_CMPNGESS, - IX86_BUILTIN_CMPORDSS, - IX86_BUILTIN_CMPUNORDSS, - IX86_BUILTIN_CMPNESS, - - IX86_BUILTIN_COMIEQSS, - IX86_BUILTIN_COMILTSS, - IX86_BUILTIN_COMILESS, - IX86_BUILTIN_COMIGTSS, - IX86_BUILTIN_COMIGESS, - IX86_BUILTIN_COMINEQSS, - IX86_BUILTIN_UCOMIEQSS, - IX86_BUILTIN_UCOMILTSS, - IX86_BUILTIN_UCOMILESS, - IX86_BUILTIN_UCOMIGTSS, - IX86_BUILTIN_UCOMIGESS, - IX86_BUILTIN_UCOMINEQSS, - - IX86_BUILTIN_CVTPI2PS, - IX86_BUILTIN_CVTPS2PI, - IX86_BUILTIN_CVTSI2SS, - IX86_BUILTIN_CVTSI642SS, - IX86_BUILTIN_CVTSS2SI, - IX86_BUILTIN_CVTSS2SI64, - IX86_BUILTIN_CVTTPS2PI, - IX86_BUILTIN_CVTTSS2SI, - IX86_BUILTIN_CVTTSS2SI64, - - IX86_BUILTIN_MAXPS, - IX86_BUILTIN_MAXSS, - IX86_BUILTIN_MINPS, - IX86_BUILTIN_MINSS, - - IX86_BUILTIN_LOADUPS, - IX86_BUILTIN_STOREUPS, - IX86_BUILTIN_MOVSS, - - IX86_BUILTIN_MOVHLPS, - IX86_BUILTIN_MOVLHPS, - IX86_BUILTIN_LOADHPS, - IX86_BUILTIN_LOADLPS, - IX86_BUILTIN_STOREHPS, - IX86_BUILTIN_STORELPS, - - IX86_BUILTIN_MASKMOVQ, - IX86_BUILTIN_MOVMSKPS, - IX86_BUILTIN_PMOVMSKB, - - IX86_BUILTIN_MOVNTPS, - IX86_BUILTIN_MOVNTQ, - - IX86_BUILTIN_LOADDQU, - IX86_BUILTIN_STOREDQU, - - IX86_BUILTIN_PACKSSWB, - IX86_BUILTIN_PACKSSDW, - IX86_BUILTIN_PACKUSWB, - - IX86_BUILTIN_PADDB, - IX86_BUILTIN_PADDW, - IX86_BUILTIN_PADDD, - IX86_BUILTIN_PADDQ, - IX86_BUILTIN_PADDSB, - IX86_BUILTIN_PADDSW, - IX86_BUILTIN_PADDUSB, - IX86_BUILTIN_PADDUSW, - IX86_BUILTIN_PSUBB, - IX86_BUILTIN_PSUBW, - IX86_BUILTIN_PSUBD, - IX86_BUILTIN_PSUBQ, - IX86_BUILTIN_PSUBSB, - IX86_BUILTIN_PSUBSW, - IX86_BUILTIN_PSUBUSB, - IX86_BUILTIN_PSUBUSW, - - IX86_BUILTIN_PAND, - IX86_BUILTIN_PANDN, - IX86_BUILTIN_POR, - IX86_BUILTIN_PXOR, - - IX86_BUILTIN_PAVGB, - IX86_BUILTIN_PAVGW, - - IX86_BUILTIN_PCMPEQB, - IX86_BUILTIN_PCMPEQW, - IX86_BUILTIN_PCMPEQD, - IX86_BUILTIN_PCMPGTB, - IX86_BUILTIN_PCMPGTW, - IX86_BUILTIN_PCMPGTD, - - IX86_BUILTIN_PMADDWD, - - IX86_BUILTIN_PMAXSW, - IX86_BUILTIN_PMAXUB, - IX86_BUILTIN_PMINSW, - IX86_BUILTIN_PMINUB, - - IX86_BUILTIN_PMULHUW, - IX86_BUILTIN_PMULHW, - IX86_BUILTIN_PMULLW, - - IX86_BUILTIN_PSADBW, - IX86_BUILTIN_PSHUFW, - - IX86_BUILTIN_PSLLW, - IX86_BUILTIN_PSLLD, - IX86_BUILTIN_PSLLQ, - IX86_BUILTIN_PSRAW, - IX86_BUILTIN_PSRAD, - IX86_BUILTIN_PSRLW, - IX86_BUILTIN_PSRLD, - IX86_BUILTIN_PSRLQ, - IX86_BUILTIN_PSLLWI, - IX86_BUILTIN_PSLLDI, - IX86_BUILTIN_PSLLQI, - IX86_BUILTIN_PSRAWI, - IX86_BUILTIN_PSRADI, - IX86_BUILTIN_PSRLWI, - IX86_BUILTIN_PSRLDI, - IX86_BUILTIN_PSRLQI, - - IX86_BUILTIN_PUNPCKHBW, - IX86_BUILTIN_PUNPCKHWD, - IX86_BUILTIN_PUNPCKHDQ, - IX86_BUILTIN_PUNPCKLBW, - IX86_BUILTIN_PUNPCKLWD, - IX86_BUILTIN_PUNPCKLDQ, - - IX86_BUILTIN_SHUFPS, - - IX86_BUILTIN_RCPPS, - IX86_BUILTIN_RCPSS, - IX86_BUILTIN_RSQRTPS, - IX86_BUILTIN_RSQRTSS, - IX86_BUILTIN_SQRTPS, - IX86_BUILTIN_SQRTSS, - - IX86_BUILTIN_UNPCKHPS, - IX86_BUILTIN_UNPCKLPS, - - IX86_BUILTIN_ANDPS, - IX86_BUILTIN_ANDNPS, - IX86_BUILTIN_ORPS, - IX86_BUILTIN_XORPS, - - IX86_BUILTIN_EMMS, - IX86_BUILTIN_LDMXCSR, - IX86_BUILTIN_STMXCSR, - IX86_BUILTIN_SFENCE, - - /* 3DNow! Original */ - IX86_BUILTIN_FEMMS, - IX86_BUILTIN_PAVGUSB, - IX86_BUILTIN_PF2ID, - IX86_BUILTIN_PFACC, - IX86_BUILTIN_PFADD, - IX86_BUILTIN_PFCMPEQ, - IX86_BUILTIN_PFCMPGE, - IX86_BUILTIN_PFCMPGT, - IX86_BUILTIN_PFMAX, - IX86_BUILTIN_PFMIN, - IX86_BUILTIN_PFMUL, - IX86_BUILTIN_PFRCP, - IX86_BUILTIN_PFRCPIT1, - IX86_BUILTIN_PFRCPIT2, - IX86_BUILTIN_PFRSQIT1, - IX86_BUILTIN_PFRSQRT, - IX86_BUILTIN_PFSUB, - IX86_BUILTIN_PFSUBR, - IX86_BUILTIN_PI2FD, - IX86_BUILTIN_PMULHRW, - - /* 3DNow! Athlon Extensions */ - IX86_BUILTIN_PF2IW, - IX86_BUILTIN_PFNACC, - IX86_BUILTIN_PFPNACC, - IX86_BUILTIN_PI2FW, - IX86_BUILTIN_PSWAPDSI, - IX86_BUILTIN_PSWAPDSF, - - /* SSE2 */ - IX86_BUILTIN_ADDPD, - IX86_BUILTIN_ADDSD, - IX86_BUILTIN_DIVPD, - IX86_BUILTIN_DIVSD, - IX86_BUILTIN_MULPD, - IX86_BUILTIN_MULSD, - IX86_BUILTIN_SUBPD, - IX86_BUILTIN_SUBSD, - - IX86_BUILTIN_CMPEQPD, - IX86_BUILTIN_CMPLTPD, - IX86_BUILTIN_CMPLEPD, - IX86_BUILTIN_CMPGTPD, - IX86_BUILTIN_CMPGEPD, - IX86_BUILTIN_CMPNEQPD, - IX86_BUILTIN_CMPNLTPD, - IX86_BUILTIN_CMPNLEPD, - IX86_BUILTIN_CMPNGTPD, - IX86_BUILTIN_CMPNGEPD, - IX86_BUILTIN_CMPORDPD, - IX86_BUILTIN_CMPUNORDPD, - IX86_BUILTIN_CMPNEPD, - IX86_BUILTIN_CMPEQSD, - IX86_BUILTIN_CMPLTSD, - IX86_BUILTIN_CMPLESD, - IX86_BUILTIN_CMPNEQSD, - IX86_BUILTIN_CMPNLTSD, - IX86_BUILTIN_CMPNLESD, - IX86_BUILTIN_CMPORDSD, - IX86_BUILTIN_CMPUNORDSD, - IX86_BUILTIN_CMPNESD, - - IX86_BUILTIN_COMIEQSD, - IX86_BUILTIN_COMILTSD, - IX86_BUILTIN_COMILESD, - IX86_BUILTIN_COMIGTSD, - IX86_BUILTIN_COMIGESD, - IX86_BUILTIN_COMINEQSD, - IX86_BUILTIN_UCOMIEQSD, - IX86_BUILTIN_UCOMILTSD, - IX86_BUILTIN_UCOMILESD, - IX86_BUILTIN_UCOMIGTSD, - IX86_BUILTIN_UCOMIGESD, - IX86_BUILTIN_UCOMINEQSD, - - IX86_BUILTIN_MAXPD, - IX86_BUILTIN_MAXSD, - IX86_BUILTIN_MINPD, - IX86_BUILTIN_MINSD, - - IX86_BUILTIN_ANDPD, - IX86_BUILTIN_ANDNPD, - IX86_BUILTIN_ORPD, - IX86_BUILTIN_XORPD, - - IX86_BUILTIN_SQRTPD, - IX86_BUILTIN_SQRTSD, - - IX86_BUILTIN_UNPCKHPD, - IX86_BUILTIN_UNPCKLPD, - - IX86_BUILTIN_SHUFPD, - - IX86_BUILTIN_LOADUPD, - IX86_BUILTIN_STOREUPD, - IX86_BUILTIN_MOVSD, - - IX86_BUILTIN_LOADHPD, - IX86_BUILTIN_LOADLPD, - - IX86_BUILTIN_CVTDQ2PD, - IX86_BUILTIN_CVTDQ2PS, - - IX86_BUILTIN_CVTPD2DQ, - IX86_BUILTIN_CVTPD2PI, - IX86_BUILTIN_CVTPD2PS, - IX86_BUILTIN_CVTTPD2DQ, - IX86_BUILTIN_CVTTPD2PI, - - IX86_BUILTIN_CVTPI2PD, - IX86_BUILTIN_CVTSI2SD, - IX86_BUILTIN_CVTSI642SD, - - IX86_BUILTIN_CVTSD2SI, - IX86_BUILTIN_CVTSD2SI64, - IX86_BUILTIN_CVTSD2SS, - IX86_BUILTIN_CVTSS2SD, - IX86_BUILTIN_CVTTSD2SI, - IX86_BUILTIN_CVTTSD2SI64, - - IX86_BUILTIN_CVTPS2DQ, - IX86_BUILTIN_CVTPS2PD, - IX86_BUILTIN_CVTTPS2DQ, - - IX86_BUILTIN_MOVNTI, - IX86_BUILTIN_MOVNTPD, - IX86_BUILTIN_MOVNTDQ, - - /* SSE2 MMX */ - IX86_BUILTIN_MASKMOVDQU, - IX86_BUILTIN_MOVMSKPD, - IX86_BUILTIN_PMOVMSKB128, - - /* APPLE LOCAL begin 4099020 */ - IX86_BUILTIN_MOVQ, - IX86_BUILTIN_LOADQ, - IX86_BUILTIN_STOREQ, - /* APPLE LOCAL end 4099020 */ - - IX86_BUILTIN_PACKSSWB128, - IX86_BUILTIN_PACKSSDW128, - IX86_BUILTIN_PACKUSWB128, - - IX86_BUILTIN_PADDB128, - IX86_BUILTIN_PADDW128, - IX86_BUILTIN_PADDD128, - IX86_BUILTIN_PADDQ128, - IX86_BUILTIN_PADDSB128, - IX86_BUILTIN_PADDSW128, - IX86_BUILTIN_PADDUSB128, - IX86_BUILTIN_PADDUSW128, - IX86_BUILTIN_PSUBB128, - IX86_BUILTIN_PSUBW128, - IX86_BUILTIN_PSUBD128, - IX86_BUILTIN_PSUBQ128, - IX86_BUILTIN_PSUBSB128, - IX86_BUILTIN_PSUBSW128, - IX86_BUILTIN_PSUBUSB128, - IX86_BUILTIN_PSUBUSW128, - - IX86_BUILTIN_PAND128, - IX86_BUILTIN_PANDN128, - IX86_BUILTIN_POR128, - IX86_BUILTIN_PXOR128, - - IX86_BUILTIN_PAVGB128, - IX86_BUILTIN_PAVGW128, - - IX86_BUILTIN_PCMPEQB128, - IX86_BUILTIN_PCMPEQW128, - IX86_BUILTIN_PCMPEQD128, - IX86_BUILTIN_PCMPGTB128, - IX86_BUILTIN_PCMPGTW128, - IX86_BUILTIN_PCMPGTD128, - - IX86_BUILTIN_PMADDWD128, - - IX86_BUILTIN_PMAXSW128, - IX86_BUILTIN_PMAXUB128, - IX86_BUILTIN_PMINSW128, - IX86_BUILTIN_PMINUB128, - - IX86_BUILTIN_PMULUDQ, - IX86_BUILTIN_PMULUDQ128, - IX86_BUILTIN_PMULHUW128, - IX86_BUILTIN_PMULHW128, - IX86_BUILTIN_PMULLW128, - - IX86_BUILTIN_PSADBW128, - IX86_BUILTIN_PSHUFHW, - IX86_BUILTIN_PSHUFLW, - IX86_BUILTIN_PSHUFD, - - IX86_BUILTIN_PSLLW128, - IX86_BUILTIN_PSLLD128, - IX86_BUILTIN_PSLLQ128, - IX86_BUILTIN_PSRAW128, - IX86_BUILTIN_PSRAD128, - IX86_BUILTIN_PSRLW128, - 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, - - IX86_BUILTIN_PUNPCKHBW128, - IX86_BUILTIN_PUNPCKHWD128, - IX86_BUILTIN_PUNPCKHDQ128, - IX86_BUILTIN_PUNPCKHQDQ128, - IX86_BUILTIN_PUNPCKLBW128, - IX86_BUILTIN_PUNPCKLWD128, - IX86_BUILTIN_PUNPCKLDQ128, - IX86_BUILTIN_PUNPCKLQDQ128, - - IX86_BUILTIN_CLFLUSH, - IX86_BUILTIN_MFENCE, - IX86_BUILTIN_LFENCE, - - /* Prescott New Instructions. */ - IX86_BUILTIN_ADDSUBPS, - IX86_BUILTIN_HADDPS, - IX86_BUILTIN_HSUBPS, - IX86_BUILTIN_MOVSHDUP, - IX86_BUILTIN_MOVSLDUP, - IX86_BUILTIN_ADDSUBPD, - IX86_BUILTIN_HADDPD, - IX86_BUILTIN_HSUBPD, - IX86_BUILTIN_LDDQU, - - IX86_BUILTIN_MONITOR, - IX86_BUILTIN_MWAIT, - - /* Merom New Instructions. */ - IX86_BUILTIN_PHADDW, - IX86_BUILTIN_PHADDD, - IX86_BUILTIN_PHADDSW, - IX86_BUILTIN_PHSUBW, - IX86_BUILTIN_PHSUBD, - IX86_BUILTIN_PHSUBSW, - IX86_BUILTIN_PMADDUBSW, - IX86_BUILTIN_PMULHRSW, - IX86_BUILTIN_PSHUFB, - IX86_BUILTIN_PSIGNB, - IX86_BUILTIN_PSIGNW, - IX86_BUILTIN_PSIGND, - IX86_BUILTIN_PALIGNR, - IX86_BUILTIN_PABSB, - IX86_BUILTIN_PABSW, - IX86_BUILTIN_PABSD, - - IX86_BUILTIN_PHADDW128, - IX86_BUILTIN_PHADDD128, - IX86_BUILTIN_PHADDSW128, - IX86_BUILTIN_PHSUBW128, - IX86_BUILTIN_PHSUBD128, - IX86_BUILTIN_PHSUBSW128, - IX86_BUILTIN_PMADDUBSW128, - IX86_BUILTIN_PMULHRSW128, - IX86_BUILTIN_PSHUFB128, - IX86_BUILTIN_PSIGNB128, - IX86_BUILTIN_PSIGNW128, - IX86_BUILTIN_PSIGND128, - IX86_BUILTIN_PALIGNR128, - IX86_BUILTIN_PABSB128, - IX86_BUILTIN_PABSW128, - IX86_BUILTIN_PABSD128, - /* APPLE LOCAL begin 5612787 mainline sse4 */ - /* AMDFAM10 - SSE4A New Instructions. */ - IX86_BUILTIN_MOVNTSD, - IX86_BUILTIN_MOVNTSS, - IX86_BUILTIN_EXTRQI, - IX86_BUILTIN_EXTRQ, - IX86_BUILTIN_INSERTQI, - IX86_BUILTIN_INSERTQ, - - /* SSE4.1. */ - IX86_BUILTIN_BLENDPD, - IX86_BUILTIN_BLENDPS, - IX86_BUILTIN_BLENDVPD, - IX86_BUILTIN_BLENDVPS, - IX86_BUILTIN_PBLENDVB128, - IX86_BUILTIN_PBLENDW128, - - IX86_BUILTIN_DPPD, - IX86_BUILTIN_DPPS, - - IX86_BUILTIN_INSERTPS128, - - IX86_BUILTIN_MOVNTDQA, - IX86_BUILTIN_MPSADBW128, - IX86_BUILTIN_PACKUSDW128, - IX86_BUILTIN_PCMPEQQ, - IX86_BUILTIN_PHMINPOSUW128, - - IX86_BUILTIN_PMAXSB128, - IX86_BUILTIN_PMAXSD128, - IX86_BUILTIN_PMAXUD128, - IX86_BUILTIN_PMAXUW128, - - IX86_BUILTIN_PMINSB128, - IX86_BUILTIN_PMINSD128, - IX86_BUILTIN_PMINUD128, - IX86_BUILTIN_PMINUW128, - - IX86_BUILTIN_PMOVSXBW128, - IX86_BUILTIN_PMOVSXBD128, - IX86_BUILTIN_PMOVSXBQ128, - IX86_BUILTIN_PMOVSXWD128, - IX86_BUILTIN_PMOVSXWQ128, - IX86_BUILTIN_PMOVSXDQ128, - - IX86_BUILTIN_PMOVZXBW128, - IX86_BUILTIN_PMOVZXBD128, - IX86_BUILTIN_PMOVZXBQ128, - IX86_BUILTIN_PMOVZXWD128, - IX86_BUILTIN_PMOVZXWQ128, - IX86_BUILTIN_PMOVZXDQ128, - - IX86_BUILTIN_PMULDQ128, - IX86_BUILTIN_PMULLD128, - - IX86_BUILTIN_ROUNDPD, - IX86_BUILTIN_ROUNDPS, - IX86_BUILTIN_ROUNDSD, - IX86_BUILTIN_ROUNDSS, - - IX86_BUILTIN_PTESTZ, - IX86_BUILTIN_PTESTC, - IX86_BUILTIN_PTESTNZC, - /* APPLE LOCAL end 5612787 mainline sse4 */ - /* APPLE LOCAL end mainline */ - IX86_BUILTIN_VEC_INIT_V2SI, - IX86_BUILTIN_VEC_INIT_V4HI, - IX86_BUILTIN_VEC_INIT_V8QI, - IX86_BUILTIN_VEC_EXT_V2DF, - IX86_BUILTIN_VEC_EXT_V2DI, - IX86_BUILTIN_VEC_EXT_V4SF, - IX86_BUILTIN_VEC_EXT_V4SI, - IX86_BUILTIN_VEC_EXT_V8HI, - /* APPLE LOCAL begin 5612787 mainline sse4 */ - /* deletion */ - /* APPLE LOCAL end 5612787 mainline sse4 */ - IX86_BUILTIN_VEC_EXT_V2SI, - IX86_BUILTIN_VEC_EXT_V4HI, - /* APPLE LOCAL begin 5612787 mainline sse4 */ - IX86_BUILTIN_VEC_EXT_V16QI, - IX86_BUILTIN_VEC_SET_V2DI, - IX86_BUILTIN_VEC_SET_V4SF, - IX86_BUILTIN_VEC_SET_V4SI, - /* APPLE LOCAL end 5612787 mainline sse4 */ - IX86_BUILTIN_VEC_SET_V8HI, - IX86_BUILTIN_VEC_SET_V4HI, - /* APPLE LOCAL begin 5612787 mainline sse4 */ - IX86_BUILTIN_VEC_SET_V16QI, - - IX86_BUILTIN_VEC_PACK_SFIX, - - /* SSE4.2. */ - IX86_BUILTIN_CRC32QI, - IX86_BUILTIN_CRC32HI, - IX86_BUILTIN_CRC32SI, - IX86_BUILTIN_CRC32DI, - - IX86_BUILTIN_PCMPESTRI128, - IX86_BUILTIN_PCMPESTRM128, - IX86_BUILTIN_PCMPESTRA128, - IX86_BUILTIN_PCMPESTRC128, - IX86_BUILTIN_PCMPESTRO128, - IX86_BUILTIN_PCMPESTRS128, - IX86_BUILTIN_PCMPESTRZ128, - IX86_BUILTIN_PCMPISTRI128, - IX86_BUILTIN_PCMPISTRM128, - IX86_BUILTIN_PCMPISTRA128, - IX86_BUILTIN_PCMPISTRC128, - IX86_BUILTIN_PCMPISTRO128, - IX86_BUILTIN_PCMPISTRS128, - IX86_BUILTIN_PCMPISTRZ128, - - IX86_BUILTIN_PCMPGTQ, - - /* TFmode support builtins. */ - IX86_BUILTIN_INFQ, - IX86_BUILTIN_FABSQ, - IX86_BUILTIN_COPYSIGNQ, - /* APPLE LOCAL end 5612787 mainline sse4 */ - - IX86_BUILTIN_MAX -}; - -/* LLVM_TARGET_INTRINSIC_PREFIX - Specify what prefix this target uses for its - * intrinsics. - */ -#define LLVM_TARGET_INTRINSIC_PREFIX "x86" - -/* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to - * the llvm::InitializeXXXTarget() function. - */ -#define LLVM_TARGET_NAME X86 - -/* Turn -march=xx into a CPU type. - */ -#define LLVM_SET_SUBTARGET_FEATURES(F) \ - { if (TARGET_MACHO && ! strcmp (ix86_arch_string, "apple")) \ - F.setCPU(TARGET_64BIT ? "core2" : "yonah"); \ - else \ - F.setCPU(ix86_arch_string); \ - if (TARGET_64BIT) F.AddFeature("64bit"); \ - if (TARGET_MMX) F.AddFeature("mmx"); \ - else if (target_flags_explicit & MASK_MMX) F.AddFeature("mmx", false); \ - if (TARGET_SSE) F.AddFeature("sse"); \ - else if (target_flags_explicit & MASK_SSE) F.AddFeature("sse", false); \ - if (TARGET_SSE2) F.AddFeature("sse2"); \ - else if (target_flags_explicit & MASK_SSE2) F.AddFeature("sse2", false); \ - if (TARGET_SSE3) F.AddFeature("sse3"); \ - else if (target_flags_explicit & MASK_SSE3) F.AddFeature("sse3", false); \ - if (TARGET_SSSE3) F.AddFeature("ssse3"); \ - if (TARGET_SSE4_1) F.AddFeature("sse41"); \ - if (TARGET_SSE4_2) F.AddFeature("sse42"); \ - if (TARGET_3DNOW) F.AddFeature("3dnow"); \ - if (TARGET_3DNOW_A) F.AddFeature("3dnowa"); \ - } - -#define LLVM_SET_IMPLICIT_FLOAT(flag_no_implicit_float) \ - if (!TARGET_80387) \ - flag_no_implicit_float = 1; \ - else \ - flag_no_implicit_float = 0; - -/* LLVM ABI definition macros. */ - -/* When -m64 is specified, set the architecture to x86_64-os-blah even if the - * compiler was configured for i[3456]86-os-blah. - */ -#define LLVM_OVERRIDE_TARGET_ARCH() \ - (TARGET_64BIT ? "x86_64" : "i386") - -/* LLVM_TARGET_INTRINSIC_LOWER - To handle builtins, we want to expand the - * invocation into normal LLVM code. If the target can handle the builtin, this - * macro should call the target TreeToLLVM::TargetIntrinsicLower method and - * return true.This macro is invoked from a method in the TreeToLLVM class. - */ -#define LLVM_TARGET_INTRINSIC_LOWER(EXP, BUILTIN_CODE, DESTLOC, RESULT, \ - DESTTY, OPS) \ - TargetIntrinsicLower(EXP, BUILTIN_CODE, DESTLOC, RESULT, DESTTY, OPS); - -/* When extracting a register name for a constraint, use the string extracted - from the magic symbol built for that register, rather than reg_names. - The latter maps both AH and AL to the same thing, which means we can't - distinguish them. */ -#define LLVM_DO_NOT_USE_REG_NAMES - -#endif /* LLVM_I386_TARGET_H */ Removed: gcc-plugin/trunk/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/i386/llvm-i386.cpp?rev=79560&view=auto ============================================================================== --- gcc-plugin/trunk/i386/llvm-i386.cpp (original) +++ gcc-plugin/trunk/i386/llvm-i386.cpp (removed) @@ -1,1515 +0,0 @@ -/* High-level LLVM backend interface -Copyright (C) 2005 Free Software Foundation, Inc. -Contributed by Evan Cheng (evan.cheng at apple.com) - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -//===----------------------------------------------------------------------===// -// This is a C++ source file that implements specific llvm IA-32 ABI. -//===----------------------------------------------------------------------===// - -// LLVM headers -#include "llvm/DerivedTypes.h" -#include "llvm/Instructions.h" -#include "llvm/Intrinsics.h" -#include "llvm/LLVMContext.h" -#include "llvm/Module.h" - -// System headers -#include - -// GCC headers -#undef VISIBILITY_HIDDEN - -extern "C" { -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "target.h" -#include "toplev.h" -#include "tree.h" -} - -// Plugin headers -#include "llvm-abi.h" -#include "llvm-internal.h" -#include "llvm-target.h" - -static LLVMContext &Context = getGlobalContext(); - -/* TargetIntrinsicLower - For builtins that we want to expand to normal LLVM - * code, emit the code now. If we can handle the code, this macro should emit - * the code, return true. - */ -bool TreeToLLVM::TargetIntrinsicLower(tree exp, - unsigned FnCode, - const MemRef *DestLoc, - Value *&Result, - const Type *ResultType, - std::vector &Ops) { - switch (FnCode) { - default: break; - case IX86_BUILTIN_ADDPS: - case IX86_BUILTIN_ADDPD: - case IX86_BUILTIN_PADDB: - case IX86_BUILTIN_PADDW: - case IX86_BUILTIN_PADDD: - case IX86_BUILTIN_PADDQ: - case IX86_BUILTIN_PADDB128: - case IX86_BUILTIN_PADDW128: - case IX86_BUILTIN_PADDD128: - case IX86_BUILTIN_PADDQ128: - Result = Builder.CreateAdd(Ops[0], Ops[1], "tmp"); - return true; - case IX86_BUILTIN_SUBPS: - case IX86_BUILTIN_SUBPD: - case IX86_BUILTIN_PSUBB: - case IX86_BUILTIN_PSUBW: - case IX86_BUILTIN_PSUBD: - case IX86_BUILTIN_PSUBQ: - case IX86_BUILTIN_PSUBB128: - case IX86_BUILTIN_PSUBW128: - case IX86_BUILTIN_PSUBD128: - case IX86_BUILTIN_PSUBQ128: - Result = Builder.CreateSub(Ops[0], Ops[1], "tmp"); - return true; - case IX86_BUILTIN_MULPS: - case IX86_BUILTIN_MULPD: - case IX86_BUILTIN_PMULLW: - case IX86_BUILTIN_PMULLW128: - Result = Builder.CreateMul(Ops[0], Ops[1], "tmp"); - return true; - case IX86_BUILTIN_DIVPS: - case IX86_BUILTIN_DIVPD: - Result = Builder.CreateFDiv(Ops[0], Ops[1], "tmp"); - return true; - case IX86_BUILTIN_PAND: - case IX86_BUILTIN_PAND128: - Result = Builder.CreateAnd(Ops[0], Ops[1], "tmp"); - return true; - case IX86_BUILTIN_PANDN: - case IX86_BUILTIN_PANDN128: - Ops[0] = Builder.CreateNot(Ops[0], "tmp"); - Result = Builder.CreateAnd(Ops[0], Ops[1], "tmp"); - return true; - case IX86_BUILTIN_POR: - case IX86_BUILTIN_POR128: - Result = Builder.CreateOr(Ops[0], Ops[1], "tmp"); - return true; - case IX86_BUILTIN_PXOR: - case IX86_BUILTIN_PXOR128: - Result = Builder.CreateXor(Ops[0], Ops[1], "tmp"); - return true; - case IX86_BUILTIN_ANDPS: - case IX86_BUILTIN_ORPS: - case IX86_BUILTIN_XORPS: - case IX86_BUILTIN_ANDNPS: - case IX86_BUILTIN_ANDPD: - case IX86_BUILTIN_ORPD: - case IX86_BUILTIN_XORPD: - case IX86_BUILTIN_ANDNPD: - if (cast(ResultType)->getNumElements() == 4) // v4f32 - Ops[0] = Builder.CreateBitCast(Ops[0], - VectorType::get(Type::getInt32Ty(Context), 4), - "tmp"); - else // v2f64 - Ops[0] = Builder.CreateBitCast(Ops[0], - VectorType::get(Type::getInt64Ty(Context), 2), - "tmp"); - - Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "tmp"); - switch (FnCode) { - case IX86_BUILTIN_ANDPS: - case IX86_BUILTIN_ANDPD: - Result = Builder.CreateAnd(Ops[0], Ops[1], "tmp"); - break; - case IX86_BUILTIN_ORPS: - case IX86_BUILTIN_ORPD: - Result = Builder.CreateOr (Ops[0], Ops[1], "tmp"); - break; - case IX86_BUILTIN_XORPS: - case IX86_BUILTIN_XORPD: - Result = Builder.CreateXor(Ops[0], Ops[1], "tmp"); - break; - case IX86_BUILTIN_ANDNPS: - case IX86_BUILTIN_ANDNPD: - Ops[0] = Builder.CreateNot(Ops[0], "tmp"); - Result = Builder.CreateAnd(Ops[0], Ops[1], "tmp"); - break; - } - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - case IX86_BUILTIN_SHUFPS: - if (ConstantInt *Elt = dyn_cast(Ops[2])) { - int EV = Elt->getZExtValue(); - Result = BuildVectorShuffle(Ops[0], Ops[1], - ((EV & 0x03) >> 0), ((EV & 0x0c) >> 2), - ((EV & 0x30) >> 4)+4, ((EV & 0xc0) >> 6)+4); - } else { - error_at(EXPR_LOCATION(exp), "mask must be an immediate"); - Result = Ops[0]; - } - return true; - case IX86_BUILTIN_SHUFPD: - if (ConstantInt *Elt = dyn_cast(Ops[2])) { - int EV = Elt->getZExtValue(); - Result = BuildVectorShuffle(Ops[0], Ops[1], - ((EV & 0x01) >> 0), ((EV & 0x02) >> 1)+2); - } else { - error_at(EXPR_LOCATION(exp), "mask must be an immediate"); - Result = Ops[0]; - } - return true; - case IX86_BUILTIN_PSHUFW: - case IX86_BUILTIN_PSHUFD: - if (ConstantInt *Elt = dyn_cast(Ops[1])) { - int EV = Elt->getZExtValue(); - Result = BuildVectorShuffle(Ops[0], Ops[0], - ((EV & 0x03) >> 0), ((EV & 0x0c) >> 2), - ((EV & 0x30) >> 4), ((EV & 0xc0) >> 6)); - } else { - error_at(EXPR_LOCATION(exp), "mask must be an immediate"); - Result = Ops[0]; - } - return true; - case IX86_BUILTIN_PSHUFHW: - if (ConstantInt *Elt = dyn_cast(Ops[1])) { - int EV = Elt->getZExtValue(); - Result = BuildVectorShuffle(Ops[0], Ops[0], - 0, 1, 2, 3, - ((EV & 0x03) >> 0)+4, ((EV & 0x0c) >> 2)+4, - ((EV & 0x30) >> 4)+4, ((EV & 0xc0) >> 6)+4); - return true; - } - return false; - case IX86_BUILTIN_PSHUFLW: - if (ConstantInt *Elt = dyn_cast(Ops[1])) { - int EV = Elt->getZExtValue(); - Result = BuildVectorShuffle(Ops[0], Ops[0], - ((EV & 0x03) >> 0), ((EV & 0x0c) >> 2), - ((EV & 0x30) >> 4), ((EV & 0xc0) >> 6), - 4, 5, 6, 7); - } else { - error_at(EXPR_LOCATION(exp), "mask must be an immediate"); - Result = Ops[0]; - } - - return true; - case IX86_BUILTIN_PUNPCKHBW: - Result = BuildVectorShuffle(Ops[0], Ops[1], 4, 12, 5, 13, - 6, 14, 7, 15); - return true; - case IX86_BUILTIN_PUNPCKHWD: - Result = BuildVectorShuffle(Ops[0], Ops[1], 2, 6, 3, 7); - return true; - case IX86_BUILTIN_PUNPCKHDQ: - Result = BuildVectorShuffle(Ops[0], Ops[1], 1, 3); - return true; - case IX86_BUILTIN_PUNPCKLBW: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 8, 1, 9, - 2, 10, 3, 11); - return true; - case IX86_BUILTIN_PUNPCKLWD: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 4, 1, 5); - return true; - case IX86_BUILTIN_PUNPCKLDQ: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 2); - return true; - case IX86_BUILTIN_PUNPCKHBW128: - Result = BuildVectorShuffle(Ops[0], Ops[1], 8, 24, 9, 25, - 10, 26, 11, 27, - 12, 28, 13, 29, - 14, 30, 15, 31); - return true; - case IX86_BUILTIN_PUNPCKHWD128: - Result = BuildVectorShuffle(Ops[0], Ops[1], 4, 12, 5, 13, 6, 14, 7, 15); - return true; - case IX86_BUILTIN_PUNPCKHDQ128: - Result = BuildVectorShuffle(Ops[0], Ops[1], 2, 6, 3, 7); - return true; - case IX86_BUILTIN_PUNPCKHQDQ128: - Result = BuildVectorShuffle(Ops[0], Ops[1], 1, 3); - return true; - case IX86_BUILTIN_PUNPCKLBW128: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 16, 1, 17, - 2, 18, 3, 19, - 4, 20, 5, 21, - 6, 22, 7, 23); - return true; - case IX86_BUILTIN_PUNPCKLWD128: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 8, 1, 9, 2, 10, 3, 11); - return true; - case IX86_BUILTIN_PUNPCKLDQ128: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 4, 1, 5); - return true; - case IX86_BUILTIN_PUNPCKLQDQ128: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 2); - return true; - case IX86_BUILTIN_UNPCKHPS: - Result = BuildVectorShuffle(Ops[0], Ops[1], 2, 6, 3, 7); - return true; - case IX86_BUILTIN_UNPCKHPD: - Result = BuildVectorShuffle(Ops[0], Ops[1], 1, 3); - return true; - case IX86_BUILTIN_UNPCKLPS: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 4, 1, 5); - return true; - case IX86_BUILTIN_UNPCKLPD: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 2); - return true; - case IX86_BUILTIN_MOVHLPS: - Result = BuildVectorShuffle(Ops[0], Ops[1], 6, 7, 2, 3); - return true; - case IX86_BUILTIN_MOVLHPS: - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 1, 4, 5); - return true; - case IX86_BUILTIN_MOVSS: - Result = BuildVectorShuffle(Ops[0], Ops[1], 4, 1, 2, 3); - return true; - case IX86_BUILTIN_MOVSD: - Result = BuildVectorShuffle(Ops[0], Ops[1], 2, 1); - return true; - case IX86_BUILTIN_MOVQ: { - Value *Zero = ConstantInt::get(Type::getInt32Ty(Context), 0); - Result = BuildVector(Zero, Zero, Zero, Zero, NULL); - Result = BuildVectorShuffle(Result, Ops[0], 4, 5, 2, 3); - return true; - } - case IX86_BUILTIN_LOADQ: { - PointerType *i64Ptr = PointerType::getUnqual(Type::getInt64Ty(Context)); - Ops[0] = Builder.CreateBitCast(Ops[0], i64Ptr, "tmp"); - Ops[0] = Builder.CreateLoad(Ops[0], "tmp"); - Value *Zero = ConstantInt::get(Type::getInt64Ty(Context), 0); - Result = BuildVector(Zero, Zero, NULL); - Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), 0); - Result = Builder.CreateInsertElement(Result, Ops[0], Idx, "tmp"); - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - } - case IX86_BUILTIN_LOADUPS: { - VectorType *v4f32 = VectorType::get(Type::getFloatTy(Context), 4); - PointerType *v4f32Ptr = PointerType::getUnqual(v4f32); - Value *BC = Builder.CreateBitCast(Ops[0], v4f32Ptr, "tmp"); - LoadInst *LI = Builder.CreateLoad(BC, "tmp"); - LI->setAlignment(1); - Result = LI; - return true; - } - case IX86_BUILTIN_LOADUPD: { - VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2); - PointerType *v2f64Ptr = PointerType::getUnqual(v2f64); - Value *BC = Builder.CreateBitCast(Ops[0], v2f64Ptr, "tmp"); - LoadInst *LI = Builder.CreateLoad(BC, "tmp"); - LI->setAlignment(1); - Result = LI; - return true; - } - case IX86_BUILTIN_LOADDQU: { - VectorType *v16i8 = VectorType::get(Type::getInt8Ty(Context), 16); - PointerType *v16i8Ptr = PointerType::getUnqual(v16i8); - Value *BC = Builder.CreateBitCast(Ops[0], v16i8Ptr, "tmp"); - LoadInst *LI = Builder.CreateLoad(BC, "tmp"); - LI->setAlignment(1); - Result = LI; - return true; - } - case IX86_BUILTIN_STOREUPS: { - VectorType *v4f32 = VectorType::get(Type::getFloatTy(Context), 4); - PointerType *v4f32Ptr = PointerType::getUnqual(v4f32); - Value *BC = Builder.CreateBitCast(Ops[0], v4f32Ptr, "tmp"); - StoreInst *SI = Builder.CreateStore(Ops[1], BC); - SI->setAlignment(1); - Result = SI; - return true; - } - case IX86_BUILTIN_STOREUPD: { - VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2); - PointerType *v2f64Ptr = PointerType::getUnqual(v2f64); - Value *BC = Builder.CreateBitCast(Ops[0], v2f64Ptr, "tmp"); - StoreInst *SI = Builder.CreateStore(Ops[1], BC); - SI->setAlignment(1); - Result = SI; - return true; - } - case IX86_BUILTIN_STOREDQU: { - VectorType *v16i8 = VectorType::get(Type::getInt8Ty(Context), 16); - PointerType *v16i8Ptr = PointerType::getUnqual(v16i8); - Value *BC = Builder.CreateBitCast(Ops[0], v16i8Ptr, "tmp"); - StoreInst *SI = Builder.CreateStore(Ops[1], BC); - SI->setAlignment(1); - Result = SI; - return true; - } - case IX86_BUILTIN_LOADHPS: { - PointerType *f64Ptr = PointerType::getUnqual(Type::getDoubleTy(Context)); - Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp"); - Value *Load = Builder.CreateLoad(Ops[1], "tmp"); - Ops[1] = BuildVector(Load, UndefValue::get(Type::getDoubleTy(Context)), NULL); - Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 1, 4, 5); - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - } - case IX86_BUILTIN_LOADLPS: { - PointerType *f64Ptr = PointerType::getUnqual(Type::getDoubleTy(Context)); - Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp"); - Value *Load = Builder.CreateLoad(Ops[1], "tmp"); - Ops[1] = BuildVector(Load, UndefValue::get(Type::getDoubleTy(Context)), NULL); - Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); - Result = BuildVectorShuffle(Ops[0], Ops[1], 4, 5, 2, 3); - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - } - case IX86_BUILTIN_LOADHPD: { - Value *Load = Builder.CreateLoad(Ops[1], "tmp"); - Ops[1] = BuildVector(Load, UndefValue::get(Type::getDoubleTy(Context)), NULL); - Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); - Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 2); - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - } - case IX86_BUILTIN_LOADLPD: { - Value *Load = Builder.CreateLoad(Ops[1], "tmp"); - Ops[1] = BuildVector(Load, UndefValue::get(Type::getDoubleTy(Context)), NULL); - Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); - Result = BuildVectorShuffle(Ops[0], Ops[1], 2, 1); - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - } - case IX86_BUILTIN_STOREHPS: { - VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2); - PointerType *f64Ptr = PointerType::getUnqual(Type::getDoubleTy(Context)); - Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); - Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), 1); - Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp"); - Ops[1] = Builder.CreateExtractElement(Ops[1], Idx, "tmp"); - Result = Builder.CreateStore(Ops[1], Ops[0]); - return true; - } - case IX86_BUILTIN_STORELPS: { - VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2); - PointerType *f64Ptr = PointerType::getUnqual(Type::getDoubleTy(Context)); - Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); - Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), 0); - Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp"); - Ops[1] = Builder.CreateExtractElement(Ops[1], Idx, "tmp"); - Result = Builder.CreateStore(Ops[1], Ops[0]); - return true; - } - case IX86_BUILTIN_MOVSHDUP: - Result = BuildVectorShuffle(Ops[0], Ops[0], 1, 1, 3, 3); - return true; - case IX86_BUILTIN_MOVSLDUP: - Result = BuildVectorShuffle(Ops[0], Ops[0], 0, 0, 2, 2); - return true; - case IX86_BUILTIN_VEC_INIT_V2SI: - Result = BuildVector(Ops[0], Ops[1], NULL); - return true; - case IX86_BUILTIN_VEC_INIT_V4HI: - // Sometimes G++ promotes arguments to int. - for (unsigned i = 0; i != 4; ++i) - Ops[i] = Builder.CreateIntCast(Ops[i], Type::getInt16Ty(Context), false, "tmp"); - Result = BuildVector(Ops[0], Ops[1], Ops[2], Ops[3], NULL); - return true; - case IX86_BUILTIN_VEC_INIT_V8QI: - // Sometimes G++ promotes arguments to int. - for (unsigned i = 0; i != 8; ++i) - Ops[i] = Builder.CreateIntCast(Ops[i], Type::getInt8Ty(Context), false, "tmp"); - Result = BuildVector(Ops[0], Ops[1], Ops[2], Ops[3], - Ops[4], Ops[5], Ops[6], Ops[7], NULL); - return true; - case IX86_BUILTIN_VEC_EXT_V2SI: - case IX86_BUILTIN_VEC_EXT_V4HI: - case IX86_BUILTIN_VEC_EXT_V2DF: - case IX86_BUILTIN_VEC_EXT_V2DI: - case IX86_BUILTIN_VEC_EXT_V4SI: - case IX86_BUILTIN_VEC_EXT_V4SF: - case IX86_BUILTIN_VEC_EXT_V8HI: - case IX86_BUILTIN_VEC_EXT_V16QI: - Result = Builder.CreateExtractElement(Ops[0], Ops[1], "tmp"); - return true; - case IX86_BUILTIN_VEC_SET_V16QI: - // Sometimes G++ promotes arguments to int. - Ops[1] = Builder.CreateIntCast(Ops[1], Type::getInt8Ty(Context), false, "tmp"); - Result = Builder.CreateInsertElement(Ops[0], Ops[1], Ops[2], "tmp"); - return true; - case IX86_BUILTIN_VEC_SET_V4HI: - case IX86_BUILTIN_VEC_SET_V8HI: - // GCC sometimes doesn't produce the right element type. - Ops[1] = Builder.CreateIntCast(Ops[1], Type::getInt16Ty(Context), false, "tmp"); - Result = Builder.CreateInsertElement(Ops[0], Ops[1], Ops[2], "tmp"); - return true; - case IX86_BUILTIN_VEC_SET_V4SI: - Result = Builder.CreateInsertElement(Ops[0], Ops[1], Ops[2], "tmp"); - return true; - case IX86_BUILTIN_VEC_SET_V2DI: - Result = Builder.CreateInsertElement(Ops[0], Ops[1], Ops[2], "tmp"); - return true; - case IX86_BUILTIN_CMPEQPS: - case IX86_BUILTIN_CMPLTPS: - case IX86_BUILTIN_CMPLEPS: - case IX86_BUILTIN_CMPGTPS: - case IX86_BUILTIN_CMPGEPS: - case IX86_BUILTIN_CMPNEQPS: - case IX86_BUILTIN_CMPNLTPS: - case IX86_BUILTIN_CMPNLEPS: - case IX86_BUILTIN_CMPNGTPS: - case IX86_BUILTIN_CMPNGEPS: - case IX86_BUILTIN_CMPORDPS: - case IX86_BUILTIN_CMPUNORDPS: { - Function *cmpps = - Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_cmp_ps); - bool flip = false; - unsigned PredCode; - switch (FnCode) { - default: assert(0 && "Unknown fncode!"); - case IX86_BUILTIN_CMPEQPS: PredCode = 0; break; - case IX86_BUILTIN_CMPLTPS: PredCode = 1; break; - case IX86_BUILTIN_CMPGTPS: PredCode = 1; flip = true; break; - case IX86_BUILTIN_CMPLEPS: PredCode = 2; break; - case IX86_BUILTIN_CMPGEPS: PredCode = 2; flip = true; break; - case IX86_BUILTIN_CMPUNORDPS: PredCode = 3; break; - case IX86_BUILTIN_CMPNEQPS: PredCode = 4; break; - case IX86_BUILTIN_CMPNLTPS: PredCode = 5; break; - case IX86_BUILTIN_CMPNGTPS: PredCode = 5; flip = true; break; - case IX86_BUILTIN_CMPNLEPS: PredCode = 6; break; - case IX86_BUILTIN_CMPNGEPS: PredCode = 6; flip = true; break; - case IX86_BUILTIN_CMPORDPS: PredCode = 7; break; - } - Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode); - Value *Arg0 = Ops[0]; - Value *Arg1 = Ops[1]; - if (flip) std::swap(Arg0, Arg1); - Value *CallOps[3] = { Arg0, Arg1, Pred }; - Result = Builder.CreateCall(cmpps, CallOps, CallOps+3, "tmp"); - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - } - case IX86_BUILTIN_CMPEQSS: - case IX86_BUILTIN_CMPLTSS: - case IX86_BUILTIN_CMPLESS: - case IX86_BUILTIN_CMPNEQSS: - case IX86_BUILTIN_CMPNLTSS: - case IX86_BUILTIN_CMPNLESS: - case IX86_BUILTIN_CMPNGTSS: - case IX86_BUILTIN_CMPNGESS: - case IX86_BUILTIN_CMPORDSS: - case IX86_BUILTIN_CMPUNORDSS: { - Function *cmpss = - Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_cmp_ss); - unsigned PredCode; - switch (FnCode) { - default: assert(0 && "Unknown fncode"); - case IX86_BUILTIN_CMPEQSS: PredCode = 0; break; - case IX86_BUILTIN_CMPLTSS: PredCode = 1; break; - case IX86_BUILTIN_CMPLESS: PredCode = 2; break; - case IX86_BUILTIN_CMPUNORDSS: PredCode = 3; break; - case IX86_BUILTIN_CMPNEQSS: PredCode = 4; break; - case IX86_BUILTIN_CMPNLTSS: PredCode = 5; break; - case IX86_BUILTIN_CMPNLESS: PredCode = 6; break; - case IX86_BUILTIN_CMPORDSS: PredCode = 7; break; - } - Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode); - Value *CallOps[3] = { Ops[0], Ops[1], Pred }; - Result = Builder.CreateCall(cmpss, CallOps, CallOps+3, "tmp"); - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - } - case IX86_BUILTIN_CMPEQPD: - case IX86_BUILTIN_CMPLTPD: - case IX86_BUILTIN_CMPLEPD: - case IX86_BUILTIN_CMPGTPD: - case IX86_BUILTIN_CMPGEPD: - case IX86_BUILTIN_CMPNEQPD: - case IX86_BUILTIN_CMPNLTPD: - case IX86_BUILTIN_CMPNLEPD: - case IX86_BUILTIN_CMPNGTPD: - case IX86_BUILTIN_CMPNGEPD: - case IX86_BUILTIN_CMPORDPD: - case IX86_BUILTIN_CMPUNORDPD: { - Function *cmppd = - Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_cmp_pd); - bool flip = false; - unsigned PredCode; - switch (FnCode) { - default: assert(0 && "Unknown fncode!"); - case IX86_BUILTIN_CMPEQPD: PredCode = 0; break; - case IX86_BUILTIN_CMPLTPD: PredCode = 1; break; - case IX86_BUILTIN_CMPGTPD: PredCode = 1; flip = true; break; - case IX86_BUILTIN_CMPLEPD: PredCode = 2; break; - case IX86_BUILTIN_CMPGEPD: PredCode = 2; flip = true; break; - case IX86_BUILTIN_CMPUNORDPD: PredCode = 3; break; - case IX86_BUILTIN_CMPNEQPD: PredCode = 4; break; - case IX86_BUILTIN_CMPNLTPD: PredCode = 5; break; - case IX86_BUILTIN_CMPNGTPD: PredCode = 5; flip = true; break; - case IX86_BUILTIN_CMPNLEPD: PredCode = 6; break; - case IX86_BUILTIN_CMPNGEPD: PredCode = 6; flip = true; break; - case IX86_BUILTIN_CMPORDPD: PredCode = 7; break; - } - Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode); - Value *Arg0 = Ops[0]; - Value *Arg1 = Ops[1]; - if (flip) std::swap(Arg0, Arg1); - - Value *CallOps[3] = { Arg0, Arg1, Pred }; - Result = Builder.CreateCall(cmppd, CallOps, CallOps+3, "tmp"); - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - } - case IX86_BUILTIN_CMPEQSD: - case IX86_BUILTIN_CMPLTSD: - case IX86_BUILTIN_CMPLESD: - case IX86_BUILTIN_CMPNEQSD: - case IX86_BUILTIN_CMPNLTSD: - case IX86_BUILTIN_CMPNLESD: - case IX86_BUILTIN_CMPORDSD: - case IX86_BUILTIN_CMPUNORDSD: { - Function *cmpsd = - Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_cmp_sd); - unsigned PredCode; - switch (FnCode) { - default: assert(0 && "Unknown fncode"); - case IX86_BUILTIN_CMPEQSD: PredCode = 0; break; - case IX86_BUILTIN_CMPLTSD: PredCode = 1; break; - case IX86_BUILTIN_CMPLESD: PredCode = 2; break; - case IX86_BUILTIN_CMPUNORDSD: PredCode = 3; break; - case IX86_BUILTIN_CMPNEQSD: PredCode = 4; break; - case IX86_BUILTIN_CMPNLTSD: PredCode = 5; break; - case IX86_BUILTIN_CMPNLESD: PredCode = 6; break; - case IX86_BUILTIN_CMPORDSD: PredCode = 7; break; - } - Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode); - Value *CallOps[3] = { Ops[0], Ops[1], Pred }; - Result = Builder.CreateCall(cmpsd, CallOps, CallOps+3, "tmp"); - Result = Builder.CreateBitCast(Result, ResultType, "tmp"); - return true; - } - case IX86_BUILTIN_LDMXCSR: { - Function *ldmxcsr = - Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_ldmxcsr); - Value *Ptr = CreateTemporary(Type::getInt32Ty(Context)); - Builder.CreateStore(Ops[0], Ptr); - Ptr = Builder.CreateBitCast(Ptr, - PointerType::getUnqual(Type::getInt8Ty(Context)), "tmp"); - Result = Builder.CreateCall(ldmxcsr, Ptr); - return true; - } - case IX86_BUILTIN_STMXCSR: { - Function *stmxcsr = - Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_stmxcsr); - Value *Ptr = CreateTemporary(Type::getInt32Ty(Context)); - Value *BPtr = Builder.CreateBitCast(Ptr, - PointerType::getUnqual(Type::getInt8Ty(Context)), "tmp"); - Builder.CreateCall(stmxcsr, BPtr); - - Result = Builder.CreateLoad(Ptr, "tmp"); - return true; - } - } - - return false; -} - -/* These are defined in i386.c */ -#define MAX_CLASSES 4 -extern "C" enum machine_mode type_natural_mode(tree, CUMULATIVE_ARGS *); -extern "C" int examine_argument(enum machine_mode, const_tree, int, int*, int*); -extern "C" int classify_argument(enum machine_mode, const_tree, - enum x86_64_reg_class classes[MAX_CLASSES], int); - -/* Target hook for llvm-abi.h. It returns true if an aggregate of the - specified type should be passed in memory. This is only called for - x86-64. */ -static bool llvm_x86_64_should_pass_aggregate_in_memory(tree TreeType, - enum machine_mode Mode){ - int IntRegs, SSERegs; - /* If examine_argument return 0, then it's passed byval in memory.*/ - int ret = examine_argument(Mode, TreeType, 0, &IntRegs, &SSERegs); - if (ret==0) - return true; - if (ret==1 && IntRegs==0 && SSERegs==0) // zero-sized struct - return true; - return false; -} - -/* Returns true if all elements of the type are integer types. */ -static bool llvm_x86_is_all_integer_types(const Type *Ty) { - for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end(); - I != E; ++I) { - const Type *STy = I->get(); - if (!STy->isIntOrIntVector() && !isa(STy)) - return false; - } - return true; -} - -/* Target hook for llvm-abi.h. It returns true if an aggregate of the - specified type should be passed in a number of registers of mixed types. - It also returns a vector of types that correspond to the registers used - for parameter passing. This is only called for x86-32. */ -bool -llvm_x86_32_should_pass_aggregate_in_mixed_regs(tree TreeType, const Type *Ty, - std::vector &Elts){ - // If this is a small fixed size type, investigate it. - HOST_WIDE_INT SrcSize = int_size_in_bytes(TreeType); - if (SrcSize <= 0 || SrcSize > 16) - return false; - - // X86-32 passes aggregates on the stack. If this is an extremely simple - // aggregate whose elements would be passed the same if passed as scalars, - // pass them that way in order to promote SROA on the caller and callee side. - // Note that we can't support passing all structs this way. For example, - // {i16, i16} should be passed in on 32-bit unit, which is not how "i16, i16" - // would be passed as stand-alone arguments. - const StructType *STy = dyn_cast(Ty); - if (!STy || STy->isPacked()) return false; - - for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { - const Type *EltTy = STy->getElementType(i); - // 32 and 64-bit integers are fine, as are float and double. Long double - // (which can be picked as the type for a union of 16 bytes) is not fine, - // as loads and stores of it get only 10 bytes. - if (EltTy == Type::getInt32Ty(Context) || - EltTy == Type::getInt64Ty(Context) || - EltTy == Type::getFloatTy(Context) || - EltTy == Type::getDoubleTy(Context) || - isa(EltTy)) { - Elts.push_back(EltTy); - continue; - } - - // TODO: Vectors are also ok to pass if they don't require extra alignment. - // TODO: We can also pass structs like {i8, i32}. - - Elts.clear(); - return false; - } - - return true; -} - -/* It returns true if an aggregate of the specified type should be passed as a - first class aggregate. */ -bool llvm_x86_should_pass_aggregate_as_fca(tree type, const Type *Ty) { - if (TREE_CODE(type) != COMPLEX_TYPE) - return false; - const StructType *STy = dyn_cast(Ty); - if (!STy || STy->isPacked()) return false; - - // FIXME: Currently codegen isn't lowering most _Complex types in a way that - // makes it ABI compatible for x86-64. Same for _Complex char and _Complex - // short in 32-bit. - const Type *EltTy = STy->getElementType(0); - return !((TARGET_64BIT && (EltTy->isInteger() || - EltTy == Type::getFloatTy(Context) || - EltTy == Type::getDoubleTy(Context))) || - EltTy == Type::getInt16Ty(Context) || - EltTy == Type::getInt8Ty(Context)); -} - -/* Target hook for llvm-abi.h. It returns true if an aggregate of the - specified type should be passed in memory. */ -bool llvm_x86_should_pass_aggregate_in_memory(tree TreeType, const Type *Ty) { - if (llvm_x86_should_pass_aggregate_as_fca(TreeType, Ty)) - return false; - - enum machine_mode Mode = type_natural_mode(TreeType, NULL); - HOST_WIDE_INT Bytes = - (Mode == BLKmode) ? int_size_in_bytes(TreeType) : (int) GET_MODE_SIZE(Mode); - - // Zero sized array, struct, or class, not passed in memory. - if (Bytes == 0) - return false; - - if (!TARGET_64BIT) { - std::vector Elts; - return !llvm_x86_32_should_pass_aggregate_in_mixed_regs(TreeType, Ty, Elts); - } - return llvm_x86_64_should_pass_aggregate_in_memory(TreeType, Mode); -} - -/* count_num_registers_uses - Return the number of GPRs and XMMs parameter - register used so far. Caller is responsible for initializing outputs. */ -static void count_num_registers_uses(std::vector &ScalarElts, - unsigned &NumGPRs, unsigned &NumXMMs) { - for (unsigned i = 0, e = ScalarElts.size(); i != e; ++i) { - const Type *Ty = ScalarElts[i]; - if (const VectorType *VTy = dyn_cast(Ty)) { - if (!TARGET_MACHO) - continue; - if (VTy->getNumElements() == 1) - // v1i64 is passed in GPRs on Darwin. - ++NumGPRs; - else - // All other vector scalar values are passed in XMM registers. - ++NumXMMs; - } else if (Ty->isInteger() || isa(Ty)) { - ++NumGPRs; - } else if (Ty==Type::getVoidTy(Context)) { - // Padding bytes that are not passed anywhere - ; - } else { - // Floating point scalar argument. - assert(Ty->isFloatingPoint() && Ty->isPrimitiveType() && - "Expecting a floating point primitive type!"); - if (Ty->getTypeID() == Type::FloatTyID - || Ty->getTypeID() == Type::DoubleTyID) - ++NumXMMs; - } - } -} - -/* Target hook for llvm-abi.h. This is called when an aggregate is being passed - in registers. If there are only enough available parameter registers to pass - part of the aggregate, return true. That means the aggregate should instead - be passed in memory. */ -bool -llvm_x86_64_aggregate_partially_passed_in_regs(std::vector &Elts, - std::vector &ScalarElts, - bool isShadowReturn) { - // Counting number of GPRs and XMMs used so far. According to AMD64 ABI - // document: "If there are no registers available for any eightbyte of an - // argument, the whole argument is passed on the stack." X86-64 uses 6 - // integer - // For example, if two GPRs are required but only one is available, then - // both parts will be in memory. - // FIXME: This is a temporary solution. To be removed when llvm has first - // class aggregate values. - unsigned NumGPRs = isShadowReturn ? 1 : 0; - unsigned NumXMMs = 0; - count_num_registers_uses(ScalarElts, NumGPRs, NumXMMs); - - unsigned NumGPRsNeeded = 0; - unsigned NumXMMsNeeded = 0; - count_num_registers_uses(Elts, NumGPRsNeeded, NumXMMsNeeded); - - bool GPRsSatisfied = true; - if (NumGPRsNeeded) { - if (NumGPRs < 6) { - if ((NumGPRs + NumGPRsNeeded) > 6) - // Only partially satisfied. - return true; - } else - GPRsSatisfied = false; - } - - bool XMMsSatisfied = true; - if (NumXMMsNeeded) { - if (NumXMMs < 8) { - if ((NumXMMs + NumXMMsNeeded) > 8) - // Only partially satisfied. - return true; - } else - XMMsSatisfied = false; - } - - return !GPRsSatisfied || !XMMsSatisfied; -} - -/* Target hook for llvm-abi.h. It returns true if an aggregate of the - specified type should be passed in a number of registers of mixed types. - It also returns a vector of types that correspond to the registers used - for parameter passing. This is only called for x86-64. */ -bool -llvm_x86_64_should_pass_aggregate_in_mixed_regs(tree TreeType, const Type *Ty, - std::vector &Elts){ - if (llvm_x86_should_pass_aggregate_as_fca(TreeType, Ty)) - return false; - - enum x86_64_reg_class Class[MAX_CLASSES]; - enum machine_mode Mode = type_natural_mode(TreeType, NULL); - bool totallyEmpty = true; - HOST_WIDE_INT Bytes = - (Mode == BLKmode) ? int_size_in_bytes(TreeType) : (int) GET_MODE_SIZE(Mode); - int NumClasses = classify_argument(Mode, TreeType, Class, 0); - if (!NumClasses) - return false; - - if (NumClasses == 1 && Class[0] == X86_64_INTEGERSI_CLASS) - // This will fit in one i32 register. - return false; - - for (int i = 0; i < NumClasses; ++i) { - switch (Class[i]) { - case X86_64_INTEGER_CLASS: - case X86_64_INTEGERSI_CLASS: - Elts.push_back(Type::getInt64Ty(Context)); - totallyEmpty = false; - Bytes -= 8; - break; - case X86_64_SSE_CLASS: - totallyEmpty = false; - // If it's a SSE class argument, then one of the followings are possible: - // 1. 1 x SSE, size is 8: 1 x Double. - // 2. 1 x SSE, size is 4: 1 x Float. - // 3. 1 x SSE + 1 x SSEUP, size is 16: 1 x <4 x i32>, <4 x f32>, - // <2 x i64>, or <2 x f64>. - // 4. 1 x SSE + 1 x SSESF, size is 12: 1 x Double, 1 x Float. - // 5. 2 x SSE, size is 16: 2 x Double. - if ((NumClasses-i) == 1) { - if (Bytes == 8) { - Elts.push_back(Type::getDoubleTy(Context)); - Bytes -= 8; - } else if (Bytes == 4) { - Elts.push_back (Type::getFloatTy(Context)); - Bytes -= 4; - } else - assert(0 && "Not yet handled!"); - } else if ((NumClasses-i) == 2) { - if (Class[i+1] == X86_64_SSEUP_CLASS) { - const Type *Ty = ConvertType(TreeType); - if (const StructType *STy = dyn_cast(Ty)) - // Look pass the struct wrapper. - if (STy->getNumElements() == 1) - Ty = STy->getElementType(0); - if (const VectorType *VTy = dyn_cast(Ty)) { - if (VTy->getNumElements() == 2) { - if (VTy->getElementType()->isInteger()) { - Elts.push_back(VectorType::get(Type::getInt64Ty(Context), 2)); - } else { - Elts.push_back(VectorType::get(Type::getDoubleTy(Context), 2)); - } - Bytes -= 8; - } else { - assert(VTy->getNumElements() == 4); - if (VTy->getElementType()->isInteger()) { - Elts.push_back(VectorType::get(Type::getInt32Ty(Context), 4)); - } else { - Elts.push_back(VectorType::get(Type::getFloatTy(Context), 4)); - } - Bytes -= 4; - } - } else if (llvm_x86_is_all_integer_types(Ty)) { - Elts.push_back(VectorType::get(Type::getInt32Ty(Context), 4)); - Bytes -= 4; - } else { - Elts.push_back(VectorType::get(Type::getFloatTy(Context), 4)); - Bytes -= 4; - } - } else if (Class[i+1] == X86_64_SSESF_CLASS) { - assert(Bytes == 12 && "Not yet handled!"); - Elts.push_back(Type::getDoubleTy(Context)); - Elts.push_back(Type::getFloatTy(Context)); - Bytes -= 12; - } else if (Class[i+1] == X86_64_SSE_CLASS) { - Elts.push_back(Type::getDoubleTy(Context)); - Elts.push_back(Type::getDoubleTy(Context)); - Bytes -= 16; - } else if (Class[i+1] == X86_64_SSEDF_CLASS && Bytes == 16) { - Elts.push_back(VectorType::get(Type::getFloatTy(Context), 2)); - Elts.push_back(Type::getDoubleTy(Context)); - } else if (Class[i+1] == X86_64_INTEGER_CLASS) { - Elts.push_back(VectorType::get(Type::getFloatTy(Context), 2)); - Elts.push_back(Type::getInt64Ty(Context)); - } else if (Class[i+1] == X86_64_NO_CLASS) { - // padding bytes, don't pass - Elts.push_back(Type::getDoubleTy(Context)); - Elts.push_back(Type::getVoidTy(Context)); - Bytes -= 16; - } else - assert(0 && "Not yet handled!"); - ++i; // Already handled the next one. - } else - assert(0 && "Not yet handled!"); - break; - case X86_64_SSESF_CLASS: - totallyEmpty = false; - Elts.push_back(Typ