From isanbard at gmail.com Mon Jul 20 00:01:43 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Sun, 19 Jul 2009 22:01:43 -0700
Subject: [llvm-commits] [llvm] r76385 - in /llvm/trunk: docs/
include/llvm-c/ include/llvm/ include/llvm/Support/
lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/
lib/CodeGen/ lib/Linker/ lib/Target/
lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/
lib/Target/CellSPU/AsmPrinter/ lib/Target/CppBackend/
lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/
lib/Target/Mips/AsmPrinter/ lib/Target/PowerPC/AsmPrinter/
lib/Target/Sparc/AsmPrinter/ lib/Target/SystemZ/AsmPrinter/
lib/Target/X86/AsmPrinter/ lib/Target/XCore/ lib/Tr...
In-Reply-To: <4A63F2AF.4040106@free.fr>
References: <200907200103.n6K13chA025017@zion.cs.uiuc.edu>
<4A63F2AF.4040106@free.fr>
Message-ID:
On Jul 19, 2009, at 9:29 PM, Duncan Sands wrote:
> Hi Bill,
>
>> Add plumbing for the `linker_private' linkage type. This type is
>> meant for
>> "private" symbols which the assember shouldn't strip, but which the
>> linker may
>> remove after evaluation. This is mostly useful for Objective-C
>> metadata.
>
> is it really necessary to have both "private" and "linker_private"
> linkage? What's the difference between them exactly?
>
My understanding is that "private" allows the assembler to strip the
symbols. But "linker_private" only allows the linker to strip the
symbols (the assembler must assume that they're used). Basically, the
linker uses a bunch of "l_OBJC_*" symbols (as opposed to "L_OBJC_*"
symbols) when performing linking. Yes, it's really the difference
between an 'l' and 'L' prefix on symbols. :-)
-bw
From clattner at apple.com Mon Jul 20 00:19:13 2009
From: clattner at apple.com (Chris Lattner)
Date: Sun, 19 Jul 2009 22:19:13 -0700
Subject: [llvm-commits] [llvm] r76385 - in /llvm/trunk: docs/
include/llvm-c/ include/llvm/
include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/
lib/Bitcode/Writer/ lib/CodeGen/ lib/Linker/ lib/Target/
lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/
lib/Target/CellSPU/AsmPrinter/ lib/Target/CppBackend/
lib/Target/IA64/AsmPrinter/
lib/Target/MSP430/ lib/Target/Mips/AsmPrinter/
lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/AsmPrinter/
lib/Target/SystemZ/AsmPrinter/ lib/Target/X86/AsmPrinter/
lib/Target/XCore/ lib/Tr...
In-Reply-To:
References: <200907200103.n6K13chA025017@zion.cs.uiuc.edu>
<4A63F2AF.4040106@free.fr>
Message-ID: <71E41203-F38F-449A-BF98-EF5C1E486F28@apple.com>
On Jul 19, 2009, at 10:01 PM, Bill Wendling wrote:
> On Jul 19, 2009, at 9:29 PM, Duncan Sands wrote:
>
>> Hi Bill,
>>
>>> Add plumbing for the `linker_private' linkage type. This type is
>>> meant for
>>> "private" symbols which the assember shouldn't strip, but which the
>>> linker may
>>> remove after evaluation. This is mostly useful for Objective-C
>>> metadata.
>>
>> is it really necessary to have both "private" and "linker_private"
>> linkage? What's the difference between them exactly?
>>
> My understanding is that "private" allows the assembler to strip the
> symbols. But "linker_private" only allows the linker to strip the
> symbols (the assembler must assume that they're used). Basically, the
> linker uses a bunch of "l_OBJC_*" symbols (as opposed to "L_OBJC_*"
> symbols) when performing linking. Yes, it's really the difference
> between an 'l' and 'L' prefix on symbols. :-)
Right. Private linkage is discarded by the assembler, so they never
make it into the .o file. linker_private is discarded by the linker,
so it never makes it into the .exe/.dylib. I don't think there is a
corresponding idea on ELF, so on ELF they two linkage types should be
codegen'd the same way.
-Chris
From clattner at apple.com Mon Jul 20 00:34:41 2009
From: clattner at apple.com (Chris Lattner)
Date: Sun, 19 Jul 2009 22:34:41 -0700
Subject: [llvm-commits] [llvm] r76385 - in /llvm/trunk: docs/
include/llvm-c/ include/llvm/ include/llvm/Support/
lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/
lib/CodeGen/ lib/Linker/ lib/Target/
lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/
lib/Target/CellSPU/AsmPrinter/ lib/Target/CppBackend/
lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/
lib/Target/Mips/AsmPrinter/ lib/Target/PowerPC/AsmPrinter/
lib/Target/Sparc/AsmPrinter/ lib/Target/SystemZ/AsmPrinter/
lib/Target/X86/AsmPrinter/ lib/Target/XCore/ lib/Tr...
In-Reply-To: <200907200103.n6K13chA025017@zion.cs.uiuc.edu>
References: <200907200103.n6K13chA025017@zion.cs.uiuc.edu>
Message-ID: <12DC6FD1-6F78-4E5E-B3AC-9E7E4E1A3BE0@apple.com>
On Jul 19, 2009, at 6:03 PM, Bill Wendling wrote:
> Author: void
> Date: Sun Jul 19 20:03:30 2009
> New Revision: 76385
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76385&view=rev
> Log:
> Add plumbing for the `linker_private' linkage type. This type is
> meant for
> "private" symbols which the assember shouldn't strip, but which the
> linker may
> remove after evaluation. This is mostly useful for Objective-C
> metadata.
>
> This is plumbing, so we don't have a use of it yet. More to come, etc.
Thanks for implementing this Bill.
> +++ llvm/trunk/include/llvm-c/Core.h Sun Jul 19 20:03:30 2009
> @@ -141,6 +141,7 @@
> LLVMInternalLinkage, /**< Rename collisions when linking (static
> functions) */
> LLVMPrivateLinkage, /**< Like Internal, but omit from symbol
> table */
> + LLVMLinkerPrivateLinkage, /**< Like Private, but linker removes. */
> LLVMDLLImportLinkage, /**< Function to be imported from DLL */
> LLVMDLLExportLinkage, /**< Function to be accessible from DLL */
> LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
This changes the C ABI, which is not allowed, please add this to the
end of the list. liblto may also need to be updated to handle this.
> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Sun Jul
> 19 20:03:30 2009
> @@ -93,12 +93,15 @@
> void Init(const std::string &GV, Mangler *Mang) {
> // Already initialized.
> if (!Stub.empty()) return;
> - Stub = Mang->makeNameProper(GV+"$stub", true);
> - LazyPtr = Mang->makeNameProper(GV+"$lazy_ptr", true);
> - SLP = Mang->makeNameProper(GV+"$slp", true);
> - SCV = Mang->makeNameProper(GV+"$scv", true);
> + Stub = Mang->makeNameProper(GV + "$stub",
> + Mangler::PrivatePrefixTy);
How about dropping "Ty" from the enum names?
Thanks for doing this Bill!
-Chris
From sabre at nondot.org Mon Jul 20 00:55:22 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 05:55:22 -0000
Subject: [llvm-commits] [llvm] r76396 - /llvm/trunk/docs/LangRef.html
Message-ID: <200907200555.n6K5tMsY001829@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 00:55:19 2009
New Revision: 76396
URL: http://llvm.org/viewvc/llvm-project?rev=76396&view=rev
Log:
document llvm.used and llvm.metadata. Stub out llvm.global_[cd]tors
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=76396&r1=76395&r2=76396&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Mon Jul 20 00:55:19 2009
@@ -91,6 +91,15 @@
Inline Assembler Expressions
+ Intrinsic Global Variables
+
+ - The 'llvm.used' Global Variable
+ - The 'llvm.global_ctors'
+ Global Variable
+ - The 'llvm.global_dtors'
+ Global Variable
+
+
Instruction Reference
- Terminator Instructions
@@ -2150,6 +2159,76 @@
+
+
+
+
+
+
LLVM has a number of "magic" global variables that contain data that affect
+code generation or other IR semantics. These are documented here. All globals
+of this sort should have a section specified as "llvm.metadata". This section
+and all globals that start with "llvm." are reserved for LLVM.
+
+
+
+
+
+
+
The @llvm.used global is an array with i8* element type which has appending linkage. This array contains a list of
+pointers to global variables and functions which may optionally have a pointer
+cast formed of bitcast or getelementptr. For example, a legal use of it is:
+
+
+ @X = global i8 4
+ @Y = global i32 123
+
+ @llvm.used = appending global [2 x i8*] [
+ i8* @X,
+ i8* bitcast (i32* @Y to i8*)
+ ], section "llvm.metadata"
+
+
+
If a global variable appears in the @llvm.used list, then the
+compiler, assembler, and linker are required to treat the symbol as if there is
+a reference to the global that it cannot see. For example, if a variable has
+internal linkage and no references other than that from the @llvm.used
+list, it cannot be deleted. This is commonly used to represent references from
+inline asms and other things the compiler cannot "see", and corresponds to
+"attribute((used))" in GNU C.
+
+
On some targets, the code generator must emit a directive to the assembler or
+object file to prevent the assembler and linker from molesting the symbol.
+
+
+
+
+
+
+
+
+
TODO: Describe this.
+
+
+
+
+
+
+
+
+
TODO: Describe this.
+
+
+
+
From sabre at nondot.org Mon Jul 20 01:05:50 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 06:05:50 -0000
Subject: [llvm-commits] [llvm] r76397 -
/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
Message-ID: <200907200605.n6K65oCs002121@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 01:05:50 2009
New Revision: 76397
URL: http://llvm.org/viewvc/llvm-project?rev=76397&view=rev
Log:
use stripPointerCasts to simplify some code.
Modified:
llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=76397&r1=76396&r2=76397&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Mon Jul 20 01:05:50 2009
@@ -96,12 +96,10 @@
ConstantArray *InitList = dyn_cast(GV->getInitializer());
if (InitList == 0) return;
- for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
- if (ConstantExpr *CE = dyn_cast(InitList->getOperand(i)))
- if (CE->getOpcode() == Instruction::BitCast)
- if (Function *F = dyn_cast(CE->getOperand(0)))
- UsedFunctions.insert(F);
- }
+ for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i)
+ if (Function *F =
+ dyn_cast(InitList->getOperand(i)->stripPointerCasts()))
+ UsedFunctions.insert(F);
}
//===-EH-------------------------------------------------------------------===//
From evan.cheng at apple.com Mon Jul 20 01:10:07 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Jul 2009 06:10:07 -0000
Subject: [llvm-commits] [llvm] r76398 - in /llvm/trunk:
test/CodeGen/Thumb/asmprinter-bug.ll utils/TableGen/AsmWriterEmitter.cpp
Message-ID: <200907200610.n6K6A7A7002243@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Jul 20 01:10:07 2009
New Revision: 76398
URL: http://llvm.org/viewvc/llvm-project?rev=76398&view=rev
Log:
Restore AsmWriterEmitter.cpp back to 74742. The recent changes broke Thumb.
Added:
llvm/trunk/test/CodeGen/Thumb/asmprinter-bug.ll
Modified:
llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
Added: llvm/trunk/test/CodeGen/Thumb/asmprinter-bug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb/asmprinter-bug.ll?rev=76398&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb/asmprinter-bug.ll (added)
+++ llvm/trunk/test/CodeGen/Thumb/asmprinter-bug.ll Mon Jul 20 01:10:07 2009
@@ -0,0 +1,288 @@
+; RUN: llvm-as < %s | llc -mtriple=thumbv6-apple-darwin10 | grep rsbs | grep {#0}
+
+ %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.adpcm_state = type { i16, i8 }
+ at stepsizeTable = internal constant [89 x i32] [i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 16, i32 17, i32 19, i32 21, i32 23, i32 25, i32 28, i32 31, i32 34, i32 37, i32 41, i32 45, i32 50, i32 55, i32 60, i32 66, i32 73, i32 80, i32 88, i32 97, i32 107, i32 118, i32 130, i32 143, i32 157, i32 173, i32 190, i32 209, i32 230, i32 253, i32 279, i32 307, i32 337, i32 371, i32 408, i32 449, i32 494, i32 544, i32 598, i32 658, i32 724, i32 796, i32 876, i32 963, i32 1060, i32 1166, i32 1282, i32 1411, i32 1552, i32 1707, i32 1878, i32 2066, i32 2272, i32 2499, i32 2749, i32 3024, i32 3327, i32 3660, i32 4026, i32 4428, i32 4871, i32 5358, i32 5894, i32 6484, i32 7132, i32 7845, i32 8630, i32 9493, i32 10442, i32 11487, i32 12635, i32 13899, i32 15289, i32 16818, i32 18500, i32 20350, i32 22385, i32 24623, i32 27086, i32 29794, i32 32767] ; <[89 x i32]*> [#uses=4]
+ at indexTable = internal constant [16 x i32] [i32 -1, i32 -1, i32 -1, i32 -1, i32 2, i32 4, i32 6, i32 8, i32 -1, i32 -1, i32 -1, i32 -1, i32 2, i32 4, i32 6, i32 8] ; <[16 x i32]*> [#uses=2]
+ at abuf = common global [500 x i8] zeroinitializer ; <[500 x i8]*> [#uses=1]
+ at .str = private constant [11 x i8] c"input file\00", section "__TEXT,__cstring,cstring_literals", align 1 ; <[11 x i8]*> [#uses=1]
+ at sbuf = common global [1000 x i16] zeroinitializer ; <[1000 x i16]*> [#uses=1]
+ at state = common global %struct.adpcm_state zeroinitializer ; <%struct.adpcm_state*> [#uses=3]
+ at __stderrp = external global %struct.FILE* ; <%struct.FILE**> [#uses=1]
+ at .str1 = private constant [28 x i8] c"Final valprev=%d, index=%d\0A\00", section "__TEXT,__cstring,cstring_literals", align 1 ; <[28 x i8]*> [#uses=1]
+
+define arm_apcscc void @adpcm_coder(i16* nocapture %indata, i8* nocapture %outdata, i32 %len, %struct.adpcm_state* nocapture %state) nounwind {
+entry:
+ %0 = getelementptr %struct.adpcm_state* %state, i32 0, i32 0 ; [#uses=2]
+ %1 = load i16* %0, align 2 ; [#uses=1]
+ %2 = sext i16 %1 to i32 ; [#uses=2]
+ %3 = getelementptr %struct.adpcm_state* %state, i32 0, i32 1 ; [#uses=2]
+ %4 = load i8* %3, align 2 ; [#uses=1]
+ %5 = sext i8 %4 to i32 ; [#uses=3]
+ %6 = getelementptr [89 x i32]* @stepsizeTable, i32 0, i32 %5 ; [#uses=1]
+ %7 = load i32* %6, align 4 ; [#uses=1]
+ %8 = icmp sgt i32 %len, 0 ; [#uses=1]
+ br i1 %8, label %bb, label %bb27
+
+bb: ; preds = %bb25, %entry
+ %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb25 ] ; [#uses=2]
+ %outp.136 = phi i8* [ %outdata, %entry ], [ %outp.0, %bb25 ] ; [#uses=3]
+ %bufferstep.035 = phi i32 [ 1, %entry ], [ %tmp, %bb25 ] ; [#uses=3]
+ %outputbuffer.134 = phi i32 [ undef, %entry ], [ %outputbuffer.0, %bb25 ] ; [#uses=2]
+ %index.033 = phi i32 [ %5, %entry ], [ %index.2, %bb25 ] ; [#uses=1]
+ %valpred.132 = phi i32 [ %2, %entry ], [ %valpred.2, %bb25 ] ; [#uses=2]
+ %step.031 = phi i32 [ %7, %entry ], [ %36, %bb25 ] ; [#uses=5]
+ %inp.038 = getelementptr i16* %indata, i32 %indvar ; [#uses=1]
+ %9 = load i16* %inp.038, align 2 ; [#uses=1]
+ %10 = sext i16 %9 to i32 ; [#uses=1]
+ %11 = sub i32 %10, %valpred.132 ; [#uses=3]
+ %12 = icmp slt i32 %11, 0 ; [#uses=1]
+ %iftmp.1.0 = select i1 %12, i32 8, i32 0 ; [#uses=2]
+ %13 = sub i32 0, %11 ; [#uses=1]
+ %14 = icmp eq i32 %iftmp.1.0, 0 ; [#uses=2]
+ %. = select i1 %14, i32 %11, i32 %13 ; [#uses=2]
+ %15 = ashr i32 %step.031, 3 ; [#uses=1]
+ %16 = icmp slt i32 %., %step.031 ; [#uses=2]
+ %delta.0 = select i1 %16, i32 0, i32 4 ; [#uses=2]
+ %17 = select i1 %16, i32 0, i32 %step.031 ; [#uses=2]
+ %diff.1 = sub i32 %., %17 ; [#uses=2]
+ %18 = ashr i32 %step.031, 1 ; [#uses=2]
+ %19 = icmp slt i32 %diff.1, %18 ; [#uses=2]
+ %20 = or i32 %delta.0, 2 ; [#uses=1]
+ %21 = select i1 %19, i32 %delta.0, i32 %20 ; [#uses=1]
+ %22 = select i1 %19, i32 0, i32 %18 ; [#uses=2]
+ %diff.2 = sub i32 %diff.1, %22 ; [#uses=1]
+ %23 = ashr i32 %step.031, 2 ; [#uses=2]
+ %24 = icmp slt i32 %diff.2, %23 ; [#uses=2]
+ %25 = zext i1 %24 to i32 ; [#uses=1]
+ %26 = select i1 %24, i32 0, i32 %23 ; [#uses=1]
+ %vpdiff.0 = add i32 %17, %15 ; [#uses=1]
+ %vpdiff.1 = add i32 %vpdiff.0, %22 ; [#uses=1]
+ %vpdiff.2 = add i32 %vpdiff.1, %26 ; [#uses=2]
+ %tmp30 = sub i32 0, %vpdiff.2 ; [#uses=1]
+ %valpred.0.p = select i1 %14, i32 %vpdiff.2, i32 %tmp30 ; [#uses=1]
+ %valpred.0 = add i32 %valpred.0.p, %valpred.132 ; [#uses=3]
+ %27 = icmp sgt i32 %valpred.0, 32767 ; [#uses=1]
+ br i1 %27, label %bb18, label %bb16
+
+bb16: ; preds = %bb
+ %28 = icmp slt i32 %valpred.0, -32768 ; [#uses=1]
+ br i1 %28, label %bb17, label %bb18
+
+bb17: ; preds = %bb16
+ br label %bb18
+
+bb18: ; preds = %bb17, %bb16, %bb
+ %valpred.2 = phi i32 [ -32768, %bb17 ], [ 32767, %bb ], [ %valpred.0, %bb16 ] ; [#uses=2]
+ %delta.1 = or i32 %21, %iftmp.1.0 ; [#uses=1]
+ %delta.2 = or i32 %delta.1, %25 ; [#uses=1]
+ %29 = xor i32 %delta.2, 1 ; [#uses=3]
+ %30 = getelementptr [16 x i32]* @indexTable, i32 0, i32 %29 ; [#uses=1]
+ %31 = load i32* %30, align 4 ; [#uses=1]
+ %32 = add i32 %31, %index.033 ; [#uses=2]
+ %33 = icmp slt i32 %32, 0 ; [#uses=1]
+ %index.1 = select i1 %33, i32 0, i32 %32 ; [#uses=2]
+ %34 = icmp sgt i32 %index.1, 88 ; [#uses=1]
+ %index.2 = select i1 %34, i32 88, i32 %index.1 ; [#uses=3]
+ %35 = getelementptr [89 x i32]* @stepsizeTable, i32 0, i32 %index.2 ; [#uses=1]
+ %36 = load i32* %35, align 4 ; [#uses=1]
+ %37 = icmp eq i32 %bufferstep.035, 0 ; [#uses=1]
+ br i1 %37, label %bb24, label %bb23
+
+bb23: ; preds = %bb18
+ %38 = shl i32 %29, 4 ; [#uses=1]
+ %39 = and i32 %38, 240 ; [#uses=1]
+ br label %bb25
+
+bb24: ; preds = %bb18
+ %40 = trunc i32 %29 to i8 ; [#uses=1]
+ %41 = and i8 %40, 15 ; [#uses=1]
+ %42 = trunc i32 %outputbuffer.134 to i8 ; [#uses=1]
+ %43 = or i8 %41, %42 ; [#uses=1]
+ store i8 %43, i8* %outp.136, align 1
+ %44 = getelementptr i8* %outp.136, i32 1 ; [#uses=1]
+ br label %bb25
+
+bb25: ; preds = %bb24, %bb23
+ %outputbuffer.0 = phi i32 [ %39, %bb23 ], [ %outputbuffer.134, %bb24 ] ; [#uses=2]
+ %outp.0 = phi i8* [ %outp.136, %bb23 ], [ %44, %bb24 ] ; [#uses=2]
+ %tmp = xor i32 %bufferstep.035, 1 ; [#uses=1]
+ %indvar.next = add i32 %indvar, 1 ; [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, %len ; [#uses=1]
+ br i1 %exitcond, label %bb26.bb27_crit_edge, label %bb
+
+bb26.bb27_crit_edge: ; preds = %bb25
+ %phitmp44 = icmp eq i32 %bufferstep.035, 1 ; [#uses=1]
+ br label %bb27
+
+bb27: ; preds = %bb26.bb27_crit_edge, %entry
+ %outp.1.lcssa = phi i8* [ %outp.0, %bb26.bb27_crit_edge ], [ %outdata, %entry ] ; [#uses=1]
+ %bufferstep.0.lcssa = phi i1 [ %phitmp44, %bb26.bb27_crit_edge ], [ false, %entry ] ; [#uses=1]
+ %outputbuffer.1.lcssa = phi i32 [ %outputbuffer.0, %bb26.bb27_crit_edge ], [ undef, %entry ] ; [#uses=1]
+ %index.0.lcssa = phi i32 [ %index.2, %bb26.bb27_crit_edge ], [ %5, %entry ] ; [#uses=1]
+ %valpred.1.lcssa = phi i32 [ %valpred.2, %bb26.bb27_crit_edge ], [ %2, %entry ] ; [#uses=1]
+ br i1 %bufferstep.0.lcssa, label %bb28, label %bb29
+
+bb28: ; preds = %bb27
+ %45 = trunc i32 %outputbuffer.1.lcssa to i8 ; [#uses=1]
+ store i8 %45, i8* %outp.1.lcssa, align 1
+ br label %bb29
+
+bb29: ; preds = %bb28, %bb27
+ %46 = trunc i32 %valpred.1.lcssa to i16 ; [#uses=1]
+ store i16 %46, i16* %0, align 2
+ %47 = trunc i32 %index.0.lcssa to i8 ; [#uses=1]
+ store i8 %47, i8* %3, align 2
+ ret void
+}
+
+define arm_apcscc void @adpcm_decoder(i8* nocapture %indata, i16* nocapture %outdata, i32 %len, %struct.adpcm_state* nocapture %state) nounwind {
+entry:
+ %0 = getelementptr %struct.adpcm_state* %state, i32 0, i32 0 ; [#uses=2]
+ %1 = load i16* %0, align 2 ; [#uses=1]
+ %2 = sext i16 %1 to i32 ; [#uses=2]
+ %3 = getelementptr %struct.adpcm_state* %state, i32 0, i32 1 ; [#uses=2]
+ %4 = load i8* %3, align 2 ; [#uses=1]
+ %5 = sext i8 %4 to i32 ; [#uses=3]
+ %6 = getelementptr [89 x i32]* @stepsizeTable, i32 0, i32 %5 ; [#uses=1]
+ %7 = load i32* %6, align 4 ; [#uses=1]
+ %8 = icmp sgt i32 %len, 0 ; [#uses=1]
+ br i1 %8, label %bb, label %bb22
+
+bb: ; preds = %bb20, %entry
+ %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb20 ] ; [#uses=2]
+ %inp.131 = phi i8* [ %indata, %entry ], [ %inp.0, %bb20 ] ; [#uses=3]
+ %bufferstep.028 = phi i32 [ 0, %entry ], [ %tmp, %bb20 ] ; [#uses=2]
+ %inputbuffer.127 = phi i32 [ undef, %entry ], [ %inputbuffer.0, %bb20 ] ; [#uses=2]
+ %index.026 = phi i32 [ %5, %entry ], [ %index.2, %bb20 ] ; [#uses=1]
+ %valpred.125 = phi i32 [ %2, %entry ], [ %valpred.2, %bb20 ] ; [#uses=1]
+ %step.024 = phi i32 [ %7, %entry ], [ %35, %bb20 ] ; [#uses=4]
+ %outp.030 = getelementptr i16* %outdata, i32 %indvar ; [#uses=1]
+ %9 = icmp eq i32 %bufferstep.028, 0 ; [#uses=1]
+ br i1 %9, label %bb2, label %bb3
+
+bb2: ; preds = %bb
+ %10 = load i8* %inp.131, align 1 ; [#uses=1]
+ %11 = sext i8 %10 to i32 ; [#uses=2]
+ %12 = getelementptr i8* %inp.131, i32 1 ; [#uses=1]
+ %13 = ashr i32 %11, 4 ; [#uses=1]
+ br label %bb3
+
+bb3: ; preds = %bb2, %bb
+ %inputbuffer.0 = phi i32 [ %11, %bb2 ], [ %inputbuffer.127, %bb ] ; [#uses=1]
+ %delta.0.in = phi i32 [ %13, %bb2 ], [ %inputbuffer.127, %bb ] ; [#uses=5]
+ %inp.0 = phi i8* [ %12, %bb2 ], [ %inp.131, %bb ] ; [#uses=1]
+ %delta.0 = and i32 %delta.0.in, 15 ; [#uses=1]
+ %tmp = xor i32 %bufferstep.028, 1 ; [#uses=1]
+ %14 = getelementptr [16 x i32]* @indexTable, i32 0, i32 %delta.0 ; [#uses=1]
+ %15 = load i32* %14, align 4 ; [#uses=1]
+ %16 = add i32 %15, %index.026 ; [#uses=2]
+ %17 = icmp slt i32 %16, 0 ; [#uses=1]
+ %index.1 = select i1 %17, i32 0, i32 %16 ; [#uses=2]
+ %18 = icmp sgt i32 %index.1, 88 ; [#uses=1]
+ %index.2 = select i1 %18, i32 88, i32 %index.1 ; [#uses=3]
+ %19 = and i32 %delta.0.in, 8 ; [#uses=1]
+ %20 = ashr i32 %step.024, 3 ; [#uses=1]
+ %21 = and i32 %delta.0.in, 4 ; [#uses=1]
+ %22 = icmp eq i32 %21, 0 ; [#uses=1]
+ %23 = select i1 %22, i32 0, i32 %step.024 ; [#uses=1]
+ %vpdiff.0 = add i32 %23, %20 ; [#uses=2]
+ %24 = and i32 %delta.0.in, 2 ; [#uses=1]
+ %25 = icmp eq i32 %24, 0 ; [#uses=1]
+ br i1 %25, label %bb11, label %bb10
+
+bb10: ; preds = %bb3
+ %26 = ashr i32 %step.024, 1 ; [#uses=1]
+ %27 = add i32 %vpdiff.0, %26 ; [#uses=1]
+ br label %bb11
+
+bb11: ; preds = %bb10, %bb3
+ %vpdiff.1 = phi i32 [ %27, %bb10 ], [ %vpdiff.0, %bb3 ] ; [#uses=2]
+ %28 = and i32 %delta.0.in, 1 ; [#uses=1]
+ %toBool = icmp eq i32 %28, 0 ; [#uses=1]
+ br i1 %toBool, label %bb13, label %bb12
+
+bb12: ; preds = %bb11
+ %29 = ashr i32 %step.024, 2 ; [#uses=1]
+ %30 = add i32 %vpdiff.1, %29 ; [#uses=1]
+ br label %bb13
+
+bb13: ; preds = %bb12, %bb11
+ %vpdiff.2 = phi i32 [ %30, %bb12 ], [ %vpdiff.1, %bb11 ] ; [#uses=2]
+ %31 = icmp eq i32 %19, 0 ; [#uses=1]
+ %tmp23 = sub i32 0, %vpdiff.2 ; [#uses=1]
+ %valpred.0.p = select i1 %31, i32 %vpdiff.2, i32 %tmp23 ; [#uses=1]
+ %valpred.0 = add i32 %valpred.0.p, %valpred.125 ; [#uses=3]
+ %32 = icmp sgt i32 %valpred.0, 32767 ; [#uses=1]
+ br i1 %32, label %bb20, label %bb18
+
+bb18: ; preds = %bb13
+ %33 = icmp slt i32 %valpred.0, -32768 ; [#uses=1]
+ br i1 %33, label %bb19, label %bb20
+
+bb19: ; preds = %bb18
+ br label %bb20
+
+bb20: ; preds = %bb19, %bb18, %bb13
+ %valpred.2 = phi i32 [ -32768, %bb19 ], [ 32767, %bb13 ], [ %valpred.0, %bb18 ] ; [#uses=3]
+ %34 = getelementptr [89 x i32]* @stepsizeTable, i32 0, i32 %index.2 ; [#uses=1]
+ %35 = load i32* %34, align 4 ; [#uses=1]
+ %36 = trunc i32 %valpred.2 to i16 ; [#uses=1]
+ store i16 %36, i16* %outp.030, align 2
+ %indvar.next = add i32 %indvar, 1 ; [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, %len ; [#uses=1]
+ br i1 %exitcond, label %bb22, label %bb
+
+bb22: ; preds = %bb20, %entry
+ %index.0.lcssa = phi i32 [ %5, %entry ], [ %index.2, %bb20 ] ; [#uses=1]
+ %valpred.1.lcssa = phi i32 [ %2, %entry ], [ %valpred.2, %bb20 ] ; [#uses=1]
+ %37 = trunc i32 %valpred.1.lcssa to i16 ; [#uses=1]
+ store i16 %37, i16* %0, align 2
+ %38 = trunc i32 %index.0.lcssa to i8 ; [#uses=1]
+ store i8 %38, i8* %3, align 2
+ ret void
+}
+
+define arm_apcscc i32 @main() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb3, %entry
+ %0 = tail call arm_apcscc i32 (...)* @read(i32 0, i8* getelementptr ([500 x i8]* @abuf, i32 0, i32 0), i32 500) nounwind ; [#uses=4]
+ %1 = icmp slt i32 %0, 0 ; [#uses=1]
+ br i1 %1, label %bb1, label %bb2
+
+bb1: ; preds = %bb
+ tail call arm_apcscc void @perror(i8* getelementptr ([11 x i8]* @.str, i32 0, i32 0)) nounwind
+ ret i32 1
+
+bb2: ; preds = %bb
+ %2 = icmp eq i32 %0, 0 ; [#uses=1]
+ br i1 %2, label %bb4, label %bb3
+
+bb3: ; preds = %bb2
+ %3 = shl i32 %0, 1 ; [#uses=1]
+ tail call arm_apcscc void @adpcm_decoder(i8* getelementptr ([500 x i8]* @abuf, i32 0, i32 0), i16* getelementptr ([1000 x i16]* @sbuf, i32 0, i32 0), i32 %3, %struct.adpcm_state* @state) nounwind
+ %4 = shl i32 %0, 2 ; [#uses=1]
+ %5 = tail call arm_apcscc i32 (...)* @write(i32 1, i16* getelementptr ([1000 x i16]* @sbuf, i32 0, i32 0), i32 %4) nounwind ; [#uses=0]
+ br label %bb
+
+bb4: ; preds = %bb2
+ %6 = load %struct.FILE** @__stderrp, align 4 ; <%struct.FILE*> [#uses=1]
+ %7 = load i16* getelementptr (%struct.adpcm_state* @state, i32 0, i32 0), align 4 ; [#uses=1]
+ %8 = sext i16 %7 to i32 ; [#uses=1]
+ %9 = load i8* getelementptr (%struct.adpcm_state* @state, i32 0, i32 1), align 2 ; [#uses=1]
+ %10 = sext i8 %9 to i32 ; [#uses=1]
+ %11 = tail call arm_apcscc i32 (%struct.FILE*, i8*, ...)* @fprintf(%struct.FILE* %6, i8* getelementptr ([28 x i8]* @.str1, i32 0, i32 0), i32 %8, i32 %10) nounwind ; [#uses=0]
+ ret i32 0
+}
+
+declare arm_apcscc i32 @read(...)
+
+declare arm_apcscc void @perror(i8* nocapture) nounwind
+
+declare arm_apcscc i32 @write(...)
+
+declare arm_apcscc i32 @fprintf(%struct.FILE* nocapture, i8* nocapture, ...) nounwind
Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=76398&r1=76397&r2=76398&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Mon Jul 20 01:10:07 2009
@@ -259,6 +259,8 @@
LastEmitted = VarEnd;
}
}
+
+ AddLiteralString("\\n");
}
/// MatchesAllButOneOp - If this instruction is exactly identical to the
@@ -355,6 +357,7 @@
}
O << "\n";
}
+
O << " break;\n";
}
@@ -382,12 +385,8 @@
Command = " " + Inst->Operands[0].getCode() + "\n";
// If this is the last operand, emit a return.
- if (Inst->Operands.size() == 1) {
- Command += " EmitComments(*MI);\n";
- // Print the final newline
- Command += " O << \"\\n\";\n";
+ if (Inst->Operands.size() == 1)
Command += " return true;\n";
- }
// Check to see if we already have 'Command' in UniqueOperandCommands.
// If not, add it.
@@ -453,12 +452,8 @@
std::string Command = " " + FirstInst->Operands[Op].getCode() + "\n";
// If this is the last operand, emit a return after the code.
- if (FirstInst->Operands.size() == Op+1) {
- Command += " EmitComments(*MI);\n";
- // Print the final newline
- Command += " O << \"\\n\";\n";
+ if (FirstInst->Operands.size() == Op+1)
Command += " return true;\n";
- }
UniqueOperandCommands[CommandIdx] += Command;
InstOpsUsed[CommandIdx]++;
@@ -569,11 +564,10 @@
// For the first operand check, add a default value for instructions with
// just opcode strings to use.
if (isFirst) {
- // Do the post instruction processing and print the final newline
- UniqueOperandCommands.push_back(" EmitComments(*MI);\n O << \"\\n\";\n return true;\n");
+ UniqueOperandCommands.push_back(" return true;\n");
isFirst = false;
}
-
+
std::vector InstIdxs;
std::vector NumInstOpsHandled;
FindUniqueOperandCommands(UniqueOperandCommands, InstIdxs,
@@ -745,9 +739,6 @@
EmitInstructions(Instructions, O);
O << " }\n";
- O << " EmitComments(*MI);\n";
- // Print the final newline
- O << " O << \"\\n\";\n";
O << " return true;\n";
}
From sabre at nondot.org Mon Jul 20 01:14:25 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 06:14:25 -0000
Subject: [llvm-commits] [llvm] r76399 - in /llvm/trunk: docs/LangRef.html
include/llvm/CodeGen/MachineModuleInfo.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/MachineModuleInfo.cpp
lib/Transforms/IPO/Internalize.cpp lib/Transforms/IPO/StripSymbols.cpp
test/CodeGen/X86/compiler_used.ll
Message-ID: <200907200614.n6K6EQRh002372@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 01:14:25 2009
New Revision: 76399
URL: http://llvm.org/viewvc/llvm-project?rev=76399&view=rev
Log:
implement a new magic global "llvm.compiler.used" which is like llvm.used, but
doesn't cause ".no_dead_strip" to be emitted on darwin.
Added:
llvm/trunk/test/CodeGen/X86/compiler_used.ll
Modified:
llvm/trunk/docs/LangRef.html
llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
llvm/trunk/lib/Transforms/IPO/Internalize.cpp
llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=76399&r1=76398&r2=76399&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Mon Jul 20 01:14:25 2009
@@ -94,6 +94,8 @@
- Intrinsic Global Variables
- The 'llvm.used' Global Variable
+ - The 'llvm.compiler.used'
+ Global Variable
- The 'llvm.global_ctors'
Global Variable
- The 'llvm.global_dtors'
@@ -2168,8 +2170,9 @@
LLVM has a number of "magic" global variables that contain data that affect
code generation or other IR semantics. These are documented here. All globals
-of this sort should have a section specified as "llvm.metadata". This section
-and all globals that start with "llvm." are reserved for LLVM.
+of this sort should have a section specified as "llvm.metadata". This
+section and all globals that start with "llvm." are reserved for use
+by LLVM.
@@ -2208,6 +2211,24 @@
+
+
+
+
The @llvm.compiler.used directive is the same as the
+@llvm.used directive, except that it only prevents the compiler from
+touching the symbol. On targets that support it, this allows an intelligent
+linker to optimize references to the symbol without being impeded as it would be
+by @llvm.used.
+
+
This is a rare construct that should only be used in rare circumstances, and
+should not be exposed to source languages.
+
+
+
+
+
Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=76399&r1=76398&r2=76399&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Mon Jul 20 01:14:25 2009
@@ -112,8 +112,9 @@
// common EH frames.
std::vector
Personalities;
- // UsedFunctions - the functions in the llvm.used list in a more easily
- // searchable format.
+ /// UsedFunctions - The functions in the @llvm.used list in a more easily
+ /// searchable format. This does not include the functions in
+ /// llvm.compiler.used.
SmallPtrSet UsedFunctions;
/// UsedDbgLabels - labels are used by debug info entries.
@@ -240,9 +241,11 @@
return Personalities;
}
- // UsedFunctions - Return set of the functions in the llvm.used list.
- const SmallPtrSet& getUsedFunctions() const {
- return UsedFunctions;
+ /// isUsedFunction - Return true if the functions in the llvm.used list. This
+ /// does not return true for things in llvm.compiler.used unless they are also
+ /// in llvm.used.
+ bool isUsedFunction(const Function *F) {
+ return UsedFunctions.count(F);
}
/// addCatchTypeInfo - Provide the catch typeinfo for a landing pad.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=76399&r1=76398&r2=76399&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Jul 20 01:14:25 2009
@@ -466,13 +466,13 @@
/// special global used by LLVM. If so, emit it and return true, otherwise
/// do nothing and return false.
bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
- if (GV->getName() == "llvm.used") {
+ if (GV->isName("llvm.used")) {
if (TAI->getUsedDirective() != 0) // No need to emit this at all.
EmitLLVMUsedList(GV->getInitializer());
return true;
}
- // Ignore debug and non-emitted data.
+ // Ignore debug and non-emitted data. This handles llvm.compiler.used.
if (GV->getSection() == "llvm.metadata" ||
GV->hasAvailableExternallyLinkage())
return true;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=76399&r1=76398&r2=76399&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Jul 20 01:14:25 2009
@@ -229,7 +229,7 @@
// retains the function in this case, and there is code around that depends
// on unused functions (calling undefined externals) being dead-stripped to
// link correctly. Yes, there really is.
- if (MMI->getUsedFunctions().count(EHFrameInfo.function))
+ if (MMI->isUsedFunction(EHFrameInfo.function))
if (const char *UsedDirective = TAI->getUsedDirective())
O << UsedDirective << EHFrameInfo.FnName << "\n\n";
}
Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=76399&r1=76398&r2=76399&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Mon Jul 20 01:14:25 2009
@@ -88,7 +88,8 @@
/// AnalyzeModule - Scan the module for global debug information.
///
void MachineModuleInfo::AnalyzeModule(Module &M) {
- // Insert functions in the llvm.used array into UsedFunctions.
+ // Insert functions in the llvm.used array (but not llvm.compiler.used) into
+ // UsedFunctions.
GlobalVariable *GV = M.getGlobalVariable("llvm.used");
if (!GV || !GV->hasInitializer()) return;
Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=76399&r1=76398&r2=76399&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Mon Jul 20 01:14:25 2009
@@ -138,7 +138,9 @@
// Never internalize the llvm.used symbol. It is used to implement
// attribute((used)).
+ // FIXME: Shouldn't this just filter on llvm.metadata section??
ExternalNames.insert("llvm.used");
+ ExternalNames.insert("llvm.compiler.used");
// Never internalize anchors used by the machine module info, else the info
// won't find them. (see MachineModuleInfo.)
Modified: llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp?rev=76399&r1=76398&r2=76399&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Mon Jul 20 01:14:25 2009
@@ -157,32 +157,26 @@
}
/// Find values that are marked as llvm.used.
-void findUsedValues(Module &M,
- SmallPtrSet& llvmUsedValues) {
- if (GlobalVariable *LLVMUsed = M.getGlobalVariable("llvm.used")) {
- llvmUsedValues.insert(LLVMUsed);
- // Collect values that are preserved as per explicit request.
- // llvm.used is used to list these values.
- if (ConstantArray *Inits =
- dyn_cast(LLVMUsed->getInitializer())) {
- for (unsigned i = 0, e = Inits->getNumOperands(); i != e; ++i) {
- if (GlobalValue *GV = dyn_cast(Inits->getOperand(i)))
- llvmUsedValues.insert(GV);
- else if (ConstantExpr *CE =
- dyn_cast(Inits->getOperand(i)))
- if (CE->getOpcode() == Instruction::BitCast)
- if (GlobalValue *GV = dyn_cast(CE->getOperand(0)))
- llvmUsedValues.insert(GV);
- }
- }
- }
+static void findUsedValues(GlobalVariable *LLVMUsed,
+ SmallPtrSet &UsedValues) {
+ if (LLVMUsed == 0) return;
+ UsedValues.insert(LLVMUsed);
+
+ ConstantArray *Inits = dyn_cast(LLVMUsed->getInitializer());
+ if (Inits == 0) return;
+
+ for (unsigned i = 0, e = Inits->getNumOperands(); i != e; ++i)
+ if (GlobalValue *GV =
+ dyn_cast(Inits->getOperand(i)->stripPointerCasts()))
+ UsedValues.insert(GV);
}
/// StripSymbolNames - Strip symbol names.
bool StripSymbolNames(Module &M, bool PreserveDbgInfo) {
SmallPtrSet llvmUsedValues;
- findUsedValues(M, llvmUsedValues);
+ findUsedValues(M.getGlobalVariable("llvm.used"), llvmUsedValues);
+ findUsedValues(M.getGlobalVariable("llvm.compiler.used"), llvmUsedValues);
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I) {
@@ -210,7 +204,8 @@
bool StripDebugInfo(Module &M) {
SmallPtrSet llvmUsedValues;
- findUsedValues(M, llvmUsedValues);
+ findUsedValues(M.getGlobalVariable("llvm.used"), llvmUsedValues);
+ findUsedValues(M.getGlobalVariable("llvm.compiler.used"), llvmUsedValues);
SmallVector CUs;
SmallVector GVs;
Added: llvm/trunk/test/CodeGen/X86/compiler_used.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/compiler_used.ll?rev=76399&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/compiler_used.ll (added)
+++ llvm/trunk/test/CodeGen/X86/compiler_used.ll Mon Jul 20 01:14:25 2009
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin9 | grep no_dead_strip | count 1
+; We should have a .no_dead_strip directive for Z but not for X/Y.
+
+ at X = internal global i8 4
+ at Y = internal global i32 123
+ at Z = internal global i8 4
+
+ at llvm.used = appending global [1 x i8*] [ i8* @Z ], section "llvm.metadata"
+ at llvm.compiler_used = appending global [2 x i8*] [ i8* @X, i8* bitcast (i32* @Y to i8*)], section "llvm.metadata"
From baldrick at free.fr Mon Jul 20 01:29:33 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 06:29:33 -0000
Subject: [llvm-commits] [gcc-plugin] r76400 -
/gcc-plugin/trunk/gcc-patches/extern-c.diff
Message-ID: <200907200629.n6K6TXLY002889@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 01:29:33 2009
New Revision: 76400
URL: http://llvm.org/viewvc/llvm-project?rev=76400&view=rev
Log:
Yet more 'extern "C"' wrappers.
Modified:
gcc-plugin/trunk/gcc-patches/extern-c.diff
Modified: gcc-plugin/trunk/gcc-patches/extern-c.diff
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gcc-patches/extern-c.diff?rev=76400&r1=76399&r2=76400&view=diff
==============================================================================
--- gcc-plugin/trunk/gcc-patches/extern-c.diff (original)
+++ gcc-plugin/trunk/gcc-patches/extern-c.diff Mon Jul 20 01:29:33 2009
@@ -1,7 +1,7 @@
Index: gcc.fsf.master/gcc/flags.h
===================================================================
---- gcc.fsf.master.orig/gcc/flags.h 2009-07-16 06:29:31.411594330 +0200
-+++ gcc.fsf.master/gcc/flags.h 2009-07-16 14:18:26.386942015 +0200
+--- gcc.fsf.master.orig/gcc/flags.h 2009-07-20 07:06:07.888082273 +0200
++++ gcc.fsf.master/gcc/flags.h 2009-07-20 07:06:41.568127963 +0200
@@ -26,6 +26,10 @@
#include "options.h"
#include "real.h"
@@ -13,7 +13,7 @@
enum debug_info_type
{
NO_DEBUG, /* Write no debug info. */
-@@ -398,4 +402,8 @@
+@@ -401,4 +405,8 @@
/* Whether to emit an overflow warning whose code is C. */
#define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c))
@@ -24,8 +24,8 @@
#endif /* ! GCC_FLAGS_H */
Index: gcc.fsf.master/gcc/opth-gen.awk
===================================================================
---- gcc.fsf.master.orig/gcc/opth-gen.awk 2009-07-16 06:29:31.375638464 +0200
-+++ gcc.fsf.master/gcc/opth-gen.awk 2009-07-16 14:18:26.411868822 +0200
+--- gcc.fsf.master.orig/gcc/opth-gen.awk 2009-07-20 07:03:59.825100430 +0200
++++ gcc.fsf.master/gcc/opth-gen.awk 2009-07-20 07:06:41.572076368 +0200
@@ -66,6 +66,10 @@
print "#ifndef OPTIONS_H"
print "#define OPTIONS_H"
@@ -49,8 +49,8 @@
}
Index: gcc.fsf.master/gcc/tree.h
===================================================================
---- gcc.fsf.master.orig/gcc/tree.h 2009-07-16 06:41:02.916597755 +0200
-+++ gcc.fsf.master/gcc/tree.h 2009-07-16 14:18:26.454840309 +0200
+--- gcc.fsf.master.orig/gcc/tree.h 2009-07-20 07:06:07.960172997 +0200
++++ gcc.fsf.master/gcc/tree.h 2009-07-20 07:06:41.576076736 +0200
@@ -31,6 +31,10 @@
#include "alias.h"
#include "options.h"
@@ -62,7 +62,7 @@
/* Codes of tree nodes */
#define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM,
-@@ -5293,4 +5297,8 @@
+@@ -5344,4 +5348,8 @@
for ((arg) = first_const_call_expr_arg ((call), &(iter)); (arg); \
(arg) = next_const_call_expr_arg (&(iter)))
@@ -73,8 +73,8 @@
#endif /* GCC_TREE_H */
Index: gcc.fsf.master/gcc/tree-flow.h
===================================================================
---- gcc.fsf.master.orig/gcc/tree-flow.h 2009-07-16 06:41:02.956597999 +0200
-+++ gcc.fsf.master/gcc/tree-flow.h 2009-07-16 14:18:26.470942184 +0200
+--- gcc.fsf.master.orig/gcc/tree-flow.h 2009-07-20 07:04:00.009074849 +0200
++++ gcc.fsf.master/gcc/tree-flow.h 2009-07-20 07:06:41.576076736 +0200
@@ -32,6 +32,10 @@
#include "ipa-reference.h"
#include "tree-ssa-alias.h"
@@ -97,8 +97,8 @@
#endif /* _TREE_FLOW_H */
Index: gcc.fsf.master/gcc/gimple.h
===================================================================
---- gcc.fsf.master.orig/gcc/gimple.h 2009-07-16 06:29:31.471600868 +0200
-+++ gcc.fsf.master/gcc/gimple.h 2009-07-16 14:18:26.490842575 +0200
+--- gcc.fsf.master.orig/gcc/gimple.h 2009-07-20 07:06:08.300077288 +0200
++++ gcc.fsf.master/gcc/gimple.h 2009-07-20 07:06:41.580076966 +0200
@@ -30,6 +30,10 @@
#include "basic-block.h"
#include "tree-ssa-operands.h"
@@ -110,7 +110,7 @@
DEF_VEC_P(gimple);
DEF_VEC_ALLOC_P(gimple,heap);
DEF_VEC_ALLOC_P(gimple,gc);
-@@ -4486,4 +4490,8 @@
+@@ -4485,4 +4489,8 @@
extern void dump_gimple_statistics (void);
@@ -121,8 +121,8 @@
#endif /* GCC_GIMPLE_H */
Index: gcc.fsf.master/gcc/configure
===================================================================
---- gcc.fsf.master.orig/gcc/configure 2009-07-16 06:41:02.920597417 +0200
-+++ gcc.fsf.master/gcc/configure 2009-07-16 14:18:26.538840612 +0200
+--- gcc.fsf.master.orig/gcc/configure 2009-07-20 07:04:00.253070167 +0200
++++ gcc.fsf.master/gcc/configure 2009-07-20 07:06:41.592072275 +0200
@@ -13982,6 +13982,10 @@
cat > plugin-version.h < plugin-version.h <
Author: evancheng
Date: Mon Jul 20 01:59:32 2009
New Revision: 76401
URL: http://llvm.org/viewvc/llvm-project?rev=76401&view=rev
Log:
Fix PR4567. Thumb1 target was using the wrong instruction to handle sp = sub fp, #c.
Modified:
llvm/trunk/lib/Target/ARM/README-Thumb.txt
llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp
Modified: llvm/trunk/lib/Target/ARM/README-Thumb.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/README-Thumb.txt?rev=76401&r1=76400&r2=76401&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/README-Thumb.txt (original)
+++ llvm/trunk/lib/Target/ARM/README-Thumb.txt Mon Jul 20 01:59:32 2009
@@ -244,3 +244,7 @@
Make use of hi register variants of cmp: tCMPhir / tCMPZhir.
//===---------------------------------------------------------------------===//
+
+Thumb1 immediate field sometimes keep pre-scaled values. See
+Thumb1RegisterInfo::eliminateFrameIndex. This is inconsistent from ARM and
+Thumb2.
Modified: llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp?rev=76401&r1=76400&r2=76401&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp Mon Jul 20 01:59:32 2009
@@ -231,8 +231,16 @@
if (DestReg != BaseReg)
DstNotEqBase = true;
NumBits = 8;
- Opc = isSub ? ARM::tSUBi8 : ARM::tADDi8;
- NeedPred = NeedCC = true;
+ if (DestReg == ARM::SP) {
+ Opc = isSub ? ARM::tSUBspi : ARM::tADDspi;
+ assert(isMul4 && "Thumb sp inc / dec size must be multiple of 4!");
+ NumBits = 7;
+ Scale = 4;
+ } else {
+ Opc = isSub ? ARM::tSUBi8 : ARM::tADDi8;
+ NumBits = 8;
+ NeedPred = NeedCC = true;
+ }
isTwoAddr = true;
}
@@ -447,7 +455,7 @@
removeOperands(MI, i);
MachineInstrBuilder MIB(&MI);
AddDefaultPred(AddDefaultT1CC(MIB).addReg(FrameReg)
- .addImm(Offset/Scale));
+ .addImm(Offset / Scale));
} else {
MI.getOperand(i).ChangeToRegister(FrameReg, false);
MI.getOperand(i+1).ChangeToImmediate(Offset / Scale);
From daniel at zuster.org Mon Jul 20 02:01:01 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 20 Jul 2009 07:01:01 -0000
Subject: [llvm-commits] [llvm] r76402 -
/llvm/trunk/tools/bugpoint/bugpoint.cpp
Message-ID: <200907200701.n6K711bo003903@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Jul 20 02:01:01 2009
New Revision: 76402
URL: http://llvm.org/viewvc/llvm-project?rev=76402&view=rev
Log:
Add -std-{compile,link}-opts to bugpoint.
- Sheesh.
Modified:
llvm/trunk/tools/bugpoint/bugpoint.cpp
Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=76402&r1=76401&r2=76402&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/bugpoint.cpp (original)
+++ llvm/trunk/tools/bugpoint/bugpoint.cpp Mon Jul 20 02:01:01 2009
@@ -22,6 +22,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/StandardPasses.h"
#include "llvm/System/Process.h"
#include "llvm/System/Signals.h"
#include "llvm/LinkAllVMCore.h"
@@ -57,6 +58,14 @@
static cl::list
PassList(cl::desc("Passes available:"), cl::ZeroOrMore);
+static cl::opt
+StandardCompileOpts("std-compile-opts",
+ cl::desc("Include the standard compile time optimizations"));
+
+static cl::opt
+StandardLinkOpts("std-link-opts",
+ cl::desc("Include the standard link time optimizations"));
+
/// BugpointIsInterrupted - Set to true when the user presses ctrl-c.
bool llvm::BugpointIsInterrupted = false;
@@ -64,6 +73,20 @@
BugpointIsInterrupted = true;
}
+// Hack to capture a pass list.
+namespace {
+ class AddToDriver : public PassManager {
+ BugDriver &D;
+ public:
+ AddToDriver(BugDriver &_D) : D(_D) {}
+
+ virtual void add(Pass *P) {
+ const PassInfo *PI = P->getPassInfo();
+ D.addPasses(&PI, &PI + 1);
+ }
+ };
+}
+
int main(int argc, char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram X(argc, argv);
@@ -77,6 +100,23 @@
LLVMContext& Context = getGlobalContext();
BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit, Context);
if (D.addSources(InputFilenames)) return 1;
+
+ AddToDriver PM(D);
+ if (StandardCompileOpts) {
+ createStandardModulePasses(&PM, 3,
+ /*OptimizeSize=*/ false,
+ /*UnitAtATime=*/ true,
+ /*UnrollLoops=*/ true,
+ /*SimplifyLibCalls=*/ true,
+ /*HaveExceptions=*/ true,
+ createFunctionInliningPass());
+ }
+
+ if (StandardLinkOpts)
+ createStandardLTOPasses(&PM, /*Internalize=*/false,
+ /*RunInliner=*/true,
+ /*VerifyEach=*/false);
+
D.addPasses(PassList.begin(), PassList.end());
// Bugpoint has the ability of generating a plethora of core files, so to
From baldrick at free.fr Mon Jul 20 03:06:09 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:06:09 -0000
Subject: [llvm-commits] [gcc-plugin] r76403 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907200806.n6K86Cjk013857@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:05:30 2009
New Revision: 76403
URL: http://llvm.org/viewvc/llvm-project?rev=76403&view=rev
Log:
Copied from llvm-gcc revision 75868.
Added:
gcc-plugin/trunk/llvm-backend.cpp
- copied unchanged from r75868, llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
From baldrick at free.fr Mon Jul 20 03:08:20 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:08:20 -0000
Subject: [llvm-commits] [gcc-plugin] r76404 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907200808.n6K88L8b013966@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:08:17 2009
New Revision: 76404
URL: http://llvm.org/viewvc/llvm-project?rev=76404&view=rev
Log:
Remove irrelevant comment.
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=76404&r1=76403&r2=76404&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:08:17 2009
@@ -1,4 +1,3 @@
-/* LLVM LOCAL begin (ENTIRE FILE!) */
/* High-level LLVM backend interface
Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Chris Lattner (sabre at nondot.org)
@@ -1775,4 +1774,3 @@
const char* Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl));
return (*Name==1) ? Name+1 : Name;
}
-/* LLVM LOCAL end (ENTIRE FILE!) */
From baldrick at free.fr Mon Jul 20 03:14:24 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:14:24 -0000
Subject: [llvm-commits] [gcc-plugin] r76405 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907200814.n6K8ER4x014151@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:14:09 2009
New Revision: 76405
URL: http://llvm.org/viewvc/llvm-project?rev=76405&view=rev
Log:
Normalize header inclusions. If anyone is wondering
why they go in this order, the reason is that gcc
poisons a bunch of routines (such as malloc), so if
gcc headers are included too early then the compiler
errors out on various llvm and system headers.
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=76405&r1=76404&r2=76405&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:14:09 2009
@@ -19,9 +19,7 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include "llvm-internal.h"
-#include "llvm-debug.h"
-#include "llvm-file-ostream.h"
+// LLVM headers
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/LLVMContext.h"
@@ -52,17 +50,24 @@
#include "llvm/Support/FormattedStream.h"
#include "llvm/System/Program.h"
+// System headers
#include
+
+// GCC headers
#undef VISIBILITY_HIDDEN
-extern "C" {
+#define IN_GCC
+
#include "config.h"
+extern "C" {
#include "system.h"
+}
#include "coretypes.h"
-#include "flags.h"
+#include "target.h"
#include "tree.h"
+
+#include "flags.h"
#include "diagnostic.h"
#include "output.h"
-#include "target.h"
#include "toplev.h"
#include "timevar.h"
#include "tm.h"
@@ -71,7 +76,12 @@
#include "langhooks.h"
#include "cgraph.h"
#include "params.h"
-}
+
+// Plugin headers
+#include "llvm-internal.h"
+#include "llvm-debug.h"
+#include "llvm-file-ostream.h"
+#include "bits_and_bobs.h"
// Non-zero if bytecode from PCH is successfully read.
int flag_llvm_pch_read;
From baldrick at free.fr Mon Jul 20 03:17:48 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:17:48 -0000
Subject: [llvm-commits] [gcc-plugin] r76406 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907200817.n6K8HoHo014238@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:17:46 2009
New Revision: 76406
URL: http://llvm.org/viewvc/llvm-project?rev=76406&view=rev
Log:
Comment out the gcc -> llvm mapping logic for the
moment, since this will have to be done differently.
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=76406&r1=76405&r2=76406&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:17:46 2009
@@ -124,203 +124,203 @@
static void createPerModuleOptimizationPasses();
static void destroyOptimizationPasses();
-//===----------------------------------------------------------------------===//
-// Matching LLVM Values with GCC DECL trees
-//===----------------------------------------------------------------------===//
-//
-// LLVMValues is a vector of LLVM Values. GCC tree nodes keep track of LLVM
-// Values using this vector's index. It is easier to save and restore the index
-// than the LLVM Value pointer while using PCH.
-
-// Collection of LLVM Values
-static std::vector LLVMValues;
-typedef DenseMap LLVMValuesMapTy;
-static LLVMValuesMapTy LLVMValuesMap;
-
-/// LocalLLVMValueIDs - This is the set of local IDs we have in our mapping,
-/// this allows us to efficiently identify and remove them. Local IDs are IDs
-/// for values that are local to the current function being processed. These do
-/// not need to go into the PCH file, but DECL_LLVM still needs a valid index
-/// while converting the function. Using "Local IDs" allows the IDs for
-/// function-local decls to be recycled after the function is done.
-static std::vector LocalLLVMValueIDs;
-
-// Remember the LLVM value for GCC tree node.
-void llvm_set_decl(tree Tr, Value *V) {
-
- // If there is not any value then do not add new LLVMValues entry.
- // However clear Tr index if it is non zero.
- if (!V) {
- if (GET_DECL_LLVM_INDEX(Tr))
- SET_DECL_LLVM_INDEX(Tr, 0);
- return;
- }
-
- unsigned &ValueSlot = LLVMValuesMap[V];
- if (ValueSlot) {
- // Already in map
- SET_DECL_LLVM_INDEX(Tr, ValueSlot);
- return;
- }
-
- LLVMValues.push_back(V);
- unsigned Index = LLVMValues.size();
- SET_DECL_LLVM_INDEX(Tr, Index);
- LLVMValuesMap[V] = Index;
-
- // Remember local values.
- if (!isa(V))
- LocalLLVMValueIDs.push_back(Index);
-}
-
-// Return TRUE if there is a LLVM Value associate with GCC tree node.
-bool llvm_set_decl_p(tree Tr) {
- unsigned Index = GET_DECL_LLVM_INDEX(Tr);
- if (Index == 0)
- return false;
-
- return LLVMValues[Index - 1] != 0;
-}
-
-// Get LLVM Value for the GCC tree node based on LLVMValues vector index.
-// If there is not any value associated then use make_decl_llvm() to
-// make LLVM value. When GCC tree node is initialized, it has 0 as the
-// index value. This is why all recorded indices are offset by 1.
-Value *llvm_get_decl(tree Tr) {
-
- unsigned Index = GET_DECL_LLVM_INDEX(Tr);
- if (Index == 0) {
- make_decl_llvm(Tr);
- Index = GET_DECL_LLVM_INDEX(Tr);
-
- // If there was an error, we may have disabled creating LLVM values.
- if (Index == 0) return 0;
- }
- assert((Index - 1) < LLVMValues.size() && "Invalid LLVM value index");
- assert(LLVMValues[Index - 1] && "Trying to use deleted LLVM value!");
-
- return LLVMValues[Index - 1];
-}
-
-/// changeLLVMConstant - Replace Old with New everywhere, updating all maps
-/// (except for AttributeAnnotateGlobals, which is a different kind of animal).
-/// At this point we know that New is not in any of these maps.
-void changeLLVMConstant(Constant *Old, Constant *New) {
- assert(Old->use_empty() && "Old value has uses!");
-
- if (AttributeUsedGlobals.count(Old)) {
- AttributeUsedGlobals.remove(Old);
- AttributeUsedGlobals.insert(New);
- }
-
- for (unsigned i = 0, e = StaticCtors.size(); i != e; ++i) {
- if (StaticCtors[i].first == Old)
- StaticCtors[i].first = New;
- }
-
- for (unsigned i = 0, e = StaticDtors.size(); i != e; ++i) {
- if (StaticDtors[i].first == Old)
- StaticDtors[i].first = New;
- }
-
- assert(!LLVMValuesMap.count(New) && "New cannot be in the LLVMValues map!");
-
- // Find Old in the table.
- LLVMValuesMapTy::iterator I = LLVMValuesMap.find(Old);
- if (I == LLVMValuesMap.end()) return;
-
- unsigned Idx = I->second-1;
- assert(Idx < LLVMValues.size() && "Out of range index!");
- assert(LLVMValues[Idx] == Old && "Inconsistent LLVMValues mapping!");
-
- LLVMValues[Idx] = New;
-
- // Remove the old value from the value map.
- LLVMValuesMap.erase(I);
-
- // Insert the new value into the value map. We know that it can't already
- // exist in the mapping.
- if (New)
- LLVMValuesMap[New] = Idx+1;
-}
-
-// Read LLVM Types string table
-void readLLVMValues() {
- GlobalValue *V = TheModule->getNamedGlobal("llvm.pch.values");
- if (!V)
- return;
-
- GlobalVariable *GV = cast(V);
- ConstantStruct *ValuesFromPCH = cast(GV->getOperand(0));
-
- for (unsigned i = 0; i < ValuesFromPCH->getNumOperands(); ++i) {
- Value *Va = ValuesFromPCH->getOperand(i);
-
- if (!Va) {
- // If V is empty then insert NULL to represent empty entries.
- LLVMValues.push_back(Va);
- continue;
- }
- if (ConstantArray *CA = dyn_cast(Va)) {
- std::string Str = CA->getAsString();
- Va = TheModule->getValueSymbolTable().lookup(Str);
- }
- assert (Va != NULL && "Invalid Value in LLVMValues string table");
- LLVMValues.push_back(Va);
- }
-
- // Now, llvm.pch.values is not required so remove it from the symbol table.
- GV->eraseFromParent();
-}
-
-// GCC tree's uses LLVMValues vector's index to reach LLVM Values.
-// Create a string table to hold these LLVM Values' names. This string
-// table will be used to recreate LTypes vector after loading PCH.
-void writeLLVMValues() {
- if (LLVMValues.empty())
- return;
-
- LLVMContext &Context = getGlobalContext();
-
- std::vector ValuesForPCH;
- for (std::vector::iterator I = LLVMValues.begin(),
- E = LLVMValues.end(); I != E; ++I) {
- if (Constant *C = dyn_cast_or_null(*I))
- ValuesForPCH.push_back(C);
- else
- // Non constant values, e.g. arguments, are not at global scope.
- // When PCH is read, only global scope values are used.
- ValuesForPCH.push_back(Context.getNullValue(Type::Int32Ty));
- }
-
- // Create string table.
- Constant *LLVMValuesTable = Context.getConstantStruct(ValuesForPCH, false);
-
- // Create variable to hold this string table.
- new GlobalVariable(*TheModule, LLVMValuesTable->getType(), true,
- GlobalValue::ExternalLinkage,
- LLVMValuesTable,
- "llvm.pch.values");
-}
-
-/// eraseLocalLLVMValues - drop all non-global values from the LLVM values map.
-void eraseLocalLLVMValues() {
- // Erase all the local values, these are stored in LocalLLVMValueIDs.
- while (!LocalLLVMValueIDs.empty()) {
- unsigned Idx = LocalLLVMValueIDs.back()-1;
- LocalLLVMValueIDs.pop_back();
-
- if (Value *V = LLVMValues[Idx]) {
- assert(!isa(V) && "Found global value");
- LLVMValuesMap.erase(V);
- }
-
- if (Idx == LLVMValues.size()-1)
- LLVMValues.pop_back();
- else
- LLVMValues[Idx] = 0;
- }
-}
+//TODO//===----------------------------------------------------------------------===//
+//TODO// Matching LLVM Values with GCC DECL trees
+//TODO//===----------------------------------------------------------------------===//
+//TODO//
+//TODO// LLVMValues is a vector of LLVM Values. GCC tree nodes keep track of LLVM
+//TODO// Values using this vector's index. It is easier to save and restore the index
+//TODO// than the LLVM Value pointer while using PCH.
+//TODO
+//TODO// Collection of LLVM Values
+//TODOstatic std::vector LLVMValues;
+//TODOtypedef DenseMap LLVMValuesMapTy;
+//TODOstatic LLVMValuesMapTy LLVMValuesMap;
+//TODO
+//TODO/// LocalLLVMValueIDs - This is the set of local IDs we have in our mapping,
+//TODO/// this allows us to efficiently identify and remove them. Local IDs are IDs
+//TODO/// for values that are local to the current function being processed. These do
+//TODO/// not need to go into the PCH file, but DECL_LLVM still needs a valid index
+//TODO/// while converting the function. Using "Local IDs" allows the IDs for
+//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.
+//TODOvoid llvm_set_decl(tree Tr, Value *V) {
+//TODO
+//TODO // If there is not any value then do not add new LLVMValues entry.
+//TODO // However clear Tr index if it is non zero.
+//TODO if (!V) {
+//TODO if (GET_DECL_LLVM_INDEX(Tr))
+//TODO SET_DECL_LLVM_INDEX(Tr, 0);
+//TODO return;
+//TODO }
+//TODO
+//TODO unsigned &ValueSlot = LLVMValuesMap[V];
+//TODO if (ValueSlot) {
+//TODO // Already in map
+//TODO SET_DECL_LLVM_INDEX(Tr, ValueSlot);
+//TODO return;
+//TODO }
+//TODO
+//TODO LLVMValues.push_back(V);
+//TODO unsigned Index = LLVMValues.size();
+//TODO SET_DECL_LLVM_INDEX(Tr, Index);
+//TODO LLVMValuesMap[V] = Index;
+//TODO
+//TODO // Remember local values.
+//TODO if (!isa(V))
+//TODO LocalLLVMValueIDs.push_back(Index);
+//TODO}
+//TODO
+//TODO// Return TRUE if there is a LLVM Value associate with GCC tree node.
+//TODObool llvm_set_decl_p(tree Tr) {
+//TODO unsigned Index = GET_DECL_LLVM_INDEX(Tr);
+//TODO if (Index == 0)
+//TODO return false;
+//TODO
+//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.
+//TODOValue *llvm_get_decl(tree Tr) {
+//TODO
+//TODO unsigned Index = GET_DECL_LLVM_INDEX(Tr);
+//TODO if (Index == 0) {
+//TODO make_decl_llvm(Tr);
+//TODO Index = GET_DECL_LLVM_INDEX(Tr);
+//TODO
+//TODO // If there was an error, we may have disabled creating LLVM values.
+//TODO if (Index == 0) return 0;
+//TODO }
+//TODO assert((Index - 1) < LLVMValues.size() && "Invalid LLVM value index");
+//TODO assert(LLVMValues[Index - 1] && "Trying to use deleted LLVM value!");
+//TODO
+//TODO return LLVMValues[Index - 1];
+//TODO}
+//TODO
+//TODO/// changeLLVMConstant - Replace Old with New everywhere, updating all maps
+//TODO/// (except for AttributeAnnotateGlobals, which is a different kind of animal).
+//TODO/// At this point we know that New is not in any of these maps.
+//TODOvoid changeLLVMConstant(Constant *Old, Constant *New) {
+//TODO assert(Old->use_empty() && "Old value has uses!");
+//TODO
+//TODO if (AttributeUsedGlobals.count(Old)) {
+//TODO AttributeUsedGlobals.remove(Old);
+//TODO AttributeUsedGlobals.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;
+//TODO }
+//TODO
+//TODO for (unsigned i = 0, e = StaticDtors.size(); i != e; ++i) {
+//TODO if (StaticDtors[i].first == Old)
+//TODO StaticDtors[i].first = New;
+//TODO }
+//TODO
+//TODO assert(!LLVMValuesMap.count(New) && "New cannot be in the LLVMValues map!");
+//TODO
+//TODO // Find Old in the table.
+//TODO LLVMValuesMapTy::iterator I = LLVMValuesMap.find(Old);
+//TODO if (I == LLVMValuesMap.end()) return;
+//TODO
+//TODO unsigned Idx = I->second-1;
+//TODO assert(Idx < LLVMValues.size() && "Out of range index!");
+//TODO assert(LLVMValues[Idx] == Old && "Inconsistent LLVMValues mapping!");
+//TODO
+//TODO LLVMValues[Idx] = New;
+//TODO
+//TODO // Remove the old value from the value map.
+//TODO LLVMValuesMap.erase(I);
+//TODO
+//TODO // Insert the new value into the value map. We know that it can't already
+//TODO // exist in the mapping.
+//TODO if (New)
+//TODO LLVMValuesMap[New] = Idx+1;
+//TODO}
+//TODO
+//TODO// Read LLVM Types string table
+//TODOvoid readLLVMValues() {
+//TODO GlobalValue *V = TheModule->getNamedGlobal("llvm.pch.values");
+//TODO if (!V)
+//TODO return;
+//TODO
+//TODO GlobalVariable *GV = cast(V);
+//TODO ConstantStruct *ValuesFromPCH = cast(GV->getOperand(0));
+//TODO
+//TODO for (unsigned i = 0; i < ValuesFromPCH->getNumOperands(); ++i) {
+//TODO Value *Va = ValuesFromPCH->getOperand(i);
+//TODO
+//TODO if (!Va) {
+//TODO // If V is empty then insert NULL to represent empty entries.
+//TODO LLVMValues.push_back(Va);
+//TODO continue;
+//TODO }
+//TODO if (ConstantArray *CA = dyn_cast(Va)) {
+//TODO std::string Str = CA->getAsString();
+//TODO Va = TheModule->getValueSymbolTable().lookup(Str);
+//TODO }
+//TODO assert (Va != NULL && "Invalid Value in LLVMValues string table");
+//TODO LLVMValues.push_back(Va);
+//TODO }
+//TODO
+//TODO // Now, llvm.pch.values is not required so remove it from the symbol table.
+//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.
+//TODOvoid writeLLVMValues() {
+//TODO if (LLVMValues.empty())
+//TODO return;
+//TODO
+//TODO LLVMContext &Context = getGlobalContext();
+//TODO
+//TODO std::vector ValuesForPCH;
+//TODO for (std::vector::iterator I = LLVMValues.begin(),
+//TODO E = LLVMValues.end(); I != E; ++I) {
+//TODO if (Constant *C = dyn_cast_or_null(*I))
+//TODO ValuesForPCH.push_back(C);
+//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 }
+//TODO
+//TODO // Create string table.
+//TODO Constant *LLVMValuesTable = Context.getConstantStruct(ValuesForPCH, false);
+//TODO
+//TODO // Create variable to hold this string table.
+//TODO new GlobalVariable(*TheModule, LLVMValuesTable->getType(), true,
+//TODO GlobalValue::ExternalLinkage,
+//TODO LLVMValuesTable,
+//TODO "llvm.pch.values");
+//TODO}
+//TODO
+//TODO/// eraseLocalLLVMValues - drop all non-global values from the LLVM values map.
+//TODOvoid eraseLocalLLVMValues() {
+//TODO // Erase all the local values, these are stored in LocalLLVMValueIDs.
+//TODO while (!LocalLLVMValueIDs.empty()) {
+//TODO unsigned Idx = LocalLLVMValueIDs.back()-1;
+//TODO LocalLLVMValueIDs.pop_back();
+//TODO
+//TODO if (Value *V = LLVMValues[Idx]) {
+//TODO assert(!isa(V) && "Found global value");
+//TODO LLVMValuesMap.erase(V);
+//TODO }
+//TODO
+//TODO if (Idx == LLVMValues.size()-1)
+//TODO LLVMValues.pop_back();
+//TODO else
+//TODO LLVMValues[Idx] = 0;
+//TODO }
+//TODO}
// Forward decl visibility style to global.
From baldrick at free.fr Mon Jul 20 03:19:17 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 10:19:17 +0200
Subject: [llvm-commits] [llvm] r76385 - in /llvm/trunk:
docs/ include/llvm-c/ include/llvm/ include/llvm/Support/ lib/AsmParser/
lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/Linker/
lib/Target/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/
lib/Target/CellSPU/AsmPrinter/
lib/Target/CppBackend/ lib/Target/IA64/AsmPrinter/
lib/Target/MSP430/ lib/Target/Mips/AsmPrinter/ lib/Target/PowerPC/AsmPrinter/
lib/Target/Sparc/AsmPrinter/ lib/Target/SystemZ/AsmPrinter/ lib/Target/X86/AsmPrinter/
lib/Target/XCore/ lib/Tr...
In-Reply-To: <71E41203-F38F-449A-BF98-EF5C1E486F28@apple.com>
References: <200907200103.n6K13chA025017@zion.cs.uiuc.edu> <4A63F2AF.4040106@free.fr>
<71E41203-F38F-449A-BF98-EF5C1E486F28@apple.com>
Message-ID: <4A642885.8080607@free.fr>
Hi Chris,
> Right. Private linkage is discarded by the assembler, so they never
> make it into the .o file. linker_private is discarded by the linker,
> so it never makes it into the .exe/.dylib. I don't think there is a
> corresponding idea on ELF, so on ELF they two linkage types should be
> codegen'd the same way.
I don't understand why you would want something to be discarded by
the assembler/linker and not by the linker/assembler. Don't you
want them both to throw pointless things away?
Ciao,
Duncan.
From baldrick at free.fr Mon Jul 20 03:24:24 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:24:24 -0000
Subject: [llvm-commits] [gcc-plugin] r76407 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907200824.n6K8OTxl014473@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:24:10 2009
New Revision: 76407
URL: http://llvm.org/viewvc/llvm-project?rev=76407&view=rev
Log:
Copy initialization logic from llvm-plugin.
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=76407&r1=76406&r2=76407&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:24:10 2009
@@ -76,6 +76,7 @@
#include "langhooks.h"
#include "cgraph.h"
#include "params.h"
+#include "plugin-version.h"
// Plugin headers
#include "llvm-internal.h"
@@ -353,35 +354,32 @@
#undef Declare2
}
-void llvm_initialize_backend(void) {
- // Initialize the LLVM backend.
-#define DoInit2(TARG, MOD) LLVMInitialize ## TARG ## MOD()
-#define DoInit(T, M) DoInit2(T, M)
- DoInit(LLVM_TARGET_NAME, TargetInfo);
- DoInit(LLVM_TARGET_NAME, Target);
- DoInit(LLVM_TARGET_NAME, AsmPrinter);
-#undef DoInit
-#undef DoInit2
-
- // Initialize LLVM options.
+/// LazilyConfigureLLVM - Set LLVM configuration options, if not already set.
+/// already created.
+static void LazilyConfigureLLVM(void) {
+ static bool Configured = false;
+ if (Configured)
+ return;
+
+ // Initialize LLVM command line options.
std::vector Args;
Args.push_back(progname); // program name
- // Allow targets to specify PIC options and other stuff to the corresponding
- // LLVM backends.
-#ifdef LLVM_SET_RED_ZONE_FLAG
- LLVM_SET_RED_ZONE_FLAG(flag_disable_red_zone)
-#endif
-#ifdef LLVM_SET_TARGET_OPTIONS
- LLVM_SET_TARGET_OPTIONS(Args);
-#endif
-#ifdef LLVM_SET_MACHINE_OPTIONS
- LLVM_SET_MACHINE_OPTIONS(Args);
-#endif
-#ifdef LLVM_SET_IMPLICIT_FLOAT
- LLVM_SET_IMPLICIT_FLOAT(flag_no_implicit_float)
-#endif
-
+//TODO // Allow targets to specify PIC options and other stuff to the corresponding
+//TODO // LLVM backends.
+//TODO#ifdef LLVM_SET_RED_ZONE_FLAG
+//TODO LLVM_SET_RED_ZONE_FLAG(flag_disable_red_zone)
+//TODO#endif
+//TODO#ifdef LLVM_SET_TARGET_OPTIONS
+//TODO LLVM_SET_TARGET_OPTIONS(Args);
+//TODO#endif
+//TODO#ifdef LLVM_SET_MACHINE_OPTIONS
+//TODO LLVM_SET_MACHINE_OPTIONS(Args);
+//TODO#endif
+//TODO#ifdef LLVM_SET_IMPLICIT_FLOAT
+//TODO LLVM_SET_IMPLICIT_FLOAT(flag_no_implicit_float)
+//TODO#endif
+
if (time_report)
Args.push_back("--time-passes");
if (fast_math_flags_set_p())
@@ -392,71 +390,84 @@
Args.push_back("--nozero-initialized-in-bss");
if (flag_debug_asm)
Args.push_back("--asm-verbose");
- if (flag_debug_pass_structure)
- Args.push_back("--debug-pass=Structure");
- if (flag_debug_pass_arguments)
- Args.push_back("--debug-pass=Arguments");
+//TODO if (flag_debug_pass_structure)
+//TODO Args.push_back("--debug-pass=Structure");
+//TODO if (flag_debug_pass_arguments)
+//TODO 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");
- // If there are options that should be passed through to the LLVM backend
- // directly from the command line, do so now. This is mainly for debugging
- // purposes, and shouldn't really be for general use.
- std::vector ArgStrings;
-
- if (flag_limited_precision > 0) {
- std::string Arg("--limit-float-precision="+utostr(flag_limited_precision));
- ArgStrings.push_back(Arg);
- }
-
- if (flag_stack_protect > 0) {
- std::string Arg("--stack-protector-buffer-size=" +
- utostr(PARAM_VALUE(PARAM_SSP_BUFFER_SIZE)));
- ArgStrings.push_back(Arg);
- }
-
- for (unsigned i = 0, e = ArgStrings.size(); i != e; ++i)
- Args.push_back(ArgStrings[i].c_str());
-
- std::vector LLVM_Optns; // Avoid deallocation before opts parsed!
- if (llvm_optns) {
- SplitString(llvm_optns, LLVM_Optns);
- for(unsigned i = 0, e = LLVM_Optns.size(); i != e; ++i)
- Args.push_back(LLVM_Optns[i].c_str());
- }
-
+//TODO // If there are options that should be passed through to the LLVM backend
+//TODO // directly from the command line, do so now. This is mainly for debugging
+//TODO // purposes, and shouldn't really be for general use.
+//TODO std::vector ArgStrings;
+//TODO
+//TODO if (flag_limited_precision > 0) {
+//TODO std::string Arg("--limit-float-precision="+utostr(flag_limited_precision));
+//TODO ArgStrings.push_back(Arg);
+//TODO }
+//TODO
+//TODO if (flag_stack_protect > 0) {
+//TODO std::string Arg("--stack-protector-buffer-size=" +
+//TODO utostr(PARAM_VALUE(PARAM_SSP_BUFFER_SIZE)));
+//TODO ArgStrings.push_back(Arg);
+//TODO }
+//TODO
+//TODO for (unsigned i = 0, e = ArgStrings.size(); i != e; ++i)
+//TODO Args.push_back(ArgStrings[i].c_str());
+//TODO
+//TODO std::vector LLVM_Optns; // Avoid deallocation before opts parsed!
+//TODO if (llvm_optns) {
+//TODO SplitString(llvm_optns, LLVM_Optns);
+//TODO for(unsigned i = 0, e = LLVM_Optns.size(); i != e; ++i)
+//TODO Args.push_back(LLVM_Optns[i].c_str());
+//TODO }
+
Args.push_back(0); // Null terminator.
int pseudo_argc = Args.size()-1;
- cl::ParseCommandLineOptions(pseudo_argc, (char**)&Args[0]);
+ llvm::cl::ParseCommandLineOptions(pseudo_argc, (char**)&Args[0]);
+
+ Configured = true;
+}
+
+/// LazilyInitializeModule - Create a module to output LLVM IR to, if it wasn't
+/// already created.
+static void LazilyInitializeModule(void) {
+ static bool Initialized = false;
+ if (Initialized)
+ return;
+
+ LazilyConfigureLLVM;
TheModule = new Module("", getGlobalContext());
// 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 = 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
+ 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
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;
@@ -469,13 +480,13 @@
// Figure out the subtarget feature string we pass to the target.
std::string FeatureStr;
- // The target can set LLVM_SET_SUBTARGET_FEATURES to configure the LLVM
- // backend.
-#ifdef LLVM_SET_SUBTARGET_FEATURES
- SubtargetFeatures Features;
- LLVM_SET_SUBTARGET_FEATURES(Features);
- FeatureStr = Features.getString();
-#endif
+//TODO // The target can set LLVM_SET_SUBTARGET_FEATURES to configure the LLVM
+//TODO // backend.
+//TODO#ifdef LLVM_SET_SUBTARGET_FEATURES
+//TODO SubtargetFeatures Features;
+//TODO LLVM_SET_SUBTARGET_FEATURES(Features);
+//TODO FeatureStr = Features.getString();
+//TODO#endif
TheTarget = TME->createTargetMachine(*TheModule, FeatureStr);
assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN);
@@ -486,29 +497,38 @@
TheModule->setDataLayout(TheTarget->getTargetData()->
getStringRepresentation());
- if (optimize)
- RegisterRegAlloc::setDefault(createLinearScanRegisterAllocator);
- else
- RegisterRegAlloc::setDefault(createLocalRegisterAllocator);
-
- // FIXME - Do not disable debug info while writing pch.
- if (!flag_pch_file &&
- debug_info_level > DINFO_LEVEL_NONE)
- TheDebugInfo = new DebugInfo(TheModule);
-}
-
-/// Set backend options that may only be known at codegen time.
-void performLateBackendInitialization(void) {
- // The Ada front-end sets flag_exceptions only after processing the file.
- ExceptionHandling = flag_exceptions;
- for (Module::iterator I = TheModule->begin(), E = TheModule->end();
- I != E; ++I)
- if (!I->isDeclaration()) {
- if (flag_disable_red_zone)
- I->addFnAttr(Attribute::NoRedZone);
- if (flag_no_implicit_float)
- I->addFnAttr(Attribute::NoImplicitFloat);
- }
+//TODO if (optimize)
+//TODO RegisterRegAlloc::setDefault(createLinearScanRegisterAllocator);
+//TODO else
+//TODO RegisterRegAlloc::setDefault(createLocalRegisterAllocator);
+
+//TODO // FIXME - Do not disable debug info while writing pch.
+//TODO if (!flag_pch_file &&
+//TODO debug_info_level > DINFO_LEVEL_NONE)
+//TODO TheDebugInfo = new DebugInfo(TheModule);
+//TODO}
+//TODO
+//TODO/// Set backend options that may only be 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 for (Module::iterator I = TheModule->begin(), E = TheModule->end();
+//TODO I != E; ++I)
+//TODO if (!I->isDeclaration()) {
+//TODO if (flag_disable_red_zone)
+//TODO I->addFnAttr(Attribute::NoRedZone);
+//TODO if (flag_no_implicit_float)
+//TODO I->addFnAttr(Attribute::NoImplicitFloat);
+//TODO }
+//TODO}
+//TODO
+//TODOvoid llvm_lang_dependent_init(const char *Name) {
+//TODO if (TheDebugInfo)
+//TODO TheDebugInfo->Initialize();
+//TODO if (Name)
+//TODO TheModule->setModuleIdentifier(Name);
+//TODO}
+ Initialized = true;
}
void llvm_lang_dependent_init(const char *Name) {
From baldrick at free.fr Mon Jul 20 03:31:04 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:31:04 -0000
Subject: [llvm-commits] [gcc-plugin] r76409 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907200831.n6K8V4XM014670@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:31:00 2009
New Revision: 76409
URL: http://llvm.org/viewvc/llvm-project?rev=76409&view=rev
Log:
Comment out a ton more of llvm-backend that won't
work as is.
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=76409&r1=76408&r2=76409&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:31:00 2009
@@ -81,7 +81,7 @@
// Plugin headers
#include "llvm-internal.h"
#include "llvm-debug.h"
-#include "llvm-file-ostream.h"
+//TODO#include "llvm-file-ostream.h"
#include "bits_and_bobs.h"
// Non-zero if bytecode from PCH is successfully read.
@@ -538,285 +538,285 @@
TheModule->setModuleIdentifier(Name);
}
-oFILEstream *AsmOutStream = 0;
-static formatted_raw_ostream *AsmOutRawStream = 0;
-oFILEstream *AsmIntermediateOutStream = 0;
-
-/// Read bytecode from PCH file. Initialize TheModule and setup
-/// LTypes vector.
-void llvm_pch_read(const unsigned char *Buffer, unsigned Size) {
- std::string ModuleName = TheModule->getModuleIdentifier();
-
- delete TheModule;
- delete TheDebugInfo;
-
- clearTargetBuiltinCache();
-
- MemoryBuffer *MB = MemoryBuffer::getNewMemBuffer(Size, ModuleName.c_str());
- memcpy((char*)MB->getBufferStart(), Buffer, Size);
-
- std::string ErrMsg;
- TheModule = ParseBitcodeFile(MB, getGlobalContext(), &ErrMsg);
- delete MB;
-
- // FIXME - Do not disable debug info while writing pch.
- if (!flag_pch_file && debug_info_level > DINFO_LEVEL_NONE) {
- TheDebugInfo = new DebugInfo(TheModule);
- TheDebugInfo->Initialize();
- }
-
- if (!TheModule) {
- cerr << "Error reading bytecodes from PCH file\n";
- cerr << ErrMsg << "\n";
- exit(1);
- }
-
- if (PerFunctionPasses || PerModulePasses) {
- destroyOptimizationPasses();
-
- // Don't run codegen, when we should output PCH
- if (flag_pch_file)
- llvm_pch_write_init();
- }
-
- // Read LLVM Types string table
- readLLVMTypesStringTable();
- readLLVMValues();
-
- flag_llvm_pch_read = 1;
-}
-
-// Initialize PCH writing.
-void llvm_pch_write_init(void) {
- timevar_push(TV_LLVM_INIT);
- AsmOutStream = new oFILEstream(asm_out_file);
- // FIXME: disentangle ostream madness here. Kill off ostream and FILE.
- AsmOutRawStream =
- new formatted_raw_ostream(*new raw_os_ostream(*AsmOutStream),
- formatted_raw_ostream::DELETE_STREAM);
- AsmOutFile = new OStream(*AsmOutStream);
-
- PerModulePasses = new PassManager();
- PerModulePasses->add(new TargetData(*TheTarget->getTargetData()));
-
- // If writing to stdout, set binary mode.
- if (asm_out_file == stdout)
- sys::Program::ChangeStdoutToBinary();
-
- // Emit an LLVM .bc file to the output. This is used when passed
- // -emit-llvm -c to the GCC driver.
- PerModulePasses->add(CreateBitcodeWriterPass(*AsmOutStream));
-
- // Disable emission of .ident into the output file... which is completely
- // wrong for llvm/.bc emission cases.
- flag_no_ident = 1;
-
- flag_llvm_pch_read = 0;
-
- timevar_pop(TV_LLVM_INIT);
-}
-
-static void destroyOptimizationPasses() {
- delete PerFunctionPasses;
- delete PerModulePasses;
- delete CodeGenPasses;
-
- PerFunctionPasses = 0;
- PerModulePasses = 0;
- CodeGenPasses = 0;
-}
-
-static void createPerFunctionOptimizationPasses() {
- if (PerFunctionPasses)
- return;
-
- // Create and set up the per-function pass manager.
- // FIXME: Move the code generator to be function-at-a-time.
- PerFunctionPasses =
- new FunctionPassManager(new ExistingModuleProvider(TheModule));
- PerFunctionPasses->add(new TargetData(*TheTarget->getTargetData()));
-
- // In -O0 if checking is disabled, we don't even have per-function passes.
- bool HasPerFunctionPasses = false;
-#ifdef ENABLE_CHECKING
- PerFunctionPasses->add(createVerifierPass());
- HasPerFunctionPasses = true;
-#endif
-
- if (optimize > 0 && !DisableLLVMOptimizations) {
- HasPerFunctionPasses = true;
- PerFunctionPasses->add(createCFGSimplificationPass());
- if (optimize == 1)
- PerFunctionPasses->add(createPromoteMemoryToRegisterPass());
- else
- PerFunctionPasses->add(createScalarReplAggregatesPass());
- PerFunctionPasses->add(createInstructionCombiningPass());
- }
-
- // If there are no module-level passes that have to be run, we codegen as
- // each function is parsed.
- // FIXME: We can't figure this out until we know there are no always-inline
- // functions.
- // FIXME: This is disabled right now until bugs can be worked out. Reenable
- // this for fast -O0 compiles!
- if (!emit_llvm_bc && !emit_llvm && 0) {
- FunctionPassManager *PM = PerFunctionPasses;
- HasPerFunctionPasses = true;
-
- CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
-
- switch (optimize) {
- default: break;
- case 0: OptLevel = CodeGenOpt::None; break;
- case 3: OptLevel = CodeGenOpt::Aggressive; break;
- }
-
- // Normal mode, emit a .s file by running the code generator.
- // Note, this also adds codegenerator level optimization passes.
- switch (TheTarget->addPassesToEmitFile(*PM, *AsmOutRawStream,
- TargetMachine::AssemblyFile,
- OptLevel)) {
- default:
- case FileModel::Error:
- cerr << "Error interfacing to target machine!\n";
- exit(1);
- case FileModel::AsmFile:
- break;
- }
-
- if (TheTarget->addPassesToEmitFileFinish(*PM, (MachineCodeEmitter *)0,
- OptLevel)) {
- cerr << "Error interfacing to target machine!\n";
- exit(1);
- }
- }
-
- if (HasPerFunctionPasses) {
- PerFunctionPasses->doInitialization();
- } else {
- delete PerFunctionPasses;
- PerFunctionPasses = 0;
- }
-}
-
-static void createPerModuleOptimizationPasses() {
- if (PerModulePasses)
- // llvm_pch_write_init has already created the per module passes.
- return;
-
- // FIXME: AT -O0/O1, we should stream out functions at a time.
- PerModulePasses = new PassManager();
- PerModulePasses->add(new TargetData(*TheTarget->getTargetData()));
- bool HasPerModulePasses = false;
-
- if (!DisableLLVMOptimizations) {
- bool NeedAlwaysInliner = false;
- llvm::Pass *InliningPass = 0;
- if (flag_inline_trees > 1) { // respect -fno-inline-functions
- InliningPass = createFunctionInliningPass(); // Inline small functions
- } else {
- // If full inliner is not run, check if always-inline is needed to handle
- // functions that are marked as always_inline.
- for (Module::iterator I = TheModule->begin(), E = TheModule->end();
- I != E; ++I)
- if (I->hasFnAttr(Attribute::AlwaysInline)) {
- NeedAlwaysInliner = true;
- break;
- }
-
- if (NeedAlwaysInliner)
- InliningPass = createAlwaysInlinerPass(); // Inline always_inline funcs
- }
-
- HasPerModulePasses = true;
- createStandardModulePasses(PerModulePasses, optimize,
- optimize_size || optimize < 3,
- flag_unit_at_a_time, flag_unroll_loops,
- !flag_no_simplify_libcalls, flag_exceptions,
- InliningPass);
- }
-
- if (emit_llvm_bc) {
- // Emit an LLVM .bc file to the output. This is used when passed
- // -emit-llvm -c to the GCC driver.
- PerModulePasses->add(CreateBitcodeWriterPass(*AsmOutStream));
- HasPerModulePasses = true;
- } else if (emit_llvm) {
- // Emit an LLVM .ll file to the output. This is used when passed
- // -emit-llvm -S to the GCC driver.
- PerModulePasses->add(createPrintModulePass(AsmOutRawStream));
- HasPerModulePasses = true;
- } else {
- // If there are passes we have to run on the entire module, we do codegen
- // as a separate "pass" after that happens.
- // However if there are no module-level passes that have to be run, we
- // codegen as each function is parsed.
- // FIXME: This is disabled right now until bugs can be worked out. Reenable
- // this for fast -O0 compiles!
- if (PerModulePasses || 1) {
- FunctionPassManager *PM = CodeGenPasses =
- new FunctionPassManager(new ExistingModuleProvider(TheModule));
- PM->add(new TargetData(*TheTarget->getTargetData()));
-
- CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
-
- switch (optimize) {
- default: break;
- case 0: OptLevel = CodeGenOpt::None; break;
- case 3: OptLevel = CodeGenOpt::Aggressive; break;
- }
-
- // Normal mode, emit a .s file by running the code generator.
- // Note, this also adds codegenerator level optimization passes.
- switch (TheTarget->addPassesToEmitFile(*PM, *AsmOutRawStream,
- TargetMachine::AssemblyFile,
- OptLevel)) {
- default:
- case FileModel::Error:
- cerr << "Error interfacing to target machine!\n";
- exit(1);
- case FileModel::AsmFile:
- break;
- }
-
- if (TheTarget->addPassesToEmitFileFinish(*PM, (MachineCodeEmitter *)0,
- OptLevel)) {
- cerr << "Error interfacing to target machine!\n";
- exit(1);
- }
- }
- }
-
- if (!HasPerModulePasses) {
- delete PerModulePasses;
- PerModulePasses = 0;
- }
-}
-
-// llvm_asm_file_start - Start the .s file.
-void llvm_asm_file_start(void) {
- timevar_push(TV_LLVM_INIT);
- AsmOutStream = new oFILEstream(asm_out_file);
- // FIXME: disentangle ostream madness here. Kill off ostream and FILE.
- AsmOutRawStream =
- new formatted_raw_ostream(*new raw_os_ostream(*AsmOutStream),
- formatted_raw_ostream::DELETE_STREAM);
- AsmOutFile = new OStream(*AsmOutStream);
-
- flag_llvm_pch_read = 0;
-
- if (emit_llvm_bc || emit_llvm)
- // Disable emission of .ident into the output file... which is completely
- // wrong for llvm/.bc emission cases.
- flag_no_ident = 1;
-
- // If writing to stdout, set binary mode.
- if (asm_out_file == stdout)
- sys::Program::ChangeStdoutToBinary();
+//TODOoFILEstream *AsmOutStream = 0;
+//TODOstatic formatted_raw_ostream *AsmOutRawStream = 0;
+//TODOoFILEstream *AsmIntermediateOutStream = 0;
+//TODO
+//TODO/// 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();
+//TODO
+//TODO delete TheModule;
+//TODO delete TheDebugInfo;
+//TODO
+//TODO clearTargetBuiltinCache();
+//TODO
+//TODO MemoryBuffer *MB = MemoryBuffer::getNewMemBuffer(Size, ModuleName.c_str());
+//TODO memcpy((char*)MB->getBufferStart(), Buffer, Size);
+//TODO
+//TODO std::string ErrMsg;
+//TODO TheModule = ParseBitcodeFile(MB, getGlobalContext(), &ErrMsg);
+//TODO delete MB;
+//TODO
+//TODO // FIXME - Do not disable debug info while writing pch.
+//TODO if (!flag_pch_file && debug_info_level > DINFO_LEVEL_NONE) {
+//TODO TheDebugInfo = new DebugInfo(TheModule);
+//TODO TheDebugInfo->Initialize();
+//TODO }
+//TODO
+//TODO if (!TheModule) {
+//TODO cerr << "Error reading bytecodes from PCH file\n";
+//TODO cerr << ErrMsg << "\n";
+//TODO exit(1);
+//TODO }
+//TODO
+//TODO if (PerFunctionPasses || PerModulePasses) {
+//TODO destroyOptimizationPasses();
+//TODO
+//TODO // Don't run codegen, when we should output PCH
+//TODO if (flag_pch_file)
+//TODO llvm_pch_write_init();
+//TODO }
+//TODO
+//TODO // Read LLVM Types string table
+//TODO readLLVMTypesStringTable();
+//TODO readLLVMValues();
+//TODO
+//TODO flag_llvm_pch_read = 1;
+//TODO}
+//TODO
+//TODO// Initialize PCH writing.
+//TODOvoid llvm_pch_write_init(void) {
+//TODO timevar_push(TV_LLVM_INIT);
+//TODO AsmOutStream = new oFILEstream(asm_out_file);
+//TODO // FIXME: disentangle ostream madness here. Kill off ostream and FILE.
+//TODO AsmOutRawStream =
+//TODO new formatted_raw_ostream(*new raw_os_ostream(*AsmOutStream),
+//TODO formatted_raw_ostream::DELETE_STREAM);
+//TODO AsmOutFile = new OStream(*AsmOutStream);
+//TODO
+//TODO PerModulePasses = new PassManager();
+//TODO PerModulePasses->add(new TargetData(*TheTarget->getTargetData()));
+//TODO
+//TODO // If writing to stdout, set binary mode.
+//TODO if (asm_out_file == stdout)
+//TODO sys::Program::ChangeStdoutToBinary();
+//TODO
+//TODO // Emit an LLVM .bc file to the output. This is used when passed
+//TODO // -emit-llvm -c to the GCC driver.
+//TODO PerModulePasses->add(CreateBitcodeWriterPass(*AsmOutStream));
+//TODO
+//TODO // Disable emission of .ident into the output file... which is completely
+//TODO // wrong for llvm/.bc emission cases.
+//TODO flag_no_ident = 1;
+//TODO
+//TODO flag_llvm_pch_read = 0;
+//TODO
+//TODO timevar_pop(TV_LLVM_INIT);
+//TODO}
- AttributeUsedGlobals.clear();
- timevar_pop(TV_LLVM_INIT);
-}
+//TODOstatic void destroyOptimizationPasses() {
+//TODO delete PerFunctionPasses;
+//TODO delete PerModulePasses;
+//TODO delete CodeGenPasses;
+//TODO
+//TODO PerFunctionPasses = 0;
+//TODO PerModulePasses = 0;
+//TODO CodeGenPasses = 0;
+//TODO}
+//TODO
+//TODOstatic void createPerFunctionOptimizationPasses() {
+//TODO if (PerFunctionPasses)
+//TODO return;
+//TODO
+//TODO // Create and set up the per-function pass manager.
+//TODO // FIXME: Move the code generator to be function-at-a-time.
+//TODO PerFunctionPasses =
+//TODO new FunctionPassManager(new ExistingModuleProvider(TheModule));
+//TODO PerFunctionPasses->add(new TargetData(*TheTarget->getTargetData()));
+//TODO
+//TODO // In -O0 if checking is disabled, we don't even have per-function passes.
+//TODO bool HasPerFunctionPasses = false;
+//TODO#ifdef ENABLE_CHECKING
+//TODO PerFunctionPasses->add(createVerifierPass());
+//TODO HasPerFunctionPasses = true;
+//TODO#endif
+//TODO
+//TODO if (optimize > 0 && !DisableLLVMOptimizations) {
+//TODO HasPerFunctionPasses = true;
+//TODO PerFunctionPasses->add(createCFGSimplificationPass());
+//TODO if (optimize == 1)
+//TODO PerFunctionPasses->add(createPromoteMemoryToRegisterPass());
+//TODO else
+//TODO PerFunctionPasses->add(createScalarReplAggregatesPass());
+//TODO PerFunctionPasses->add(createInstructionCombiningPass());
+//TODO }
+//TODO
+//TODO // If there are no module-level passes that have to be run, we codegen as
+//TODO // each function is parsed.
+//TODO // FIXME: We can't figure this out until we know there are no always-inline
+//TODO // functions.
+//TODO // FIXME: This is disabled right now until bugs can be worked out. Reenable
+//TODO // this for fast -O0 compiles!
+//TODO if (!emit_llvm_bc && !emit_llvm && 0) {
+//TODO FunctionPassManager *PM = PerFunctionPasses;
+//TODO HasPerFunctionPasses = true;
+//TODO
+//TODO CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+//TODO
+//TODO switch (optimize) {
+//TODO default: break;
+//TODO case 0: OptLevel = CodeGenOpt::None; break;
+//TODO case 3: OptLevel = CodeGenOpt::Aggressive; break;
+//TODO }
+//TODO
+//TODO // Normal mode, emit a .s file by running the code generator.
+//TODO // Note, this also adds codegenerator level optimization passes.
+//TODO switch (TheTarget->addPassesToEmitFile(*PM, *AsmOutRawStream,
+//TODO TargetMachine::AssemblyFile,
+//TODO OptLevel)) {
+//TODO default:
+//TODO case FileModel::Error:
+//TODO cerr << "Error interfacing to target machine!\n";
+//TODO exit(1);
+//TODO case FileModel::AsmFile:
+//TODO break;
+//TODO }
+//TODO
+//TODO if (TheTarget->addPassesToEmitFileFinish(*PM, (MachineCodeEmitter *)0,
+//TODO OptLevel)) {
+//TODO cerr << "Error interfacing to target machine!\n";
+//TODO exit(1);
+//TODO }
+//TODO }
+//TODO
+//TODO if (HasPerFunctionPasses) {
+//TODO PerFunctionPasses->doInitialization();
+//TODO } else {
+//TODO delete PerFunctionPasses;
+//TODO PerFunctionPasses = 0;
+//TODO }
+//TODO}
+//TODO
+//TODOstatic void createPerModuleOptimizationPasses() {
+//TODO if (PerModulePasses)
+//TODO // llvm_pch_write_init has already created the per module passes.
+//TODO return;
+//TODO
+//TODO // FIXME: AT -O0/O1, we should stream out functions at a time.
+//TODO PerModulePasses = new PassManager();
+//TODO PerModulePasses->add(new TargetData(*TheTarget->getTargetData()));
+//TODO bool HasPerModulePasses = false;
+//TODO
+//TODO if (!DisableLLVMOptimizations) {
+//TODO bool NeedAlwaysInliner = false;
+//TODO llvm::Pass *InliningPass = 0;
+//TODO if (flag_inline_trees > 1) { // respect -fno-inline-functions
+//TODO InliningPass = createFunctionInliningPass(); // Inline small functions
+//TODO } else {
+//TODO // If full inliner is not run, check if always-inline is needed to handle
+//TODO // functions that are marked as always_inline.
+//TODO for (Module::iterator I = TheModule->begin(), E = TheModule->end();
+//TODO I != E; ++I)
+//TODO if (I->hasFnAttr(Attribute::AlwaysInline)) {
+//TODO NeedAlwaysInliner = true;
+//TODO break;
+//TODO }
+//TODO
+//TODO if (NeedAlwaysInliner)
+//TODO InliningPass = createAlwaysInlinerPass(); // Inline always_inline funcs
+//TODO }
+//TODO
+//TODO HasPerModulePasses = true;
+//TODO createStandardModulePasses(PerModulePasses, optimize,
+//TODO optimize_size || optimize < 3,
+//TODO flag_unit_at_a_time, flag_unroll_loops,
+//TODO !flag_no_simplify_libcalls, flag_exceptions,
+//TODO InliningPass);
+//TODO }
+//TODO
+//TODO if (emit_llvm_bc) {
+//TODO // Emit an LLVM .bc file to the output. This is used when passed
+//TODO // -emit-llvm -c to the GCC driver.
+//TODO PerModulePasses->add(CreateBitcodeWriterPass(*AsmOutStream));
+//TODO HasPerModulePasses = true;
+//TODO } else if (emit_llvm) {
+//TODO // Emit an LLVM .ll file to the output. This is used when passed
+//TODO // -emit-llvm -S to the GCC driver.
+//TODO PerModulePasses->add(createPrintModulePass(AsmOutRawStream));
+//TODO HasPerModulePasses = true;
+//TODO } else {
+//TODO // If there are passes we have to run on the entire module, we do codegen
+//TODO // as a separate "pass" after that happens.
+//TODO // However if there are no module-level passes that have to be run, we
+//TODO // codegen as each function is parsed.
+//TODO // FIXME: This is disabled right now until bugs can be worked out. Reenable
+//TODO // this for fast -O0 compiles!
+//TODO if (PerModulePasses || 1) {
+//TODO FunctionPassManager *PM = CodeGenPasses =
+//TODO new FunctionPassManager(new ExistingModuleProvider(TheModule));
+//TODO PM->add(new TargetData(*TheTarget->getTargetData()));
+//TODO
+//TODO CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+//TODO
+//TODO switch (optimize) {
+//TODO default: break;
+//TODO case 0: OptLevel = CodeGenOpt::None; break;
+//TODO case 3: OptLevel = CodeGenOpt::Aggressive; break;
+//TODO }
+//TODO
+//TODO // Normal mode, emit a .s file by running the code generator.
+//TODO // Note, this also adds codegenerator level optimization passes.
+//TODO switch (TheTarget->addPassesToEmitFile(*PM, *AsmOutRawStream,
+//TODO TargetMachine::AssemblyFile,
+//TODO OptLevel)) {
+//TODO default:
+//TODO case FileModel::Error:
+//TODO cerr << "Error interfacing to target machine!\n";
+//TODO exit(1);
+//TODO case FileModel::AsmFile:
+//TODO break;
+//TODO }
+//TODO
+//TODO if (TheTarget->addPassesToEmitFileFinish(*PM, (MachineCodeEmitter *)0,
+//TODO OptLevel)) {
+//TODO cerr << "Error interfacing to target machine!\n";
+//TODO exit(1);
+//TODO }
+//TODO }
+//TODO }
+//TODO
+//TODO if (!HasPerModulePasses) {
+//TODO delete PerModulePasses;
+//TODO PerModulePasses = 0;
+//TODO }
+//TODO}
+//TODO
+//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);
+//TODO // FIXME: disentangle ostream madness here. Kill off ostream and FILE.
+//TODO AsmOutRawStream =
+//TODO new formatted_raw_ostream(*new raw_os_ostream(*AsmOutStream),
+//TODO formatted_raw_ostream::DELETE_STREAM);
+//TODO AsmOutFile = new OStream(*AsmOutStream);
+//TODO
+//TODO flag_llvm_pch_read = 0;
+//TODO
+//TODO if (emit_llvm_bc || emit_llvm)
+//TODO // Disable emission of .ident into the output file... which is completely
+//TODO // wrong for llvm/.bc emission cases.
+//TODO flag_no_ident = 1;
+//TODO
+//TODO // If writing to stdout, set binary mode.
+//TODO if (asm_out_file == stdout)
+//TODO sys::Program::ChangeStdoutToBinary();
+//TODO
+//TODO AttributeUsedGlobals.clear();
+//TODO timevar_pop(TV_LLVM_INIT);
+//TODO}
/// ConvertStructorsList - Convert a list of static ctors/dtors to an
/// initializer suitable for the llvm.global_[cd]tors globals.
@@ -847,174 +847,174 @@
Array, Name);
}
-// llvm_asm_file_end - Finish the .s file.
-void llvm_asm_file_end(void) {
- timevar_push(TV_LLVM_PERFILE);
- LLVMContext &Context = getGlobalContext();
-
- performLateBackendInitialization();
- createPerFunctionOptimizationPasses();
-
- if (flag_pch_file) {
- writeLLVMTypesStringTable();
- writeLLVMValues();
- }
-
- // Add an llvm.global_ctors global if needed.
- if (!StaticCtors.empty())
- CreateStructorsList(StaticCtors, "llvm.global_ctors");
- // Add an llvm.global_dtors global if needed.
- if (!StaticDtors.empty())
- CreateStructorsList(StaticDtors, "llvm.global_dtors");
-
- if (!AttributeUsedGlobals.empty()) {
- std::vector AUGs;
- const Type *SBP= Context.getPointerTypeUnqual(Type::Int8Ty);
- for (SmallSetVector::iterator AI = AttributeUsedGlobals.begin(),
- AE = AttributeUsedGlobals.end(); AI != AE; ++AI) {
- Constant *C = *AI;
- AUGs.push_back(TheFolder->CreateBitCast(C, SBP));
- }
-
- ArrayType *AT = Context.getArrayType(SBP, AUGs.size());
- Constant *Init = Context.getConstantArray(AT, AUGs);
- GlobalValue *gv = new GlobalVariable(*TheModule, AT, false,
- GlobalValue::AppendingLinkage, Init,
- "llvm.used");
- gv->setSection("llvm.metadata");
- AttributeUsedGlobals.clear();
- }
-
- // Add llvm.global.annotations
- if (!AttributeAnnotateGlobals.empty()) {
- Constant *Array = Context.getConstantArray(
- Context.getArrayType(AttributeAnnotateGlobals[0]->getType(),
- AttributeAnnotateGlobals.size()),
- AttributeAnnotateGlobals);
- GlobalValue *gv = new GlobalVariable(*TheModule, Array->getType(), false,
- GlobalValue::AppendingLinkage, Array,
- "llvm.global.annotations");
- gv->setSection("llvm.metadata");
- AttributeAnnotateGlobals.clear();
- }
-
- // Finish off the per-function pass.
- if (PerFunctionPasses)
- PerFunctionPasses->doFinalization();
-
- // Emit intermediate file before module level optimization passes are run.
- if (flag_debug_llvm_module_opt) {
-
- static PassManager *IntermediatePM = new PassManager();
- IntermediatePM->add(new TargetData(*TheTarget->getTargetData()));
-
- char asm_intermediate_out_filename[MAXPATHLEN];
- strcpy(&asm_intermediate_out_filename[0], asm_file_name);
- strcat(&asm_intermediate_out_filename[0],".0");
- FILE *asm_intermediate_out_file = fopen(asm_intermediate_out_filename, "w+b");
- AsmIntermediateOutStream = new oFILEstream(asm_intermediate_out_file);
- AsmIntermediateOutFile = new OStream(*AsmIntermediateOutStream);
- raw_ostream *AsmIntermediateRawOutStream =
- new raw_os_ostream(*AsmIntermediateOutStream);
- if (emit_llvm_bc)
- IntermediatePM->add(CreateBitcodeWriterPass(*AsmIntermediateOutStream));
- if (emit_llvm)
- IntermediatePM->add(createPrintModulePass(AsmIntermediateRawOutStream));
- IntermediatePM->run(*TheModule);
- AsmIntermediateRawOutStream->flush();
- delete AsmIntermediateRawOutStream;
- AsmIntermediateRawOutStream = 0;
- AsmIntermediateOutStream->flush();
- fflush(asm_intermediate_out_file);
- delete AsmIntermediateOutStream;
- AsmIntermediateOutStream = 0;
- delete AsmIntermediateOutFile;
- AsmIntermediateOutFile = 0;
- }
-
- // Run module-level optimizers, if any are present.
- createPerModuleOptimizationPasses();
- if (PerModulePasses)
- PerModulePasses->run(*TheModule);
-
- // Run the code generator, if present.
- if (CodeGenPasses) {
- CodeGenPasses->doInitialization();
- for (Module::iterator I = TheModule->begin(), E = TheModule->end();
- I != E; ++I)
- if (!I->isDeclaration())
- CodeGenPasses->run(*I);
- CodeGenPasses->doFinalization();
- }
-
- AsmOutRawStream->flush();
- AsmOutStream->flush();
- fflush(asm_out_file);
- delete AsmOutRawStream;
- AsmOutRawStream = 0;
- delete AsmOutStream;
- AsmOutStream = 0;
- delete AsmOutFile;
- AsmOutFile = 0;
- timevar_pop(TV_LLVM_PERFILE);
-}
-
-// llvm_call_llvm_shutdown - Release LLVM global state.
-void llvm_call_llvm_shutdown(void) {
- llvm_shutdown();
-}
-
-// llvm_emit_code_for_current_function - Top level interface for emitting a
-// function to the .s file.
-void llvm_emit_code_for_current_function(tree fndecl) {
- if (cfun->nonlocal_goto_save_area)
- sorry("%Jnon-local gotos not supported by LLVM", fndecl);
-
- if (errorcount || sorrycount) {
- TREE_ASM_WRITTEN(fndecl) = 1;
- return; // Do not process broken code.
- }
- timevar_push(TV_LLVM_FUNCS);
-
- // Convert the AST to raw/ugly LLVM code.
- Function *Fn;
- {
- TreeToLLVM Emitter(fndecl);
- enum symbol_visibility vis = DECL_VISIBILITY (fndecl);
-
- if (vis != VISIBILITY_DEFAULT)
- // "asm_out.visibility" emits an important warning if we're using a
- // visibility that's not supported by the target.
- targetm.asm_out.visibility(fndecl, vis);
-
- Fn = Emitter.EmitFunction();
- }
-
-#if 0
- if (dump_file) {
- fprintf (dump_file,
- "\n\n;;\n;; Full LLVM generated for this function:\n;;\n");
- Fn->dump();
- }
-#endif
-
- performLateBackendInitialization();
- createPerFunctionOptimizationPasses();
-
- if (PerFunctionPasses)
- PerFunctionPasses->run(*Fn);
-
- // TODO: Nuke the .ll code for the function at -O[01] if we don't want to
- // inline it or something else.
-
- // There's no need to defer outputting this function any more; we
- // know we want to output it.
- DECL_DEFER_OUTPUT(fndecl) = 0;
-
- // Finally, we have written out this function!
- TREE_ASM_WRITTEN(fndecl) = 1;
- timevar_pop(TV_LLVM_FUNCS);
-}
+//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();
+//TODO
+//TODO performLateBackendInitialization();
+//TODO createPerFunctionOptimizationPasses();
+//TODO
+//TODO if (flag_pch_file) {
+//TODO writeLLVMTypesStringTable();
+//TODO writeLLVMValues();
+//TODO }
+//TODO
+//TODO // Add an llvm.global_ctors global if needed.
+//TODO if (!StaticCtors.empty())
+//TODO CreateStructorsList(StaticCtors, "llvm.global_ctors");
+//TODO // Add an llvm.global_dtors global if needed.
+//TODO if (!StaticDtors.empty())
+//TODO CreateStructorsList(StaticDtors, "llvm.global_dtors");
+//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 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 GlobalValue *gv = new GlobalVariable(*TheModule, AT, false,
+//TODO GlobalValue::AppendingLinkage, Init,
+//TODO "llvm.used");
+//TODO gv->setSection("llvm.metadata");
+//TODO AttributeUsedGlobals.clear();
+//TODO }
+//TODO
+//TODO // Add llvm.global.annotations
+//TODO if (!AttributeAnnotateGlobals.empty()) {
+//TODO Constant *Array = Context.getConstantArray(
+//TODO Context.getArrayType(AttributeAnnotateGlobals[0]->getType(),
+//TODO AttributeAnnotateGlobals.size()),
+//TODO AttributeAnnotateGlobals);
+//TODO GlobalValue *gv = new GlobalVariable(*TheModule, Array->getType(), false,
+//TODO GlobalValue::AppendingLinkage, Array,
+//TODO "llvm.global.annotations");
+//TODO gv->setSection("llvm.metadata");
+//TODO AttributeAnnotateGlobals.clear();
+//TODO }
+//TODO
+//TODO // Finish off the per-function pass.
+//TODO if (PerFunctionPasses)
+//TODO PerFunctionPasses->doFinalization();
+//TODO
+//TODO // Emit intermediate file before module level optimization passes are run.
+//TODO if (flag_debug_llvm_module_opt) {
+//TODO
+//TODO static PassManager *IntermediatePM = new PassManager();
+//TODO IntermediatePM->add(new TargetData(*TheTarget->getTargetData()));
+//TODO
+//TODO char asm_intermediate_out_filename[MAXPATHLEN];
+//TODO strcpy(&asm_intermediate_out_filename[0], asm_file_name);
+//TODO strcat(&asm_intermediate_out_filename[0],".0");
+//TODO FILE *asm_intermediate_out_file = fopen(asm_intermediate_out_filename, "w+b");
+//TODO AsmIntermediateOutStream = new oFILEstream(asm_intermediate_out_file);
+//TODO AsmIntermediateOutFile = new OStream(*AsmIntermediateOutStream);
+//TODO raw_ostream *AsmIntermediateRawOutStream =
+//TODO new raw_os_ostream(*AsmIntermediateOutStream);
+//TODO if (emit_llvm_bc)
+//TODO IntermediatePM->add(CreateBitcodeWriterPass(*AsmIntermediateOutStream));
+//TODO if (emit_llvm)
+//TODO IntermediatePM->add(createPrintModulePass(AsmIntermediateRawOutStream));
+//TODO IntermediatePM->run(*TheModule);
+//TODO AsmIntermediateRawOutStream->flush();
+//TODO delete AsmIntermediateRawOutStream;
+//TODO AsmIntermediateRawOutStream = 0;
+//TODO AsmIntermediateOutStream->flush();
+//TODO fflush(asm_intermediate_out_file);
+//TODO delete AsmIntermediateOutStream;
+//TODO AsmIntermediateOutStream = 0;
+//TODO delete AsmIntermediateOutFile;
+//TODO AsmIntermediateOutFile = 0;
+//TODO }
+//TODO
+//TODO // Run module-level optimizers, if any are present.
+//TODO createPerModuleOptimizationPasses();
+//TODO if (PerModulePasses)
+//TODO PerModulePasses->run(*TheModule);
+//TODO
+//TODO // Run the code generator, if present.
+//TODO if (CodeGenPasses) {
+//TODO CodeGenPasses->doInitialization();
+//TODO for (Module::iterator I = TheModule->begin(), E = TheModule->end();
+//TODO I != E; ++I)
+//TODO if (!I->isDeclaration())
+//TODO CodeGenPasses->run(*I);
+//TODO CodeGenPasses->doFinalization();
+//TODO }
+//TODO
+//TODO AsmOutRawStream->flush();
+//TODO AsmOutStream->flush();
+//TODO fflush(asm_out_file);
+//TODO delete AsmOutRawStream;
+//TODO AsmOutRawStream = 0;
+//TODO delete AsmOutStream;
+//TODO AsmOutStream = 0;
+//TODO delete AsmOutFile;
+//TODO AsmOutFile = 0;
+//TODO timevar_pop(TV_LLVM_PERFILE);
+//TODO}
+//TODO
+//TODO// llvm_call_llvm_shutdown - Release LLVM global state.
+//TODOvoid llvm_call_llvm_shutdown(void) {
+//TODO llvm_shutdown();
+//TODO}
+//TODO
+//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);
+//TODO
+//TODO if (errorcount || sorrycount) {
+//TODO TREE_ASM_WRITTEN(fndecl) = 1;
+//TODO return; // Do not process broken code.
+//TODO }
+//TODO timevar_push(TV_LLVM_FUNCS);
+//TODO
+//TODO // Convert the AST to raw/ugly LLVM code.
+//TODO Function *Fn;
+//TODO {
+//TODO TreeToLLVM Emitter(fndecl);
+//TODO enum symbol_visibility vis = DECL_VISIBILITY (fndecl);
+//TODO
+//TODO if (vis != VISIBILITY_DEFAULT)
+//TODO // "asm_out.visibility" emits an important warning if we're using a
+//TODO // visibility that's not supported by the target.
+//TODO targetm.asm_out.visibility(fndecl, vis);
+//TODO
+//TODO Fn = Emitter.EmitFunction();
+//TODO }
+//TODO
+//TODO#if 0
+//TODO if (dump_file) {
+//TODO fprintf (dump_file,
+//TODO "\n\n;;\n;; Full LLVM generated for this function:\n;;\n");
+//TODO Fn->dump();
+//TODO }
+//TODO#endif
+//TODO
+//TODO performLateBackendInitialization();
+//TODO createPerFunctionOptimizationPasses();
+//TODO
+//TODO if (PerFunctionPasses)
+//TODO PerFunctionPasses->run(*Fn);
+//TODO
+//TODO // TODO: Nuke the .ll code for the function at -O[01] if we don't want to
+//TODO // inline it or something else.
+//TODO
+//TODO // There's no need to defer outputting this function any more; we
+//TODO // know we want to output it.
+//TODO DECL_DEFER_OUTPUT(fndecl) = 0;
+//TODO
+//TODO // Finally, we have written out this function!
+//TODO TREE_ASM_WRITTEN(fndecl) = 1;
+//TODO timevar_pop(TV_LLVM_FUNCS);
+//TODO}
// emit_alias_to_llvm - Given decl and target emit alias to target.
void emit_alias_to_llvm(tree decl, tree target, tree target_decl) {
@@ -1025,7 +1025,7 @@
LLVMContext &Context = getGlobalContext();
- timevar_push(TV_LLVM_GLOBALS);
+//TODO timevar_push(TV_LLVM_GLOBALS);
// Get or create LLVM global for our alias.
GlobalValue *V = cast(DECL_LLVM(decl));
@@ -1067,7 +1067,7 @@
assert(0 && "Unsuported global value");
} else {
error ("%J%qD aliased to undefined symbol %qs", decl, decl, AliaseeName);
- timevar_pop(TV_LLVM_GLOBALS);
+//TODO timevar_pop(TV_LLVM_GLOBALS);
return;
}
}
@@ -1076,7 +1076,7 @@
GlobalValue::LinkageTypes Linkage;
// A weak alias has TREE_PUBLIC set but not the other bits.
- if (DECL_LLVM_PRIVATE(decl))
+ if (false)//FIXME DECL_LLVM_PRIVATE(decl))
Linkage = GlobalValue::PrivateLinkage;
else if (DECL_WEAK(decl))
// The user may have explicitly asked for weak linkage - ignore flag_odr.
@@ -1095,7 +1095,7 @@
V->replaceAllUsesWith(Context.getConstantExprBitCast(GA, V->getType()));
else if (!V->use_empty()) {
error ("%J Alias %qD used with invalid type!", decl, decl);
- timevar_pop(TV_LLVM_GLOBALS);
+//TODO timevar_pop(TV_LLVM_GLOBALS);
return;
}
@@ -1112,7 +1112,7 @@
TREE_ASM_WRITTEN(decl) = 1;
- timevar_pop(TV_LLVM_GLOBALS);
+//TODO timevar_pop(TV_LLVM_GLOBALS);
return;
}
@@ -1287,7 +1287,7 @@
LLVMContext &Context = getGlobalContext();
- timevar_push(TV_LLVM_GLOBALS);
+//TODO timevar_push(TV_LLVM_GLOBALS);
// Get or create the global variable now.
GlobalVariable *GV = cast(DECL_LLVM(decl));
@@ -1341,7 +1341,7 @@
// Set the linkage.
GlobalValue::LinkageTypes Linkage = GV->getLinkage();
if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS)
- && DECL_LLVM_PRIVATE(decl)) {
+ && false) {// FIXME DECL_LLVM_PRIVATE(decl)) {
Linkage = GlobalValue::PrivateLinkage;
} else if (!TREE_PUBLIC(decl)) {
Linkage = GlobalValue::InternalLinkage;
@@ -1437,7 +1437,7 @@
}
TREE_ASM_WRITTEN(decl) = 1;
- timevar_pop(TV_LLVM_GLOBALS);
+//TODO timevar_pop(TV_LLVM_GLOBALS);
}
@@ -1526,7 +1526,7 @@
return;
}
- timevar_push(TV_LLVM_GLOBALS);
+//TODO timevar_push(TV_LLVM_GLOBALS);
const char *Name = "";
if (DECL_NAME(decl))
@@ -1702,7 +1702,7 @@
SET_DECL_LLVM(decl, GV);
}
- timevar_pop(TV_LLVM_GLOBALS);
+//TODO timevar_pop(TV_LLVM_GLOBALS);
}
/// llvm_get_decl_name - Used by varasm.c, returns the specified declaration's
From baldrick at free.fr Mon Jul 20 03:34:24 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:34:24 -0000
Subject: [llvm-commits] [gcc-plugin] r76410 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907200834.n6K8YPdg014759@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:34:20 2009
New Revision: 76410
URL: http://llvm.org/viewvc/llvm-project?rev=76410&view=rev
Log:
Remove some objc logic that is unlikely to ever
make sense in the plugin context.
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=76410&r1=76409&r2=76410&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:34:20 2009
@@ -1425,16 +1425,8 @@
// No debug info for globals when optimization is on. While this is
// something that would be accurate and useful to a user, it currently
// affects some optimizations that, e.g., count uses.
- if (TheDebugInfo && !optimize) {
- const char *Name = GV->getName().c_str();
- const char LPrefix[] = "\01L_OBJC_";
- const char lPrefix[] = "\01l_OBJC_";
-
- if (flag_objc_abi == -1 || flag_objc_abi == 0 ||
- (strncmp(Name, LPrefix, sizeof(LPrefix) - 1) != 0 &&
- strncmp(Name, lPrefix, sizeof(lPrefix) - 1) != 0))
- TheDebugInfo->EmitGlobalVariable(GV, decl);
- }
+ if (TheDebugInfo && !optimize)
+ TheDebugInfo->EmitGlobalVariable(GV, decl);
TREE_ASM_WRITTEN(decl) = 1;
//TODO timevar_pop(TV_LLVM_GLOBALS);
From baldrick at free.fr Mon Jul 20 03:37:17 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:37:17 -0000
Subject: [llvm-commits] [gcc-plugin] r76411 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907200837.n6K8bI1o014840@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:37:16 2009
New Revision: 76411
URL: http://llvm.org/viewvc/llvm-project?rev=76411&view=rev
Log:
We definitely will need some functionality like
this for debugging, but it will have to wait till
later.
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=76411&r1=76410&r2=76411&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:37:16 2009
@@ -1764,29 +1764,28 @@
string);
}
-
-// print_llvm - Print the specified LLVM chunk like an operand, called by
-// print-tree.c for tree dumps.
-//
-void print_llvm(FILE *file, void *LLVM) {
- oFILEstream FS(file);
- FS << "LLVM: ";
- WriteAsOperand(FS, (Value*)LLVM, true, TheModule);
-}
-
-// print_llvm_type - Print the specified LLVM type symbolically, called by
-// print-tree.c for tree dumps.
-//
-void print_llvm_type(FILE *file, void *LLVM) {
- oFILEstream FS(file);
- FS << "LLVM: ";
-
- // FIXME: oFILEstream can probably be removed in favor of a new raw_ostream
- // adaptor which would be simpler and more efficient. In the meantime, just
- // adapt the adaptor.
- raw_os_ostream RO(FS);
- WriteTypeSymbolic(RO, (const Type*)LLVM, TheModule);
-}
+//FIXME// print_llvm - Print the specified LLVM chunk like an operand, called by
+//FIXME// print-tree.c for tree dumps.
+//FIXME//
+//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//
+//FIXMEvoid print_llvm_type(FILE *file, void *LLVM) {
+//FIXME oFILEstream FS(file);
+//FIXME FS << "LLVM: ";
+//FIXME
+//FIXME // FIXME: oFILEstream can probably be removed in favor of a new raw_ostream
+//FIXME // adaptor which would be simpler and more efficient. In the meantime, just
+//FIXME // adapt the adaptor.
+//FIXME raw_os_ostream RO(FS);
+//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
From baldrick at free.fr Mon Jul 20 03:40:16 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:40:16 -0000
Subject: [llvm-commits] [gcc-plugin] r76412 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907200840.n6K8eIuw014933@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:40:10 2009
New Revision: 76412
URL: http://llvm.org/viewvc/llvm-project?rev=76412&view=rev
Log:
For the moment, all target stuff is completely
broken in the plugin.
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=76412&r1=76411&r2=76412&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:40:10 2009
@@ -340,19 +340,19 @@
}
}
-#ifndef LLVM_TARGET_NAME
-#error LLVM_TARGET_NAME macro not specified by GCC backend
-#endif
-
-namespace llvm {
-#define Declare2(TARG, MOD) extern "C" void LLVMInitialize ## TARG ## MOD()
-#define Declare(T, M) Declare2(T, M)
- Declare(LLVM_TARGET_NAME, TargetInfo);
- Declare(LLVM_TARGET_NAME, Target);
- Declare(LLVM_TARGET_NAME, AsmPrinter);
-#undef Declare
-#undef Declare2
-}
+//TODO#ifndef LLVM_TARGET_NAME
+//TODO#error LLVM_TARGET_NAME macro not specified by GCC backend
+//TODO#endif
+//TODO
+//TODOnamespace llvm {
+//TODO#define Declare2(TARG, MOD) extern "C" void LLVMInitialize ## TARG ## MOD()
+//TODO#define Declare(T, M) Declare2(T, M)
+//TODO Declare(LLVM_TARGET_NAME, TargetInfo);
+//TODO Declare(LLVM_TARGET_NAME, Target);
+//TODO Declare(LLVM_TARGET_NAME, AsmPrinter);
+//TODO#undef Declare
+//TODO#undef Declare2
+//TODO}
/// LazilyConfigureLLVM - Set LLVM configuration options, if not already set.
/// already created.
From baldrick at free.fr Mon Jul 20 03:50:47 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:50:47 -0000
Subject: [llvm-commits] [gcc-plugin] r76413 - in /gcc-plugin/trunk: Makefile
llvm-backend.cpp llvm-plugin.cpp
Message-ID: <200907200850.n6K8otEq015214@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:50:24 2009
New Revision: 76413
URL: http://llvm.org/viewvc/llvm-project?rev=76413&view=rev
Log:
Remove plugin logic to llvm-backend, now that this
compiles.
Removed:
gcc-plugin/trunk/llvm-plugin.cpp
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=76413&r1=76412&r2=76413&view=diff
==============================================================================
--- gcc-plugin/trunk/Makefile (original)
+++ gcc-plugin/trunk/Makefile Mon Jul 20 03:50:24 2009
@@ -1,4 +1,4 @@
-PLUGIN_SOURCE_FILES=llvm-convert.cpp llvm-debug.cpp llvm-plugin.cpp llvm-types.cpp
+PLUGIN_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp llvm-types.cpp
PLUGIN_OBJECT_FILES=$(patsubst %.cpp,%.o,$(PLUGIN_SOURCE_FILES))
#GCCPLUGIN_DIR:=$(shell $(GCC) -print-file-name=plugin)
@@ -15,7 +15,7 @@
-I${GCCSOURCE_DIR}/libcpp/include -I${GCCSOURCE_DIR}/libdecnumber \
-I${GCCOBJECT_DIR}/libdecnumber
-LDFLAGS+=$(shell llvm-config --ldflags) $(shell llvm-config --libs core target)
+LDFLAGS+=$(shell llvm-config --ldflags) $(shell llvm-config --libs analysis core target)
llvm.so: $(PLUGIN_OBJECT_FILES)
$(CXX) -shared $^ -o $@ ${LDFLAGS}
Modified: gcc-plugin/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=76413&r1=76412&r2=76413&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:50:24 2009
@@ -65,18 +65,23 @@
#include "target.h"
#include "tree.h"
-#include "flags.h"
+#include "cgraph.h"
#include "diagnostic.h"
-#include "output.h"
-#include "toplev.h"
-#include "timevar.h"
-#include "tm.h"
+#include "flags.h"
#include "function.h"
-#include "tree-inline.h"
+#include "gcc-plugin.h"
+extern "C" {
+#include "intl.h"
+}
#include "langhooks.h"
-#include "cgraph.h"
+#include "output.h"
#include "params.h"
#include "plugin-version.h"
+#include "tm.h"
+#include "toplev.h"
+#include "tree-inline.h"
+#include "tree-flow.h"
+#include "tree-pass.h"
// Plugin headers
#include "llvm-internal.h"
@@ -1795,3 +1800,205 @@
const char* Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl));
return (*Name==1) ? Name+1 : Name;
}
+
+
+//===----------------------------------------------------------------------===//
+// Plugin interface
+//===----------------------------------------------------------------------===//
+
+// This plugin's code is licensed under the GPLv2. The LLVM libraries use
+// the GPL compatible University of Illinois/NCSA Open Source License.
+int plugin_is_GPL_compatible; // This plugin is GPL compatible.
+
+/// execute_emit_llvm - Turn a gimple function into LLVM IR.
+static unsigned int
+execute_emit_llvm (void)
+{
+//TODO Don't want to use sorry at this stage...
+//TODO if (cfun->nonlocal_goto_save_area)
+//TODO sorry("%Jnon-local gotos not supported by LLVM", fndecl);
+
+//TODO Do we want to do this? Will the warning set sorry_count etc?
+//TODO enum symbol_visibility vis = DECL_VISIBILITY (current_function_decl);
+//TODO
+//TODO if (vis != VISIBILITY_DEFAULT)
+//TODO // "asm_out.visibility" emits an important warning if we're using a
+//TODO // visibility that's not supported by the target.
+//TODO targetm.asm_out.visibility(current_function_decl, vis);
+
+ // There's no need to defer outputting this function any more; we
+ // know we want to output it.
+ DECL_DEFER_OUTPUT(current_function_decl) = 0;
+
+ // Convert the AST to raw/ugly LLVM code.
+//FIXME TreeToLLVM Emitter(current_function_decl);
+cout << "Yo!\n";
+
+//TODO#if 0
+//TODO if (dump_file) {
+//TODO fprintf (dump_file,
+//TODO "\n\n;;\n;; Full LLVM generated for this function:\n;;\n");
+//TODO Fn->dump();
+//TODO }
+//TODO#endif
+//TODO
+//TODO performLateBackendInitialization();
+//TODO createPerFunctionOptimizationPasses();
+//TODO
+//TODO if (PerFunctionPasses)
+//TODO PerFunctionPasses->run(*Fn);
+//TODO
+//TODO // TODO: Nuke the .ll code for the function at -O[01] if we don't want to
+//TODO // inline it or something else.
+
+ // Finally, we have written out this function!
+ TREE_ASM_WRITTEN(current_function_decl) = 1;
+
+ execute_free_datastructures ();
+ return 0;
+}
+
+/// pass_emit_llvm - RTL pass that turns gimple functions into LLVM IR.
+static struct rtl_opt_pass pass_emit_llvm =
+{
+ {
+ RTL_PASS,
+ "emit_llvm", /* name */
+ NULL, /* gate */
+ execute_emit_llvm, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_EXPAND, /* tv_id */
+ PROP_gimple_lcf | 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_ggc_collect /* todo_flags_finish */
+ }
+};
+
+
+/// gate_null - Gate method for a pass that does nothing.
+static bool
+gate_null (void)
+{
+ return false;
+}
+
+
+/// pass_gimple_null - Gimple pass that does nothing.
+static struct gimple_opt_pass pass_gimple_null =
+{
+ {
+ GIMPLE_PASS,
+ NULL, /* name */
+ gate_null, /* gate */
+ NULL, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_NONE, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+ }
+};
+
+/// pass_rtl_null - RTL pass that does nothing.
+static struct rtl_opt_pass pass_rtl_null =
+{
+ {
+ RTL_PASS,
+ NULL, /* name */
+ gate_null, /* gate */
+ NULL, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_NONE, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+ }
+};
+
+/// plugin_init - The initialization routine called by GCC. Defined in
+/// gcc-plugin.h.
+int plugin_init (struct plugin_name_args *plugin_info,
+ struct plugin_gcc_version *version) {
+ const char *plugin_name = plugin_info->base_name;
+ bool disable_gcc_optimizations = true;
+ struct plugin_pass pass_info;
+
+ // Check that the running gcc is the same as the gcc we were built against.
+ // If not, refuse to load. This seems wise when developing against a fast
+ // moving gcc tree.
+ // TODO: Make the check milder if doing a "release build".
+ if (!plugin_default_version_check (version, &gcc_version)) {
+ // TODO: calling a gcc routine when there is a version mismatch is
+ // dangerous. On the other hand, failing without an explanation is
+ // obscure. Could send a message to std::cerr instead, but bypassing
+ // the gcc error reporting and translating mechanism is kind of sucky.
+ error(G_("plugin %qs: gcc version mismatch"), plugin_name);
+ return 1;
+ }
+
+ // Process any plugin arguments.
+ {
+ int argc = plugin_info->argc;
+ struct plugin_argument *argv = plugin_info->argv;
+
+ for (int i = 0; i < argc; ++i) {
+ if (!strcmp (argv[i].key, "enable-gcc-optzns")) {
+ if (argv[i].value)
+ warning (0, G_("option '-fplugin-arg-%s-%s=%s' ignored"
+ " (superfluous '=%s')"),
+ plugin_name, argv[i].key, argv[i].value, argv[i].value);
+ else
+ disable_gcc_optimizations = false;
+ } else {
+ warning (0, G_("plugin %qs: unrecognized argument %qs ignored"),
+ plugin_name, argv[i].key);
+ }
+ }
+ }
+
+ // Replace rtl expansion with gimple to LLVM conversion.
+ pass_info.pass = &pass_emit_llvm.pass;
+ pass_info.reference_pass_name = "expand";
+ pass_info.ref_pass_instance_number = 0;
+ pass_info.pos_op = PASS_POS_REPLACE;
+ register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
+
+ // Turn off all rtl passes.
+ pass_info.pass = &pass_gimple_null.pass;
+ pass_info.reference_pass_name = "*rest_of_compilation";
+ pass_info.ref_pass_instance_number = 0;
+ pass_info.pos_op = PASS_POS_REPLACE;
+ register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
+
+ pass_info.pass = &pass_rtl_null.pass;
+ pass_info.reference_pass_name = "*clean_state";
+ pass_info.ref_pass_instance_number = 0;
+ pass_info.pos_op = PASS_POS_REPLACE;
+ register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
+
+ if (disable_gcc_optimizations) {
+ // Turn off all gcc optimization passes.
+ // TODO: figure out a good way of turning off ipa passes.
+ pass_info.pass = &pass_gimple_null.pass;
+ pass_info.reference_pass_name = "*all_optimizations";
+ pass_info.ref_pass_instance_number = 0;
+ pass_info.pos_op = PASS_POS_REPLACE;
+ register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
+ }
+
+ return 0;
+}
Removed: gcc-plugin/trunk/llvm-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-plugin.cpp?rev=76412&view=auto
==============================================================================
--- gcc-plugin/trunk/llvm-plugin.cpp (original)
+++ gcc-plugin/trunk/llvm-plugin.cpp (removed)
@@ -1,438 +0,0 @@
-/* LLVM plugin for gcc
- Copyright (C) 2009 Free Software Foundation, Inc.
-
-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 see
-. */
-
-// LLVM headers
-#include "llvm/LLVMContext.h"
-#include "llvm/Module.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/IRBuilder.h"
-#include "llvm/Support/TargetFolder.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetRegistry.h"
-
-// System headers
-#include
-#include
-
-// GCC headers
-#undef VISIBILITY_HIDDEN
-#define IN_GCC
-
-extern "C" {
-#include "intl.h"
-}
-#include "gcc-plugin.h"
-#include "plugin-version.h"
-#include "coretypes.h"
-#include "target.h"
-#include "flags.h"
-#include "toplev.h"
-#include "tree.h"
-#include "tree-flow.h"
-#include "tree-pass.h"
-
-// Plugin headers
-#include "llvm-internal.h"
-
-using namespace llvm;
-
-// This plugin's code is licensed under the GPLv2. The LLVM libraries use
-// the GPL compatible University of Illinois/NCSA Open Source License.
-int plugin_is_GPL_compatible; // This plugin is GPL compatible.
-
-
-// Global state for emitting LLVM IR.
-DebugInfo *TheDebugInfo = 0;
-TargetFolder *TheFolder = 0;
-Module *TheModule = 0;
-TargetMachine *TheTarget = 0;
-TypeConverter *TheTypeConverter = 0;
-
-SmallSetVector AttributeUsedGlobals;
-
-/// LazilyConfigureLLVM - Set LLVM configuration options, if not already set.
-/// already created.
-static void LazilyConfigureLLVM(void) {
- static bool Configured = false;
- if (Configured)
- return;
-
- // Initialize LLVM command line options.
- std::vector Args;
- Args.push_back(progname); // program name
-
-//TODO // Allow targets to specify PIC options and other stuff to the corresponding
-//TODO // LLVM backends.
-//TODO#ifdef LLVM_SET_RED_ZONE_FLAG
-//TODO LLVM_SET_RED_ZONE_FLAG(flag_disable_red_zone)
-//TODO#endif
-//TODO#ifdef LLVM_SET_TARGET_OPTIONS
-//TODO LLVM_SET_TARGET_OPTIONS(Args);
-//TODO#endif
-//TODO#ifdef LLVM_SET_MACHINE_OPTIONS
-//TODO LLVM_SET_MACHINE_OPTIONS(Args);
-//TODO#endif
-//TODO#ifdef LLVM_SET_IMPLICIT_FLOAT
-//TODO LLVM_SET_IMPLICIT_FLOAT(flag_no_implicit_float)
-//TODO#endif
-
- if (time_report)
- Args.push_back("--time-passes");
- if (fast_math_flags_set_p())
- Args.push_back("--enable-unsafe-fp-math");
- if (!flag_omit_frame_pointer)
- Args.push_back("--disable-fp-elim");
- if (!flag_zero_initialized_in_bss)
- Args.push_back("--nozero-initialized-in-bss");
- if (flag_debug_asm)
- Args.push_back("--asm-verbose");
-//TODO if (flag_debug_pass_structure)
-//TODO Args.push_back("--debug-pass=Structure");
-//TODO if (flag_debug_pass_arguments)
-//TODO 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");
-
-//TODO // If there are options that should be passed through to the LLVM backend
-//TODO // directly from the command line, do so now. This is mainly for debugging
-//TODO // purposes, and shouldn't really be for general use.
-//TODO std::vector ArgStrings;
-//TODO
-//TODO if (flag_limited_precision > 0) {
-//TODO std::string Arg("--limit-float-precision="+utostr(flag_limited_precision));
-//TODO ArgStrings.push_back(Arg);
-//TODO }
-//TODO
-//TODO if (flag_stack_protect > 0) {
-//TODO std::string Arg("--stack-protector-buffer-size=" +
-//TODO utostr(PARAM_VALUE(PARAM_SSP_BUFFER_SIZE)));
-//TODO ArgStrings.push_back(Arg);
-//TODO }
-//TODO
-//TODO for (unsigned i = 0, e = ArgStrings.size(); i != e; ++i)
-//TODO Args.push_back(ArgStrings[i].c_str());
-//TODO
-//TODO std::vector LLVM_Optns; // Avoid deallocation before opts parsed!
-//TODO if (llvm_optns) {
-//TODO SplitString(llvm_optns, LLVM_Optns);
-//TODO for(unsigned i = 0, e = LLVM_Optns.size(); i != e; ++i)
-//TODO Args.push_back(LLVM_Optns[i].c_str());
-//TODO }
-
- Args.push_back(0); // Null terminator.
- int pseudo_argc = Args.size()-1;
- llvm::cl::ParseCommandLineOptions(pseudo_argc, (char**)&Args[0]);
-
- Configured = true;
-}
-
-/// LazilyInitializeModule - Create a module to output LLVM IR to, if it wasn't
-/// already created.
-static void LazilyInitializeModule(void) {
- static bool Initialized = false;
- if (Initialized)
- return;
-
- LazilyConfigureLLVM;
-
- TheModule = new Module("", getGlobalContext());
-
- // 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
- 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;
- const Target *TME =
- TargetRegistry::getClosestStaticTargetForModule(*TheModule, Err);
- if (!TME) {
- cerr << "Did not get a target machine! Triplet is " << TargetTriple << '\n';
- exit(1);
- }
-
- // Figure out the subtarget feature string we pass to the target.
- std::string FeatureStr;
-//TODO // The target can set LLVM_SET_SUBTARGET_FEATURES to configure the LLVM
-//TODO // backend.
-//TODO#ifdef LLVM_SET_SUBTARGET_FEATURES
-//TODO SubtargetFeatures Features;
-//TODO LLVM_SET_SUBTARGET_FEATURES(Features);
-//TODO FeatureStr = Features.getString();
-//TODO#endif
- TheTarget = TME->createTargetMachine(*TheModule, FeatureStr);
- assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN);
-
- TheFolder = new TargetFolder(TheTarget->getTargetData(), getGlobalContext());
-
- // Install information about target datalayout stuff into the module for
- // optimizer use.
- TheModule->setDataLayout(TheTarget->getTargetData()->
- getStringRepresentation());
-
-//TODO if (optimize)
-//TODO RegisterRegAlloc::setDefault(createLinearScanRegisterAllocator);
-//TODO else
-//TODO RegisterRegAlloc::setDefault(createLocalRegisterAllocator);
-
-//TODO // FIXME - Do not disable debug info while writing pch.
-//TODO if (!flag_pch_file &&
-//TODO debug_info_level > DINFO_LEVEL_NONE)
-//TODO TheDebugInfo = new DebugInfo(TheModule);
-//TODO}
-//TODO
-//TODO/// Set backend options that may only be 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 for (Module::iterator I = TheModule->begin(), E = TheModule->end();
-//TODO I != E; ++I)
-//TODO if (!I->isDeclaration()) {
-//TODO if (flag_disable_red_zone)
-//TODO I->addFnAttr(Attribute::NoRedZone);
-//TODO if (flag_no_implicit_float)
-//TODO I->addFnAttr(Attribute::NoImplicitFloat);
-//TODO }
-//TODO}
-//TODO
-//TODOvoid llvm_lang_dependent_init(const char *Name) {
-//TODO if (TheDebugInfo)
-//TODO TheDebugInfo->Initialize();
-//TODO if (Name)
-//TODO TheModule->setModuleIdentifier(Name);
-//TODO}
- Initialized = true;
-}
-
-/// execute_emit_llvm - Turn a gimple function into LLVM IR.
-static unsigned int
-execute_emit_llvm (void)
-{
-//TODO Don't want to use sorry at this stage...
-//TODO if (cfun->nonlocal_goto_save_area)
-//TODO sorry("%Jnon-local gotos not supported by LLVM", fndecl);
-
-//TODO Do we want to do this? Will the warning set sorry_count etc?
-//TODO enum symbol_visibility vis = DECL_VISIBILITY (current_function_decl);
-//TODO
-//TODO if (vis != VISIBILITY_DEFAULT)
-//TODO // "asm_out.visibility" emits an important warning if we're using a
-//TODO // visibility that's not supported by the target.
-//TODO targetm.asm_out.visibility(current_function_decl, vis);
-
- // There's no need to defer outputting this function any more; we
- // know we want to output it.
- DECL_DEFER_OUTPUT(current_function_decl) = 0;
-
- // Convert the AST to raw/ugly LLVM code.
-//FIXME TreeToLLVM Emitter(current_function_decl);
-cout << "Yo!\n";
-
-//TODO#if 0
-//TODO if (dump_file) {
-//TODO fprintf (dump_file,
-//TODO "\n\n;;\n;; Full LLVM generated for this function:\n;;\n");
-//TODO Fn->dump();
-//TODO }
-//TODO#endif
-//TODO
-//TODO performLateBackendInitialization();
-//TODO createPerFunctionOptimizationPasses();
-//TODO
-//TODO if (PerFunctionPasses)
-//TODO PerFunctionPasses->run(*Fn);
-//TODO
-//TODO // TODO: Nuke the .ll code for the function at -O[01] if we don't want to
-//TODO // inline it or something else.
-
- // Finally, we have written out this function!
- TREE_ASM_WRITTEN(current_function_decl) = 1;
-
- execute_free_datastructures ();
- return 0;
-}
-
-/// pass_emit_llvm - RTL pass that turns gimple functions into LLVM IR.
-static struct rtl_opt_pass pass_emit_llvm =
-{
- {
- RTL_PASS,
- "emit_llvm", /* name */
- NULL, /* gate */
- execute_emit_llvm, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_EXPAND, /* tv_id */
- PROP_gimple_lcf | 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_ggc_collect /* todo_flags_finish */
- }
-};
-
-
-/// gate_null - Gate method for a pass that does nothing.
-static bool
-gate_null (void)
-{
- return false;
-}
-
-
-/// pass_gimple_null - Gimple pass that does nothing.
-static struct gimple_opt_pass pass_gimple_null =
-{
- {
- GIMPLE_PASS,
- NULL, /* name */
- gate_null, /* gate */
- NULL, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_NONE, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0 /* todo_flags_finish */
- }
-};
-
-/// pass_rtl_null - RTL pass that does nothing.
-static struct rtl_opt_pass pass_rtl_null =
-{
- {
- RTL_PASS,
- NULL, /* name */
- gate_null, /* gate */
- NULL, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_NONE, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0 /* todo_flags_finish */
- }
-};
-
-/// plugin_init - The initialization routine called by GCC. Defined in
-/// gcc-plugin.h.
-int plugin_init (struct plugin_name_args *plugin_info,
- struct plugin_gcc_version *version) {
- const char *plugin_name = plugin_info->base_name;
- bool disable_gcc_optimizations = true;
- struct plugin_pass pass_info;
-
- // Check that the running gcc is the same as the gcc we were built against.
- // If not, refuse to load. This seems wise when developing against a fast
- // moving gcc tree.
- // TODO: Make the check milder if doing a "release build".
- if (!plugin_default_version_check (version, &gcc_version)) {
- // TODO: calling a gcc routine when there is a version mismatch is
- // dangerous. On the other hand, failing without an explanation is
- // obscure. Could send a message to std::cerr instead, but bypassing
- // the gcc error reporting and translating mechanism is kind of sucky.
- error(G_("plugin %qs: gcc version mismatch"), plugin_name);
- return 1;
- }
-
- // Process any plugin arguments.
- {
- int argc = plugin_info->argc;
- struct plugin_argument *argv = plugin_info->argv;
-
- for (int i = 0; i < argc; ++i) {
- if (!strcmp (argv[i].key, "enable-gcc-optzns")) {
- if (argv[i].value)
- warning (0, G_("option '-fplugin-arg-%s-%s=%s' ignored"
- " (superfluous '=%s')"),
- plugin_name, argv[i].key, argv[i].value, argv[i].value);
- else
- disable_gcc_optimizations = false;
- } else {
- warning (0, G_("plugin %qs: unrecognized argument %qs ignored"),
- plugin_name, argv[i].key);
- }
- }
- }
-
- // Replace rtl expansion with gimple to LLVM conversion.
- pass_info.pass = &pass_emit_llvm.pass;
- pass_info.reference_pass_name = "expand";
- pass_info.ref_pass_instance_number = 0;
- pass_info.pos_op = PASS_POS_REPLACE;
- register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
-
- // Turn off all rtl passes.
- pass_info.pass = &pass_gimple_null.pass;
- pass_info.reference_pass_name = "*rest_of_compilation";
- pass_info.ref_pass_instance_number = 0;
- pass_info.pos_op = PASS_POS_REPLACE;
- register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
-
- pass_info.pass = &pass_rtl_null.pass;
- pass_info.reference_pass_name = "*clean_state";
- pass_info.ref_pass_instance_number = 0;
- pass_info.pos_op = PASS_POS_REPLACE;
- register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
-
- if (disable_gcc_optimizations) {
- // Turn off all gcc optimization passes.
- // TODO: figure out a good way of turning off ipa passes.
- pass_info.pass = &pass_gimple_null.pass;
- pass_info.reference_pass_name = "*all_optimizations";
- pass_info.ref_pass_instance_number = 0;
- pass_info.pos_op = PASS_POS_REPLACE;
- register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
- }
-
- return 0;
-}
From bruno.cardoso at gmail.com Mon Jul 20 03:52:07 2009
From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
Date: Mon, 20 Jul 2009 08:52:07 -0000
Subject: [llvm-commits] [llvm] r76414 - in /llvm/trunk:
include/llvm/Target/TargetELFWriterInfo.h lib/CodeGen/ELFWriter.cpp
lib/CodeGen/ELFWriter.h lib/Target/X86/X86ELFWriterInfo.cpp
lib/Target/X86/X86ELFWriterInfo.h
Message-ID: <200907200852.n6K8q9ZQ015283@zion.cs.uiuc.edu>
Author: bruno
Date: Mon Jul 20 03:52:02 2009
New Revision: 76414
URL: http://llvm.org/viewvc/llvm-project?rev=76414&view=rev
Log:
For PC relative relocations where symbols are defined in the same section they
are referenced, ignore the relocation entry and patch the relocatable field with
the computed symbol offset directly
Modified:
llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h
llvm/trunk/lib/CodeGen/ELFWriter.cpp
llvm/trunk/lib/CodeGen/ELFWriter.h
llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp
llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h?rev=76414&r1=76413&r2=76414&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h Mon Jul 20 03:52:02 2009
@@ -105,16 +105,25 @@
/// ELF relocation entry.
virtual bool hasRelocationAddend() const = 0;
- /// getAddendForRelTy - Gets the addend value for an ELF relocation entry
- /// based on the target relocation type. If addend is not used returns 0.
+ /// getDefaultAddendForRelTy - Gets the default addend value for a
+ /// relocation entry based on the target ELF relocation type.
virtual long int getDefaultAddendForRelTy(unsigned RelTy) const = 0;
/// getRelTySize - Returns the size of relocatable field in bits
virtual unsigned getRelocationTySize(unsigned RelTy) const = 0;
+ /// isPCRelativeRel - True if the relocation type is pc relative
+ virtual bool isPCRelativeRel(unsigned RelTy) const = 0;
+
/// getJumpTableRelocationTy - Returns the machine relocation type used
/// to reference a jumptable.
virtual unsigned getAbsoluteLabelMachineRelTy() const = 0;
+
+ /// computeRelocation - Some relocatable fields could be relocated
+ /// directly, avoiding the emission of a relocation symbol, compute the
+ /// final relocation value for this symbol.
+ virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset,
+ unsigned RelTy) const = 0;
};
} // end llvm namespace
Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=76414&r1=76413&r2=76414&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Mon Jul 20 03:52:02 2009
@@ -145,7 +145,7 @@
return false;
}
-/// Get jump table section on the section name returned by TAI
+// Get jump table section on the section name returned by TAI
ELFSection &ELFWriter::getJumpTableSection() {
unsigned Align = TM.getTargetData()->getPointerABIAlignment();
return getSection(TAI->getJumpTableDataSection(),
@@ -153,7 +153,7 @@
ELFSection::SHF_ALLOC, Align);
}
-/// Get a constant pool section based on the section name returned by TAI
+// Get a constant pool section based on the section name returned by TAI
ELFSection &ELFWriter::getConstantPoolSection(MachineConstantPoolEntry &CPE) {
std::string CstPoolName =
TAI->SelectSectionForMachineConst(CPE.getType())->getName();
@@ -163,6 +163,19 @@
CPE.getAlignment());
}
+// Return the relocation section of section 'S'. 'RelA' is true
+// if the relocation section contains entries with addends.
+ELFSection &ELFWriter::getRelocSection(ELFSection &S) {
+ unsigned SectionHeaderTy = TEW->hasRelocationAddend() ?
+ ELFSection::SHT_RELA : ELFSection::SHT_REL;
+ std::string RelSName(".rel");
+ if (TEW->hasRelocationAddend())
+ RelSName.append("a");
+ RelSName.append(S.getName());
+
+ return getSection(RelSName, SectionHeaderTy, 0, TEW->getPrefELFAlignment());
+}
+
// getGlobalELFVisibility - Returns the ELF specific visibility type
unsigned ELFWriter::getGlobalELFVisibility(const GlobalValue *GV) {
switch (GV->getVisibility()) {
@@ -474,20 +487,32 @@
return false;
}
+// RelocateField - Patch relocatable field with 'Offset' in 'BO'
+// using a 'Value' of known 'Size'
+void ELFWriter::RelocateField(BinaryObject &BO, uint32_t Offset,
+ int64_t Value, unsigned Size) {
+ if (Size == 32)
+ BO.fixWord32(Value, Offset);
+ else if (Size == 64)
+ BO.fixWord64(Value, Offset);
+ else
+ llvm_unreachable("don't know howto patch relocatable field");
+}
+
/// EmitRelocations - Emit relocations
void ELFWriter::EmitRelocations() {
+ // True if the target uses the relocation entry to hold the addend,
+ // otherwise the addend is written directly to the relocatable field.
+ bool HasRelA = TEW->hasRelocationAddend();
+
// Create Relocation sections for each section which needs it.
for (unsigned i=0, e=SectionList.size(); i != e; ++i) {
ELFSection &S = *SectionList[i];
// This section does not have relocations
if (!S.hasRelocations()) continue;
-
- // Get the relocation section for section 'S'
- bool HasRelA = TEW->hasRelocationAddend();
- ELFSection &RelSec = getRelocSection(S.getName(), HasRelA,
- TEW->getPrefELFAlignment());
+ ELFSection &RelSec = getRelocSection(S);
// 'Link' - Section hdr idx of the associated symbol table
// 'Info' - Section hdr idx of the section to which the relocation applies
@@ -502,18 +527,15 @@
MRE = Relos.end(); MRI != MRE; ++MRI) {
MachineRelocation &MR = *MRI;
- // Holds the relocatable field address as an offset from the
- // beginning of the section where it lives
- unsigned Offset = MR.getMachineCodeOffset();
+ // Relocatable field offset from the section start
+ unsigned RelOffset = MR.getMachineCodeOffset();
// Symbol index in the symbol table
unsigned SymIdx = 0;
- // Target specific ELF relocation type
+ // Target specific relocation field type and size
unsigned RelType = TEW->getRelocationType(MR.getRelocationType());
-
- // Constant addend used to compute the value to be stored
- // into the relocatable field
+ unsigned RelTySize = TEW->getRelocationTySize(RelType);
int64_t Addend = 0;
// There are several machine relocations types, and each one of
@@ -533,29 +555,33 @@
} else {
// Get the symbol index for the section symbol
unsigned SectionIdx = MR.getConstantVal();
+ SymIdx = SectionList[SectionIdx]->getSymbolTableIndex();
+ Addend = (uint64_t)MR.getResultPointer();
+
+ // For pc relative relocations where symbols are defined in the same
+ // section they are referenced, ignore the relocation entry and patch
+ // the relocatable field with the symbol offset directly.
+ if (S.SectionIdx == SectionIdx && TEW->isPCRelativeRel(RelType)) {
+ int64_t Value = TEW->computeRelocation(Addend, RelOffset, RelType);
+ RelocateField(S, RelOffset, Value, RelTySize);
+ continue;
+ }
// Handle Jump Table Index relocation
if ((SectionIdx == getJumpTableSection().SectionIdx) &&
- TEW->hasCustomJumpTableIndexRelTy())
+ TEW->hasCustomJumpTableIndexRelTy()) {
RelType = TEW->getJumpTableIndexRelTy();
-
- SymIdx = SectionList[SectionIdx]->getSymbolTableIndex();
- Addend = (uint64_t)MR.getResultPointer();
+ RelTySize = TEW->getRelocationTySize(RelType);
+ }
}
// The target without addend on the relocation symbol must be
// patched in the relocation place itself to contain the addend
- if (!HasRelA) {
- if (TEW->getRelocationTySize(RelType) == 32)
- S.fixWord32(Addend, Offset);
- else if (TEW->getRelocationTySize(RelType) == 64)
- S.fixWord64(Addend, Offset);
- else
- llvm_unreachable("don't know howto patch relocatable field");
- }
+ if (!HasRelA)
+ RelocateField(S, RelOffset, Addend, RelTySize);
// Get the relocation entry and emit to the relocation section
- ELFRelocation Rel(Offset, SymIdx, RelType, HasRelA, Addend);
+ ELFRelocation Rel(RelOffset, SymIdx, RelType, HasRelA, Addend);
EmitRelocation(RelSec, Rel, HasRelA);
}
}
Modified: llvm/trunk/lib/CodeGen/ELFWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.h?rev=76414&r1=76413&r2=76414&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ELFWriter.h (original)
+++ llvm/trunk/lib/CodeGen/ELFWriter.h Mon Jul 20 03:52:02 2009
@@ -171,18 +171,6 @@
ELFSection::SHF_EXECINSTR | ELFSection::SHF_ALLOC);
}
- /// Return the relocation section of section 'S'. 'RelA' is true
- /// if the relocation section contains entries with addends.
- ELFSection &getRelocSection(std::string SName, bool RelA, unsigned Align) {
- std::string RelSName(".rel");
- unsigned SHdrTy = RelA ? ELFSection::SHT_RELA : ELFSection::SHT_REL;
-
- if (RelA) RelSName.append("a");
- RelSName.append(SName);
-
- return getSection(RelSName, SHdrTy, 0, Align);
- }
-
ELFSection &getNonExecStackSection() {
return getSection(".note.GNU-stack", ELFSection::SHT_PROGBITS, 0, 1);
}
@@ -215,6 +203,7 @@
ELFSection &getJumpTableSection();
ELFSection &getConstantPoolSection(MachineConstantPoolEntry &CPE);
+ ELFSection &getRelocSection(ELFSection &S);
// Helpers for obtaining ELF specific info.
unsigned getGlobalELFBinding(const GlobalValue *GV);
@@ -244,6 +233,8 @@
void EmitSymbolTable();
void EmitStringTable();
void OutputSectionsAndSectionTable();
+ void RelocateField(BinaryObject &BO, uint32_t Offset, int64_t Value,
+ unsigned Size);
unsigned SortSymbols();
};
}
Modified: llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp?rev=76414&r1=76413&r2=76414&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp Mon Jul 20 03:52:02 2009
@@ -103,8 +103,44 @@
return 0;
}
+bool X86ELFWriterInfo::isPCRelativeRel(unsigned RelTy) const {
+ if (is64Bit) {
+ switch(RelTy) {
+ case R_X86_64_PC32:
+ return true;
+ case R_X86_64_32:
+ case R_X86_64_32S:
+ case R_X86_64_64:
+ return false;
+ default:
+ llvm_unreachable("unknown x86_64 relocation type");
+ }
+ } else {
+ switch(RelTy) {
+ case R_386_PC32:
+ return true;
+ case R_386_32:
+ return false;
+ default:
+ llvm_unreachable("unknown x86 relocation type");
+ }
+ }
+ return 0;
+}
+
unsigned X86ELFWriterInfo::getAbsoluteLabelMachineRelTy() const {
return is64Bit ?
X86::reloc_absolute_dword : X86::reloc_absolute_word;
}
+long int X86ELFWriterInfo::computeRelocation(unsigned SymOffset,
+ unsigned RelOffset,
+ unsigned RelTy) const {
+
+ if (RelTy == R_X86_64_PC32 || RelTy == R_386_PC32)
+ return SymOffset - (RelOffset + 4);
+ else
+ assert("computeRelocation unknown for this relocation type");
+
+ return 0;
+}
Modified: llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h?rev=76414&r1=76413&r2=76414&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h Mon Jul 20 03:52:02 2009
@@ -59,16 +59,25 @@
/// for a jump table index.
virtual unsigned getJumpTableIndexRelTy() const { return R_X86_64_32S; }
- /// getAddendForRelTy - Gets the addend value for an ELF relocation entry
- /// based on the target relocation type
+ /// getDefaultAddendForRelTy - Gets the default addend value for a
+ /// relocation entry based on the target ELF relocation type.
virtual long int getDefaultAddendForRelTy(unsigned RelTy) const;
/// getRelTySize - Returns the size of relocatable field in bits
virtual unsigned getRelocationTySize(unsigned RelTy) const;
+ /// isPCRelativeRel - True if the relocation type is pc relative
+ virtual bool isPCRelativeRel(unsigned RelTy) const;
+
/// getJumpTableRelocationTy - Returns the machine relocation type used
/// to reference a jumptable.
virtual unsigned getAbsoluteLabelMachineRelTy() const;
+
+ /// computeRelocation - Some relocatable fields could be relocated
+ /// directly, avoiding the relocation symbol emission, compute the
+ /// final relocation value for this symbol.
+ virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset,
+ unsigned RelTy) const;
};
} // end llvm namespace
From baldrick at free.fr Mon Jul 20 03:56:30 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 08:56:30 -0000
Subject: [llvm-commits] [gcc-plugin] r76415 - in /gcc-plugin/trunk: Makefile
bits_and_bobs.cpp
Message-ID: <200907200856.n6K8uWco015409@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 03:56:14 2009
New Revision: 76415
URL: http://llvm.org/viewvc/llvm-project?rev=76415&view=rev
Log:
Add a fake implementation of some rather vital
functions. With this, the plugin now builds
and can be loaded into gcc. So we are back to
the "Yo!" printing stage, only this time it
takes a 17MB plugin to do it :)
Added:
gcc-plugin/trunk/bits_and_bobs.cpp
Modified:
gcc-plugin/trunk/Makefile
Modified: gcc-plugin/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=76415&r1=76414&r2=76415&view=diff
==============================================================================
--- gcc-plugin/trunk/Makefile (original)
+++ gcc-plugin/trunk/Makefile Mon Jul 20 03:56:14 2009
@@ -1,4 +1,4 @@
-PLUGIN_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp llvm-types.cpp
+PLUGIN_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp llvm-types.cpp bits_and_bobs.cpp
PLUGIN_OBJECT_FILES=$(patsubst %.cpp,%.o,$(PLUGIN_SOURCE_FILES))
#GCCPLUGIN_DIR:=$(shell $(GCC) -print-file-name=plugin)
Added: gcc-plugin/trunk/bits_and_bobs.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/bits_and_bobs.cpp?rev=76415&view=auto
==============================================================================
--- gcc-plugin/trunk/bits_and_bobs.cpp (added)
+++ gcc-plugin/trunk/bits_and_bobs.cpp Mon Jul 20 03:56:14 2009
@@ -0,0 +1,47 @@
+// LLVM headers
+#include "llvm/Constant.h"
+#include "llvm/Value.h"
+
+// GCC headers
+#undef VISIBILITY_HIDDEN
+#define IN_GCC
+
+#include "config.h"
+extern "C" {
+#include "system.h"
+}
+#include "coretypes.h"
+#include "target.h"
+#include "tree.h"
+
+using namespace llvm;
+
+bool flag_odr = false;
+
+void llvm_set_decl (tree t, Value *V) {
+abort();
+}
+
+Value *llvm_get_decl(tree t) {
+abort();
+}
+
+bool llvm_set_decl_p(tree t) {
+abort();
+}
+
+void eraseLocalLLVMValues() {
+abort();
+}
+
+void changeLLVMConstant(Constant *Old, Constant *New) {
+abort();
+}
+
+const Type *llvm_set_type(tree Tr, const Type *Ty) {
+abort();
+}
+
+const Type *llvm_get_type(unsigned Index) {
+abort();
+}
From baldrick at free.fr Mon Jul 20 05:05:34 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 10:05:34 -0000
Subject: [llvm-commits] [gcc-plugin] r76416 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907201005.n6KA5ckT022553@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 05:05:09 2009
New Revision: 76416
URL: http://llvm.org/viewvc/llvm-project?rev=76416&view=rev
Log:
Initialize the target as x86 for the moment.
Actually do something with functions rather
than just printing Yo!
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=76416&r1=76415&r2=76416&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 05:05:09 2009
@@ -43,6 +43,7 @@
#include "llvm/Transforms/IPO.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/StandardPasses.h"
@@ -345,19 +346,22 @@
}
}
-//TODO#ifndef LLVM_TARGET_NAME
-//TODO#error LLVM_TARGET_NAME macro not specified by GCC backend
-//TODO#endif
-//TODO
-//TODOnamespace llvm {
-//TODO#define Declare2(TARG, MOD) extern "C" void LLVMInitialize ## TARG ## MOD()
-//TODO#define Declare(T, M) Declare2(T, M)
-//TODO Declare(LLVM_TARGET_NAME, TargetInfo);
-//TODO Declare(LLVM_TARGET_NAME, Target);
-//TODO Declare(LLVM_TARGET_NAME, AsmPrinter);
-//TODO#undef Declare
-//TODO#undef Declare2
-//TODO}
+// FIXME: For the moment, all the world's an x86
+#define LLVM_TARGET_NAME X86
+
+#ifndef LLVM_TARGET_NAME
+#error LLVM_TARGET_NAME macro not specified by GCC backend
+#endif
+
+namespace llvm {
+#define Declare2(TARG, MOD) extern "C" void LLVMInitialize ## TARG ## MOD()
+#define Declare(T, M) Declare2(T, M)
+ Declare(LLVM_TARGET_NAME, TargetInfo);
+ Declare(LLVM_TARGET_NAME, Target);
+ Declare(LLVM_TARGET_NAME, AsmPrinter);
+#undef Declare
+#undef Declare2
+}
/// LazilyConfigureLLVM - Set LLVM configuration options, if not already set.
/// already created.
@@ -366,6 +370,15 @@
if (Configured)
return;
+ // Initialize the LLVM backend.
+#define DoInit2(TARG, MOD) LLVMInitialize ## TARG ## MOD()
+#define DoInit(T, M) DoInit2(T, M)
+ DoInit(LLVM_TARGET_NAME, TargetInfo);
+ DoInit(LLVM_TARGET_NAME, Target);
+ DoInit(LLVM_TARGET_NAME, AsmPrinter);
+#undef DoInit
+#undef DoInit2
+
// Initialize LLVM command line options.
std::vector Args;
Args.push_back(progname); // program name
@@ -478,20 +491,18 @@
std::string Err;
const Target *TME =
TargetRegistry::getClosestStaticTargetForModule(*TheModule, Err);
- if (!TME) {
- cerr << "Did not get a target machine! Triplet is " << TargetTriple << '\n';
- exit(1);
- }
+ if (!TME)
+ llvm_report_error(Err);
// Figure out the subtarget feature string we pass to the target.
std::string FeatureStr;
-//TODO // The target can set LLVM_SET_SUBTARGET_FEATURES to configure the LLVM
-//TODO // backend.
-//TODO#ifdef LLVM_SET_SUBTARGET_FEATURES
-//TODO SubtargetFeatures Features;
-//TODO LLVM_SET_SUBTARGET_FEATURES(Features);
-//TODO FeatureStr = Features.getString();
-//TODO#endif
+ // The target can set LLVM_SET_SUBTARGET_FEATURES to configure the LLVM
+ // backend.
+#ifdef LLVM_SET_SUBTARGET_FEATURES
+ SubtargetFeatures Features;
+ LLVM_SET_SUBTARGET_FEATURES(Features);
+ FeatureStr = Features.getString();
+#endif
TheTarget = TME->createTargetMachine(*TheModule, FeatureStr);
assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN);
@@ -1814,6 +1825,8 @@
static unsigned int
execute_emit_llvm (void)
{
+ LazilyInitializeModule();
+
//TODO Don't want to use sorry at this stage...
//TODO if (cfun->nonlocal_goto_save_area)
//TODO sorry("%Jnon-local gotos not supported by LLVM", fndecl);
@@ -1831,8 +1844,7 @@
DECL_DEFER_OUTPUT(current_function_decl) = 0;
// Convert the AST to raw/ugly LLVM code.
-//FIXME TreeToLLVM Emitter(current_function_decl);
-cout << "Yo!\n";
+ TreeToLLVM Emitter(current_function_decl);
//TODO#if 0
//TODO if (dump_file) {
From baldrick at free.fr Mon Jul 20 05:11:34 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 10:11:34 -0000
Subject: [llvm-commits] [gcc-plugin] r76417 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907201011.n6KABbWL022754@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 05:11:13 2009
New Revision: 76417
URL: http://llvm.org/viewvc/llvm-project?rev=76417&view=rev
Log:
Call LazilyConfigureLLVM, rather than taking its
address. Spotted by Edwin.
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=76417&r1=76416&r2=76417&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 05:11:13 2009
@@ -458,7 +458,7 @@
if (Initialized)
return;
- LazilyConfigureLLVM;
+ LazilyConfigureLLVM();
TheModule = new Module("", getGlobalContext());
From baldrick at free.fr Mon Jul 20 05:15:10 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 10:15:10 -0000
Subject: [llvm-commits] [gcc-plugin] r76418 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907201015.n6KAFB2H022893@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 05:15:03 2009
New Revision: 76418
URL: http://llvm.org/viewvc/llvm-project?rev=76418&view=rev
Log:
The inliner is not linked in for the moment, so
turn off this inliner option.
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=76418&r1=76417&r2=76418&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 05:15:03 2009
@@ -412,9 +412,9 @@
//TODO Args.push_back("--debug-pass=Structure");
//TODO if (flag_debug_pass_arguments)
//TODO Args.push_back("--debug-pass=Arguments");
- if (optimize_size || optimize < 3)
- // Reduce inline limit. Default limit is 200.
- Args.push_back("--inline-threshold=50");
+//TODO if (optimize_size || optimize < 3)
+//TODO // Reduce inline limit. Default limit is 200.
+//TODO Args.push_back("--inline-threshold=50");
if (flag_unwind_tables)
Args.push_back("--unwind-tables");
From baldrick at free.fr Mon Jul 20 05:21:22 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 10:21:22 -0000
Subject: [llvm-commits] [gcc-plugin] r76421 -
/gcc-plugin/trunk/llvm-backend.cpp
Message-ID: <200907201021.n6KALN5A023131@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 05:21:18 2009
New Revision: 76421
URL: http://llvm.org/viewvc/llvm-project?rev=76421&view=rev
Log:
Turn on function emission. This immediately crashes
due to various methods that are implemented as abort.
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=76421&r1=76420&r2=76421&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 05:21:18 2009
@@ -1845,6 +1845,7 @@
// Convert the AST to raw/ugly LLVM code.
TreeToLLVM Emitter(current_function_decl);
+ Function *Fn = Emitter.EmitFunction();
//TODO#if 0
//TODO if (dump_file) {
From andrewl at lenharth.org Mon Jul 20 05:49:36 2009
From: andrewl at lenharth.org (Andrew Lenharth)
Date: Mon, 20 Jul 2009 05:49:36 -0500
Subject: [llvm-commits] [llvm] r76353 - in /llvm/trunk/lib/Target/Alpha:
Alpha.td AlphaCallingConv.td AlphaISelDAGToDAG.cpp
AlphaISelLowering.cpp AlphaISelLowering.h
In-Reply-To: <200907190111.n6J1BWjP009675@zion.cs.uiuc.edu>
References: <200907190111.n6J1BWjP009675@zion.cs.uiuc.edu>
Message-ID: <85dfcd7f0907200349v363c0c12nfc66b453d4b0091@mail.gmail.com>
On Sat, Jul 18, 2009 at 8:11 PM, Eli Friedman wrote:
> Author: efriedma
> Date: Sat Jul 18 20:11:32 2009
> New Revision: 76353
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76353&view=rev
> Log:
> Switch Alpha over to the new call lowering style. ?New code mostly
> copied from the SystemZ target. ?I don't think this causes any
> significant changes to the output (I compared the assembly, and the
> results appeared to be essentially unchanged), although I don't actually
> have an Alpha to test on.
>
> I would appreciate if anyone with the appropriate hardware could test
> this. I'm not sure if that includes anyone subscribed to llvm-commits,
> though.
It does, though the test machines are down after a power loss and I
haven't reboot them. I'll try to get the alpha builder bot back up
this week.
Andrew
>
> Added:
> ? ?llvm/trunk/lib/Target/Alpha/AlphaCallingConv.td
> Modified:
> ? ?llvm/trunk/lib/Target/Alpha/Alpha.td
> ? ?llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
> ? ?llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp
> ? ?llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h
>
> Modified: llvm/trunk/lib/Target/Alpha/Alpha.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/Alpha.td?rev=76353&r1=76352&r2=76353&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Alpha/Alpha.td (original)
> +++ llvm/trunk/lib/Target/Alpha/Alpha.td Sat Jul 18 20:11:32 2009
> @@ -30,6 +30,12 @@
> ?include "AlphaRegisterInfo.td"
>
> ?//===----------------------------------------------------------------------===//
> +// Calling Convention Description
> +//===----------------------------------------------------------------------===//
> +
> +include "AlphaCallingConv.td"
> +
> +//===----------------------------------------------------------------------===//
> ?// Schedule Description
> ?//===----------------------------------------------------------------------===//
>
>
> Added: llvm/trunk/lib/Target/Alpha/AlphaCallingConv.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaCallingConv.td?rev=76353&view=auto
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Alpha/AlphaCallingConv.td (added)
> +++ llvm/trunk/lib/Target/Alpha/AlphaCallingConv.td Sat Jul 18 20:11:32 2009
> @@ -0,0 +1,37 @@
> +//===- AlphaCallingConv.td - Calling Conventions for Alpha -*- tablegen -*-===//
> +//
> +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===----------------------------------------------------------------------===//
> +// This describes the calling conventions for Alpha architecture.
> +//===----------------------------------------------------------------------===//
> +
> +//===----------------------------------------------------------------------===//
> +// Alpha Return Value Calling Convention
> +//===----------------------------------------------------------------------===//
> +def RetCC_Alpha : CallingConv<[
> + ?// i64 is returned in register R0
> + ?CCIfType<[i64], CCAssignToReg<[R0]>>,
> +
> + ?// f32 / f64 are returned in F0/F1
> + ?CCIfType<[f32, f64], CCAssignToReg<[F0, F1]>>
> +]>;
> +
> +//===----------------------------------------------------------------------===//
> +// Alpha Argument Calling Conventions
> +//===----------------------------------------------------------------------===//
> +def CC_Alpha : CallingConv<[
> + ?// The first 6 arguments are passed in registers, whether integer or
> + ?// floating-point
> + ?CCIfType<[i64], CCAssignToRegWithShadow<[R16, R17, R18, R19, R20, R21],
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[F16, F17, F18, F19, F20, F21]>>,
> +
> + ?CCIfType<[f32, f64], CCAssignToRegWithShadow<[F16, F17, F18, F19, F20, F21],
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [R16, R17, R18, R19, R20, R21]>>,
> +
> + ?// Stack slots are 8 bytes in size and 8-byte aligned.
> + ?CCIfType<[i64, f32, f64], CCAssignToStack<8, 8>>
> +]>;
>
> Modified: llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp?rev=76353&r1=76352&r2=76353&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp (original)
> +++ llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Sat Jul 18 20:11:32 2009
> @@ -446,55 +446,9 @@
> ? SDNode *N = Op.getNode();
> ? SDValue Chain = N->getOperand(0);
> ? SDValue Addr = N->getOperand(1);
> - ?SDValue InFlag(0,0); ?// Null incoming flag value.
> + ?SDValue InFlag = N->getOperand(N->getNumOperands() - 1);
> ? DebugLoc dl = N->getDebugLoc();
>
> - ? std::vector CallOperands;
> - ? std::vector TypeOperands;
> -
> - ? //grab the arguments
> - ? for(int i = 2, e = N->getNumOperands(); i < e; ++i) {
> - ? ? TypeOperands.push_back(N->getOperand(i).getValueType());
> - ? ? CallOperands.push_back(N->getOperand(i));
> - ? }
> - ? int count = N->getNumOperands() - 2;
> -
> - ? static const unsigned args_int[] = {Alpha::R16, Alpha::R17, Alpha::R18,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Alpha::R19, Alpha::R20, Alpha::R21};
> - ? static const unsigned args_float[] = {Alpha::F16, Alpha::F17, Alpha::F18,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Alpha::F19, Alpha::F20, Alpha::F21};
> -
> - ? for (int i = 6; i < count; ++i) {
> - ? ? unsigned Opc = Alpha::WTF;
> - ? ? if (TypeOperands[i].isInteger()) {
> - ? ? ? Opc = Alpha::STQ;
> - ? ? } else if (TypeOperands[i] == MVT::f32) {
> - ? ? ? Opc = Alpha::STS;
> - ? ? } else if (TypeOperands[i] == MVT::f64) {
> - ? ? ? Opc = Alpha::STT;
> - ? ? } else
> - ? ? ? llvm_unreachable("Unknown operand");
> -
> - ? ? SDValue Ops[] = { CallOperands[i], ?getI64Imm((i - 6) * 8),
> - ? ? ? ? ? ? ? ? ? ? ? CurDAG->getCopyFromReg(Chain, dl, Alpha::R30, MVT::i64),
> - ? ? ? ? ? ? ? ? ? ? ? Chain };
> - ? ? Chain = SDValue(CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 4), 0);
> - ? }
> - ? for (int i = 0; i < std::min(6, count); ++i) {
> - ? ? if (TypeOperands[i].isInteger()) {
> - ? ? ? Chain = CurDAG->getCopyToReg(Chain, dl, args_int[i],
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CallOperands[i], InFlag);
> - ? ? ? InFlag = Chain.getValue(1);
> - ? ? } else if (TypeOperands[i] == MVT::f32 || TypeOperands[i] == MVT::f64) {
> - ? ? ? Chain = CurDAG->getCopyToReg(Chain, dl, args_float[i],
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CallOperands[i], InFlag);
> - ? ? ? InFlag = Chain.getValue(1);
> - ? ? } else
> - ? ? ? llvm_unreachable("Unknown operand");
> - ? }
> -
> - ? // Finally, once everything is in registers to pass to the call, emit the
> - ? // call itself.
> ? ?if (Addr.getOpcode() == AlphaISD::GPRelLo) {
> ? ? ?SDValue GOT = SDValue(getGlobalBaseReg(), 0);
> ? ? ?Chain = CurDAG->getCopyToReg(Chain, dl, Alpha::R29, GOT, InFlag);
> @@ -510,31 +464,8 @@
> ? ?}
> ? ?InFlag = Chain.getValue(1);
>
> - ? std::vector CallResults;
> -
> - ? switch (N->getValueType(0).getSimpleVT()) {
> - ? default: llvm_unreachable("Unexpected ret value!");
> - ? ? case MVT::Other: break;
> - ? case MVT::i64:
> - ? ? Chain = CurDAG->getCopyFromReg(Chain, dl,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Alpha::R0, MVT::i64, InFlag).getValue(1);
> - ? ? CallResults.push_back(Chain.getValue(0));
> - ? ? break;
> - ? case MVT::f32:
> - ? ? Chain = CurDAG->getCopyFromReg(Chain, dl,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Alpha::F0, MVT::f32, InFlag).getValue(1);
> - ? ? CallResults.push_back(Chain.getValue(0));
> - ? ? break;
> - ? case MVT::f64:
> - ? ? Chain = CurDAG->getCopyFromReg(Chain, dl,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Alpha::F0, MVT::f64, InFlag).getValue(1);
> - ? ? CallResults.push_back(Chain.getValue(0));
> - ? ? break;
> - ? }
> -
> - ? CallResults.push_back(Chain);
> - ? for (unsigned i = 0, e = CallResults.size(); i != e; ++i)
> - ? ? ReplaceUses(Op.getValue(i), CallResults[i]);
> + ?ReplaceUses(Op.getValue(0), Chain);
> + ?ReplaceUses(Op.getValue(1), InFlag);
> ?}
>
>
>
> Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=76353&r1=76352&r2=76353&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Sat Jul 18 20:11:32 2009
> @@ -13,12 +13,14 @@
>
> ?#include "AlphaISelLowering.h"
> ?#include "AlphaTargetMachine.h"
> +#include "llvm/CodeGen/CallingConvLower.h"
> ?#include "llvm/CodeGen/MachineFrameInfo.h"
> ?#include "llvm/CodeGen/MachineFunction.h"
> ?#include "llvm/CodeGen/MachineInstrBuilder.h"
> ?#include "llvm/CodeGen/MachineRegisterInfo.h"
> ?#include "llvm/CodeGen/SelectionDAG.h"
> ?#include "llvm/CodeGen/MachineRegisterInfo.h"
> +#include "llvm/CodeGen/PseudoSourceValue.h"
> ?#include "llvm/Constants.h"
> ?#include "llvm/Function.h"
> ?#include "llvm/Module.h"
> @@ -223,6 +225,174 @@
> ?// //#define GP ? ?$29
> ?// //#define SP ? ?$30
>
> +#include "AlphaGenCallingConv.inc"
> +
> +SDValue AlphaTargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
> + ?CallSDNode *TheCall = cast(Op.getNode());
> + ?SDValue Chain ?= TheCall->getChain();
> + ?SDValue Callee = TheCall->getCallee();
> + ?bool isVarArg ?= TheCall->isVarArg();
> + ?DebugLoc dl = Op.getDebugLoc();
> + ?MachineFunction &MF = DAG.getMachineFunction();
> + ?unsigned CC = MF.getFunction()->getCallingConv();
> +
> + ?// Analyze operands of the call, assigning locations to each operand.
> + ?SmallVector ArgLocs;
> + ?CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
> +
> + ?CCInfo.AnalyzeCallOperands(TheCall, CC_Alpha);
> +
> + ? ?// Get a count of how many bytes are to be pushed on the stack.
> + ?unsigned NumBytes = CCInfo.getNextStackOffset();
> +
> + ?Chain = DAG.getCALLSEQ_START(Chain, DAG.getConstant(NumBytes,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?getPointerTy(), true));
> +
> + ?SmallVector, 4> RegsToPass;
> + ?SmallVector MemOpChains;
> + ?SDValue StackPtr;
> +
> + ?// Walk the register/memloc assignments, inserting copies/loads.
> + ?for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
> + ? ?CCValAssign &VA = ArgLocs[i];
> +
> + ? ?// Arguments start after the 5 first operands of ISD::CALL
> + ? ?SDValue Arg = TheCall->getArg(i);
> +
> + ? ?// Promote the value if needed.
> + ? ?switch (VA.getLocInfo()) {
> + ? ? ?default: assert(0 && "Unknown loc info!");
> + ? ? ?case CCValAssign::Full: break;
> + ? ? ?case CCValAssign::SExt:
> + ? ? ? ?Arg = DAG.getNode(ISD::SIGN_EXTEND, dl, VA.getLocVT(), Arg);
> + ? ? ? ?break;
> + ? ? ?case CCValAssign::ZExt:
> + ? ? ? ?Arg = DAG.getNode(ISD::ZERO_EXTEND, dl, VA.getLocVT(), Arg);
> + ? ? ? ?break;
> + ? ? ?case CCValAssign::AExt:
> + ? ? ? ?Arg = DAG.getNode(ISD::ANY_EXTEND, dl, VA.getLocVT(), Arg);
> + ? ? ? ?break;
> + ? ?}
> +
> + ? ?// Arguments that can be passed on register must be kept at RegsToPass
> + ? ?// vector
> + ? ?if (VA.isRegLoc()) {
> + ? ? ?RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg));
> + ? ?} else {
> + ? ? ?assert(VA.isMemLoc());
> +
> + ? ? ?if (StackPtr.getNode() == 0)
> + ? ? ? ?StackPtr = DAG.getCopyFromReg(Chain, dl, Alpha::R30, MVT::i64);
> +
> + ? ? ?SDValue PtrOff = DAG.getNode(ISD::ADD, dl, getPointerTy(),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? StackPtr,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getIntPtrConstant(VA.getLocMemOffset()));
> +
> + ? ? ?MemOpChains.push_back(DAG.getStore(Chain, dl, Arg, PtrOff,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PseudoSourceValue::getStack(), 0));
> + ? ?}
> + ?}
> +
> + ?// Transform all store nodes into one single node because all store nodes are
> + ?// independent of each other.
> + ?if (!MemOpChains.empty())
> + ? ?Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
> + ? ? ? ? ? ? ? ? ? ? ? ?&MemOpChains[0], MemOpChains.size());
> +
> + ?// Build a sequence of copy-to-reg nodes chained together with token chain and
> + ?// flag operands which copy the outgoing args into registers. ?The InFlag in
> + ?// necessary since all emited instructions must be stuck together.
> + ?SDValue InFlag;
> + ?for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
> + ? ?Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? RegsToPass[i].second, InFlag);
> + ? ?InFlag = Chain.getValue(1);
> + ?}
> +
> + ?// Returns a chain & a flag for retval copy to use.
> + ?SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
> + ?SmallVector Ops;
> + ?Ops.push_back(Chain);
> + ?Ops.push_back(Callee);
> +
> + ?// Add argument registers to the end of the list so that they are
> + ?// known live into the call.
> + ?for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i)
> + ? ?Ops.push_back(DAG.getRegister(RegsToPass[i].first,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?RegsToPass[i].second.getValueType()));
> +
> + ?if (InFlag.getNode())
> + ? ?Ops.push_back(InFlag);
> +
> + ?Chain = DAG.getNode(AlphaISD::CALL, dl, NodeTys, &Ops[0], Ops.size());
> + ?InFlag = Chain.getValue(1);
> +
> + ?// Create the CALLSEQ_END node.
> + ?Chain = DAG.getCALLSEQ_END(Chain,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getConstant(NumBytes, getPointerTy(), true),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getConstant(0, getPointerTy(), true),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? InFlag);
> + ?InFlag = Chain.getValue(1);
> +
> + ?// Handle result values, copying them out of physregs into vregs that we
> + ?// return.
> + ?return SDValue(LowerCallResult(Chain, InFlag, TheCall, CC, DAG),
> + ? ? ? ? ? ? ? ? Op.getResNo());
> +}
> +
> +/// LowerCallResult - Lower the result values of an ISD::CALL into the
> +/// appropriate copies out of appropriate physical registers. ?This assumes that
> +/// Chain/InFlag are the input chain/flag to use, and that TheCall is the call
> +/// being lowered. Returns a SDNode with the same number of values as the
> +/// ISD::CALL.
> +SDNode*
> +AlphaTargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CallSDNode *TheCall,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned CallingConv,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SelectionDAG &DAG) {
> + ?bool isVarArg = TheCall->isVarArg();
> + ?DebugLoc dl = TheCall->getDebugLoc();
> +
> + ?// Assign locations to each value returned by this call.
> + ?SmallVector RVLocs;
> + ?CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs,
> + ? ? ? ? ? ? ? ? DAG.getContext());
> +
> + ?CCInfo.AnalyzeCallResult(TheCall, RetCC_Alpha);
> + ?SmallVector ResultVals;
> +
> + ?// Copy all of the result registers out of their specified physreg.
> + ?for (unsigned i = 0; i != RVLocs.size(); ++i) {
> + ? ?CCValAssign &VA = RVLocs[i];
> +
> + ? ?Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? VA.getLocVT(), InFlag).getValue(1);
> + ? ?SDValue RetValue = Chain.getValue(0);
> + ? ?InFlag = Chain.getValue(2);
> +
> + ? ?// If this is an 8/16/32-bit value, it is really passed promoted to 64
> + ? ?// bits. Insert an assert[sz]ext to capture this, then truncate to the
> + ? ?// right size.
> + ? ?if (VA.getLocInfo() == CCValAssign::SExt)
> + ? ? ?RetValue = DAG.getNode(ISD::AssertSext, dl, VA.getLocVT(), RetValue,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getValueType(VA.getValVT()));
> + ? ?else if (VA.getLocInfo() == CCValAssign::ZExt)
> + ? ? ?RetValue = DAG.getNode(ISD::AssertZext, dl, VA.getLocVT(), RetValue,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getValueType(VA.getValVT()));
> +
> + ? ?if (VA.getLocInfo() != CCValAssign::Full)
> + ? ? ?RetValue = DAG.getNode(ISD::TRUNCATE, dl, VA.getValVT(), RetValue);
> +
> + ? ?ResultVals.push_back(RetValue);
> + ?}
> +
> + ?ResultVals.push_back(Chain);
> +
> + ?// Merge everything together with a MERGE_VALUES node.
> + ?return DAG.getNode(ISD::MERGE_VALUES, dl, TheCall->getVTList(),
> + ? ? ? ? ? ? ? ? ? ? &ResultVals[0], ResultVals.size()).getNode();
> +}
> +
> ?static SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?int &VarArgsBase,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?int &VarArgsOffset) {
> @@ -365,85 +535,6 @@
> ? ? ? ? ? ? ? ? ? ? ?MVT::Other, Copy, Copy.getValue(1));
> ?}
>
> -std::pair
> -AlphaTargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool RetSExt, bool RetZExt, bool isVarArg,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool isInreg, unsigned NumFixedArgs,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned CallingConv,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool isTailCall, SDValue Callee,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ArgListTy &Args, SelectionDAG &DAG,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? DebugLoc dl) {
> - ?int NumBytes = 0;
> - ?if (Args.size() > 6)
> - ? ?NumBytes = (Args.size() - 6) * 8;
> -
> - ?Chain = DAG.getCALLSEQ_START(Chain, DAG.getIntPtrConstant(NumBytes, true));
> - ?std::vector args_to_use;
> - ?for (unsigned i = 0, e = Args.size(); i != e; ++i)
> - ?{
> - ? ?switch (getValueType(Args[i].Ty).getSimpleVT()) {
> - ? ?default: llvm_unreachable("Unexpected ValueType for argument!");
> - ? ?case MVT::i1:
> - ? ?case MVT::i8:
> - ? ?case MVT::i16:
> - ? ?case MVT::i32:
> - ? ? ?// Promote the integer to 64 bits. ?If the input type is signed use a
> - ? ? ?// sign extend, otherwise use a zero extend.
> - ? ? ?if (Args[i].isSExt)
> - ? ? ? ?Args[i].Node = DAG.getNode(ISD::SIGN_EXTEND, dl,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MVT::i64, Args[i].Node);
> - ? ? ?else if (Args[i].isZExt)
> - ? ? ? ?Args[i].Node = DAG.getNode(ISD::ZERO_EXTEND, dl,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MVT::i64, Args[i].Node);
> - ? ? ?else
> - ? ? ? ?Args[i].Node = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i64, Args[i].Node);
> - ? ? ?break;
> - ? ?case MVT::i64:
> - ? ?case MVT::f64:
> - ? ?case MVT::f32:
> - ? ? ?break;
> - ? ?}
> - ? ?args_to_use.push_back(Args[i].Node);
> - ?}
> -
> - ?std::vector RetVals;
> - ?MVT RetTyVT = getValueType(RetTy);
> - ?MVT ActualRetTyVT = RetTyVT;
> - ?if (RetTyVT.getSimpleVT() >= MVT::i1 && RetTyVT.getSimpleVT() <= MVT::i32)
> - ? ?ActualRetTyVT = MVT::i64;
> -
> - ?if (RetTyVT != MVT::isVoid)
> - ? ?RetVals.push_back(ActualRetTyVT);
> - ?RetVals.push_back(MVT::Other);
> -
> - ?std::vector Ops;
> - ?Ops.push_back(Chain);
> - ?Ops.push_back(Callee);
> - ?Ops.insert(Ops.end(), args_to_use.begin(), args_to_use.end());
> - ?SDValue TheCall = DAG.getNode(AlphaISD::CALL, dl,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?RetVals, &Ops[0], Ops.size());
> - ?Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
> - ?Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(NumBytes, true),
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getIntPtrConstant(0, true), SDValue());
> - ?SDValue RetVal = TheCall;
> -
> - ?if (RetTyVT != ActualRetTyVT) {
> - ? ?ISD::NodeType AssertKind = ISD::DELETED_NODE;
> - ? ?if (RetSExt)
> - ? ? ?AssertKind = ISD::AssertSext;
> - ? ?else if (RetZExt)
> - ? ? ?AssertKind = ISD::AssertZext;
> -
> - ? ?if (AssertKind != ISD::DELETED_NODE)
> - ? ? ?RetVal = DAG.getNode(AssertKind, dl, MVT::i64, RetVal,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getValueType(RetTyVT));
> -
> - ? ?RetVal = DAG.getNode(ISD::TRUNCATE, dl, RetTyVT, RetVal);
> - ?}
> -
> - ?return std::make_pair(RetVal, Chain);
> -}
> -
> ?void AlphaTargetLowering::LowerVAARG(SDNode *N, SDValue &Chain,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SDValue &DataPtr, SelectionDAG &DAG) {
> ? Chain = N->getOperand(0);
> @@ -482,7 +573,7 @@
> ? case ISD::FORMAL_ARGUMENTS: return LowerFORMAL_ARGUMENTS(Op, DAG,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?VarArgsBase,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?VarArgsOffset);
> -
> + ?case ISD::CALL: return LowerCALL(Op, DAG);
> ? case ISD::RET: return LowerRET(Op,DAG);
> ? case ISD::JumpTable: return LowerJumpTable(Op, DAG);
>
>
> Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h?rev=76353&r1=76352&r2=76353&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h (original)
> +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h Sat Jul 18 20:11:32 2009
> @@ -82,13 +82,9 @@
> ? ? // Friendly names for dumps
> ? ? const char *getTargetNodeName(unsigned Opcode) const;
>
> - ? ?/// LowerCallTo - This hook lowers an abstract call to a function into an
> - ? ?/// actual call.
> - ? ?virtual std::pair
> - ? ?LowerCallTo(SDValue Chain, const Type *RetTy, bool RetSExt, bool RetZExt,
> - ? ? ? ? ? ? ? ?bool isVarArg, bool isInreg, unsigned NumFixedArgs, unsigned CC,
> - ? ? ? ? ? ? ? ?bool isTailCall, SDValue Callee, ArgListTy &Args,
> - ? ? ? ? ? ? ? ?SelectionDAG &DAG, DebugLoc dl);
> + ? ?SDValue LowerCALL(SDValue Op, SelectionDAG &DAG);
> + ? ?SDNode *LowerCallResult(SDValue Chain, SDValue InFlag, CallSDNode *TheCall,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?unsigned CallingConv, SelectionDAG &DAG);
>
> ? ? ConstraintType getConstraintType(const std::string &Constraint) const;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From eli.friedman at gmail.com Mon Jul 20 07:42:37 2009
From: eli.friedman at gmail.com (Eli Friedman)
Date: Mon, 20 Jul 2009 05:42:37 -0700
Subject: [llvm-commits] [llvm] r76385 - in /llvm/trunk: docs/
include/llvm-c/ include/llvm/ include/llvm/Support/
lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/
lib/CodeGen/ lib/Linker/ lib/Target/
lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPr
Message-ID:
On Mon, Jul 20, 2009 at 1:19 AM, Duncan Sands wrote:
> Hi Chris,
>
>> Right. ?Private linkage is discarded by the assembler, so they never
>> make it into the .o file. ?linker_private is discarded by the linker,
>> so it never makes it into the .exe/.dylib. ?I don't think there is a
>> corresponding idea on ELF, so on ELF they two linkage types should be
>> codegen'd the same way.
>
> I don't understand why you would want something to be discarded by
> the assembler/linker and not by the linker/assembler. ?Don't you
> want them both to throw pointless things away?
I've stopped questioning anything that has to do with Apple's
linker... it has all sorts of strange quirks.
-Eli
From criswell at cs.uiuc.edu Mon Jul 20 09:23:17 2009
From: criswell at cs.uiuc.edu (John Criswell)
Date: Mon, 20 Jul 2009 09:23:17 -0500
Subject: [llvm-commits] CVS: llvm-www/Users.html
Message-ID: <200907201423.n6KENHKA004874@maute.cs.uiuc.edu>
Changes in directory llvm-www:
Users.html updated: 1.53 -> 1.54
---
Log message:
Added Mono to the list of LLVM Users.
---
Diffs of the changes: (+8 -1)
Users.html | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletion(-)
Index: llvm-www/Users.html
diff -u llvm-www/Users.html:1.53 llvm-www/Users.html:1.54
--- llvm-www/Users.html:1.53 Thu Jul 9 21:30:50 2009
+++ llvm-www/Users.html Mon Jul 20 09:21:44 2009
@@ -434,6 +434,13 @@
Unladen Swallow
A faster implementation of Python. |
+
+
+
+ |
+ Mono |
+ Mono has an option to use LLVM for JIT compilation. |
+
@@ -448,6 +455,6 @@
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
LLVM Development List
- Last modified: $Date: 2009/07/10 02:30:50 $
+ Last modified: $Date: 2009/07/20 14:21:44 $
From eli.friedman at gmail.com Mon Jul 20 09:50:16 2009
From: eli.friedman at gmail.com (Eli Friedman)
Date: Mon, 20 Jul 2009 14:50:16 -0000
Subject: [llvm-commits] [llvm] r76422 -
/llvm/trunk/examples/Kaleidoscope/toy.cpp
Message-ID: <200907201450.n6KEoJO4032028@zion.cs.uiuc.edu>
Author: efriedma
Date: Mon Jul 20 09:50:07 2009
New Revision: 76422
URL: http://llvm.org/viewvc/llvm-project?rev=76422&view=rev
Log:
PR4591: Make sure to initialize the pass manager before using it.
Modified:
llvm/trunk/examples/Kaleidoscope/toy.cpp
Modified: llvm/trunk/examples/Kaleidoscope/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/toy.cpp?rev=76422&r1=76421&r2=76422&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/toy.cpp Mon Jul 20 09:50:07 2009
@@ -1125,6 +1125,8 @@
// Simplify the control flow graph (deleting unreachable blocks, etc).
OurFPM.add(createCFGSimplificationPass());
+ OurFPM.doInitialization();
+
// Set the global so the code gen can use this.
TheFPM = &OurFPM;
From clattner at apple.com Mon Jul 20 10:22:22 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 20 Jul 2009 08:22:22 -0700
Subject: [llvm-commits] [llvm] r76422 -
/llvm/trunk/examples/Kaleidoscope/toy.cpp
In-Reply-To: <200907201450.n6KEoJO4032028@zion.cs.uiuc.edu>
References: <200907201450.n6KEoJO4032028@zion.cs.uiuc.edu>
Message-ID: <57988AED-2CC0-4F07-9CE5-A67DB77B07B3@apple.com>
On Jul 20, 2009, at 7:50 AM, Eli Friedman wrote:
> Author: efriedma
> Date: Mon Jul 20 09:50:07 2009
> New Revision: 76422
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76422&view=rev
> Log:
> PR4591: Make sure to initialize the pass manager before using it.
Why is this needed? Isn't the FunctionPassManager calling doInit on
all the passes in it before they start?
-Chris
>
>
> Modified:
> llvm/trunk/examples/Kaleidoscope/toy.cpp
>
> Modified: llvm/trunk/examples/Kaleidoscope/toy.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/toy.cpp?rev=76422&r1=76421&r2=76422&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/examples/Kaleidoscope/toy.cpp (original)
> +++ llvm/trunk/examples/Kaleidoscope/toy.cpp Mon Jul 20 09:50:07 2009
> @@ -1125,6 +1125,8 @@
> // Simplify the control flow graph (deleting unreachable blocks,
> etc).
> OurFPM.add(createCFGSimplificationPass());
>
> + OurFPM.doInitialization();
> +
> // Set the global so the code gen can use this.
> TheFPM = &OurFPM;
>
>
>
> _______________________________________________
> 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 Jul 20 10:29:24 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 20 Jul 2009 08:29:24 -0700
Subject: [llvm-commits] [llvm] r76385 - in /llvm/trunk: docs/
include/llvm-c/ include/llvm/ include/llvm/Support/ lib/AsmParser/
lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/
lib/Linker/ lib/Target/ lib/Target/ARM/AsmPrinter/
lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/AsmPrinter/
lib/Target/CppBackend/ lib/Target/IA64/AsmPrinter/
lib/Target/MSP430/ lib/Target/Mips/AsmPrinter/
lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/AsmPrinter/
lib/Target/SystemZ/AsmPrinter/ lib/Target/X86/AsmPrinter/
lib/Target/XCore/ lib/Tr...
In-Reply-To: <4A642885.8080607@free.fr>
References: <200907200103.n6K13chA025017@zion.cs.uiuc.edu>
<4A63F2AF.4040106@free.fr>
<71E41203-F38F-449A-BF98-EF5C1E486F28@apple.com>
<4A642885.8080607@free.fr>
Message-ID:
On Jul 20, 2009, at 1:19 AM, Duncan Sands wrote:
> Hi Chris,
>
>> Right. Private linkage is discarded by the assembler, so they never
>> make it into the .o file. linker_private is discarded by the linker,
>> so it never makes it into the .exe/.dylib. I don't think there is a
>> corresponding idea on ELF, so on ELF they two linkage types should be
>> codegen'd the same way.
>
> I don't understand why you would want something to be discarded by
> the assembler/linker and not by the linker/assembler. Don't you
> want them both to throw pointless things away?
This is needed for weird ObjC metadata stuff. The basic issue with
linkerprivate is that all labels that exist in the .o file end up
defining boundaries between "atoms" that the linker works with. The
linker then dead code strips and reorders at the boundary of these
labels. Since Private labels are discarded before they make it to
the .o file, the linker doesn't see them. However, we don't want
these labels to make it into the .exe file etc. Some more information
is here:
http://developer.apple.com/documentation/DeveloperTools/Reference/Assembler/040-Assembler_Directives/asm_directives.html#/
/apple_ref/doc/uid/TP30000823-DontLinkElementID_6
This is a similar deal with the llvm.compiler.used thing I just added:
The basic idea is that the linker *knows* the layout of various objc
metadata sections, so it can do various optimizations etc. However,
it doesn't do these if they are marked no-dead-strip, because it
(reasonably) assumes that there is something weird going on.
llvm.compiler.used prevents the compiler from molesting the metadata,
but allows the linker to eliminate duplicate info, etc.
-Chris
From evan.cheng at apple.com Mon Jul 20 10:33:14 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Jul 2009 15:33:14 -0000
Subject: [llvm-commits] [llvm] r76423 -
/llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp
Message-ID: <200907201533.n6KFXFGK000935@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Jul 20 10:33:09 2009
New Revision: 76423
URL: http://llvm.org/viewvc/llvm-project?rev=76423&view=rev
Log:
xfail for now.
Modified:
llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp
Modified: llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2009-07-15-LineNumbers.cpp?rev=76423&r1=76422&r2=76423&view=diff
==============================================================================
--- llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp (original)
+++ llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp Mon Jul 20 10:33:09 2009
@@ -2,6 +2,7 @@
// print line numbers in asm.
// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \
// RUN: llc --disable-fp-elim -f -O0 -relocation-model=pic | grep {# SrcLine 25}
+// XFAIL: *
#include
From david_goodwin at apple.com Mon Jul 20 10:55:49 2009
From: david_goodwin at apple.com (David Goodwin)
Date: Mon, 20 Jul 2009 15:55:49 -0000
Subject: [llvm-commits] [llvm] r76424 -
/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
Message-ID: <200907201555.n6KFtoVg001548@zion.cs.uiuc.edu>
Author: david_goodwin
Date: Mon Jul 20 10:55:39 2009
New Revision: 76424
URL: http://llvm.org/viewvc/llvm-project?rev=76424&view=rev
Log:
Use t2LDRri12 for frame index loads.
Modified:
llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=76424&r1=76423&r2=76424&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jul 20 10:55:39 2009
@@ -596,8 +596,17 @@
bool ARMDAGToDAGISel::SelectT2AddrModeImm12(SDValue Op, SDValue N,
SDValue &Base, SDValue &OffImm) {
// Match simple R + imm12 operands.
- if (N.getOpcode() != ISD::ADD)
+
+ // Match frame index...
+ if (N.getOpcode() != ISD::ADD) {
+ if (N.getOpcode() == ISD::FrameIndex) {
+ int FI = cast(N)->getIndex();
+ Base = CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy());
+ OffImm = CurDAG->getTargetConstant(0, MVT::i32);
+ return true;
+ }
return false;
+ }
if (ConstantSDNode *RHS = dyn_cast(N.getOperand(1))) {
int RHSC = (int)RHS->getZExtValue();
@@ -686,8 +695,7 @@
if (N.getOpcode() != ISD::ADD && N.getOpcode() != ISD::SUB) {
Base = N;
if (N.getOpcode() == ISD::FrameIndex) {
- int FI = cast(N)->getIndex();
- Base = CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy());
+ return false; // we want to select t2LDRri12 instead
} else if (N.getOpcode() == ARMISD::Wrapper) {
Base = N.getOperand(0);
if (Base.getOpcode() == ISD::TargetConstantPool)
From dag at cray.com Mon Jul 20 11:05:46 2009
From: dag at cray.com (David Greene)
Date: Mon, 20 Jul 2009 11:05:46 -0500
Subject: [llvm-commits] LLVM Verilog Backend
In-Reply-To: <6a8523d60907181601m37a50c62t8ff9c5be8e658aca@mail.gmail.com>
References: <9b38093e0907180422m57244b21n5d5a50368f84db71@mail.gmail.com>
<6a8523d60907181601m37a50c62t8ff9c5be8e658aca@mail.gmail.com>
Message-ID: <200907201105.47405.dag@cray.com>
On Saturday 18 July 2009 18:01, Daniel Dunbar wrote:
> > Oh, I see what you mean... I wasn't really considering it carefully.
> > How about "always indent namespaces, don't define functions inside a
> > namespace"?
>
> Yeah, I like that rule. Small inlines functions in classes are
> probably an exception, since its a lot more work to duplicate the
> function declaration outside the namespace.
I'll second this. Makes a lot of sense to me.
-Dave
From bob.wilson at apple.com Mon Jul 20 11:06:26 2009
From: bob.wilson at apple.com (Bob Wilson)
Date: Mon, 20 Jul 2009 09:06:26 -0700
Subject: [llvm-commits] [llvm] r76422 -
/llvm/trunk/examples/Kaleidoscope/toy.cpp
In-Reply-To: <57988AED-2CC0-4F07-9CE5-A67DB77B07B3@apple.com>
References: <200907201450.n6KEoJO4032028@zion.cs.uiuc.edu>
<57988AED-2CC0-4F07-9CE5-A67DB77B07B3@apple.com>
Message-ID:
On Jul 20, 2009, at 8:22 AM, Chris Lattner wrote:
>
> On Jul 20, 2009, at 7:50 AM, Eli Friedman wrote:
>
>> Author: efriedma
>> Date: Mon Jul 20 09:50:07 2009
>> New Revision: 76422
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=76422&view=rev
>> Log:
>> PR4591: Make sure to initialize the pass manager before using it.
>
> Why is this needed? Isn't the FunctionPassManager calling doInit on
> all the passes in it before they start?
No, it doesn't. I ran into the same problem in llc on Friday (http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090713/081666.html
).
The FunctionPassManager does the initialization if you call it for a
Module but not for individual Functions.
From dag at cray.com Mon Jul 20 11:06:56 2009
From: dag at cray.com (David Greene)
Date: Mon, 20 Jul 2009 11:06:56 -0500
Subject: [llvm-commits] [llvm] r76423 -
/llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp
In-Reply-To: <200907201533.n6KFXFGK000935@zion.cs.uiuc.edu>
References: <200907201533.n6KFXFGK000935@zion.cs.uiuc.edu>
Message-ID: <200907201106.56948.dag@cray.com>
On Monday 20 July 2009 10:33, Evan Cheng wrote:
> Author: evancheng
> Date: Mon Jul 20 10:33:09 2009
> New Revision: 76423
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76423&view=rev
> Log:
> xfail for now.
Why? It should work.
-Dave
From evan.cheng at apple.com Mon Jul 20 11:11:33 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Jul 2009 09:11:33 -0700
Subject: [llvm-commits] [llvm] r76423 -
/llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp
In-Reply-To: <200907201106.56948.dag@cray.com>
References: <200907201533.n6KFXFGK000935@zion.cs.uiuc.edu>
<200907201106.56948.dag@cray.com>
Message-ID: <015B0FF7-EA1E-4981-9F55-0377833DBC78@apple.com>
See r76398. I've reverted your recent tablegen changes since it broke
Thumb backend. I've sent you a private email of the details.
Evan
On Jul 20, 2009, at 9:06 AM, David Greene wrote:
> On Monday 20 July 2009 10:33, Evan Cheng wrote:
>> Author: evancheng
>> Date: Mon Jul 20 10:33:09 2009
>> New Revision: 76423
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=76423&view=rev
>> Log:
>> xfail for now.
>
> Why? It should work.
>
> -Dave
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From greened at obbligato.org Mon Jul 20 11:16:12 2009
From: greened at obbligato.org (David Greene)
Date: Mon, 20 Jul 2009 16:16:12 -0000
Subject: [llvm-commits] [llvm] r76425 - in /llvm/trunk:
include/llvm/Support/Debug.h lib/Support/Debug.cpp
Message-ID: <200907201616.n6KGGEwd002126@zion.cs.uiuc.edu>
Author: greened
Date: Mon Jul 20 11:16:06 2009
New Revision: 76425
URL: http://llvm.org/viewvc/llvm-project?rev=76425&view=rev
Log:
Hide the DOUT static variable behind a function interface.
Modified:
llvm/trunk/include/llvm/Support/Debug.h
llvm/trunk/lib/Support/Debug.cpp
Modified: llvm/trunk/include/llvm/Support/Debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Debug.h?rev=76425&r1=76424&r2=76425&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Debug.h (original)
+++ llvm/trunk/include/llvm/Support/Debug.h Mon Jul 20 11:16:06 2009
@@ -61,6 +61,11 @@
do { if (DebugFlag && isCurrentDebugType(DEBUG_TYPE)) { X; } } while (0)
#endif
+/// getNullOutputStream - Return a null string that does not output
+/// anything. This hides the static variable from other modules.
+///
+OStream &getNullOutputStream();
+
/// getErrorOutputStream - Returns the error output stream (std::cerr). This
/// places the std::c* I/O streams into one .cpp file and relieves the whole
/// program from having to have hundreds of static c'tor/d'tors for them.
@@ -68,8 +73,7 @@
OStream &getErrorOutputStream(const char *DebugType);
#ifdef NDEBUG
-static llvm::OStream NullStream(0);
-#define DOUT llvm::NullStream
+#define DOUT llvm::getNullOutputStream()
#else
#define DOUT llvm::getErrorOutputStream(DEBUG_TYPE)
#endif
Modified: llvm/trunk/lib/Support/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Debug.cpp?rev=76425&r1=76424&r2=76425&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Debug.cpp (original)
+++ llvm/trunk/lib/Support/Debug.cpp Mon Jul 20 11:16:06 2009
@@ -64,6 +64,14 @@
#endif
}
+/// getNullOutputStream - Return a null string that does not output
+/// anything. This hides the static variable from other modules.
+///
+OStream &llvm::getNullOutputStream() {
+ static llvm::OStream NullStream(0);
+ return NullStream;
+}
+
// getErrorOutputStream - Returns the error output stream (std::cerr). This
// places the std::c* I/O streams into one .cpp file and relieves the whole
// program from having to have hundreds of static c'tor/d'tors for them.
From mai4 at uiuc.edu Mon Jul 20 11:16:52 2009
From: mai4 at uiuc.edu (Haohui Mai)
Date: Mon, 20 Jul 2009 16:16:52 -0000
Subject: [llvm-commits] [poolalloc] r76426 - in /poolalloc/trunk:
include/poolalloc/PoolAllocate.h lib/DSA/Steensgaard.cpp
lib/PoolAllocate/PAMultipleGlobalPool.cpp
Message-ID: <200907201616.n6KGGqKG002167@zion.cs.uiuc.edu>
Author: mai4
Date: Mon Jul 20 11:16:52 2009
New Revision: 76426
URL: http://llvm.org/viewvc/llvm-project?rev=76426&view=rev
Log:
1. A global might have DSNode in both the result graph and the globals graph, which should be placed in the same pool in PAMultiGlobalPool.
2. Add a print() method for debugging.
3. Revert the deprecated flag.
Modified:
poolalloc/trunk/include/poolalloc/PoolAllocate.h
poolalloc/trunk/lib/DSA/Steensgaard.cpp
poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=76426&r1=76425&r2=76426&view=diff
==============================================================================
--- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original)
+++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Mon Jul 20 11:16:52 2009
@@ -187,7 +187,7 @@
PoolAllocate (bool passAllArguments,
bool SAFECode = true,
- intptr_t IDp = (intptr_t) (&ID)) __attribute__((__deprecated__))
+ intptr_t IDp = (intptr_t) (&ID))
: ModulePass((intptr_t)IDp),
PassAllArguments(passAllArguments)
{
@@ -511,10 +511,11 @@
void ProcessFunctionBodySimple(Function& F, TargetData & TD);
/// Mapping between DSNodes and Pool descriptors. For this pass, it is a
/// one-to-one relationship.
- DenseMap PoolMap;
+ typedef DenseMap PoolMapTy;
+ PoolMapTy PoolMap;
void generatePool(unsigned RecSize, unsigned Align,
Module& M, BasicBlock * InsertAtEnd, const DSNode * Node);
-
+ Module * currentModule;
public:
static char ID;
PoolAllocateMultipleGlobalPool(bool passAllArgs=false, bool SAFECode = true)
@@ -527,7 +528,8 @@
virtual Value * getGlobalPool (const DSNode * Node);
virtual Value * getPool (const DSNode * N, Function & F);
-
+ virtual void print(std::ostream &OS, const Module * M) const;
+ virtual void dump() const;
};
}
Modified: poolalloc/trunk/lib/DSA/Steensgaard.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Steensgaard.cpp?rev=76426&r1=76425&r2=76426&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Steensgaard.cpp (original)
+++ poolalloc/trunk/lib/DSA/Steensgaard.cpp Mon Jul 20 11:16:52 2009
@@ -134,7 +134,7 @@
// Remove any nodes that are dead after all of the merging we have done...
- ResultGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
+ ResultGraph->removeDeadNodes(DSGraph::RemoveUnreachableGlobals);
print(DOUT, &M);
return false;
Modified: poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp?rev=76426&r1=76425&r2=76426&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp Mon Jul 20 11:16:52 2009
@@ -79,6 +79,7 @@
}
bool PoolAllocateMultipleGlobalPool::runOnModule(Module &M) {
+ currentModule = &M;
if (M.begin() == M.end()) return false;
Graphs = &getAnalysis();
assert (Graphs && "No DSA pass available!\n");
@@ -350,7 +351,15 @@
DSGraph * GG = DS->getGlobalsGraph();
for(DSGraph::node_const_iterator I = GG->node_begin(),
E = GG->node_end(); I != E; ++I) {
- generatePool(I->getSize(), Align, M, BB, I);
+ if (I->globals_begin() != I->globals_end()) {
+ const GlobalValue * GV = *(I->globals_begin());
+ DSNodeHandle NH = G->getNodeForValue(GV);
+ if (!NH.isNull()) {
+ PoolMap[&*I] = PoolMap[NH.getNode()];
+ } else {
+ generatePool(I->getSize(), Align, M, BB, I);
+ }
+ }
}
ReturnInst::Create(BB);
@@ -393,4 +402,16 @@
return getGlobalPool(N);
}
+void
+PoolAllocateMultipleGlobalPool::print(std::ostream &OS, const Module * M) const {
+ for (PoolMapTy::const_iterator I = PoolMap.begin(), E = PoolMap.end(); I != E; ++I) {
+ OS << I->first << " -> " << I->second->getName() << "\n";
+ }
+}
+
+void
+PoolAllocateMultipleGlobalPool::dump() const {
+ print (std::cerr, currentModule);
+}
+
PoolAllocateMultipleGlobalPool::~PoolAllocateMultipleGlobalPool() {}
From daniel at zuster.org Mon Jul 20 11:50:16 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 20 Jul 2009 16:50:16 -0000
Subject: [llvm-commits] [llvm] r76427 -
/llvm/trunk/include/llvm/Support/Debug.h
Message-ID: <200907201650.n6KGoHLk003310@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Jul 20 11:50:16 2009
New Revision: 76427
URL: http://llvm.org/viewvc/llvm-project?rev=76427&view=rev
Log:
Fix comment.
Modified:
llvm/trunk/include/llvm/Support/Debug.h
Modified: llvm/trunk/include/llvm/Support/Debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Debug.h?rev=76427&r1=76426&r2=76427&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Debug.h (original)
+++ llvm/trunk/include/llvm/Support/Debug.h Mon Jul 20 11:50:16 2009
@@ -18,8 +18,8 @@
// can specify '-debug-only=foo' to enable JUST the debug information for the
// foo class.
//
-// When compiling in release mode, the -debug-* options and all code in DEBUG()
-// statements disappears, so it does not effect the runtime of the code.
+// When compiling without assertions, the -debug-* options and all code in
+// DEBUG() statements disappears, so it does not effect the runtime of the code.
//
//===----------------------------------------------------------------------===//
From clattner at apple.com Mon Jul 20 11:51:24 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 20 Jul 2009 09:51:24 -0700
Subject: [llvm-commits] [llvm] r76422 -
/llvm/trunk/examples/Kaleidoscope/toy.cpp
In-Reply-To:
References: <200907201450.n6KEoJO4032028@zion.cs.uiuc.edu>
<57988AED-2CC0-4F07-9CE5-A67DB77B07B3@apple.com>
Message-ID:
On Jul 20, 2009, at 9:06 AM, Bob Wilson wrote:
>
> On Jul 20, 2009, at 8:22 AM, Chris Lattner wrote:
>
>>
>> On Jul 20, 2009, at 7:50 AM, Eli Friedman wrote:
>>
>>> Author: efriedma
>>> Date: Mon Jul 20 09:50:07 2009
>>> New Revision: 76422
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=76422&view=rev
>>> Log:
>>> PR4591: Make sure to initialize the pass manager before using it.
>>
>> Why is this needed? Isn't the FunctionPassManager calling doInit on
>> all the passes in it before they start?
>
> No, it doesn't. I ran into the same problem in llc on Friday (http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090713/081666.html
> ).
>
> The FunctionPassManager does the initialization if you call it for a
> Module but not for individual Functions.
That seems bad, we should fix it in FunctionPassManager, not in all
the clients.
-Chris
From devang.patel at gmail.com Mon Jul 20 12:08:22 2009
From: devang.patel at gmail.com (Devang Patel)
Date: Mon, 20 Jul 2009 10:08:22 -0700
Subject: [llvm-commits] [llvm] r76422 -
/llvm/trunk/examples/Kaleidoscope/toy.cpp
In-Reply-To:
References: <200907201450.n6KEoJO4032028@zion.cs.uiuc.edu>
<57988AED-2CC0-4F07-9CE5-A67DB77B07B3@apple.com>
Message-ID: <352a1fb20907201008v5f72facr3ac81a98245d36ec@mail.gmail.com>
On Mon, Jul 20, 2009 at 9:51 AM, Chris Lattner wrote:
>
> On Jul 20, 2009, at 9:06 AM, Bob Wilson wrote:
>
>>
>> On Jul 20, 2009, at 8:22 AM, Chris Lattner wrote:
>>
>>>
>>> On Jul 20, 2009, at 7:50 AM, Eli Friedman wrote:
>>>
>>>> Author: efriedma
>>>> Date: Mon Jul 20 09:50:07 2009
>>>> New Revision: 76422
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=76422&view=rev
>>>> Log:
>>>> PR4591: Make sure to initialize the pass manager before using it.
>>>
>>> Why is this needed? ?Isn't the FunctionPassManager calling doInit on
>>> all the passes in it before they start?
>>
>> No, it doesn't. ?I ran into the same problem in llc on Friday (http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090713/081666.html
>> ).
>>
>> The FunctionPassManager does the initialization if you call it for a
>> Module but not for individual Functions.
>
> That seems bad, we should fix it in FunctionPassManager, not in all
> the clients.
It is not a good idea to use doInitialization() as a "constructor" of
respective PM object. The new Context work is expecting this, which is
bad. See r74724's feedback.
doInitialization() gives all passes a chance to collect required
information before PM runs all passes. It is not meant to
initialization PM object. All function passes are allowed to implement
doInitialization(Module &M). They do not implement
doInitialization(Function &F), so it does no make sense to ask
FunctionPassManager to run doInitialization(Function &F).
-
Devang
From sabre at nondot.org Mon Jul 20 12:12:46 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 17:12:46 -0000
Subject: [llvm-commits] [llvm] r76431 - in /llvm/trunk:
include/llvm/Target/TargetAsmInfo.h lib/Target/PIC16/PIC16TargetAsmInfo.cpp
lib/Target/PIC16/PIC16TargetAsmInfo.h
Message-ID: <200907201712.n6KHCksA004769@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 12:12:46 2009
New Revision: 76431
URL: http://llvm.org/viewvc/llvm-project?rev=76431&view=rev
Log:
rename TargetAsmInfo::getASDirective -> getDataASDirective
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=76431&r1=76430&r2=76431&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Jul 20 12:12:46 2009
@@ -305,11 +305,10 @@
const char *Data32bitsDirective; // Defaults to "\t.long\t"
const char *Data64bitsDirective; // Defaults to "\t.quad\t"
- /// getASDirective - Targets can override it to provide different data
- /// directives for various sizes and non-default address spaces.
- virtual const char *getASDirective(unsigned size,
- unsigned AS) const {
- assert(AS > 0 && "Dont know the directives for default addr space");
+ /// getDataASDirective - Return the directive that should be used to emit
+ /// data of the specified size to the specified numeric address space.
+ virtual const char *getDataASDirective(unsigned Size, unsigned AS) const {
+ assert(AS != 0 && "Don't know the directives for default addr space");
return NULL;
}
@@ -631,16 +630,16 @@
// Data directive accessors
//
const char *getData8bitsDirective(unsigned AS = 0) const {
- return AS == 0 ? Data8bitsDirective : getASDirective(8, AS);
+ return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS);
}
const char *getData16bitsDirective(unsigned AS = 0) const {
- return AS == 0 ? Data16bitsDirective : getASDirective(16, AS);
+ return AS == 0 ? Data16bitsDirective : getDataASDirective(16, AS);
}
const char *getData32bitsDirective(unsigned AS = 0) const {
- return AS == 0 ? Data32bitsDirective : getASDirective(32, AS);
+ return AS == 0 ? Data32bitsDirective : getDataASDirective(32, AS);
}
const char *getData64bitsDirective(unsigned AS = 0) const {
- return AS == 0 ? Data64bitsDirective : getASDirective(64, AS);
+ return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
}
Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp?rev=76431&r1=76430&r2=76431&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.cpp Mon Jul 20 12:12:46 2009
@@ -54,25 +54,21 @@
HasSingleParameterDotFile = false;
}
-const char *PIC16TargetAsmInfo::getRomDirective(unsigned size) const
-{
- if (size == 8)
- return RomData8bitsDirective;
- else if (size == 16)
- return RomData16bitsDirective;
- else if (size == 32)
- return RomData32bitsDirective;
- else
- return NULL;
+const char *PIC16TargetAsmInfo::getRomDirective(unsigned Size) const {
+ switch (Size) {
+ case 8: return RomData8bitsDirective;
+ case 16: return RomData16bitsDirective;
+ case 32: return RomData32bitsDirective;
+ default: return NULL;
+ }
}
-const char *PIC16TargetAsmInfo::getASDirective(unsigned size,
- unsigned AS) const {
+const char *PIC16TargetAsmInfo::
+getDataASDirective(unsigned Size, unsigned AS) const {
if (AS == PIC16ISD::ROM_SPACE)
- return getRomDirective(size);
- else
- return NULL;
+ return getRomDirective(Size);
+ return NULL;
}
const Section *
Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h?rev=76431&r1=76430&r2=76431&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h Mon Jul 20 12:12:46 2009
@@ -58,7 +58,7 @@
const char *RomData16bitsDirective;
const char *RomData32bitsDirective;
const char *getRomDirective(unsigned size) const;
- virtual const char *getASDirective(unsigned size, unsigned AS) const;
+ virtual const char *getDataASDirective(unsigned size, unsigned AS) const;
const Section *getBSSSectionForGlobal(const GlobalVariable *GV) const;
const Section *getIDATASectionForGlobal(const GlobalVariable *GV) const;
const Section *getSectionForAuto(const GlobalVariable *GV) const;
From david_goodwin at apple.com Mon Jul 20 12:15:03 2009
From: david_goodwin at apple.com (David Goodwin)
Date: Mon, 20 Jul 2009 17:15:03 -0000
Subject: [llvm-commits] [llvm] r76432 -
/llvm/trunk/tools/bugpoint/ToolRunner.cpp
Message-ID: <200907201715.n6KHF4cI004847@zion.cs.uiuc.edu>
Author: david_goodwin
Date: Mon Jul 20 12:15:03 2009
New Revision: 76432
URL: http://llvm.org/viewvc/llvm-project?rev=76432&view=rev
Log:
For remote execution, must cd to the executable directory since the exe expects to find a dylib in the CWD ('.').
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=76432&r1=76431&r2=76432&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original)
+++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Mon Jul 20 12:15:03 2009
@@ -688,7 +688,6 @@
std::vector ProgramArgs;
- std::string Exec;
if (RemoteClientPath.isEmpty())
ProgramArgs.push_back(OutputBinary.c_str());
else {
@@ -704,10 +703,12 @@
ProgramArgs.push_back(RemoteExtra.c_str());
}
- // Full path to the binary
+ // Full path to the binary. We need to cd to the exec directory because
+ // there is a dylib there that the exec expects to find in the CWD
char* env_pwd = getenv("PWD");
+ std::string Exec = "cd ";
Exec += env_pwd;
- Exec += "/";
+ Exec += "; ./";
Exec += OutputBinary.c_str();
ProgramArgs.push_back(Exec.c_str());
}
From sabre at nondot.org Mon Jul 20 12:23:00 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 17:23:00 -0000
Subject: [llvm-commits] [llvm] r76433 -
/llvm/trunk/include/llvm/Target/TargetMachine.h
Message-ID: <200907201723.n6KHN0nF005080@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 12:23:00 2009
New Revision: 76433
URL: http://llvm.org/viewvc/llvm-project?rev=76433&view=rev
Log:
remove dead forward decl
Modified:
llvm/trunk/include/llvm/Target/TargetMachine.h
Modified: llvm/trunk/include/llvm/Target/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=76433&r1=76432&r2=76433&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetMachine.h (original)
+++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Jul 20 12:23:00 2009
@@ -32,7 +32,6 @@
class JITCodeEmitter;
class ObjectCodeEmitter;
class TargetRegisterInfo;
-class Module;
class PassManagerBase;
class PassManager;
class Pass;
From baldrick at free.fr Mon Jul 20 12:27:45 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 17:27:45 -0000
Subject: [llvm-commits] [gcc-plugin] r76434 - in /gcc-plugin/trunk: Makefile
llvm-cache.c llvm-cache.h
Message-ID: <200907201727.n6KHRjE0005219@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 12:27:45 2009
New Revision: 76434
URL: http://llvm.org/viewvc/llvm-project?rev=76434&view=rev
Log:
Add a generic mechanism for associating a void*
with a gcc tree. The point is that if the tree
is garbage collected then the map entry is auto
removed. Well, it would be if the garbage collector
new about the new GTY type - leave that for later.
Added:
gcc-plugin/trunk/llvm-cache.c
gcc-plugin/trunk/llvm-cache.h
Modified:
gcc-plugin/trunk/Makefile
Modified: gcc-plugin/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=76434&r1=76433&r2=76434&view=diff
==============================================================================
--- gcc-plugin/trunk/Makefile (original)
+++ gcc-plugin/trunk/Makefile Mon Jul 20 12:27:45 2009
@@ -1,21 +1,21 @@
-PLUGIN_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp llvm-types.cpp bits_and_bobs.cpp
-PLUGIN_OBJECT_FILES=$(patsubst %.cpp,%.o,$(PLUGIN_SOURCE_FILES))
+C_SOURCE_FILES=llvm-cache.c
+CPP_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.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
-#CXXFLAGS+=-I$(GCCPLUGINS_DIR)/include -fPIC -O2
+#CFLAGS+=-I$(GCCPLUGINS_DIR)/include -fPIC -O2
-CXXFLAGS+=-Werror -fPIC -g -O2
-CXXFLAGS+=$(shell llvm-config --cppflags)
-CXXFLAGS+=\
- -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
+CFLAGS+=-Werror -fPIC -g -O2
+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
+CXXFLAGS+=$(CFLAGS) $(shell llvm-config --cppflags)
-LDFLAGS+=$(shell llvm-config --ldflags) $(shell llvm-config --libs analysis core target)
+LDFLAGS+=$(shell llvm-config --ldflags) $(shell llvm-config --libs analysis core target x86)
llvm.so: $(PLUGIN_OBJECT_FILES)
$(CXX) -shared $^ -o $@ ${LDFLAGS}
Added: gcc-plugin/trunk/llvm-cache.c
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-cache.c?rev=76434&view=auto
==============================================================================
--- gcc-plugin/trunk/llvm-cache.c (added)
+++ gcc-plugin/trunk/llvm-cache.c Mon Jul 20 12:27:45 2009
@@ -0,0 +1,89 @@
+/* Caching values "in" trees
+Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+Contributed by Chris Lattner (sabre at nondot.org)
+
+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 code lets you to associate a void* with a tree, as if it were cached
+// inside the tree: if the tree is garbage collected and reallocated, then the
+// cached value will have been cleared.
+//===----------------------------------------------------------------------===//
+
+// Plugin headers
+#include "llvm-cache.h"
+
+// GCC headers
+#include "hashtab.h"
+
+#include "stdio.h" //QQ
+
+#define tree_llvm_map_eq tree_map_base_eq
+#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);
+ return tree_map_base_marked_p(p);
+}
+
+static GTY ((if_marked ("debugging_tree_llvm_map_marked_p"),
+ param_is (struct tree_llvm_map)))
+ htab_t llvm_cache;
+
+bool llvm_has_cached (union tree_node *t) {
+ struct tree_map_base in;
+
+ if (!llvm_cache)
+ return false;
+
+ in.from = t;
+ return htab_find (llvm_cache, &in) != NULL;
+}
+
+const void *llvm_get_cached (union tree_node *t) {
+ struct tree_llvm_map *h;
+ struct tree_map_base in;
+
+ if (!llvm_cache)
+ return NULL;
+
+ in.from = t;
+ h = (struct tree_llvm_map *) htab_find (llvm_cache, &in);
+ return h ? h->val : NULL;
+}
+
+const void *llvm_set_cached (union tree_node *t, const void *val) {
+ struct tree_llvm_map **slot;
+ struct tree_map_base in;
+
+ if (!llvm_cache)
+ llvm_cache = htab_create_ggc (1024, tree_llvm_map_hash, tree_llvm_map_eq, NULL);
+
+ in.from = t;
+
+ slot = (struct tree_llvm_map **) htab_find_slot (llvm_cache, &in, INSERT);
+ gcc_assert(slot);
+
+ if (!*slot) {
+ *slot = GGC_NEW (struct tree_llvm_map);
+ (*slot)->base.from = t;
+ }
+
+ (*slot)->val = val;
+}
Added: gcc-plugin/trunk/llvm-cache.h
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-cache.h?rev=76434&view=auto
==============================================================================
--- gcc-plugin/trunk/llvm-cache.h (added)
+++ gcc-plugin/trunk/llvm-cache.h Mon Jul 20 12:27:45 2009
@@ -0,0 +1,61 @@
+/* Caching values "in" trees
+Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+Contributed by Chris Lattner (sabre at nondot.org)
+
+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 code lets you to associate a void* with a tree, as if it were cached
+// inside the tree: if the tree is garbage collected and reallocated, then the
+// cached value will have been cleared.
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CACHE_H
+#define LLVM_CACHE_H
+
+#define IN_GCC
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "ggc.h"
+#include "target.h"
+#include "tree.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+struct GTY(()) tree_llvm_map {
+ struct tree_map_base base;
+ const void *val;
+};
+
+extern bool llvm_has_cached (union tree_node *);
+
+extern const void *llvm_get_cached (union tree_node *);
+
+extern const void *llvm_set_cached (union tree_node *, const void *);
+
+extern void llvm_init_cache (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LLVM_CACHE_H */
From gohman at apple.com Mon Jul 20 12:43:31 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Jul 2009 17:43:31 -0000
Subject: [llvm-commits] [llvm] r76437 - in /llvm/trunk:
include/llvm/Operator.h lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/ScalarEvolution.cpp
lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp
lib/VMCore/Instructions.cpp lib/VMCore/Value.cpp
test/CodeGen/X86/iv-users-in-other-loops.ll
test/Transforms/IndVarSimplify/max-pointer.ll
test/Transforms/InstCombine/add2.ll test/Transforms/InstCombine/add3.ll
test/Transforms/InstCombine/cast_ptr.ll
Message-ID: <200907201743.n6KHhVnj005680@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jul 20 12:43:30 2009
New Revision: 76437
URL: http://llvm.org/viewvc/llvm-project?rev=76437&view=rev
Log:
Revert the addition of hasNoPointerOverflow to GEPOperator.
Getelementptrs that are defined to wrap are virtually useless to
optimization, and getelementptrs that are undefined on any kind
of overflow are too restrictive -- it's difficult to ensure that
all intermediate addresses are within bounds. I'm going to take
a different approach.
Remove a few optimizations that depended on this flag.
Added:
llvm/trunk/test/Transforms/InstCombine/add3.ll (contents, props changed)
- copied, changed from r76422, llvm/trunk/test/Transforms/InstCombine/add2.ll
Modified:
llvm/trunk/include/llvm/Operator.h
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/lib/VMCore/Constants.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
llvm/trunk/lib/VMCore/Value.cpp
llvm/trunk/test/CodeGen/X86/iv-users-in-other-loops.ll
llvm/trunk/test/Transforms/IndVarSimplify/max-pointer.ll
llvm/trunk/test/Transforms/InstCombine/add2.ll
llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll
Modified: llvm/trunk/include/llvm/Operator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Operator.h (original)
+++ llvm/trunk/include/llvm/Operator.h Mon Jul 20 12:43:30 2009
@@ -171,24 +171,6 @@
return true;
}
- /// hasNoPointerOverflow - Return true if this GetElementPtr is known to
- /// never have overflow in the pointer addition portions of its effective
- /// computation. GetElementPtr computation involves several phases;
- /// overflow can be considered to occur in index typecasting, array index
- /// scaling, and the addition of the base pointer with offsets. This flag
- /// only applies to the last of these. The operands are added to the base
- /// pointer one at a time from left to right. This function returns false
- /// if any of these additions results in an address value which is not
- /// known to be within the allocated address space that the base pointer
- /// points into, or within one element (of the original allocation) past
- /// the end.
- bool hasNoPointerOverflow() const {
- return SubclassOptionalData & (1 << 0);
- }
- void setHasNoPointerOverflow(bool B) {
- SubclassOptionalData = (SubclassOptionalData & ~(1 << 0)) | (B << 0);
- }
-
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const GEPOperator *) { return true; }
static inline bool classof(const GetElementPtrInst *) { return true; }
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Jul 20 12:43:30 2009
@@ -38,13 +38,8 @@
// Useful predicates
//===----------------------------------------------------------------------===//
-static const User *isGEP(const Value *V) {
- if (const GEPOperator *GEP = dyn_cast(V))
- // For the purposes of BasicAliasAnalysis, if the GEP has overflow it
- // could do crazy things.
- if (GEP->hasNoPointerOverflow())
- return GEP;
- return 0;
+static const GEPOperator *isGEP(const Value *V) {
+ return dyn_cast(V);
}
static const Value *GetGEPOperands(const Value *V,
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jul 20 12:43:30 2009
@@ -2938,15 +2938,10 @@
return getSCEV(U->getOperand(0));
break;
- case Instruction::IntToPtr:
- if (!TD) break; // Without TD we can't analyze pointers.
- return getTruncateOrZeroExtend(getSCEV(U->getOperand(0)),
- TD->getIntPtrType());
-
- case Instruction::PtrToInt:
- if (!TD) break; // Without TD we can't analyze pointers.
- return getTruncateOrZeroExtend(getSCEV(U->getOperand(0)),
- U->getType());
+ // It's tempting to handle inttoptr and ptrtoint, however this can
+ // lead to pointer expressions which cannot be expanded to GEPs
+ // (because they may overflow). For now, the only pointer-typed
+ // expressions we handle are GEPs and address literals.
case Instruction::GetElementPtr:
if (!TD) break; // Without TD we can't analyze pointers.
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jul 20 12:43:30 2009
@@ -2276,31 +2276,6 @@
return R;
}
- // add (cast *A to intptrtype) B ->
- // cast (GEP (cast *A to i8*) B) --> intptrtype
- {
- CastInst *CI = dyn_cast(LHS);
- Value *Other = RHS;
- if (!CI) {
- CI = dyn_cast(RHS);
- Other = LHS;
- }
- if (CI && CI->getType()->isSized() &&
- (CI->getType()->getScalarSizeInBits() ==
- TD->getIntPtrType()->getPrimitiveSizeInBits())
- && isa(CI->getOperand(0)->getType())) {
- unsigned AS =
- cast(CI->getOperand(0)->getType())->getAddressSpace();
- Value *I2 = InsertBitCastBefore(CI->getOperand(0),
- Context->getPointerType(Type::Int8Ty, AS), I);
- GetElementPtrInst *GEP = GetElementPtrInst::Create(I2, Other, "ctg2");
- // A GEP formed from an arbitrary add may overflow.
- cast(GEP)->setHasNoPointerOverflow(false);
- I2 = InsertNewInstBefore(GEP, I);
- return new PtrToIntInst(I2, CI->getType());
- }
- }
-
// add (select X 0 (sub n A)) A --> select X A n
{
SelectInst *SI = dyn_cast(LHS);
@@ -8914,65 +8889,7 @@
if (Instruction *I = commonCastTransforms(CI))
return I;
-
- const Type *DestPointee = cast(CI.getType())->getElementType();
- if (!DestPointee->isSized()) return 0;
- // If this is inttoptr(add (ptrtoint x), cst), try to turn this into a GEP.
- ConstantInt *Cst;
- Value *X;
- if (match(CI.getOperand(0), m_Add(m_Cast(m_Value(X)),
- m_ConstantInt(Cst)), *Context)) {
- // If the source and destination operands have the same type, see if this
- // is a single-index GEP.
- if (X->getType() == CI.getType()) {
- // Get the size of the pointee type.
- uint64_t Size = TD->getTypeAllocSize(DestPointee);
-
- // Convert the constant to intptr type.
- APInt Offset = Cst->getValue();
- Offset.sextOrTrunc(TD->getPointerSizeInBits());
-
- // If Offset is evenly divisible by Size, we can do this xform.
- if (Size && !APIntOps::srem(Offset, APInt(Offset.getBitWidth(), Size))){
- Offset = APIntOps::sdiv(Offset, APInt(Offset.getBitWidth(), Size));
- GetElementPtrInst *GEP =
- GetElementPtrInst::Create(X, Context->getConstantInt(Offset));
- // A gep synthesized from inttoptr+add+ptrtoint must be assumed to
- // potentially overflow, in the absense of further analysis.
- cast(GEP)->setHasNoPointerOverflow(false);
- return GEP;
- }
- }
- // TODO: Could handle other cases, e.g. where add is indexing into field of
- // struct etc.
- } else if (CI.getOperand(0)->hasOneUse() &&
- match(CI.getOperand(0), m_Add(m_Value(X),
- m_ConstantInt(Cst)), *Context)) {
- // Otherwise, if this is inttoptr(add x, cst), try to turn this into an
- // "inttoptr+GEP" instead of "add+intptr".
-
- // Get the size of the pointee type.
- uint64_t Size = TD->getTypeAllocSize(DestPointee);
-
- // Convert the constant to intptr type.
- APInt Offset = Cst->getValue();
- Offset.sextOrTrunc(TD->getPointerSizeInBits());
-
- // If Offset is evenly divisible by Size, we can do this xform.
- if (Size && !APIntOps::srem(Offset, APInt(Offset.getBitWidth(), Size))){
- Offset = APIntOps::sdiv(Offset, APInt(Offset.getBitWidth(), Size));
-
- Instruction *P = InsertNewInstBefore(new IntToPtrInst(X, CI.getType(),
- "tmp"), CI);
- GetElementPtrInst *GEP =
- GetElementPtrInst::Create(P, Context->getConstantInt(Offset), "tmp");
- // A gep synthesized from inttoptr+add+ptrtoint must be assumed to
- // potentially overflow, in the absense of further analysis.
- cast(GEP)->setHasNoPointerOverflow(false);
- return GEP;
- }
- }
return 0;
}
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jul 20 12:43:30 2009
@@ -475,11 +475,8 @@
static GetElementPtrConstantExpr *Create(Constant *C,
const std::vector&IdxList,
const Type *DestTy) {
- GetElementPtrConstantExpr *Result = new(IdxList.size() + 1)
- GetElementPtrConstantExpr(C, IdxList, DestTy);
- // Getelementptr defaults to having no pointer overflow.
- cast(Result)->setHasNoPointerOverflow(true);
- return Result;
+ return
+ new(IdxList.size() + 1) GetElementPtrConstantExpr(C, IdxList, DestTy);
}
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Jul 20 12:43:30 2009
@@ -1023,9 +1023,6 @@
OL[i+1] = Idx[i];
setName(Name);
-
- // GetElementPtr instructions have undefined results on overflow by default.
- cast(this)->setHasNoPointerOverflow(true);
}
void GetElementPtrInst::init(Value *Ptr, Value *Idx, const std::string &Name) {
@@ -1035,9 +1032,6 @@
OL[1] = Idx;
setName(Name);
-
- // GetElementPtr instructions have undefined results on overflow by default.
- cast(this)->setHasNoPointerOverflow(true);
}
GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI)
@@ -1049,10 +1043,6 @@
Use *GEPIOL = GEPI.OperandList;
for (unsigned i = 0, E = NumOperands; i != E; ++i)
OL[i] = GEPIOL[i];
-
- // Transfer the hasNoPointerOverflow() value from the original GEPI.
- cast(this)
- ->setHasNoPointerOverflow(cast(GEPI).hasNoPointerOverflow());
}
GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
Modified: llvm/trunk/lib/VMCore/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Value.cpp (original)
+++ llvm/trunk/lib/VMCore/Value.cpp Mon Jul 20 12:43:30 2009
@@ -363,8 +363,6 @@
unsigned MaxLookup = 6;
do {
if (GEPOperator *GEP = dyn_cast(V)) {
- if (!GEP->hasNoPointerOverflow())
- return V;
V = GEP->getPointerOperand();
} else if (Operator::getOpcode(V) == Instruction::BitCast) {
V = cast(V)->getOperand(0);
Modified: llvm/trunk/test/CodeGen/X86/iv-users-in-other-loops.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/iv-users-in-other-loops.ll?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/iv-users-in-other-loops.ll (original)
+++ llvm/trunk/test/CodeGen/X86/iv-users-in-other-loops.ll Mon Jul 20 12:43:30 2009
@@ -3,8 +3,8 @@
; RUN: grep dec %t | count 2
; RUN: grep addq %t | count 13
; RUN: not grep addb %t
-; RUN: grep leaq %t | count 8
-; RUN: grep leal %t | count 4
+; RUN: grep leaq %t | count 9
+; RUN: grep leal %t | count 3
; RUN: grep movq %t | count 5
; IV users in each of the loops from other loops shouldn't cause LSR
Modified: llvm/trunk/test/Transforms/IndVarSimplify/max-pointer.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/max-pointer.ll?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/IndVarSimplify/max-pointer.ll (original)
+++ llvm/trunk/test/Transforms/IndVarSimplify/max-pointer.ll Mon Jul 20 12:43:30 2009
@@ -22,58 +22,6 @@
ret void
}
-define void @bar(i8* %str1Ptr, i64 %s, i8* %inLastBytePtr) nounwind {
-entry:
- %str2Ptr = inttoptr i64 %s to i8*
- %0 = icmp ult i8* %str2Ptr, %str1Ptr ; [#uses=1]
- %str2Ptr_addr.0 = select i1 %0, i8* %str1Ptr, i8* %str2Ptr ; [#uses=1]
- br label %bb2
-
-bb2: ; preds = %bb2, %entry
- %str2Ptr_addr.1 = phi i8* [ %str2Ptr_addr.0, %entry ], [ %1, %bb2 ] ; [#uses=1]
- %1 = getelementptr i8* %str2Ptr_addr.1, i64 1 ; [#uses=2]
- %2 = icmp ult i8* %1, %inLastBytePtr ; [#uses=0]
- br i1 false, label %bb2, label %return
-
-return: ; preds = %bb2
- ret void
-}
-
-define void @qux(i64 %t, i64 %s, i8* %inLastBytePtr) nounwind {
-entry:
- %str1Ptr = inttoptr i64 %t to i8*
- %str2Ptr = inttoptr i64 %s to i8*
- %0 = icmp ult i8* %str2Ptr, %str1Ptr ; [#uses=1]
- %str2Ptr_addr.0 = select i1 %0, i8* %str1Ptr, i8* %str2Ptr ; [#uses=1]
- br label %bb2
-
-bb2: ; preds = %bb2, %entry
- %str2Ptr_addr.1 = phi i8* [ %str2Ptr_addr.0, %entry ], [ %1, %bb2 ] ; [#uses=1]
- %1 = getelementptr i8* %str2Ptr_addr.1, i64 1 ; [#uses=2]
- %2 = icmp ult i8* %1, %inLastBytePtr ; [#uses=0]
- br i1 false, label %bb2, label %return
-
-return: ; preds = %bb2
- ret void
-}
-
-define void @vor(i64 %t, i8* %str2Ptr, i8* %inLastBytePtr) nounwind {
-entry:
- %str1Ptr = inttoptr i64 %t to i8*
- %0 = icmp ult i8* %str2Ptr, %str1Ptr ; [#uses=1]
- %str2Ptr_addr.0 = select i1 %0, i8* %str1Ptr, i8* %str2Ptr ; [#uses=1]
- br label %bb2
-
-bb2: ; preds = %bb2, %entry
- %str2Ptr_addr.1 = phi i8* [ %str2Ptr_addr.0, %entry ], [ %1, %bb2 ] ; [#uses=1]
- %1 = getelementptr i8* %str2Ptr_addr.1, i64 1 ; [#uses=2]
- %2 = icmp ult i8* %1, %inLastBytePtr ; [#uses=0]
- br i1 false, label %bb2, label %return
-
-return: ; preds = %bb2
- ret void
-}
-
define void @sfoo(i8* %str1Ptr, i8* %str2Ptr, i8* %inLastBytePtr) nounwind {
entry:
%0 = icmp slt i8* %str2Ptr, %str1Ptr ; [#uses=1]
@@ -89,57 +37,3 @@
return: ; preds = %bb2
ret void
}
-
-define void @sbar(i8* %str1Ptr, i64 %s, i8* %inLastBytePtr) nounwind {
-entry:
- %str2Ptr = inttoptr i64 %s to i8*
- %0 = icmp slt i8* %str2Ptr, %str1Ptr ; [#uses=1]
- %str2Ptr_addr.0 = select i1 %0, i8* %str1Ptr, i8* %str2Ptr ; [#uses=1]
- br label %bb2
-
-bb2: ; preds = %bb2, %entry
- %str2Ptr_addr.1 = phi i8* [ %str2Ptr_addr.0, %entry ], [ %1, %bb2 ] ; [#uses=1]
- %1 = getelementptr i8* %str2Ptr_addr.1, i64 1 ; [#uses=2]
- %2 = icmp slt i8* %1, %inLastBytePtr ; [#uses=0]
- br i1 false, label %bb2, label %return
-
-return: ; preds = %bb2
- ret void
-}
-
-define void @squx(i64 %t, i64 %s, i8* %inLastBytePtr) nounwind {
-entry:
- %str1Ptr = inttoptr i64 %t to i8*
- %str2Ptr = inttoptr i64 %s to i8*
- %0 = icmp slt i8* %str2Ptr, %str1Ptr ; [#uses=1]
- %str2Ptr_addr.0 = select i1 %0, i8* %str1Ptr, i8* %str2Ptr ; [#uses=1]
- br label %bb2
-
-bb2: ; preds = %bb2, %entry
- %str2Ptr_addr.1 = phi i8* [ %str2Ptr_addr.0, %entry ], [ %1, %bb2 ] ; [#uses=1]
- %1 = getelementptr i8* %str2Ptr_addr.1, i64 1 ; [#uses=2]
- %2 = icmp slt i8* %1, %inLastBytePtr ; [#uses=0]
- br i1 false, label %bb2, label %return
-
-return: ; preds = %bb2
- ret void
-}
-
-define void @svor(i64 %t, i8* %str2Ptr, i8* %inLastBytePtr) nounwind {
-entry:
- %str1Ptr = inttoptr i64 %t to i8*
- %0 = icmp slt i8* %str2Ptr, %str1Ptr ; [#uses=1]
- %str2Ptr_addr.0 = select i1 %0, i8* %str1Ptr, i8* %str2Ptr ; [#uses=1]
- br label %bb2
-
-bb2: ; preds = %bb2, %entry
- %str2Ptr_addr.1 = phi i8* [ %str2Ptr_addr.0, %entry ], [ %1, %bb2 ] ; [#uses=1]
- %1 = getelementptr i8* %str2Ptr_addr.1, i64 1 ; [#uses=2]
- %2 = icmp slt i8* %1, %inLastBytePtr ; [#uses=0]
- br i1 false, label %bb2, label %return
-
-return: ; preds = %bb2
- ret void
-}
-
-
Modified: llvm/trunk/test/Transforms/InstCombine/add2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/add2.ll?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/add2.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/add2.ll Mon Jul 20 12:43:30 2009
@@ -1,9 +1,4 @@
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN: grep -v OK | not grep add
-
-;; Target triple for gep raising case below.
-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 = "i686-apple-darwin8"
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep add
define i64 @test1(i64 %A, i32 %B) {
%tmp12 = zext i32 %B to i64
@@ -13,23 +8,6 @@
ret i64 %tmp6
}
-; PR1795
-define void @test2(i32 %.val24) {
-EntryBlock:
- add i32 %.val24, -12
- inttoptr i32 %0 to i32*
- store i32 1, i32* %1
- add i32 %.val24, -16
- inttoptr i32 %2 to i32*
- getelementptr i32* %3, i32 1
- load i32* %4
- tail call i32 @callee( i32 %5 )
- ret void
-}
-
-declare i32 @callee(i32)
-
-
define i32 @test3(i32 %A) {
%B = and i32 %A, 7
%C = and i32 %A, 32
Copied: llvm/trunk/test/Transforms/InstCombine/add3.ll (from r76422, llvm/trunk/test/Transforms/InstCombine/add2.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/add3.ll?p2=llvm/trunk/test/Transforms/InstCombine/add3.ll&p1=llvm/trunk/test/Transforms/InstCombine/add2.ll&r1=76422&r2=76437&rev=76437&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/add2.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/add3.ll Mon Jul 20 12:43:30 2009
@@ -1,18 +1,9 @@
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN: grep -v OK | not grep add
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep inttoptr | count 2
;; Target triple for gep raising case below.
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 = "i686-apple-darwin8"
-define i64 @test1(i64 %A, i32 %B) {
- %tmp12 = zext i32 %B to i64
- %tmp3 = shl i64 %tmp12, 32
- %tmp5 = add i64 %tmp3, %A
- %tmp6 = and i64 %tmp5, 123
- ret i64 %tmp6
-}
-
; PR1795
define void @test2(i32 %.val24) {
EntryBlock:
@@ -28,19 +19,3 @@
}
declare i32 @callee(i32)
-
-
-define i32 @test3(i32 %A) {
- %B = and i32 %A, 7
- %C = and i32 %A, 32
- %F = add i32 %B, %C
- ret i32 %F
-}
-
-define i32 @test4(i32 %A) {
- %B = and i32 %A, 128
- %C = lshr i32 %A, 30
- %F = add i32 %B, %C
- ret i32 %F
-}
-
Propchange: llvm/trunk/test/Transforms/InstCombine/add3.ll
------------------------------------------------------------------------------
cvs2svn:cvs-rev = 1.2
Propchange: llvm/trunk/test/Transforms/InstCombine/add3.ll
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: llvm/trunk/test/Transforms/InstCombine/add3.ll
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: llvm/trunk/test/Transforms/InstCombine/add3.ll
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll?rev=76437&r1=76436&r2=76437&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast_ptr.ll Mon Jul 20 12:43:30 2009
@@ -1,8 +1,15 @@
; Tests to make sure elimination of casts is working correctly
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | FileCheck %s
target datalayout = "p:32:32"
+; This shouldn't convert to getelementptr because the relationship
+; between the arithmetic and the layout of allocated memory is
+; entirely unknown.
+; CHECK: @test1
+; CHECK: ptrtoint
+; CHECK: add
+; CHECK: inttoptr
define i8* @test1(i8* %t) {
%tmpc = ptrtoint i8* %t to i32 ; [#uses=1]
%tmpa = add i32 %tmpc, 32 ; [#uses=1]
@@ -10,6 +17,9 @@
ret i8* %tv
}
+; These casts should be folded away.
+; CHECK: @test2
+; CHECK: icmp eq i8* %a, %b
define i1 @test2(i8* %a, i8* %b) {
%tmpa = ptrtoint i8* %a to i32 ; [#uses=1]
%tmpb = ptrtoint i8* %b to i32 ; [#uses=1]
From gohman at apple.com Mon Jul 20 12:44:17 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Jul 2009 17:44:17 -0000
Subject: [llvm-commits] [llvm] r76438 -
/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
Message-ID: <200907201744.n6KHiHeq005714@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jul 20 12:44:17 2009
New Revision: 76438
URL: http://llvm.org/viewvc/llvm-project?rev=76438&view=rev
Log:
Update this comment.
Modified:
llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=76438&r1=76437&r2=76438&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Mon Jul 20 12:44:17 2009
@@ -215,13 +215,11 @@
/// expandAddToGEP - Expand a SCEVAddExpr with a pointer type into a GEP
/// instead of using ptrtoint+arithmetic+inttoptr. This helps
-/// BasicAliasAnalysis analyze the result. However, it suffers from the
-/// underlying bug described in PR2831. Addition in LLVM currently always
-/// has two's complement wrapping guaranteed. However, the semantics for
-/// getelementptr overflow are ambiguous. In the common case though, this
-/// expansion gets used when a GEP in the original code has been converted
-/// into integer arithmetic, in which case the resulting code will be no
-/// more undefined than it was originally.
+/// BasicAliasAnalysis analyze the result.
+///
+/// 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: It might seem desirable for this function to be more
/// loop-aware. If some of the indices are loop-invariant while others
From sabre at nondot.org Mon Jul 20 12:47:48 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 17:47:48 -0000
Subject: [llvm-commits] [llvm] r76439 -
/llvm/trunk/include/llvm/Target/TargetAsmInfo.h
Message-ID: <200907201747.n6KHlmcF005895@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 12:47:48 2009
New Revision: 76439
URL: http://llvm.org/viewvc/llvm-project?rev=76439&view=rev
Log:
add some fixme's and cleanups. TargetAsmInfo shouldn't depend on VMCore eventually.
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=76439&r1=76438&r2=76439&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Jul 20 12:47:48 2009
@@ -566,12 +566,14 @@
/// call to be explicit llvm code if it wants to. This is useful for
/// turning simple inline asms into LLVM intrinsics, which gives the
/// compiler more information about the behavior of the code.
+// FIXME: Move this to TargetLowering.
virtual bool ExpandInlineAsm(CallInst *CI) const {
return false;
}
/// emitUsedDirectiveFor - This hook allows targets to selectively decide
/// not to emit the UsedDirective for some symbols in llvm.used.
+// FIXME: REMOVE this (rdar://7071300)
virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
Mangler *Mang) const {
return (GV!=0);
@@ -586,6 +588,7 @@
/// SectionKindForGlobal - This hook allows the target to select proper
/// section kind used for global emission.
+// FIXME: Eliminate this.
virtual SectionKind::Kind
SectionKindForGlobal(const GlobalValue *GV) const;
@@ -598,36 +601,37 @@
/// SectionFlagsForGlobal - This hook allows the target to select proper
/// section flags either for given global or for section.
+// FIXME: Eliminate this.
virtual unsigned
SectionFlagsForGlobal(const GlobalValue *GV = NULL,
const char* name = NULL) const;
/// SectionForGlobal - This hooks returns proper section name for given
/// global with all necessary flags and marks.
+// FIXME: Eliminate this.
virtual const Section* SectionForGlobal(const GlobalValue *GV) const;
// Helper methods for SectionForGlobal
+// FIXME: Eliminate this.
virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
SectionKind::Kind kind) const;
- const std::string& getSectionFlags(unsigned Flags) const;
+ const std::string &getSectionFlags(unsigned Flags) const;
virtual std::string printSectionFlags(unsigned flags) const { return ""; }
+// FIXME: Eliminate this.
virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
-
virtual const Section* SelectSectionForMachineConst(const Type *Ty) const;
/// getSLEB128Size - Compute the number of bytes required for a signed
/// leb128 value.
-
static unsigned getSLEB128Size(int Value);
/// getULEB128Size - Compute the number of bytes required for an unsigned
/// leb128 value.
-
static unsigned getULEB128Size(unsigned Value);
- // Data directive accessors
+ // Data directive accessors.
//
const char *getData8bitsDirective(unsigned AS = 0) const {
return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS);
From gohman at apple.com Mon Jul 20 12:51:11 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Jul 2009 17:51:11 -0000
Subject: [llvm-commits] [llvm] r76440 - /llvm/trunk/include/llvm/Operator.h
Message-ID: <200907201751.n6KHpBo0006249@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jul 20 12:51:10 2009
New Revision: 76440
URL: http://llvm.org/viewvc/llvm-project?rev=76440&view=rev
Log:
Drop UDivOperator and introduce SDivOperator. Thanks to Chris
for noticing this.
Modified:
llvm/trunk/include/llvm/Operator.h
Modified: llvm/trunk/include/llvm/Operator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=76440&r1=76439&r2=76440&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Operator.h (original)
+++ llvm/trunk/include/llvm/Operator.h Mon Jul 20 12:51:10 2009
@@ -100,9 +100,9 @@
}
};
-/// UDivOperator - An Operator with opcode Instruction::UDiv.
+/// SDivOperator - An Operator with opcode Instruction::SDiv.
///
-class UDivOperator : public Operator {
+class SDivOperator : public Operator {
public:
/// isExact - Test whether this division is known to be exact, with
/// zero remainder.
@@ -114,12 +114,12 @@
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const UDivOperator *) { return true; }
+ static inline bool classof(const SDivOperator *) { return true; }
static inline bool classof(const ConstantExpr *CE) {
- return CE->getOpcode() == Instruction::UDiv;
+ return CE->getOpcode() == Instruction::SDiv;
}
static inline bool classof(const Instruction *I) {
- return I->getOpcode() == Instruction::UDiv;
+ return I->getOpcode() == Instruction::SDiv;
}
static inline bool classof(const Value *V) {
return (isa(V) && classof(cast(V))) ||
From sabre at nondot.org Mon Jul 20 12:51:36 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 17:51:36 -0000
Subject: [llvm-commits] [llvm] r76441 - in /llvm/trunk:
include/llvm/Target/TargetLowering.h lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
Message-ID: <200907201751.n6KHpbHN006273@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 12:51:36 2009
New Revision: 76441
URL: http://llvm.org/viewvc/llvm-project?rev=76441&view=rev
Log:
Copy ExpandInlineAsm to TargetLowering from TargetAsmInfo.
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.h
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=76441&r1=76440&r2=76441&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jul 20 12:51:36 2009
@@ -1270,6 +1270,15 @@
// Inline Asm Support hooks
//
+ /// ExpandInlineAsm - This hook allows the target to expand an inline asm
+ /// call to be explicit llvm code if it wants to. This is useful for
+ /// turning simple inline asms into LLVM intrinsics, which gives the
+ /// compiler more information about the behavior of the code.
+ // FIXME: Move this to TargetLowering.
+ virtual bool ExpandInlineAsm(CallInst *CI) const {
+ return false;
+ }
+
enum ConstraintType {
C_Register, // Constraint represents specific register(s).
C_RegisterClass, // Constraint represents any of register(s) in class.
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=76441&r1=76440&r2=76441&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jul 20 12:51:36 2009
@@ -22,6 +22,7 @@
#include "llvm/GlobalAlias.h"
#include "llvm/GlobalVariable.h"
#include "llvm/Function.h"
+#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/LLVMContext.h"
#include "llvm/ADT/BitVector.h"
@@ -8658,6 +8659,100 @@
// X86 Inline Assembly Support
//===----------------------------------------------------------------------===//
+static bool LowerToBSwap(CallInst *CI) {
+ // FIXME: this should verify that we are targetting a 486 or better. If not,
+ // we will turn this bswap into something that will be lowered to logical ops
+ // instead of emitting the bswap asm. For now, we don't support 486 or lower
+ // so don't worry about this.
+
+ // Verify this is a simple bswap.
+ if (CI->getNumOperands() != 2 ||
+ CI->getType() != CI->getOperand(1)->getType() ||
+ !CI->getType()->isInteger())
+ return false;
+
+ const IntegerType *Ty = dyn_cast(CI->getType());
+ if (!Ty || Ty->getBitWidth() % 16 != 0)
+ return false;
+
+ // Okay, we can do this xform, do so now.
+ const Type *Tys[] = { Ty };
+ Module *M = CI->getParent()->getParent()->getParent();
+ Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 1);
+
+ Value *Op = CI->getOperand(1);
+ Op = CallInst::Create(Int, Op, CI->getName(), CI);
+
+ CI->replaceAllUsesWith(Op);
+ CI->eraseFromParent();
+ return true;
+}
+
+bool X86TargetLowering::ExpandInlineAsm(CallInst *CI) const {
+ InlineAsm *IA = cast(CI->getCalledValue());
+ std::vector Constraints = IA->ParseConstraints();
+
+ std::string AsmStr = IA->getAsmString();
+
+ // TODO: should remove alternatives from the asmstring: "foo {a|b}" -> "foo a"
+ std::vector AsmPieces;
+ SplitString(AsmStr, AsmPieces, "\n"); // ; as separator?
+
+ switch (AsmPieces.size()) {
+ default: return false;
+ case 1:
+ AsmStr = AsmPieces[0];
+ AsmPieces.clear();
+ SplitString(AsmStr, AsmPieces, " \t"); // Split with whitespace.
+
+ // bswap $0
+ if (AsmPieces.size() == 2 &&
+ (AsmPieces[0] == "bswap" ||
+ AsmPieces[0] == "bswapq" ||
+ AsmPieces[0] == "bswapl") &&
+ (AsmPieces[1] == "$0" ||
+ AsmPieces[1] == "${0:q}")) {
+ // No need to check constraints, nothing other than the equivalent of
+ // "=r,0" would be valid here.
+ return LowerToBSwap(CI);
+ }
+ // rorw $$8, ${0:w} --> llvm.bswap.i16
+ if (CI->getType() == Type::Int16Ty &&
+ AsmPieces.size() == 3 &&
+ AsmPieces[0] == "rorw" &&
+ AsmPieces[1] == "$$8," &&
+ AsmPieces[2] == "${0:w}" &&
+ IA->getConstraintString() == "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}") {
+ return LowerToBSwap(CI);
+ }
+ break;
+ case 3:
+ if (CI->getType() == Type::Int64Ty && Constraints.size() >= 2 &&
+ Constraints[0].Codes.size() == 1 && Constraints[0].Codes[0] == "A" &&
+ Constraints[1].Codes.size() == 1 && Constraints[1].Codes[0] == "0") {
+ // bswap %eax / bswap %edx / xchgl %eax, %edx -> llvm.bswap.i64
+ std::vector Words;
+ SplitString(AsmPieces[0], Words, " \t");
+ if (Words.size() == 2 && Words[0] == "bswap" && Words[1] == "%eax") {
+ Words.clear();
+ SplitString(AsmPieces[1], Words, " \t");
+ if (Words.size() == 2 && Words[0] == "bswap" && Words[1] == "%edx") {
+ Words.clear();
+ SplitString(AsmPieces[2], Words, " \t,");
+ if (Words.size() == 3 && Words[0] == "xchgl" && Words[1] == "%eax" &&
+ Words[2] == "%edx") {
+ return LowerToBSwap(CI);
+ }
+ }
+ }
+ }
+ break;
+ }
+ return false;
+}
+
+
+
/// getConstraintType - Given a constraint letter, return the type of
/// constraint it is for this target.
X86TargetLowering::ConstraintType
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=76441&r1=76440&r2=76441&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Jul 20 12:51:36 2009
@@ -420,6 +420,8 @@
SDValue getReturnAddressFrameIndex(SelectionDAG &DAG);
+ virtual bool ExpandInlineAsm(CallInst *CI) const;
+
ConstraintType getConstraintType(const std::string &Constraint) const;
std::vector
From sabre at nondot.org Mon Jul 20 12:52:52 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 17:52:52 -0000
Subject: [llvm-commits] [llvm] r76442 -
/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
Message-ID: <200907201752.n6KHqrBB006353@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 12:52:52 2009
New Revision: 76442
URL: http://llvm.org/viewvc/llvm-project?rev=76442&view=rev
Log:
use ExpandInlineAsm on TargetLowering instead of TargetAsmInfo.
Modified:
llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=76442&r1=76441&r2=76442&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Mon Jul 20 12:52:52 2009
@@ -23,10 +23,8 @@
#include "llvm/IntrinsicInst.h"
#include "llvm/LLVMContext.h"
#include "llvm/Pass.h"
-#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLowering.h"
-#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/Utils/AddrModeMatcher.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
@@ -859,18 +857,16 @@
} else if (CallInst *CI = dyn_cast(I)) {
// If we found an inline asm expession, and if the target knows how to
// lower it to normal LLVM code, do so now.
- if (TLI && isa(CI->getCalledValue()))
- if (const TargetAsmInfo *TAI =
- TLI->getTargetMachine().getTargetAsmInfo()) {
- if (TAI->ExpandInlineAsm(CI)) {
- BBI = BB.begin();
- // Avoid processing instructions out of order, which could cause
- // reuse before a value is defined.
- SunkAddrs.clear();
- } else
- // Sink address computing for memory operands into the block.
- MadeChange |= OptimizeInlineAsmInst(I, &(*CI), SunkAddrs);
- }
+ if (TLI && isa(CI->getCalledValue())) {
+ if (TLI->ExpandInlineAsm(CI)) {
+ BBI = BB.begin();
+ // Avoid processing instructions out of order, which could cause
+ // reuse before a value is defined.
+ SunkAddrs.clear();
+ } else
+ // Sink address computing for memory operands into the block.
+ MadeChange |= OptimizeInlineAsmInst(I, &(*CI), SunkAddrs);
+ }
}
}
From sabre at nondot.org Mon Jul 20 12:57:41 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 17:57:41 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r76444 -
/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Message-ID: <200907201757.n6KHvgrw006578@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 12:57:40 2009
New Revision: 76444
URL: http://llvm.org/viewvc/llvm-project?rev=76444&view=rev
Log:
use ExpandInlineAsm from TargetLowering instead of TargetAsmInfo.
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=76444&r1=76443&r2=76444&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jul 20 12:57:40 2009
@@ -39,6 +39,8 @@
#include "llvm/System/Host.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetAsmInfo.h"
+#undef RET
+#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/StringExtras.h"
@@ -4589,8 +4591,8 @@
// Give the backend a chance to upgrade the inline asm to LLVM code. This
// handles some common cases that LLVM has intrinsics for, e.g. x86 bswap ->
// llvm.bswap.
- if (const TargetAsmInfo *TAI = TheTarget->getTargetAsmInfo())
- TAI->ExpandInlineAsm(CV);
+ if (const TargetLowering *TLI = TheTarget->getTargetLowering())
+ TLI->ExpandInlineAsm(CV);
if (NumChoices>1)
FreeConstTupleStrings(ReplacementStrings, NumInputs+NumOutputs);
From sabre at nondot.org Mon Jul 20 12:59:33 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 17:59:33 -0000
Subject: [llvm-commits] [llvm] r76445 - in /llvm/trunk:
include/llvm/Target/TargetAsmInfo.h lib/Target/X86/X86TargetAsmInfo.cpp
lib/Target/X86/X86TargetAsmInfo.h
Message-ID: <200907201759.n6KHxXLv006644@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 12:59:32 2009
New Revision: 76445
URL: http://llvm.org/viewvc/llvm-project?rev=76445&view=rev
Log:
remove TargetAsmInfo::ExpandInlineAsm
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=76445&r1=76444&r2=76445&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Jul 20 12:59:32 2009
@@ -562,15 +562,6 @@
/// length.
virtual unsigned getInlineAsmLength(const char *Str) const;
- /// ExpandInlineAsm - This hook allows the target to expand an inline asm
- /// call to be explicit llvm code if it wants to. This is useful for
- /// turning simple inline asms into LLVM intrinsics, which gives the
- /// compiler more information about the behavior of the code.
-// FIXME: Move this to TargetLowering.
- virtual bool ExpandInlineAsm(CallInst *CI) const {
- return false;
- }
-
/// emitUsedDirectiveFor - This hook allows targets to selectively decide
/// not to emit the UsedDirective for some symbols in llvm.used.
// FIXME: REMOVE this (rdar://7071300)
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=76445&r1=76444&r2=76445&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jul 20 12:59:32 2009
@@ -333,99 +333,5 @@
SectionEndDirectiveSuffix = "\tends\n";
}
-template
-bool X86TargetAsmInfo::LowerToBSwap(CallInst *CI) const {
- // FIXME: this should verify that we are targetting a 486 or better. If not,
- // we will turn this bswap into something that will be lowered to logical ops
- // instead of emitting the bswap asm. For now, we don't support 486 or lower
- // so don't worry about this.
-
- // Verify this is a simple bswap.
- if (CI->getNumOperands() != 2 ||
- CI->getType() != CI->getOperand(1)->getType() ||
- !CI->getType()->isInteger())
- return false;
-
- const IntegerType *Ty = dyn_cast(CI->getType());
- if (!Ty || Ty->getBitWidth() % 16 != 0)
- return false;
-
- // Okay, we can do this xform, do so now.
- const Type *Tys[] = { Ty };
- Module *M = CI->getParent()->getParent()->getParent();
- Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 1);
-
- Value *Op = CI->getOperand(1);
- Op = CallInst::Create(Int, Op, CI->getName(), CI);
-
- CI->replaceAllUsesWith(Op);
- CI->eraseFromParent();
- return true;
-}
-
-template
-bool X86TargetAsmInfo::ExpandInlineAsm(CallInst *CI) const {
- InlineAsm *IA = cast(CI->getCalledValue());
- std::vector Constraints = IA->ParseConstraints();
-
- std::string AsmStr = IA->getAsmString();
-
- // TODO: should remove alternatives from the asmstring: "foo {a|b}" -> "foo a"
- std::vector AsmPieces;
- SplitString(AsmStr, AsmPieces, "\n"); // ; as separator?
-
- switch (AsmPieces.size()) {
- default: return false;
- case 1:
- AsmStr = AsmPieces[0];
- AsmPieces.clear();
- SplitString(AsmStr, AsmPieces, " \t"); // Split with whitespace.
-
- // bswap $0
- if (AsmPieces.size() == 2 &&
- (AsmPieces[0] == "bswap" ||
- AsmPieces[0] == "bswapq" ||
- AsmPieces[0] == "bswapl") &&
- (AsmPieces[1] == "$0" ||
- AsmPieces[1] == "${0:q}")) {
- // No need to check constraints, nothing other than the equivalent of
- // "=r,0" would be valid here.
- return LowerToBSwap(CI);
- }
- // rorw $$8, ${0:w} --> llvm.bswap.i16
- if (CI->getType() == Type::Int16Ty &&
- AsmPieces.size() == 3 &&
- AsmPieces[0] == "rorw" &&
- AsmPieces[1] == "$$8," &&
- AsmPieces[2] == "${0:w}" &&
- IA->getConstraintString() == "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}") {
- return LowerToBSwap(CI);
- }
- break;
- case 3:
- if (CI->getType() == Type::Int64Ty && Constraints.size() >= 2 &&
- Constraints[0].Codes.size() == 1 && Constraints[0].Codes[0] == "A" &&
- Constraints[1].Codes.size() == 1 && Constraints[1].Codes[0] == "0") {
- // bswap %eax / bswap %edx / xchgl %eax, %edx -> llvm.bswap.i64
- std::vector Words;
- SplitString(AsmPieces[0], Words, " \t");
- if (Words.size() == 2 && Words[0] == "bswap" && Words[1] == "%eax") {
- Words.clear();
- SplitString(AsmPieces[1], Words, " \t");
- if (Words.size() == 2 && Words[0] == "bswap" && Words[1] == "%edx") {
- Words.clear();
- SplitString(AsmPieces[2], Words, " \t,");
- if (Words.size() == 3 && Words[0] == "xchgl" && Words[1] == "%eax" &&
- Words[2] == "%edx") {
- return LowerToBSwap(CI);
- }
- }
- }
- }
- break;
- }
- return false;
-}
-
// Instantiate default implementation.
TEMPLATE_INSTANTIATION(class X86TargetAsmInfo);
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=76445&r1=76444&r2=76445&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Mon Jul 20 12:59:32 2009
@@ -26,18 +26,10 @@
template
struct X86TargetAsmInfo : public BaseTAI {
- explicit X86TargetAsmInfo(const X86TargetMachine &TM):
- BaseTAI(TM) {
- const X86Subtarget *Subtarget = &TM.getSubtarget();
-
+ explicit X86TargetAsmInfo(const X86TargetMachine &TM) : BaseTAI(TM) {
BaseTAI::AsmTransCBE = x86_asm_table;
- BaseTAI::AssemblerDialect = Subtarget->getAsmFlavor();
+ BaseTAI::AssemblerDialect =TM.getSubtarget().getAsmFlavor();
}
-
- virtual bool ExpandInlineAsm(CallInst *CI) const;
-
- private:
- bool LowerToBSwap(CallInst *CI) const;
};
typedef X86TargetAsmInfo X86GenericTargetAsmInfo;
From isanbard at gmail.com Mon Jul 20 13:22:23 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 11:22:23 -0700
Subject: [llvm-commits] [llvm] r76385 - in /llvm/trunk: docs/
include/llvm-c/ include/llvm/ include/llvm/Support/
lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/
lib/CodeGen/ lib/Linker/ lib/Target/
lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPr
Message-ID: <16e5fdf90907201122u55ce1136ybde0afe91ef88842@mail.gmail.com>
On Sun, Jul 19, 2009 at 10:34 PM, Chris Lattner wrote:
>
> On Jul 19, 2009, at 6:03 PM, Bill Wendling wrote:
>
>> Author: void
>> Date: Sun Jul 19 20:03:30 2009
>> New Revision: 76385
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=76385&view=rev
>> Log:
>> Add plumbing for the `linker_private' linkage type. This type is
>> meant for
>> "private" symbols which the assember shouldn't strip, but which the
>> linker may
>> remove after evaluation. This is mostly useful for Objective-C
>> metadata.
>>
>> This is plumbing, so we don't have a use of it yet. More to come, etc.
>
> Thanks for implementing this Bill.
>
>> +++ llvm/trunk/include/llvm-c/Core.h Sun Jul 19 20:03:30 2009
>> @@ -141,6 +141,7 @@
>> ? LLVMInternalLinkage, ? ?/**< Rename collisions when linking (static
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?functions) */
>> ? LLVMPrivateLinkage, ? ? /**< Like Internal, but omit from symbol
>> table */
>> + ?LLVMLinkerPrivateLinkage, /**< Like Private, but linker removes. */
>> ? LLVMDLLImportLinkage, ? /**< Function to be imported from DLL */
>> ? LLVMDLLExportLinkage, ? /**< Function to be accessible from DLL */
>> ? LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
>
> This changes the C ABI, which is not allowed, please add this to the
> end of the list. ?liblto may also need to be updated to handle this.
>
Oops...Okay.
>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Sun Jul
>> 19 20:03:30 2009
>> @@ -93,12 +93,15 @@
>> ? ? ? void Init(const std::string &GV, Mangler *Mang) {
>> ? ? ? ? // Already initialized.
>> ? ? ? ? if (!Stub.empty()) return;
>> - ? ? ? ?Stub = Mang->makeNameProper(GV+"$stub", true);
>> - ? ? ? ?LazyPtr = Mang->makeNameProper(GV+"$lazy_ptr", true);
>> - ? ? ? ?SLP = Mang->makeNameProper(GV+"$slp", true);
>> - ? ? ? ?SCV = Mang->makeNameProper(GV+"$scv", true);
>> + ? ? ? ?Stub = Mang->makeNameProper(GV + "$stub",
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Mangler::PrivatePrefixTy);
>
> How about dropping "Ty" from the enum names?
>
I'm not good at naming these things, but unfortunately there are
already variables in the Mangler class named "PrivatePrefix" etc. I'll
try to think of something better...
-bw
From baldrick at free.fr Mon Jul 20 13:22:44 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 18:22:44 -0000
Subject: [llvm-commits] [gcc-plugin] r76446 - in /gcc-plugin/trunk:
bits_and_bobs.cpp bits_and_bobs.h llvm-types.cpp
Message-ID: <200907201822.n6KIMi2N007643@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 13:22:43 2009
New Revision: 76446
URL: http://llvm.org/viewvc/llvm-project?rev=76446&view=rev
Log:
Associate llvm types to gcc type trees using the cache.
There's no good way right now to handle switching from
one LLVM type to another, but with this we can at least
make progress on other fronts.
Modified:
gcc-plugin/trunk/bits_and_bobs.cpp
gcc-plugin/trunk/bits_and_bobs.h
gcc-plugin/trunk/llvm-types.cpp
Modified: gcc-plugin/trunk/bits_and_bobs.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/bits_and_bobs.cpp?rev=76446&r1=76445&r2=76446&view=diff
==============================================================================
--- gcc-plugin/trunk/bits_and_bobs.cpp (original)
+++ gcc-plugin/trunk/bits_and_bobs.cpp Mon Jul 20 13:22:43 2009
@@ -38,10 +38,6 @@
abort();
}
-const Type *llvm_set_type(tree Tr, const Type *Ty) {
-abort();
-}
-
-const Type *llvm_get_type(unsigned Index) {
+void llvmEraseLType(const Type *Ty) {
abort();
}
Modified: gcc-plugin/trunk/bits_and_bobs.h
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/bits_and_bobs.h?rev=76446&r1=76445&r2=76446&view=diff
==============================================================================
--- gcc-plugin/trunk/bits_and_bobs.h (original)
+++ gcc-plugin/trunk/bits_and_bobs.h Mon Jul 20 13:22:43 2009
@@ -26,10 +26,9 @@
#define SET_TYPE_LLVM(NODE, TYPE) (const Type *)llvm_set_type(NODE, TYPE)
-extern const Type *llvm_get_type(unsigned Index);
+extern const Type *llvm_get_type(tree Tr);
-#define GET_TYPE_LLVM(NODE) \
- (const Type *)llvm_get_type( 0 )
+#define GET_TYPE_LLVM(NODE) (const Type *)llvm_get_type(NODE)
// emit_global_to_llvm - Emit the specified VAR_DECL to LLVM as a global
// variable.
@@ -38,4 +37,6 @@
extern bool flag_odr;
+void llvmEraseLType(const Type *);
+
#endif
Modified: gcc-plugin/trunk/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-types.cpp?rev=76446&r1=76445&r2=76446&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-types.cpp (original)
+++ gcc-plugin/trunk/llvm-types.cpp Mon Jul 20 13:22:43 2009
@@ -52,115 +52,130 @@
// Plugin headers
#include "llvm-abi.h"
+#include "llvm-cache.h"
#include "bits_and_bobs.h"
+static LLVMContext &Context = getGlobalContext();
+
//===----------------------------------------------------------------------===//
// Matching LLVM types with GCC trees
//===----------------------------------------------------------------------===//
-//
-// LTypes is a vector of LLVM types. GCC tree nodes keep track of LLVM types
-// using this vector's index. It is easier to save and restore the index than
-// the LLVM type pointer while usig PCH. STL vector does not provide fast
-// searching mechanism which is required to remove LLVM Type entry when type is
-// refined and replaced by another LLVM Type. This is achieved by maintaining
-// a map.
-
-// Collection of LLVM Types
-static std::vector LTypes;
-typedef DenseMap LTypesMapTy;
-static LTypesMapTy LTypesMap;
-
-static LLVMContext &Context = getGlobalContext();
-
-// Erase type from LTypes vector
-static void llvmEraseLType(const Type *Ty) {
- LTypesMapTy::iterator I = LTypesMap.find(Ty);
+// GET_TYPE_LLVM/SET_TYPE_LLVM - Associate an LLVM type with each TREE type.
+// These are lazily computed by ConvertType.
- if (I != LTypesMap.end()) {
- // It is OK to clear this entry instead of removing this entry
- // to avoid re-indexing of other entries.
- LTypes[ LTypesMap[Ty] - 1] = NULL;
- LTypesMap.erase(I);
- }
+const Type *llvm_set_type(tree Tr, const Type *Ty) {
+ assert(TYPE_P(Tr) && "Expected a gcc type!");
+ return (const Type *)llvm_set_cached(Tr, Ty);
}
-// Read LLVM Types string table
-void readLLVMTypesStringTable() {
-
- GlobalValue *V = TheModule->getNamedGlobal("llvm.pch.types");
- if (!V)
- return;
-
- // Value *GV = TheModule->getValueSymbolTable().lookup("llvm.pch.types");
- GlobalVariable *GV = cast(V);
- ConstantStruct *LTypesNames = cast(GV->getOperand(0));
-
- for (unsigned i = 0; i < LTypesNames->getNumOperands(); ++i) {
- const Type *Ty = NULL;
-
- if (ConstantArray *CA =
- dyn_cast(LTypesNames->getOperand(i))) {
- std::string Str = CA->getAsString();
- Ty = TheModule->getTypeByName(Str);
- assert (Ty != NULL && "Invalid Type in LTypes string table");
- }
- // If V is not a string then it is empty. Insert NULL to represent
- // empty entries.
- LTypes.push_back(Ty);
- }
-
- // Now, llvm.pch.types value is not required so remove it from the symbol
- // table.
- GV->eraseFromParent();
+const Type *llvm_get_type(tree Tr) {
+ assert(TYPE_P(Tr) && "Expected a gcc type!");
+ return (const Type *)llvm_get_cached(Tr);
}
-
-// GCC tree's uses LTypes vector's index to reach LLVM types.
-// Create a string table to hold these LLVM types' names. This string
-// table will be used to recreate LTypes vector after loading PCH.
-void writeLLVMTypesStringTable() {
-
- if (LTypes.empty())
- return;
-
- std::vector LTypesNames;
- std::map < const Type *, std::string > TypeNameMap;
-
- // Collect Type Names in advance.
- const TypeSymbolTable &ST = TheModule->getTypeSymbolTable();
- TypeSymbolTable::const_iterator TI = ST.begin();
- for (; TI != ST.end(); ++TI) {
- TypeNameMap[TI->second] = TI->first;
- }
-
- // Populate LTypesNames vector.
- for (std::vector::iterator I = LTypes.begin(),
- E = LTypes.end(); I != E; ++I) {
- const Type *Ty = *I;
-
- // Give names to nameless types.
- if (Ty && TypeNameMap[Ty].empty()) {
- std::string NewName =
- TheModule->getTypeSymbolTable().getUniqueName("llvm.fe.ty");
- TheModule->addTypeName(NewName, Ty);
- TypeNameMap[*I] = NewName;
- }
-
- const std::string &TypeName = TypeNameMap[*I];
- LTypesNames.push_back(Context.getConstantArray(TypeName, false));
- }
-
- // Create string table.
- Constant *LTypesNameTable = Context.getConstantStruct(LTypesNames, false);
-
- // Create variable to hold this string table.
- GlobalVariable *GV = new GlobalVariable(*TheModule,
- LTypesNameTable->getType(), true,
- GlobalValue::ExternalLinkage,
- LTypesNameTable,
- "llvm.pch.types");
-}
+//
+//TODO// LTypes is a vector of LLVM types. GCC tree nodes keep track of LLVM types
+//TODO// using this vector's index. It is easier to save and restore the index than
+//TODO// the LLVM type pointer while usig PCH. STL vector does not provide fast
+//TODO// searching mechanism which is required to remove LLVM Type entry when type is
+//TODO// refined and replaced by another LLVM Type. This is achieved by maintaining
+//TODO// a map.
+//TODO
+//TODO// Collection of LLVM Types
+//TODOstatic std::vector LTypes;
+//TODOtypedef DenseMap LTypesMapTy;
+//TODOstatic LTypesMapTy LTypesMap;
+//TODO
+//TODO// Erase type from LTypes vector
+//TODOstatic void llvmEraseLType(const Type *Ty) {
+//TODO
+//TODO LTypesMapTy::iterator I = LTypesMap.find(Ty);
+//TODO
+//TODO if (I != LTypesMap.end()) {
+//TODO // It is OK to clear this entry instead of removing this entry
+//TODO // to avoid re-indexing of other entries.
+//TODO LTypes[ LTypesMap[Ty] - 1] = NULL;
+//TODO LTypesMap.erase(I);
+//TODO }
+//TODO}
+//TODO
+//TODO// Read LLVM Types string table
+//TODOvoid readLLVMTypesStringTable() {
+//TODO
+//TODO GlobalValue *V = TheModule->getNamedGlobal("llvm.pch.types");
+//TODO if (!V)
+//TODO return;
+//TODO
+//TODO // Value *GV = TheModule->getValueSymbolTable().lookup("llvm.pch.types");
+//TODO GlobalVariable *GV = cast(V);
+//TODO ConstantStruct *LTypesNames = cast(GV->getOperand(0));
+//TODO
+//TODO for (unsigned i = 0; i < LTypesNames->getNumOperands(); ++i) {
+//TODO const Type *Ty = NULL;
+//TODO
+//TODO if (ConstantArray *CA =
+//TODO dyn_cast(LTypesNames->getOperand(i))) {
+//TODO std::string Str = CA->getAsString();
+//TODO Ty = TheModule->getTypeByName(Str);
+//TODO assert (Ty != NULL && "Invalid Type in LTypes string table");
+//TODO }
+//TODO // If V is not a string then it is empty. Insert NULL to represent
+//TODO // empty entries.
+//TODO LTypes.push_back(Ty);
+//TODO }
+//TODO
+//TODO // Now, llvm.pch.types value is not required so remove it from the symbol
+//TODO // table.
+//TODO GV->eraseFromParent();
+//TODO}
+//TODO
+//TODO
+//TODO// GCC tree's uses LTypes vector's index to reach LLVM types.
+//TODO// Create a string table to hold these LLVM types' names. This string
+//TODO// table will be used to recreate LTypes vector after loading PCH.
+//TODOvoid writeLLVMTypesStringTable() {
+//TODO
+//TODO if (LTypes.empty())
+//TODO return;
+//TODO
+//TODO std::vector LTypesNames;
+//TODO std::map < const Type *, std::string > TypeNameMap;
+//TODO
+//TODO // Collect Type Names in advance.
+//TODO const TypeSymbolTable &ST = TheModule->getTypeSymbolTable();
+//TODO TypeSymbolTable::const_iterator TI = ST.begin();
+//TODO for (; TI != ST.end(); ++TI) {
+//TODO TypeNameMap[TI->second] = TI->first;
+//TODO }
+//TODO
+//TODO // Populate LTypesNames vector.
+//TODO for (std::vector::iterator I = LTypes.begin(),
+//TODO E = LTypes.end(); I != E; ++I) {
+//TODO const Type *Ty = *I;
+//TODO
+//TODO // Give names to nameless types.
+//TODO if (Ty && TypeNameMap[Ty].empty()) {
+//TODO std::string NewName =
+//TODO TheModule->getTypeSymbolTable().getUniqueName("llvm.fe.ty");
+//TODO TheModule->addTypeName(NewName, Ty);
+//TODO TypeNameMap[*I] = NewName;
+//TODO }
+//TODO
+//TODO const std::string &TypeName = TypeNameMap[*I];
+//TODO LTypesNames.push_back(Context.getConstantArray(TypeName, false));
+//TODO }
+//TODO
+//TODO // Create string table.
+//TODO Constant *LTypesNameTable = Context.getConstantStruct(LTypesNames, false);
+//TODO
+//TODO // Create variable to hold this string table.
+//TODO GlobalVariable *GV = new GlobalVariable(*TheModule,
+//TODO LTypesNameTable->getType(), true,
+//TODO GlobalValue::ExternalLinkage,
+//TODO LTypesNameTable,
+//TODO "llvm.pch.types");
+//TODO}
//===----------------------------------------------------------------------===//
// Recursive Type Handling Code and Data
From isanbard at gmail.com Mon Jul 20 13:22:53 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 18:22:53 -0000
Subject: [llvm-commits] [llvm] r76447 - /llvm/trunk/include/llvm-c/Core.h
Message-ID: <200907201822.n6KIMr7Z007662@zion.cs.uiuc.edu>
Author: void
Date: Mon Jul 20 13:22:52 2009
New Revision: 76447
URL: http://llvm.org/viewvc/llvm-project?rev=76447&view=rev
Log:
Put new enum at end of list to avoid changing ABI.
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=76447&r1=76446&r2=76447&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Mon Jul 20 13:22:52 2009
@@ -141,13 +141,13 @@
LLVMInternalLinkage, /**< Rename collisions when linking (static
functions) */
LLVMPrivateLinkage, /**< Like Internal, but omit from symbol table */
- LLVMLinkerPrivateLinkage, /**< Like Private, but linker removes. */
LLVMDLLImportLinkage, /**< Function to be imported from DLL */
LLVMDLLExportLinkage, /**< Function to be accessible from DLL */
LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
LLVMGhostLinkage, /**< Stand-in functions for streaming fns from
bitcode */
- LLVMCommonLinkage /**< Tentative definitions */
+ LLVMCommonLinkage, /**< Tentative definitions */
+ LLVMLinkerPrivateLinkage /**< Like Private, but linker removes. */
} LLVMLinkage;
typedef enum {
From baldrick at free.fr Mon Jul 20 13:24:22 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Jul 2009 18:24:22 -0000
Subject: [llvm-commits] [gcc-plugin] r76448 - /gcc-plugin/trunk/llvm-cache.h
Message-ID: <200907201824.n6KIONKP007713@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Jul 20 13:24:22 2009
New Revision: 76448
URL: http://llvm.org/viewvc/llvm-project?rev=76448&view=rev
Log:
Add a note so as not to forget about telling the
garbage collector about this new type.
Modified:
gcc-plugin/trunk/llvm-cache.h
Modified: gcc-plugin/trunk/llvm-cache.h
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-cache.h?rev=76448&r1=76447&r2=76448&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-cache.h (original)
+++ gcc-plugin/trunk/llvm-cache.h Mon Jul 20 13:24:22 2009
@@ -45,6 +45,7 @@
struct tree_map_base base;
const void *val;
};
+/* FIXME: Need to use gengtype and tell the GC about this. */
extern bool llvm_has_cached (union tree_node *);
From dgregor at apple.com Mon Jul 20 13:30:25 2009
From: dgregor at apple.com (Douglas Gregor)
Date: Mon, 20 Jul 2009 18:30:25 -0000
Subject: [llvm-commits] [llvm] r76449 - /llvm/trunk/CMakeLists.txt
Message-ID: <200907201830.n6KIUQ3e008080@zion.cs.uiuc.edu>
Author: dgregor
Date: Mon Jul 20 13:30:25 2009
New Revision: 76449
URL: http://llvm.org/viewvc/llvm-project?rev=76449&view=rev
Log:
Build FileCheck from with CMake
Modified:
llvm/trunk/CMakeLists.txt
Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=76449&r1=76448&r2=76449&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Mon Jul 20 13:30:25 2009
@@ -260,6 +260,8 @@
add_subdirectory(lib/Analysis/IPA)
add_subdirectory(lib/MC)
+add_subdirectory(utils/FileCheck)
+
set(LLVM_ENUM_ASM_PRINTERS "")
set(LLVM_ENUM_ASM_PARSERS "")
foreach(t ${LLVM_TARGETS_TO_BUILD})
From clattner at apple.com Mon Jul 20 13:33:18 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 20 Jul 2009 11:33:18 -0700
Subject: [llvm-commits] [llvm] r76385 - in /llvm/trunk: docs/
include/llvm-c/ include/llvm/
include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/
lib/Bitcode/Writer/ lib/CodeGen/ lib/Linker/ lib/Target/
lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPr
In-Reply-To: <16e5fdf90907201122u55ce1136ybde0afe91ef88842@mail.gmail.com>
References: <16e5fdf90907201122u55ce1136ybde0afe91ef88842@mail.gmail.com>
Message-ID: <3EFA515F-9209-47F0-B081-E2807C51F7C6@apple.com>
On Jul 20, 2009, at 11:22 AM, Bill Wendling wrote:
>>>
>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Sun Jul
>>> 19 20:03:30 2009
>>> @@ -93,12 +93,15 @@
>>> void Init(const std::string &GV, Mangler *Mang) {
>>> // Already initialized.
>>> if (!Stub.empty()) return;
>>> - Stub = Mang->makeNameProper(GV+"$stub", true);
>>> - LazyPtr = Mang->makeNameProper(GV+"$lazy_ptr", true);
>>> - SLP = Mang->makeNameProper(GV+"$slp", true);
>>> - SCV = Mang->makeNameProper(GV+"$scv", true);
>>> + Stub = Mang->makeNameProper(GV + "$stub",
>>> + Mangler::PrivatePrefixTy);
>>
>> How about dropping "Ty" from the enum names?
>>
> I'm not good at naming these things, but unfortunately there are
> already variables in the Mangler class named "PrivatePrefix" etc. I'll
> try to think of something better...
How about "Private" then? That's even better I think.
-Chris
From clattner at apple.com Mon Jul 20 13:33:46 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 20 Jul 2009 11:33:46 -0700
Subject: [llvm-commits] [llvm] r76447 - /llvm/trunk/include/llvm-c/Core.h
In-Reply-To: <200907201822.n6KIMr7Z007662@zion.cs.uiuc.edu>
References: <200907201822.n6KIMr7Z007662@zion.cs.uiuc.edu>
Message-ID: <2D108AB1-39DD-4C60-8AA0-623B0F5DEB5C@apple.com>
On Jul 20, 2009, at 11:22 AM, Bill Wendling wrote:
> Author: void
> Date: Mon Jul 20 13:22:52 2009
> New Revision: 76447
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76447&view=rev
> Log:
> Put new enum at end of list to avoid changing ABI.
Just to verify: is there code in the C api's that maps from the C++
numbering to the C numbering?
-Chris
>
> 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=76447&r1=76446&r2=76447&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/include/llvm-c/Core.h (original)
> +++ llvm/trunk/include/llvm-c/Core.h Mon Jul 20 13:22:52 2009
> @@ -141,13 +141,13 @@
> LLVMInternalLinkage, /**< Rename collisions when linking (static
> functions) */
> LLVMPrivateLinkage, /**< Like Internal, but omit from symbol
> table */
> - LLVMLinkerPrivateLinkage, /**< Like Private, but linker removes. */
> LLVMDLLImportLinkage, /**< Function to be imported from DLL */
> LLVMDLLExportLinkage, /**< Function to be accessible from DLL */
> LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
> LLVMGhostLinkage, /**< Stand-in functions for streaming fns
> from
> bitcode */
> - LLVMCommonLinkage /**< Tentative definitions */
> + LLVMCommonLinkage, /**< Tentative definitions */
> + LLVMLinkerPrivateLinkage /**< Like Private, but linker removes. */
> } LLVMLinkage;
>
> typedef enum {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From isanbard at gmail.com Mon Jul 20 13:46:18 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 11:46:18 -0700
Subject: [llvm-commits] [llvm] r76447 - /llvm/trunk/include/llvm-c/Core.h
In-Reply-To: <2D108AB1-39DD-4C60-8AA0-623B0F5DEB5C@apple.com>
References: <200907201822.n6KIMr7Z007662@zion.cs.uiuc.edu>
<2D108AB1-39DD-4C60-8AA0-623B0F5DEB5C@apple.com>
Message-ID: <16e5fdf90907201146k72094499gfa6d3a296eb7f2da@mail.gmail.com>
On Mon, Jul 20, 2009 at 11:33 AM, Chris Lattner wrote:
>
> On Jul 20, 2009, at 11:22 AM, Bill Wendling wrote:
>
>> Author: void
>> Date: Mon Jul 20 13:22:52 2009
>> New Revision: 76447
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=76447&view=rev
>> Log:
>> Put new enum at end of list to avoid changing ABI.
>
> Just to verify: is there code in the C api's that maps from the C++
> numbering to the C numbering?
>
I've never looked at the C APIs. . .
-bw
From daniel at zuster.org Mon Jul 20 13:55:05 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 20 Jul 2009 18:55:05 -0000
Subject: [llvm-commits] [llvm] r76453 - in /llvm/trunk:
include/llvm/MC/MCAsmParser.h include/llvm/Target/TargetAsmParser.h
lib/MC/CMakeLists.txt lib/MC/MCAsmParser.cpp
lib/Target/X86/AsmParser/X86AsmParser.cpp tools/llvm-mc/AsmParser.cpp
tools/llvm-mc/AsmParser.h tools/llvm-mc/llvm-mc.cpp
Message-ID: <200907201855.n6KIt51B008933@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Jul 20 13:55:04 2009
New Revision: 76453
URL: http://llvm.org/viewvc/llvm-project?rev=76453&view=rev
Log:
Add MCAsmParser interface.
- This provides the AsmParser interface to the target specific assembly
parsers.
Added:
llvm/trunk/include/llvm/MC/MCAsmParser.h
llvm/trunk/lib/MC/MCAsmParser.cpp
Modified:
llvm/trunk/include/llvm/Target/TargetAsmParser.h
llvm/trunk/lib/MC/CMakeLists.txt
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmParser.h
llvm/trunk/tools/llvm-mc/llvm-mc.cpp
Added: llvm/trunk/include/llvm/MC/MCAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmParser.h?rev=76453&view=auto
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmParser.h (added)
+++ llvm/trunk/include/llvm/MC/MCAsmParser.h Mon Jul 20 13:55:04 2009
@@ -0,0 +1,33 @@
+//===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCASMPARSER_H
+#define LLVM_MC_MCASMPARSER_H
+
+namespace llvm {
+class MCAsmParser;
+class MCInst;
+class Target;
+class TargetAsmParser;
+
+/// MCAsmParser - Generic assembler parser interface, for use by target specific
+/// assembly parsers.
+class MCAsmParser {
+ MCAsmParser(const MCAsmParser &); // DO NOT IMPLEMENT
+ void operator=(const MCAsmParser &); // DO NOT IMPLEMENT
+protected: // Can only create subclasses.
+ MCAsmParser();
+
+public:
+ virtual ~MCAsmParser();
+};
+
+} // End llvm namespace
+
+#endif
Modified: llvm/trunk/include/llvm/Target/TargetAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmParser.h?rev=76453&r1=76452&r2=76453&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmParser.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmParser.h Mon Jul 20 13:55:04 2009
@@ -11,6 +11,8 @@
#define LLVM_TARGET_TARGETPARSER_H
namespace llvm {
+class MCAsmParser;
+class MCInst;
class Target;
/// TargetAsmParser - Generic interface to target specific assembly parsers.
@@ -27,6 +29,21 @@
virtual ~TargetAsmParser();
const Target &getTarget() const { return TheTarget; }
+
+ /// ParseInstruction - Parse one assembly instruction.
+ ///
+ /// The parser is positioned following the instruction name. The target
+ /// specific instruction parser should parse the entire instruction and
+ /// construct the appropriate MCInst, or emit an error. On success, the entire
+ /// line should be parsed up to and including the end-of-statement token. On
+ /// failure, the parser is not required to read to the end of the line.
+ //
+ /// \param AP - The current parser object.
+ /// \param Name - The instruction name.
+ /// \param Inst [out] - On success, the parsed instruction.
+ /// \return True on failure.
+ virtual bool ParseInstruction(MCAsmParser &AP, const char *Name,
+ MCInst &Inst) = 0;
};
} // End llvm namespace
Modified: llvm/trunk/lib/MC/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/CMakeLists.txt?rev=76453&r1=76452&r2=76453&view=diff
==============================================================================
--- llvm/trunk/lib/MC/CMakeLists.txt (original)
+++ llvm/trunk/lib/MC/CMakeLists.txt Mon Jul 20 13:55:04 2009
@@ -1,4 +1,5 @@
add_llvm_library(LLVMMC
+ MCAsmParser.cpp
MCAsmStreamer.cpp
MCContext.cpp
MCStreamer.cpp
Added: llvm/trunk/lib/MC/MCAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmParser.cpp?rev=76453&view=auto
==============================================================================
--- llvm/trunk/lib/MC/MCAsmParser.cpp (added)
+++ llvm/trunk/lib/MC/MCAsmParser.cpp Mon Jul 20 13:55:04 2009
@@ -0,0 +1,18 @@
+//===-- MCAsmParser.cpp - Abstract Asm Parser Interface -------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCAsmParser.h"
+
+using namespace llvm;
+
+MCAsmParser::MCAsmParser() {
+}
+
+MCAsmParser::~MCAsmParser() {
+}
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=76453&r1=76452&r2=76453&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Jul 20 13:55:04 2009
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "X86.h"
+#include "llvm/MC/MCAsmParser.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetAsmParser.h"
using namespace llvm;
@@ -17,6 +18,9 @@
class X86ATTAsmParser : public TargetAsmParser {
public:
explicit X86ATTAsmParser(const Target &);
+
+ virtual bool ParseInstruction(MCAsmParser &AP, const char *Name,
+ MCInst &Inst);
};
}
@@ -26,6 +30,11 @@
{
}
+bool X86ATTAsmParser::ParseInstruction(MCAsmParser &AP, const char *Name,
+ MCInst &Inst) {
+ return true;
+}
+
namespace {
TargetAsmParser *createAsmParser(const Target &T) {
return new X86ATTAsmParser(T);
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=76453&r1=76452&r2=76453&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jul 20 13:55:04 2009
@@ -20,6 +20,7 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Target/TargetAsmParser.h"
using namespace llvm;
void AsmParser::Warning(SMLoc L, const char *Msg) {
@@ -548,7 +549,8 @@
}
MCInst Inst;
- if (ParseX86InstOperands(IDVal, Inst))
+ if (ParseX86InstOperands(IDVal, Inst) &&
+ getTargetParser().ParseInstruction(*this, IDVal, Inst))
return true;
if (Lexer.isNot(asmtok::EndOfStatement))
Modified: llvm/trunk/tools/llvm-mc/AsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=76453&r1=76452&r2=76453&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jul 20 13:55:04 2009
@@ -15,6 +15,7 @@
#define ASMPARSER_H
#include "AsmLexer.h"
+#include "llvm/MC/MCAsmParser.h"
#include "llvm/MC/MCStreamer.h"
namespace llvm {
@@ -24,7 +25,7 @@
class MCStreamer;
class MCValue;
-class AsmParser {
+class AsmParser : MCAsmParser {
public:
struct X86Operand;
@@ -32,14 +33,19 @@
AsmLexer Lexer;
MCContext &Ctx;
MCStreamer &Out;
+ TargetAsmParser &TargetParser;
public:
- AsmParser(SourceMgr &SM, MCContext &ctx, MCStreamer &OutStr)
- : Lexer(SM), Ctx(ctx), Out(OutStr) {}
+ AsmParser(SourceMgr &_SM, MCContext &_Ctx, MCStreamer &_Out,
+ TargetAsmParser &_TargetParser)
+ : Lexer(_SM), Ctx(_Ctx), Out(_Out), TargetParser(_TargetParser) {}
~AsmParser() {}
bool Run();
+public:
+ TargetAsmParser &getTargetParser() const { return TargetParser; }
+
private:
bool ParseStatement();
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=76453&r1=76452&r2=76453&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Mon Jul 20 13:55:04 2009
@@ -186,9 +186,10 @@
OwningPtr Str(createAsmStreamer(Ctx, outs()));
// FIXME: Target hook & command line option for initial section.
- Str.get()->SwitchSection(Ctx.GetSection("__TEXT,__text,regular,pure_instructions"));
+ Str.get()->SwitchSection(Ctx.GetSection("__TEXT,__text,"
+ "regular,pure_instructions"));
- AsmParser Parser(SrcMgr, Ctx, *Str.get());
+ AsmParser Parser(SrcMgr, Ctx, *Str.get(), *TAP);
return Parser.Run();
}
From dpatel at apple.com Mon Jul 20 14:00:09 2009
From: dpatel at apple.com (Devang Patel)
Date: Mon, 20 Jul 2009 19:00:09 -0000
Subject: [llvm-commits] [llvm] r76455 - in /llvm/trunk/lib/AsmParser:
LLParser.cpp LLParser.h
Message-ID: <200907201900.n6KJ09GX009159@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Jul 20 14:00:08 2009
New Revision: 76455
URL: http://llvm.org/viewvc/llvm-project?rev=76455&view=rev
Log:
Refactor metadata parsing routines into separate functions.
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLParser.h
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=76455&r1=76454&r2=76455&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jul 20 14:00:08 2009
@@ -365,6 +365,47 @@
return ParseAlias(Name, NameLoc, Visibility);
}
+// MDString:
+// ::= '!' STRINGCONSTANT
+bool LLParser::ParseMDString(Constant *&MDS) {
+ std::string Str;
+ if (ParseStringConstant(Str)) return true;
+ MDS = Context.getMDString(Str.data(), Str.data() + Str.size());
+ return false;
+}
+
+// MDNode:
+// ::= '!' MDNodeNumber
+bool LLParser::ParseMDNode(Constant *&Node) {
+ // !{ ..., !42, ... }
+ unsigned MID = 0;
+ if (ParseUInt32(MID)) return true;
+
+ // Check existing MDNode.
+ std::map::iterator I = MetadataCache.find(MID);
+ if (I != MetadataCache.end()) {
+ Node = I->second;
+ return false;
+ }
+
+ // Check known forward references.
+ std::map >::iterator
+ FI = ForwardRefMDNodes.find(MID);
+ if (FI != ForwardRefMDNodes.end()) {
+ Node = FI->second.first;
+ return false;
+ }
+
+ // Create MDNode forward reference
+ SmallVector Elts;
+ std::string FwdRefName = "llvm.mdnode.fwdref." + utostr(MID);
+ Elts.push_back(Context.getMDString(FwdRefName));
+ MDNode *FwdNode = Context.getMDNode(Elts.data(), Elts.size());
+ ForwardRefMDNodes[MID] = std::make_pair(FwdNode, Lex.getLoc());
+ Node = FwdNode;
+ return false;
+}
+
/// ParseStandaloneMetadata:
/// !42 = !{...}
bool LLParser::ParseStandaloneMetadata() {
@@ -1647,36 +1688,12 @@
// Standalone metadata reference
// !{ ..., !42, ... }
- unsigned MID = 0;
- if (!ParseUInt32(MID)) {
- std::map::iterator I = MetadataCache.find(MID);
- if (I != MetadataCache.end())
- ID.ConstantVal = I->second;
- else {
- std::map >::iterator
- FI = ForwardRefMDNodes.find(MID);
- if (FI != ForwardRefMDNodes.end())
- ID.ConstantVal = FI->second.first;
- else {
- // Create MDNode forward reference
- SmallVector Elts;
- std::string FwdRefName = "llvm.mdnode.fwdref." + utostr(MID);
- Elts.push_back(Context.getMDString(FwdRefName));
- MDNode *FwdNode = Context.getMDNode(Elts.data(), Elts.size());
- ForwardRefMDNodes[MID] = std::make_pair(FwdNode, Lex.getLoc());
- ID.ConstantVal = FwdNode;
- }
- }
-
+ if (!ParseMDNode(ID.ConstantVal))
return false;
- }
-
+
// MDString:
// ::= '!' STRINGCONSTANT
- std::string Str;
- if (ParseStringConstant(Str)) return true;
-
- ID.ConstantVal = Context.getMDString(Str.data(), Str.data() + Str.size());
+ if (ParseMDString(ID.ConstantVal)) return true;
return false;
}
case lltok::APSInt:
Modified: llvm/trunk/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=76455&r1=76454&r2=76455&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.h (original)
+++ llvm/trunk/lib/AsmParser/LLParser.h Mon Jul 20 14:00:08 2009
@@ -147,6 +147,8 @@
bool HasLinkage, unsigned Visibility);
bool ParseAlias(const std::string &Name, LocTy Loc, unsigned Visibility);
bool ParseStandaloneMetadata();
+ bool ParseMDString(Constant *&S);
+ bool ParseMDNode(Constant *&N);
// Type Parsing.
bool ParseType(PATypeHolder &Result, bool AllowVoid = false);
From isanbard at gmail.com Mon Jul 20 14:41:27 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 19:41:27 -0000
Subject: [llvm-commits] [llvm] r76456 - in /llvm/trunk:
include/llvm/Support/Mangler.h lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/VMCore/Mangler.cpp
Message-ID: <200907201941.n6KJfRLp010488@zion.cs.uiuc.edu>
Author: void
Date: Mon Jul 20 14:41:27 2009
New Revision: 76456
URL: http://llvm.org/viewvc/llvm-project?rev=76456&view=rev
Log:
Rename Mangler linkage enums to something less gross.
Modified:
llvm/trunk/include/llvm/Support/Mangler.h
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/trunk/lib/VMCore/Mangler.cpp
Modified: llvm/trunk/include/llvm/Support/Mangler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Mangler.h?rev=76456&r1=76455&r2=76456&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Mangler.h (original)
+++ llvm/trunk/include/llvm/Support/Mangler.h Mon Jul 20 14:41:27 2009
@@ -27,9 +27,9 @@
class Mangler {
public:
enum ManglerPrefixTy {
- DefaultPrefixTy, ///< Emit default string before each symbol.
- PrivatePrefixTy, ///< Emit "private" prefix before each symbol.
- LinkerPrivatePrefixTy ///< Emit "linker private" prefix before each symbol.
+ Default, ///< Emit default string before each symbol.
+ Private, ///< Emit "private" prefix before each symbol.
+ LinkerPrivate ///< Emit "linker private" prefix before each symbol.
};
private:
@@ -103,7 +103,7 @@
/// from getValueName.
///
std::string makeNameProper(const std::string &x,
- ManglerPrefixTy PrefixTy = DefaultPrefixTy);
+ ManglerPrefixTy PrefixTy = Mangler::Default);
};
} // End llvm namespace
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=76456&r1=76455&r2=76456&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Jul 20 14:41:27 2009
@@ -93,14 +93,10 @@
void Init(const std::string &GV, Mangler *Mang) {
// Already initialized.
if (!Stub.empty()) return;
- Stub = Mang->makeNameProper(GV + "$stub",
- Mangler::PrivatePrefixTy);
- LazyPtr = Mang->makeNameProper(GV + "$lazy_ptr",
- Mangler::PrivatePrefixTy);
- SLP = Mang->makeNameProper(GV + "$slp",
- Mangler::PrivatePrefixTy);
- SCV = Mang->makeNameProper(GV + "$scv",
- Mangler::PrivatePrefixTy);
+ Stub = Mang->makeNameProper(GV + "$stub", Mangler::Private);
+ LazyPtr = Mang->makeNameProper(GV + "$lazy_ptr", Mangler::Private);
+ SLP = Mang->makeNameProper(GV + "$slp", Mangler::Private);
+ SCV = Mang->makeNameProper(GV + "$scv", Mangler::Private);
}
};
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=76456&r1=76455&r2=76456&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Mon Jul 20 14:41:27 2009
@@ -71,11 +71,11 @@
// Already initialized.
if (!Stub.empty()) return;
Stub = Mang->makeNameProper(GV + "$stub",
- Mangler::PrivatePrefixTy);
+ Mangler::Private);
LazyPtr = Mang->makeNameProper(GV + "$lazy_ptr",
- Mangler::PrivatePrefixTy);
+ Mangler::Private);
AnonSymbol = Mang->makeNameProper(GV + "$stub$tmp",
- Mangler::PrivatePrefixTy);
+ Mangler::Private);
}
};
Modified: llvm/trunk/lib/VMCore/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Mangler.cpp?rev=76456&r1=76455&r2=76456&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Mangler.cpp (original)
+++ llvm/trunk/lib/VMCore/Mangler.cpp Mon Jul 20 14:41:27 2009
@@ -60,9 +60,9 @@
if (NeedPrefix) {
Result = Prefix + Result;
- if (PrefixTy == PrivatePrefixTy)
+ if (PrefixTy == Mangler::Private)
Result = PrivatePrefix + Result;
- else if (PrefixTy == LinkerPrivatePrefixTy)
+ else if (PrefixTy == Mangler::LinkerPrivate)
Result = LinkerPrivatePrefix + Result;
}
@@ -98,9 +98,9 @@
Result = Prefix + X;
- if (PrefixTy == PrivatePrefixTy)
+ if (PrefixTy == Mangler::Private)
Result = PrivatePrefix + Result;
- else if (PrefixTy == LinkerPrivatePrefixTy)
+ else if (PrefixTy == Mangler::LinkerPrivate)
Result = LinkerPrivatePrefix + Result;
return Result;
@@ -121,9 +121,9 @@
if (NeedPrefix) {
Result = Prefix + Result;
- if (PrefixTy == PrivatePrefixTy)
+ if (PrefixTy == Mangler::Private)
Result = PrivatePrefix + Result;
- else if (PrefixTy == LinkerPrivatePrefixTy)
+ else if (PrefixTy == Mangler::LinkerPrivate)
Result = LinkerPrivatePrefix + Result;
}
@@ -142,8 +142,8 @@
"Intrinsic functions cannot be mangled by Mangler");
ManglerPrefixTy PrefixTy =
- (GV->hasPrivateLinkage() || ForcePrivate) ? PrivatePrefixTy :
- GV->hasLinkerPrivateLinkage() ? LinkerPrivatePrefixTy : DefaultPrefixTy;
+ (GV->hasPrivateLinkage() || ForcePrivate) ? Mangler::Private :
+ GV->hasLinkerPrivateLinkage() ? Mangler::LinkerPrivate : Mangler::Default;
if (GV->hasName())
return makeNameProper(GV->getName() + Suffix, PrefixTy);
From eli.friedman at gmail.com Mon Jul 20 14:45:16 2009
From: eli.friedman at gmail.com (Eli Friedman)
Date: Mon, 20 Jul 2009 19:45:16 -0000
Subject: [llvm-commits] [llvm] r76457 -
/llvm/trunk/include/llvm/Target/TargetLowering.h
Message-ID: <200907201945.n6KJjGr4010609@zion.cs.uiuc.edu>
Author: efriedma
Date: Mon Jul 20 14:45:16 2009
New Revision: 76457
URL: http://llvm.org/viewvc/llvm-project?rev=76457&view=rev
Log:
Remove FIXME that was already fixed.
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=76457&r1=76456&r2=76457&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jul 20 14:45:16 2009
@@ -1274,7 +1274,6 @@
/// call to be explicit llvm code if it wants to. This is useful for
/// turning simple inline asms into LLVM intrinsics, which gives the
/// compiler more information about the behavior of the code.
- // FIXME: Move this to TargetLowering.
virtual bool ExpandInlineAsm(CallInst *CI) const {
return false;
}
From isanbard at gmail.com Mon Jul 20 14:45:23 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 12:45:23 -0700
Subject: [llvm-commits] [llvm] r76447 - /llvm/trunk/include/llvm-c/Core.h
In-Reply-To: <16e5fdf90907201146k72094499gfa6d3a296eb7f2da@mail.gmail.com>
References: <200907201822.n6KIMr7Z007662@zion.cs.uiuc.edu>
<2D108AB1-39DD-4C60-8AA0-623B0F5DEB5C@apple.com>
<16e5fdf90907201146k72094499gfa6d3a296eb7f2da@mail.gmail.com>
Message-ID: <16e5fdf90907201245i55a5cf03u49e866135974009c@mail.gmail.com>
On Mon, Jul 20, 2009 at 11:46 AM, Bill Wendling wrote:
> On Mon, Jul 20, 2009 at 11:33 AM, Chris Lattner wrote:
>>
>> On Jul 20, 2009, at 11:22 AM, Bill Wendling wrote:
>>
>>> Author: void
>>> Date: Mon Jul 20 13:22:52 2009
>>> New Revision: 76447
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=76447&view=rev
>>> Log:
>>> Put new enum at end of list to avoid changing ABI.
>>
>> Just to verify: is there code in the C api's that maps from the C++
>> numbering to the C numbering?
>>
Okay. There isn't a "map" from C APIs to C++ numbering. It does a
static_cast of the GlobalValue::LinkageTypes to the equivalent C enum
type.
I'm still checking the LTO stuff, but I didn't see any uses of
LLVMLinkage anywhere other than in VMUtils/Core.cpp.
-bw
From evan.cheng at apple.com Mon Jul 20 14:47:55 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Jul 2009 19:47:55 -0000
Subject: [llvm-commits] [llvm] r76458 - in /llvm/trunk:
lib/CodeGen/SimpleRegisterCoalescing.cpp lib/Target/X86/X86RegisterInfo.cpp
test/CodeGen/Thumb/2009-07-19-SPDecBug.ll
test/CodeGen/X86/2009-07-20-CoalescerBug.ll
Message-ID: <200907201947.n6KJltWg010694@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Jul 20 14:47:55 2009
New Revision: 76458
URL: http://llvm.org/viewvc/llvm-project?rev=76458&view=rev
Log:
Fix some sub-reg coalescing bugs where the coalescer wasn't updating the resulting interval's register class.
Added:
llvm/trunk/test/CodeGen/Thumb/2009-07-19-SPDecBug.ll
llvm/trunk/test/CodeGen/X86/2009-07-20-CoalescerBug.ll
Modified:
llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=76458&r1=76457&r2=76458&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Jul 20 14:47:55 2009
@@ -614,15 +614,17 @@
return false;
if (TID.getNumDefs() != 1)
return false;
- // Make sure the copy destination register class fits the instruction
- // definition register class. The mismatch can happen as a result of earlier
- // extract_subreg, insert_subreg, subreg_to_reg coalescing.
- const TargetRegisterClass *RC = getInstrOperandRegClass(tri_, TID, 0);
- if (TargetRegisterInfo::isVirtualRegister(DstReg)) {
- if (mri_->getRegClass(DstReg) != RC)
+ if (DefMI->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) {
+ // Make sure the copy destination register class fits the instruction
+ // definition register class. The mismatch can happen as a result of earlier
+ // extract_subreg, insert_subreg, subreg_to_reg coalescing.
+ const TargetRegisterClass *RC = getInstrOperandRegClass(tri_, TID, 0);
+ if (TargetRegisterInfo::isVirtualRegister(DstReg)) {
+ if (mri_->getRegClass(DstReg) != RC)
+ return false;
+ } else if (!RC->contains(DstReg))
return false;
- } else if (!RC->contains(DstReg))
- return false;
+ }
unsigned DefIdx = li_->getDefIndex(CopyIdx);
const LiveRange *DLR= li_->getInterval(DstReg).getLiveRangeContaining(DefIdx);
@@ -1378,13 +1380,17 @@
}
}
if (SubIdx) {
- if (isInsSubReg || isSubRegToReg) {
- if (!DstIsPhys && !SrcIsPhys) {
+ if (!DstIsPhys && !SrcIsPhys) {
+ if (isInsSubReg || isSubRegToReg) {
NewRC = tri_->getMatchingSuperRegClass(DstRC, SrcRC, SubIdx);
- if (!NewRC)
- return false;
+ } else // extract_subreg {
+ NewRC = tri_->getMatchingSuperRegClass(SrcRC, DstRC, SubIdx);
}
+ if (!NewRC) {
+ DOUT << "\t Conflicting sub-register indices.\n";
+ return false; // Not coalescable
}
+
unsigned LargeReg = isExtSubReg ? SrcReg : DstReg;
unsigned SmallReg = isExtSubReg ? DstReg : SrcReg;
unsigned Limit= allocatableRCRegs_[mri_->getRegClass(SmallReg)].count();
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=76458&r1=76457&r2=76458&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Mon Jul 20 14:47:55 2009
@@ -161,69 +161,84 @@
case 1:
// 8-bit
if (B == &X86::GR8RegClass) {
- if (A == &X86::GR64RegClass)
- return &X86::GR64RegClass;
- else if (A == &X86::GR32RegClass)
- return &X86::GR32RegClass;
- else if (A == &X86::GR16RegClass)
- return &X86::GR16RegClass;
+ if (A->getSize() == 2 || A->getSize() == 4 || A->getSize() == 8)
+ return A;
} else if (B == &X86::GR8_ABCD_LRegClass || B == &X86::GR8_ABCD_HRegClass) {
- if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass)
+ if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass ||
+ A == &X86::GR64_NOREXRegClass)
return &X86::GR64_ABCDRegClass;
- else if (A == &X86::GR32RegClass || A == &X86::GR32_ABCDRegClass)
+ else if (A == &X86::GR32RegClass || A == &X86::GR32_ABCDRegClass ||
+ A == &X86::GR32_NOREXRegClass)
return &X86::GR32_ABCDRegClass;
- else if (A == &X86::GR16RegClass || A == &X86::GR16_ABCDRegClass)
+ else if (A == &X86::GR16RegClass || A == &X86::GR16_ABCDRegClass ||
+ A == &X86::GR16_NOREXRegClass)
return &X86::GR16_ABCDRegClass;
} else if (B == &X86::GR8_NOREXRegClass) {
if (A == &X86::GR64RegClass || A == &X86::GR64_NOREXRegClass)
return &X86::GR64_NOREXRegClass;
+ else if (A == &X86::GR64_ABCDRegClass)
+ return &X86::GR64_ABCDRegClass;
else if (A == &X86::GR32RegClass || A == &X86::GR32_NOREXRegClass)
return &X86::GR32_NOREXRegClass;
+ else if (A == &X86::GR32_ABCDRegClass)
+ return &X86::GR32_ABCDRegClass;
else if (A == &X86::GR16RegClass || A == &X86::GR16_NOREXRegClass)
return &X86::GR16_NOREXRegClass;
+ else if (A == &X86::GR16_ABCDRegClass)
+ return &X86::GR16_ABCDRegClass;
}
break;
case 2:
// 8-bit hi
if (B == &X86::GR8_ABCD_HRegClass) {
- if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass)
+ if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass ||
+ A == &X86::GR64_NOREXRegClass)
return &X86::GR64_ABCDRegClass;
- else if (A == &X86::GR32RegClass || A == &X86::GR32_ABCDRegClass)
+ else if (A == &X86::GR32RegClass || A == &X86::GR32_ABCDRegClass ||
+ A == &X86::GR32_NOREXRegClass)
return &X86::GR32_ABCDRegClass;
- else if (A == &X86::GR16RegClass || A == &X86::GR16_ABCDRegClass)
+ else if (A == &X86::GR16RegClass || A == &X86::GR16_ABCDRegClass ||
+ A == &X86::GR16_NOREXRegClass)
return &X86::GR16_ABCDRegClass;
}
break;
case 3:
// 16-bit
if (B == &X86::GR16RegClass) {
- if (A == &X86::GR64RegClass)
- return &X86::GR64RegClass;
- else if (A == &X86::GR32RegClass)
- return &X86::GR32RegClass;
+ if (A->getSize() == 4 || A->getSize() == 8)
+ return A;
} else if (B == &X86::GR16_ABCDRegClass) {
- if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass)
+ if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass ||
+ A == &X86::GR64_NOREXRegClass)
return &X86::GR64_ABCDRegClass;
- else if (A == &X86::GR32RegClass || A == &X86::GR32_ABCDRegClass)
+ else if (A == &X86::GR32RegClass || A == &X86::GR32_ABCDRegClass ||
+ A == &X86::GR32_NOREXRegClass)
return &X86::GR32_ABCDRegClass;
} else if (B == &X86::GR16_NOREXRegClass) {
if (A == &X86::GR64RegClass || A == &X86::GR64_NOREXRegClass)
return &X86::GR64_NOREXRegClass;
- else if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass)
+ else if (A == &X86::GR64_ABCDRegClass)
+ return &X86::GR64_ABCDRegClass;
+ else if (A == &X86::GR32RegClass || A == &X86::GR32_NOREXRegClass)
+ return &X86::GR32_NOREXRegClass;
+ else if (A == &X86::GR32_ABCDRegClass)
return &X86::GR64_ABCDRegClass;
}
break;
case 4:
// 32-bit
if (B == &X86::GR32RegClass) {
- if (A == &X86::GR64RegClass)
- return &X86::GR64RegClass;
+ if (A->getSize() == 8)
+ return A;
} else if (B == &X86::GR32_ABCDRegClass) {
- if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass)
+ if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass ||
+ A == &X86::GR64_NOREXRegClass)
return &X86::GR64_ABCDRegClass;
} else if (B == &X86::GR32_NOREXRegClass) {
if (A == &X86::GR64RegClass || A == &X86::GR64_NOREXRegClass)
return &X86::GR64_NOREXRegClass;
+ else if (A == &X86::GR64_ABCDRegClass)
+ return &X86::GR64_ABCDRegClass;
}
break;
}
Added: llvm/trunk/test/CodeGen/Thumb/2009-07-19-SPDecBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb/2009-07-19-SPDecBug.ll?rev=76458&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb/2009-07-19-SPDecBug.ll (added)
+++ llvm/trunk/test/CodeGen/Thumb/2009-07-19-SPDecBug.ll Mon Jul 20 14:47:55 2009
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | llc -mtriple=thumbv6-elf | not grep "subs sp"
+; PR4567
+
+define arm_apcscc i8* @__gets_chk(i8* %s, i32 %slen) nounwind {
+entry:
+ br i1 undef, label %bb, label %bb1
+
+bb: ; preds = %entry
+ ret i8* undef
+
+bb1: ; preds = %entry
+ br i1 undef, label %bb3, label %bb2
+
+bb2: ; preds = %bb1
+ %0 = alloca i8, i32 undef, align 4 ; [#uses=0]
+ br label %bb4
+
+bb3: ; preds = %bb1
+ %1 = malloc i8, i32 undef ; [#uses=0]
+ br label %bb4
+
+bb4: ; preds = %bb3, %bb2
+ br i1 undef, label %bb5, label %bb6
+
+bb5: ; preds = %bb4
+ %2 = call arm_apcscc i8* @gets(i8* %s) nounwind ; [#uses=1]
+ ret i8* %2
+
+bb6: ; preds = %bb4
+ unreachable
+}
+
+declare arm_apcscc i8* @gets(i8*) nounwind
Added: llvm/trunk/test/CodeGen/X86/2009-07-20-CoalescerBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-07-20-CoalescerBug.ll?rev=76458&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2009-07-20-CoalescerBug.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2009-07-20-CoalescerBug.ll Mon Jul 20 14:47:55 2009
@@ -0,0 +1,165 @@
+; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin10
+; PR4587
+; rdar://7072590
+
+ %struct.re_pattern_buffer = type <{ i8*, i64, i64, i64, i8*, i64, i64, i8, i8, i8, i8, i8, i8, i8, i8 }>
+
+define fastcc i32 @regex_compile(i8* %pattern, i64 %size, i64 %syntax, %struct.re_pattern_buffer* nocapture %bufp) nounwind ssp {
+entry:
+ br i1 undef, label %return, label %if.end
+
+if.end: ; preds = %entry
+ %tmp35 = getelementptr %struct.re_pattern_buffer* %bufp, i64 0, i32 3 ; [#uses=1]
+ store i64 %syntax, i64* %tmp35
+ store i32 undef, i32* undef
+ br i1 undef, label %if.then66, label %if.end102
+
+if.then66: ; preds = %if.end
+ br i1 false, label %if.else, label %if.then70
+
+if.then70: ; preds = %if.then66
+ %call74 = call i8* @xrealloc(i8* undef, i64 32) nounwind ssp ; [#uses=0]
+ unreachable
+
+if.else: ; preds = %if.then66
+ br i1 false, label %do.body86, label %if.end99
+
+do.body86: ; preds = %if.else
+ br i1 false, label %do.end, label %if.then90
+
+if.then90: ; preds = %do.body86
+ unreachable
+
+do.end: ; preds = %do.body86
+ ret i32 12
+
+if.end99: ; preds = %if.else
+ br label %if.end102
+
+if.end102: ; preds = %if.end99, %if.end
+ br label %while.body
+
+while.body: ; preds = %if.end1126, %sw.bb532, %while.body, %if.end102
+ %laststart.2 = phi i8* [ null, %if.end102 ], [ %laststart.7.ph, %if.end1126 ], [ %laststart.2, %sw.bb532 ], [ %laststart.2, %while.body ] ; [#uses=6]
+ %b.1 = phi i8* [ undef, %if.end102 ], [ %ctg29688, %if.end1126 ], [ %b.1, %sw.bb532 ], [ %b.1, %while.body ] ; [#uses=5]
+ br i1 undef, label %while.body, label %if.end127
+
+if.end127: ; preds = %while.body
+ switch i32 undef, label %sw.bb532 [
+ i32 123, label %handle_interval
+ i32 92, label %do.body3527
+ ]
+
+sw.bb532: ; preds = %if.end127
+ br i1 undef, label %while.body, label %if.end808
+
+if.end808: ; preds = %sw.bb532
+ br i1 undef, label %while.cond1267.preheader, label %if.then811
+
+while.cond1267.preheader: ; preds = %if.end808
+ br i1 false, label %return, label %if.end1294
+
+if.then811: ; preds = %if.end808
+ %call817 = call fastcc i8* @skip_one_char(i8* %laststart.2) ssp ; [#uses=0]
+ br i1 undef, label %cond.end834, label %lor.lhs.false827
+
+lor.lhs.false827: ; preds = %if.then811
+ br label %cond.end834
+
+cond.end834: ; preds = %lor.lhs.false827, %if.then811
+ br i1 undef, label %land.lhs.true838, label %while.cond979.preheader
+
+land.lhs.true838: ; preds = %cond.end834
+ br i1 undef, label %if.then842, label %while.cond979.preheader
+
+if.then842: ; preds = %land.lhs.true838
+ %conv851 = trunc i64 undef to i32 ; [#uses=1]
+ br label %while.cond979.preheader
+
+while.cond979.preheader: ; preds = %if.then842, %land.lhs.true838, %cond.end834
+ %startoffset.0.ph = phi i32 [ 0, %cond.end834 ], [ 0, %land.lhs.true838 ], [ %conv851, %if.then842 ] ; [#uses=2]
+ %laststart.7.ph = phi i8* [ %laststart.2, %cond.end834 ], [ %laststart.2, %land.lhs.true838 ], [ %laststart.2, %if.then842 ] ; [#uses=3]
+ %b.4.ph = phi i8* [ %b.1, %cond.end834 ], [ %b.1, %land.lhs.true838 ], [ %b.1, %if.then842 ] ; [#uses=3]
+ %ctg29688 = getelementptr i8* %b.4.ph, i64 6 ; [#uses=1]
+ br label %while.cond979
+
+while.cond979: ; preds = %if.end1006, %while.cond979.preheader
+ %cmp991 = icmp ugt i64 undef, 0 ; [#uses=1]
+ br i1 %cmp991, label %do.body994, label %while.end1088
+
+do.body994: ; preds = %while.cond979
+ br i1 undef, label %return, label %if.end1006
+
+if.end1006: ; preds = %do.body994
+ %cmp1014 = icmp ugt i64 undef, 32768 ; [#uses=1]
+ %storemerge10953 = select i1 %cmp1014, i64 32768, i64 undef ; [#uses=1]
+ store i64 %storemerge10953, i64* undef
+ br i1 false, label %return, label %while.cond979
+
+while.end1088: ; preds = %while.cond979
+ br i1 undef, label %if.then1091, label %if.else1101
+
+if.then1091: ; preds = %while.end1088
+ store i8 undef, i8* undef
+ %idx.ext1132.pre = zext i32 %startoffset.0.ph to i64 ; [#uses=1]
+ %add.ptr1133.pre = getelementptr i8* %laststart.7.ph, i64 %idx.ext1132.pre ; [#uses=1]
+ %sub.ptr.lhs.cast1135.pre = ptrtoint i8* %add.ptr1133.pre to i64 ; [#uses=1]
+ br label %if.end1126
+
+if.else1101: ; preds = %while.end1088
+ %cond1109 = select i1 undef, i32 18, i32 14 ; [#uses=1]
+ %idx.ext1112 = zext i32 %startoffset.0.ph to i64 ; [#uses=1]
+ %add.ptr1113 = getelementptr i8* %laststart.7.ph, i64 %idx.ext1112 ; [#uses=2]
+ %sub.ptr.rhs.cast1121 = ptrtoint i8* %add.ptr1113 to i64 ; [#uses=1]
+ call fastcc void @insert_op1(i32 %cond1109, i8* %add.ptr1113, i32 undef, i8* %b.4.ph) ssp
+ br label %if.end1126
+
+if.end1126: ; preds = %if.else1101, %if.then1091
+ %sub.ptr.lhs.cast1135.pre-phi = phi i64 [ %sub.ptr.rhs.cast1121, %if.else1101 ], [ %sub.ptr.lhs.cast1135.pre, %if.then1091 ] ; [#uses=1]
+ %add.ptr1128 = getelementptr i8* %b.4.ph, i64 3 ; [#uses=1]
+ %sub.ptr.rhs.cast1136 = ptrtoint i8* %add.ptr1128 to i64 ; [#uses=1]
+ %sub.ptr.sub1137 = sub i64 %sub.ptr.lhs.cast1135.pre-phi, %sub.ptr.rhs.cast1136 ; [#uses=1]
+ %sub.ptr.sub11378527 = trunc i64 %sub.ptr.sub1137 to i32 ; [#uses=1]
+ %conv1139 = add i32 %sub.ptr.sub11378527, -3 ; [#uses=1]
+ store i8 undef, i8* undef
+ %shr10.i8599 = lshr i32 %conv1139, 8 ; [#uses=1]
+ %conv6.i8600 = trunc i32 %shr10.i8599 to i8 ; [#uses=1]
+ store i8 %conv6.i8600, i8* undef
+ br label %while.body
+
+if.end1294: ; preds = %while.cond1267.preheader
+ ret i32 12
+
+do.body3527: ; preds = %if.end127
+ br i1 undef, label %do.end3536, label %if.then3531
+
+if.then3531: ; preds = %do.body3527
+ unreachable
+
+do.end3536: ; preds = %do.body3527
+ ret i32 5
+
+handle_interval: ; preds = %if.end127
+ br i1 undef, label %do.body4547, label %cond.false4583
+
+do.body4547: ; preds = %handle_interval
+ br i1 undef, label %do.end4556, label %if.then4551
+
+if.then4551: ; preds = %do.body4547
+ unreachable
+
+do.end4556: ; preds = %do.body4547
+ ret i32 9
+
+cond.false4583: ; preds = %handle_interval
+ unreachable
+
+return: ; preds = %if.end1006, %do.body994, %while.cond1267.preheader, %entry
+ ret i32 undef
+}
+
+declare i8* @xrealloc(i8*, i64) ssp
+
+declare fastcc i8* @skip_one_char(i8*) nounwind readonly ssp
+
+declare fastcc void @insert_op1(i32, i8*, i32, i8*) nounwind ssp
From dalej at apple.com Mon Jul 20 15:00:06 2009
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 20 Jul 2009 20:00:06 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r76459 -
/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Message-ID: <200907202000.n6KK06RI011116@zion.cs.uiuc.edu>
Author: johannes
Date: Mon Jul 20 15:00:06 2009
New Revision: 76459
URL: http://llvm.org/viewvc/llvm-project?rev=76459&view=rev
Log:
Remove unnecessary, and unstable, reference. PR 4575.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=76459&r1=76458&r2=76459&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jul 20 15:00:06 2009
@@ -1696,7 +1696,7 @@
static tree FixBaseClassField(tree Field) {
tree oldTy = TREE_TYPE(Field);
- tree &newTy = BaseTypesMap[oldTy];
+ tree newTy = BaseTypesMap[oldTy];
// If already in table, reuse.
if (!newTy) {
newTy = copy_node(oldTy);
@@ -1763,7 +1763,7 @@
static tree FixLessAlignedClassField(tree Field) {
tree oldTy = TREE_TYPE(Field);
std::pair p = std::make_pair(oldTy, DECL_ALIGN(Field));
- tree &newTy = LessAlignedTypesMap[p];
+ tree newTy = LessAlignedTypesMap[p];
// If already in table, reuse.
if (!newTy) {
newTy = copy_node(oldTy);
From clattner at apple.com Mon Jul 20 15:01:14 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 20 Jul 2009 13:01:14 -0700
Subject: [llvm-commits] [llvm] r76447 - /llvm/trunk/include/llvm-c/Core.h
In-Reply-To: <16e5fdf90907201245i55a5cf03u49e866135974009c@mail.gmail.com>
References: <200907201822.n6KIMr7Z007662@zion.cs.uiuc.edu>
<2D108AB1-39DD-4C60-8AA0-623B0F5DEB5C@apple.com>
<16e5fdf90907201146k72094499gfa6d3a296eb7f2da@mail.gmail.com>
<16e5fdf90907201245i55a5cf03u49e866135974009c@mail.gmail.com>
Message-ID: <40C8CEE7-ED6F-4D77-8661-FB1B9C35F13B@apple.com>
On Jul 20, 2009, at 12:45 PM, Bill Wendling wrote:
> On Mon, Jul 20, 2009 at 11:46 AM, Bill Wendling
> wrote:
>> On Mon, Jul 20, 2009 at 11:33 AM, Chris Lattner
>> wrote:
>>>
>>> On Jul 20, 2009, at 11:22 AM, Bill Wendling wrote:
>>>
>>>> Author: void
>>>> Date: Mon Jul 20 13:22:52 2009
>>>> New Revision: 76447
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=76447&view=rev
>>>> Log:
>>>> Put new enum at end of list to avoid changing ABI.
>>>
>>> Just to verify: is there code in the C api's that maps from the C++
>>> numbering to the C numbering?
>>>
> Okay. There isn't a "map" from C APIs to C++ numbering. It does a
> static_cast of the GlobalValue::LinkageTypes to the equivalent C enum
> type.
Ok, instead of doing a static cast, do a switch() on one value and
have each case map over.
> I'm still checking the LTO stuff, but I didn't see any uses of
> LLVMLinkage anywhere other than in VMUtils/Core.cpp.
Right, but does LTO handle privatelinkage? If so, it might need to be
updated to support the new linkage form (maybe not).
-Chris
From daniel at zuster.org Mon Jul 20 15:01:54 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Mon, 20 Jul 2009 20:01:54 -0000
Subject: [llvm-commits] [llvm] r76460 - in /llvm/trunk:
include/llvm/MC/MCAsmLexer.h include/llvm/MC/MCAsmParser.h
lib/MC/CMakeLists.txt lib/MC/MCAsmLexer.cpp
lib/Target/X86/AsmParser/X86AsmParser.cpp tools/llvm-mc/AsmLexer.h
tools/llvm-mc/AsmParser.h
Message-ID: <200907202001.n6KK1tu8011214@zion.cs.uiuc.edu>
Author: ddunbar
Date: Mon Jul 20 15:01:54 2009
New Revision: 76460
URL: http://llvm.org/viewvc/llvm-project?rev=76460&view=rev
Log:
Add MCAsmLexer interface.
- This provides the AsmLexer interface to the target specific assembly parsers.
Added:
llvm/trunk/include/llvm/MC/MCAsmLexer.h
llvm/trunk/lib/MC/MCAsmLexer.cpp
Modified:
llvm/trunk/include/llvm/MC/MCAsmParser.h
llvm/trunk/lib/MC/CMakeLists.txt
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmLexer.h
llvm/trunk/tools/llvm-mc/AsmParser.h
Added: llvm/trunk/include/llvm/MC/MCAsmLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmLexer.h?rev=76460&view=auto
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmLexer.h (added)
+++ llvm/trunk/include/llvm/MC/MCAsmLexer.h Mon Jul 20 15:01:54 2009
@@ -0,0 +1,32 @@
+//===-- llvm/MC/MCAsmLexer.h - Abstract Asm Lexer Interface -----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCASMLEXER_H
+#define LLVM_MC_MCASMLEXER_H
+
+namespace llvm {
+class MCAsmLexer;
+class MCInst;
+class Target;
+
+/// MCAsmLexer - Generic assembler lexer interface, for use by target specific
+/// assembly lexers.
+class MCAsmLexer {
+ MCAsmLexer(const MCAsmLexer &); // DO NOT IMPLEMENT
+ void operator=(const MCAsmLexer &); // DO NOT IMPLEMENT
+protected: // Can only create subclasses.
+ MCAsmLexer();
+
+public:
+ virtual ~MCAsmLexer();
+};
+
+} // End llvm namespace
+
+#endif
Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmParser.h?rev=76460&r1=76459&r2=76460&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmParser.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmParser.h Mon Jul 20 15:01:54 2009
@@ -11,10 +11,7 @@
#define LLVM_MC_MCASMPARSER_H
namespace llvm {
-class MCAsmParser;
-class MCInst;
-class Target;
-class TargetAsmParser;
+class MCAsmLexer;
/// MCAsmParser - Generic assembler parser interface, for use by target specific
/// assembly parsers.
@@ -26,6 +23,8 @@
public:
virtual ~MCAsmParser();
+
+ virtual MCAsmLexer &getLexer() = 0;
};
} // End llvm namespace
Modified: llvm/trunk/lib/MC/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/CMakeLists.txt?rev=76460&r1=76459&r2=76460&view=diff
==============================================================================
--- llvm/trunk/lib/MC/CMakeLists.txt (original)
+++ llvm/trunk/lib/MC/CMakeLists.txt Mon Jul 20 15:01:54 2009
@@ -1,4 +1,5 @@
add_llvm_library(LLVMMC
+ MCAsmLexer.cpp
MCAsmParser.cpp
MCAsmStreamer.cpp
MCContext.cpp
Added: llvm/trunk/lib/MC/MCAsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmLexer.cpp?rev=76460&view=auto
==============================================================================
--- llvm/trunk/lib/MC/MCAsmLexer.cpp (added)
+++ llvm/trunk/lib/MC/MCAsmLexer.cpp Mon Jul 20 15:01:54 2009
@@ -0,0 +1,18 @@
+//===-- MCAsmLexer.cpp - Abstract Asm Lexer Interface ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCAsmLexer.h"
+
+using namespace llvm;
+
+MCAsmLexer::MCAsmLexer() {
+}
+
+MCAsmLexer::~MCAsmLexer() {
+}
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=76460&r1=76459&r2=76460&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Jul 20 15:01:54 2009
@@ -8,21 +8,29 @@
//===----------------------------------------------------------------------===//
#include "X86.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCAsmParser.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetAsmParser.h"
using namespace llvm;
namespace {
+ struct X86Operand {
+ };
-class X86ATTAsmParser : public TargetAsmParser {
- public:
- explicit X86ATTAsmParser(const Target &);
-
- virtual bool ParseInstruction(MCAsmParser &AP, const char *Name,
- MCInst &Inst);
-};
-
+ class X86ATTAsmParser : public TargetAsmParser {
+ bool ParseOperand(X86Operand &Op);
+
+ bool MatchInstruction(const char *Name,
+ llvm::SmallVector &Operands,
+ MCInst &Inst);
+
+ public:
+ explicit X86ATTAsmParser(const Target &);
+
+ virtual bool ParseInstruction(MCAsmParser &AP, const char *Name,
+ MCInst &Inst);
+ };
}
X86ATTAsmParser::X86ATTAsmParser(const Target &T)
@@ -30,9 +38,25 @@
{
}
+bool X86ATTAsmParser::ParseOperand(X86Operand &Op) {
+ return true;
+}
+
+bool
+X86ATTAsmParser::MatchInstruction(const char *Name,
+ llvm::SmallVector &Operands,
+ MCInst &Inst) {
+ return false;
+}
+
bool X86ATTAsmParser::ParseInstruction(MCAsmParser &AP, const char *Name,
MCInst &Inst) {
- return true;
+ MCAsmLexer &Lexer = AP.getLexer();
+ llvm::SmallVector Operands;
+ (void) Lexer;
+ (void) Operands;
+
+ return MatchInstruction(Name, Operands, Inst);
}
namespace {
Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=76460&r1=76459&r2=76460&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmLexer.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmLexer.h Mon Jul 20 15:01:54 2009
@@ -14,6 +14,7 @@
#ifndef ASMLEXER_H
#define ASMLEXER_H
+#include "llvm/MC/MCAsmLexer.h"
#include "llvm/Support/DataTypes.h"
#include
#include
@@ -52,7 +53,7 @@
}
/// AsmLexer - Lexer class for assembly files.
-class AsmLexer {
+class AsmLexer : public MCAsmLexer {
SourceMgr &SrcMgr;
const char *CurPtr;
Modified: llvm/trunk/tools/llvm-mc/AsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=76460&r1=76459&r2=76460&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jul 20 15:01:54 2009
@@ -24,6 +24,7 @@
class MCInst;
class MCStreamer;
class MCValue;
+class TargetAsmParser;
class AsmParser : MCAsmParser {
public:
@@ -46,6 +47,8 @@
public:
TargetAsmParser &getTargetParser() const { return TargetParser; }
+ virtual MCAsmLexer &getLexer() { return Lexer; }
+
private:
bool ParseStatement();
From gohman at apple.com Mon Jul 20 15:18:28 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Jul 2009 13:18:28 -0700
Subject: [llvm-commits] LLVM Verilog Backend
In-Reply-To: <9b38093e0907180422m57244b21n5d5a50368f84db71@mail.gmail.com>
References: <9b38093e0907180422m57244b21n5d5a50368f84db71@mail.gmail.com>
Message-ID:
On Jul 18, 2009, at 4:22 AM, Nadav wrote:
> Hello,
>
> My name is Nadav Rotem and I am a PhD student at Haifa University.
> In my research (in High-level Synthesis), I developed a Verilog
> backend for LLVM that I would like to contribute to LLVM. The
> Verilog Backend is documented in an academic paper [1]. An on-line
> web interface is available [2].
>
> I attached the code to this email. The code compiles with LLVM 2.5;
> I only included the Backend itself. I did not include the
> preliminary transformation passes, the driver scripts and the test
> cases.
Hello,
Are you planning to contribute the transformation passes and/or other
components, or just this backend? Is this backend usable without these
other parts?
Do you have any tests, or any examples, that can be used to demonstrate
this backend?
Thanks,
Dan
From enderby at apple.com Mon Jul 20 15:25:37 2009
From: enderby at apple.com (Kevin Enderby)
Date: Mon, 20 Jul 2009 20:25:37 -0000
Subject: [llvm-commits] [llvm] r76462 - in /llvm/trunk:
include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp
test/MC/AsmParser/directive_dump_and_load.s tools/llvm-mc/AsmParser.cpp
tools/llvm-mc/AsmParser.h
Message-ID: <200907202025.n6KKPbjx012028@zion.cs.uiuc.edu>
Author: enderby
Date: Mon Jul 20 15:25:37 2009
New Revision: 76462
URL: http://llvm.org/viewvc/llvm-project?rev=76462&view=rev
Log:
Removed the DumpSymbolsandMacros and LoadSymbolsandMacros MCStreamer API as
the parsing of the .dump and .load should be done in the assembly parser and
not have any need for an MCStreamer API. Changed the code for now so these
just produce an error saying these specific directives are not yet implemented
since they are likely no longer used and may never need to be implemented.
Removed:
llvm/trunk/test/MC/AsmParser/directive_dump_and_load.s
Modified:
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/lib/MC/MCAsmStreamer.cpp
llvm/trunk/tools/llvm-mc/AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmParser.h
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=76462&r1=76461&r2=76462&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Jul 20 15:25:37 2009
@@ -162,18 +162,6 @@
/// @param AbortReason - The reason assembly is terminated, if non-NULL.
virtual void AbortAssembly(const char *AbortReason) = 0;
- /// DumpSymbolsandMacros - Dump to the specified file in @param FileName all
- /// symbols and macros at this point in the assembly.
- ///
- /// @param FileName - The file to dump the symbols and macros into.
- virtual void DumpSymbolsandMacros(const char *FileName) = 0;
-
- /// LoadSymbolsandMacros - Load from the specified file in @param FileName
- /// symbols and macros into the assembler at this point in the assembly.
- ///
- /// @param FileName - The file to load the symbols and macros from.
- virtual void LoadSymbolsandMacros(const char *FileName) = 0;
-
/// @}
/// @name Generating Data
/// @{
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=76462&r1=76461&r2=76462&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Jul 20 15:25:37 2009
@@ -57,10 +57,6 @@
virtual void AbortAssembly(const char *AbortReason = NULL);
- virtual void DumpSymbolsandMacros(const char *FileName);
-
- virtual void LoadSymbolsandMacros(const char *FileName);
-
virtual void EmitBytes(const char *Data, unsigned Length);
virtual void EmitValue(const MCValue &Value, unsigned Size);
@@ -144,14 +140,6 @@
}
-void MCAsmStreamer::DumpSymbolsandMacros(const char *FileName) {
- OS << ".dump" << ' ' << FileName << '\n';
-}
-
-void MCAsmStreamer::LoadSymbolsandMacros(const char *FileName) {
- OS << ".load" << ' ' << FileName << '\n';
-}
-
void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value,
bool MakeAbsolute) {
assert(!Symbol->getSection() && "Cannot assign to a label!");
Removed: llvm/trunk/test/MC/AsmParser/directive_dump_and_load.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_dump_and_load.s?rev=76461&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_dump_and_load.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_dump_and_load.s (removed)
@@ -1,8 +0,0 @@
-# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
-
-# CHECK: TEST0:
-# CHECK: .dump "somefile"
-# CHECK: .load "jack and jill"
-TEST0:
- .dump "somefile"
- .load "jack and jill"
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=76462&r1=76461&r2=76462&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jul 20 15:25:37 2009
@@ -539,9 +539,9 @@
if (!strcmp(IDVal, ".include"))
return ParseDirectiveInclude();
if (!strcmp(IDVal, ".dump"))
- return ParseDirectiveDarwinDumpOrLoad(/*IsDump=*/true);
+ return ParseDirectiveDarwinDumpOrLoad(IDLoc, /*IsDump=*/true);
if (!strcmp(IDVal, ".load"))
- return ParseDirectiveDarwinDumpOrLoad(/*IsLoad=*/false);
+ return ParseDirectiveDarwinDumpOrLoad(IDLoc, /*IsLoad=*/false);
Warning(IDLoc, "ignoring directive for now");
EatToEndOfStatement();
@@ -1197,11 +1197,11 @@
/// ParseDirectiveDarwinDumpOrLoad
/// ::= ( .dump | .load ) "filename"
-bool AsmParser::ParseDirectiveDarwinDumpOrLoad(bool IsDump) {
+bool AsmParser::ParseDirectiveDarwinDumpOrLoad(SMLoc IDLoc, bool IsDump) {
if (Lexer.isNot(asmtok::String))
return TokError("expected string in '.dump' or '.load' directive");
- const char *Str = Lexer.getCurStrVal();
+ Lexer.getCurStrVal();
Lexer.Lex();
@@ -1210,10 +1210,12 @@
Lexer.Lex();
+ // FIXME: If/when .dump and .load are implemented they will be done in the
+ // the assembly parser and not have any need for an MCStreamer API.
if (IsDump)
- Out.DumpSymbolsandMacros(Str);
+ Warning(IDLoc, "ignoring directive .dump for now");
else
- Out.LoadSymbolsandMacros(Str);
+ Warning(IDLoc, "ignoring directive .load for now");
return false;
}
Modified: llvm/trunk/tools/llvm-mc/AsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=76462&r1=76461&r2=76462&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jul 20 15:25:37 2009
@@ -127,7 +127,7 @@
// Darwin specific ".subsections_via_symbols"
bool ParseDirectiveDarwinSubsectionsViaSymbols();
// Darwin specific .dump and .load
- bool ParseDirectiveDarwinDumpOrLoad(bool IsDump);
+ bool ParseDirectiveDarwinDumpOrLoad(SMLoc IDLoc, bool IsDump);
bool ParseDirectiveAbort(); // ".abort"
bool ParseDirectiveInclude(); // ".include"
From sabre at nondot.org Mon Jul 20 15:25:57 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 20 Jul 2009 20:25:57 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r76463 -
/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Message-ID: <200907202025.n6KKPwBl012050@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Jul 20 15:25:57 2009
New Revision: 76463
URL: http://llvm.org/viewvc/llvm-project?rev=76463&view=rev
Log:
rearrange #includes so that macros from GCC headers don't interfere with
llvm headers.
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=76463&r1=76462&r2=76463&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jul 20 15:25:57 2009
@@ -25,9 +25,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/ValueSymbolTable.h"
-#include "llvm-abi.h"
-#include "llvm-internal.h"
-#include "llvm-debug.h"
#include "llvm/CallingConv.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
@@ -39,7 +36,6 @@
#include "llvm/System/Host.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetAsmInfo.h"
-#undef RET
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
@@ -47,6 +43,10 @@
#include "llvm/ADT/DenseMap.h"
#include
+#include "llvm-abi.h"
+#include "llvm-internal.h"
+#include "llvm-debug.h"
+
extern "C" {
#include "config.h"
#include "system.h"
From gohman at apple.com Mon Jul 20 15:32:43 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Jul 2009 20:32:43 -0000
Subject: [llvm-commits] [llvm] r76464 - /llvm/trunk/include/llvm/Operator.h
Message-ID: <200907202032.n6KKWhBv012261@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jul 20 15:32:43 2009
New Revision: 76464
URL: http://llvm.org/viewvc/llvm-project?rev=76464&view=rev
Log:
Clarify that OverflowingBinaryOperator is not used for SDiv, even though
SDiv is a binary operation that can overflow.
Modified:
llvm/trunk/include/llvm/Operator.h
Modified: llvm/trunk/include/llvm/Operator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=76464&r1=76463&r2=76464&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Operator.h (original)
+++ llvm/trunk/include/llvm/Operator.h Mon Jul 20 15:32:43 2009
@@ -61,7 +61,8 @@
};
/// OverflowingBinaryOperator - Utility class for integer arithmetic operators
-/// which may exhibit overflow - Add, Sub, and Mul.
+/// which may exhibit overflow - Add, Sub, and Mul. It does not include SDiv,
+/// despite that operator having the potential for overflow.
///
class OverflowingBinaryOperator : public Operator {
public:
From isanbard at gmail.com Mon Jul 20 15:33:27 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 13:33:27 -0700
Subject: [llvm-commits] [llvm] r76447 - /llvm/trunk/include/llvm-c/Core.h
In-Reply-To: <40C8CEE7-ED6F-4D77-8661-FB1B9C35F13B@apple.com>
References: <200907201822.n6KIMr7Z007662@zion.cs.uiuc.edu>
<2D108AB1-39DD-4C60-8AA0-623B0F5DEB5C@apple.com>
<16e5fdf90907201146k72094499gfa6d3a296eb7f2da@mail.gmail.com>
<16e5fdf90907201245i55a5cf03u49e866135974009c@mail.gmail.com>
<40C8CEE7-ED6F-4D77-8661-FB1B9C35F13B@apple.com>
Message-ID: <16e5fdf90907201333v71efc45i7af985cac42669ba@mail.gmail.com>
On Mon, Jul 20, 2009 at 1:01 PM, Chris Lattner wrote:
>
> Ok, instead of doing a static cast, do a switch() on one value and
> have each case map over.
>
Okay. :)
> Right, but does LTO handle privatelinkage? ?If so, it might need to be
> updated to support the new linkage form (maybe not).
>
I did a global grep on "PrivateLinkage" and didn't find anything in
the LTO code...
-bw
From isanbard at gmail.com Mon Jul 20 15:34:46 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 20:34:46 -0000
Subject: [llvm-commits] [llvm] r76465 - /llvm/trunk/lib/VMCore/Core.cpp
Message-ID: <200907202034.n6KKYkDF012330@zion.cs.uiuc.edu>
Author: void
Date: Mon Jul 20 15:34:46 2009
New Revision: 76465
URL: http://llvm.org/viewvc/llvm-project?rev=76465&view=rev
Log:
Change the casting of linkage types into a map. This makes this much more robust
as it no longer depends upon two different enums being kept in sync with each
other.
Modified:
llvm/trunk/lib/VMCore/Core.cpp
Modified: llvm/trunk/lib/VMCore/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=76465&r1=76464&r2=76465&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Core.cpp (original)
+++ llvm/trunk/lib/VMCore/Core.cpp Mon Jul 20 15:34:46 2009
@@ -697,12 +697,97 @@
}
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global) {
- return static_cast(unwrap(Global)->getLinkage());
+ switch (unwrap(Global)->getLinkage()) {
+ default:
+ assert(false && "Unhandled Linkage Type.");
+ case GlobalValue::ExternalLinkage:
+ return LLVMExternalLinkage;
+ case GlobalValue::AvailableExternallyLinkage:
+ return LLVMAvailableExternallyLinkage;
+ case GlobalValue::LinkOnceAnyLinkage:
+ return LLVMLinkOnceAnyLinkage;
+ case GlobalValue::LinkOnceODRLinkage:
+ return LLVMLinkOnceODRLinkage;
+ case GlobalValue::WeakAnyLinkage:
+ return LLVMWeakAnyLinkage;
+ case GlobalValue::WeakODRLinkage:
+ return LLVMWeakODRLinkage;
+ case GlobalValue::AppendingLinkage:
+ return LLVMAppendingLinkage;
+ case GlobalValue::InternalLinkage:
+ return LLVMInternalLinkage;
+ case GlobalValue::PrivateLinkage:
+ return LLVMPrivateLinkage;
+ case GlobalValue::LinkerPrivateLinkage:
+ return LLVMLinkerPrivateLinkage;
+ case GlobalValue::DLLImportLinkage:
+ return LLVMDLLImportLinkage;
+ case GlobalValue::DLLExportLinkage:
+ return LLVMDLLExportLinkage;
+ case GlobalValue::ExternalWeakLinkage:
+ return LLVMExternalWeakLinkage;
+ case GlobalValue::GhostLinkage:
+ return LLVMGhostLinkage;
+ case GlobalValue::CommonLinkage:
+ return LLVMCommonLinkage;
+ }
+
+ // Should never get here.
+ return static_cast(0);
}
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage) {
- unwrap(Global)
- ->setLinkage(static_cast(Linkage));
+ GlobalValue *GV = unwrap(Global);
+
+ switch (Linkage) {
+ default:
+ assert(false && "Unhandled Linkage Type.");
+ case LLVMExternalLinkage:
+ GV->setLinkage(GlobalValue::ExternalLinkage);
+ break;
+ case LLVMAvailableExternallyLinkage:
+ GV->setLinkage(GlobalValue::AvailableExternallyLinkage);
+ break;
+ case LLVMLinkOnceAnyLinkage:
+ GV->setLinkage(GlobalValue::LinkOnceAnyLinkage);
+ break;
+ case LLVMLinkOnceODRLinkage:
+ GV->setLinkage(GlobalValue::LinkOnceODRLinkage);
+ break;
+ case LLVMWeakAnyLinkage:
+ GV->setLinkage(GlobalValue::WeakAnyLinkage);
+ break;
+ case LLVMWeakODRLinkage:
+ GV->setLinkage(GlobalValue::WeakODRLinkage);
+ break;
+ case LLVMAppendingLinkage:
+ GV->setLinkage(GlobalValue::AppendingLinkage);
+ break;
+ case LLVMInternalLinkage:
+ GV->setLinkage(GlobalValue::InternalLinkage);
+ break;
+ case LLVMPrivateLinkage:
+ GV->setLinkage(GlobalValue::PrivateLinkage);
+ break;
+ case LLVMLinkerPrivateLinkage:
+ GV->setLinkage(GlobalValue::LinkerPrivateLinkage);
+ break;
+ case LLVMDLLImportLinkage:
+ GV->setLinkage(GlobalValue::DLLImportLinkage);
+ break;
+ case LLVMDLLExportLinkage:
+ GV->setLinkage(GlobalValue::DLLExportLinkage);
+ break;
+ case LLVMExternalWeakLinkage:
+ GV->setLinkage(GlobalValue::ExternalWeakLinkage);
+ break;
+ case LLVMGhostLinkage:
+ GV->setLinkage(GlobalValue::GhostLinkage);
+ break;
+ case LLVMCommonLinkage:
+ GV->setLinkage(GlobalValue::CommonLinkage);
+ break;
+ }
}
const char *LLVMGetSection(LLVMValueRef Global) {
From isanbard at gmail.com Mon Jul 20 16:00:18 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 14:00:18 -0700
Subject: [llvm-commits] [llvm] r76385 - in /llvm/trunk: docs/
include/llvm-c/ include/llvm/ include/llvm/Support/
lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/
lib/CodeGen/ lib/Linker/ lib/Target/
lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPr
In-Reply-To:
References:
Message-ID: <16e5fdf90907201400h3745db43q659e574fb3259eed@mail.gmail.com>
On Mon, Jul 20, 2009 at 5:42 AM, Eli Friedman wrote:
> On Mon, Jul 20, 2009 at 1:19 AM, Duncan Sands wrote:
>> Hi Chris,
>>
>>> Right. ?Private linkage is discarded by the assembler, so they never
>>> make it into the .o file. ?linker_private is discarded by the linker,
>>> so it never makes it into the .exe/.dylib. ?I don't think there is a
>>> corresponding idea on ELF, so on ELF they two linkage types should be
>>> codegen'd the same way.
>>
>> I don't understand why you would want something to be discarded by
>> the assembler/linker and not by the linker/assembler. ?Don't you
>> want them both to throw pointless things away?
>
> I've stopped questioning anything that has to do with Apple's
> linker... it has all sorts of strange quirks.
>
I have too. :-)
-bw
From evan.cheng at apple.com Mon Jul 20 16:16:08 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Jul 2009 21:16:08 -0000
Subject: [llvm-commits] [llvm] r76472 - in /llvm/trunk:
lib/CodeGen/TwoAddressInstructionPass.cpp
test/CodeGen/Thumb/2009-07-20-TwoAddrBug.ll
Message-ID: <200907202116.n6KLG8ZW013756@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Jul 20 16:16:08 2009
New Revision: 76472
URL: http://llvm.org/viewvc/llvm-project?rev=76472&view=rev
Log:
Use TII->findCommutedOpIndices to find the commute operands (rather than guessing).
Added:
llvm/trunk/test/CodeGen/Thumb/2009-07-20-TwoAddrBug.ll
Modified:
llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=76472&r1=76471&r2=76472&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Jul 20 16:16:08 2009
@@ -879,10 +879,14 @@
// so, swap the B and C operands. This makes the live ranges of A
// and C joinable.
// FIXME: This code also works for A := B op C instructions.
- if (TID.isCommutable() && mi->getNumOperands() >= 3) {
- assert(mi->getOperand(3-si).isReg() &&
- "Not a proper commutative instruction!");
- unsigned regC = mi->getOperand(3-si).getReg();
+ unsigned SrcOp1, SrcOp2;
+ if (TID.isCommutable() && mi->getNumOperands() >= 3 &&
+ TII->findCommutedOpIndices(mi, SrcOp1, SrcOp2)) {
+ unsigned regC = 0;
+ if (si == SrcOp1)
+ regC = mi->getOperand(SrcOp2).getReg();
+ else if (si == SrcOp2)
+ regC = mi->getOperand(SrcOp1).getReg();
if (isKilled(*mi, regC, MRI, TII)) {
if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) {
++NumCommuted;
Added: llvm/trunk/test/CodeGen/Thumb/2009-07-20-TwoAddrBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb/2009-07-20-TwoAddrBug.ll?rev=76472&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb/2009-07-20-TwoAddrBug.ll (added)
+++ llvm/trunk/test/CodeGen/Thumb/2009-07-20-TwoAddrBug.ll Mon Jul 20 16:16:08 2009
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -mtriple=thumbv6-apple-darwin10
+
+ at Time.2535 = external global i64 ; [#uses=2]
+
+define arm_apcscc i64 @millisecs() nounwind {
+entry:
+ %0 = load i64* @Time.2535, align 4 ; [#uses=2]
+ %1 = add i64 %0, 1 ; [#uses=1]
+ store i64 %1, i64* @Time.2535, align 4
+ ret i64 %0
+}
From gohman at apple.com Mon Jul 20 16:19:08 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Jul 2009 21:19:08 -0000
Subject: [llvm-commits] [llvm] r76475 - in /llvm/trunk:
include/llvm/Bitcode/LLVMBitCodes.h lib/AsmParser/LLLexer.cpp
lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h
lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp
lib/VMCore/AsmWriter.cpp test/Assembler/flags-plain.ll
test/Assembler/flags-reversed.ll test/Assembler/flags-signed.ll
test/Assembler/flags-unsigned.ll test/Assembler/flags.ll
Message-ID: <200907202119.n6KLJ8DK013888@zion.cs.uiuc.edu>
Author: djg
Date: Mon Jul 20 16:19:07 2009
New Revision: 76475
URL: http://llvm.org/viewvc/llvm-project?rev=76475&view=rev
Log:
Assembly and Bitcode support for unsigned/signed overflow flags and
exact sdiv flags.
Added:
llvm/trunk/test/Assembler/flags-plain.ll
llvm/trunk/test/Assembler/flags-reversed.ll
llvm/trunk/test/Assembler/flags-signed.ll
llvm/trunk/test/Assembler/flags-unsigned.ll
llvm/trunk/test/Assembler/flags.ll
Modified:
llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
llvm/trunk/lib/AsmParser/LLLexer.cpp
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLToken.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=76475&r1=76474&r2=76475&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
+++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Mon Jul 20 16:19:07 2009
@@ -171,6 +171,18 @@
BINOP_XOR = 12
};
+ /// OverflowingBinaryOperatorOptionalFlags - Flags for serializing
+ /// OverflowingBinaryOperator's SubclassOptionalData contents.
+ enum OverflowingBinaryOperatorOptionalFlags {
+ OBO_NO_UNSIGNED_OVERFLOW = 0,
+ OBO_NO_SIGNED_OVERFLOW = 1
+ };
+
+ /// SDivOperatorOptionalFlags - Flags for serializing SDivOperator's
+ /// SubclassOptionalData contents.
+ enum SDivOperatorOptionalFlags {
+ SDIV_EXACT = 0
+ };
// The function body block (FUNCTION_BLOCK_ID) describes function bodies. It
// can contain a constant block (CONSTANTS_BLOCK_ID).
Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=76475&r1=76474&r2=76475&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLLexer.cpp Mon Jul 20 16:19:07 2009
@@ -501,6 +501,9 @@
KEYWORD(deplibs);
KEYWORD(datalayout);
KEYWORD(volatile);
+ KEYWORD(signed);
+ KEYWORD(unsigned);
+ KEYWORD(exact);
KEYWORD(align);
KEYWORD(addrspace);
KEYWORD(section);
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=76475&r1=76474&r2=76475&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jul 20 16:19:07 2009
@@ -21,6 +21,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/MDNode.h"
#include "llvm/Module.h"
+#include "llvm/Operator.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringExtras.h"
@@ -2041,6 +2042,49 @@
ID.Kind = ValID::t_Constant;
return false;
}
+ case lltok::kw_signed: {
+ Lex.Lex();
+ bool AlsoUnsigned = EatIfPresent(lltok::kw_unsigned);
+ if (Lex.getKind() != lltok::kw_add &&
+ Lex.getKind() != lltok::kw_sub &&
+ Lex.getKind() != lltok::kw_mul)
+ return TokError("expected 'add', 'sub', or 'mul'");
+ bool Result = LLParser::ParseValID(ID);
+ if (!Result) {
+ cast(ID.ConstantVal)
+ ->setHasNoSignedOverflow(true);
+ if (AlsoUnsigned)
+ cast(ID.ConstantVal)
+ ->setHasNoUnsignedOverflow(true);
+ }
+ return Result;
+ }
+ case lltok::kw_unsigned: {
+ Lex.Lex();
+ bool AlsoSigned = EatIfPresent(lltok::kw_signed);
+ if (Lex.getKind() != lltok::kw_add &&
+ Lex.getKind() != lltok::kw_sub &&
+ Lex.getKind() != lltok::kw_mul)
+ return TokError("expected 'add', 'sub', or 'mul'");
+ bool Result = LLParser::ParseValID(ID);
+ if (!Result) {
+ cast(ID.ConstantVal)
+ ->setHasNoUnsignedOverflow(true);
+ if (AlsoSigned)
+ cast(ID.ConstantVal)
+ ->setHasNoSignedOverflow(true);
+ }
+ return Result;
+ }
+ case lltok::kw_exact: {
+ Lex.Lex();
+ if (Lex.getKind() != lltok::kw_sdiv)
+ return TokError("expected 'sdiv'");
+ bool Result = LLParser::ParseValID(ID);
+ if (!Result)
+ cast(ID.ConstantVal)->setIsExact(true);
+ return Result;
+ }
}
Lex.Lex();
@@ -2558,6 +2602,50 @@
return ParseStore(Inst, PFS, true);
else
return TokError("expected 'load' or 'store'");
+ case lltok::kw_signed: {
+ bool AlsoUnsigned = EatIfPresent(lltok::kw_unsigned);
+ if (Lex.getKind() == lltok::kw_add ||
+ Lex.getKind() == lltok::kw_sub ||
+ Lex.getKind() == lltok::kw_mul) {
+ Lex.Lex();
+ KeywordVal = Lex.getUIntVal();
+ bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 0);
+ if (!Result) {
+ cast(Inst)->setHasNoSignedOverflow(true);
+ if (AlsoUnsigned)
+ cast(Inst)->setHasNoUnsignedOverflow(true);
+ }
+ return Result;
+ }
+ return TokError("expected 'add', 'sub', or 'mul'");
+ }
+ case lltok::kw_unsigned: {
+ bool AlsoSigned = EatIfPresent(lltok::kw_signed);
+ if (Lex.getKind() == lltok::kw_add ||
+ Lex.getKind() == lltok::kw_sub ||
+ Lex.getKind() == lltok::kw_mul) {
+ Lex.Lex();
+ KeywordVal = Lex.getUIntVal();
+ bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 1);
+ if (!Result) {
+ cast(Inst)->setHasNoUnsignedOverflow(true);
+ if (AlsoSigned)
+ cast(Inst)->setHasNoSignedOverflow(true);
+ }
+ return Result;
+ }
+ return TokError("expected 'add', 'sub', or 'mul'");
+ }
+ case lltok::kw_exact:
+ if (Lex.getKind() == lltok::kw_sdiv) {
+ Lex.Lex();
+ KeywordVal = Lex.getUIntVal();
+ bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 1);
+ if (!Result)
+ cast(Inst)->setIsExact(true);
+ return Result;
+ }
+ return TokError("expected 'udiv'");
case lltok::kw_getresult: return ParseGetResult(Inst, PFS);
case lltok::kw_getelementptr: return ParseGetElementPtr(Inst, PFS);
case lltok::kw_extractvalue: return ParseExtractValue(Inst, PFS);
Modified: llvm/trunk/lib/AsmParser/LLToken.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLToken.h?rev=76475&r1=76474&r2=76475&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLToken.h (original)
+++ llvm/trunk/lib/AsmParser/LLToken.h Mon Jul 20 16:19:07 2009
@@ -51,6 +51,9 @@
kw_deplibs,
kw_datalayout,
kw_volatile,
+ kw_signed,
+ kw_unsigned,
+ kw_exact,
kw_align,
kw_addrspace,
kw_section,
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=76475&r1=76474&r2=76475&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Jul 20 16:19:07 2009
@@ -20,6 +20,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/MDNode.h"
#include "llvm/Module.h"
+#include "llvm/Operator.h"
#include "llvm/AutoUpgrade.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
@@ -747,6 +748,18 @@
return false;
}
+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);
+ } else if (SDivOperator *Div = dyn_cast(V)) {
+ if (Flags & (1 << bitc::SDIV_EXACT))
+ Div->setIsExact(true);
+ }
+}
bool BitcodeReader::ParseConstants() {
if (Stream.EnterSubBlock(bitc::CONSTANTS_BLOCK_ID))
@@ -778,7 +791,8 @@
// Read a record.
Record.clear();
Value *V = 0;
- switch (Stream.ReadRecord(Code, Record)) {
+ unsigned BitCode = Stream.ReadRecord(Code, Record);
+ switch (BitCode) {
default: // Default behavior: unknown constant
case bitc::CST_CODE_UNDEF: // UNDEF
V = Context.getUndef(CurTy);
@@ -899,6 +913,8 @@
Constant *RHS = ValueList.getConstantFwdRef(Record[2], CurTy);
V = Context.getConstantExpr(Opc, LHS, RHS);
}
+ if (Record.size() >= 4)
+ SetOptimizationFlags(V, Record[3]);
break;
}
case bitc::CST_CODE_CE_CAST: { // CE_CAST: [opcode, opty, opval]
@@ -1451,7 +1467,8 @@
// Read a record.
Record.clear();
Instruction *I = 0;
- switch (Stream.ReadRecord(Code, Record)) {
+ unsigned BitCode = Stream.ReadRecord(Code, Record);
+ switch (BitCode) {
default: // Default behavior: reject
return Error("Unknown instruction");
case bitc::FUNC_CODE_DECLAREBLOCKS: // DECLAREBLOCKS: [nblocks]
@@ -1469,12 +1486,14 @@
Value *LHS, *RHS;
if (getValueTypePair(Record, OpNum, NextValueNo, LHS) ||
getValue(Record, OpNum, LHS->getType(), RHS) ||
- OpNum+1 != Record.size())
+ OpNum+1 > Record.size())
return Error("Invalid BINOP record");
- int Opc = GetDecodedBinaryOpcode(Record[OpNum], LHS->getType());
+ int Opc = GetDecodedBinaryOpcode(Record[OpNum++], LHS->getType());
if (Opc == -1) return Error("Invalid BINOP record");
I = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);
+ if (OpNum < Record.size())
+ SetOptimizationFlags(I, Record[3]);
break;
}
case bitc::FUNC_CODE_INST_CAST: { // CAST: [opval, opty, destty, castopc]
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=76475&r1=76474&r2=76475&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Jul 20 16:19:07 2009
@@ -21,6 +21,7 @@
#include "llvm/Instructions.h"
#include "llvm/MDNode.h"
#include "llvm/Module.h"
+#include "llvm/Operator.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/ErrorHandling.h"
@@ -50,6 +51,7 @@
// FUNCTION_BLOCK abbrev id's.
FUNCTION_INST_LOAD_ABBREV = bitc::FIRST_APPLICATION_ABBREV,
FUNCTION_INST_BINOP_ABBREV,
+ FUNCTION_INST_BINOP_FLAGS_ABBREV,
FUNCTION_INST_CAST_ABBREV,
FUNCTION_INST_RET_VOID_ABBREV,
FUNCTION_INST_RET_VAL_ABBREV,
@@ -454,6 +456,22 @@
}
}
+static uint64_t GetOptimizationFlags(const Value *V) {
+ uint64_t Flags = 0;
+
+ 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;
+ } else if (const SDivOperator *Div = dyn_cast(V)) {
+ if (Div->isExact())
+ Flags |= 1 << bitc::SDIV_EXACT;
+ }
+
+ return Flags;
+}
static void WriteConstants(unsigned FirstVal, unsigned LastVal,
const ValueEnumerator &VE,
@@ -641,6 +659,9 @@
Record.push_back(GetEncodedBinaryOpcode(CE->getOpcode()));
Record.push_back(VE.getValueID(C->getOperand(0)));
Record.push_back(VE.getValueID(C->getOperand(1)));
+ uint64_t Flags = GetOptimizationFlags(CE);
+ if (Flags != 0)
+ Record.push_back(Flags);
}
break;
case Instruction::GetElementPtr:
@@ -778,6 +799,12 @@
AbbrevToUse = FUNCTION_INST_BINOP_ABBREV;
Vals.push_back(VE.getValueID(I.getOperand(1)));
Vals.push_back(GetEncodedBinaryOpcode(I.getOpcode()));
+ uint64_t Flags = GetOptimizationFlags(&I);
+ if (Flags != 0) {
+ if (AbbrevToUse == FUNCTION_INST_BINOP_ABBREV)
+ AbbrevToUse = FUNCTION_INST_BINOP_FLAGS_ABBREV;
+ Vals.push_back(Flags);
+ }
}
break;
@@ -1225,6 +1252,17 @@
Abbv) != FUNCTION_INST_BINOP_ABBREV)
llvm_unreachable("Unexpected abbrev ordering!");
}
+ { // INST_BINOP_FLAGS abbrev for FUNCTION_BLOCK.
+ BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+ Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_BINOP));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHS
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // RHS
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4)); // opc
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); // flags
+ if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID,
+ Abbv) != FUNCTION_INST_BINOP_FLAGS_ABBREV)
+ llvm_unreachable("Unexpected abbrev ordering!");
+ }
{ // INST_CAST abbrev for FUNCTION_BLOCK.
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_CAST));
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=76475&r1=76474&r2=76475&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Jul 20 16:19:07 2009
@@ -23,6 +23,7 @@
#include "llvm/InlineAsm.h"
#include "llvm/Instruction.h"
#include "llvm/Instructions.h"
+#include "llvm/Operator.h"
#include "llvm/MDNode.h"
#include "llvm/Module.h"
#include "llvm/ValueSymbolTable.h"
@@ -851,6 +852,19 @@
}
}
+static void WriteOptimizationInfo(raw_ostream &Out, const User *U) {
+ if (const OverflowingBinaryOperator *OBO =
+ dyn_cast(U)) {
+ if (OBO->hasNoUnsignedOverflow())
+ Out << "unsigned ";
+ if (OBO->hasNoSignedOverflow())
+ Out << "signed ";
+ } else if (const SDivOperator *Div = dyn_cast(U)) {
+ if (Div->isExact())
+ Out << "exact ";
+ }
+}
+
static void WriteConstantInt(raw_ostream &Out, const Constant *CV,
TypePrinting &TypePrinter, SlotTracker *Machine) {
if (const ConstantInt *CI = dyn_cast(CV)) {
@@ -1062,6 +1076,7 @@
}
if (const ConstantExpr *CE = dyn_cast(CV)) {
+ WriteOptimizationInfo(Out, CE);
Out << CE->getOpcodeName();
if (CE->isCompare())
Out << ' ' << getPredicateText(CE->getPredicate());
@@ -1682,6 +1697,9 @@
Out << "tail ";
}
+ // Print out optimization information.
+ WriteOptimizationInfo(Out, &I);
+
// Print out the opcode...
Out << I.getOpcodeName();
Added: llvm/trunk/test/Assembler/flags-plain.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags-plain.ll?rev=76475&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/flags-plain.ll (added)
+++ llvm/trunk/test/Assembler/flags-plain.ll Mon Jul 20 16:19:07 2009
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+ at addr = external global i64
+
+define i64 @add_plain_ce() {
+; CHECK: ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @sub_plain_ce() {
+; CHECK: ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @mul_plain_ce() {
+; CHECK: ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @sdiv_plain_ce() {
+; CHECK: ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
Added: llvm/trunk/test/Assembler/flags-reversed.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags-reversed.ll?rev=76475&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/flags-reversed.ll (added)
+++ llvm/trunk/test/Assembler/flags-reversed.ll Mon Jul 20 16:19:07 2009
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+ at addr = external global i64
+
+define i64 @add_both_reversed_ce() {
+; CHECK: ret i64 unsigned signed add (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 signed unsigned add (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @sub_both_reversed_ce() {
+; CHECK: ret i64 unsigned signed sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 signed unsigned sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @mul_both_reversed_ce() {
+; CHECK: ret i64 unsigned signed mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 signed unsigned mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
Added: llvm/trunk/test/Assembler/flags-signed.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags-signed.ll?rev=76475&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/flags-signed.ll (added)
+++ llvm/trunk/test/Assembler/flags-signed.ll Mon Jul 20 16:19:07 2009
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+ at addr = external global i64
+
+define i64 @add_signed_ce() {
+; CHECK: ret i64 signed add (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 signed add (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @sub_signed_ce() {
+; CHECK: ret i64 signed sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 signed sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @mul_signed_ce() {
+; CHECK: ret i64 signed mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 signed mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
Added: llvm/trunk/test/Assembler/flags-unsigned.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags-unsigned.ll?rev=76475&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/flags-unsigned.ll (added)
+++ llvm/trunk/test/Assembler/flags-unsigned.ll Mon Jul 20 16:19:07 2009
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+ at addr = external global i64
+
+define i64 @add_unsigned_ce() {
+; CHECK: ret i64 unsigned add (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 unsigned add (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @sub_unsigned_ce() {
+; CHECK: ret i64 unsigned sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 unsigned sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @mul_unsigned_ce() {
+; CHECK: ret i64 unsigned mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 unsigned mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
Added: llvm/trunk/test/Assembler/flags.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/flags.ll?rev=76475&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/flags.ll (added)
+++ llvm/trunk/test/Assembler/flags.ll Mon Jul 20 16:19:07 2009
@@ -0,0 +1,125 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+ at addr = external global i64
+
+define i64 @add_signed(i64 %x, i64 %y) {
+; CHECK: %z = signed add i64 %x, %y
+ %z = signed add i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @sub_signed(i64 %x, i64 %y) {
+; CHECK: %z = signed sub i64 %x, %y
+ %z = signed sub i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @mul_signed(i64 %x, i64 %y) {
+; CHECK: %z = signed mul i64 %x, %y
+ %z = signed mul i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @add_unsigned(i64 %x, i64 %y) {
+; CHECK: %z = unsigned add i64 %x, %y
+ %z = unsigned add i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @sub_unsigned(i64 %x, i64 %y) {
+; CHECK: %z = unsigned sub i64 %x, %y
+ %z = unsigned sub i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @mul_unsigned(i64 %x, i64 %y) {
+; CHECK: %z = unsigned mul i64 %x, %y
+ %z = unsigned mul i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @add_plain(i64 %x, i64 %y) {
+; CHECK: %z = add i64 %x, %y
+ %z = add i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @sub_plain(i64 %x, i64 %y) {
+; CHECK: %z = sub i64 %x, %y
+ %z = sub i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @mul_plain(i64 %x, i64 %y) {
+; CHECK: %z = mul i64 %x, %y
+ %z = mul i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @add_both(i64 %x, i64 %y) {
+; CHECK: %z = unsigned signed add i64 %x, %y
+ %z = unsigned signed add i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @sub_both(i64 %x, i64 %y) {
+; CHECK: %z = unsigned signed sub i64 %x, %y
+ %z = unsigned signed sub i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @mul_both(i64 %x, i64 %y) {
+; CHECK: %z = unsigned signed mul i64 %x, %y
+ %z = unsigned signed mul i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @add_both_reversed(i64 %x, i64 %y) {
+; CHECK: %z = unsigned signed add i64 %x, %y
+ %z = signed unsigned add i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @sub_both_reversed(i64 %x, i64 %y) {
+; CHECK: %z = unsigned signed sub i64 %x, %y
+ %z = signed unsigned sub i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @mul_both_reversed(i64 %x, i64 %y) {
+; CHECK: %z = unsigned signed mul i64 %x, %y
+ %z = signed unsigned mul i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @sdiv_exact(i64 %x, i64 %y) {
+; CHECK: %z = exact sdiv i64 %x, %y
+ %z = exact sdiv i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @sdiv_plain(i64 %x, i64 %y) {
+; CHECK: %z = sdiv i64 %x, %y
+ %z = sdiv i64 %x, %y
+ ret i64 %z
+}
+
+define i64 @add_both_ce() {
+; CHECK: ret i64 unsigned signed add (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 signed unsigned add (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @sub_both_ce() {
+; CHECK: ret i64 unsigned signed sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 signed unsigned sub (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @mul_both_ce() {
+; CHECK: ret i64 unsigned signed mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 unsigned signed mul (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
+
+define i64 @sdiv_exact_ce() {
+; CHECK: ret i64 exact sdiv (i64 ptrtoint (i64* @addr to i64), i64 91)
+ ret i64 exact sdiv (i64 ptrtoint (i64* @addr to i64), i64 91)
+}
From mai4 at uiuc.edu Mon Jul 20 16:24:10 2009
From: mai4 at uiuc.edu (Haohui Mai)
Date: Mon, 20 Jul 2009 21:24:10 -0000
Subject: [llvm-commits] [poolalloc] r76477 -
/poolalloc/trunk/lib/DSA/Steensgaard.cpp
Message-ID: <200907202124.n6KLOAhA014130@zion.cs.uiuc.edu>
Author: mai4
Date: Mon Jul 20 16:24:09 2009
New Revision: 76477
URL: http://llvm.org/viewvc/llvm-project?rev=76477&view=rev
Log:
Merge globals into the result graph at the final stage of steensgaard DSA, just like what BU does.
Modified:
poolalloc/trunk/lib/DSA/Steensgaard.cpp
Modified: poolalloc/trunk/lib/DSA/Steensgaard.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Steensgaard.cpp?rev=76477&r1=76476&r2=76477&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Steensgaard.cpp (original)
+++ poolalloc/trunk/lib/DSA/Steensgaard.cpp Mon Jul 20 16:24:09 2009
@@ -62,9 +62,9 @@
GlobalsGraph = new DSGraph(GG, GG->getGlobalECs());
// Create a new, empty, graph...
- ResultGraph = new DSGraph(GlobalECs, getTargetData());
+ ResultGraph = new DSGraph(GG->getGlobalECs(), getTargetData());
ResultGraph->setGlobalsGraph(GlobalsGraph);
-// ResultGraph->spliceFrom(DS->getGlobalsGraph());
+ // ResultGraph->spliceFrom(DS->getGlobalsGraph());
// Loop over the rest of the module, merging graphs for non-external functions
@@ -134,7 +134,25 @@
// Remove any nodes that are dead after all of the merging we have done...
- ResultGraph->removeDeadNodes(DSGraph::RemoveUnreachableGlobals);
+ ResultGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
+
+ GlobalsGraph->removeTriviallyDeadNodes(true);
+ GlobalsGraph->maskIncompleteMarkers();
+
+ // Mark external globals incomplete.
+ GlobalsGraph->markIncompleteNodes(DSGraph::IgnoreGlobals);
+
+ formGlobalECs();
+
+ // Clone the global nodes into this graph.
+ ReachabilityCloner RC(ResultGraph, GlobalsGraph,
+ DSGraph::DontCloneCallNodes |
+ DSGraph::DontCloneAuxCallNodes);
+ for (DSScalarMap::global_iterator I = GlobalsGraph->getScalarMap().global_begin(),
+ E = GlobalsGraph->getScalarMap().global_end(); I != E; ++I)
+ if (isa(*I))
+ RC.getClonedNH(GlobalsGraph->getNodeForValue(*I));
+
print(DOUT, &M);
return false;
From rnk at mit.edu Mon Jul 20 16:26:31 2009
From: rnk at mit.edu (Reid Kleckner)
Date: Mon, 20 Jul 2009 14:26:31 -0700
Subject: [llvm-commits] Changes to BumpPtrAllocator so it can be used for
JITed function stubs and globals
Message-ID: <9a9942200907201426m3ca80fe0n86cd5b03ff0041a5@mail.gmail.com>
This parameterizes the BumpPtrAllocator over a slab allocation
strategy. It defaults to using malloc, and there should be no
functional changes to other code. It passes make check. These
changes are needed so I don't have to write a second bump allocator in
the JIT memory manager, which can't use malloc since the memory must
be marked executable. Please review!
Thanks,
Reid
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Allocator.diff
Type: text/x-diff
Size: 12174 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090720/edcaf89f/attachment.bin
From isanbard at gmail.com Mon Jul 20 16:30:28 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 21:30:28 -0000
Subject: [llvm-commits] [llvm] r76479 - in /llvm/trunk/lib:
CodeGen/AsmPrinter/AsmPrinter.cpp Target/MSP430/MSP430AsmPrinter.cpp
Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
Message-ID: <200907202130.n6KLUS2c014383@zion.cs.uiuc.edu>
Author: void
Date: Mon Jul 20 16:30:28 2009
New Revision: 76479
URL: http://llvm.org/viewvc/llvm-project?rev=76479&view=rev
Log:
Pass in the unfortunately named "LessPrivatePrefix" for the
"LinkerPrivatePrefix". It seems to have been used in only one place before I
started this "linker_private" business. I'm thinking that a rename is in
order...
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp
llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=76479&r1=76478&r2=76479&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Jul 20 16:30:28 2009
@@ -154,7 +154,8 @@
}
bool AsmPrinter::doInitialization(Module &M) {
- Mang = new Mangler(M, TAI->getGlobalPrefix(), TAI->getPrivateGlobalPrefix());
+ Mang = new Mangler(M, TAI->getGlobalPrefix(), TAI->getPrivateGlobalPrefix(),
+ TAI->getLessPrivateGlobalPrefix());
if (TAI->doesAllowQuotesInName())
Mang->setUseQuotes(true);
Modified: llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp?rev=76479&r1=76478&r2=76479&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp Mon Jul 20 16:30:28 2009
@@ -82,7 +82,8 @@
}
bool MSP430AsmPrinter::doInitialization(Module &M) {
- Mang = new Mangler(M, "", TAI->getPrivateGlobalPrefix());
+ Mang = new Mangler(M, "", TAI->getPrivateGlobalPrefix(),
+ TAI->getLessPrivateGlobalPrefix());
return false; // success
}
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=76479&r1=76478&r2=76479&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Mon Jul 20 16:30:28 2009
@@ -451,7 +451,8 @@
bool MipsAsmPrinter::
doInitialization(Module &M)
{
- Mang = new Mangler(M, "", TAI->getPrivateGlobalPrefix());
+ Mang = new Mangler(M, "", TAI->getPrivateGlobalPrefix(),
+ TAI->getLessPrivateGlobalPrefix());
// Tell the assembler which ABI we are using
O << "\t.section .mdebug." << emitCurrentABIString() << '\n';
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=76479&r1=76478&r2=76479&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Mon Jul 20 16:30:28 2009
@@ -223,7 +223,8 @@
}
bool SparcAsmPrinter::doInitialization(Module &M) {
- Mang = new Mangler(M, "", TAI->getPrivateGlobalPrefix());
+ Mang = new Mangler(M, "", TAI->getPrivateGlobalPrefix(),
+ TAI->getLessPrivateGlobalPrefix());
return false; // success
}
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=76479&r1=76478&r2=76479&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp Mon Jul 20 16:30:28 2009
@@ -92,7 +92,8 @@
}
bool SystemZAsmPrinter::doInitialization(Module &M) {
- Mang = new Mangler(M, "", TAI->getPrivateGlobalPrefix());
+ Mang = new Mangler(M, "", TAI->getPrivateGlobalPrefix(),
+ TAI->getLessPrivateGlobalPrefix());
return false; // success
}
From isanbard at gmail.com Mon Jul 20 16:38:26 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Jul 2009 21:38:26 -0000
Subject: [llvm-commits] [llvm] r76480 - in /llvm/trunk/lib:
CodeGen/MachOWriter.cpp Target/DarwinTargetAsmInfo.cpp
Message-ID: <200907202138.n6KLcQrQ014616@zion.cs.uiuc.edu>
Author: void
Date: Mon Jul 20 16:38:26 2009
New Revision: 76480
URL: http://llvm.org/viewvc/llvm-project?rev=76480&view=rev
Log:
Simplify the code in DarwinTargetAsmInfo::emitUsedDirectiveFor so that humans can understand it.
Modified:
llvm/trunk/lib/CodeGen/MachOWriter.cpp
llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
Modified: llvm/trunk/lib/CodeGen/MachOWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.cpp?rev=76480&r1=76479&r2=76480&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachOWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachOWriter.cpp Mon Jul 20 16:38:26 2009
@@ -774,4 +774,3 @@
}
} // end namespace llvm
-
Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=76480&r1=76479&r2=76480&view=diff
==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Jul 20 16:38:26 2009
@@ -107,23 +107,23 @@
/// emitUsedDirectiveFor - On Darwin, internally linked data beginning with
/// the PrivateGlobalPrefix or the LessPrivateGlobalPrefix does not have the
/// directive emitted (this occurs in ObjC metadata).
-bool
-DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV,
- Mangler *Mang) const {
- if (GV==0)
- return false;
+bool DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV,
+ Mangler *Mang) const {
+ if (!GV) return false;
- /// FIXME: WHAT IS THIS?
-
- if (GV->hasLocalLinkage() && !isa(GV) &&
- ((strlen(getPrivateGlobalPrefix()) != 0 &&
- Mang->getMangledName(GV).substr(0,strlen(getPrivateGlobalPrefix())) ==
- getPrivateGlobalPrefix()) ||
- (strlen(getLessPrivateGlobalPrefix()) != 0 &&
- Mang->getMangledName(GV).substr(0,
- strlen(getLessPrivateGlobalPrefix())) ==
- getLessPrivateGlobalPrefix())))
- return false;
+ // Check whether the mangled name has the "Private" or "LessPrivate" prefix.
+ if (GV->hasLocalLinkage() && !isa(GV)) {
+ const std::string &Name = Mang->getMangledName(GV);
+ const char *PGPrefix = getPrivateGlobalPrefix();
+ const char *LPGPrefix = getLessPrivateGlobalPrefix();
+ unsigned PGPLen = strlen(PGPrefix);
+ unsigned LPGPLen = strlen(LPGPrefix);
+
+ if ((PGPLen != 0 && Name.substr(0, PGPLen) == PGPrefix) ||
+ (LPGPLen != 0 && Name.substr(0, LPGPLen) == LPGPrefix))
+ return false;
+ }
+
return true;
}
From criswell at uiuc.edu Mon Jul 20 16:42:26 2009
From: criswell at uiuc.edu (John Criswell)
Date: Mon, 20 Jul 2009 21:42:26 -0000
Subject: [llvm-commits] [poolalloc] r76482 - in
/poolalloc/trunk/lib/PoolAllocate: PAMultipleGlobalPool.cpp PASimple.cpp
PoolAllocate.cpp
Message-ID: <200907202142.n6KLgSCa014768@zion.cs.uiuc.edu>
Author: criswell
Date: Mon Jul 20 16:42:23 2009
New Revision: 76482
URL: http://llvm.org/viewvc/llvm-project?rev=76482&view=rev
Log:
The Context field of the Pass class isn't being initialized correctly.
Initialize it explicitly via the global context.
Modified:
poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
Modified: poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp?rev=76482&r1=76481&r2=76482&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp Mon Jul 20 16:42:23 2009
@@ -81,6 +81,12 @@
bool PoolAllocateMultipleGlobalPool::runOnModule(Module &M) {
currentModule = &M;
if (M.begin() == M.end()) return false;
+
+ //
+ // Get the context from the global context.
+ //
+ Context = &getGlobalContext();
+
Graphs = &getAnalysis();
assert (Graphs && "No DSA pass available!\n");
Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=76482&r1=76481&r2=76482&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Mon Jul 20 16:42:23 2009
@@ -104,6 +104,11 @@
bool PoolAllocateSimple::runOnModule(Module &M) {
if (M.begin() == M.end()) return false;
+ //
+ // Get the context from the global context.
+ //
+ Context = &getGlobalContext();
+
// Get the Target Data information and the Graphs
if (CompleteDSA) {
Graphs = &getAnalysis();
Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=76482&r1=76481&r2=76482&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Mon Jul 20 16:42:23 2009
@@ -111,6 +111,11 @@
CurModule = &M;
//
+ // Get the context from the global context.
+ //
+ Context = &getGlobalContext();
+
+ //
// Get references to the DSA information. For SAFECode, we need Top-Down
// DSA. For Automatic Pool Allocation only, we need Bottom-Up DSA. In all
// cases, we need to use the Equivalence-Class version of DSA.
From evan.cheng at apple.com Mon Jul 20 16:43:16 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Jul 2009 14:43:16 -0700
Subject: [llvm-commits] [unladen-swallow] Re: Patch to allow the
JITMemoryManager to allocate more blocks of memory
In-Reply-To: <9a9942200907171125x50c2d277w6a330ee7bccf3566@mail.gmail.com>
References: <9a9942200906231656r3fd098c6r9e3e53dffe7cf790@mail.gmail.com>
<9a9942200906231659x2b73f65ap51207eb5eef56129@mail.gmail.com>
<9a9942200906231705m4ec42d3drabd014f740867f28@mail.gmail.com>
<718901DE-2AFB-4323-8204-4674B5F46B62@apple.com>
<9a9942200907131657t37928039s53b674b52b62f191@mail.gmail.com>
<2E6DAD9B-FED4-4A40-81ED-A2C81B4BDEF9@apple.com>
<9a9942200907141139u2964c566r3e8e020968f74f49@mail.gmail.com>
<9a9942200907171125x50c2d277w6a330ee7bccf3566@mail.gmail.com>
Message-ID: <7BCCBD81-CCEC-4D62-864C-1FDA47225020@apple.com>
On Jul 17, 2009, at 11:25 AM, Reid Kleckner wrote:
> Here is the updated patch. I will commit the changes to
> Support/Allocator.(h|cpp) as a separate patch, but I assume you'll
> want to review all the changes here. It passes make check, modulo 7
> failures that look related to my old version of llvm-gcc.
Looks good to me. I'll let someone else review the Allocator changes.
Thanks,
Evan
>
> Reid
>
> On Wed, Jul 15, 2009 at 10:41 PM, Evan Cheng
> wrote:
>>
>>
>> On Jul 14, 2009, at 11:39 AM, Reid Kleckner wrote:
>>
>>> On Mon, Jul 13, 2009 at 10:37 PM, Evan Cheng
>>> wrote:
>>>>
>>>> Hi Reid,
>>>>
>>>> Thanks. A couple of comments.
>>>>
>>>> Can you change CheckInvariants() to return true / false and the
>>>> error
>>>> message by reference instead?
>>>
>>> Sure. That's nice because it makes the ostream deconstructor will
>>> automatically flush things, whereas it didn't before.
>>>
>>>> + /// BumpAllocator - This is a simple memory allocator that
>>>> simply
>>>> bumps a
>>>> + /// pointer forwards across a slab of memory until it runs
>>>> out, at
>>>> which
>>>> + /// point it allocates a new slab. If the size of an
>>>> allocation is
>>>> above
>>>> a
>>>> + /// certain threshold, the allocator allocates a separate slab
>>>> for it,
>>>> to
>>>> + /// avoid wasted space. We use this class to allocate
>>>> function stubs
>>>> and
>>>> + /// global data structures.
>>>> + class BumpAllocator {
>>>>
>>>> Is there a reason not to use the BumpPtrAllocator in Support/
>>>> Allocator.h?
>>>
>>> That allocator uses malloc. One of the things I was trying to do is
>>> get all the code and globals laid out contiguously in memory by
>>> using
>>> the NearBlock parameter of sys::Memory::AllocateRWX. That isn't
>>> particularly reliable, and it's not even supported on Windows. It
>>> would still be nice to get all slab allocation centralized through
>>> the
>>> memory manager instead of through malloc, though.
>>>
>>> I could parameterize the allocator in Support to use either malloc
>>> or
>>> the JITMemoryManager, or I could just use mine or the one in Support
>>> wholesale. Which would you prefer?
>>
>> How about changing the allocator in Support to use AllocateRWX? On
>> Windows,
>> can it fallback to malloc?
>>
>> Evan
>>>
>>>> + for (MemoryRangeHeader *Hdr = (MemoryRangeHeader*)Start,
>>>> *LastHdr =
>>>> NULL;
>>>> + Start <= (char*)Hdr && (char*)Hdr < End;
>>>> + Hdr = &Hdr->getBlockAfter()) {
>>>> + if (Hdr->ThisAllocated == 0) {
>>>>
>>>> How about "if (!Hdr->ThisAllocated) continue;" to reduce
>>>> indentation.
>>>> Thanks,
>>>
>>> That can't be done, since the 'if' doesn't cover the entire body of
>>> the for loop. I did notice that the 'else if' clause will never
>>> execute because ThisAllocated is a one bit field, so I dropped that.
>>>
>>> Thanks for the review,
>>> Reid
>>> <
>>> JITMemoryManager.diff
>>> >_______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From evan.cheng at apple.com Mon Jul 20 16:43:57 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Jul 2009 14:43:57 -0700
Subject: [llvm-commits] [PATCH] Call MCE.processDebugLoc from the
remaining Targets' emitters
In-Reply-To: <0016e64642628b3689046eda1969@google.com>
References: <0016e64642628b3689046eda1969@google.com>
Message-ID: <905F33A6-07CF-413E-94CD-FD4D27C6B9BD@apple.com>
Looks good.
Evan
On Jul 16, 2009, at 3:21 PM, jyasskin at gmail.com wrote:
> Reviewers: ,
>
> Description:
> r76102 added the MachineCodeEmitter::processDebugLoc call and called
> it
> from the X86 Emitter. This patch extends that to the ARM, Alpha, and
> PPC emitters, which I think is all of the targets that can write to a
> MachineCodeEmitter.
>
> Please review this at http://codereview.appspot.com/95062
>
> Affected files:
> M lib/Target/ARM/ARMCodeEmitter.cpp
> M lib/Target/Alpha/AlphaCodeEmitter.cpp
> M lib/Target/PowerPC/PPCCodeEmitter.cpp
>
>
> Index: lib/Target/PowerPC/PPCCodeEmitter.cpp
> ===================================================================
> --- lib/Target/PowerPC/PPCCodeEmitter.cpp (revision 76100)
> +++ lib/Target/PowerPC/PPCCodeEmitter.cpp (working copy)
> @@ -133,6 +133,7 @@
>
> for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
> I != E;
> ++I){
> const MachineInstr &MI = *I;
> + MCE.processDebugLoc(MI.getDebugLoc());
> switch (MI.getOpcode()) {
> default:
> MCE.emitWordBE(getBinaryCodeForInstr(MI));
> @@ -275,4 +276,3 @@
> }
>
> #include "PPCGenCodeEmitter.inc"
> -
> Index: lib/Target/ARM/ARMCodeEmitter.cpp
> ===================================================================
> --- lib/Target/ARM/ARMCodeEmitter.cpp (revision 76100)
> +++ lib/Target/ARM/ARMCodeEmitter.cpp (working copy)
> @@ -337,6 +337,8 @@
> void Emitter::emitInstruction(const MachineInstr &MI) {
> DOUT << "JIT: " << (void*)MCE.getCurrentPCValue() << ":\t" << MI;
>
> + MCE.processDebugLoc(MI.getDebugLoc());
> +
> NumEmitted++; // Keep track of the # of mi's emitted
> switch (MI.getDesc().TSFlags & ARMII::FormMask) {
> default: {
> @@ -1422,4 +1424,3 @@
> }
>
> #include "ARMGenCodeEmitter.inc"
> -
> Index: lib/Target/Alpha/AlphaCodeEmitter.cpp
> ===================================================================
> --- lib/Target/Alpha/AlphaCodeEmitter.cpp (revision 76100)
> +++ lib/Target/Alpha/AlphaCodeEmitter.cpp (working copy)
> @@ -72,8 +72,6 @@
> return "Alpha Machine Code Emitter";
> }
>
> - void emitInstruction(const MachineInstr &MI);
> -
> private:
> void emitBasicBlock(MachineBasicBlock &MBB);
> };
> @@ -118,6 +116,7 @@
> for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
> I != E; ++I) {
> const MachineInstr &MI = *I;
> + MCE.processDebugLoc(MI.getDebugLoc());
> switch(MI.getOpcode()) {
> default:
> MCE.emitWordLE(getBinaryCodeForInstr(*I));
> @@ -245,5 +244,3 @@
> }
>
> #include "AlphaGenCodeEmitter.inc"
> -
> -
>
>
> _______________________________________________
> 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 Mon Jul 20 16:46:42 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Jul 2009 21:46:42 -0000
Subject: [llvm-commits] [llvm] r76485 -
/llvm/trunk/test/CodeGen/ARM/2009-07-18-RewriterBug.ll
Message-ID: <200907202146.n6KLkho2015172@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Jul 20 16:46:42 2009
New Revision: 76485
URL: http://llvm.org/viewvc/llvm-project?rev=76485&view=rev
Log:
Forgot this test earlier.
Added:
llvm/trunk/test/CodeGen/ARM/2009-07-18-RewriterBug.ll
Added: llvm/trunk/test/CodeGen/ARM/2009-07-18-RewriterBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-07-18-RewriterBug.ll?rev=76485&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2009-07-18-RewriterBug.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/2009-07-18-RewriterBug.ll Mon Jul 20 16:46:42 2009
@@ -0,0 +1,1323 @@
+; RUN: llvm-as < %s | llc -mtriple=armv6-apple-darwin10 -mattr=+vfp2 | grep fcmpezd | count 13
+
+ %struct.EDGE_PAIR = type { %struct.edge_rec*, %struct.edge_rec* }
+ %struct.VEC2 = type { double, double, double }
+ %struct.VERTEX = type { %struct.VEC2, %struct.VERTEX*, %struct.VERTEX* }
+ %struct.edge_rec = type { %struct.VERTEX*, %struct.edge_rec*, i32, i8* }
+ at avail_edge = internal global %struct.edge_rec* null ; <%struct.edge_rec**> [#uses=6]
+ at _2E_str7 = internal constant [21 x i8] c"ERROR: Only 1 point!\00", section "__TEXT,__cstring,cstring_literals", align 1 ; <[21 x i8]*> [#uses=1]
+ at llvm.used = appending global [1 x i8*] [i8* bitcast (void (%struct.EDGE_PAIR*, %struct.VERTEX*, %struct.VERTEX*)* @build_delaunay to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
+
+define arm_apcscc void @build_delaunay(%struct.EDGE_PAIR* noalias nocapture sret %agg.result, %struct.VERTEX* %tree, %struct.VERTEX* %extra) nounwind {
+entry:
+ %delright = alloca %struct.EDGE_PAIR, align 8 ; <%struct.EDGE_PAIR*> [#uses=3]
+ %delleft = alloca %struct.EDGE_PAIR, align 8 ; <%struct.EDGE_PAIR*> [#uses=3]
+ %0 = icmp eq %struct.VERTEX* %tree, null ; [#uses=1]
+ br i1 %0, label %bb8, label %bb
+
+bb: ; preds = %entry
+ %1 = getelementptr %struct.VERTEX* %tree, i32 0, i32 2 ; <%struct.VERTEX**> [#uses=1]
+ %2 = load %struct.VERTEX** %1, align 4 ; <%struct.VERTEX*> [#uses=2]
+ %3 = icmp eq %struct.VERTEX* %2, null ; [#uses=1]
+ br i1 %3, label %bb7, label %bb1.i
+
+bb1.i: ; preds = %bb1.i, %bb
+ %tree_addr.0.i = phi %struct.VERTEX* [ %5, %bb1.i ], [ %tree, %bb ] ; <%struct.VERTEX*> [#uses=3]
+ %4 = getelementptr %struct.VERTEX* %tree_addr.0.i, i32 0, i32 1 ; <%struct.VERTEX**> [#uses=1]
+ %5 = load %struct.VERTEX** %4, align 4 ; <%struct.VERTEX*> [#uses=2]
+ %6 = icmp eq %struct.VERTEX* %5, null ; [#uses=1]
+ br i1 %6, label %get_low.exit, label %bb1.i
+
+get_low.exit: ; preds = %bb1.i
+ call arm_apcscc void @build_delaunay(%struct.EDGE_PAIR* noalias sret %delright, %struct.VERTEX* %2, %struct.VERTEX* %extra) nounwind
+ %7 = getelementptr %struct.VERTEX* %tree, i32 0, i32 1 ; <%struct.VERTEX**> [#uses=1]
+ %8 = load %struct.VERTEX** %7, align 4 ; <%struct.VERTEX*> [#uses=1]
+ call arm_apcscc void @build_delaunay(%struct.EDGE_PAIR* noalias sret %delleft, %struct.VERTEX* %8, %struct.VERTEX* %tree) nounwind
+ %9 = getelementptr %struct.EDGE_PAIR* %delleft, i32 0, i32 0 ; <%struct.edge_rec**> [#uses=1]
+ %10 = load %struct.edge_rec** %9, align 8 ; <%struct.edge_rec*> [#uses=2]
+ %11 = getelementptr %struct.EDGE_PAIR* %delleft, i32 0, i32 1 ; <%struct.edge_rec**> [#uses=1]
+ %12 = load %struct.edge_rec** %11, align 4 ; <%struct.edge_rec*> [#uses=1]
+ %13 = getelementptr %struct.EDGE_PAIR* %delright, i32 0, i32 0 ; <%struct.edge_rec**> [#uses=1]
+ %14 = load %struct.edge_rec** %13, align 8 ; <%struct.edge_rec*> [#uses=1]
+ %15 = getelementptr %struct.EDGE_PAIR* %delright, i32 0, i32 1 ; <%struct.edge_rec**> [#uses=1]
+ %16 = load %struct.edge_rec** %15, align 4 ; <%struct.edge_rec*> [#uses=2]
+ br label %bb.i
+
+bb.i: ; preds = %bb4.i, %get_low.exit
+ %rdi_addr.0.i = phi %struct.edge_rec* [ %14, %get_low.exit ], [ %72, %bb4.i ] ; <%struct.edge_rec*> [#uses=2]
+ %ldi_addr.1.i = phi %struct.edge_rec* [ %12, %get_low.exit ], [ %ldi_addr.0.i, %bb4.i ] ; <%struct.edge_rec*> [#uses=3]
+ %17 = getelementptr %struct.edge_rec* %rdi_addr.0.i, i32 0, i32 0 ; <%struct.VERTEX**> [#uses=1]
+ %18 = load %struct.VERTEX** %17, align 4 ; <%struct.VERTEX*> [#uses=3]
+ %19 = ptrtoint %struct.edge_rec* %ldi_addr.1.i to i32 ; [#uses=1]
+ %20 = getelementptr %struct.VERTEX* %18, i32 0, i32 0, i32 0 ; [#uses=1]
+ %21 = load double* %20, align 4 ; [#uses=3]
+ %22 = getelementptr %struct.VERTEX* %18, i32 0, i32 0, i32 1 ; [#uses=1]
+ %23 = load double* %22, align 4 ; [#uses=3]
+ br label %bb2.i
+
+bb1.i1: ; preds = %bb2.i
+ %24 = ptrtoint %struct.edge_rec* %ldi_addr.0.i to i32 ; [#uses=2]
+ %25 = add i32 %24, 48 ; [#uses=1]
+ %26 = and i32 %25, 63 ; [#uses=1]
+ %27 = and i32 %24, -64 ; [#uses=1]
+ %28 = or i32 %26, %27 ; [#uses=1]
+ %29 = inttoptr i32 %28 to %struct.edge_rec* ; <%struct.edge_rec*> [#uses=1]
+ %30 = getelementptr %struct.edge_rec* %29, i32 0, i32 1 ; <%struct.edge_rec**> [#uses=1]
+ %31 = load %struct.edge_rec** %30, align 4 ; <%struct.edge_rec*> [#uses=1]
+ %32 = ptrtoint %struct.edge_rec* %31 to i32 ; [#uses=2]
+ %33 = add i32 %32, 16 ; [#uses=1]
+ %34 = and i32 %33, 63 ; [#uses=1]
+ %35 = and i32 %32, -64 ; [#uses=1]
+ %36 = or i32 %34, %35 ; [#uses=2]
+ %37 = inttoptr i32 %36 to %struct.edge_rec* ; <%struct.edge_rec*> [#uses=2]
+ br label %bb2.i
+
+bb2.i: ; preds = %bb1.i1, %bb.i
+ %ldi_addr.1.pn.i = phi %struct.edge_rec* [ %ldi_addr.1.i, %bb.i ], [ %37, %bb1.i1 ] ; <%struct.edge_rec*> [#uses=1]
+ %.pn6.in.in.i = phi i32 [ %19, %bb.i ], [ %36, %bb1.i1 ] ; [#uses=1]
+ %ldi_addr.0.i = phi %struct.edge_rec* [ %ldi_addr.1.i, %bb.i ], [ %37, %bb1.i1 ] ; <%struct.edge_rec*> [#uses=4]
+ %.pn6.in.i = xor i32 %.pn6.in.in.i, 32 ; [#uses=1]
+ %.pn6.i = inttoptr i32 %.pn6.in.i to %struct.edge_rec* ; <%struct.edge_rec*> [#uses=1]
+ %t1.0.in.i = getelementptr %struct.edge_rec* %ldi_addr.1.pn.i, i32 0, i32 0 ; <%struct.VERTEX**> [#uses=1]
+ %t2.0.in.i = getelementptr %struct.edge_rec* %.pn6.i, i32 0, i32 0 ; <%struct.VERTEX**> [#uses=1]
+ %t1.0.i = load %struct.VERTEX** %t1.0.in.i ; <%struct.VERTEX*> [#uses=2]
+ %t2.0.i = load %struct.VERTEX** %t2.0.in.i ; <%struct.VERTEX*> [#uses=2]
+ %38 = getelementptr %struct.VERTEX* %t1.0.i, i32 0, i32 0, i32 0 ; [#uses=1]
+ %39 = load double* %38, align 4 ; [#uses=3]
+ %40 = getelementptr %struct.VERTEX* %t1.0.i, i32 0, i32 0, i32 1 ; [#uses=1]
+ %41 = load double* %40, align 4 ; [#uses=3]
+ %42 = getelementptr %struct.VERTEX* %t2.0.i, i32 0, i32 0, i32 0 ; [#uses=1]
+ %43 = load double* %42, align 4 ; [#uses=1]
+ %44 = getelementptr %struct.VERTEX* %t2.0.i, i32 0, i32 0, i32 1 ; [#uses=1]
+ %45 = load double* %44, align 4 ; [#uses=1]
+ %46 = fsub double %39, %21 ; [#uses=1]
+ %47 = fsub double %45, %23 ; [#uses=1]
+ %48 = fmul double %46, %47 ; [#uses=1]
+ %49 = fsub double %43, %21 ; [#uses=1]
+ %50 = fsub double %41, %23 ; [#uses=1]
+ %51 = fmul double %49, %50 ; [#uses=1]
+ %52 = fsub double %48, %51 ; [#uses=1]
+ %53 = fcmp ogt double %52, 0.000000e+00 ; [#uses=1]
+ br i1 %53, label %bb1.i1, label %bb3.i
+
+bb3.i: ; preds = %bb2.i
+ %54 = ptrtoint %struct.edge_rec* %rdi_addr.0.i to i32 ; [#uses=1]
+ %55 = xor i32 %54, 32 ; [#uses=3]
+ %56 = inttoptr i32 %55 to %struct.edge_rec* ; <%struct.edge_rec*> [#uses=2]
+ %57 = getelementptr %struct.edge_rec* %56, i32 0, i32 0 ; <%struct.VERTEX**> [#uses=1]
+ %58 = load %struct.VERTEX** %57, align 4 ; <%struct.VERTEX*> [#uses=2]
+ %59 = getelementptr %struct.VERTEX* %58, i32 0, i32 0, i32 0 ; [#uses=1]
+ %60 = load double* %59, align 4 ; [#uses=1]
+ %61 = getelementptr %struct.VERTEX* %58, i32 0, i32 0, i32 1 ; [#uses=1]
+ %62 = load double* %61, align 4 ; [#uses=1]
+ %63 = fsub double %60, %39 ; [#uses=1]
+ %64 = fsub double %23, %41 ; [#uses=1]
+ %65 = fmul double %63, %64 ; [#uses=1]
+ %66 = fsub double %21, %39 ;