From baldrick at free.fr Mon Oct 1 02:47:21 2007
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 1 Oct 2007 09:47:21 +0200
Subject: [llvm-commits] Size of long double (X86_FP80Ty)
In-Reply-To: <3AF2C9B1-D9B0-4CCD-B60F-5A1BB7E91E8A@apple.com>
References: <200709282204.17074.baldrick@free.fr>
<3AF2C9B1-D9B0-4CCD-B60F-5A1BB7E91E8A@apple.com>
Message-ID: <200710010947.21712.baldrick@free.fr>
> By the way, to be consistent, getTypeSize for an APInt
> should return the number of bits rounded up to a multiple
> of 8, rather than rounded up to a power of 2 as it is now.
> Shall I make this change?
Due to the way ExpandOp works for loads and stores, it looks
like the size needs to be the smallest power of 2 bigger than
or equal to the bitwidth. For example, consider i36 on a 32
bit machine. The type to expand to is i32, and a store gets
expanded into two i32 stores, i.e. 64 bits. This suggests
that the size needs to be at least 8 bytes, since otherwise
you may write outside the allocated memory.
Note that this applies regardless of alignment (I say this
because getTypeSize seems to round the size of APInt's up
to the next multiple of the alignment). For example, consider
i128. This first gets expanded to i64, result on two 64 bit
writes, then i64 to i32, resulting in four 32 bit writes. In
any case, you write 128 bits so the size should presumably be
16 bytes, and alignment didn't come into this anywhere...
Am I wrong?
Thanks,
Duncan.
PS: Is it the same for floating point types? Can a 128 bit
fp type be expanded into two 64 bit fp types?
From neil at daikokuya.co.uk Mon Oct 1 08:07:48 2007
From: neil at daikokuya.co.uk (Neil Booth)
Date: Mon, 1 Oct 2007 22:07:48 +0900
Subject: [llvm-commits] [llvm] r42484 - in /llvm/trunk/lib:
CodeGen/SelectionDAG/LegalizeDAG.cpp
CodeGen/SelectionDAG/SelectionDAG.cpp
ExecutionEngine/ExecutionEngine.cpp VMCore/ConstantFold.cpp
In-Reply-To: <200709301819.l8UIJ3wE003992@zion.cs.uiuc.edu>
References: <200709301819.l8UIJ3wE003992@zion.cs.uiuc.edu>
Message-ID: <20071001130748.GN19035@daikokuya.co.uk>
Dale Johannesen wrote:-
> Author: johannes
> Date: Sun Sep 30 13:19:03 2007
> New Revision: 42484
>
> URL: http://llvm.org/viewvc/llvm-project?rev=42484&view=rev
> Log:
> Constant fold int-to-long-double conversions;
> use APFloat for int-to-float/double; use
> round-to-nearest for these (implementation-defined,
> seems to match gcc).
Seems sensible. Ultimately FENV_ACCESS pragma should be taken into
account, for C at least.
Neil.
From djg at cray.com Mon Oct 1 11:01:24 2007
From: djg at cray.com (Dan Gohman)
Date: Mon, 01 Oct 2007 16:01:24 -0000
Subject: [llvm-commits] [llvm] r42487 - in /llvm/trunk/include/llvm:
Analysis/CallGraph.h Analysis/LoopInfo.h Support/CallSite.h
Message-ID: <200710011601.l91G1OQr011316@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 1 11:01:23 2007
New Revision: 42487
URL: http://llvm.org/viewvc/llvm-project?rev=42487&view=rev
Log:
Add empty() member functions to a few container-like classes.
Modified:
llvm/trunk/include/llvm/Analysis/CallGraph.h
llvm/trunk/include/llvm/Analysis/LoopInfo.h
llvm/trunk/include/llvm/Support/CallSite.h
Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=42487&r1=42486&r2=42487&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/CallGraph.h Mon Oct 1 11:01:23 2007
@@ -189,6 +189,7 @@
inline iterator end() { return CalledFunctions.end(); }
inline const_iterator begin() const { return CalledFunctions.begin(); }
inline const_iterator end() const { return CalledFunctions.end(); }
+ inline bool empty() const { return CalledFunctions.empty(); }
inline unsigned size() const { return CalledFunctions.size(); }
// Subscripting operator - Return the i'th called function...
Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=42487&r1=42486&r2=42487&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Mon Oct 1 11:01:23 2007
@@ -79,6 +79,7 @@
typedef std::vector::const_iterator iterator;
iterator begin() const { return SubLoops.begin(); }
iterator end() const { return SubLoops.end(); }
+ bool empty() const { return SubLoops.empty(); }
/// getBlocks - Get a list of the basic blocks which make up this loop.
///
Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=42487&r1=42486&r2=42487&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Mon Oct 1 11:01:23 2007
@@ -110,6 +110,7 @@
return I->op_begin()+3; // Skip Function, BB, BB
}
arg_iterator arg_end() const { return I->op_end(); }
+ bool arg_empty() const { return arg_end() == arg_begin(); }
unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); }
bool operator<(const CallSite &CS) const {
From dalej at apple.com Mon Oct 1 11:03:14 2007
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 01 Oct 2007 16:03:14 -0000
Subject: [llvm-commits] [llvm] r42488 - in /llvm/trunk:
include/llvm/Target/TargetData.h lib/Target/TargetData.cpp
Message-ID: <200710011603.l91G3EoQ011433@zion.cs.uiuc.edu>
Author: johannes
Date: Mon Oct 1 11:03:14 2007
New Revision: 42488
URL: http://llvm.org/viewvc/llvm-project?rev=42488&view=rev
Log:
Add getABITypeSize, getABITypeSizeInBits
Modified:
llvm/trunk/include/llvm/Target/TargetData.h
llvm/trunk/lib/Target/TargetData.cpp
Modified: llvm/trunk/include/llvm/Target/TargetData.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=42488&r1=42487&r2=42488&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetData.h (original)
+++ llvm/trunk/include/llvm/Target/TargetData.h Mon Oct 1 11:03:14 2007
@@ -159,10 +159,23 @@
/// type.
uint64_t getTypeSize(const Type *Ty) const;
+ /// getABITypeSize - Return the number of bytes allocated for the specified
+ /// type when used as an element in a larger object, including alignment
+ /// padding.
+ uint64_t getABITypeSize(const Type *Ty) const {
+ unsigned char Align = getABITypeAlignment(Ty);
+ return (getTypeSize(Ty) + Align - 1)/Align*Align;
+ }
+
/// getTypeSizeInBits - Return the number of bits necessary to hold the
/// specified type.
uint64_t getTypeSizeInBits(const Type* Ty) const;
+ /// getABITypeSizeInBits - Return the number of bytes allocated for the
+ /// specified type when used as an element in a larger object, including
+ /// alignment padding.
+ uint64_t getABITypeSizeInBits(const Type* Ty) const;
+
/// getABITypeAlignment - Return the minimum ABI-required alignment for the
/// specified type.
unsigned char getABITypeAlignment(const Type *Ty) const;
Modified: llvm/trunk/lib/Target/TargetData.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=42488&r1=42487&r2=42488&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetData.cpp (original)
+++ llvm/trunk/lib/Target/TargetData.cpp Mon Oct 1 11:03:14 2007
@@ -471,7 +471,12 @@
return getTypeSize(Ty) * 8;
}
-
+uint64_t TargetData::getABITypeSizeInBits(const Type *Ty) const {
+ if (Ty->isInteger())
+ return cast(Ty)->getBitWidth();
+ else
+ return getABITypeSize(Ty) * 8;
+}
/*!
\param abi_or_pref Flag that determines which alignment is returned. true
returns the ABI alignment, false returns the preferred alignment.
From dalej at apple.com Mon Oct 1 11:08:54 2007
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 1 Oct 2007 09:08:54 -0700
Subject: [llvm-commits] Size of long double (X86_FP80Ty)
In-Reply-To: <200709301023.44406.baldrick@free.fr>
References: <200709282204.17074.baldrick@free.fr>
<3AF2C9B1-D9B0-4CCD-B60F-5A1BB7E91E8A@apple.com>
<200709301023.44406.baldrick@free.fr>
Message-ID: <4753238B-3DAB-454B-BE0D-491C1E815E23@apple.com>
The attached patch, plus the bits I've checked in, seems to work.
There are no problems in the llvm testsuite but there's something
funny going on in the gcc testsuite, although I'm not convinced it's
the fault of this patch, so I'm not checking it in until I get that
figured out. You could see if it works for you.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ldarray.txt
Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071001/c7abc41d/attachment.txt
-------------- next part --------------
From evan.cheng at apple.com Mon Oct 1 13:12:49 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 01 Oct 2007 18:12:49 -0000
Subject: [llvm-commits] [llvm] r42492 -
/llvm/trunk/lib/Target/X86/X86InstrSSE.td
Message-ID: <200710011812.l91ICnk0017551@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 1 13:12:48 2007
New Revision: 42492
URL: http://llvm.org/viewvc/llvm-project?rev=42492&view=rev
Log:
Typo. X86comi doesn't read / write chain's.
Modified:
llvm/trunk/lib/Target/X86/X86InstrSSE.td
Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=42492&r1=42491&r2=42492&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Oct 1 13:12:48 2007
@@ -32,8 +32,7 @@
def X86frsqrt : SDNode<"X86ISD::FRSQRT", SDTFPUnaryOp>;
def X86frcp : SDNode<"X86ISD::FRCP", SDTFPUnaryOp>;
def X86fsrl : SDNode<"X86ISD::FSRL", SDTX86FPShiftOp>;
-def X86comi : SDNode<"X86ISD::COMI", SDTX86CmpTest,
- [SDNPHasChain]>;
+def X86comi : SDNode<"X86ISD::COMI", SDTX86CmpTest>;
def X86ucomi : SDNode<"X86ISD::UCOMI", SDTX86CmpTest>;
def X86s2vec : SDNode<"X86ISD::S2VEC", SDTypeProfile<1, 1, []>, []>;
def X86pextrw : SDNode<"X86ISD::PEXTRW", SDTypeProfile<1, 2, []>, []>;
From dpatel at apple.com Mon Oct 1 13:12:58 2007
From: dpatel at apple.com (Devang Patel)
Date: Mon, 01 Oct 2007 18:12:58 -0000
Subject: [llvm-commits] [llvm] r42493 - in /llvm/trunk:
lib/Transforms/Scalar/LICM.cpp
test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll
Message-ID: <200710011812.l91ICwiS017575@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Oct 1 13:12:58 2007
New Revision: 42493
URL: http://llvm.org/viewvc/llvm-project?rev=42493&view=rev
Log:
Relax unsafe use check. If there is one unconditional use inside the loop then it is safe to promote value even if there is another conditional use inside the loop.
Added:
llvm/trunk/test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=42493&r1=42492&r2=42493&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Mon Oct 1 13:12:58 2007
@@ -800,24 +800,15 @@
break;
}
- // Do not promote null values because it may be unsafe to do so.
- if (isa(V))
- PointerOk = false;
-
- if (GetElementPtrInst *GEP = dyn_cast(V)) {
- // If GEP base is NULL then the calculated address used by Store or
- // Load instruction is invalid. Do not promote this value because
- // it may expose load and store instruction that are covered by
- // condition which may not yet folded.
- if (isa(GEP->getOperand(0)))
- PointerOk = false;
- }
-
- // If value V use is not dominating loop exit then promoting
- // it may expose unsafe load and store instructions unconditinally.
- if (PointerOk)
+ // If one use of value V inside the loop is safe then it is OK to promote
+ // this value. On the otherside if there is not any unsafe use inside the
+ // looop then also it is OK to promote this value. Otherwise it is
+ // unsafe to promote this value.
+ if (PointerOk) {
+ bool oneSafeUse = false;
+ bool oneUnsafeUse = false;
for(Value::use_iterator UI = V->use_begin(), UE = V->use_end();
- UI != UE && PointerOk; ++UI) {
+ UI != UE; ++UI) {
Instruction *Use = dyn_cast(*UI);
if (!Use || !CurLoop->contains(Use->getParent()))
continue;
@@ -825,16 +816,25 @@
ExitI = LoopExits.begin(), ExitE = LoopExits.end();
ExitI != ExitE; ++ExitI) {
Instruction *Ex = *ExitI;
- if (!DT->dominates(Use, Ex)){
- PointerOk = false;
+ if (!isa(Use) && DT->dominates(Use, Ex)) {
+ oneSafeUse = true;
break;
}
+ else
+ oneUnsafeUse = true;
}
-
- if (!PointerOk)
+
+ if (oneSafeUse)
break;
}
-
+
+ if (oneSafeUse)
+ PointerOk = true;
+ else if (!oneUnsafeUse)
+ PointerOk = true;
+ else
+ PointerOk = false;
+ }
if (PointerOk) {
const Type *Ty = cast(V->getType())->getElementType();
Added: llvm/trunk/test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll?rev=42493&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll (added)
+++ llvm/trunk/test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll Mon Oct 1 13:12:58 2007
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -licm | llvm-dis | grep promoted
+; Promote value if at least one use is safe
+
+
+define i32 @f2(i32* %p, i8* %q) {
+entry:
+ br label %loop.head
+
+loop.head: ; preds = %cond.true, %entry
+ store i32 20, i32* %p
+ %tmp3.i = icmp eq i8* null, %q ; [#uses=1]
+ br i1 %tmp3.i, label %exit, label %cond.true
+
+cond.true: ; preds = %loop.head
+ store i32 40, i32* %p
+ br label %loop.head
+
+exit: ; preds = %loop.head
+ ret i32 0
+}
+
From clattner at apple.com Mon Oct 1 13:38:39 2007
From: clattner at apple.com (Chris Lattner)
Date: Mon, 1 Oct 2007 11:38:39 -0700
Subject: [llvm-commits] [llvm] r42484 - in /llvm/trunk/lib:
CodeGen/SelectionDAG/LegalizeDAG.cpp CodeGen/SelectionDAG/SelectionDAG.cpp
ExecutionEngine/ExecutionEngine.cpp VMCore/ConstantFold.cpp
In-Reply-To: <20071001130748.GN19035@daikokuya.co.uk>
References: <200709301819.l8UIJ3wE003992@zion.cs.uiuc.edu>
<20071001130748.GN19035@daikokuya.co.uk>
Message-ID:
On Oct 1, 2007, at 6:07 AM, Neil Booth wrote:
>> Author: johannes
>> Date: Sun Sep 30 13:19:03 2007
>> New Revision: 42484
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=42484&view=rev
>> Log:
>> Constant fold int-to-long-double conversions;
>> use APFloat for int-to-float/double; use
>> round-to-nearest for these (implementation-defined,
>> seems to match gcc).
>
> Seems sensible. Ultimately FENV_ACCESS pragma should be taken into
> account, for C at least.
Unfortunately, LLVM doesn't propagate this down into the optimizers
(yet).
-Chris
From sabre at nondot.org Mon Oct 1 14:22:35 2007
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 1 Oct 2007 14:22:35 -0500
Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi
Message-ID: <200710011922.l91JMZhf020616@zion.cs.uiuc.edu>
Changes in directory llvm-www/demo:
index.cgi updated: 1.75 -> 1.76
---
Log message:
only log and mail if the code is not the default code.
---
Diffs of the changes: (+17 -11)
index.cgi | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
Index: llvm-www/demo/index.cgi
diff -u llvm-www/demo/index.cgi:1.75 llvm-www/demo/index.cgi:1.76
--- llvm-www/demo/index.cgi:1.75 Sun Sep 30 17:23:13 2007
+++ llvm-www/demo/index.cgi Mon Oct 1 14:21:45 2007
@@ -18,10 +18,10 @@
my $LOGFILE = "$ROOT/log.txt";
my $FORM_URL = 'index.cgi';
+my $MAILADDR = 'sabre at nondot.org';
my $CONTACT_ADDRESS = 'Questions or comments? Email the LLVMdev mailing list.';
my $LOGO_IMAGE_URL = 'cathead.png';
my $TIMEOUTAMOUNT = 20;
-$ENV{'LLVM_LIB_SEARCH_PATH'} = '/home/vadve/gaeke/llvm/Release/runtime/';
$ENV{'LD_LIBRARY_PATH'} = '/home/vadve/shared/localtools/fc1/lib/';
my @PREPENDPATHDIRS =
@@ -29,6 +29,12 @@
'/home/vadve/shared/llvm-gcc4.0-2.1/bin/',
'/home/vadve/shared/llvm-2.1/Release/bin');
+my $defaultsrc = "#include \n#include \n\n" .
+ "int power(int X) {\n if (X == 0) return 1;\n" .
+ " return X*power(X-1);\n}\n\n" .
+ "int main(int argc, char **argv) {\n" .
+ " printf(\"%d\\n\", power(atoi(argv[0])));\n}\n";
+
sub getname {
my ($extension) = @_;
for ( my $count = 0 ; ; $count++ ) {
@@ -166,14 +172,8 @@
my $source = $c->param('source');
-# Start the user out with something valid.
-if (!defined($source)) {
- $source = "#include \n#include \n\n" .
- "int power(int X) {\n if (X == 0) return 1;\n" .
- " return X*power(X-1);\n}\n\n" .
- "int main(int argc, char **argv) {\n" .
- " printf(\"%d\\n\", power(atoi(argv[0])));\n}\n";
-}
+# Start the user out with something valid if no code.
+$source = $defaultsrc if (!defined($source));
print $c->textarea(
-name => "source",
@@ -448,6 +448,12 @@
try_run("llvm2cpp","llvm2cpp $bytecodeFile -o $l2cppFile 2>&1",
$l2cppFile);
}
+
+ # Get the source presented by the user to CGI, convert newline sequences to simple \n.
+ my $actualsrc = $c->param('source');
+ $actualsrc =~ s/\015\012/\n/go;
+ # Don't log this or mail it if it is the default code.
+ if ($actualsrc ne $defaultsrc) {
addlog( $source, $pid, $UnhilightedResult );
my ( $ip, $host, $lg, $lines );
@@ -455,7 +461,7 @@
$lg = $c->param('language');
$ip = $c->remote_addr();
chomp( $host = `host $ip` ) if $ip;
- mailto( 'sabre at nondot.org',
+ mailto( $MAILADDR',
"--- Query: ---\nFrom: ($ip) $host\nInput: $lines lines of $lg\n"
. "C++ demangle = "
. ( $c->param('cxxdemangle') ? 1 : 0 )
@@ -465,7 +471,7 @@
. ( $c->param('showstats') ? 1 : 0 ) . "\n\n"
. "--- Source: ---\n$source\n"
. "--- Result: ---\n$UnhilightedResult\n" );
-
+ }
unlink( $inputFile, $bytecodeFile, $outputFile, $disassemblyFile );
}
From sabre at nondot.org Mon Oct 1 14:30:20 2007
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 1 Oct 2007 14:30:20 -0500
Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi
Message-ID: <200710011930.l91JUKGW020943@zion.cs.uiuc.edu>
Changes in directory llvm-www/demo:
index.cgi updated: 1.76 -> 1.77
---
Log message:
fix typo
---
Diffs of the changes: (+1 -1)
index.cgi | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: llvm-www/demo/index.cgi
diff -u llvm-www/demo/index.cgi:1.76 llvm-www/demo/index.cgi:1.77
--- llvm-www/demo/index.cgi:1.76 Mon Oct 1 14:21:45 2007
+++ llvm-www/demo/index.cgi Mon Oct 1 14:29:53 2007
@@ -461,7 +461,7 @@
$lg = $c->param('language');
$ip = $c->remote_addr();
chomp( $host = `host $ip` ) if $ip;
- mailto( $MAILADDR',
+ mailto( $MAILADDR,
"--- Query: ---\nFrom: ($ip) $host\nInput: $lines lines of $lg\n"
. "C++ demangle = "
. ( $c->param('cxxdemangle') ? 1 : 0 )
From sabre at nondot.org Mon Oct 1 14:36:27 2007
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 1 Oct 2007 14:36:27 -0500
Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi
Message-ID: <200710011936.l91JaRbi021251@zion.cs.uiuc.edu>
Changes in directory llvm-www/demo:
index.cgi updated: 1.77 -> 1.78
---
Log message:
don't compile before they hit submit
---
Diffs of the changes: (+1 -1)
index.cgi | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: llvm-www/demo/index.cgi
diff -u llvm-www/demo/index.cgi:1.77 llvm-www/demo/index.cgi:1.78
--- llvm-www/demo/index.cgi:1.77 Mon Oct 1 14:29:53 2007
+++ llvm-www/demo/index.cgi Mon Oct 1 14:36:08 2007
@@ -351,7 +351,7 @@
close $fh;
}
-if ($source) {
+if ($c->param('source')) {
print $c->hr;
my $extension = $suffixes{ $c->param('language') };
barf "Unknown language; can't compile\n" unless $extension;
From isanbard at gmail.com Mon Oct 1 15:02:28 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 01 Oct 2007 20:02:28 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42496 -
/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
Message-ID: <200710012002.l91K2SY6022595@zion.cs.uiuc.edu>
Author: void
Date: Mon Oct 1 15:02:27 2007
New Revision: 42496
URL: http://llvm.org/viewvc/llvm-project?rev=42496&view=rev
Log:
GCC uses "i32 0" for null pointers. LLVM requires a pointer type.
Modified:
llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=42496&r1=42495&r2=42496&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Mon Oct 1 15:02:27 2007
@@ -2566,7 +2566,8 @@
/* struct objc_method_list *optional_instance_methods; */
if (!optional_instance_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2576,7 +2577,8 @@
/* struct objc_method_list *optional_class_methods; */
if (!optional_class_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2586,7 +2588,8 @@
/* struct objc_prop_list *instance_properties; */
if (!instance_prop)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2667,7 +2670,8 @@
/* struct _prop_list_t *properties; */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -4974,7 +4978,8 @@
/* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
if (flag_next_runtime || ! sel_ref_chain)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
initlist
= tree_cons (NULL_TREE,
@@ -9234,7 +9239,8 @@
(objc_protocol_template)),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- refs_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ refs_expr = null_pointer_node;
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9304,7 +9310,8 @@
if (newabi)
{
/* 'isa' is NULL in the new ObjC abi */
- expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ expr = null_pointer_node;
}
/* APPLE LOCAL end radar 4533974 - ObjC newprotocol - radar 4695109 */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9312,7 +9319,8 @@
else
{
if (!objc_protocol_or_opt_ins_meth)
- expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ expr = null_pointer_node;
else
expr = convert (build_pointer_type (objc_protocol_extension_template),
build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
@@ -9326,7 +9334,8 @@
initlist = tree_cons (NULL_TREE, protocol_list, initlist);
if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -9337,7 +9346,8 @@
}
if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -9352,7 +9362,8 @@
{
/* APPLE LOCAL begin radar 4695109 */
if (!objc_protocol_or_opt_ins_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9360,7 +9371,8 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!opt_cls_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9369,7 +9381,8 @@
}
/* APPLE LOCAL end radar 4695109 */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -10389,7 +10402,8 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ ivar = tree_cons (NULL_TREE, null_pointer_node, ivar);
/* Set type */
encode_field_decl (field_decl,
@@ -10446,7 +10460,8 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ ivar = tree_cons (NULL_TREE, null_pointer_node, ivar);
/* Set type. */
encode_field_decl (field_decl,
@@ -11142,7 +11157,8 @@
initlist = tree_cons (NULL_TREE, class_name, initlist);
if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -11152,7 +11168,8 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -11164,7 +11181,8 @@
/* protocol_list = */
if (!protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
@@ -11186,7 +11204,8 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* struct _objc_property_list *instance_properties; */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -11253,7 +11272,8 @@
/* objc_ivar_list = */
if (!ivar_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -11265,7 +11285,8 @@
/* objc_method_list = */
if (!dispatch_table)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -11277,22 +11298,27 @@
if (flag_next_runtime)
/* method_cache = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* dtable = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* subclass_list = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* sibling_class = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
}
/* protocol_list = */
if (! protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (build_pointer_type
@@ -11307,18 +11333,21 @@
{
/* const char *ivar_layout; */
if (IS_CLS_META (status)) /* Meta Class ? */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
tree ivar_layout = objc_build_ivar_layout (true);
if (!ivar_layout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
initlist = tree_cons (NULL_TREE, ivar_layout, initlist);
}
/* struct _objc_class_ext *ext; */
if (!objc_class_ext)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (build_pointer_type (objc_class_ext_template),
@@ -11328,7 +11357,8 @@
}
else
/* gc_object_type = NULL */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* APPLE LOCAL end radar 4585769 - Objective-C 1.0 extensions */
return objc_build_constructor (type, nreverse (initlist));
@@ -11490,13 +11520,15 @@
if (cache)
initlist = tree_cons (NULL_TREE, cache, initlist);
else
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* vtable */
if (vtable)
initlist = tree_cons (NULL_TREE, vtable, initlist);
else
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* ro */
initlist = tree_cons (NULL_TREE, ro, initlist);
@@ -11540,7 +11572,8 @@
/* APPLE LOCAL begin radar 4695101 */
/* ivarLayout */
if (!ivarLayout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
initlist = tree_cons (NULL_TREE, ivarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11550,7 +11583,8 @@
/* baseMethods */
if (!baseMethods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11560,31 +11594,34 @@
/* baseProtocols */
if (!baseProtocols)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
tree protocol_list_t_p = build_pointer_type (
xref_tag (RECORD_TYPE,
get_identifier (UTAG_V2_PROTOCOL_LIST)));
expr = convert (protocol_list_t_p,
- build_unary_op (ADDR_EXPR, baseProtocols, 0));
+ build_unary_op (ADDR_EXPR, baseProtocols, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* ivars */
if (!ivars)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_v2_ivar_list_ptr,
- build_unary_op (ADDR_EXPR, ivars, 0));
+ build_unary_op (ADDR_EXPR, ivars, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL begin radar 4695101 */
/* weakIvarLayout */
if (!weakIvarLayout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
initlist = tree_cons (NULL_TREE, weakIvarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11592,11 +11629,12 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* property list */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr,
- build_unary_op (ADDR_EXPR, property_list, 0));
+ build_unary_op (ADDR_EXPR, property_list, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL end C* property metadata (Radar 4498373) */
@@ -11854,7 +11892,8 @@
/* root class. */
root_expr = build_unary_op (ADDR_EXPR, metaclass_decl, 0);
metaclass_superclass_expr = build_unary_op (ADDR_EXPR, class_decl, 0);
- class_superclass_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ class_superclass_expr = null_pointer_node;
flags |= 0x2; /* CLS_ROOT: it is also a root meta class */
}
@@ -12043,7 +12082,8 @@
super_expr = build_c_cast (cast_type, super_expr); /* cast! */
}
else
- super_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ super_expr = null_pointer_node;
root_expr = add_objc_string (my_root_id, class_names);
root_expr = build_c_cast (cast_type, root_expr); /* cast! */
@@ -13303,7 +13343,8 @@
refs_expr = convert (build_pointer_type (objc_v2_protocol_template),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- refs_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ refs_expr = null_pointer_node;
/* APPLE LOCAL begin radar 4695101 */
/* Build table of list of properties for this protocol. */
From isanbard at gmail.com Mon Oct 1 15:09:53 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 01 Oct 2007 20:09:53 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42497 -
/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Message-ID: <200710012009.l91K9rUA022838@zion.cs.uiuc.edu>
Author: void
Date: Mon Oct 1 15:09:53 2007
New Revision: 42497
URL: http://llvm.org/viewvc/llvm-project?rev=42497&view=rev
Log:
GCC uses "i32 0" for null pointers. LLVM uses pointer types.
Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=42497&r1=42496&r2=42497&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Oct 1 15:09:53 2007
@@ -2576,7 +2576,8 @@
/* struct objc_method_list *optional_instance_methods; */
if (!optional_instance_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2586,7 +2587,8 @@
/* struct objc_method_list *optional_class_methods; */
if (!optional_class_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2596,7 +2598,8 @@
/* struct objc_prop_list *instance_properties; */
if (!instance_prop)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2677,7 +2680,8 @@
/* struct _prop_list_t *properties; */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -4871,7 +4875,8 @@
/* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
if (flag_next_runtime || ! sel_ref_chain)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
initlist
= tree_cons (NULL_TREE,
@@ -9134,7 +9139,8 @@
(objc_protocol_template)),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- refs_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ refs_expr = null_pointer_node;
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9204,7 +9210,8 @@
if (newabi)
{
/* 'isa' is NULL in the new ObjC abi */
- expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ expr = null_pointer_node;
}
/* APPLE LOCAL end radar 4533974 - ObjC newprotocol - radar 4695109 */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9212,7 +9219,8 @@
else
{
if (!objc_protocol_or_opt_ins_meth)
- expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ expr = null_pointer_node;
else
expr = convert (build_pointer_type (objc_protocol_extension_template),
build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
@@ -9226,7 +9234,8 @@
initlist = tree_cons (NULL_TREE, protocol_list, initlist);
if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9235,7 +9244,8 @@
}
if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9248,7 +9258,8 @@
{
/* APPLE LOCAL begin radar 4695109 */
if (!objc_protocol_or_opt_ins_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9256,7 +9267,8 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!opt_cls_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9265,7 +9277,8 @@
}
/* APPLE LOCAL end radar 4695109 */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -10291,7 +10304,8 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ ivar = tree_cons (NULL_TREE, null_pointer_node, ivar);
/* Set type */
encode_field_decl (field_decl,
@@ -10348,7 +10362,8 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ ivar = tree_cons (NULL_TREE, null_pointer_node, ivar);
/* Set type. */
encode_field_decl (field_decl,
@@ -11042,7 +11057,8 @@
initlist = tree_cons (NULL_TREE, class_name, initlist);
if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11050,7 +11066,8 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11060,7 +11077,8 @@
/* protocol_list = */
if (!protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
@@ -11082,7 +11100,8 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* struct _objc_property_list *instance_properties; */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -11149,7 +11168,8 @@
/* objc_ivar_list = */
if (!ivar_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_ivar_list_ptr,
@@ -11159,7 +11179,8 @@
/* objc_method_list = */
if (!dispatch_table)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11169,22 +11190,27 @@
if (flag_next_runtime)
/* method_cache = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
/* dtable = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* subclass_list = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* sibling_class = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
}
/* protocol_list = */
if (! protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (build_pointer_type
@@ -11199,18 +11225,21 @@
{
/* const char *ivar_layout; */
if (IS_CLS_META (status)) /* Meta Class ? */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
tree ivar_layout = objc_build_ivar_layout (true);
if (!ivar_layout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
initlist = tree_cons (NULL_TREE, ivar_layout, initlist);
}
/* struct _objc_class_ext *ext; */
if (!objc_class_ext)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (build_pointer_type (objc_class_ext_template),
@@ -11220,7 +11249,8 @@
}
else
/* gc_object_type = NULL */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* APPLE LOCAL end radar 4585769 - Objective-C 1.0 extensions */
return objc_build_constructor (type, nreverse (initlist));
@@ -11382,13 +11412,15 @@
if (cache)
initlist = tree_cons (NULL_TREE, cache, initlist);
else
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* vtable */
if (vtable)
initlist = tree_cons (NULL_TREE, vtable, initlist);
else
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* ro */
initlist = tree_cons (NULL_TREE, ro, initlist);
@@ -11432,7 +11464,8 @@
/* APPLE LOCAL begin radar 4695101 */
/* ivarLayout */
if (!ivarLayout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
initlist = tree_cons (NULL_TREE, ivarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11442,7 +11475,8 @@
/* baseMethods */
if (!baseMethods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11452,31 +11486,34 @@
/* baseProtocols */
if (!baseProtocols)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
tree protocol_list_t_p = build_pointer_type (
xref_tag (RECORD_TYPE,
get_identifier (UTAG_V2_PROTOCOL_LIST)));
expr = convert (protocol_list_t_p,
- build_unary_op (ADDR_EXPR, baseProtocols, 0));
+ build_unary_op (ADDR_EXPR, baseProtocols, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* ivars */
if (!ivars)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_v2_ivar_list_ptr,
- build_unary_op (ADDR_EXPR, ivars, 0));
+ build_unary_op (ADDR_EXPR, ivars, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL begin radar 4695101 */
/* weakIvarLayout */
if (!weakIvarLayout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
initlist = tree_cons (NULL_TREE, weakIvarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11484,11 +11521,12 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* property list */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
else
{
expr = convert (objc_prop_list_ptr,
- build_unary_op (ADDR_EXPR, property_list, 0));
+ build_unary_op (ADDR_EXPR, property_list, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL end C* property metadata (Radar 4498373) */
@@ -11735,7 +11773,8 @@
/* root class. */
root_expr = build_unary_op (ADDR_EXPR, metaclass_decl, 0);
metaclass_superclass_expr = build_unary_op (ADDR_EXPR, class_decl, 0);
- class_superclass_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ class_superclass_expr = null_pointer_node;
flags |= 0x2; /* CLS_ROOT: it is also a root meta class */
}
@@ -11927,7 +11966,8 @@
super_expr = build_c_cast (cast_type, super_expr); /* cast! */
}
else
- super_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ super_expr = null_pointer_node;
root_expr = add_objc_string (my_root_id, class_names);
root_expr = build_c_cast (cast_type, root_expr); /* cast! */
@@ -13190,7 +13230,8 @@
refs_expr = convert (build_pointer_type (objc_v2_protocol_template),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- refs_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ refs_expr = null_pointer_node;
/* APPLE LOCAL begin radar 4695101 */
/* Build table of list of properties for this protocol. */
From evan.cheng at apple.com Mon Oct 1 15:44:09 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 01 Oct 2007 20:44:09 -0000
Subject: [llvm-commits] [llvm] r42499 - in /llvm/trunk:
include/llvm/CodeGen/LinkAllCodegenComponents.h
include/llvm/CodeGen/ScheduleDAG.h
lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp
Message-ID: <200710012044.l91Ki9Fu024385@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 1 15:44:07 2007
New Revision: 42499
URL: http://llvm.org/viewvc/llvm-project?rev=42499&view=rev
Log:
Remove simple scheduler.
Removed:
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp
Modified:
llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
Modified: llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h?rev=42499&r1=42498&r2=42499&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h Mon Oct 1 15:44:07 2007
@@ -35,9 +35,6 @@
(void) llvm::createSimpleRegisterCoalescer();
- (void) llvm::createBFS_DAGScheduler(NULL, NULL, NULL);
- (void) llvm::createSimpleDAGScheduler(NULL, NULL, NULL);
- (void) llvm::createNoItinsDAGScheduler(NULL, NULL, NULL);
(void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL);
(void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL);
(void) llvm::createTDListDAGScheduler(NULL, NULL, NULL);
Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=42499&r1=42498&r2=42499&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Mon Oct 1 15:44:07 2007
@@ -354,24 +354,6 @@
DenseMap &VRBaseMap);
};
- /// createBFS_DAGScheduler - This creates a simple breadth first instruction
- /// scheduler.
- ScheduleDAG *createBFS_DAGScheduler(SelectionDAGISel *IS,
- SelectionDAG *DAG,
- MachineBasicBlock *BB);
-
- /// createSimpleDAGScheduler - This creates a simple two pass instruction
- /// scheduler using instruction itinerary.
- ScheduleDAG* createSimpleDAGScheduler(SelectionDAGISel *IS,
- SelectionDAG *DAG,
- MachineBasicBlock *BB);
-
- /// createNoItinsDAGScheduler - This creates a simple two pass instruction
- /// scheduler without using instruction itinerary.
- ScheduleDAG* createNoItinsDAGScheduler(SelectionDAGISel *IS,
- SelectionDAG *DAG,
- MachineBasicBlock *BB);
-
/// createBURRListDAGScheduler - This creates a bottom up register usage
/// reduction list scheduler.
ScheduleDAG* createBURRListDAGScheduler(SelectionDAGISel *IS,
Removed: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp?rev=42498&view=auto
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp (removed)
@@ -1,1165 +0,0 @@
-//===-- ScheduleDAGSimple.cpp - Implement a trivial DAG scheduler ---------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by James M. Laskey and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This implements a simple two pass scheduler. The first pass attempts to push
-// backward any lengthy instructions and critical paths. The second pass packs
-// instructions into semi-optimal time slots.
-//
-//===----------------------------------------------------------------------===//
-
-#define DEBUG_TYPE "pre-RA-sched"
-#include "llvm/CodeGen/MachineFunction.h"
-#include "llvm/CodeGen/ScheduleDAG.h"
-#include "llvm/CodeGen/SchedulerRegistry.h"
-#include "llvm/CodeGen/SelectionDAG.h"
-#include "llvm/CodeGen/SSARegMap.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetInstrInfo.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/Compiler.h"
-#include
-using namespace llvm;
-
-namespace {
-
-static RegisterScheduler
- bfsDAGScheduler("none", " No scheduling: breadth first sequencing",
- createBFS_DAGScheduler);
-static RegisterScheduler
- simpleDAGScheduler("simple",
- " Simple two pass scheduling: minimize critical path "
- "and maximize processor utilization",
- createSimpleDAGScheduler);
-static RegisterScheduler
- noitinDAGScheduler("simple-noitin",
- " Simple two pass scheduling: Same as simple "
- "except using generic latency",
- createNoItinsDAGScheduler);
-
-class NodeInfo;
-typedef NodeInfo *NodeInfoPtr;
-typedef std::vector NIVector;
-typedef std::vector::iterator NIIterator;
-
-//===--------------------------------------------------------------------===//
-///
-/// Node group - This struct is used to manage flagged node groups.
-///
-class NodeGroup {
-public:
- NodeGroup *Next;
-private:
- NIVector Members; // Group member nodes
- NodeInfo *Dominator; // Node with highest latency
- unsigned Latency; // Total latency of the group
- int Pending; // Number of visits pending before
- // adding to order
-
-public:
- // Ctor.
- NodeGroup() : Next(NULL), Dominator(NULL), Pending(0) {}
-
- // Accessors
- inline void setDominator(NodeInfo *D) { Dominator = D; }
- inline NodeInfo *getTop() { return Members.front(); }
- inline NodeInfo *getBottom() { return Members.back(); }
- inline NodeInfo *getDominator() { return Dominator; }
- inline void setLatency(unsigned L) { Latency = L; }
- inline unsigned getLatency() { return Latency; }
- inline int getPending() const { return Pending; }
- inline void setPending(int P) { Pending = P; }
- inline int addPending(int I) { return Pending += I; }
-
- // Pass thru
- inline bool group_empty() { return Members.empty(); }
- inline NIIterator group_begin() { return Members.begin(); }
- inline NIIterator group_end() { return Members.end(); }
- inline void group_push_back(const NodeInfoPtr &NI) {
- Members.push_back(NI);
- }
- inline NIIterator group_insert(NIIterator Pos, const NodeInfoPtr &NI) {
- return Members.insert(Pos, NI);
- }
- inline void group_insert(NIIterator Pos, NIIterator First,
- NIIterator Last) {
- Members.insert(Pos, First, Last);
- }
-
- static void Add(NodeInfo *D, NodeInfo *U);
-};
-
-//===--------------------------------------------------------------------===//
-///
-/// NodeInfo - This struct tracks information used to schedule the a node.
-///
-class NodeInfo {
-private:
- int Pending; // Number of visits pending before
- // adding to order
-public:
- SDNode *Node; // DAG node
- InstrStage *StageBegin; // First stage in itinerary
- InstrStage *StageEnd; // Last+1 stage in itinerary
- unsigned Latency; // Total cycles to complete instr
- bool IsCall : 1; // Is function call
- bool IsLoad : 1; // Is memory load
- bool IsStore : 1; // Is memory store
- unsigned Slot; // Node's time slot
- NodeGroup *Group; // Grouping information
-#ifndef NDEBUG
- unsigned Preorder; // Index before scheduling
-#endif
-
- // Ctor.
- NodeInfo(SDNode *N = NULL)
- : Pending(0)
- , Node(N)
- , StageBegin(NULL)
- , StageEnd(NULL)
- , Latency(0)
- , IsCall(false)
- , IsLoad(false)
- , IsStore(false)
- , Slot(0)
- , Group(NULL)
-#ifndef NDEBUG
- , Preorder(0)
-#endif
- {}
-
- // Accessors
- inline bool isInGroup() const {
- assert(!Group || !Group->group_empty() && "Group with no members");
- return Group != NULL;
- }
- inline bool isGroupDominator() const {
- return isInGroup() && Group->getDominator() == this;
- }
- inline int getPending() const {
- return Group ? Group->getPending() : Pending;
- }
- inline void setPending(int P) {
- if (Group) Group->setPending(P);
- else Pending = P;
- }
- inline int addPending(int I) {
- if (Group) return Group->addPending(I);
- else return Pending += I;
- }
-};
-
-//===--------------------------------------------------------------------===//
-///
-/// NodeGroupIterator - Iterates over all the nodes indicated by the node
-/// info. If the node is in a group then iterate over the members of the
-/// group, otherwise just the node info.
-///
-class NodeGroupIterator {
-private:
- NodeInfo *NI; // Node info
- NIIterator NGI; // Node group iterator
- NIIterator NGE; // Node group iterator end
- bool iter_valid;
-
-public:
- // Ctor.
- NodeGroupIterator(NodeInfo *N) : NI(N), iter_valid(false) {
- // If the node is in a group then set up the group iterator. Otherwise
- // the group iterators will trip first time out.
- assert(N && "Bad node info");
- if (N->isInGroup()) {
- // get Group
- NodeGroup *Group = NI->Group;
- NGI = Group->group_begin();
- NGE = Group->group_end();
- // Prevent this node from being used (will be in members list
- NI = NULL;
- iter_valid = true;
- }
- }
-
- /// next - Return the next node info, otherwise NULL.
- ///
- NodeInfo *next() {
- if (iter_valid) {
- // If members list
- if (NGI != NGE) return *NGI++;
- }
- // Use node as the result (may be NULL)
- NodeInfo *Result = NI;
- // Only use once
- NI = NULL;
- // Return node or NULL
- return Result;
- }
-};
-//===--------------------------------------------------------------------===//
-
-
-//===--------------------------------------------------------------------===//
-///
-/// NodeGroupOpIterator - Iterates over all the operands of a node. If the
-/// node is a member of a group, this iterates over all the operands of all
-/// the members of the group.
-///
-class NodeGroupOpIterator {
-private:
- NodeInfo *NI; // Node containing operands
- NodeGroupIterator GI; // Node group iterator
- SDNode::op_iterator OI; // Operand iterator
- SDNode::op_iterator OE; // Operand iterator end
-
- /// CheckNode - Test if node has more operands. If not get the next node
- /// skipping over nodes that have no operands.
- void CheckNode() {
- // Only if operands are exhausted first
- while (OI == OE) {
- // Get next node info
- NodeInfo *NI = GI.next();
- // Exit if nodes are exhausted
- if (!NI) return;
- // Get node itself
- SDNode *Node = NI->Node;
- // Set up the operand iterators
- OI = Node->op_begin();
- OE = Node->op_end();
- }
- }
-
-public:
- // Ctor.
- NodeGroupOpIterator(NodeInfo *N)
- : NI(N), GI(N), OI(SDNode::op_iterator()), OE(SDNode::op_iterator()) {}
-
- /// isEnd - Returns true when not more operands are available.
- ///
- inline bool isEnd() { CheckNode(); return OI == OE; }
-
- /// next - Returns the next available operand.
- ///
- inline SDOperand next() {
- assert(OI != OE &&
- "Not checking for end of NodeGroupOpIterator correctly");
- return *OI++;
- }
-};
-
-
-//===----------------------------------------------------------------------===//
-///
-/// BitsIterator - Provides iteration through individual bits in a bit vector.
-///
-template
-class BitsIterator {
-private:
- T Bits; // Bits left to iterate through
-
-public:
- /// Ctor.
- BitsIterator(T Initial) : Bits(Initial) {}
-
- /// Next - Returns the next bit set or zero if exhausted.
- inline T Next() {
- // Get the rightmost bit set
- T Result = Bits & -Bits;
- // Remove from rest
- Bits &= ~Result;
- // Return single bit or zero
- return Result;
- }
-};
-
-//===----------------------------------------------------------------------===//
-
-
-//===----------------------------------------------------------------------===//
-///
-/// ResourceTally - Manages the use of resources over time intervals. Each
-/// item (slot) in the tally vector represents the resources used at a given
-/// moment. A bit set to 1 indicates that a resource is in use, otherwise
-/// available. An assumption is made that the tally is large enough to schedule
-/// all current instructions (asserts otherwise.)
-///
-template
-class ResourceTally {
-private:
- std::vector Tally; // Resources used per slot
- typedef typename std::vector::iterator Iter;
- // Tally iterator
-
- /// SlotsAvailable - Returns true if all units are available.
- ///
- bool SlotsAvailable(Iter Begin, unsigned N, unsigned ResourceSet,
- unsigned &Resource) {
- assert(N && "Must check availability with N != 0");
- // Determine end of interval
- Iter End = Begin + N;
- assert(End <= Tally.end() && "Tally is not large enough for schedule");
-
- // Iterate thru each resource
- BitsIterator Resources(ResourceSet & ~*Begin);
- while (unsigned Res = Resources.Next()) {
- // Check if resource is available for next N slots
- Iter Interval = End;
- do {
- Interval--;
- if (*Interval & Res) break;
- } while (Interval != Begin);
-
- // If available for N
- if (Interval == Begin) {
- // Success
- Resource = Res;
- return true;
- }
- }
-
- // No luck
- Resource = 0;
- return false;
- }
-
- /// RetrySlot - Finds a good candidate slot to retry search.
- Iter RetrySlot(Iter Begin, unsigned N, unsigned ResourceSet) {
- assert(N && "Must check availability with N != 0");
- // Determine end of interval
- Iter End = Begin + N;
- assert(End <= Tally.end() && "Tally is not large enough for schedule");
-
- while (Begin != End--) {
- // Clear units in use
- ResourceSet &= ~*End;
- // If no units left then we should go no further
- if (!ResourceSet) return End + 1;
- }
- // Made it all the way through
- return Begin;
- }
-
- /// FindAndReserveStages - Return true if the stages can be completed. If
- /// so mark as busy.
- bool FindAndReserveStages(Iter Begin,
- InstrStage *Stage, InstrStage *StageEnd) {
- // If at last stage then we're done
- if (Stage == StageEnd) return true;
- // Get number of cycles for current stage
- unsigned N = Stage->Cycles;
- // Check to see if N slots are available, if not fail
- unsigned Resource;
- if (!SlotsAvailable(Begin, N, Stage->Units, Resource)) return false;
- // Check to see if remaining stages are available, if not fail
- if (!FindAndReserveStages(Begin + N, Stage + 1, StageEnd)) return false;
- // Reserve resource
- Reserve(Begin, N, Resource);
- // Success
- return true;
- }
-
- /// Reserve - Mark busy (set) the specified N slots.
- void Reserve(Iter Begin, unsigned N, unsigned Resource) {
- // Determine end of interval
- Iter End = Begin + N;
- assert(End <= Tally.end() && "Tally is not large enough for schedule");
-
- // Set resource bit in each slot
- for (; Begin < End; Begin++)
- *Begin |= Resource;
- }
-
- /// FindSlots - Starting from Begin, locate consecutive slots where all stages
- /// can be completed. Returns the address of first slot.
- Iter FindSlots(Iter Begin, InstrStage *StageBegin, InstrStage *StageEnd) {
- // Track position
- Iter Cursor = Begin;
-
- // Try all possible slots forward
- while (true) {
- // Try at cursor, if successful return position.
- if (FindAndReserveStages(Cursor, StageBegin, StageEnd)) return Cursor;
- // Locate a better position
- Cursor = RetrySlot(Cursor + 1, StageBegin->Cycles, StageBegin->Units);
- }
- }
-
-public:
- /// Initialize - Resize and zero the tally to the specified number of time
- /// slots.
- inline void Initialize(unsigned N) {
- Tally.assign(N, 0); // Initialize tally to all zeros.
- }
-
- // FindAndReserve - Locate an ideal slot for the specified stages and mark
- // as busy.
- unsigned FindAndReserve(unsigned Slot, InstrStage *StageBegin,
- InstrStage *StageEnd) {
- // Where to begin
- Iter Begin = Tally.begin() + Slot;
- // Find a free slot
- Iter Where = FindSlots(Begin, StageBegin, StageEnd);
- // Distance is slot number
- unsigned Final = Where - Tally.begin();
- return Final;
- }
-
-};
-
-//===----------------------------------------------------------------------===//
-///
-/// ScheduleDAGSimple - Simple two pass scheduler.
-///
-class VISIBILITY_HIDDEN ScheduleDAGSimple : public ScheduleDAG {
-private:
- bool NoSched; // Just do a BFS schedule, nothing fancy
- bool NoItins; // Don't use itineraries?
- ResourceTally Tally; // Resource usage tally
- unsigned NSlots; // Total latency
- static const unsigned NotFound = ~0U; // Search marker
-
- unsigned NodeCount; // Number of nodes in DAG
- std::map Map; // Map nodes to info
- bool HasGroups; // True if there are any groups
- NodeInfo *Info; // Info for nodes being scheduled
- NIVector Ordering; // Emit ordering of nodes
- NodeGroup *HeadNG, *TailNG; // Keep track of allocated NodeGroups
-
-public:
-
- // Ctor.
- ScheduleDAGSimple(bool noSched, bool noItins, SelectionDAG &dag,
- MachineBasicBlock *bb, const TargetMachine &tm)
- : ScheduleDAG(dag, bb, tm), NoSched(noSched), NoItins(noItins), NSlots(0),
- NodeCount(0), HasGroups(false), Info(NULL), HeadNG(NULL), TailNG(NULL) {
- assert(&TII && "Target doesn't provide instr info?");
- assert(&MRI && "Target doesn't provide register info?");
- }
-
- virtual ~ScheduleDAGSimple() {
- if (Info)
- delete[] Info;
-
- NodeGroup *NG = HeadNG;
- while (NG) {
- NodeGroup *NextSU = NG->Next;
- delete NG;
- NG = NextSU;
- }
- }
-
- void Schedule();
-
- /// getNI - Returns the node info for the specified node.
- ///
- NodeInfo *getNI(SDNode *Node) { return Map[Node]; }
-
-private:
- static bool isDefiner(NodeInfo *A, NodeInfo *B);
- void IncludeNode(NodeInfo *NI);
- void VisitAll();
- void GatherSchedulingInfo();
- void FakeGroupDominators();
- bool isStrongDependency(NodeInfo *A, NodeInfo *B);
- bool isWeakDependency(NodeInfo *A, NodeInfo *B);
- void ScheduleBackward();
- void ScheduleForward();
-
- void AddToGroup(NodeInfo *D, NodeInfo *U);
- /// PrepareNodeInfo - Set up the basic minimum node info for scheduling.
- ///
- void PrepareNodeInfo();
-
- /// IdentifyGroups - Put flagged nodes into groups.
- ///
- void IdentifyGroups();
-
- /// print - Print ordering to specified output stream.
- ///
- void print(std::ostream &O) const;
- void print(std::ostream *O) const { if (O) print(*O); }
-
- void dump(const char *tag) const;
-
- virtual void dump() const;
-
- /// EmitAll - Emit all nodes in schedule sorted order.
- ///
- void EmitAll();
-
- /// printNI - Print node info.
- ///
- void printNI(std::ostream &O, NodeInfo *NI) const;
- void printNI(std::ostream *O, NodeInfo *NI) const { if (O) printNI(*O, NI); }
-
- /// printChanges - Hilight changes in order caused by scheduling.
- ///
- void printChanges(unsigned Index) const;
-};
-
-//===----------------------------------------------------------------------===//
-/// Special case itineraries.
-///
-enum {
- CallLatency = 40, // To push calls back in time
-
- RSInteger = 0xC0000000, // Two integer units
- RSFloat = 0x30000000, // Two float units
- RSLoadStore = 0x0C000000, // Two load store units
- RSBranch = 0x02000000 // One branch unit
-};
-static InstrStage LoadStage = { 5, RSLoadStore };
-static InstrStage StoreStage = { 2, RSLoadStore };
-static InstrStage IntStage = { 2, RSInteger };
-static InstrStage FloatStage = { 3, RSFloat };
-//===----------------------------------------------------------------------===//
-
-} // namespace
-
-//===----------------------------------------------------------------------===//
-
-/// PrepareNodeInfo - Set up the basic minimum node info for scheduling.
-///
-void ScheduleDAGSimple::PrepareNodeInfo() {
- // Allocate node information
- Info = new NodeInfo[NodeCount];
-
- unsigned i = 0;
- for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
- E = DAG.allnodes_end(); I != E; ++I, ++i) {
- // Fast reference to node schedule info
- NodeInfo* NI = &Info[i];
- // Set up map
- Map[I] = NI;
- // Set node
- NI->Node = I;
- // Set pending visit count
- NI->setPending(I->use_size());
- }
-}
-
-/// IdentifyGroups - Put flagged nodes into groups.
-///
-void ScheduleDAGSimple::IdentifyGroups() {
- for (unsigned i = 0, N = NodeCount; i < N; i++) {
- NodeInfo* NI = &Info[i];
- SDNode *Node = NI->Node;
-
- // For each operand (in reverse to only look at flags)
- for (unsigned N = Node->getNumOperands(); 0 < N--;) {
- // Get operand
- SDOperand Op = Node->getOperand(N);
- // No more flags to walk
- if (Op.getValueType() != MVT::Flag) break;
- // Add to node group
- AddToGroup(getNI(Op.Val), NI);
- // Let everyone else know
- HasGroups = true;
- }
- }
-}
-
-/// CountInternalUses - Returns the number of edges between the two nodes.
-///
-static unsigned CountInternalUses(NodeInfo *D, NodeInfo *U) {
- unsigned N = 0;
- for (unsigned M = U->Node->getNumOperands(); 0 < M--;) {
- SDOperand Op = U->Node->getOperand(M);
- if (Op.Val == D->Node) N++;
- }
-
- return N;
-}
-
-//===----------------------------------------------------------------------===//
-/// Add - Adds a definer and user pair to a node group.
-///
-void ScheduleDAGSimple::AddToGroup(NodeInfo *D, NodeInfo *U) {
- // Get current groups
- NodeGroup *DGroup = D->Group;
- NodeGroup *UGroup = U->Group;
- // If both are members of groups
- if (DGroup && UGroup) {
- // There may have been another edge connecting
- if (DGroup == UGroup) return;
- // Add the pending users count
- DGroup->addPending(UGroup->getPending());
- // For each member of the users group
- NodeGroupIterator UNGI(U);
- while (NodeInfo *UNI = UNGI.next() ) {
- // Change the group
- UNI->Group = DGroup;
- // For each member of the definers group
- NodeGroupIterator DNGI(D);
- while (NodeInfo *DNI = DNGI.next() ) {
- // Remove internal edges
- DGroup->addPending(-CountInternalUses(DNI, UNI));
- }
- }
- // Merge the two lists
- DGroup->group_insert(DGroup->group_end(),
- UGroup->group_begin(), UGroup->group_end());
- } else if (DGroup) {
- // Make user member of definers group
- U->Group = DGroup;
- // Add users uses to definers group pending
- DGroup->addPending(U->Node->use_size());
- // For each member of the definers group
- NodeGroupIterator DNGI(D);
- while (NodeInfo *DNI = DNGI.next() ) {
- // Remove internal edges
- DGroup->addPending(-CountInternalUses(DNI, U));
- }
- DGroup->group_push_back(U);
- } else if (UGroup) {
- // Make definer member of users group
- D->Group = UGroup;
- // Add definers uses to users group pending
- UGroup->addPending(D->Node->use_size());
- // For each member of the users group
- NodeGroupIterator UNGI(U);
- while (NodeInfo *UNI = UNGI.next() ) {
- // Remove internal edges
- UGroup->addPending(-CountInternalUses(D, UNI));
- }
- UGroup->group_insert(UGroup->group_begin(), D);
- } else {
- D->Group = U->Group = DGroup = new NodeGroup();
- DGroup->addPending(D->Node->use_size() + U->Node->use_size() -
- CountInternalUses(D, U));
- DGroup->group_push_back(D);
- DGroup->group_push_back(U);
-
- if (HeadNG == NULL)
- HeadNG = DGroup;
- if (TailNG != NULL)
- TailNG->Next = DGroup;
- TailNG = DGroup;
- }
-}
-
-
-/// print - Print ordering to specified output stream.
-///
-void ScheduleDAGSimple::print(std::ostream &O) const {
-#ifndef NDEBUG
- O << "Ordering\n";
- for (unsigned i = 0, N = Ordering.size(); i < N; i++) {
- NodeInfo *NI = Ordering[i];
- printNI(O, NI);
- O << "\n";
- if (NI->isGroupDominator()) {
- NodeGroup *Group = NI->Group;
- for (NIIterator NII = Group->group_begin(), E = Group->group_end();
- NII != E; NII++) {
- O << " ";
- printNI(O, *NII);
- O << "\n";
- }
- }
- }
-#endif
-}
-
-void ScheduleDAGSimple::dump(const char *tag) const {
- cerr << tag; dump();
-}
-
-void ScheduleDAGSimple::dump() const {
- print(cerr);
-}
-
-
-/// EmitAll - Emit all nodes in schedule sorted order.
-///
-void ScheduleDAGSimple::EmitAll() {
- // If this is the first basic block in the function, and if it has live ins
- // that need to be copied into vregs, emit the copies into the top of the
- // block before emitting the code for the block.
- MachineFunction &MF = DAG.getMachineFunction();
- if (&MF.front() == BB && MF.livein_begin() != MF.livein_end()) {
- for (MachineFunction::livein_iterator LI = MF.livein_begin(),
- E = MF.livein_end(); LI != E; ++LI)
- if (LI->second) {
- const TargetRegisterClass *RC = RegMap->getRegClass(LI->second);
- MRI->copyRegToReg(*MF.begin(), MF.begin()->end(), LI->second,
- LI->first, RC, RC);
- }
- }
-
- DenseMap VRBaseMap;
-
- // For each node in the ordering
- for (unsigned i = 0, N = Ordering.size(); i < N; i++) {
- // Get the scheduling info
- NodeInfo *NI = Ordering[i];
- if (NI->isInGroup()) {
- NodeGroupIterator NGI(Ordering[i]);
- while (NodeInfo *NI = NGI.next()) EmitNode(NI->Node, 0, VRBaseMap);
- } else {
- EmitNode(NI->Node, 0, VRBaseMap);
- }
- }
-}
-
-/// isFlagDefiner - Returns true if the node defines a flag result.
-static bool isFlagDefiner(SDNode *A) {
- unsigned N = A->getNumValues();
- return N && A->getValueType(N - 1) == MVT::Flag;
-}
-
-/// isFlagUser - Returns true if the node uses a flag result.
-///
-static bool isFlagUser(SDNode *A) {
- unsigned N = A->getNumOperands();
- return N && A->getOperand(N - 1).getValueType() == MVT::Flag;
-}
-
-/// printNI - Print node info.
-///
-void ScheduleDAGSimple::printNI(std::ostream &O, NodeInfo *NI) const {
-#ifndef NDEBUG
- SDNode *Node = NI->Node;
- O << " "
- << std::hex << Node << std::dec
- << ", Lat=" << NI->Latency
- << ", Slot=" << NI->Slot
- << ", ARITY=(" << Node->getNumOperands() << ","
- << Node->getNumValues() << ")"
- << " " << Node->getOperationName(&DAG);
- if (isFlagDefiner(Node)) O << "<#";
- if (isFlagUser(Node)) O << ">#";
-#endif
-}
-
-/// printChanges - Hilight changes in order caused by scheduling.
-///
-void ScheduleDAGSimple::printChanges(unsigned Index) const {
-#ifndef NDEBUG
- // Get the ordered node count
- unsigned N = Ordering.size();
- // Determine if any changes
- unsigned i = 0;
- for (; i < N; i++) {
- NodeInfo *NI = Ordering[i];
- if (NI->Preorder != i) break;
- }
-
- if (i < N) {
- cerr << Index << ". New Ordering\n";
-
- for (i = 0; i < N; i++) {
- NodeInfo *NI = Ordering[i];
- cerr << " " << NI->Preorder << ". ";
- printNI(cerr, NI);
- cerr << "\n";
- if (NI->isGroupDominator()) {
- NodeGroup *Group = NI->Group;
- for (NIIterator NII = Group->group_begin(), E = Group->group_end();
- NII != E; NII++) {
- cerr << " ";
- printNI(cerr, *NII);
- cerr << "\n";
- }
- }
- }
- } else {
- cerr << Index << ". No Changes\n";
- }
-#endif
-}
-
-//===----------------------------------------------------------------------===//
-/// isDefiner - Return true if node A is a definer for B.
-///
-bool ScheduleDAGSimple::isDefiner(NodeInfo *A, NodeInfo *B) {
- // While there are A nodes
- NodeGroupIterator NII(A);
- while (NodeInfo *NI = NII.next()) {
- // Extract node
- SDNode *Node = NI->Node;
- // While there operands in nodes of B
- NodeGroupOpIterator NGOI(B);
- while (!NGOI.isEnd()) {
- SDOperand Op = NGOI.next();
- // If node from A defines a node in B
- if (Node == Op.Val) return true;
- }
- }
- return false;
-}
-
-/// IncludeNode - Add node to NodeInfo vector.
-///
-void ScheduleDAGSimple::IncludeNode(NodeInfo *NI) {
- // Get node
- SDNode *Node = NI->Node;
- // Ignore entry node
- if (Node->getOpcode() == ISD::EntryToken) return;
- // Check current count for node
- int Count = NI->getPending();
- // If the node is already in list
- if (Count < 0) return;
- // Decrement count to indicate a visit
- Count--;
- // If count has gone to zero then add node to list
- if (!Count) {
- // Add node
- if (NI->isInGroup()) {
- Ordering.push_back(NI->Group->getDominator());
- } else {
- Ordering.push_back(NI);
- }
- // indicate node has been added
- Count--;
- }
- // Mark as visited with new count
- NI->setPending(Count);
-}
-
-/// GatherSchedulingInfo - Get latency and resource information about each node.
-///
-void ScheduleDAGSimple::GatherSchedulingInfo() {
- // Get instruction itineraries for the target
- const InstrItineraryData &InstrItins = TM.getInstrItineraryData();
-
- // For each node
- for (unsigned i = 0, N = NodeCount; i < N; i++) {
- // Get node info
- NodeInfo* NI = &Info[i];
- SDNode *Node = NI->Node;
-
- // If there are itineraries and it is a machine instruction
- if (InstrItins.isEmpty() || NoItins) {
- // If machine opcode
- if (Node->isTargetOpcode()) {
- // Get return type to guess which processing unit
- MVT::ValueType VT = Node->getValueType(0);
- // Get machine opcode
- MachineOpCode TOpc = Node->getTargetOpcode();
- NI->IsCall = TII->isCall(TOpc);
- NI->IsLoad = TII->isLoad(TOpc);
- NI->IsStore = TII->isStore(TOpc);
-
- if (TII->isLoad(TOpc)) NI->StageBegin = &LoadStage;
- else if (TII->isStore(TOpc)) NI->StageBegin = &StoreStage;
- else if (MVT::isInteger(VT)) NI->StageBegin = &IntStage;
- else if (MVT::isFloatingPoint(VT)) NI->StageBegin = &FloatStage;
- if (NI->StageBegin) NI->StageEnd = NI->StageBegin + 1;
- }
- } else if (Node->isTargetOpcode()) {
- // get machine opcode
- MachineOpCode TOpc = Node->getTargetOpcode();
- // Check to see if it is a call
- NI->IsCall = TII->isCall(TOpc);
- // Get itinerary stages for instruction
- unsigned II = TII->getSchedClass(TOpc);
- NI->StageBegin = InstrItins.begin(II);
- NI->StageEnd = InstrItins.end(II);
- }
-
- // One slot for the instruction itself
- NI->Latency = 1;
-
- // Add long latency for a call to push it back in time
- if (NI->IsCall) NI->Latency += CallLatency;
-
- // Sum up all the latencies
- for (InstrStage *Stage = NI->StageBegin, *E = NI->StageEnd;
- Stage != E; Stage++) {
- NI->Latency += Stage->Cycles;
- }
-
- // Sum up all the latencies for max tally size
- NSlots += NI->Latency;
- }
-
- // Unify metrics if in a group
- if (HasGroups) {
- for (unsigned i = 0, N = NodeCount; i < N; i++) {
- NodeInfo* NI = &Info[i];
-
- if (NI->isInGroup()) {
- NodeGroup *Group = NI->Group;
-
- if (!Group->getDominator()) {
- NIIterator NGI = Group->group_begin(), NGE = Group->group_end();
- NodeInfo *Dominator = *NGI;
- unsigned Latency = 0;
-
- for (NGI++; NGI != NGE; NGI++) {
- NodeInfo* NGNI = *NGI;
- Latency += NGNI->Latency;
- if (Dominator->Latency < NGNI->Latency) Dominator = NGNI;
- }
-
- Dominator->Latency = Latency;
- Group->setDominator(Dominator);
- }
- }
- }
- }
-}
-
-/// VisitAll - Visit each node breadth-wise to produce an initial ordering.
-/// Note that the ordering in the Nodes vector is reversed.
-void ScheduleDAGSimple::VisitAll() {
- // Add first element to list
- NodeInfo *NI = getNI(DAG.getRoot().Val);
- if (NI->isInGroup()) {
- Ordering.push_back(NI->Group->getDominator());
- } else {
- Ordering.push_back(NI);
- }
-
- // Iterate through all nodes that have been added
- for (unsigned i = 0; i < Ordering.size(); i++) { // note: size() varies
- // Visit all operands
- NodeGroupOpIterator NGI(Ordering[i]);
- while (!NGI.isEnd()) {
- // Get next operand
- SDOperand Op = NGI.next();
- // Get node
- SDNode *Node = Op.Val;
- // Ignore passive nodes
- if (isPassiveNode(Node)) continue;
- // Check out node
- IncludeNode(getNI(Node));
- }
- }
-
- // Add entry node last (IncludeNode filters entry nodes)
- if (DAG.getEntryNode().Val != DAG.getRoot().Val)
- Ordering.push_back(getNI(DAG.getEntryNode().Val));
-
- // Reverse the order
- std::reverse(Ordering.begin(), Ordering.end());
-}
-
-/// FakeGroupDominators - Set dominators for non-scheduling.
-///
-void ScheduleDAGSimple::FakeGroupDominators() {
- for (unsigned i = 0, N = NodeCount; i < N; i++) {
- NodeInfo* NI = &Info[i];
-
- if (NI->isInGroup()) {
- NodeGroup *Group = NI->Group;
-
- if (!Group->getDominator()) {
- Group->setDominator(NI);
- }
- }
- }
-}
-
-/// isStrongDependency - Return true if node A has results used by node B.
-/// I.E., B must wait for latency of A.
-bool ScheduleDAGSimple::isStrongDependency(NodeInfo *A, NodeInfo *B) {
- // If A defines for B then it's a strong dependency or
- // if a load follows a store (may be dependent but why take a chance.)
- return isDefiner(A, B) || (A->IsStore && B->IsLoad);
-}
-
-/// isWeakDependency Return true if node A produces a result that will
-/// conflict with operands of B. It is assumed that we have called
-/// isStrongDependency prior.
-bool ScheduleDAGSimple::isWeakDependency(NodeInfo *A, NodeInfo *B) {
- // TODO check for conflicting real registers and aliases
-#if 0 // FIXME - Since we are in SSA form and not checking register aliasing
- return A->Node->getOpcode() == ISD::EntryToken || isStrongDependency(B, A);
-#else
- return A->Node->getOpcode() == ISD::EntryToken;
-#endif
-}
-
-/// ScheduleBackward - Schedule instructions so that any long latency
-/// instructions and the critical path get pushed back in time. Time is run in
-/// reverse to allow code reuse of the Tally and eliminate the overhead of
-/// biasing every slot indices against NSlots.
-void ScheduleDAGSimple::ScheduleBackward() {
- // Size and clear the resource tally
- Tally.Initialize(NSlots);
- // Get number of nodes to schedule
- unsigned N = Ordering.size();
-
- // For each node being scheduled
- for (unsigned i = N; 0 < i--;) {
- NodeInfo *NI = Ordering[i];
- // Track insertion
- unsigned Slot = NotFound;
-
- // Compare against those previously scheduled nodes
- unsigned j = i + 1;
- for (; j < N; j++) {
- // Get following instruction
- NodeInfo *Other = Ordering[j];
-
- // Check dependency against previously inserted nodes
- if (isStrongDependency(NI, Other)) {
- Slot = Other->Slot + Other->Latency;
- break;
- } else if (isWeakDependency(NI, Other)) {
- Slot = Other->Slot;
- break;
- }
- }
-
- // If independent of others (or first entry)
- if (Slot == NotFound) Slot = 0;
-
-#if 0 // FIXME - measure later
- // Find a slot where the needed resources are available
- if (NI->StageBegin != NI->StageEnd)
- Slot = Tally.FindAndReserve(Slot, NI->StageBegin, NI->StageEnd);
-#endif
-
- // Set node slot
- NI->Slot = Slot;
-
- // Insert sort based on slot
- j = i + 1;
- for (; j < N; j++) {
- // Get following instruction
- NodeInfo *Other = Ordering[j];
- // Should we look further (remember slots are in reverse time)
- if (Slot >= Other->Slot) break;
- // Shuffle other into ordering
- Ordering[j - 1] = Other;
- }
- // Insert node in proper slot
- if (j != i + 1) Ordering[j - 1] = NI;
- }
-}
-
-/// ScheduleForward - Schedule instructions to maximize packing.
-///
-void ScheduleDAGSimple::ScheduleForward() {
- // Size and clear the resource tally
- Tally.Initialize(NSlots);
- // Get number of nodes to schedule
- unsigned N = Ordering.size();
-
- // For each node being scheduled
- for (unsigned i = 0; i < N; i++) {
- NodeInfo *NI = Ordering[i];
- // Track insertion
- unsigned Slot = NotFound;
-
- // Compare against those previously scheduled nodes
- unsigned j = i;
- for (; 0 < j--;) {
- // Get following instruction
- NodeInfo *Other = Ordering[j];
-
- // Check dependency against previously inserted nodes
- if (isStrongDependency(Other, NI)) {
- Slot = Other->Slot + Other->Latency;
- break;
- } else if (Other->IsCall || isWeakDependency(Other, NI)) {
- Slot = Other->Slot;
- break;
- }
- }
-
- // If independent of others (or first entry)
- if (Slot == NotFound) Slot = 0;
-
- // Find a slot where the needed resources are available
- if (NI->StageBegin != NI->StageEnd)
- Slot = Tally.FindAndReserve(Slot, NI->StageBegin, NI->StageEnd);
-
- // Set node slot
- NI->Slot = Slot;
-
- // Insert sort based on slot
- j = i;
- for (; 0 < j--;) {
- // Get prior instruction
- NodeInfo *Other = Ordering[j];
- // Should we look further
- if (Slot >= Other->Slot) break;
- // Shuffle other into ordering
- Ordering[j + 1] = Other;
- }
- // Insert node in proper slot
- if (j != i) Ordering[j + 1] = NI;
- }
-}
-
-/// Schedule - Order nodes according to selected style.
-///
-void ScheduleDAGSimple::Schedule() {
- // Number the nodes
- NodeCount = std::distance(DAG.allnodes_begin(), DAG.allnodes_end());
-
- // Set up minimum info for scheduling
- PrepareNodeInfo();
- // Construct node groups for flagged nodes
- IdentifyGroups();
-
- // Test to see if scheduling should occur
- bool ShouldSchedule = NodeCount > 3 && !NoSched;
- // Don't waste time if is only entry and return
- if (ShouldSchedule) {
- // Get latency and resource requirements
- GatherSchedulingInfo();
- } else if (HasGroups) {
- // Make sure all the groups have dominators
- FakeGroupDominators();
- }
-
- // Breadth first walk of DAG
- VisitAll();
-
-#ifndef NDEBUG
- static unsigned Count = 0;
- Count++;
- for (unsigned i = 0, N = Ordering.size(); i < N; i++) {
- NodeInfo *NI = Ordering[i];
- NI->Preorder = i;
- }
-#endif
-
- // Don't waste time if is only entry and return
- if (ShouldSchedule) {
- // Push back long instructions and critical path
- ScheduleBackward();
-
- // Pack instructions to maximize resource utilization
- ScheduleForward();
- }
-
- DEBUG(printChanges(Count));
-
- // Emit in scheduled order
- EmitAll();
-}
-
-
-/// createSimpleDAGScheduler - This creates a simple two pass instruction
-/// scheduler using instruction itinerary.
-llvm::ScheduleDAG* llvm::createSimpleDAGScheduler(SelectionDAGISel *IS,
- SelectionDAG *DAG,
- MachineBasicBlock *BB) {
- return new ScheduleDAGSimple(false, false, *DAG, BB, DAG->getTarget());
-}
-
-/// createNoItinsDAGScheduler - This creates a simple two pass instruction
-/// scheduler without using instruction itinerary.
-llvm::ScheduleDAG* llvm::createNoItinsDAGScheduler(SelectionDAGISel *IS,
- SelectionDAG *DAG,
- MachineBasicBlock *BB) {
- return new ScheduleDAGSimple(false, true, *DAG, BB, DAG->getTarget());
-}
-
-/// createBFS_DAGScheduler - This creates a simple breadth first instruction
-/// scheduler.
-llvm::ScheduleDAG* llvm::createBFS_DAGScheduler(SelectionDAGISel *IS,
- SelectionDAG *DAG,
- MachineBasicBlock *BB) {
- return new ScheduleDAGSimple(true, false, *DAG, BB, DAG->getTarget());
-}
From evan.cheng at apple.com Mon Oct 1 15:45:17 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 01 Oct 2007 20:45:17 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42500 -
/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
Message-ID: <200710012045.l91KjH8x024456@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 1 15:45:17 2007
New Revision: 42500
URL: http://llvm.org/viewvc/llvm-project?rev=42500&view=rev
Log:
- Always use default scheduler even at -O0.
- Use local register allocator at -O0.
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=42500&r1=42499&r2=42500&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Mon Oct 1 15:45:17 2007
@@ -185,14 +185,13 @@
// optimizer use.
TheModule->setDataLayout(TheTarget->getTargetData()->
getStringRepresentation());
+
+ RegisterScheduler::setDefault(createDefaultScheduler);
- if (optimize) {
- RegisterScheduler::setDefault(createDefaultScheduler);
- } else {
- RegisterScheduler::setDefault(createBFS_DAGScheduler);
- }
-
- RegisterRegAlloc::setDefault(createLinearScanRegisterAllocator);
+ if (optimize)
+ RegisterRegAlloc::setDefault(createLinearScanRegisterAllocator);
+ else
+ RegisterRegAlloc::setDefault(createLocalRegisterAllocator);
if (!optimize && debug_info_level > DINFO_LEVEL_NONE)
TheDebugInfo = new DebugInfo(TheModule);
From evan.cheng at apple.com Mon Oct 1 15:47:54 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 01 Oct 2007 20:47:54 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42501 -
/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Message-ID: <200710012047.l91Klscl024579@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 1 15:47:54 2007
New Revision: 42501
URL: http://llvm.org/viewvc/llvm-project?rev=42501&view=rev
Log:
Merge -r42499:42500 llvm-project/llvm-gcc-4.0/trunk
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=42501&r1=42500&r2=42501&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Oct 1 15:47:54 2007
@@ -185,14 +185,13 @@
// optimizer use.
TheModule->setDataLayout(TheTarget->getTargetData()->
getStringRepresentation());
+
+ RegisterScheduler::setDefault(createDefaultScheduler);
- if (optimize) {
- RegisterScheduler::setDefault(createDefaultScheduler);
- } else {
- RegisterScheduler::setDefault(createBFS_DAGScheduler);
- }
-
- RegisterRegAlloc::setDefault(createLinearScanRegisterAllocator);
+ if (optimize)
+ RegisterRegAlloc::setDefault(createLinearScanRegisterAllocator);
+ else
+ RegisterRegAlloc::setDefault(createLocalRegisterAllocator);
if (!optimize && debug_info_level > DINFO_LEVEL_NONE)
TheDebugInfo = new DebugInfo(TheModule);
From dpatel at apple.com Mon Oct 1 16:22:57 2007
From: dpatel at apple.com (Devang Patel)
Date: Mon, 01 Oct 2007 21:22:57 -0000
Subject: [llvm-commits] [llvm] r42502 -
/llvm/trunk/test/CFrontend/2007-10-01-BuildArrayRef.c
Message-ID: <200710012122.l91LMvEa025858@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Oct 1 16:22:57 2007
New Revision: 42502
URL: http://llvm.org/viewvc/llvm-project?rev=42502&view=rev
Log:
PR 1603 test case.
Added:
llvm/trunk/test/CFrontend/2007-10-01-BuildArrayRef.c
Added: llvm/trunk/test/CFrontend/2007-10-01-BuildArrayRef.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-10-01-BuildArrayRef.c?rev=42502&view=auto
==============================================================================
--- llvm/trunk/test/CFrontend/2007-10-01-BuildArrayRef.c (added)
+++ llvm/trunk/test/CFrontend/2007-10-01-BuildArrayRef.c Mon Oct 1 16:22:57 2007
@@ -0,0 +1,8 @@
+// RUN: %llvmgcc -S %s -o /dev/null |& grep "error: assignment of read-only location"
+// PR 1603
+int func()
+{
+ const int *arr;
+ arr[0] = 1;
+}
+
From dpatel at apple.com Mon Oct 1 16:24:01 2007
From: dpatel at apple.com (Devang Patel)
Date: Mon, 01 Oct 2007 21:24:01 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42503 -
/llvm-gcc-4.0/trunk/gcc/c-typeck.c
Message-ID: <200710012124.l91LO1IU025907@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Oct 1 16:24:00 2007
New Revision: 42503
URL: http://llvm.org/viewvc/llvm-project?rev=42503&view=rev
Log:
Fix
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071001/054127.html
Modified:
llvm-gcc-4.0/trunk/gcc/c-typeck.c
Modified: llvm-gcc-4.0/trunk/gcc/c-typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-typeck.c?rev=42503&r1=42502&r2=42503&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.0/trunk/gcc/c-typeck.c Mon Oct 1 16:24:00 2007
@@ -1898,7 +1898,8 @@
*/
{
tree ty = TREE_TYPE(TREE_TYPE(ar));
- if (TREE_CODE(ty) != ARRAY_TYPE)
+ if (TREE_CODE(ty) == RECORD_TYPE || TREE_CODE(ty) == UNION_TYPE
+ || TREE_CODE(ty) == QUAL_UNION_TYPE)
ty = TYPE_MAIN_VARIANT (ty);
return build4 (ARRAY_REF, ty, ar, index, NULL_TREE, NULL_TREE);
}
From dpatel at apple.com Mon Oct 1 16:27:19 2007
From: dpatel at apple.com (Devang Patel)
Date: Mon, 01 Oct 2007 21:27:19 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42504 -
/llvm-gcc-4.2/trunk/gcc/c-typeck.c
Message-ID: <200710012127.l91LRJGq026066@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Oct 1 16:27:18 2007
New Revision: 42504
URL: http://llvm.org/viewvc/llvm-project?rev=42504&view=rev
Log:
Fix PR1603
Modified:
llvm-gcc-4.2/trunk/gcc/c-typeck.c
Modified: llvm-gcc-4.2/trunk/gcc/c-typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-typeck.c?rev=42504&r1=42503&r2=42504&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-typeck.c Mon Oct 1 16:27:18 2007
@@ -2082,7 +2082,8 @@
*/
{
tree ty = TREE_TYPE(TREE_TYPE(ar));
- if (TREE_CODE(ty) != ARRAY_TYPE)
+ if (TREE_CODE(ty) == RECORD_TYPE || TREE_CODE(ty) == UNION_TYPE
+ || TREE_CODE(ty) == QUAL_UNION_TYPE)
ty = TYPE_MAIN_VARIANT (ty);
return build4 (ARRAY_REF, ty, ar, index, NULL_TREE, NULL_TREE);
}
From dalej at apple.com Mon Oct 1 17:06:32 2007
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 1 Oct 2007 15:06:32 -0700
Subject: [llvm-commits] PR 1660
Message-ID: <53BF6421-4CB5-4981-9DF9-76C6AEAA2A5D@apple.com>
points out that llvm-gcc-4.2 doesn't build on MacOSX PowerPC machines.
I believe that the gcc-4.2 target-specific code for this environment
assumes that
gcc's XFloat mode (==128-bit long double) is supported, and makes no
provision for the
possibility that it isn't. The dependency was introduced in FSF
between 4.0 and 4.2.
That is, this isn't a recent regression (and the way to fix it, at
least the best way if not
the quickest, is to implement PPC long double.)
Here is your chance to prove me wrong! Has anybody ever gotten this
configuration to build?
From evan.cheng at apple.com Mon Oct 1 17:17:20 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 01 Oct 2007 22:17:20 -0000
Subject: [llvm-commits] [llvm] r42505 - in /llvm/trunk/test/CodeGen:
Generic/2006-07-03-schedulers.ll X86/2007-01-13-StackPtrIndex.ll
Message-ID: <200710012217.l91MHKH8028692@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 1 17:17:20 2007
New Revision: 42505
URL: http://llvm.org/viewvc/llvm-project?rev=42505&view=rev
Log:
-pre-RA-sched=none, simple, simple-noitin are gone.
Modified:
llvm/trunk/test/CodeGen/Generic/2006-07-03-schedulers.ll
llvm/trunk/test/CodeGen/X86/2007-01-13-StackPtrIndex.ll
Modified: llvm/trunk/test/CodeGen/Generic/2006-07-03-schedulers.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2006-07-03-schedulers.ll?rev=42505&r1=42504&r2=42505&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/2006-07-03-schedulers.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/2006-07-03-schedulers.ll Mon Oct 1 17:17:20 2007
@@ -1,7 +1,4 @@
-; RUN: llvm-upgrade %s | llvm-as | llc -pre-RA-sched=none
; RUN: llvm-upgrade %s | llvm-as | llc -pre-RA-sched=default
-; RUN: llvm-upgrade %s | llvm-as | llc -pre-RA-sched=simple
-; RUN: llvm-upgrade %s | llvm-as | llc -pre-RA-sched=simple-noitin
; RUN: llvm-upgrade %s | llvm-as | llc -pre-RA-sched=list-td
; RUN: llvm-upgrade %s | llvm-as | llc -pre-RA-sched=list-tdrr
; RUN: llvm-upgrade %s | llvm-as | llc -pre-RA-sched=list-burr
Modified: llvm/trunk/test/CodeGen/X86/2007-01-13-StackPtrIndex.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-01-13-StackPtrIndex.ll?rev=42505&r1=42504&r2=42505&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2007-01-13-StackPtrIndex.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2007-01-13-StackPtrIndex.ll Mon Oct 1 17:17:20 2007
@@ -1,5 +1,5 @@
-; RUN: llvm-as < %s | llc -march=x86-64 -pre-RA-sched=none | grep leaq
-; RUN: llvm-as < %s | llc -march=x86-64 -pre-RA-sched=none | not grep {,%rsp)}
+; RUN: llvm-as < %s | llc -march=x86-64 | grep leaq
+; RUN: llvm-as < %s | llc -march=x86-64 | not grep {,%rsp)}
; PR1103
target datalayout = "e-p:64:64"
From sabre at nondot.org Mon Oct 1 17:23:22 2007
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 1 Oct 2007 17:23:22 -0500
Subject: [llvm-commits] CVS: llvm-www/demo/DemoInfo.html index.cgi
Message-ID: <200710012223.l91MNMrG029180@zion.cs.uiuc.edu>
Changes in directory llvm-www/demo:
DemoInfo.html added (r1.1)
index.cgi updated: 1.78 -> 1.79
---
Log message:
move information about options out to a separate page.
---
Diffs of the changes: (+77 -21)
DemoInfo.html | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index.cgi | 32 +++++++++-------------------
2 files changed, 77 insertions(+), 21 deletions(-)
Index: llvm-www/demo/DemoInfo.html
diff -c /dev/null llvm-www/demo/DemoInfo.html:1.1
*** /dev/null Mon Oct 1 17:22:50 2007
--- llvm-www/demo/DemoInfo.html Mon Oct 1 17:22:39 2007
***************
*** 0 ****
--- 1,66 ----
+
+
+
+
+ Demo page information
+
+
+
+
+
+ Demo page information
+
+ Press "back" or click here to return to the demo
+ page.
+
+
+
+
+ Select this option if you want to run the output LLVM IR through "c++filt",
+ which converts 'mangled' C++ names to their unmangled version.
+ Note that LLVM code produced will not be lexically valid, but it will
+ be easier to understand.
+
+
+
+
+
+ Select this option to run the LLVM link-time optimizer, which is designed to
+ optimize across files in your application. Since the demo page doesn't allow
+ you to upload multiple files at once, and does not link in any libraries, we
+ configured the demo page optimizer to assume there are no calls
+ coming in from outside the source file, allowing it to optimize more
+ aggressively.
+
+ Note that you have to define 'main' in your program for this
+ to make much of a difference.
+
+
+
+
+
+ Select this option to enable compilation timings and statistics from various
+ optimizers.
+
+
+
+
+
+ Select this option to run the llvm-bcanalyzer tool
+ on the generated bytecode, which introspects into the format of the .bc file
+ itself.
+
+
+
+
+
+ Select this option to run the llvm2cpp tool
+ on the generated bytecode, which auto generates the C++ API calls that could
+ be used to create the .bc file.
+
+
+
+
+
Index: llvm-www/demo/index.cgi
diff -u llvm-www/demo/index.cgi:1.78 llvm-www/demo/index.cgi:1.79
--- llvm-www/demo/index.cgi:1.78 Mon Oct 1 14:36:08 2007
+++ llvm-www/demo/index.cgi Mon Oct 1 17:22:39 2007
@@ -10,7 +10,6 @@
$| = 1;
my $ROOT = "/tmp/webcompile";
-#my $ROOT = "/home/vadve/lattner/webcompile";
open( STDERR, ">&STDOUT" ) or die "can't redirect stderr to stdout";
@@ -175,6 +174,8 @@
# Start the user out with something valid if no code.
$source = $defaultsrc if (!defined($source));
+print '| ';
+
print $c->textarea(
-name => "source",
-rows => 16,
@@ -194,46 +195,35 @@
-default => 'C'
);
-print ' ';
-print ' | ';
+print '\n | ';
+
+print "Options";
print $c->checkbox(
-name => 'cxxdemangle',
-label => 'Demangle C++ names with c++filt'
- ),' | ';
-print
-" Click here if you want Bitter Melon to run the resulting code through c++filt. Warning, the LLVM code produced will probably not be lexically valid, but it will be easier to understand. | | ";
+ ),' ? ';
print $c->checkbox(
-name => 'linkopt',
-label => 'Run link-time optimizer',
-checked => 'checked'
- )," | ";
-print
-" Bitter Melon can also run the link-time optimizer for you, if you like (but she won't link your code with any libraries). Note that you have to define 'main' in your program for this to make much of a difference. ";
-print " | | ";
+ ),' ? ';
print $c->checkbox(
-name => 'showstats',
-label => 'Show detailed pass statistics'
- ), " | ";
-print
-" Would you believe that BitterMelon even has a stopwatch? Click here to get detailed compilation statistic and timings from each pass. ";
-print " | | ";
+ ), ' ? ';
print $c->checkbox(
-name => 'showbcanalysis',
-label => 'Show detailed bytecode analysis'
- )," | ";
-print " And further, the cat can even produce detailed information about the bytecode file generated! Click here to get a detailed description of the various artifacts in the bytecode file your program generates. ";
-
-print " | | ";
+ ),' ? ';
print $c->checkbox(
-name => 'showllvm2cpp',
- -label => 'Show corresponding LLVM C++ code'
- )," | ";
-print " And, BitterMelon, that fabulously talented cat can even turn your bytecode back into LLVM C++ that would produce the same bytecode! Click here to get a C++ program that generates the equivalent bytecode for your program by direct LLVM IR calls. ";
+ -label => 'Show LLVM C++ API code'
+ ), ' ?';
print " | ";
From djg at cray.com Mon Oct 1 17:40:21 2007
From: djg at cray.com (Dan Gohman)
Date: Mon, 01 Oct 2007 22:40:21 -0000
Subject: [llvm-commits] [llvm] r42506 -
/llvm/trunk/lib/CodeGen/DwarfWriter.cpp
Message-ID: <200710012240.l91MeLfI030394@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 1 17:40:20 2007
New Revision: 42506
URL: http://llvm.org/viewvc/llvm-project?rev=42506&view=rev
Log:
Move the code that emits the .file directives so that it runs after the
SourceFiles list is fully filled in so that it sees all of the files.
Modified:
llvm/trunk/lib/CodeGen/DwarfWriter.cpp
Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=42506&r1=42505&r2=42506&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Mon Oct 1 17:40:20 2007
@@ -1971,19 +1971,6 @@
if (didInitial) return;
didInitial = true;
- // Print out .file directives to specify files for .loc directives.
- if (TAI->hasDotLocAndDotFile()) {
- const UniqueVector &SourceFiles = MMI->getSourceFiles();
- const UniqueVector &Directories = MMI->getDirectories();
- for (unsigned i = 1, e = SourceFiles.size(); i <= e; ++i) {
- sys::Path FullPath(Directories[SourceFiles[i].getDirectoryID()]);
- bool AppendOk = FullPath.appendComponent(SourceFiles[i].getName());
- assert(AppendOk && "Could not append filename to directory!");
- Asm->EmitFile(i, FullPath.toString());
- Asm->EOL();
- }
- }
-
// Dwarf sections base addresses.
if (TAI->doesDwarfRequireFrameSection()) {
Asm->SwitchToDataSection(TAI->getDwarfFrameSection());
@@ -2626,9 +2613,6 @@
MMI = mmi;
shouldEmit = true;
- // Emit initial sections
- EmitInitial();
-
// Create all the compile unit DIEs.
ConstructCompileUnitDIEs();
@@ -2640,6 +2624,23 @@
// Prime section data.
SectionMap.insert(TAI->getTextSection());
+
+ // Print out .file directives to specify files for .loc directives. These
+ // are printed out early so that they precede any .loc directives.
+ if (TAI->hasDotLocAndDotFile()) {
+ const UniqueVector &SourceFiles = MMI->getSourceFiles();
+ const UniqueVector &Directories = MMI->getDirectories();
+ for (unsigned i = 1, e = SourceFiles.size(); i <= e; ++i) {
+ sys::Path FullPath(Directories[SourceFiles[i].getDirectoryID()]);
+ bool AppendOk = FullPath.appendComponent(SourceFiles[i].getName());
+ assert(AppendOk && "Could not append filename to directory!");
+ Asm->EmitFile(i, FullPath.toString());
+ Asm->EOL();
+ }
+ }
+
+ // Emit initial sections
+ EmitInitial();
}
}
From sabre at nondot.org Mon Oct 1 17:44:49 2007
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 1 Oct 2007 17:44:49 -0500
Subject: [llvm-commits] CVS: llvm-www/demo/DemoInfo.html index.cgi
Message-ID: <200710012244.l91Min4R030730@zion.cs.uiuc.edu>
Changes in directory llvm-www/demo:
DemoInfo.html updated: 1.1 -> 1.2
index.cgi updated: 1.79 -> 1.80
---
Log message:
Further clean up
---
Diffs of the changes: (+48 -39)
DemoInfo.html | 17 ++++++++++++++
index.cgi | 70 +++++++++++++++++++++++++---------------------------------
2 files changed, 48 insertions(+), 39 deletions(-)
Index: llvm-www/demo/DemoInfo.html
diff -u llvm-www/demo/DemoInfo.html:1.1 llvm-www/demo/DemoInfo.html:1.2
--- llvm-www/demo/DemoInfo.html:1.1 Mon Oct 1 17:22:39 2007
+++ llvm-www/demo/DemoInfo.html Mon Oct 1 17:44:25 2007
@@ -13,6 +13,23 @@
Press "back" or click here to return to the demo
page.
+
+
+
+- The generated LLVM code will be easier to read if
+you use stdio (e.g., printf) than iostreams (e.g., std::cout).
+
+- Unused inline functions and methods are not generated. Instead
+of 'class foo { void bar() {}};',
+try writing 'class foo { void bar(); }; void foo::bar() {}'.
+
+- If you want to try out a file that uses non-standard header files, you should
+ preprocess it (e.g., with the -save-temps or -E options to
+ gcc) then upload the result.
+
+
+
+
Index: llvm-www/demo/index.cgi
diff -u llvm-www/demo/index.cgi:1.79 llvm-www/demo/index.cgi:1.80
--- llvm-www/demo/index.cgi:1.79 Mon Oct 1 17:22:39 2007
+++ llvm-www/demo/index.cgi Mon Oct 1 17:44:25 2007
@@ -10,6 +10,7 @@
$| = 1;
my $ROOT = "/tmp/webcompile";
+#my $ROOT = "/home/vadve/lattner/webcompile";
open( STDERR, ">&STDOUT" ) or die "can't redirect stderr to stdout";
@@ -127,10 +128,6 @@
-
- The LLVM Compiler Infrastructure
-
-
Try out LLVM in your browser!
@@ -156,18 +153,12 @@
print <Bitter Melon the cat says, paste a C/C++ program in the text box or upload
- one from your computer, and you can see the equivalent LLVM code, meow!!
-
-If you want to try out a file that uses non-standard header files, you should
- preprocess it (e.g., with the -save-temps or -E options to
- gcc) then upload the result.
+ one from your computer, and you can see LLVM compile it, meow!!
END
print $c->start_multipart_form( 'POST', $FORM_URL );
-print "Type your source code in below: \n";
-
my $source = $c->param('source');
@@ -176,70 +167,71 @@
print '';
+print "Type your source code in below: (hints and
+advice) \n";
+
print $c->textarea(
-name => "source",
-rows => 16,
-columns => 60,
-default => $source
-);
+), " ";
-print "Or upload a file: ";
+print "Or upload a file: ";
print $c->filefield( -name => 'uploaded_file', -default => '' );
print " \n";
-print "By the way, what language is this code in?: ",
+
+print ' | ';
+
+print "General Options";
+
+print "Source language: ",
$c->radio_group(
-name => 'language',
-values => [ 'C', 'C++' ],
-default => 'C'
- );
-
-print '\n | ';
-
-print "Options";
-
-print $c->checkbox(
- -name => 'cxxdemangle',
- -label => 'Demangle C++ names with c++filt'
- ),' ?';
+ ), " ";
print $c->checkbox(
-name => 'linkopt',
-label => 'Run link-time optimizer',
-checked => 'checked'
- ),' ? ';
+ ),' ? ';
print $c->checkbox(
-name => 'showstats',
-label => 'Show detailed pass statistics'
- ), ' ? ';
+ ), ' ? ';
+
+print $c->checkbox(
+ -name => 'cxxdemangle',
+ -label => 'Demangle C++ names'
+ ),' ? ';
+
+
+print " Output Options";
print $c->checkbox(
-name => 'showbcanalysis',
-label => 'Show detailed bytecode analysis'
- ),' ?';
+ ),' ? ';
print $c->checkbox(
-name => 'showllvm2cpp',
-label => 'Show LLVM C++ API code'
- ), ' ? ';
+ ), ' ?';
print " | ";
-print "", $c->submit, "\n", $c->endform;
+print " ", $c->submit(-value=> 'Compile Source Code'),
+ "\n", $c->endform;
print "\nIf you have questions about the LLVM code generated by the
-front-end, please check the FAQ.
- If the FAQ does not address it, please
-send an email to the LLVMdev mailing
-list. \nHints: - The generated LLVM code will be easier to read if
-you use stdio (e.g., printf) than iostreams (e.g., std::cout).
-- Unused inline functions and methods are not generated. Instead
-of 'class foo { void bar() {}};',
-try writing 'class foo { void bar(); }; void foo::bar() {}'.
- \n";
+front-end, please check the FAQ and
+the demo page hints section.
+\n";
$ENV{'PATH'} = ( join ( ':', @PREPENDPATHDIRS ) ) . ":" . $ENV{'PATH'};
From sabre at nondot.org Mon Oct 1 17:52:27 2007
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 1 Oct 2007 17:52:27 -0500
Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi
Message-ID: <200710012252.l91MqRL4031243@zion.cs.uiuc.edu>
Changes in directory llvm-www/demo:
index.cgi updated: 1.80 -> 1.81
---
Log message:
minor reformating.
---
Diffs of the changes: (+9 -10)
index.cgi | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
Index: llvm-www/demo/index.cgi
diff -u llvm-www/demo/index.cgi:1.80 llvm-www/demo/index.cgi:1.81
--- llvm-www/demo/index.cgi:1.80 Mon Oct 1 17:44:25 2007
+++ llvm-www/demo/index.cgi Mon Oct 1 17:52:08 2007
@@ -131,19 +131,19 @@
Try out LLVM in your browser!
-EOF
-if ($LOGO_IMAGE_URL) {
- print " ";
-}
+
+
+ |
+EOF
if ( -f "$ROOT/locked" ) {
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$locktime) =
stat("$ROOT/locked");
my $currtime = time();
if ($locktime + 60 > $currtime) {
- print " Bitter Melon the cat says, 'this page is already in use by someone else at this ";
- print "time, try reloading in a second or two. Meow!' \n";
+ print "This page is already in use by someone else at this ";
+ print "time, try reloading in a second or two. Meow! | '\n";
exit 0;
}
}
@@ -151,10 +151,9 @@
system("touch $ROOT/locked");
print <Bitter Melon the cat says, paste a C/C++ program in the text box or upload
- one from your computer, and you can see LLVM compile it, meow!!
-
+Bitter Melon the cat says, paste a C/C++ program in the text box or upload
+one from your computer, and you can see LLVM compile it, meow!!
+ |
END
print $c->start_multipart_form( 'POST', $FORM_URL );
From dalej at apple.com Mon Oct 1 18:08:35 2007
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 01 Oct 2007 23:08:35 -0000
Subject: [llvm-commits] [llvm] r42508 - in /llvm/trunk/lib:
CodeGen/AsmPrinter.cpp CodeGen/SelectionDAG/SelectionDAGISel.cpp
Transforms/Scalar/LoopStrengthReduce.cpp
Message-ID: <200710012308.l91N8ZKS032108@zion.cs.uiuc.edu>
Author: johannes
Date: Mon Oct 1 18:08:35 2007
New Revision: 42508
URL: http://llvm.org/viewvc/llvm-project?rev=42508&view=rev
Log:
Fix stride computations for long double arrays.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=42508&r1=42507&r2=42508&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Oct 1 18:08:35 2007
@@ -816,8 +816,12 @@
if (CVA->isString()) {
EmitString(CVA);
} else { // Not a string. Print the values in successive locations
- for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i)
+ for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) {
EmitGlobalConstant(CVA->getOperand(i));
+ const Type* EltTy = CVA->getType()->getElementType();
+ uint64_t padSize = TD->getABITypeSize(EltTy) - TD->getTypeSize(EltTy);
+ EmitZeros(padSize);
+ }
}
return;
} else if (const ConstantStruct *CVS = dyn_cast(CV)) {
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=42508&r1=42507&r2=42508&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Oct 1 18:08:35 2007
@@ -2279,13 +2279,13 @@
if (ConstantInt *CI = dyn_cast(Idx)) {
if (CI->getZExtValue() == 0) continue;
uint64_t Offs =
- TD->getTypeSize(Ty)*cast(CI)->getSExtValue();
+ TD->getABITypeSize(Ty)*cast(CI)->getSExtValue();
N = DAG.getNode(ISD::ADD, N.getValueType(), N, getIntPtrConstant(Offs));
continue;
}
// N = N + Idx * ElementSize;
- uint64_t ElementSize = TD->getTypeSize(Ty);
+ uint64_t ElementSize = TD->getABITypeSize(Ty);
SDOperand IdxN = getValue(Idx);
// If the index is smaller or larger than intptr_t, truncate or extend
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=42508&r1=42507&r2=42508&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Oct 1 18:08:35 2007
@@ -286,7 +286,7 @@
Value *OpVal = getCastedVersionOf(opcode, GEP->getOperand(i));
SCEVHandle Idx = SE->getSCEV(OpVal);
- uint64_t TypeSize = TD->getTypeSize(GTI.getIndexedType());
+ uint64_t TypeSize = TD->getABITypeSize(GTI.getIndexedType());
if (TypeSize != 1)
Idx = SCEVMulExpr::get(Idx,
SCEVConstant::get(ConstantInt::get(UIntPtrTy,
From evan.cheng at apple.com Mon Oct 1 18:44:33 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 01 Oct 2007 23:44:33 -0000
Subject: [llvm-commits] [llvm] r42509 - in /llvm/trunk/lib/Target/X86:
X86RegisterInfo.cpp X86RegisterInfo.h
Message-ID: <200710012344.l91NiYBe001006@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 1 18:44:33 2007
New Revision: 42509
URL: http://llvm.org/viewvc/llvm-project?rev=42509&view=rev
Log:
Refactor code to add load / store folded instructions -> register only
instructions reverse map.
Modified:
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.h
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=42509&r1=42508&r2=42509&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Mon Oct 1 18:44:33 2007
@@ -63,6 +63,577 @@
StackPtr = X86::ESP;
FramePtr = X86::EBP;
}
+
+ SmallVector AmbEntries;
+ static const unsigned OpTbl2Addr[][2] = {
+ { X86::ADC32ri, X86::ADC32mi },
+ { X86::ADC32ri8, X86::ADC32mi8 },
+ { X86::ADC32rr, X86::ADC32mr },
+ { X86::ADC64ri32, X86::ADC64mi32 },
+ { X86::ADC64ri8, X86::ADC64mi8 },
+ { X86::ADC64rr, X86::ADC64mr },
+ { X86::ADD16ri, X86::ADD16mi },
+ { X86::ADD16ri8, X86::ADD16mi8 },
+ { X86::ADD16rr, X86::ADD16mr },
+ { X86::ADD32ri, X86::ADD32mi },
+ { X86::ADD32ri8, X86::ADD32mi8 },
+ { X86::ADD32rr, X86::ADD32mr },
+ { X86::ADD64ri32, X86::ADD64mi32 },
+ { X86::ADD64ri8, X86::ADD64mi8 },
+ { X86::ADD64rr, X86::ADD64mr },
+ { X86::ADD8ri, X86::ADD8mi },
+ { X86::ADD8rr, X86::ADD8mr },
+ { X86::AND16ri, X86::AND16mi },
+ { X86::AND16ri8, X86::AND16mi8 },
+ { X86::AND16rr, X86::AND16mr },
+ { X86::AND32ri, X86::AND32mi },
+ { X86::AND32ri8, X86::AND32mi8 },
+ { X86::AND32rr, X86::AND32mr },
+ { X86::AND64ri32, X86::AND64mi32 },
+ { X86::AND64ri8, X86::AND64mi8 },
+ { X86::AND64rr, X86::AND64mr },
+ { X86::AND8ri, X86::AND8mi },
+ { X86::AND8rr, X86::AND8mr },
+ { X86::DEC16r, X86::DEC16m },
+ { X86::DEC32r, X86::DEC32m },
+ { X86::DEC64_16r, X86::DEC16m },
+ { X86::DEC64_32r, X86::DEC32m },
+ { X86::DEC64r, X86::DEC64m },
+ { X86::DEC8r, X86::DEC8m },
+ { X86::INC16r, X86::INC16m },
+ { X86::INC32r, X86::INC32m },
+ { X86::INC64_16r, X86::INC16m },
+ { X86::INC64_32r, X86::INC32m },
+ { X86::INC64r, X86::INC64m },
+ { X86::INC8r, X86::INC8m },
+ { X86::NEG16r, X86::NEG16m },
+ { X86::NEG32r, X86::NEG32m },
+ { X86::NEG64r, X86::NEG64m },
+ { X86::NEG8r, X86::NEG8m },
+ { X86::NOT16r, X86::NOT16m },
+ { X86::NOT32r, X86::NOT32m },
+ { X86::NOT64r, X86::NOT64m },
+ { X86::NOT8r, X86::NOT8m },
+ { X86::OR16ri, X86::OR16mi },
+ { X86::OR16ri8, X86::OR16mi8 },
+ { X86::OR16rr, X86::OR16mr },
+ { X86::OR32ri, X86::OR32mi },
+ { X86::OR32ri8, X86::OR32mi8 },
+ { X86::OR32rr, X86::OR32mr },
+ { X86::OR64ri32, X86::OR64mi32 },
+ { X86::OR64ri8, X86::OR64mi8 },
+ { X86::OR64rr, X86::OR64mr },
+ { X86::OR8ri, X86::OR8mi },
+ { X86::OR8rr, X86::OR8mr },
+ { X86::ROL16r1, X86::ROL16m1 },
+ { X86::ROL16rCL, X86::ROL16mCL },
+ { X86::ROL16ri, X86::ROL16mi },
+ { X86::ROL32r1, X86::ROL32m1 },
+ { X86::ROL32rCL, X86::ROL32mCL },
+ { X86::ROL32ri, X86::ROL32mi },
+ { X86::ROL64r1, X86::ROL64m1 },
+ { X86::ROL64rCL, X86::ROL64mCL },
+ { X86::ROL64ri, X86::ROL64mi },
+ { X86::ROL8r1, X86::ROL8m1 },
+ { X86::ROL8rCL, X86::ROL8mCL },
+ { X86::ROL8ri, X86::ROL8mi },
+ { X86::ROR16r1, X86::ROR16m1 },
+ { X86::ROR16rCL, X86::ROR16mCL },
+ { X86::ROR16ri, X86::ROR16mi },
+ { X86::ROR32r1, X86::ROR32m1 },
+ { X86::ROR32rCL, X86::ROR32mCL },
+ { X86::ROR32ri, X86::ROR32mi },
+ { X86::ROR64r1, X86::ROR64m1 },
+ { X86::ROR64rCL, X86::ROR64mCL },
+ { X86::ROR64ri, X86::ROR64mi },
+ { X86::ROR8r1, X86::ROR8m1 },
+ { X86::ROR8rCL, X86::ROR8mCL },
+ { X86::ROR8ri, X86::ROR8mi },
+ { X86::SAR16r1, X86::SAR16m1 },
+ { X86::SAR16rCL, X86::SAR16mCL },
+ { X86::SAR16ri, X86::SAR16mi },
+ { X86::SAR32r1, X86::SAR32m1 },
+ { X86::SAR32rCL, X86::SAR32mCL },
+ { X86::SAR32ri, X86::SAR32mi },
+ { X86::SAR64r1, X86::SAR64m1 },
+ { X86::SAR64rCL, X86::SAR64mCL },
+ { X86::SAR64ri, X86::SAR64mi },
+ { X86::SAR8r1, X86::SAR8m1 },
+ { X86::SAR8rCL, X86::SAR8mCL },
+ { X86::SAR8ri, X86::SAR8mi },
+ { X86::SBB32ri, X86::SBB32mi },
+ { X86::SBB32ri8, X86::SBB32mi8 },
+ { X86::SBB32rr, X86::SBB32mr },
+ { X86::SBB64ri32, X86::SBB64mi32 },
+ { X86::SBB64ri8, X86::SBB64mi8 },
+ { X86::SBB64rr, X86::SBB64mr },
+ { X86::SHL16r1, X86::SHL16m1 },
+ { X86::SHL16rCL, X86::SHL16mCL },
+ { X86::SHL16ri, X86::SHL16mi },
+ { X86::SHL32r1, X86::SHL32m1 },
+ { X86::SHL32rCL, X86::SHL32mCL },
+ { X86::SHL32ri, X86::SHL32mi },
+ { X86::SHL64r1, X86::SHL64m1 },
+ { X86::SHL64rCL, X86::SHL64mCL },
+ { X86::SHL64ri, X86::SHL64mi },
+ { X86::SHL8r1, X86::SHL8m1 },
+ { X86::SHL8rCL, X86::SHL8mCL },
+ { X86::SHL8ri, X86::SHL8mi },
+ { X86::SHLD16rrCL, X86::SHLD16mrCL },
+ { X86::SHLD16rri8, X86::SHLD16mri8 },
+ { X86::SHLD32rrCL, X86::SHLD32mrCL },
+ { X86::SHLD32rri8, X86::SHLD32mri8 },
+ { X86::SHLD64rrCL, X86::SHLD64mrCL },
+ { X86::SHLD64rri8, X86::SHLD64mri8 },
+ { X86::SHR16r1, X86::SHR16m1 },
+ { X86::SHR16rCL, X86::SHR16mCL },
+ { X86::SHR16ri, X86::SHR16mi },
+ { X86::SHR32r1, X86::SHR32m1 },
+ { X86::SHR32rCL, X86::SHR32mCL },
+ { X86::SHR32ri, X86::SHR32mi },
+ { X86::SHR64r1, X86::SHR64m1 },
+ { X86::SHR64rCL, X86::SHR64mCL },
+ { X86::SHR64ri, X86::SHR64mi },
+ { X86::SHR8r1, X86::SHR8m1 },
+ { X86::SHR8rCL, X86::SHR8mCL },
+ { X86::SHR8ri, X86::SHR8mi },
+ { X86::SHRD16rrCL, X86::SHRD16mrCL },
+ { X86::SHRD16rri8, X86::SHRD16mri8 },
+ { X86::SHRD32rrCL, X86::SHRD32mrCL },
+ { X86::SHRD32rri8, X86::SHRD32mri8 },
+ { X86::SHRD64rrCL, X86::SHRD64mrCL },
+ { X86::SHRD64rri8, X86::SHRD64mri8 },
+ { X86::SUB16ri, X86::SUB16mi },
+ { X86::SUB16ri8, X86::SUB16mi8 },
+ { X86::SUB16rr, X86::SUB16mr },
+ { X86::SUB32ri, X86::SUB32mi },
+ { X86::SUB32ri8, X86::SUB32mi8 },
+ { X86::SUB32rr, X86::SUB32mr },
+ { X86::SUB64ri32, X86::SUB64mi32 },
+ { X86::SUB64ri8, X86::SUB64mi8 },
+ { X86::SUB64rr, X86::SUB64mr },
+ { X86::SUB8ri, X86::SUB8mi },
+ { X86::SUB8rr, X86::SUB8mr },
+ { X86::XOR16ri, X86::XOR16mi },
+ { X86::XOR16ri8, X86::XOR16mi8 },
+ { X86::XOR16rr, X86::XOR16mr },
+ { X86::XOR32ri, X86::XOR32mi },
+ { X86::XOR32ri8, X86::XOR32mi8 },
+ { X86::XOR32rr, X86::XOR32mr },
+ { X86::XOR64ri32, X86::XOR64mi32 },
+ { X86::XOR64ri8, X86::XOR64mi8 },
+ { X86::XOR64rr, X86::XOR64mr },
+ { X86::XOR8ri, X86::XOR8mi },
+ { X86::XOR8rr, X86::XOR8mr }
+ };
+
+ for (unsigned i = 0, e = array_lengthof(OpTbl2Addr); i != e; ++i) {
+ unsigned RegOp = OpTbl2Addr[i][0];
+ unsigned MemOp = OpTbl2Addr[i][1];
+ if (!RegOp2MemOpTable2Addr.insert(std::make_pair((unsigned*)RegOp, MemOp)))
+ assert(false && "Duplicated entries?");
+ if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, RegOp)))
+ AmbEntries.push_back(MemOp);
+ }
+
+ static const unsigned OpTbl0[][2] = {
+ { X86::CALL32r, X86::CALL32m },
+ { X86::CALL64r, X86::CALL64m },
+ { X86::CMP16ri, X86::CMP16mi },
+ { X86::CMP16ri8, X86::CMP16mi8 },
+ { X86::CMP32ri, X86::CMP32mi },
+ { X86::CMP32ri8, X86::CMP32mi8 },
+ { X86::CMP64ri32, X86::CMP64mi32 },
+ { X86::CMP64ri8, X86::CMP64mi8 },
+ { X86::CMP8ri, X86::CMP8mi },
+ { X86::DIV16r, X86::DIV16m },
+ { X86::DIV32r, X86::DIV32m },
+ { X86::DIV64r, X86::DIV64m },
+ { X86::DIV8r, X86::DIV8m },
+ { X86::FsMOVAPDrr, X86::MOVSDmr },
+ { X86::FsMOVAPSrr, X86::MOVSSmr },
+ { X86::IDIV16r, X86::IDIV16m },
+ { X86::IDIV32r, X86::IDIV32m },
+ { X86::IDIV64r, X86::IDIV64m },
+ { X86::IDIV8r, X86::IDIV8m },
+ { X86::IMUL16r, X86::IMUL16m },
+ { X86::IMUL32r, X86::IMUL32m },
+ { X86::IMUL64r, X86::IMUL64m },
+ { X86::IMUL8r, X86::IMUL8m },
+ { X86::JMP32r, X86::JMP32m },
+ { X86::JMP64r, X86::JMP64m },
+ { X86::MOV16ri, X86::MOV16mi },
+ { X86::MOV16rr, X86::MOV16mr },
+ { X86::MOV32ri, X86::MOV32mi },
+ { X86::MOV32rr, X86::MOV32mr },
+ { X86::MOV64ri32, X86::MOV64mi32 },
+ { X86::MOV64rr, X86::MOV64mr },
+ { X86::MOV8ri, X86::MOV8mi },
+ { X86::MOV8rr, X86::MOV8mr },
+ { X86::MOVAPDrr, X86::MOVAPDmr },
+ { X86::MOVAPSrr, X86::MOVAPSmr },
+ { X86::MOVPDI2DIrr, X86::MOVPDI2DImr },
+ { X86::MOVPQIto64rr,X86::MOVPQIto64mr },
+ { X86::MOVPS2SSrr, X86::MOVPS2SSmr },
+ { X86::MOVSDrr, X86::MOVSDmr },
+ { X86::MOVSDto64rr, X86::MOVSDto64mr },
+ { X86::MOVSS2DIrr, X86::MOVSS2DImr },
+ { X86::MOVSSrr, X86::MOVSSmr },
+ { X86::MOVUPDrr, X86::MOVUPDmr },
+ { X86::MOVUPSrr, X86::MOVUPSmr },
+ { X86::MUL16r, X86::MUL16m },
+ { X86::MUL32r, X86::MUL32m },
+ { X86::MUL64r, X86::MUL64m },
+ { X86::MUL8r, X86::MUL8m },
+ { X86::SETAEr, X86::SETAEm },
+ { X86::SETAr, X86::SETAm },
+ { X86::SETBEr, X86::SETBEm },
+ { X86::SETBr, X86::SETBm },
+ { X86::SETEr, X86::SETEm },
+ { X86::SETGEr, X86::SETGEm },
+ { X86::SETGr, X86::SETGm },
+ { X86::SETLEr, X86::SETLEm },
+ { X86::SETLr, X86::SETLm },
+ { X86::SETNEr, X86::SETNEm },
+ { X86::SETNPr, X86::SETNPm },
+ { X86::SETNSr, X86::SETNSm },
+ { X86::SETPr, X86::SETPm },
+ { X86::SETSr, X86::SETSm },
+ { X86::TAILJMPr, X86::TAILJMPm },
+ { X86::TEST16ri, X86::TEST16mi },
+ { X86::TEST32ri, X86::TEST32mi },
+ { X86::TEST64ri32, X86::TEST64mi32 },
+ { X86::TEST8ri, X86::TEST8mi },
+ { X86::XCHG16rr, X86::XCHG16mr },
+ { X86::XCHG32rr, X86::XCHG32mr },
+ { X86::XCHG64rr, X86::XCHG64mr },
+ { X86::XCHG8rr, X86::XCHG8mr }
+ };
+
+ for (unsigned i = 0, e = array_lengthof(OpTbl0); i != e; ++i) {
+ unsigned RegOp = OpTbl0[i][0];
+ unsigned MemOp = OpTbl0[i][1];
+ if (!RegOp2MemOpTable0.insert(std::make_pair((unsigned*)RegOp, MemOp)))
+ assert(false && "Duplicated entries?");
+ if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, RegOp)))
+ AmbEntries.push_back(MemOp);
+ }
+
+ static const unsigned OpTbl1[][2] = {
+ { X86::CMP16rr, X86::CMP16rm },
+ { X86::CMP32rr, X86::CMP32rm },
+ { X86::CMP64rr, X86::CMP64rm },
+ { X86::CMP8rr, X86::CMP8rm },
+ { X86::CVTSD2SSrr, X86::CVTSD2SSrm },
+ { X86::CVTSI2SD64rr, X86::CVTSI2SD64rm },
+ { X86::CVTSI2SDrr, X86::CVTSI2SDrm },
+ { X86::CVTSI2SS64rr, X86::CVTSI2SS64rm },
+ { X86::CVTSI2SSrr, X86::CVTSI2SSrm },
+ { X86::CVTSS2SDrr, X86::CVTSS2SDrm },
+ { X86::CVTTSD2SI64rr, X86::CVTTSD2SI64rm },
+ { X86::CVTTSD2SIrr, X86::CVTTSD2SIrm },
+ { X86::CVTTSS2SI64rr, X86::CVTTSS2SI64rm },
+ { X86::CVTTSS2SIrr, X86::CVTTSS2SIrm },
+ { X86::FsMOVAPDrr, X86::MOVSDrm },
+ { X86::FsMOVAPSrr, X86::MOVSSrm },
+ { X86::IMUL16rri, X86::IMUL16rmi },
+ { X86::IMUL16rri8, X86::IMUL16rmi8 },
+ { X86::IMUL32rri, X86::IMUL32rmi },
+ { X86::IMUL32rri8, X86::IMUL32rmi8 },
+ { X86::IMUL64rri32, X86::IMUL64rmi32 },
+ { X86::IMUL64rri8, X86::IMUL64rmi8 },
+ { X86::Int_CMPSDrr, X86::Int_CMPSDrm },
+ { X86::Int_CMPSSrr, X86::Int_CMPSSrm },
+ { X86::Int_COMISDrr, X86::Int_COMISDrm },
+ { X86::Int_COMISSrr, X86::Int_COMISSrm },
+ { X86::Int_CVTDQ2PDrr, X86::Int_CVTDQ2PDrm },
+ { X86::Int_CVTDQ2PSrr, X86::Int_CVTDQ2PSrm },
+ { X86::Int_CVTPD2DQrr, X86::Int_CVTPD2DQrm },
+ { X86::Int_CVTPD2PSrr, X86::Int_CVTPD2PSrm },
+ { X86::Int_CVTPS2DQrr, X86::Int_CVTPS2DQrm },
+ { X86::Int_CVTPS2PDrr, X86::Int_CVTPS2PDrm },
+ { X86::Int_CVTSD2SI64rr,X86::Int_CVTSD2SI64rm },
+ { X86::Int_CVTSD2SIrr, X86::Int_CVTSD2SIrm },
+ { X86::Int_CVTSD2SSrr, X86::Int_CVTSD2SSrm },
+ { X86::Int_CVTSI2SD64rr,X86::Int_CVTSI2SD64rm },
+ { X86::Int_CVTSI2SDrr, X86::Int_CVTSI2SDrm },
+ { X86::Int_CVTSI2SS64rr,X86::Int_CVTSI2SS64rm },
+ { X86::Int_CVTSI2SSrr, X86::Int_CVTSI2SSrm },
+ { X86::Int_CVTSS2SDrr, X86::Int_CVTSS2SDrm },
+ { X86::Int_CVTSS2SI64rr,X86::Int_CVTSS2SI64rm },
+ { X86::Int_CVTSS2SIrr, X86::Int_CVTSS2SIrm },
+ { X86::Int_CVTTPD2DQrr, X86::Int_CVTTPD2DQrm },
+ { X86::Int_CVTTPS2DQrr, X86::Int_CVTTPS2DQrm },
+ { X86::Int_CVTTSD2SI64rr,X86::Int_CVTTSD2SI64rm },
+ { X86::Int_CVTTSD2SIrr, X86::Int_CVTTSD2SIrm },
+ { X86::Int_CVTTSS2SI64rr,X86::Int_CVTTSS2SI64rm },
+ { X86::Int_CVTTSS2SIrr, X86::Int_CVTTSS2SIrm },
+ { X86::Int_UCOMISDrr, X86::Int_UCOMISDrm },
+ { X86::Int_UCOMISSrr, X86::Int_UCOMISSrm },
+ { X86::MOV16rr, X86::MOV16rm },
+ { X86::MOV32rr, X86::MOV32rm },
+ { X86::MOV64rr, X86::MOV64rm },
+ { X86::MOV64toPQIrr, X86::MOV64toPQIrm },
+ { X86::MOV64toSDrr, X86::MOV64toSDrm },
+ { X86::MOV8rr, X86::MOV8rm },
+ { X86::MOVAPDrr, X86::MOVAPDrm },
+ { X86::MOVAPSrr, X86::MOVAPSrm },
+ { X86::MOVDDUPrr, X86::MOVDDUPrm },
+ { X86::MOVDI2PDIrr, X86::MOVDI2PDIrm },
+ { X86::MOVDI2SSrr, X86::MOVDI2SSrm },
+ { X86::MOVSD2PDrr, X86::MOVSD2PDrm },
+ { X86::MOVSDrr, X86::MOVSDrm },
+ { X86::MOVSHDUPrr, X86::MOVSHDUPrm },
+ { X86::MOVSLDUPrr, X86::MOVSLDUPrm },
+ { X86::MOVSS2PSrr, X86::MOVSS2PSrm },
+ { X86::MOVSSrr, X86::MOVSSrm },
+ { X86::MOVSX16rr8, X86::MOVSX16rm8 },
+ { X86::MOVSX32rr16, X86::MOVSX32rm16 },
+ { X86::MOVSX32rr8, X86::MOVSX32rm8 },
+ { X86::MOVSX64rr16, X86::MOVSX64rm16 },
+ { X86::MOVSX64rr32, X86::MOVSX64rm32 },
+ { X86::MOVSX64rr8, X86::MOVSX64rm8 },
+ { X86::MOVUPDrr, X86::MOVUPDrm },
+ { X86::MOVUPSrr, X86::MOVUPSrm },
+ { X86::MOVZX16rr8, X86::MOVZX16rm8 },
+ { X86::MOVZX32rr16, X86::MOVZX32rm16 },
+ { X86::MOVZX32rr8, X86::MOVZX32rm8 },
+ { X86::MOVZX64rr16, X86::MOVZX64rm16 },
+ { X86::MOVZX64rr8, X86::MOVZX64rm8 },
+ { X86::PSHUFDri, X86::PSHUFDmi },
+ { X86::PSHUFHWri, X86::PSHUFHWmi },
+ { X86::PSHUFLWri, X86::PSHUFLWmi },
+ { X86::PsMOVZX64rr32, X86::PsMOVZX64rm32 },
+ { X86::RCPPSr, X86::RCPPSm },
+ { X86::RCPPSr_Int, X86::RCPPSm_Int },
+ { X86::RSQRTPSr, X86::RSQRTPSm },
+ { X86::RSQRTPSr_Int, X86::RSQRTPSm_Int },
+ { X86::RSQRTSSr, X86::RSQRTSSm },
+ { X86::RSQRTSSr_Int, X86::RSQRTSSm_Int },
+ { X86::SQRTPDr, X86::SQRTPDm },
+ { X86::SQRTPDr_Int, X86::SQRTPDm_Int },
+ { X86::SQRTPSr, X86::SQRTPSm },
+ { X86::SQRTPSr_Int, X86::SQRTPSm_Int },
+ { X86::SQRTSDr, X86::SQRTSDm },
+ { X86::SQRTSDr_Int, X86::SQRTSDm_Int },
+ { X86::SQRTSSr, X86::SQRTSSm },
+ { X86::SQRTSSr_Int, X86::SQRTSSm_Int },
+ { X86::TEST16rr, X86::TEST16rm },
+ { X86::TEST32rr, X86::TEST32rm },
+ { X86::TEST64rr, X86::TEST64rm },
+ { X86::TEST8rr, X86::TEST8rm },
+ // FIXME: TEST*rr EAX,EAX ---> CMP [mem], 0
+ { X86::UCOMISDrr, X86::UCOMISDrm },
+ { X86::UCOMISSrr, X86::UCOMISSrm },
+ { X86::XCHG16rr, X86::XCHG16rm },
+ { X86::XCHG32rr, X86::XCHG32rm },
+ { X86::XCHG64rr, X86::XCHG64rm },
+ { X86::XCHG8rr, X86::XCHG8rm }
+ };
+
+ for (unsigned i = 0, e = array_lengthof(OpTbl1); i != e; ++i) {
+ unsigned RegOp = OpTbl1[i][0];
+ unsigned MemOp = OpTbl1[i][1];
+ if (!RegOp2MemOpTable1.insert(std::make_pair((unsigned*)RegOp, MemOp)))
+ assert(false && "Duplicated entries?");
+ if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, RegOp)))
+ AmbEntries.push_back(MemOp);
+ }
+
+ static const unsigned OpTbl2[][2] = {
+ { X86::ADC32rr, X86::ADC32rm },
+ { X86::ADC64rr, X86::ADC64rm },
+ { X86::ADD16rr, X86::ADD16rm },
+ { X86::ADD32rr, X86::ADD32rm },
+ { X86::ADD64rr, X86::ADD64rm },
+ { X86::ADD8rr, X86::ADD8rm },
+ { X86::ADDPDrr, X86::ADDPDrm },
+ { X86::ADDPSrr, X86::ADDPSrm },
+ { X86::ADDSDrr, X86::ADDSDrm },
+ { X86::ADDSSrr, X86::ADDSSrm },
+ { X86::ADDSUBPDrr, X86::ADDSUBPDrm },
+ { X86::ADDSUBPSrr, X86::ADDSUBPSrm },
+ { X86::AND16rr, X86::AND16rm },
+ { X86::AND32rr, X86::AND32rm },
+ { X86::AND64rr, X86::AND64rm },
+ { X86::AND8rr, X86::AND8rm },
+ { X86::ANDNPDrr, X86::ANDNPDrm },
+ { X86::ANDNPSrr, X86::ANDNPSrm },
+ { X86::ANDPDrr, X86::ANDPDrm },
+ { X86::ANDPSrr, X86::ANDPSrm },
+ { X86::CMOVA16rr, X86::CMOVA16rm },
+ { X86::CMOVA32rr, X86::CMOVA32rm },
+ { X86::CMOVA64rr, X86::CMOVA64rm },
+ { X86::CMOVAE16rr, X86::CMOVAE16rm },
+ { X86::CMOVAE32rr, X86::CMOVAE32rm },
+ { X86::CMOVAE64rr, X86::CMOVAE64rm },
+ { X86::CMOVB16rr, X86::CMOVB16rm },
+ { X86::CMOVB32rr, X86::CMOVB32rm },
+ { X86::CMOVB64rr, X86::CMOVB64rm },
+ { X86::CMOVBE16rr, X86::CMOVBE16rm },
+ { X86::CMOVBE32rr, X86::CMOVBE32rm },
+ { X86::CMOVBE64rr, X86::CMOVBE64rm },
+ { X86::CMOVE16rr, X86::CMOVE16rm },
+ { X86::CMOVE32rr, X86::CMOVE32rm },
+ { X86::CMOVE64rr, X86::CMOVE64rm },
+ { X86::CMOVG16rr, X86::CMOVG16rm },
+ { X86::CMOVG32rr, X86::CMOVG32rm },
+ { X86::CMOVG64rr, X86::CMOVG64rm },
+ { X86::CMOVGE16rr, X86::CMOVGE16rm },
+ { X86::CMOVGE32rr, X86::CMOVGE32rm },
+ { X86::CMOVGE64rr, X86::CMOVGE64rm },
+ { X86::CMOVL16rr, X86::CMOVL16rm },
+ { X86::CMOVL32rr, X86::CMOVL32rm },
+ { X86::CMOVL64rr, X86::CMOVL64rm },
+ { X86::CMOVLE16rr, X86::CMOVLE16rm },
+ { X86::CMOVLE32rr, X86::CMOVLE32rm },
+ { X86::CMOVLE64rr, X86::CMOVLE64rm },
+ { X86::CMOVNE16rr, X86::CMOVNE16rm },
+ { X86::CMOVNE32rr, X86::CMOVNE32rm },
+ { X86::CMOVNE64rr, X86::CMOVNE64rm },
+ { X86::CMOVNP16rr, X86::CMOVNP16rm },
+ { X86::CMOVNP32rr, X86::CMOVNP32rm },
+ { X86::CMOVNP64rr, X86::CMOVNP64rm },
+ { X86::CMOVNS16rr, X86::CMOVNS16rm },
+ { X86::CMOVNS32rr, X86::CMOVNS32rm },
+ { X86::CMOVNS64rr, X86::CMOVNS64rm },
+ { X86::CMOVP16rr, X86::CMOVP16rm },
+ { X86::CMOVP32rr, X86::CMOVP32rm },
+ { X86::CMOVP64rr, X86::CMOVP64rm },
+ { X86::CMOVS16rr, X86::CMOVS16rm },
+ { X86::CMOVS32rr, X86::CMOVS32rm },
+ { X86::CMOVS64rr, X86::CMOVS64rm },
+ { X86::CMPPDrri, X86::CMPPDrmi },
+ { X86::CMPPSrri, X86::CMPPSrmi },
+ { X86::CMPSDrr, X86::CMPSDrm },
+ { X86::CMPSSrr, X86::CMPSSrm },
+ { X86::DIVPDrr, X86::DIVPDrm },
+ { X86::DIVPSrr, X86::DIVPSrm },
+ { X86::DIVSDrr, X86::DIVSDrm },
+ { X86::DIVSSrr, X86::DIVSSrm },
+ { X86::HADDPDrr, X86::HADDPDrm },
+ { X86::HADDPSrr, X86::HADDPSrm },
+ { X86::HSUBPDrr, X86::HSUBPDrm },
+ { X86::HSUBPSrr, X86::HSUBPSrm },
+ { X86::IMUL16rr, X86::IMUL16rm },
+ { X86::IMUL32rr, X86::IMUL32rm },
+ { X86::IMUL64rr, X86::IMUL64rm },
+ { X86::MAXPDrr, X86::MAXPDrm },
+ { X86::MAXPDrr_Int, X86::MAXPDrm_Int },
+ { X86::MAXPSrr, X86::MAXPSrm },
+ { X86::MAXPSrr_Int, X86::MAXPSrm_Int },
+ { X86::MAXSDrr, X86::MAXSDrm },
+ { X86::MAXSDrr_Int, X86::MAXSDrm_Int },
+ { X86::MAXSSrr, X86::MAXSSrm },
+ { X86::MAXSSrr_Int, X86::MAXSSrm_Int },
+ { X86::MINPDrr, X86::MINPDrm },
+ { X86::MINPDrr_Int, X86::MINPDrm_Int },
+ { X86::MINPSrr, X86::MINPSrm },
+ { X86::MINPSrr_Int, X86::MINPSrm_Int },
+ { X86::MINSDrr, X86::MINSDrm },
+ { X86::MINSDrr_Int, X86::MINSDrm_Int },
+ { X86::MINSSrr, X86::MINSSrm },
+ { X86::MINSSrr_Int, X86::MINSSrm_Int },
+ { X86::MULPDrr, X86::MULPDrm },
+ { X86::MULPSrr, X86::MULPSrm },
+ { X86::MULSDrr, X86::MULSDrm },
+ { X86::MULSSrr, X86::MULSSrm },
+ { X86::OR16rr, X86::OR16rm },
+ { X86::OR32rr, X86::OR32rm },
+ { X86::OR64rr, X86::OR64rm },
+ { X86::OR8rr, X86::OR8rm },
+ { X86::ORPDrr, X86::ORPDrm },
+ { X86::ORPSrr, X86::ORPSrm },
+ { X86::PACKSSDWrr, X86::PACKSSDWrm },
+ { X86::PACKSSWBrr, X86::PACKSSWBrm },
+ { X86::PACKUSWBrr, X86::PACKUSWBrm },
+ { X86::PADDBrr, X86::PADDBrm },
+ { X86::PADDDrr, X86::PADDDrm },
+ { X86::PADDQrr, X86::PADDQrm },
+ { X86::PADDSBrr, X86::PADDSBrm },
+ { X86::PADDSWrr, X86::PADDSWrm },
+ { X86::PADDWrr, X86::PADDWrm },
+ { X86::PANDNrr, X86::PANDNrm },
+ { X86::PANDrr, X86::PANDrm },
+ { X86::PAVGBrr, X86::PAVGBrm },
+ { X86::PAVGWrr, X86::PAVGWrm },
+ { X86::PCMPEQBrr, X86::PCMPEQBrm },
+ { X86::PCMPEQDrr, X86::PCMPEQDrm },
+ { X86::PCMPEQWrr, X86::PCMPEQWrm },
+ { X86::PCMPGTBrr, X86::PCMPGTBrm },
+ { X86::PCMPGTDrr, X86::PCMPGTDrm },
+ { X86::PCMPGTWrr, X86::PCMPGTWrm },
+ { X86::PINSRWrri, X86::PINSRWrmi },
+ { X86::PMADDWDrr, X86::PMADDWDrm },
+ { X86::PMAXSWrr, X86::PMAXSWrm },
+ { X86::PMAXUBrr, X86::PMAXUBrm },
+ { X86::PMINSWrr, X86::PMINSWrm },
+ { X86::PMINUBrr, X86::PMINUBrm },
+ { X86::PMULHUWrr, X86::PMULHUWrm },
+ { X86::PMULHWrr, X86::PMULHWrm },
+ { X86::PMULLWrr, X86::PMULLWrm },
+ { X86::PMULUDQrr, X86::PMULUDQrm },
+ { X86::PORrr, X86::PORrm },
+ { X86::PSADBWrr, X86::PSADBWrm },
+ { X86::PSLLDrr, X86::PSLLDrm },
+ { X86::PSLLQrr, X86::PSLLQrm },
+ { X86::PSLLWrr, X86::PSLLWrm },
+ { X86::PSRADrr, X86::PSRADrm },
+ { X86::PSRAWrr, X86::PSRAWrm },
+ { X86::PSRLDrr, X86::PSRLDrm },
+ { X86::PSRLQrr, X86::PSRLQrm },
+ { X86::PSRLWrr, X86::PSRLWrm },
+ { X86::PSUBBrr, X86::PSUBBrm },
+ { X86::PSUBDrr, X86::PSUBDrm },
+ { X86::PSUBSBrr, X86::PSUBSBrm },
+ { X86::PSUBSWrr, X86::PSUBSWrm },
+ { X86::PSUBWrr, X86::PSUBWrm },
+ { X86::PUNPCKHBWrr, X86::PUNPCKHBWrm },
+ { X86::PUNPCKHDQrr, X86::PUNPCKHDQrm },
+ { X86::PUNPCKHQDQrr, X86::PUNPCKHQDQrm },
+ { X86::PUNPCKHWDrr, X86::PUNPCKHWDrm },
+ { X86::PUNPCKLBWrr, X86::PUNPCKLBWrm },
+ { X86::PUNPCKLDQrr, X86::PUNPCKLDQrm },
+ { X86::PUNPCKLQDQrr, X86::PUNPCKLQDQrm },
+ { X86::PUNPCKLWDrr, X86::PUNPCKLWDrm },
+ { X86::PXORrr, X86::PXORrm },
+ { X86::SBB32rr, X86::SBB32rm },
+ { X86::SBB64rr, X86::SBB64rm },
+ { X86::SHUFPDrri, X86::SHUFPDrmi },
+ { X86::SHUFPSrri, X86::SHUFPSrmi },
+ { X86::SUB16rr, X86::SUB16rm },
+ { X86::SUB32rr, X86::SUB32rm },
+ { X86::SUB64rr, X86::SUB64rm },
+ { X86::SUB8rr, X86::SUB8rm },
+ { X86::SUBPDrr, X86::SUBPDrm },
+ { X86::SUBPSrr, X86::SUBPSrm },
+ { X86::SUBSDrr, X86::SUBSDrm },
+ { X86::SUBSSrr, X86::SUBSSrm },
+ // FIXME: TEST*rr -> swapped operand of TEST*mr.
+ { X86::UNPCKHPDrr, X86::UNPCKHPDrm },
+ { X86::UNPCKHPSrr, X86::UNPCKHPSrm },
+ { X86::UNPCKLPDrr, X86::UNPCKLPDrm },
+ { X86::UNPCKLPSrr, X86::UNPCKLPSrm },
+ { X86::XOR16rr, X86::XOR16rm },
+ { X86::XOR32rr, X86::XOR32rm },
+ { X86::XOR64rr, X86::XOR64rm },
+ { X86::XOR8rr, X86::XOR8rm },
+ { X86::XORPDrr, X86::XORPDrm },
+ { X86::XORPSrr, X86::XORPSrm }
+ };
+
+ for (unsigned i = 0, e = array_lengthof(OpTbl2); i != e; ++i) {
+ unsigned RegOp = OpTbl2[i][0];
+ unsigned MemOp = OpTbl2[i][1];
+ if (!RegOp2MemOpTable2.insert(std::make_pair((unsigned*)RegOp, MemOp)))
+ assert(false && "Duplicated entries?");
+ if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, RegOp)))
+ AmbEntries.push_back(MemOp);
+ }
+
+ // Remove ambiguous entries.
+ for (unsigned i = 0, e = AmbEntries.size(); i != e; ++i)
+ MemOp2RegOpTable.erase((unsigned*)AmbEntries[i]);
}
// getX86RegNum - This function maps LLVM register identifiers to their X86
@@ -411,70 +982,11 @@
return MIB.addImm(0);
}
-
-//===----------------------------------------------------------------------===//
-// Efficient Lookup Table Support
-//===----------------------------------------------------------------------===//
-
-namespace {
- /// TableEntry - Maps the 'from' opcode to a fused form of the 'to' opcode.
- ///
- struct TableEntry {
- unsigned from; // Original opcode.
- unsigned to; // New opcode.
-
- // less operators used by STL search.
- bool operator<(const TableEntry &TE) const { return from < TE.from; }
- friend bool operator<(const TableEntry &TE, unsigned V) {
- return TE.from < V;
- }
- friend bool operator<(unsigned V, const TableEntry &TE) {
- return V < TE.from;
- }
- };
-}
-
-/// TableIsSorted - Return true if the table is in 'from' opcode order.
-///
-static bool TableIsSorted(const TableEntry *Table, unsigned NumEntries) {
- for (unsigned i = 1; i != NumEntries; ++i)
- if (!(Table[i-1] < Table[i])) {
- cerr << "Entries out of order " << Table[i-1].from
- << " " << Table[i].from << "\n";
- return false;
- }
- return true;
-}
-
-/// TableLookup - Return the table entry matching the specified opcode.
-/// Otherwise return NULL.
-static const TableEntry *TableLookup(const TableEntry *Table, unsigned N,
- unsigned Opcode) {
- const TableEntry *I = std::lower_bound(Table, Table+N, Opcode);
- if (I != Table+N && I->from == Opcode)
- return I;
- return NULL;
-}
-
-#ifdef NDEBUG
-#define ASSERT_SORTED(TABLE)
-#else
-#define ASSERT_SORTED(TABLE) \
- { static bool TABLE##Checked = false; \
- if (!TABLE##Checked) { \
- assert(TableIsSorted(TABLE, array_lengthof(TABLE)) && \
- "All lookup tables must be sorted for efficient access!"); \
- TABLE##Checked = true; \
- } \
- }
-#endif
-
MachineInstr*
X86RegisterInfo::foldMemoryOperand(MachineInstr *MI, unsigned i,
SmallVector &MOs) const {
// Table (and size) to search
- const TableEntry *OpcodeTablePtr = NULL;
- unsigned OpcodeTableSize = 0;
+ const DenseMap *OpcodeTablePtr = NULL;
bool isTwoAddrFold = false;
unsigned NumOps = TII.getNumOperands(MI->getOpcode());
bool isTwoAddr = NumOps > 1 &&
@@ -488,170 +1000,7 @@
MI->getOperand(0).isRegister() &&
MI->getOperand(1).isRegister() &&
MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) {
- static const TableEntry OpcodeTable[] = {
- { X86::ADC32ri, X86::ADC32mi },
- { X86::ADC32ri8, X86::ADC32mi8 },
- { X86::ADC32rr, X86::ADC32mr },
- { X86::ADC64ri32, X86::ADC64mi32 },
- { X86::ADC64ri8, X86::ADC64mi8 },
- { X86::ADC64rr, X86::ADC64mr },
- { X86::ADD16ri, X86::ADD16mi },
- { X86::ADD16ri8, X86::ADD16mi8 },
- { X86::ADD16rr, X86::ADD16mr },
- { X86::ADD32ri, X86::ADD32mi },
- { X86::ADD32ri8, X86::ADD32mi8 },
- { X86::ADD32rr, X86::ADD32mr },
- { X86::ADD64ri32, X86::ADD64mi32 },
- { X86::ADD64ri8, X86::ADD64mi8 },
- { X86::ADD64rr, X86::ADD64mr },
- { X86::ADD8ri, X86::ADD8mi },
- { X86::ADD8rr, X86::ADD8mr },
- { X86::AND16ri, X86::AND16mi },
- { X86::AND16ri8, X86::AND16mi8 },
- { X86::AND16rr, X86::AND16mr },
- { X86::AND32ri, X86::AND32mi },
- { X86::AND32ri8, X86::AND32mi8 },
- { X86::AND32rr, X86::AND32mr },
- { X86::AND64ri32, X86::AND64mi32 },
- { X86::AND64ri8, X86::AND64mi8 },
- { X86::AND64rr, X86::AND64mr },
- { X86::AND8ri, X86::AND8mi },
- { X86::AND8rr, X86::AND8mr },
- { X86::DEC16r, X86::DEC16m },
- { X86::DEC32r, X86::DEC32m },
- { X86::DEC64_16r, X86::DEC16m },
- { X86::DEC64_32r, X86::DEC32m },
- { X86::DEC64r, X86::DEC64m },
- { X86::DEC8r, X86::DEC8m },
- { X86::INC16r, X86::INC16m },
- { X86::INC32r, X86::INC32m },
- { X86::INC64_16r, X86::INC16m },
- { X86::INC64_32r, X86::INC32m },
- { X86::INC64r, X86::INC64m },
- { X86::INC8r, X86::INC8m },
- { X86::NEG16r, X86::NEG16m },
- { X86::NEG32r, X86::NEG32m },
- { X86::NEG64r, X86::NEG64m },
- { X86::NEG8r, X86::NEG8m },
- { X86::NOT16r, X86::NOT16m },
- { X86::NOT32r, X86::NOT32m },
- { X86::NOT64r, X86::NOT64m },
- { X86::NOT8r, X86::NOT8m },
- { X86::OR16ri, X86::OR16mi },
- { X86::OR16ri8, X86::OR16mi8 },
- { X86::OR16rr, X86::OR16mr },
- { X86::OR32ri, X86::OR32mi },
- { X86::OR32ri8, X86::OR32mi8 },
- { X86::OR32rr, X86::OR32mr },
- { X86::OR64ri32, X86::OR64mi32 },
- { X86::OR64ri8, X86::OR64mi8 },
- { X86::OR64rr, X86::OR64mr },
- { X86::OR8ri, X86::OR8mi },
- { X86::OR8rr, X86::OR8mr },
- { X86::ROL16r1, X86::ROL16m1 },
- { X86::ROL16rCL, X86::ROL16mCL },
- { X86::ROL16ri, X86::ROL16mi },
- { X86::ROL32r1, X86::ROL32m1 },
- { X86::ROL32rCL, X86::ROL32mCL },
- { X86::ROL32ri, X86::ROL32mi },
- { X86::ROL64r1, X86::ROL64m1 },
- { X86::ROL64rCL, X86::ROL64mCL },
- { X86::ROL64ri, X86::ROL64mi },
- { X86::ROL8r1, X86::ROL8m1 },
- { X86::ROL8rCL, X86::ROL8mCL },
- { X86::ROL8ri, X86::ROL8mi },
- { X86::ROR16r1, X86::ROR16m1 },
- { X86::ROR16rCL, X86::ROR16mCL },
- { X86::ROR16ri, X86::ROR16mi },
- { X86::ROR32r1, X86::ROR32m1 },
- { X86::ROR32rCL, X86::ROR32mCL },
- { X86::ROR32ri, X86::ROR32mi },
- { X86::ROR64r1, X86::ROR64m1 },
- { X86::ROR64rCL, X86::ROR64mCL },
- { X86::ROR64ri, X86::ROR64mi },
- { X86::ROR8r1, X86::ROR8m1 },
- { X86::ROR8rCL, X86::ROR8mCL },
- { X86::ROR8ri, X86::ROR8mi },
- { X86::SAR16r1, X86::SAR16m1 },
- { X86::SAR16rCL, X86::SAR16mCL },
- { X86::SAR16ri, X86::SAR16mi },
- { X86::SAR32r1, X86::SAR32m1 },
- { X86::SAR32rCL, X86::SAR32mCL },
- { X86::SAR32ri, X86::SAR32mi },
- { X86::SAR64r1, X86::SAR64m1 },
- { X86::SAR64rCL, X86::SAR64mCL },
- { X86::SAR64ri, X86::SAR64mi },
- { X86::SAR8r1, X86::SAR8m1 },
- { X86::SAR8rCL, X86::SAR8mCL },
- { X86::SAR8ri, X86::SAR8mi },
- { X86::SBB32ri, X86::SBB32mi },
- { X86::SBB32ri8, X86::SBB32mi8 },
- { X86::SBB32rr, X86::SBB32mr },
- { X86::SBB64ri32, X86::SBB64mi32 },
- { X86::SBB64ri8, X86::SBB64mi8 },
- { X86::SBB64rr, X86::SBB64mr },
- { X86::SHL16r1, X86::SHL16m1 },
- { X86::SHL16rCL, X86::SHL16mCL },
- { X86::SHL16ri, X86::SHL16mi },
- { X86::SHL32r1, X86::SHL32m1 },
- { X86::SHL32rCL, X86::SHL32mCL },
- { X86::SHL32ri, X86::SHL32mi },
- { X86::SHL64r1, X86::SHL64m1 },
- { X86::SHL64rCL, X86::SHL64mCL },
- { X86::SHL64ri, X86::SHL64mi },
- { X86::SHL8r1, X86::SHL8m1 },
- { X86::SHL8rCL, X86::SHL8mCL },
- { X86::SHL8ri, X86::SHL8mi },
- { X86::SHLD16rrCL, X86::SHLD16mrCL },
- { X86::SHLD16rri8, X86::SHLD16mri8 },
- { X86::SHLD32rrCL, X86::SHLD32mrCL },
- { X86::SHLD32rri8, X86::SHLD32mri8 },
- { X86::SHLD64rrCL, X86::SHLD64mrCL },
- { X86::SHLD64rri8, X86::SHLD64mri8 },
- { X86::SHR16r1, X86::SHR16m1 },
- { X86::SHR16rCL, X86::SHR16mCL },
- { X86::SHR16ri, X86::SHR16mi },
- { X86::SHR32r1, X86::SHR32m1 },
- { X86::SHR32rCL, X86::SHR32mCL },
- { X86::SHR32ri, X86::SHR32mi },
- { X86::SHR64r1, X86::SHR64m1 },
- { X86::SHR64rCL, X86::SHR64mCL },
- { X86::SHR64ri, X86::SHR64mi },
- { X86::SHR8r1, X86::SHR8m1 },
- { X86::SHR8rCL, X86::SHR8mCL },
- { X86::SHR8ri, X86::SHR8mi },
- { X86::SHRD16rrCL, X86::SHRD16mrCL },
- { X86::SHRD16rri8, X86::SHRD16mri8 },
- { X86::SHRD32rrCL, X86::SHRD32mrCL },
- { X86::SHRD32rri8, X86::SHRD32mri8 },
- { X86::SHRD64rrCL, X86::SHRD64mrCL },
- { X86::SHRD64rri8, X86::SHRD64mri8 },
- { X86::SUB16ri, X86::SUB16mi },
- { X86::SUB16ri8, X86::SUB16mi8 },
- { X86::SUB16rr, X86::SUB16mr },
- { X86::SUB32ri, X86::SUB32mi },
- { X86::SUB32ri8, X86::SUB32mi8 },
- { X86::SUB32rr, X86::SUB32mr },
- { X86::SUB64ri32, X86::SUB64mi32 },
- { X86::SUB64ri8, X86::SUB64mi8 },
- { X86::SUB64rr, X86::SUB64mr },
- { X86::SUB8ri, X86::SUB8mi },
- { X86::SUB8rr, X86::SUB8mr },
- { X86::XOR16ri, X86::XOR16mi },
- { X86::XOR16ri8, X86::XOR16mi8 },
- { X86::XOR16rr, X86::XOR16mr },
- { X86::XOR32ri, X86::XOR32mi },
- { X86::XOR32ri8, X86::XOR32mi8 },
- { X86::XOR32rr, X86::XOR32mr },
- { X86::XOR64ri32, X86::XOR64mi32 },
- { X86::XOR64ri8, X86::XOR64mi8 },
- { X86::XOR64rr, X86::XOR64mr },
- { X86::XOR8ri, X86::XOR8mi },
- { X86::XOR8rr, X86::XOR8mr }
- };
- ASSERT_SORTED(OpcodeTable);
- OpcodeTablePtr = OpcodeTable;
- OpcodeTableSize = array_lengthof(OpcodeTable);
+ OpcodeTablePtr = &RegOp2MemOpTable2Addr;
isTwoAddrFold = true;
} else if (i == 0) { // If operand 0
if (MI->getOpcode() == X86::MOV16r0)
@@ -667,398 +1016,23 @@
return NewMI;
}
- static const TableEntry OpcodeTable[] = {
- { X86::CALL32r, X86::CALL32m },
- { X86::CALL64r, X86::CALL64m },
- { X86::CMP16ri, X86::CMP16mi },
- { X86::CMP16ri8, X86::CMP16mi8 },
- { X86::CMP32ri, X86::CMP32mi },
- { X86::CMP32ri8, X86::CMP32mi8 },
- { X86::CMP64ri32, X86::CMP64mi32 },
- { X86::CMP64ri8, X86::CMP64mi8 },
- { X86::CMP8ri, X86::CMP8mi },
- { X86::DIV16r, X86::DIV16m },
- { X86::DIV32r, X86::DIV32m },
- { X86::DIV64r, X86::DIV64m },
- { X86::DIV8r, X86::DIV8m },
- { X86::FsMOVAPDrr, X86::MOVSDmr },
- { X86::FsMOVAPSrr, X86::MOVSSmr },
- { X86::IDIV16r, X86::IDIV16m },
- { X86::IDIV32r, X86::IDIV32m },
- { X86::IDIV64r, X86::IDIV64m },
- { X86::IDIV8r, X86::IDIV8m },
- { X86::IMUL16r, X86::IMUL16m },
- { X86::IMUL32r, X86::IMUL32m },
- { X86::IMUL64r, X86::IMUL64m },
- { X86::IMUL8r, X86::IMUL8m },
- { X86::JMP32r, X86::JMP32m },
- { X86::JMP64r, X86::JMP64m },
- { X86::MOV16ri, X86::MOV16mi },
- { X86::MOV16rr, X86::MOV16mr },
- { X86::MOV32ri, X86::MOV32mi },
- { X86::MOV32rr, X86::MOV32mr },
- { X86::MOV64ri32, X86::MOV64mi32 },
- { X86::MOV64rr, X86::MOV64mr },
- { X86::MOV8ri, X86::MOV8mi },
- { X86::MOV8rr, X86::MOV8mr },
- { X86::MOVAPDrr, X86::MOVAPDmr },
- { X86::MOVAPSrr, X86::MOVAPSmr },
- { X86::MOVPDI2DIrr, X86::MOVPDI2DImr },
- { X86::MOVPQIto64rr,X86::MOVPQIto64mr },
- { X86::MOVPS2SSrr, X86::MOVPS2SSmr },
- { X86::MOVSDrr, X86::MOVSDmr },
- { X86::MOVSDto64rr, X86::MOVSDto64mr },
- { X86::MOVSS2DIrr, X86::MOVSS2DImr },
- { X86::MOVSSrr, X86::MOVSSmr },
- { X86::MOVUPDrr, X86::MOVUPDmr },
- { X86::MOVUPSrr, X86::MOVUPSmr },
- { X86::MUL16r, X86::MUL16m },
- { X86::MUL32r, X86::MUL32m },
- { X86::MUL64r, X86::MUL64m },
- { X86::MUL8r, X86::MUL8m },
- { X86::SETAEr, X86::SETAEm },
- { X86::SETAr, X86::SETAm },
- { X86::SETBEr, X86::SETBEm },
- { X86::SETBr, X86::SETBm },
- { X86::SETEr, X86::SETEm },
- { X86::SETGEr, X86::SETGEm },
- { X86::SETGr, X86::SETGm },
- { X86::SETLEr, X86::SETLEm },
- { X86::SETLr, X86::SETLm },
- { X86::SETNEr, X86::SETNEm },
- { X86::SETNPr, X86::SETNPm },
- { X86::SETNSr, X86::SETNSm },
- { X86::SETPr, X86::SETPm },
- { X86::SETSr, X86::SETSm },
- { X86::TAILJMPr, X86::TAILJMPm },
- { X86::TEST16ri, X86::TEST16mi },
- { X86::TEST32ri, X86::TEST32mi },
- { X86::TEST64ri32, X86::TEST64mi32 },
- { X86::TEST8ri, X86::TEST8mi },
- { X86::XCHG16rr, X86::XCHG16mr },
- { X86::XCHG32rr, X86::XCHG32mr },
- { X86::XCHG64rr, X86::XCHG64mr },
- { X86::XCHG8rr, X86::XCHG8mr }
- };
-
- ASSERT_SORTED(OpcodeTable);
- OpcodeTablePtr = OpcodeTable;
- OpcodeTableSize = array_lengthof(OpcodeTable);
+ OpcodeTablePtr = &RegOp2MemOpTable0;
} else if (i == 1) {
- static const TableEntry OpcodeTable[] = {
- { X86::CMP16rr, X86::CMP16rm },
- { X86::CMP32rr, X86::CMP32rm },
- { X86::CMP64rr, X86::CMP64rm },
- { X86::CMP8rr, X86::CMP8rm },
- { X86::CVTSD2SSrr, X86::CVTSD2SSrm },
- { X86::CVTSI2SD64rr, X86::CVTSI2SD64rm },
- { X86::CVTSI2SDrr, X86::CVTSI2SDrm },
- { X86::CVTSI2SS64rr, X86::CVTSI2SS64rm },
- { X86::CVTSI2SSrr, X86::CVTSI2SSrm },
- { X86::CVTSS2SDrr, X86::CVTSS2SDrm },
- { X86::CVTTSD2SI64rr, X86::CVTTSD2SI64rm },
- { X86::CVTTSD2SIrr, X86::CVTTSD2SIrm },
- { X86::CVTTSS2SI64rr, X86::CVTTSS2SI64rm },
- { X86::CVTTSS2SIrr, X86::CVTTSS2SIrm },
- { X86::FsMOVAPDrr, X86::MOVSDrm },
- { X86::FsMOVAPSrr, X86::MOVSSrm },
- { X86::IMUL16rri, X86::IMUL16rmi },
- { X86::IMUL16rri8, X86::IMUL16rmi8 },
- { X86::IMUL32rri, X86::IMUL32rmi },
- { X86::IMUL32rri8, X86::IMUL32rmi8 },
- { X86::IMUL64rri32, X86::IMUL64rmi32 },
- { X86::IMUL64rri8, X86::IMUL64rmi8 },
- { X86::Int_CMPSDrr, X86::Int_CMPSDrm },
- { X86::Int_CMPSSrr, X86::Int_CMPSSrm },
- { X86::Int_COMISDrr, X86::Int_COMISDrm },
- { X86::Int_COMISSrr, X86::Int_COMISSrm },
- { X86::Int_CVTDQ2PDrr, X86::Int_CVTDQ2PDrm },
- { X86::Int_CVTDQ2PSrr, X86::Int_CVTDQ2PSrm },
- { X86::Int_CVTPD2DQrr, X86::Int_CVTPD2DQrm },
- { X86::Int_CVTPD2PSrr, X86::Int_CVTPD2PSrm },
- { X86::Int_CVTPS2DQrr, X86::Int_CVTPS2DQrm },
- { X86::Int_CVTPS2PDrr, X86::Int_CVTPS2PDrm },
- { X86::Int_CVTSD2SI64rr,X86::Int_CVTSD2SI64rm },
- { X86::Int_CVTSD2SIrr, X86::Int_CVTSD2SIrm },
- { X86::Int_CVTSD2SSrr, X86::Int_CVTSD2SSrm },
- { X86::Int_CVTSI2SD64rr,X86::Int_CVTSI2SD64rm },
- { X86::Int_CVTSI2SDrr, X86::Int_CVTSI2SDrm },
- { X86::Int_CVTSI2SS64rr,X86::Int_CVTSI2SS64rm },
- { X86::Int_CVTSI2SSrr, X86::Int_CVTSI2SSrm },
- { X86::Int_CVTSS2SDrr, X86::Int_CVTSS2SDrm },
- { X86::Int_CVTSS2SI64rr,X86::Int_CVTSS2SI64rm },
- { X86::Int_CVTSS2SIrr, X86::Int_CVTSS2SIrm },
- { X86::Int_CVTTPD2DQrr, X86::Int_CVTTPD2DQrm },
- { X86::Int_CVTTPS2DQrr, X86::Int_CVTTPS2DQrm },
- { X86::Int_CVTTSD2SI64rr,X86::Int_CVTTSD2SI64rm },
- { X86::Int_CVTTSD2SIrr, X86::Int_CVTTSD2SIrm },
- { X86::Int_CVTTSS2SI64rr,X86::Int_CVTTSS2SI64rm },
- { X86::Int_CVTTSS2SIrr, X86::Int_CVTTSS2SIrm },
- { X86::Int_UCOMISDrr, X86::Int_UCOMISDrm },
- { X86::Int_UCOMISSrr, X86::Int_UCOMISSrm },
- { X86::MOV16rr, X86::MOV16rm },
- { X86::MOV32rr, X86::MOV32rm },
- { X86::MOV64rr, X86::MOV64rm },
- { X86::MOV64toPQIrr, X86::MOV64toPQIrm },
- { X86::MOV64toSDrr, X86::MOV64toSDrm },
- { X86::MOV8rr, X86::MOV8rm },
- { X86::MOVAPDrr, X86::MOVAPDrm },
- { X86::MOVAPSrr, X86::MOVAPSrm },
- { X86::MOVDDUPrr, X86::MOVDDUPrm },
- { X86::MOVDI2PDIrr, X86::MOVDI2PDIrm },
- { X86::MOVDI2SSrr, X86::MOVDI2SSrm },
- { X86::MOVSD2PDrr, X86::MOVSD2PDrm },
- { X86::MOVSDrr, X86::MOVSDrm },
- { X86::MOVSHDUPrr, X86::MOVSHDUPrm },
- { X86::MOVSLDUPrr, X86::MOVSLDUPrm },
- { X86::MOVSS2PSrr, X86::MOVSS2PSrm },
- { X86::MOVSSrr, X86::MOVSSrm },
- { X86::MOVSX16rr8, X86::MOVSX16rm8 },
- { X86::MOVSX32rr16, X86::MOVSX32rm16 },
- { X86::MOVSX32rr8, X86::MOVSX32rm8 },
- { X86::MOVSX64rr16, X86::MOVSX64rm16 },
- { X86::MOVSX64rr32, X86::MOVSX64rm32 },
- { X86::MOVSX64rr8, X86::MOVSX64rm8 },
- { X86::MOVUPDrr, X86::MOVUPDrm },
- { X86::MOVUPSrr, X86::MOVUPSrm },
- { X86::MOVZX16rr8, X86::MOVZX16rm8 },
- { X86::MOVZX32rr16, X86::MOVZX32rm16 },
- { X86::MOVZX32rr8, X86::MOVZX32rm8 },
- { X86::MOVZX64rr16, X86::MOVZX64rm16 },
- { X86::MOVZX64rr8, X86::MOVZX64rm8 },
- { X86::PSHUFDri, X86::PSHUFDmi },
- { X86::PSHUFHWri, X86::PSHUFHWmi },
- { X86::PSHUFLWri, X86::PSHUFLWmi },
- { X86::PsMOVZX64rr32, X86::PsMOVZX64rm32 },
- { X86::RCPPSr, X86::RCPPSm },
- { X86::RCPPSr_Int, X86::RCPPSm_Int },
- { X86::RSQRTPSr, X86::RSQRTPSm },
- { X86::RSQRTPSr_Int, X86::RSQRTPSm_Int },
- { X86::RSQRTSSr, X86::RSQRTSSm },
- { X86::RSQRTSSr_Int, X86::RSQRTSSm_Int },
- { X86::SQRTPDr, X86::SQRTPDm },
- { X86::SQRTPDr_Int, X86::SQRTPDm_Int },
- { X86::SQRTPSr, X86::SQRTPSm },
- { X86::SQRTPSr_Int, X86::SQRTPSm_Int },
- { X86::SQRTSDr, X86::SQRTSDm },
- { X86::SQRTSDr_Int, X86::SQRTSDm_Int },
- { X86::SQRTSSr, X86::SQRTSSm },
- { X86::SQRTSSr_Int, X86::SQRTSSm_Int },
- { X86::TEST16rr, X86::TEST16rm },
- { X86::TEST32rr, X86::TEST32rm },
- { X86::TEST64rr, X86::TEST64rm },
- { X86::TEST8rr, X86::TEST8rm },
- // FIXME: TEST*rr EAX,EAX ---> CMP [mem], 0
- { X86::UCOMISDrr, X86::UCOMISDrm },
- { X86::UCOMISSrr, X86::UCOMISSrm },
- { X86::XCHG16rr, X86::XCHG16rm },
- { X86::XCHG32rr, X86::XCHG32rm },
- { X86::XCHG64rr, X86::XCHG64rm },
- { X86::XCHG8rr, X86::XCHG8rm }
- };
-
- ASSERT_SORTED(OpcodeTable);
- OpcodeTablePtr = OpcodeTable;
- OpcodeTableSize = array_lengthof(OpcodeTable);
+ OpcodeTablePtr = &RegOp2MemOpTable1;
} else if (i == 2) {
- static const TableEntry OpcodeTable[] = {
- { X86::ADC32rr, X86::ADC32rm },
- { X86::ADC64rr, X86::ADC64rm },
- { X86::ADD16rr, X86::ADD16rm },
- { X86::ADD32rr, X86::ADD32rm },
- { X86::ADD64rr, X86::ADD64rm },
- { X86::ADD8rr, X86::ADD8rm },
- { X86::ADDPDrr, X86::ADDPDrm },
- { X86::ADDPSrr, X86::ADDPSrm },
- { X86::ADDSDrr, X86::ADDSDrm },
- { X86::ADDSSrr, X86::ADDSSrm },
- { X86::ADDSUBPDrr, X86::ADDSUBPDrm },
- { X86::ADDSUBPSrr, X86::ADDSUBPSrm },
- { X86::AND16rr, X86::AND16rm },
- { X86::AND32rr, X86::AND32rm },
- { X86::AND64rr, X86::AND64rm },
- { X86::AND8rr, X86::AND8rm },
- { X86::ANDNPDrr, X86::ANDNPDrm },
- { X86::ANDNPSrr, X86::ANDNPSrm },
- { X86::ANDPDrr, X86::ANDPDrm },
- { X86::ANDPSrr, X86::ANDPSrm },
- { X86::CMOVA16rr, X86::CMOVA16rm },
- { X86::CMOVA32rr, X86::CMOVA32rm },
- { X86::CMOVA64rr, X86::CMOVA64rm },
- { X86::CMOVAE16rr, X86::CMOVAE16rm },
- { X86::CMOVAE32rr, X86::CMOVAE32rm },
- { X86::CMOVAE64rr, X86::CMOVAE64rm },
- { X86::CMOVB16rr, X86::CMOVB16rm },
- { X86::CMOVB32rr, X86::CMOVB32rm },
- { X86::CMOVB64rr, X86::CMOVB64rm },
- { X86::CMOVBE16rr, X86::CMOVBE16rm },
- { X86::CMOVBE32rr, X86::CMOVBE32rm },
- { X86::CMOVBE64rr, X86::CMOVBE64rm },
- { X86::CMOVE16rr, X86::CMOVE16rm },
- { X86::CMOVE32rr, X86::CMOVE32rm },
- { X86::CMOVE64rr, X86::CMOVE64rm },
- { X86::CMOVG16rr, X86::CMOVG16rm },
- { X86::CMOVG32rr, X86::CMOVG32rm },
- { X86::CMOVG64rr, X86::CMOVG64rm },
- { X86::CMOVGE16rr, X86::CMOVGE16rm },
- { X86::CMOVGE32rr, X86::CMOVGE32rm },
- { X86::CMOVGE64rr, X86::CMOVGE64rm },
- { X86::CMOVL16rr, X86::CMOVL16rm },
- { X86::CMOVL32rr, X86::CMOVL32rm },
- { X86::CMOVL64rr, X86::CMOVL64rm },
- { X86::CMOVLE16rr, X86::CMOVLE16rm },
- { X86::CMOVLE32rr, X86::CMOVLE32rm },
- { X86::CMOVLE64rr, X86::CMOVLE64rm },
- { X86::CMOVNE16rr, X86::CMOVNE16rm },
- { X86::CMOVNE32rr, X86::CMOVNE32rm },
- { X86::CMOVNE64rr, X86::CMOVNE64rm },
- { X86::CMOVNP16rr, X86::CMOVNP16rm },
- { X86::CMOVNP32rr, X86::CMOVNP32rm },
- { X86::CMOVNP64rr, X86::CMOVNP64rm },
- { X86::CMOVNS16rr, X86::CMOVNS16rm },
- { X86::CMOVNS32rr, X86::CMOVNS32rm },
- { X86::CMOVNS64rr, X86::CMOVNS64rm },
- { X86::CMOVP16rr, X86::CMOVP16rm },
- { X86::CMOVP32rr, X86::CMOVP32rm },
- { X86::CMOVP64rr, X86::CMOVP64rm },
- { X86::CMOVS16rr, X86::CMOVS16rm },
- { X86::CMOVS32rr, X86::CMOVS32rm },
- { X86::CMOVS64rr, X86::CMOVS64rm },
- { X86::CMPPDrri, X86::CMPPDrmi },
- { X86::CMPPSrri, X86::CMPPSrmi },
- { X86::CMPSDrr, X86::CMPSDrm },
- { X86::CMPSSrr, X86::CMPSSrm },
- { X86::DIVPDrr, X86::DIVPDrm },
- { X86::DIVPSrr, X86::DIVPSrm },
- { X86::DIVSDrr, X86::DIVSDrm },
- { X86::DIVSSrr, X86::DIVSSrm },
- { X86::HADDPDrr, X86::HADDPDrm },
- { X86::HADDPSrr, X86::HADDPSrm },
- { X86::HSUBPDrr, X86::HSUBPDrm },
- { X86::HSUBPSrr, X86::HSUBPSrm },
- { X86::IMUL16rr, X86::IMUL16rm },
- { X86::IMUL32rr, X86::IMUL32rm },
- { X86::IMUL64rr, X86::IMUL64rm },
- { X86::MAXPDrr, X86::MAXPDrm },
- { X86::MAXPDrr_Int, X86::MAXPDrm_Int },
- { X86::MAXPSrr, X86::MAXPSrm },
- { X86::MAXPSrr_Int, X86::MAXPSrm_Int },
- { X86::MAXSDrr, X86::MAXSDrm },
- { X86::MAXSDrr_Int, X86::MAXSDrm_Int },
- { X86::MAXSSrr, X86::MAXSSrm },
- { X86::MAXSSrr_Int, X86::MAXSSrm_Int },
- { X86::MINPDrr, X86::MINPDrm },
- { X86::MINPDrr_Int, X86::MINPDrm_Int },
- { X86::MINPSrr, X86::MINPSrm },
- { X86::MINPSrr_Int, X86::MINPSrm_Int },
- { X86::MINSDrr, X86::MINSDrm },
- { X86::MINSDrr_Int, X86::MINSDrm_Int },
- { X86::MINSSrr, X86::MINSSrm },
- { X86::MINSSrr_Int, X86::MINSSrm_Int },
- { X86::MULPDrr, X86::MULPDrm },
- { X86::MULPSrr, X86::MULPSrm },
- { X86::MULSDrr, X86::MULSDrm },
- { X86::MULSSrr, X86::MULSSrm },
- { X86::OR16rr, X86::OR16rm },
- { X86::OR32rr, X86::OR32rm },
- { X86::OR64rr, X86::OR64rm },
- { X86::OR8rr, X86::OR8rm },
- { X86::ORPDrr, X86::ORPDrm },
- { X86::ORPSrr, X86::ORPSrm },
- { X86::PACKSSDWrr, X86::PACKSSDWrm },
- { X86::PACKSSWBrr, X86::PACKSSWBrm },
- { X86::PACKUSWBrr, X86::PACKUSWBrm },
- { X86::PADDBrr, X86::PADDBrm },
- { X86::PADDDrr, X86::PADDDrm },
- { X86::PADDQrr, X86::PADDQrm },
- { X86::PADDSBrr, X86::PADDSBrm },
- { X86::PADDSWrr, X86::PADDSWrm },
- { X86::PADDWrr, X86::PADDWrm },
- { X86::PANDNrr, X86::PANDNrm },
- { X86::PANDrr, X86::PANDrm },
- { X86::PAVGBrr, X86::PAVGBrm },
- { X86::PAVGWrr, X86::PAVGWrm },
- { X86::PCMPEQBrr, X86::PCMPEQBrm },
- { X86::PCMPEQDrr, X86::PCMPEQDrm },
- { X86::PCMPEQWrr, X86::PCMPEQWrm },
- { X86::PCMPGTBrr, X86::PCMPGTBrm },
- { X86::PCMPGTDrr, X86::PCMPGTDrm },
- { X86::PCMPGTWrr, X86::PCMPGTWrm },
- { X86::PINSRWrri, X86::PINSRWrmi },
- { X86::PMADDWDrr, X86::PMADDWDrm },
- { X86::PMAXSWrr, X86::PMAXSWrm },
- { X86::PMAXUBrr, X86::PMAXUBrm },
- { X86::PMINSWrr, X86::PMINSWrm },
- { X86::PMINUBrr, X86::PMINUBrm },
- { X86::PMULHUWrr, X86::PMULHUWrm },
- { X86::PMULHWrr, X86::PMULHWrm },
- { X86::PMULLWrr, X86::PMULLWrm },
- { X86::PMULUDQrr, X86::PMULUDQrm },
- { X86::PORrr, X86::PORrm },
- { X86::PSADBWrr, X86::PSADBWrm },
- { X86::PSLLDrr, X86::PSLLDrm },
- { X86::PSLLQrr, X86::PSLLQrm },
- { X86::PSLLWrr, X86::PSLLWrm },
- { X86::PSRADrr, X86::PSRADrm },
- { X86::PSRAWrr, X86::PSRAWrm },
- { X86::PSRLDrr, X86::PSRLDrm },
- { X86::PSRLQrr, X86::PSRLQrm },
- { X86::PSRLWrr, X86::PSRLWrm },
- { X86::PSUBBrr, X86::PSUBBrm },
- { X86::PSUBDrr, X86::PSUBDrm },
- { X86::PSUBSBrr, X86::PSUBSBrm },
- { X86::PSUBSWrr, X86::PSUBSWrm },
- { X86::PSUBWrr, X86::PSUBWrm },
- { X86::PUNPCKHBWrr, X86::PUNPCKHBWrm },
- { X86::PUNPCKHDQrr, X86::PUNPCKHDQrm },
- { X86::PUNPCKHQDQrr, X86::PUNPCKHQDQrm },
- { X86::PUNPCKHWDrr, X86::PUNPCKHWDrm },
- { X86::PUNPCKLBWrr, X86::PUNPCKLBWrm },
- { X86::PUNPCKLDQrr, X86::PUNPCKLDQrm },
- { X86::PUNPCKLQDQrr, X86::PUNPCKLQDQrm },
- { X86::PUNPCKLWDrr, X86::PUNPCKLWDrm },
- { X86::PXORrr, X86::PXORrm },
- { X86::SBB32rr, X86::SBB32rm },
- { X86::SBB64rr, X86::SBB64rm },
- { X86::SHUFPDrri, X86::SHUFPDrmi },
- { X86::SHUFPSrri, X86::SHUFPSrmi },
- { X86::SUB16rr, X86::SUB16rm },
- { X86::SUB32rr, X86::SUB32rm },
- { X86::SUB64rr, X86::SUB64rm },
- { X86::SUB8rr, X86::SUB8rm },
- { X86::SUBPDrr, X86::SUBPDrm },
- { X86::SUBPSrr, X86::SUBPSrm },
- { X86::SUBSDrr, X86::SUBSDrm },
- { X86::SUBSSrr, X86::SUBSSrm },
- // FIXME: TEST*rr -> swapped operand of TEST*mr.
- { X86::UNPCKHPDrr, X86::UNPCKHPDrm },
- { X86::UNPCKHPSrr, X86::UNPCKHPSrm },
- { X86::UNPCKLPDrr, X86::UNPCKLPDrm },
- { X86::UNPCKLPSrr, X86::UNPCKLPSrm },
- { X86::XOR16rr, X86::XOR16rm },
- { X86::XOR32rr, X86::XOR32rm },
- { X86::XOR64rr, X86::XOR64rm },
- { X86::XOR8rr, X86::XOR8rm },
- { X86::XORPDrr, X86::XORPDrm },
- { X86::XORPSrr, X86::XORPSrm }
- };
-
- ASSERT_SORTED(OpcodeTable);
- OpcodeTablePtr = OpcodeTable;
- OpcodeTableSize = array_lengthof(OpcodeTable);
+ OpcodeTablePtr = &RegOp2MemOpTable2;
}
// If table selected...
if (OpcodeTablePtr) {
// Find the Opcode to fuse
- unsigned fromOpcode = MI->getOpcode();
- // Lookup fromOpcode in table
- if (const TableEntry *Entry = TableLookup(OpcodeTablePtr, OpcodeTableSize,
- fromOpcode)) {
+ DenseMap::iterator I =
+ OpcodeTablePtr->find((unsigned*)MI->getOpcode());
+ if (I != OpcodeTablePtr->end()) {
if (isTwoAddrFold)
- NewMI = FuseTwoAddrInst(Entry->to, MOs, MI, TII);
+ NewMI = FuseTwoAddrInst(I->second, MOs, MI, TII);
else
- NewMI = FuseInst(Entry->to, i, MOs, MI, TII);
+ NewMI = FuseInst(I->second, i, MOs, MI, TII);
NewMI->copyKillDeadInfo(MI);
return NewMI;
}
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=42509&r1=42508&r2=42509&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Mon Oct 1 18:44:33 2007
@@ -14,6 +14,7 @@
#ifndef X86REGISTERINFO_H
#define X86REGISTERINFO_H
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Target/MRegisterInfo.h"
#include "X86GenRegisterInfo.h.inc"
@@ -38,17 +39,33 @@
private:
/// Is64Bit - Is the target 64-bits.
+ ///
bool Is64Bit;
/// SlotSize - Stack slot size in bytes.
+ ///
unsigned SlotSize;
/// StackPtr - X86 physical register used as stack ptr.
+ ///
unsigned StackPtr;
/// FramePtr - X86 physical register used as frame ptr.
+ ///
unsigned FramePtr;
+ /// RegOp2MemOpTable2Addr, RegOp2MemOpTable0, RegOp2MemOpTable1,
+ /// RegOp2MemOpTable2 - Load / store folding opcode maps.
+ ///
+ DenseMap RegOp2MemOpTable2Addr;
+ DenseMap RegOp2MemOpTable0;
+ DenseMap RegOp2MemOpTable1;
+ DenseMap RegOp2MemOpTable2;
+
+ /// MemOp2RegOpTable - Load / store unfolding opcode map.
+ ///
+ DenseMap MemOp2RegOpTable;
+
public:
X86RegisterInfo(X86TargetMachine &tm, const TargetInstrInfo &tii);
@@ -57,6 +74,7 @@
unsigned getX86RegNum(unsigned RegNo);
/// Code Generation virtual methods...
+ ///
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
const std::vector &CSI) const;
From isanbard at gmail.com Mon Oct 1 18:48:07 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 01 Oct 2007 23:48:07 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42510 -
/llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp
Message-ID: <200710012348.l91Nm78P001119@zion.cs.uiuc.edu>
Author: void
Date: Mon Oct 1 18:48:06 2007
New Revision: 42510
URL: http://llvm.org/viewvc/llvm-project?rev=42510&view=rev
Log:
createBFS_DAGScheduler doesn't exist anymore
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp?rev=42510&r1=42509&r2=42510&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp Mon Oct 1 18:48:06 2007
@@ -51,7 +51,6 @@
llvm::createCFGSimplificationPass();
llvm::createDefaultScheduler(NULL, NULL, NULL);
- llvm::createBFS_DAGScheduler(NULL, NULL, NULL);
llvm::createLinearScanRegisterAllocator();
llvm::createGVNPass();
From isanbard at gmail.com Mon Oct 1 18:49:25 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 01 Oct 2007 23:49:25 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42511 -
/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
Message-ID: <200710012349.l91NnPDF001180@zion.cs.uiuc.edu>
Author: void
Date: Mon Oct 1 18:49:21 2007
New Revision: 42511
URL: http://llvm.org/viewvc/llvm-project?rev=42511&view=rev
Log:
createBFS_DAGScheduler doesn't exist anymore
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=42511&r1=42510&r2=42511&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Mon Oct 1 18:49:21 2007
@@ -51,7 +51,6 @@
llvm::createCFGSimplificationPass();
llvm::createDefaultScheduler(NULL, NULL, NULL);
- llvm::createBFS_DAGScheduler(NULL, NULL, NULL);
llvm::createLinearScanRegisterAllocator();
llvm::createGVNPass();
From tonic at nondot.org Mon Oct 1 19:19:28 2007
From: tonic at nondot.org (Tanya Lattner)
Date: Tue, 02 Oct 2007 00:19:28 -0000
Subject: [llvm-commits] [llvm] r42514 - /llvm/trunk/utils/NewNightlyTest.pl
Message-ID: <200710020019.l920JSGK002668@zion.cs.uiuc.edu>
Author: tbrethou
Date: Mon Oct 1 19:19:27 2007
New Revision: 42514
URL: http://llvm.org/viewvc/llvm-project?rev=42514&view=rev
Log:
If the user did not check out LLVM and request it to be built, it should be a build error. This relies on the user having a successful build of LLVM, but the tests will fail if they dont.
Modified:
llvm/trunk/utils/NewNightlyTest.pl
Modified: llvm/trunk/utils/NewNightlyTest.pl
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/NewNightlyTest.pl?rev=42514&r1=42513&r2=42514&view=diff
==============================================================================
--- llvm/trunk/utils/NewNightlyTest.pl (original)
+++ llvm/trunk/utils/NewNightlyTest.pl Mon Oct 1 19:19:27 2007
@@ -737,7 +737,6 @@
my $BuildError = 0, $BuildStatus = "OK";
if ($NOBUILD) {
$BuildStatus = "Skipped by user";
- $BuildError = 1;
}
elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
`grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
From dalej at apple.com Mon Oct 1 19:27:23 2007
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 02 Oct 2007 00:27:23 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42515 -
/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
Message-ID: <200710020027.l920RNVX003102@zion.cs.uiuc.edu>
Author: johannes
Date: Mon Oct 1 19:27:23 2007
New Revision: 42515
URL: http://llvm.org/viewvc/llvm-project?rev=42515&view=rev
Log:
Use getABITypeSizeInBits for superior checking.
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=42515&r1=42514&r2=42515&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Mon Oct 1 19:27:23 2007
@@ -74,12 +74,11 @@
static const Type * llvm_set_type(tree Tr, const Type *Ty) {
// For x86 long double, llvm records the size of the data (80) while
- // gcc's TYPE_SIZE including alignment padding. Compensate.
+ // gcc's TYPE_SIZE including alignment padding. getABITypeSizeInBits
+ // is used to compensate for this.
assert((!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) ||
- getInt64(TYPE_SIZE(Tr), true) == getTargetData().getTypeSizeInBits(Ty) ||
- (getTargetData().getTypeSizeInBits(Ty) == 80 &&
- (getInt64(TYPE_SIZE(Tr), true) == 96 ||
- getInt64(TYPE_SIZE(Tr), true) == 128)))
+ getInt64(TYPE_SIZE(Tr), true) ==
+ getTargetData().getABITypeSizeInBits(Ty))
&& "LLVM type size doesn't match GCC type size!");
unsigned &TypeSlot = LTypesMap[Ty];
From dpatel at apple.com Mon Oct 1 19:39:20 2007
From: dpatel at apple.com (Devang Patel)
Date: Tue, 02 Oct 2007 00:39:20 -0000
Subject: [llvm-commits] [llvm] r42517 -
/llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll
Message-ID: <200710020039.l920dKsR003705@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Oct 1 19:39:19 2007
New Revision: 42517
URL: http://llvm.org/viewvc/llvm-project?rev=42517&view=rev
Log:
New test.
Added:
llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll
Added: llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/C%2B%2BFrontend/2007-10-01-StructResize.ll?rev=42517&view=auto
==============================================================================
--- llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll (added)
+++ llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll Mon Oct 1 19:39:19 2007
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -c %s -o /dev/null
+
+#pragma pack(4)
+
+struct Bork {
+ unsigned int f1 : 3;
+ unsigned int f2 : 30;
+};
+
+int Foo(Bork *hdr) {
+ hdr->f1 = 7;
+ hdr->f2 = 927;
+}
+
From dpatel at apple.com Mon Oct 1 19:41:17 2007
From: dpatel at apple.com (Devang Patel)
Date: Tue, 02 Oct 2007 00:41:17 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42518 -
/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
Message-ID: <200710020041.l920fHME003847@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Oct 1 19:41:16 2007
New Revision: 42518
URL: http://llvm.org/viewvc/llvm-project?rev=42518&view=rev
Log:
If LLVM struct size matches GCC struct size then do not
removing trailing 'extra' padding bytes.
Fix
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071001/054142.html
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=42518&r1=42517&r2=42518&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Mon Oct 1 19:41:16 2007
@@ -1160,7 +1160,7 @@
// If this is a Packed struct and ExtraBitsAvailable is not zero then
// remove Extra bytes if ExtraBitsAvailable > 8.
- void RemoveExtraBytes () {
+ void RemoveExtraBytes (unsigned GCCTypeSize) {
unsigned NoOfBytesToRemove = ExtraBitsAvailable/8;
@@ -1170,6 +1170,10 @@
if (NoOfBytesToRemove == 0)
return;
+ unsigned OriginalSize = ElementSizeInBytes.back();
+ if (OriginalSize == GCCTypeSize)
+ return;
+
const Type *LastType = Elements.back();
unsigned PadBytes = 0;
@@ -1191,7 +1195,6 @@
Elements.pop_back();
Elements.push_back(Pad);
- unsigned OriginalSize = ElementSizeInBytes.back();
ElementSizeInBytes.pop_back();
ElementSizeInBytes.push_back(OriginalSize - NoOfBytesToRemove);
}
@@ -1667,12 +1670,12 @@
for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field))
DecodeStructFields(Field, *Info);
- Info->RemoveExtraBytes();
+ uint64_t GCCTypeSize = ((uint64_t)TREE_INT_CST_LOW(TYPE_SIZE(type))+7)/8;
+ Info->RemoveExtraBytes(GCCTypeSize);
// If the LLVM struct requires explicit tail padding to be the same size as
// the GCC struct, insert tail padding now. This handles, e.g., "{}" in C++.
if (TYPE_SIZE(type) && TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST) {
uint64_t LLVMStructSize = Info->getSizeAsLLVMStruct();
- uint64_t GCCTypeSize = ((uint64_t)TREE_INT_CST_LOW(TYPE_SIZE(type))+7)/8;
if (LLVMStructSize != GCCTypeSize) {
assert(LLVMStructSize < GCCTypeSize &&
From resistor at mac.com Mon Oct 1 19:43:25 2007
From: resistor at mac.com (Owen Anderson)
Date: Tue, 02 Oct 2007 00:43:25 -0000
Subject: [llvm-commits] [llvm] r42519 - /llvm/trunk/docs/AliasAnalysis.html
Message-ID: <200710020043.l920hQkk004003@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Oct 1 19:43:25 2007
New Revision: 42519
URL: http://llvm.org/viewvc/llvm-project?rev=42519&view=rev
Log:
Mention memdep in the AA documentation.
Modified:
llvm/trunk/docs/AliasAnalysis.html
Modified: llvm/trunk/docs/AliasAnalysis.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/AliasAnalysis.html?rev=42519&r1=42518&r2=42519&view=diff
==============================================================================
--- llvm/trunk/docs/AliasAnalysis.html (original)
+++ llvm/trunk/docs/AliasAnalysis.html Mon Oct 1 19:43:25 2007
@@ -50,6 +50,7 @@
implementations
+ Memory Dependence Analysis
@@ -948,6 +949,24 @@
+
+
+
+
+
+
If you're just looking to be a client of alias analysis information, consider
+using the Memory Dependence Analysis interface instead. MemDep is a lazy,
+caching layer on top of alias analysis that is able to answer the question of
+what preceding memory operations a given instruction depends on, either at an
+intra- or inter-block level. Because of its laziness and caching
+policy, using MemDep can be a significant performance win over accessing alias
+analysis directly.
+
+
+
+
From dpatel at apple.com Mon Oct 1 19:43:27 2007
From: dpatel at apple.com (Devang Patel)
Date: Tue, 02 Oct 2007 00:43:27 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42520 -
/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Message-ID: <200710020043.l920hRk1004032@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Oct 1 19:43:27 2007
New Revision: 42520
URL: http://llvm.org/viewvc/llvm-project?rev=42520&view=rev
Log:
If LLVM struct size matches GCC struct size then do not
removing trailing 'extra' padding bytes.
Fix
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071001/054142.html
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=42520&r1=42519&r2=42520&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Oct 1 19:43:27 2007
@@ -1185,7 +1185,7 @@
// If this is a Packed struct and ExtraBitsAvailable is not zero then
// remove Extra bytes if ExtraBitsAvailable > 8.
- void RemoveExtraBytes () {
+ void RemoveExtraBytes (unsigned GCCTypeSize) {
unsigned NoOfBytesToRemove = ExtraBitsAvailable/8;
@@ -1195,6 +1195,10 @@
if (NoOfBytesToRemove == 0)
return;
+ unsigned OriginalSize = ElementSizeInBytes.back();
+ if (OriginalSize == GCCTypeSize)
+ return;
+
const Type *LastType = Elements.back();
unsigned PadBytes = 0;
@@ -1216,7 +1220,6 @@
Elements.pop_back();
Elements.push_back(Pad);
- unsigned OriginalSize = ElementSizeInBytes.back();
ElementSizeInBytes.pop_back();
ElementSizeInBytes.push_back(OriginalSize - NoOfBytesToRemove);
}
@@ -1692,12 +1695,12 @@
for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field))
DecodeStructFields(Field, *Info);
- Info->RemoveExtraBytes();
+ uint64_t GCCTypeSize = ((uint64_t)TREE_INT_CST_LOW(TYPE_SIZE(type))+7)/8;
+ Info->RemoveExtraBytes(GCCTypeSize);
// If the LLVM struct requires explicit tail padding to be the same size as
// the GCC struct, insert tail padding now. This handles, e.g., "{}" in C++.
if (TYPE_SIZE(type) && TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST) {
uint64_t LLVMStructSize = Info->getSizeAsLLVMStruct();
- uint64_t GCCTypeSize = ((uint64_t)TREE_INT_CST_LOW(TYPE_SIZE(type))+7)/8;
if (LLVMStructSize != GCCTypeSize) {
assert(LLVMStructSize < GCCTypeSize &&
From resistor at mac.com Mon Oct 1 19:44:21 2007
From: resistor at mac.com (Owen Anderson)
Date: Tue, 02 Oct 2007 00:44:21 -0000
Subject: [llvm-commits] [llvm] r42521 - /llvm/trunk/docs/AliasAnalysis.html
Message-ID: <200710020044.l920iL2b004106@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Oct 1 19:44:20 2007
New Revision: 42521
URL: http://llvm.org/viewvc/llvm-project?rev=42521&view=rev
Log:
Fix typo.
Modified:
llvm/trunk/docs/AliasAnalysis.html
Modified: llvm/trunk/docs/AliasAnalysis.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/AliasAnalysis.html?rev=42521&r1=42520&r2=42521&view=diff
==============================================================================
--- llvm/trunk/docs/AliasAnalysis.html (original)
+++ llvm/trunk/docs/AliasAnalysis.html Mon Oct 1 19:44:20 2007
@@ -50,7 +50,7 @@
implementations
- Memory Dependence Analysis
+ Memory Dependence Analysis
From dpatel at apple.com Mon Oct 1 19:47:43 2007
From: dpatel at apple.com (Devang Patel)
Date: Tue, 02 Oct 2007 00:47:43 -0000
Subject: [llvm-commits] [llvm] r42522 -
/llvm/trunk/test/FrontendObjC/2007-09-25-EH.m
Message-ID: <200710020047.l920lh0I004399@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Oct 1 19:47:43 2007
New Revision: 42522
URL: http://llvm.org/viewvc/llvm-project?rev=42522&view=rev
Log:
Fix test.
Modified:
llvm/trunk/test/FrontendObjC/2007-09-25-EH.m
Modified: llvm/trunk/test/FrontendObjC/2007-09-25-EH.m
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-09-25-EH.m?rev=42522&r1=42521&r2=42522&view=diff
==============================================================================
--- llvm/trunk/test/FrontendObjC/2007-09-25-EH.m (original)
+++ llvm/trunk/test/FrontendObjC/2007-09-25-EH.m Mon Oct 1 19:47:43 2007
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc -c -w -m64 %s -o /dev/null
+// RUN: %llvmgcc -c -w -m64 -mmacosx-version-min=10.5 %s -o /dev/null
@class NSDictionary, DSoBuffer, DSoDirectory, NSMutableArray;
@interface NSException {}
From evan.cheng at apple.com Mon Oct 1 20:50:08 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 02 Oct 2007 01:50:08 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42523 -
/llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp
Message-ID: <200710020150.l921o8o0007378@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 1 20:50:08 2007
New Revision: 42523
URL: http://llvm.org/viewvc/llvm-project?rev=42523&view=rev
Log:
Link in llvm::createLocalRegisterAllocator.
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp?rev=42523&r1=42522&r2=42523&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-linker-hack.cpp Mon Oct 1 20:50:08 2007
@@ -52,6 +52,7 @@
llvm::createDefaultScheduler(NULL, NULL, NULL);
llvm::createLinearScanRegisterAllocator();
+ llvm::createLocalRegisterAllocator();
llvm::createGVNPass();
llvm::createGCSEPass();
From evan.cheng at apple.com Mon Oct 1 21:28:00 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 02 Oct 2007 02:28:00 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42525 -
/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
Message-ID: <200710020228.l922S1Ms009090@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 1 21:28:00 2007
New Revision: 42525
URL: http://llvm.org/viewvc/llvm-project?rev=42525&view=rev
Log:
Merge -r42522:42523 llvm-project/llvm-gcc-4.0/trunk
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=42525&r1=42524&r2=42525&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Mon Oct 1 21:28:00 2007
@@ -52,6 +52,7 @@
llvm::createDefaultScheduler(NULL, NULL, NULL);
llvm::createLinearScanRegisterAllocator();
+ llvm::createLocalRegisterAllocator();
llvm::createGVNPass();
llvm::createGCSEPass();
From baldrick at free.fr Tue Oct 2 01:33:12 2007
From: baldrick at free.fr (Duncan Sands)
Date: Tue, 2 Oct 2007 08:33:12 +0200
Subject: [llvm-commits] [llvm-gcc-4.0] r42515 -
/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
In-Reply-To: <200710020027.l920RNVX003102@zion.cs.uiuc.edu>
References: <200710020027.l920RNVX003102@zion.cs.uiuc.edu>
Message-ID: <200710020833.12947.baldrick@free.fr>
> Use getABITypeSizeInBits for superior checking.
Thanks for doing this! Please also apply to 4.2.
Thanks,
Duncan.
From gordonhenriksen at mac.com Tue Oct 2 04:50:18 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Tue, 02 Oct 2007 09:50:18 -0000
Subject: [llvm-commits] [llvm] r42526 - in /llvm/trunk: Makefile.config.in
autoconf/configure.ac bindings/Makefile test/Makefile
Message-ID: <200710020950.l929oJpt008361@zion.cs.uiuc.edu>
Author: gordon
Date: Tue Oct 2 04:50:18 2007
New Revision: 42526
URL: http://llvm.org/viewvc/llvm-project?rev=42526&view=rev
Log:
Add explicit --enable-bindings option to configure.
Modified:
llvm/trunk/Makefile.config.in
llvm/trunk/autoconf/configure.ac
llvm/trunk/bindings/Makefile
llvm/trunk/test/Makefile
Modified: llvm/trunk/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=42526&r1=42525&r2=42526&view=diff
==============================================================================
--- llvm/trunk/Makefile.config.in (original)
+++ llvm/trunk/Makefile.config.in Tue Oct 2 04:50:18 2007
@@ -168,6 +168,9 @@
LIBS := @LIBS@
+# Targets that we should build
+TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
+
# Path to location for LLVM C/C++ front-end. You can modify this if you
# want to override the value set by configure.
LLVMGCCDIR := @LLVMGCCDIR@
@@ -259,3 +262,8 @@
# Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
# on the check.
HUGE_VAL_SANITY = @HUGE_VAL_SANITY@
+
+# Bindings that we should build
+BINDINGS_TO_BUILD = @BINDINGS_TO_BUILD@
+ALL_BINDINGS = @ALL_BINDINGS@
+
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=42526&r1=42525&r2=42526&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Tue Oct 2 04:50:18 2007
@@ -432,6 +432,24 @@
esac
AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS)
+dnl Allow specific bindings to be specified for building (or not)
+AC_ARG_ENABLE([bindings],AS_HELP_STRING([--enable-bindings],
+ [Build specific language bindings: all,auto,none,{binding-name} (default=auto)]),,
+ enableval=default)
+BINDINGS_TO_BUILD=""
+case "$enableval" in
+ all | yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
+ all ) BINDINGS_TO_BUILD="ocaml" ;;
+ none | no) BINDINGS_TO_BUILD="" ;;
+ *)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do
+ case "$a_binding" in
+ ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;;
+ *) AC_MSG_ERROR([Unrecognized binding $a_binding]) ;;
+ esac
+ done
+ ;;
+esac
+
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 4: Check for programs we need and that they are the right version
@@ -855,6 +873,19 @@
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
[Time at which LLVM was configured])
+# Determine which bindings to build.
+if test "$BINDINGS_TO_BUILD" = auto ; then
+ BINDINGS_TO_BUILD=""
+ if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
+ BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD"
+ fi
+fi
+AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD)
+
+# This isn't really configurey, but it avoids having to repeat the list in
+# other files.
+AC_SUBST(ALL_BINDINGS,ocaml)
+
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 10: Specify the output files and generate it
Modified: llvm/trunk/bindings/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/Makefile?rev=42526&r1=42525&r2=42526&view=diff
==============================================================================
--- llvm/trunk/bindings/Makefile (original)
+++ llvm/trunk/bindings/Makefile Tue Oct 2 04:50:18 2007
@@ -11,8 +11,6 @@
include $(LEVEL)/Makefile.config
-ifdef OCAMLC
-PARALLEL_DIRS += ocaml
-endif
+PARALLEL_DIRS = $(BINDINGS_TO_BUILD)
include $(LEVEL)/Makefile.common
Modified: llvm/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=42526&r1=42525&r2=42526&view=diff
==============================================================================
--- llvm/trunk/test/Makefile (original)
+++ llvm/trunk/test/Makefile Tue Oct 2 04:50:18 2007
@@ -34,9 +34,7 @@
IGNORE_TESTS += llvm2cpp.exp
endif
-ifndef OCAMLC
-IGNORE_TESTS += ocaml.exp
-endif
+IGNORE_TESTS += $(filter-out $(BINDINGS_TO_BUILD:=.exp),$(ALL_BINDINGS:=.exp))
ifdef IGNORE_TESTS
RUNTESTFLAGS += --ignore "$(strip $(IGNORE_TESTS))"
From gordonhenriksen at mac.com Tue Oct 2 04:50:32 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Tue, 02 Oct 2007 09:50:32 -0000
Subject: [llvm-commits] [llvm] r42527 - /llvm/trunk/configure
Message-ID: <200710020950.l929oX43008383@zion.cs.uiuc.edu>
Author: gordon
Date: Tue Oct 2 04:50:32 2007
New Revision: 42527
URL: http://llvm.org/viewvc/llvm-project?rev=42527&view=rev
Log:
Regenerate.
Modified:
llvm/trunk/configure
Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=42527&r1=42526&r2=42527&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Tue Oct 2 04:50:32 2007
@@ -924,6 +924,8 @@
LLVM_INFODIR
LLVM_MANDIR
LLVM_CONFIGTIME
+BINDINGS_TO_BUILD
+ALL_BINDINGS
LIBOBJS
LTLIBOBJS'
ac_subst_files=''
@@ -1542,6 +1544,8 @@
all,host-only,{target-name} (default=all)
--enable-cbe-printf-a Enable C Backend output with hex floating point via
%a (default is YES)
+ --enable-bindings Build specific language bindings:
+ all,auto,none,{binding-name} (default=auto)
--enable-ltdl-install install libltdl
--enable-shared[=PKGS] build shared libraries
[default=yes]
@@ -4823,6 +4827,29 @@
EXTRA_OPTIONS=$EXTRA_OPTIONS
+# Check whether --enable-bindings was given.
+if test "${enable_bindings+set}" = set; then
+ enableval=$enable_bindings;
+else
+ enableval=default
+fi
+
+BINDINGS_TO_BUILD=""
+case "$enableval" in
+ all | yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
+ all ) BINDINGS_TO_BUILD="ocaml" ;;
+ none | no) BINDINGS_TO_BUILD="" ;;
+ *)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do
+ case "$a_binding" in
+ ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;;
+ *) { { echo "$as_me:$LINENO: error: Unrecognized binding $a_binding" >&5
+echo "$as_me: error: Unrecognized binding $a_binding" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+ done
+ ;;
+esac
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -10499,7 +10526,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <
conftest.$ac_ext
+ echo '#line 12673 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -14361,11 +14388,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14364: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14391: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14368: \$? = $ac_status" >&5
+ echo "$as_me:14395: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14629,11 +14656,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14632: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14659: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14636: \$? = $ac_status" >&5
+ echo "$as_me:14663: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14733,11 +14760,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14736: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14763: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14740: \$? = $ac_status" >&5
+ echo "$as_me:14767: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -17185,7 +17212,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext < conftest.$ac_ext <&5)
+ (eval echo "\"\$as_me:19683: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:19660: \$? = $ac_status" >&5
+ echo "$as_me:19687: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -19757,11 +19784,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:19760: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:19787: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:19764: \$? = $ac_status" >&5
+ echo "$as_me:19791: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -21327,11 +21354,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:21330: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:21357: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:21334: \$? = $ac_status" >&5
+ echo "$as_me:21361: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -21431,11 +21458,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:21434: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:21461: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:21438: \$? = $ac_status" >&5
+ echo "$as_me:21465: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -23666,11 +23693,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23669: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23696: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:23673: \$? = $ac_status" >&5
+ echo "$as_me:23700: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -23934,11 +23961,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23937: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23964: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:23941: \$? = $ac_status" >&5
+ echo "$as_me:23968: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -24038,11 +24065,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:24041: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:24068: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:24045: \$? = $ac_status" >&5
+ echo "$as_me:24072: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -34115,6 +34142,21 @@
_ACEOF
+# Determine which bindings to build.
+if test "$BINDINGS_TO_BUILD" = auto ; then
+ BINDINGS_TO_BUILD=""
+ if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
+ BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD"
+ fi
+fi
+BINDINGS_TO_BUILD=$BINDINGS_TO_BUILD
+
+
+# This isn't really configurey, but it avoids having to repeat the list in
+# other files.
+ALL_BINDINGS=ocaml
+
+
ac_config_headers="$ac_config_headers include/llvm/Config/config.h"
@@ -35034,11 +35076,13 @@
LLVM_INFODIR!$LLVM_INFODIR$ac_delim
LLVM_MANDIR!$LLVM_MANDIR$ac_delim
LLVM_CONFIGTIME!$LLVM_CONFIGTIME$ac_delim
+BINDINGS_TO_BUILD!$BINDINGS_TO_BUILD$ac_delim
+ALL_BINDINGS!$ALL_BINDINGS$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 75; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
From gordonhenriksen at mac.com Tue Oct 2 05:14:32 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Tue, 02 Oct 2007 10:14:32 -0000
Subject: [llvm-commits] [llvm] r42528 - in /llvm/trunk: Makefile.config.in
autoconf/configure.ac
Message-ID: <200710021014.l92AEWHa009347@zion.cs.uiuc.edu>
Author: gordon
Date: Tue Oct 2 05:14:32 2007
New Revision: 42528
URL: http://llvm.org/viewvc/llvm-project?rev=42528&view=rev
Log:
Fixing (harmless) typos.
Modified:
llvm/trunk/Makefile.config.in
llvm/trunk/autoconf/configure.ac
Modified: llvm/trunk/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=42528&r1=42527&r2=42528&view=diff
==============================================================================
--- llvm/trunk/Makefile.config.in (original)
+++ llvm/trunk/Makefile.config.in Tue Oct 2 05:14:32 2007
@@ -105,9 +105,6 @@
# Target triple (cpu-vendor-os) for which we should generate code
TARGET_TRIPLE=@target@
-# Targets that we should build
-TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
-
# Extra options to compile LLVM with
EXTRA_OPTIONS=@EXTRA_OPTIONS@
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=42528&r1=42527&r2=42528&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Tue Oct 2 05:14:32 2007
@@ -438,7 +438,7 @@
enableval=default)
BINDINGS_TO_BUILD=""
case "$enableval" in
- all | yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
+ yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
all ) BINDINGS_TO_BUILD="ocaml" ;;
none | no) BINDINGS_TO_BUILD="" ;;
*)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do
From gordonhenriksen at mac.com Tue Oct 2 05:14:42 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Tue, 02 Oct 2007 10:14:42 -0000
Subject: [llvm-commits] [llvm] r42529 - /llvm/trunk/configure
Message-ID: <200710021014.l92AEhTK009368@zion.cs.uiuc.edu>
Author: gordon
Date: Tue Oct 2 05:14:42 2007
New Revision: 42529
URL: http://llvm.org/viewvc/llvm-project?rev=42529&view=rev
Log:
Regenerate.
Modified:
llvm/trunk/configure
Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=42529&r1=42528&r2=42529&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Tue Oct 2 05:14:42 2007
@@ -4836,7 +4836,7 @@
BINDINGS_TO_BUILD=""
case "$enableval" in
- all | yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
+ yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
all ) BINDINGS_TO_BUILD="ocaml" ;;
none | no) BINDINGS_TO_BUILD="" ;;
*)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do
From baldrick at free.fr Tue Oct 2 06:31:12 2007
From: baldrick at free.fr (Duncan Sands)
Date: Tue, 2 Oct 2007 13:31:12 +0200
Subject: [llvm-commits] Size of long double (X86_FP80Ty)
In-Reply-To: <4753238B-3DAB-454B-BE0D-491C1E815E23@apple.com>
References: <200709282204.17074.baldrick@free.fr>
<200709301023.44406.baldrick@free.fr>
<4753238B-3DAB-454B-BE0D-491C1E815E23@apple.com>
Message-ID: <200710021331.12297.baldrick@free.fr>
Hi Dale,
> The attached patch, plus the bits I've checked in, seems to work.
> There are no problems in the llvm testsuite but there's something
> funny going on in the gcc testsuite, although I'm not convinced it's
> the fault of this patch, so I'm not checking it in until I get that
> figured out. You could see if it works for you.
it doesn't cause any additional Ada testsuite passes or failures. However
I didn't check whether the tests fail differently (most of the tests are
multipart, so it is possible that more or less parts failed).
Best wishes,
Duncan.
From gordonhenriksen at mac.com Tue Oct 2 11:42:11 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Tue, 02 Oct 2007 16:42:11 -0000
Subject: [llvm-commits] [llvm] r42532 - in /llvm/trunk: Makefile.config.in
autoconf/configure.ac bindings/ocaml/Makefile.ocaml
bindings/ocaml/bitwriter/llvm_bitwriter.mli
Message-ID: <200710021642.l92GgBu1025978@zion.cs.uiuc.edu>
Author: gordon
Date: Tue Oct 2 11:42:10 2007
New Revision: 42532
URL: http://llvm.org/viewvc/llvm-project?rev=42532&view=rev
Log:
Providing --with-ocaml-libdir for ./configure. The default is the
stdlib if it's beneath --prefix, and is libdir/ocaml otherwise.
If someone has a better way than this to test whether $B is a path
within $A, I'd love to hear it:
if test "$A" \< "$B" -a "$B" \< "${A}~"
Modified:
llvm/trunk/Makefile.config.in
llvm/trunk/autoconf/configure.ac
llvm/trunk/bindings/ocaml/Makefile.ocaml
llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli
Modified: llvm/trunk/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=42532&r1=42531&r2=42532&view=diff
==============================================================================
--- llvm/trunk/Makefile.config.in (original)
+++ llvm/trunk/Makefile.config.in Tue Oct 2 11:42:10 2007
@@ -261,6 +261,7 @@
HUGE_VAL_SANITY = @HUGE_VAL_SANITY@
# Bindings that we should build
-BINDINGS_TO_BUILD = @BINDINGS_TO_BUILD@
-ALL_BINDINGS = @ALL_BINDINGS@
+BINDINGS_TO_BUILD := @BINDINGS_TO_BUILD@
+ALL_BINDINGS := @ALL_BINDINGS@
+OCAML_LIBDIR := @OCAML_LIBDIR@
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=42532&r1=42531&r2=42532&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Tue Oct 2 11:42:10 2007
@@ -450,6 +450,20 @@
;;
esac
+dnl Allow the ocaml libdir to be overridden. This could go in a configure
+dnl script for bindings/ocaml/configure, except that its auto value depends on
+dnl OCAMLC, which is found here to support tests.
+AC_ARG_WITH([ocaml-libdir],
+ [AS_HELP_STRING([--with-ocaml-libdir],
+ [Specify install location for ocaml bindings (default is stdlib)])],
+ [],
+ [withval=auto])
+case "$withval" in
+ auto) with_ocaml_libdir="$withval" ;;
+ /* | [[A-Za-z]]:[[\\/]]*) with_ocaml_libdir="$withval" ;;
+ *) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;;
+esac
+
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 4: Check for programs we need and that they are the right version
@@ -886,6 +900,44 @@
# other files.
AC_SUBST(ALL_BINDINGS,ocaml)
+# Do any work necessary to ensure that bindings have what they need.
+binding_prereqs_failed=0
+for a_binding in $BINDINGS_TO_BUILD ; do
+ case "$a_binding" in
+ ocaml)
+ if test "x$OCAMLC" = x ; then
+ AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc])
+ binding_prereqs_failed=1
+ fi
+ if test "x$OCAMLDEP" = x ; then
+ AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep])
+ binding_prereqs_failed=1
+ fi
+ if test "x$OCAMLOPT" = x ; then
+ AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt])
+ dnl ocamlopt is optional!
+ fi
+ if test "x$with_ocaml_libdir" != xauto ; then
+ AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir)
+ else
+ ocaml_stdlib="`"$OCAMLC" -where`"
+ if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~"
+ then
+ # ocaml stdlib is beneath our prefix; use stdlib
+ AC_SUBST(OCAML_LIBDIR,$ocaml_stdlib)
+ else
+ # ocaml stdlib is outside our prefix; use libdir/ocaml
+ AC_SUBST(OCAML_LIBDIR,$LLVM_LIBDIR/ocaml)
+ fi
+ fi
+ ;;
+ esac
+done
+if test "$binding_prereqs_failed" = 1 ; then
+ AC_MSG_ERROR([Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings.])
+fi
+
+
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 10: Specify the output files and generate it
Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=42532&r1=42531&r2=42532&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/Makefile.ocaml (original)
+++ llvm/trunk/bindings/ocaml/Makefile.ocaml Tue Oct 2 11:42:10 2007
@@ -14,12 +14,6 @@
include $(LEVEL)/Makefile.config
-# Find the ocaml stdlib root. /usr/local/lib/ocaml is the default when built
-# from source; distros use something like /usr/lib/ocaml/3.10.0.
-ifndef OCAML_LIBDIR
-OCAML_LIBDIR := $(shell $(OCAMLC) -where)
-endif
-
# CFLAGS needs to be set before Makefile.rules is included. Yes, ocaml puts its
# includes under its libdir.
CFLAGS += -I$(OCAML_LIBDIR)
@@ -27,7 +21,7 @@
include $(LEVEL)/Makefile.common
# Intentionally ignore PROJ_prefix here. We want the ocaml stdlib. However, the
-# user can override this with OCAML_LIBDIR.
+# user can override this with OCAML_LIBDIR or configure --with-ocaml-libdir=.
PROJ_libocamldir := $(DESTDIR)$(OCAML_LIBDIR)
OcamlDir := $(LibDir)/ocaml
Modified: llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli?rev=42532&r1=42531&r2=42532&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli (original)
+++ llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli Tue Oct 2 11:42:10 2007
@@ -8,7 +8,7 @@
*===----------------------------------------------------------------------===
*
* This interface provides an ocaml API for the LLVM bitcode writer, the
- * classes in the classes in the Bitwriter library.
+ * classes in the Bitwriter library.
*
*===----------------------------------------------------------------------===*)
From gordonhenriksen at mac.com Tue Oct 2 11:42:22 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Tue, 02 Oct 2007 16:42:22 -0000
Subject: [llvm-commits] [llvm] r42533 - /llvm/trunk/configure
Message-ID: <200710021642.l92GgN8n025999@zion.cs.uiuc.edu>
Author: gordon
Date: Tue Oct 2 11:42:22 2007
New Revision: 42533
URL: http://llvm.org/viewvc/llvm-project?rev=42533&view=rev
Log:
Regenerate.
Modified:
llvm/trunk/configure
Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=42533&r1=42532&r2=42533&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Tue Oct 2 11:42:22 2007
@@ -926,6 +926,7 @@
LLVM_CONFIGTIME
BINDINGS_TO_BUILD
ALL_BINDINGS
+OCAML_LIBDIR
LIBOBJS
LTLIBOBJS'
ac_subst_files=''
@@ -1562,6 +1563,8 @@
--with-llvmgccdir Specify location of llvm-gcc install dir (default
searches PATH)
--with-extra-options Specify addtional options to compile LLVM with
+ --with-ocaml-libdir Specify install location for ocaml bindings (default
+ is stdlib)
--with-tclinclude directory where tcl headers are
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-pic try to use only PIC/non-PIC objects [default=use
@@ -4851,6 +4854,22 @@
esac
+# Check whether --with-ocaml-libdir was given.
+if test "${with_ocaml_libdir+set}" = set; then
+ withval=$with_ocaml_libdir;
+else
+ withval=auto
+fi
+
+case "$withval" in
+ auto) with_ocaml_libdir="$withval" ;;
+ /* | [A-Za-z]:[\\/]*) with_ocaml_libdir="$withval" ;;
+ *) { { echo "$as_me:$LINENO: error: Invalid path for --with-ocaml-libdir. Provide full path" >&5
+echo "$as_me: error: Invalid path for --with-ocaml-libdir. Provide full path" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -10526,7 +10545,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext < conftest.$ac_ext
+ echo '#line 12692 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -14388,11 +14407,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14391: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14410: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14395: \$? = $ac_status" >&5
+ echo "$as_me:14414: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14656,11 +14675,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14659: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14678: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14663: \$? = $ac_status" >&5
+ echo "$as_me:14682: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14760,11 +14779,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14763: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14782: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14767: \$? = $ac_status" >&5
+ echo "$as_me:14786: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -17212,7 +17231,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext < conftest.$ac_ext <&5)
+ (eval echo "\"\$as_me:19702: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:19687: \$? = $ac_status" >&5
+ echo "$as_me:19706: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -19784,11 +19803,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:19787: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:19806: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:19791: \$? = $ac_status" >&5
+ echo "$as_me:19810: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -21354,11 +21373,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:21357: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:21376: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:21361: \$? = $ac_status" >&5
+ echo "$as_me:21380: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -21458,11 +21477,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:21461: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:21480: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:21465: \$? = $ac_status" >&5
+ echo "$as_me:21484: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -23693,11 +23712,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23696: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23715: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:23700: \$? = $ac_status" >&5
+ echo "$as_me:23719: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -23961,11 +23980,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23964: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23983: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:23968: \$? = $ac_status" >&5
+ echo "$as_me:23987: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -24065,11 +24084,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:24068: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:24087: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:24072: \$? = $ac_status" >&5
+ echo "$as_me:24091: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -34157,6 +34176,51 @@
ALL_BINDINGS=ocaml
+# Do any work necessary to ensure that bindings have what they need.
+binding_prereqs_failed=0
+for a_binding in $BINDINGS_TO_BUILD ; do
+ case "$a_binding" in
+ ocaml)
+ if test "x$OCAMLC" = x ; then
+ { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc" >&5
+echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc" >&2;}
+ binding_prereqs_failed=1
+ fi
+ if test "x$OCAMLDEP" = x ; then
+ { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep" >&5
+echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep" >&2;}
+ binding_prereqs_failed=1
+ fi
+ if test "x$OCAMLOPT" = x ; then
+ { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt" >&5
+echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt" >&2;}
+ fi
+ if test "x$with_ocaml_libdir" != xauto ; then
+ OCAML_LIBDIR=$with_ocaml_libdir
+
+ else
+ ocaml_stdlib="`"$OCAMLC" -where`"
+ if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~"
+ then
+ # ocaml stdlib is beneath our prefix; use stdlib
+ OCAML_LIBDIR=$ocaml_stdlib
+
+ else
+ # ocaml stdlib is outside our prefix; use libdir/ocaml
+ OCAML_LIBDIR=$LLVM_LIBDIR/ocaml
+
+ fi
+ fi
+ ;;
+ esac
+done
+if test "$binding_prereqs_failed" = 1 ; then
+ { { echo "$as_me:$LINENO: error: Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings." >&5
+echo "$as_me: error: Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
ac_config_headers="$ac_config_headers include/llvm/Config/config.h"
@@ -35078,11 +35142,12 @@
LLVM_CONFIGTIME!$LLVM_CONFIGTIME$ac_delim
BINDINGS_TO_BUILD!$BINDINGS_TO_BUILD$ac_delim
ALL_BINDINGS!$ALL_BINDINGS$ac_delim
+OCAML_LIBDIR!$OCAML_LIBDIR$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 75; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
From dalej at apple.com Tue Oct 2 12:42:04 2007
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 02 Oct 2007 17:42:04 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42536 -
/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Message-ID: <200710021742.l92Hg5CZ028923@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Oct 2 12:42:04 2007
New Revision: 42536
URL: http://llvm.org/viewvc/llvm-project?rev=42536&view=rev
Log:
Use getABITypeSizeInBits for improved type checking.
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=42536&r1=42535&r2=42536&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Tue Oct 2 12:42:04 2007
@@ -74,12 +74,11 @@
static const Type * llvm_set_type(tree Tr, const Type *Ty) {
// For x86 long double, llvm records the size of the data (80) while
- // gcc's TYPE_SIZE including alignment padding. Compensate.
+ // gcc's TYPE_SIZE including alignment padding. getABITypeSizeInBits
+ // is used to compensate for this.
assert((!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) ||
- getInt64(TYPE_SIZE(Tr), true) == getTargetData().getTypeSizeInBits(Ty) ||
- (getTargetData().getTypeSizeInBits(Ty) == 80 &&
- (getInt64(TYPE_SIZE(Tr), true) == 96 ||
- getInt64(TYPE_SIZE(Tr), true) == 128)))
+ getInt64(TYPE_SIZE(Tr), true) ==
+ getTargetData().getABITypeSizeInBits(Ty))
&& "LLVM type size doesn't match GCC type size!");
unsigned &TypeSlot = LTypesMap[Ty];
From dalej at apple.com Tue Oct 2 12:44:00 2007
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 02 Oct 2007 17:44:00 -0000
Subject: [llvm-commits] [llvm] r42537 - in /llvm/trunk:
include/llvm/Intrinsics.td lib/Analysis/ConstantFolding.cpp
lib/CodeGen/IntrinsicLowering.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/Target/CBackend/CBackend.cpp
Message-ID: <200710021744.l92Hi0IJ029003@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Oct 2 12:43:59 2007
New Revision: 42537
URL: http://llvm.org/viewvc/llvm-project?rev=42537&view=rev
Log:
Rewrite sqrt and powi to use anyfloat. By popular demand.
Modified:
llvm/trunk/include/llvm/Intrinsics.td
llvm/trunk/lib/Analysis/ConstantFolding.cpp
llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/lib/Target/CBackend/CBackend.cpp
Modified: llvm/trunk/include/llvm/Intrinsics.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=42537&r1=42536&r2=42537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Intrinsics.td (original)
+++ llvm/trunk/include/llvm/Intrinsics.td Tue Oct 2 12:43:59 2007
@@ -178,18 +178,8 @@
}
let Properties = [IntrNoMem] in {
- def int_sqrt_f32 : Intrinsic<[llvm_float_ty, llvm_float_ty]>;
- def int_sqrt_f64 : Intrinsic<[llvm_double_ty, llvm_double_ty]>;
- def int_sqrt_f80 : Intrinsic<[llvm_f80_ty, llvm_f80_ty]>;
- def int_sqrt_f128 : Intrinsic<[llvm_f128_ty, llvm_f128_ty]>;
- def int_sqrt_ppcf128 : Intrinsic<[llvm_ppcf128_ty, llvm_ppcf128_ty]>;
-
- def int_powi_f32 : Intrinsic<[llvm_float_ty, llvm_float_ty, llvm_i32_ty]>;
- def int_powi_f64 : Intrinsic<[llvm_double_ty, llvm_double_ty, llvm_i32_ty]>;
- def int_powi_f80 : Intrinsic<[llvm_f80_ty, llvm_f80_ty, llvm_i32_ty]>;
- def int_powi_f128 : Intrinsic<[llvm_f128_ty, llvm_f128_ty, llvm_i32_ty]>;
- def int_powi_ppcf128 : Intrinsic<[llvm_ppcf128_ty, llvm_ppcf128_ty,
- llvm_i32_ty]>;
+ def int_sqrt : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>]>;
+ def int_powi : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>, llvm_i32_ty]>;
}
// NOTE: these are internal interfaces.
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=42537&r1=42536&r2=42537&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Tue Oct 2 12:43:59 2007
@@ -329,16 +329,8 @@
bool
llvm::canConstantFoldCallTo(Function *F) {
switch (F->getIntrinsicID()) {
- case Intrinsic::sqrt_f32:
- case Intrinsic::sqrt_f64:
- case Intrinsic::sqrt_f80:
- case Intrinsic::sqrt_f128:
- case Intrinsic::sqrt_ppcf128:
- case Intrinsic::powi_f32:
- case Intrinsic::powi_f64:
- case Intrinsic::powi_f80:
- case Intrinsic::powi_f128:
- case Intrinsic::powi_ppcf128:
+ case Intrinsic::sqrt:
+ case Intrinsic::powi:
case Intrinsic::bswap:
case Intrinsic::ctpop:
case Intrinsic::ctlz:
@@ -539,12 +531,12 @@
}
} else if (NumOperands == 2) {
if (ConstantFP *Op1 = dyn_cast(Operands[0])) {
+ if (Ty!=Type::FloatTy && Ty!=Type::DoubleTy)
+ return 0;
double Op1V = Ty==Type::FloatTy ?
(double)Op1->getValueAPF().convertToFloat():
Op1->getValueAPF().convertToDouble();
if (ConstantFP *Op2 = dyn_cast(Operands[1])) {
- if (Ty!=Type::FloatTy && Ty!=Type::DoubleTy)
- return 0;
double Op2V = Ty==Type::FloatTy ?
(double)Op2->getValueAPF().convertToFloat():
Op2->getValueAPF().convertToDouble();
Modified: llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp?rev=42537&r1=42536&r2=42537&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Tue Oct 2 12:43:59 2007
@@ -99,14 +99,20 @@
PointerType::get(Type::Int8Ty), Type::Int32Ty,
TD.getIntPtrType(), (Type *)0);
break;
- case Intrinsic::sqrt_f32:
- case Intrinsic::sqrt_f64:
- if(I->arg_begin()->getType() == Type::FloatTy)
+ case Intrinsic::sqrt:
+ switch((int)I->arg_begin()->getType()->getTypeID()) {
+ case Type::FloatTyID:
EnsureFunctionExists(M, "sqrtf", I->arg_begin(), I->arg_end(),
Type::FloatTy);
- else
+ case Type::DoubleTyID:
EnsureFunctionExists(M, "sqrt", I->arg_begin(), I->arg_end(),
Type::DoubleTy);
+ case Type::X86_FP80TyID:
+ case Type::FP128TyID:
+ case Type::PPC_FP128TyID:
+ EnsureFunctionExists(M, "sqrtl", I->arg_begin(), I->arg_end(),
+ I->arg_begin()->getType());
+ }
break;
}
}
@@ -782,34 +788,27 @@
MemsetFCache);
break;
}
- case Intrinsic::sqrt_f32: {
+ case Intrinsic::sqrt: {
static Constant *sqrtfFCache = 0;
- ReplaceCallWith("sqrtf", CI, CI->op_begin()+1, CI->op_end(),
- Type::FloatTy, sqrtfFCache);
- break;
- }
- case Intrinsic::sqrt_f64: {
static Constant *sqrtFCache = 0;
- ReplaceCallWith("sqrt", CI, CI->op_begin()+1, CI->op_end(),
+ static Constant *sqrtLDCache = 0;
+ switch (CI->getOperand(1)->getType()->getTypeID()) {
+ default: assert(0 && "Invalid type in sqrt"); abort();
+ case Type::FloatTyID:
+ ReplaceCallWith("sqrtf", CI, CI->op_begin()+1, CI->op_end(),
+ Type::FloatTy, sqrtfFCache);
+ break;
+ case Type::DoubleTyID:
+ ReplaceCallWith("sqrt", CI, CI->op_begin()+1, CI->op_end(),
Type::DoubleTy, sqrtFCache);
- break;
- }
- case Intrinsic::sqrt_f80: {
- static Constant *sqrtF80Cache = 0;
- ReplaceCallWith("sqrtl", CI, CI->op_begin()+1, CI->op_end(),
- Type::X86_FP80Ty, sqrtF80Cache);
- break;
- }
- case Intrinsic::sqrt_f128: {
- static Constant *sqrtF128Cache = 0;
- ReplaceCallWith("sqrtl", CI, CI->op_begin()+1, CI->op_end(),
- Type::FP128Ty, sqrtF128Cache);
- break;
- }
- case Intrinsic::sqrt_ppcf128: {
- static Constant *sqrtppcF128Cache = 0;
- ReplaceCallWith("sqrtl", CI, CI->op_begin()+1, CI->op_end(),
- Type::PPC_FP128Ty, sqrtppcF128Cache);
+ break;
+ case Type::X86_FP80TyID:
+ case Type::FP128TyID:
+ case Type::PPC_FP128TyID:
+ ReplaceCallWith("sqrtl", CI, CI->op_begin()+1, CI->op_end(),
+ CI->getOperand(1)->getType(), sqrtLDCache);
+ break;
+ }
break;
}
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=42537&r1=42536&r2=42537&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Oct 2 12:43:59 2007
@@ -2796,20 +2796,12 @@
return 0;
}
- case Intrinsic::sqrt_f32:
- case Intrinsic::sqrt_f64:
- case Intrinsic::sqrt_f80:
- case Intrinsic::sqrt_f128:
- case Intrinsic::sqrt_ppcf128:
+ case Intrinsic::sqrt:
setValue(&I, DAG.getNode(ISD::FSQRT,
getValue(I.getOperand(1)).getValueType(),
getValue(I.getOperand(1))));
return 0;
- case Intrinsic::powi_f32:
- case Intrinsic::powi_f64:
- case Intrinsic::powi_f80:
- case Intrinsic::powi_f128:
- case Intrinsic::powi_ppcf128:
+ case Intrinsic::powi:
setValue(&I, DAG.getNode(ISD::FPOWI,
getValue(I.getOperand(1)).getValueType(),
getValue(I.getOperand(1)),
Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=42537&r1=42536&r2=42537&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Tue Oct 2 12:43:59 2007
@@ -2417,8 +2417,7 @@
case Intrinsic::longjmp:
case Intrinsic::prefetch:
case Intrinsic::dbg_stoppoint:
- case Intrinsic::powi_f32:
- case Intrinsic::powi_f64:
+ case Intrinsic::powi:
// We directly implement these intrinsics
break;
default:
@@ -2537,8 +2536,7 @@
writeOperand(I.getOperand(1));
Out << ')';
return;
- case Intrinsic::powi_f32:
- case Intrinsic::powi_f64:
+ case Intrinsic::powi:
Out << "__builtin_powi(";
writeOperand(I.getOperand(1));
Out << ", ";
From dalej at apple.com Tue Oct 2 12:44:34 2007
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 02 Oct 2007 17:44:34 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42538 -
/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
Message-ID: <200710021744.l92HiY2u029037@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Oct 2 12:44:34 2007
New Revision: 42538
URL: http://llvm.org/viewvc/llvm-project?rev=42538&view=rev
Log:
Rewrite sqrt and powi to use anyfloat.
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=42538&r1=42537&r2=42538&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Tue Oct 2 12:44:34 2007
@@ -4499,17 +4499,10 @@
Value *TreeToLLVM::EmitBuiltinSQRT(tree exp) {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
Intrinsic::ID Id = Intrinsic::not_intrinsic;
+ const Type* Ty = Amt->getType();
- switch (Amt->getType()->getTypeID()) {
- default: assert(0 && "Unknown FP type!");
- case Type::FloatTyID: Id = Intrinsic::sqrt_f32; break;
- case Type::DoubleTyID: Id = Intrinsic::sqrt_f64; break;
- case Type::X86_FP80TyID: Id = Intrinsic::sqrt_f80; break;
- case Type::FP128TyID: Id = Intrinsic::sqrt_f128; break;
- case Type::PPC_FP128TyID: Id = Intrinsic::sqrt_ppcf128; break;
- }
-
- return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id),
+ return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::sqrt, &Ty, 1),
Amt, "tmp");
}
@@ -4520,23 +4513,14 @@
Value *Val = Emit(TREE_VALUE(ArgList), 0);
Value *Pow = Emit(TREE_VALUE(TREE_CHAIN(ArgList)), 0);
+ const Type *Ty = Val->getType();
Pow = CastToSIntType(Pow, Type::Int32Ty);
- Intrinsic::ID Id = Intrinsic::not_intrinsic;
-
- switch (Val->getType()->getTypeID()) {
- default: assert(0 && "Unknown FP type!");
- case Type::FloatTyID: Id = Intrinsic::powi_f32; break;
- case Type::DoubleTyID: Id = Intrinsic::powi_f64; break;
- case Type::X86_FP80TyID: Id = Intrinsic::powi_f80; break;
- case Type::FP128TyID: Id = Intrinsic::powi_f128; break;
- case Type::PPC_FP128TyID: Id = Intrinsic::powi_ppcf128; break;
- }
-
SmallVector Args;
Args.push_back(Val);
Args.push_back(Pow);
- return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id),
+ return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::powi, &Ty, 1),
Args.begin(), Args.end(), "tmp");
}
From dalej at apple.com Tue Oct 2 12:44:51 2007
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 02 Oct 2007 17:44:51 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42539 -
/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Message-ID: <200710021744.l92Hipqm029060@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Oct 2 12:44:51 2007
New Revision: 42539
URL: http://llvm.org/viewvc/llvm-project?rev=42539&view=rev
Log:
Rewrite sqrt and powi to use anyfloat.
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=42539&r1=42538&r2=42539&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Oct 2 12:44:51 2007
@@ -4052,17 +4052,10 @@
Value *TreeToLLVM::EmitBuiltinSQRT(tree exp) {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
Intrinsic::ID Id = Intrinsic::not_intrinsic;
+ const Type* Ty = Amt->getType();
- switch (Amt->getType()->getTypeID()) {
- default: assert(0 && "Unknown FP type!");
- case Type::FloatTyID: Id = Intrinsic::sqrt_f32; break;
- case Type::DoubleTyID: Id = Intrinsic::sqrt_f64; break;
- case Type::X86_FP80TyID: Id = Intrinsic::sqrt_f80; break;
- case Type::FP128TyID: Id = Intrinsic::sqrt_f128; break;
- case Type::PPC_FP128TyID: Id = Intrinsic::sqrt_ppcf128; break;
- }
-
- return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id),
+ return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::sqrt, &Ty, 1),
Amt, "tmp");
}
@@ -4073,23 +4066,14 @@
Value *Val = Emit(TREE_VALUE(ArgList), 0);
Value *Pow = Emit(TREE_VALUE(TREE_CHAIN(ArgList)), 0);
+ const Type *Ty = Val->getType();
Pow = CastToSIntType(Pow, Type::Int32Ty);
- Intrinsic::ID Id = Intrinsic::not_intrinsic;
-
- switch (Val->getType()->getTypeID()) {
- default: assert(0 && "Unknown FP type!");
- case Type::FloatTyID: Id = Intrinsic::powi_f32; break;
- case Type::DoubleTyID: Id = Intrinsic::powi_f64; break;
- case Type::X86_FP80TyID: Id = Intrinsic::powi_f80; break;
- case Type::FP128TyID: Id = Intrinsic::powi_f128; break;
- case Type::PPC_FP128TyID: Id = Intrinsic::powi_ppcf128; break;
- }
-
SmallVector Args;
Args.push_back(Val);
Args.push_back(Pow);
- return Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id),
+ return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
+ Intrinsic::powi, &Ty, 1),
Args.begin(), Args.end(), "tmp");
}
From dalej at apple.com Tue Oct 2 12:47:38 2007
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 02 Oct 2007 17:47:38 -0000
Subject: [llvm-commits] [llvm] r42540 - /llvm/trunk/docs/LangRef.html
Message-ID: <200710021747.l92HlcZ7029155@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Oct 2 12:47:38 2007
New Revision: 42540
URL: http://llvm.org/viewvc/llvm-project?rev=42540&view=rev
Log:
Document new sqrt and powi handling.
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=42540&r1=42539&r2=42540&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Tue Oct 2 12:47:38 2007
@@ -4484,9 +4484,14 @@
Syntax:
+
This is an overloaded intrinsic. You can use llvm.sqrt on any
+floating point type. Not all targets support all types however.
- declare float @llvm.sqrt.f32(float %Val)
- declare double @llvm.sqrt.f64(double %Val)
+ declare float @llvm.sqrt.f32(float %Val)
+ declare double @llvm.sqrt.f64(double %Val)
+ declare x86_fp80 @llvm.sqrt.f80(x86_fp80 %Val)
+ declare fp128 @llvm.sqrt.f128(fp128 %Val)
+ declare ppc_fp128 @llvm.sqrt.ppcf128(ppc_fp128 %Val)
Overview:
@@ -4520,9 +4525,14 @@
Syntax:
+
This is an overloaded intrinsic. You can use llvm.powi on any
+floating point type. Not all targets support all types however.
- declare float @llvm.powi.f32(float %Val, i32 %power)
- declare double @llvm.powi.f64(double %Val, i32 %power)
+ declare float @llvm.powi.f32(float %Val, i32 %power)
+ declare double @llvm.powi.f64(double %Val, i32 %power)
+ declare x86_fp80 @llvm.powi.f80(x86_fp80 %Val, i32 %power)
+ declare fp128 @llvm.powi.f128(fp128 %Val, i32 %power)
+ declare ppc_fp128 @llvm.powi.ppcf128(ppc_fp128 %Val, i32 %power)
Overview:
From gordonhenriksen at mac.com Tue Oct 2 13:04:26 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Tue, 02 Oct 2007 18:04:26 -0000
Subject: [llvm-commits] [llvm] r42541 - /llvm/trunk/CREDITS.TXT
Message-ID: <200710021804.l92I4QDA029787@zion.cs.uiuc.edu>
Author: gordon
Date: Tue Oct 2 13:04:24 2007
New Revision: 42541
URL: http://llvm.org/viewvc/llvm-project?rev=42541&view=rev
Log:
Updating my credits entry.
Modified:
llvm/trunk/CREDITS.TXT
Modified: llvm/trunk/CREDITS.TXT
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=42541&r1=42540&r2=42541&view=diff
==============================================================================
--- llvm/trunk/CREDITS.TXT (original)
+++ llvm/trunk/CREDITS.TXT Tue Oct 2 13:04:24 2007
@@ -108,7 +108,9 @@
N: Gordon Henriksen
E: gordonhenriksen at mac.com
+D: Pluggable GC support
D: C interface
+D: Ocaml bindings
N: Raul Fernandes Herbster
E: raul at dsc.ufcg.edu.br
From lattner at apple.com Tue Oct 2 13:51:31 2007
From: lattner at apple.com (Tanya Lattner)
Date: Tue, 2 Oct 2007 11:51:31 -0700
Subject: [llvm-commits] make check errors
Message-ID: <24EC4450-66E1-4E56-B5AB-867F4871F420@apple.com>
I'm seeing several make check errors (this is x86 Darwin, Revision:
42541). Any ideas?
FAIL: /Users/lattner/work/llvm/test/CFrontend/2004-11-27-
VariableSizeInStructure.c for PR360
Failed with exit(1) at line 1
while running: /Users/lattner/work/llvm-gcc/install/bin/llvm-gcc -
emit-llvm /Users/lattner/work/llvm/test/CFrontend/2004-11-27-
VariableSizeInStructure.c -S -o /dev/null
/Users/lattner/work/llvm/test/CFrontend/2004-11-27-
VariableSizeInStructure.c: In function 'sub1':
/Users/lattner/work/llvm/test/CFrontend/2004-11-27-
VariableSizeInStructure.c:7: internal compiler error: tree check:
expected integer_cst, have var_decl in ConvertRECORD, at llvm-
types.cpp:1673
Please submit a full bug report,
with preprocessed source if appropriate.
See
for instructions.
FAIL: /Users/lattner/work/llvm/test/CFrontend/2005-10-18-
VariableSizedElementCrash.c
Failed with exit(1) at line 1
while running: /Users/lattner/work/llvm-gcc/install/bin/llvm-gcc -
emit-llvm /Users/lattner/work/llvm/test/CFrontend/2005-10-18-
VariableSizedElementCrash.c -S -o -
.abort
/Users/lattner/work/llvm/test/CFrontend/2005-10-18-
VariableSizedElementCrash.c: In function 'sub1':
/Users/lattner/work/llvm/test/CFrontend/2005-10-18-
VariableSizedElementCrash.c:5: warning: no semicolon at end of struct
or union
/Users/lattner/work/llvm/test/CFrontend/2005-10-18-
VariableSizedElementCrash.c:3: internal compiler error: tree check:
expected integer_cst, have var_decl in ConvertRECORD, at llvm-
types.cpp:1673
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
FAIL: /Users/lattner/work/llvm/test/CFrontend/2007-02-04-
WITH_SIZE_EXPR.c for PR1174
Failed with exit(1) at line 1
while running: /Users/lattner/work/llvm-gcc/install/bin/llvm-gcc -
emit-llvm /Users/lattner/work/llvm/test/CFrontend/2007-02-04-
WITH_SIZE_EXPR.c -O3 -S -o - -emit-llvm
.abort
/Users/lattner/work/llvm/test/CFrontend/2007-02-04-WITH_SIZE_EXPR.c:
In function 'zzz':
/Users/lattner/work/llvm/test/CFrontend/2007-02-04-WITH_SIZE_EXPR.c:
5: internal compiler error: tree check: expected integer_cst, have
var_decl in ConvertRECORD, at llvm-types.cpp:1673
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
FAIL: /Users/lattner/work/llvm/test/CFrontend/2007-02-16-
VariableSizeStructArg.c for PR1170
Failed with exit(1) at line 1
while running: /Users/lattner/work/llvm-gcc/install/bin/llvm-gcc -
emit-llvm -S /Users/lattner/work/llvm/test/CFrontend/2007-02-16-
VariableSizeStructArg.c -o -
.abort
/Users/lattner/work/llvm/test/CFrontend/2007-02-16-
VariableSizeStructArg.c:3: warning: anonymous struct declared inside
parameter list
/Users/lattner/work/llvm/test/CFrontend/2007-02-16-
VariableSizeStructArg.c:3: warning: its scope is only this definition
or declaration, which is probably not what you want
/Users/lattner/work/llvm/test/CFrontend/2007-02-16-
VariableSizeStructArg.c: In function 'f':
/Users/lattner/work/llvm/test/CFrontend/2007-02-16-
VariableSizeStructArg.c:3: internal compiler error: tree check:
expected integer_cst, have var_decl in ConvertRECORD, at llvm-
types.cpp:1673
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
FAIL: /Users/lattner/work/llvm/test/CFrontend/2007-03-06-
VarSizeInStruct1.c
Failed with exit(1) at line 1
while running: /Users/lattner/work/llvm-gcc/install/bin/llvm-gcc -
emit-llvm /Users/lattner/work/llvm/test/CFrontend/2007-03-06-
VarSizeInStruct1.c -S -o -
.abort
/Users/lattner/work/llvm/test/CFrontend/2007-03-06-
VarSizeInStruct1.c: In function 'p':
/Users/lattner/work/llvm/test/CFrontend/2007-03-06-VarSizeInStruct1.c:
7: warning: function returns address of local variable
/Users/lattner/work/llvm/test/CFrontend/2007-03-06-VarSizeInStruct1.c:
2: internal compiler error: tree check: expected integer_cst, have
var_decl in ConvertRECORD, at llvm-types.cpp:1673
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
FAIL: /Users/lattner/work/llvm/test/CFrontend/2007-03-06-
VarSizeInStruct2.c
Failed with exit(1) at line 1
while running: /Users/lattner/work/llvm-gcc/install/bin/llvm-gcc -
emit-llvm /Users/lattner/work/llvm/test/CFrontend/2007-03-06-
VarSizeInStruct2.c -S -o -
.abort
/Users/lattner/work/llvm/test/CFrontend/2007-03-06-
VarSizeInStruct2.c: In function 'p':
/Users/lattner/work/llvm/test/CFrontend/2007-03-06-VarSizeInStruct2.c:
2: internal compiler error: tree check: expected integer_cst, have
var_decl in ConvertRECORD, at llvm-types.cpp:1673
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
-Tanya
From dpatel at apple.com Tue Oct 2 13:56:40 2007
From: dpatel at apple.com (Devang Patel)
Date: Tue, 2 Oct 2007 11:56:40 -0700
Subject: [llvm-commits] make check errors
In-Reply-To: <24EC4450-66E1-4E56-B5AB-867F4871F420@apple.com>
References: <24EC4450-66E1-4E56-B5AB-867F4871F420@apple.com>
Message-ID:
On Oct 2, 2007, at 11:51 AM, Tanya Lattner wrote:
> I'm seeing several make check errors (this is x86 Darwin, Revision:
> 42541). Any ideas?
I'll take a look.
-
Devang
From isanbard at gmail.com Tue Oct 2 14:55:05 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 19:55:05 -0000
Subject: [llvm-commits] [llvm] r42542 -
/llvm/trunk/lib/Target/X86/README-SSE.txt
Message-ID: <200710021955.l92Jt57O002086@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 14:55:05 2007
New Revision: 42542
URL: http://llvm.org/viewvc/llvm-project?rev=42542&view=rev
Log:
Micro-optimization -- missed LICM opportunity.
Modified:
llvm/trunk/lib/Target/X86/README-SSE.txt
Modified: llvm/trunk/lib/Target/X86/README-SSE.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=42542&r1=42541&r2=42542&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README-SSE.txt (original)
+++ llvm/trunk/lib/Target/X86/README-SSE.txt Tue Oct 2 14:55:05 2007
@@ -671,3 +671,27 @@
//===---------------------------------------------------------------------===//
+In this loop:
+
+LBB4_6: # bb47.preheader
+ shlw $2, %si
+ decw %si
+ movzwl %si, %eax
+ incl %eax
+ xorl %ecx, %ecx
+LBB4_7: # bb47
+ xorps %xmm0, %xmm0 # (1)
+ movaps %xmm0, (%edx)
+ movaps %xmm0, 16(%edx)
+ addl $32, %edx
+ incl %ecx
+ cmpl %eax, %ecx
+ jne LBB4_7 # bb47
+LBB4_8: # bb42.return_crit_edge
+ xorw %si, %si
+ jmp LBB4_12 # return
+
+The instruction at (1) can be moved out of the main body of the loop.
+
+//===---------------------------------------------------------------------===//
+
From isanbard at gmail.com Tue Oct 2 15:42:59 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 20:42:59 -0000
Subject: [llvm-commits] [llvm] r42546 - /llvm/trunk/lib/Target/X86/README.txt
Message-ID: <200710022042.l92Kgx2O005184@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 15:42:59 2007
New Revision: 42546
URL: http://llvm.org/viewvc/llvm-project?rev=42546&view=rev
Log:
Another missed optimization.
Modified:
llvm/trunk/lib/Target/X86/README.txt
Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=42546&r1=42545&r2=42546&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Tue Oct 2 15:42:59 2007
@@ -1239,3 +1239,31 @@
//===---------------------------------------------------------------------===//
+The following code:
+
+LBB3_5: # bb114.preheader
+ movswl -68(%ebp), %eax
+ movl $32, %ecx
+ movl %ecx, -80(%ebp)
+ subl %eax, -80(%ebp)
+ movswl -52(%ebp), %eax
+ movl %ecx, -84(%ebp)
+ subl %eax, -84(%ebp)
+ movswl -70(%ebp), %eax
+ movl %ecx, -88(%ebp)
+ subl %eax, -88(%ebp)
+ movswl -50(%ebp), %eax
+ subl %eax, %ecx
+ movl %ecx, -76(%ebp)
+ movswl -42(%ebp), %eax
+ movl %eax, -92(%ebp)
+ movswl -66(%ebp), %eax
+ movl %eax, -96(%ebp)
+ movw $0, -98(%ebp)
+
+has redundant subtractions of %eax from a stack slot. However, %ecx doesn't
+change, so we could simply subtract %eax from %ecx first and then use %ecx (or
+vice-versa).
+
+//===---------------------------------------------------------------------===//
+
From isanbard at gmail.com Tue Oct 2 15:54:32 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 20:54:32 -0000
Subject: [llvm-commits] [llvm] r42547 - /llvm/trunk/lib/Target/X86/README.txt
Message-ID: <200710022054.l92KsWiX006088@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 15:54:32 2007
New Revision: 42547
URL: http://llvm.org/viewvc/llvm-project?rev=42547&view=rev
Log:
Now with LL code!
Modified:
llvm/trunk/lib/Target/X86/README.txt
Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=42547&r1=42546&r2=42547&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Tue Oct 2 15:54:32 2007
@@ -1241,6 +1241,22 @@
The following code:
+bb114.preheader: ; preds = %cond_next94
+ %tmp231232 = sext i16 %tmp62 to i32 ; [#uses=1]
+ %tmp233 = sub i32 32, %tmp231232 ; [#uses=1]
+ %tmp245246 = sext i16 %tmp65 to i32 ; [#uses=1]
+ %tmp252253 = sext i16 %tmp68 to i32 ; [#uses=1]
+ %tmp254 = sub i32 32, %tmp252253 ; [#uses=1]
+ %tmp553554 = bitcast i16* %tmp37 to i8* ; [#uses=2]
+ %tmp583584 = sext i16 %tmp98 to i32 ; [#uses=1]
+ %tmp585 = sub i32 32, %tmp583584 ; [#uses=1]
+ %tmp614615 = sext i16 %tmp101 to i32 ; [#uses=1]
+ %tmp621622 = sext i16 %tmp104 to i32 ; [#uses=1]
+ %tmp623 = sub i32 32, %tmp621622 ; [#uses=1]
+ br label %bb114
+
+produces:
+
LBB3_5: # bb114.preheader
movswl -68(%ebp), %eax
movl $32, %ecx
@@ -1261,7 +1277,7 @@
movl %eax, -96(%ebp)
movw $0, -98(%ebp)
-has redundant subtractions of %eax from a stack slot. However, %ecx doesn't
+This has redundant subtractions of %eax from a stack slot. However, %ecx doesn't
change, so we could simply subtract %eax from %ecx first and then use %ecx (or
vice-versa).
From isanbard at gmail.com Tue Oct 2 16:01:16 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 21:01:16 -0000
Subject: [llvm-commits] [llvm] r42548 -
/llvm/trunk/lib/Target/X86/README-SSE.txt
Message-ID: <200710022101.l92L1GDe006547@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 16:01:16 2007
New Revision: 42548
URL: http://llvm.org/viewvc/llvm-project?rev=42548&view=rev
Log:
Now with source code.
Modified:
llvm/trunk/lib/Target/X86/README-SSE.txt
Modified: llvm/trunk/lib/Target/X86/README-SSE.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=42548&r1=42547&r2=42548&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README-SSE.txt (original)
+++ llvm/trunk/lib/Target/X86/README-SSE.txt Tue Oct 2 16:01:16 2007
@@ -673,6 +673,22 @@
In this loop:
+bb49: ; preds = %bb49, %bb49.preheader
+ %indvar = phi i32 [ 0, %bb49.preheader ], [ %indvar.next, %bb49 ] ; [#uses=2]
+ %dp.089.0.rec = shl i32 %indvar, 3 ; [#uses=2]
+ %dp.089.0 = getelementptr i32* %tmp89, i32 %dp.089.0.rec ; [#uses=1]
+ %tmp5051 = bitcast i32* %dp.089.0 to <2 x i64>* ; <<2 x i64>*> [#uses=1]
+ store <2 x i64> zeroinitializer, <2 x i64>* %tmp5051, align 16
+ %dp.089.0.sum105 = or i32 %dp.089.0.rec, 4 ; [#uses=1]
+ %tmp56 = getelementptr i32* %tmp89, i32 %dp.089.0.sum105 ; [#uses=1]
+ %tmp5657 = bitcast i32* %tmp56 to <2 x i64>* ; <<2 x i64>*> [#uses=1]
+ store <2 x i64> zeroinitializer, <2 x i64>* %tmp5657, align 16
+ %indvar.next = add i32 %indvar, 1 ; [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, %tmp98 ; [#uses=1]
+ br i1 %exitcond, label %bb72, label %bb49
+
+we get:
+
LBB4_6: # bb47.preheader
shlw $2, %si
decw %si
From isanbard at gmail.com Tue Oct 2 16:02:53 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 21:02:53 -0000
Subject: [llvm-commits] [llvm] r42549 -
/llvm/trunk/lib/Target/X86/README-SSE.txt
Message-ID: <200710022102.l92L2sTb006688@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 16:02:53 2007
New Revision: 42549
URL: http://llvm.org/viewvc/llvm-project?rev=42549&view=rev
Log:
Small label changes.
Modified:
llvm/trunk/lib/Target/X86/README-SSE.txt
Modified: llvm/trunk/lib/Target/X86/README-SSE.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=42549&r1=42548&r2=42549&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README-SSE.txt (original)
+++ llvm/trunk/lib/Target/X86/README-SSE.txt Tue Oct 2 16:02:53 2007
@@ -689,13 +689,13 @@
we get:
-LBB4_6: # bb47.preheader
+LBB5_6: # bb49.preheader
shlw $2, %si
decw %si
movzwl %si, %eax
incl %eax
xorl %ecx, %ecx
-LBB4_7: # bb47
+LBB5_7: # bb49
xorps %xmm0, %xmm0 # (1)
movaps %xmm0, (%edx)
movaps %xmm0, 16(%edx)
@@ -703,9 +703,6 @@
incl %ecx
cmpl %eax, %ecx
jne LBB4_7 # bb47
-LBB4_8: # bb42.return_crit_edge
- xorw %si, %si
- jmp LBB4_12 # return
The instruction at (1) can be moved out of the main body of the loop.
From dpatel at apple.com Tue Oct 2 16:28:45 2007
From: dpatel at apple.com (Devang Patel)
Date: Tue, 02 Oct 2007 21:28:45 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42550 -
/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
Message-ID: <200710022128.l92LSjLQ008191@zion.cs.uiuc.edu>
Author: dpatel
Date: Tue Oct 2 16:28:44 2007
New Revision: 42550
URL: http://llvm.org/viewvc/llvm-project?rev=42550&view=rev
Log:
Remove extra bytes from LLVMStruct only if is bigger than GCC struct.
This patch fixes gcc assertion failure caused by previous patch.
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=42550&r1=42549&r2=42550&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Tue Oct 2 16:28:44 2007
@@ -1160,7 +1160,7 @@
// If this is a Packed struct and ExtraBitsAvailable is not zero then
// remove Extra bytes if ExtraBitsAvailable > 8.
- void RemoveExtraBytes (unsigned GCCTypeSize) {
+ void RemoveExtraBytes () {
unsigned NoOfBytesToRemove = ExtraBitsAvailable/8;
@@ -1170,10 +1170,6 @@
if (NoOfBytesToRemove == 0)
return;
- unsigned OriginalSize = ElementSizeInBytes.back();
- if (OriginalSize == GCCTypeSize)
- return;
-
const Type *LastType = Elements.back();
unsigned PadBytes = 0;
@@ -1192,6 +1188,7 @@
// Update last element type and size, element offset is unchanged.
const Type *Pad = ArrayType::get(Type::Int8Ty, PadBytes);
+ unsigned OriginalSize = ElementSizeInBytes.back();
Elements.pop_back();
Elements.push_back(Pad);
@@ -1670,13 +1667,17 @@
for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field))
DecodeStructFields(Field, *Info);
- uint64_t GCCTypeSize = ((uint64_t)TREE_INT_CST_LOW(TYPE_SIZE(type))+7)/8;
- Info->RemoveExtraBytes(GCCTypeSize);
// If the LLVM struct requires explicit tail padding to be the same size as
// the GCC struct, insert tail padding now. This handles, e.g., "{}" in C++.
if (TYPE_SIZE(type) && TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST) {
+ uint64_t GCCTypeSize = ((uint64_t)TREE_INT_CST_LOW(TYPE_SIZE(type))+7)/8;
uint64_t LLVMStructSize = Info->getSizeAsLLVMStruct();
-
+
+ if (LLVMStructSize > GCCTypeSize) {
+ Info->RemoveExtraBytes();
+ LLVMStructSize = Info->getSizeAsLLVMStruct();
+ }
+
if (LLVMStructSize != GCCTypeSize) {
assert(LLVMStructSize < GCCTypeSize &&
"LLVM type size doesn't match GCC type size!");
@@ -1702,7 +1703,9 @@
}
}
}
- }
+ } else
+ Info->RemoveExtraBytes();
+
// Now that the LLVM struct is finalized, figure out a safe place to index to
// and set the DECL_LLVM values for each FieldDecl that doesn't start at a
From dpatel at apple.com Tue Oct 2 16:33:23 2007
From: dpatel at apple.com (Devang Patel)
Date: Tue, 02 Oct 2007 21:33:23 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42551 -
/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Message-ID: <200710022133.l92LXNfk008508@zion.cs.uiuc.edu>
Author: dpatel
Date: Tue Oct 2 16:33:22 2007
New Revision: 42551
URL: http://llvm.org/viewvc/llvm-project?rev=42551&view=rev
Log:
Remove extra bytes from LLVMStruct only if is bigger than GCC struct.
This patch fixes gcc assertion failure caused by previous patch.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=42551&r1=42550&r2=42551&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Tue Oct 2 16:33:22 2007
@@ -1184,7 +1184,7 @@
// If this is a Packed struct and ExtraBitsAvailable is not zero then
// remove Extra bytes if ExtraBitsAvailable > 8.
- void RemoveExtraBytes (unsigned GCCTypeSize) {
+ void RemoveExtraBytes () {
unsigned NoOfBytesToRemove = ExtraBitsAvailable/8;
@@ -1194,10 +1194,6 @@
if (NoOfBytesToRemove == 0)
return;
- unsigned OriginalSize = ElementSizeInBytes.back();
- if (OriginalSize == GCCTypeSize)
- return;
-
const Type *LastType = Elements.back();
unsigned PadBytes = 0;
@@ -1216,6 +1212,7 @@
// Update last element type and size, element offset is unchanged.
const Type *Pad = ArrayType::get(Type::Int8Ty, PadBytes);
+ unsigned OriginalSize = ElementSizeInBytes.back();
Elements.pop_back();
Elements.push_back(Pad);
@@ -1694,13 +1691,17 @@
for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field))
DecodeStructFields(Field, *Info);
- uint64_t GCCTypeSize = ((uint64_t)TREE_INT_CST_LOW(TYPE_SIZE(type))+7)/8;
- Info->RemoveExtraBytes(GCCTypeSize);
// If the LLVM struct requires explicit tail padding to be the same size as
// the GCC struct, insert tail padding now. This handles, e.g., "{}" in C++.
if (TYPE_SIZE(type) && TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST) {
+ uint64_t GCCTypeSize = ((uint64_t)TREE_INT_CST_LOW(TYPE_SIZE(type))+7)/8;
uint64_t LLVMStructSize = Info->getSizeAsLLVMStruct();
-
+
+ if (LLVMStructSize > GCCTypeSize) {
+ Info->RemoveExtraBytes();
+ LLVMStructSize = Info->getSizeAsLLVMStruct();
+ }
+
if (LLVMStructSize != GCCTypeSize) {
assert(LLVMStructSize < GCCTypeSize &&
"LLVM type size doesn't match GCC type size!");
@@ -1726,7 +1727,9 @@
}
}
}
- }
+ } else
+ Info->RemoveExtraBytes();
+
// Now that the LLVM struct is finalized, figure out a safe place to index to
// and set index values for each FieldDecl that doesn't start at a variable
From isanbard at gmail.com Tue Oct 2 16:43:06 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 21:43:06 -0000
Subject: [llvm-commits] [llvm] r42552 - /llvm/trunk/lib/Target/X86/README.txt
Message-ID: <200710022143.l92Lh6Ne009164@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 16:43:06 2007
New Revision: 42552
URL: http://llvm.org/viewvc/llvm-project?rev=42552&view=rev
Log:
Another missed optimization with LICM.
Modified:
llvm/trunk/lib/Target/X86/README.txt
Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=42552&r1=42551&r2=42552&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Tue Oct 2 16:43:06 2007
@@ -1283,3 +1283,26 @@
//===---------------------------------------------------------------------===//
+For this code:
+
+cond_next603: ; preds = %bb493, %cond_true336, %cond_next599
+ %v.21050.1 = phi i32 [ %v.21050.0, %cond_next599 ], [ %tmp344, %cond_true336 ], [ %v.2, %bb493 ] ; [#uses=1]
+ %maxz.21051.1 = phi i32 [ %maxz.21051.0, %cond_next599 ], [ 0, %cond_true336 ], [ %maxz.2, %bb493 ] ; [#uses=2]
+ %cnt.01055.1 = phi i32 [ %cnt.01055.0, %cond_next599 ], [ 0, %cond_true336 ], [ %cnt.0, %bb493 ] ; [#uses=2]
+ %byteptr.9 = phi i8* [ %byteptr.12, %cond_next599 ], [ %byteptr.0, %cond_true336 ], [ %byteptr.10, %bb493 ] ; [#uses=9]
+ %bitptr.6 = phi i32 [ %tmp5571104.1, %cond_next599 ], [ %tmp4921049, %cond_true336 ], [ %bitptr.7, %bb493 ] ; [#uses=4]
+ %source.5 = phi i32 [ %tmp602, %cond_next599 ], [ %source.0, %cond_true336 ], [ %source.6, %bb493 ] ; [#uses=7]
+ %tmp606 = getelementptr %struct.const_tables* @tables, i32 0, i32 0, i32 %cnt.01055.1 ; [#uses=1]
+ %tmp607 = load i8* %tmp606, align 1 ; [#uses=1]
+
+We produce this:
+
+LBB4_70: # cond_next603
+ movl -20(%ebp), %esi
+ movl L_tables$non_lazy_ptr-"L4$pb"(%esi), %esi
+
+However, ICC caches this information before the loop and produces this:
+
+ movl 88(%esp), %eax #481.12
+
+//===---------------------------------------------------------------------===//
From isanbard at gmail.com Tue Oct 2 16:49:31 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 21:49:31 -0000
Subject: [llvm-commits] [llvm] r42554 - /llvm/trunk/lib/Target/X86/README.txt
Message-ID: <200710022149.l92LnVFU009573@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 16:49:31 2007
New Revision: 42554
URL: http://llvm.org/viewvc/llvm-project?rev=42554&view=rev
Log:
Another micro-opt.
Modified:
llvm/trunk/lib/Target/X86/README.txt
Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=42554&r1=42553&r2=42554&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Tue Oct 2 16:49:31 2007
@@ -1306,3 +1306,19 @@
movl 88(%esp), %eax #481.12
//===---------------------------------------------------------------------===//
+
+This code:
+
+ %tmp659 = icmp slt i16 %tmp654, 0 ; [#uses=1]
+ br i1 %tmp659, label %cond_true662, label %cond_next715
+
+produces this:
+
+ testw %cx, %cx
+ movswl %cx, %esi
+ jns LBB4_109 # cond_next715
+
+Shark tells us that using %cx in the testw instruction is sub-optimal. It
+suggests using the 32-bit register (which is what ICC uses).
+
+//===---------------------------------------------------------------------===//
From isanbard at gmail.com Tue Oct 2 17:26:38 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 22:26:38 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42557 -
/llvm-gcc-4.0/tags/llvm-gcc-1200-16/
Message-ID: <200710022226.l92MQcox011349@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 17:26:38 2007
New Revision: 42557
URL: http://llvm.org/viewvc/llvm-project?rev=42557&view=rev
Log:
Creating llvm-gcc-1200-16 branch
Added:
llvm-gcc-4.0/tags/llvm-gcc-1200-16/
- copied from r42556, llvm-gcc-4.0/trunk/
From isanbard at gmail.com Tue Oct 2 17:26:53 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 22:26:53 -0000
Subject: [llvm-commits] [llvm] r42558 - /llvm/tags/Apple/llvm-1200-16/
Message-ID: <200710022226.l92MQrhe011374@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 17:26:53 2007
New Revision: 42558
URL: http://llvm.org/viewvc/llvm-project?rev=42558&view=rev
Log:
Creating llvm-1200-16 branch
Added:
llvm/tags/Apple/llvm-1200-16/
- copied from r42557, llvm/trunk/
From isanbard at gmail.com Tue Oct 2 18:56:53 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 23:56:53 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42560 - /llvm-gcc-4.0/trunk/build_gcc
Message-ID: <200710022356.l92Nur8Q015907@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 18:56:53 2007
New Revision: 42560
URL: http://llvm.org/viewvc/llvm-project?rev=42560&view=rev
Log:
Port of rdar://5505456 to LLVM.
Modified:
llvm-gcc-4.0/trunk/build_gcc
Modified: llvm-gcc-4.0/trunk/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/build_gcc?rev=42560&r1=42559&r2=42560&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/build_gcc (original)
+++ llvm-gcc-4.0/trunk/build_gcc Tue Oct 2 18:56:53 2007
@@ -261,8 +261,10 @@
--host=$BUILD-apple-darwin$DARWIN_VERS --target=$BUILD-apple-darwin$DARWIN_VERS || exit 1
fi
# Unset RC_DEBUG_OPTIONS because it causes the bootstrap to fail.
-RC_DEBUG_OPTIONS= \
- make $MAKEFLAGS $BOOTSTRAP CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
+# Also keep unset for cross compilers so that the cross built libraries are
+# comparable to the native built libraries.
+unset RC_DEBUG_OPTIONS
+make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
From isanbard at gmail.com Tue Oct 2 18:57:16 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 02 Oct 2007 23:57:16 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42561 - /llvm-gcc-4.2/trunk/build_gcc
Message-ID: <200710022357.l92NvGWf015939@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 2 18:57:16 2007
New Revision: 42561
URL: http://llvm.org/viewvc/llvm-project?rev=42561&view=rev
Log:
Backport of radr://5505456 to LLVM
Modified:
llvm-gcc-4.2/trunk/build_gcc
Modified: llvm-gcc-4.2/trunk/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=42561&r1=42560&r2=42561&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Tue Oct 2 18:57:16 2007
@@ -253,8 +253,10 @@
--host=$BUILD-apple-darwin$DARWIN_VERS --target=$BUILD-apple-darwin$DARWIN_VERS || exit 1
fi
# Unset RC_DEBUG_OPTIONS because it causes the bootstrap to fail.
-RC_DEBUG_OPTIONS= \
- make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
+# Also keep unset for cross compilers so that the cross built libraries are
+# comparable to the native built libraries.
+unset RC_DEBUG_OPTIONS
+make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
From resistor at mac.com Tue Oct 2 22:20:17 2007
From: resistor at mac.com (Owen Anderson)
Date: Wed, 03 Oct 2007 03:20:17 -0000
Subject: [llvm-commits] [llvm] r42563 - in /llvm/trunk:
include/llvm/Analysis/PostDominators.h
lib/Analysis/PostDominatorCalculation.h lib/Analysis/PostDominators.cpp
lib/VMCore/DominatorCalculation.h lib/VMCore/Dominators.cpp
Message-ID: <200710030320.l933KHBE027793@zion.cs.uiuc.edu>
Author: resistor
Date: Tue Oct 2 22:20:17 2007
New Revision: 42563
URL: http://llvm.org/viewvc/llvm-project?rev=42563&view=rev
Log:
Factor some code from the DomTree and PostDomTree calculate methods up into
each one's runOnFunction method.
Modified:
llvm/trunk/include/llvm/Analysis/PostDominators.h
llvm/trunk/lib/Analysis/PostDominatorCalculation.h
llvm/trunk/lib/Analysis/PostDominators.cpp
llvm/trunk/lib/VMCore/DominatorCalculation.h
llvm/trunk/lib/VMCore/Dominators.cpp
Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=42563&r1=42562&r2=42563&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Tue Oct 2 22:20:17 2007
@@ -27,11 +27,7 @@
PostDominatorTree() :
DominatorTreeBase((intptr_t)&ID, true) {}
- virtual bool runOnFunction(Function &F) {
- reset(); // Reset from the last time we were run...
- PDTcalculate(*this, F);
- return false;
- }
+ virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
Modified: llvm/trunk/lib/Analysis/PostDominatorCalculation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominatorCalculation.h?rev=42563&r1=42562&r2=42563&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PostDominatorCalculation.h (original)
+++ llvm/trunk/lib/Analysis/PostDominatorCalculation.h Tue Oct 2 22:20:17 2007
@@ -19,24 +19,6 @@
namespace llvm {
void PDTcalculate(PostDominatorTree& PDT, Function &F) {
- // Step #0: Scan the function looking for the root nodes of the post-dominance
- // relationships. These blocks, which have no successors, end with return and
- // unwind instructions.
- for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
- TerminatorInst *Insn = I->getTerminator();
- if (Insn->getNumSuccessors() == 0) {
- // Unreachable block is not a root node.
- if (!isa(Insn))
- PDT.Roots.push_back(I);
- }
-
- // Prepopulate maps so that we don't get iterator invalidation issues later.
- PDT.IDoms[I] = 0;
- PDT.DomTreeNodes[I] = 0;
- }
-
- PDT.Vertex.push_back(0);
-
// Step #1: Number blocks in depth-first order and initialize variables used
// in later stages of the algorithm.
unsigned N = 0;
Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=42563&r1=42562&r2=42563&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Tue Oct 2 22:20:17 2007
@@ -28,6 +28,29 @@
static RegisterPass
F("postdomtree", "Post-Dominator Tree Construction", true);
+bool PostDominatorTree::runOnFunction(Function &F) {
+ reset(); // Reset from the last time we were run...
+
+ // Initialize the roots list
+ for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
+ TerminatorInst *Insn = I->getTerminator();
+ if (Insn->getNumSuccessors() == 0) {
+ // Unreachable block is not a root node.
+ if (!isa(Insn))
+ Roots.push_back(I);
+ }
+
+ // Prepopulate maps so that we don't get iterator invalidation issues later.
+ IDoms[I] = 0;
+ DomTreeNodes[I] = 0;
+ }
+
+ Vertex.push_back(0);
+
+ PDTcalculate(*this, F);
+ return false;
+}
+
//===----------------------------------------------------------------------===//
// PostDominanceFrontier Implementation
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/VMCore/DominatorCalculation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/DominatorCalculation.h?rev=42563&r1=42562&r2=42563&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/DominatorCalculation.h (original)
+++ llvm/trunk/lib/VMCore/DominatorCalculation.h Tue Oct 2 22:20:17 2007
@@ -40,8 +40,6 @@
// Add a node for the root...
DT.DomTreeNodes[Root] = DT.RootNode = new DomTreeNode(Root, 0);
- DT.Vertex.push_back(0);
-
// Step #1: Number blocks in depth-first order and initialize variables used
// in later stages of the algorithm.
unsigned N = DFSPass >(DT, Root, 0);
Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=42563&r1=42562&r2=42563&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Tue Oct 2 22:20:17 2007
@@ -350,7 +350,13 @@
bool DominatorTree::runOnFunction(Function &F) {
reset(); // Reset from the last time we were run...
+
+ // Initialize roots
Roots.push_back(&F.getEntryBlock());
+ IDoms[&F.getEntryBlock()] = 0;
+ DomTreeNodes[&F.getEntryBlock()] = 0;
+ Vertex.push_back(0);
+
DTcalculate(*this, F);
return false;
}
From clattner at apple.com Tue Oct 2 22:29:21 2007
From: clattner at apple.com (Chris Lattner)
Date: Tue, 2 Oct 2007 20:29:21 -0700
Subject: [llvm-commits] [llvm] r42546 -
/llvm/trunk/lib/Target/X86/README.txt
In-Reply-To: <200710022042.l92Kgx2O005184@zion.cs.uiuc.edu>
References: <200710022042.l92Kgx2O005184@zion.cs.uiuc.edu>
Message-ID: <9BFDF489-2B34-498D-8FAE-8790C4EEC1D1@apple.com>
> URL: http://llvm.org/viewvc/llvm-project?rev=42546&view=rev
> Log:
> Another missed optimization.
Hi Bill,
Thank you for tracking these down. However, without .ll files or .c
files to reproduce this, they are somewhat useless. In the example
below, if I wanted to work on this, how would I demonstrate the issue?
-Chris
> Modified:
> llvm/trunk/lib/Target/X86/README.txt
>
> Modified: llvm/trunk/lib/Target/X86/README.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/
> README.txt?rev=42546&r1=42545&r2=42546&view=diff
>
> ======================================================================
> ========
> --- llvm/trunk/lib/Target/X86/README.txt (original)
> +++ llvm/trunk/lib/Target/X86/README.txt Tue Oct 2 15:42:59 2007
> @@ -1239,3 +1239,31 @@
>
> //
> ===-------------------------------------------------------------------
> --===//
>
> +The following code:
> +
> +LBB3_5: # bb114.preheader
> + movswl -68(%ebp), %eax
> + movl $32, %ecx
> + movl %ecx, -80(%ebp)
> + subl %eax, -80(%ebp)
> + movswl -52(%ebp), %eax
> + movl %ecx, -84(%ebp)
> + subl %eax, -84(%ebp)
> + movswl -70(%ebp), %eax
> + movl %ecx, -88(%ebp)
> + subl %eax, -88(%ebp)
> + movswl -50(%ebp), %eax
> + subl %eax, %ecx
> + movl %ecx, -76(%ebp)
> + movswl -42(%ebp), %eax
> + movl %eax, -92(%ebp)
> + movswl -66(%ebp), %eax
> + movl %eax, -96(%ebp)
> + movw $0, -98(%ebp)
> +
> +has redundant subtractions of %eax from a stack slot. However, %
> ecx doesn't
> +change, so we could simply subtract %eax from %ecx first and then
> use %ecx (or
> +vice-versa).
> +
> +//
> ===-------------------------------------------------------------------
> --===//
> +
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From clattner at apple.com Tue Oct 2 22:30:23 2007
From: clattner at apple.com (Chris Lattner)
Date: Tue, 2 Oct 2007 20:30:23 -0700
Subject: [llvm-commits] [llvm] r42546 -
/llvm/trunk/lib/Target/X86/README.txt
In-Reply-To: <9BFDF489-2B34-498D-8FAE-8790C4EEC1D1@apple.com>
References: <200710022042.l92Kgx2O005184@zion.cs.uiuc.edu>
<9BFDF489-2B34-498D-8FAE-8790C4EEC1D1@apple.com>
Message-ID: <5D2023C7-8B27-47B8-B541-22D49258D49D@apple.com>
On Oct 2, 2007, at 8:29 PM, Chris Lattner wrote:
>> URL: http://llvm.org/viewvc/llvm-project?rev=42546&view=rev
>> Log:
>> Another missed optimization.
>
> Hi Bill,
>
> Thank you for tracking these down. However, without .ll files or .c
> files to reproduce this, they are somewhat useless. In the example
> below, if I wanted to work on this, how would I demonstrate the issue?
Ok, nevermind, you fixed this later, thanks!
-Chris
> -Chris
>
>> Modified:
>> llvm/trunk/lib/Target/X86/README.txt
>>
>> Modified: llvm/trunk/lib/Target/X86/README.txt
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/
>> README.txt?rev=42546&r1=42545&r2=42546&view=diff
>>
>> =====================================================================
>> =
>> ========
>> --- llvm/trunk/lib/Target/X86/README.txt (original)
>> +++ llvm/trunk/lib/Target/X86/README.txt Tue Oct 2 15:42:59 2007
>> @@ -1239,3 +1239,31 @@
>>
>> //
>> ===------------------------------------------------------------------
>> -
>> --===//
>>
>> +The following code:
>> +
>> +LBB3_5: # bb114.preheader
>> + movswl -68(%ebp), %eax
>> + movl $32, %ecx
>> + movl %ecx, -80(%ebp)
>> + subl %eax, -80(%ebp)
>> + movswl -52(%ebp), %eax
>> + movl %ecx, -84(%ebp)
>> + subl %eax, -84(%ebp)
>> + movswl -70(%ebp), %eax
>> + movl %ecx, -88(%ebp)
>> + subl %eax, -88(%ebp)
>> + movswl -50(%ebp), %eax
>> + subl %eax, %ecx
>> + movl %ecx, -76(%ebp)
>> + movswl -42(%ebp), %eax
>> + movl %eax, -92(%ebp)
>> + movswl -66(%ebp), %eax
>> + movl %eax, -96(%ebp)
>> + movw $0, -98(%ebp)
>> +
>> +has redundant subtractions of %eax from a stack slot. However, %
>> ecx doesn't
>> +change, so we could simply subtract %eax from %ecx first and then
>> use %ecx (or
>> +vice-versa).
>> +
>> +//
>> ===------------------------------------------------------------------
>> -
>> --===//
>> +
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From clattner at apple.com Tue Oct 2 22:33:16 2007
From: clattner at apple.com (Chris Lattner)
Date: Tue, 2 Oct 2007 20:33:16 -0700
Subject: [llvm-commits] [llvm] r42537 - in /llvm/trunk:
include/llvm/Intrinsics.td lib/Analysis/ConstantFolding.cpp
lib/CodeGen/IntrinsicLowering.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/Target/CBackend/CBackend.cpp
In-Reply-To: <200710021744.l92Hi0IJ029003@zion.cs.uiuc.edu>
References: <200710021744.l92Hi0IJ029003@zion.cs.uiuc.edu>
Message-ID:
On Oct 2, 2007, at 10:44 AM, Dale Johannesen wrote:
> Author: johannes
> Date: Tue Oct 2 12:43:59 2007
> New Revision: 42537
>
> URL: http://llvm.org/viewvc/llvm-project?rev=42537&view=rev
> Log:
> Rewrite sqrt and powi to use anyfloat. By popular demand.
Nice shrinkification Dale!
-Chris
From clattner at apple.com Tue Oct 2 22:35:07 2007
From: clattner at apple.com (Chris Lattner)
Date: Tue, 2 Oct 2007 20:35:07 -0700
Subject: [llvm-commits] [llvm] r42554 -
/llvm/trunk/lib/Target/X86/README.txt
In-Reply-To: <200710022149.l92LnVFU009573@zion.cs.uiuc.edu>
References: <200710022149.l92LnVFU009573@zion.cs.uiuc.edu>
Message-ID:
Hi Bill,
This is not enough context to reproduce this issue. Can you please
include more in the .ll file? Specifically, the movswl wouldn't
exist if "tmp654" weren't live out I hope. It would be best if
the .ll fragments were actually compilable.
-Chris
On Oct 2, 2007, at 2:49 PM, Bill Wendling wrote:
> Author: void
> Date: Tue Oct 2 16:49:31 2007
> New Revision: 42554
>
> URL: http://llvm.org/viewvc/llvm-project?rev=42554&view=rev
> Log:
> Another micro-opt.
>
> Modified:
> llvm/trunk/lib/Target/X86/README.txt
>
> Modified: llvm/trunk/lib/Target/X86/README.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/
> README.txt?rev=42554&r1=42553&r2=42554&view=diff
>
> ======================================================================
> ========
> --- llvm/trunk/lib/Target/X86/README.txt (original)
> +++ llvm/trunk/lib/Target/X86/README.txt Tue Oct 2 16:49:31 2007
> @@ -1306,3 +1306,19 @@
> movl 88(%esp), %eax
> #481.12
>
> //
> ===-------------------------------------------------------------------
> --===//
> +
> +This code:
> +
> + %tmp659 = icmp slt i16 %tmp654, 0 ; [#uses=1]
> + br i1 %tmp659, label %cond_true662, label %cond_next715
> +
> +produces this:
> +
> + testw %cx, %cx
> + movswl %cx, %esi
> + jns LBB4_109 # cond_next715
> +
> +Shark tells us that using %cx in the testw instruction is sub-
> optimal. It
> +suggests using the 32-bit register (which is what ICC uses).
> +
> +//
> ===-------------------------------------------------------------------
> --===//
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From sabre at nondot.org Tue Oct 2 22:40:24 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 03:40:24 -0000
Subject: [llvm-commits] [llvm] r42564 - /llvm/trunk/lib/Target/X86/README.txt
Message-ID: <200710030340.l933eOZe028977@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Oct 2 22:40:24 2007
New Revision: 42564
URL: http://llvm.org/viewvc/llvm-project?rev=42564&view=rev
Log:
Bill's example is still not enough to repro this, but it has other issues that
seem significant as well.
Modified:
llvm/trunk/lib/Target/X86/README.txt
Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=42564&r1=42563&r2=42564&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Tue Oct 2 22:40:24 2007
@@ -1277,6 +1277,14 @@
movl %eax, -96(%ebp)
movw $0, -98(%ebp)
+This appears to be bad because the RA is not folding the store to the stack
+slot into the movl. The above instructions could be:
+ movl $32, -80(%ebp)
+...
+ movl $32, -84(%ebp)
+...
+This seems like a cross between remat and spill folding.
+
This has redundant subtractions of %eax from a stack slot. However, %ecx doesn't
change, so we could simply subtract %eax from %ecx first and then use %ecx (or
vice-versa).
From clattner at apple.com Tue Oct 2 22:49:04 2007
From: clattner at apple.com (Chris Lattner)
Date: Tue, 2 Oct 2007 20:49:04 -0700
Subject: [llvm-commits] [llvm] r42519 -
/llvm/trunk/docs/AliasAnalysis.html
In-Reply-To: <200710020043.l920hQkk004003@zion.cs.uiuc.edu>
References: <200710020043.l920hQkk004003@zion.cs.uiuc.edu>
Message-ID:
Hi Owen,
Can you please expound a bit on what sort of clients should use
memdep and why? The goal of this document is so that people can
understand how the pieces fit together and have an idea of what to
use when they have a particular problem to solve, thanks!
-Chris
On Oct 1, 2007, at 5:43 PM, Owen Anderson wrote:
> Author: resistor
> Date: Mon Oct 1 19:43:25 2007
> New Revision: 42519
>
> URL: http://llvm.org/viewvc/llvm-project?rev=42519&view=rev
> Log:
> Mention memdep in the AA documentation.
>
> Modified:
> llvm/trunk/docs/AliasAnalysis.html
>
> Modified: llvm/trunk/docs/AliasAnalysis.html
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/
> AliasAnalysis.html?rev=42519&r1=42518&r2=42519&view=diff
>
> ======================================================================
> ========
> --- llvm/trunk/docs/AliasAnalysis.html (original)
> +++ llvm/trunk/docs/AliasAnalysis.html Mon Oct 1 19:43:25 2007
> @@ -50,6 +50,7 @@
> implementations
>
>
> + Memory Dependence Analysis
>
>
>
> @@ -948,6 +949,24 @@
>
>
>
> +
> +
> +
> +
> +
> +
If you're just looking to be a client of alias analysis
> information, consider
> +using the Memory Dependence Analysis interface instead. MemDep is
> a lazy,
> +caching layer on top of alias analysis that is able to answer the
> question of
> +what preceding memory operations a given instruction depends on,
> either at an
> +intra- or inter-block level. Because of its laziness and caching
> +policy, using MemDep can be a significant performance win over
> accessing alias
> +analysis directly.
> +
> +
> +
> +
>
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From sabre at nondot.org Tue Oct 2 22:59:16 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 03:59:16 -0000
Subject: [llvm-commits] [llvm] r42565 -
/llvm/trunk/lib/Transforms/IPO/Internalize.cpp
Message-ID: <200710030359.l933xGRW029911@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Oct 2 22:59:15 2007
New Revision: 42565
URL: http://llvm.org/viewvc/llvm-project?rev=42565&view=rev
Log:
Fix PR1719, by not marking llvm.noinline internal.
Modified:
llvm/trunk/lib/Transforms/IPO/Internalize.cpp
Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=42565&r1=42564&r2=42565&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Tue Oct 2 22:59:15 2007
@@ -130,6 +130,7 @@
ExternalNames.insert("llvm.dbg.subprograms");
ExternalNames.insert("llvm.global_ctors");
ExternalNames.insert("llvm.global_dtors");
+ ExternalNames.insert("llvm.noinline");
// Mark all global variables with initializers as internal as well.
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
From resistor at mac.com Tue Oct 2 23:33:13 2007
From: resistor at mac.com (Owen Anderson)
Date: Wed, 03 Oct 2007 04:33:13 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42566 -
/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
Message-ID: <200710030433.l934XDap031554@zion.cs.uiuc.edu>
Author: resistor
Date: Tue Oct 2 23:33:12 2007
New Revision: 42566
URL: http://llvm.org/viewvc/llvm-project?rev=42566&view=rev
Log:
Revert Bill's last patch to this file. It was causing a failure building
Qt for Darwin.
Modified:
llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=42566&r1=42565&r2=42566&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Tue Oct 2 23:33:12 2007
@@ -2566,8 +2566,7 @@
/* struct objc_method_list *optional_instance_methods; */
if (!optional_instance_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2577,8 +2576,7 @@
/* struct objc_method_list *optional_class_methods; */
if (!optional_class_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2588,8 +2586,7 @@
/* struct objc_prop_list *instance_properties; */
if (!instance_prop)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2670,8 +2667,7 @@
/* struct _prop_list_t *properties; */
if (!property_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -4978,8 +4974,7 @@
/* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
if (flag_next_runtime || ! sel_ref_chain)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
initlist
= tree_cons (NULL_TREE,
@@ -9239,8 +9234,7 @@
(objc_protocol_template)),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- /* APPLE LOCAL LLVM - NUL pointer */
- refs_expr = null_pointer_node;
+ refs_expr = build_int_cst (NULL_TREE, 0);
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9310,8 +9304,7 @@
if (newabi)
{
/* 'isa' is NULL in the new ObjC abi */
- /* APPLE LOCAL LLVM - NUL pointer */
- expr = null_pointer_node;
+ expr = build_int_cst (NULL_TREE, 0);
}
/* APPLE LOCAL end radar 4533974 - ObjC newprotocol - radar 4695109 */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9319,8 +9312,7 @@
else
{
if (!objc_protocol_or_opt_ins_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- expr = null_pointer_node;
+ expr = build_int_cst (NULL_TREE, 0);
else
expr = convert (build_pointer_type (objc_protocol_extension_template),
build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
@@ -9334,8 +9326,7 @@
initlist = tree_cons (NULL_TREE, protocol_list, initlist);
if (!instance_methods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -9346,8 +9337,7 @@
}
if (!class_methods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -9362,8 +9352,7 @@
{
/* APPLE LOCAL begin radar 4695109 */
if (!objc_protocol_or_opt_ins_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9371,8 +9360,7 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!opt_cls_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9381,8 +9369,7 @@
}
/* APPLE LOCAL end radar 4695109 */
if (!property_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -10402,8 +10389,7 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- /* APPLE LOCAL LLVM - NUL pointer */
- ivar = tree_cons (NULL_TREE, null_pointer_node, ivar);
+ ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
/* Set type */
encode_field_decl (field_decl,
@@ -10460,8 +10446,7 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- /* APPLE LOCAL LLVM - NUL pointer */
- ivar = tree_cons (NULL_TREE, null_pointer_node, ivar);
+ ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
/* Set type. */
encode_field_decl (field_decl,
@@ -11157,8 +11142,7 @@
initlist = tree_cons (NULL_TREE, class_name, initlist);
if (!instance_methods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -11168,8 +11152,7 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!class_methods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -11181,8 +11164,7 @@
/* protocol_list = */
if (!protocol_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
@@ -11204,8 +11186,7 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* struct _objc_property_list *instance_properties; */
if (!property_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -11272,8 +11253,7 @@
/* objc_ivar_list = */
if (!ivar_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -11285,8 +11265,7 @@
/* objc_method_list = */
if (!dispatch_table)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* APPLE LOCAL begin mainline */
@@ -11298,27 +11277,22 @@
if (flag_next_runtime)
/* method_cache = */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* dtable = */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* subclass_list = */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* sibling_class = */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
}
/* protocol_list = */
if (! protocol_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (build_pointer_type
@@ -11333,21 +11307,18 @@
{
/* const char *ivar_layout; */
if (IS_CLS_META (status)) /* Meta Class ? */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
tree ivar_layout = objc_build_ivar_layout (true);
if (!ivar_layout)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
initlist = tree_cons (NULL_TREE, ivar_layout, initlist);
}
/* struct _objc_class_ext *ext; */
if (!objc_class_ext)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (build_pointer_type (objc_class_ext_template),
@@ -11357,8 +11328,7 @@
}
else
/* gc_object_type = NULL */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* APPLE LOCAL end radar 4585769 - Objective-C 1.0 extensions */
return objc_build_constructor (type, nreverse (initlist));
@@ -11520,15 +11490,13 @@
if (cache)
initlist = tree_cons (NULL_TREE, cache, initlist);
else
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* vtable */
if (vtable)
initlist = tree_cons (NULL_TREE, vtable, initlist);
else
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* ro */
initlist = tree_cons (NULL_TREE, ro, initlist);
@@ -11572,8 +11540,7 @@
/* APPLE LOCAL begin radar 4695101 */
/* ivarLayout */
if (!ivarLayout)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
initlist = tree_cons (NULL_TREE, ivarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11583,8 +11550,7 @@
/* baseMethods */
if (!baseMethods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11594,34 +11560,31 @@
/* baseProtocols */
if (!baseProtocols)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
tree protocol_list_t_p = build_pointer_type (
xref_tag (RECORD_TYPE,
get_identifier (UTAG_V2_PROTOCOL_LIST)));
expr = convert (protocol_list_t_p,
- build_unary_op (ADDR_EXPR, baseProtocols, 0));
+ build_unary_op (ADDR_EXPR, baseProtocols, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* ivars */
if (!ivars)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_v2_ivar_list_ptr,
- build_unary_op (ADDR_EXPR, ivars, 0));
+ build_unary_op (ADDR_EXPR, ivars, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL begin radar 4695101 */
/* weakIvarLayout */
if (!weakIvarLayout)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
initlist = tree_cons (NULL_TREE, weakIvarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11629,12 +11592,11 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* property list */
if (!property_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr,
- build_unary_op (ADDR_EXPR, property_list, 0));
+ build_unary_op (ADDR_EXPR, property_list, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL end C* property metadata (Radar 4498373) */
@@ -11892,8 +11854,7 @@
/* root class. */
root_expr = build_unary_op (ADDR_EXPR, metaclass_decl, 0);
metaclass_superclass_expr = build_unary_op (ADDR_EXPR, class_decl, 0);
- /* APPLE LOCAL LLVM - NUL pointer */
- class_superclass_expr = null_pointer_node;
+ class_superclass_expr = build_int_cst (NULL_TREE, 0);
flags |= 0x2; /* CLS_ROOT: it is also a root meta class */
}
@@ -12082,8 +12043,7 @@
super_expr = build_c_cast (cast_type, super_expr); /* cast! */
}
else
- /* APPLE LOCAL LLVM - NUL pointer */
- super_expr = null_pointer_node;
+ super_expr = build_int_cst (NULL_TREE, 0);
root_expr = add_objc_string (my_root_id, class_names);
root_expr = build_c_cast (cast_type, root_expr); /* cast! */
@@ -13343,8 +13303,7 @@
refs_expr = convert (build_pointer_type (objc_v2_protocol_template),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- /* APPLE LOCAL LLVM - NUL pointer */
- refs_expr = null_pointer_node;
+ refs_expr = build_int_cst (NULL_TREE, 0);
/* APPLE LOCAL begin radar 4695101 */
/* Build table of list of properties for this protocol. */
From resistor at mac.com Tue Oct 2 23:49:04 2007
From: resistor at mac.com (Owen Anderson)
Date: Wed, 03 Oct 2007 04:49:04 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42567 -
/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Message-ID: <200710030449.l934n4UX032323@zion.cs.uiuc.edu>
Author: resistor
Date: Tue Oct 2 23:49:04 2007
New Revision: 42567
URL: http://llvm.org/viewvc/llvm-project?rev=42567&view=rev
Log:
Revert Bill's last patch to this file. It was causing a failure building
Qt for Darwin.
Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=42567&r1=42566&r2=42567&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Tue Oct 2 23:49:04 2007
@@ -2576,8 +2576,7 @@
/* struct objc_method_list *optional_instance_methods; */
if (!optional_instance_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2587,8 +2586,7 @@
/* struct objc_method_list *optional_class_methods; */
if (!optional_class_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2598,8 +2596,7 @@
/* struct objc_prop_list *instance_properties; */
if (!instance_prop)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2680,8 +2677,7 @@
/* struct _prop_list_t *properties; */
if (!property_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -4875,8 +4871,7 @@
/* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
if (flag_next_runtime || ! sel_ref_chain)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
initlist
= tree_cons (NULL_TREE,
@@ -9139,8 +9134,7 @@
(objc_protocol_template)),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- /* APPLE LOCAL LLVM - NUL pointer */
- refs_expr = null_pointer_node;
+ refs_expr = build_int_cst (NULL_TREE, 0);
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9210,8 +9204,7 @@
if (newabi)
{
/* 'isa' is NULL in the new ObjC abi */
- /* APPLE LOCAL LLVM - NUL pointer */
- expr = null_pointer_node;
+ expr = build_int_cst (NULL_TREE, 0);
}
/* APPLE LOCAL end radar 4533974 - ObjC newprotocol - radar 4695109 */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9219,8 +9212,7 @@
else
{
if (!objc_protocol_or_opt_ins_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- expr = null_pointer_node;
+ expr = build_int_cst (NULL_TREE, 0);
else
expr = convert (build_pointer_type (objc_protocol_extension_template),
build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
@@ -9234,8 +9226,7 @@
initlist = tree_cons (NULL_TREE, protocol_list, initlist);
if (!instance_methods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9244,8 +9235,7 @@
}
if (!class_methods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9258,8 +9248,7 @@
{
/* APPLE LOCAL begin radar 4695109 */
if (!objc_protocol_or_opt_ins_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9267,8 +9256,7 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!opt_cls_meth)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9277,8 +9265,7 @@
}
/* APPLE LOCAL end radar 4695109 */
if (!property_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -10304,8 +10291,7 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- /* APPLE LOCAL LLVM - NUL pointer */
- ivar = tree_cons (NULL_TREE, null_pointer_node, ivar);
+ ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
/* Set type */
encode_field_decl (field_decl,
@@ -10362,8 +10348,7 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- /* APPLE LOCAL LLVM - NUL pointer */
- ivar = tree_cons (NULL_TREE, null_pointer_node, ivar);
+ ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
/* Set type. */
encode_field_decl (field_decl,
@@ -11057,8 +11042,7 @@
initlist = tree_cons (NULL_TREE, class_name, initlist);
if (!instance_methods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11066,8 +11050,7 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!class_methods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11077,8 +11060,7 @@
/* protocol_list = */
if (!protocol_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
@@ -11100,8 +11082,7 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* struct _objc_property_list *instance_properties; */
if (!property_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr,
@@ -11168,8 +11149,7 @@
/* objc_ivar_list = */
if (!ivar_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_ivar_list_ptr,
@@ -11179,8 +11159,7 @@
/* objc_method_list = */
if (!dispatch_table)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11190,27 +11169,22 @@
if (flag_next_runtime)
/* method_cache = */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* dtable = */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* subclass_list = */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* sibling_class = */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
}
/* protocol_list = */
if (! protocol_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (build_pointer_type
@@ -11225,21 +11199,18 @@
{
/* const char *ivar_layout; */
if (IS_CLS_META (status)) /* Meta Class ? */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
tree ivar_layout = objc_build_ivar_layout (true);
if (!ivar_layout)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
initlist = tree_cons (NULL_TREE, ivar_layout, initlist);
}
/* struct _objc_class_ext *ext; */
if (!objc_class_ext)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (build_pointer_type (objc_class_ext_template),
@@ -11249,8 +11220,7 @@
}
else
/* gc_object_type = NULL */
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* APPLE LOCAL end radar 4585769 - Objective-C 1.0 extensions */
return objc_build_constructor (type, nreverse (initlist));
@@ -11412,15 +11382,13 @@
if (cache)
initlist = tree_cons (NULL_TREE, cache, initlist);
else
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* vtable */
if (vtable)
initlist = tree_cons (NULL_TREE, vtable, initlist);
else
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* ro */
initlist = tree_cons (NULL_TREE, ro, initlist);
@@ -11464,8 +11432,7 @@
/* APPLE LOCAL begin radar 4695101 */
/* ivarLayout */
if (!ivarLayout)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
initlist = tree_cons (NULL_TREE, ivarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11475,8 +11442,7 @@
/* baseMethods */
if (!baseMethods)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_method_list_ptr,
@@ -11486,34 +11452,31 @@
/* baseProtocols */
if (!baseProtocols)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
tree protocol_list_t_p = build_pointer_type (
xref_tag (RECORD_TYPE,
get_identifier (UTAG_V2_PROTOCOL_LIST)));
expr = convert (protocol_list_t_p,
- build_unary_op (ADDR_EXPR, baseProtocols, 0));
+ build_unary_op (ADDR_EXPR, baseProtocols, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* ivars */
if (!ivars)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_v2_ivar_list_ptr,
- build_unary_op (ADDR_EXPR, ivars, 0));
+ build_unary_op (ADDR_EXPR, ivars, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL begin radar 4695101 */
/* weakIvarLayout */
if (!weakIvarLayout)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
initlist = tree_cons (NULL_TREE, weakIvarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11521,12 +11484,11 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* property list */
if (!property_list)
- /* APPLE LOCAL LLVM - NUL pointer */
- initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
+ initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
expr = convert (objc_prop_list_ptr,
- build_unary_op (ADDR_EXPR, property_list, 0));
+ build_unary_op (ADDR_EXPR, property_list, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL end C* property metadata (Radar 4498373) */
@@ -11773,8 +11735,7 @@
/* root class. */
root_expr = build_unary_op (ADDR_EXPR, metaclass_decl, 0);
metaclass_superclass_expr = build_unary_op (ADDR_EXPR, class_decl, 0);
- /* APPLE LOCAL LLVM - NUL pointer */
- class_superclass_expr = null_pointer_node;
+ class_superclass_expr = build_int_cst (NULL_TREE, 0);
flags |= 0x2; /* CLS_ROOT: it is also a root meta class */
}
@@ -11966,8 +11927,7 @@
super_expr = build_c_cast (cast_type, super_expr); /* cast! */
}
else
- /* APPLE LOCAL LLVM - NUL pointer */
- super_expr = null_pointer_node;
+ super_expr = build_int_cst (NULL_TREE, 0);
root_expr = add_objc_string (my_root_id, class_names);
root_expr = build_c_cast (cast_type, root_expr); /* cast! */
@@ -13230,8 +13190,7 @@
refs_expr = convert (build_pointer_type (objc_v2_protocol_template),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- /* APPLE LOCAL LLVM - NUL pointer */
- refs_expr = null_pointer_node;
+ refs_expr = build_int_cst (NULL_TREE, 0);
/* APPLE LOCAL begin radar 4695101 */
/* Build table of list of properties for this protocol. */
From isanbard at gmail.com Tue Oct 2 23:54:18 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 2 Oct 2007 21:54:18 -0700
Subject: [llvm-commits] [llvm-gcc-4.0] r42566 -
/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
In-Reply-To: <200710030433.l934XDap031554@zion.cs.uiuc.edu>
References: <200710030433.l934XDap031554@zion.cs.uiuc.edu>
Message-ID:
On Oct 2, 2007, at 9:33 PM, Owen Anderson wrote:
> Author: resistor
> Date: Tue Oct 2 23:33:12 2007
> New Revision: 42566
>
> URL: http://llvm.org/viewvc/llvm-project?rev=42566&view=rev
> Log:
> Revert Bill's last patch to this file. It was causing a failure
> building
> Qt for Darwin.
>
Hi Owen,
Could you file a radar or PR with a testcase?
Thanks!
-bw
From isanbard at gmail.com Tue Oct 2 22:57:06 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 2 Oct 2007 20:57:06 -0700
Subject: [llvm-commits] [llvm] r42554 -
/llvm/trunk/lib/Target/X86/README.txt
In-Reply-To:
References: <200710022149.l92LnVFU009573@zion.cs.uiuc.edu>
Message-ID:
Sure. I can try to whittle down the testcase that I'm working on.
-bw
On Oct 2, 2007, at 8:35 PM, Chris Lattner wrote:
> Hi Bill,
>
> This is not enough context to reproduce this issue. Can you please
> include more in the .ll file? Specifically, the movswl wouldn't
> exist if "tmp654" weren't live out I hope. It would be best if
> the .ll fragments were actually compilable.
>
> -Chris
>
> On Oct 2, 2007, at 2:49 PM, Bill Wendling wrote:
>
>> Author: void
>> Date: Tue Oct 2 16:49:31 2007
>> New Revision: 42554
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=42554&view=rev
>> Log:
>> Another micro-opt.
>>
>> Modified:
>> llvm/trunk/lib/Target/X86/README.txt
>>
>> Modified: llvm/trunk/lib/Target/X86/README.txt
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/
>> README.txt?rev=42554&r1=42553&r2=42554&view=diff
>>
>> =====================================================================
>> =
>> ========
>> --- llvm/trunk/lib/Target/X86/README.txt (original)
>> +++ llvm/trunk/lib/Target/X86/README.txt Tue Oct 2 16:49:31 2007
>> @@ -1306,3 +1306,19 @@
>> movl 88(%esp), %eax
>> #481.12
>>
>> //
>> ===------------------------------------------------------------------
>> -
>> --===//
>> +
>> +This code:
>> +
>> + %tmp659 = icmp slt i16 %tmp654, 0 ; [#uses=1]
>> + br i1 %tmp659, label %cond_true662, label %cond_next715
>> +
>> +produces this:
>> +
>> + testw %cx, %cx
>> + movswl %cx, %esi
>> + jns LBB4_109 # cond_next715
>> +
>> +Shark tells us that using %cx in the testw instruction is sub-
>> optimal. It
>> +suggests using the 32-bit register (which is what ICC uses).
>> +
>> +//
>> ===------------------------------------------------------------------
>> -
>> --===//
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From isanbard at gmail.com Wed Oct 3 00:03:34 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Wed, 03 Oct 2007 05:03:34 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42568 -
/llvm-gcc-4.0/tags/llvm-gcc-1200-17/
Message-ID: <200710030503.l9353YZS000826@zion.cs.uiuc.edu>
Author: void
Date: Wed Oct 3 00:03:34 2007
New Revision: 42568
URL: http://llvm.org/viewvc/llvm-project?rev=42568&view=rev
Log:
Creating llvm-gcc-1200-17 branch
Added:
llvm-gcc-4.0/tags/llvm-gcc-1200-17/
- copied from r42567, llvm-gcc-4.0/trunk/
From isanbard at gmail.com Wed Oct 3 00:03:40 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Wed, 03 Oct 2007 05:03:40 -0000
Subject: [llvm-commits] [llvm] r42569 - /llvm/tags/Apple/llvm-1200-17/
Message-ID: <200710030503.l9353eRh000841@zion.cs.uiuc.edu>
Author: void
Date: Wed Oct 3 00:03:39 2007
New Revision: 42569
URL: http://llvm.org/viewvc/llvm-project?rev=42569&view=rev
Log:
Creating llvm-1200-17 branch
Added:
llvm/tags/Apple/llvm-1200-17/
- copied from r42568, llvm/trunk/
From sabre at nondot.org Wed Oct 3 00:29:07 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 05:29:07 -0000
Subject: [llvm-commits] [llvm] r42570 -
/llvm/trunk/test/CFrontend/2007-10-02-VolatileArray.c
Message-ID: <200710030529.l935T7qZ001896@zion.cs.uiuc.edu>
Author: lattner
Date: Wed Oct 3 00:29:07 2007
New Revision: 42570
URL: http://llvm.org/viewvc/llvm-project?rev=42570&view=rev
Log:
testcase for PR1647
Added:
llvm/trunk/test/CFrontend/2007-10-02-VolatileArray.c
Added: llvm/trunk/test/CFrontend/2007-10-02-VolatileArray.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-10-02-VolatileArray.c?rev=42570&view=auto
==============================================================================
--- llvm/trunk/test/CFrontend/2007-10-02-VolatileArray.c (added)
+++ llvm/trunk/test/CFrontend/2007-10-02-VolatileArray.c Wed Oct 3 00:29:07 2007
@@ -0,0 +1,7 @@
+// RUN: %llvmgcc -S %s -o - | grep volatile
+// PR1647
+
+void foo(volatile int *p)
+{
+p[0] = 0;
+}
From sabre at nondot.org Wed Oct 3 00:31:52 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 05:31:52 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42571 -
/llvm-gcc-4.0/trunk/gcc/c-typeck.c
Message-ID: <200710030531.l935VqhF001981@zion.cs.uiuc.edu>
Author: lattner
Date: Wed Oct 3 00:31:52 2007
New Revision: 42571
URL: http://llvm.org/viewvc/llvm-project?rev=42571&view=rev
Log:
Fix PR1647 and test/CFrontend/2007-10-02-VolatileArray.c
Modified:
llvm-gcc-4.0/trunk/gcc/c-typeck.c
Modified: llvm-gcc-4.0/trunk/gcc/c-typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-typeck.c?rev=42571&r1=42570&r2=42571&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.0/trunk/gcc/c-typeck.c Wed Oct 3 00:31:52 2007
@@ -1901,7 +1901,11 @@
if (TREE_CODE(ty) == RECORD_TYPE || TREE_CODE(ty) == UNION_TYPE
|| TREE_CODE(ty) == QUAL_UNION_TYPE)
ty = TYPE_MAIN_VARIANT (ty);
- return build4 (ARRAY_REF, ty, ar, index, NULL_TREE, NULL_TREE);
+
+ ar = build4 (ARRAY_REF, ty, ar, index, NULL_TREE, NULL_TREE);
+ /* mirror logic from build_indirect_ref to set TREE_THIS_VOLATILE. */
+ TREE_THIS_VOLATILE(ar) = TYPE_VOLATILE(TREE_TYPE(ar));
+ return ar;
}
#endif
/* APPLE LOCAL end LLVM */
From sabre at nondot.org Wed Oct 3 00:33:03 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 05:33:03 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42572 -
/llvm-gcc-4.2/trunk/gcc/c-typeck.c
Message-ID: <200710030533.l935X3hv002031@zion.cs.uiuc.edu>
Author: lattner
Date: Wed Oct 3 00:33:02 2007
New Revision: 42572
URL: http://llvm.org/viewvc/llvm-project?rev=42572&view=rev
Log:
Fix PR1647 and test/CFrontend/2007-10-02-VolatileArray.c
Modified:
llvm-gcc-4.2/trunk/gcc/c-typeck.c
Modified: llvm-gcc-4.2/trunk/gcc/c-typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-typeck.c?rev=42572&r1=42571&r2=42572&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-typeck.c Wed Oct 3 00:33:02 2007
@@ -2085,7 +2085,11 @@
if (TREE_CODE(ty) == RECORD_TYPE || TREE_CODE(ty) == UNION_TYPE
|| TREE_CODE(ty) == QUAL_UNION_TYPE)
ty = TYPE_MAIN_VARIANT (ty);
- return build4 (ARRAY_REF, ty, ar, index, NULL_TREE, NULL_TREE);
+
+ ar = build4 (ARRAY_REF, ty, ar, index, NULL_TREE, NULL_TREE);
+ /* mirror logic from build_indirect_ref to set TREE_THIS_VOLATILE. */
+ TREE_THIS_VOLATILE(ar) = TYPE_VOLATILE(TREE_TYPE(ar));
+ return ar;
}
#endif
/* LLVM LOCAL end */
From sabre at nondot.org Wed Oct 3 01:10:59 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 06:10:59 -0000
Subject: [llvm-commits] [llvm] r42573 - /llvm/trunk/lib/Target/README.txt
Message-ID: <200710030610.l936AxrD003783@zion.cs.uiuc.edu>
Author: lattner
Date: Wed Oct 3 01:10:59 2007
New Revision: 42573
URL: http://llvm.org/viewvc/llvm-project?rev=42573&view=rev
Log:
add a note
Modified:
llvm/trunk/lib/Target/README.txt
Modified: llvm/trunk/lib/Target/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=42573&r1=42572&r2=42573&view=diff
==============================================================================
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Wed Oct 3 01:10:59 2007
@@ -427,6 +427,22 @@
//===---------------------------------------------------------------------===//
+Tail recursion elimination is not transforming this function, because it is
+returning n, which fails the isDynamicConstant check in the accumulator
+recursion checks.
+
+long long fib(const long long n) {
+ switch(n) {
+ case 0:
+ case 1:
+ return n;
+ default:
+ return fib(n-1) + fib(n-2);
+ }
+}
+
+//===---------------------------------------------------------------------===//
+
Argument promotion should promote arguments for recursive functions, like
this:
From gordonhenriksen at mac.com Wed Oct 3 07:06:42 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Wed, 03 Oct 2007 12:06:42 -0000
Subject: [llvm-commits] [llvm] r42574 - /llvm/trunk/autoconf/configure.ac
Message-ID: <200710031206.l93C6hp1024959@zion.cs.uiuc.edu>
Author: gordon
Date: Wed Oct 3 07:06:41 2007
New Revision: 42574
URL: http://llvm.org/viewvc/llvm-project?rev=42574&view=rev
Log:
Fixing a typo in configure.ac.
Patch by Adam Goode.
Modified:
llvm/trunk/autoconf/configure.ac
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=42574&r1=42573&r2=42574&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Wed Oct 3 07:06:41 2007
@@ -874,7 +874,7 @@
[Installation directory for libraries])
AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR",
[Installation directory for data files])
-AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR",
+AC_DEFINE_UNQUOTED(LLVM_DOCSDIR, "$LLVM_DOCSDIR",
[Installation directory for documentation])
AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR",
[Installation directory for config files])
From gordonhenriksen at mac.com Wed Oct 3 07:07:14 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Wed, 03 Oct 2007 12:07:14 -0000
Subject: [llvm-commits] [llvm] r42575 - in /llvm/trunk: configure
include/llvm/Config/config.h.in
Message-ID: <200710031207.l93C7F6n024987@zion.cs.uiuc.edu>
Author: gordon
Date: Wed Oct 3 07:07:14 2007
New Revision: 42575
URL: http://llvm.org/viewvc/llvm-project?rev=42575&view=rev
Log:
Regenerate.
Modified:
llvm/trunk/configure
llvm/trunk/include/llvm/Config/config.h.in
Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=42575&r1=42574&r2=42575&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Wed Oct 3 07:07:14 2007
@@ -34132,7 +34132,7 @@
cat >>confdefs.h <<_ACEOF
-#define LLVM_DATADIR "$LLVM_DOCSDIR"
+#define LLVM_DOCSDIR "$LLVM_DOCSDIR"
_ACEOF
Modified: llvm/trunk/include/llvm/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=42575&r1=42574&r2=42575&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.in (original)
+++ llvm/trunk/include/llvm/Config/config.h.in Wed Oct 3 07:07:14 2007
@@ -449,9 +449,12 @@
/* Time at which LLVM was configured */
#undef LLVM_CONFIGTIME
-/* Installation directory for documentation */
+/* Installation directory for data files */
#undef LLVM_DATADIR
+/* Installation directory for documentation */
+#undef LLVM_DOCSDIR
+
/* Installation directory for config files */
#undef LLVM_ETCDIR
From neil at daikokuya.co.uk Wed Oct 3 10:16:42 2007
From: neil at daikokuya.co.uk (Neil Booth)
Date: Wed, 03 Oct 2007 15:16:42 -0000
Subject: [llvm-commits] [llvm] r42576 - in /llvm/trunk:
include/llvm/ADT/APFloat.h lib/Support/APFloat.cpp
Message-ID: <200710031516.l93FGg2Q031663@zion.cs.uiuc.edu>
Author: neil
Date: Wed Oct 3 10:16:41 2007
New Revision: 42576
URL: http://llvm.org/viewvc/llvm-project?rev=42576&view=rev
Log:
Tweak RoundAwayFromZero the bit number below which is truncated, and make
it const.
Preparation for APFloat -> hexadecimal string conversion.
Modified:
llvm/trunk/include/llvm/ADT/APFloat.h
llvm/trunk/lib/Support/APFloat.cpp
Modified: llvm/trunk/include/llvm/ADT/APFloat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=42576&r1=42575&r2=42576&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)
+++ llvm/trunk/include/llvm/ADT/APFloat.h Wed Oct 3 10:16:41 2007
@@ -253,7 +253,7 @@
opStatus addOrSubtract(const APFloat &, roundingMode, bool subtract);
cmpResult compareAbsoluteValue(const APFloat &) const;
opStatus handleOverflow(roundingMode);
- bool roundAwayFromZero(roundingMode, lostFraction);
+ bool roundAwayFromZero(roundingMode, lostFraction, unsigned int) const;
opStatus convertFromUnsignedInteger(integerPart *, unsigned int,
roundingMode);
lostFraction combineLostFractions(lostFraction, lostFraction);
Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=42576&r1=42575&r2=42576&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Wed Oct 3 10:16:41 2007
@@ -184,7 +184,8 @@
return digitValue == 0 ? lfLessThanHalf: lfMoreThanHalf;
}
- /* Return the fraction lost were a bignum truncated. */
+ /* Return the fraction lost were a bignum truncated losing the least
+ significant BITS bits. */
lostFraction
lostFractionThroughTruncation(integerPart *parts,
unsigned int partCount,
@@ -694,16 +695,20 @@
return opInexact;
}
-/* This routine must work for fcZero of both signs, and fcNormal
- numbers. */
+/* Returns TRUE if, when truncating the current number, with BIT the
+ new LSB, with the given lost fraction and rounding mode, the result
+ would need to be rounded away from zero (i.e., by increasing the
+ signficand). This routine must work for fcZero of both signs, and
+ fcNormal numbers. */
bool
APFloat::roundAwayFromZero(roundingMode rounding_mode,
- lostFraction lost_fraction)
+ lostFraction lost_fraction,
+ unsigned int bit) const
{
/* NaNs and infinities should not have lost fractions. */
assert(category == fcNormal || category == fcZero);
- /* Our caller has already handled this case. */
+ /* Current callers never pass this so we don't handle it. */
assert(lost_fraction != lfExactlyZero);
switch(rounding_mode) {
@@ -719,7 +724,7 @@
/* Our zeroes don't have a significand to test. */
if(lost_fraction == lfExactlyHalf && category != fcZero)
- return significandParts()[0] & 1;
+ return APInt::tcExtractBit(significandParts(), bit);
return false;
@@ -802,7 +807,7 @@
}
/* Increment the significand if we're rounding away from zero. */
- if(roundAwayFromZero(rounding_mode, lost_fraction)) {
+ if(roundAwayFromZero(rounding_mode, lost_fraction, 0)) {
if(omsb == 0)
exponent = semantics->minExponent;
@@ -1451,7 +1456,7 @@
}
if(lost_fraction != lfExactlyZero
- && tmp.roundAwayFromZero(rounding_mode, lost_fraction))
+ && tmp.roundAwayFromZero(rounding_mode, lost_fraction, 0))
tmp.incrementSignificand();
msb = tmp.significandMSB();
From lattner at apple.com Wed Oct 3 11:34:41 2007
From: lattner at apple.com (Tanya Lattner)
Date: Wed, 3 Oct 2007 09:34:41 -0700
Subject: [llvm-commits] [llvm-gcc-4.0] r42566 -
/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
In-Reply-To:
References: <200710030433.l934XDap031554@zion.cs.uiuc.edu>
Message-ID:
Reverting this patch causes test/FrontendObjC/2007-09-25-EH.m to
fail. It will most likely only fail on Tiger systems (<10.5).
Please xfail this test and then re-enable it once this has been fixed.
-Tanya
On Oct 2, 2007, at 9:54 PM, Bill Wendling wrote:
> On Oct 2, 2007, at 9:33 PM, Owen Anderson wrote:
>
>> Author: resistor
>> Date: Tue Oct 2 23:33:12 2007
>> New Revision: 42566
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=42566&view=rev
>> Log:
>> Revert Bill's last patch to this file. It was causing a failure
>> building
>> Qt for Darwin.
>>
> Hi Owen,
>
> Could you file a radar or PR with a testcase?
>
> Thanks!
> -bw
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071003/4597be24/attachment.html
From tonic at nondot.org Wed Oct 3 12:05:40 2007
From: tonic at nondot.org (Tanya Lattner)
Date: Wed, 03 Oct 2007 17:05:40 -0000
Subject: [llvm-commits] [llvm] r42578 -
/llvm/trunk/lib/Transforms/IPO/Internalize.cpp
Message-ID: <200710031705.l93H5eb7004580@zion.cs.uiuc.edu>
Author: tbrethou
Date: Wed Oct 3 12:05:40 2007
New Revision: 42578
URL: http://llvm.org/viewvc/llvm-project?rev=42578&view=rev
Log:
Fix PR1719, by not marking llvm.global.annotations internal.
Modified:
llvm/trunk/lib/Transforms/IPO/Internalize.cpp
Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=42578&r1=42577&r2=42578&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Wed Oct 3 12:05:40 2007
@@ -131,6 +131,7 @@
ExternalNames.insert("llvm.global_ctors");
ExternalNames.insert("llvm.global_dtors");
ExternalNames.insert("llvm.noinline");
+ ExternalNames.insert("llvm.global.annotations");
// Mark all global variables with initializers as internal as well.
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
From sabre at nondot.org Wed Oct 3 12:10:03 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 17:10:03 -0000
Subject: [llvm-commits] [llvm] r42579 - /llvm/trunk/lib/Target/X86/README.txt
Message-ID: <200710031710.l93HA3L3004804@zion.cs.uiuc.edu>
Author: lattner
Date: Wed Oct 3 12:10:03 2007
New Revision: 42579
URL: http://llvm.org/viewvc/llvm-project?rev=42579&view=rev
Log:
add a note
Modified:
llvm/trunk/lib/Target/X86/README.txt
Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=42579&r1=42578&r2=42579&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Wed Oct 3 12:10:03 2007
@@ -1330,3 +1330,35 @@
suggests using the 32-bit register (which is what ICC uses).
//===---------------------------------------------------------------------===//
+
+rdar://5506677 - We compile this:
+
+define i32 @foo(double %x) {
+ %x14 = bitcast double %x to i64 ; [#uses=1]
+ %tmp713 = trunc i64 %x14 to i32 ; [#uses=1]
+ %tmp8 = and i32 %tmp713, 2147483647 ; [#uses=1]
+ ret i32 %tmp8
+}
+
+to:
+
+_foo:
+ subl $12, %esp
+ fldl 16(%esp)
+ fstpl (%esp)
+ movl $2147483647, %eax
+ andl (%esp), %eax
+ addl $12, %esp
+ #FP_REG_KILL
+ ret
+
+It would be much better to eliminate the fldl/fstpl by folding the bitcast
+into the load SDNode. That would give us:
+
+_foo:
+ movl $2147483647, %eax
+ andl 4(%esp), %eax
+ ret
+
+//===---------------------------------------------------------------------===//
+
From sabre at nondot.org Wed Oct 3 12:33:52 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 17:33:52 -0000
Subject: [llvm-commits] [llvm] r42580 - /llvm/trunk/docs/LangRef.html
Message-ID: <200710031733.l93HXq2e005894@zion.cs.uiuc.edu>
Author: lattner
Date: Wed Oct 3 12:33:51 2007
New Revision: 42580
URL: http://llvm.org/viewvc/llvm-project?rev=42580&view=rev
Log:
remove misleading documentation: LLVM has no atomic support yet.
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=42580&r1=42579&r2=42580&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Wed Oct 3 12:33:51 2007
@@ -191,15 +191,6 @@
Debugger intrinsics
Exception Handling intrinsics
- Atomic Operations and Synchronization Intrinsics
-
- - 'llvm.atomic.lcs.*' Intrinsic
- - 'llvm.atomic.ls.*' Intrinsic
- - 'llvm.atomic.las.*' Intrinsic
- - 'llvm.atomic.lss.*' Intrinsic
- - 'llvm.memory.barrier' Intrinsic
-
-
Trampoline Intrinsic
- 'llvm.init.trampoline' Intrinsic
@@ -291,7 +282,7 @@
the parser.
-
+
@@ -4861,298 +4852,6 @@
-
-
-
- These intrinsic functions expand the "universal IR" of LLVM to represent
- hardware constructs for atomic operations and memory synchronization. This
- provides an interface to the hardware, not an interface to the programmer. It
- is aimed at a low enough level to allow any programming models or APIs which
- need atomic behaviors to map cleanly onto it. It is also modeled primarily on
- hardware behavior. Just as hardware provides a "universal IR" for source
- languages, it also provides a starting point for developing a "universal"
- atomic operation and synchronization IR.
-
-
- These do not form an API such as high-level threading libraries,
- software transaction memory systems, atomic primitives, and intrinsic
- functions as found in BSD, GNU libc, atomic_ops, APR, and other system and
- application libraries. The hardware interface provided by LLVM should allow
- a clean implementation of all of these APIs and parallel programming models.
- No one model or paradigm should be selected above others unless the hardware
- itself ubiquitously does so.
-
-
-
-
-
-
-
Syntax:
-
- This is an overloaded intrinsic. You can use llvm.atomic.lcs on any
- integer bit width. Not all targets support all bit widths however.
-
-declare i8 @llvm.atomic.lcs.i8.i8p.i8.i8( i8* <ptr>, i8 <cmp>, i8 <val> )
-declare i16 @llvm.atomic.lcs.i16.i16p.i16.i16( i16* <ptr>, i16 <cmp>, i16 <val> )
-declare i32 @llvm.atomic.lcs.i32.i32p.i32.i32( i32* <ptr>, i32 <cmp>, i32 <val> )
-declare i64 @llvm.atomic.lcs.i64.i64p.i64.i64( i64* <ptr>, i64 <cmp>, i64 <val> )
-
-
Overview:
-
- This loads a value in memory and compares it to a given value. If they are
- equal, it stores a new value into the memory.
-
-
Arguments:
-
- The llvm.atomic.lcs intrinsic takes three arguments. The result as
- well as both cmp and val must be integer values with the
- same bit width. The ptr argument must be a pointer to a value of
- this integer type. While any bit width integer may be used, targets may only
- lower representations they support in hardware.
-
-
Semantics:
-
- This entire intrinsic must be executed atomically. It first loads the value
- in memory pointed to by ptr and compares it with the value
- cmp. If they are equal, val is stored into the memory. The
- loaded value is yielded in all cases. This provides the equivalent of an
- atomic compare-and-swap operation within the SSA framework.
-
-
Examples:
-
-%ptr = malloc i32
- store i32 4, %ptr
-
-%val1 = add i32 4, 4
-%result1 = call i32 @llvm.atomic.lcs( i32* %ptr, i32 4, %val1 )
- ; yields {i32}:result1 = 4
-%stored1 = icmp eq i32 %result1, 4 ; yields {i1}:stored1 = true
-%memval1 = load i32* %ptr ; yields {i32}:memval1 = 8
-
-%val2 = add i32 1, 1
-%result2 = call i32 @llvm.atomic.lcs( i32* %ptr, i32 5, %val2 )
- ; yields {i32}:result2 = 8
-%stored2 = icmp eq i32 %result2, 5 ; yields {i1}:stored2 = false
-%memval2 = load i32* %ptr ; yields {i32}:memval2 = 8
-
-
-
-
-
-
-
Syntax:
-
- This is an overloaded intrinsic. You can use llvm.atomic.ls on any
- integer bit width. Not all targets support all bit widths however.
-
-declare i8 @llvm.atomic.ls.i8.i8p.i8( i8* <ptr>, i8 <val> )
-declare i16 @llvm.atomic.ls.i16.i16p.i16( i16* <ptr>, i16 <val> )
-declare i32 @llvm.atomic.ls.i32.i32p.i32( i32* <ptr>, i32 <val> )
-declare i64 @llvm.atomic.ls.i64.i64p.i64( i64* <ptr>, i64 <val> )
-
-
Overview:
-
- This intrinsic loads the value stored in memory at ptr and yields
- the value from memory. It then stores the value in val in the memory
- at ptr.
-
-
Arguments:
-
- The llvm.atomic.ls intrinsic takes two arguments. Both the
- val argument and the result must be integers of the same bit width.
- The first argument, ptr, must be a pointer to a value of this
- integer type. The targets may only lower integer representations they
- support.
-
-
Semantics:
-
- This intrinsic loads the value pointed to by ptr, yields it, and
- stores val back into ptr atomically. This provides the
- equivalent of an atomic swap operation within the SSA framework.
-
-
Examples:
-
-%ptr = malloc i32
- store i32 4, %ptr
-
-%val1 = add i32 4, 4
-%result1 = call i32 @llvm.atomic.ls( i32* %ptr, i32 %val1 )
- ; yields {i32}:result1 = 4
-%stored1 = icmp eq i32 %result1, 4 ; yields {i1}:stored1 = true
-%memval1 = load i32* %ptr ; yields {i32}:memval1 = 8
-
-%val2 = add i32 1, 1
-%result2 = call i32 @llvm.atomic.ls( i32* %ptr, i32 %val2 )
- ; yields {i32}:result2 = 8
-%stored2 = icmp eq i32 %result2, 8 ; yields {i1}:stored2 = true
-%memval2 = load i32* %ptr ; yields {i32}:memval2 = 2
-
-
-
-
-
-
-
Syntax:
-
- This is an overloaded intrinsic. You can use llvm.atomic.las on any
- integer bit width. Not all targets support all bit widths however.
-
-declare i8 @llvm.atomic.las.i8.i8p.i8( i8* <ptr>, i8 <delta> )
-declare i16 @llvm.atomic.las.i16.i16p.i16( i16* <ptr>, i16 <delta> )
-declare i32 @llvm.atomic.las.i32.i32p.i32( i32* <ptr>, i32 <delta> )
-declare i64 @llvm.atomic.las.i64.i64p.i64( i64* <ptr>, i64 <delta> )
-
-
Overview:
-
- This intrinsic adds delta to the value stored in memory at
- ptr. It yields the original value at ptr.
-
-
Arguments:
-
- The intrinsic takes two arguments, the first a pointer to an integer value
- and the second an integer value. The result is also an integer value. These
- integer types can have any bit width, but they must all have the same bit
- width. The targets may only lower integer representations they support.
-
-
Semantics:
-
- This intrinsic does a series of operations atomically. It first loads the
- value stored at ptr. It then adds delta, stores the result
- to ptr. It yields the original value stored at ptr.
-
-
Examples:
-
-%ptr = malloc i32
- store i32 4, %ptr
-%result1 = call i32 @llvm.atomic.las( i32* %ptr, i32 4 )
- ; yields {i32}:result1 = 4
-%result2 = call i32 @llvm.atomic.las( i32* %ptr, i32 2 )
- ; yields {i32}:result2 = 8
-%result3 = call i32 @llvm.atomic.las( i32* %ptr, i32 5 )
- ; yields {i32}:result3 = 10
-%memval = load i32* %ptr ; yields {i32}:memval1 = 15
-
-
-
-
-
-
-
Syntax:
-
- This is an overloaded intrinsic. You can use llvm.atomic.lss on any
- integer bit width. Not all targets support all bit widths however.
-
-declare i8 @llvm.atomic.lss.i8.i8.i8( i8* <ptr>, i8 <delta> )
-declare i16 @llvm.atomic.lss.i16.i16.i16( i16* <ptr>, i16 <delta> )
-declare i32 @llvm.atomic.lss.i32.i32.i32( i32* <ptr>, i32 <delta> )
-declare i64 @llvm.atomic.lss.i64.i64.i64( i64* <ptr>, i64 <delta> )
-
-
Overview:
-
- This intrinsic subtracts delta from the value stored in memory at
- ptr. It yields the original value at ptr.
-
-
Arguments:
-
- The intrinsic takes two arguments, the first a pointer to an integer value
- and the second an integer value. The result is also an integer value. These
- integer types can have any bit width, but they must all have the same bit
- width. The targets may only lower integer representations they support.
-
-
Semantics:
-
- This intrinsic does a series of operations atomically. It first loads the
- value stored at ptr. It then subtracts delta,
- stores the result to ptr. It yields the original value stored
- at ptr.
-
-
Examples:
-
-%ptr = malloc i32
- store i32 32, %ptr
-%result1 = call i32 @llvm.atomic.lss( i32* %ptr, i32 4 )
- ; yields {i32}:result1 = 32
-%result2 = call i32 @llvm.atomic.lss( i32* %ptr, i32 2 )
- ; yields {i32}:result2 = 28
-%result3 = call i32 @llvm.atomic.lss( i32* %ptr, i32 5 )
- ; yields {i32}:result3 = 26
-%memval = load i32* %ptr ; yields {i32}:memval1 = 21
-
-
-
-
-
-
-
Syntax:
-
-declare void @llvm.memory.barrier( i1 <ll>, i1 <ls>, i1 <sl>, i1 <ss> )
-
-
Overview:
-
- The llvm.memory.barrier intrinsic guarantees ordering between
- specific pairs of memory access types.
-
-
Arguments:
-
- The llvm.memory.barrier intrinsic requires four boolean arguments.
- Each argument enables a specific barrier as listed below.
-
-
- - ll: load-load barrier
- - ls: load-store barrier
- - sl: store-load barrier
- - ss: store-store barrier
-
-
Semantics:
-
- This intrinsic causes the system to enforce some ordering constraints upon
- the loads and stores of the program. This barrier does not indicate
- when any events will occur, it only enforces an order in
- which they occur. For any of the specified pairs of load and store operations
- (f.ex. load-load, or store-load), all of the first operations preceding the
- barrier will complete before any of the second operations succeeding the
- barrier begin. Specifically the semantics for each pairing is as follows:
-
-
- - ll: All loads before the barrier must complete before any load
- after the barrier begins.
- - ls: All loads before the barrier must complete before any
- store after the barrier begins.
- - ss: All stores before the barrier must complete before any
- store after the barrier begins.
- - sl: All stores before the barrier must complete before any
- load after the barrier begins.
-
-
- These semantics are applied with a logical "and" behavior when more than one
- is enabled in a single memory barrier intrinsic.
-
-
Example:
-
-%ptr = malloc i32
- store i32 4, %ptr
-
-%result1 = load i32* %ptr ; yields {i32}:result1 = 4
- call void @llvm.memory.barrier( i1 false, i1 true, i1 false, i1 false )
- ; guarantee the above finishes
- store i32 8, %ptr ; before this begins
-
-
-
-
-
From sabre at nondot.org Wed Oct 3 12:34:29 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 17:34:29 -0000
Subject: [llvm-commits] [llvm] r42581 - /llvm/trunk/docs/LangRef.html
Message-ID: <200710031734.l93HYTlV005945@zion.cs.uiuc.edu>
Author: lattner
Date: Wed Oct 3 12:34:29 2007
New Revision: 42581
URL: http://llvm.org/viewvc/llvm-project?rev=42581&view=rev
Log:
remove extraneous tag
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=42581&r1=42580&r2=42581&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Wed Oct 3 12:34:29 2007
@@ -282,7 +282,7 @@
the parser.
-
+
From dalej at apple.com Wed Oct 3 12:45:28 2007
From: dalej at apple.com (Dale Johannesen)
Date: Wed, 03 Oct 2007 17:45:28 -0000
Subject: [llvm-commits] [llvm] r42582 -
/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Message-ID: <200710031745.l93HjSJD006585@zion.cs.uiuc.edu>
Author: johannes
Date: Wed Oct 3 12:45:27 2007
New Revision: 42582
URL: http://llvm.org/viewvc/llvm-project?rev=42582&view=rev
Log:
Tone down an overzealous optimization.
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=42582&r1=42581&r2=42582&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Oct 3 12:45:27 2007
@@ -7354,8 +7354,17 @@
if (FCmpInst *FCI = dyn_cast(CondVal)) {
if (FCI->getOperand(0) == TrueVal && FCI->getOperand(1) == FalseVal) {
// Transform (X == Y) ? X : Y -> Y
- if (FCI->getPredicate() == FCmpInst::FCMP_OEQ)
+ if (FCI->getPredicate() == FCmpInst::FCMP_OEQ) {
+ // This is not safe in general for floating point:
+ // consider X== -0, Y== +0.
+ // It becomes safe if either operand is a nonzero constant.
+ ConstantFP *CFPt, *CFPf;
+ if (((CFPt = dyn_cast(TrueVal)) &&
+ !CFPt->getValueAPF().isZero()) ||
+ ((CFPf = dyn_cast(FalseVal)) &&
+ !CFPf->getValueAPF().isZero()))
return ReplaceInstUsesWith(SI, FalseVal);
+ }
// Transform (X != Y) ? X : Y -> X
if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
return ReplaceInstUsesWith(SI, TrueVal);
@@ -7363,8 +7372,17 @@
} else if (FCI->getOperand(0) == FalseVal && FCI->getOperand(1) == TrueVal){
// Transform (X == Y) ? Y : X -> X
- if (FCI->getPredicate() == FCmpInst::FCMP_OEQ)
- return ReplaceInstUsesWith(SI, FalseVal);
+ if (FCI->getPredicate() == FCmpInst::FCMP_OEQ) {
+ // This is not safe in general for floating point:
+ // consider X== -0, Y== +0.
+ // It becomes safe if either operand is a nonzero constant.
+ ConstantFP *CFPt, *CFPf;
+ if (((CFPt = dyn_cast(TrueVal)) &&
+ !CFPt->getValueAPF().isZero()) ||
+ ((CFPf = dyn_cast(FalseVal)) &&
+ !CFPf->getValueAPF().isZero()))
+ return ReplaceInstUsesWith(SI, FalseVal);
+ }
// Transform (X != Y) ? Y : X -> Y
if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
return ReplaceInstUsesWith(SI, TrueVal);
From isanbard at gmail.com Wed Oct 3 12:46:54 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Wed, 03 Oct 2007 17:46:54 -0000
Subject: [llvm-commits] [llvm] r42583 -
/llvm/trunk/test/FrontendObjC/2007-09-25-EH.m
Message-ID: <200710031746.l93Hks0u006702@zion.cs.uiuc.edu>
Author: void
Date: Wed Oct 3 12:46:54 2007
New Revision: 42583
URL: http://llvm.org/viewvc/llvm-project?rev=42583&view=rev
Log:
Temporarily XFAIL this test.
Modified:
llvm/trunk/test/FrontendObjC/2007-09-25-EH.m
Modified: llvm/trunk/test/FrontendObjC/2007-09-25-EH.m
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-09-25-EH.m?rev=42583&r1=42582&r2=42583&view=diff
==============================================================================
--- llvm/trunk/test/FrontendObjC/2007-09-25-EH.m (original)
+++ llvm/trunk/test/FrontendObjC/2007-09-25-EH.m Wed Oct 3 12:46:54 2007
@@ -1,4 +1,6 @@
// RUN: %llvmgcc -c -w -m64 -mmacosx-version-min=10.5 %s -o /dev/null
+// XFAIL: *
+// Reenable when Obj-C FE problem is fixed.
@class NSDictionary, DSoBuffer, DSoDirectory, NSMutableArray;
@interface NSException {}
From isanbard at gmail.com Wed Oct 3 12:47:27 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Wed, 3 Oct 2007 10:47:27 -0700
Subject: [llvm-commits] [llvm-gcc-4.0] r42566 -
/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
In-Reply-To:
References: <200710030433.l934XDap031554@zion.cs.uiuc.edu>
Message-ID: <16e5fdf90710031047o2c042fbahee0ca7714cdd68a5@mail.gmail.com>
On 10/3/07, Tanya Lattner wrote:
> Reverting this patch causes test/FrontendObjC/2007-09-25-EH.m to fail. It
> will most likely only fail on Tiger systems (<10.5).
>
> Please xfail this test and then re-enable it once this has been fixed.
>
Doh! I XFAILed it. This isn't a regression as it tested the patch I put in. :-)
-bw
From clattner at apple.com Wed Oct 3 13:14:35 2007
From: clattner at apple.com (Chris Lattner)
Date: Wed, 3 Oct 2007 11:14:35 -0700
Subject: [llvm-commits] [llvm] r42582 -
/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
In-Reply-To: <200710031745.l93HjSJD006585@zion.cs.uiuc.edu>
References: <200710031745.l93HjSJD006585@zion.cs.uiuc.edu>
Message-ID:
> URL: http://llvm.org/viewvc/llvm-project?rev=42582&view=rev
> Log:
> Tone down an overzealous optimization.
Nice catch!
-Chris
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/
> Scalar/InstructionCombining.cpp?rev=42582&r1=42581&r2=42582&view=diff
>
> ======================================================================
> ========
> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed
> Oct 3 12:45:27 2007
> @@ -7354,8 +7354,17 @@
> if (FCmpInst *FCI = dyn_cast(CondVal)) {
> if (FCI->getOperand(0) == TrueVal && FCI->getOperand(1) ==
> FalseVal) {
> // Transform (X == Y) ? X : Y -> Y
> - if (FCI->getPredicate() == FCmpInst::FCMP_OEQ)
> + if (FCI->getPredicate() == FCmpInst::FCMP_OEQ) {
> + // This is not safe in general for floating point:
> + // consider X== -0, Y== +0.
> + // It becomes safe if either operand is a nonzero constant.
> + ConstantFP *CFPt, *CFPf;
> + if (((CFPt = dyn_cast(TrueVal)) &&
> + !CFPt->getValueAPF().isZero()) ||
> + ((CFPf = dyn_cast(FalseVal)) &&
> + !CFPf->getValueAPF().isZero()))
> return ReplaceInstUsesWith(SI, FalseVal);
> + }
> // Transform (X != Y) ? X : Y -> X
> if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
> return ReplaceInstUsesWith(SI, TrueVal);
> @@ -7363,8 +7372,17 @@
>
> } else if (FCI->getOperand(0) == FalseVal && FCI->getOperand
> (1) == TrueVal){
> // Transform (X == Y) ? Y : X -> X
> - if (FCI->getPredicate() == FCmpInst::FCMP_OEQ)
> - return ReplaceInstUsesWith(SI, FalseVal);
> + if (FCI->getPredicate() == FCmpInst::FCMP_OEQ) {
> + // This is not safe in general for floating point:
> + // consider X== -0, Y== +0.
> + // It becomes safe if either operand is a nonzero constant.
> + ConstantFP *CFPt, *CFPf;
> + if (((CFPt = dyn_cast(TrueVal)) &&
> + !CFPt->getValueAPF().isZero()) ||
> + ((CFPf = dyn_cast(FalseVal)) &&
> + !CFPf->getValueAPF().isZero()))
> + return ReplaceInstUsesWith(SI, FalseVal);
> + }
> // Transform (X != Y) ? Y : X -> Y
> if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
> return ReplaceInstUsesWith(SI, TrueVal);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From djg at cray.com Wed Oct 3 14:04:09 2007
From: djg at cray.com (Dan Gohman)
Date: Wed, 03 Oct 2007 19:04:09 -0000
Subject: [llvm-commits] [llvm] r42584 - in /llvm/trunk:
include/llvm/PassManagers.h lib/VMCore/PassManager.cpp
Message-ID: <200710031904.l93J49KN010190@zion.cs.uiuc.edu>
Author: djg
Date: Wed Oct 3 14:04:09 2007
New Revision: 42584
URL: http://llvm.org/viewvc/llvm-project?rev=42584&view=rev
Log:
Fix a using namespace llvm; in a header file.
Modified:
llvm/trunk/include/llvm/PassManagers.h
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/include/llvm/PassManagers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=42584&r1=42583&r2=42584&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassManagers.h (original)
+++ llvm/trunk/include/llvm/PassManagers.h Wed Oct 3 14:04:09 2007
@@ -13,7 +13,6 @@
#include "llvm/PassManager.h"
#include "llvm/ADT/SmallVector.h"
-using namespace llvm;
class llvm::PMDataManager;
class llvm::PMStack;
@@ -381,8 +380,8 @@
}
-extern void StartPassTimer(Pass *);
-extern void StopPassTimer(Pass *);
+extern void StartPassTimer(llvm::Pass *);
+extern void StopPassTimer(llvm::Pass *);
#endif
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=42584&r1=42583&r2=42584&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Wed Oct 3 14:04:09 2007
@@ -22,6 +22,7 @@
#include
#include
#include
Semantics:
+
This instruction always performs a logical shift right operation. The most
significant bits of the result will be filled with zero bits after the
-shift.
+shift. If var2 is (statically or dynamically) equal to or larger than
+the number of bits in var1, the result is undefined.
Example:
@@ -2209,6 +2221,7 @@
<result> = lshr i32 4, 2 ; yields {i32}:result = 1
<result> = lshr i8 4, 3 ; yields {i8}:result = 0
<result> = lshr i8 -2, 1 ; yields {i8}:result = 0x7FFFFFFF
+ <result> = lshr i32 1, 32 ; undefined
@@ -2232,7 +2245,9 @@
Semantics:
This instruction always performs an arithmetic shift right operation,
The most significant bits of the result will be filled with the sign bit
-of var1.
+of var1. If var2 is (statically or dynamically) equal to or
+larger than the number of bits in var1, the result is undefined.
+
Example:
@@ -2240,6 +2255,7 @@
<result> = ashr i32 4, 2 ; yields {i32}:result = 1
<result> = ashr i8 4, 3 ; yields {i8}:result = 0
<result> = ashr i8 -2, 1 ; yields {i8}:result = -1
+ <result> = ashr i32 1, 32 ; undefined
From sabre at nondot.org Wed Oct 3 16:12:10 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 03 Oct 2007 21:12:10 -0000
Subject: [llvm-commits] [llvm] r42589 - in /llvm/trunk:
include/llvm/ADT/FoldingSet.h lib/Support/FoldingSet.cpp
Message-ID: <200710032112.l93LCAMa015236@zion.cs.uiuc.edu>
Author: lattner
Date: Wed Oct 3 16:12:09 2007
New Revision: 42589
URL: http://llvm.org/viewvc/llvm-project?rev=42589&view=rev
Log:
Add initial iterator support for folding set.
Modified:
llvm/trunk/include/llvm/ADT/FoldingSet.h
llvm/trunk/lib/Support/FoldingSet.cpp
Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=42589&r1=42588&r2=42589&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/FoldingSet.h (original)
+++ llvm/trunk/include/llvm/ADT/FoldingSet.h Wed Oct 3 16:12:09 2007
@@ -220,6 +220,8 @@
typedef FoldingSetImpl::Node FoldingSetNode;
typedef FoldingSetImpl::NodeID FoldingSetNodeID;
+template class FoldingSetIterator;
+
//===----------------------------------------------------------------------===//
/// FoldingSet - This template class is used to instantiate a specialized
/// implementation of the folding set to the node class T. T must be a
@@ -238,6 +240,14 @@
explicit FoldingSet(unsigned Log2InitSize = 6)
: FoldingSetImpl(Log2InitSize)
{}
+
+ typedef FoldingSetIterator iterator;
+ iterator begin() { return iterator(Buckets); }
+ iterator end() { return iterator(Buckets+NumBuckets); }
+
+ typedef FoldingSetIterator const_iterator;
+ const_iterator begin() const { return const_iterator(Buckets); }
+ const_iterator end() const { return const_iterator(Buckets+NumBuckets); }
/// GetOrInsertNode - If there is an existing simple Node exactly
/// equal to the specified node, return it. Otherwise, insert 'N' and
@@ -254,6 +264,47 @@
}
};
+//===----------------------------------------------------------------------===//
+/// FoldingSetIteratorImpl - This is the common iterator support shared by all
+/// folding sets, which knows how to walk the folding set hash table.
+class FoldingSetIteratorImpl {
+protected:
+ FoldingSetNode *NodePtr;
+ FoldingSetIteratorImpl(void **Bucket);
+ void advance();
+
+public:
+ bool operator==(const FoldingSetIteratorImpl &RHS) const {
+ return NodePtr == RHS.NodePtr;
+ }
+ bool operator!=(const FoldingSetIteratorImpl &RHS) const {
+ return NodePtr != RHS.NodePtr;
+ }
+};
+
+
+template
+class FoldingSetIterator : public FoldingSetIteratorImpl {
+public:
+ FoldingSetIterator(void **Bucket) : FoldingSetIteratorImpl(Bucket) {}
+
+ T &operator*() const {
+ return *static_cast(NodePtr);
+ }
+
+ T *operator->() const {
+ return static_cast(NodePtr);
+ }
+
+ inline FoldingSetIterator& operator++() { // Preincrement
+ advance();
+ return *this;
+ }
+ FoldingSetIterator operator++(int) { // Postincrement
+ FoldingSetIterator tmp = *this; ++*this; return tmp;
+ }
+};
+
} // End of namespace llvm.
Modified: llvm/trunk/lib/Support/FoldingSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=42589&r1=42588&r2=42589&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FoldingSet.cpp (original)
+++ llvm/trunk/lib/Support/FoldingSet.cpp Wed Oct 3 16:12:09 2007
@@ -151,6 +151,7 @@
/// testing.
static void **GetBucketPtr(void *NextInBucketPtr) {
intptr_t Ptr = reinterpret_cast(NextInBucketPtr);
+ assert((Ptr & 1) && "Not a bucket pointer");
return reinterpret_cast(Ptr & ~intptr_t(1));
}
@@ -323,3 +324,34 @@
InsertNode(N, IP);
return N;
}
+
+//===----------------------------------------------------------------------===//
+// FoldingSetIteratorImpl Implementation
+
+FoldingSetIteratorImpl::FoldingSetIteratorImpl(void **Bucket) {
+ // Skip to the first non-null non-self-cycle bucket.
+ while (*Bucket == 0 || GetNextPtr(*Bucket) == 0)
+ ++Bucket;
+
+ NodePtr = static_cast(*Bucket);
+}
+
+void FoldingSetIteratorImpl::advance() {
+ // If there is another link within this bucket, go to it.
+ void *Probe = NodePtr->getNextInBucket();
+
+ if (FoldingSetNode *NextNodeInBucket = GetNextPtr(Probe))
+ NodePtr = NextNodeInBucket;
+ else {
+ // Otherwise, this is the last link in this bucket.
+ void **Bucket = GetBucketPtr(Probe);
+
+ // Skip to the next non-null non-self-cycle bucket.
+ do {
+ ++Bucket;
+ } while (*Bucket == 0 || GetNextPtr(*Bucket) == 0);
+
+ NodePtr = static_cast(*Bucket);
+ }
+}
+
From dpatel at apple.com Wed Oct 3 16:16:08 2007
From: dpatel at apple.com (Devang Patel)
Date: Wed, 03 Oct 2007 21:16:08 -0000
Subject: [llvm-commits] [llvm] r42590 -
/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Message-ID: <200710032116.l93LG8nm015463@zion.cs.uiuc.edu>
Author: dpatel
Date: Wed Oct 3 16:16:08 2007
New Revision: 42590
URL: http://llvm.org/viewvc/llvm-project?rev=42590&view=rev
Log:
Refactor code in a separate method.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=42590&r1=42589&r2=42590&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Oct 3 16:16:08 2007
@@ -103,6 +103,11 @@
if (I != LoopProcessWorklist.end())
LoopProcessWorklist.erase(I);
}
+
+ /// Split all of the edges from inside the loop to their exit blocks. Update
+ /// the appropriate Phi nodes as we do so.
+ void SplitExitEdges(const SmallVector &ExitBlocks,
+ SmallVector &MiddleBlocks);
bool UnswitchIfProfitable(Value *LoopCond, Constant *Val,Loop *L);
unsigned getLoopUnswitchCost(Loop *L, Value *LIC);
@@ -596,38 +601,11 @@
++NumTrivial;
}
-/// VersionLoop - We determined that the loop is profitable to unswitch when LIC
-/// equal Val. Split it into loop versions and test the condition outside of
-/// either loop. Return the loops created as Out1/Out2.
-void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
- Loop *L) {
- Function *F = L->getHeader()->getParent();
- DOUT << "loop-unswitch: Unswitching loop %"
- << L->getHeader()->getName() << " [" << L->getBlocks().size()
- << " blocks] in Function " << F->getName()
- << " when '" << *Val << "' == " << *LIC << "\n";
-
- // LoopBlocks contains all of the basic blocks of the loop, including the
- // preheader of the loop, the body of the loop, and the exit blocks of the
- // loop, in that order.
- std::vector LoopBlocks;
-
- // First step, split the preheader and exit blocks, and add these blocks to
- // the LoopBlocks list.
- BasicBlock *OrigHeader = L->getHeader();
- BasicBlock *OrigPreheader = L->getLoopPreheader();
- BasicBlock *NewPreheader = SplitEdge(OrigPreheader, L->getHeader(), this);
- LoopBlocks.push_back(NewPreheader);
-
- // We want the loop to come after the preheader, but before the exit blocks.
- LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end());
-
- SmallVector ExitBlocks;
- L->getUniqueExitBlocks(ExitBlocks);
-
- // Split all of the edges from inside the loop to their exit blocks. Update
- // the appropriate Phi nodes as we do so.
- SmallVector MiddleBlocks;
+/// SplitExitEdges -
+/// Split all of the edges from inside the loop to their exit blocks. Update
+/// the appropriate Phi nodes as we do so.
+void LoopUnswitch::SplitExitEdges(const SmallVector &ExitBlocks,
+ SmallVector &MiddleBlocks) {
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
BasicBlock *ExitBlock = ExitBlocks[i];
std::vector Preds(pred_begin(ExitBlock), pred_end(ExitBlock));
@@ -671,7 +649,42 @@
}
}
}
-
+}
+
+/// UnswitchNontrivialCondition - We determined that the loop is profitable to unswitch when LIC
+/// equal Val. Split it into loop versions and test the condition outside of
+/// either loop. Return the loops created as Out1/Out2.
+void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
+ Loop *L) {
+ Function *F = L->getHeader()->getParent();
+ DOUT << "loop-unswitch: Unswitching loop %"
+ << L->getHeader()->getName() << " [" << L->getBlocks().size()
+ << " blocks] in Function " << F->getName()
+ << " when '" << *Val << "' == " << *LIC << "\n";
+
+ // LoopBlocks contains all of the basic blocks of the loop, including the
+ // preheader of the loop, the body of the loop, and the exit blocks of the
+ // loop, in that order.
+ std::vector LoopBlocks;
+
+ // First step, split the preheader and exit blocks, and add these blocks to
+ // the LoopBlocks list.
+ BasicBlock *OrigHeader = L->getHeader();
+ BasicBlock *OrigPreheader = L->getLoopPreheader();
+ BasicBlock *NewPreheader = SplitEdge(OrigPreheader, L->getHeader(), this);
+ LoopBlocks.push_back(NewPreheader);
+
+ // We want the loop to come after the preheader, but before the exit blocks.
+ LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end());
+
+ SmallVector ExitBlocks;
+ L->getUniqueExitBlocks(ExitBlocks);
+
+ // Split all of the edges from inside the loop to their exit blocks. Update
+ // the appropriate Phi nodes as we do so.
+ SmallVector MiddleBlocks;
+ SplitExitEdges(ExitBlocks, MiddleBlocks);
+
// The exit blocks may have been changed due to edge splitting, recompute.
ExitBlocks.clear();
L->getUniqueExitBlocks(ExitBlocks);
From dpatel at apple.com Wed Oct 3 16:17:43 2007
From: dpatel at apple.com (Devang Patel)
Date: Wed, 03 Oct 2007 21:17:43 -0000
Subject: [llvm-commits] [llvm] r42591 -
/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Message-ID: <200710032117.l93LHh1d015537@zion.cs.uiuc.edu>
Author: dpatel
Date: Wed Oct 3 16:17:43 2007
New Revision: 42591
URL: http://llvm.org/viewvc/llvm-project?rev=42591&view=rev
Log:
Fix 80 col violation.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=42591&r1=42590&r2=42591&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Oct 3 16:17:43 2007
@@ -651,9 +651,9 @@
}
}
-/// UnswitchNontrivialCondition - We determined that the loop is profitable to unswitch when LIC
-/// equal Val. Split it into loop versions and test the condition outside of
-/// either loop. Return the loops created as Out1/Out2.
+/// UnswitchNontrivialCondition - We determined that the loop is profitable
+/// to unswitch when LIC equal Val. Split it into loop versions and test the
+/// condition outside of either loop. Return the loops created as Out1/Out2.
void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
Loop *L) {
Function *F = L->getHeader()->getParent();
From resistor at mac.com Wed Oct 3 16:24:38 2007
From: resistor at mac.com (Owen Anderson)
Date: Wed, 03 Oct 2007 21:24:38 -0000
Subject: [llvm-commits] [llvm] r42592 -
/llvm/trunk/include/llvm/ADT/GraphTraits.h
Message-ID: <200710032124.l93LOck3015993@zion.cs.uiuc.edu>
Author: resistor
Date: Wed Oct 3 16:24:38 2007
New Revision: 42592
URL: http://llvm.org/viewvc/llvm-project?rev=42592&view=rev
Log:
Add a GraphTraits partial specialization to make the inverse of an inverse be the same as the underlying graph.
Modified:
llvm/trunk/include/llvm/ADT/GraphTraits.h
Modified: llvm/trunk/include/llvm/ADT/GraphTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/GraphTraits.h?rev=42592&r1=42591&r2=42592&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/GraphTraits.h (original)
+++ llvm/trunk/include/llvm/ADT/GraphTraits.h Wed Oct 3 16:24:38 2007
@@ -78,6 +78,26 @@
inline Inverse(GraphType &G) : Graph(G) {}
};
+// Provide a partial specialization of GraphTraits so that the inverse of an inverse
+// falls back to the original graph.
+template
+struct GraphTraits > > {
+ typedef typename GraphTraits::NodeType NodeType;
+ typedef typename GraphTraits::ChildIteratorType ChildIteratorType;
+
+ static NodeType *getEntryNode(Inverse > *G) {
+ return GraphTraits::getEntryNode(G.Graph.Graph);
+ }
+
+ static ChildIteratorType child_begin(NodeType* N) {
+ return GraphTraits::child_begin(N);
+ }
+
+ static ChildIteratorType child_end(NodeType* N) {
+ return GraphTraits::child_end(N);
+ }
+};
+
} // End llvm namespace
#endif
From resistor at mac.com Wed Oct 3 16:25:45 2007
From: resistor at mac.com (Owen Anderson)
Date: Wed, 03 Oct 2007 21:25:45 -0000
Subject: [llvm-commits] [llvm] r42593 - in /llvm/trunk:
include/llvm/Analysis/DominatorInternals.h
include/llvm/Analysis/Dominators.h include/llvm/Analysis/PostDominators.h
lib/Analysis/PostDominatorCalculation.h lib/Analysis/PostDominators.cpp
lib/VMCore/DominatorCalculation.h lib/VMCore/Dominators.cpp
Message-ID: <200710032125.l93LPkPH016053@zion.cs.uiuc.edu>
Author: resistor
Date: Wed Oct 3 16:25:45 2007
New Revision: 42593
URL: http://llvm.org/viewvc/llvm-project?rev=42593&view=rev
Log:
Completely merge the implementation details of DomTree and PostDomTree.
Also, add a FIXME for a bug in PostDomTree calculation I noticed while writing this,
Removed:
llvm/trunk/lib/Analysis/PostDominatorCalculation.h
llvm/trunk/lib/VMCore/DominatorCalculation.h
Modified:
llvm/trunk/include/llvm/Analysis/DominatorInternals.h
llvm/trunk/include/llvm/Analysis/Dominators.h
llvm/trunk/include/llvm/Analysis/PostDominators.h
llvm/trunk/lib/Analysis/PostDominators.cpp
llvm/trunk/lib/VMCore/Dominators.cpp
Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=42593&r1=42592&r2=42593&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Wed Oct 3 16:25:45 2007
@@ -208,6 +208,93 @@
#endif
}
+template
+void Calculate(DominatorTreeBase& DT, Function& F) {
+ // Step #1: Number blocks in depth-first order and initialize variables used
+ // in later stages of the algorithm.
+ unsigned N = 0;
+ for (unsigned i = 0, e = DT.Roots.size(); i != e; ++i)
+ N = DFSPass >(DT, DT.Roots[i], N);
+
+ for (unsigned i = N; i >= 2; --i) {
+ typename GraphTraits::NodeType* W = DT.Vertex[i];
+ DominatorTree::InfoRec &WInfo = DT.Info[W];
+
+ // Step #2: Calculate the semidominators of all vertices
+ for (typename GraphTraits >::ChildIteratorType CI =
+ GraphTraits >::child_begin(W),
+ E = GraphTraits >::child_end(W); CI != E; ++CI)
+ if (DT.Info.count(*CI)) { // Only if this predecessor is reachable!
+ unsigned SemiU = DT.Info[Eval >(DT, *CI)].Semi;
+ if (SemiU < WInfo.Semi)
+ WInfo.Semi = SemiU;
+ }
+
+ DT.Info[DT.Vertex[WInfo.Semi]].Bucket.push_back(W);
+
+ typename GraphTraits::NodeType* WParent = WInfo.Parent;
+ Link >(DT, WParent, W, WInfo);
+
+ // Step #3: Implicitly define the immediate dominator of vertices
+ std::vector::NodeType*> &WParentBucket =
+ DT.Info[WParent].Bucket;
+ while (!WParentBucket.empty()) {
+ typename GraphTraits::NodeType* V = WParentBucket.back();
+ WParentBucket.pop_back();
+ typename GraphTraits::NodeType* U =
+ Eval >(DT, V);
+ DT.IDoms[V] = DT.Info[U].Semi < DT.Info[V].Semi ? U : WParent;
+ }
+ }
+
+ // Step #4: Explicitly define the immediate dominator of each vertex
+ for (unsigned i = 2; i <= N; ++i) {
+ typename GraphTraits::NodeType* W = DT.Vertex[i];
+ typename GraphTraits::NodeType*& WIDom = DT.IDoms[W];
+ if (WIDom != DT.Vertex[DT.Info[W].Semi])
+ WIDom = DT.IDoms[WIDom];
+ }
+
+ if (DT.Roots.empty()) return;
+
+ // Add a node for the root. This node might be the actual root, if there is
+ // one exit block, or it may be the virtual exit (denoted by (BasicBlock *)0)
+ // which postdominates all real exits if there are multiple exit blocks.
+ typename GraphTraits::NodeType* Root = DT.Roots.size() == 1 ? DT.Roots[0]
+ : 0;
+ DT.DomTreeNodes[Root] = DT.RootNode = new DomTreeNode(Root, 0);
+
+ // Loop over all of the reachable blocks in the function...
+ for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
+ if (typename GraphTraits::NodeType* ImmDom = DT.getIDom(I)) {
+ // Reachable block.
+ DomTreeNode *BBNode = DT.DomTreeNodes[I];
+ if (BBNode) continue; // Haven't calculated this node yet?
+
+ // Get or calculate the node for the immediate dominator
+ DomTreeNode *IDomNode = DT.getNodeForBlock(ImmDom);
+
+ // Add a new tree node for this BasicBlock, and link it as a child of
+ // IDomNode
+ DomTreeNode *C = new DomTreeNode(I, IDomNode);
+ DT.DomTreeNodes[I] = IDomNode->addChild(C);
+ }
+
+ // Free temporary memory used to construct idom's
+ DT.IDoms.clear();
+ DT.Info.clear();
+ std::vector::NodeType*>().swap(DT.Vertex);
+
+ // FIXME: This does not work on PostDomTrees. It seems likely that this is
+ // due to an error in the algorithm for post-dominators. This really should
+ // be investigated and fixed at some point.
+ // DT.updateDFSNumbers();
+
+ // Start out with the DFS numbers being invalid. Let them be computed if
+ // demanded.
+ DT.DFSInfoValid = false;
+}
+
}
#endif
Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=42593&r1=42592&r2=42593&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Wed Oct 3 16:25:45 2007
@@ -289,6 +289,9 @@
typename GraphT::NodeType* V,
unsigned N);
+ template friend void Calculate(DominatorTreeBase& DT,
+ Function& F);
+
/// updateDFSNumbers - Assign In and Out numbers to the nodes while walking
/// dominator tree in dfs order.
void updateDFSNumbers();
@@ -325,9 +328,6 @@
/// BB is split and now it has one successor. Update dominator tree to
/// reflect this change.
void splitBlock(BasicBlock *BB);
-
-private:
- friend void DTcalculate(DominatorTree& DT, Function& F);
};
//===-------------------------------------
Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=42593&r1=42592&r2=42593&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Wed Oct 3 16:25:45 2007
@@ -32,8 +32,6 @@
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
-private:
- friend void PDTcalculate(PostDominatorTree& PDT, Function &F);
};
Removed: llvm/trunk/lib/Analysis/PostDominatorCalculation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominatorCalculation.h?rev=42592&view=auto
==============================================================================
--- llvm/trunk/lib/Analysis/PostDominatorCalculation.h (original)
+++ llvm/trunk/lib/Analysis/PostDominatorCalculation.h (removed)
@@ -1,99 +0,0 @@
-//==- PostDominatorCalculation.h - Post-Dominator Calculation ----*- C++ -*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Owen Anderson and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// PostDominatorTree calculation implementation.
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ANALYSIS_POST_DOMINATOR_CALCULATION_H
-#define LLVM_ANALYSIS_POST_DOMINATOR_CALCULATION_H
-
-#include "llvm/Analysis/PostDominators.h"
-#include "llvm/Analysis/DominatorInternals.h"
-
-namespace llvm {
-
-void PDTcalculate(PostDominatorTree& PDT, Function &F) {
- // Step #1: Number blocks in depth-first order and initialize variables used
- // in later stages of the algorithm.
- unsigned N = 0;
- for (unsigned i = 0, e = PDT.Roots.size(); i != e; ++i)
- N = DFSPass > >(PDT, PDT.Roots[i], N);
-
- for (unsigned i = N; i >= 2; --i) {
- BasicBlock *W = PDT.Vertex[i];
- PostDominatorTree::InfoRec &WInfo = PDT.Info[W];
-
- // Step #2: Calculate the semidominators of all vertices
- for (succ_iterator SI = succ_begin(W), SE = succ_end(W); SI != SE; ++SI)
- if (PDT.Info.count(*SI)) { // Only if this predecessor is reachable!
- unsigned SemiU =
- PDT.Info[Eval > >(PDT, *SI)].Semi;
- if (SemiU < WInfo.Semi)
- WInfo.Semi = SemiU;
- }
-
- PDT.Info[PDT.Vertex[WInfo.Semi]].Bucket.push_back(W);
-
- BasicBlock *WParent = WInfo.Parent;
- Link > >(PDT, WParent, W, WInfo);
-
- // Step #3: Implicitly define the immediate dominator of vertices
- std::vector &WParentBucket = PDT.Info[WParent].Bucket;
- while (!WParentBucket.empty()) {
- BasicBlock *V = WParentBucket.back();
- WParentBucket.pop_back();
- BasicBlock *U = Eval > >(PDT, V);
- PDT.IDoms[V] = PDT.Info[U].Semi < PDT.Info[V].Semi ? U : WParent;
- }
- }
-
- // Step #4: Explicitly define the immediate dominator of each vertex
- for (unsigned i = 2; i <= N; ++i) {
- BasicBlock *W = PDT.Vertex[i];
- BasicBlock *&WIDom = PDT.IDoms[W];
- if (WIDom != PDT.Vertex[PDT.Info[W].Semi])
- WIDom = PDT.IDoms[WIDom];
- }
-
- if (PDT.Roots.empty()) return;
-
- // Add a node for the root. This node might be the actual root, if there is
- // one exit block, or it may be the virtual exit (denoted by (BasicBlock *)0)
- // which postdominates all real exits if there are multiple exit blocks.
- BasicBlock *Root = PDT.Roots.size() == 1 ? PDT.Roots[0] : 0;
- PDT.DomTreeNodes[Root] = PDT.RootNode = new DomTreeNode(Root, 0);
-
- // Loop over all of the reachable blocks in the function...
- for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
- if (BasicBlock *ImmPostDom = PDT.getIDom(I)) { // Reachable block.
- DomTreeNode *&BBNode = PDT.DomTreeNodes[I];
- if (!BBNode) { // Haven't calculated this node yet?
- // Get or calculate the node for the immediate dominator
- DomTreeNode *IPDomNode = PDT.getNodeForBlock(ImmPostDom);
-
- // Add a new tree node for this BasicBlock, and link it as a child of
- // IDomNode
- DomTreeNode *C = new DomTreeNode(I, IPDomNode);
- PDT.DomTreeNodes[I] = C;
- BBNode = IPDomNode->addChild(C);
- }
- }
-
- // Free temporary memory used to construct idom's
- PDT.IDoms.clear();
- PDT.Info.clear();
- std::vector().swap(PDT.Vertex);
-
- // Start out with the DFS numbers being invalid. Let them be computed if
- // demanded.
- PDT.DFSInfoValid = false;
-}
-
-}
-#endif
Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=42593&r1=42592&r2=42593&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Wed Oct 3 16:25:45 2007
@@ -16,7 +16,7 @@
#include "llvm/Support/CFG.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SetOperations.h"
-#include "PostDominatorCalculation.h"
+#include "llvm/Analysis/DominatorInternals.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -47,7 +47,7 @@
Vertex.push_back(0);
- PDTcalculate(*this, F);
+ Calculate >(*this, F);
return false;
}
Removed: llvm/trunk/lib/VMCore/DominatorCalculation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/DominatorCalculation.h?rev=42592&view=auto
==============================================================================
--- llvm/trunk/lib/VMCore/DominatorCalculation.h (original)
+++ llvm/trunk/lib/VMCore/DominatorCalculation.h (removed)
@@ -1,106 +0,0 @@
-//==- DominatorCalculation.h - Dominator Calculation -------------*- C++ -*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Owen Anderson and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_VMCORE_DOMINATOR_CALCULATION_H
-#define LLVM_VMCORE_DOMINATOR_CALCULATION_H
-
-#include "llvm/Analysis/Dominators.h"
-#include "llvm/Analysis/DominatorInternals.h"
-
-//===----------------------------------------------------------------------===//
-//
-// DominatorTree construction - This pass constructs immediate dominator
-// information for a flow-graph based on the algorithm described in this
-// document:
-//
-// A Fast Algorithm for Finding Dominators in a Flowgraph
-// T. Lengauer & R. Tarjan, ACM TOPLAS July 1979, pgs 121-141.
-//
-// This implements both the O(n*ack(n)) and the O(n*log(n)) versions of EVAL and
-// LINK, but it turns out that the theoretically slower O(n*log(n))
-// implementation is actually faster than the "efficient" algorithm (even for
-// large CFGs) because the constant overheads are substantially smaller. The
-// lower-complexity version can be enabled with the following #define:
-//
-#define BALANCE_IDOM_TREE 0
-//
-//===----------------------------------------------------------------------===//
-
-namespace llvm {
-
-void DTcalculate(DominatorTree& DT, Function &F) {
- BasicBlock* Root = DT.Roots[0];
-
- // Add a node for the root...
- DT.DomTreeNodes[Root] = DT.RootNode = new DomTreeNode(Root, 0);
-
- // Step #1: Number blocks in depth-first order and initialize variables used
- // in later stages of the algorithm.
- unsigned N = DFSPass >(DT, Root, 0);
-
- for (unsigned i = N; i >= 2; --i) {
- BasicBlock *W = DT.Vertex[i];
- DominatorTree::InfoRec &WInfo = DT.Info[W];
-
- // Step #2: Calculate the semidominators of all vertices
- for (pred_iterator PI = pred_begin(W), E = pred_end(W); PI != E; ++PI)
- if (DT.Info.count(*PI)) { // Only if this predecessor is reachable!
- unsigned SemiU = DT.Info[Eval >(DT, *PI)].Semi;
- if (SemiU < WInfo.Semi)
- WInfo.Semi = SemiU;
- }
-
- DT.Info[DT.Vertex[WInfo.Semi]].Bucket.push_back(W);
-
- BasicBlock *WParent = WInfo.Parent;
- Link >(DT, WParent, W, WInfo);
-
- // Step #3: Implicitly define the immediate dominator of vertices
- std::vector &WParentBucket = DT.Info[WParent].Bucket;
- while (!WParentBucket.empty()) {
- BasicBlock *V = WParentBucket.back();
- WParentBucket.pop_back();
- BasicBlock *U = Eval >(DT, V);
- DT.IDoms[V] = DT.Info[U].Semi < DT.Info[V].Semi ? U : WParent;
- }
- }
-
- // Step #4: Explicitly define the immediate dominator of each vertex
- for (unsigned i = 2; i <= N; ++i) {
- BasicBlock *W = DT.Vertex[i];
- BasicBlock *&WIDom = DT.IDoms[W];
- if (WIDom != DT.Vertex[DT.Info[W].Semi])
- WIDom = DT.IDoms[WIDom];
- }
-
- // Loop over all of the reachable blocks in the function...
- for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
- if (BasicBlock *ImmDom = DT.getIDom(I)) { // Reachable block.
- DomTreeNode *BBNode = DT.DomTreeNodes[I];
- if (BBNode) continue; // Haven't calculated this node yet?
-
- // Get or calculate the node for the immediate dominator
- DomTreeNode *IDomNode = DT.getNodeForBlock(ImmDom);
-
- // Add a new tree node for this BasicBlock, and link it as a child of
- // IDomNode
- DomTreeNode *C = new DomTreeNode(I, IDomNode);
- DT.DomTreeNodes[I] = IDomNode->addChild(C);
- }
-
- // Free temporary memory used to construct idom's
- DT.Info.clear();
- DT.IDoms.clear();
- std::vector().swap(DT.Vertex);
-
- DT.updateDFSNumbers();
-}
-
-}
-#endif
Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=42593&r1=42592&r2=42593&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Wed Oct 3 16:25:45 2007
@@ -21,9 +21,9 @@
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/Analysis/DominatorInternals.h"
#include "llvm/Instructions.h"
#include "llvm/Support/Streams.h"
-#include "DominatorCalculation.h"
#include
using namespace llvm;
@@ -357,7 +357,10 @@
DomTreeNodes[&F.getEntryBlock()] = 0;
Vertex.push_back(0);
- DTcalculate(*this, F);
+ Calculate(*this, F);
+
+ updateDFSNumbers();
+
return false;
}
From isanbard at gmail.com Wed Oct 3 17:02:01 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Wed, 03 Oct 2007 22:02:01 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42595 -
/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
Message-ID: <200710032202.l93M21LR017742@zion.cs.uiuc.edu>
Author: void
Date: Wed Oct 3 17:02:00 2007
New Revision: 42595
URL: http://llvm.org/viewvc/llvm-project?rev=42595&view=rev
Log:
LLVM needs a pointer type instead of "i32" for a null pointer. Also,
Objective-C++ is picky when it comes to converting a "void*" to another pointer
type.
Modified:
llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=42595&r1=42594&r2=42595&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Wed Oct 3 17:02:00 2007
@@ -2566,7 +2566,12 @@
/* struct objc_method_list *optional_instance_methods; */
if (!optional_instance_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2576,7 +2581,12 @@
/* struct objc_method_list *optional_class_methods; */
if (!optional_class_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2586,7 +2596,12 @@
/* struct objc_prop_list *instance_properties; */
if (!instance_prop)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_prop_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2667,7 +2682,12 @@
/* struct _prop_list_t *properties; */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_prop_list_ptr,
@@ -4972,9 +4992,13 @@
build_int_cst (long_integer_type_node, 0));
/* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
-
if (flag_next_runtime || ! sel_ref_chain)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (build_pointer_type (objc_selector_type),
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
initlist
= tree_cons (NULL_TREE,
@@ -9229,13 +9253,16 @@
/* static struct objc_protocol _OBJC_PROTOCOL_; */
protocol_name_expr = add_objc_string (PROTOCOL_NAME (p), class_names);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
if (refs_decl)
- refs_expr = convert (build_pointer_type (build_pointer_type
- (objc_protocol_template)),
- build_unary_op (ADDR_EXPR, refs_decl, 0));
+ refs_expr =
+ convert (build_pointer_type (build_pointer_type (objc_protocol_template)),
+ build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- refs_expr = build_int_cst (NULL_TREE, 0);
-
+ refs_expr =
+ convert (build_pointer_type (build_pointer_type (objc_protocol_template)),
+ build_int_cst (NULL_TREE, 0));
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
save_objc_implementation_context = objc_implementation_context;
@@ -9301,10 +9328,16 @@
/* APPLE LOCAL begin ObjC new abi */
/* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
/* APPLE LOCAL begin radar 4533974 - ObjC newprotocol - radar 4695109 */
+ /* APPLE LOCAL LLVM - begin NUL pointer */
if (newabi)
{
+ if (!objc_protocol_extension_template)
+ build_objc_protocol_extension_template ();
+
/* 'isa' is NULL in the new ObjC abi */
- expr = build_int_cst (NULL_TREE, 0);
+ expr =
+ convert (build_pointer_type (objc_protocol_extension_template),
+ build_int_cst (NULL_TREE, 0));
}
/* APPLE LOCAL end radar 4533974 - ObjC newprotocol - radar 4695109 */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9312,11 +9345,20 @@
else
{
if (!objc_protocol_or_opt_ins_meth)
- expr = build_int_cst (NULL_TREE, 0);
+ {
+ if (!objc_protocol_extension_template)
+ build_objc_protocol_extension_template ();
+
+ expr =
+ convert (build_pointer_type (objc_protocol_extension_template),
+ build_int_cst (NULL_TREE, 0));
+ }
else
- expr = convert (build_pointer_type (objc_protocol_extension_template),
- build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
+ expr = convert (build_pointer_type (objc_protocol_extension_template),
+ build_unary_op (ADDR_EXPR,
+ objc_protocol_or_opt_ins_meth, 0));
}
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL end radar 4585769 - Objective-C 1.0 extensions */
initlist = tree_cons (NULL_TREE, expr, initlist);
@@ -9326,23 +9368,33 @@
initlist = tree_cons (NULL_TREE, protocol_list, initlist);
if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_proto_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
/* APPLE LOCAL begin mainline */
expr = convert (objc_method_proto_list_ptr,
- build_unary_op (ADDR_EXPR, instance_methods, 0));
+ build_unary_op (ADDR_EXPR, instance_methods, 0));
/* APPLE LOCAL end mainline */
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_proto_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
/* APPLE LOCAL begin mainline */
expr = convert (objc_method_proto_list_ptr,
- build_unary_op (ADDR_EXPR, class_methods, 0));
+ build_unary_op (ADDR_EXPR, class_methods, 0));
/* APPLE LOCAL end mainline */
initlist = tree_cons (NULL_TREE, expr, initlist);
}
@@ -9352,31 +9404,49 @@
{
/* APPLE LOCAL begin radar 4695109 */
if (!objc_protocol_or_opt_ins_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_proto_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
- {
- expr = convert (objc_method_proto_list_ptr,
- build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ {
+ expr = convert (objc_method_proto_list_ptr,
+ build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+
if (!opt_cls_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_proto_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
- {
- expr = convert (objc_method_proto_list_ptr,
- build_unary_op (ADDR_EXPR, opt_cls_meth, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ {
+ expr = convert (objc_method_proto_list_ptr,
+ build_unary_op (ADDR_EXPR, opt_cls_meth, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+
/* APPLE LOCAL end radar 4695109 */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
- {
- expr = convert (objc_prop_list_ptr,
- build_unary_op (ADDR_EXPR, property_list, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ {
+ expr = convert (objc_prop_list_ptr,
+ build_unary_op (ADDR_EXPR, property_list, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
}
+
/* APPLE LOCAL end C* property metadata (Radar 4498373) */
return objc_build_constructor (type, nreverse (initlist));
}
@@ -10389,7 +10459,12 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ ivar = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ ivar);
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* Set type */
encode_field_decl (field_decl,
@@ -10446,7 +10521,12 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ ivar = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ ivar);
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* Set type. */
encode_field_decl (field_decl,
@@ -11142,7 +11222,12 @@
initlist = tree_cons (NULL_TREE, class_name, initlist);
if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
/* APPLE LOCAL begin mainline */
@@ -11152,7 +11237,12 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
/* APPLE LOCAL begin mainline */
@@ -11163,18 +11253,26 @@
}
/* protocol_list = */
- if (!protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
- else
- {
- /* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
- tree protocol_list_ptr =
- (abi_v2) ? build_pointer_type (objc_v2_protocol_template)
- : build_pointer_type (build_pointer_type (objc_protocol_template));
- expr = convert (protocol_list_ptr, build_unary_op (ADDR_EXPR, protocol_list, 0));
- /* APPLE LOCAL end radar 4533974 - ObjC new protocol */
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ {
+ tree protocol_list_ptr =
+ (abi_v2) ? build_pointer_type (objc_v2_protocol_template)
+ : build_pointer_type (build_pointer_type (objc_protocol_template));
+
+ if (!protocol_list)
+ initlist = tree_cons (NULL_TREE,
+ convert (protocol_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ else
+ {
+ /* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
+ expr = convert (protocol_list_ptr, build_unary_op (ADDR_EXPR, protocol_list, 0));
+ /* APPLE LOCAL end radar 4533974 - ObjC new protocol */
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+ }
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
if (!abi_v2)
{
@@ -11186,7 +11284,12 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* struct _objc_property_list *instance_properties; */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_prop_list_ptr,
@@ -11253,7 +11356,12 @@
/* objc_ivar_list = */
if (!ivar_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_ivar_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
/* APPLE LOCAL begin mainline */
@@ -11265,7 +11373,12 @@
/* objc_method_list = */
if (!dispatch_table)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
/* APPLE LOCAL begin mainline */
@@ -11275,60 +11388,109 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
+ /* APPLE LOCAL LLVM - begin NUL pointer */
if (flag_next_runtime)
/* method_cache = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ initlist = tree_cons (NULL_TREE,
+ convert (build_pointer_type
+ (xref_tag (RECORD_TYPE,
+ get_identifier
+ ("objc_cache"))),
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
else
{
+ tree null_objc_class_ptr =
+ convert (build_pointer_type (objc_class_template),
+ build_int_cst (NULL_TREE, 0));
+
/* dtable = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ initlist = tree_cons (NULL_TREE,
+ convert (build_pointer_type (xref_tag (RECORD_TYPE,
+ get_identifier
+ ("sarray"))),
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
/* subclass_list = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ initlist = tree_cons (NULL_TREE, null_objc_class_ptr, initlist);
/* sibling_class = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ initlist = tree_cons (NULL_TREE, null_objc_class_ptr, initlist);
}
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* protocol_list = */
- if (! protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
- else
- {
- expr = convert (build_pointer_type
- (build_pointer_type
- (objc_protocol_template)),
- build_unary_op (ADDR_EXPR, protocol_list, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ {
+ tree objc_protocol_ptr_ptr =
+ build_pointer_type (build_pointer_type (objc_protocol_template));
+
+ if (!protocol_list)
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_protocol_ptr_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ else
+ {
+ expr = convert (objc_protocol_ptr_ptr,
+ build_unary_op (ADDR_EXPR, protocol_list, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+ }
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
if (flag_next_runtime)
{
/* const char *ivar_layout; */
if (IS_CLS_META (status)) /* Meta Class ? */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
tree ivar_layout = objc_build_ivar_layout (true);
if (!ivar_layout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
initlist = tree_cons (NULL_TREE, ivar_layout, initlist);
}
/* struct _objc_class_ext *ext; */
- if (!objc_class_ext)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
- else
- {
- expr = convert (build_pointer_type (objc_class_ext_template),
- build_unary_op (ADDR_EXPR, objc_class_ext, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ if (!objc_class_ext_template)
+ build_objc_class_ext_template ();
+
+ {
+ tree objc_class_ext_ptr =
+ build_pointer_type (objc_class_ext_template);
+
+ if (!objc_class_ext)
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_class_ext_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ else
+ {
+ expr = convert (objc_class_ext_ptr,
+ build_unary_op (ADDR_EXPR, objc_class_ext, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+ }
+ /* APPLE LOCAL LLVM - end NUL pointer */
}
else
/* gc_object_type = NULL */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* APPLE LOCAL end radar 4585769 - Objective-C 1.0 extensions */
return objc_build_constructor (type, nreverse (initlist));
@@ -11490,13 +11652,19 @@
if (cache)
initlist = tree_cons (NULL_TREE, cache, initlist);
else
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* vtable */
if (vtable)
initlist = tree_cons (NULL_TREE, vtable, initlist);
else
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (build_pointer_type (objc_imp_type),
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* ro */
initlist = tree_cons (NULL_TREE, ro, initlist);
@@ -11540,7 +11708,12 @@
/* APPLE LOCAL begin radar 4695101 */
/* ivarLayout */
if (!ivarLayout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
initlist = tree_cons (NULL_TREE, ivarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11550,7 +11723,12 @@
/* baseMethods */
if (!baseMethods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_list_ptr,
@@ -11559,32 +11737,50 @@
}
/* baseProtocols */
- if (!baseProtocols)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
- else
- {
- tree protocol_list_t_p = build_pointer_type (
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_V2_PROTOCOL_LIST)));
- expr = convert (protocol_list_t_p,
- build_unary_op (ADDR_EXPR, baseProtocols, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ {
+ tree protocol_list_t_p =
+ build_pointer_type (xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_V2_PROTOCOL_LIST)));
+
+ if (!baseProtocols)
+ initlist = tree_cons (NULL_TREE,
+ convert (protocol_list_t_p,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ else
+ {
+ expr = convert (protocol_list_t_p,
+ build_unary_op (ADDR_EXPR, baseProtocols, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+ }
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* ivars */
if (!ivars)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_v2_ivar_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_v2_ivar_list_ptr,
- build_unary_op (ADDR_EXPR, ivars, 0));
+ build_unary_op (ADDR_EXPR, ivars, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL begin radar 4695101 */
/* weakIvarLayout */
if (!weakIvarLayout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
initlist = tree_cons (NULL_TREE, weakIvarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11592,11 +11788,16 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* property list */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_prop_list_ptr,
- build_unary_op (ADDR_EXPR, property_list, 0));
+ build_unary_op (ADDR_EXPR, property_list, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL end C* property metadata (Radar 4498373) */
@@ -11854,7 +12055,10 @@
/* root class. */
root_expr = build_unary_op (ADDR_EXPR, metaclass_decl, 0);
metaclass_superclass_expr = build_unary_op (ADDR_EXPR, class_decl, 0);
- class_superclass_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ class_superclass_expr = convert (build_pointer_type (objc_v2_class_template),
+ build_int_cst (NULL_TREE, 0));
+ /* APPLE LOCAL LLVM - end NUL pointer */
flags |= 0x2; /* CLS_ROOT: it is also a root meta class */
}
@@ -12043,7 +12247,10 @@
super_expr = build_c_cast (cast_type, super_expr); /* cast! */
}
else
- super_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ super_expr = convert (string_type_node,
+ build_int_cst (NULL_TREE, 0));
+ /* APPLE LOCAL LLVM - end NUL pointer */
root_expr = add_objc_string (my_root_id, class_names);
root_expr = build_c_cast (cast_type, root_expr); /* cast! */
@@ -13303,7 +13510,11 @@
refs_expr = convert (build_pointer_type (objc_v2_protocol_template),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- refs_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ refs_expr =
+ convert (build_pointer_type (objc_v2_protocol_template),
+ build_int_cst (NULL_TREE, 0));
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL begin radar 4695101 */
/* Build table of list of properties for this protocol. */
From isanbard at gmail.com Wed Oct 3 17:20:58 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Wed, 03 Oct 2007 22:20:58 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42597 -
/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Message-ID: <200710032220.l93MKwXc018734@zion.cs.uiuc.edu>
Author: void
Date: Wed Oct 3 17:20:58 2007
New Revision: 42597
URL: http://llvm.org/viewvc/llvm-project?rev=42597&view=rev
Log:
LLVM needs a pointer type instead of "i32" for a null pointer. Also,
Objective-C++ is picky when it comes to converting a "void*" to another pointer
type.
Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=42597&r1=42596&r2=42597&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Wed Oct 3 17:20:58 2007
@@ -2576,7 +2576,12 @@
/* struct objc_method_list *optional_instance_methods; */
if (!optional_instance_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2586,7 +2591,12 @@
/* struct objc_method_list *optional_class_methods; */
if (!optional_class_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2596,7 +2606,12 @@
/* struct objc_prop_list *instance_properties; */
if (!instance_prop)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_prop_list_ptr, build_unary_op (ADDR_EXPR,
@@ -2677,7 +2692,12 @@
/* struct _prop_list_t *properties; */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_prop_list_ptr,
@@ -4869,9 +4889,13 @@
build_int_cst (long_integer_type_node, 0));
/* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
-
if (flag_next_runtime || ! sel_ref_chain)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (build_pointer_type (objc_selector_type),
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
initlist
= tree_cons (NULL_TREE,
@@ -9129,13 +9153,16 @@
/* static struct objc_protocol _OBJC_PROTOCOL_; */
protocol_name_expr = add_objc_string (PROTOCOL_NAME (p), class_names);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
if (refs_decl)
- refs_expr = convert (build_pointer_type (build_pointer_type
- (objc_protocol_template)),
- build_unary_op (ADDR_EXPR, refs_decl, 0));
+ refs_expr =
+ convert (build_pointer_type (build_pointer_type (objc_protocol_template)),
+ build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- refs_expr = build_int_cst (NULL_TREE, 0);
-
+ refs_expr =
+ convert (build_pointer_type (build_pointer_type (objc_protocol_template)),
+ build_int_cst (NULL_TREE, 0));
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
save_objc_implementation_context = objc_implementation_context;
@@ -9201,10 +9228,16 @@
/* APPLE LOCAL begin ObjC new abi */
/* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
/* APPLE LOCAL begin radar 4533974 - ObjC newprotocol - radar 4695109 */
+ /* APPLE LOCAL LLVM - begin NUL pointer */
if (newabi)
{
+ if (!objc_protocol_extension_template)
+ build_objc_protocol_extension_template ();
+
/* 'isa' is NULL in the new ObjC abi */
- expr = build_int_cst (NULL_TREE, 0);
+ expr =
+ convert (build_pointer_type (objc_protocol_extension_template),
+ build_int_cst (NULL_TREE, 0));
}
/* APPLE LOCAL end radar 4533974 - ObjC newprotocol - radar 4695109 */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
@@ -9212,11 +9245,20 @@
else
{
if (!objc_protocol_or_opt_ins_meth)
- expr = build_int_cst (NULL_TREE, 0);
+ {
+ if (!objc_protocol_extension_template)
+ build_objc_protocol_extension_template ();
+
+ expr =
+ convert (build_pointer_type (objc_protocol_extension_template),
+ build_int_cst (NULL_TREE, 0));
+ }
else
- expr = convert (build_pointer_type (objc_protocol_extension_template),
- build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
+ expr = convert (build_pointer_type (objc_protocol_extension_template),
+ build_unary_op (ADDR_EXPR,
+ objc_protocol_or_opt_ins_meth, 0));
}
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL end radar 4585769 - Objective-C 1.0 extensions */
initlist = tree_cons (NULL_TREE, expr, initlist);
@@ -9226,7 +9268,12 @@
initlist = tree_cons (NULL_TREE, protocol_list, initlist);
if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_proto_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9235,7 +9282,12 @@
}
if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_proto_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_proto_list_ptr,
@@ -9248,30 +9300,45 @@
{
/* APPLE LOCAL begin radar 4695109 */
if (!objc_protocol_or_opt_ins_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_proto_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
- {
- expr = convert (objc_method_proto_list_ptr,
- build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ {
+ expr = convert (objc_method_proto_list_ptr,
+ build_unary_op (ADDR_EXPR, objc_protocol_or_opt_ins_meth, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
if (!opt_cls_meth)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_proto_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
- {
- expr = convert (objc_method_proto_list_ptr,
- build_unary_op (ADDR_EXPR, opt_cls_meth, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ {
+ expr = convert (objc_method_proto_list_ptr,
+ build_unary_op (ADDR_EXPR, opt_cls_meth, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
/* APPLE LOCAL end radar 4695109 */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
- {
- expr = convert (objc_prop_list_ptr,
- build_unary_op (ADDR_EXPR, property_list, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ {
+ expr = convert (objc_prop_list_ptr,
+ build_unary_op (ADDR_EXPR, property_list, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
/* APPLE LOCAL begin radar 5192466 */
/* const uint32_t size; = sizeof(struct protocol_t) */
expr = build_int_cst (
@@ -10291,7 +10358,12 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ ivar = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ ivar);
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* Set type */
encode_field_decl (field_decl,
@@ -10348,7 +10420,12 @@
ivar);
else
/* Unnamed bit-field ivar (yuck). */
- ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ ivar = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ ivar);
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* Set type. */
encode_field_decl (field_decl,
@@ -11042,7 +11119,12 @@
initlist = tree_cons (NULL_TREE, class_name, initlist);
if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_list_ptr,
@@ -11050,7 +11132,12 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_list_ptr,
@@ -11059,18 +11146,26 @@
}
/* protocol_list = */
- if (!protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
- else
- {
- /* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
- tree protocol_list_ptr =
- (abi_v2) ? build_pointer_type (objc_v2_protocol_template)
- : build_pointer_type (build_pointer_type (objc_protocol_template));
- expr = convert (protocol_list_ptr, build_unary_op (ADDR_EXPR, protocol_list, 0));
- /* APPLE LOCAL end radar 4533974 - ObjC new protocol */
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ {
+ tree protocol_list_ptr =
+ (abi_v2) ? build_pointer_type (objc_v2_protocol_template)
+ : build_pointer_type (build_pointer_type (objc_protocol_template));
+
+ if (!protocol_list)
+ initlist = tree_cons (NULL_TREE,
+ convert (protocol_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ else
+ {
+ /* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
+ expr = convert (protocol_list_ptr, build_unary_op (ADDR_EXPR, protocol_list, 0));
+ /* APPLE LOCAL end radar 4533974 - ObjC new protocol */
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+ }
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
if (!abi_v2)
{
@@ -11082,7 +11177,12 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* struct _objc_property_list *instance_properties; */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_prop_list_ptr,
@@ -11149,7 +11249,12 @@
/* objc_ivar_list = */
if (!ivar_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_ivar_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_ivar_list_ptr,
@@ -11159,7 +11264,12 @@
/* objc_method_list = */
if (!dispatch_table)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_list_ptr,
@@ -11167,60 +11277,109 @@
initlist = tree_cons (NULL_TREE, expr, initlist);
}
+ /* APPLE LOCAL LLVM - begin NUL pointer */
if (flag_next_runtime)
/* method_cache = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ initlist = tree_cons (NULL_TREE,
+ convert (build_pointer_type
+ (xref_tag (RECORD_TYPE,
+ get_identifier
+ ("objc_cache"))),
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
else
{
+ tree null_objc_class_ptr =
+ convert (build_pointer_type (objc_class_template),
+ build_int_cst (NULL_TREE, 0));
+
/* dtable = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
-
+ initlist = tree_cons (NULL_TREE,
+ convert (build_pointer_type (xref_tag (RECORD_TYPE,
+ get_identifier
+ ("sarray"))),
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+
/* subclass_list = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
-
+ initlist = tree_cons (NULL_TREE, null_objc_class_ptr, initlist);
+
/* sibling_class = */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ initlist = tree_cons (NULL_TREE, null_objc_class_ptr, initlist);
}
-
+ /* APPLE LOCAL LLVM - end NUL pointer */
+
/* protocol_list = */
- if (! protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
- else
- {
- expr = convert (build_pointer_type
- (build_pointer_type
- (objc_protocol_template)),
- build_unary_op (ADDR_EXPR, protocol_list, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ {
+ tree objc_protocol_ptr_ptr =
+ build_pointer_type (build_pointer_type (objc_protocol_template));
+
+ if (!protocol_list)
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_protocol_ptr_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ else
+ {
+ expr = convert (objc_protocol_ptr_ptr,
+ build_unary_op (ADDR_EXPR, protocol_list, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+ }
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */
if (flag_next_runtime)
{
/* const char *ivar_layout; */
if (IS_CLS_META (status)) /* Meta Class ? */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
tree ivar_layout = objc_build_ivar_layout (true);
if (!ivar_layout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
initlist = tree_cons (NULL_TREE, ivar_layout, initlist);
}
/* struct _objc_class_ext *ext; */
- if (!objc_class_ext)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
- else
- {
- expr = convert (build_pointer_type (objc_class_ext_template),
- build_unary_op (ADDR_EXPR, objc_class_ext, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ if (!objc_class_ext_template)
+ build_objc_class_ext_template ();
+
+ {
+ tree objc_class_ext_ptr =
+ build_pointer_type (objc_class_ext_template);
+
+ if (!objc_class_ext)
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_class_ext_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ else
+ {
+ expr = convert (objc_class_ext_ptr,
+ build_unary_op (ADDR_EXPR, objc_class_ext, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+ }
+ /* APPLE LOCAL LLVM - end NUL pointer */
}
else
/* gc_object_type = NULL */
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* APPLE LOCAL end radar 4585769 - Objective-C 1.0 extensions */
return objc_build_constructor (type, nreverse (initlist));
@@ -11382,13 +11541,19 @@
if (cache)
initlist = tree_cons (NULL_TREE, cache, initlist);
else
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - NUL pointer */
+ initlist = tree_cons (NULL_TREE, null_pointer_node, initlist);
/* vtable */
if (vtable)
initlist = tree_cons (NULL_TREE, vtable, initlist);
else
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (build_pointer_type (objc_imp_type),
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* ro */
initlist = tree_cons (NULL_TREE, ro, initlist);
@@ -11432,7 +11597,12 @@
/* APPLE LOCAL begin radar 4695101 */
/* ivarLayout */
if (!ivarLayout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
initlist = tree_cons (NULL_TREE, ivarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11442,7 +11612,12 @@
/* baseMethods */
if (!baseMethods)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_method_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_method_list_ptr,
@@ -11451,32 +11626,50 @@
}
/* baseProtocols */
- if (!baseProtocols)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
- else
- {
- tree protocol_list_t_p = build_pointer_type (
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_V2_PROTOCOL_LIST)));
- expr = convert (protocol_list_t_p,
- build_unary_op (ADDR_EXPR, baseProtocols, 0));
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ {
+ tree protocol_list_t_p =
+ build_pointer_type (xref_tag (RECORD_TYPE,
+ get_identifier (UTAG_V2_PROTOCOL_LIST)));
+
+ if (!baseProtocols)
+ initlist = tree_cons (NULL_TREE,
+ convert (protocol_list_t_p,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ else
+ {
+ expr = convert (protocol_list_t_p,
+ build_unary_op (ADDR_EXPR, baseProtocols, 0));
+ initlist = tree_cons (NULL_TREE, expr, initlist);
+ }
+ }
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* ivars */
if (!ivars)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_v2_ivar_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_v2_ivar_list_ptr,
- build_unary_op (ADDR_EXPR, ivars, 0));
+ build_unary_op (ADDR_EXPR, ivars, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL begin radar 4695101 */
/* weakIvarLayout */
if (!weakIvarLayout)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (string_type_node,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
initlist = tree_cons (NULL_TREE, weakIvarLayout, initlist);
/* APPLE LOCAL end radar 4695101 */
@@ -11484,11 +11677,16 @@
/* APPLE LOCAL begin C* property metadata (Radar 4498373) */
/* property list */
if (!property_list)
- initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ initlist = tree_cons (NULL_TREE,
+ convert (objc_prop_list_ptr,
+ build_int_cst (NULL_TREE, 0)),
+ initlist);
+ /* APPLE LOCAL LLVM - end NUL pointer */
else
{
expr = convert (objc_prop_list_ptr,
- build_unary_op (ADDR_EXPR, property_list, 0));
+ build_unary_op (ADDR_EXPR, property_list, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* APPLE LOCAL end C* property metadata (Radar 4498373) */
@@ -11735,7 +11933,10 @@
/* root class. */
root_expr = build_unary_op (ADDR_EXPR, metaclass_decl, 0);
metaclass_superclass_expr = build_unary_op (ADDR_EXPR, class_decl, 0);
- class_superclass_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ class_superclass_expr = convert (build_pointer_type (objc_v2_class_template),
+ build_int_cst (NULL_TREE, 0));
+ /* APPLE LOCAL LLVM - end NUL pointer */
flags |= 0x2; /* CLS_ROOT: it is also a root meta class */
}
@@ -11927,7 +12128,10 @@
super_expr = build_c_cast (cast_type, super_expr); /* cast! */
}
else
- super_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ super_expr = convert (string_type_node,
+ build_int_cst (NULL_TREE, 0));
+ /* APPLE LOCAL LLVM - end NUL pointer */
root_expr = add_objc_string (my_root_id, class_names);
root_expr = build_c_cast (cast_type, root_expr); /* cast! */
@@ -13190,7 +13394,11 @@
refs_expr = convert (build_pointer_type (objc_v2_protocol_template),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
- refs_expr = build_int_cst (NULL_TREE, 0);
+ /* APPLE LOCAL LLVM - begin NUL pointer */
+ refs_expr =
+ convert (build_pointer_type (objc_v2_protocol_template),
+ build_int_cst (NULL_TREE, 0));
+ /* APPLE LOCAL LLVM - end NUL pointer */
/* APPLE LOCAL begin radar 4695101 */
/* Build table of list of properties for this protocol. */
From neil at daikokuya.co.uk Wed Oct 3 17:26:02 2007
From: neil at daikokuya.co.uk (Neil Booth)
Date: Wed, 03 Oct 2007 22:26:02 -0000
Subject: [llvm-commits] [llvm] r42598 - in /llvm/trunk:
include/llvm/ADT/APFloat.h lib/Support/APFloat.cpp
Message-ID: <200710032226.l93MQ25v019027@zion.cs.uiuc.edu>
Author: neil
Date: Wed Oct 3 17:26:02 2007
New Revision: 42598
URL: http://llvm.org/viewvc/llvm-project?rev=42598&view=rev
Log:
Add APFloat -> hexadecimal string conversion, as per %a and %A in C99.
Useful for diagnostics and debugging.
Modified:
llvm/trunk/include/llvm/ADT/APFloat.h
llvm/trunk/lib/Support/APFloat.cpp
Modified: llvm/trunk/include/llvm/ADT/APFloat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=42598&r1=42597&r2=42598&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)
+++ llvm/trunk/include/llvm/ADT/APFloat.h Wed Oct 3 17:26:02 2007
@@ -13,10 +13,10 @@
//===----------------------------------------------------------------------===//
/* A self-contained host- and target-independent arbitrary-precision
- floating-point software implementation using bignum integer
- arithmetic, as provided by static functions in the APInt class.
+ floating-point software implementation. It uses bignum integer
+ arithmetic as provided by static functions in the APInt class.
The library will work with bignum integers whose parts are any
- unsigned type at least 16 bits wide. 64 bits is recommended.
+ unsigned type at least 16 bits wide, but 64 bits is recommended.
Written for clarity rather than speed, in particular with a view
to use in the front-end of a cross compiler so that target
@@ -30,10 +30,7 @@
are add, subtract, multiply, divide, fused-multiply-add,
conversion-to-float, conversion-to-integer and
conversion-from-integer. New rounding modes (e.g. away from zero)
- can be added with three or four lines of code. The library reads
- and correctly rounds hexadecimal floating point numbers as per
- C99; syntax is required to have been validated by the caller.
- Conversion from decimal is not currently implemented.
+ can be added with three or four lines of code.
Four formats are built-in: IEEE single precision, double
precision, quadruple precision, and x87 80-bit extended double
@@ -54,6 +51,17 @@
should be straight forward to add support for the before-rounding
case too.
+ The library reads hexadecimal floating point numbers as per C99,
+ and correctly rounds if necessary according to the specified
+ rounding mode. Syntax is required to have been validated by the
+ caller. It also converts floating point numbers to hexadecimal
+ text as per the C99 %a and %A conversions. The output precision
+ (or alternatively the natural minimal precision) can be specified;
+ if the requested precision is less than the natural precision the
+ output is correctly rounded for the specified rounding mode.
+
+ Conversion to and from decimal text is not currently implemented.
+
Non-zero finite numbers are represented internally as a sign bit,
a 16-bit signed exponent, and the significand as an array of
integer parts. After normalization of a number of precision P the
@@ -77,17 +85,14 @@
Conversions to and from decimal strings (hard).
- Conversions to hexadecimal string.
-
- Read and write IEEE-format in-memory representations.
-
Optional ability to detect underflow tininess before rounding.
New formats: x87 in single and double precision mode (IEEE apart
from extended exponent range) and IBM two-double extended
precision (hard).
- New operations: sqrt, nextafter, nexttoward.
+ New operations: sqrt, IEEE remainder, C90 fmod, nextafter,
+ nexttoward.
*/
#ifndef LLVM_FLOAT_H
@@ -205,6 +210,13 @@
compare unordered, 0==-0). */
cmpResult compare(const APFloat &) const;
+ /* Write out a hexadecimal representation of the floating point
+ value to DST, which must be of sufficient size, in the C99 form
+ [-]0xh.hhhhp[+-]d. Return the number of characters written,
+ excluding the terminating NUL. */
+ unsigned int convertToHexString(char *dst, unsigned int hexDigits,
+ bool upperCase, roundingMode) const;
+
/* Bitwise comparison for equality (QNaNs compare equal, 0!=-0). */
bool bitwiseIsEqual(const APFloat &) const;
@@ -255,9 +267,11 @@
opStatus handleOverflow(roundingMode);
bool roundAwayFromZero(roundingMode, lostFraction, unsigned int) const;
opStatus convertFromUnsignedInteger(integerPart *, unsigned int,
- roundingMode);
+ roundingMode);
lostFraction combineLostFractions(lostFraction, lostFraction);
opStatus convertFromHexadecimalString(const char *, roundingMode);
+ char *convertNormalToHexString(char *, unsigned int, bool,
+ roundingMode) const;
APInt convertFloatAPFloatToAPInt() const;
APInt convertDoubleAPFloatToAPInt() const;
APInt convertF80LongDoubleAPFloatToAPInt() const;
Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=42598&r1=42597&r2=42598&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Wed Oct 3 17:26:02 2007
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include
+#include
#include "llvm/ADT/APFloat.h"
#include "llvm/Support/MathExtras.h"
@@ -20,7 +21,8 @@
#define convolve(lhs, rhs) ((lhs) * 4 + (rhs))
-/* Assumed in hexadecimal significand parsing. */
+/* Assumed in hexadecimal significand parsing, and conversion to
+ hexadecimal strings. */
COMPILE_TIME_ASSERT(integerPartWidth % 4 == 0);
namespace llvm {
@@ -187,7 +189,7 @@
/* Return the fraction lost were a bignum truncated losing the least
significant BITS bits. */
lostFraction
- lostFractionThroughTruncation(integerPart *parts,
+ lostFractionThroughTruncation(const integerPart *parts,
unsigned int partCount,
unsigned int bits)
{
@@ -219,6 +221,66 @@
return lost_fraction;
}
+
+
+ /* Zero at the end to avoid modular arithmetic when adding one; used
+ when rounding up during hexadecimal output. */
+ static const char hexDigitsLower[] = "0123456789abcdef0";
+ static const char hexDigitsUpper[] = "0123456789ABCDEF0";
+ static const char infinityL[] = "infinity";
+ static const char infinityU[] = "INFINITY";
+ static const char NaNL[] = "nan";
+ static const char NaNU[] = "NAN";
+
+ /* Write out an integerPart in hexadecimal, starting with the most
+ significant nibble. Write out exactly COUNT hexdigits, return
+ COUNT. */
+ static unsigned int
+ partAsHex (char *dst, integerPart part, unsigned int count,
+ const char *hexDigitChars)
+ {
+ unsigned int result = count;
+
+ assert (count != 0 && count <= integerPartWidth / 4);
+
+ part >>= (integerPartWidth - 4 * count);
+ while (count--) {
+ dst[count] = hexDigitChars[part & 0xf];
+ part >>= 4;
+ }
+
+ return result;
+ }
+
+ /* Write out a decimal exponent. */
+ static char *
+ writeDecimalExponent (char *dst, int exponent)
+ {
+ assert (exponent >= -65536 && exponent <= 65535);
+
+ if (exponent < 0) {
+ *dst++ = '-';
+ exponent = -exponent;
+ }
+
+ if (exponent == 0) {
+ *dst++ = '0';
+ } else {
+ char buff[12], *p;
+
+ p = buff;
+ while (exponent) {
+ *p++ = '0' + exponent % 10;
+ exponent /= 10;
+ }
+
+ do
+ *dst++ = *--p;
+ while (p != buff);
+ }
+
+ return dst;
+ }
}
/* Constructors. */
@@ -1167,7 +1229,7 @@
return fs;
}
-/* Normalized remainder. */
+/* Normalized remainder. This is not currently doing TRT. */
APFloat::opStatus
APFloat::mod(const APFloat &rhs, roundingMode rounding_mode)
{
@@ -1630,6 +1692,181 @@
abort();
}
+/* Write out a hexadecimal representation of the floating point value
+ to DST, which must be of sufficient size, in the C99 form
+ [-]0xh.hhhhp[+-]d. Return the number of characters written,
+ excluding the terminating NUL.
+
+ If UPPERCASE, the output is in upper case, otherwise in lower case.
+
+ HEXDIGITS digits appear altogether, rounding the value if
+ necessary. If HEXDIGITS is 0, the minimal precision to display the
+ number precisely is used instead. If nothing would appear after
+ the decimal point it is suppressed.
+
+ The decimal exponent is always printed and has at least one digit.
+ Zero values display an exponent of zero. Infinities and NaNs
+ appear as "infinity" or "nan" respectively.
+
+ The above rules are as specified by C99. There is ambiguity about
+ what the leading hexadecimal digit should be. This implementation
+ uses whatever is necessary so that the exponent is displayed as
+ stored. This implies the exponent will fall within the IEEE format
+ range, and the leading hexadecimal digit will be 0 (for denormals),
+ 1 (normal numbers) or 2 (normal numbers rounded-away-from-zero with
+ any other digits zero).
+*/
+unsigned int
+APFloat::convertToHexString(char *dst, unsigned int hexDigits,
+ bool upperCase, roundingMode rounding_mode) const
+{
+ char *p;
+
+ p = dst;
+ if (sign)
+ *dst++ = '-';
+
+ switch (category) {
+ case fcInfinity:
+ memcpy (dst, upperCase ? infinityU: infinityL, sizeof infinityU - 1);
+ dst += sizeof infinityL - 1;
+ break;
+
+ case fcNaN:
+ memcpy (dst, upperCase ? NaNU: NaNL, sizeof NaNU - 1);
+ dst += sizeof NaNU - 1;
+ break;
+
+ case fcZero:
+ *dst++ = '0';
+ *dst++ = upperCase ? 'X': 'x';
+ *dst++ = '0';
+ if (hexDigits > 1) {
+ *dst++ = '.';
+ memset (dst, '0', hexDigits - 1);
+ dst += hexDigits - 1;
+ }
+ *dst++ = upperCase ? 'P': 'p';
+ *dst++ = '0';
+ break;
+
+ case fcNormal:
+ dst = convertNormalToHexString (dst, hexDigits, upperCase, rounding_mode);
+ break;
+ }
+
+ *dst = 0;
+
+ return dst - p;
+}
+
+/* Does the hard work of outputting the correctly rounded hexadecimal
+ form of a normal floating point number with the specified number of
+ hexadecimal digits. If HEXDIGITS is zero the minimum number of
+ digits necessary to print the value precisely is output. */
+char *
+APFloat::convertNormalToHexString(char *dst, unsigned int hexDigits,
+ bool upperCase,
+ roundingMode rounding_mode) const
+{
+ unsigned int count, valueBits, shift, partsCount, outputDigits;
+ const char *hexDigitChars;
+ const integerPart *significand;
+ char *p;
+ bool roundUp;
+
+ *dst++ = '0';
+ *dst++ = upperCase ? 'X': 'x';
+
+ roundUp = false;
+ hexDigitChars = upperCase ? hexDigitsUpper: hexDigitsLower;
+
+ significand = significandParts();
+ partsCount = partCount();
+
+ /* +3 because the first digit only uses the single integer bit, so
+ we have 3 virtual zero most-significant-bits. */
+ valueBits = semantics->precision + 3;
+ shift = integerPartWidth - valueBits % integerPartWidth;
+
+ /* The natural number of digits required ignoring trailing
+ insignificant zeroes. */
+ outputDigits = (valueBits - significandLSB () + 3) / 4;
+
+ /* hexDigits of zero means use the required number for the
+ precision. Otherwise, see if we are truncating. If we are,
+ found out if we need to round away from zero. */
+ if (hexDigits) {
+ if (hexDigits < outputDigits) {
+ /* We are dropping non-zero bits, so need to check how to round.
+ "bits" is the number of dropped bits. */
+ unsigned int bits;
+ lostFraction fraction;
+
+ bits = valueBits - hexDigits * 4;
+ fraction = lostFractionThroughTruncation (significand, partsCount, bits);
+ roundUp = roundAwayFromZero(rounding_mode, fraction, bits);
+ }
+ outputDigits = hexDigits;
+ }
+
+ /* Write the digits consecutively, and start writing in the location
+ of the hexadecimal point. We move the most significant digit
+ left and add the hexadecimal point later. */
+ p = ++dst;
+
+ count = (valueBits + integerPartWidth - 1) / integerPartWidth;
+
+ while (outputDigits && count) {
+ integerPart part;
+
+ /* Put the most significant integerPartWidth bits in "part". */
+ if (--count == partsCount)
+ part = 0; /* An imaginary higher zero part. */
+ else
+ part = significand[count] << shift;
+
+ if (count && shift)
+ part |= significand[count - 1] >> (integerPartWidth - shift);
+
+ /* Convert as much of "part" to hexdigits as we can. */
+ unsigned int curDigits = integerPartWidth / 4;
+
+ if (curDigits > outputDigits)
+ curDigits = outputDigits;
+ dst += partAsHex (dst, part, curDigits, hexDigitChars);
+ outputDigits -= curDigits;
+ }
+
+ if (roundUp) {
+ char *q = dst;
+
+ /* Note that hexDigitChars has a trailing '0'. */
+ do {
+ q--;
+ *q = hexDigitChars[hexDigitValue (*q) + 1];
+ } while (*q == '0' && q > p);
+ } else {
+ /* Add trailing zeroes. */
+ memset (dst, '0', outputDigits);
+ dst += outputDigits;
+ }
+
+ /* Move the most significant digit to before the point, and if there
+ is something after the decimal point add it. This must come
+ after rounding above. */
+ p[-1] = p[0];
+ if (dst -1 == p)
+ dst--;
+ else
+ p[0] = '.';
+
+ /* Finally output the exponent. */
+ *dst++ = upperCase ? 'P': 'p';
+
+ return writeDecimalExponent (dst, exponent);
+}
+
// For good performance it is desirable for different APFloats
// to produce different integers.
uint32_t
From gordonhenriksen at mac.com Wed Oct 3 19:07:51 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Thu, 04 Oct 2007 00:07:51 -0000
Subject: [llvm-commits] [llvm] r42599 -
/llvm/trunk/bindings/ocaml/Makefile.ocaml
Message-ID: <200710040007.l9407pTB022789@zion.cs.uiuc.edu>
Author: gordon
Date: Wed Oct 3 19:07:50 2007
New Revision: 42599
URL: http://llvm.org/viewvc/llvm-project?rev=42599&view=rev
Log:
Do use the actual ocaml stdlib (not the install dir) to find the
caml/*.h headers.
Modified:
llvm/trunk/bindings/ocaml/Makefile.ocaml
Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=42599&r1=42598&r2=42599&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/Makefile.ocaml (original)
+++ llvm/trunk/bindings/ocaml/Makefile.ocaml Wed Oct 3 19:07:50 2007
@@ -14,9 +14,8 @@
include $(LEVEL)/Makefile.config
-# CFLAGS needs to be set before Makefile.rules is included. Yes, ocaml puts its
-# includes under its libdir.
-CFLAGS += -I$(OCAML_LIBDIR)
+# CFLAGS needs to be set before Makefile.rules is included.
+CFLAGS += -I$(shell $(OCAMLC) -where)
include $(LEVEL)/Makefile.common
From sabre at nondot.org Wed Oct 3 23:40:37 2007
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 3 Oct 2007 23:40:37 -0500
Subject: [llvm-commits] CVS: llvm-www/Users.html
Message-ID: <200710040440.l944eb27032169@zion.cs.uiuc.edu>
Changes in directory llvm-www:
Users.html updated: 1.21 -> 1.22
---
Log message:
add an entry.
---
Diffs of the changes: (+7 -1)
Users.html | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletion(-)
Index: llvm-www/Users.html
diff -u llvm-www/Users.html:1.21 llvm-www/Users.html:1.22
--- llvm-www/Users.html:1.21 Wed Jul 4 15:10:08 2007
+++ llvm-www/Users.html Wed Oct 3 23:39:57 2007
@@ -242,6 +242,12 @@
| Faust Signal Processing Language |
Signal processing language, uses the LLVM JIT for runtime codegen. |
+
+
+
+ |
+ iPhone tool chain |
+ llvm-gcc Compiler for iPhone Dev Wiki toolchain. |
@@ -257,6 +263,6 @@
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
LLVM Development List
- Last modified: $Date: 2007/07/04 20:10:08 $
+ Last modified: $Date: 2007/10/04 04:39:57 $
From dberlin at dberlin.org Thu Oct 4 00:25:51 2007
From: dberlin at dberlin.org (Daniel Berlin)
Date: Thu, 04 Oct 2007 05:25:51 -0000
Subject: [llvm-commits] [llvm] r42604 -
/llvm/trunk/include/llvm/ADT/SparseBitVector.h
Message-ID: <200710040525.l945PpKi000954@zion.cs.uiuc.edu>
Author: dannyb
Date: Thu Oct 4 00:25:51 2007
New Revision: 42604
URL: http://llvm.org/viewvc/llvm-project?rev=42604&view=rev
Log:
Make SparseBitVector::set actually work properly when sets are not in ascending or descending order.
Modified:
llvm/trunk/include/llvm/ADT/SparseBitVector.h
Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=42604&r1=42603&r2=42604&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Thu Oct 4 00:25:51 2007
@@ -334,9 +334,8 @@
--ElementIter;
} else {
while (ElementIter != Elements.end() &&
- ElementIter->index() <= ElementIndex)
+ ElementIter->index() < ElementIndex)
++ElementIter;
- --ElementIter;
}
CurrElementIter = ElementIter;
return ElementIter;
@@ -536,10 +535,17 @@
if (ElementIter == Elements.end() ||
ElementIter->index() != ElementIndex) {
Element = new SparseBitVectorElement(ElementIndex);
- // Insert does insert before, and lower bound gives the one before.
- ElementIter = Elements.insert(++ElementIter, Element);
+ // We may have hit the beginning of our SparseBitVector, in which case,
+ // we may need to insert right after this element, which requires moving
+ // the current iterator forward one, because insert does insert before.
+ if (ElementIter->index() < ElementIndex)
+ ElementIter = Elements.insert(++ElementIter, Element);
+ else
+ ElementIter = Elements.insert(ElementIter, Element);
}
}
+ CurrElementIter = ElementIter;
+
ElementIter->set(Idx % ElementSize);
}
From dberlin at dberlin.org Thu Oct 4 00:29:36 2007
From: dberlin at dberlin.org (Daniel Berlin)
Date: Thu, 04 Oct 2007 05:29:36 -0000
Subject: [llvm-commits] [llvm] r42605 -
/llvm/trunk/include/llvm/ADT/SparseBitVector.h
Message-ID: <200710040529.l945TavG001073@zion.cs.uiuc.edu>
Author: dannyb
Date: Thu Oct 4 00:29:36 2007
New Revision: 42605
URL: http://llvm.org/viewvc/llvm-project?rev=42605&view=rev
Log:
It helps a lot when you check for the end of your list before randomly
dereferencing things.
Modified:
llvm/trunk/include/llvm/ADT/SparseBitVector.h
Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=42605&r1=42604&r2=42605&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Thu Oct 4 00:29:36 2007
@@ -538,7 +538,8 @@
// We may have hit the beginning of our SparseBitVector, in which case,
// we may need to insert right after this element, which requires moving
// the current iterator forward one, because insert does insert before.
- if (ElementIter->index() < ElementIndex)
+ if (ElementIter != Elements.end() &&
+ ElementIter->index() < ElementIndex)
ElementIter = Elements.insert(++ElementIter, Element);
else
ElementIter = Elements.insert(ElementIter, Element);
From isanbard at gmail.com Thu Oct 4 04:33:10 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Thu, 04 Oct 2007 09:33:10 -0000
Subject: [llvm-commits] [llvm] r42606 -
/llvm/trunk/test/FrontendObjC/2007-09-25-EH.m
Message-ID: <200710040933.l949XB8X015933@zion.cs.uiuc.edu>
Author: void
Date: Thu Oct 4 04:33:08 2007
New Revision: 42606
URL: http://llvm.org/viewvc/llvm-project?rev=42606&view=rev
Log:
un-XFAIL this test.
Modified:
llvm/trunk/test/FrontendObjC/2007-09-25-EH.m
Modified: llvm/trunk/test/FrontendObjC/2007-09-25-EH.m
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-09-25-EH.m?rev=42606&r1=42605&r2=42606&view=diff
==============================================================================
--- llvm/trunk/test/FrontendObjC/2007-09-25-EH.m (original)
+++ llvm/trunk/test/FrontendObjC/2007-09-25-EH.m Thu Oct 4 04:33:08 2007
@@ -1,6 +1,4 @@
// RUN: %llvmgcc -c -w -m64 -mmacosx-version-min=10.5 %s -o /dev/null
-// XFAIL: *
-// Reenable when Obj-C FE problem is fixed.
@class NSDictionary, DSoBuffer, DSoDirectory, NSMutableArray;
@interface NSException {}
From sabre at nondot.org Thu Oct 4 10:47:28 2007
From: sabre at nondot.org (Chris Lattner)
Date: Thu, 04 Oct 2007 15:47:28 -0000
Subject: [llvm-commits] [llvm] r42607 - /llvm/trunk/lib/Target/X86/README.txt
Message-ID: <200710041547.l94FlSFa028162@zion.cs.uiuc.edu>
Author: lattner
Date: Thu Oct 4 10:47:27 2007
New Revision: 42607
URL: http://llvm.org/viewvc/llvm-project?rev=42607&view=rev
Log:
add a note.
Modified:
llvm/trunk/lib/Target/X86/README.txt
Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=42607&r1=42606&r2=42607&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Thu Oct 4 10:47:27 2007
@@ -1362,3 +1362,43 @@
//===---------------------------------------------------------------------===//
+We compile this:
+
+void compare (long long foo) {
+ if (foo < 4294967297LL)
+ abort();
+}
+
+to:
+
+_compare:
+ subl $12, %esp
+ cmpl $0, 16(%esp)
+ setne %al
+ movzbw %al, %ax
+ cmpl $1, 20(%esp)
+ setg %cl
+ movzbw %cl, %cx
+ cmove %ax, %cx
+ movw %cx, %ax
+ testb $1, %al
+ je LBB1_2 # cond_true
+
+(also really horrible code on ppc). This is due to the expand code for 64-bit
+compares. GCC produces multiple branches, which is much nicer:
+
+_compare:
+ pushl %ebp
+ movl %esp, %ebp
+ subl $8, %esp
+ movl 8(%ebp), %eax
+ movl 12(%ebp), %edx
+ subl $1, %edx
+ jg L5
+L7:
+ jl L4
+ cmpl $0, %eax
+ jbe L4
+L5:
+
+//===---------------------------------------------------------------------===//
From isanbard at gmail.com Thu Oct 4 13:46:07 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Thu, 04 Oct 2007 18:46:07 -0000
Subject: [llvm-commits] [llvm] r42609 -
/llvm/trunk/test/FrontendObjC/2007-10-03-MetadataPointers.mm
Message-ID: <200710041846.l94Ik7QL002895@zion.cs.uiuc.edu>
Author: void
Date: Thu Oct 4 13:46:06 2007
New Revision: 42609
URL: http://llvm.org/viewvc/llvm-project?rev=42609&view=rev
Log:
Added testcase for creation of metadata with null pointers.
Added:
llvm/trunk/test/FrontendObjC/2007-10-03-MetadataPointers.mm
Added: llvm/trunk/test/FrontendObjC/2007-10-03-MetadataPointers.mm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-10-03-MetadataPointers.mm?rev=42609&view=auto
==============================================================================
--- llvm/trunk/test/FrontendObjC/2007-10-03-MetadataPointers.mm (added)
+++ llvm/trunk/test/FrontendObjC/2007-10-03-MetadataPointers.mm Thu Oct 4 13:46:06 2007
@@ -0,0 +1,7 @@
+// RUN: %llvmgcc -x objective-c++ -c %s -o /dev/null
+
+ at class NSImage;
+void bork() {
+ NSImage *nsimage;
+ [nsimage release];
+}
From isanbard at gmail.com Thu Oct 4 13:47:25 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Thu, 04 Oct 2007 18:47:25 -0000
Subject: [llvm-commits] [llvm] r42610 - /llvm/trunk/test/FrontendObjC/dg.exp
Message-ID: <200710041847.l94IlPli002964@zion.cs.uiuc.edu>
Author: void
Date: Thu Oct 4 13:47:25 2007
New Revision: 42610
URL: http://llvm.org/viewvc/llvm-project?rev=42610&view=rev
Log:
Support Objective C++ too.
Modified:
llvm/trunk/test/FrontendObjC/dg.exp
Modified: llvm/trunk/test/FrontendObjC/dg.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/dg.exp?rev=42610&r1=42609&r2=42610&view=diff
==============================================================================
--- llvm/trunk/test/FrontendObjC/dg.exp (original)
+++ llvm/trunk/test/FrontendObjC/dg.exp Thu Oct 4 13:47:25 2007
@@ -2,5 +2,6 @@
if [ llvm_gcc_supports objc ] then {
RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{m}]]
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{mm}]]
}
From dberlin at dberlin.org Thu Oct 4 16:18:20 2007
From: dberlin at dberlin.org (Daniel Berlin)
Date: Thu, 04 Oct 2007 21:18:20 -0000
Subject: [llvm-commits] [llvm] r42612 -
/llvm/trunk/include/llvm/ADT/SparseBitVector.h
Message-ID: <200710042118.l94LIKgG009660@zion.cs.uiuc.edu>
Author: dannyb
Date: Thu Oct 4 16:18:20 2007
New Revision: 42612
URL: http://llvm.org/viewvc/llvm-project?rev=42612&view=rev
Log:
Fix off by one error in iterator
Modified:
llvm/trunk/include/llvm/ADT/SparseBitVector.h
Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=42612&r1=42611&r2=42612&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Thu Oct 4 16:18:20 2007
@@ -390,7 +390,7 @@
// See if we ran out of Bits in this word.
if (!Bits) {
- int NextSetBitNumber = Iter->find_next(BitNumber % ElementSize) ;
+ int NextSetBitNumber = Iter->find_next((BitNumber - 1) % ElementSize) ;
// If we ran out of set bits in this element, move to next element.
if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0)) {
++Iter;
From dberlin at dberlin.org Thu Oct 4 16:27:17 2007
From: dberlin at dberlin.org (Daniel Berlin)
Date: Thu, 04 Oct 2007 21:27:17 -0000
Subject: [llvm-commits] [llvm] r42613 -
/llvm/trunk/include/llvm/ADT/SparseBitVector.h
Message-ID: <200710042127.l94LRHcg010191@zion.cs.uiuc.edu>
Author: dannyb
Date: Thu Oct 4 16:27:17 2007
New Revision: 42613
URL: http://llvm.org/viewvc/llvm-project?rev=42613&view=rev
Log:
Fix the previous bug a slightly different way (by modifying how find_next works)
Modified:
llvm/trunk/include/llvm/ADT/SparseBitVector.h
Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=42613&r1=42612&r2=42613&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Thu Oct 4 16:27:17 2007
@@ -168,15 +168,14 @@
assert(0 && "Illegal empty element");
}
- /// find_next - Returns the index of the next set bit following the
- /// "Prev" bit. Returns -1 if the next set bit is not found.
- int find_next(unsigned Prev) const {
- ++Prev;
- if (Prev >= BITS_PER_ELEMENT)
+ /// find_next - Returns the index of the next set bit starting from the
+ /// "Curr" bit. Returns -1 if the next set bit is not found.
+ int find_next(unsigned Curr) const {
+ if (Curr >= BITS_PER_ELEMENT)
return -1;
- unsigned WordPos = Prev / BITWORD_SIZE;
- unsigned BitPos = Prev % BITWORD_SIZE;
+ unsigned WordPos = Curr / BITWORD_SIZE;
+ unsigned BitPos = Curr % BITWORD_SIZE;
BitWord Copy = Bits[WordPos];
assert (WordPos <= BITWORDS_PER_ELEMENT
&& "Word Position outside of element");
@@ -390,7 +389,7 @@
// See if we ran out of Bits in this word.
if (!Bits) {
- int NextSetBitNumber = Iter->find_next((BitNumber - 1) % ElementSize) ;
+ int NextSetBitNumber = Iter->find_next(BitNumber % ElementSize) ;
// If we ran out of set bits in this element, move to next element.
if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0)) {
++Iter;
@@ -546,7 +545,7 @@
}
}
CurrElementIter = ElementIter;
-
+
ElementIter->set(Idx % ElementSize);
}
From isanbard at gmail.com Thu Oct 4 17:15:58 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Thu, 04 Oct 2007 22:15:58 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42614 - in /llvm-gcc-4.0/trunk/gcc:
c-common.h llvm-backend.cpp objc/objc-act.c stub-objc.c
Message-ID: <200710042215.l94MFwL8012295@zion.cs.uiuc.edu>
Author: void
Date: Thu Oct 4 17:15:58 2007
New Revision: 42614
URL: http://llvm.org/viewvc/llvm-project?rev=42614&view=rev
Log:
rdar://5476262 - Try to lookup the name of the global decl before creating a new
one.
Modified:
llvm-gcc-4.0/trunk/gcc/c-common.h
llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
llvm-gcc-4.0/trunk/gcc/stub-objc.c
Modified: llvm-gcc-4.0/trunk/gcc/c-common.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-common.h?rev=42614&r1=42613&r2=42614&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/c-common.h (original)
+++ llvm-gcc-4.0/trunk/gcc/c-common.h Thu Oct 4 17:15:58 2007
@@ -1139,12 +1139,6 @@
extern void objc_remove_weak_read (tree*);
/* APPLE LOCAL end radar 4426814 */
-/* APPLE LOCAL begin - LLVM radar 5476262 */
-#ifdef ENABLE_LLVM
-extern bool objc_is_protocol_reference (const char *name);
-#endif
-/* APPLE LOCAL end - LLVM radar 5476262 */
-
/* APPLE LOCAL begin C* language */
extern void objc_set_method_opt (int);
void objc_finish_foreach_loop (location_t, tree, tree, tree, tree);
Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=42614&r1=42613&r2=42614&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Thu Oct 4 17:15:58 2007
@@ -66,7 +66,6 @@
#include "function.h"
#include "tree-inline.h"
#include "langhooks.h"
-#include "c-common.h"
}
// Non-zero if bytecode from PCH is successfully read.
@@ -1061,14 +1060,6 @@
// being created.
GlobalVariable *GVE = TheModule->getGlobalVariable(Name);
- // And Objective-C "@protocol" will create a decl for the
- // protocol metadata and then when the protocol is
- // referenced. However, protocols have file-scope, so they
- // aren't found in the GlobalVariable list unless we look at
- // non-extern globals as well.
- if (!GVE && c_dialect_objc() && objc_is_protocol_reference(Name))
- GVE = TheModule->getGlobalVariable(Name, true);
-
if (GVE == 0) {
GV = new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage,0,
Name, TheModule);
Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=42614&r1=42613&r2=42614&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Thu Oct 4 17:15:58 2007
@@ -11867,29 +11867,21 @@
tree decl = TREE_PURPOSE (chain);
gcc_assert (TREE_CODE (expr) == PROTOCOL_INTERFACE_TYPE);
/* APPLE LOCAL begin radar 4695109 */
- sprintf (string, "_OBJC_PROTOCOL_$_%s",
+ /* APPLE LOCAL begin - LLVM radar 5476262 */
+ sprintf (string, "L_OBJC_PROTOCOL_$_%s",
IDENTIFIER_POINTER (PROTOCOL_NAME (expr)));
- expr = start_var_decl (objc_v2_protocol_template, string);
+#ifdef ENABLE_LLVM
+ expr = lookup_name (get_identifier(string));
+ if (expr == NULL_TREE)
+#endif
+ expr = start_var_decl (objc_v2_protocol_template, &string[1]);
+ /* APPLE LOCAL end - LLVM radar 5476262 */
/* APPLE LOCAL end radar 4695109 */
expr = convert (objc_protocol_type, build_fold_addr_expr (expr));
finish_var_decl (decl, expr);
}
}
-/* APPLE LOCAL begin - LLVM radar 5476262 */
-#ifdef ENABLE_LLVM
-/* This routine returns true if the name is the same as a protocol
- reference name. */
-
-bool
-objc_is_protocol_reference (const char *name)
-{
- return flag_objc_abi == 2 && strlen (name) > 19 &&
- strncmp (name, "\01L_OBJC_PROTOCOL_$_", 19) == 0;
-}
-#endif
-/* APPLE LOCAL end - LLVM radar 5476262 */
-
/* This routine builds the protocol_reference_chain for each protocol name used
@protocol(MyProtocol) expression. IDENT is current protocol name. */
@@ -13402,7 +13394,7 @@
/* Declare variable which holds 'struct protocol_t' meta data. */
/* APPLE LOCAL begin radar 4695109 */
-/* poniter to protocol metadata in new ABI protocol is now generated
+/* pointer to protocol metadata in new ABI protocol is now generated
like the old abi. */
static void
build_v2_protocol_reference (tree p)
@@ -13415,6 +13407,9 @@
proto_name = synth_id_with_class_suffix ("_OBJC_PROTOCOL_$", p);
decl = start_var_decl (objc_v2_protocol_template, proto_name);
PROTOCOL_V2_FORWARD_DECL (p) = decl;
+ /* APPLE LOCAL begin - LLVM radar 5476262 */
+ pushdecl_top_level(decl);
+ /* APPLE LOCAL end - LLVM radar 5476262 */
}
/* APPLE LOCAL end radar 4695109 */
Modified: llvm-gcc-4.0/trunk/gcc/stub-objc.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/stub-objc.c?rev=42614&r1=42613&r2=42614&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/stub-objc.c (original)
+++ llvm-gcc-4.0/trunk/gcc/stub-objc.c Thu Oct 4 17:15:58 2007
@@ -548,13 +548,3 @@
return false;
}
/* APPLE LOCAL end radar 4985544 */
-
-/* APPLE LOCAL begin - LLVM radar 5476262 */
-#ifdef ENABLE_LLVM
-bool
-objc_is_protocol_reference (const char * ARG_UNUSED(name))
-{
- return false;
-}
-#endif
-/* APPLE LOCAL end - LLVM radar 5476262 */
From isanbard at gmail.com Thu Oct 4 17:18:01 2007
From: isanbard at gmail.com (Bill Wendling)
Date: Thu, 04 Oct 2007 22:18:01 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42615 -
/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Message-ID: <200710042218.l94MI1jY012403@zion.cs.uiuc.edu>
Author: void
Date: Thu Oct 4 17:18:01 2007
New Revision: 42615
URL: http://llvm.org/viewvc/llvm-project?rev=42615&view=rev
Log:
rdar://5476262 - Try to lookup the name of the global decl before creating a new
one.
Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=42615&r1=42614&r2=42615&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Oct 4 17:18:01 2007
@@ -11756,9 +11756,15 @@
tree decl = TREE_PURPOSE (chain);
gcc_assert (TREE_CODE (expr) == PROTOCOL_INTERFACE_TYPE);
/* APPLE LOCAL begin radar 4695109 */
- sprintf (string, "_OBJC_PROTOCOL_$_%s",
+ /* APPLE LOCAL begin - LLVM radar 5476262 */
+ sprintf (string, "L_OBJC_PROTOCOL_$_%s",
IDENTIFIER_POINTER (PROTOCOL_NAME (expr)));
- expr = start_var_decl (objc_v2_protocol_template, string);
+#ifdef ENABLE_LLVM
+ expr = lookup_name (get_identifier(string));
+ if (expr == NULL_TREE)
+#endif
+ expr = start_var_decl (objc_v2_protocol_template, &string[1]);
+ /* APPLE LOCAL end - LLVM radar 5476262 */
/* APPLE LOCAL end radar 4695109 */
expr = convert (objc_protocol_type, build_fold_addr_expr (expr));
finish_var_decl (decl, expr);
@@ -13299,6 +13305,9 @@
proto_name = synth_id_with_class_suffix ("_OBJC_PROTOCOL_$", p);
decl = start_var_decl (objc_v2_protocol_template, proto_name);
PROTOCOL_V2_FORWARD_DECL (p) = decl;
+ /* APPLE LOCAL begin - LLVM radar 5476262 */
+ pushdecl_top_level(decl);
+ /* APPLE LOCAL end - LLVM radar 5476262 */
}
/* APPLE LOCAL end radar 4695109 */
From asl at math.spbu.ru Thu Oct 4 18:54:25 2007
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Thu, 04 Oct 2007 23:54:25 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r42617 -
/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Message-ID: <200710042354.l94NsPAG016999@zion.cs.uiuc.edu>
Author: asl
Date: Thu Oct 4 18:54:25 2007
New Revision: 42617
URL: http://llvm.org/viewvc/llvm-project?rev=42617&view=rev
Log:
Don't zero high 24 bit of %mxcsr by emitting 32 bit load instead of 8 bit one.
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=42617&r1=42616&r2=42617&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu Oct 4 18:54:25 2007
@@ -610,9 +610,11 @@
case IX86_BUILTIN_STMXCSR: {
Function *stmxcsr =
Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_stmxcsr);
- Value *Ptr = CreateTemporary(Type::Int32Ty);
- Ptr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty), "tmp");
- Builder.CreateCall(stmxcsr, Ptr);
+ Value *Ptr = CreateTemporary(Type::Int32Ty);
+ Value *BPtr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty),
+ "tmp");
+ Builder.CreateCall(stmxcsr, BPtr);
+
Result = Builder.CreateLoad(Ptr, "tmp");
return true;
}
From asl at math.spbu.ru Thu Oct 4 18:55:59 2007
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Thu, 04 Oct 2007 23:55:59 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r42618 -
/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp
Message-ID: <200710042355.l94NtxQQ017055@zion.cs.uiuc.edu>
Author: asl
Date: Thu Oct 4 18:55:59 2007
New Revision: 42618
URL: http://llvm.org/viewvc/llvm-project?rev=42618&view=rev
Log:
Don't zero high 24 bit of %mxcsr by emitting 32 bit load instead of 8 bit one.
Modified:
llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp
Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp?rev=42618&r1=42617&r2=42618&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Thu Oct 4 18:55:59 2007
@@ -610,9 +610,11 @@
case IX86_BUILTIN_STMXCSR: {
Function *stmxcsr =
Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_stmxcsr);
- Value *Ptr = CreateTemporary(Type::Int32Ty);
- Ptr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty), "tmp");
- Builder.CreateCall(stmxcsr, Ptr);
+ Value *Ptr = CreateTemporary(Type::Int32Ty);
+ Value *BPtr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty),
+ "tmp");
+ Builder.CreateCall(stmxcsr, BPtr);
+
Result = Builder.CreateLoad(Ptr, "tmp");
return true;
}
From evan.cheng at apple.com Thu Oct 4 20:09:32 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:09:32 -0000
Subject: [llvm-commits] [llvm] r42619 -
/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Message-ID: <200710050109.l9519W4i020221@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:09:32 2007
New Revision: 42619
URL: http://llvm.org/viewvc/llvm-project?rev=42619&view=rev
Log:
Silence a warning.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42619&r1=42618&r2=42619&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 4 20:09:32 2007
@@ -5395,7 +5395,7 @@
}
}
- RTLIB::Libcall LC;
+ RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
if (Node->getOperand(0).getValueType() == MVT::f32)
LC = RTLIB::FPTOUINT_F32_I64;
else if (Node->getOperand(0).getValueType() == MVT::f64)
From evan.cheng at apple.com Thu Oct 4 20:10:50 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:10:50 -0000
Subject: [llvm-commits] [llvm] r42620 - in /llvm/trunk:
include/llvm/CodeGen/SelectionDAG.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Message-ID: <200710050110.l951Ao9x020309@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:10:49 2007
New Revision: 42620
URL: http://llvm.org/viewvc/llvm-project?rev=42620&view=rev
Log:
Add a variant of getTargetNode() that takes a vector of MVT::ValueType.
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=42620&r1=42619&r2=42620&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Thu Oct 4 20:10:49 2007
@@ -414,6 +414,8 @@
MVT::ValueType VT2, MVT::ValueType VT3,
MVT::ValueType VT4,
const SDOperand *Ops, unsigned NumOps);
+ SDNode *getTargetNode(unsigned Opcode, std::vector &ResultTys,
+ const SDOperand *Ops, unsigned NumOps);
/// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.
/// This can cause recursive merging of nodes in the DAG. Use the first
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=42620&r1=42619&r2=42620&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Oct 4 20:10:49 2007
@@ -3054,6 +3054,13 @@
const MVT::ValueType *VTs = getNodeValueTypes(VTList);
return getNode(ISD::BUILTIN_OP_END+Opcode, VTs, 4, Ops, NumOps).Val;
}
+SDNode *SelectionDAG::getTargetNode(unsigned Opcode,
+ std::vector &ResultTys,
+ const SDOperand *Ops, unsigned NumOps) {
+ const MVT::ValueType *VTs = getNodeValueTypes(ResultTys);
+ return getNode(ISD::BUILTIN_OP_END+Opcode, VTs, ResultTys.size(),
+ Ops, NumOps).Val;
+}
/// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.
/// This can cause recursive merging of nodes in the DAG.
From evan.cheng at apple.com Thu Oct 4 20:32:41 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:32:41 -0000
Subject: [llvm-commits] [llvm] r42621 - in /llvm/trunk:
include/llvm/Target/MRegisterInfo.h lib/Target/ARM/ARMRegisterInfo.cpp
lib/Target/ARM/ARMRegisterInfo.h lib/Target/Alpha/AlphaRegisterInfo.cpp
lib/Target/Alpha/AlphaRegisterInfo.h lib/Target/Mips/MipsRegisterInfo.cpp
lib/Target/Mips/MipsRegisterInfo.h lib/Target/PowerPC/PPCRegisterInfo.cpp
lib/Target/PowerPC/PPCRegisterInfo.h lib/Target/Sparc/SparcRegisterInfo.cpp
lib/Target/Sparc/SparcRegisterInfo.h
Message-ID: <200710050132.l951Wf8x021244@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:32:41 2007
New Revision: 42621
URL: http://llvm.org/viewvc/llvm-project?rev=42621&view=rev
Log:
- Added a few target hooks to generate load / store instructions from / to any
address (not just from / to frameindexes).
- Added target hooks to unfold load / store instructions / SDNodes into separate
load, data processing, store instructions / SDNodes.
Modified:
llvm/trunk/include/llvm/Target/MRegisterInfo.h
llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp
llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h
llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp
llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h
llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h
llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h
llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp
llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h
Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/MRegisterInfo.h?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/MRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/MRegisterInfo.h Thu Oct 4 20:32:41 2007
@@ -16,6 +16,7 @@
#ifndef LLVM_TARGET_MREGISTERINFO_H
#define LLVM_TARGET_MREGISTERINFO_H
+#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/ValueTypes.h"
#include
@@ -30,6 +31,9 @@
class MachineLocation;
class MachineMove;
class RegScavenger;
+class SDNode;
+class SelectionDAG;
+class SSARegMap;
class TargetRegisterClass;
class Type;
@@ -503,11 +507,21 @@
unsigned SrcReg, int FrameIndex,
const TargetRegisterClass *RC) const = 0;
+ virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const = 0;
+
virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC) const = 0;
+ virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const = 0;
+
virtual void copyRegToReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, unsigned SrcReg,
@@ -550,6 +564,20 @@
return 0;
}
+ /// unfoldMemoryOperand - Separate a single instruction which folded a load or a
+ /// a store or a load and a store into two or more instruction. If this is
+ /// possible, returns true as well as the new instructions by reference.
+ virtual bool unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI,
+ SSARegMap *RegMap,
+ SmallVector &NewMIs) const {
+ return false;
+ }
+
+ virtual bool unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N,
+ SmallVector &NewNodes) const {
+ return false;
+ }
+
/// targetHandlesStackFrameRounding - Returns true if the target is responsible
/// for rounding up the stack frame (probably at emitPrologue time).
virtual bool targetHandlesStackFrameRounding() const {
Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp Thu Oct 4 20:32:41 2007
@@ -132,6 +132,30 @@
return true;
}
+static inline
+const MachineInstrBuilder &AddDefaultPred(const MachineInstrBuilder &MIB) {
+ return MIB.addImm((int64_t)ARMCC::AL).addReg(0);
+}
+
+static inline
+const MachineInstrBuilder &AddDefaultCC(const MachineInstrBuilder &MIB) {
+ return MIB.addReg(0);
+}
+
+static const MachineInstrBuilder &ARMInstrAddOperand(MachineInstrBuilder &MIB,
+ MachineOperand &MO) {
+ if (MO.isRegister())
+ MIB = MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit());
+ else if (MO.isImmediate())
+ MIB = MIB.addImm(MO.getImm());
+ else if (MO.isFrameIndex())
+ MIB = MIB.addFrameIndex(MO.getFrameIndex());
+ else
+ assert(0 && "Unknown operand for ARMInstrAddOperand!");
+
+ return MIB;
+}
+
void ARMRegisterInfo::
storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned SrcReg, int FI,
@@ -143,17 +167,52 @@
BuildMI(MBB, I, TII.get(ARM::tSpill)).addReg(SrcReg, false, false, true)
.addFrameIndex(FI).addImm(0);
else
- BuildMI(MBB, I, TII.get(ARM::STR)).addReg(SrcReg, false, false, true)
- .addFrameIndex(FI).addReg(0).addImm(0).addImm((int64_t)ARMCC::AL)
- .addReg(0);
+ AddDefaultPred(BuildMI(MBB, I, TII.get(ARM::STR))
+ .addReg(SrcReg, false, false, true)
+ .addFrameIndex(FI).addReg(0).addImm(0));
+ } else if (RC == ARM::DPRRegisterClass) {
+ AddDefaultPred(BuildMI(MBB, I, TII.get(ARM::FSTD))
+ .addReg(SrcReg, false, false, true)
+ .addFrameIndex(FI).addImm(0));
+ } else {
+ assert(RC == ARM::SPRRegisterClass && "Unknown regclass!");
+ AddDefaultPred(BuildMI(MBB, I, TII.get(ARM::FSTS))
+ .addReg(SrcReg, false, false, true)
+ .addFrameIndex(FI).addImm(0));
+ }
+}
+
+void ARMRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = 0;
+ if (RC == ARM::GPRRegisterClass) {
+ ARMFunctionInfo *AFI = MF.getInfo();
+ if (AFI->isThumbFunction()) {
+ Opc = Addr[0].isFrameIndex() ? ARM::tSpill : ARM::tSTR;
+ MachineInstrBuilder MIB =
+ BuildMI(TII.get(Opc)).addReg(SrcReg, false, false, true);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i)
+ MIB = ARMInstrAddOperand(MIB, Addr[i]);
+ NewMIs.push_back(MIB);
+ return;
+ }
+ Opc = ARM::STR;
} else if (RC == ARM::DPRRegisterClass) {
- BuildMI(MBB, I, TII.get(ARM::FSTD)).addReg(SrcReg, false, false, true)
- .addFrameIndex(FI).addImm(0).addImm((int64_t)ARMCC::AL).addReg(0);
+ Opc = ARM::FSTD;
} else {
assert(RC == ARM::SPRRegisterClass && "Unknown regclass!");
- BuildMI(MBB, I, TII.get(ARM::FSTS)).addReg(SrcReg, false, false, true)
- .addFrameIndex(FI).addImm(0).addImm((int64_t)ARMCC::AL).addReg(0);
+ Opc = ARM::FSTS;
}
+
+ MachineInstrBuilder MIB =
+ BuildMI(TII.get(Opc)).addReg(SrcReg, false, false, true);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i)
+ MIB = ARMInstrAddOperand(MIB, Addr[i]);
+ AddDefaultPred(MIB);
+ NewMIs.push_back(MIB);
+ return;
}
void ARMRegisterInfo::
@@ -167,19 +226,49 @@
BuildMI(MBB, I, TII.get(ARM::tRestore), DestReg)
.addFrameIndex(FI).addImm(0);
else
- BuildMI(MBB, I, TII.get(ARM::LDR), DestReg)
- .addFrameIndex(FI).addReg(0).addImm(0).addImm((int64_t)ARMCC::AL)
- .addReg(0);
+ AddDefaultPred(BuildMI(MBB, I, TII.get(ARM::LDR), DestReg)
+ .addFrameIndex(FI).addReg(0).addImm(0));
} else if (RC == ARM::DPRRegisterClass) {
- BuildMI(MBB, I, TII.get(ARM::FLDD), DestReg)
- .addFrameIndex(FI).addImm(0).addImm((int64_t)ARMCC::AL).addReg(0);
+ AddDefaultPred(BuildMI(MBB, I, TII.get(ARM::FLDD), DestReg)
+ .addFrameIndex(FI).addImm(0));
} else {
assert(RC == ARM::SPRRegisterClass && "Unknown regclass!");
- BuildMI(MBB, I, TII.get(ARM::FLDS), DestReg)
- .addFrameIndex(FI).addImm(0).addImm((int64_t)ARMCC::AL).addReg(0);
+ AddDefaultPred(BuildMI(MBB, I, TII.get(ARM::FLDS), DestReg)
+ .addFrameIndex(FI).addImm(0));
}
}
+void ARMRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = 0;
+ if (RC == ARM::GPRRegisterClass) {
+ ARMFunctionInfo *AFI = MF.getInfo();
+ if (AFI->isThumbFunction()) {
+ Opc = Addr[0].isFrameIndex() ? ARM::tRestore : ARM::tLDR;
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc), DestReg);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i)
+ MIB = ARMInstrAddOperand(MIB, Addr[i]);
+ NewMIs.push_back(MIB);
+ return;
+ }
+ Opc = ARM::LDR;
+ } else if (RC == ARM::DPRRegisterClass) {
+ Opc = ARM::FLDD;
+ } else {
+ assert(RC == ARM::SPRRegisterClass && "Unknown regclass!");
+ Opc = ARM::FLDS;
+ }
+
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc), DestReg);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i)
+ MIB = ARMInstrAddOperand(MIB, Addr[i]);
+ AddDefaultPred(MIB);
+ NewMIs.push_back(MIB);
+ return;
+}
+
void ARMRegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I,
unsigned DestReg, unsigned SrcReg,
@@ -196,14 +285,14 @@
if (AFI->isThumbFunction())
BuildMI(MBB, I, TII.get(ARM::tMOVr), DestReg).addReg(SrcReg);
else
- BuildMI(MBB, I, TII.get(ARM::MOVr), DestReg).addReg(SrcReg)
- .addImm((int64_t)ARMCC::AL).addReg(0).addReg(0);
+ AddDefaultCC(AddDefaultPred(BuildMI(MBB, I, TII.get(ARM::MOVr), DestReg)
+ .addReg(SrcReg)));
} else if (DestRC == ARM::SPRRegisterClass)
- BuildMI(MBB, I, TII.get(ARM::FCPYS), DestReg).addReg(SrcReg)
- .addImm((int64_t)ARMCC::AL).addReg(0);
+ AddDefaultPred(BuildMI(MBB, I, TII.get(ARM::FCPYS), DestReg)
+ .addReg(SrcReg));
else if (DestRC == ARM::DPRRegisterClass)
- BuildMI(MBB, I, TII.get(ARM::FCPYD), DestReg).addReg(SrcReg)
- .addImm((int64_t)ARMCC::AL).addReg(0);
+ AddDefaultPred(BuildMI(MBB, I, TII.get(ARM::FCPYD), DestReg)
+ .addReg(SrcReg));
else
abort();
}
@@ -1390,7 +1479,7 @@
MachineInstrBuilder MIB =
BuildMI(MBB, MBBI, TII.get(isThumb ? ARM::tADDrSPi : ARM::ADDri),FramePtr)
.addFrameIndex(FramePtrSpillFI).addImm(0);
- if (!isThumb) MIB.addImm(ARMCC::AL).addReg(0).addReg(0);
+ if (!isThumb) AddDefaultCC(AddDefaultPred(MIB));
}
if (!isThumb) {
Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h Thu Oct 4 20:32:41 2007
@@ -51,11 +51,21 @@
unsigned SrcReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI,
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
unsigned DestReg, unsigned SrcReg,
const TargetRegisterClass *DestRC,
Modified: llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp Thu Oct 4 20:32:41 2007
@@ -82,6 +82,31 @@
abort();
}
+void AlphaRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = 0;
+ if (RC == Alpha::F4RCRegisterClass)
+ Opc = Alpha::STS;
+ else if (RC == Alpha::F8RCRegisterClass)
+ Opc = Alpha::STT;
+ else if (RC == Alpha::GPRCRegisterClass)
+ Opc = Alpha::STQ;
+ else
+ abort();
+ MachineInstrBuilder MIB =
+ BuildMI(TII.get(Opc)).addReg(SrcReg, false, false, true);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit());
+ else
+ MIB.addImm(MO.getImm());
+ }
+ NewMIs.push_back(MIB);
+}
+
void
AlphaRegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
@@ -102,6 +127,31 @@
abort();
}
+void AlphaRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = 0;
+ if (RC == Alpha::F4RCRegisterClass)
+ Opc = Alpha::LDS;
+ else if (RC == Alpha::F8RCRegisterClass)
+ Opc = Alpha::LDT;
+ else if (RC == Alpha::GPRCRegisterClass)
+ Opc = Alpha::LDQ;
+ else
+ abort();
+ MachineInstrBuilder MIB =
+ BuildMI(TII.get(Opc), DestReg);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit());
+ else
+ MIB.addImm(MO.getImm());
+ }
+ NewMIs.push_back(MIB);
+}
+
MachineInstr *AlphaRegisterInfo::foldMemoryOperand(MachineInstr *MI,
unsigned OpNum,
int FrameIndex) const {
Modified: llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h Thu Oct 4 20:32:41 2007
@@ -33,11 +33,21 @@
unsigned SrcReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI,
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
MachineInstr* foldMemoryOperand(MachineInstr *MI, unsigned OpNum,
int FrameIndex) const;
Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Thu Oct 4 20:32:41 2007
@@ -95,6 +95,27 @@
assert(0 && "Can't store this register to stack slot");
}
+void MipsRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ if (RC != Mips::CPURegsRegisterClass)
+ assert(0 && "Can't store this register");
+ MachineInstrBuilder MIB = BuildMI(TII.get(Mips::SW))
+ .addReg(SrcReg, false, false, true);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg());
+ else if (MO.isImmediate())
+ MIB.addImm(MO.getImmedValue());
+ else
+ MIB.addFrameIndex(MO.getFrameIndex());
+ }
+ NewMIs.push_back(MIB);
+ return;
+}
+
void MipsRegisterInfo::
loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned DestReg, int FI,
@@ -106,6 +127,26 @@
assert(0 && "Can't load this register from stack slot");
}
+void MipsRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ if (RC != Mips::CPURegsRegisterClass)
+ assert(0 && "Can't load this register");
+ MachineInstrBuilder MIB = BuildMI(TII.get(Mips::LW), DestReg);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg());
+ else if (MO.isImmediate())
+ MIB.addImm(MO.getImmedValue());
+ else
+ MIB.addFrameIndex(MO.getFrameIndex());
+ }
+ NewMIs.push_back(MIB);
+ return;
+}
+
void MipsRegisterInfo::
copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned DestReg, unsigned SrcReg,
Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h Thu Oct 4 20:32:41 2007
@@ -37,11 +37,21 @@
unsigned SrcReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI,
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
unsigned DestReg, const MachineInstr *Orig) const;
Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Thu Oct 4 20:32:41 2007
@@ -103,68 +103,67 @@
ImmToIdxMap[PPC::ADDI8] = PPC::ADD8; ImmToIdxMap[PPC::STD_32] = PPC::STDX_32;
}
-void
-PPCRegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator MI,
- unsigned SrcReg, int FrameIdx,
- const TargetRegisterClass *RC) const {
+static void StoreRegToStackSlot(const TargetInstrInfo &TII,
+ unsigned SrcReg, int FrameIdx,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) {
if (RC == PPC::GPRCRegisterClass) {
if (SrcReg != PPC::LR) {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::STW))
- .addReg(SrcReg, false, false, true), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::STW))
+ .addReg(SrcReg, false, false, true), FrameIdx));
} else {
// FIXME: this spills LR immediately to memory in one step. To do this,
// we use R11, which we know cannot be used in the prolog/epilog. This is
// a hack.
- BuildMI(MBB, MI, TII.get(PPC::MFLR), PPC::R11);
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::STW))
- .addReg(PPC::R11, false, false, true), FrameIdx);
+ NewMIs.push_back(BuildMI(TII.get(PPC::MFLR), PPC::R11));
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::STW))
+ .addReg(PPC::R11, false, false, true), FrameIdx));
}
} else if (RC == PPC::G8RCRegisterClass) {
if (SrcReg != PPC::LR8) {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::STD))
- .addReg(SrcReg, false, false, true), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::STD))
+ .addReg(SrcReg, false, false, true), FrameIdx));
} else {
// FIXME: this spills LR immediately to memory in one step. To do this,
// we use R11, which we know cannot be used in the prolog/epilog. This is
// a hack.
- BuildMI(MBB, MI, TII.get(PPC::MFLR8), PPC::X11);
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::STD))
- .addReg(PPC::X11, false, false, true), FrameIdx);
+ NewMIs.push_back(BuildMI(TII.get(PPC::MFLR8), PPC::X11));
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::STD))
+ .addReg(PPC::X11, false, false, true), FrameIdx));
}
} else if (RC == PPC::F8RCRegisterClass) {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::STFD))
- .addReg(SrcReg, false, false, true), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::STFD))
+ .addReg(SrcReg, false, false, true), FrameIdx));
} else if (RC == PPC::F4RCRegisterClass) {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::STFS))
- .addReg(SrcReg, false, false, true), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::STFS))
+ .addReg(SrcReg, false, false, true), FrameIdx));
} else if (RC == PPC::CRRCRegisterClass) {
// FIXME: We use R0 here, because it isn't available for RA.
// We need to store the CR in the low 4-bits of the saved value. First,
// issue a MFCR to save all of the CRBits.
- BuildMI(MBB, MI, TII.get(PPC::MFCR), PPC::R0);
+ NewMIs.push_back(BuildMI(TII.get(PPC::MFCR), PPC::R0));
// If the saved register wasn't CR0, shift the bits left so that they are in
// CR0's slot.
if (SrcReg != PPC::CR0) {
unsigned ShiftBits = PPCRegisterInfo::getRegisterNumbering(SrcReg)*4;
// rlwinm r0, r0, ShiftBits, 0, 31.
- BuildMI(MBB, MI, TII.get(PPC::RLWINM), PPC::R0)
- .addReg(PPC::R0).addImm(ShiftBits).addImm(0).addImm(31);
+ NewMIs.push_back(BuildMI(TII.get(PPC::RLWINM), PPC::R0)
+ .addReg(PPC::R0).addImm(ShiftBits).addImm(0).addImm(31));
}
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::STW))
- .addReg(PPC::R0, false, false, true), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::STW))
+ .addReg(PPC::R0, false, false, true), FrameIdx));
} else if (RC == PPC::VRRCRegisterClass) {
// We don't have indexed addressing for vector loads. Emit:
// R0 = ADDI FI#
// STVX VAL, 0, R0
//
// FIXME: We use R0 here, because it isn't available for RA.
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::ADDI), PPC::R0),
- FrameIdx, 0, 0);
- BuildMI(MBB, MI, TII.get(PPC::STVX))
- .addReg(SrcReg, false, false, true).addReg(PPC::R0).addReg(PPC::R0);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::ADDI), PPC::R0),
+ FrameIdx, 0, 0));
+ NewMIs.push_back(BuildMI(TII.get(PPC::STVX))
+ .addReg(SrcReg, false, false, true).addReg(PPC::R0).addReg(PPC::R0));
} else {
assert(0 && "Unknown regclass!");
abort();
@@ -172,55 +171,163 @@
}
void
-PPCRegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator MI,
- unsigned DestReg, int FrameIdx,
- const TargetRegisterClass *RC) const {
+PPCRegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator MI,
+ unsigned SrcReg, int FrameIdx,
+ const TargetRegisterClass *RC) const {
+ SmallVector NewMIs;
+ StoreRegToStackSlot(TII, SrcReg, FrameIdx, RC, NewMIs);
+ for (unsigned i = 0, e = NewMIs.size(); i != e; ++i)
+ MBB.insert(MI, NewMIs[i]);
+}
+
+void PPCRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ if (Addr[0].isFrameIndex()) {
+ StoreRegToStackSlot(TII, SrcReg, Addr[0].getFrameIndex(), RC, NewMIs);
+ return;
+ }
+
+ unsigned Opc = 0;
+ if (RC == PPC::GPRCRegisterClass) {
+ Opc = PPC::STW;
+ } else if (RC == PPC::G8RCRegisterClass) {
+ Opc = PPC::STD;
+ } else if (RC == PPC::F8RCRegisterClass) {
+ Opc = PPC::STFD;
+ } else if (RC == PPC::F4RCRegisterClass) {
+ Opc = PPC::STFS;
+ } else if (RC == PPC::VRRCRegisterClass) {
+ Opc = PPC::STVX;
+ } else {
+ assert(0 && "Unknown regclass!");
+ abort();
+ }
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc))
+ .addReg(SrcReg, false, false, true);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg());
+ else if (MO.isImmediate())
+ MIB.addImm(MO.getImmedValue());
+ else
+ MIB.addFrameIndex(MO.getFrameIndex());
+ }
+ NewMIs.push_back(MIB);
+ return;
+}
+
+static void LoadRegFromStackSlot(const TargetInstrInfo &TII,
+ unsigned DestReg, int FrameIdx,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) {
if (RC == PPC::GPRCRegisterClass) {
if (DestReg != PPC::LR) {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::LWZ), DestReg), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::LWZ), DestReg),
+ FrameIdx));
} else {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::LWZ), PPC::R11),FrameIdx);
- BuildMI(MBB, MI, TII.get(PPC::MTLR)).addReg(PPC::R11);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::LWZ), PPC::R11),
+ FrameIdx));
+ NewMIs.push_back(BuildMI(TII.get(PPC::MTLR)).addReg(PPC::R11));
}
} else if (RC == PPC::G8RCRegisterClass) {
if (DestReg != PPC::LR8) {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::LD), DestReg), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::LD), DestReg),
+ FrameIdx));
} else {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::LD), PPC::R11), FrameIdx);
- BuildMI(MBB, MI, TII.get(PPC::MTLR8)).addReg(PPC::R11);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::LD), PPC::R11),
+ FrameIdx));
+ NewMIs.push_back(BuildMI(TII.get(PPC::MTLR8)).addReg(PPC::R11));
}
} else if (RC == PPC::F8RCRegisterClass) {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::LFD), DestReg), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::LFD), DestReg),
+ FrameIdx));
} else if (RC == PPC::F4RCRegisterClass) {
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::LFS), DestReg), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::LFS), DestReg),
+ FrameIdx));
} else if (RC == PPC::CRRCRegisterClass) {
// FIXME: We use R0 here, because it isn't available for RA.
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::LWZ), PPC::R0), FrameIdx);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::LWZ), PPC::R0),
+ FrameIdx));
// If the reloaded register isn't CR0, shift the bits right so that they are
// in the right CR's slot.
if (DestReg != PPC::CR0) {
unsigned ShiftBits = PPCRegisterInfo::getRegisterNumbering(DestReg)*4;
// rlwinm r11, r11, 32-ShiftBits, 0, 31.
- BuildMI(MBB, MI, TII.get(PPC::RLWINM), PPC::R0)
- .addReg(PPC::R0).addImm(32-ShiftBits).addImm(0).addImm(31);
+ NewMIs.push_back(BuildMI(TII.get(PPC::RLWINM), PPC::R0)
+ .addReg(PPC::R0).addImm(32-ShiftBits).addImm(0).addImm(31));
}
- BuildMI(MBB, MI, TII.get(PPC::MTCRF), DestReg).addReg(PPC::R0);
+ NewMIs.push_back(BuildMI(TII.get(PPC::MTCRF), DestReg).addReg(PPC::R0));
} else if (RC == PPC::VRRCRegisterClass) {
// We don't have indexed addressing for vector loads. Emit:
// R0 = ADDI FI#
// Dest = LVX 0, R0
//
// FIXME: We use R0 here, because it isn't available for RA.
- addFrameReference(BuildMI(MBB, MI, TII.get(PPC::ADDI), PPC::R0),
- FrameIdx, 0, 0);
- BuildMI(MBB, MI, TII.get(PPC::LVX),DestReg).addReg(PPC::R0).addReg(PPC::R0);
+ NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::ADDI), PPC::R0),
+ FrameIdx, 0, 0));
+ NewMIs.push_back(BuildMI(TII.get(PPC::LVX),DestReg).addReg(PPC::R0)
+ .addReg(PPC::R0));
+ } else {
+ assert(0 && "Unknown regclass!");
+ abort();
+ }
+}
+
+void
+PPCRegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator MI,
+ unsigned DestReg, int FrameIdx,
+ const TargetRegisterClass *RC) const {
+ SmallVector NewMIs;
+ LoadRegFromStackSlot(TII, DestReg, FrameIdx, RC, NewMIs);
+ for (unsigned i = 0, e = NewMIs.size(); i != e; ++i)
+ MBB.insert(MI, NewMIs[i]);
+}
+
+void PPCRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ if (Addr[0].isFrameIndex()) {
+ LoadRegFromStackSlot(TII, DestReg, Addr[0].getFrameIndex(), RC, NewMIs);
+ return;
+ }
+
+ unsigned Opc = 0;
+ if (RC == PPC::GPRCRegisterClass) {
+ assert(DestReg != PPC::LR && "Can't handle this yet!");
+ Opc = PPC::LWZ;
+ } else if (RC == PPC::G8RCRegisterClass) {
+ assert(DestReg != PPC::LR8 && "Can't handle this yet!");
+ Opc = PPC::LD;
+ } else if (RC == PPC::F8RCRegisterClass) {
+ Opc = PPC::LFD;
+ } else if (RC == PPC::F4RCRegisterClass) {
+ Opc = PPC::LFS;
+ } else if (RC == PPC::VRRCRegisterClass) {
+ Opc = PPC::LVX;
} else {
assert(0 && "Unknown regclass!");
abort();
}
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc), DestReg);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg());
+ else if (MO.isImmediate())
+ MIB.addImm(MO.getImmedValue());
+ else
+ MIB.addFrameIndex(MO.getFrameIndex());
+ }
+ NewMIs.push_back(MIB);
+ return;
}
void PPCRegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h Thu Oct 4 20:32:41 2007
@@ -40,11 +40,21 @@
unsigned SrcReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI,
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
unsigned DestReg, unsigned SrcReg,
const TargetRegisterClass *DestRC,
Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp Thu Oct 4 20:32:41 2007
@@ -48,6 +48,34 @@
assert(0 && "Can't store this register to stack slot");
}
+void SparcRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = 0;
+ if (RC == SP::IntRegsRegisterClass)
+ Opc = SP::STri;
+ else if (RC == SP::FPRegsRegisterClass)
+ Opc = SP::STFri;
+ else if (RC == SP::DFPRegsRegisterClass)
+ Opc = SP::STDFri;
+ else
+ assert(0 && "Can't load this register");
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc));
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg());
+ else if (MO.isImmediate())
+ MIB.addImm(MO.getImmedValue());
+ else
+ MIB.addFrameIndex(MO.getFrameIndex());
+ }
+ MIB.addReg(SrcReg, false, false, true);
+ NewMIs.push_back(MIB);
+ return;
+}
+
void SparcRegisterInfo::
loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned DestReg, int FI,
@@ -62,6 +90,33 @@
assert(0 && "Can't load this register from stack slot");
}
+void SparcRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = 0;
+ if (RC == SP::IntRegsRegisterClass)
+ Opc = SP::LDri;
+ else if (RC == SP::FPRegsRegisterClass)
+ Opc = SP::LDFri;
+ else if (RC == SP::DFPRegsRegisterClass)
+ Opc = SP::LDDFri;
+ else
+ assert(0 && "Can't load this register");
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc), DestReg);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg());
+ else if (MO.isImmediate())
+ MIB.addImm(MO.getImmedValue());
+ else
+ MIB.addFrameIndex(MO.getFrameIndex());
+ }
+ NewMIs.push_back(MIB);
+ return;
+}
+
void SparcRegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I,
unsigned DestReg, unsigned SrcReg,
Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h?rev=42621&r1=42620&r2=42621&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h (original)
+++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h Thu Oct 4 20:32:41 2007
@@ -35,11 +35,21 @@
unsigned SrcReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI,
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
unsigned DestReg, unsigned SrcReg,
const TargetRegisterClass *DestRC,
From evan.cheng at apple.com Thu Oct 4 20:33:45 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:33:45 -0000
Subject: [llvm-commits] [llvm] r42622 - in /llvm/trunk/lib/Target/IA64:
IA64RegisterInfo.cpp IA64RegisterInfo.h
Message-ID: <200710050133.l951XjEn021299@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:33:45 2007
New Revision: 42622
URL: http://llvm.org/viewvc/llvm-project?rev=42622&view=rev
Log:
Forgot these.
Modified:
llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp
llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h
Modified: llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp?rev=42622&r1=42621&r2=42622&view=diff
==============================================================================
--- llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp Thu Oct 4 20:33:45 2007
@@ -60,6 +60,38 @@
"sorry, I don't know how to store this sort of reg in the stack\n");
}
+void IA64RegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = 0;
+ if (RC == IA64::FPRegisterClass) {
+ Opc = IA64::STF8;
+ } else if (RC == IA64::GRRegisterClass) {
+ Opc = IA64::ST8;
+ } else if (RC == IA64::PRRegisterClass) {
+ Opc = IA64::ST1;
+ } else {
+ assert(0 &&
+ "sorry, I don't know how to store this sort of reg\n");
+ }
+
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc));
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg());
+ else if (MO.isImmediate())
+ MIB.addImm(MO.getImmedValue());
+ else
+ MIB.addFrameIndex(MO.getFrameIndex());
+ }
+ MIB.addReg(SrcReg, false, false, true);
+ NewMIs.push_back(MIB);
+ return;
+
+}
+
void IA64RegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, int FrameIdx,
@@ -80,6 +112,36 @@
"sorry, I don't know how to load this sort of reg from the stack\n");
}
+void IA64RegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = 0;
+ if (RC == IA64::FPRegisterClass) {
+ Opc = IA64::LDF8;
+ } else if (RC == IA64::GRRegisterClass) {
+ Opc = IA64::LD8;
+ } else if (RC == IA64::PRRegisterClass) {
+ Opc = IA64::LD1;
+ } else {
+ assert(0 &&
+ "sorry, I don't know how to store this sort of reg\n");
+ }
+
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc), DestReg);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i) {
+ MachineOperand &MO = Addr[i];
+ if (MO.isRegister())
+ MIB.addReg(MO.getReg());
+ else if (MO.isImmediate())
+ MIB.addImm(MO.getImmedValue());
+ else
+ MIB.addFrameIndex(MO.getFrameIndex());
+ }
+ NewMIs.push_back(MIB);
+ return;
+}
+
void IA64RegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, unsigned SrcReg,
Modified: llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h?rev=42622&r1=42621&r2=42622&view=diff
==============================================================================
--- llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h (original)
+++ llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h Thu Oct 4 20:33:45 2007
@@ -34,11 +34,21 @@
unsigned SrcReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void copyRegToReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, unsigned SrcReg,
From evan.cheng at apple.com Thu Oct 4 20:34:14 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:34:14 -0000
Subject: [llvm-commits] [llvm] r42623 -
/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Message-ID: <200710050134.l951YEof021335@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:34:14 2007
New Revision: 42623
URL: http://llvm.org/viewvc/llvm-project?rev=42623&view=rev
Log:
Not needed any more.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=42623&r1=42622&r2=42623&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Oct 4 20:34:14 2007
@@ -31,7 +31,6 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SSARegMap.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/ADT/StringExtras.h"
From evan.cheng at apple.com Thu Oct 4 20:34:55 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:34:55 -0000
Subject: [llvm-commits] [llvm] r42624 - in /llvm/trunk/lib/Target/X86:
X86RegisterInfo.cpp X86RegisterInfo.h
Message-ID: <200710050134.l951YtmT021371@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:34:55 2007
New Revision: 42624
URL: http://llvm.org/viewvc/llvm-project?rev=42624&view=rev
Log:
Added storeRegToAddr, loadRegFromAddr, and unfoldMemoryOperand's.
Modified:
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.h
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=42624&r1=42623&r2=42624&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Oct 4 20:34:55 2007
@@ -26,6 +26,7 @@
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
+#include "llvm/CodeGen/SSARegMap.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
@@ -232,82 +233,85 @@
unsigned MemOp = OpTbl2Addr[i][1];
if (!RegOp2MemOpTable2Addr.insert(std::make_pair((unsigned*)RegOp, MemOp)))
assert(false && "Duplicated entries?");
- if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, RegOp)))
+ unsigned AuxInfo = 0 | (1 << 4) | (1 << 5); // Index 0,folded load and store
+ if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp,
+ std::make_pair(RegOp, AuxInfo))))
AmbEntries.push_back(MemOp);
}
- static const unsigned OpTbl0[][2] = {
- { X86::CALL32r, X86::CALL32m },
- { X86::CALL64r, X86::CALL64m },
- { X86::CMP16ri, X86::CMP16mi },
- { X86::CMP16ri8, X86::CMP16mi8 },
- { X86::CMP32ri, X86::CMP32mi },
- { X86::CMP32ri8, X86::CMP32mi8 },
- { X86::CMP64ri32, X86::CMP64mi32 },
- { X86::CMP64ri8, X86::CMP64mi8 },
- { X86::CMP8ri, X86::CMP8mi },
- { X86::DIV16r, X86::DIV16m },
- { X86::DIV32r, X86::DIV32m },
- { X86::DIV64r, X86::DIV64m },
- { X86::DIV8r, X86::DIV8m },
- { X86::FsMOVAPDrr, X86::MOVSDmr },
- { X86::FsMOVAPSrr, X86::MOVSSmr },
- { X86::IDIV16r, X86::IDIV16m },
- { X86::IDIV32r, X86::IDIV32m },
- { X86::IDIV64r, X86::IDIV64m },
- { X86::IDIV8r, X86::IDIV8m },
- { X86::IMUL16r, X86::IMUL16m },
- { X86::IMUL32r, X86::IMUL32m },
- { X86::IMUL64r, X86::IMUL64m },
- { X86::IMUL8r, X86::IMUL8m },
- { X86::JMP32r, X86::JMP32m },
- { X86::JMP64r, X86::JMP64m },
- { X86::MOV16ri, X86::MOV16mi },
- { X86::MOV16rr, X86::MOV16mr },
- { X86::MOV32ri, X86::MOV32mi },
- { X86::MOV32rr, X86::MOV32mr },
- { X86::MOV64ri32, X86::MOV64mi32 },
- { X86::MOV64rr, X86::MOV64mr },
- { X86::MOV8ri, X86::MOV8mi },
- { X86::MOV8rr, X86::MOV8mr },
- { X86::MOVAPDrr, X86::MOVAPDmr },
- { X86::MOVAPSrr, X86::MOVAPSmr },
- { X86::MOVPDI2DIrr, X86::MOVPDI2DImr },
- { X86::MOVPQIto64rr,X86::MOVPQIto64mr },
- { X86::MOVPS2SSrr, X86::MOVPS2SSmr },
- { X86::MOVSDrr, X86::MOVSDmr },
- { X86::MOVSDto64rr, X86::MOVSDto64mr },
- { X86::MOVSS2DIrr, X86::MOVSS2DImr },
- { X86::MOVSSrr, X86::MOVSSmr },
- { X86::MOVUPDrr, X86::MOVUPDmr },
- { X86::MOVUPSrr, X86::MOVUPSmr },
- { X86::MUL16r, X86::MUL16m },
- { X86::MUL32r, X86::MUL32m },
- { X86::MUL64r, X86::MUL64m },
- { X86::MUL8r, X86::MUL8m },
- { X86::SETAEr, X86::SETAEm },
- { X86::SETAr, X86::SETAm },
- { X86::SETBEr, X86::SETBEm },
- { X86::SETBr, X86::SETBm },
- { X86::SETEr, X86::SETEm },
- { X86::SETGEr, X86::SETGEm },
- { X86::SETGr, X86::SETGm },
- { X86::SETLEr, X86::SETLEm },
- { X86::SETLr, X86::SETLm },
- { X86::SETNEr, X86::SETNEm },
- { X86::SETNPr, X86::SETNPm },
- { X86::SETNSr, X86::SETNSm },
- { X86::SETPr, X86::SETPm },
- { X86::SETSr, X86::SETSm },
- { X86::TAILJMPr, X86::TAILJMPm },
- { X86::TEST16ri, X86::TEST16mi },
- { X86::TEST32ri, X86::TEST32mi },
- { X86::TEST64ri32, X86::TEST64mi32 },
- { X86::TEST8ri, X86::TEST8mi },
- { X86::XCHG16rr, X86::XCHG16mr },
- { X86::XCHG32rr, X86::XCHG32mr },
- { X86::XCHG64rr, X86::XCHG64mr },
- { X86::XCHG8rr, X86::XCHG8mr }
+ // If the third value is 1, then it's folding either a load or a store.
+ static const unsigned OpTbl0[][3] = {
+ { X86::CALL32r, X86::CALL32m, 1 },
+ { X86::CALL64r, X86::CALL64m, 1 },
+ { X86::CMP16ri, X86::CMP16mi, 1 },
+ { X86::CMP16ri8, X86::CMP16mi8, 1 },
+ { X86::CMP32ri, X86::CMP32mi, 1 },
+ { X86::CMP32ri8, X86::CMP32mi8, 1 },
+ { X86::CMP64ri32, X86::CMP64mi32, 1 },
+ { X86::CMP64ri8, X86::CMP64mi8, 1 },
+ { X86::CMP8ri, X86::CMP8mi, 1 },
+ { X86::DIV16r, X86::DIV16m, 1 },
+ { X86::DIV32r, X86::DIV32m, 1 },
+ { X86::DIV64r, X86::DIV64m, 1 },
+ { X86::DIV8r, X86::DIV8m, 1 },
+ { X86::FsMOVAPDrr, X86::MOVSDmr, 0 },
+ { X86::FsMOVAPSrr, X86::MOVSSmr, 0 },
+ { X86::IDIV16r, X86::IDIV16m, 1 },
+ { X86::IDIV32r, X86::IDIV32m, 1 },
+ { X86::IDIV64r, X86::IDIV64m, 1 },
+ { X86::IDIV8r, X86::IDIV8m, 1 },
+ { X86::IMUL16r, X86::IMUL16m, 1 },
+ { X86::IMUL32r, X86::IMUL32m, 1 },
+ { X86::IMUL64r, X86::IMUL64m, 1 },
+ { X86::IMUL8r, X86::IMUL8m, 1 },
+ { X86::JMP32r, X86::JMP32m, 1 },
+ { X86::JMP64r, X86::JMP64m, 1 },
+ { X86::MOV16ri, X86::MOV16mi, 0 },
+ { X86::MOV16rr, X86::MOV16mr, 0 },
+ { X86::MOV32ri, X86::MOV32mi, 0 },
+ { X86::MOV32rr, X86::MOV32mr, 0 },
+ { X86::MOV64ri32, X86::MOV64mi32, 0 },
+ { X86::MOV64rr, X86::MOV64mr, 0 },
+ { X86::MOV8ri, X86::MOV8mi, 0 },
+ { X86::MOV8rr, X86::MOV8mr, 0 },
+ { X86::MOVAPDrr, X86::MOVAPDmr, 0 },
+ { X86::MOVAPSrr, X86::MOVAPSmr, 0 },
+ { X86::MOVPDI2DIrr, X86::MOVPDI2DImr, 0 },
+ { X86::MOVPQIto64rr,X86::MOVPQIto64mr, 0 },
+ { X86::MOVPS2SSrr, X86::MOVPS2SSmr, 0 },
+ { X86::MOVSDrr, X86::MOVSDmr, 0 },
+ { X86::MOVSDto64rr, X86::MOVSDto64mr, 0 },
+ { X86::MOVSS2DIrr, X86::MOVSS2DImr, 0 },
+ { X86::MOVSSrr, X86::MOVSSmr, 0 },
+ { X86::MOVUPDrr, X86::MOVUPDmr, 0 },
+ { X86::MOVUPSrr, X86::MOVUPSmr, 0 },
+ { X86::MUL16r, X86::MUL16m, 1 },
+ { X86::MUL32r, X86::MUL32m, 1 },
+ { X86::MUL64r, X86::MUL64m, 1 },
+ { X86::MUL8r, X86::MUL8m, 1 },
+ { X86::SETAEr, X86::SETAEm, 0 },
+ { X86::SETAr, X86::SETAm, 0 },
+ { X86::SETBEr, X86::SETBEm, 0 },
+ { X86::SETBr, X86::SETBm, 0 },
+ { X86::SETEr, X86::SETEm, 0 },
+ { X86::SETGEr, X86::SETGEm, 0 },
+ { X86::SETGr, X86::SETGm, 0 },
+ { X86::SETLEr, X86::SETLEm, 0 },
+ { X86::SETLr, X86::SETLm, 0 },
+ { X86::SETNEr, X86::SETNEm, 0 },
+ { X86::SETNPr, X86::SETNPm, 0 },
+ { X86::SETNSr, X86::SETNSm, 0 },
+ { X86::SETPr, X86::SETPm, 0 },
+ { X86::SETSr, X86::SETSm, 0 },
+ { X86::TAILJMPr, X86::TAILJMPm, 1 },
+ { X86::TEST16ri, X86::TEST16mi, 1 },
+ { X86::TEST32ri, X86::TEST32mi, 1 },
+ { X86::TEST64ri32, X86::TEST64mi32, 1 },
+ { X86::TEST8ri, X86::TEST8mi, 1 },
+ { X86::XCHG16rr, X86::XCHG16mr, 0 },
+ { X86::XCHG32rr, X86::XCHG32mr, 0 },
+ { X86::XCHG64rr, X86::XCHG64mr, 0 },
+ { X86::XCHG8rr, X86::XCHG8mr, 0 }
};
for (unsigned i = 0, e = array_lengthof(OpTbl0); i != e; ++i) {
@@ -315,7 +319,11 @@
unsigned MemOp = OpTbl0[i][1];
if (!RegOp2MemOpTable0.insert(std::make_pair((unsigned*)RegOp, MemOp)))
assert(false && "Duplicated entries?");
- if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, RegOp)))
+ unsigned FoldedLoad = OpTbl0[i][2];
+ // Index 0, folded load or store.
+ unsigned AuxInfo = 0 | (FoldedLoad << 4) | ((FoldedLoad^1) << 5);
+ if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp,
+ std::make_pair(RegOp, AuxInfo))))
AmbEntries.push_back(MemOp);
}
@@ -436,7 +444,9 @@
unsigned MemOp = OpTbl1[i][1];
if (!RegOp2MemOpTable1.insert(std::make_pair((unsigned*)RegOp, MemOp)))
assert(false && "Duplicated entries?");
- if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, RegOp)))
+ unsigned AuxInfo = 1 | (1 << 4); // Index 1, folded load
+ if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp,
+ std::make_pair(RegOp, AuxInfo))))
AmbEntries.push_back(MemOp);
}
@@ -627,7 +637,9 @@
unsigned MemOp = OpTbl2[i][1];
if (!RegOp2MemOpTable2.insert(std::make_pair((unsigned*)RegOp, MemOp)))
assert(false && "Duplicated entries?");
- if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, RegOp)))
+ unsigned AuxInfo = 2 | (1 << 4); // Index 1, folded load
+ if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp,
+ std::make_pair(RegOp, AuxInfo))))
AmbEntries.push_back(MemOp);
}
@@ -722,11 +734,30 @@
return true;
}
-void X86RegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator MI,
- unsigned SrcReg, int FrameIdx,
- const TargetRegisterClass *RC) const {
- unsigned Opc;
+static const MachineInstrBuilder &X86InstrAddOperand(MachineInstrBuilder &MIB,
+ MachineOperand &MO) {
+ if (MO.isRegister())
+ MIB = MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit());
+ else if (MO.isImmediate())
+ MIB = MIB.addImm(MO.getImm());
+ else if (MO.isFrameIndex())
+ MIB = MIB.addFrameIndex(MO.getFrameIndex());
+ else if (MO.isGlobalAddress())
+ MIB = MIB.addGlobalAddress(MO.getGlobal(), MO.getOffset());
+ else if (MO.isConstantPoolIndex())
+ MIB = MIB.addConstantPoolIndex(MO.getConstantPoolIndex(), MO.getOffset());
+ else if (MO.isJumpTableIndex())
+ MIB = MIB.addJumpTableIndex(MO.getJumpTableIndex());
+ else if (MO.isExternalSymbol())
+ MIB = MIB.addExternalSymbol(MO.getSymbolName());
+ else
+ assert(0 && "Unknown operand for X86InstrAddOperand!");
+
+ return MIB;
+}
+
+static unsigned getStoreRegOpcode(const TargetRegisterClass *RC) {
+ unsigned Opc = 0;
if (RC == &X86::GR64RegClass) {
Opc = X86::MOV64mr;
} else if (RC == &X86::GR32RegClass) {
@@ -757,15 +788,33 @@
assert(0 && "Unknown regclass");
abort();
}
+
+ return Opc;
+}
+
+void X86RegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator MI,
+ unsigned SrcReg, int FrameIdx,
+ const TargetRegisterClass *RC) const {
+ unsigned Opc = getStoreRegOpcode(RC);
addFrameReference(BuildMI(MBB, MI, TII.get(Opc)), FrameIdx)
.addReg(SrcReg, false, false, true);
}
-void X86RegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator MI,
- unsigned DestReg, int FrameIdx,
- const TargetRegisterClass *RC) const{
- unsigned Opc;
+void X86RegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = getStoreRegOpcode(RC);
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc));
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i)
+ MIB = X86InstrAddOperand(MIB, Addr[i]);
+ MIB.addReg(SrcReg, false, false, true);
+ NewMIs.push_back(MIB);
+}
+
+static unsigned getLoadRegOpcode(const TargetRegisterClass *RC) {
+ unsigned Opc = 0;
if (RC == &X86::GR64RegClass) {
Opc = X86::MOV64rm;
} else if (RC == &X86::GR32RegClass) {
@@ -796,9 +845,29 @@
assert(0 && "Unknown regclass");
abort();
}
+
+ return Opc;
+}
+
+void X86RegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator MI,
+ unsigned DestReg, int FrameIdx,
+ const TargetRegisterClass *RC) const{
+ unsigned Opc = getLoadRegOpcode(RC);
addFrameReference(BuildMI(MBB, MI, TII.get(Opc), DestReg), FrameIdx);
}
+void X86RegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const {
+ unsigned Opc = getLoadRegOpcode(RC);
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc), DestReg);
+ for (unsigned i = 0, e = Addr.size(); i != e; ++i)
+ MIB = X86InstrAddOperand(MIB, Addr[i]);
+ NewMIs.push_back(MIB);
+}
+
void X86RegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, unsigned SrcReg,
@@ -905,28 +974,6 @@
}
}
-static const MachineInstrBuilder &FuseInstrAddOperand(MachineInstrBuilder &MIB,
- MachineOperand &MO) {
- if (MO.isRegister())
- MIB = MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit());
- else if (MO.isImmediate())
- MIB = MIB.addImm(MO.getImm());
- else if (MO.isFrameIndex())
- MIB = MIB.addFrameIndex(MO.getFrameIndex());
- else if (MO.isGlobalAddress())
- MIB = MIB.addGlobalAddress(MO.getGlobal(), MO.getOffset());
- else if (MO.isConstantPoolIndex())
- MIB = MIB.addConstantPoolIndex(MO.getConstantPoolIndex(), MO.getOffset());
- else if (MO.isJumpTableIndex())
- MIB = MIB.addJumpTableIndex(MO.getJumpTableIndex());
- else if (MO.isExternalSymbol())
- MIB = MIB.addExternalSymbol(MO.getSymbolName());
- else
- assert(0 && "Unknown operand for FuseInst!");
-
- return MIB;
-}
-
static MachineInstr *FuseTwoAddrInst(unsigned Opcode,
SmallVector &MOs,
MachineInstr *MI, const TargetInstrInfo &TII) {
@@ -936,14 +983,14 @@
MachineInstrBuilder MIB = BuildMI(TII.get(Opcode));
unsigned NumAddrOps = MOs.size();
for (unsigned i = 0; i != NumAddrOps; ++i)
- MIB = FuseInstrAddOperand(MIB, MOs[i]);
+ MIB = X86InstrAddOperand(MIB, MOs[i]);
if (NumAddrOps < 4) // FrameIndex only
MIB.addImm(1).addReg(0).addImm(0);
// Loop over the rest of the ri operands, converting them over.
for (unsigned i = 0; i != NumOps; ++i) {
MachineOperand &MO = MI->getOperand(i+2);
- MIB = FuseInstrAddOperand(MIB, MO);
+ MIB = X86InstrAddOperand(MIB, MO);
}
return MIB;
}
@@ -959,11 +1006,11 @@
assert(MO.isRegister() && "Expected to fold into reg operand!");
unsigned NumAddrOps = MOs.size();
for (unsigned i = 0; i != NumAddrOps; ++i)
- MIB = FuseInstrAddOperand(MIB, MOs[i]);
+ MIB = X86InstrAddOperand(MIB, MOs[i]);
if (NumAddrOps < 4) // FrameIndex only
MIB.addImm(1).addReg(0).addImm(0);
} else {
- MIB = FuseInstrAddOperand(MIB, MO);
+ MIB = X86InstrAddOperand(MIB, MO);
}
}
return MIB;
@@ -976,7 +1023,7 @@
unsigned NumAddrOps = MOs.size();
for (unsigned i = 0; i != NumAddrOps; ++i)
- MIB = FuseInstrAddOperand(MIB, MOs[i]);
+ MIB = X86InstrAddOperand(MIB, MOs[i]);
if (NumAddrOps < 4) // FrameIndex only
MIB.addImm(1).addReg(0).addImm(0);
return MIB.addImm(0);
@@ -1066,6 +1113,156 @@
return foldMemoryOperand(MI, OpNum, MOs);
}
+bool X86RegisterInfo::unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI,
+ SSARegMap *RegMap,
+ SmallVector &NewMIs) const {
+ DenseMap >::iterator I =
+ MemOp2RegOpTable.find((unsigned*)MI->getOpcode());
+ if (I == MemOp2RegOpTable.end())
+ return false;
+ unsigned Opc = I->second.first;
+ unsigned Index = I->second.second & 0xf;
+ bool HasLoad = I->second.second & (1 << 4);
+ bool HasStore = I->second.second & (1 << 5);
+ const TargetInstrDescriptor &TID = TII.get(Opc);
+ const TargetOperandInfo &TOI = TID.OpInfo[Index];
+ const TargetRegisterClass *RC = (TOI.Flags & M_LOOK_UP_PTR_REG_CLASS)
+ ? TII.getPointerRegClass() : getRegClass(TOI.RegClass);
+ SmallVector AddrOps;
+ SmallVector BeforeOps;
+ SmallVector AfterOps;
+ SmallVector ImpOps;
+ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+ MachineOperand &Op = MI->getOperand(i);
+ if (i >= Index && i < Index+4)
+ AddrOps.push_back(Op);
+ else if (Op.isRegister() && Op.isImplicit())
+ ImpOps.push_back(Op);
+ else if (i < Index)
+ BeforeOps.push_back(Op);
+ else if (i > Index)
+ AfterOps.push_back(Op);
+ }
+
+ // Emit the load instruction.
+ unsigned LoadReg = 0;
+ if (HasLoad) {
+ LoadReg = RegMap->createVirtualRegister(RC);
+ loadRegFromAddr(MF, LoadReg, AddrOps, RC, NewMIs);
+ if (HasStore) {
+ // Address operands cannot be marked isKill.
+ for (unsigned i = 1; i != 5; ++i) {
+ MachineOperand &MO = NewMIs[0]->getOperand(i);
+ if (MO.isRegister())
+ MO.unsetIsKill();
+ }
+ }
+ }
+
+ // Emit the data processing instruction.
+ MachineInstrBuilder MIB = BuildMI(TII.get(Opc));
+ unsigned StoreReg = 0;
+ const TargetRegisterClass *DstRC = 0;
+ if (HasStore) {
+ const TargetOperandInfo &DstTOI = TID.OpInfo[0];
+ DstRC = (DstTOI.Flags & M_LOOK_UP_PTR_REG_CLASS)
+ ? TII.getPointerRegClass() : getRegClass(DstTOI.RegClass);
+ StoreReg = RegMap->createVirtualRegister(RC);
+ MIB.addReg(StoreReg, true);
+ }
+ for (unsigned i = 0, e = BeforeOps.size(); i != e; ++i)
+ MIB = X86InstrAddOperand(MIB, BeforeOps[i]);
+ if (LoadReg)
+ MIB.addReg(LoadReg);
+ for (unsigned i = 0, e = AfterOps.size(); i != e; ++i)
+ MIB = X86InstrAddOperand(MIB, AfterOps[i]);
+ NewMIs.push_back(MIB);
+
+ // Emit the store instruction.
+ if (HasStore)
+ storeRegToAddr(MF, StoreReg, AddrOps, DstRC, NewMIs);
+
+ return true;
+}
+
+
+bool
+X86RegisterInfo::unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N,
+ SmallVector &NewNodes) const {
+ if (!N->isTargetOpcode())
+ return false;
+
+ DenseMap >::iterator I =
+ MemOp2RegOpTable.find((unsigned*)N->getTargetOpcode());
+ if (I == MemOp2RegOpTable.end())
+ return false;
+ unsigned Opc = I->second.first;
+ unsigned Index = I->second.second & 0xf;
+ bool HasLoad = I->second.second & (1 << 4);
+ bool HasStore = I->second.second & (1 << 5);
+ const TargetInstrDescriptor &TID = TII.get(Opc);
+ const TargetOperandInfo &TOI = TID.OpInfo[Index];
+ const TargetRegisterClass *RC = (TOI.Flags & M_LOOK_UP_PTR_REG_CLASS)
+ ? TII.getPointerRegClass() : getRegClass(TOI.RegClass);
+ std::vector AddrOps;
+ std::vector BeforeOps;
+ std::vector AfterOps;
+ unsigned NumOps = N->getNumOperands();
+ for (unsigned i = 0; i != NumOps-1; ++i) {
+ SDOperand Op = N->getOperand(i);
+ if (i >= Index && i < Index+4)
+ AddrOps.push_back(Op);
+ else if (i < Index)
+ BeforeOps.push_back(Op);
+ else if (i > Index)
+ AfterOps.push_back(Op);
+ }
+ SDOperand Chain = N->getOperand(NumOps-1);
+ AddrOps.push_back(Chain);
+
+ // Emit the load instruction.
+ SDNode *Load = 0;
+ if (HasLoad) {
+ MVT::ValueType VT = *RC->vt_begin();
+ Load = DAG.getTargetNode(getLoadRegOpcode(RC), VT, MVT::Other,
+ &AddrOps[0], AddrOps.size());
+ NewNodes.push_back(Load);
+ }
+
+ // Emit the data processing instruction.
+ std::vector VTs;
+ const TargetRegisterClass *DstRC = 0;
+ if (TID.numDefs > 0) {
+ const TargetOperandInfo &DstTOI = TID.OpInfo[0];
+ DstRC = (DstTOI.Flags & M_LOOK_UP_PTR_REG_CLASS)
+ ? TII.getPointerRegClass() : getRegClass(DstTOI.RegClass);
+ VTs.push_back(*DstRC->vt_begin());
+ }
+ for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) {
+ MVT::ValueType VT = N->getValueType(i);
+ if (VT != MVT::Other && i >= TID.numDefs)
+ VTs.push_back(VT);
+ }
+ if (Load)
+ BeforeOps.push_back(SDOperand(Load, 0));
+ std::copy(AfterOps.begin(), AfterOps.end(), std::back_inserter(BeforeOps));
+ SDNode *NewNode= DAG.getTargetNode(Opc, VTs, &BeforeOps[0], BeforeOps.size());
+ NewNodes.push_back(NewNode);
+
+ // Emit the store instruction.
+ if (HasStore) {
+ AddrOps.pop_back();
+ AddrOps.push_back(SDOperand(NewNode, 0));
+ AddrOps.push_back(Chain);
+ SDNode *Store = DAG.getTargetNode(getStoreRegOpcode(DstRC),
+ MVT::Other, &AddrOps[0], AddrOps.size());
+ NewNodes.push_back(Store);
+ }
+
+ return true;
+}
+
+
const unsigned *
X86RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
static const unsigned CalleeSavedRegs32Bit[] = {
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=42624&r1=42623&r2=42624&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Oct 4 20:34:55 2007
@@ -64,7 +64,7 @@
/// MemOp2RegOpTable - Load / store unfolding opcode map.
///
- DenseMap MemOp2RegOpTable;
+ DenseMap > MemOp2RegOpTable;
public:
X86RegisterInfo(X86TargetMachine &tm, const TargetInstrInfo &tii);
@@ -88,11 +88,21 @@
unsigned SrcReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC) const;
+ void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
+ SmallVector Addr,
+ const TargetRegisterClass *RC,
+ SmallVector &NewMIs) const;
+
void copyRegToReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
unsigned DestReg, unsigned SrcReg,
@@ -122,6 +132,16 @@
unsigned OpNum,
MachineInstr* LoadMI) const;
+ /// unfoldMemoryOperand - Separate a single instruction which folded a load or a
+ /// a store or a load and a store into two or more instruction. If this is
+ /// possible, returns true as well as the new instructions by reference.
+ bool unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI,
+ SSARegMap *RegMap,
+ SmallVector &NewMIs) const;
+
+ bool unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N,
+ SmallVector &NewNodes) const;
+
/// getCalleeSavedRegs - Return a null-terminated list of all of the
/// callee-save registers on this target.
const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
From evan.cheng at apple.com Thu Oct 4 20:39:18 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:39:18 -0000
Subject: [llvm-commits] [llvm] r42625 - in /llvm/trunk:
include/llvm/CodeGen/ScheduleDAG.h lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Message-ID: <200710050139.l951dI1P021546@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:39:18 2007
New Revision: 42625
URL: http://llvm.org/viewvc/llvm-project?rev=42625&view=rev
Log:
If a node that defines a physical register that is expensive to copy. The
scheduler will try a number of tricks in order to avoid generating the
copies. This may not be possible in case the node produces a chain value
that prevent movement. Try unfolding the load from the node before to allow
it to be moved / cloned.
Modified:
llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=42625&r1=42624&r2=42625&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Thu Oct 4 20:39:18 2007
@@ -115,7 +115,7 @@
short NumSuccsLeft; // # of succs not scheduled.
bool isTwoAddress : 1; // Is a two-address instruction.
bool isCommutable : 1; // Is a commutable instruction.
- bool hasPhysRegDefs : 1; // Has physreg defs that are being used.
+ bool hasPhysRegDefs : 1; // Has physreg defs that are being used.
bool isPending : 1; // True once pending.
bool isAvailable : 1; // True once available.
bool isScheduled : 1; // True once scheduled.
@@ -297,6 +297,10 @@
/// together nodes with a single SUnit.
void BuildSchedUnits();
+ /// ComputeLatency - Compute node latency.
+ ///
+ void ComputeLatency(SUnit *SU);
+
/// CalculateDepths, CalculateHeights - Calculate node depth / height.
///
void CalculateDepths();
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=42625&r1=42624&r2=42625&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Thu Oct 4 20:39:18 2007
@@ -68,6 +68,7 @@
return SU;
}
+
/// BuildSchedUnits - Build SUnits from the selection dag that we are input.
/// This SUnit graph is similar to the SelectionDAG, but represents flagged
/// together nodes with a single SUnit.
@@ -77,8 +78,6 @@
// invalidated.
SUnits.reserve(std::distance(DAG.allnodes_begin(), DAG.allnodes_end()));
- const InstrItineraryData &InstrItins = TM.getInstrItineraryData();
-
for (SelectionDAG::allnodes_iterator NI = DAG.allnodes_begin(),
E = DAG.allnodes_end(); NI != E; ++NI) {
if (isPassiveNode(NI)) // Leaf node, e.g. a TargetImmediate.
@@ -131,32 +130,8 @@
// Update the SUnit
NodeSUnit->Node = N;
SUnitMap[N].push_back(NodeSUnit);
-
- // Compute the latency for the node. We use the sum of the latencies for
- // all nodes flagged together into this SUnit.
- if (InstrItins.isEmpty()) {
- // No latency information.
- NodeSUnit->Latency = 1;
- } else {
- NodeSUnit->Latency = 0;
- if (N->isTargetOpcode()) {
- unsigned SchedClass = TII->getSchedClass(N->getTargetOpcode());
- InstrStage *S = InstrItins.begin(SchedClass);
- InstrStage *E = InstrItins.end(SchedClass);
- for (; S != E; ++S)
- NodeSUnit->Latency += S->Cycles;
- }
- for (unsigned i = 0, e = NodeSUnit->FlaggedNodes.size(); i != e; ++i) {
- SDNode *FNode = NodeSUnit->FlaggedNodes[i];
- if (FNode->isTargetOpcode()) {
- unsigned SchedClass = TII->getSchedClass(FNode->getTargetOpcode());
- InstrStage *S = InstrItins.begin(SchedClass);
- InstrStage *E = InstrItins.end(SchedClass);
- for (; S != E; ++S)
- NodeSUnit->Latency += S->Cycles;
- }
- }
- }
+
+ ComputeLatency(NodeSUnit);
}
// Pass 2: add the preds, succs, etc.
@@ -214,6 +189,36 @@
return;
}
+void ScheduleDAG::ComputeLatency(SUnit *SU) {
+ const InstrItineraryData &InstrItins = TM.getInstrItineraryData();
+
+ // Compute the latency for the node. We use the sum of the latencies for
+ // all nodes flagged together into this SUnit.
+ if (InstrItins.isEmpty()) {
+ // No latency information.
+ SU->Latency = 1;
+ } else {
+ SU->Latency = 0;
+ if (SU->Node->isTargetOpcode()) {
+ unsigned SchedClass = TII->getSchedClass(SU->Node->getTargetOpcode());
+ InstrStage *S = InstrItins.begin(SchedClass);
+ InstrStage *E = InstrItins.end(SchedClass);
+ for (; S != E; ++S)
+ SU->Latency += S->Cycles;
+ }
+ for (unsigned i = 0, e = SU->FlaggedNodes.size(); i != e; ++i) {
+ SDNode *FNode = SU->FlaggedNodes[i];
+ if (FNode->isTargetOpcode()) {
+ unsigned SchedClass = TII->getSchedClass(FNode->getTargetOpcode());
+ InstrStage *S = InstrItins.begin(SchedClass);
+ InstrStage *E = InstrItins.end(SchedClass);
+ for (; S != E; ++S)
+ SU->Latency += S->Cycles;
+ }
+ }
+ }
+}
+
void ScheduleDAG::CalculateDepths() {
std::vector > WorkList;
for (unsigned i = 0, e = SUnits.size(); i != e; ++i)
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=42625&r1=42624&r2=42625&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Thu Oct 4 20:39:18 2007
@@ -34,6 +34,7 @@
using namespace llvm;
STATISTIC(NumBacktracks, "Number of times scheduler backtraced");
+STATISTIC(NumUnfolds, "Number of nodes unfolded");
STATISTIC(NumDups, "Number of duplicated nodes");
STATISTIC(NumCCCopies, "Number of cross class copies");
@@ -385,32 +386,145 @@
++NumBacktracks;
}
-/// isSafeToCopy - True if the SUnit for the given SDNode can safely cloned,
-/// i.e. the node does not produce a flag, it does not read a flag and it does
-/// not have an incoming chain.
-static bool isSafeToCopy(SDNode *N) {
+/// CopyAndMoveSuccessors - Clone the specified node and move its scheduled
+/// successors to the newly created node.
+SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
+ if (SU->FlaggedNodes.size())
+ return NULL;
+
+ SDNode *N = SU->Node;
if (!N)
- return true;
+ return NULL;
+ SUnit *NewSU;
for (unsigned i = 0, e = N->getNumValues(); i != e; ++i)
if (N->getValueType(i) == MVT::Flag)
- return false;
+ return NULL;
+ bool TryUnfold = false;
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
const SDOperand &Op = N->getOperand(i);
MVT::ValueType VT = Op.Val->getValueType(Op.ResNo);
- if (VT == MVT::Other || VT == MVT::Flag)
- return false;
- }
+ if (VT == MVT::Flag)
+ return NULL;
+ else if (VT == MVT::Other)
+ TryUnfold = true;
+ }
+
+ if (TryUnfold) {
+ SmallVector NewNodes;
+ if (!MRI->unfoldMemoryOperand(DAG, N, NewNodes))
+ return NULL;
+
+ DOUT << "Unfolding SU # " << SU->NodeNum << "\n";
+ assert(NewNodes.size() == 2 && "Expected a load folding node!");
+
+ N = NewNodes[1];
+ SDNode *LoadNode = NewNodes[0];
+ std::vector Deleted;
+ unsigned NumVals = N->getNumValues();
+ unsigned OldNumVals = SU->Node->getNumValues();
+ for (unsigned i = 0; i != NumVals; ++i)
+ DAG.ReplaceAllUsesOfValueWith(SDOperand(SU->Node, i),
+ SDOperand(N, i), Deleted);
+ DAG.ReplaceAllUsesOfValueWith(SDOperand(SU->Node, OldNumVals-1),
+ SDOperand(LoadNode, 1), Deleted);
+
+ SUnit *LoadSU = NewSUnit(LoadNode);
+ SUnit *NewSU = NewSUnit(N);
+ SUnitMap[LoadNode].push_back(LoadSU);
+ SUnitMap[N].push_back(NewSU);
+ const TargetInstrDescriptor *TID = &TII->get(LoadNode->getTargetOpcode());
+ for (unsigned i = 0; i != TID->numOperands; ++i) {
+ if (TID->getOperandConstraint(i, TOI::TIED_TO) != -1) {
+ LoadSU->isTwoAddress = true;
+ break;
+ }
+ }
+ if (TID->Flags & M_COMMUTABLE)
+ LoadSU->isCommutable = true;
- return true;
-}
+ TID = &TII->get(N->getTargetOpcode());
+ for (unsigned i = 0; i != TID->numOperands; ++i) {
+ if (TID->getOperandConstraint(i, TOI::TIED_TO) != -1) {
+ NewSU->isTwoAddress = true;
+ break;
+ }
+ }
+ if (TID->Flags & M_COMMUTABLE)
+ NewSU->isCommutable = true;
-/// CopyAndMoveSuccessors - Clone the specified node and move its scheduled
-/// successors to the newly created node.
-SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
- DOUT << "Duplicating SU # " << SU->NodeNum << "\n";
+ // FIXME: Calculate height / depth and propagate the changes?
+ LoadSU->Depth = NewSU->Depth = SU->Depth;
+ LoadSU->Height = NewSU->Height = SU->Height;
+ ComputeLatency(LoadSU);
+ ComputeLatency(NewSU);
+
+ SUnit *ChainPred = NULL;
+ SmallVector ChainSuccs;
+ SmallVector LoadPreds;
+ SmallVector NodePreds;
+ SmallVector NodeSuccs;
+ for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
+ I != E; ++I) {
+ if (I->isCtrl)
+ ChainPred = I->Dep;
+ else if (I->Dep->Node && I->Dep->Node->isOperand(LoadNode))
+ LoadPreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false));
+ else
+ NodePreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false));
+ }
+ for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
+ I != E; ++I) {
+ if (I->isCtrl)
+ ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
+ I->isCtrl, I->isSpecial));
+ else
+ NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
+ I->isCtrl, I->isSpecial));
+ }
- SUnit *NewSU = Clone(SU);
+ SU->removePred(ChainPred, true, false);
+ LoadSU->addPred(ChainPred, true, false);
+ for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) {
+ SDep *Pred = &LoadPreds[i];
+ SU->removePred(Pred->Dep, Pred->isCtrl, Pred->isSpecial);
+ LoadSU->addPred(Pred->Dep, Pred->isCtrl, Pred->isSpecial,
+ Pred->Reg, Pred->Cost);
+ }
+ for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) {
+ SDep *Pred = &NodePreds[i];
+ SU->removePred(Pred->Dep, Pred->isCtrl, Pred->isSpecial);
+ NewSU->addPred(Pred->Dep, Pred->isCtrl, Pred->isSpecial,
+ Pred->Reg, Pred->Cost);
+ }
+ for (unsigned i = 0, e = NodeSuccs.size(); i != e; ++i) {
+ SDep *Succ = &NodeSuccs[i];
+ Succ->Dep->removePred(SU, Succ->isCtrl, Succ->isSpecial);
+ Succ->Dep->addPred(NewSU, Succ->isCtrl, Succ->isSpecial,
+ Succ->Reg, Succ->Cost);
+ }
+ for (unsigned i = 0, e = ChainSuccs.size(); i != e; ++i) {
+ SDep *Succ = &ChainSuccs[i];
+ Succ->Dep->removePred(SU, Succ->isCtrl, Succ->isSpecial);
+ Succ->Dep->addPred(LoadSU, Succ->isCtrl, Succ->isSpecial,
+ Succ->Reg, Succ->Cost);
+ }
+ NewSU->addPred(LoadSU, false, false);
+
+ AvailableQueue->addNode(LoadSU);
+ AvailableQueue->addNode(NewSU);
+
+ ++NumUnfolds;
+
+ if (NewSU->NumSuccsLeft == 0) {
+ NewSU->isAvailable = true;
+ return NewSU;
+ } else
+ SU = NewSU;
+ }
+
+ DOUT << "Duplicating SU # " << SU->NodeNum << "\n";
+ NewSU = Clone(SU);
// New SUnit has the exact same predecessors.
for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
@@ -452,6 +566,7 @@
const TargetRegisterClass *DestRC,
const TargetRegisterClass *SrcRC,
SmallVector &Copies) {
+ abort();
SUnit *CopyFromSU = NewSUnit(NULL);
CopyFromSU->CopySrcRC = SrcRC;
CopyFromSU->CopyDstRC = DestRC;
@@ -640,10 +755,8 @@
assert(LRegs.size() == 1 && "Can't handle this yet!");
unsigned Reg = LRegs[0];
SUnit *LRDef = LiveRegDefs[Reg];
- SUnit *NewDef;
- if (isSafeToCopy(LRDef->Node))
- NewDef = CopyAndMoveSuccessors(LRDef);
- else {
+ SUnit *NewDef = CopyAndMoveSuccessors(LRDef);
+ if (!NewDef) {
// Issue expensive cross register class copies.
MVT::ValueType VT = getPhysicalRegisterVT(LRDef->Node, Reg, TII);
const TargetRegisterClass *RC =
From evan.cheng at apple.com Thu Oct 4 20:39:40 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:39:40 -0000
Subject: [llvm-commits] [llvm] r42626 -
/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Message-ID: <200710050139.l951deU9021571@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:39:40 2007
New Revision: 42626
URL: http://llvm.org/viewvc/llvm-project?rev=42626&view=rev
Log:
Oops. Didn't mean to leave this in.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=42626&r1=42625&r2=42626&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Thu Oct 4 20:39:40 2007
@@ -566,7 +566,6 @@
const TargetRegisterClass *DestRC,
const TargetRegisterClass *SrcRC,
SmallVector &Copies) {
- abort();
SUnit *CopyFromSU = NewSUnit(NULL);
CopyFromSU->CopySrcRC = SrcRC;
CopyFromSU->CopyDstRC = DestRC;
From evan.cheng at apple.com Thu Oct 4 20:42:35 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:42:35 -0000
Subject: [llvm-commits] [llvm] r42627 -
/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Message-ID: <200710050142.l951gZaM021672@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:42:35 2007
New Revision: 42627
URL: http://llvm.org/viewvc/llvm-project?rev=42627&view=rev
Log:
Chain producing nodes cannot be moved, not chain reading nodes.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=42627&r1=42626&r2=42627&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Thu Oct 4 20:42:35 2007
@@ -397,17 +397,19 @@
return NULL;
SUnit *NewSU;
- for (unsigned i = 0, e = N->getNumValues(); i != e; ++i)
- if (N->getValueType(i) == MVT::Flag)
- return NULL;
bool TryUnfold = false;
+ for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) {
+ MVT::ValueType VT = N->getValueType(i);
+ if (VT == MVT::Flag)
+ return NULL;
+ else if (VT == MVT::Other)
+ TryUnfold = true;
+ }
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
const SDOperand &Op = N->getOperand(i);
MVT::ValueType VT = Op.Val->getValueType(Op.ResNo);
if (VT == MVT::Flag)
return NULL;
- else if (VT == MVT::Other)
- TryUnfold = true;
}
if (TryUnfold) {
From evan.cheng at apple.com Thu Oct 4 20:44:22 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 01:44:22 -0000
Subject: [llvm-commits] [llvm] r42628 -
/llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll
Message-ID: <200710050144.l951iMhF021771@zion.cs.uiuc.edu>
Author: evancheng
Date: Thu Oct 4 20:44:22 2007
New Revision: 42628
URL: http://llvm.org/viewvc/llvm-project?rev=42628&view=rev
Log:
New test case.
Added:
llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll
Added: llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll?rev=42628&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll Thu Oct 4 20:44:22 2007
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | llc | not grep pushf
+
+ %struct.gl_texture_image = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8* }
+ %struct.gl_texture_object = type { i32, i32, i32, float, [4 x i32], i32, i32, i32, i32, i32, float, [11 x %struct.gl_texture_image*], [1024 x i8], i32, i32, i32, i8, i8*, i8, void (%struct.gl_texture_object*, i32, float*, float*, float*, float*, i8*, i8*, i8*, i8*)*, %struct.gl_texture_object* }
+
+define fastcc void @sample_3d_linear(%struct.gl_texture_object* %tObj, %struct.gl_texture_image* %img, float %s, float %t, float %r, i8* %red, i8* %green, i8* %blue, i8* %alpha) {
+entry:
+ %tmp15 = load i32* null, align 4 ; [#uses=1]
+ %tmp16 = icmp eq i32 %tmp15, 10497 ; [#uses=1]
+ %tmp2152 = call float @floorf( float 0.000000e+00 ) ; [#uses=0]
+ br i1 %tmp16, label %cond_true, label %cond_false
+
+cond_true: ; preds = %entry
+ ret void
+
+cond_false: ; preds = %entry
+ ret void
+}
+
+declare float @floorf(float)
From dberlin at dberlin.org Fri Oct 5 00:10:54 2007
From: dberlin at dberlin.org (Daniel Berlin)
Date: Fri, 05 Oct 2007 05:10:54 -0000
Subject: [llvm-commits] [llvm] r42629 -
/llvm/trunk/include/llvm/ADT/SparseBitVector.h
Message-ID: <200710050510.l955As2N028253@zion.cs.uiuc.edu>
Author: dannyb
Date: Fri Oct 5 00:10:53 2007
New Revision: 42629
URL: http://llvm.org/viewvc/llvm-project?rev=42629&view=rev
Log:
Fix intersectWithComplement bug noticed by Curtis Dunham
Optimize |= case for empty RHS
Modified:
llvm/trunk/include/llvm/ADT/SparseBitVector.h
Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=42629&r1=42628&r2=42629&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Fri Oct 5 00:10:53 2007
@@ -580,8 +580,8 @@
ElementListIter Iter1 = Elements.begin();
ElementListConstIter Iter2 = RHS.Elements.begin();
- // Check if both bitmaps are empty
- if (Elements.empty() && RHS.Elements.empty())
+ // If RHS is empty, we are done
+ if (RHS.Elements.empty())
return false;
while (Iter2 != RHS.Elements.end()) {
@@ -671,9 +671,7 @@
}
++Iter2;
} else {
- ElementListIter IterTmp = Iter1;
++Iter1;
- Elements.erase(IterTmp);
}
}
CurrElementIter = Elements.begin();
From evan.cheng at apple.com Fri Oct 5 02:06:19 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 5 Oct 2007 00:06:19 -0700
Subject: [llvm-commits] [llvm] r40628 - in /llvm/trunk:
lib/Target/X86/X86InstrFPStack.td lib/Target/X86/X86InstrFormats.td
lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrMMX.td
lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86InstrX86-64.td
test/CodeGen/X86/2007-07-31-VInsertBug.ll
In-Reply-To:
References: <200707310804.l6V844EB007549@zion.cs.uiuc.edu>
<31A3D1FE-643E-4ABA-896D-DDC1B7404B60@apple.com>
Message-ID: <3AD4F30D-122A-4B9C-9707-C9E60ACDC761@apple.com>
I'll look at this.
Evan
On Sep 28, 2007, at 12:17 PM, Chris Lattner wrote:
> Evan, ping?
>
> -Chris
>
> On Aug 1, 2007, at 5:47 PM, Chris Lattner wrote:
>
>> On Jul 31, 2007, at 1:04 AM, Evan Cheng wrote:
>>> Author: evancheng
>>> Date: Tue Jul 31 03:04:03 2007
>>> New Revision: 40628
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=40628&view=rev
>>> Log:
>>> Redo and generalize previously removed opt for pinsrw: (vextract
>>> (v4i32 bc (v4f32 s2v (f32 load ))), 0) -> (i32 load )
>>
>>
>>> +
>>> +// (vextract (v4i32 bc (v4f32 s2v (f32 load $addr))), 0) -> (i32
>>> load $addr)
>>> +def : Pat<(vector_extract
>>> + (bc_v4i32 (v4f32 (scalar_to_vector (loadf32 addr:
>>> $src)))), (iPTR 0)),
>>> + (MOV32rm addr:$src)>;
>>> +def : Pat<(vector_extract
>>> + (bc_v2i64 (v2f64 (scalar_to_vector (loadf64 addr:
>>> $src)))), (iPTR 0)),
>>> + (MOV64rm addr:$src)>;
>>
>> Would it be possible (and would it make sense) to do this in the dag
>> combiner rather than as a target-specific pattern?
>>
>> -Chris
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From evan.cheng at apple.com Fri Oct 5 03:04:02 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 08:04:02 -0000
Subject: [llvm-commits] [test-suite] r42630 -
/test-suite/trunk/Makefile.programs
Message-ID: <200710050804.l958420V008347@zion.cs.uiuc.edu>
Author: evancheng
Date: Fri Oct 5 03:04:01 2007
New Revision: 42630
URL: http://llvm.org/viewvc/llvm-project?rev=42630&view=rev
Log:
Testing convertToThreeeAddress as X86 llcbeta.
Modified:
test-suite/trunk/Makefile.programs
Modified: test-suite/trunk/Makefile.programs
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=42630&r1=42629&r2=42630&view=diff
==============================================================================
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Fri Oct 5 03:04:01 2007
@@ -221,7 +221,8 @@
LLCBETAOPTION := -sched=simple
endif
ifeq ($(ARCH),x86)
-LLCBETAOPTION := -regalloc=local -fast
+LLCBETAOPTION := -enable-x86-conv-3-addr
+#-regalloc=local -fast
#-disable-rematerialization
#-disable-fp-elim
#-regalloc=bigblock -fast
From evan.cheng at apple.com Fri Oct 5 03:04:02 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 08:04:02 -0000
Subject: [llvm-commits] [llvm] r42630 -
/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Message-ID: <200710050804.l95842x8008353@zion.cs.uiuc.edu>
Author: evancheng
Date: Fri Oct 5 03:04:01 2007
New Revision: 42630
URL: http://llvm.org/viewvc/llvm-project?rev=42630&view=rev
Log:
Testing convertToThreeeAddress as X86 llcbeta.
Modified:
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=42630&r1=42629&r2=42630&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Oct 5 03:04:01 2007
@@ -22,8 +22,15 @@
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/SSARegMap.h"
#include "llvm/Target/TargetOptions.h"
+#include "llvm/Support/CommandLine.h"
using namespace llvm;
+namespace {
+ cl::opt
+ EnableConvert3Addr("enable-x86-conv-3-addr",
+ cl::desc("Enable convertToThreeAddress for X86"));
+}
+
X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
: TargetInstrInfo(X86Insts, array_lengthof(X86Insts)),
TM(tm), RI(tm, *this) {
@@ -144,6 +151,21 @@
return true;
}
+/// hasLiveCondCodeDef - True if MI has a condition code def, e.g. EFLAGS, that
+/// is not marked dead.
+static bool hasLiveCondCodeDef(MachineInstr *MI) {
+ if (!EnableConvert3Addr)
+ return true;
+ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+ MachineOperand &MO = MI->getOperand(i);
+ if (MO.isRegister() && MO.isDef() &&
+ MO.getReg() == X86::EFLAGS && !MO.isDead()) {
+ return true;
+ }
+ }
+ return false;
+}
+
/// convertToThreeAddress - This method must be implemented by targets that
/// set the M_CONVERTIBLE_TO_3_ADDR flag. When this flag is set, the target
/// may be able to convert a two-address instruction into a true
@@ -169,7 +191,7 @@
bool DisableLEA16 = true;
switch (MI->getOpcode()) {
- default: return 0;
+ default: break; // All others need to check for live condition code defs.
case X86::SHUFPSrri: {
assert(MI->getNumOperands() == 4 && "Unknown shufps instruction!");
if (!TM.getSubtarget().hasSSE2()) return 0;
@@ -253,10 +275,7 @@
}
}
- // FIXME: None of these instructions are promotable to LEAs without
- // additional information. In particular, LEA doesn't set the flags that
- // add and inc do. :(
- if (0)
+ if (!hasLiveCondCodeDef(MI))
switch (MI->getOpcode()) {
case X86::INC32r:
case X86::INC64_32r:
From baldrick at free.fr Fri Oct 5 05:37:01 2007
From: baldrick at free.fr (Duncan Sands)
Date: Fri, 05 Oct 2007 10:37:01 -0000
Subject: [llvm-commits] [llvm] r42631 -
/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
Message-ID: <200710051037.l95Ab2uC013450@zion.cs.uiuc.edu>
Author: baldrick
Date: Fri Oct 5 05:37:00 2007
New Revision: 42631
URL: http://llvm.org/viewvc/llvm-project?rev=42631&view=rev
Log:
Fix typo in comment.
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=42631&r1=42630&r2=42631&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Oct 5 05:37:00 2007
@@ -1512,7 +1512,7 @@
// AddrMode - unindexed, pre-indexed, post-indexed.
ISD::MemIndexedMode AddrMode;
- // IsTruncStore - True is the op does a truncation before store.
+ // IsTruncStore - True if the op does a truncation before store.
bool IsTruncStore;
// StoredVT - VT of the value after truncation.
From djg at cray.com Fri Oct 5 09:07:57 2007
From: djg at cray.com (Dan Gohman)
Date: Fri, 05 Oct 2007 14:07:57 -0000
Subject: [llvm-commits] [llvm] r42632 -
/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
Message-ID: <200710051407.l95E7vHn020119@zion.cs.uiuc.edu>
Author: djg
Date: Fri Oct 5 09:07:56 2007
New Revision: 42632
URL: http://llvm.org/viewvc/llvm-project?rev=42632&view=rev
Log:
Define target-indepenent SDNode types for multiply and divide that
produce two results.
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=42632&r1=42631&r2=42632&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Oct 5 09:07:56 2007
@@ -233,6 +233,15 @@
// Simple integer binary arithmetic operators.
ADD, SUB, MUL, SDIV, UDIV, SREM, UREM,
+
+ // SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing
+ // a signed/unsigned value of type i[2*n], and return the full value as
+ // two results, each of type iN.
+ SMUL_LOHI, UMUL_LOHI,
+
+ // SDIVREM/UDIVREM - Divide two integers and produce both a quotient and
+ // remainder result.
+ SDIVREM, UDIVREM,
// CARRY_FALSE - This node is used when folding other nodes,
// like ADDC/SUBC, which indicate the carry result is always false.
From djg at cray.com Fri Oct 5 09:09:33 2007
From: djg at cray.com (Dan Gohman)
Date: Fri, 05 Oct 2007 14:09:33 -0000
Subject: [llvm-commits] [llvm] r42633 -
/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
Message-ID: <200710051409.l95E9XfZ020154@zion.cs.uiuc.edu>
Author: djg
Date: Fri Oct 5 09:09:33 2007
New Revision: 42633
URL: http://llvm.org/viewvc/llvm-project?rev=42633&view=rev
Log:
SMUL_LOHI and UMUL_LOHI are commutative.
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=42633&r1=42632&r2=42633&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Fri Oct 5 09:09:33 2007
@@ -457,6 +457,8 @@
case ISD::MUL:
case ISD::MULHU:
case ISD::MULHS:
+ case ISD::SMUL_LOHI:
+ case ISD::UMUL_LOHI:
case ISD::FADD:
case ISD::FMUL:
case ISD::AND:
From djg at cray.com Fri Oct 5 09:11:04 2007
From: djg at cray.com (Dan Gohman)
Date: Fri, 05 Oct 2007 14:11:04 -0000
Subject: [llvm-commits] [llvm] r42634 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Message-ID: <200710051411.l95EB4p8020196@zion.cs.uiuc.edu>
Author: djg
Date: Fri Oct 5 09:11:04 2007
New Revision: 42634
URL: http://llvm.org/viewvc/llvm-project?rev=42634&view=rev
Log:
Provide names for MUL_LOHI and DIVREM operators.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=42634&r1=42633&r2=42634&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Oct 5 09:11:04 2007
@@ -3571,6 +3571,10 @@
case ISD::UDIV: return "udiv";
case ISD::SREM: return "srem";
case ISD::UREM: return "urem";
+ case ISD::SMUL_LOHI: return "smul_lohi";
+ case ISD::UMUL_LOHI: return "umul_lohi";
+ case ISD::SDIVREM: return "sdivrem";
+ case ISD::UDIVREM: return "divrem";
case ISD::AND: return "and";
case ISD::OR: return "or";
case ISD::XOR: return "xor";
From djg at cray.com Fri Oct 5 09:11:58 2007
From: djg at cray.com (Dan Gohman)
Date: Fri, 05 Oct 2007 14:11:58 -0000
Subject: [llvm-commits] [llvm] r42635 -
/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Message-ID: <200710051411.l95EBw5O020233@zion.cs.uiuc.edu>
Author: djg
Date: Fri Oct 5 09:11:58 2007
New Revision: 42635
URL: http://llvm.org/viewvc/llvm-project?rev=42635&view=rev
Log:
Fix a typo in a comment.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=42635&r1=42634&r2=42635&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Fri Oct 5 09:11:58 2007
@@ -1301,7 +1301,7 @@
I != E; ++I) {
if (I->isCtrl) continue;
SUnit *SuccSU = I->Dep;
- // Don't constraint nodes with implicit defs. It can create cycles
+ // Don't constrain nodes with implicit defs. It can create cycles
// plus it may increase register pressures.
if (SuccSU == SU || SuccSU->hasPhysRegDefs)
continue;
From djg at cray.com Fri Oct 5 09:17:22 2007
From: djg at cray.com (Dan Gohman)
Date: Fri, 05 Oct 2007 14:17:22 -0000
Subject: [llvm-commits] [llvm] r42636 -
/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Message-ID: <200710051417.l95EHMkQ020380@zion.cs.uiuc.edu>
Author: djg
Date: Fri Oct 5 09:17:22 2007
New Revision: 42636
URL: http://llvm.org/viewvc/llvm-project?rev=42636&view=rev
Log:
Legalize support for MUL_LOHI and DIVREM.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42636&r1=42635&r2=42636&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Oct 5 09:17:22 2007
@@ -2630,6 +2630,16 @@
}
break;
+ case ISD::SMUL_LOHI:
+ case ISD::UMUL_LOHI:
+ case ISD::SDIVREM:
+ case ISD::UDIVREM:
+ // These nodes will only be produced by target-specific lowering, so
+ // they shouldn't be here if they aren't legal.
+ assert(TLI.isOperationLegal(Node->getValueType(0), Node->getValueType(0)) &&
+ "This must be legal!");
+ break;
+
case ISD::FCOPYSIGN: // FCOPYSIGN does not require LHS/RHS to match type!
Tmp1 = LegalizeOp(Node->getOperand(0)); // LHS
switch (getTypeAction(Node->getOperand(1).getValueType())) {
From djg at cray.com Fri Oct 5 10:54:58 2007
From: djg at cray.com (Dan Gohman)
Date: Fri, 05 Oct 2007 15:54:58 -0000
Subject: [llvm-commits] [llvm] r42637 -
/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
Message-ID: <200710051554.l95Fswwq023862@zion.cs.uiuc.edu>
Author: djg
Date: Fri Oct 5 10:54:58 2007
New Revision: 42637
URL: http://llvm.org/viewvc/llvm-project?rev=42637&view=rev
Log:
Change a space to a tab in the assembly output of a .globl directive
for consistency.
Modified:
llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=42637&r1=42636&r2=42637&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Fri Oct 5 10:54:58 2007
@@ -126,7 +126,7 @@
O << "\t.weak_definition\t" << CurrentFnName << "\n";
} else if (Subtarget->isTargetCygMing()) {
EmitAlignment(4, F); // FIXME: This should be parameterized somewhere.
- O << "\t.globl " << CurrentFnName << "\n";
+ O << "\t.globl\t" << CurrentFnName << "\n";
O << "\t.linkonce discard\n";
} else {
EmitAlignment(4, F); // FIXME: This should be parameterized somewhere.
From djg at cray.com Fri Oct 5 10:58:41 2007
From: djg at cray.com (Dan Gohman)
Date: Fri, 05 Oct 2007 15:58:41 -0000
Subject: [llvm-commits] [llvm] r42638 -
/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
Message-ID: <200710051558.l95FwfH9024048@zion.cs.uiuc.edu>
Author: djg
Date: Fri Oct 5 10:58:41 2007
New Revision: 42638
URL: http://llvm.org/viewvc/llvm-project?rev=42638&view=rev
Log:
Change a few more spaces to tabs in assembly output.
Modified:
llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=42638&r1=42637&r2=42638&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Fri Oct 5 10:58:41 2007
@@ -213,7 +213,7 @@
case GlobalValue::LinkOnceLinkage:
case GlobalValue::WeakLinkage:
if (Subtarget->isTargetDarwin()) {
- O << "\t.globl " << name << "\n"
+ O << "\t.globl\t" << name << "\n"
<< "\t.weak_definition " << name << "\n";
SwitchToDataSection(".section __DATA,__const_coal,coalesced", I);
} else if (Subtarget->isTargetCygMing()) {
@@ -221,7 +221,7 @@
name +
",\"aw\"");
SwitchToDataSection(SectionName.c_str(), I);
- O << "\t.globl " << name << "\n"
+ O << "\t.globl\t" << name << "\n"
<< "\t.linkonce same_size\n";
} else {
std::string SectionName("\t.section\t.llvm.linkonce.d." +
@@ -239,7 +239,7 @@
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol
- O << "\t.globl " << name << "\n";
+ O << "\t.globl\t" << name << "\n";
// FALL THROUGH
case GlobalValue::InternalLinkage: {
if (I->isConstant()) {
From sabre at nondot.org Fri Oct 5 12:40:39 2007
From: sabre at nondot.org (Chris Lattner)
Date: Fri, 05 Oct 2007 17:40:39 -0000
Subject: [llvm-commits] [llvm] r42639 -
/llvm/trunk/include/llvm/ADT/DenseSet.h
Message-ID: <200710051740.l95Heddo029366@zion.cs.uiuc.edu>
Author: lattner
Date: Fri Oct 5 12:40:38 2007
New Revision: 42639
URL: http://llvm.org/viewvc/llvm-project?rev=42639&view=rev
Log:
Mark count method const.
Modified:
llvm/trunk/include/llvm/ADT/DenseSet.h
Modified: llvm/trunk/include/llvm/ADT/DenseSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseSet.h?rev=42639&r1=42638&r2=42639&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseSet.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseSet.h Fri Oct 5 12:40:38 2007
@@ -38,7 +38,7 @@
TheMap.clear();
}
- bool count(const ValueT &V) {
+ bool count(const ValueT &V) const {
return TheMap.count(V);
}
From evan.cheng at apple.com Fri Oct 5 12:59:57 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 17:59:57 -0000
Subject: [llvm-commits] [llvm] r42640 - in /llvm/trunk/lib/Target/X86:
X86InstrInfo.td X86InstrX86-64.td
Message-ID: <200710051759.l95Hxv6X030523@zion.cs.uiuc.edu>
Author: evancheng
Date: Fri Oct 5 12:59:57 2007
New Revision: 42640
URL: http://llvm.org/viewvc/llvm-project?rev=42640&view=rev
Log:
ADC and SBB uses EFLAGS.
Modified:
llvm/trunk/lib/Target/X86/X86InstrInfo.td
llvm/trunk/lib/Target/X86/X86InstrX86-64.td
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=42640&r1=42639&r2=42640&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Oct 5 12:59:57 2007
@@ -1853,6 +1853,7 @@
[(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
}
+let Uses = [EFLAGS] in {
let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"adc{l}\t{$src2, $dst|$dst, $src2}",
@@ -1879,6 +1880,7 @@
"adc{l}\t{$src2, $dst|$dst, $src2}",
[(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
}
+} // Uses = [EFLAGS]
def SUB8rr : I<0x28, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
"sub{b}\t{$src2, $dst|$dst, $src2}",
@@ -1945,6 +1947,7 @@
[(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
}
+let Uses = [EFLAGS] in {
def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"sbb{l}\t{$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
@@ -1972,6 +1975,7 @@
def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
"sbb{l}\t{$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>;
+} // Uses = [EFLAGS]
} // Defs = [EFLAGS]
let Defs = [EFLAGS] in {
Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=42640&r1=42639&r2=42640&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Oct 5 12:59:57 2007
@@ -262,6 +262,7 @@
"add{q}\t{$src2, $dst|$dst, $src2}",
[(store (add (load addr:$dst), i64immSExt8:$src2), addr:$dst)]>;
+let Uses = [EFLAGS] in {
let isTwoAddress = 1 in {
let isCommutable = 1 in
def ADC64rr : RI<0x11, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
@@ -289,6 +290,7 @@
def ADC64mi8 : RIi8<0x83, MRM2m, (outs), (ins i64mem:$dst, i64i8imm :$src2),
"adc{q}\t{$src2, $dst|$dst, $src2}",
[(store (adde (load addr:$dst), i64immSExt8:$src2), addr:$dst)]>;
+} // Uses = [EFLAGS]
let isTwoAddress = 1 in {
def SUB64rr : RI<0x29, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
@@ -317,6 +319,7 @@
"sub{q}\t{$src2, $dst|$dst, $src2}",
[(store (sub (load addr:$dst), i64immSExt8:$src2), addr:$dst)]>;
+let Uses = [EFLAGS] in {
let isTwoAddress = 1 in {
def SBB64rr : RI<0x19, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
"sbb{q}\t{$src2, $dst|$dst, $src2}",
@@ -343,6 +346,7 @@
def SBB64mi8 : RIi8<0x83, MRM3m, (outs), (ins i64mem:$dst, i64i8imm :$src2),
"sbb{q}\t{$src2, $dst|$dst, $src2}",
[(store (sube (load addr:$dst), i64immSExt8:$src2), addr:$dst)]>;
+} // Uses = [EFLAGS]
} // Defs = [EFLAGS]
// Unsigned multiplication
From evan.cheng at apple.com Fri Oct 5 13:20:36 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 18:20:36 -0000
Subject: [llvm-commits] [llvm] r42642 - in /llvm/trunk/lib/Target/X86:
X86InstrInfo.cpp X86InstrX86-64.td
Message-ID: <200710051820.l95IKaaV031541@zion.cs.uiuc.edu>
Author: evancheng
Date: Fri Oct 5 13:20:36 2007
New Revision: 42642
URL: http://llvm.org/viewvc/llvm-project?rev=42642&view=rev
Log:
Add support to convert more 64-bit instructions to 3-address instructions.
Modified:
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
llvm/trunk/lib/Target/X86/X86InstrX86-64.td
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=42642&r1=42641&r2=42642&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Oct 5 13:20:36 2007
@@ -277,39 +277,54 @@
if (!hasLiveCondCodeDef(MI))
switch (MI->getOpcode()) {
+ case X86::INC64r:
case X86::INC32r:
- case X86::INC64_32r:
+ case X86::INC64_32r: {
assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!");
- NewMI = addRegOffset(BuildMI(get(X86::LEA32r), Dest), Src, 1);
+ unsigned Opc = MI->getOpcode() == X86::INC64r ? X86::LEA64r : X86::LEA32r;
+ NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, 1);
break;
+ }
case X86::INC16r:
case X86::INC64_16r:
if (DisableLEA16) return 0;
assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!");
NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, 1);
break;
+ case X86::DEC64r:
case X86::DEC32r:
- case X86::DEC64_32r:
+ case X86::DEC64_32r: {
assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!");
- NewMI = addRegOffset(BuildMI(get(X86::LEA32r), Dest), Src, -1);
+ unsigned Opc = MI->getOpcode() == X86::DEC64r ? X86::LEA64r : X86::LEA32r;
+ NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, -1);
break;
+ }
case X86::DEC16r:
case X86::DEC64_16r:
if (DisableLEA16) return 0;
assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!");
NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, -1);
break;
- case X86::ADD32rr:
+ case X86::ADD64rr:
+ case X86::ADD32rr: {
assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
- NewMI = addRegReg(BuildMI(get(X86::LEA32r), Dest), Src,
- MI->getOperand(2).getReg());
+ unsigned Opc = MI->getOpcode() == X86::ADD64rr ? X86::LEA64r : X86::LEA32r;
+ NewMI = addRegReg(BuildMI(get(Opc), Dest), Src, MI->getOperand(2).getReg());
break;
+ }
case X86::ADD16rr:
if (DisableLEA16) return 0;
assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
NewMI = addRegReg(BuildMI(get(X86::LEA16r), Dest), Src,
MI->getOperand(2).getReg());
break;
+ case X86::ADD64ri32:
+ case X86::ADD64ri8:
+ assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
+ if (MI->getOperand(2).isImmediate())
+ NewMI = addRegOffset(BuildMI(get(X86::LEA64r), Dest), Src,
+ MI->getOperand(2).getImmedValue());
+ break;
case X86::ADD32ri:
case X86::ADD32ri8:
assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
@@ -328,6 +343,7 @@
case X86::SHL16ri:
if (DisableLEA16) return 0;
case X86::SHL32ri:
+ case X86::SHL64ri:
assert(MI->getNumOperands() >= 3 && MI->getOperand(2).isImmediate() &&
"Unknown shl instruction!");
unsigned ShAmt = MI->getOperand(2).getImmedValue();
@@ -335,7 +351,8 @@
X86AddressMode AM;
AM.Scale = 1 << ShAmt;
AM.IndexReg = Src;
- unsigned Opc = MI->getOpcode() == X86::SHL32ri ? X86::LEA32r :X86::LEA16r;
+ unsigned Opc = MI->getOpcode() == X86::SHL64ri ? X86::LEA64r
+ : (MI->getOpcode() == X86::SHL32ri ? X86::LEA32r : X86::LEA16r);
NewMI = addFullAddress(BuildMI(get(Opc), Dest), AM);
}
break;
Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=42642&r1=42641&r2=42642&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Oct 5 13:20:36 2007
@@ -454,6 +454,7 @@
def SHL64rCL : RI<0xD3, MRM4r, (outs GR64:$dst), (ins GR64:$src),
"shl{q}\t{%cl, $dst|$dst, %CL}",
[(set GR64:$dst, (shl GR64:$src, CL))]>;
+let isConvertibleToThreeAddress = 1 in // Can transform into LEA.
def SHL64ri : RIi8<0xC1, MRM4r, (outs GR64:$dst), (ins GR64:$src1, i8imm:$src2),
"shl{q}\t{$src2, $dst|$dst, $src2}",
[(set GR64:$dst, (shl GR64:$src1, (i8 imm:$src2)))]>;
From dalej at apple.com Fri Oct 5 15:04:43 2007
From: dalej at apple.com (Dale Johannesen)
Date: Fri, 05 Oct 2007 20:04:43 -0000
Subject: [llvm-commits] [llvm] r42644 - in /llvm/trunk:
include/llvm/CodeGen/RuntimeLibcalls.h
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/TargetLowering.cpp
lib/Target/PowerPC/PPCCallingConv.td lib/Target/PowerPC/PPCISelLowering.cpp
test/CodeGen/PowerPC/ppcf128-1-opt.ll test/CodeGen/PowerPC/ppcf128-1.ll
Message-ID: <200710052004.l95K4h1K004890@zion.cs.uiuc.edu>
Author: johannes
Date: Fri Oct 5 15:04:43 2007
New Revision: 42644
URL: http://llvm.org/viewvc/llvm-project?rev=42644&view=rev
Log:
First round of ppc long double. call/return and
basic arithmetic works.
Rename RTLIB long double functions to distinguish
different flavors of long double; the lib functions
have different names, alas.
Added:
llvm/trunk/test/CodeGen/PowerPC/ppcf128-1-opt.ll
llvm/trunk/test/CodeGen/PowerPC/ppcf128-1.ll
Modified:
llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
Modified: llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h?rev=42644&r1=42643&r2=42644&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h (original)
+++ llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h Fri Oct 5 15:04:43 2007
@@ -18,9 +18,8 @@
namespace llvm {
namespace RTLIB {
/// RTLIB::Libcall enum - This enum defines all of the runtime library calls
- /// the backend can emit. "LD" is used for all long double types, since
- /// these functions will have the same interface on different targets even
- /// though the data is not in the same format.
+ /// the backend can emit. The various long double types cannot be merged,
+ /// because 80-bit library functions use "xf" and 128-bit use "tf".
///
enum Libcall {
// Integer
@@ -46,22 +45,29 @@
// FLOATING POINT
ADD_F32,
ADD_F64,
+ ADD_PPCF128,
SUB_F32,
SUB_F64,
+ SUB_PPCF128,
MUL_F32,
MUL_F64,
+ MUL_PPCF128,
DIV_F32,
DIV_F64,
+ DIV_PPCF128,
REM_F32,
REM_F64,
+ REM_PPCF128,
NEG_F32,
NEG_F64,
POWI_F32,
POWI_F64,
- POWI_LD,
+ POWI_F80,
+ POWI_PPCF128,
SQRT_F32,
SQRT_F64,
- SQRT_LD,
+ SQRT_F80,
+ SQRT_PPCF128,
SIN_F32,
SIN_F64,
COS_F32,
@@ -74,18 +80,21 @@
FPTOSINT_F32_I64,
FPTOSINT_F64_I32,
FPTOSINT_F64_I64,
- FPTOSINT_LD_I64,
+ FPTOSINT_F80_I64,
+ FPTOSINT_PPCF128_I64,
FPTOUINT_F32_I32,
FPTOUINT_F32_I64,
FPTOUINT_F64_I32,
FPTOUINT_F64_I64,
- FPTOUINT_LD_I32,
- FPTOUINT_LD_I64,
+ FPTOUINT_F80_I32,
+ FPTOUINT_F80_I64,
+ FPTOUINT_PPCF128_I64,
SINTTOFP_I32_F32,
SINTTOFP_I32_F64,
SINTTOFP_I64_F32,
SINTTOFP_I64_F64,
- SINTTOFP_I64_LD,
+ SINTTOFP_I64_F80,
+ SINTTOFP_I64_PPCF128,
UINTTOFP_I32_F32,
UINTTOFP_I32_F64,
UINTTOFP_I64_F32,
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42644&r1=42643&r2=42644&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Oct 5 15:04:43 2007
@@ -3055,7 +3055,10 @@
switch(Node->getOpcode()) {
case ISD::FSQRT:
LC = VT == MVT::f32 ? RTLIB::SQRT_F32 :
- VT == MVT::f64 ? RTLIB::SQRT_F64 : RTLIB::SQRT_LD;
+ VT == MVT::f64 ? RTLIB::SQRT_F64 :
+ VT == MVT::f80 ? RTLIB::SQRT_F80 :
+ VT == MVT::ppcf128 ? RTLIB::SQRT_PPCF128 :
+ RTLIB::UNKNOWN_LIBCALL;
break;
case ISD::FSIN:
LC = VT == MVT::f32 ? RTLIB::SIN_F32 : RTLIB::SIN_F64;
@@ -3079,7 +3082,9 @@
RTLIB::Libcall LC =
Node->getValueType(0) == MVT::f32 ? RTLIB::POWI_F32 :
Node->getValueType(0) == MVT::f64 ? RTLIB::POWI_F64 :
- RTLIB::POWI_LD;
+ Node->getValueType(0) == MVT::f80 ? RTLIB::POWI_F80 :
+ Node->getValueType(0) == MVT::ppcf128 ? RTLIB::POWI_PPCF128 :
+ RTLIB::UNKNOWN_LIBCALL;
SDOperand Dummy;
Result = ExpandLibCall(TLI.getLibcallName(LC), Node,
false/*sign irrelevant*/, Dummy);
@@ -3261,9 +3266,13 @@
else if (OVT == MVT::f64)
LC = (VT == MVT::i32)
? RTLIB::FPTOSINT_F64_I32 : RTLIB::FPTOSINT_F64_I64;
- else if (OVT == MVT::f80 || OVT == MVT::f128 || OVT == MVT::ppcf128) {
+ else if (OVT == MVT::f80) {
assert(VT == MVT::i64);
- LC = RTLIB::FPTOSINT_LD_I64;
+ LC = RTLIB::FPTOSINT_F80_I64;
+ }
+ else if (OVT == MVT::ppcf128) {
+ assert(VT == MVT::i64);
+ LC = RTLIB::FPTOSINT_PPCF128_I64;
}
break;
}
@@ -3275,9 +3284,13 @@
else if (OVT == MVT::f64)
LC = (VT == MVT::i32)
? RTLIB::FPTOUINT_F64_I32 : RTLIB::FPTOSINT_F64_I64;
- else if (OVT == MVT::f80 || OVT == MVT::f128 || OVT == MVT::ppcf128) {
+ else if (OVT == MVT::f80) {
LC = (VT == MVT::i32)
- ? RTLIB::FPTOUINT_LD_I32 : RTLIB::FPTOUINT_LD_I64;
+ ? RTLIB::FPTOUINT_F80_I32 : RTLIB::FPTOUINT_F80_I64;
+ }
+ else if (OVT == MVT::ppcf128) {
+ assert(VT == MVT::i64);
+ LC = RTLIB::FPTOUINT_PPCF128_I64;
}
break;
}
@@ -5375,13 +5388,15 @@
}
}
- RTLIB::Libcall LC;
+ RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
if (Node->getOperand(0).getValueType() == MVT::f32)
LC = RTLIB::FPTOSINT_F32_I64;
else if (Node->getOperand(0).getValueType() == MVT::f64)
LC = RTLIB::FPTOSINT_F64_I64;
- else
- LC = RTLIB::FPTOSINT_LD_I64;
+ else if (Node->getOperand(0).getValueType() == MVT::f80)
+ LC = RTLIB::FPTOSINT_F80_I64;
+ else if (Node->getOperand(0).getValueType() == MVT::ppcf128)
+ LC = RTLIB::FPTOSINT_PPCF128_I64;
Lo = ExpandLibCall(TLI.getLibcallName(LC), Node,
false/*sign irrelevant*/, Hi);
break;
@@ -5410,10 +5425,10 @@
LC = RTLIB::FPTOUINT_F32_I64;
else if (Node->getOperand(0).getValueType() == MVT::f64)
LC = RTLIB::FPTOUINT_F64_I64;
- else if (Node->getOperand(0).getValueType() == MVT::f80 ||
- Node->getOperand(0).getValueType() == MVT::f128 ||
- Node->getOperand(0).getValueType() == MVT::ppcf128)
- LC = RTLIB::FPTOUINT_LD_I64;
+ else if (Node->getOperand(0).getValueType() == MVT::f80)
+ LC = RTLIB::FPTOUINT_F80_I64;
+ else if (Node->getOperand(0).getValueType() == MVT::ppcf128)
+ LC = RTLIB::FPTOUINT_PPCF128_I64;
Lo = ExpandLibCall(TLI.getLibcallName(LC), Node,
false/*sign irrelevant*/, Hi);
break;
@@ -5679,23 +5694,35 @@
break;
case ISD::FADD:
- Lo = ExpandLibCall(TLI.getLibcallName((VT == MVT::f32)
- ? RTLIB::ADD_F32 : RTLIB::ADD_F64),
+ Lo = ExpandLibCall(TLI.getLibcallName(VT == MVT::f32 ? RTLIB::ADD_F32 :
+ VT == MVT::f64 ? RTLIB::ADD_F64 :
+ VT == MVT::ppcf128 ?
+ RTLIB::ADD_PPCF128 :
+ RTLIB::UNKNOWN_LIBCALL),
Node, false, Hi);
break;
case ISD::FSUB:
- Lo = ExpandLibCall(TLI.getLibcallName((VT == MVT::f32)
- ? RTLIB::SUB_F32 : RTLIB::SUB_F64),
+ Lo = ExpandLibCall(TLI.getLibcallName(VT == MVT::f32 ? RTLIB::SUB_F32 :
+ VT == MVT::f64 ? RTLIB::SUB_F64 :
+ VT == MVT::ppcf128 ?
+ RTLIB::SUB_PPCF128 :
+ RTLIB::UNKNOWN_LIBCALL),
Node, false, Hi);
break;
case ISD::FMUL:
- Lo = ExpandLibCall(TLI.getLibcallName((VT == MVT::f32)
- ? RTLIB::MUL_F32 : RTLIB::MUL_F64),
+ Lo = ExpandLibCall(TLI.getLibcallName(VT == MVT::f32 ? RTLIB::MUL_F32 :
+ VT == MVT::f64 ? RTLIB::MUL_F64 :
+ VT == MVT::ppcf128 ?
+ RTLIB::MUL_PPCF128 :
+ RTLIB::UNKNOWN_LIBCALL),
Node, false, Hi);
break;
case ISD::FDIV:
- Lo = ExpandLibCall(TLI.getLibcallName((VT == MVT::f32)
- ? RTLIB::DIV_F32 : RTLIB::DIV_F64),
+ Lo = ExpandLibCall(TLI.getLibcallName(VT == MVT::f32 ? RTLIB::DIV_F32 :
+ VT == MVT::f64 ? RTLIB::DIV_F64 :
+ VT == MVT::ppcf128 ?
+ RTLIB::DIV_PPCF128 :
+ RTLIB::UNKNOWN_LIBCALL),
Node, false, Hi);
break;
case ISD::FP_EXTEND:
@@ -5707,7 +5734,10 @@
case ISD::FPOWI:
Lo = ExpandLibCall(TLI.getLibcallName((VT == MVT::f32) ? RTLIB::POWI_F32 :
(VT == MVT::f64) ? RTLIB::POWI_F64 :
- RTLIB::POWI_LD),
+ (VT == MVT::f80) ? RTLIB::POWI_F80 :
+ (VT == MVT::ppcf128) ?
+ RTLIB::POWI_PPCF128 :
+ RTLIB::UNKNOWN_LIBCALL),
Node, false, Hi);
break;
case ISD::FSQRT:
@@ -5717,7 +5747,10 @@
switch(Node->getOpcode()) {
case ISD::FSQRT:
LC = (VT == MVT::f32) ? RTLIB::SQRT_F32 :
- (VT == MVT::f64) ? RTLIB::SQRT_F64 : RTLIB::SQRT_LD;
+ (VT == MVT::f64) ? RTLIB::SQRT_F64 :
+ (VT == MVT::f80) ? RTLIB::SQRT_F80 :
+ (VT == MVT::ppcf128) ? RTLIB::SQRT_PPCF128 :
+ RTLIB::UNKNOWN_LIBCALL;
break;
case ISD::FSIN:
LC = (VT == MVT::f32) ? RTLIB::SIN_F32 : RTLIB::SIN_F64;
@@ -5768,9 +5801,13 @@
LC = isSigned ? RTLIB::SINTTOFP_I64_F32 : RTLIB::UINTTOFP_I64_F32;
else if (VT == MVT::f64)
LC = isSigned ? RTLIB::SINTTOFP_I64_F64 : RTLIB::UINTTOFP_I64_F64;
- else if (VT == MVT::f80 || VT == MVT::f128 || VT == MVT::ppcf128) {
+ else if (VT == MVT::f80) {
+ assert(isSigned);
+ LC = RTLIB::SINTTOFP_I64_F80;
+ }
+ else if (VT == MVT::ppcf128) {
assert(isSigned);
- LC = RTLIB::SINTTOFP_I64_LD;
+ LC = RTLIB::SINTTOFP_I64_PPCF128;
}
} else {
if (VT == MVT::f32)
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=42644&r1=42643&r2=42644&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri Oct 5 15:04:43 2007
@@ -46,22 +46,29 @@
Names[RTLIB::NEG_I64] = "__negdi2";
Names[RTLIB::ADD_F32] = "__addsf3";
Names[RTLIB::ADD_F64] = "__adddf3";
+ Names[RTLIB::ADD_PPCF128] = "__gcc_qadd";
Names[RTLIB::SUB_F32] = "__subsf3";
Names[RTLIB::SUB_F64] = "__subdf3";
+ Names[RTLIB::SUB_PPCF128] = "__gcc_qsub";
Names[RTLIB::MUL_F32] = "__mulsf3";
Names[RTLIB::MUL_F64] = "__muldf3";
+ Names[RTLIB::MUL_PPCF128] = "__gcc_qmul";
Names[RTLIB::DIV_F32] = "__divsf3";
Names[RTLIB::DIV_F64] = "__divdf3";
+ Names[RTLIB::DIV_PPCF128] = "__gcc_qdiv";
Names[RTLIB::REM_F32] = "fmodf";
Names[RTLIB::REM_F64] = "fmod";
+ Names[RTLIB::REM_PPCF128] = "fmodl";
Names[RTLIB::NEG_F32] = "__negsf2";
Names[RTLIB::NEG_F64] = "__negdf2";
Names[RTLIB::POWI_F32] = "__powisf2";
Names[RTLIB::POWI_F64] = "__powidf2";
- Names[RTLIB::POWI_LD] = "__powixf2";
+ Names[RTLIB::POWI_F80] = "__powixf2";
+ Names[RTLIB::POWI_PPCF128] = "__powitf2";
Names[RTLIB::SQRT_F32] = "sqrtf";
Names[RTLIB::SQRT_F64] = "sqrt";
- Names[RTLIB::SQRT_LD] = "sqrtl";
+ Names[RTLIB::SQRT_F80] = "sqrtl";
+ Names[RTLIB::SQRT_PPCF128] = "sqrtl";
Names[RTLIB::SIN_F32] = "sinf";
Names[RTLIB::SIN_F64] = "sin";
Names[RTLIB::COS_F32] = "cosf";
@@ -72,18 +79,21 @@
Names[RTLIB::FPTOSINT_F32_I64] = "__fixsfdi";
Names[RTLIB::FPTOSINT_F64_I32] = "__fixdfsi";
Names[RTLIB::FPTOSINT_F64_I64] = "__fixdfdi";
- Names[RTLIB::FPTOSINT_LD_I64] = "__fixxfdi";
+ Names[RTLIB::FPTOSINT_F80_I64] = "__fixxfdi";
+ Names[RTLIB::FPTOSINT_PPCF128_I64] = "__fixtfdi";
Names[RTLIB::FPTOUINT_F32_I32] = "__fixunssfsi";
Names[RTLIB::FPTOUINT_F32_I64] = "__fixunssfdi";
Names[RTLIB::FPTOUINT_F64_I32] = "__fixunsdfsi";
Names[RTLIB::FPTOUINT_F64_I64] = "__fixunsdfdi";
- Names[RTLIB::FPTOUINT_LD_I32] = "__fixunsxfsi";
- Names[RTLIB::FPTOUINT_LD_I64] = "__fixunsxfdi";
+ Names[RTLIB::FPTOUINT_F80_I32] = "__fixunsxfsi";
+ Names[RTLIB::FPTOUINT_F80_I64] = "__fixunsxfdi";
+ Names[RTLIB::FPTOUINT_PPCF128_I64] = "__fixunstfdi";
Names[RTLIB::SINTTOFP_I32_F32] = "__floatsisf";
Names[RTLIB::SINTTOFP_I32_F64] = "__floatsidf";
Names[RTLIB::SINTTOFP_I64_F32] = "__floatdisf";
Names[RTLIB::SINTTOFP_I64_F64] = "__floatdidf";
- Names[RTLIB::SINTTOFP_I64_LD] = "__floatdixf";
+ Names[RTLIB::SINTTOFP_I64_F80] = "__floatdixf";
+ Names[RTLIB::SINTTOFP_I64_PPCF128] = "__floatditf";
Names[RTLIB::UINTTOFP_I32_F32] = "__floatunsisf";
Names[RTLIB::UINTTOFP_I32_F64] = "__floatunsidf";
Names[RTLIB::UINTTOFP_I64_F32] = "__floatundisf";
@@ -222,6 +232,14 @@
}
}
+ // ppcf128 type is really two f64's.
+ if (!isTypeLegal(MVT::ppcf128)) {
+ NumRegistersForVT[MVT::ppcf128] = 2*NumRegistersForVT[MVT::f64];
+ RegisterTypeForVT[MVT::ppcf128] = MVT::f64;
+ TransformToType[MVT::ppcf128] = MVT::f64;
+ ValueTypeActions.setTypeAction(MVT::ppcf128, Expand);
+ }
+
// Decide how to handle f64. If the target does not have native f64 support,
// expand it to i64 and we will be generating soft float library calls.
if (!isTypeLegal(MVT::f64)) {
Modified: llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td?rev=42644&r1=42643&r2=42644&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCCallingConv.td Fri Oct 5 15:04:43 2007
@@ -25,7 +25,8 @@
CCIfType<[i32], CCAssignToReg<[R3, R4]>>,
CCIfType<[i64], CCAssignToReg<[X3, X4]>>,
- CCIfType<[f32, f64], CCAssignToReg<[F1]>>,
+ CCIfType<[f32], CCAssignToReg<[F1]>>,
+ CCIfType<[f64], CCAssignToReg<[F1, F2]>>,
// Vector types are always returned in V2.
CCIfType<[v16i8, v8i16, v4i32, v4f32], CCAssignToReg<[V2]>>
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=42644&r1=42643&r2=42644&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Oct 5 15:04:43 2007
@@ -1812,8 +1812,20 @@
NumResults = 1;
NodeTys.push_back(MVT::i64);
break;
- case MVT::f32:
case MVT::f64:
+ if (Op.Val->getValueType(1) == MVT::f64) {
+ Chain = DAG.getCopyFromReg(Chain, PPC::F1, MVT::f64, InFlag).getValue(1);
+ ResultVals[0] = Chain.getValue(0);
+ Chain = DAG.getCopyFromReg(Chain, PPC::F2, MVT::f64,
+ Chain.getValue(2)).getValue(1);
+ ResultVals[1] = Chain.getValue(0);
+ NumResults = 2;
+ NodeTys.push_back(MVT::f64);
+ NodeTys.push_back(MVT::f64);
+ break;
+ }
+ // else fall through
+ case MVT::f32:
Chain = DAG.getCopyFromReg(Chain, PPC::F1, Op.Val->getValueType(0),
InFlag).getValue(1);
ResultVals[0] = Chain.getValue(0);
Added: llvm/trunk/test/CodeGen/PowerPC/ppcf128-1-opt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppcf128-1-opt.ll?rev=42644&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/ppcf128-1-opt.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/ppcf128-1-opt.ll Fri Oct 5 15:04:43 2007
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | llc > %t
+; ModuleID = ''
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
+target triple = "powerpc-apple-darwin8"
+
+define ppc_fp128 @plus(ppc_fp128 %x, ppc_fp128 %y) {
+entry:
+ %tmp3 = add ppc_fp128 %x, %y ; [#uses=1]
+ ret ppc_fp128 %tmp3
+}
+
+define ppc_fp128 @minus(ppc_fp128 %x, ppc_fp128 %y) {
+entry:
+ %tmp3 = sub ppc_fp128 %x, %y ; [#uses=1]
+ ret ppc_fp128 %tmp3
+}
+
+define ppc_fp128 @times(ppc_fp128 %x, ppc_fp128 %y) {
+entry:
+ %tmp3 = mul ppc_fp128 %x, %y ; [#uses=1]
+ ret ppc_fp128 %tmp3
+}
+
+define ppc_fp128 @divide(ppc_fp128 %x, ppc_fp128 %y) {
+entry:
+ %tmp3 = fdiv ppc_fp128 %x, %y ; [#uses=1]
+ ret ppc_fp128 %tmp3
+}
+
Added: llvm/trunk/test/CodeGen/PowerPC/ppcf128-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppcf128-1.ll?rev=42644&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/ppcf128-1.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/ppcf128-1.ll Fri Oct 5 15:04:43 2007
@@ -0,0 +1,92 @@
+; RUN: llvm-as < %s | opt -std-compile-opts | llc > %t
+; ModuleID = 'ld3.c'
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
+target triple = "powerpc-apple-darwin8"
+
+define ppc_fp128 @plus(ppc_fp128 %x, ppc_fp128 %y) {
+entry:
+ %x_addr = alloca ppc_fp128 ; [#uses=2]
+ %y_addr = alloca ppc_fp128 ; [#uses=2]
+ %retval = alloca ppc_fp128, align 16 ; [#uses=2]
+ %tmp = alloca ppc_fp128, align 16 ; [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
+ store ppc_fp128 %x, ppc_fp128* %x_addr
+ store ppc_fp128 %y, ppc_fp128* %y_addr
+ %tmp1 = load ppc_fp128* %x_addr, align 16 ; [#uses=1]
+ %tmp2 = load ppc_fp128* %y_addr, align 16 ; [#uses=1]
+ %tmp3 = add ppc_fp128 %tmp1, %tmp2 ; [#uses=1]
+ store ppc_fp128 %tmp3, ppc_fp128* %tmp, align 16
+ %tmp4 = load ppc_fp128* %tmp, align 16 ; [#uses=1]
+ store ppc_fp128 %tmp4, ppc_fp128* %retval, align 16
+ br label %return
+
+return: ; preds = %entry
+ %retval5 = load ppc_fp128* %retval ; [#uses=1]
+ ret ppc_fp128 %retval5
+}
+
+define ppc_fp128 @minus(ppc_fp128 %x, ppc_fp128 %y) {
+entry:
+ %x_addr = alloca ppc_fp128 ; [#uses=2]
+ %y_addr = alloca ppc_fp128 ; [#uses=2]
+ %retval = alloca ppc_fp128, align 16 ; [#uses=2]
+ %tmp = alloca ppc_fp128, align 16 ; [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
+ store ppc_fp128 %x, ppc_fp128* %x_addr
+ store ppc_fp128 %y, ppc_fp128* %y_addr
+ %tmp1 = load ppc_fp128* %x_addr, align 16 ; [#uses=1]
+ %tmp2 = load ppc_fp128* %y_addr, align 16 ; [#uses=1]
+ %tmp3 = sub ppc_fp128 %tmp1, %tmp2 ; [#uses=1]
+ store ppc_fp128 %tmp3, ppc_fp128* %tmp, align 16
+ %tmp4 = load ppc_fp128* %tmp, align 16 ; [#uses=1]
+ store ppc_fp128 %tmp4, ppc_fp128* %retval, align 16
+ br label %return
+
+return: ; preds = %entry
+ %retval5 = load ppc_fp128* %retval ; [#uses=1]
+ ret ppc_fp128 %retval5
+}
+
+define ppc_fp128 @times(ppc_fp128 %x, ppc_fp128 %y) {
+entry:
+ %x_addr = alloca ppc_fp128 ; [#uses=2]
+ %y_addr = alloca ppc_fp128 ; [#uses=2]
+ %retval = alloca ppc_fp128, align 16 ; [#uses=2]
+ %tmp = alloca ppc_fp128, align 16 ; [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
+ store ppc_fp128 %x, ppc_fp128* %x_addr
+ store ppc_fp128 %y, ppc_fp128* %y_addr
+ %tmp1 = load ppc_fp128* %x_addr, align 16 ; [#uses=1]
+ %tmp2 = load ppc_fp128* %y_addr, align 16 ; [#uses=1]
+ %tmp3 = mul ppc_fp128 %tmp1, %tmp2 ; [#uses=1]
+ store ppc_fp128 %tmp3, ppc_fp128* %tmp, align 16
+ %tmp4 = load ppc_fp128* %tmp, align 16 ; [#uses=1]
+ store ppc_fp128 %tmp4, ppc_fp128* %retval, align 16
+ br label %return
+
+return: ; preds = %entry
+ %retval5 = load ppc_fp128* %retval ; [#uses=1]
+ ret ppc_fp128 %retval5
+}
+
+define ppc_fp128 @divide(ppc_fp128 %x, ppc_fp128 %y) {
+entry:
+ %x_addr = alloca ppc_fp128 ; [#uses=2]
+ %y_addr = alloca ppc_fp128 ; [#uses=2]
+ %retval = alloca ppc_fp128, align 16 ; [#uses=2]
+ %tmp = alloca ppc_fp128, align 16 ; [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
+ store ppc_fp128 %x, ppc_fp128* %x_addr
+ store ppc_fp128 %y, ppc_fp128* %y_addr
+ %tmp1 = load ppc_fp128* %x_addr, align 16 ; [#uses=1]
+ %tmp2 = load ppc_fp128* %y_addr, align 16 ; [#uses=1]
+ %tmp3 = fdiv ppc_fp128 %tmp1, %tmp2 ; [#uses=1]
+ store ppc_fp128 %tmp3, ppc_fp128* %tmp, align 16
+ %tmp4 = load ppc_fp128* %tmp, align 16 ; [#uses=1]
+ store ppc_fp128 %tmp4, ppc_fp128* %retval, align 16
+ br label %return
+
+return: ; preds = %entry
+ %retval5 = load ppc_fp128* %retval ; [#uses=1]
+ ret ppc_fp128 %retval5
+}
From evan.cheng at apple.com Fri Oct 5 15:34:26 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 20:34:26 -0000
Subject: [llvm-commits] [llvm] r42647 -
/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Message-ID: <200710052034.l95KYQja006086@zion.cs.uiuc.edu>
Author: evancheng
Date: Fri Oct 5 15:34:26 2007
New Revision: 42647
URL: http://llvm.org/viewvc/llvm-project?rev=42647&view=rev
Log:
In 64-bit mode, avoid using leal with 32-bit 32-bit address size, e.g.
leal 1(%ecx), %edi, which requires 67H prefix.
Modified:
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=42647&r1=42646&r2=42647&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Oct 5 15:34:26 2007
@@ -190,8 +190,8 @@
// we have better subtarget support, enable the 16-bit LEA generation here.
bool DisableLEA16 = true;
- switch (MI->getOpcode()) {
- default: break; // All others need to check for live condition code defs.
+ unsigned MIOpc = MI->getOpcode();
+ switch (MIOpc) {
case X86::SHUFPSrri: {
assert(MI->getNumOperands() == 4 && "Unknown shufps instruction!");
if (!TM.getSubtarget().hasSSE2()) return 0;
@@ -273,96 +273,105 @@
}
break;
}
- }
-
- if (!hasLiveCondCodeDef(MI))
- switch (MI->getOpcode()) {
- case X86::INC64r:
- case X86::INC32r:
- case X86::INC64_32r: {
- assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!");
- unsigned Opc = MI->getOpcode() == X86::INC64r ? X86::LEA64r : X86::LEA32r;
- NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, 1);
- break;
- }
- case X86::INC16r:
- case X86::INC64_16r:
- if (DisableLEA16) return 0;
- assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!");
- NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, 1);
- break;
- case X86::DEC64r:
- case X86::DEC32r:
- case X86::DEC64_32r: {
- assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!");
- unsigned Opc = MI->getOpcode() == X86::DEC64r ? X86::LEA64r : X86::LEA32r;
- NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, -1);
- break;
- }
- case X86::DEC16r:
- case X86::DEC64_16r:
- if (DisableLEA16) return 0;
- assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!");
- NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, -1);
- break;
- case X86::ADD64rr:
- case X86::ADD32rr: {
- assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
- unsigned Opc = MI->getOpcode() == X86::ADD64rr ? X86::LEA64r : X86::LEA32r;
- NewMI = addRegReg(BuildMI(get(Opc), Dest), Src, MI->getOperand(2).getReg());
- break;
- }
- case X86::ADD16rr:
- if (DisableLEA16) return 0;
- assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
- NewMI = addRegReg(BuildMI(get(X86::LEA16r), Dest), Src,
- MI->getOperand(2).getReg());
- break;
- case X86::ADD64ri32:
- case X86::ADD64ri8:
- assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
- if (MI->getOperand(2).isImmediate())
- NewMI = addRegOffset(BuildMI(get(X86::LEA64r), Dest), Src,
- MI->getOperand(2).getImmedValue());
- break;
- case X86::ADD32ri:
- case X86::ADD32ri8:
- assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
- if (MI->getOperand(2).isImmediate())
- NewMI = addRegOffset(BuildMI(get(X86::LEA32r), Dest), Src,
- MI->getOperand(2).getImmedValue());
- break;
- case X86::ADD16ri:
- case X86::ADD16ri8:
- if (DisableLEA16) return 0;
- assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
- if (MI->getOperand(2).isImmediate())
- NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src,
- MI->getOperand(2).getImmedValue());
- break;
- case X86::SHL16ri:
- if (DisableLEA16) return 0;
- case X86::SHL32ri:
- case X86::SHL64ri:
- assert(MI->getNumOperands() >= 3 && MI->getOperand(2).isImmediate() &&
- "Unknown shl instruction!");
- unsigned ShAmt = MI->getOperand(2).getImmedValue();
- if (ShAmt == 1 || ShAmt == 2 || ShAmt == 3) {
- X86AddressMode AM;
- AM.Scale = 1 << ShAmt;
- AM.IndexReg = Src;
- unsigned Opc = MI->getOpcode() == X86::SHL64ri ? X86::LEA64r
- : (MI->getOpcode() == X86::SHL32ri ? X86::LEA32r : X86::LEA16r);
- NewMI = addFullAddress(BuildMI(get(Opc), Dest), AM);
+ default: {
+ // The following opcodes also sets the condition code register(s). Only
+ // convert them to equivalent lea if the condition code register def's
+ // are dead!
+ if (hasLiveCondCodeDef(MI))
+ return 0;
+
+ switch (MIOpc) {
+ default: return 0;
+ case X86::INC64r:
+ case X86::INC32r:
+ case X86::INC64_32r: {
+ assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!");
+ unsigned Opc = MIOpc == X86::INC64r ? X86::LEA64r
+ : (MIOpc == X86::INC64_32r ? X86::LEA64_32r : X86::LEA32r);
+ NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, 1);
+ break;
+ }
+ case X86::INC16r:
+ case X86::INC64_16r:
+ if (DisableLEA16) return 0;
+ assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!");
+ NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, 1);
+ break;
+ case X86::DEC64r:
+ case X86::DEC32r:
+ case X86::DEC64_32r: {
+ assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!");
+ unsigned Opc = MIOpc == X86::DEC64r ? X86::LEA64r
+ : (MIOpc == X86::DEC64_32r ? X86::LEA64_32r : X86::LEA32r);
+ NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, -1);
+ break;
+ }
+ case X86::DEC16r:
+ case X86::DEC64_16r:
+ if (DisableLEA16) return 0;
+ assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!");
+ NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, -1);
+ break;
+ case X86::ADD64rr:
+ case X86::ADD32rr: {
+ assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
+ unsigned Opc = MIOpc == X86::ADD64rr ? X86::LEA64r : X86::LEA32r;
+ NewMI = addRegReg(BuildMI(get(Opc), Dest), Src,
+ MI->getOperand(2).getReg());
+ break;
+ }
+ case X86::ADD16rr:
+ if (DisableLEA16) return 0;
+ assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
+ NewMI = addRegReg(BuildMI(get(X86::LEA16r), Dest), Src,
+ MI->getOperand(2).getReg());
+ break;
+ case X86::ADD64ri32:
+ case X86::ADD64ri8:
+ assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
+ if (MI->getOperand(2).isImmediate())
+ NewMI = addRegOffset(BuildMI(get(X86::LEA64r), Dest), Src,
+ MI->getOperand(2).getImmedValue());
+ break;
+ case X86::ADD32ri:
+ case X86::ADD32ri8:
+ assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
+ if (MI->getOperand(2).isImmediate())
+ NewMI = addRegOffset(BuildMI(get(X86::LEA32r), Dest), Src,
+ MI->getOperand(2).getImmedValue());
+ break;
+ case X86::ADD16ri:
+ case X86::ADD16ri8:
+ if (DisableLEA16) return 0;
+ assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
+ if (MI->getOperand(2).isImmediate())
+ NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src,
+ MI->getOperand(2).getImmedValue());
+ break;
+ case X86::SHL16ri:
+ if (DisableLEA16) return 0;
+ case X86::SHL32ri:
+ case X86::SHL64ri: {
+ assert(MI->getNumOperands() >= 3 && MI->getOperand(2).isImmediate() &&
+ "Unknown shl instruction!");
+ unsigned ShAmt = MI->getOperand(2).getImmedValue();
+ if (ShAmt == 1 || ShAmt == 2 || ShAmt == 3) {
+ X86AddressMode AM;
+ AM.Scale = 1 << ShAmt;
+ AM.IndexReg = Src;
+ unsigned Opc = MIOpc == X86::SHL64ri ? X86::LEA64r
+ : (MIOpc == X86::SHL32ri ? X86::LEA32r : X86::LEA16r);
+ NewMI = addFullAddress(BuildMI(get(Opc), Dest), AM);
+ }
+ break;
+ }
}
- break;
}
-
- if (NewMI) {
- NewMI->copyKillDeadInfo(MI);
- LV.instructionChanged(MI, NewMI); // Update live variables
- MFI->insert(MBBI, NewMI); // Insert the new inst
}
+
+ NewMI->copyKillDeadInfo(MI);
+ LV.instructionChanged(MI, NewMI); // Update live variables
+ MFI->insert(MBBI, NewMI); // Insert the new inst
return NewMI;
}
From evan.cheng at apple.com Fri Oct 5 16:55:32 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 21:55:32 -0000
Subject: [llvm-commits] [llvm] r42653 -
/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Message-ID: <200710052155.l95LtWgD009023@zion.cs.uiuc.edu>
Author: evancheng
Date: Fri Oct 5 16:55:32 2007
New Revision: 42653
URL: http://llvm.org/viewvc/llvm-project?rev=42653&view=rev
Log:
INC64_32r -> LEA64_32r is better than INC64_32r -> LEA32r, but it still can
cause performance degradation.
Modified:
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=42653&r1=42652&r2=42653&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Oct 5 16:55:32 2007
@@ -283,11 +283,9 @@
switch (MIOpc) {
default: return 0;
case X86::INC64r:
- case X86::INC32r:
- case X86::INC64_32r: {
+ case X86::INC32r: {
assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!");
- unsigned Opc = MIOpc == X86::INC64r ? X86::LEA64r
- : (MIOpc == X86::INC64_32r ? X86::LEA64_32r : X86::LEA32r);
+ unsigned Opc = MIOpc == X86::INC64r ? X86::LEA64r : X86::LEA32r;
NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, 1);
break;
}
@@ -298,11 +296,9 @@
NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, 1);
break;
case X86::DEC64r:
- case X86::DEC32r:
- case X86::DEC64_32r: {
+ case X86::DEC32r: {
assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!");
- unsigned Opc = MIOpc == X86::DEC64r ? X86::LEA64r
- : (MIOpc == X86::DEC64_32r ? X86::LEA64_32r : X86::LEA32r);
+ unsigned Opc = MIOpc == X86::DEC64r ? X86::LEA64r : X86::LEA32r;
NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, -1);
break;
}
From dpatel at apple.com Fri Oct 5 17:29:34 2007
From: dpatel at apple.com (Devang Patel)
Date: Fri, 05 Oct 2007 22:29:34 -0000
Subject: [llvm-commits] [llvm] r42654 - in /llvm/trunk:
lib/Transforms/Scalar/LoopUnswitch.cpp lib/VMCore/Dominators.cpp
test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll
Message-ID: <200710052229.l95MTYp2010695@zion.cs.uiuc.edu>
Author: dpatel
Date: Fri Oct 5 17:29:34 2007
New Revision: 42654
URL: http://llvm.org/viewvc/llvm-project?rev=42654&view=rev
Log:
Fix bug in updating dominance frontier after loop
unswitch when frontier includes basic blocks that
are not inside loop.
Added:
llvm/trunk/test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
llvm/trunk/lib/VMCore/Dominators.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=42654&r1=42653&r2=42654&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Fri Oct 5 17:29:34 2007
@@ -41,7 +41,6 @@
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
@@ -71,6 +70,18 @@
bool OptimizeForSize;
bool redoLoop;
+
+ DominanceFrontier *DF;
+ DominatorTree *DT;
+
+ /// LoopDF - Loop's dominance frontier. This set is a collection of
+ /// loop exiting blocks' DF member blocks. However this does set does not
+ /// includes basic blocks that are inside loop.
+ SmallPtrSet LoopDF;
+
+ /// OrigLoopExitMap - This is used to map loop exiting block with
+ /// corresponding loop exit block, before updating CFG.
+ DenseMap OrigLoopExitMap;
public:
static char ID; // Pass ID, replacement for typeid
explicit LoopUnswitch(bool Os = false) :
@@ -106,8 +117,13 @@
/// Split all of the edges from inside the loop to their exit blocks. Update
/// the appropriate Phi nodes as we do so.
- void SplitExitEdges(const SmallVector &ExitBlocks,
+ void SplitExitEdges(Loop *L, const SmallVector &ExitBlocks,
SmallVector &MiddleBlocks);
+
+ /// If BB's dominance frontier has a member that is not part of loop L then
+ /// remove it. Add NewDFMember in BB's dominance frontier.
+ void ReplaceLoopExternalDFMember(Loop *L, BasicBlock *BB,
+ BasicBlock *NewDFMember);
bool UnswitchIfProfitable(Value *LoopCond, Constant *Val,Loop *L);
unsigned getLoopUnswitchCost(Loop *L, Value *LIC);
@@ -158,13 +174,16 @@
if (Value *RHS = FindLIVLoopCondition(BO->getOperand(1), L, Changed))
return RHS;
}
-
- return 0;
+
+ return 0;
}
bool LoopUnswitch::runOnLoop(Loop *L, LPPassManager &LPM_Ref) {
LI = &getAnalysis();
LPM = &LPM_Ref;
+ DF = getAnalysisToUpdate();
+ DT = getAnalysisToUpdate();
+
bool Changed = false;
do {
@@ -601,11 +620,36 @@
++NumTrivial;
}
+/// ReplaceLoopExternalDFMember -
+/// If BB's dominance frontier has a member that is not part of loop L then
+/// remove it. Add NewDFMember in BB's dominance frontier.
+void LoopUnswitch::ReplaceLoopExternalDFMember(Loop *L, BasicBlock *BB,
+ BasicBlock *NewDFMember) {
+
+ DominanceFrontier::iterator DFI = DF->find(BB);
+ if (DFI == DF->end())
+ return;
+
+ DominanceFrontier::DomSetType &DFSet = DFI->second;
+ for (DominanceFrontier::DomSetType::iterator DI = DFSet.begin(),
+ DE = DFSet.end(); DI != DE; ++DI) {
+ BasicBlock *B = *DI;
+ if (L->contains(B))
+ continue;
+
+ DF->removeFromFrontier(DFI, B);
+ LoopDF.insert(B);
+ }
+
+ DF->addToFrontier(DFI, NewDFMember);
+}
+
/// SplitExitEdges -
/// Split all of the edges from inside the loop to their exit blocks. Update
/// the appropriate Phi nodes as we do so.
-void LoopUnswitch::SplitExitEdges(const SmallVector &ExitBlocks,
+void LoopUnswitch::SplitExitEdges(Loop *L, const SmallVector &ExitBlocks,
SmallVector &MiddleBlocks) {
+
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
BasicBlock *ExitBlock = ExitBlocks[i];
std::vector Preds(pred_begin(ExitBlock), pred_end(ExitBlock));
@@ -622,6 +666,8 @@
EndBlock = ExitBlock;
}
+ OrigLoopExitMap[StartBlock] = EndBlock;
+
std::set InsertedPHIs;
PHINode* OldLCSSA = 0;
for (BasicBlock::iterator I = EndBlock->begin();
@@ -647,8 +693,24 @@
OldLCSSA->replaceAllUsesWith(NewLCSSA);
NewLCSSA->addIncoming(OldLCSSA, MiddleBlock);
}
+
+ if (DF && DT) {
+ // StartBlock -- > MiddleBlock -- > EndBlock
+ // StartBlock is loop exiting block. EndBlock will become merge point
+ // of two loop exits after loop unswitch.
+
+ // If StartBlock's DF member includes a block that is not loop member
+ // then replace that DF member with EndBlock.
+
+ // If MiddleBlock's DF member includes a block that is not loop member
+ // tnen replace that DF member with EndBlock.
+
+ ReplaceLoopExternalDFMember(L, StartBlock, EndBlock);
+ ReplaceLoopExternalDFMember(L, MiddleBlock, EndBlock);
+ }
}
}
+
}
/// UnswitchNontrivialCondition - We determined that the loop is profitable
@@ -683,7 +745,7 @@
// Split all of the edges from inside the loop to their exit blocks. Update
// the appropriate Phi nodes as we do so.
SmallVector MiddleBlocks;
- SplitExitEdges(ExitBlocks, MiddleBlocks);
+ SplitExitEdges(L, ExitBlocks, MiddleBlocks);
// The exit blocks may have been changed due to edge splitting, recompute.
ExitBlocks.clear();
@@ -692,9 +754,6 @@
// Add exit blocks to the loop blocks.
LoopBlocks.insert(LoopBlocks.end(), ExitBlocks.begin(), ExitBlocks.end());
- DominanceFrontier *DF = getAnalysisToUpdate();
- DominatorTree *DT = getAnalysisToUpdate();
-
// Next step, clone all of the basic blocks that make up the loop (including
// the loop preheader and exit blocks), keeping track of the mapping between
// the instructions and blocks.
@@ -778,6 +837,9 @@
// Update dominator info
if (DF && DT) {
+ SmallVector ExitingBlocks;
+ L->getExitingBlocks(ExitingBlocks);
+
// Clone dominator info for all cloned basic block.
for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) {
BasicBlock *LBB = LoopBlocks[i];
@@ -785,29 +847,57 @@
CloneDomInfo(NBB, LBB, NewPreheader, OrigPreheader,
OrigHeader, DT, DF, ValueMap);
- // Remove any OutSiders from LBB and NBB's dominance frontier.
- DominanceFrontier::iterator LBBI = DF->find(LBB);
- if (LBBI != DF->end()) {
- DominanceFrontier::DomSetType &LBSet = LBBI->second;
- for (DominanceFrontier::DomSetType::iterator LI = LBSet.begin(),
- LE = LBSet.end(); LI != LE; /* NULL */) {
- BasicBlock *B = *LI++;
- if (OutSiders.count(B))
- DF->removeFromFrontier(LBBI, B);
- }
- }
+ // If LBB's dominance frontier includes DFMember
+ // such that DFMember is also a member of LoopDF then
+ // - Remove DFMember from LBB's dominance frontier
+ // - Copy loop exiting blocks', that are dominated by BB, dominance frontier
+ // member in BB's dominance frontier
- // Remove any OutSiders from LBB and NBB's dominance frontier.
+ DominanceFrontier::iterator LBBI = DF->find(LBB);
DominanceFrontier::iterator NBBI = DF->find(NBB);
- if (NBBI != DF->end()) {
- DominanceFrontier::DomSetType NBSet = NBBI->second;
- for (DominanceFrontier::DomSetType::iterator NI = NBSet.begin(),
- NE = NBSet.end(); NI != NE; /* NULL */) {
- BasicBlock *B = *NI++;
- if (OutSiders.count(B))
+ if (LBBI == DF->end())
+ continue;
+
+ DominanceFrontier::DomSetType &LBSet = LBBI->second;
+ for (DominanceFrontier::DomSetType::iterator LI = LBSet.begin(),
+ LE = LBSet.end(); LI != LE; /* NULL */) {
+ BasicBlock *B = *LI++;
+ if (B == LBB && B == L->getHeader())
+ continue;
+ bool removeB = false;
+ if (!LoopDF.count(B))
+ continue;
+
+ // If LBB dominates loop exits then insert loop exit block's DF
+ // into B's DF.
+ for(SmallVector::iterator LExitI = ExitingBlocks.begin(),
+ LExitE = ExitingBlocks.end(); LExitI != LExitE; ++LExitI) {
+ BasicBlock *E = *LExitI;
+
+ if (!DT->dominates(LBB,E))
+ continue;
+
+ DenseMap::iterator DFBI =
+ OrigLoopExitMap.find(E);
+ if (DFBI == OrigLoopExitMap.end())
+ continue;
+
+ BasicBlock *DFB = DFBI->second;
+ DF->addToFrontier(LBBI, DFB);
+ DF->addToFrontier(NBBI, DFB);
+ removeB = true;
+ }
+
+ // If B's replacement is inserted in DF then now is the time to remove B.
+ if (removeB) {
+ DF->removeFromFrontier(LBBI, B);
+ if (L->contains(B))
+ DF->removeFromFrontier(NBBI, cast(ValueMap[B]));
+ else
DF->removeFromFrontier(NBBI, B);
}
}
+
}
// MiddleBlocks are dominated by original pre header. SplitEdge updated
Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=42654&r1=42653&r2=42654&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Fri Oct 5 17:29:34 2007
@@ -422,8 +422,11 @@
}
if (NewBBI != end()) {
- DominanceFrontier::DomSetType NewBBSet = NewBBI->second;
- NewBBSet.insert(Set.begin(), Set.end());
+ for (DominanceFrontier::DomSetType::iterator SetI = Set.begin(),
+ E = Set.end(); SetI != E; ++SetI) {
+ BasicBlock *SB = *SetI;
+ addToFrontier(NewBBI, SB);
+ }
} else
addBasicBlock(NewBB, Set);
}
Added: llvm/trunk/test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll?rev=42654&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll (added)
+++ llvm/trunk/test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll Fri Oct 5 17:29:34 2007
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -licm -loop-unroll -disable-output
+
+ at resonant = external global i32 ; [#uses=2]
+
+define void @weightadj() {
+entry:
+ br label %bb
+
+bb: ; preds = %bb158, %entry
+ store i32 0, i32* @resonant, align 4
+ br i1 false, label %g.exit, label %bb158
+
+g.exit: ; preds = %bb68, %bb
+ br i1 false, label %bb68, label %cond_true
+
+cond_true: ; preds = %g.exit
+ store i32 1, i32* @resonant, align 4
+ br label %bb68
+
+bb68: ; preds = %cond_true, %g.exit
+ %tmp71 = icmp slt i32 0, 0 ; [#uses=1]
+ br i1 %tmp71, label %g.exit, label %bb158
+
+bb158: ; preds = %bb68, %bb
+ br i1 false, label %bb, label %return
+
+return: ; preds = %bb158
+ ret void
+}
From evan.cheng at apple.com Fri Oct 5 17:31:10 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 22:31:10 -0000
Subject: [llvm-commits] [test-suite] r42655 -
/test-suite/trunk/Makefile.programs
Message-ID: <200710052231.l95MVAVT010742@zion.cs.uiuc.edu>
Author: evancheng
Date: Fri Oct 5 17:31:10 2007
New Revision: 42655
URL: http://llvm.org/viewvc/llvm-project?rev=42655&view=rev
Log:
Enable convertToThreeAddress for X86 by default.
Modified:
test-suite/trunk/Makefile.programs
Modified: test-suite/trunk/Makefile.programs
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=42655&r1=42654&r2=42655&view=diff
==============================================================================
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Fri Oct 5 17:31:10 2007
@@ -221,8 +221,7 @@
LLCBETAOPTION := -sched=simple
endif
ifeq ($(ARCH),x86)
-LLCBETAOPTION := -enable-x86-conv-3-addr
-#-regalloc=local -fast
+LLCBETAOPTION := -regalloc=local -fast
#-disable-rematerialization
#-disable-fp-elim
#-regalloc=bigblock -fast
From evan.cheng at apple.com Fri Oct 5 17:31:10 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 22:31:10 -0000
Subject: [llvm-commits] [llvm] r42655 - in /llvm/trunk:
lib/Target/X86/X86InstrInfo.cpp test/CodeGen/X86/2006-05-02-InstrSched2.ll
test/CodeGen/X86/2006-05-11-InstrSched.ll
test/CodeGen/X86/loop-strength-reduce2.ll
Message-ID: <200710052231.l95MVAD8010750@zion.cs.uiuc.edu>
Author: evancheng
Date: Fri Oct 5 17:31:10 2007
New Revision: 42655
URL: http://llvm.org/viewvc/llvm-project?rev=42655&view=rev
Log:
Enable convertToThreeAddress for X86 by default.
Modified:
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
llvm/trunk/test/CodeGen/X86/2006-05-02-InstrSched2.ll
llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll
llvm/trunk/test/CodeGen/X86/loop-strength-reduce2.ll
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=42655&r1=42654&r2=42655&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Oct 5 17:31:10 2007
@@ -22,15 +22,8 @@
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/SSARegMap.h"
#include "llvm/Target/TargetOptions.h"
-#include "llvm/Support/CommandLine.h"
using namespace llvm;
-namespace {
- cl::opt
- EnableConvert3Addr("enable-x86-conv-3-addr",
- cl::desc("Enable convertToThreeAddress for X86"));
-}
-
X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
: TargetInstrInfo(X86Insts, array_lengthof(X86Insts)),
TM(tm), RI(tm, *this) {
@@ -154,8 +147,6 @@
/// hasLiveCondCodeDef - True if MI has a condition code def, e.g. EFLAGS, that
/// is not marked dead.
static bool hasLiveCondCodeDef(MachineInstr *MI) {
- if (!EnableConvert3Addr)
- return true;
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI->getOperand(i);
if (MO.isRegister() && MO.isDef() &&
Modified: llvm/trunk/test/CodeGen/X86/2006-05-02-InstrSched2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2006-05-02-InstrSched2.ll?rev=42655&r1=42654&r2=42655&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2006-05-02-InstrSched2.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2006-05-02-InstrSched2.ll Fri Oct 5 17:31:10 2007
@@ -1,5 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats |& \
-; RUN: grep asm-printer | grep 16
+; RUN: grep asm-printer | grep 15
void %_ZN9__gnu_cxx9hashtableISt4pairIKPKciES3_NS_4hashIS3_EESt10_Select1stIS5_E5eqstrSaIiEE14find_or_insertERKS5__cond_true456.i(sbyte* %tmp435.i, uint* %tmp449.i.out) {
newFuncRoot:
Modified: llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll?rev=42655&r1=42654&r2=42655&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll Fri Oct 5 17:31:10 2007
@@ -1,5 +1,5 @@
; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats |&\
-; RUN: grep {asm-printer} | grep 33
+; RUN: grep {asm-printer} | grep 32
target datalayout = "e-p:32:32"
define void @foo(i32* %mc, i32* %bp, i32* %ms, i32* %xmb, i32* %mpp, i32* %tpmm, i32* %ip, i32* %tpim, i32* %dpp, i32* %tpdm, i32* %bpi, i32 %M) {
Modified: llvm/trunk/test/CodeGen/X86/loop-strength-reduce2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/loop-strength-reduce2.ll?rev=42655&r1=42654&r2=42655&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/loop-strength-reduce2.ll (original)
+++ llvm/trunk/test/CodeGen/X86/loop-strength-reduce2.ll Fri Oct 5 17:31:10 2007
@@ -1,4 +1,4 @@
-; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=i686-apple-darwin -relocation-model=pic | not grep lea
+; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=i686-apple-darwin -relocation-model=pic | grep '\$pb' | grep mov
;
; Make sure the PIC label flags2-"L1$pb" is not moved up to the preheader.
From evan.cheng at apple.com Fri Oct 5 17:34:59 2007
From: evan.cheng at apple.com (Evan Cheng)
Date: Fri, 05 Oct 2007 22:34:59 -0000
Subject: [llvm-commits] [llvm] r42656 - /llvm/trunk/lib/Target/X86/README.txt
Message-ID: <200710052234.l95MYxCM010919@zion.cs.uiuc.edu>
Author: evancheng
Date: Fri Oct 5 17:34:59 2007
New Revision: 42656
URL: http://llvm.org/viewvc/llvm-project?rev=42656&view=rev
Log:
This is done.
Modified:
llvm/trunk/lib/Target/X86/README.txt
Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=42656&r1=42655&r2=42656&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Fri Oct 5 17:34:59 2007
@@ -290,10 +290,6 @@
//===---------------------------------------------------------------------===//
-Enable X86InstrInfo::convertToThreeAddress().
-
-//===---------------------------------------------------------------------===//
-
We are currently lowering large (1MB+) memmove/memcpy to rep/stosl and rep/movsl
We should leave these as libcalls for everything over a much lower threshold,
since libc is hand tuned for medium and large mem ops (avoiding RFO for large
From gordonhenriksen at mac.com Fri Oct 5 17:36:48 2007
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Fri, 5 Oct 2007 18:36:48 -0400
Subject: [llvm-commits] [cfe-commits] r42652 - in /cfe/trunk/www:
get_involved.html index.html
In-Reply-To: <200710052144.l95Li4W0008520@zion.cs.uiuc.edu>
References: <200710052144.l95Li4W0008520@zion.cs.uiuc.edu>
Message-ID:
Hi Kevin,
Since you're using non-ASCII characters, could you please declare the
character set in the section? I believe this is correct for
this file:
On Oct 5, 2007, at 17:44, Kevin wrote:
> Author: kevin
> Date: Fri Oct 5 16:44:03 2007
> New Revision: 42652
>
> URL: http://llvm.org/viewvc/llvm-project?rev=42652&view=rev
> Log:
> A message on the main page about bulding clang.
>
> Modified:
> cfe/trunk/www/get_involved.html
> cfe/trunk/www/index.html
>
> Modified: cfe/trunk/www/get_involved.html
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/
> get_involved.html?rev=42652&r1=42651&r2=42652&view=diff
>
> ======================================================================
> ========
> --- cfe/trunk/www/get_involved.html (original)
> +++ cfe/trunk/www/get_involved.html Fri Oct 5 16:44:03 2007
> @@ -32,7 +32,7 @@
> cfe-commits - This list is for patch submission/
> discussion.
> cfe-dev - This list is for everything else clang related.
>
> -Building clang / working with the code
> +Building clang / working with the code
> a>
> If you would like to check out and build the project, the current
> scheme is:
>
> - Check out llvm
>
> Modified: cfe/trunk/www/index.html
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/index.html?
> rev=42652&r1=42651&r2=42652&view=diff
>
> ======================================================================
> ========
> --- cfe/trunk/www/index.html (original)
> +++ cfe/trunk/www/index.html Fri Oct 5 16:44:03 2007
> @@ -41,6 +41,8 @@
>
- BSD License
>
> Of course this is only a rough outline of the goals and features
> of Clang. To get a true sense of what the new LLVM front-end is
> all about, as well as why you might want to considering using it,
> see the Features section.
> +
Try Clang
> + If you are a compiler developer and want to try out Clang, then
> build instructions are available on the href="get_involved.html#build">Get Involved page.
> Get Involved
> If you are interested in working on Clang, then check out the href="get_involved.html">Get Involved section.
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
? Gordon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071005/2bbb2aad/attachment.html
From asl at math.spbu.ru Fri Oct 5 17:39:24 2007
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Fri, 05 Oct 2007 22:39:24 -0000
Subject: [llvm-commits] [test-suite] r42657 -
/test-suite/trunk/SingleSource/Benchmarks/McGill/misr.c
Message-ID: <200710052239.l95MdOt0011080@zion.cs.uiuc.edu>
Author: asl
Date: Fri Oct 5 17:39:24 2007
New Revision: 42657
URL: http://llvm.org/viewvc/llvm-project?rev=42657&view=rev
Log:
Fix misr on mingw32
Modified:
test-suite/trunk/SingleSource/Benchmarks/McGill/misr.c
Modified: test-suite/trunk/SingleSource/Benchmarks/McGill/misr.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/McGill/misr.c?rev=42657&r1=42656&r2=42657&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/McGill/misr.c (original)
+++ test-suite/trunk/SingleSource/Benchmarks/McGill/misr.c Fri Oct 5 17:39:24 2007
@@ -40,6 +40,11 @@
#define TRUE 1
#define FALSE 0
+#ifdef __MINGW32__
+# define seed48(x) srand(x)
+# define lrand48() ((rand() << 16) ^ (rand()))
+#endif
+
int reg_len;
typedef struct cells {
@@ -217,7 +222,7 @@
misr_type *temp;
int different, savef_free, savefaulty;
int rem, quot, h, i, j;
- long rand;
+ long randv;
double randprob;
different = FALSE;
@@ -231,7 +236,7 @@
savefaulty = 0;
for (i=0; if_free;
savefaulty += temp->faulty;
}
- temp->f_free = ((temp->next->f_free + rand) & BIN_MASK);
+ temp->f_free = ((temp->next->f_free + randv) & BIN_MASK);
randprob = ((double)(lrand48() % 1000) / 1000);
- if (prob > randprob) rand ^= BIN_MASK;
- temp->faulty = ((temp->next->faulty + rand) & BIN_MASK);
+ if (prob > randprob) randv ^= BIN_MASK;
+ temp->faulty = ((temp->next->faulty + randv) & BIN_MASK);
temp = temp->next;
- rand >>= 1;
+ randv >>= 1;
}
}
- rand = lrand48();
+ randv = lrand48();
for (j=0; jf_free;
savefaulty += temp->faulty;
}
- temp->f_free = ((temp->next->f_free + rand) & BIN_MASK);
- randprob = ((double)(lrand48() % 1000) / 1000); if (prob > randprob) rand ^= BIN_MASK;
- temp->faulty = ((temp->next->faulty + rand) & BIN_MASK);
+ temp->f_free = ((temp->next->f_free + randv) & BIN_MASK);
+ randprob = ((double)(lrand48() % 1000) / 1000);
+ if (prob > randprob) randv ^= BIN_MASK;
+ temp->faulty = ((temp->next->faulty + randv) & BIN_MASK);
temp = temp->next;
- rand >>= 1;
+ randv >>= 1;
}
- rand = lrand48();
+ randv = lrand48();
if (structure[reg_len - 1] == '1')
{
savef_free += temp->f_free;
savefaulty += temp->faulty;
}
- temp->f_free = ((savef_free + rand) & BIN_MASK);
+ temp->f_free = ((savef_free + randv) & BIN_MASK);
randprob = ((double)(lrand48() % 10000) / 10000);
- if (prob > randprob) rand ^= BIN_MASK;
- temp->faulty = ((savefaulty + rand) & BIN_MASK);
+ if (prob > randprob) randv ^= BIN_MASK;
+ temp->faulty = ((savefaulty + randv) & BIN_MASK);
temp = present;
}
From asl at math.spbu.ru Fri Oct 5 17:50:25 2007
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Fri, 05 Oct 2007 22:50:25 -0000
Subject: [llvm-commits] [test-suite] r42658 - in
/test-suite/trunk/SingleSource/Benchmarks/Misc: ReedSolomon.c flops.c
mandel.c
Message-ID: <200710052250.l95MoPHH011738@zion.cs.uiuc.edu>
Author: asl
Date: Fri Oct 5 17:50:24 2007
New Revision: 42658
URL: http://llvm.org/viewvc/llvm-project?rev=42658&view=rev
Log:
Fix 'Misc' on mingw32
Modified:
test-suite/trunk/SingleSource/Benchmarks/Misc/ReedSolomon.c
test-suite/trunk/SingleSource/Benchmarks/Misc/flops.c
test-suite/trunk/SingleSource/Benchmarks/Misc/mandel.c
Modified: test-suite/trunk/SingleSource/Benchmarks/Misc/ReedSolomon.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc/ReedSolomon.c?rev=42658&r1=42657&r2=42658&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc/ReedSolomon.c (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc/ReedSolomon.c Fri Oct 5 17:50:24 2007
@@ -423,6 +423,10 @@
#define LENGTH 150000
#endif
+#ifdef __MINGW32__
+#define random() rand()
+#endif
+
for (i=0; i
struct timeval tnow;
Modified: test-suite/trunk/SingleSource/Benchmarks/Misc/mandel.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Misc/mandel.c?rev=42658&r1=42657&r2=42658&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Misc/mandel.c (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Misc/mandel.c Fri Oct 5 17:50:24 2007
@@ -18,7 +18,7 @@
#define I 1.0iF
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__MINGW32__)
#include
#elif defined(__APPLE__)
#include
From asl at math.spbu.ru Fri Oct 5 18:00:17 2007
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Fri, 05 Oct 2007 23:00:17 -0000
Subject: [llvm-commits] [test-suite] r42659 -
/test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/timer.c
Message-ID: <200710052300.l95N0HaS012294@zion.cs.uiuc.edu>
Author: asl
Date: Fri Oct 5 18:00:17 2007
New Revision: 42659
URL: http://llvm.org/viewvc/llvm-project?rev=42659&view=rev
Log:
Fix smg2000 on mingw32
Modified:
test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/timer.c
Modified: test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/timer.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/timer.c?rev=42659&r1=42658&r2=42659&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/timer.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/ASCI_Purple/SMG2000/timer.c Fri Oct 5 18:00:17 2007
@@ -19,7 +19,9 @@
*/
#include
+#ifndef __MINGW32__
#include
+#endif
#ifdef TIMER_USE_MPI
#include "mpi.h"
#endif
From sabre at nondot.org Fri Oct 5 18:01:44 2007
From: sabre at nondot.org (Chris Lattner)
Date: Fri, 5 Oct 2007 18:01:44 -0500
Subject: [llvm-commits] CVS: llvm-www/img/PhotoDale.png
Message-ID: <200710052301.l95N1itE012385@zion.cs.uiuc.edu>
Changes in directory llvm-www/img:
PhotoDale.png added (r1.1)
---
Log message:
add dale
---
Diffs of the changes: (+0 -0)
PhotoDale.png | 0
1 files changed
Index: llvm-www/img/PhotoDale.png
From sabre at nondot.org Fri Oct 5 18:01:44 2007
From: sabre at nondot.org (Chris Lattner)
Date: Fri, 5 Oct 2007 18:01:44 -0500
Subject: [llvm-commits] CVS: llvm-www/developers.txt
Message-ID: <200710052301.l95N1iMO012386@zion.cs.uiuc.edu>
Changes in directory llvm-www:
developers.txt updated: 1.14 -> 1.15
---
Log message:
add dale
---
Diffs of the changes: (+1 -0)
developers.txt | 1 +
1 files changed, 1 insertion(+)
Index: llvm-www/developers.txt
diff -u llvm-www/developers.txt:1.14 llvm-www/developers.txt:1.15
--- llvm-www/developers.txt:1.14 Tue May 15 17:52:47 2007
+++ llvm-www/developers.txt Fri Oct 5 18:01:07 2007
@@ -11,6 +11,7 @@
Alkis Evlogimenos href=http://alkis.evlogimenos.com img=PhotoAlkis.jpg width=200 height=170 alt=alkis
Brian Gaeke href=http://netfiles.uiuc.edu/gaeke/www/ img=PhotoBrian.png width=155 height=163 alt=brg
Patrick Jenkins href=http://www.patjenk.com img=PhotoPatJenk.jpg width=200 width=173 height=130 alt=PatJenk
+Dale Johannesen href=http://llvm.org/ img=img/PhotoDale.png width=132 height=107 alt=Dale
Brad Jones href=http://www.nondot.org/~kungfoomaster/ img=PhotoBrad.jpg width=200 height=171 alt=KungFooMaster
Anton Korobeynikov href=mailto:asl_at_math_dot_spbu_dot_ru img=PhotoAnton.jpg width=239 height=207 alt=Anton
Jim Laskey href=mailto:jlaskey at mac.com img=PhotoJim.jpg width=128 height=128 alt=Wickund
From sabre at nondot.org Fri Oct 5 18:02:36 2007
From: sabre at nondot.org (Chris Lattner)
Date: Fri, 5 Oct 2007 18:02:36 -0500
Subject: [llvm-commits] CVS: llvm-www/developers.txt
Message-ID: <200710052302.l95N2agT012434@zion.cs.uiuc.edu>
Changes in directory llvm-www:
developers.txt updated: 1.15 -> 1.16
---
Log message:
fix path
---
Diffs of the changes: (+1 -1)
developers.txt | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: llvm-www/developers.txt
diff -u llvm-www/developers.txt:1.15 llvm-www/developers.txt:1.16
--- llvm-www/developers.txt:1.15 Fri Oct 5 18:01:07 2007
+++ llvm-www/developers.txt Fri Oct 5 18:02:18 2007
@@ -11,7 +11,7 @@
Alkis Evlogimenos href=http://alkis.evlogimenos.com img=PhotoAlkis.jpg width=200 height=170 alt=alkis
Brian Gaeke href=http://netfiles.uiuc.edu/gaeke/www/ img=PhotoBrian.png width=155 height=163 alt=brg
Patrick Jenkins href=http://www.patjenk.com img=PhotoPatJenk.jpg width=200 width=173 height=130 alt=PatJenk
-Dale Johannesen href=http://llvm.org/ img=img/PhotoDale.png width=132 height=107 alt=Dale
+Dale Johannesen href=http://llvm.org/ img=PhotoDale.png width=132 height=107 alt=Dale
Brad Jones href=http://www.nondot.org/~kungfoomaster/ img=PhotoBrad.jpg width=200 height=171 alt=KungFooMaster
Anton Korobeynikov href=mailto:asl_at_math_dot_spbu_dot_ru img=PhotoAnton.jpg width=239 height=207 alt=Anton
Jim Laskey href=mailto:jlaskey at mac.com img=PhotoJim.jpg width=128 height=128 alt=Wickund
From asl at math.spbu.ru Fri Oct 5 18:07:16 2007
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Fri, 05 Oct 2007 23:07:16 -0000
Subject: [llvm-commits] [test-suite] r42660 - in
/test-suite/trunk/MultiSource/Benchmarks: Fhourstones-3.1/Game.h
Fhourstones-3.1/SearchGame.c Fhourstones/time.c
Message-ID: <200710052307.l95N7GtH012741@zion.cs.uiuc.edu>
Author: asl
Date: Fri Oct 5 18:07:16 2007
New Revision: 42660
URL: http://llvm.org/viewvc/llvm-project?rev=42660&view=rev
Log:
Clean Fhoursstones: remove time-related routines, unbreak mingw32
Modified:
test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Game.h
test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/SearchGame.c
test-suite/trunk/MultiSource/Benchmarks/Fhourstones/time.c
Modified: test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Game.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Game.h?rev=42660&r1=42659&r2=42660&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Game.h (original)
+++ test-suite/trunk/MultiSource/Benchmarks/Fhourstones-3.1/Game.h Fri Oct 5 18:07:16 2007
@@ -42,7 +42,8 @@
#define TOP (BOTTOM << HEIGHT)
#include
-typedef u_int64_t uint64;
+#include