From dpatel at apple.com Mon Apr 28 00:13:08 2008
From: dpatel at apple.com (Devang Patel)
Date: Mon, 28 Apr 2008 05:13:08 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50333 - /llvm-gcc-4.2/trunk/build_gcc
Message-ID: <200804280513.m3S5D8LD016871@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Apr 28 00:13:07 2008
New Revision: 50333
URL: http://llvm.org/viewvc/llvm-project?rev=50333&view=rev
Log:
Add FIXME note.
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=50333&r1=50332&r2=50333&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Mon Apr 28 00:13:07 2008
@@ -410,6 +410,7 @@
done
done
+# FIXME: What is the motivation here ?
for t in $TARGETS ; do
cp -p /usr/lib/libstdc++.6.dylib \
.$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc++.dylib \
From dpatel at apple.com Mon Apr 28 00:37:24 2008
From: dpatel at apple.com (Devang Patel)
Date: Sun, 27 Apr 2008 22:37:24 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r50317 -
/llvm-gcc-4.2/branches/Apple/Tak/gcc/llvm-convert.cpp
In-Reply-To:
References: <200804270642.m3R6gRUl010174@zion.cs.uiuc.edu>
Message-ID: <253385FC-59AD-4348-B047-702BE23AB1B7@apple.com>
On Apr 27, 2008, at 2:37 AM, Bill Wendling wrote:
> Do you have a testcase for this?
This patch increases #of passes from 289 to 621 in compat.exp tests on
x86-64 darwin :)
> (Applied to mainline.)
Thanks!
-
Devang
From sabre at nondot.org Mon Apr 28 01:01:07 2008
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 28 Apr 2008 06:01:07 -0000
Subject: [llvm-commits] [llvm] r50334 -
/llvm/trunk/include/llvm/ADT/SmallVector.h
Message-ID: <200804280601.m3S617KC018224@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Apr 28 01:01:06 2008
New Revision: 50334
URL: http://llvm.org/viewvc/llvm-project?rev=50334&view=rev
Log:
generalize SmallVector copy ctor, there is no requirement for
the initialization vector to have the same fixed size, just the
same element type.
Modified:
llvm/trunk/include/llvm/ADT/SmallVector.h
Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=50334&r1=50333&r2=50334&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Mon Apr 28 01:01:06 2008
@@ -486,7 +486,8 @@
append(S, E);
}
- SmallVector(const SmallVector &RHS) : SmallVectorImpl(NumTsAvailable) {
+ SmallVector(const SmallVectorImpl &RHS)
+ : SmallVectorImpl(NumTsAvailable) {
if (!RHS.empty())
operator=(RHS);
}
From sabre at nondot.org Mon Apr 28 01:02:19 2008
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 28 Apr 2008 06:02:19 -0000
Subject: [llvm-commits] [llvm] r50335 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200804280602.m3S62Jbn018264@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Apr 28 01:02:19 2008
New Revision: 50335
URL: http://llvm.org/viewvc/llvm-project?rev=50335&view=rev
Log:
switch RegsForValue::Regs to be a SmallVector to avoid
heap thrash on tiny (usually single-element) vectors.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50335&r1=50334&r2=50335&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 01:02:19 2008
@@ -125,7 +125,7 @@
/// Regs - This list holds the register (for legal and promoted values)
/// or register set (for expanded values) that the value should be assigned
/// to.
- std::vector Regs;
+ SmallVector Regs;
/// RegVTs - The value types of the registers. This is the same size
/// as ValueVTs; every register contributing to a given value must
@@ -146,11 +146,11 @@
unsigned Reg, MVT::ValueType regvt, MVT::ValueType valuevt)
: TLI(&tli), Regs(1, Reg), RegVTs(1, regvt), ValueVTs(1, valuevt) {}
RegsForValue(const TargetLowering &tli,
- const std::vector ®s,
+ const SmallVectorImpl ®s,
MVT::ValueType regvt, MVT::ValueType valuevt)
: TLI(&tli), Regs(regs), RegVTs(1, regvt), ValueVTs(1, valuevt) {}
RegsForValue(const TargetLowering &tli,
- const std::vector ®s,
+ const SmallVectorImpl ®s,
const SmallVector ®vts,
const SmallVector &valuevts)
: TLI(&tli), Regs(regs), RegVTs(regvts), ValueVTs(valuevts) {}
@@ -3600,7 +3600,7 @@
MachineFunction &MF = DAG.getMachineFunction();
- std::vector Regs;
+ SmallVector Regs;
// If this is a constraint for a single physreg, or a constraint for a
// register class, find it.
From asl at math.spbu.ru Mon Apr 28 01:12:38 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 28 Apr 2008 10:12:38 +0400
Subject: [llvm-commits] [PATCH] Add support for response files to
the CommandLine library
In-Reply-To: <48177.81.172.134.32.1209349445.squirrel@webmail.sophsolutions.com>
References: <48177.81.172.134.32.1209349445.squirrel@webmail.sophsolutions.com>
Message-ID: <1209363158.5745.24.camel@localhost>
Mikhail,
> Add support for response files [1] to the CommandLine library. Response
> files are enabled by an optional argument to ParseCommandLineOptions and
> ParseEnvironmentOptions.
Looks ok, please apply.
PS: Please turn automatic whitespace cleanup off, otherwise patches are
really hard to review.
--
With best regards, Anton Korobeynikov.
Faculty of Mathematics & Mechanics, Saint Petersburg State University.
From dpatel at apple.com Mon Apr 28 01:21:48 2008
From: dpatel at apple.com (Devang Patel)
Date: Mon, 28 Apr 2008 06:21:48 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50336 -
/llvm-gcc-4.2/branches/Apple/Tak/gcc/testsuite/gcc.apple/asm-function-20.c
Message-ID: <200804280621.m3S6Ln0p018771@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Apr 28 01:21:48 2008
New Revision: 50336
URL: http://llvm.org/viewvc/llvm-project?rev=50336&view=rev
Log:
Remove inliner specific warning message check.
Modified:
llvm-gcc-4.2/branches/Apple/Tak/gcc/testsuite/gcc.apple/asm-function-20.c
Modified: llvm-gcc-4.2/branches/Apple/Tak/gcc/testsuite/gcc.apple/asm-function-20.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Tak/gcc/testsuite/gcc.apple/asm-function-20.c?rev=50336&r1=50335&r2=50336&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Tak/gcc/testsuite/gcc.apple/asm-function-20.c (original)
+++ llvm-gcc-4.2/branches/Apple/Tak/gcc/testsuite/gcc.apple/asm-function-20.c Mon Apr 28 01:21:48 2008
@@ -7,7 +7,7 @@
inline int numberFive (void);
asm int numberFive (void)
{ /* { dg-warning "can never be inlined" } */
- /* { dg-warning "inlining failed in call" "" { target *-*-* } 9 } */
+ /* LLVM LOCAL */
li r3, 1
}
From isanbard at gmail.com Mon Apr 28 01:31:33 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 28 Apr 2008 06:31:33 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50337 -
/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-function-20.c
Message-ID: <200804280631.m3S6VXNd019038@zion.cs.uiuc.edu>
Author: void
Date: Mon Apr 28 01:31:33 2008
New Revision: 50337
URL: http://llvm.org/viewvc/llvm-project?rev=50337&view=rev
Log:
Porting r50336 from Tak.
Modified:
llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-function-20.c
Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-function-20.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-function-20.c?rev=50337&r1=50336&r2=50337&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-function-20.c (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/asm-function-20.c Mon Apr 28 01:31:33 2008
@@ -7,7 +7,7 @@
inline int numberFive (void);
asm int numberFive (void)
{ /* { dg-warning "can never be inlined" } */
- /* { dg-warning "inlining failed in call" "" { target *-*-* } 9 } */
+ /* LLVM LOCAL */
li r3, 1
}
From sabre at nondot.org Mon Apr 28 01:32:08 2008
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 28 Apr 2008 06:32:08 -0000
Subject: [llvm-commits] [llvm] r50338 -
/llvm/trunk/include/llvm/ADT/SmallVector.h
Message-ID: <200804280632.m3S6W8VA019066@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Apr 28 01:32:08 2008
New Revision: 50338
URL: http://llvm.org/viewvc/llvm-project?rev=50338&view=rev
Log:
restore the copy ctor in SmallVector. This fixes serious
errors I introduced in my last patch.
Modified:
llvm/trunk/include/llvm/ADT/SmallVector.h
Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=50338&r1=50337&r2=50338&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Mon Apr 28 01:32:08 2008
@@ -486,6 +486,11 @@
append(S, E);
}
+ SmallVector(const SmallVector &RHS) : SmallVectorImpl(NumTsAvailable) {
+ if (!RHS.empty())
+ operator=(RHS);
+ }
+
SmallVector(const SmallVectorImpl &RHS)
: SmallVectorImpl(NumTsAvailable) {
if (!RHS.empty())
From isanbard at gmail.com Mon Apr 28 01:34:05 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 28 Apr 2008 06:34:05 -0000
Subject: [llvm-commits] [llvm] r50339 - in /llvm/branches/Apple/Tak:
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll
Message-ID: <200804280634.m3S6Y5qN019130@zion.cs.uiuc.edu>
Author: void
Date: Mon Apr 28 01:34:05 2008
New Revision: 50339
URL: http://llvm.org/viewvc/llvm-project?rev=50339&view=rev
Log:
Porting r50332 to Tak.
Added:
llvm/branches/Apple/Tak/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll
Modified:
llvm/branches/Apple/Tak/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/branches/Apple/Tak/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Transforms/Utils/SimplifyCFG.cpp?rev=50339&r1=50338&r2=50339&view=diff
==============================================================================
--- llvm/branches/Apple/Tak/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/branches/Apple/Tak/lib/Transforms/Utils/SimplifyCFG.cpp Mon Apr 28 01:34:05 2008
@@ -1367,10 +1367,11 @@
// If the return instruction returns a value, and if the value was a
// PHI node in "BB", propagate the right value into the return.
- if (NewRet->getNumOperands() == 1)
- if (PHINode *PN = dyn_cast(NewRet->getOperand(0)))
+ for (unsigned i = 0, e = NewRet->getNumOperands(); i != e; ++i)
+ if (PHINode *PN = dyn_cast(NewRet->getOperand(i)))
if (PN->getParent() == BB)
- NewRet->setOperand(0, PN->getIncomingValueForBlock(Pred));
+ NewRet->setOperand(i, PN->getIncomingValueForBlock(Pred));
+
// Update any PHI nodes in the returning block to realize that we no
// longer branch to them.
BB->removePredecessor(Pred);
Added: llvm/branches/Apple/Tak/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll?rev=50339&view=auto
==============================================================================
--- llvm/branches/Apple/Tak/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll (added)
+++ llvm/branches/Apple/Tak/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll Mon Apr 28 01:34:05 2008
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; PR2256
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-mingw32"
+
+define { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval %Z, i1 %cond) nounwind {
+bb: ; preds = %entry
+ br i1 %cond, label %bb48, label %bb40
+
+bb40: ; preds = %bb
+ store i32 34, i32* null, align 4
+ br label %bb196
+
+bb48: ; preds = %bb.bb48_crit_edge, %entry.bb48_crit_edge
+ %tmp53 = icmp eq i32 0, 1280 ; [#uses=1]
+ br i1 %tmp53, label %bb56, label %bb174
+
+bb56: ; preds = %bb48
+ %iftmp.0.0 = select i1 false, x86_fp80 0xK3FFFC90FDAA22168C235, x86_fp80 0xKBFFFC90FDAA22168C235 ; [#uses=0]
+ br label %bb196
+
+
+bb174: ; preds = %bb144, %bb114
+ %tmp191 = mul x86_fp80 0xK00000000000000000000, 0xK3FFE8000000000000000 ; [#uses=1]
+ br label %bb196
+
+bb196: ; preds = %bb174, %bb56, %bb40
+ %Res.1.0 = phi x86_fp80 [ 0xK7FFF8000000000000000, %bb40 ], [ %tmp191, %bb174 ], [ 0xK00000000000000000000, %bb56 ] ; [#uses=1]
+ ret x86_fp80 0xK00000000000000000000, x86_fp80 %Res.1.0
+}
From isanbard at gmail.com Mon Apr 28 01:34:18 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Sun, 27 Apr 2008 23:34:18 -0700
Subject: [llvm-commits] [llvm] r50332 - in /llvm/trunk:
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll
In-Reply-To: <200804280019.m3S0J7In008978@zion.cs.uiuc.edu>
References: <200804280019.m3S0J7In008978@zion.cs.uiuc.edu>
Message-ID:
On Apr 27, 2008, at 5:19 PM, Chris Lattner wrote:
> Author: lattner
> Date: Sun Apr 27 19:19:07 2008
> New Revision: 50332
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50332&view=rev
> Log:
> Fix PR2256, yet another miscompilation in simplifycfg of i
> multiple return values.
>
> Bill, please pull this into Tak.
Done
-bw
From isanbard at gmail.com Mon Apr 28 01:35:17 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Sun, 27 Apr 2008 23:35:17 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r50333 -
/llvm-gcc-4.2/trunk/build_gcc
In-Reply-To: <200804280513.m3S5D8LD016871@zion.cs.uiuc.edu>
References: <200804280513.m3S5D8LD016871@zion.cs.uiuc.edu>
Message-ID: <38CD6817-7FBA-4C3F-9CDB-F99001D52ACD@gmail.com>
On Apr 27, 2008, at 10:13 PM, Devang Patel wrote:
> Author: dpatel
> Date: Mon Apr 28 00:13:07 2008
> New Revision: 50333
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50333&view=rev
> Log:
> Add FIXME note.
>
> 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=50333&r1=50332&r2=50333&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm-gcc-4.2/trunk/build_gcc (original)
> +++ llvm-gcc-4.2/trunk/build_gcc Mon Apr 28 00:13:07 2008
> @@ -410,6 +410,7 @@
> done
> done
>
> +# FIXME: What is the motivation here ?
If we do just sym-linking, then will coexistence still work?
-bw
> for t in $TARGETS ; do
> cp -p /usr/lib/libstdc++.6.dylib \
> .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc+
> +.dylib \
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From sabre at nondot.org Mon Apr 28 01:44:42 2008
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 28 Apr 2008 06:44:42 -0000
Subject: [llvm-commits] [llvm] r50340 - in /llvm/trunk:
include/llvm/ADT/SmallVector.h
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200804280644.m3S6ig0Y019478@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Apr 28 01:44:42 2008
New Revision: 50340
URL: http://llvm.org/viewvc/llvm-project?rev=50340&view=rev
Log:
Remove the SmallVector ctor that converts from a SmallVectorImpl. This
conversion open the door for many nasty implicit conversion issues, and
can be easily solved by initializing with (V.begin(), V.end()) when
needed.
This patch includes many small cleanups for sdisel also.
Modified:
llvm/trunk/include/llvm/ADT/SmallVector.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=50340&r1=50339&r2=50340&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Mon Apr 28 01:44:42 2008
@@ -491,16 +491,11 @@
operator=(RHS);
}
- SmallVector(const SmallVectorImpl &RHS)
- : SmallVectorImpl(NumTsAvailable) {
- if (!RHS.empty())
- operator=(RHS);
- }
-
const SmallVector &operator=(const SmallVector &RHS) {
SmallVectorImpl::operator=(RHS);
return *this;
}
+
};
} // End llvm namespace
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50340&r1=50339&r2=50340&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 01:44:42 2008
@@ -146,11 +146,11 @@
unsigned Reg, MVT::ValueType regvt, MVT::ValueType valuevt)
: TLI(&tli), Regs(1, Reg), RegVTs(1, regvt), ValueVTs(1, valuevt) {}
RegsForValue(const TargetLowering &tli,
- const SmallVectorImpl ®s,
+ const SmallVector ®s,
MVT::ValueType regvt, MVT::ValueType valuevt)
: TLI(&tli), Regs(regs), RegVTs(1, regvt), ValueVTs(1, valuevt) {}
RegsForValue(const TargetLowering &tli,
- const SmallVectorImpl ®s,
+ const SmallVector ®s,
const SmallVector ®vts,
const SmallVector &valuevts)
: TLI(&tli), Regs(regs), RegVTs(regvts), ValueVTs(valuevts) {}
@@ -360,16 +360,15 @@
/// the correctly promoted or expanded types. Assign these registers
/// consecutive vreg numbers and return the first assigned number.
unsigned FunctionLoweringInfo::CreateRegForValue(const Value *V) {
- const Type *Ty = V->getType();
SmallVector ValueVTs;
- ComputeValueVTs(TLI, Ty, ValueVTs);
+ ComputeValueVTs(TLI, V->getType(), ValueVTs);
unsigned FirstReg = 0;
for (unsigned Value = 0; Value != ValueVTs.size(); ++Value) {
MVT::ValueType ValueVT = ValueVTs[Value];
- unsigned NumRegs = TLI.getNumRegisters(ValueVT);
MVT::ValueType RegisterVT = TLI.getRegisterType(ValueVT);
+ unsigned NumRegs = TLI.getNumRegisters(ValueVT);
for (unsigned i = 0; i != NumRegs; ++i) {
unsigned R = MakeReg(RegisterVT);
if (!FirstReg) FirstReg = R;
@@ -1042,18 +1041,22 @@
if (N.Val) return N;
const Type *VTy = V->getType();
- MVT::ValueType VT = TLI.getValueType(VTy, true);
if (Constant *C = const_cast(dyn_cast(V))) {
- if (ConstantExpr *CE = dyn_cast(C)) {
- visit(CE->getOpcode(), *CE);
- SDOperand N1 = NodeMap[V];
- assert(N1.Val && "visit didn't populate the ValueMap!");
- return N1;
- } else if (GlobalValue *GV = dyn_cast(C)) {
+ MVT::ValueType VT = TLI.getValueType(VTy, true);
+
+ if (ConstantInt *CI = dyn_cast(C))
+ return N = DAG.getConstant(CI->getValue(), VT);
+
+ if (GlobalValue *GV = dyn_cast(C))
return N = DAG.getGlobalAddress(GV, VT);
- } else if (isa(C)) {
+
+ if (isa(C))
return N = DAG.getConstant(0, TLI.getPointerTy());
- } else if (isa(C)) {
+
+ if (ConstantFP *CFP = dyn_cast(C))
+ return N = DAG.getConstantFP(CFP->getValueAPF(), VT);
+
+ if (isa(C)) {
if (!isa(VTy))
return N = DAG.getNode(ISD::UNDEF, VT);
@@ -1067,44 +1070,46 @@
// Create a VConstant node with generic Vector type.
MVT::ValueType VT = MVT::getVectorType(PVT, NumElements);
- return N = DAG.getNode(ISD::BUILD_VECTOR, VT,
- &Ops[0], Ops.size());
- } else if (ConstantFP *CFP = dyn_cast(C)) {
- return N = DAG.getConstantFP(CFP->getValueAPF(), VT);
- } else if (const VectorType *PTy = dyn_cast(VTy)) {
- unsigned NumElements = PTy->getNumElements();
- MVT::ValueType PVT = TLI.getValueType(PTy->getElementType());
-
- // Now that we know the number and type of the elements, push a
- // Constant or ConstantFP node onto the ops list for each element of
- // the vector constant.
- SmallVector Ops;
- if (ConstantVector *CP = dyn_cast(C)) {
- for (unsigned i = 0; i != NumElements; ++i)
- Ops.push_back(getValue(CP->getOperand(i)));
- } else {
- assert(isa(C) && "Unknown vector constant!");
- SDOperand Op;
- if (MVT::isFloatingPoint(PVT))
- Op = DAG.getConstantFP(0, PVT);
- else
- Op = DAG.getConstant(0, PVT);
- Ops.assign(NumElements, Op);
- }
-
- // Create a BUILD_VECTOR node.
- MVT::ValueType VT = MVT::getVectorType(PVT, NumElements);
- return NodeMap[V] = DAG.getNode(ISD::BUILD_VECTOR, VT, &Ops[0],
- Ops.size());
+ return N = DAG.getNode(ISD::BUILD_VECTOR, VT, &Ops[0], Ops.size());
+ }
+
+ if (ConstantExpr *CE = dyn_cast(C)) {
+ visit(CE->getOpcode(), *CE);
+ SDOperand N1 = NodeMap[V];
+ assert(N1.Val && "visit didn't populate the ValueMap!");
+ return N1;
+ }
+
+ const VectorType *VecTy = cast(VTy);
+ unsigned NumElements = VecTy->getNumElements();
+ MVT::ValueType PVT = TLI.getValueType(VecTy->getElementType());
+
+ // Now that we know the number and type of the elements, push a
+ // Constant or ConstantFP node onto the ops list for each element of
+ // the vector constant.
+ SmallVector Ops;
+ if (ConstantVector *CP = dyn_cast(C)) {
+ for (unsigned i = 0; i != NumElements; ++i)
+ Ops.push_back(getValue(CP->getOperand(i)));
} else {
- // Canonicalize all constant ints to be unsigned.
- return N = DAG.getConstant(cast(C)->getValue(),VT);
+ assert(isa(C) && "Unknown vector constant!");
+ SDOperand Op;
+ if (MVT::isFloatingPoint(PVT))
+ Op = DAG.getConstantFP(0, PVT);
+ else
+ Op = DAG.getConstant(0, PVT);
+ Ops.assign(NumElements, Op);
}
+
+ // Create a BUILD_VECTOR node.
+ return NodeMap[V] = DAG.getNode(ISD::BUILD_VECTOR, VT, &Ops[0], Ops.size());
}
+ // If this is a static alloca, generate it as the frameindex instead of
+ // computation.
if (const AllocaInst *AI = dyn_cast(V)) {
std::map::iterator SI =
- FuncInfo.StaticAllocaMap.find(AI);
+ FuncInfo.StaticAllocaMap.find(AI);
if (SI != FuncInfo.StaticAllocaMap.end())
return DAG.getFrameIndex(SI->second, TLI.getPointerTy());
}
@@ -1114,7 +1119,6 @@
RegsForValue RFV(TLI, InReg, VTy);
SDOperand Chain = DAG.getEntryNode();
-
return RFV.getCopyFromRegs(DAG, Chain, NULL);
}
@@ -1124,6 +1128,7 @@
DAG.setRoot(DAG.getNode(ISD::RET, MVT::Other, getControlRoot()));
return;
}
+
SmallVector NewValues;
NewValues.push_back(getControlRoot());
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
@@ -3600,7 +3605,7 @@
MachineFunction &MF = DAG.getMachineFunction();
- SmallVector Regs;
+ SmallVector Regs;
// If this is a constraint for a single physreg, or a constraint for a
// register class, find it.
From dpatel at apple.com Mon Apr 28 01:49:24 2008
From: dpatel at apple.com (Devang Patel)
Date: Sun, 27 Apr 2008 23:49:24 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r50333 -
/llvm-gcc-4.2/trunk/build_gcc
In-Reply-To: <38CD6817-7FBA-4C3F-9CDB-F99001D52ACD@gmail.com>
References: <200804280513.m3S5D8LD016871@zion.cs.uiuc.edu>
<38CD6817-7FBA-4C3F-9CDB-F99001D52ACD@gmail.com>
Message-ID:
On Apr 27, 2008, at 11:35 PM, Bill Wendling wrote:
> If we do just sym-linking, then will coexistence still work?
Yes.
-
Devang
From clattner at apple.com Mon Apr 28 02:13:24 2008
From: clattner at apple.com (Chris Lattner)
Date: Mon, 28 Apr 2008 00:13:24 -0700
Subject: [llvm-commits] [llvm] r50279 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/Transforms/Scalar/CodeGenPrepare.cpp
test/CodeGen/Generic/multiple-return-values-cross-block-with-invoke.ll
In-Reply-To: <200804251827.m3PIRtH4003953@zion.cs.uiuc.edu>
References: <200804251827.m3PIRtH4003953@zion.cs.uiuc.edu>
Message-ID:
On Apr 25, 2008, at 11:27 AM, Dan Gohman wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=50279&view=rev
> Log:
> Remove the code from CodeGenPrepare that moved getresult instructions
> to the block that defines their operands. This doesn't work in the
> case that the operand is an invoke, because invoke is a terminator
> and must be the last instruction in a block.
Nice! Thanks for tackling this.
> /// RegsForValue - This struct represents the physical registers
> that a
> /// particular value is assigned and the type information about
> the value.
> /// This is needed because values can be promoted into larger
> registers and
> /// expanded into multiple smaller registers than the value.
> struct VISIBILITY_HIDDEN RegsForValue {
This should probably explicitly mention how it handles aggregates.
Maybe a good general summary up front could help my larger complaint
next:
...
> + /// RegVTs - The value types of the registers. This is the same
> size
> + /// as ValueVTs; every register contributing to a given value
> must
> + /// have the same type. When Regs contains all virtual
> registers, the
> + /// contents of RegVTs is redundant with TLI's getRegisterType
> member
> + /// function, however when Regs contains physical registers, it
> is
> + /// necessary to have a separate record of the types.
> ///
> + SmallVector RegVTs;
>
> + /// ValueVTs - The value types of the values, which may be
> promoted
> + /// or synthesized from one or more registers.
> + SmallVector ValueVTs;
The descriptions of these fields is not very clear to me. The
description of RegVTs forward references ValueVTs, maybe ValueVTs
should be moved first? It would be helpful to have an explanatory
comment here with an example. For example, on PPC, how is {i8, i64}
handled by these two vectors? Maybe 'Regs' should have a comment that
indicates it can contain pregs?
>
> +
> + RegsForValue() : TLI(0) {}
> +
> + RegsForValue(const TargetLowering &tli,
> + unsigned Reg, MVT::ValueType regvt, MVT::ValueType
> valuevt)
> + : TLI(&tli), Regs(1, Reg), RegVTs(1, regvt), ValueVTs(1,
> valuevt) {}
> + RegsForValue(const TargetLowering &tli,
> + const std::vector ®s,
> MVT::ValueType regvt, MVT::ValueType valuevt)
> + : TLI(&tli), Regs(regs), RegVTs(1, regvt), ValueVTs(1,
> valuevt) {}
> + RegsForValue(const TargetLowering &tli,
> + const std::vector ®s,
> + const SmallVector ®vts,
> + const SmallVector &valuevts)
> + : TLI(&tli), Regs(regs), RegVTs(regvts), ValueVTs(valuevts) {}
> + RegsForValue(const TargetLowering &tli,
> + unsigned Reg, const Type *Ty) : TLI(&tli) {
So many ctors... would it be reasonable to change clients to use one
of the more general ones instead of having so many ctors?
>
> + ComputeValueVTs(tli, Ty, ValueVTs);
> +
> + for (unsigned Value = 0; Value != ValueVTs.size(); ++Value) {
Please add a comment explaining what this loop is doing. Does
'ValueVTs.size()' need to be recomputed on every iteration?
>
> + MVT::ValueType ValueVT = ValueVTs[Value];
> + unsigned NumRegs = TLI->getNumRegisters(ValueVT);
> + MVT::ValueType RegisterVT = TLI->getRegisterType(ValueVT);
> + for (unsigned i = 0; i != NumRegs; ++i)
> + Regs.push_back(Reg + i);
> + RegVTs.push_back(RegisterVT);
> + Reg += NumRegs;
> + }
> }
> @@ -310,16 +362,22 @@
> /// the correctly promoted or expanded types. Assign these registers
> /// consecutive vreg numbers and return the first assigned number.
> unsigned FunctionLoweringInfo::CreateRegForValue(const Value *V) {
> + const Type *Ty = V->getType();
> + SmallVector ValueVTs;
> + ComputeValueVTs(TLI, Ty, ValueVTs);
> +
> + unsigned FirstReg = 0;
> + for (unsigned Value = 0; Value != ValueVTs.size(); ++Value) {
> + MVT::ValueType ValueVT = ValueVTs[Value];
> + unsigned NumRegs = TLI.getNumRegisters(ValueVT);
> + MVT::ValueType RegisterVT = TLI.getRegisterType(ValueVT);
>
> + for (unsigned i = 0; i != NumRegs; ++i) {
> + unsigned R = MakeReg(RegisterVT);
> + if (!FirstReg) FirstReg = R;
> + }
> + }
> + return FirstReg;
> }
The comments in this method should be improved to talk about what it
is now doing. Please mention aggregates. Could this code change to
use RegsForValue to compute the expansion? Maybe it should be a new
method on RegsForValue?
> @@ -3898,8 +3985,9 @@
> if ((NumOps & 7) == 2 /*REGDEF*/) {
> // Add NumOps>>3 registers to MatchedRegs.
> RegsForValue MatchedRegs;
> - MatchedRegs.ValueVT = InOperandVal.getValueType();
> - MatchedRegs.RegVT = AsmNodeOperands[CurOp
> +1].getValueType();
> + MatchedRegs.TLI = &TLI;
> + MatchedRegs.ValueVTs.resize(1,
> InOperandVal.getValueType());
> + MatchedRegs.RegVTs.resize(1, AsmNodeOperands[CurOp
> +1].getValueType());
Please use push_back, instead of resize(1, x)
> @@ -4304,21 +4392,14 @@
> }
>
> // Figure out the result value types. We start by making a list of
> + // the potentially illegal return value types.
> SmallVector LoweredRetTys;
> SmallVector RetTys;
> + ComputeValueVTs(*this, RetTy, RetTys);
>
> + // Then we translate that to a list of legal types.
> + for (unsigned I = 0, E = RetTys.size(); I != E; ++I) {
> + MVT::ValueType VT = RetTys[I];
> MVT::ValueType RegisterVT = getRegisterType(VT);
> unsigned NumRegs = getNumRegisters(VT);
> for (unsigned i = 0; i != NumRegs; ++i)
This seems like something that should be a method on RegsForValue.
> @@ -4441,19 +4522,11 @@
> cast(Op.getOperand(1))->getReg() != Reg) &&
> "Copy from a reg to the same reg!");
> assert(!TargetRegisterInfo::isPhysicalRegister(Reg) && "Is a
> physreg");
> + RegsForValue RFV(TLI, Reg, V->getType());
> + SDOperand Chain = DAG.getEntryNode();
> + RFV.getCopyToRegs(Op, DAG, Chain, 0);
> + PendingExports.push_back(Chain);
> }
I'm not sure if your patch is responsible, but it is very strange to
me that RegsForValue::getCopyToRegs takes 'Chain' byref and mutates
the input. Should RegsForValue::getCopyToRegs return a new chain
instead?
Thanks again for doing working on this Dan!
-Chris
From sabre at nondot.org Mon Apr 28 02:16:35 2008
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 28 Apr 2008 07:16:35 -0000
Subject: [llvm-commits] [llvm] r50341 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200804280716.m3S7GaHR020497@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Apr 28 02:16:35 2008
New Revision: 50341
URL: http://llvm.org/viewvc/llvm-project?rev=50341&view=rev
Log:
Another collection of random cleanups. No functionality change.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50341&r1=50340&r2=50341&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 02:16:35 2008
@@ -1040,9 +1040,8 @@
SDOperand &N = NodeMap[V];
if (N.Val) return N;
- const Type *VTy = V->getType();
if (Constant *C = const_cast(dyn_cast(V))) {
- MVT::ValueType VT = TLI.getValueType(VTy, true);
+ MVT::ValueType VT = TLI.getValueType(V->getType(), true);
if (ConstantInt *CI = dyn_cast(C))
return N = DAG.getConstant(CI->getValue(), VT);
@@ -1056,22 +1055,8 @@
if (ConstantFP *CFP = dyn_cast(C))
return N = DAG.getConstantFP(CFP->getValueAPF(), VT);
- if (isa(C)) {
- if (!isa(VTy))
- return N = DAG.getNode(ISD::UNDEF, VT);
-
- // Create a BUILD_VECTOR of undef nodes.
- const VectorType *PTy = cast(VTy);
- unsigned NumElements = PTy->getNumElements();
- MVT::ValueType PVT = TLI.getValueType(PTy->getElementType());
-
- SmallVector Ops;
- Ops.assign(NumElements, DAG.getNode(ISD::UNDEF, PVT));
-
- // Create a VConstant node with generic Vector type.
- MVT::ValueType VT = MVT::getVectorType(PVT, NumElements);
- return N = DAG.getNode(ISD::BUILD_VECTOR, VT, &Ops[0], Ops.size());
- }
+ if (isa(C) && !isa(V->getType()))
+ return N = DAG.getNode(ISD::UNDEF, VT);
if (ConstantExpr *CE = dyn_cast(C)) {
visit(CE->getOpcode(), *CE);
@@ -1080,24 +1065,27 @@
return N1;
}
- const VectorType *VecTy = cast(VTy);
+ const VectorType *VecTy = cast(V->getType());
unsigned NumElements = VecTy->getNumElements();
- MVT::ValueType PVT = TLI.getValueType(VecTy->getElementType());
- // Now that we know the number and type of the elements, push a
- // Constant or ConstantFP node onto the ops list for each element of
- // the vector constant.
- SmallVector Ops;
+ // Now that we know the number and type of the elements, get that number of
+ // elements into the Ops array based on what kind of constant it is.
+ SmallVector Ops;
if (ConstantVector *CP = dyn_cast(C)) {
for (unsigned i = 0; i != NumElements; ++i)
Ops.push_back(getValue(CP->getOperand(i)));
} else {
- assert(isa(C) && "Unknown vector constant!");
+ assert((isa(C) || isa(C)) &&
+ "Unknown vector constant!");
+ MVT::ValueType EltVT = TLI.getValueType(VecTy->getElementType());
+
SDOperand Op;
- if (MVT::isFloatingPoint(PVT))
- Op = DAG.getConstantFP(0, PVT);
+ if (isa(C))
+ Op = DAG.getNode(ISD::UNDEF, EltVT);
+ else if (MVT::isFloatingPoint(EltVT))
+ Op = DAG.getConstantFP(0, EltVT);
else
- Op = DAG.getConstant(0, PVT);
+ Op = DAG.getConstant(0, EltVT);
Ops.assign(NumElements, Op);
}
@@ -1117,7 +1105,7 @@
unsigned InReg = FuncInfo.ValueMap[V];
assert(InReg && "Value not in map!");
- RegsForValue RFV(TLI, InReg, VTy);
+ RegsForValue RFV(TLI, InReg, V->getType());
SDOperand Chain = DAG.getEntryNode();
return RFV.getCopyFromRegs(DAG, Chain, NULL);
}
@@ -3368,17 +3356,17 @@
if (isa(I.getOperand(0))) {
SDOperand Undef = DAG.getNode(ISD::UNDEF, TLI.getValueType(I.getType()));
setValue(&I, Undef);
- } else {
- SDOperand Call = getValue(I.getOperand(0));
-
- // To add support for individual return values with aggregate types,
- // we'd need a way to take a getresult index and determine which
- // values of the Call SDNode are associated with it.
- assert(TLI.getValueType(I.getType(), true) != MVT::Other &&
- "Individual return values must not be aggregates!");
-
- setValue(&I, SDOperand(Call.Val, I.getIndex()));
+ return;
}
+
+ // To add support for individual return values with aggregate types,
+ // we'd need a way to take a getresult index and determine which
+ // values of the Call SDNode are associated with it.
+ assert(TLI.getValueType(I.getType(), true) != MVT::Other &&
+ "Individual return values must not be aggregates!");
+
+ SDOperand Call = getValue(I.getOperand(0));
+ setValue(&I, SDOperand(Call.Val, I.getIndex()));
}
@@ -3387,23 +3375,27 @@
/// Chain/Flag as the input and updates them for the output Chain/Flag.
/// If the Flag pointer is NULL, no flag is used.
SDOperand RegsForValue::getCopyFromRegs(SelectionDAG &DAG,
- SDOperand &Chain, SDOperand *Flag)const{
+ SDOperand &Chain,
+ SDOperand *Flag) const {
// Assemble the legal parts into the final values.
SmallVector Values(ValueVTs.size());
- for (unsigned Value = 0, Part = 0; Value != ValueVTs.size(); ++Value) {
+ SmallVector Parts;
+ for (unsigned Value = 0, Part = 0, e = ValueVTs.size(); Value != e; ++Value) {
// Copy the legal parts from the registers.
MVT::ValueType ValueVT = ValueVTs[Value];
unsigned NumRegs = TLI->getNumRegisters(ValueVT);
MVT::ValueType RegisterVT = RegVTs[Value];
- SmallVector Parts(NumRegs);
+ Parts.resize(NumRegs);
for (unsigned i = 0; i != NumRegs; ++i) {
- SDOperand P = Flag ?
- DAG.getCopyFromReg(Chain, Regs[Part+i], RegisterVT, *Flag) :
- DAG.getCopyFromReg(Chain, Regs[Part+i], RegisterVT);
- Chain = P.getValue(1);
- if (Flag)
+ SDOperand P;
+ if (Flag == 0)
+ P = DAG.getCopyFromReg(Chain, Regs[Part+i], RegisterVT);
+ else {
+ P = DAG.getCopyFromReg(Chain, Regs[Part+i], RegisterVT, *Flag);
*Flag = P.getValue(2);
+ }
+ Chain = P.getValue(1);
Parts[Part+i] = P;
}
@@ -3411,6 +3403,10 @@
ValueVT);
Part += NumRegs;
}
+
+ if (ValueVTs.size() == 1)
+ return Values[0];
+
return DAG.getNode(ISD::MERGE_VALUES,
DAG.getVTList(&ValueVTs[0], ValueVTs.size()),
&Values[0], ValueVTs.size());
@@ -3425,7 +3421,7 @@
// Get the list of the values's legal parts.
unsigned NumRegs = Regs.size();
SmallVector Parts(NumRegs);
- for (unsigned Value = 0, Part = 0; Value != ValueVTs.size(); ++Value) {
+ for (unsigned Value = 0, Part = 0, e = ValueVTs.size(); Value != e; ++Value) {
MVT::ValueType ValueVT = ValueVTs[Value];
unsigned NumParts = TLI->getNumRegisters(ValueVT);
MVT::ValueType RegisterVT = RegVTs[Value];
@@ -3438,14 +3434,20 @@
// Copy the parts into the registers.
SmallVector Chains(NumRegs);
for (unsigned i = 0; i != NumRegs; ++i) {
- SDOperand Part = Flag ?
- DAG.getCopyToReg(Chain, Regs[i], Parts[i], *Flag) :
- DAG.getCopyToReg(Chain, Regs[i], Parts[i]);
- Chains[i] = Part.getValue(0);
- if (Flag)
+ SDOperand Part;
+ if (Flag == 0)
+ Part = DAG.getCopyToReg(Chain, Regs[i], Parts[i]);
+ else {
+ Part = DAG.getCopyToReg(Chain, Regs[i], Parts[i], *Flag);
*Flag = Part.getValue(1);
+ }
+ Chains[i] = Part.getValue(0);
}
- Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, &Chains[0], NumRegs);
+
+ if (NumRegs == 1)
+ Chain = Chains[0];
+ else
+ Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, &Chains[0], NumRegs);
}
/// AddInlineAsmOperands - Add this value to the specified inlineasm node
@@ -3455,15 +3457,11 @@
std::vector &Ops) const {
MVT::ValueType IntPtrTy = DAG.getTargetLoweringInfo().getPointerTy();
Ops.push_back(DAG.getTargetConstant(Code | (Regs.size() << 3), IntPtrTy));
- for (unsigned Value = 0, Reg = 0; Value != ValueVTs.size(); ++Value) {
- MVT::ValueType ValueVT = ValueVTs[Value];
- unsigned NumRegs = TLI->getNumRegisters(ValueVT);
+ for (unsigned Value = 0, Reg = 0, e = ValueVTs.size(); Value != e; ++Value) {
+ unsigned NumRegs = TLI->getNumRegisters(ValueVTs[Value]);
MVT::ValueType RegisterVT = RegVTs[Value];
- for (unsigned i = 0; i != NumRegs; ++i) {
- SDOperand RegOp = DAG.getRegister(Regs[Reg+i], RegisterVT);
- Ops.push_back(RegOp);
- }
- Reg += NumRegs;
+ for (unsigned i = 0; i != NumRegs; ++i)
+ Ops.push_back(DAG.getRegister(Regs[Reg++], RegisterVT));
}
}
@@ -4524,8 +4522,7 @@
return true;
}
-void SelectionDAGLowering::CopyValueToVirtualRegister(Value *V,
- unsigned Reg) {
+void SelectionDAGLowering::CopyValueToVirtualRegister(Value *V, unsigned Reg) {
SDOperand Op = getValue(V);
assert((Op.getOpcode() != ISD::CopyFromReg ||
cast(Op.getOperand(1))->getReg() != Reg) &&
From asl at math.spbu.ru Mon Apr 28 02:40:07 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 28 Apr 2008 07:40:07 -0000
Subject: [llvm-commits] [llvm] r50342 -
/llvm/trunk/lib/Target/X86/X86CallingConv.td
Message-ID: <200804280740.m3S7e7MU026455@zion.cs.uiuc.edu>
Author: asl
Date: Mon Apr 28 02:40:07 2008
New Revision: 50342
URL: http://llvm.org/viewvc/llvm-project?rev=50342&view=rev
Log:
Fix FP return for Win64 ABI
Modified:
llvm/trunk/lib/Target/X86/X86CallingConv.td
Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=50342&r1=50341&r2=50342&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon Apr 28 02:40:07 2008
@@ -83,6 +83,10 @@
// The X86-Win64 calling convention always returns __m64 values in RAX.
CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToReg<[RAX]>>,
+ // And FP in XMM0 only.
+ CCIfType<[f32], CCAssignToReg<[XMM0]>>,
+ CCIfType<[f64], CCAssignToReg<[XMM0]>>,
+
// Otherwise, everything is the same as 'normal' X86-64 C CC.
CCDelegateTo
]>;
From nicolas.geoffray at lip6.fr Mon Apr 28 03:49:15 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 08:49:15 -0000
Subject: [llvm-commits] [vmkit] r50343 -
/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
Message-ID: <200804280849.m3S8nF0v031239@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 03:49:14 2008
New Revision: 50343
URL: http://llvm.org/viewvc/llvm-project?rev=50343&view=rev
Log:
Do no empty used_nodes after a collection: otherwise all objects
previously allocated will never be collected.
Modified:
vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp?rev=50343&r1=50342&r2=50343&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp Mon Apr 28 03:49:14 2008
@@ -91,7 +91,6 @@
//printf(" !!!! reject %p [%p]\n", cur->chunk()->_2gc(), cur);
allocator->reject_chunk(cur);
}
- used_nodes->alone();
}
void GCCollector::collect_unprotect() {
From nicolas.geoffray at lip6.fr Mon Apr 28 03:51:16 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 08:51:16 -0000
Subject: [llvm-commits] [vmkit] r50344 - in /vmkit/trunk/lib/JnJVM:
Classpath/ClasspathVMRuntime.cpp VMCore/NativeUtil.cpp
Message-ID: <200804280851.m3S8pGex031311@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 03:51:15 2008
New Revision: 50344
URL: http://llvm.org/viewvc/llvm-project?rev=50344&view=rev
Log:
A service environment shares the native libraries with the bootstrap
virtual machine.
Modified:
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp
vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp?rev=50344&r1=50343&r2=50344&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp Mon Apr 28 03:51:15 2008
@@ -66,7 +66,11 @@
jobject _str,
jobject _loader) {
JavaString* str = (JavaString*)_str;
+#ifndef SERVICE_VM
Jnjvm* vm = JavaThread::get()->isolate;
+#else
+ Jnjvm* vm = Jnjvm::bootstrapVM;
+#endif
char* buf = str->strToAsciiz();
Modified: vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp?rev=50344&r1=50343&r2=50344&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp Mon Apr 28 03:51:15 2008
@@ -182,7 +182,11 @@
static void* loadName(char* buf, bool& jnjvm) {
void* res = dlsym(0, buf);
if (!res) {
- Jnjvm *vm = JavaThread::get()->isolate;
+#ifndef SERVICE_VM
+ Jnjvm* vm = JavaThread::get()->isolate;
+#else
+ Jnjvm* vm = Jnjvm::bootstrapVM;
+#endif
for (std::vector::iterator i = vm->nativeLibs.begin(),
e = vm->nativeLibs.end(); i!= e; ++i) {
res = dlsym((*i), buf);
From nicolas.geoffray at lip6.fr Mon Apr 28 04:00:49 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 09:00:49 -0000
Subject: [llvm-commits] [vmkit] r50345 -
/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
Message-ID: <200804280900.m3S90oV3031608@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 04:00:49 2008
New Revision: 50345
URL: http://llvm.org/viewvc/llvm-project?rev=50345&view=rev
Log:
A type in a constant pool is allocated on behalf of the class of the
constant pool.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp?rev=50345&r1=50344&r2=50345&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Mon Apr 28 04:00:49 2008
@@ -343,7 +343,7 @@
}
sint32 entry = ctpDef[index];
const UTF8* type = UTF8At(entry & 0xFFFF);
- Typedef* sign = JavaThread::get()->isolate->constructType(type);
+ Typedef* sign = classDef->isolate->constructType(type);
ctpRes[index] = sign;
return sign;
}
From nicolas.geoffray at lip6.fr Mon Apr 28 04:01:56 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 09:01:56 -0000
Subject: [llvm-commits] [vmkit] r50346 -
/vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp
Message-ID: <200804280901.m3S91uud031650@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 04:01:56 2008
New Revision: 50346
URL: http://llvm.org/viewvc/llvm-project?rev=50346&view=rev
Log:
At startup of a service environment, allocate a bootstrap service that
will bootstrap the JVM.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp?rev=50346&r1=50345&r2=50346&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp Mon Apr 28 04:01:56 2008
@@ -30,6 +30,10 @@
#include "LockedMap.h"
#include "Zip.h"
+#ifdef SERVICE_VM
+#include "ServiceDomain.h"
+#endif
+
using namespace jnjvm;
static void initialiseVT() {
@@ -69,6 +73,9 @@
INIT(JavaString);
INIT(CacheNode);
INIT(Enveloppe);
+#ifdef SERVICE_VM
+ INIT(ServiceDomain);
+#endif
#undef INIT
#define INIT(X) { \
@@ -204,7 +211,6 @@
void handler(int val, siginfo_t* info, void* addr) {
printf("Crash in JnJVM at %p\n", addr);
- JavaJIT::printBacktrace();
assert(0);
}
@@ -237,11 +243,16 @@
}
extern "C" int start_app(int argc, char** argv) {
-#if defined(SERVICE_VM) || !defined(MULTIPLE_VM)
+#if !defined(MULTIPLE_VM)
JavaIsolate* vm = (JavaIsolate*)JavaIsolate::bootstrapVM;
#else
+#ifdef SERVICE_VM
+ ServiceDomain* vm = ServiceDomain::allocateService((JavaIsolate*)Jnjvm::bootstrapVM);
+ JavaThread::get()->isolate = vm;
+#else
JavaIsolate* vm = JavaIsolate::allocateIsolate(JavaIsolate::bootstrapVM);
#endif
+#endif
vm->runMain(argc, argv);
return 0;
}
From nicolas.geoffray at lip6.fr Mon Apr 28 04:03:04 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 09:03:04 -0000
Subject: [llvm-commits] [vmkit] r50347 -
/vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
Message-ID: <200804280903.m3S934nL032140@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 04:03:03 2008
New Revision: 50347
URL: http://llvm.org/viewvc/llvm-project?rev=50347&view=rev
Log:
Classes meta-globalvariable can be emitted even if they are not ready (ie clinited).
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp?rev=50347&r1=50346&r2=50347&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Mon Apr 28 04:03:03 2008
@@ -1842,7 +1842,7 @@
BranchInst::Create(ifTrue, ifFalse, cmp, currentBlock);
currentBlock = ifFalse;
Value* clVar = 0;
- if (dcl && dcl->isReady()) {
+ if (dcl) {
clVar = new LoadInst(dcl->llvmVar(compilingClass->isolate->module), "", ifFalse);
} else {
clVar = getResolvedClass(index, false);
@@ -1879,7 +1879,7 @@
compilingClass->ctpInfo->getMethodClassIfLoaded(index);
Value* clVar = 0;
- if (dcl && dcl->isReady()) {
+ if (dcl) {
clVar = new LoadInst(dcl->llvmVar(compilingClass->isolate->module), "", currentBlock);
} else {
clVar = getResolvedClass(index, false);
From nicolas.geoffray at lip6.fr Mon Apr 28 04:21:34 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 09:21:34 -0000
Subject: [llvm-commits] [vmkit] r50348 - in /vmkit/trunk/lib/JnJVM/VMCore:
JavaClass.cpp JavaClass.h JavaIsolate.cpp JavaJIT.cpp JavaJIT.h
JavaJITInitialise.cpp JavaMetaJIT.cpp JavaRuntimeJIT.cpp Jnjvm.cpp
LockedMap.h ServiceDomain.cpp VirtualTables.cpp
Message-ID: <200804280921.m3S9LZPd032756@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 04:21:34 2008
New Revision: 50348
URL: http://llvm.org/viewvc/llvm-project?rev=50348&view=rev
Log:
Multi-vm improvements:
- Correct initialization of classes (JavaState and vm argument)
- Static instances of classes loaded by app class loaders are not
unique anymore (make room for code sharing between class loaders)
- getstatic and putstatic: when the class is not resolved, the runtime
callback does not update the global variable and index, just the
constant pool.
Service-vm improvements:
- Check if a call is a service call in the called function, not in
the caller (TODO: optimize static calls since we know at compilation
time if it's a service call or not).
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h
vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp
vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Mon Apr 28 04:21:34 2008
@@ -608,15 +608,10 @@
#ifdef MULTIPLE_VM
JavaObject* Class::staticInstance() {
- if (isolate == Jnjvm::bootstrapVM) {
- Class* cl = this;
- std::pair* val =
- JavaThread::get()->isolate->statics->lookup(cl);
- assert(val);
- return val->second;
- } else {
- return _staticInstance;
- }
+ std::pair* val =
+ JavaThread::get()->isolate->statics->lookup(this);
+ assert(val);
+ return val->second;
}
void Class::createStaticInstance() {
@@ -629,35 +624,28 @@
(*i)->initField(val);
}
- if (isolate == Jnjvm::bootstrapVM) {
- std::pair* v =
- new std::pair(0, val);
- JavaThread::get()->isolate->statics->hash(this, v);
- } else {
- _staticInstance = val;
- }
+
+ Jnjvm* vm = JavaThread::get()->isolate;
+ std::pair* p = vm->statics->lookup(this);
+ assert(p);
+ assert(!p->second);
+ p->second = val;
}
-bool CommonClass::isReady() {
- if (isolate == Jnjvm::bootstrapVM && !this->isArray &&
+JavaState* CommonClass::getStatus() {
+ if (!this->isArray &&
!AssessorDesc::bogusClassToPrimitive(this)) {
Class* cl = (Class*)this;
- std::pair* val =
- JavaThread::get()->isolate->statics->lookup(cl);
- return val && val->first;
- } else {
- return status == ready;
- }
-}
-
-void CommonClass::setReady() {
- if (isolate == Jnjvm::bootstrapVM && !this->isArray &&
- !AssessorDesc::bogusClassToPrimitive(this)) {
- std::pair* val =
- JavaThread::get()->isolate->statics->lookup((Class*)this);
- val->first = 1;
+ Jnjvm* vm = JavaThread::get()->isolate;
+ std::pair* val = vm->statics->lookup(cl);
+ if (!val) {
+ val = new std::pair(status, 0);
+ JavaThread::get()->isolate->statics->hash(cl, val);
+ }
+ if (val->first < status) val->first = status;
+ return (JavaState*)&(val->first);
} else {
- status = ready;
+ return &status;
}
}
#endif
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Mon Apr 28 04:21:34 2008
@@ -35,6 +35,7 @@
class Class;
class JavaCtpInfo;
class JavaField;
+class JavaJIT;
class JavaMethod;
class JavaObject;
class Jnjvm;
@@ -73,6 +74,8 @@
};
class CommonClass : public mvm::Object {
+public:
+ JavaObject* classLoader;
private:
llvm::GlobalVariable* _llvmVar;
#ifndef MULTIPLE_VM
@@ -93,7 +96,6 @@
std::vector staticMethods;
std::vector virtualFields;
std::vector staticFields;
- JavaObject* classLoader;
#ifndef MULTIPLE_VM
JavaObject* delegatee;
#endif
@@ -147,15 +149,17 @@
void resolveClass(bool doClinit);
#ifndef MULTIPLE_VM
+ JavaState* getStatus() {
+ return &status;
+ }
bool isReady() {
return status == ready;
}
- void setReady() {
- status = ready;
- }
#else
- bool isReady();
- void setReady();
+ JavaState* getStatus();
+ bool isReady() {
+ return *getStatus() == ready;
+ }
#endif
bool isResolved() {
return status >= resolved;
@@ -171,7 +175,6 @@
unsigned int minor;
unsigned int major;
ArrayUInt8* bytes;
- JavaObject* _staticInstance;
JavaObject* virtualInstance;
llvm::Function* virtualTracer;
llvm::Function* staticTracer;
@@ -185,7 +188,7 @@
bool innerOuterResolved;
void resolveFields();
- llvm::Value* staticVar(llvm::Module* compilingModule, llvm::BasicBlock* BB);
+ llvm::Value* staticVar(JavaJIT* jit);
uint64 virtualSize;
VirtualTable* virtualVT;
@@ -200,6 +203,7 @@
JavaObject* operator()(Jnjvm* vm);
#ifndef MULTIPLE_VM
+ JavaObject* _staticInstance;
JavaObject* staticInstance() {
return _staticInstance;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Mon Apr 28 04:21:34 2008
@@ -29,6 +29,10 @@
#include "LockedMap.h"
#include "Zip.h"
+#ifdef SERVICE_VM
+#include "ServiceDomain.h"
+#endif
+
#define PATH_MANIFEST "META-INF/MANIFEST.MF"
#define MAIN_CLASS "Main-Class: "
#define PREMAIN_CLASS "Premain-Class: "
@@ -382,6 +386,9 @@
argc = argc - pos + 1;
loadBootstrap();
+#ifdef SERVICE_VM
+ (*Classpath::vmdataClassLoader)(appClassLoader, (JavaObject*)this);
+#endif
if (info.agents.size()) {
assert(0 && "implement me");
@@ -397,7 +404,7 @@
for (int i = 2; i < argc; ++i) {
args->setAt(i - 2, (JavaObject*)asciizToStr(argv[i]));
}
-
+
executeClass(info.className, args);
waitForExit();
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Mon Apr 28 04:21:34 2008
@@ -98,7 +98,7 @@
uint32 JavaJIT::stackSize() {
return stack.size();
}
-
+
void JavaJIT::invokeVirtual(uint16 index) {
JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
@@ -109,7 +109,8 @@
if ((cl && isFinal(cl->access)) ||
(meth && (isFinal(meth->access) || isPrivate(meth->access))))
return invokeSpecial(index);
-
+
+
#ifndef WITHOUT_VTABLE
Constant* zero = mvm::jit::constantZero;
Signdef* signature = ctpInfo->infoOfInterfaceOrVirtualMethod(index);
@@ -119,7 +120,7 @@
makeArgs(it, index, args, signature->nbIn + 1);
JITVerifyNull(args[0]);
-
+
std::vector indexes; //[3];
indexes.push_back(zero);
indexes.push_back(zero);
@@ -174,7 +175,9 @@
Value* Func = new LoadInst(FuncPtr, "", currentBlock);
Func = new BitCastInst(Func, signature->virtualTypePtr, "", currentBlock);
+
Value* val = invoke(Func, args, "", currentBlock);
+
const llvm::Type* retType = signature->virtualType->getReturnType();
if (retType != Type::VoidTy) {
push(val, signature->ret->funcs);
@@ -182,6 +185,7 @@
push(mvm::jit::constantZero, AssessorDesc::dInt);
}
}
+
#else
return invokeInterfaceOrVirtual(index);
#endif
@@ -299,8 +303,7 @@
if (isVirtual(compilingMethod->access)) {
argsSync.push_back(llvmFunction->arg_begin());
} else {
- Module* M = compilingClass->isolate->module;
- Value* arg = compilingClass->staticVar(M, currentBlock);
+ Value* arg = compilingClass->staticVar(this);
argsSync.push_back(arg);
}
llvm::CallInst::Create(aquireObjectLLVM, argsSync.begin(), argsSync.end(),
@@ -312,8 +315,7 @@
if (isVirtual(compilingMethod->access)) {
argsSync.push_back(llvmFunction->arg_begin());
} else {
- Module* M = compilingClass->isolate->module;
- Value* arg = compilingClass->staticVar(M, currentBlock);
+ Value* arg = compilingClass->staticVar(this);
argsSync.push_back(arg);
}
llvm::CallInst::Create(releaseObjectLLVM, argsSync.begin(), argsSync.end(), "",
@@ -349,6 +351,7 @@
const FunctionType *funcType = compilingMethod->llvmType;
returnType = funcType->getReturnType();
+ endBlock = createBasicBlock("end");
llvmFunction = parentFunction;
currentBlock = curBB;
@@ -409,13 +412,25 @@
JavaObject* loader = compilingClass->classLoader;
ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
isolateLocal = new LoadInst(vm->llvmDelegatee(), "", currentBlock);
+ Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, args[args.size() - 1],
+ isolateLocal, "", currentBlock);
+ BasicBlock* ifTrue = createBasicBlock("true service call");
+ BasicBlock* endBlock = createBasicBlock("end check service call");
+ BranchInst::Create(ifTrue, endBlock, cmp, currentBlock);
+ currentBlock = ifTrue;
+ std::vector Args;
+ Args.push_back(args[args.size()- 1]);
+ Args.push_back(isolateLocal);
+ CallInst::Create(ServiceDomain::serviceCallStartLLVM, Args.begin(),
+ Args.end(), "", currentBlock);
+ BranchInst::Create(endBlock, currentBlock);
+ currentBlock = endBlock;
}
#endif
#endif
exploreOpcodes(&compilingClass->bytes->elements[start], codeLen);
- endBlock = createBasicBlock("end");
if (returnType != Type::VoidTy) {
endNode = llvm::PHINode::Create(returnType, "", endBlock);
@@ -425,6 +440,25 @@
PRINT_DEBUG(JNJVM_COMPILE, 1, COLOR_NORMAL, "--> end inline compiling %s\n",
compilingMethod->printString());
+
+#if defined(SERVICE_VM)
+ if (compilingClass->isolate != Jnjvm::bootstrapVM) {
+ Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, args[args.size() - 1],
+ isolateLocal, "", currentBlock);
+ BasicBlock* ifTrue = createBasicBlock("true service call");
+ BasicBlock* newEndBlock = createBasicBlock("end check service call");
+ BranchInst::Create(ifTrue, newEndBlock, cmp, currentBlock);
+ currentBlock = ifTrue;
+ std::vector Args;
+ Args.push_back(args[args.size() - 1]);
+ Args.push_back(isolateLocal);
+ CallInst::Create(ServiceDomain::serviceCallStopLLVM, Args.begin(),
+ Args.end(), "", currentBlock);
+ BranchInst::Create(newEndBlock, currentBlock);
+ currentBlock = newEndBlock;
+ endBlock = currentBlock;
+ }
+#endif
curBB = endBlock;
return endNode;
@@ -460,7 +494,7 @@
Function* func = llvmFunction = compilingMethod->llvmFunction;
- BasicBlock* startBlock = currentBlock = createBasicBlock("start");
+ currentBlock = createBasicBlock("start");
endExceptionBlock = createBasicBlock("endExceptionBlock");
unifiedUnreachable = createBasicBlock("unifiedUnreachable");
@@ -481,9 +515,7 @@
}
#endif
- unsigned nbe = readExceptionTable(reader);
- currentBlock = startBlock;
for (int i = 0; i < maxLocals; i++) {
intLocals.push_back(new AllocaInst(Type::Int32Ty, "", currentBlock));
@@ -534,10 +566,25 @@
JavaObject* loader = compilingClass->classLoader;
ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
isolateLocal = new LoadInst(vm->llvmDelegatee(), "", currentBlock);
+ Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, i, isolateLocal, "",
+ currentBlock);
+ BasicBlock* ifTrue = createBasicBlock("true service call");
+ BasicBlock* endBlock = createBasicBlock("end check service call");
+ BranchInst::Create(ifTrue, endBlock, cmp, currentBlock);
+ currentBlock = ifTrue;
+ std::vector Args;
+ Args.push_back(i);
+ Args.push_back(isolateLocal);
+ CallInst::Create(ServiceDomain::serviceCallStartLLVM, Args.begin(),
+ Args.end(), "", currentBlock);
+ BranchInst::Create(endBlock, currentBlock);
+ currentBlock = endBlock;
}
#endif
#endif
+ unsigned nbe = readExceptionTable(reader);
+
exploreOpcodes(&compilingClass->bytes->elements[start], codeLen);
@@ -567,11 +614,29 @@
currentBlock);
}
#endif
+
+#if defined(SERVICE_VM)
+ if (compilingClass->isolate != Jnjvm::bootstrapVM) {
+ Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, i, isolateLocal, "",
+ currentBlock);
+ BasicBlock* ifTrue = createBasicBlock("true service call");
+ BasicBlock* newEndBlock = createBasicBlock("end check service call");
+ BranchInst::Create(ifTrue, newEndBlock, cmp, currentBlock);
+ currentBlock = ifTrue;
+ std::vector Args;
+ Args.push_back(i);
+ Args.push_back(isolateLocal);
+ CallInst::Create(ServiceDomain::serviceCallStopLLVM, Args.begin(),
+ Args.end(), "", currentBlock);
+ BranchInst::Create(newEndBlock, currentBlock);
+ currentBlock = newEndBlock;
+ }
+#endif
if (returnType != Type::VoidTy)
- llvm::ReturnInst::Create(endNode, endBlock);
+ llvm::ReturnInst::Create(endNode, currentBlock);
else
- llvm::ReturnInst::Create(endBlock);
+ llvm::ReturnInst::Create(currentBlock);
pred_iterator PI = pred_begin(endExceptionBlock);
pred_iterator PE = pred_end(endExceptionBlock);
@@ -623,6 +688,7 @@
unsigned JavaJIT::readExceptionTable(Reader* reader) {
+ BasicBlock* temp = currentBlock;
uint16 nbe = reader->readU2();
std::vector exceptions;
unsigned sync = isSynchro(compilingMethod->access) ? 1 : 0;
@@ -634,6 +700,7 @@
}
BasicBlock* realEndExceptionBlock = endExceptionBlock;
+ currentExceptionBlock = endExceptionBlock;
if (sync) {
BasicBlock* synchronizeExceptionBlock =
createBasicBlock("synchronizeExceptionBlock");
@@ -644,8 +711,7 @@
if (isVirtual(compilingMethod->access)) {
argsSync.push_back(llvmFunction->arg_begin());
} else {
- Value* arg = compilingClass->staticVar(compilingClass->isolate->module,
- currentBlock);
+ Value* arg = compilingClass->staticVar(this);
argsSync.push_back(arg);
}
llvm::CallInst::Create(releaseObjectLLVM, argsSync.begin(), argsSync.end(),
@@ -817,7 +883,8 @@
e = exceptions.end(); i!= e; ++i) {
delete *i;
}
-
+
+ currentBlock = temp;
return nbe;
}
@@ -850,9 +917,7 @@
const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
void* val = 0;
GlobalVariable* gv = 0;
-#ifdef MULTIPLE_VM
- if (compilingClass->isolate != Jnjvm::bootstrapVM) {
-#endif
+#ifndef MULTIPLE_VM
val = compilingClass->isolate->UTF8ToStr(utf8);
compilingClass->isolate->protectModule->lock();
gv =
@@ -861,8 +926,7 @@
constantJavaObjectNull, "",
compilingClass->isolate->module);
compilingClass->isolate->protectModule->unlock();
-#ifdef MULTIPLE_VM
- } else {
+#else
val = (void*)utf8;
compilingClass->isolate->protectModule->lock();
gv =
@@ -871,7 +935,6 @@
constantUTF8Null, "",
compilingClass->isolate->module);
compilingClass->isolate->protectModule->unlock();
- }
#endif
// TODO: put an initialiser in here
@@ -893,13 +956,12 @@
currentBlock);
}
#ifdef MULTIPLE_VM
- if (compilingClass->isolate == Jnjvm::bootstrapVM) {
- CallInst* C = llvm::CallInst::Create(runtimeUTF8ToStrLLVM, toPush, "",
- currentBlock);
- push(C, AssessorDesc::dRef);
- } else
-#endif
+ CallInst* C = llvm::CallInst::Create(runtimeUTF8ToStrLLVM, toPush, "",
+ currentBlock);
+ push(C, AssessorDesc::dRef);
+#else
push(toPush, AssessorDesc::dRef);
+#endif
} else if (type == JavaCtpInfo::ConstantLong) {
mvm::jit::protectConstants();//->lock();
push(ConstantInt::get(Type::Int64Ty, ctpInfo->LongAt(index)),
@@ -1285,7 +1347,7 @@
if (!val) {
Function* func = ctpInfo->infoOfStaticOrSpecialMethod(index, ACC_VIRTUAL,
signature, meth);
-#ifdef SERVICE_VM
+#if 0//def SERVICE_VM
bool serviceCall = false;
if (meth && meth->classDef->classLoader != compilingClass->classLoader &&
meth->classDef->isolate != Jnjvm::bootstrapVM){
@@ -1294,7 +1356,7 @@
serviceCall = true;
std::vector Args;
Args.push_back(isolateLocal);
- Args.push_back(calling->llvmDelegatee());
+ Args.push_back(new LoadInst(calling->llvmDelegatee(), "", currentBlock));
CallInst::Create(ServiceDomain::serviceCallStartLLVM, Args.begin(),
Args.end(), "", currentBlock);
}
@@ -1307,14 +1369,14 @@
val = invoke(func, args, "", currentBlock);
}
-#ifdef SERVICE_VM
+#if 0//def SERVICE_VM
if (serviceCall) {
JavaObject* loader = meth->classDef->classLoader;
ServiceDomain* calling = ServiceDomain::getDomainFromLoader(loader);
serviceCall = true;
std::vector Args;
Args.push_back(isolateLocal);
- Args.push_back(calling->llvmDelegatee());
+ Args.push_back(new LoadInst(calling->llvmDelegatee(), "", currentBlock));
CallInst::Create(ServiceDomain::serviceCallStopLLVM, Args.begin(),
Args.end(), "", currentBlock);
}
@@ -1353,7 +1415,7 @@
Function* func = ctpInfo->infoOfStaticOrSpecialMethod(index, ACC_STATIC,
signature, meth);
-#ifdef SERVICE_VM
+#if 0//def SERVICE_VM
bool serviceCall = false;
if (meth && meth->classDef->classLoader != compilingClass->classLoader &&
meth->classDef->isolate != Jnjvm::bootstrapVM){
@@ -1362,7 +1424,7 @@
serviceCall = true;
std::vector Args;
Args.push_back(isolateLocal);
- Args.push_back(calling->llvmDelegatee());
+ Args.push_back(new LoadInst(calling->llvmDelegatee(), "", currentBlock));
CallInst::Create(ServiceDomain::serviceCallStartLLVM, Args.begin(),
Args.end(), "", currentBlock);
}
@@ -1375,13 +1437,13 @@
val = invoke(func, args, "", currentBlock);
}
-#ifdef SERVICE_VM
+#if 0//def SERVICE_VM
if (serviceCall) {
JavaObject* loader = meth->classDef->classLoader;
ServiceDomain* calling = ServiceDomain::getDomainFromLoader(loader);
std::vector Args;
Args.push_back(isolateLocal);
- Args.push_back(calling->llvmDelegatee());
+ Args.push_back(new LoadInst(calling->llvmDelegatee(), "", currentBlock));
CallInst::Create(ServiceDomain::serviceCallStopLLVM, Args.begin(), Args.end(), "",
currentBlock);
}
@@ -1476,11 +1538,9 @@
Value* load = new LoadInst(cl->llvmVar(compilingClass->isolate->module),
"", currentBlock);
#ifdef MULTIPLE_VM
- if (cl->isolate == Jnjvm::bootstrapVM) {
- Module* M = compilingClass->isolate->module;
- Value* arg = new LoadInst(cl->llvmVar(M), "", currentBlock);
- invoke(initialisationCheckLLVM, arg, "", currentBlock);
- }
+ Module* M = compilingClass->isolate->module;
+ Value* arg = new LoadInst(cl->llvmVar(M), "", currentBlock);
+ invoke(initialisationCheckLLVM, arg, "", currentBlock);
val = invoke(doNewLLVM, load, isolateLocal, "", currentBlock);
#else
val = invoke(doNewLLVM, load, "", currentBlock);
@@ -1531,16 +1591,9 @@
&& field->classDef->isReady()
#endif
) {
- Module* M = compilingClass->isolate->module;
- if (stat) object = field->classDef->staticVar(M, currentBlock);
+ if (stat) object = field->classDef->staticVar(this);
const Type* type = stat ? field->classDef->staticType :
field->classDef->virtualType;
-#ifdef MULTIPLE_VM
- if (stat && field->classDef->isolate == Jnjvm::bootstrapVM) {
- Value* arg = new LoadInst(field->classDef->llvmVar(M), "", currentBlock);
- invoke(initialisationCheckLLVM, arg, "", currentBlock);
- }
-#endif
return fieldGetter(this, type, object, field->offset);
} else {
const Type* Pty = mvm::jit::arrayPtrType;
@@ -1607,15 +1660,6 @@
llvm::BranchInst::Create(endBlock, currentBlock);
currentBlock = endBlock;;
-#ifdef MULTIPLE_VM
- if (stat) {
- std::vector args;
- Value* val = new LoadInst(compilingClass->llvmVar(M), "", currentBlock);
- args.push_back(val);
- args.push_back(CI);
- invoke(initialisationCheckCtpLLVM, args, "", currentBlock);
- }
-#endif
return new BitCastInst(node, fieldTypePtr, "", currentBlock);
}
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h Mon Apr 28 04:21:34 2008
@@ -252,7 +252,6 @@
static llvm::Function* doNewUnknownLLVM;
#ifdef MULTIPLE_VM
static llvm::Function* initialisationCheckLLVM;
- static llvm::Function* initialisationCheckCtpLLVM;
#endif
static llvm::Function* initialiseObjectLLVM;
static llvm::Function* newLookupLLVM;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITInitialise.cpp Mon Apr 28 04:21:34 2008
@@ -232,20 +232,7 @@
initialisationCheckLLVM = Function::Create(type, GlobalValue::ExternalLinkage,
"initialisationCheck",
module);
- }
-
- // Create initialisationCheckCtpLLVM
- {
- std::vector args;
- args.push_back(mvm::jit::ptrType);
- args.push_back(Type::Int32Ty);
- const FunctionType* type = FunctionType::get(Type::VoidTy, args,
- false);
-
- initialisationCheckCtpLLVM = Function::Create(type, GlobalValue::ExternalLinkage,
- "initialisationCheckCtp",
- module);
- }
+ }
#endif
@@ -518,7 +505,8 @@
// Create getStaticInstanceLLVM
{
std::vector args;
- args.push_back(mvm::jit::ptrType);
+ args.push_back(mvm::jit::ptrType); // cl
+ args.push_back(mvm::jit::ptrType); // vm
const FunctionType* type = FunctionType::get(JavaObject::llvmType, args, false);
getStaticInstanceLLVM = Function::Create(type, GlobalValue::ExternalLinkage,
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp Mon Apr 28 04:21:34 2008
@@ -32,16 +32,12 @@
using namespace jnjvm;
using namespace llvm;
-Value* Class::staticVar(Module* compilingModule, BasicBlock* currentBlock) {
+Value* Class::staticVar(JavaJIT* jit) {
+#ifndef MULTIPLE_VM
if (!_staticVar) {
aquire();
if (!_staticVar) {
-#ifdef MULTIPLE_VM
- if (isolate == Jnjvm::bootstrapVM) {
- _staticVar = llvmVar(compilingModule);
- } else {
-#endif
JavaObject* obj = staticInstance();
mvm::jit::protectConstants();//->lock();
Constant* cons =
@@ -55,23 +51,18 @@
cons, "",
isolate->module);
isolate->protectModule->unlock();
- }
-#ifdef MULTIPLE_VM
}
-#endif
release();
}
-#ifdef MULTIPLE_VM
- if (isolate == Jnjvm::bootstrapVM) {
- Value* ld = new LoadInst(_staticVar, "", currentBlock);
- return llvm::CallInst::Create(JavaJIT::getStaticInstanceLLVM, ld, "",
- currentBlock);
- } else {
-#endif
- return new LoadInst(_staticVar, "", currentBlock);
-#ifdef MULTIPLE_VM
- }
+ return new LoadInst(_staticVar, "", jit->currentBlock);
+
+#else
+ Value* var = llvmVar(jit->compilingClass->isolate->module);
+ Value* ld = new LoadInst(var, "", jit->currentBlock);
+ jit->invoke(JavaJIT::initialisationCheckLLVM, ld, "", jit->currentBlock);
+ return jit->invoke(JavaJIT::getStaticInstanceLLVM, ld, jit->isolateLocal,
+ "", jit->currentBlock);
#endif
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Mon Apr 28 04:21:34 2008
@@ -60,7 +60,6 @@
llvm::Function* JavaJIT::doNewUnknownLLVM = 0;
#ifdef MULTIPLE_VM
llvm::Function* JavaJIT::initialisationCheckLLVM = 0;
-llvm::Function* JavaJIT::initialisationCheckCtpLLVM = 0;
#endif
llvm::Function* JavaJIT::initialiseObjectLLVM = 0;
llvm::Function* JavaJIT::newLookupLLVM = 0;
@@ -139,8 +138,10 @@
field->classDef->initialiseClass();
if (stat) obj = field->classDef->staticInstance();
void* ptr = (void*)(field->ptrOffset + (uint64)obj);
+#ifndef MULTIPLE_VM
if (stat) *ifStatic = ptr;
*offset = (uint32)field->ptrOffset;
+#endif
return ptr;
}
@@ -157,9 +158,10 @@
void* ptr = (void*)((uint64)obj + field->ptrOffset);
ctpInfo->ctpRes[index] = field;
-
+#ifndef MULTIPLE_VM
if (stat) *ifStatic = ptr;
*offset = (uint32)field->ptrOffset;
+#endif
return ptr;
}
@@ -210,18 +212,17 @@
}
#ifdef MULTIPLE_VM
-extern "C" JavaObject* getStaticInstance(Class* cl) {
- if (cl->isolate == Jnjvm::bootstrapVM) {
- Jnjvm* vm = JavaThread::get()->isolate;
- std::pair* val = vm->statics->lookup(cl);
- if (!val) {
- cl->initialiseClass();
- val = vm->statics->lookup(cl);
- }
- return val->second;
- } else {
- return cl->_staticInstance;
+extern "C" JavaObject* getStaticInstance(Class* cl, Jnjvm* vm) {
+ std::pair* val = vm->statics->lookup(cl);
+ if (!val || !(val->second)) {
+ cl->initialiseClass();
+ val = vm->statics->lookup(cl);
}
+ return val->second;
+}
+
+extern "C" void initialisationCheck(CommonClass* cl) {
+ cl->isolate->initialiseClass(cl);
}
#endif
@@ -270,15 +271,3 @@
}
#endif
-#ifdef MULTIPLE_VM
-extern "C" void initialisationCheck(CommonClass* cl) {
- cl->isolate->initialiseClass(cl);
-}
-
-extern "C" void initialisationCheckCtp(Class* caller, uint16 index) {
- JavaCtpInfo* ctpInfo = caller->ctpInfo;
- JavaField* field = (JavaField*)(ctpInfo->ctpRes[index]);
- assert(field && "checking without resolving?");
- field->classDef->isolate->initialiseClass(field->classDef);
-}
-#endif
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Mon Apr 28 04:21:34 2008
@@ -304,22 +304,23 @@
typedef void (*clinit_t)(Jnjvm* vm);
void Jnjvm::initialiseClass(CommonClass* cl) {
+ JavaState* status = cl->getStatus();
if (cl->isArray || AssessorDesc::bogusClassToPrimitive(cl)) {
- cl->status = ready;
- } else if (!(cl->isReady())) {
+ *status = ready;
+ } else if (!(*status == ready)) {
cl->aquire();
- int status = cl->status;
- if (cl->isReady()) {
+ JavaState* status = cl->getStatus();
+ if (*status == ready) {
cl->release();
- } else if (status >= resolved && status != clinitParent &&
- status != inClinit) {
- cl->status = clinitParent;
+ } else if (*status >= resolved && *status != clinitParent &&
+ *status != inClinit) {
+ *status = clinitParent;
cl->release();
if (cl->super) {
cl->super->initialiseClass();
}
- cl->status = inClinit;
+ *status = inClinit;
JavaMethod* meth = cl->lookupMethodDontThrow(clinitName, clinitType, true,
false);
@@ -334,7 +335,7 @@
JavaObject* exc = 0;
try{
clinit_t pred = (clinit_t)meth->compiledPtr();
- pred(this);
+ pred(JavaThread::get()->isolate);
} catch(...) {
exc = JavaThread::getJavaException();
assert(exc && "no exception?");
@@ -349,14 +350,14 @@
}
}
- cl->setReady();
+ *status = ready;
cl->broadcastClass();
- } else if (status < resolved) {
+ } else if (*status < resolved) {
cl->release();
unknownError("try to clinit a not-readed class...");
} else {
if (!cl->ownerClass()) {
- while (status < ready) cl->waitClass();
+ while (*status < ready) cl->waitClass();
cl->release();
initialiseClass(cl);
}
@@ -713,7 +714,9 @@
cl->name = name;
cl->classLoader = 0;
cl->bytes = 0;
+#ifndef MULTIPLE_VM
cl->_staticInstance = 0;
+#endif
cl->virtualInstance = 0;
cl->super = 0;
cl->ctpInfo = 0;
Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Mon Apr 28 04:21:34 2008
@@ -264,7 +264,7 @@
};
class StaticInstanceMap :
- public LockedMap*, std::less > {
+ public LockedMap*, std::less > {
public:
static VirtualTable* VT;
Modified: vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp Mon Apr 28 04:21:34 2008
@@ -69,14 +69,18 @@
#ifdef MULTIPLE_GC
service->GC = Collector::allocate();
#endif
-
+
+ service->classpath = callingVM->classpath;
+ service->bootClasspathEnv = callingVM->bootClasspathEnv;
+ service->libClasspathEnv = callingVM->libClasspathEnv;
+ service->bootClasspath = callingVM->bootClasspath;
service->functions = vm_new(service, FunctionMap)();
service->functionDefs = vm_new(service, FunctionDefMap)();
service->module = new llvm::Module("Service Domain");
service->protectModule = mvm::Lock::allocNormal();
- service->TheModuleProvider = new JnjvmModuleProvider(service->module,
+ service->TheModuleProvider = new JnjvmModuleProvider(service->module,
service->functions,
- service->functionDefs);
+ service->functionDefs);
#ifdef MULTIPLE_GC
mvm::jit::memoryManager->addGCForModule(service->module, service->GC);
@@ -86,7 +90,8 @@
service->name = "service";
service->jniEnv = &JNI_JNIEnvTable;
service->javavmEnv = &JNI_JavaVMTable;
-
+ service->appClassLoader = callingVM->appClassLoader;
+
// We copy so that bootstrap utf8 such as "" are unique
service->hashUTF8 = vm_new(service, UTF8Map)();
callingVM->hashUTF8->copy(service->hashUTF8);
@@ -118,8 +123,8 @@
void ServiceDomain::loadBootstrap() {
// load and initialise math since it is responsible for dlopen'ing
// libjavalang.so and we are optimizing some math operations
- loadName(asciizConstructUTF8("java/lang/Math"),
- CommonClass::jnjvmClassLoader, true, true, true);
+ //loadName(asciizConstructUTF8("java/lang/Math"),
+ // CommonClass::jnjvmClassLoader, true, true, true);
}
void ServiceDomain::serviceError(const char* str) {
@@ -133,29 +138,38 @@
return vm;
}
-#ifdef SERVICE_VM
-extern "C" void ServiceDomainStart(ServiceDomain* caller,
- ServiceDomain* callee) {
+extern "C" void serviceCallStart(ServiceDomain* caller,
+ ServiceDomain* callee) {
+ assert(caller && "No caller in service stop?");
+ assert(callee && "No callee in service stop?");
+ assert(caller->getVirtualTable() == ServiceDomain::VT && "Caller not a service domain?");
+ assert(callee->getVirtualTable() == ServiceDomain::VT && "Callee not a service domain?");
JavaThread* th = JavaThread::get();
th->isolate = callee;
+#ifdef SERVICE_VM
time_t t = time(NULL);
caller->lock->lock();
caller->executionTime += t - th->executionTime;
caller->interactions[callee]++;
caller->lock->unlock();
th->executionTime = t;
-
+#endif
}
-extern "C" void ServiceDomainStop(ServiceDomain* caller,
- ServiceDomain* callee) {
+extern "C" void serviceCallStop(ServiceDomain* caller,
+ ServiceDomain* callee) {
+ assert(caller && "No caller in service stop?");
+ assert(callee && "No callee in service stop?");
+ assert(caller->getVirtualTable() == ServiceDomain::VT && "Caller not a service domain?");
+ assert(callee->getVirtualTable() == ServiceDomain::VT && "Callee not a service domain?");
JavaThread* th = JavaThread::get();
th->isolate = caller;
+#ifdef SERVICE_VM
time_t t = time(NULL);
callee->lock->lock();
callee->executionTime += t - th->executionTime;
callee->lock->unlock();
th->executionTime = t;
+#endif
}
-#endif
Modified: vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp?rev=50348&r1=50347&r2=50348&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Mon Apr 28 04:21:34 2008
@@ -144,7 +144,9 @@
void Class::TRACER {
CommonClass::PARENT_TRACER;
bytes->MARK_AND_TRACE;
+#ifndef MULTIPLE_VM
_staticInstance->MARK_AND_TRACE;
+#endif
virtualInstance->MARK_AND_TRACE;
ctpInfo->MARK_AND_TRACE;
TRACE_VECTOR(Attribut*, gc_allocator, attributs);
From nicolas.geoffray at lip6.fr Mon Apr 28 05:31:20 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 10:31:20 -0000
Subject: [llvm-commits] [vmkit] r50349 - in /vmkit/trunk: configure.ac
lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp lib/JnJVM/README
lib/JnJVM/VMCore/Jni.cpp
Message-ID: <200804281031.m3SAVL8D002134@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 05:31:15 2008
New Revision: 50349
URL: http://llvm.org/viewvc/llvm-project?rev=50349&view=rev
Log:
Move to GNU Classpath 0.97.1, and move Java version of JnJVM to 1.5.
Modified:
vmkit/trunk/configure.ac
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp
vmkit/trunk/lib/JnJVM/README
vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp
Modified: vmkit/trunk/configure.ac
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure.ac?rev=50349&r1=50348&r2=50349&view=diff
==============================================================================
--- vmkit/trunk/configure.ac (original)
+++ vmkit/trunk/configure.ac Mon Apr 28 05:31:15 2008
@@ -243,10 +243,10 @@
dnl **************************************************************************
AC_ARG_WITH(gnu-classpath-version,
[AS_HELP_STRING(--with-gnu-classpath-version=something,
- [GNU CLASSPATH VERSION (default is '0.93')])],
+ [GNU CLASSPATH VERSION (default is '0.97.1')])],
[[gnuclasspathversion=$withval]],
- [[ echo Using '0.93' as GNU CLASSPATH version.
- gnuclasspathversion=0.93
+ [[ echo Using '0.97.1' as GNU CLASSPATH version.
+ gnuclasspathversion=0.97.1
]]
)
gnuclasspathversionuvm=`echo $gnuclasspathversion | $SED s/\\\./-/`
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp?rev=50349&r1=50348&r2=50349&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystemProperties.cpp Mon Apr 28 05:31:15 2008
@@ -61,11 +61,11 @@
setProperty(vm, prop, "java.vm.specification.version", "1.0");
setProperty(vm, prop, "java.vm.specification.vendor", "Sun Microsystems, Inc");
setProperty(vm, prop, "java.vm.specification.name", "Java Virtual Machine Specification");
- setProperty(vm, prop, "java.specification.version", "1.4");
+ setProperty(vm, prop, "java.specification.version", "1.5");
setProperty(vm, prop, "java.specification.vendor", "Sun Microsystems, Inc");
setProperty(vm, prop, "java.specification.name", "Java Platform API Specification");
- setProperty(vm, prop, "java.version", "1.4");
- setProperty(vm, prop, "java.runtime.version", "1.4");
+ setProperty(vm, prop, "java.version", "1.5");
+ setProperty(vm, prop, "java.runtime.version", "1.5");
setProperty(vm, prop, "java.vendor", "VVM Project");
setProperty(vm, prop, "java.vendor.url", "http://vvm.lip6.fr");
@@ -73,14 +73,14 @@
if (!tmp) tmp = "";
setProperty(vm, prop, "java.home", tmp);
- setProperty(vm, prop, "java.class.version", "48.0");
+ setProperty(vm, prop, "java.class.version", "49.0");
setProperty(vm, prop, "java.class.path", vm->classpath);
setProperty(vm, prop, "java.boot.class.path", vm->bootClasspathEnv);
setProperty(vm, prop, "sun.boot.class.path", vm->bootClasspathEnv);
setProperty(vm, prop, "java.vm.version", "2.0");
setProperty(vm, prop, "java.vm.vendor", "VVM Project");
setProperty(vm, prop, "java.vm.name", "JnJVM");
- setProperty(vm, prop, "java.specification.version", "1.4");
+ setProperty(vm, prop, "java.specification.version", "1.5");
setProperty(vm, prop, "java.library.path", vm->libClasspathEnv);
setProperty(vm, prop, "java.io.tmpdir", "/tmp");
@@ -114,6 +114,7 @@
//setProperty(vm, prop, "gnu.classpath.nio.charset.provider.iconv", "true")
setProperty(vm, prop, "file.encoding", "ISO8859_1");
+ setProperty(vm, prop, "gnu.java.util.zoneinfo.dir", "/usr/share/zoneinfo");
}
Modified: vmkit/trunk/lib/JnJVM/README
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/README?rev=50349&r1=50348&r2=50349&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/README (original)
+++ vmkit/trunk/lib/JnJVM/README Mon Apr 28 05:31:15 2008
@@ -1,11 +1,11 @@
1 - GNU Classpath
-Current version 0.93. Use gcj > 4 or ecj
+Current version 0.97.1. Use ecj to compile Classpath.
a - unzip classpath
- tar -xzf classpath-0.93
+ tar -xzf classpath-0.97.1
b - compile classpath
- cd classpath-0.93
- ./configure && make
+ cd classpath-0.97.1
+ ./configure --disable-plugin --disable-examples && make
IMPORTANT: for local use
cd classpath-x.y/lib;
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp?rev=50349&r1=50348&r2=50349&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp Mon Apr 28 05:31:15 2008
@@ -25,8 +25,8 @@
using namespace jnjvm;
-extern "C" const struct JNIInvokeInterface JNI_JavaVMTable;
-extern "C" struct JNINativeInterface JNI_JNIEnvTable;
+extern "C" const struct JNIInvokeInterface_ JNI_JavaVMTable;
+extern "C" struct JNINativeInterface_ JNI_JNIEnvTable;
#define BEGIN_EXCEPTION \
JavaObject* excp = 0; \
@@ -249,7 +249,7 @@
jobject NewObjectA(JNIEnv* env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -339,7 +339,7 @@
jobject CallObjectMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue * args) {
+ const jvalue * args) {
assert(0 && "implement me");
return 0;
}
@@ -371,7 +371,7 @@
jboolean CallBooleanMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue * args) {
+ const jvalue * args) {
assert(0 && "implement me");
return 0;
}
@@ -390,7 +390,7 @@
jbyte CallByteMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -410,7 +410,7 @@
jchar CallCharMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -430,7 +430,7 @@
jshort CallShortMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -463,7 +463,7 @@
jint CallIntMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -484,7 +484,7 @@
jlong CallLongMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -517,7 +517,7 @@
jfloat CallFloatMethodA(JNIEnv *env, jobject _obj, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -559,7 +559,7 @@
jdouble CallDoubleMethodA(JNIEnv *env, jobject _obj, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -597,7 +597,7 @@
void CallVoidMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
}
@@ -618,7 +618,7 @@
jobject CallNonvirtualObjectMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args) {
+ jmethodID methodID, const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -640,7 +640,7 @@
jboolean CallNonvirtualBooleanMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args) {
+ jmethodID methodID, const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -661,7 +661,7 @@
jbyte CallNonvirtualByteMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args) {
+ jmethodID methodID, const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -683,7 +683,7 @@
jchar CallNonvirtualCharMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args) {
+ jmethodID methodID, const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -705,7 +705,7 @@
jshort CallNonvirtualShortMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args) {
+ jmethodID methodID, const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -727,7 +727,7 @@
jint CallNonvirtualIntMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args) {
+ jmethodID methodID, const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -749,7 +749,7 @@
jlong CallNonvirtualLongMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args) {
+ jmethodID methodID, const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -771,7 +771,7 @@
jfloat CallNonvirtualFloatMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args) {
+ jmethodID methodID, const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -793,7 +793,7 @@
jdouble CallNonvirtualDoubleMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args) {
+ jmethodID methodID, const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -824,7 +824,7 @@
void CallNonvirtualVoidMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue * args) {
+ jmethodID methodID, const jvalue * args) {
assert(0 && "implement me");
}
@@ -1106,7 +1106,7 @@
jobject CallStaticObjectMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -1138,7 +1138,7 @@
jboolean CallStaticBooleanMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -1158,7 +1158,7 @@
jbyte CallStaticByteMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -1178,7 +1178,7 @@
jchar CallStaticCharMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -1199,7 +1199,7 @@
jshort CallStaticShortMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -1219,7 +1219,7 @@
jint CallStaticIntMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -1239,7 +1239,7 @@
jlong CallStaticLongMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -1261,7 +1261,7 @@
jfloat CallStaticFloatMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -1282,7 +1282,7 @@
jdouble CallStaticDoubleMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue *args) {
+ const jvalue *args) {
assert(0 && "implement me");
return 0;
}
@@ -1317,7 +1317,7 @@
void CallStaticVoidMethodA(JNIEnv *env, jclass clazz, jmethodID methodID,
- jvalue * args) {
+ const jvalue * args) {
assert(0 && "implement me");
}
@@ -1969,49 +1969,49 @@
void SetBooleanArrayRegion(JNIEnv *env, jbooleanArray array, jsize start,
- jsize len, jboolean *buf) {
+ jsize len, const jboolean *buf) {
assert(0 && "implement me");
}
void SetByteArrayRegion(JNIEnv *env, jbyteArray array, jsize start, jsize len,
- jbyte *buf) {
+ const jbyte *buf) {
assert(0 && "implement me");
}
void SetCharArrayRegion(JNIEnv *env, jcharArray array, jsize start, jsize len,
- jchar *buf) {
+ const jchar *buf) {
assert(0 && "implement me");
}
void SetShortArrayRegion(JNIEnv *env, jshortArray array, jsize start,
- jsize len, jshort *buf) {
+ jsize len, const jshort *buf) {
assert(0 && "implement me");
}
void SetIntArrayRegion(JNIEnv *env, jintArray array, jsize start, jsize len,
- jint *buf) {
+ const jint *buf) {
assert(0 && "implement me");
}
void SetLongArrayRegion(JNIEnv* env, jlongArray array, jsize start, jsize len,
- jlong *buf) {
+ const jlong *buf) {
assert(0 && "implement me");
}
void SetFloatArrayRegion(JNIEnv *env, jfloatArray array, jsize start,
- jsize len, jfloat *buf) {
+ jsize len, const jfloat *buf) {
assert(0 && "implement me");
}
void SetDoubleArrayRegion(JNIEnv *env, jdoubleArray array, jsize start,
- jsize len, jdouble *buf) {
+ jsize len, const jdouble *buf) {
assert(0 && "implement me");
}
@@ -2168,6 +2168,12 @@
return 0;
}
+jobjectRefType GetObjectRefType(JNIEnv* env, jobject obj) {
+ assert(0 && "implement me");
+ return (jobjectRefType)0;
+}
+
+
jint DestroyJavaVM(JavaVM *vm) {
assert(0 && "implement me");
@@ -2213,7 +2219,7 @@
}
-const struct JNIInvokeInterface JNI_JavaVMTable = {
+const struct JNIInvokeInterface_ JNI_JavaVMTable = {
NULL,
NULL,
NULL,
@@ -2226,7 +2232,7 @@
};
-struct JNINativeInterface JNI_JNIEnvTable = {
+struct JNINativeInterface_ JNI_JNIEnvTable = {
NULL,
NULL,
NULL,
@@ -2493,5 +2499,8 @@
&NewDirectByteBuffer,
&GetDirectBufferAddress,
- &GetDirectBufferCapacity
+ &GetDirectBufferCapacity,
+
+ /* ---- JNI 1.6 functions ---- */
+ &GetObjectRefType
};
From echristo at apple.com Mon Apr 28 10:20:00 2008
From: echristo at apple.com (Eric Christopher)
Date: Mon, 28 Apr 2008 08:20:00 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r50333 -
/llvm-gcc-4.2/trunk/build_gcc
In-Reply-To: <200804280513.m3S5D8LD016871@zion.cs.uiuc.edu>
References: <200804280513.m3S5D8LD016871@zion.cs.uiuc.edu>
Message-ID:
>
>
> +# FIXME: What is the motivation here ?
Just to make sure that the root has all of the actual files it needs
FWIW. What's up?
-eric
From nicolas.geoffray at lip6.fr Mon Apr 28 11:09:13 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 16:09:13 -0000
Subject: [llvm-commits] [vmkit] r50350 - in /vmkit/trunk/lib/Mvm/GCMmap2:
gccollector.cpp gccollector.h gcinit.cpp
Message-ID: <200804281609.m3SG9D7D011979@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 11:09:12 2008
New Revision: 50350
URL: http://llvm.org/viewvc/llvm-project?rev=50350&view=rev
Log:
In a service environment, the only distinction between GCs is the collection frequency.
Modified:
vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h
vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp?rev=50350&r1=50349&r2=50350&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp Mon Apr 28 11:09:12 2008
@@ -11,7 +11,7 @@
using namespace mvm;
-#ifndef MULTIPLE_GC
+#if !defined(MULTIPLE_GC) || defined(SERVICE_GC)
GCAllocator *GCCollector::allocator = 0;
#ifdef HAVE_PTHREAD
GCThread *GCCollector::threads;
@@ -19,13 +19,6 @@
GCCollector::markerFn GCCollector::_marker;
-int GCCollector::_collect_freq_auto;
-int GCCollector::_collect_freq_maybe;
-int GCCollector::_since_last_collection;
-
-bool GCCollector::_enable_auto;
-bool GCCollector::_enable_maybe;
-bool GCCollector::_enable_collection;
int GCCollector::status;
@@ -33,13 +26,24 @@
GCChunkNode *GCCollector::unused_nodes;
unsigned int GCCollector::current_mark;
-#else
+#endif
+
+#ifdef MULTIPLE_GC
GCCollector* GCCollector::bootstrapGC;
#endif
#ifdef SERVICE_GC
GCCollector* GCCollector::collectingGC;
-unsigned int GCCollector::current_mark;
+#endif
+
+#if !defined(SERVICE_GC) && !defined(MULTIPLE_GC)
+int GCCollector::_collect_freq_auto;
+int GCCollector::_collect_freq_maybe;
+int GCCollector::_since_last_collection;
+
+bool GCCollector::_enable_auto;
+bool GCCollector::_enable_maybe;
+bool GCCollector::_enable_collection;
#endif
void GCCollector::do_collect() {
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h?rev=50350&r1=50349&r2=50350&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.h Mon Apr 28 11:09:12 2008
@@ -23,30 +23,38 @@
#define STATIC static
#endif
+#if defined(MULTIPLE_GC) && !defined(SERVICE_GC)
+#define STATIC_FIELD
+#else
+#define STATIC_FIELD static
+#endif
+
+#if defined(MULTIPLE_GC)
+#define STATIC_NO_SERVICE
+#else
+#define STATIC_NO_SERVICE static
+#endif
+
namespace mvm {
class GCCollector : public Collector {
#ifdef HAVE_PTHREAD
friend class GCThread;
#endif
- STATIC GCAllocator *allocator; /* The allocator */
-
+ STATIC_FIELD GCAllocator *allocator; /* The allocator */
- STATIC GCChunkNode *used_nodes; /* Used memory nodes */
- STATIC GCChunkNode *unused_nodes; /* Unused memory nodes */
-#ifdef SERVICE_GC
- static unsigned int current_mark;
-#else
- STATIC unsigned int current_mark;
-#endif
- STATIC int _collect_freq_auto; /* Collection frequency in gcmalloc/gcrealloc */
- STATIC int _collect_freq_maybe; /* Collection frequency in maybeCollect */
- STATIC int _since_last_collection; /* Bytes left since last collection */
- STATIC bool _enable_auto; /* Automatic collection? */
- STATIC bool _enable_maybe; /* Collection in maybeCollect()? */
- STATIC bool _enable_collection; /* collection authorized? */
- STATIC int status;
+ STATIC_FIELD GCChunkNode *used_nodes; /* Used memory nodes */
+ STATIC_FIELD GCChunkNode *unused_nodes; /* Unused memory nodes */
+ STATIC_FIELD unsigned int current_mark;
+
+ STATIC_NO_SERVICE int _collect_freq_auto; /* Collection frequency in gcmalloc/gcrealloc */
+ STATIC_NO_SERVICE int _collect_freq_maybe; /* Collection frequency in maybeCollect */
+ STATIC_NO_SERVICE int _since_last_collection; /* Bytes left since last collection */
+ STATIC_NO_SERVICE bool _enable_auto; /* Automatic collection? */
+ STATIC_NO_SERVICE bool _enable_maybe; /* Collection in maybeCollect()? */
+ STATIC_NO_SERVICE bool _enable_collection; /* collection authorized? */
+ STATIC_FIELD int status;
enum { stat_collect, stat_finalize, stat_alloc, stat_broken };
@@ -75,14 +83,14 @@
}
public:
- STATIC Collector::markerFn _marker; /* The function which traces roots */
+ STATIC_FIELD Collector::markerFn _marker; /* The function which traces roots */
#ifdef SERVICE_GC
static GCCollector* collectingGC;
#endif
#ifdef MULTIPLE_GC
static GCCollector* bootstrapGC;
#endif
- STATIC GCThread *threads; /* le gestionnaire de thread et de synchro */
+ STATIC_FIELD GCThread *threads; /* le gestionnaire de thread et de synchro */
static void (*internMemoryError)(unsigned int);
#ifdef HAVE_PTHREAD
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp?rev=50350&r1=50349&r2=50350&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cpp Mon Apr 28 11:09:12 2008
@@ -26,19 +26,15 @@
}
void GCCollector::initialise(Collector::markerFn marker) {
-
+
+#ifdef SERVICE_GC
+ if (this == bootstrapGC) {
+#endif
used_nodes = new GCChunkNode();
unused_nodes = new GCChunkNode();
#ifdef HAVE_PTHREAD
-#ifdef SERVICE_GC
- if (this != bootstrapGC)
- threads = bootstrapGC->threads;
- else
- threads = new GCThread();
-#else
threads = new GCThread();
#endif
-#endif
struct sigaction sa;
sigset_t mask;
@@ -60,10 +56,11 @@
used_nodes->alone();
+ current_mark = 0;
+ status = stat_alloc;
#ifdef SERVICE_GC
- if (this == bootstrapGC)
+ }
#endif
- current_mark = 0;
_collect_freq_auto = def_collect_freq_auto;
_collect_freq_maybe = def_collect_freq_maybe;
@@ -74,7 +71,6 @@
_enable_collection = 1;
_enable_maybe = 1;
- status = stat_alloc;
}
void GCCollector::destroy() {
From nicolas.geoffray at lip6.fr Mon Apr 28 11:10:33 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 16:10:33 -0000
Subject: [llvm-commits] [vmkit] r50351 -
/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
Message-ID: <200804281610.m3SGAXLv012087@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 11:10:33 2008
New Revision: 50351
URL: http://llvm.org/viewvc/llvm-project?rev=50351&view=rev
Log:
Fix compilation of native synchronized functions.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=50351&r1=50350&r2=50351&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Mon Apr 28 11:10:33 2008
@@ -217,10 +217,44 @@
mvm::jit::executionEngine->addGlobalMapping(func, natPtr);
return llvmFunction;
}
-
+
+ currentExceptionBlock = endExceptionBlock = 0;
currentBlock = createBasicBlock("start");
BasicBlock* executeBlock = createBasicBlock("execute");
endBlock = createBasicBlock("end block");
+
+#if defined(MULTIPLE_VM)
+ Value* lastArg = 0;
+ for (Function::arg_iterator i = func->arg_begin(), e = func->arg_end();
+ i != e; ++i) {
+ lastArg = i;
+ }
+#if !defined(SERVICE_VM)
+ isolateLocal = lastArg;
+#else
+ if (compilingClass->isolate == Jnjvm::bootstrapVM) {
+ isolateLocal = lastArg;
+ } else {
+ JavaObject* loader = compilingClass->classLoader;
+ ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
+ isolateLocal = new LoadInst(vm->llvmDelegatee(), "", currentBlock);
+ Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, lastArg,
+ isolateLocal, "", currentBlock);
+ BasicBlock* ifTrue = createBasicBlock("true service call");
+ BasicBlock* endBlock = createBasicBlock("end check service call");
+ BranchInst::Create(ifTrue, endBlock, cmp, currentBlock);
+ currentBlock = ifTrue;
+ std::vector Args;
+ Args.push_back(lastArg);
+ Args.push_back(isolateLocal);
+ CallInst::Create(ServiceDomain::serviceCallStartLLVM, Args.begin(),
+ Args.end(), "", currentBlock);
+ BranchInst::Create(endBlock, currentBlock);
+ currentBlock = endBlock;
+ }
+#endif
+#endif
+
if (funcType->getReturnType() != Type::VoidTy)
endNode = llvm::PHINode::Create(funcType->getReturnType(), "", endBlock);
From nicolas.geoffray at lip6.fr Mon Apr 28 11:11:55 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 16:11:55 -0000
Subject: [llvm-commits] [vmkit] r50352 - in /vmkit/trunk/lib/JnJVM:
Classpath/ClasspathVMThread.cpp VMCore/JavaIsolate.cpp VMCore/JavaThread.h
VMCore/ServiceDomain.cpp VMCore/ServiceDomain.h
Message-ID: <200804281611.m3SGBu4l012141@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 11:11:55 2008
New Revision: 50352
URL: http://llvm.org/viewvc/llvm-project?rev=50352&view=rev
Log:
Code cleanup for service-environments.
Modified:
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h
vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp
vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp?rev=50352&r1=50351&r2=50352&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp Mon Apr 28 11:11:55 2008
@@ -26,6 +26,10 @@
#include "Jnjvm.h"
#include "NativeUtil.h"
+#ifdef SERVICE_VM
+#include "ServiceDomain.h"
+#endif
+
using namespace jnjvm;
extern "C" {
@@ -67,7 +71,7 @@
ts->nonDaemonLock->unlock();
}
-#ifdef SERVICE_DOMAIN
+#ifdef SERVICE_VM
((ServiceDomain*)isolate)->numThreads++;
#endif
JavaMethod* method = vmthClass->lookupMethod(Jnjvm::runName, Jnjvm::clinitType, ACC_VIRTUAL, true);
@@ -82,7 +86,7 @@
ts->nonDaemonLock->unlock();
}
-#ifdef SERVICE_DOMAIN
+#ifdef SERVICE_VM
((ServiceDomain*)isolate)->numThreads--;
#endif
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=50352&r1=50351&r2=50352&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Mon Apr 28 11:11:55 2008
@@ -330,9 +330,6 @@
}
void JavaIsolate::executeClass(const char* className, ArrayObject* args) {
-#ifdef SERVICE_VM
- JavaThread::get()->executionTime = time(0);
-#endif
try {
JavaJIT::invokeOnceVoid(this, appClassLoader, className, "main",
"([Ljava/lang/String;)V", ACC_STATIC, args);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h?rev=50352&r1=50351&r2=50352&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaThread.h Mon Apr 28 11:11:55 2008
@@ -45,8 +45,6 @@
static const unsigned int StateWaiting;
static const unsigned int StateInterrupted;
- JavaObject* cacheObject; // cache for allocations patching
-
virtual void print(mvm::PrintBuffer *buf) const;
virtual void TRACER;
virtual void destroyer(size_t sz);
@@ -62,9 +60,6 @@
static bool compareException(Class*);
static JavaObject* getJavaException();
void returnFromNative();
-#ifdef SERVICE_VM
- time_t executionTime;
-#endif
};
} // end namespace jnjvm
Modified: vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp?rev=50352&r1=50351&r2=50352&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.cpp Mon Apr 28 11:11:55 2008
@@ -115,18 +115,10 @@
service->gcTriggered = 0;
service->numThreads = 0;
- service->loadBootstrap();
service->lock = mvm::Lock::allocNormal();
return service;
}
-void ServiceDomain::loadBootstrap() {
- // load and initialise math since it is responsible for dlopen'ing
- // libjavalang.so and we are optimizing some math operations
- //loadName(asciizConstructUTF8("java/lang/Math"),
- // CommonClass::jnjvmClassLoader, true, true, true);
-}
-
void ServiceDomain::serviceError(const char* str) {
fprintf(stderr, str);
abort();
@@ -140,36 +132,28 @@
extern "C" void serviceCallStart(ServiceDomain* caller,
ServiceDomain* callee) {
- assert(caller && "No caller in service stop?");
- assert(callee && "No callee in service stop?");
- assert(caller->getVirtualTable() == ServiceDomain::VT && "Caller not a service domain?");
- assert(callee->getVirtualTable() == ServiceDomain::VT && "Callee not a service domain?");
+ assert(caller && "No caller in service start?");
+ assert(callee && "No callee in service start?");
+ assert(caller->getVirtualTable() == ServiceDomain::VT &&
+ "Caller not a service domain?");
+ assert(callee->getVirtualTable() == ServiceDomain::VT &&
+ "Callee not a service domain?");
JavaThread* th = JavaThread::get();
th->isolate = callee;
-#ifdef SERVICE_VM
- time_t t = time(NULL);
caller->lock->lock();
- caller->executionTime += t - th->executionTime;
caller->interactions[callee]++;
caller->lock->unlock();
- th->executionTime = t;
-#endif
}
extern "C" void serviceCallStop(ServiceDomain* caller,
ServiceDomain* callee) {
assert(caller && "No caller in service stop?");
assert(callee && "No callee in service stop?");
- assert(caller->getVirtualTable() == ServiceDomain::VT && "Caller not a service domain?");
- assert(callee->getVirtualTable() == ServiceDomain::VT && "Callee not a service domain?");
+ assert(caller->getVirtualTable() == ServiceDomain::VT &&
+ "Caller not a service domain?");
+ assert(callee->getVirtualTable() == ServiceDomain::VT &&
+ "Callee not a service domain?");
JavaThread* th = JavaThread::get();
th->isolate = caller;
-#ifdef SERVICE_VM
- time_t t = time(NULL);
- callee->lock->lock();
- callee->executionTime += t - th->executionTime;
- callee->lock->unlock();
- th->executionTime = t;
-#endif
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h?rev=50352&r1=50351&r2=50352&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/ServiceDomain.h Mon Apr 28 11:11:55 2008
@@ -39,14 +39,12 @@
virtual void print(mvm::PrintBuffer* buf) const;
virtual void TRACER;
virtual void destroyer(size_t sz);
- void loadBootstrap();
static ServiceDomain* allocateService(JavaIsolate* callingVM);
llvm::GlobalVariable* llvmDelegatee();
void serviceError(const char* str);
mvm::Lock* lock;
ClassMap* classes;
- struct timeval started;
uint64 executionTime;
uint64 memoryUsed;
uint64 gcTriggered;
From dpatel at apple.com Mon Apr 28 11:12:32 2008
From: dpatel at apple.com (Devang Patel)
Date: Mon, 28 Apr 2008 09:12:32 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r50333 -
/llvm-gcc-4.2/trunk/build_gcc
In-Reply-To:
References: <200804280513.m3S5D8LD016871@zion.cs.uiuc.edu>
Message-ID: <514A21BA-18EA-41FA-B144-8B3E112BCBC3@apple.com>
On Apr 28, 2008, at 8:20 AM, Eric Christopher wrote:
>>
>>
>> +# FIXME: What is the motivation here ?
>
> Just to make sure that the root has all of the actual files it needs
> FWIW. What's up?
Why does root need libstdc++.dylib inside the root? libstdc++.dylib is
a system library and compiler should find it at /usr/lib/libstdc+
+.dylib.
-
Devang
From echristo at apple.com Mon Apr 28 11:17:21 2008
From: echristo at apple.com (Eric Christopher)
Date: Mon, 28 Apr 2008 09:17:21 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r50333 -
/llvm-gcc-4.2/trunk/build_gcc
In-Reply-To: <514A21BA-18EA-41FA-B144-8B3E112BCBC3@apple.com>
References: <200804280513.m3S5D8LD016871@zion.cs.uiuc.edu>
<514A21BA-18EA-41FA-B144-8B3E112BCBC3@apple.com>
Message-ID: <11243516-B0B6-49E2-AE7F-D2F3EF93E53F@apple.com>
On Apr 28, 2008, at 9:12 AM, Devang Patel wrote:
>
> On Apr 28, 2008, at 8:20 AM, Eric Christopher wrote:
>
>>>
>>>
>>> +# FIXME: What is the motivation here ?
>>
>> Just to make sure that the root has all of the actual files it
>> needs FWIW. What's up?
>
> Why does root need libstdc++.dylib inside the root? libstdc++.dylib
> is a system library and compiler should find it at /usr/lib/libstdc+
> +.dylib.
Probably so that you can install a root and get a full build and just
have it copy over an existing libstdc++. Can't think of anything else
offhand. If you remove the lines and everything still works then go
ahead :)
-eric
From criswell at uiuc.edu Mon Apr 28 11:21:27 2008
From: criswell at uiuc.edu (John Criswell)
Date: Mon, 28 Apr 2008 16:21:27 -0000
Subject: [llvm-commits] [poolalloc] r50353 -
/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
Message-ID: <200804281621.m3SGLR8R012434@zion.cs.uiuc.edu>
Author: criswell
Date: Mon Apr 28 11:21:26 2008
New Revision: 50353
URL: http://llvm.org/viewvc/llvm-project?rev=50353&view=rev
Log:
Support FORTRAN programs converted by NAG's f2c program.
Modified:
poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=50353&r1=50352&r2=50353&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Mon Apr 28 11:21:26 2008
@@ -89,7 +89,8 @@
AddPoolPrototypes(&M);
// Get the main function to insert the poolinit calls.
- Function *MainFunc = M.getFunction("main");
+ Function *MainFunc = (M.getFunction("main") ? M.getFunction("main")
+ : M.getFunction("MAIN__"));
if (MainFunc == 0 || MainFunc->isDeclaration()) {
std::cerr << "Cannot pool allocate this program: it has global "
<< "pools but no 'main' function yet!\n";
@@ -104,7 +105,7 @@
// Now that all call targets are available, rewrite the function bodies of the
// clones.
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
- if (!I->isDeclaration())
+ if (!(I->isDeclaration()))
ProcessFunctionBodySimple(*I);
return true;
}
@@ -333,7 +334,8 @@
Constant::getNullValue(getPoolType()), "GlobalPool",
&M);
- Function *MainFunc = M.getFunction("main");
+ Function *MainFunc = (M.getFunction("main") ? M.getFunction("main")
+ : M.getFunction("MAIN__"));
assert(MainFunc && "No main in program??");
BasicBlock::iterator InsertPt;
From matthijs at stdin.nl Mon Apr 28 07:09:23 2008
From: matthijs at stdin.nl (Matthijs Kooijman)
Date: Mon, 28 Apr 2008 14:09:23 +0200
Subject: [llvm-commits] [llvm] r50265 - in /llvm/trunk:
include/llvm/ include/llvm/Analysis/ include/llvm/Bitcode/
include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Reader/
lib/Bitcode/Writer/ lib/Transforms/IPO/
lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/
test/Transforms/Inline/
test/Transforms/PruneEH/ test/Transforms/SimplifyCFG/
tools/llvm-bcanalyzer/
In-Reply-To: <200804251654.m3PGs1Kg032722@zion.cs.uiuc.edu>
References: <200804251654.m3PGs1Kg032722@zion.cs.uiuc.edu>
Message-ID: <20080428120923.GB31157@katherina.student.utwente.nl>
(Message resent with correct From address)
Hi,
> llvm/trunk/lib/AsmParser/llvmAsmParser.y
> llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs
This patch modifies llvmAsmParser.y, but does not update
llvmAsmParser.{h,cpp}.cvs accordingly, breaking builds when bison is not
available. Please update and commeit these files as well.
Assuming that you did actually compile the code, could it be that the build
system is broken and does not automatically update the .h.cvs and .cpp.cvs
files when the .y file changes?
Gr.
Matthijs
From dpatel at apple.com Mon Apr 28 11:43:10 2008
From: dpatel at apple.com (Devang Patel)
Date: Mon, 28 Apr 2008 16:43:10 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50354 -
/llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp
Message-ID: <200804281643.m3SGhAZw013026@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Apr 28 11:43:09 2008
New Revision: 50354
URL: http://llvm.org/viewvc/llvm-project?rev=50354&view=rev
Log:
Vectors bigger than 128 are returned using sret.
This fixes few failures in compat.exp for x86-64 darwin target.
Modified:
llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp
Modified: llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp?rev=50354&r1=50353&r2=50354&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Tak/gcc/config/i386/llvm-i386.cpp Mon Apr 28 11:43:09 2008
@@ -898,9 +898,9 @@
if (TREE_INT_CST_LOW(TYPE_SIZE(type))==64 &&
TYPE_VECTOR_SUBPARTS(type)>1)
return true;
- if (TREE_INT_CST_LOW(TYPE_SIZE(type))>128)
- return true;
}
+ if (TREE_INT_CST_LOW(TYPE_SIZE(type))>128)
+ return true;
return false;
}
From foldr at codedgers.com Mon Apr 28 11:44:25 2008
From: foldr at codedgers.com (Mikhail Glushenkov)
Date: Mon, 28 Apr 2008 16:44:25 -0000
Subject: [llvm-commits] [llvm] r50355 - in /llvm/trunk:
docs/CommandLine.html include/llvm/Support/CommandLine.h
lib/Support/CommandLine.cpp
Message-ID: <200804281644.m3SGiPO2013080@zion.cs.uiuc.edu>
Author: foldr
Date: Mon Apr 28 11:44:25 2008
New Revision: 50355
URL: http://llvm.org/viewvc/llvm-project?rev=50355&view=rev
Log:
Add support for response files to the CommandLine library.
Modified:
llvm/trunk/docs/CommandLine.html
llvm/trunk/include/llvm/Support/CommandLine.h
llvm/trunk/lib/Support/CommandLine.cpp
Modified: llvm/trunk/docs/CommandLine.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandLine.html?rev=50355&r1=50354&r2=50355&view=diff
==============================================================================
--- llvm/trunk/docs/CommandLine.html (original)
+++ llvm/trunk/docs/CommandLine.html Mon Apr 28 11:44:25 2008
@@ -52,6 +52,7 @@
specified
Controlling other formatting options
Miscellaneous option modifiers
+ Response files
Top-Level Classes and Functions
@@ -1442,6 +1443,29 @@
+
+
+
+
+
+
Some systems, such as certain variants of Microsoft Windows and
+some older Unices have a relatively low limit on command-line
+length. It is therefore customary to use the so-called 'response
+files' to circumvent this restriction. These files are mentioned on
+the command-line (using the "@file") syntax. The program reads these
+files and inserts the contents into argv, thereby working around the
+command-line length limits. Response files are enabled by an optional
+fourth argument to
+cl::ParseEnvironmentOptions
+and
+cl::ParseCommandLineOptions .
+
+
+
+
+
Top-Level Classes and Functions
@@ -1475,7 +1499,8 @@
The cl::ParseCommandLineOptions function requires two parameters
(argc and argv ), but may also take an optional third parameter
which holds additional extra text to emit when the
---help option is invoked.
+
--help option is invoked, and a fourth boolean parameter that enables
+
response files .
@@ -1497,11 +1522,13 @@
href="#cl::ParseCommandLineOptions">cl::ParseCommandLineOptions
does.
-It takes three parameters: the name of the program (since argv may
+
It takes four parameters: the name of the program (since argv may
not be available, it can't just look in argv[0] ), the name of the
-environment variable to examine, and the optional
+environment variable to examine, the optional
additional extra text to emit when the
---help option is invoked.
+--help option is invoked, and the boolean
+switch that controls whether reponse files
+should be read.
cl::ParseEnvironmentOptions will break the environment
variable's value up into words and then process them using
Modified: llvm/trunk/include/llvm/Support/CommandLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=50355&r1=50354&r2=50355&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CommandLine.h (original)
+++ llvm/trunk/include/llvm/Support/CommandLine.h Mon Apr 28 11:44:25 2008
@@ -41,14 +41,16 @@
// ParseCommandLineOptions - Command line option processing entry point.
//
void ParseCommandLineOptions(int argc, char **argv,
- const char *Overview = 0);
+ const char *Overview = 0,
+ bool ReadResponseFiles = false);
//===----------------------------------------------------------------------===//
// ParseEnvironmentOptions - Environment variable option processing alternate
// entry point.
//
void ParseEnvironmentOptions(const char *progName, const char *envvar,
- const char *Overview = 0);
+ const char *Overview = 0,
+ bool ReadResponseFiles = false);
///===---------------------------------------------------------------------===//
/// SetVersionPrinter - Override the default (LLVM specific) version printer
@@ -146,10 +148,10 @@
virtual enum ValueExpected getValueExpectedFlagDefault() const {
return ValueOptional;
}
-
+
// Out of line virtual function to provide home for the class.
virtual void anchor();
-
+
int NumOccurrences; // The number of times specified
int Flags; // Flags for the argument
unsigned Position; // Position of last occurrence of the option
@@ -213,7 +215,7 @@
// addArgument - Register this argument with the commandline system.
//
void addArgument();
-
+
Option *getNextRegisteredOption() const { return NextRegistered; }
// Return the width of the option tag for printing...
@@ -225,7 +227,7 @@
virtual void printOptionInfo(unsigned GlobalWidth) const = 0;
virtual void getExtraOptionNames(std::vector &OptionNames) {}
-
+
// addOccurrence - Wrapper around handleOccurrence that enforces Flags
//
bool addOccurrence(unsigned pos, const char *ArgName,
@@ -339,7 +341,7 @@
};
template
-ValuesClass END_WITH_NULL values(const char *Arg, DataType Val,
+ValuesClass END_WITH_NULL values(const char *Arg, DataType Val,
const char *Desc, ...) {
va_list ValueArgs;
va_start(ValueArgs, Desc);
@@ -389,7 +391,7 @@
//
hasArgStr = O.hasArgStr();
}
-
+
void getExtraOptionNames(std::vector &OptionNames) {
// If there has been no argstr specified, that means that we need to add an
// argument for every possible option. This ensures that our options are
@@ -537,7 +539,7 @@
// getValueName - Do not print = at all.
virtual const char *getValueName() const { return 0; }
-
+
// An out-of-line virtual method to provide a 'home' for this class.
virtual void anchor();
};
@@ -551,7 +553,7 @@
class parser : public basic_parser {
public:
// parse - Return true on error.
- bool parse(Option &O, const char *ArgName, const std::string &Arg,
+ bool parse(Option &O, const char *ArgName, const std::string &Arg,
boolOrDefault &Val);
enum ValueExpected getValueExpectedFlagDefault() const {
@@ -560,7 +562,7 @@
// getValueName - Do not print = at all.
virtual const char *getValueName() const { return 0; }
-
+
// An out-of-line virtual method to provide a 'home' for this class.
virtual void anchor();
};
@@ -965,7 +967,7 @@
virtual void getExtraOptionNames(std::vector &OptionNames) {
return Parser.getExtraOptionNames(OptionNames);
}
-
+
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
const std::string &Arg) {
typename ParserClass::parser_data_type Val =
@@ -1071,7 +1073,7 @@
template
class bits_storage {
unsigned *Location; // Where to store the bits...
-
+
template
static unsigned Bit(const T &V) {
unsigned BitPos = reinterpret_cast(V);
@@ -1096,9 +1098,9 @@
"line option with external storage!");
*Location |= Bit(V);
}
-
+
unsigned getBits() { return *Location; }
-
+
template
bool isSet(const T &V) {
return (*Location & Bit(V)) != 0;
@@ -1106,13 +1108,13 @@
};
-// Define how to hold bits. Since we can inherit from a class, we do so.
+// Define how to hold bits. Since we can inherit from a class, we do so.
// This makes us exactly compatible with the bits in all cases that it is used.
//
template
class bits_storage {
unsigned Bits; // Where to store the bits...
-
+
template
static unsigned Bit(const T &V) {
unsigned BitPos = reinterpret_cast(V);
@@ -1120,15 +1122,15 @@
"enum exceeds width of bit vector!");
return 1 << BitPos;
}
-
+
public:
template
void addValue(const T &V) {
Bits |= Bit(V);
}
-
+
unsigned getBits() { return Bits; }
-
+
template
bool isSet(const T &V) {
return (Bits & Bit(V)) != 0;
@@ -1151,7 +1153,7 @@
virtual void getExtraOptionNames(std::vector &OptionNames) {
return Parser.getExtraOptionNames(OptionNames);
}
-
+
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
const std::string &Arg) {
typename ParserClass::parser_data_type Val =
Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=50355&r1=50354&r2=50355&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Mon Apr 28 11:44:25 2008
@@ -17,7 +17,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/Config/config.h"
+#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Streams.h"
#include "llvm/System/Path.h"
@@ -87,7 +89,7 @@
void Option::addArgument() {
assert(NextRegistered == 0 && "argument multiply registered!");
-
+
NextRegistered = RegisteredOptionList;
RegisteredOptionList = this;
MarkOptionsChanged();
@@ -111,7 +113,7 @@
O->getExtraOptionNames(OptionNames);
if (O->ArgStr[0])
OptionNames.push_back(O->ArgStr);
-
+
// Handle named options.
for (unsigned i = 0, e = OptionNames.size(); i != e; ++i) {
// Add argument to the argument map!
@@ -121,9 +123,9 @@
<< OptionNames[0] << "' defined more than once!\n";
}
}
-
+
OptionNames.clear();
-
+
// Remember information about positional options.
if (O->getFormattingFlag() == cl::Positional)
PositionalOpts.push_back(O);
@@ -135,10 +137,10 @@
CAOpt = O;
}
}
-
+
if (CAOpt)
PositionalOpts.push_back(CAOpt);
-
+
// Make sure that they are in order of registration not backwards.
std::reverse(PositionalOpts.begin(), PositionalOpts.end());
}
@@ -150,17 +152,17 @@
static Option *LookupOption(const char *&Arg, const char *&Value,
std::map &OptionsMap) {
while (*Arg == '-') ++Arg; // Eat leading dashes
-
+
const char *ArgEnd = Arg;
while (*ArgEnd && *ArgEnd != '=')
++ArgEnd; // Scan till end of argument name.
-
+
if (*ArgEnd == '=') // If we have an equals sign...
Value = ArgEnd+1; // Get the value, not the equals
-
-
+
+
if (*Arg == 0) return 0;
-
+
// Look up the option.
std::map::iterator I =
OptionsMap.find(std::string(Arg, ArgEnd));
@@ -309,7 +311,7 @@
/// an environment variable (whose name is given in ENVVAR).
///
void cl::ParseEnvironmentOptions(const char *progName, const char *envVar,
- const char *Overview) {
+ const char *Overview, bool ReadResponseFiles) {
// Check args.
assert(progName && "Program name not specified");
assert(envVar && "Environment variable name missing");
@@ -328,7 +330,7 @@
// and hand it off to ParseCommandLineOptions().
ParseCStringVector(newArgv, envValue);
int newArgc = newArgv.size();
- ParseCommandLineOptions(newArgc, &newArgv[0], Overview);
+ ParseCommandLineOptions(newArgc, &newArgv[0], Overview, ReadResponseFiles);
// Free all the strdup()ed strings.
for (std::vector::iterator i = newArgv.begin(), e = newArgv.end();
@@ -336,32 +338,78 @@
free (*i);
}
+
+/// ExpandResponseFiles - Copy the contents of argv into newArgv,
+/// substituting the contents of the response files for the arguments
+/// of type @file.
+static void ExpandResponseFiles(int argc, char** argv,
+ std::vector& newArgv) {
+ for (int i = 1; i != argc; ++i) {
+ char* arg = argv[i];
+
+ if (arg[0] == '@') {
+
+ sys::PathWithStatus respFile(++arg);
+
+ // Check that the response file is not empty (mmap'ing empty
+ // files can be problematic).
+ const sys::FileStatus *FileStat = respFile.getFileStatus();
+ if (!FileStat)
+ continue;
+ if (FileStat->getSize() == 0)
+ continue;
+
+ // Mmap the response file into memory.
+ OwningPtr
+ respFilePtr(MemoryBuffer::getFile(respFile.c_str()));
+
+ if (respFilePtr == 0)
+ continue;
+
+ ParseCStringVector(newArgv, respFilePtr->getBufferStart());
+ }
+ else {
+ newArgv.push_back(strdup(arg));
+ }
+ }
+}
+
void cl::ParseCommandLineOptions(int argc, char **argv,
- const char *Overview) {
+ const char *Overview, bool ReadResponseFiles) {
// Process all registered options.
std::vector PositionalOpts;
std::vector SinkOpts;
std::map Opts;
GetOptionInfo(PositionalOpts, SinkOpts, Opts);
-
+
assert((!Opts.empty() || !PositionalOpts.empty()) &&
"No options specified!");
+
+ // Expand response files.
+ std::vector newArgv;
+ if (ReadResponseFiles) {
+ newArgv.push_back(strdup(argv[0]));
+ ExpandResponseFiles(argc, argv, newArgv);
+ argv = &newArgv[0];
+ argc = newArgv.size();
+ }
+
sys::Path progname(argv[0]);
// Copy the program name into ProgName, making sure not to overflow it.
std::string ProgName = sys::Path(argv[0]).getLast();
if (ProgName.size() > 79) ProgName.resize(79);
strcpy(ProgramName, ProgName.c_str());
-
+
ProgramOverview = Overview;
bool ErrorParsing = false;
// Check out the positional arguments to collect information about them.
unsigned NumPositionalRequired = 0;
-
+
// Determine whether or not there are an unlimited number of positionals
bool HasUnlimitedPositionals = false;
-
+
Option *ConsumeAfterOpt = 0;
if (!PositionalOpts.empty()) {
if (PositionalOpts[0]->getNumOccurrencesFlag() == cl::ConsumeAfter) {
@@ -427,7 +475,7 @@
GetOptionInfo(PositionalOpts, SinkOpts, Opts);
OptionListChanged = false;
}
-
+
// Check to see if this is a positional argument. This argument is
// considered to be positional if it doesn't start with '-', if it is "-"
// itself, or if we have seen "--" already.
@@ -567,7 +615,7 @@
<< ": Not enough positional command line arguments specified!\n"
<< "Must specify at least " << NumPositionalRequired
<< " positional arguments: See: " << argv[0] << " --help\n";
-
+
ErrorParsing = true;
} else if (!HasUnlimitedPositionals
&& PositionalVals.size() > PositionalOpts.size()) {
@@ -664,6 +712,14 @@
PositionalOpts.clear();
MoreHelp->clear();
+ // Free the memory allocated by ExpandResponseFiles.
+ if (ReadResponseFiles) {
+ // Free all the strdup()ed strings.
+ for (std::vector::iterator i = newArgv.begin(), e = newArgv.end();
+ i != e; ++i)
+ free (*i);
+ }
+
// If we had an error processing our arguments, don't let the program execute
if (ErrorParsing) exit(1);
}
@@ -678,7 +734,7 @@
cerr << HelpStr; // Be nice for positional arguments
else
cerr << ProgramName << ": for the -" << ArgName;
-
+
cerr << " option: " << Message << "\n";
return true;
}
@@ -943,7 +999,7 @@
std::vector SinkOpts;
std::map OptMap;
GetOptionInfo(PositionalOpts, SinkOpts, OptMap);
-
+
// Copy Options into a vector so we can sort them as we like...
std::vector > Opts;
copy(OptMap.begin(), OptMap.end(), std::back_inserter(Opts));
@@ -970,7 +1026,7 @@
// Print out the positional options.
Option *CAOpt = 0; // The cl::ConsumeAfter option, if it exists...
- if (!PositionalOpts.empty() &&
+ if (!PositionalOpts.empty() &&
PositionalOpts[0]->getNumOccurrencesFlag() == ConsumeAfter)
CAOpt = PositionalOpts[0];
From nicolas.geoffray at lip6.fr Mon Apr 28 11:48:02 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Mon, 28 Apr 2008 16:48:02 -0000
Subject: [llvm-commits] [vmkit] r50356 -
/vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp
Message-ID: <200804281648.m3SGm2Pe013218@zion.cs.uiuc.edu>
Author: geoffray
Date: Mon Apr 28 11:48:02 2008
New Revision: 50356
URL: http://llvm.org/viewvc/llvm-project?rev=50356&view=rev
Log:
Implementation of Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8.
Modified:
vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp
Modified: vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp?rev=50356&r1=50355&r2=50356&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp Mon Apr 28 11:48:02 2008
@@ -93,3 +93,14 @@
return false;
}
}
+
+extern "C" {
+JNIEXPORT bool JNICALL Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8(
+#ifdef NATIVE_JNI
+JNIEnv *env,
+jclass clazz,
+#endif
+) {
+ return false;
+}
+}
From gohman at apple.com Mon Apr 28 11:58:24 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 16:58:24 -0000
Subject: [llvm-commits] [llvm] r50357 -
/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200804281658.m3SGwPBH013528@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 11:58:24 2008
New Revision: 50357
URL: http://llvm.org/viewvc/llvm-project?rev=50357&view=rev
Log:
Teach DAGCombine to convert (sext x) to (zext x) when the
sign-bit of x is known to be zero.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=50357&r1=50356&r2=50357&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Apr 28 11:58:24 2008
@@ -2887,6 +2887,10 @@
if (SCC.Val) return SCC;
}
+ // fold (sext x) -> (zext x) if the sign bit is known zero.
+ if (DAG.SignBitIsZero(N0))
+ return DAG.getNode(ISD::ZERO_EXTEND, VT, N0);
+
return SDOperand();
}
From gohman at apple.com Mon Apr 28 12:02:22 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 17:02:22 -0000
Subject: [llvm-commits] [llvm] r50358 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/sext-misc.ll
Message-ID: <200804281702.m3SH2MPF013676@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 12:02:21 2008
New Revision: 50358
URL: http://llvm.org/viewvc/llvm-project?rev=50358&view=rev
Log:
Teach InstCombine's ComputeMaskedBits what SelectionDAG's
ComputeMaskedBits knows about cttz, ctlz, and ctpop. Teach
SelectionDAG's ComputeMaskedBits what InstCombine's knows
about SRem. And teach them both some things about high bits
in Mul, UDiv, URem, and Sub. This allows instcombine and
dagcombine to eliminate sign-extension operations in
several new cases.
Added:
llvm/trunk/test/Transforms/InstCombine/sext-misc.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=50358&r1=50357&r2=50358&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Apr 28 12:02:21 2008
@@ -1229,6 +1229,50 @@
KnownZero = KnownZeroOut;
return;
}
+ case ISD::MUL: {
+ APInt Mask2 = APInt::getAllOnesValue(BitWidth);
+ ComputeMaskedBits(Op.getOperand(1), Mask2, KnownZero, KnownOne, Depth+1);
+ ComputeMaskedBits(Op.getOperand(0), Mask2, KnownZero2, KnownOne2, Depth+1);
+ assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
+ assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?");
+
+ // If low bits are zero in either operand, output low known-0 bits.
+ // Also compute a conserative estimate for high known-0 bits.
+ // More trickiness is possible, but this is sufficient for the
+ // interesting case of alignment computation.
+ KnownOne.clear();
+ unsigned TrailZ = KnownZero.countTrailingOnes() +
+ KnownZero2.countTrailingOnes();
+ unsigned LeadZ = std::max(KnownZero.countLeadingOnes() +
+ KnownZero2.countLeadingOnes() +
+ 1, BitWidth) - BitWidth;
+
+ TrailZ = std::min(TrailZ, BitWidth);
+ LeadZ = std::min(LeadZ, BitWidth);
+ KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ) |
+ APInt::getHighBitsSet(BitWidth, LeadZ);
+ KnownZero &= Mask;
+ return;
+ }
+ case ISD::UDIV: {
+ // For the purposes of computing leading zeros we can conservatively
+ // treat a udiv as a logical right shift by the power of 2 known to
+ // be greater than the denominator.
+ APInt AllOnes = APInt::getAllOnesValue(BitWidth);
+ ComputeMaskedBits(Op.getOperand(0),
+ AllOnes, KnownZero2, KnownOne2, Depth+1);
+ unsigned LeadZ = KnownZero2.countLeadingOnes();
+
+ KnownOne2.clear();
+ KnownZero2.clear();
+ ComputeMaskedBits(Op.getOperand(1),
+ AllOnes, KnownZero2, KnownOne2, Depth+1);
+ LeadZ = std::min(BitWidth,
+ LeadZ + BitWidth - KnownOne2.countLeadingZeros());
+
+ KnownZero = APInt::getHighBitsSet(BitWidth, LeadZ) & Mask;
+ return;
+ }
case ISD::SELECT:
ComputeMaskedBits(Op.getOperand(2), Mask, KnownZero, KnownOne, Depth+1);
ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero2, KnownOne2, Depth+1);
@@ -1469,47 +1513,94 @@
KnownZero = APInt::getHighBitsSet(BitWidth, BitWidth - 1);
return;
+ case ISD::SUB: {
+ if (ConstantSDNode *CLHS = dyn_cast(Op.getOperand(0))) {
+ // We know that the top bits of C-X are clear if X contains less bits
+ // than C (i.e. no wrap-around can happen). For example, 20-X is
+ // positive if we can prove that X is >= 0 and < 16.
+ if (CLHS->getAPIntValue().isNonNegative()) {
+ unsigned NLZ = (CLHS->getAPIntValue()+1).countLeadingZeros();
+ // NLZ can't be BitWidth with no sign bit
+ APInt MaskV = APInt::getHighBitsSet(BitWidth, NLZ+1);
+ ComputeMaskedBits(Op.getOperand(1), MaskV, KnownZero2, KnownOne2,
+ Depth+1);
+
+ // If all of the MaskV bits are known to be zero, then we know the
+ // output top bits are zero, because we now know that the output is
+ // from [0-C].
+ if ((KnownZero2 & MaskV) == MaskV) {
+ unsigned NLZ2 = CLHS->getAPIntValue().countLeadingZeros();
+ // Top bits known zero.
+ KnownZero = APInt::getHighBitsSet(BitWidth, NLZ2) & Mask;
+ }
+ }
+ }
+ }
+ // fall through
case ISD::ADD: {
- // If either the LHS or the RHS are Zero, the result is zero.
- ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero, KnownOne, Depth+1);
- ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero2, KnownOne2, Depth+1);
- assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
- assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?");
-
// Output known-0 bits are known if clear or set in both the low clear bits
// common to both LHS & RHS. For example, 8+(X<<3) is known to have the
// low 3 bits clear.
- unsigned KnownZeroOut = std::min(KnownZero.countTrailingOnes(),
- KnownZero2.countTrailingOnes());
-
- KnownZero = APInt::getLowBitsSet(BitWidth, KnownZeroOut);
- KnownOne = APInt(BitWidth, 0);
+ APInt Mask2 = APInt::getLowBitsSet(BitWidth, Mask.countTrailingOnes());
+ ComputeMaskedBits(Op.getOperand(0), Mask2, KnownZero2, KnownOne2, Depth+1);
+ assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?");
+ unsigned KnownZeroOut = KnownZero2.countTrailingOnes();
+
+ ComputeMaskedBits(Op.getOperand(1), Mask2, KnownZero2, KnownOne2, Depth+1);
+ assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?");
+ KnownZeroOut = std::min(KnownZeroOut,
+ KnownZero2.countTrailingOnes());
+
+ KnownZero |= APInt::getLowBitsSet(BitWidth, KnownZeroOut);
return;
}
- case ISD::SUB: {
- ConstantSDNode *CLHS = dyn_cast(Op.getOperand(0));
- if (!CLHS) return;
+ case ISD::SREM:
+ if (ConstantSDNode *Rem = dyn_cast(Op.getOperand(1))) {
+ APInt RA = Rem->getAPIntValue();
+ if (RA.isPowerOf2() || (-RA).isPowerOf2()) {
+ APInt LowBits = RA.isStrictlyPositive() ? ((RA - 1) | RA) : ~RA;
+ APInt Mask2 = LowBits | APInt::getSignBit(BitWidth);
+ ComputeMaskedBits(Op.getOperand(0), Mask2,KnownZero2,KnownOne2,Depth+1);
+
+ // The sign of a remainder is equal to the sign of the first
+ // operand (zero being positive).
+ if (KnownZero2[BitWidth-1] || ((KnownZero2 & LowBits) == LowBits))
+ KnownZero2 |= ~LowBits;
+ else if (KnownOne2[BitWidth-1])
+ KnownOne2 |= ~LowBits;
- // We know that the top bits of C-X are clear if X contains less bits
- // than C (i.e. no wrap-around can happen). For example, 20-X is
- // positive if we can prove that X is >= 0 and < 16.
- if (CLHS->getAPIntValue().isNonNegative()) {
- unsigned NLZ = (CLHS->getAPIntValue()+1).countLeadingZeros();
- // NLZ can't be BitWidth with no sign bit
- APInt MaskV = APInt::getHighBitsSet(BitWidth, NLZ+1);
- ComputeMaskedBits(Op.getOperand(1), MaskV, KnownZero, KnownOne, Depth+1);
-
- // If all of the MaskV bits are known to be zero, then we know the output
- // top bits are zero, because we now know that the output is from [0-C].
- if ((KnownZero & MaskV) == MaskV) {
- unsigned NLZ2 = CLHS->getAPIntValue().countLeadingZeros();
- // Top bits known zero.
- KnownZero = APInt::getHighBitsSet(BitWidth, NLZ2) & Mask;
- KnownOne = APInt(BitWidth, 0); // No one bits known.
- } else {
- KnownZero = KnownOne = APInt(BitWidth, 0); // Otherwise, nothing known.
+ KnownZero |= KnownZero2 & Mask;
+ KnownOne |= KnownOne2 & Mask;
+
+ assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");
+ }
+ }
+ return;
+ case ISD::UREM: {
+ if (ConstantSDNode *Rem = dyn_cast(Op.getOperand(1))) {
+ APInt RA = Rem->getAPIntValue();
+ if (RA.isStrictlyPositive() && RA.isPowerOf2()) {
+ APInt LowBits = (RA - 1) | RA;
+ APInt Mask2 = LowBits & Mask;
+ KnownZero |= ~LowBits & Mask;
+ ComputeMaskedBits(Op.getOperand(0), Mask2, KnownZero, KnownOne,Depth+1);
+ assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");
+ break;
}
}
+
+ // Since the result is less than or equal to either operand, any leading
+ // zero bits in either operand must also exist in the result.
+ APInt AllOnes = APInt::getAllOnesValue(BitWidth);
+ ComputeMaskedBits(Op.getOperand(0), AllOnes, KnownZero, KnownOne,
+ Depth+1);
+ ComputeMaskedBits(Op.getOperand(1), AllOnes, KnownZero2, KnownOne2,
+ Depth+1);
+
+ uint32_t Leaders = std::max(KnownZero.countLeadingOnes(),
+ KnownZero2.countLeadingOnes());
+ KnownOne.clear();
+ KnownZero = APInt::getHighBitsSet(BitWidth, Leaders) & Mask;
return;
}
default:
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=50358&r1=50357&r2=50358&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 28 12:02:21 2008
@@ -700,15 +700,15 @@
return;
}
+ KnownZero.clear(); KnownOne.clear(); // Start out not knowing anything.
+
if (Depth == 6 || Mask == 0)
return; // Limit search depth.
User *I = dyn_cast(V);
if (!I) return;
- KnownZero.clear(); KnownOne.clear(); // Don't know anything.
APInt KnownZero2(KnownZero), KnownOne2(KnownOne);
-
switch (getOpcode(I)) {
default: break;
case Instruction::And: {
@@ -759,16 +759,42 @@
assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?");
// If low bits are zero in either operand, output low known-0 bits.
+ // Also compute a conserative estimate for high known-0 bits.
// More trickiness is possible, but this is sufficient for the
// interesting case of alignment computation.
KnownOne.clear();
unsigned TrailZ = KnownZero.countTrailingOnes() +
KnownZero2.countTrailingOnes();
+ unsigned LeadZ = std::max(KnownZero.countLeadingOnes() +
+ KnownZero2.countLeadingOnes() +
+ 1, BitWidth) - BitWidth;
+
TrailZ = std::min(TrailZ, BitWidth);
- KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ);
+ LeadZ = std::min(LeadZ, BitWidth);
+ KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ) |
+ APInt::getHighBitsSet(BitWidth, LeadZ);
KnownZero &= Mask;
return;
}
+ case Instruction::UDiv: {
+ // For the purposes of computing leading zeros we can conservatively
+ // treat a udiv as a logical right shift by the power of 2 known to
+ // be greater than the denominator.
+ APInt AllOnes = APInt::getAllOnesValue(BitWidth);
+ ComputeMaskedBits(I->getOperand(0),
+ AllOnes, KnownZero2, KnownOne2, Depth+1);
+ unsigned LeadZ = KnownZero2.countLeadingOnes();
+
+ KnownOne2.clear();
+ KnownZero2.clear();
+ ComputeMaskedBits(I->getOperand(1),
+ AllOnes, KnownZero2, KnownOne2, Depth+1);
+ LeadZ = std::min(BitWidth,
+ LeadZ + BitWidth - KnownOne2.countLeadingZeros());
+
+ KnownZero = APInt::getHighBitsSet(BitWidth, LeadZ) & Mask;
+ return;
+ }
case Instruction::Select:
ComputeMaskedBits(I->getOperand(2), Mask, KnownZero, KnownOne, Depth+1);
ComputeMaskedBits(I->getOperand(1), Mask, KnownZero2, KnownOne2, Depth+1);
@@ -900,38 +926,36 @@
unsigned NLZ = (CLHS->getValue()+1).countLeadingZeros();
// NLZ can't be BitWidth with no sign bit
APInt MaskV = APInt::getHighBitsSet(BitWidth, NLZ+1);
- ComputeMaskedBits(I->getOperand(1), MaskV, KnownZero, KnownOne, Depth+1);
+ ComputeMaskedBits(I->getOperand(1), MaskV, KnownZero2, KnownOne2,
+ Depth+1);
- // If all of the MaskV bits are known to be zero, then we know the output
- // top bits are zero, because we now know that the output is from [0-C].
- if ((KnownZero & MaskV) == MaskV) {
+ // If all of the MaskV bits are known to be zero, then we know the
+ // output top bits are zero, because we now know that the output is
+ // from [0-C].
+ if ((KnownZero2 & MaskV) == MaskV) {
unsigned NLZ2 = CLHS->getValue().countLeadingZeros();
// Top bits known zero.
KnownZero = APInt::getHighBitsSet(BitWidth, NLZ2) & Mask;
- KnownOne = APInt(BitWidth, 0); // No one bits known.
- } else {
- KnownZero = KnownOne = APInt(BitWidth, 0); // Otherwise, nothing known.
}
- return;
}
}
}
// fall through
case Instruction::Add: {
- // If either the LHS or the RHS are Zero, the result is zero.
- ComputeMaskedBits(I->getOperand(1), Mask, KnownZero, KnownOne, Depth+1);
- ComputeMaskedBits(I->getOperand(0), Mask, KnownZero2, KnownOne2, Depth+1);
- assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
- assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?");
-
// Output known-0 bits are known if clear or set in both the low clear bits
// common to both LHS & RHS. For example, 8+(X<<3) is known to have the
// low 3 bits clear.
- unsigned KnownZeroOut = std::min(KnownZero.countTrailingOnes(),
- KnownZero2.countTrailingOnes());
-
- KnownZero = APInt::getLowBitsSet(BitWidth, KnownZeroOut);
- KnownOne = APInt(BitWidth, 0);
+ APInt Mask2 = APInt::getLowBitsSet(BitWidth, Mask.countTrailingOnes());
+ ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero2, KnownOne2, Depth+1);
+ assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?");
+ unsigned KnownZeroOut = KnownZero2.countTrailingOnes();
+
+ ComputeMaskedBits(I->getOperand(1), Mask2, KnownZero2, KnownOne2, Depth+1);
+ assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?");
+ KnownZeroOut = std::min(KnownZeroOut,
+ KnownZero2.countTrailingOnes());
+
+ KnownZero |= APInt::getLowBitsSet(BitWidth, KnownZeroOut);
return;
}
case Instruction::SRem:
@@ -956,7 +980,7 @@
}
}
break;
- case Instruction::URem:
+ case Instruction::URem: {
if (ConstantInt *Rem = dyn_cast(I->getOperand(1))) {
APInt RA = Rem->getValue();
if (RA.isStrictlyPositive() && RA.isPowerOf2()) {
@@ -965,19 +989,24 @@
KnownZero |= ~LowBits & Mask;
ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero, KnownOne,Depth+1);
assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");
+ break;
}
- } else {
- // Since the result is less than or equal to RHS, any leading zero bits
- // in RHS must also exist in the result.
- APInt AllOnes = APInt::getAllOnesValue(BitWidth);
- ComputeMaskedBits(I->getOperand(1), AllOnes, KnownZero2, KnownOne2,
- Depth+1);
-
- uint32_t Leaders = KnownZero2.countLeadingOnes();
- KnownZero |= APInt::getHighBitsSet(BitWidth, Leaders) & Mask;
- assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");
}
+
+ // Since the result is less than or equal to either operand, any leading
+ // zero bits in either operand must also exist in the result.
+ APInt AllOnes = APInt::getAllOnesValue(BitWidth);
+ ComputeMaskedBits(I->getOperand(0), AllOnes, KnownZero, KnownOne,
+ Depth+1);
+ ComputeMaskedBits(I->getOperand(1), AllOnes, KnownZero2, KnownOne2,
+ Depth+1);
+
+ uint32_t Leaders = std::max(KnownZero.countLeadingOnes(),
+ KnownZero2.countLeadingOnes());
+ KnownOne.clear();
+ KnownZero = APInt::getHighBitsSet(BitWidth, Leaders) & Mask;
break;
+ }
case Instruction::Alloca:
case Instruction::Malloc: {
@@ -1088,6 +1117,20 @@
}
break;
}
+ case Instruction::Call:
+ if (IntrinsicInst *II = dyn_cast(I)) {
+ switch (II->getIntrinsicID()) {
+ default: break;
+ case Intrinsic::ctpop:
+ case Intrinsic::ctlz:
+ case Intrinsic::cttz: {
+ unsigned LowBits = Log2_32(BitWidth)+1;
+ KnownZero = APInt::getHighBitsSet(BitWidth, BitWidth - LowBits);
+ break;
+ }
+ }
+ }
+ break;
}
}
@@ -1232,7 +1275,9 @@
APInt LHSKnownZero(BitWidth, 0), LHSKnownOne(BitWidth, 0);
APInt &RHSKnownZero = KnownZero, &RHSKnownOne = KnownOne;
switch (I->getOpcode()) {
- default: break;
+ default:
+ ComputeMaskedBits(V, DemandedMask, RHSKnownZero, RHSKnownOne, Depth);
+ break;
case Instruction::And:
// If either the LHS or the RHS are Zero, the result is zero.
if (SimplifyDemandedBits(I->getOperand(1), DemandedMask,
@@ -1578,6 +1623,9 @@
LHSKnownZero, LHSKnownOne, Depth+1))
return true;
}
+ // Otherwise just hand the sub off to ComputeMaskedBits to fill in
+ // the known zeros and ones.
+ ComputeMaskedBits(V, DemandedMask, RHSKnownZero, RHSKnownOne, Depth);
break;
case Instruction::Shl:
if (ConstantInt *SA = dyn_cast(I->getOperand(1))) {
@@ -1695,10 +1743,10 @@
}
}
break;
- case Instruction::URem:
+ case Instruction::URem: {
if (ConstantInt *Rem = dyn_cast(I->getOperand(1))) {
APInt RA = Rem->getValue();
- if (RA.isPowerOf2()) {
+ if (RA.isStrictlyPositive() && RA.isPowerOf2()) {
APInt LowBits = (RA - 1) | RA;
APInt Mask2 = LowBits & DemandedMask;
KnownZero |= ~LowBits & DemandedMask;
@@ -1707,19 +1755,26 @@
return true;
assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");
+ break;
}
- } else {
- APInt KnownZero2(BitWidth, 0), KnownOne2(BitWidth, 0);
- APInt AllOnes = APInt::getAllOnesValue(BitWidth);
- if (SimplifyDemandedBits(I->getOperand(1), AllOnes,
- KnownZero2, KnownOne2, Depth+1))
- return true;
-
- uint32_t Leaders = KnownZero2.countLeadingOnes();
- KnownZero |= APInt::getHighBitsSet(BitWidth, Leaders) & DemandedMask;
}
+
+ APInt KnownZero2(BitWidth, 0), KnownOne2(BitWidth, 0);
+ APInt AllOnes = APInt::getAllOnesValue(BitWidth);
+ ComputeMaskedBits(I->getOperand(0), AllOnes,
+ KnownZero2, KnownOne2, Depth+1);
+ uint32_t Leaders = KnownZero2.countLeadingOnes();
+ APInt HighZeros = APInt::getHighBitsSet(BitWidth, Leaders);
+ if (SimplifyDemandedBits(I->getOperand(1), ~HighZeros,
+ KnownZero2, KnownOne2, Depth+1))
+ return true;
+
+ Leaders = std::max(Leaders,
+ KnownZero2.countLeadingOnes());
+ KnownZero = APInt::getHighBitsSet(BitWidth, Leaders) & DemandedMask;
break;
}
+ }
// If the client is only demanding bits that we know, return the known
// constant.
Added: llvm/trunk/test/Transforms/InstCombine/sext-misc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/sext-misc.ll?rev=50358&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/sext-misc.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/sext-misc.ll Mon Apr 28 12:02:21 2008
@@ -0,0 +1,45 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sext
+; RUN: llvm-as < %s | llc -march=x86-64 | not grep movslq
+; RUN: llvm-as < %s | llc -march=x86 | not grep sar
+
+declare i32 @llvm.ctpop.i32(i32)
+declare i32 @llvm.ctlz.i32(i32)
+declare i32 @llvm.cttz.i32(i32)
+
+define i64 @foo(i32 %x) {
+ %t = call i32 @llvm.ctpop.i32(i32 %x)
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @boo(i32 %x) {
+ %t = call i32 @llvm.ctlz.i32(i32 %x)
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @zoo(i32 %x) {
+ %t = call i32 @llvm.cttz.i32(i32 %x)
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @coo(i32 %x) {
+ %t = udiv i32 %x, 3
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @moo(i32 %x) {
+ %t = urem i32 %x, 30000
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @yoo(i32 %x) {
+ %u = lshr i32 %x, 3
+ %t = mul i32 %u, 3
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @voo(i32 %x) {
+ %t = and i32 %x, 511
+ %u = sub i32 20000, %t
+ %s = sext i32 %u to i64
+ ret i64 %s
+}
From gohman at apple.com Mon Apr 28 12:15:20 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 17:15:20 -0000
Subject: [llvm-commits] [llvm] r50359 - in /llvm/trunk:
include/llvm/CodeGen/SelectionDAG.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMISelLowering.h
lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h
Message-ID: <200804281715.m3SHFKgD014115@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 12:15:20 2008
New Revision: 50359
URL: http://llvm.org/viewvc/llvm-project?rev=50359&view=rev
Log:
Fix the SVOffset values for loads and stores produced by
memcpy/memset expansion. It was a bug for the SVOffset value
to be used in the actual address calculations.
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
llvm/trunk/lib/Target/ARM/ARMISelLowering.h
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.h
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=50359&r1=50358&r2=50359&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Apr 28 12:15:20 2008
@@ -326,17 +326,17 @@
SDOperand getMemcpy(SDOperand Chain, SDOperand Dst, SDOperand Src,
SDOperand Size, unsigned Align,
bool AlwaysInline,
- const Value *DstSV, uint64_t DstOff,
- const Value *SrcSV, uint64_t SrcOff);
+ const Value *DstSV, uint64_t DstSVOff,
+ const Value *SrcSV, uint64_t SrcSVOff);
SDOperand getMemmove(SDOperand Chain, SDOperand Dst, SDOperand Src,
SDOperand Size, unsigned Align,
- const Value *DstSV, uint64_t DstOff,
- const Value *SrcSV, uint64_t SrcOff);
+ const Value *DstSV, uint64_t DstOSVff,
+ const Value *SrcSV, uint64_t SrcSVOff);
SDOperand getMemset(SDOperand Chain, SDOperand Dst, SDOperand Src,
SDOperand Size, unsigned Align,
- const Value *DstSV, uint64_t DstOff);
+ const Value *DstSV, uint64_t DstSVOff);
/// getSetCC - Helper function to make it easier to build SetCC's if you just
/// have an ISD::CondCode instead of an SDOperand.
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=50359&r1=50358&r2=50359&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Apr 28 12:15:20 2008
@@ -2590,8 +2590,8 @@
SDOperand Src, uint64_t Size,
unsigned Align,
bool AlwaysInline,
- const Value *DstSV, uint64_t DstOff,
- const Value *SrcSV, uint64_t SrcOff) {
+ const Value *DstSV, uint64_t DstSVOff,
+ const Value *SrcSV, uint64_t SrcSVOff){
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
// Expand memcpy to a series of store ops if the size operand falls below
@@ -2610,6 +2610,7 @@
GlobalAddressSDNode *G = NULL;
std::string Str;
bool CopyFromStr = false;
+ uint64_t SrcOff = 0, DstOff = 0;
if (Src.getOpcode() == ISD::GlobalAddress)
G = cast(Src);
@@ -2640,15 +2641,15 @@
Store =
DAG.getStore(Chain, Value,
getMemBasePlusOffset(Dst, DstOff, DAG),
- DstSV, DstOff);
+ DstSV, DstSVOff + DstOff);
} else {
Value = DAG.getLoad(VT, Chain,
getMemBasePlusOffset(Src, SrcOff, DAG),
- SrcSV, SrcOff, false, Align);
+ SrcSV, SrcSVOff + SrcOff, false, Align);
Store =
DAG.getStore(Chain, Value,
getMemBasePlusOffset(Dst, DstOff, DAG),
- DstSV, DstOff, false, Align);
+ DstSV, DstSVOff + DstOff, false, Align);
}
OutChains.push_back(Store);
SrcOff += VTSize;
@@ -2663,7 +2664,7 @@
SDOperand Chain, SDOperand Dst,
SDOperand Src, uint64_t Size,
unsigned Align,
- const Value *DstSV, uint64_t DstOff) {
+ const Value *DstSV, uint64_t DstSVOff) {
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
// Expand memset to a series of load/store ops if the size operand
@@ -2674,6 +2675,7 @@
return SDOperand();
SmallVector OutChains;
+ uint64_t DstOff = 0;
unsigned NumMemOps = MemOps.size();
for (unsigned i = 0; i < NumMemOps; i++) {
@@ -2682,7 +2684,7 @@
SDOperand Value = getMemsetValue(Src, VT, DAG);
SDOperand Store = DAG.getStore(Chain, Value,
getMemBasePlusOffset(Dst, DstOff, DAG),
- DstSV, DstOff);
+ DstSV, DstSVOff + DstOff);
OutChains.push_back(Store);
DstOff += VTSize;
}
@@ -2694,8 +2696,8 @@
SDOperand SelectionDAG::getMemcpy(SDOperand Chain, SDOperand Dst,
SDOperand Src, SDOperand Size,
unsigned Align, bool AlwaysInline,
- const Value *DstSV, uint64_t DstOff,
- const Value *SrcSV, uint64_t SrcOff) {
+ const Value *DstSV, uint64_t DstSVOff,
+ const Value *SrcSV, uint64_t SrcSVOff) {
// Check to see if we should lower the memcpy to loads and stores first.
// For cases within the target-specified limits, this is the best choice.
@@ -2707,7 +2709,7 @@
SDOperand Result =
getMemcpyLoadsAndStores(*this, Chain, Dst, Src, ConstantSize->getValue(),
- Align, false, DstSV, DstOff, SrcSV, SrcOff);
+ Align, false, DstSV, DstSVOff, SrcSV, SrcSVOff);
if (Result.Val)
return Result;
}
@@ -2717,7 +2719,7 @@
SDOperand Result =
TLI.EmitTargetCodeForMemcpy(*this, Chain, Dst, Src, Size, Align,
AlwaysInline,
- DstSV, DstOff, SrcSV, SrcOff);
+ DstSV, DstSVOff, SrcSV, SrcSVOff);
if (Result.Val)
return Result;
@@ -2727,7 +2729,7 @@
assert(ConstantSize && "AlwaysInline requires a constant size!");
return getMemcpyLoadsAndStores(*this, Chain, Dst, Src,
ConstantSize->getValue(), Align, true,
- DstSV, DstOff, SrcSV, SrcOff);
+ DstSV, DstSVOff, SrcSV, SrcSVOff);
}
// Emit a library call.
@@ -2748,8 +2750,8 @@
SDOperand SelectionDAG::getMemmove(SDOperand Chain, SDOperand Dst,
SDOperand Src, SDOperand Size,
unsigned Align,
- const Value *DstSV, uint64_t DstOff,
- const Value *SrcSV, uint64_t SrcOff) {
+ const Value *DstSV, uint64_t DstSVOff,
+ const Value *SrcSV, uint64_t SrcSVOff) {
// TODO: Optimize small memmove cases with simple loads and stores,
// ensuring that all loads precede all stores. This can cause severe
@@ -2759,7 +2761,7 @@
// code. If the target chooses to do this, this is the next best.
SDOperand Result =
TLI.EmitTargetCodeForMemmove(*this, Chain, Dst, Src, Size, Align,
- DstSV, DstOff, SrcSV, SrcOff);
+ DstSV, DstSVOff, SrcSV, SrcSVOff);
if (Result.Val)
return Result;
@@ -2781,7 +2783,7 @@
SDOperand SelectionDAG::getMemset(SDOperand Chain, SDOperand Dst,
SDOperand Src, SDOperand Size,
unsigned Align,
- const Value *DstSV, uint64_t DstOff) {
+ const Value *DstSV, uint64_t DstSVOff) {
// Check to see if we should lower the memset to stores first.
// For cases within the target-specified limits, this is the best choice.
@@ -2793,7 +2795,7 @@
SDOperand Result =
getMemsetStores(*this, Chain, Dst, Src, ConstantSize->getValue(), Align,
- DstSV, DstOff);
+ DstSV, DstSVOff);
if (Result.Val)
return Result;
}
@@ -2802,7 +2804,7 @@
// code. If the target chooses to do this, this is the next best.
SDOperand Result =
TLI.EmitTargetCodeForMemset(*this, Chain, Dst, Src, Size, Align,
- DstSV, DstOff);
+ DstSV, DstSVOff);
if (Result.Val)
return Result;
Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=50359&r1=50358&r2=50359&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Apr 28 12:15:20 2008
@@ -1247,8 +1247,8 @@
SDOperand Dst, SDOperand Src,
SDOperand Size, unsigned Align,
bool AlwaysInline,
- const Value *DstSV, uint64_t DstOff,
- const Value *SrcSV, uint64_t SrcOff){
+ const Value *DstSV, uint64_t DstSVOff,
+ const Value *SrcSV, uint64_t SrcSVOff){
// Do repeated 4-byte loads and stores. To be improved.
// This requires 4-byte alignment.
if ((Align & 3) != 0)
@@ -1271,6 +1271,7 @@
const unsigned MAX_LOADS_IN_LDM = 6;
SDOperand TFOps[MAX_LOADS_IN_LDM];
SDOperand Loads[MAX_LOADS_IN_LDM];
+ uint64_t SrcOff = 0, DstOff = 0;
// Emit up to MAX_LOADS_IN_LDM loads, then a TokenFactor barrier, then the
// same number of stores. The loads and stores will get combined into
@@ -1281,7 +1282,7 @@
Loads[i] = DAG.getLoad(VT, Chain,
DAG.getNode(ISD::ADD, MVT::i32, Src,
DAG.getConstant(SrcOff, MVT::i32)),
- SrcSV, SrcOff);
+ SrcSV, SrcSVOff + SrcOff);
TFOps[i] = Loads[i].getValue(1);
SrcOff += VTSize;
}
@@ -1292,7 +1293,7 @@
TFOps[i] = DAG.getStore(Chain, Loads[i],
DAG.getNode(ISD::ADD, MVT::i32, Dst,
DAG.getConstant(DstOff, MVT::i32)),
- DstSV, DstOff);
+ DstSV, DstSVOff + DstOff);
DstOff += VTSize;
}
Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, &TFOps[0], i);
@@ -1318,7 +1319,7 @@
Loads[i] = DAG.getLoad(VT, Chain,
DAG.getNode(ISD::ADD, MVT::i32, Src,
DAG.getConstant(SrcOff, MVT::i32)),
- SrcSV, SrcOff);
+ SrcSV, SrcSVOff + SrcOff);
TFOps[i] = Loads[i].getValue(1);
++i;
SrcOff += VTSize;
@@ -1340,7 +1341,7 @@
TFOps[i] = DAG.getStore(Chain, Loads[i],
DAG.getNode(ISD::ADD, MVT::i32, Dst,
DAG.getConstant(DstOff, MVT::i32)),
- DstSV, DstOff);
+ DstSV, DstSVOff + DstOff);
++i;
DstOff += VTSize;
BytesLeft -= VTSize;
Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=50359&r1=50358&r2=50359&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Mon Apr 28 12:15:20 2008
@@ -149,8 +149,8 @@
SDOperand Dst, SDOperand Src,
SDOperand Size, unsigned Align,
bool AlwaysInline,
- const Value *DstSV, uint64_t DstOff,
- const Value *SrcSV, uint64_t SrcOff);
+ const Value *DstSV, uint64_t DstSVOff,
+ const Value *SrcSV, uint64_t SrcSVOff);
};
}
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=50359&r1=50358&r2=50359&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Apr 28 12:15:20 2008
@@ -4763,7 +4763,7 @@
SDOperand Chain,
SDOperand Dst, SDOperand Src,
SDOperand Size, unsigned Align,
- const Value *DstSV, uint64_t DstOff) {
+ const Value *DstSV, uint64_t DstSVOff) {
ConstantSDNode *ConstantSize = dyn_cast(Size);
/// If not DWORD aligned or size is more than the threshold, call the library.
@@ -4890,7 +4890,7 @@
DAG.getConstant(Offset, AddrVT)),
Src,
DAG.getConstant(BytesLeft, SizeVT),
- Align, DstSV, 0);
+ Align, DstSV, DstSVOff + Offset);
}
// TODO: Use a Tokenfactor, as in memcpy, instead of a single chain.
@@ -4903,8 +4903,8 @@
SDOperand Dst, SDOperand Src,
SDOperand Size, unsigned Align,
bool AlwaysInline,
- const Value *DstSV, uint64_t DstOff,
- const Value *SrcSV, uint64_t SrcOff){
+ const Value *DstSV, uint64_t DstSVOff,
+ const Value *SrcSV, uint64_t SrcSVOff){
// This requires the copy size to be a constant, preferrably
// within a subtarget-specific limit.
@@ -4964,7 +4964,8 @@
DAG.getConstant(Offset, SrcVT)),
DAG.getConstant(BytesLeft, SizeVT),
Align, AlwaysInline,
- DstSV, 0, SrcSV, 0));
+ DstSV, DstSVOff + Offset,
+ SrcSV, SrcSVOff + Offset));
}
return DAG.getNode(ISD::TokenFactor, MVT::Other, &Results[0], Results.size());
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=50359&r1=50358&r2=50359&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Apr 28 12:15:20 2008
@@ -538,14 +538,14 @@
SDOperand Chain,
SDOperand Dst, SDOperand Src,
SDOperand Size, unsigned Align,
- const Value *DstSV, uint64_t DstOff);
+ const Value *DstSV, uint64_t DstSVOff);
SDOperand EmitTargetCodeForMemcpy(SelectionDAG &DAG,
SDOperand Chain,
SDOperand Dst, SDOperand Src,
SDOperand Size, unsigned Align,
bool AlwaysInline,
- const Value *DstSV, uint64_t DstOff,
- const Value *SrcSV, uint64_t SrcOff);
+ const Value *DstSV, uint64_t DstSVOff,
+ const Value *SrcSV, uint64_t SrcSVOff);
};
}
From gohman at apple.com Mon Apr 28 12:27:57 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 10:27:57 -0700
Subject: [llvm-commits] Speeding up instruction selection
(ScheduleDAGRRList)
In-Reply-To:
References:
Message-ID:
On Apr 24, 2008, at 6:07 AM, Roman Levenstein wrote:
>
>> /Users/echeng/LLVM/llvm/Release/bin/llc -f Output/sqlite3.llvm.bc -o
>> Output/sqlite3.llc.s
>> Assertion failed: (RemovedNum == 1 && "Not in queue!"), function
>> remove, file ScheduleDAGRRList.cpp, line 1321.
>
> Fixed. This was a bug related to the CapturePred function. It was
> updating the state of the SUnit before removing it. As a result, the
> comparison operators were working incorrectly and this SUnit could not
> be removed properly.
This is something that could cause subtle oddities in the
priority_queue implementation too. Good catch!
>
>
> With this patch, everything compiles without any problems on my
> machine.
>
> The new patch is attached.
This looks good; please commit it.
I expect we'll be revisiting the use of std::set, but in the testing
I've done
it doesn't seem to be a big enough factor to hold this up.
Dan
From gordonhenriksen at mac.com Mon Apr 28 12:37:06 2008
From: gordonhenriksen at mac.com (Gordon Henriksen)
Date: Mon, 28 Apr 2008 17:37:06 -0000
Subject: [llvm-commits] [llvm] r50360 - in /llvm/trunk:
include/llvm-c/Core.h include/llvm/Argument.h lib/VMCore/Core.cpp
lib/VMCore/Function.cpp
Message-ID: <200804281737.m3SHb7ME014773@zion.cs.uiuc.edu>
Author: gordon
Date: Mon Apr 28 12:37:06 2008
New Revision: 50360
URL: http://llvm.org/viewvc/llvm-project?rev=50360&view=rev
Log:
Expose parameter attributes via C bindings.
Patch by Anders Johnsen!
Modified:
llvm/trunk/include/llvm-c/Core.h
llvm/trunk/include/llvm/Argument.h
llvm/trunk/lib/VMCore/Core.cpp
llvm/trunk/lib/VMCore/Function.cpp
Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=50360&r1=50359&r2=50360&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Mon Apr 28 12:37:06 2008
@@ -83,6 +83,20 @@
typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
typedef enum {
+ LLVMZExtParamAttr = 1<<0,
+ LLVMSExtParamAttr = 1<<1,
+ LLVMNoReturnParamAttr = 1<<2,
+ LLVMNoUnwindParamAttr = 1<<3,
+ LLVMInRegParamAttr = 1<<4,
+ LLVMNoAliasParamAttr = 1<<5,
+ LLVMStructRetParamAttr = 1<<6,
+ LLVMByValParamAttr = 1<<7,
+ LLVMNestParamAttr = 1<<8,
+ LLVMReadNoneParamAttr = 1<<9,
+ LLVMReadOnlyParamAttr = 1<<10
+} LLVMParamAttr;
+
+typedef enum {
LLVMVoidTypeKind, /**< type with no size */
LLVMFloatTypeKind, /**< 32 bit floating point type */
LLVMDoubleTypeKind, /**< 64 bit floating point type */
@@ -413,6 +427,9 @@
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn);
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg);
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg);
+void LLVMAddParamAttr(LLVMValueRef Arg, LLVMParamAttr PA);
+void LLVMRemoveParamAttr(LLVMValueRef Arg, LLVMParamAttr PA);
+void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
/* Operations on basic blocks */
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB);
@@ -441,6 +458,11 @@
/* Operations on call sites */
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr);
+void LLVMAddInstrParamAttr(LLVMValueRef Instr, unsigned index, LLVMParamAttr);
+void LLVMRemoveInstrParamAttr(LLVMValueRef Instr, unsigned index,
+ LLVMParamAttr);
+void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
+ unsigned align);
/* Operations on phi nodes */
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
Modified: llvm/trunk/include/llvm/Argument.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Argument.h?rev=50360&r1=50359&r2=50360&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Argument.h (original)
+++ llvm/trunk/include/llvm/Argument.h Mon Apr 28 12:37:06 2008
@@ -15,6 +15,7 @@
#define LLVM_ARGUMENT_H
#include "llvm/Value.h"
+#include "llvm/ParameterAttributes.h"
namespace llvm {
@@ -60,7 +61,13 @@
/// hasSRetAttr - Return true if this argument has the sret attribute on it in
/// its containing function.
bool hasStructRetAttr() const;
+
+ /// addAttr - Add a ParamAttr to an argument
+ void addAttr(ParameterAttributes);
+ /// removeAttr - Remove a ParamAttr from an argument
+ void removeAttr(ParameterAttributes);
+
virtual void print(std::ostream &OS) const;
void print(std::ostream *OS) const {
if (OS) print(*OS);
Modified: llvm/trunk/lib/VMCore/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=50360&r1=50359&r2=50360&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Core.cpp (original)
+++ llvm/trunk/lib/VMCore/Core.cpp Mon Apr 28 12:37:06 2008
@@ -20,6 +20,7 @@
#include "llvm/TypeSymbolTable.h"
#include "llvm/ModuleProvider.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/CallSite.h"
#include
#include
#include
@@ -798,6 +799,19 @@
return wrap(--I);
}
+void LLVMAddParamAttr(LLVMValueRef Arg, LLVMParamAttr PA) {
+ unwrap(Arg)->addAttr(PA);
+}
+
+void LLVMRemoveParamAttr(LLVMValueRef Arg, LLVMParamAttr PA) {
+ unwrap(Arg)->removeAttr(PA);
+}
+
+void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) {
+ unwrap(Arg)->addAttr(
+ ParamAttr::constructAlignmentFromInt(align));
+}
+
/*--.. Operations on basic blocks ..........................................--*/
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB) {
@@ -936,6 +950,28 @@
assert(0 && "LLVMSetInstructionCallConv applies only to call and invoke!");
}
+void LLVMAddInstrParamAttr(LLVMValueRef Instr, unsigned index,
+ LLVMParamAttr PA) {
+ CallSite Call = CallSite(unwrap(Instr));
+ Call.setParamAttrs(
+ Call.getParamAttrs().addAttr(index, PA));
+}
+
+void LLVMRemoveInstrParamAttr(LLVMValueRef Instr, unsigned index,
+ LLVMParamAttr PA) {
+ CallSite Call = CallSite(unwrap(Instr));
+ Call.setParamAttrs(
+ Call.getParamAttrs().removeAttr(index, PA));
+}
+
+void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
+ unsigned align) {
+ CallSite Call = CallSite(unwrap(Instr));
+ Call.setParamAttrs(
+ Call.getParamAttrs().addAttr(index,
+ ParamAttr::constructAlignmentFromInt(align)));
+}
+
/*--.. Operations on phi nodes .............................................--*/
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=50360&r1=50359&r2=50360&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Mon Apr 28 12:37:06 2008
@@ -110,6 +110,17 @@
return getParent()->paramHasAttr(1, ParamAttr::StructRet);
}
+/// addAttr - Add a ParamAttr to an argument
+void Argument::addAttr(ParameterAttributes attr) {
+ getParent()->setParamAttrs(
+ getParent()->getParamAttrs().addAttr(getArgNo() + 1, attr));
+}
+
+/// removeAttr - Remove a ParamAttr from an argument
+void Argument::removeAttr(ParameterAttributes attr) {
+ getParent()->setParamAttrs(
+ getParent()->getParamAttrs().removeAttr(getArgNo() + 1, attr));
+}
From gohman at apple.com Mon Apr 28 12:42:03 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 17:42:03 -0000
Subject: [llvm-commits] [llvm] r50361 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200804281742.m3SHg3YS014897@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 12:42:03 2008
New Revision: 50361
URL: http://llvm.org/viewvc/llvm-project?rev=50361&view=rev
Log:
Don't call size() on each iteration of the loop.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50361&r1=50360&r2=50361&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 12:42:03 2008
@@ -158,7 +158,7 @@
unsigned Reg, const Type *Ty) : TLI(&tli) {
ComputeValueVTs(tli, Ty, ValueVTs);
- for (unsigned Value = 0; Value != ValueVTs.size(); ++Value) {
+ for (unsigned Value = 0, e = ValueVTs.size(); Value != e; ++Value) {
MVT::ValueType ValueVT = ValueVTs[Value];
unsigned NumRegs = TLI->getNumRegisters(ValueVT);
MVT::ValueType RegisterVT = TLI->getRegisterType(ValueVT);
@@ -364,7 +364,7 @@
ComputeValueVTs(TLI, V->getType(), ValueVTs);
unsigned FirstReg = 0;
- for (unsigned Value = 0; Value != ValueVTs.size(); ++Value) {
+ for (unsigned Value = 0, e = ValueVTs.size(); Value != e; ++Value) {
MVT::ValueType ValueVT = ValueVTs[Value];
MVT::ValueType RegisterVT = TLI.getRegisterType(ValueVT);
From kremenek at apple.com Mon Apr 28 12:58:07 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Mon, 28 Apr 2008 17:58:07 -0000
Subject: [llvm-commits] [llvm] r50362 - /llvm/trunk/lib/Support/Allocator.cpp
Message-ID: <200804281758.m3SHw7lm015385@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Apr 28 12:58:07 2008
New Revision: 50362
URL: http://llvm.org/viewvc/llvm-project?rev=50362&view=rev
Log:
Bug fix in BumpPtrAllocator: don't assume that all objects have the same alignment. "Bump" of the pointer for the next allocated object to be of the specified alignment.
Modified:
llvm/trunk/lib/Support/Allocator.cpp
Modified: llvm/trunk/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=50362&r1=50361&r2=50362&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Allocator.cpp (original)
+++ llvm/trunk/lib/Support/Allocator.cpp Mon Apr 28 12:58:07 2008
@@ -46,13 +46,16 @@
/// Allocate - Allocate and return at least the specified number of bytes.
///
void *Allocate(unsigned AllocSize, unsigned Alignment, MemRegion **RegPtr) {
- // Round size up to an even multiple of the alignment.
- AllocSize = (AllocSize+Alignment-1) & ~(Alignment-1);
- // If there is space in this region, return it.
- if (unsigned(NextPtr+AllocSize-(char*)this) <= RegionSize) {
- void *Result = NextPtr;
- NextPtr += AllocSize;
+ char* Result = (char*) (((uintptr_t) (NextPtr+Alignment-1))
+ & ~(Alignment-1));
+
+ // Speculate the new value of NextPtr.
+ char* NextPtrTmp = Result + AllocSize;
+
+ // If we are still within the current region, return Result.
+ if (unsigned (NextPtrTmp - (char*) this) <= RegionSize) {
+ NextPtr = NextPtrTmp;
return Result;
}
From kremenek at apple.com Mon Apr 28 12:58:20 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Mon, 28 Apr 2008 17:58:20 -0000
Subject: [llvm-commits] [llvm] r50363 -
/llvm/trunk/include/llvm/Support/AlignOf.h
Message-ID: <200804281758.m3SHwKGM015404@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Apr 28 12:58:20 2008
New Revision: 50363
URL: http://llvm.org/viewvc/llvm-project?rev=50363&view=rev
Log:
Add more alignment enums.
Modified:
llvm/trunk/include/llvm/Support/AlignOf.h
Modified: llvm/trunk/include/llvm/Support/AlignOf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/AlignOf.h?rev=50363&r1=50362&r2=50363&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/AlignOf.h (original)
+++ llvm/trunk/include/llvm/Support/AlignOf.h Mon Apr 28 12:58:20 2008
@@ -35,10 +35,17 @@
template
struct AlignOf {
enum { Alignment = sizeof(AlignmentCalcImpl) - sizeof(T) };
+
enum { Alignment_GreaterEqual_2Bytes = Alignment >= 2 ? 1 : 0 };
enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 };
enum { Alignment_GreaterEqual_8Bytes = Alignment >= 8 ? 1 : 0 };
enum { Alignment_GreaterEqual_16Bytes = Alignment >= 16 ? 1 : 0 };
+
+ enum { Alignment_LessEqual_2Bytes = Alignment <= 2 ? 1 : 0 };
+ enum { Alignment_LessEqual_4Bytes = Alignment <= 4 ? 1 : 0 };
+ enum { Alignment_LessEqual_8Bytes = Alignment <= 8 ? 1 : 0 };
+ enum { Alignment_LessEqual_16Bytes = Alignment <= 16 ? 1 : 0 };
+
};
/// alignof - A templated function that returns the mininum alignment of
From gohman at apple.com Mon Apr 28 13:10:41 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 18:10:41 -0000
Subject: [llvm-commits] [llvm] r50365 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200804281810.m3SIAfXu015793@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 13:10:39 2008
New Revision: 50365
URL: http://llvm.org/viewvc/llvm-project?rev=50365&view=rev
Log:
Rewrite the comments for RegsForValue and its members, and
reorder some of the members for clarity.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50365&r1=50364&r2=50365&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 13:10:39 2008
@@ -114,46 +114,56 @@
}
namespace {
- /// RegsForValue - This struct represents the physical registers that a
- /// particular value is assigned and the type information about the value.
- /// This is needed because values can be promoted into larger registers and
- /// expanded into multiple smaller registers than the value.
+ /// RegsForValue - This struct represents the registers (physical or virtual)
+ /// that a particular set of values is assigned, and the type information about
+ /// the value. The most common situation is to represent one value at a time,
+ /// but struct or array values are handled element-wise as multiple values.
+ /// The splitting of aggregates is performed recursively, so that we never
+ /// have aggregate-typed registers. The values at this point do not necessarily
+ /// have legal types, so each value may require one or more registers of some
+ /// legal type.
+ ///
struct VISIBILITY_HIDDEN RegsForValue {
/// TLI - The TargetLowering object.
+ ///
const TargetLowering *TLI;
- /// Regs - This list holds the register (for legal and promoted values)
- /// or register set (for expanded values) that the value should be assigned
- /// to.
- SmallVector Regs;
+ /// ValueVTs - The value types of the values, which may not be legal, and
+ /// may need be promoted or synthesized from one or more registers.
+ ///
+ SmallVector ValueVTs;
- /// RegVTs - The value types of the registers. This is the same size
- /// as ValueVTs; every register contributing to a given value must
- /// have the same type. When Regs contains all virtual registers, the
- /// contents of RegVTs is redundant with TLI's getRegisterType member
- /// function, however when Regs contains physical registers, it is
- /// necessary to have a separate record of the types.
+ /// RegVTs - The value types of the registers. This is the same size as
+ /// ValueVTs and it records, for each value, what the type of the assigned
+ /// register or registers are. (Individual values are never synthesized
+ /// from more than one type of register.)
+ ///
+ /// With virtual registers, the contents of RegVTs is redundant with TLI's
+ /// getRegisterType member function, however when with physical registers
+ /// it is necessary to have a separate record of the types.
///
SmallVector RegVTs;
- /// ValueVTs - The value types of the values, which may be promoted
- /// or synthesized from one or more registers.
- SmallVector ValueVTs;
+ /// Regs - This list holds the registers assigned to the values.
+ /// Each legal or promoted value requires one register, and each
+ /// expanded value requires multiple registers.
+ ///
+ SmallVector Regs;
RegsForValue() : TLI(0) {}
RegsForValue(const TargetLowering &tli,
unsigned Reg, MVT::ValueType regvt, MVT::ValueType valuevt)
- : TLI(&tli), Regs(1, Reg), RegVTs(1, regvt), ValueVTs(1, valuevt) {}
+ : TLI(&tli), ValueVTs(1, valuevt), RegVTs(1, regvt), Regs(1, Reg) {}
RegsForValue(const TargetLowering &tli,
const SmallVector ®s,
MVT::ValueType regvt, MVT::ValueType valuevt)
- : TLI(&tli), Regs(regs), RegVTs(1, regvt), ValueVTs(1, valuevt) {}
+ : TLI(&tli), ValueVTs(1, valuevt), RegVTs(1, regvt), Regs(regs) {}
RegsForValue(const TargetLowering &tli,
const SmallVector ®s,
const SmallVector ®vts,
const SmallVector &valuevts)
- : TLI(&tli), Regs(regs), RegVTs(regvts), ValueVTs(valuevts) {}
+ : TLI(&tli), ValueVTs(valuevts), RegVTs(regvts), Regs(regs) {}
RegsForValue(const TargetLowering &tli,
unsigned Reg, const Type *Ty) : TLI(&tli) {
ComputeValueVTs(tli, Ty, ValueVTs);
From clattner at apple.com Mon Apr 28 13:14:26 2008
From: clattner at apple.com (Chris Lattner)
Date: Mon, 28 Apr 2008 11:14:26 -0700
Subject: [llvm-commits] [llvm] r50358 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/sext-misc.ll
In-Reply-To: <200804281702.m3SH2MPF013676@zion.cs.uiuc.edu>
References: <200804281702.m3SH2MPF013676@zion.cs.uiuc.edu>
Message-ID:
On Apr 28, 2008, at 10:02 AM, Dan Gohman wrote:
> Log:
> Teach InstCombine's ComputeMaskedBits what SelectionDAG's
> ComputeMaskedBits knows about cttz, ctlz, and ctpop. Teach
> SelectionDAG's ComputeMaskedBits what InstCombine's knows
> about SRem. And teach them both some things about high bits
> in Mul, UDiv, URem, and Sub. This allows instcombine and
> dagcombine to eliminate sign-extension operations in
> several new cases.
Nice!
-Chris
From gohman at apple.com Mon Apr 28 13:19:43 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 18:19:43 -0000
Subject: [llvm-commits] [llvm] r50366 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200804281819.m3SIJifM016055@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 13:19:43 2008
New Revision: 50366
URL: http://llvm.org/viewvc/llvm-project?rev=50366&view=rev
Log:
Add a comment to CreateRegForValue that clarifies the handling of
aggregate types.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50366&r1=50365&r2=50366&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 13:19:43 2008
@@ -369,6 +369,10 @@
/// CreateRegForValue - Allocate the appropriate number of virtual registers of
/// the correctly promoted or expanded types. Assign these registers
/// consecutive vreg numbers and return the first assigned number.
+///
+/// In the case that the given value has struct or array type, this function
+/// will assign registers for each member or element.
+///
unsigned FunctionLoweringInfo::CreateRegForValue(const Value *V) {
SmallVector ValueVTs;
ComputeValueVTs(TLI, V->getType(), ValueVTs);
From gohman at apple.com Mon Apr 28 13:28:50 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 18:28:50 -0000
Subject: [llvm-commits] [llvm] r50367 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200804281828.m3SISoL2016483@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 13:28:49 2008
New Revision: 50367
URL: http://llvm.org/viewvc/llvm-project?rev=50367&view=rev
Log:
Delete an unused constructor.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50367&r1=50366&r2=50367&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 13:28:49 2008
@@ -153,9 +153,6 @@
RegsForValue() : TLI(0) {}
RegsForValue(const TargetLowering &tli,
- unsigned Reg, MVT::ValueType regvt, MVT::ValueType valuevt)
- : TLI(&tli), ValueVTs(1, valuevt), RegVTs(1, regvt), Regs(1, Reg) {}
- RegsForValue(const TargetLowering &tli,
const SmallVector ®s,
MVT::ValueType regvt, MVT::ValueType valuevt)
: TLI(&tli), ValueVTs(1, valuevt), RegVTs(1, regvt), Regs(regs) {}
From evan.cheng at apple.com Mon Apr 28 13:35:41 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 28 Apr 2008 11:35:41 -0700
Subject: [llvm-commits] [llvm] r50357 -
/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
In-Reply-To: <200804281658.m3SGwPBH013528@zion.cs.uiuc.edu>
References: <200804281658.m3SGwPBH013528@zion.cs.uiuc.edu>
Message-ID: <1A96CB40-FEB1-4187-B1D0-6BA415CBF1AF@apple.com>
Is this always safe? What if zext of the type is not legal?
Evan
On Apr 28, 2008, at 9:58 AM, Dan Gohman wrote:
> Author: djg
> Date: Mon Apr 28 11:58:24 2008
> New Revision: 50357
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50357&view=rev
> Log:
> Teach DAGCombine to convert (sext x) to (zext x) when the
> sign-bit of x is known to be zero.
>
> Modified:
> llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=50357&r1=50356&r2=50357&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Apr 28
> 11:58:24 2008
> @@ -2887,6 +2887,10 @@
> if (SCC.Val) return SCC;
> }
>
> + // fold (sext x) -> (zext x) if the sign bit is known zero.
> + if (DAG.SignBitIsZero(N0))
> + return DAG.getNode(ISD::ZERO_EXTEND, VT, N0);
> +
> return SDOperand();
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From gohman at apple.com Mon Apr 28 13:41:28 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 11:41:28 -0700
Subject: [llvm-commits] [llvm] r50279 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/Transforms/Scalar/CodeGenPrepare.cpp
test/CodeGen/Generic/multiple-return-values-cross-block-with-invoke.ll
In-Reply-To:
References: <200804251827.m3PIRtH4003953@zion.cs.uiuc.edu>
Message-ID: <99F2986B-B21C-45EC-84F1-715893122EA2@apple.com>
On Apr 28, 2008, at 12:13 AM, Chris Lattner wrote:
> On Apr 25, 2008, at 11:27 AM, Dan Gohman wrote:
>>
>> /// RegsForValue - This struct represents the physical registers
>> that a
>> /// particular value is assigned and the type information about
>> the value.
>> /// This is needed because values can be promoted into larger
>> registers and
>> /// expanded into multiple smaller registers than the value.
>> struct VISIBILITY_HIDDEN RegsForValue {
>
> This should probably explicitly mention how it handles aggregates.
> Maybe a good general summary up front could help my larger complaint
> next:
I rewrote this comment. Let me know if have further questions.
>
>
>
> ...
>
>> + /// RegVTs - The value types of the registers. This is the same
>> size
>> + /// as ValueVTs; every register contributing to a given value
>> must
>> + /// have the same type. When Regs contains all virtual
>> registers, the
>> + /// contents of RegVTs is redundant with TLI's getRegisterType
>> member
>> + /// function, however when Regs contains physical registers, it
>> is
>> + /// necessary to have a separate record of the types.
>> ///
>> + SmallVector RegVTs;
>>
>> + /// ValueVTs - The value types of the values, which may be
>> promoted
>> + /// or synthesized from one or more registers.
>> + SmallVector ValueVTs;
>
> The descriptions of these fields is not very clear to me. The
> description of RegVTs forward references ValueVTs, maybe ValueVTs
> should be moved first? It would be helpful to have an explanatory
> comment here with an example. For example, on PPC, how is {i8, i64}
> handled by these two vectors? Maybe 'Regs' should have a comment that
> indicates it can contain pregs?
I rewrote several related comments to be more explanatory.
>
>
>>
>> +
>> + RegsForValue() : TLI(0) {}
>> +
>> + RegsForValue(const TargetLowering &tli,
>> + unsigned Reg, MVT::ValueType regvt, MVT::ValueType
>> valuevt)
>> + : TLI(&tli), Regs(1, Reg), RegVTs(1, regvt), ValueVTs(1,
>> valuevt) {}
>> + RegsForValue(const TargetLowering &tli,
>> + const std::vector ®s,
>> MVT::ValueType regvt, MVT::ValueType valuevt)
>> + : TLI(&tli), Regs(regs), RegVTs(1, regvt), ValueVTs(1,
>> valuevt) {}
>> + RegsForValue(const TargetLowering &tli,
>> + const std::vector ®s,
>> + const SmallVector ®vts,
>> + const SmallVector &valuevts)
>> + : TLI(&tli), Regs(regs), RegVTs(regvts), ValueVTs(valuevts) {}
>> + RegsForValue(const TargetLowering &tli,
>> + unsigned Reg, const Type *Ty) : TLI(&tli) {
>
> So many ctors... would it be reasonable to change clients to use one
> of the more general ones instead of having so many ctors?
One of them was unused; I deleted it.
>
>
>>
>> + ComputeValueVTs(tli, Ty, ValueVTs);
>> +
>> + for (unsigned Value = 0; Value != ValueVTs.size(); ++Value) {
>
> Please add a comment explaining what this loop is doing. Does
> 'ValueVTs.size()' need to be recomputed on every iteration?
No, it ought to be inlined :-). I fixed it though.
>
>
>>
>> + MVT::ValueType ValueVT = ValueVTs[Value];
>> + unsigned NumRegs = TLI->getNumRegisters(ValueVT);
>> + MVT::ValueType RegisterVT = TLI->getRegisterType(ValueVT);
>> + for (unsigned i = 0; i != NumRegs; ++i)
>> + Regs.push_back(Reg + i);
>> + RegVTs.push_back(RegisterVT);
>> + Reg += NumRegs;
>> + }
>> }
>
>
>> @@ -310,16 +362,22 @@
>> /// the correctly promoted or expanded types. Assign these registers
>> /// consecutive vreg numbers and return the first assigned number.
>> unsigned FunctionLoweringInfo::CreateRegForValue(const Value *V) {
>> + const Type *Ty = V->getType();
>> + SmallVector ValueVTs;
>> + ComputeValueVTs(TLI, Ty, ValueVTs);
>> +
>> + unsigned FirstReg = 0;
>> + for (unsigned Value = 0; Value != ValueVTs.size(); ++Value) {
>> + MVT::ValueType ValueVT = ValueVTs[Value];
>> + unsigned NumRegs = TLI.getNumRegisters(ValueVT);
>> + MVT::ValueType RegisterVT = TLI.getRegisterType(ValueVT);
>>
>> + for (unsigned i = 0; i != NumRegs; ++i) {
>> + unsigned R = MakeReg(RegisterVT);
>> + if (!FirstReg) FirstReg = R;
>> + }
>> + }
>> + return FirstReg;
>> }
>
> The comments in this method should be improved to talk about what it
> is now doing. Please mention aggregates. Could this code change to
> use RegsForValue to compute the expansion? Maybe it should be a new
> method on RegsForValue?
I added a comment that mentions aggregates. This code does
use ComputeValueVTs to do most of the work; that's a function
I factored out specifically for the purpose of using it
in both CreateRegForValue and RegsForValue.
>
>
>> @@ -3898,8 +3985,9 @@
>> if ((NumOps & 7) == 2 /*REGDEF*/) {
>> // Add NumOps>>3 registers to MatchedRegs.
>> RegsForValue MatchedRegs;
>> - MatchedRegs.ValueVT = InOperandVal.getValueType();
>> - MatchedRegs.RegVT = AsmNodeOperands[CurOp
>> +1].getValueType();
>> + MatchedRegs.TLI = &TLI;
>> + MatchedRegs.ValueVTs.resize(1,
>> InOperandVal.getValueType());
>> + MatchedRegs.RegVTs.resize(1, AsmNodeOperands[CurOp
>> +1].getValueType());
>
> Please use push_back, instead of resize(1, x)
I used resize because it's initializing the vector contents
with exactly one element. But I'll change it if you insist :-).
>
>
>> @@ -4304,21 +4392,14 @@
>> }
>>
>> // Figure out the result value types. We start by making a list of
>> + // the potentially illegal return value types.
>> SmallVector LoweredRetTys;
>> SmallVector RetTys;
>> + ComputeValueVTs(*this, RetTy, RetTys);
>>
>> + // Then we translate that to a list of legal types.
>> + for (unsigned I = 0, E = RetTys.size(); I != E; ++I) {
>> + MVT::ValueType VT = RetTys[I];
>> MVT::ValueType RegisterVT = getRegisterType(VT);
>> unsigned NumRegs = getNumRegisters(VT);
>> for (unsigned i = 0; i != NumRegs; ++i)
>
> This seems like something that should be a method on RegsForValue.
It isn't trivial to do though. I expect we'll continue to
refactor RegsForValue and eventually get this cleaned up.
>
>
>> @@ -4441,19 +4522,11 @@
>> cast(Op.getOperand(1))->getReg() != Reg) &&
>> "Copy from a reg to the same reg!");
>> assert(!TargetRegisterInfo::isPhysicalRegister(Reg) && "Is a
>> physreg");
>> + RegsForValue RFV(TLI, Reg, V->getType());
>> + SDOperand Chain = DAG.getEntryNode();
>> + RFV.getCopyToRegs(Op, DAG, Chain, 0);
>> + PendingExports.push_back(Chain);
>> }
>
> I'm not sure if your patch is responsible, but it is very strange to
> me that RegsForValue::getCopyToRegs takes 'Chain' byref and mutates
> the input. Should RegsForValue::getCopyToRegs return a new chain
> instead?
Perhaps, but currently the Chain handling is consistent with
the optional Flag handling.
Dan
From gohman at apple.com Mon Apr 28 13:47:17 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 18:47:17 -0000
Subject: [llvm-commits] [llvm] r50368 -
/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200804281847.m3SIlHSB017114@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 13:47:17 2008
New Revision: 50368
URL: http://llvm.org/viewvc/llvm-project?rev=50368&view=rev
Log:
Evan pointed out that folding sext to zext may not be correct
if the zext is not legal.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=50368&r1=50367&r2=50368&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Apr 28 13:47:17 2008
@@ -2888,7 +2888,8 @@
}
// fold (sext x) -> (zext x) if the sign bit is known zero.
- if (DAG.SignBitIsZero(N0))
+ if ((!AfterLegalize || TLI.isOperationLegal(ISD::ZERO_EXTEND, VT)) &&
+ DAG.SignBitIsZero(N0))
return DAG.getNode(ISD::ZERO_EXTEND, VT, N0);
return SDOperand();
From dalej at apple.com Mon Apr 28 14:46:58 2008
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 28 Apr 2008 19:46:58 -0000
Subject: [llvm-commits] [llvm] r50369 - /llvm/trunk/include/llvm/Constants.h
Message-ID: <200804281946.m3SJkwTW019211@zion.cs.uiuc.edu>
Author: johannes
Date: Mon Apr 28 14:46:58 2008
New Revision: 50369
URL: http://llvm.org/viewvc/llvm-project?rev=50369&view=rev
Log:
Don't try to convert PPC long double.
Modified:
llvm/trunk/include/llvm/Constants.h
Modified: llvm/trunk/include/llvm/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=50369&r1=50368&r2=50369&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Constants.h (original)
+++ llvm/trunk/include/llvm/Constants.h Mon Apr 28 14:46:58 2008
@@ -263,6 +263,9 @@
bool isExactlyValue(const APFloat& V) const;
bool isExactlyValue(double V) const {
+ // convert is not supported on this type
+ if (&Val.getSemantics() == &APFloat::PPCDoubleDouble)
+ return false;
APFloat FV(V);
FV.convert(Val.getSemantics(), APFloat::rmNearestTiesToEven);
return isExactlyValue(FV);
From gohman at apple.com Mon Apr 28 14:51:27 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 19:51:27 -0000
Subject: [llvm-commits] [llvm] r50370 - in /llvm/trunk:
lib/Transforms/Scalar/DeadStoreElimination.cpp
test/Transforms/DeadStoreElimination/volatile-load.ll
Message-ID: <200804281951.m3SJpRnh019358@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 14:51:27 2008
New Revision: 50370
URL: http://llvm.org/viewvc/llvm-project?rev=50370&view=rev
Log:
Fix DSE to not eliminate volatile loads with no uses.
Added:
llvm/trunk/test/Transforms/DeadStoreElimination/volatile-load.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=50370&r1=50369&r2=50370&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Mon Apr 28 14:51:27 2008
@@ -326,9 +326,9 @@
// If we encounter a use of the pointer, it is no longer considered dead
if (LoadInst* L = dyn_cast(BBI)) {
- // However, if this load is unused, we can go ahead and remove it, and
- // not have to worry about it making our pointer undead!
- if (L->use_empty()) {
+ // However, if this load is unused and not volatile, we can go ahead and remove it,
+ // and not have to worry about it making our pointer undead!
+ if (L->use_empty() && !L->isVolatile()) {
MD.removeInstruction(L);
// DCE instructions only used to calculate that load
Added: llvm/trunk/test/Transforms/DeadStoreElimination/volatile-load.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadStoreElimination/volatile-load.ll?rev=50370&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/DeadStoreElimination/volatile-load.ll (added)
+++ llvm/trunk/test/Transforms/DeadStoreElimination/volatile-load.ll Mon Apr 28 14:51:27 2008
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | grep {volatile load}
+
+ at g_1 = global i32 0
+
+define void @foo() nounwind {
+ %t = volatile load i32* @g_1
+ ret void
+}
From isanbard at gmail.com Mon Apr 28 14:57:12 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 28 Apr 2008 19:57:12 -0000
Subject: [llvm-commits] [llvm] r50371 -
/llvm/branches/Apple/Tak/include/llvm/Constants.h
Message-ID: <200804281957.m3SJvCUk019722@zion.cs.uiuc.edu>
Author: void
Date: Mon Apr 28 14:57:12 2008
New Revision: 50371
URL: http://llvm.org/viewvc/llvm-project?rev=50371&view=rev
Log:
Porting r50369 to Tak.
Modified:
llvm/branches/Apple/Tak/include/llvm/Constants.h
Modified: llvm/branches/Apple/Tak/include/llvm/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/include/llvm/Constants.h?rev=50371&r1=50370&r2=50371&view=diff
==============================================================================
--- llvm/branches/Apple/Tak/include/llvm/Constants.h (original)
+++ llvm/branches/Apple/Tak/include/llvm/Constants.h Mon Apr 28 14:57:12 2008
@@ -263,6 +263,9 @@
bool isExactlyValue(const APFloat& V) const;
bool isExactlyValue(double V) const {
+ // convert is not supported on this type
+ if (&Val.getSemantics() == &APFloat::PPCDoubleDouble)
+ return false;
APFloat FV(V);
FV.convert(Val.getSemantics(), APFloat::rmNearestTiesToEven);
return isExactlyValue(FV);
From gohman at apple.com Mon Apr 28 15:25:15 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 20:25:15 -0000
Subject: [llvm-commits] [llvm] r50372 - /llvm/trunk/lib/Support/Allocator.cpp
Message-ID: <200804282025.m3SKPF3X020635@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 15:25:15 2008
New Revision: 50372
URL: http://llvm.org/viewvc/llvm-project?rev=50372&view=rev
Log:
Fix a pointer-arithmetic bug that caused 64-bit host pointer values to
be truncated to 32 bits. This fixes the recent Benchmarks/McCat/09-vor
regression on x86-64, among other things.
Modified:
llvm/trunk/lib/Support/Allocator.cpp
Modified: llvm/trunk/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=50372&r1=50371&r2=50372&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Allocator.cpp (original)
+++ llvm/trunk/lib/Support/Allocator.cpp Mon Apr 28 15:25:15 2008
@@ -48,7 +48,7 @@
void *Allocate(unsigned AllocSize, unsigned Alignment, MemRegion **RegPtr) {
char* Result = (char*) (((uintptr_t) (NextPtr+Alignment-1))
- & ~(Alignment-1));
+ & ~((uintptr_t) Alignment-1));
// Speculate the new value of NextPtr.
char* NextPtrTmp = Result + AllocSize;
From isanbard at gmail.com Mon Apr 28 15:34:54 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 28 Apr 2008 13:34:54 -0700
Subject: [llvm-commits] [llvm] r50372 -
/llvm/trunk/lib/Support/Allocator.cpp
In-Reply-To: <200804282025.m3SKPF3X020635@zion.cs.uiuc.edu>
References: <200804282025.m3SKPF3X020635@zion.cs.uiuc.edu>
Message-ID: <16e5fdf90804281334j7bdbd61ep57e03ae7f006213c@mail.gmail.com>
Does this go into Tak?
On Mon, Apr 28, 2008 at 1:25 PM, Dan Gohman wrote:
> Author: djg
> Date: Mon Apr 28 15:25:15 2008
> New Revision: 50372
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50372&view=rev
> Log:
> Fix a pointer-arithmetic bug that caused 64-bit host pointer values to
> be truncated to 32 bits. This fixes the recent Benchmarks/McCat/09-vor
> regression on x86-64, among other things.
>
> Modified:
> llvm/trunk/lib/Support/Allocator.cpp
>
> Modified: llvm/trunk/lib/Support/Allocator.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=50372&r1=50371&r2=50372&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Support/Allocator.cpp (original)
> +++ llvm/trunk/lib/Support/Allocator.cpp Mon Apr 28 15:25:15 2008
> @@ -48,7 +48,7 @@
> void *Allocate(unsigned AllocSize, unsigned Alignment, MemRegion **RegPtr) {
>
> char* Result = (char*) (((uintptr_t) (NextPtr+Alignment-1))
> - & ~(Alignment-1));
> + & ~((uintptr_t) Alignment-1));
>
> // Speculate the new value of NextPtr.
> char* NextPtrTmp = Result + AllocSize;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From gohman at apple.com Mon Apr 28 16:36:28 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 21:36:28 -0000
Subject: [llvm-commits] [llvm] r50374 -
/llvm/branches/Apple/Tak/lib/Support/Allocator.cpp
Message-ID: <200804282136.m3SLaSUn023070@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 16:36:28 2008
New Revision: 50374
URL: http://llvm.org/viewvc/llvm-project?rev=50374&view=rev
Log:
Porting r50362 and r50372 to Tak.
Modified:
llvm/branches/Apple/Tak/lib/Support/Allocator.cpp
Modified: llvm/branches/Apple/Tak/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Support/Allocator.cpp?rev=50374&r1=50373&r2=50374&view=diff
==============================================================================
--- llvm/branches/Apple/Tak/lib/Support/Allocator.cpp (original)
+++ llvm/branches/Apple/Tak/lib/Support/Allocator.cpp Mon Apr 28 16:36:28 2008
@@ -46,13 +46,16 @@
/// Allocate - Allocate and return at least the specified number of bytes.
///
void *Allocate(unsigned AllocSize, unsigned Alignment, MemRegion **RegPtr) {
- // Round size up to an even multiple of the alignment.
- AllocSize = (AllocSize+Alignment-1) & ~(Alignment-1);
- // If there is space in this region, return it.
- if (unsigned(NextPtr+AllocSize-(char*)this) <= RegionSize) {
- void *Result = NextPtr;
- NextPtr += AllocSize;
+ char* Result = (char*) (((uintptr_t) (NextPtr+Alignment-1))
+ & ~((uintptr_t) Alignment-1));
+
+ // Speculate the new value of NextPtr.
+ char* NextPtrTmp = Result + AllocSize;
+
+ // If we are still within the current region, return Result.
+ if (unsigned (NextPtrTmp - (char*) this) <= RegionSize) {
+ NextPtr = NextPtrTmp;
return Result;
}
From asl at math.spbu.ru Mon Apr 28 16:48:04 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 28 Apr 2008 21:48:04 -0000
Subject: [llvm-commits] [llvm] r50375 - /llvm/trunk/include/llvm-c/Core.h
Message-ID: <200804282148.m3SLm4UZ023426@zion.cs.uiuc.edu>
Author: asl
Date: Mon Apr 28 16:48:04 2008
New Revision: 50375
URL: http://llvm.org/viewvc/llvm-project?rev=50375&view=rev
Log:
Correct parameter attributes encoding for C bindings.
Patch by Anders Johnsen!
Modified:
llvm/trunk/include/llvm-c/Core.h
Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=50375&r1=50374&r2=50375&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Mon Apr 28 16:48:04 2008
@@ -86,10 +86,10 @@
LLVMZExtParamAttr = 1<<0,
LLVMSExtParamAttr = 1<<1,
LLVMNoReturnParamAttr = 1<<2,
- LLVMNoUnwindParamAttr = 1<<3,
- LLVMInRegParamAttr = 1<<4,
- LLVMNoAliasParamAttr = 1<<5,
- LLVMStructRetParamAttr = 1<<6,
+ LLVMInRegParamAttr = 1<<3,
+ LLVMStructRetParamAttr = 1<<4,
+ LLVMNoUnwindParamAttr = 1<<5,
+ LLVMNoAliasParamAttr = 1<<6,
LLVMByValParamAttr = 1<<7,
LLVMNestParamAttr = 1<<8,
LLVMReadNoneParamAttr = 1<<9,
From asl at math.spbu.ru Mon Apr 28 15:53:48 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 28 Apr 2008 20:53:48 -0000
Subject: [llvm-commits] [llvm] r50373 - in /llvm/trunk/tools/bugpoint:
ExecutionDriver.cpp ToolRunner.cpp ToolRunner.h
Message-ID: <200804282053.m3SKrm90021528@zion.cs.uiuc.edu>
Author: asl
Date: Mon Apr 28 15:53:48 2008
New Revision: 50373
URL: http://llvm.org/viewvc/llvm-project?rev=50373&view=rev
Log:
Add possibility of using arbitrary to to execute stuff from bugpoint.
Patch by Pekka J??skel?inen!
Modified:
llvm/trunk/tools/bugpoint/ExecutionDriver.cpp
llvm/trunk/tools/bugpoint/ToolRunner.cpp
llvm/trunk/tools/bugpoint/ToolRunner.h
Modified: llvm/trunk/tools/bugpoint/ExecutionDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExecutionDriver.cpp?rev=50373&r1=50372&r2=50373&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ExecutionDriver.cpp (original)
+++ llvm/trunk/tools/bugpoint/ExecutionDriver.cpp Mon Apr 28 15:53:48 2008
@@ -28,7 +28,7 @@
// for miscompilation.
//
enum OutputType {
- AutoPick, RunLLI, RunJIT, RunLLC, RunCBE, CBE_bug, LLC_Safe
+ AutoPick, RunLLI, RunJIT, RunLLC, RunCBE, CBE_bug, LLC_Safe, Custom
};
cl::opt
@@ -48,6 +48,9 @@
clEnumValN(RunCBE, "run-cbe", "Compile with CBE"),
clEnumValN(CBE_bug,"cbe-bug", "Find CBE bugs"),
clEnumValN(LLC_Safe, "llc-safe", "Use LLC for all"),
+ clEnumValN(Custom, "run-custom",
+ "Use -exec-command to define a command to execute "
+ "the bitcode. Useful for cross-compilation."),
clEnumValEnd),
cl::init(AutoPick));
@@ -71,8 +74,13 @@
"into executing programs"));
cl::list
- AdditionalLinkerArgs("Xlinker",
+ AdditionalLinkerArgs("Xlinker",
cl::desc("Additional arguments to pass to the linker"));
+
+ cl::opt
+ CustomExecCommand("exec-command", cl::init("simulate"),
+ cl::desc("Command to execute the bitcode (use with -run-custom) "
+ "(default: simulate)"));
}
namespace llvm {
@@ -148,6 +156,10 @@
Interpreter = AbstractInterpreter::createCBE(getToolName(), Message,
&ToolArgv);
break;
+ case Custom:
+ Interpreter = AbstractInterpreter::createCustom(getToolName(), Message,
+ CustomExecCommand);
+ break;
default:
Message = "Sorry, this back-end is not supported by bugpoint right now!\n";
break;
Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=50373&r1=50372&r2=50373&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original)
+++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Mon Apr 28 15:53:48 2008
@@ -174,6 +174,110 @@
return 0;
}
+//===---------------------------------------------------------------------===//
+// Custom execution command implementation of AbstractIntepreter interface
+//
+// Allows using a custom command for executing the bitcode, thus allows,
+// for example, to invoke a cross compiler for code generation followed by
+// a simulator that executes the generated binary.
+namespace {
+ class CustomExecutor : public AbstractInterpreter {
+ std::string ExecutionCommand;
+ std::vector ExecutorArgs;
+ public:
+ CustomExecutor(
+ const std::string &ExecutionCmd, std::vector ExecArgs) :
+ ExecutionCommand(ExecutionCmd), ExecutorArgs(ExecArgs) {}
+
+ virtual int ExecuteProgram(const std::string &Bitcode,
+ const std::vector &Args,
+ const std::string &InputFile,
+ const std::string &OutputFile,
+ const std::vector &GCCArgs,
+ const std::vector &SharedLibs =
+ std::vector(),
+ unsigned Timeout = 0,
+ unsigned MemoryLimit = 0);
+ };
+}
+
+int CustomExecutor::ExecuteProgram(const std::string &Bitcode,
+ const std::vector &Args,
+ const std::string &InputFile,
+ const std::string &OutputFile,
+ const std::vector &GCCArgs,
+ const std::vector &SharedLibs,
+ unsigned Timeout,
+ unsigned MemoryLimit) {
+
+ std::vector ProgramArgs;
+ ProgramArgs.push_back(ExecutionCommand.c_str());
+
+ for (std::size_t i = 0; i < ExecutorArgs.size(); ++i)
+ ProgramArgs.push_back(ExecutorArgs.at(i).c_str());
+ ProgramArgs.push_back(Bitcode.c_str());
+ ProgramArgs.push_back(0);
+
+ // Add optional parameters to the running program from Argv
+ for (unsigned i=0, e = Args.size(); i != e; ++i)
+ ProgramArgs.push_back(Args[i].c_str());
+
+ return RunProgramWithTimeout(
+ sys::Path(ExecutionCommand),
+ &ProgramArgs[0], sys::Path(InputFile), sys::Path(OutputFile),
+ sys::Path(OutputFile), Timeout, MemoryLimit);
+}
+
+// Custom execution environment create method, takes the execution command
+// as arguments
+AbstractInterpreter *AbstractInterpreter::createCustom(
+ const std::string &ProgramPath,
+ std::string &Message,
+ const std::string &ExecCommandLine) {
+
+ std::string Command = "";
+ std::vector Args;
+ std::string delimiters = " ";
+
+ // Tokenize the ExecCommandLine to the command and the args to allow
+ // defining a full command line as the command instead of just the
+ // executed program. We cannot just pass the whole string after the command
+ // as a single argument because then program sees only a single
+ // command line argument (with spaces in it: "foo bar" instead
+ // of "foo" and "bar").
+
+ // code borrowed from:
+ // http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html
+ std::string::size_type lastPos =
+ ExecCommandLine.find_first_not_of(delimiters, 0);
+ std::string::size_type pos =
+ ExecCommandLine.find_first_of(delimiters, lastPos);
+
+ while (std::string::npos != pos || std::string::npos != lastPos) {
+ std::string token = ExecCommandLine.substr(lastPos, pos - lastPos);
+ if (Command == "")
+ Command = token;
+ else
+ Args.push_back(token);
+ // Skip delimiters. Note the "not_of"
+ lastPos = ExecCommandLine.find_first_not_of(delimiters, pos);
+ // Find next "non-delimiter"
+ pos = ExecCommandLine.find_first_of(delimiters, lastPos);
+ }
+
+ std::string CmdPath = FindExecutable(Command, ProgramPath).toString();
+ if (CmdPath.empty()) {
+ Message =
+ std::string("Cannot find '") + Command +
+ "' in executable directory or PATH!\n";
+ return 0;
+ }
+
+ Message = "Found command in: " + CmdPath + "\n";
+
+ return new CustomExecutor(CmdPath, Args);
+}
+
//===----------------------------------------------------------------------===//
// LLC Implementation of AbstractIntepreter interface
//
Modified: llvm/trunk/tools/bugpoint/ToolRunner.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.h?rev=50373&r1=50372&r2=50373&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ToolRunner.h (original)
+++ llvm/trunk/tools/bugpoint/ToolRunner.h Mon Apr 28 15:53:48 2008
@@ -98,6 +98,10 @@
std::string &Message,
const std::vector *Args=0);
+ static AbstractInterpreter* createCustom(const std::string &ProgramPath,
+ std::string &Message,
+ const std::string &ExecCommandLine);
+
virtual ~AbstractInterpreter() {}
From evan.cheng at apple.com Mon Apr 28 17:07:13 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 28 Apr 2008 22:07:13 -0000
Subject: [llvm-commits] [llvm] r50376 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200804282207.m3SM7EeF024010@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Apr 28 17:07:13 2008
New Revision: 50376
URL: http://llvm.org/viewvc/llvm-project?rev=50376&view=rev
Log:
Fix a bug in RegsForValue::getCopyToRegs() that causes cyclical scheduling units. If it's creating multiple CopyToReg nodes that are "flagged" together, it should not create a TokenFactor for it's chain outputs:
c1, f1 = CopyToReg
c2, f2 = CopyToReg
c3 = TokenFactor c1, c2
...
= user c3, ..., f2
Now that the two CopyToReg's and the user are "flagged" together. They effectively forms a single scheduling unit. The TokenFactor is now both an operand and a successor of the Flagged nodes.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50376&r1=50375&r2=50376&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 17:07:13 2008
@@ -3455,8 +3455,18 @@
Chains[i] = Part.getValue(0);
}
- if (NumRegs == 1)
- Chain = Chains[0];
+ if (NumRegs == 1 || Flag)
+ // If NumRegs > 1 && Flag is used then the use of the last CopyToReg is
+ // flagged to it. That is the CopyToReg nodes and the user are considered
+ // a single scheduling unit. If we create a TokenFactor and return it as
+ // chain, then the TokenFactor is both a predecessor (operand) of the
+ // user as well as a successor (the TF operands are flagged to the user).
+ // c1, f1 = CopyToReg
+ // c2, f2 = CopyToReg
+ // c3 = TokenFactor c1, c2
+ // ...
+ // = op c3, ..., f2
+ Chain = Chains[NumRegs-1];
else
Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, &Chains[0], NumRegs);
}
From evan.cheng at apple.com Mon Apr 28 17:14:35 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 28 Apr 2008 22:14:35 -0000
Subject: [llvm-commits] [llvm] r50377 -
/llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll
Message-ID: <200804282214.m3SMEZnS024198@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Apr 28 17:14:34 2008
New Revision: 50377
URL: http://llvm.org/viewvc/llvm-project?rev=50377&view=rev
Log:
Test case.
Added:
llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll
Added: llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll?rev=50377&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll Mon Apr 28 17:14:34 2008
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | llc
+
+define i64 @t(i64 %maxIdleDuration) nounwind {
+ call void asm sideeffect "wrmsr", "{cx},A,~{dirflag},~{fpsr},~{flags}"( i32 416, i64 0 ) nounwind
+ unreachable
+}
From gohman at apple.com Mon Apr 28 17:18:31 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 15:18:31 -0700
Subject: [llvm-commits] [llvm] r50377 -
/llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll
In-Reply-To: <200804282214.m3SMEZnS024198@zion.cs.uiuc.edu>
References: <200804282214.m3SMEZnS024198@zion.cs.uiuc.edu>
Message-ID: <2F22391A-A528-414A-BF1C-E65DEC177F9A@apple.com>
Thanks Evan. Can you add a -march=x86 to this test; it's significantly
less interesting on x86-64 where i64 is legal.
Dan
On Apr 28, 2008, at 3:14 PM, Evan Cheng wrote:
> Author: evancheng
> Date: Mon Apr 28 17:14:34 2008
> New Revision: 50377
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50377&view=rev
> Log:
> Test case.
>
> Added:
> llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll
>
> Added: llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll?rev=50377&view=auto
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll (added)
> +++ llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll Mon
> Apr 28 17:14:34 2008
> @@ -0,0 +1,6 @@
> +; RUN: llvm-as < %s | llc
> +
> +define i64 @t(i64 %maxIdleDuration) nounwind {
> + call void asm sideeffect "wrmsr",
> "{cx},A,~{dirflag},~{fpsr},~{flags}"( i32 416, i64 0 ) nounwind
> + unreachable
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From lattner at apple.com Mon Apr 28 17:24:56 2008
From: lattner at apple.com (Tanya Lattner)
Date: Mon, 28 Apr 2008 15:24:56 -0700
Subject: [llvm-commits] [llvm] r50358 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/sext-misc.ll
In-Reply-To: <200804281702.m3SH2MPF013676@zion.cs.uiuc.edu>
References: <200804281702.m3SH2MPF013676@zion.cs.uiuc.edu>
Message-ID: <61DD658D-2829-4622-B642-AED4EFFF00BF@apple.com>
I believe this patch is causing the following failure:
llvm/test/CodeGen/CellSPU/and_ops.ll
Failed with exit(1) at line 2
while running: grep and and_ops.ll.tmp1.s | count 232
count: expected 232 lines and got 234.
child process exited abnormally
Please fix or revert.
-Tanya
On Apr 28, 2008, at 10:02 AM, Dan Gohman wrote:
> Author: djg
> Date: Mon Apr 28 12:02:21 2008
> New Revision: 50358
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50358&view=rev
> Log:
> Teach InstCombine's ComputeMaskedBits what SelectionDAG's
> ComputeMaskedBits knows about cttz, ctlz, and ctpop. Teach
> SelectionDAG's ComputeMaskedBits what InstCombine's knows
> about SRem. And teach them both some things about high bits
> in Mul, UDiv, URem, and Sub. This allows instcombine and
> dagcombine to eliminate sign-extension operations in
> several new cases.
>
> Added:
> llvm/trunk/test/Transforms/InstCombine/sext-misc.ll
> Modified:
> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/
> SelectionDAG/SelectionDAG.cpp?rev=50358&r1=50357&r2=50358&view=diff
>
> ======================================================================
> ========
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Apr 28
> 12:02:21 2008
> @@ -1229,6 +1229,50 @@
> KnownZero = KnownZeroOut;
> return;
> }
> + case ISD::MUL: {
> + APInt Mask2 = APInt::getAllOnesValue(BitWidth);
> + ComputeMaskedBits(Op.getOperand(1), Mask2, KnownZero,
> KnownOne, Depth+1);
> + ComputeMaskedBits(Op.getOperand(0), Mask2, KnownZero2,
> KnownOne2, Depth+1);
> + assert((KnownZero & KnownOne) == 0 && "Bits known to be one
> AND zero?");
> + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one
> AND zero?");
> +
> + // If low bits are zero in either operand, output low known-0
> bits.
> + // Also compute a conserative estimate for high known-0 bits.
> + // More trickiness is possible, but this is sufficient for the
> + // interesting case of alignment computation.
> + KnownOne.clear();
> + unsigned TrailZ = KnownZero.countTrailingOnes() +
> + KnownZero2.countTrailingOnes();
> + unsigned LeadZ = std::max(KnownZero.countLeadingOnes() +
> + KnownZero2.countLeadingOnes() +
> + 1, BitWidth) - BitWidth;
> +
> + TrailZ = std::min(TrailZ, BitWidth);
> + LeadZ = std::min(LeadZ, BitWidth);
> + KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ) |
> + APInt::getHighBitsSet(BitWidth, LeadZ);
> + KnownZero &= Mask;
> + return;
> + }
> + case ISD::UDIV: {
> + // For the purposes of computing leading zeros we can
> conservatively
> + // treat a udiv as a logical right shift by the power of 2
> known to
> + // be greater than the denominator.
> + APInt AllOnes = APInt::getAllOnesValue(BitWidth);
> + ComputeMaskedBits(Op.getOperand(0),
> + AllOnes, KnownZero2, KnownOne2, Depth+1);
> + unsigned LeadZ = KnownZero2.countLeadingOnes();
> +
> + KnownOne2.clear();
> + KnownZero2.clear();
> + ComputeMaskedBits(Op.getOperand(1),
> + AllOnes, KnownZero2, KnownOne2, Depth+1);
> + LeadZ = std::min(BitWidth,
> + LeadZ + BitWidth - KnownOne2.countLeadingZeros
> ());
> +
> + KnownZero = APInt::getHighBitsSet(BitWidth, LeadZ) & Mask;
> + return;
> + }
> case ISD::SELECT:
> ComputeMaskedBits(Op.getOperand(2), Mask, KnownZero, KnownOne,
> Depth+1);
> ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero2,
> KnownOne2, Depth+1);
> @@ -1469,47 +1513,94 @@
> KnownZero = APInt::getHighBitsSet(BitWidth, BitWidth - 1);
> return;
>
> + case ISD::SUB: {
> + if (ConstantSDNode *CLHS = dyn_cast
> (Op.getOperand(0))) {
> + // We know that the top bits of C-X are clear if X contains
> less bits
> + // than C (i.e. no wrap-around can happen). For example, 20-
> X is
> + // positive if we can prove that X is >= 0 and < 16.
> + if (CLHS->getAPIntValue().isNonNegative()) {
> + unsigned NLZ = (CLHS->getAPIntValue()+1).countLeadingZeros();
> + // NLZ can't be BitWidth with no sign bit
> + APInt MaskV = APInt::getHighBitsSet(BitWidth, NLZ+1);
> + ComputeMaskedBits(Op.getOperand(1), MaskV, KnownZero2,
> KnownOne2,
> + Depth+1);
> +
> + // If all of the MaskV bits are known to be zero, then we
> know the
> + // output top bits are zero, because we now know that the
> output is
> + // from [0-C].
> + if ((KnownZero2 & MaskV) == MaskV) {
> + unsigned NLZ2 = CLHS->getAPIntValue().countLeadingZeros();
> + // Top bits known zero.
> + KnownZero = APInt::getHighBitsSet(BitWidth, NLZ2) & Mask;
> + }
> + }
> + }
> + }
> + // fall through
> case ISD::ADD: {
> - // If either the LHS or the RHS are Zero, the result is zero.
> - ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero, KnownOne,
> Depth+1);
> - ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero2,
> KnownOne2, Depth+1);
> - assert((KnownZero & KnownOne) == 0 && "Bits known to be one
> AND zero?");
> - assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one
> AND zero?");
> -
> // Output known-0 bits are known if clear or set in both the
> low clear bits
> // common to both LHS & RHS. For example, 8+(X<<3) is known
> to have the
> // low 3 bits clear.
> - unsigned KnownZeroOut = std::min(KnownZero.countTrailingOnes(),
> - KnownZero2.countTrailingOnes());
> -
> - KnownZero = APInt::getLowBitsSet(BitWidth, KnownZeroOut);
> - KnownOne = APInt(BitWidth, 0);
> + APInt Mask2 = APInt::getLowBitsSet(BitWidth,
> Mask.countTrailingOnes());
> + ComputeMaskedBits(Op.getOperand(0), Mask2, KnownZero2,
> KnownOne2, Depth+1);
> + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one
> AND zero?");
> + unsigned KnownZeroOut = KnownZero2.countTrailingOnes();
> +
> + ComputeMaskedBits(Op.getOperand(1), Mask2, KnownZero2,
> KnownOne2, Depth+1);
> + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one
> AND zero?");
> + KnownZeroOut = std::min(KnownZeroOut,
> + KnownZero2.countTrailingOnes());
> +
> + KnownZero |= APInt::getLowBitsSet(BitWidth, KnownZeroOut);
> return;
> }
> - case ISD::SUB: {
> - ConstantSDNode *CLHS = dyn_cast(Op.getOperand
> (0));
> - if (!CLHS) return;
> + case ISD::SREM:
> + if (ConstantSDNode *Rem = dyn_cast
> (Op.getOperand(1))) {
> + APInt RA = Rem->getAPIntValue();
> + if (RA.isPowerOf2() || (-RA).isPowerOf2()) {
> + APInt LowBits = RA.isStrictlyPositive() ? ((RA - 1) |
> RA) : ~RA;
> + APInt Mask2 = LowBits | APInt::getSignBit(BitWidth);
> + ComputeMaskedBits(Op.getOperand(0),
> Mask2,KnownZero2,KnownOne2,Depth+1);
> +
> + // The sign of a remainder is equal to the sign of the first
> + // operand (zero being positive).
> + if (KnownZero2[BitWidth-1] || ((KnownZero2 & LowBits) ==
> LowBits))
> + KnownZero2 |= ~LowBits;
> + else if (KnownOne2[BitWidth-1])
> + KnownOne2 |= ~LowBits;
>
> - // We know that the top bits of C-X are clear if X contains
> less bits
> - // than C (i.e. no wrap-around can happen). For example, 20-X is
> - // positive if we can prove that X is >= 0 and < 16.
> - if (CLHS->getAPIntValue().isNonNegative()) {
> - unsigned NLZ = (CLHS->getAPIntValue()+1).countLeadingZeros();
> - // NLZ can't be BitWidth with no sign bit
> - APInt MaskV = APInt::getHighBitsSet(BitWidth, NLZ+1);
> - ComputeMaskedBits(Op.getOperand(1), MaskV, KnownZero,
> KnownOne, Depth+1);
> -
> - // If all of the MaskV bits are known to be zero, then we
> know the output
> - // top bits are zero, because we now know that the output is
> from [0-C].
> - if ((KnownZero & MaskV) == MaskV) {
> - unsigned NLZ2 = CLHS->getAPIntValue().countLeadingZeros();
> - // Top bits known zero.
> - KnownZero = APInt::getHighBitsSet(BitWidth, NLZ2) & Mask;
> - KnownOne = APInt(BitWidth, 0); // No one bits known.
> - } else {
> - KnownZero = KnownOne = APInt(BitWidth, 0); // Otherwise,
> nothing known.
> + KnownZero |= KnownZero2 & Mask;
> + KnownOne |= KnownOne2 & Mask;
> +
> + assert((KnownZero & KnownOne) == 0&&"Bits known to be one
> AND zero?");
> + }
> + }
> + return;
> + case ISD::UREM: {
> + if (ConstantSDNode *Rem = dyn_cast
> (Op.getOperand(1))) {
> + APInt RA = Rem->getAPIntValue();
> + if (RA.isStrictlyPositive() && RA.isPowerOf2()) {
> + APInt LowBits = (RA - 1) | RA;
> + APInt Mask2 = LowBits & Mask;
> + KnownZero |= ~LowBits & Mask;
> + ComputeMaskedBits(Op.getOperand(0), Mask2, KnownZero,
> KnownOne,Depth+1);
> + assert((KnownZero & KnownOne) == 0&&"Bits known to be one
> AND zero?");
> + break;
> }
> }
> +
> + // Since the result is less than or equal to either operand,
> any leading
> + // zero bits in either operand must also exist in the result.
> + APInt AllOnes = APInt::getAllOnesValue(BitWidth);
> + ComputeMaskedBits(Op.getOperand(0), AllOnes, KnownZero, KnownOne,
> + Depth+1);
> + ComputeMaskedBits(Op.getOperand(1), AllOnes, KnownZero2,
> KnownOne2,
> + Depth+1);
> +
> + uint32_t Leaders = std::max(KnownZero.countLeadingOnes(),
> + KnownZero2.countLeadingOnes());
> + KnownOne.clear();
> + KnownZero = APInt::getHighBitsSet(BitWidth, Leaders) & Mask;
> return;
> }
> default:
>
> Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/
> Scalar/InstructionCombining.cpp?rev=50358&r1=50357&r2=50358&view=diff
>
> ======================================================================
> ========
> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon
> Apr 28 12:02:21 2008
> @@ -700,15 +700,15 @@
> return;
> }
>
> + KnownZero.clear(); KnownOne.clear(); // Start out not knowing
> anything.
> +
> if (Depth == 6 || Mask == 0)
> return; // Limit search depth.
>
> User *I = dyn_cast(V);
> if (!I) return;
>
> - KnownZero.clear(); KnownOne.clear(); // Don't know anything.
> APInt KnownZero2(KnownZero), KnownOne2(KnownOne);
> -
> switch (getOpcode(I)) {
> default: break;
> case Instruction::And: {
> @@ -759,16 +759,42 @@
> assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one
> AND zero?");
>
> // If low bits are zero in either operand, output low known-0
> bits.
> + // Also compute a conserative estimate for high known-0 bits.
> // More trickiness is possible, but this is sufficient for the
> // interesting case of alignment computation.
> KnownOne.clear();
> unsigned TrailZ = KnownZero.countTrailingOnes() +
> KnownZero2.countTrailingOnes();
> + unsigned LeadZ = std::max(KnownZero.countLeadingOnes() +
> + KnownZero2.countLeadingOnes() +
> + 1, BitWidth) - BitWidth;
> +
> TrailZ = std::min(TrailZ, BitWidth);
> - KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ);
> + LeadZ = std::min(LeadZ, BitWidth);
> + KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ) |
> + APInt::getHighBitsSet(BitWidth, LeadZ);
> KnownZero &= Mask;
> return;
> }
> + case Instruction::UDiv: {
> + // For the purposes of computing leading zeros we can
> conservatively
> + // treat a udiv as a logical right shift by the power of 2
> known to
> + // be greater than the denominator.
> + APInt AllOnes = APInt::getAllOnesValue(BitWidth);
> + ComputeMaskedBits(I->getOperand(0),
> + AllOnes, KnownZero2, KnownOne2, Depth+1);
> + unsigned LeadZ = KnownZero2.countLeadingOnes();
> +
> + KnownOne2.clear();
> + KnownZero2.clear();
> + ComputeMaskedBits(I->getOperand(1),
> + AllOnes, KnownZero2, KnownOne2, Depth+1);
> + LeadZ = std::min(BitWidth,
> + LeadZ + BitWidth - KnownOne2.countLeadingZeros
> ());
> +
> + KnownZero = APInt::getHighBitsSet(BitWidth, LeadZ) & Mask;
> + return;
> + }
> case Instruction::Select:
> ComputeMaskedBits(I->getOperand(2), Mask, KnownZero, KnownOne,
> Depth+1);
> ComputeMaskedBits(I->getOperand(1), Mask, KnownZero2,
> KnownOne2, Depth+1);
> @@ -900,38 +926,36 @@
> unsigned NLZ = (CLHS->getValue()+1).countLeadingZeros();
> // NLZ can't be BitWidth with no sign bit
> APInt MaskV = APInt::getHighBitsSet(BitWidth, NLZ+1);
> - ComputeMaskedBits(I->getOperand(1), MaskV, KnownZero,
> KnownOne, Depth+1);
> + ComputeMaskedBits(I->getOperand(1), MaskV, KnownZero2,
> KnownOne2,
> + Depth+1);
>
> - // If all of the MaskV bits are known to be zero, then we
> know the output
> - // top bits are zero, because we now know that the output
> is from [0-C].
> - if ((KnownZero & MaskV) == MaskV) {
> + // If all of the MaskV bits are known to be zero, then we
> know the
> + // output top bits are zero, because we now know that the
> output is
> + // from [0-C].
> + if ((KnownZero2 & MaskV) == MaskV) {
> unsigned NLZ2 = CLHS->getValue().countLeadingZeros();
> // Top bits known zero.
> KnownZero = APInt::getHighBitsSet(BitWidth, NLZ2) & Mask;
> - KnownOne = APInt(BitWidth, 0); // No one bits known.
> - } else {
> - KnownZero = KnownOne = APInt(BitWidth, 0); //
> Otherwise, nothing known.
> }
> - return;
> }
> }
> }
> // fall through
> case Instruction::Add: {
> - // If either the LHS or the RHS are Zero, the result is zero.
> - ComputeMaskedBits(I->getOperand(1), Mask, KnownZero, KnownOne,
> Depth+1);
> - ComputeMaskedBits(I->getOperand(0), Mask, KnownZero2,
> KnownOne2, Depth+1);
> - assert((KnownZero & KnownOne) == 0 && "Bits known to be one
> AND zero?");
> - assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one
> AND zero?");
> -
> // Output known-0 bits are known if clear or set in both the
> low clear bits
> // common to both LHS & RHS. For example, 8+(X<<3) is known
> to have the
> // low 3 bits clear.
> - unsigned KnownZeroOut = std::min(KnownZero.countTrailingOnes(),
> - KnownZero2.countTrailingOnes());
> -
> - KnownZero = APInt::getLowBitsSet(BitWidth, KnownZeroOut);
> - KnownOne = APInt(BitWidth, 0);
> + APInt Mask2 = APInt::getLowBitsSet(BitWidth,
> Mask.countTrailingOnes());
> + ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero2,
> KnownOne2, Depth+1);
> + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one
> AND zero?");
> + unsigned KnownZeroOut = KnownZero2.countTrailingOnes();
> +
> + ComputeMaskedBits(I->getOperand(1), Mask2, KnownZero2,
> KnownOne2, Depth+1);
> + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one
> AND zero?");
> + KnownZeroOut = std::min(KnownZeroOut,
> + KnownZero2.countTrailingOnes());
> +
> + KnownZero |= APInt::getLowBitsSet(BitWidth, KnownZeroOut);
> return;
> }
> case Instruction::SRem:
> @@ -956,7 +980,7 @@
> }
> }
> break;
> - case Instruction::URem:
> + case Instruction::URem: {
> if (ConstantInt *Rem = dyn_cast(I->getOperand(1))) {
> APInt RA = Rem->getValue();
> if (RA.isStrictlyPositive() && RA.isPowerOf2()) {
> @@ -965,19 +989,24 @@
> KnownZero |= ~LowBits & Mask;
> ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero,
> KnownOne,Depth+1);
> assert((KnownZero & KnownOne) == 0&&"Bits known to be one
> AND zero?");
> + break;
> }
> - } else {
> - // Since the result is less than or equal to RHS, any
> leading zero bits
> - // in RHS must also exist in the result.
> - APInt AllOnes = APInt::getAllOnesValue(BitWidth);
> - ComputeMaskedBits(I->getOperand(1), AllOnes, KnownZero2,
> KnownOne2,
> - Depth+1);
> -
> - uint32_t Leaders = KnownZero2.countLeadingOnes();
> - KnownZero |= APInt::getHighBitsSet(BitWidth, Leaders) & Mask;
> - assert((KnownZero & KnownOne) == 0&&"Bits known to be one
> AND zero?");
> }
> +
> + // Since the result is less than or equal to either operand,
> any leading
> + // zero bits in either operand must also exist in the result.
> + APInt AllOnes = APInt::getAllOnesValue(BitWidth);
> + ComputeMaskedBits(I->getOperand(0), AllOnes, KnownZero, KnownOne,
> + Depth+1);
> + ComputeMaskedBits(I->getOperand(1), AllOnes, KnownZero2,
> KnownOne2,
> + Depth+1);
> +
> + uint32_t Leaders = std::max(KnownZero.countLeadingOnes(),
> + KnownZero2.countLeadingOnes());
> + KnownOne.clear();
> + KnownZero = APInt::getHighBitsSet(BitWidth, Leaders) & Mask;
> break;
> + }
>
> case Instruction::Alloca:
> case Instruction::Malloc: {
> @@ -1088,6 +1117,20 @@
> }
> break;
> }
> + case Instruction::Call:
> + if (IntrinsicInst *II = dyn_cast(I)) {
> + switch (II->getIntrinsicID()) {
> + default: break;
> + case Intrinsic::ctpop:
> + case Intrinsic::ctlz:
> + case Intrinsic::cttz: {
> + unsigned LowBits = Log2_32(BitWidth)+1;
> + KnownZero = APInt::getHighBitsSet(BitWidth, BitWidth -
> LowBits);
> + break;
> + }
> + }
> + }
> + break;
> }
> }
>
> @@ -1232,7 +1275,9 @@
> APInt LHSKnownZero(BitWidth, 0), LHSKnownOne(BitWidth, 0);
> APInt &RHSKnownZero = KnownZero, &RHSKnownOne = KnownOne;
> switch (I->getOpcode()) {
> - default: break;
> + default:
> + ComputeMaskedBits(V, DemandedMask, RHSKnownZero, RHSKnownOne,
> Depth);
> + break;
> case Instruction::And:
> // If either the LHS or the RHS are Zero, the result is zero.
> if (SimplifyDemandedBits(I->getOperand(1), DemandedMask,
> @@ -1578,6 +1623,9 @@
> LHSKnownZero, LHSKnownOne, Depth+1))
> return true;
> }
> + // Otherwise just hand the sub off to ComputeMaskedBits to
> fill in
> + // the known zeros and ones.
> + ComputeMaskedBits(V, DemandedMask, RHSKnownZero, RHSKnownOne,
> Depth);
> break;
> case Instruction::Shl:
> if (ConstantInt *SA = dyn_cast(I->getOperand(1))) {
> @@ -1695,10 +1743,10 @@
> }
> }
> break;
> - case Instruction::URem:
> + case Instruction::URem: {
> if (ConstantInt *Rem = dyn_cast(I->getOperand(1))) {
> APInt RA = Rem->getValue();
> - if (RA.isPowerOf2()) {
> + if (RA.isStrictlyPositive() && RA.isPowerOf2()) {
> APInt LowBits = (RA - 1) | RA;
> APInt Mask2 = LowBits & DemandedMask;
> KnownZero |= ~LowBits & DemandedMask;
> @@ -1707,19 +1755,26 @@
> return true;
>
> assert((KnownZero & KnownOne) == 0&&"Bits known to be one
> AND zero?");
> + break;
> }
> - } else {
> - APInt KnownZero2(BitWidth, 0), KnownOne2(BitWidth, 0);
> - APInt AllOnes = APInt::getAllOnesValue(BitWidth);
> - if (SimplifyDemandedBits(I->getOperand(1), AllOnes,
> - KnownZero2, KnownOne2, Depth+1))
> - return true;
> -
> - uint32_t Leaders = KnownZero2.countLeadingOnes();
> - KnownZero |= APInt::getHighBitsSet(BitWidth, Leaders) &
> DemandedMask;
> }
> +
> + APInt KnownZero2(BitWidth, 0), KnownOne2(BitWidth, 0);
> + APInt AllOnes = APInt::getAllOnesValue(BitWidth);
> + ComputeMaskedBits(I->getOperand(0), AllOnes,
> + KnownZero2, KnownOne2, Depth+1);
> + uint32_t Leaders = KnownZero2.countLeadingOnes();
> + APInt HighZeros = APInt::getHighBitsSet(BitWidth, Leaders);
> + if (SimplifyDemandedBits(I->getOperand(1), ~HighZeros,
> + KnownZero2, KnownOne2, Depth+1))
> + return true;
> +
> + Leaders = std::max(Leaders,
> + KnownZero2.countLeadingOnes());
> + KnownZero = APInt::getHighBitsSet(BitWidth, Leaders) &
> DemandedMask;
> break;
> }
> + }
>
> // If the client is only demanding bits that we know, return the
> known
> // constant.
>
> Added: llvm/trunk/test/Transforms/InstCombine/sext-misc.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/
> InstCombine/sext-misc.ll?rev=50358&view=auto
>
> ======================================================================
> ========
> --- llvm/trunk/test/Transforms/InstCombine/sext-misc.ll (added)
> +++ llvm/trunk/test/Transforms/InstCombine/sext-misc.ll Mon Apr 28
> 12:02:21 2008
> @@ -0,0 +1,45 @@
> +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sext
> +; RUN: llvm-as < %s | llc -march=x86-64 | not grep movslq
> +; RUN: llvm-as < %s | llc -march=x86 | not grep sar
> +
> +declare i32 @llvm.ctpop.i32(i32)
> +declare i32 @llvm.ctlz.i32(i32)
> +declare i32 @llvm.cttz.i32(i32)
> +
> +define i64 @foo(i32 %x) {
> + %t = call i32 @llvm.ctpop.i32(i32 %x)
> + %s = sext i32 %t to i64
> + ret i64 %s
> +}
> +define i64 @boo(i32 %x) {
> + %t = call i32 @llvm.ctlz.i32(i32 %x)
> + %s = sext i32 %t to i64
> + ret i64 %s
> +}
> +define i64 @zoo(i32 %x) {
> + %t = call i32 @llvm.cttz.i32(i32 %x)
> + %s = sext i32 %t to i64
> + ret i64 %s
> +}
> +define i64 @coo(i32 %x) {
> + %t = udiv i32 %x, 3
> + %s = sext i32 %t to i64
> + ret i64 %s
> +}
> +define i64 @moo(i32 %x) {
> + %t = urem i32 %x, 30000
> + %s = sext i32 %t to i64
> + ret i64 %s
> +}
> +define i64 @yoo(i32 %x) {
> + %u = lshr i32 %x, 3
> + %t = mul i32 %u, 3
> + %s = sext i32 %t to i64
> + ret i64 %s
> +}
> +define i64 @voo(i32 %x) {
> + %t = and i32 %x, 511
> + %u = sub i32 20000, %t
> + %s = sext i32 %u to i64
> + ret i64 %s
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From dalej at apple.com Mon Apr 28 17:26:52 2008
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 28 Apr 2008 22:26:52 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50378 -
/llvm-gcc-4.2/branches/Apple/Tak/gcc/llvm-backend.cpp
Message-ID: <200804282226.m3SMQqpZ024630@zion.cs.uiuc.edu>
Author: johannes
Date: Mon Apr 28 17:26:52 2008
New Revision: 50378
URL: http://llvm.org/viewvc/llvm-project?rev=50378&view=rev
Log:
Revert part of 50039 that changed inlining behavior.
Fixes 5895098 and 5886557. Note this is not being
applied to mainline, only the release branch.
Modified:
llvm-gcc-4.2/branches/Apple/Tak/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/branches/Apple/Tak/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Tak/gcc/llvm-backend.cpp?rev=50378&r1=50377&r2=50378&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Tak/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Tak/gcc/llvm-backend.cpp Mon Apr 28 17:26:52 2008
@@ -356,10 +356,9 @@
if (flag_unit_at_a_time && flag_exceptions)
PM->add(createPruneEHPass()); // Remove dead EH info
- if (flag_inline_trees) // respect -fno-inline-functions
- PM->add(createFunctionInliningPass()); // Inline small functions
-
if (optimize > 1) {
+ if (flag_inline_trees > 1) // respect -fno-inline-functions
+ PM->add(createFunctionInliningPass()); // Inline small functions
if (flag_unit_at_a_time && !lang_hooks.flag_no_builtin())
PM->add(createSimplifyLibCallsPass()); // Library Call Optimizations
From clattner at apple.com Mon Apr 28 18:18:55 2008
From: clattner at apple.com (Chris Lattner)
Date: Mon, 28 Apr 2008 16:18:55 -0700
Subject: [llvm-commits] [llvm] r50279 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/Transforms/Scalar/CodeGenPrepare.cpp
test/CodeGen/Generic/multiple-return-values-cross-block-with-invoke.ll
In-Reply-To: <99F2986B-B21C-45EC-84F1-715893122EA2@apple.com>
References: <200804251827.m3PIRtH4003953@zion.cs.uiuc.edu>
<99F2986B-B21C-45EC-84F1-715893122EA2@apple.com>
Message-ID:
On Apr 28, 2008, at 11:41 AM, Dan Gohman wrote:
>>> /// This is needed because values can be promoted into larger
>>> registers and
>>> /// expanded into multiple smaller registers than the value.
>>> struct VISIBILITY_HIDDEN RegsForValue {
>>
>> This should probably explicitly mention how it handles aggregates.
>> Maybe a good general summary up front could help my larger complaint
>> next:
>
> I rewrote this comment. Let me know if have further questions.
Thanks!
>>> + for (unsigned i = 0; i != NumRegs; ++i) {
>>> + unsigned R = MakeReg(RegisterVT);
>>> + if (!FirstReg) FirstReg = R;
>>> + }
>>> + }
>>> + return FirstReg;
>>> }
>>
>> The comments in this method should be improved to talk about what it
>> is now doing. Please mention aggregates. Could this code change to
>> use RegsForValue to compute the expansion? Maybe it should be a new
>> method on RegsForValue?
>
> I added a comment that mentions aggregates. This code does
> use ComputeValueVTs to do most of the work; that's a function
> I factored out specifically for the purpose of using it
> in both CreateRegForValue and RegsForValue.
True: the direction I was trying to go is to make CreateRegForValue a
private method in RegsForValue. This might not make sense, but would
reduce one concept out of SDISel.
>>> @@ -3898,8 +3985,9 @@
>>> if ((NumOps & 7) == 2 /*REGDEF*/) {
>>> // Add NumOps>>3 registers to MatchedRegs.
>>> RegsForValue MatchedRegs;
>>> - MatchedRegs.ValueVT = InOperandVal.getValueType();
>>> - MatchedRegs.RegVT = AsmNodeOperands[CurOp
>>> +1].getValueType();
>>> + MatchedRegs.TLI = &TLI;
>>> + MatchedRegs.ValueVTs.resize(1,
>>> InOperandVal.getValueType());
>>> + MatchedRegs.RegVTs.resize(1, AsmNodeOperands[CurOp
>>> +1].getValueType());
>>
>> Please use push_back, instead of resize(1, x)
>
> I used resize because it's initializing the vector contents
> with exactly one element. But I'll change it if you insist :-).
Please do, it is much more idiomatic to use push_back and the vector
was clearly empty before.
>>> // Figure out the result value types. We start by making a list of
>>> + // the potentially illegal return value types.
>>> SmallVector LoweredRetTys;
>>> SmallVector RetTys;
>>> + ComputeValueVTs(*this, RetTy, RetTys);
>>>
>>> + // Then we translate that to a list of legal types.
>>> + for (unsigned I = 0, E = RetTys.size(); I != E; ++I) {
>>> + MVT::ValueType VT = RetTys[I];
>>> MVT::ValueType RegisterVT = getRegisterType(VT);
>>> unsigned NumRegs = getNumRegisters(VT);
>>> for (unsigned i = 0; i != NumRegs; ++i)
>>
>> This seems like something that should be a method on RegsForValue.
>
> It isn't trivial to do though. I expect we'll continue to
> refactor RegsForValue and eventually get this cleaned up.
Ok.
>>> @@ -4441,19 +4522,11 @@
>>> cast(Op.getOperand(1))->getReg() != Reg) &&
>>> "Copy from a reg to the same reg!");
>>> assert(!TargetRegisterInfo::isPhysicalRegister(Reg) && "Is a
>>> physreg");
>>> + RegsForValue RFV(TLI, Reg, V->getType());
>>> + SDOperand Chain = DAG.getEntryNode();
>>> + RFV.getCopyToRegs(Op, DAG, Chain, 0);
>>> + PendingExports.push_back(Chain);
>>> }
>>
>> I'm not sure if your patch is responsible, but it is very strange to
>> me that RegsForValue::getCopyToRegs takes 'Chain' byref and mutates
>> the input. Should RegsForValue::getCopyToRegs return a new chain
>> instead?
>
> Perhaps, but currently the Chain handling is consistent with
> the optional Flag handling.
Ok. Thanks Dan,
-Chris
From clattner at apple.com Mon Apr 28 18:20:04 2008
From: clattner at apple.com (Chris Lattner)
Date: Mon, 28 Apr 2008 16:20:04 -0700
Subject: [llvm-commits] [llvm] r50372 -
/llvm/trunk/lib/Support/Allocator.cpp
In-Reply-To: <16e5fdf90804281334j7bdbd61ep57e03ae7f006213c@mail.gmail.com>
References: <200804282025.m3SKPF3X020635@zion.cs.uiuc.edu>
<16e5fdf90804281334j7bdbd61ep57e03ae7f006213c@mail.gmail.com>
Message-ID: <9020DCB8-8823-4594-BF0C-B733514E5166@apple.com>
On Apr 28, 2008, at 1:34 PM, Bill Wendling wrote:
> Does this go into Tak?
No.
-Chris
>
>
> On Mon, Apr 28, 2008 at 1:25 PM, Dan Gohman wrote:
>> Author: djg
>> Date: Mon Apr 28 15:25:15 2008
>> New Revision: 50372
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=50372&view=rev
>> Log:
>> Fix a pointer-arithmetic bug that caused 64-bit host pointer values
>> to
>> be truncated to 32 bits. This fixes the recent Benchmarks/McCat/09-
>> vor
>> regression on x86-64, among other things.
>>
>> Modified:
>> llvm/trunk/lib/Support/Allocator.cpp
>>
>> Modified: llvm/trunk/lib/Support/Allocator.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=50372&r1=50371&r2=50372&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/lib/Support/Allocator.cpp (original)
>> +++ llvm/trunk/lib/Support/Allocator.cpp Mon Apr 28 15:25:15 2008
>> @@ -48,7 +48,7 @@
>> void *Allocate(unsigned AllocSize, unsigned Alignment, MemRegion
>> **RegPtr) {
>>
>> char* Result = (char*) (((uintptr_t) (NextPtr+Alignment-1))
>> - & ~(Alignment-1));
>> + & ~((uintptr_t) Alignment-1));
>>
>> // Speculate the new value of NextPtr.
>> char* NextPtrTmp = Result + AllocSize;
>>
>>
>> _______________________________________________
>> 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 gohman at apple.com Mon Apr 28 18:26:22 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 28 Apr 2008 23:26:22 -0000
Subject: [llvm-commits] [llvm] r50379 - in /llvm/trunk/test/CodeGen/CellSPU:
and_ops.ll and_ops_more.ll
Message-ID: <200804282326.m3SNQMWE026689@zion.cs.uiuc.edu>
Author: djg
Date: Mon Apr 28 18:26:22 2008
New Revision: 50379
URL: http://llvm.org/viewvc/llvm-project?rev=50379&view=rev
Log:
Update and_ops.ll according to the recent dagcombiner changes.
Add a new test, and_ops_more.ll, which is XFAIL'd, to
record the parts of and_ops.ll that were affected by this
change.
Added:
llvm/trunk/test/CodeGen/CellSPU/and_ops_more.ll
Modified:
llvm/trunk/test/CodeGen/CellSPU/and_ops.ll
Modified: llvm/trunk/test/CodeGen/CellSPU/and_ops.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/and_ops.ll?rev=50379&r1=50378&r2=50379&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/CellSPU/and_ops.ll (original)
+++ llvm/trunk/test/CodeGen/CellSPU/and_ops.ll Mon Apr 28 18:26:22 2008
@@ -1,7 +1,7 @@
; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
-; RUN: grep and %t1.s | count 232
+; RUN: grep and %t1.s | count 234
; RUN: grep andc %t1.s | count 85
-; RUN: grep andi %t1.s | count 36
+; RUN: grep andi %t1.s | count 37
; RUN: grep andhi %t1.s | count 30
; RUN: grep andbi %t1.s | count 4
Added: llvm/trunk/test/CodeGen/CellSPU/and_ops_more.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/and_ops_more.ll?rev=50379&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/CellSPU/and_ops_more.ll (added)
+++ llvm/trunk/test/CodeGen/CellSPU/and_ops_more.ll Mon Apr 28 18:26:22 2008
@@ -0,0 +1,26 @@
+; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
+; RUN: grep and %t1.s | count 10
+; RUN: not grep andc %t1.s
+; RUN: not grep andi %t1.s
+; RUN: grep andhi %t1.s | count 5
+; RUN: grep andbi %t1.s | count 1
+; XFAIL: *
+
+; This testcase is derived from test/CodeGen/CellSPU/and_ops.ll and
+; records the changes due to r50358. The and_sext8 function appears
+; to be improved by this change, while the andhi_i16 function appears
+; to be pessimized.
+
+target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128"
+target triple = "spu"
+
+define i16 @andhi_i16(i16 signext %in) signext {
+ %tmp38 = and i16 %in, 37 ; [#uses=1]
+ ret i16 %tmp38
+}
+
+define i8 @and_sext8(i8 signext %in) signext {
+ ; ANDBI generated
+ %tmp38 = and i8 %in, 37
+ ret i8 %tmp38
+}
From evan.cheng at apple.com Mon Apr 28 18:31:41 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 28 Apr 2008 23:31:41 -0000
Subject: [llvm-commits] [llvm] r50380 -
/llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll
Message-ID: <200804282331.m3SNVfqX026873@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Apr 28 18:31:41 2008
New Revision: 50380
URL: http://llvm.org/viewvc/llvm-project?rev=50380&view=rev
Log:
Add -march=x86.
Modified:
llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll
Modified: llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll?rev=50380&r1=50379&r2=50380&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll Mon Apr 28 18:31:41 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc
+; RUN: llvm-as < %s | llc -march=x86
define i64 @t(i64 %maxIdleDuration) nounwind {
call void asm sideeffect "wrmsr", "{cx},A,~{dirflag},~{fpsr},~{flags}"( i32 416, i64 0 ) nounwind
From dpatel at apple.com Mon Apr 28 19:30:11 2008
From: dpatel at apple.com (Devang Patel)
Date: Tue, 29 Apr 2008 00:30:11 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50381 -
/llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c
Message-ID: <200804290030.m3T0UC4I028623@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Apr 28 19:30:11 2008
New Revision: 50381
URL: http://llvm.org/viewvc/llvm-project?rev=50381&view=rev
Log:
Disable 5812818 fix for now.
Modified:
llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c
Modified: llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c?rev=50381&r1=50380&r2=50381&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c Mon Apr 28 19:30:11 2008
@@ -8622,6 +8622,7 @@
CLASS_TYPE (class) = record;
/* APPLE LOCAL llvm begin */
+#if 0
#ifdef ENABLE_LLVM
/* Synthesized properties will later be added to this RECORD_DECL as they
* are found in @implementations. We don't want the LLVM tree->llvm
@@ -8633,6 +8634,7 @@
if (flag_objc_abi == 2)
llvm_compute_type(record);
#endif
+#endif
/* APPLE LOCAL llvm end */
}
}
From resistor at mac.com Mon Apr 28 19:38:35 2008
From: resistor at mac.com (Owen Anderson)
Date: Tue, 29 Apr 2008 00:38:35 -0000
Subject: [llvm-commits] [llvm] r50382 - in /llvm/trunk:
include/llvm/LinkAllPasses.h include/llvm/Transforms/Scalar.h
lib/Transforms/Scalar/DeadLoopElimination.cpp
Message-ID: <200804290038.m3T0cZc1028840@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Apr 28 19:38:34 2008
New Revision: 50382
URL: http://llvm.org/viewvc/llvm-project?rev=50382&view=rev
Log:
Add dead loop elimination, which removes dead loops for which we can compute
the trip count.
Added:
llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
Modified:
llvm/trunk/include/llvm/LinkAllPasses.h
llvm/trunk/include/llvm/Transforms/Scalar.h
Modified: llvm/trunk/include/llvm/LinkAllPasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=50382&r1=50381&r2=50382&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LinkAllPasses.h (original)
+++ llvm/trunk/include/llvm/LinkAllPasses.h Mon Apr 28 19:38:34 2008
@@ -114,6 +114,7 @@
(void) llvm::createCodeGenPreparePass();
(void) llvm::createGVNPass();
(void) llvm::createMemCpyOptPass();
+ (void) llvm::createDeadLoopEliminationPass();
(void)new llvm::IntervalPartition();
(void)new llvm::FindUsedTypes();
Modified: llvm/trunk/include/llvm/Transforms/Scalar.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar.h?rev=50382&r1=50381&r2=50382&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar.h Mon Apr 28 19:38:34 2008
@@ -319,6 +319,13 @@
//===----------------------------------------------------------------------===//
//
+// DeadLoopElimination - This pass performs DCE of non-infinite loops that it
+// can prove are dead.
+//
+LoopPass *createDeadLoopEliminationPass();
+
+//===----------------------------------------------------------------------===//
+//
// CodeGenPrepare - This pass prepares a function for instruction selection.
//
FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0);
Added: llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp?rev=50382&view=auto
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp (added)
+++ llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp Mon Apr 28 19:38:34 2008
@@ -0,0 +1,239 @@
+//===- DeadLoopElimination.cpp - Dead Loop Elimination Pass ---------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the Dead Loop Elimination Pass.
+//
+//===----------------------------------------------------------------------===//
+
+#define DEBUG_TYPE "dead-loop"
+
+#include "llvm/Transforms/Scalar.h"
+#include "llvm/Instruction.h"
+#include "llvm/Analysis/LoopInfo.h"
+#include "llvm/Analysis/LoopPass.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/SmallVector.h"
+
+using namespace llvm;
+
+STATISTIC(NumDeleted, "Number of loops deleted");
+
+namespace {
+ class VISIBILITY_HIDDEN DeadLoopElimination : public LoopPass {
+ public:
+ static char ID; // Pass ID, replacement for typeid
+ DeadLoopElimination() : LoopPass((intptr_t)&ID) { }
+
+ // Possibly eliminate loop L if it is dead.
+ bool runOnLoop(Loop* L, LPPassManager& LPM);
+
+ bool SingleDominatingExit(Loop* L);
+ bool IsLoopDead(Loop* L);
+ bool IsLoopInvariantInst(Instruction *I, Loop* L);
+
+ virtual void getAnalysisUsage(AnalysisUsage& AU) const {
+ AU.addRequired();
+ AU.addRequired();
+ AU.addRequiredID(LoopSimplifyID);
+ AU.addRequiredID(LCSSAID);
+
+ AU.addPreserved();
+ AU.addPreserved();
+ AU.addPreservedID(LoopSimplifyID);
+ AU.addPreservedID(LCSSAID);
+ }
+ };
+
+ char DeadLoopElimination::ID = 0;
+ RegisterPass X ("dead-loop", "Eliminate dead loops");
+}
+
+LoopPass* llvm::createDeadLoopEliminationPass() {
+ return new DeadLoopElimination();
+}
+
+bool DeadLoopElimination::SingleDominatingExit(Loop* L) {
+ SmallVector exitingBlocks;
+ L->getExitingBlocks(exitingBlocks);
+
+ if (exitingBlocks.size() != 1)
+ return 0;
+
+ BasicBlock* latch = L->getLoopLatch();
+ if (!latch)
+ return 0;
+
+ DominatorTree& DT = getAnalysis();
+ if (DT.dominates(exitingBlocks[0], latch))
+ return exitingBlocks[0];
+ else
+ return 0;
+}
+
+bool DeadLoopElimination::IsLoopInvariantInst(Instruction *I, Loop* L) {
+ // PHI nodes are not loop invariant if defined in the loop.
+ if (isa(I) && L->contains(I->getParent()))
+ return false;
+
+ // The instruction is loop invariant if all of its operands are loop-invariant
+ for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
+ if (!L->isLoopInvariant(I->getOperand(i)))
+ return false;
+
+ // If we got this far, the instruction is loop invariant!
+ return true;
+}
+
+bool DeadLoopElimination::IsLoopDead(Loop* L) {
+ SmallVector exitingBlocks;
+ L->getExitingBlocks(exitingBlocks);
+ BasicBlock* exitingBlock = exitingBlocks[0];
+
+ // Get the set of out-of-loop blocks that the exiting block branches to.
+ SmallVector exitBlocks;
+ L->getUniqueExitBlocks(exitBlocks);
+ if (exitBlocks.size() > 1)
+ return false;
+ BasicBlock* exitBlock = exitBlocks[0];
+
+ // Make sure that all PHI entries coming from the loop are loop invariant.
+ BasicBlock::iterator BI = exitBlock->begin();
+ while (PHINode* P = dyn_cast(BI)) {
+ Value* incoming = P->getIncomingValueForBlock(exitingBlock);
+ if (Instruction* I = dyn_cast(incoming))
+ if (!IsLoopInvariantInst(I, L))
+ return false;
+
+ BI++;
+ }
+
+ // Make sure that no instructions in the block have potential side-effects.
+ for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
+ LI != LE; ++LI) {
+ for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
+ BI != BE; ++BI) {
+ if (BI->mayWriteToMemory())
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool DeadLoopElimination::runOnLoop(Loop* L, LPPassManager& LPM) {
+ // Don't remove loops for which we can't solve the trip count.
+ // They could be infinite, in which case we'd be changing program behavior.
+ if (L->getTripCount())
+ return false;
+
+ // We can only remove the loop if there is a preheader that we can
+ // branch from after removing it.
+ BasicBlock* preheader = L->getLoopPreheader();
+ if (!preheader)
+ return false;
+
+ // We can't remove loops that contain subloops. If the subloops were dead,
+ // they would already have been removed in earlier executions of this pass.
+ if (L->begin() != L->end())
+ return false;
+
+ // Loops with multiple exits or exits that don't dominate the latch
+ // are too complicated to handle correctly.
+ if (!SingleDominatingExit(L))
+ return false;
+
+ // Finally, we have to check that the loop really is dead.
+ if (!IsLoopDead(L))
+ return false;
+
+ // Now that we know the removal is safe, change the branch from the preheader
+ // to go to the single exiting block.
+ SmallVector exitingBlocks;
+ L->getExitingBlocks(exitingBlocks);
+ BasicBlock* exitingBlock = exitingBlocks[0];
+
+ SmallVector exitBlocks;
+ L->getUniqueExitBlocks(exitBlocks);
+ BasicBlock* exitBlock = exitBlocks[0];
+
+ Function* F = L->getLoopLatch()->getParent();
+
+ for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
+ LI != LE; ++LI)
+ for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
+ BI != BE; ) {
+ Instruction* I = BI++;
+ if (I->getNumUses() > 0 && IsLoopInvariantInst(I, L))
+ I->moveBefore(preheader->getTerminator());
+ }
+
+ TerminatorInst* TI = preheader->getTerminator();
+ if (BranchInst* BI = dyn_cast(TI)) {
+ if (BI->isUnconditional())
+ BI->setSuccessor(0, exitBlock);
+ else if (L->contains(BI->getSuccessor(0)))
+ BI->setSuccessor(0, exitBlock);
+ else
+ BI->setSuccessor(1, exitBlock);
+ } else {
+ return false;
+ }
+
+ BasicBlock::iterator BI = exitBlock->begin();
+ while (PHINode* P = dyn_cast(BI)) {
+ unsigned i = P->getBasicBlockIndex(exitingBlock);
+ P->setIncomingBlock(i, preheader);
+ BI++;
+ }
+
+ DominatorTree& DT = getAnalysis();
+ for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
+ LI != LE; ++LI) {
+ SmallPtrSet childNodes;
+ childNodes.insert(DT[*LI]->begin(), DT[*LI]->end());
+ for (SmallPtrSet::iterator DI = childNodes.begin(),
+ DE = childNodes.end(); DI != DE; ++DI)
+ DT.changeImmediateDominator(*DI, DT[preheader]);
+
+ DT.eraseNode(*LI);
+
+ for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
+ BI != BE; ++BI) {
+ BI->dropAllReferences();
+ }
+
+ (*LI)->dropAllReferences();
+ }
+
+ unsigned bar = 0;
+
+ for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
+ LI != LE; ++LI) {
+ for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
+ BI != BE; ) {
+ Instruction* I = BI++;
+ I->eraseFromParent();
+ }
+
+ (*LI)->eraseFromParent();
+ }
+
+ LoopInfo& loopInfo = getAnalysis();
+ SmallPtrSet blocks;
+ blocks.insert(L->block_begin(), L->block_end());
+ for (SmallPtrSet::iterator I = blocks.begin(),
+ E = blocks.end(); I != E; ++I)
+ loopInfo.removeBlock(*I);
+
+ LPM.deleteLoopFromQueue(L);
+
+ NumDeleted++;
+
+ return true;
+}
From resistor at mac.com Mon Apr 28 19:39:24 2008
From: resistor at mac.com (Owen Anderson)
Date: Tue, 29 Apr 2008 00:39:24 -0000
Subject: [llvm-commits] [llvm] r50383 -
/llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
Message-ID: <200804290039.m3T0dOMb028874@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Apr 28 19:39:24 2008
New Revision: 50383
URL: http://llvm.org/viewvc/llvm-project?rev=50383&view=rev
Log:
Remove debugging code.
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp?rev=50383&r1=50382&r2=50383&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp Mon Apr 28 19:39:24 2008
@@ -162,8 +162,6 @@
L->getUniqueExitBlocks(exitBlocks);
BasicBlock* exitBlock = exitBlocks[0];
- Function* F = L->getLoopLatch()->getParent();
-
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
LI != LE; ++LI)
for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
@@ -211,8 +209,6 @@
(*LI)->dropAllReferences();
}
- unsigned bar = 0;
-
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
LI != LE; ++LI) {
for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
From resistor at mac.com Mon Apr 28 19:45:16 2008
From: resistor at mac.com (Owen Anderson)
Date: Tue, 29 Apr 2008 00:45:16 -0000
Subject: [llvm-commits] [llvm] r50384 -
/llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
Message-ID: <200804290045.m3T0jGko029097@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Apr 28 19:45:15 2008
New Revision: 50384
URL: http://llvm.org/viewvc/llvm-project?rev=50384&view=rev
Log:
Add some more comments.
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp?rev=50384&r1=50383&r2=50384&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp Mon Apr 28 19:45:15 2008
@@ -162,6 +162,12 @@
L->getUniqueExitBlocks(exitBlocks);
BasicBlock* exitBlock = exitBlocks[0];
+ // Because we're deleting a large chunk of code at once, the sequence in which
+ // we remove things is very important to avoid invalidation issues. Don't
+ // mess with this unless you have good reason and know what you're doing.
+
+ // Move simple loop-invariant expressions out of the loop, since they
+ // might be needed by the exit phis.
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
LI != LE; ++LI)
for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
@@ -171,6 +177,7 @@
I->moveBefore(preheader->getTerminator());
}
+ // Connect the preheader directly to the exit block.
TerminatorInst* TI = preheader->getTerminator();
if (BranchInst* BI = dyn_cast(TI)) {
if (BI->isUnconditional())
@@ -180,9 +187,12 @@
else
BI->setSuccessor(1, exitBlock);
} else {
+ // FIXME: Support switches
return false;
}
+ // Rewrite phis in the exit block to get their inputs from
+ // the preheader instead of the exiting block.
BasicBlock::iterator BI = exitBlock->begin();
while (PHINode* P = dyn_cast(BI)) {
unsigned i = P->getBasicBlockIndex(exitingBlock);
@@ -190,9 +200,12 @@
BI++;
}
+ // Update lots of internal structures...
DominatorTree& DT = getAnalysis();
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
LI != LE; ++LI) {
+ // Move all of the block's children to be children of the preheader, which
+ // allows us to remove the domtree entry for the block.
SmallPtrSet childNodes;
childNodes.insert(DT[*LI]->begin(), DT[*LI]->end());
for (SmallPtrSet::iterator DI = childNodes.begin(),
@@ -201,6 +214,8 @@
DT.eraseNode(*LI);
+ // Drop all references between the instructions and the block so
+ // that we don't have reference counting problems later.
for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
BI != BE; ++BI) {
BI->dropAllReferences();
@@ -209,6 +224,8 @@
(*LI)->dropAllReferences();
}
+ // Erase the instructions and the blocks without having to worry
+ // about ordering because we already dropped the references.
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
LI != LE; ++LI) {
for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
@@ -220,6 +237,8 @@
(*LI)->eraseFromParent();
}
+ // Finally, the blocks from loopinfo. This has to happen late because
+ // otherwise our loop iterators won't work.
LoopInfo& loopInfo = getAnalysis();
SmallPtrSet blocks;
blocks.insert(L->block_begin(), L->block_end());
@@ -227,6 +246,8 @@
E = blocks.end(); I != E; ++I)
loopInfo.removeBlock(*I);
+ // The last step is to inform the loop pass manager that we've
+ // eliminated this loop.
LPM.deleteLoopFromQueue(L);
NumDeleted++;
From dalej at apple.com Mon Apr 28 20:11:02 2008
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 28 Apr 2008 18:11:02 -0700
Subject: [llvm-commits] [llvm-gcc-4.2] r50381 -
/llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c
In-Reply-To: <200804290030.m3T0UC4I028623@zion.cs.uiuc.edu>
References: <200804290030.m3T0UC4I028623@zion.cs.uiuc.edu>
Message-ID: <050312FF-6CD8-4D0B-8A1D-5878D461FF34@apple.com>
On Apr 28, 2008, at 5:30 PM, Devang Patel wrote:
> Author: dpatel
> Date: Mon Apr 28 19:30:11 2008
> New Revision: 50381
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50381&view=rev
> Log:
> Disable 5812818 fix for now.
Would somebody please reopen 5812818 in that case? That is not as
important as the SWB, but it is a compile-time crash on correct code.
> Modified:
> llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c
>
> Modified: llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c?rev=50381&r1=50380&r2=50381&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c (original)
> +++ llvm-gcc-4.2/branches/Apple/Tak/gcc/objc/objc-act.c Mon Apr 28
> 19:30:11 2008
> @@ -8622,6 +8622,7 @@
> CLASS_TYPE (class) = record;
>
> /* APPLE LOCAL llvm begin */
> +#if 0
> #ifdef ENABLE_LLVM
> /* Synthesized properties will later be added to this
> RECORD_DECL as they
> * are found in @implementations. We don't want the LLVM tree-
> >llvm
> @@ -8633,6 +8634,7 @@
> if (flag_objc_abi == 2)
> llvm_compute_type(record);
> #endif
> +#endif
> /* APPLE LOCAL llvm end */
> }
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From evan.cheng at apple.com Mon Apr 28 20:41:44 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 29 Apr 2008 01:41:44 -0000
Subject: [llvm-commits] [llvm] r50385 - in /llvm/trunk:
lib/CodeGen/SimpleRegisterCoalescing.cpp
test/CodeGen/X86/2008-04-28-CoalescerBug.ll
Message-ID: <200804290141.m3T1fiYu030660@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Apr 28 20:41:44 2008
New Revision: 50385
URL: http://llvm.org/viewvc/llvm-project?rev=50385&view=rev
Log:
Another extract_subreg coalescing bug.
e.g.
vr1024<2> extract_subreg vr1025, 2
If vr1024 do not have the same register class as vr1025, it's not safe to coalesce this away. For example, vr1024 might be a GPR32 while vr1025 might be a GPR64.
Added:
llvm/trunk/test/CodeGen/X86/2008-04-28-CoalescerBug.ll
Modified:
llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=50385&r1=50384&r2=50385&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Apr 28 20:41:44 2008
@@ -942,9 +942,11 @@
unsigned OldSubIdx = isExtSubReg ? CopyMI->getOperand(0).getSubReg()
: CopyMI->getOperand(2).getSubReg();
if (OldSubIdx) {
- if (OldSubIdx == SubIdx)
+ if (OldSubIdx == SubIdx && !differingRegisterClasses(SrcReg, DstReg))
// r1024<2> = EXTRACT_SUBREG r1025, 2. Then r1024 has already been
// coalesced to a larger register so the subreg indices cancel out.
+ // Also check if the other larger register is of the same register
+ // class as the would be resulting register.
SubIdx = 0;
else {
DOUT << "\t Sub-register indices mismatch.\n";
Added: llvm/trunk/test/CodeGen/X86/2008-04-28-CoalescerBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-04-28-CoalescerBug.ll?rev=50385&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2008-04-28-CoalescerBug.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2008-04-28-CoalescerBug.ll Mon Apr 28 20:41:44 2008
@@ -0,0 +1,166 @@
+; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep movl | not grep {r\[abcd\]x}
+; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep movl | not grep {r\[ds\]i}
+; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep movl | not grep {r\[bs\]p}
+
+ %struct.BITMAP = type { i16, i16, i32, i32, i32, i32, i32, i32, i8*, i8* }
+ %struct.BltData = type { float, float, float, float }
+ %struct.BltDepth = type { i32, i8**, i32, %struct.BITMAP* (%struct.BltDepth**, %struct.BITMAP*, i32, i32, float*, float, i32)*, i32 (%struct.BltDepth**, %struct.BltOp*)*, i32 (%struct.BltDepth**, %struct.BltOp*, %struct.BltImg*)*, i32 (%struct.BltDepth**, %struct.BltOp*, %struct.BltSh*)*, [28 x [2 x [2 x i32]]]*, %struct.BltData* }
+ %struct.BltImg = type { i32, i8, i8, i8, float, float*, float*, i32, i32, float*, i32 (i8*, i8*, i8**, i32*, i8**, i32*)*, i8* }
+ %struct.BltOp = type { i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i32, i32, i32, i32, i32, i32, i32, i8* }
+ %struct.BltSh = type { i8, i8, i8, i8, float, float*, float*, float*, float*, i32, i32, float*, float*, float* }
+
+define void @t(%struct.BltDepth* %depth, %struct.BltOp* %bop, i32 %mode) nounwind {
+entry:
+ switch i32 %mode, label %return [
+ i32 1, label %bb2898.us
+ i32 18, label %bb13086.preheader
+ ]
+
+bb13086.preheader: ; preds = %entry
+ %tmp13098 = icmp eq i32 0, 0 ; [#uses=1]
+ %tmp13238 = icmp eq i32 0, 0 ; [#uses=1]
+ br label %bb13088
+
+bb2898.us: ; preds = %bb2898.us, %entry
+ br label %bb2898.us
+
+bb13088: ; preds = %bb13572, %bb13567, %bb13107, %bb13086.preheader
+ br i1 %tmp13098, label %bb13107, label %bb13101
+
+bb13101: ; preds = %bb13088
+ br label %bb13107
+
+bb13107: ; preds = %bb13101, %bb13088
+ %iftmp.684.0 = phi i32 [ 0, %bb13101 ], [ 65535, %bb13088 ] ; [#uses=2]
+ %tmp13111 = load i64* null, align 8 ; [#uses=3]
+ %tmp13116 = lshr i64 %tmp13111, 16 ; [#uses=1]
+ %tmp1311613117 = trunc i64 %tmp13116 to i32 ; [#uses=1]
+ %tmp13118 = and i32 %tmp1311613117, 65535 ; [#uses=1]
+ %tmp13120 = lshr i64 %tmp13111, 32 ; [#uses=1]
+ %tmp1312013121 = trunc i64 %tmp13120 to i32 ; [#uses=1]
+ %tmp13122 = and i32 %tmp1312013121, 65535 ; [#uses=2]
+ %tmp13124 = lshr i64 %tmp13111, 48 ; [#uses=1]
+ %tmp1312413125 = trunc i64 %tmp13124 to i32 ; [#uses=2]
+ %tmp1314013141not = xor i16 0, -1 ; [#uses=1]
+ %tmp1314013141not13142 = zext i16 %tmp1314013141not to i32 ; [#uses=3]
+ %tmp13151 = mul i32 %tmp13122, %tmp1314013141not13142 ; [#uses=1]
+ %tmp13154 = mul i32 %tmp1312413125, %tmp1314013141not13142 ; [#uses=1]
+ %tmp13157 = mul i32 %iftmp.684.0, %tmp1314013141not13142 ; [#uses=1]
+ %tmp13171 = add i32 %tmp13151, 1 ; [#uses=1]
+ %tmp13172 = add i32 %tmp13171, 0 ; [#uses=1]
+ %tmp13176 = add i32 %tmp13154, 1 ; [#uses=1]
+ %tmp13177 = add i32 %tmp13176, 0 ; [#uses=1]
+ %tmp13181 = add i32 %tmp13157, 1 ; [#uses=1]
+ %tmp13182 = add i32 %tmp13181, 0 ; [#uses=1]
+ %tmp13188 = lshr i32 %tmp13172, 16 ; [#uses=1]
+ %tmp13190 = lshr i32 %tmp13177, 16 ; [#uses=1]
+ %tmp13192 = lshr i32 %tmp13182, 16 ; [#uses=1]
+ %tmp13198 = sub i32 %tmp13118, 0 ; [#uses=1]
+ %tmp13201 = sub i32 %tmp13122, %tmp13188 ; [#uses=1]
+ %tmp13204 = sub i32 %tmp1312413125, %tmp13190 ; [#uses=1]
+ %tmp13207 = sub i32 %iftmp.684.0, %tmp13192 ; [#uses=1]
+ %tmp1320813209 = zext i32 %tmp13204 to i64 ; [#uses=1]
+ %tmp13211 = shl i64 %tmp1320813209, 48 ; [#uses=1]
+ %tmp1321213213 = zext i32 %tmp13201 to i64 ; [#uses=1]
+ %tmp13214 = shl i64 %tmp1321213213, 32 ; [#uses=1]
+ %tmp13215 = and i64 %tmp13214, 281470681743360 ; [#uses=1]
+ %tmp1321713218 = zext i32 %tmp13198 to i64 ; [#uses=1]
+ %tmp13219 = shl i64 %tmp1321713218, 16 ; [#uses=1]
+ %tmp13220 = and i64 %tmp13219, 4294901760 ; [#uses=1]
+ %tmp13216 = or i64 %tmp13211, 0 ; [#uses=1]
+ %tmp13221 = or i64 %tmp13216, %tmp13215 ; [#uses=1]
+ %tmp13225 = or i64 %tmp13221, %tmp13220 ; [#uses=4]
+ %tmp1322713228 = trunc i32 %tmp13207 to i16 ; [#uses=4]
+ %tmp13233 = icmp eq i16 %tmp1322713228, 0 ; [#uses=1]
+ br i1 %tmp13233, label %bb13088, label %bb13236
+
+bb13236: ; preds = %bb13107
+ br i1 false, label %bb13567, label %bb13252
+
+bb13252: ; preds = %bb13236
+ %tmp1329013291 = zext i16 %tmp1322713228 to i64 ; [#uses=8]
+ %tmp13296 = lshr i64 %tmp13225, 16 ; [#uses=1]
+ %tmp13297 = and i64 %tmp13296, 65535 ; [#uses=1]
+ %tmp13299 = lshr i64 %tmp13225, 32 ; [#uses=1]
+ %tmp13300 = and i64 %tmp13299, 65535 ; [#uses=1]
+ %tmp13302 = lshr i64 %tmp13225, 48 ; [#uses=1]
+ %tmp13306 = sub i64 %tmp1329013291, 0 ; [#uses=0]
+ %tmp13309 = sub i64 %tmp1329013291, %tmp13297 ; [#uses=1]
+ %tmp13312 = sub i64 %tmp1329013291, %tmp13300 ; [#uses=1]
+ %tmp13315 = sub i64 %tmp1329013291, %tmp13302 ; [#uses=1]
+ %tmp13318 = mul i64 %tmp1329013291, %tmp1329013291 ; [#uses=1]
+ br i1 false, label %bb13339, label %bb13324
+
+bb13324: ; preds = %bb13252
+ br i1 false, label %bb13339, label %bb13330
+
+bb13330: ; preds = %bb13324
+ %tmp13337 = sdiv i64 0, 0 ; [#uses=1]
+ br label %bb13339
+
+bb13339: ; preds = %bb13330, %bb13324, %bb13252
+ %r0120.0 = phi i64 [ %tmp13337, %bb13330 ], [ 0, %bb13252 ], [ 4294836225, %bb13324 ] ; [#uses=1]
+ br i1 false, label %bb13360, label %bb13345
+
+bb13345: ; preds = %bb13339
+ br i1 false, label %bb13360, label %bb13351
+
+bb13351: ; preds = %bb13345
+ %tmp13354 = mul i64 0, %tmp13318 ; [#uses=1]
+ %tmp13357 = sub i64 %tmp1329013291, %tmp13309 ; [#uses=1]
+ %tmp13358 = sdiv i64 %tmp13354, %tmp13357 ; [#uses=1]
+ br label %bb13360
+
+bb13360: ; preds = %bb13351, %bb13345, %bb13339
+ %r1121.0 = phi i64 [ %tmp13358, %bb13351 ], [ 0, %bb13339 ], [ 4294836225, %bb13345 ] ; [#uses=1]
+ br i1 false, label %bb13402, label %bb13387
+
+bb13387: ; preds = %bb13360
+ br label %bb13402
+
+bb13402: ; preds = %bb13387, %bb13360
+ %r3123.0 = phi i64 [ 0, %bb13360 ], [ 4294836225, %bb13387 ] ; [#uses=1]
+ %tmp13404 = icmp eq i16 %tmp1322713228, -1 ; [#uses=1]
+ br i1 %tmp13404, label %bb13435, label %bb13407
+
+bb13407: ; preds = %bb13402
+ br label %bb13435
+
+bb13435: ; preds = %bb13407, %bb13402
+ %r0120.1 = phi i64 [ 0, %bb13407 ], [ %r0120.0, %bb13402 ] ; [#uses=0]
+ %r1121.1 = phi i64 [ 0, %bb13407 ], [ %r1121.0, %bb13402 ] ; [#uses=0]
+ %r3123.1 = phi i64 [ 0, %bb13407 ], [ %r3123.0, %bb13402 ] ; [#uses=0]
+ %tmp13450 = mul i64 0, %tmp13312 ; [#uses=0]
+ %tmp13455 = mul i64 0, %tmp13315 ; [#uses=0]
+ %tmp13461 = add i64 0, %tmp1329013291 ; [#uses=1]
+ %tmp13462 = mul i64 %tmp13461, 65535 ; [#uses=1]
+ %tmp13466 = sub i64 %tmp13462, 0 ; [#uses=1]
+ %tmp13526 = add i64 %tmp13466, 1 ; [#uses=1]
+ %tmp13527 = add i64 %tmp13526, 0 ; [#uses=1]
+ %tmp13528 = ashr i64 %tmp13527, 16 ; [#uses=4]
+ %tmp13536 = sub i64 %tmp13528, 0 ; [#uses=1]
+ %tmp13537 = shl i64 %tmp13536, 32 ; [#uses=1]
+ %tmp13538 = and i64 %tmp13537, 281470681743360 ; [#uses=1]
+ %tmp13542 = sub i64 %tmp13528, 0 ; [#uses=1]
+ %tmp13543 = shl i64 %tmp13542, 16 ; [#uses=1]
+ %tmp13544 = and i64 %tmp13543, 4294901760 ; [#uses=1]
+ %tmp13548 = sub i64 %tmp13528, 0 ; [#uses=1]
+ %tmp13549 = and i64 %tmp13548, 65535 ; [#uses=1]
+ %tmp13539 = or i64 %tmp13538, 0 ; [#uses=1]
+ %tmp13545 = or i64 %tmp13539, %tmp13549 ; [#uses=1]
+ %tmp13550 = or i64 %tmp13545, %tmp13544 ; [#uses=1]
+ %tmp1355213553 = trunc i64 %tmp13528 to i16 ; [#uses=1]
+ br label %bb13567
+
+bb13567: ; preds = %bb13435, %bb13236
+ %tsp1040.0.0 = phi i64 [ %tmp13550, %bb13435 ], [ %tmp13225, %bb13236 ] ; [#uses=0]
+ %tsp1040.1.0 = phi i16 [ %tmp1355213553, %bb13435 ], [ %tmp1322713228, %bb13236 ] ; [#uses=1]
+ br i1 %tmp13238, label %bb13088, label %bb13572
+
+bb13572: ; preds = %bb13567
+ store i16 %tsp1040.1.0, i16* null, align 2
+ br label %bb13088
+
+return: ; preds = %entry
+ ret void
+}
From sabre at nondot.org Mon Apr 28 23:29:55 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 29 Apr 2008 04:29:55 -0000
Subject: [llvm-commits] [llvm] r50386 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
test/CodeGen/X86/inline-asm-mrv.ll
Message-ID: <200804290429.m3T4TtCd002846@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Apr 28 23:29:54 2008
New Revision: 50386
URL: http://llvm.org/viewvc/llvm-project?rev=50386&view=rev
Log:
add support for multiple return values in inline asm. This is a step
towards PR2094. It now compiles the attached .ll file to:
_sad16_sse2:
movslq %ecx, %rax
## InlineAsm Start
%ecx %rdx %rax %rax %r8d %rdx %rsi
## InlineAsm End
## InlineAsm Start
set %eax
## InlineAsm End
ret
which is pretty decent for a 3 output, 4 input asm.
Added:
llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50386&r1=50385&r2=50386&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 23:29:54 2008
@@ -176,6 +176,15 @@
}
}
+ /// append - Add the specified values to this one.
+ void append(const RegsForValue &RHS) {
+ TLI = RHS.TLI;
+ ValueVTs.append(RHS.ValueVTs.begin(), RHS.ValueVTs.end());
+ RegVTs.append(RHS.RegVTs.begin(), RHS.RegVTs.end());
+ Regs.append(RHS.Regs.begin(), RHS.Regs.end());
+ }
+
+
/// getCopyFromRegs - Emit a series of CopyFromReg nodes that copies from
/// this value and returns the result as a ValueVTs value. This uses
/// Chain/Flag as the input and updates them for the output Chain/Flag.
@@ -3754,7 +3763,6 @@
}
// Otherwise, we couldn't allocate enough registers for this.
- return;
}
@@ -3938,7 +3946,7 @@
// Loop over all of the inputs, copying the operand values into the
// appropriate registers and processing the output regs.
RegsForValue RetValRegs;
-
+
// IndirectStoresToEmit - The set of stores to emit after the inline asm node.
std::vector > IndirectStoresToEmit;
@@ -3970,15 +3978,16 @@
exit(1);
}
- if (!OpInfo.isIndirect) {
- // This is the result value of the call.
- assert(RetValRegs.Regs.empty() &&
- "Cannot have multiple output constraints yet!");
- assert(CS.getType() != Type::VoidTy && "Bad inline asm!");
- RetValRegs = OpInfo.AssignedRegs;
- } else {
+ // If this is an indirect operand, store through the pointer after the
+ // asm.
+ if (OpInfo.isIndirect) {
IndirectStoresToEmit.push_back(std::make_pair(OpInfo.AssignedRegs,
OpInfo.CallOperandVal));
+ } else {
+ // This is the result value of the call.
+ assert(CS.getType() != Type::VoidTy && "Bad inline asm!");
+ // Concatenate this output onto the outputs list.
+ RetValRegs.append(OpInfo.AssignedRegs);
}
// Add information to the INLINEASM node to know that this register is
@@ -4115,9 +4124,7 @@
// width/num elts. Make sure to convert it to the right type with
// bit_convert.
if (MVT::isVector(Val.getValueType())) {
- const VectorType *VTy = cast(CS.getType());
- MVT::ValueType DesiredVT = TLI.getValueType(VTy);
-
+ MVT::ValueType DesiredVT = TLI.getValueType(CS.getType());
Val = DAG.getNode(ISD::BIT_CONVERT, DesiredVT, Val);
}
Added: llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll?rev=50386&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll (added)
+++ llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll Mon Apr 28 23:29:54 2008
@@ -0,0 +1,17 @@
+; PR2094
+; RUN: llvm-as < %s | llc -march=x86-64 | grep movslq
+; RUN: llvm-as < %s | llc -march=x86-64 | not grep movq
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin8"
+
+define i32 @sad16_sse2(i8* %v, i8* %blk2, i8* %blk1, i32 %stride, i32 %h) nounwind {
+entry:
+ %tmp12 = sext i32 %stride to i64 ; [#uses=1]
+ %mrv = call {i32, i8*, i8*} asm sideeffect "$0 $1 $2 $3 $4 $5 $6",
+ "=r,=r,=r,r,r,r,r"( i64 %tmp12, i32 %h, i8* %blk1, i8* %blk2 ) nounwind
+ %tmp6 = getresult {i32, i8*, i8*} %mrv, 0
+ %tmp7 = call i32 asm sideeffect "set $0",
+ "=r,~{dirflag},~{fpsr},~{flags}"( ) nounwind
+ ret i32 %tmp7
+}
From sabre at nondot.org Mon Apr 28 23:48:56 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 29 Apr 2008 04:48:56 -0000
Subject: [llvm-commits] [llvm] r50389 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
test/CodeGen/X86/inline-asm-mrv.ll
Message-ID: <200804290448.m3T4mul4003479@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Apr 28 23:48:56 2008
New Revision: 50389
URL: http://llvm.org/viewvc/llvm-project?rev=50389&view=rev
Log:
make the vector conversion magic handle multiple results.
We now compile test2/test3 to:
_test2:
## InlineAsm Start
set %xmm0, %xmm1
## InlineAsm End
addps %xmm1, %xmm0
ret
_test3:
## InlineAsm Start
set %xmm0, %xmm1
## InlineAsm End
paddd %xmm1, %xmm0
ret
as expected.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50389&r1=50388&r2=50389&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 28 23:48:56 2008
@@ -4119,15 +4119,24 @@
// and set it as the value of the call.
if (!RetValRegs.Regs.empty()) {
SDOperand Val = RetValRegs.getCopyFromRegs(DAG, Chain, &Flag);
-
- // If the result of the inline asm is a vector, it may have the wrong
- // width/num elts. Make sure to convert it to the right type with
+
+ // If any of the results of the inline asm is a vector, it may have the
+ // wrong width/num elts. This can happen for register classes that can
+ // contain multiple different value types. The preg or vreg allocated may
+ // not have the same VT as was expected. Convert it to the right type with
// bit_convert.
- if (MVT::isVector(Val.getValueType())) {
- MVT::ValueType DesiredVT = TLI.getValueType(CS.getType());
- Val = DAG.getNode(ISD::BIT_CONVERT, DesiredVT, Val);
+ if (const StructType *ResSTy = dyn_cast(CS.getType())) {
+ for (unsigned i = 0, e = ResSTy->getNumElements(); i != e; ++i) {
+ if (MVT::isVector(Val.Val->getValueType(i)))
+ Val = DAG.getNode(ISD::BIT_CONVERT,
+ TLI.getValueType(ResSTy->getElementType(i)), Val);
+ }
+ } else {
+ if (MVT::isVector(Val.getValueType()))
+ Val = DAG.getNode(ISD::BIT_CONVERT, TLI.getValueType(CS.getType()),
+ Val);
}
-
+
setValue(CS.getInstruction(), Val);
}
Modified: llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll?rev=50389&r1=50388&r2=50389&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll (original)
+++ llvm/trunk/test/CodeGen/X86/inline-asm-mrv.ll Mon Apr 28 23:48:56 2008
@@ -1,12 +1,13 @@
; PR2094
; RUN: llvm-as < %s | llc -march=x86-64 | grep movslq
+; RUN: llvm-as < %s | llc -march=x86-64 | grep addps
+; RUN: llvm-as < %s | llc -march=x86-64 | grep paddd
; RUN: llvm-as < %s | llc -march=x86-64 | not grep movq
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-apple-darwin8"
-define i32 @sad16_sse2(i8* %v, i8* %blk2, i8* %blk1, i32 %stride, i32 %h) nounwind {
-entry:
+define i32 @test1(i8* %v, i8* %blk2, i8* %blk1, i32 %stride, i32 %h) nounwind {
%tmp12 = sext i32 %stride to i64 ; [#uses=1]
%mrv = call {i32, i8*, i8*} asm sideeffect "$0 $1 $2 $3 $4 $5 $6",
"=r,=r,=r,r,r,r,r"( i64 %tmp12, i32 %h, i8* %blk1, i8* %blk2 ) nounwind
@@ -15,3 +16,20 @@
"=r,~{dirflag},~{fpsr},~{flags}"( ) nounwind
ret i32 %tmp7
}
+
+define <4 x float> @test2() nounwind {
+ %mrv = call {<4 x float>, <4 x float>} asm "set $0, $1", "=x,=x"()
+ %a = getresult {<4 x float>, <4 x float>} %mrv, 0
+ %b = getresult {<4 x float>, <4 x float>} %mrv, 1
+ %c = add <4 x float> %a, %b
+ ret <4 x float> %c
+}
+
+define <4 x i32> @test3() nounwind {
+ %mrv = call {<4 x i32>, <4 x i32>} asm "set $0, $1", "=x,=x"()
+ %a = getresult {<4 x i32>, <4 x i32>} %mrv, 0
+ %b = getresult {<4 x i32>, <4 x i32>} %mrv, 1
+ %c = add <4 x i32> %a, %b
+ ret <4 x i32> %c
+}
+
From sabre at nondot.org Mon Apr 28 23:58:39 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 29 Apr 2008 04:58:39 -0000
Subject: [llvm-commits] [llvm] r50390 - in /llvm/trunk:
lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
Message-ID: <200804290458.m3T4wdep003808@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Apr 28 23:58:38 2008
New Revision: 50390
URL: http://llvm.org/viewvc/llvm-project?rev=50390&view=rev
Log:
don't delete the last store to an alloca if the store is volatile.
Added:
llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=50390&r1=50389&r2=50390&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 28 23:58:38 2008
@@ -10311,7 +10311,7 @@
// If the RHS is an alloca with a single use, zapify the store, making the
// alloca dead.
- if (Ptr->hasOneUse()) {
+ if (Ptr->hasOneUse() && !SI.isVolatile()) {
if (isa(Ptr)) {
EraseInstFromFunction(SI);
++NumCombined;
Added: llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll?rev=50390&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll Mon Apr 28 23:58:38 2008
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile store}
+
+define void @test() {
+ %votf = alloca <4 x float> ; <<4 x float>*> [#uses=1]
+ volatile store <4 x float> zeroinitializer, <4 x float>* %votf, align 16
+ ret void
+}
+
From sabre at nondot.org Tue Apr 29 00:05:22 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 29 Apr 2008 05:05:22 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50391 -
/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c
Message-ID: <200804290505.m3T55MDt003991@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Apr 29 00:05:22 2008
New Revision: 50391
URL: http://llvm.org/viewvc/llvm-project?rev=50391&view=rev
Log:
Fix this test so we don't delete the whole thing.
We compile this loop to amazingly gross code. What is
wrong with this picture:
entry:
%tmp2126 = icmp sgt i32 %count, 0 ; [#uses=1]
br i1 %tmp2126, label %bb.preheader, label %return
bb.preheader: ; preds = %entry
%tmp = icmp slt i32 %count, 1 ; [#uses=1]
%smax = select i1 %tmp, i32 1, i32 %count ; [#uses=1]
br label %bb
..
Modified:
llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c
Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c?rev=50391&r1=50390&r2=50391&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c Tue Apr 29 00:05:22 2008
@@ -5,11 +5,10 @@
/* { dg-final { scan-assembler "and.*0xffffff00" } } */
unsigned char lut[256];
-void foo( int count )
+void foo( int count, unsigned int *srcptr, unsigned *dstptr )
{
int j;
- unsigned int *srcptr, *dstptr;
for (j = 0; j < count; j++) {
unsigned int tmp = *srcptr;
unsigned int alpha = (tmp&255);
From sabre at nondot.org Tue Apr 29 00:12:08 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 29 Apr 2008 05:12:08 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50392 -
/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c
Message-ID: <200804290512.m3T5C8CK004196@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Apr 29 00:12:08 2008
New Revision: 50392
URL: http://llvm.org/viewvc/llvm-project?rev=50392&view=rev
Log:
llvm prints in decimal, allow this test to pass.
Modified:
llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c
Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c?rev=50392&r1=50391&r2=50392&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/i386-bitmask1.c Tue Apr 29 00:12:08 2008
@@ -2,7 +2,7 @@
/* { dg-do compile { target "i?86-*-*" } } */
/* { dg-options "-O2" } */
/* { dg-skip-if "" { i?86-*-* } { "-m64" } { "" } } */
-/* { dg-final { scan-assembler "and.*0xffffff00" } } */
+/* { dg-final { scan-assembler "and.*(0xffffff00|4294967040)" } } */
unsigned char lut[256];
void foo( int count, unsigned int *srcptr, unsigned *dstptr )
From tonic at nondot.org Tue Apr 29 00:12:45 2008
From: tonic at nondot.org (Tanya Lattner)
Date: Tue, 29 Apr 2008 05:12:45 -0000
Subject: [llvm-commits] [nightly-test-server] r50393 -
/nightly-test-server/trunk/AcceptTestResults.php
Message-ID: <200804290512.m3T5CjCX004226@zion.cs.uiuc.edu>
Author: tbrethou
Date: Tue Apr 29 00:12:45 2008
New Revision: 50393
URL: http://llvm.org/viewvc/llvm-project?rev=50393&view=rev
Log:
Fix loc stats and program results.
Update comments to reflect new table design.
Modified:
nightly-test-server/trunk/AcceptTestResults.php
Modified: nightly-test-server/trunk/AcceptTestResults.php
URL: http://llvm.org/viewvc/llvm-project/nightly-test-server/trunk/AcceptTestResults.php?rev=50393&r1=50392&r2=50393&view=diff
==============================================================================
--- nightly-test-server/trunk/AcceptTestResults.php (original)
+++ nightly-test-server/trunk/AcceptTestResults.php Tue Apr 29 00:12:45 2008
@@ -45,33 +45,39 @@
/*******************************************************************************
* mysql> describe testRunInfo;
-* +-------------------+-----------------------------------+------+-----+---------------------+----------------+
-* | Field | Type | Null | Key | Default | Extra |
-* +-------------------+-----------------------------------+------+-----+---------------------+----------------+
-* | id | int(11) | | PRI | NULL | auto_increment |
-* | runDateTime | datetime | | | 0000-00-00 00:00:00 | |
-* | machineId | int(11) | | | 0 | |
-* | machineUname | text | YES | | NULL | |
-* | gccVersion | text | YES | | NULL | |
-* | cvsCpuTime | double | YES | | NULL | |
-* | cvsWallTime | double | YES | | NULL | |
-* | configureCpuTime | double | YES | | NULL | |
-* | configureWallTime | double | YES | | NULL | |
-* | buildCpuTime | double | YES | | NULL | |
-* | buildWallTime | double | YES | | NULL | |
-* | dejagnuCpuTime | double | YES | | NULL | |
-* | dejagnuWallTime | double | YES | | NULL | |
-* | warnings | mediumtext | YES | | NULL | |
-* | warningsAdded | text | YES | | NULL | |
-* | warningsRemoved | text | YES | | NULL | |
-* | cvsUsersAdd | text | YES | | NULL | |
-* | cvsUsersCO | text | YES | | NULL | |
-* | cvsFilesAdded | text | YES | | NULL | |
-* | cvsFilesRemoved | text | YES | | NULL | |
-* | cvsFilesModified | text | YES | | NULL | |
-* | buildStatus | tinyint(4) | YES | | NULL | |
-* | type | enum('release','debug','unknown') | YES | | unknown | |
-* +-------------------+-----------------------------------+------+-----+---------------------+----------------+
+* +-------------------+-------------------------------------+------+-----+---------------------+----------------+
+* | Field | Type | Null | Key | Default | Extra |
+* +-------------------+-------------------------------------+------+-----+---------------------+----------------+
+* | id | int(11) | | PRI | NULL | auto_increment |
+* | runDateTime | datetime | | MUL | 0000-00-00 00:00:00 | |
+* | machineId | int(11) | | MUL | 0 | |
+* | machineUname | text | YES | | NULL | |
+* | gccVersion | text | YES | | NULL | |
+* | cvsCpuTime | double | YES | | NULL | |
+* | cvsWallTime | double | YES | | NULL | |
+* | configureCpuTime | double | YES | | NULL | |
+* | configureWallTime | double | YES | | NULL | |
+* | buildCpuTime | double | YES | | NULL | |
+* | buildWallTime | double | YES | | NULL | |
+* | dejagnuCpuTime | double | YES | | NULL | |
+* | dejagnuWallTime | double | YES | | NULL | |
+* | warnings | mediumtext | YES | | NULL | |
+* | warningsAdded | text | YES | | NULL | |
+* | warningsRemoved | text | YES | | NULL | |
+* | cvsUsersAdd | text | YES | | NULL | |
+* | cvsUsersCO | text | YES | | NULL | |
+* | cvsFilesAdded | text | YES | | NULL | |
+* | cvsFilesRemoved | text | YES | | NULL | |
+* | cvsFilesModified | text | YES | | NULL | |
+* | buildStatus | enum('OK','FAIL','Skipped','Other') | YES | | Other | |
+* | type | enum('release','debug','unknown') | YES | | unknown | |
+* | dejagnuPass | int(11) | YES | | NULL | |
+* | dejagnuFail | int(11) | YES | | NULL | |
+* | dejagnuXFail | int(11) | YES | | NULL | |
+* | dejagnuXPass | int(11) | YES | | NULL | |
+* | dateAdded | datetime | YES | | NULL | |
+* +-------------------+-------------------------------------+------+-----+---------------------+----------------+
+*
* Add a test run configuration to the database for logging test results.
*
*******************************************************************************/
@@ -205,17 +211,47 @@
$program = $results[0];
$program = $prefix . $program;
+
$gccasTime = $results[1];
+ if($gccasTime == "*")
+ $gccasTime = NULL;
+
$byteCodeSize = $results[2];
+ if($byteCodeSize == "*")
+ $byteCodeSize = NULL;
+
$llcTime = $results[3];
+ if($llcTime == "*")
+ $llcTime = NULL;
+
$llcBetaTime = $results[4];
+ if($llcBetaTime == "*")
+ $llcBetaTime = NULL;
+
$jitTime = $results[5];
+ if($jitTime == "*")
+ $jitTime = NULL;
+
$gccRunTime = $results[6];
+ if($gccRunTime = "*")
+ $gccRunTime = NULL;
+
$cbeRunTime = $results[7];
+ if($cbeRunTime == "*")
+ $cbeRunTime = NULL;
+
$llcRunTime = $results[8];
+ if($llcRunTime == "*")
+ $llcRunTime = NULL;
+
$llcBetaRunTime = $results[9];
+ if($llcBetaRunTime == "*")
+ $llcBetaRunTime = NULL;
+
$jitRunTime = $results[10];
-
+ if($jitRunTime == "*")
+ $jitRunTime = NULL;
+
// Get id for program name
$sqlQuery = "SELECT id FROM programs WHERE name=\"$program\"";
$result = mysql_query($sqlQuery) or die(mysql_error());
@@ -239,7 +275,7 @@
\"$llcTime\", \"$llcBetaTime\", \"$jitTime\", \"$gccRunTime\",
\"$cbeRunTime\", \"$llcRunTime\", \"$llcBetaRunTime\",
\"$jitRunTime\")";
-
+
mysql_query($query) or die(mysql_error());
}
@@ -594,7 +630,7 @@
$loc = $_POST['lines_of_code'];
$filesincvs = $_POST['cvs_file_count'];
$dirsincvs = $_POST['cvs_dir_count'];
-if(strcmp($buildstatus, "OK") == 0) {
+if($buildstatus == 1) {
// only update loc if successful build
updateLLVMStats($runDateTime, $loc, $filesincvs, $dirsincvs, $testRunConfigId);
From dpatel at apple.com Tue Apr 29 00:48:18 2008
From: dpatel at apple.com (Devang Patel)
Date: Mon, 28 Apr 2008 22:48:18 -0700
Subject: [llvm-commits] [llvm] r50382 - in /llvm/trunk:
include/llvm/LinkAllPasses.h include/llvm/Transforms/Scalar.h
lib/Transforms/Scalar/DeadLoopElimination.cpp
In-Reply-To: <200804290038.m3T0cZc1028840@zion.cs.uiuc.edu>
References: <200804290038.m3T0cZc1028840@zion.cs.uiuc.edu>
Message-ID:
On Apr 28, 2008, at 5:38 PM, Owen Anderson wrote:
> + for (Loop::block_iterator LI = L->block_begin(), LE = L-
> >block_end();
> + LI != LE; ++LI) {
Make sure that you're not incrementing invalid iterator here.
-
Devang
From dpatel at apple.com Tue Apr 29 00:50:35 2008
From: dpatel at apple.com (Devang Patel)
Date: Mon, 28 Apr 2008 22:50:35 -0700
Subject: [llvm-commits] [llvm] r50384 -
/llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
In-Reply-To: <200804290045.m3T0jGko029097@zion.cs.uiuc.edu>
References: <200804290045.m3T0jGko029097@zion.cs.uiuc.edu>
Message-ID:
On Apr 28, 2008, at 5:45 PM, Owen Anderson wrote:
> Author: resistor
> Date: Mon Apr 28 19:45:15 2008
> New Revision: 50384
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50384&view=rev
> Log:
> Add some more comments.
Thanks!. Please define "Dead Loop" at the beginning to avoid
confusion. Some of the function definitions could use comments to
describe their behavior.
-
Devang
From sabre at nondot.org Tue Apr 29 00:53:29 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 29 Apr 2008 05:53:29 -0000
Subject: [llvm-commits] [llvm] r50397 -
/llvm/trunk/test/CFrontend/inline-asm-mrv.c
Message-ID: <200804290553.m3T5rTua005540@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Apr 29 00:53:29 2008
New Revision: 50397
URL: http://llvm.org/viewvc/llvm-project?rev=50397&view=rev
Log:
new testcase for PR2094. The inline asms should not pin allocas to the
stack anymore.
Added:
llvm/trunk/test/CFrontend/inline-asm-mrv.c
Added: llvm/trunk/test/CFrontend/inline-asm-mrv.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/inline-asm-mrv.c?rev=50397&view=auto
==============================================================================
--- llvm/trunk/test/CFrontend/inline-asm-mrv.c (added)
+++ llvm/trunk/test/CFrontend/inline-asm-mrv.c Tue Apr 29 00:53:29 2008
@@ -0,0 +1,12 @@
+// RUN: %llvmgcc -S %s -o - -O | not grep alloca
+// PR2094
+
+int sad16_sse2(void *v, unsigned char *blk2, unsigned char *blk1,
+ int stride, int h) {
+ int ret;
+ asm volatile( "%0 %1 %2 %3"
+ : "+r" (h), "+r" (blk1), "+r" (blk2)
+ : "r" ((long)stride));
+ asm volatile("set %0 %1" : "=r"(ret) : "r"(blk1));
+ return ret;
+}
From sabre at nondot.org Tue Apr 29 00:54:46 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 29 Apr 2008 05:54:46 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50398 -
/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Message-ID: <200804290554.m3T5skVa005587@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Apr 29 00:54:45 2008
New Revision: 50398
URL: http://llvm.org/viewvc/llvm-project?rev=50398&view=rev
Log:
Implement support for turning inline asms with multiple results into
a multiple return value call. This fixes the last part of PR2094.
Testcase here: llvm/test/CFrontend/inline-asm-mrv.c
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=50398&r1=50397&r2=50398&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Apr 29 00:54:45 2008
@@ -3794,8 +3794,8 @@
std::string ConstraintStr;
// StoreCallResultAddr - The pointer to store the result of the call through.
- Value *StoreCallResultAddr = 0;
- const Type *CallResultType = Type::VoidTy;
+ SmallVector StoreCallResultAddrs;
+ SmallVector CallResultTypes;
// Process outputs.
int ValNum = 0;
@@ -3856,13 +3856,11 @@
cast(Dest.Ptr->getType())->getElementType();
assert(!Dest.isBitfield() && "Cannot assign into a bitfield!");
- if (ConstraintStr.empty() && !AllowsMem && // Reg dest and no output yet?
- DestValTy->isFirstClassType()) {
- assert(StoreCallResultAddr == 0 && "Already have a result val?");
- StoreCallResultAddr = Dest.Ptr;
+ if (!AllowsMem && DestValTy->isFirstClassType()) { // Reg dest -> asm return
+ StoreCallResultAddrs.push_back(Dest.Ptr);
ConstraintStr += ",=";
ConstraintStr += SimplifiedConstraint;
- CallResultType = DestValTy;
+ CallResultTypes.push_back(DestValTy);
} else {
ConstraintStr += ",=*";
ConstraintStr += SimplifiedConstraint;
@@ -3989,6 +3987,17 @@
}
}
+ const Type *CallResultType;
+ switch (CallResultTypes.size()) {
+ case 0: CallResultType = Type::VoidTy; break;
+ case 1: CallResultType = CallResultTypes[0]; break;
+ default:
+ std::vector TmpVec(CallResultTypes.begin(),
+ CallResultTypes.end());
+ CallResultType = StructType::get(TmpVec);
+ break;
+ }
+
const FunctionType *FTy =
FunctionType::get(CallResultType, CallArgTypes, false);
@@ -4005,12 +4014,18 @@
Value *Asm = InlineAsm::get(FTy, NewAsmStr, ConstraintStr,
ASM_VOLATILE_P(exp) || !ASM_OUTPUTS(exp));
CallInst *CV = Builder.CreateCall(Asm, CallOps.begin(), CallOps.end(),
- StoreCallResultAddr ? "tmp" : "");
+ CallResultTypes.empty() ? "" : "asmtmp");
CV->setDoesNotThrow();
// If the call produces a value, store it into the destination.
- if (StoreCallResultAddr)
- Builder.CreateStore(CV, StoreCallResultAddr);
+ if (StoreCallResultAddrs.size() == 1)
+ Builder.CreateStore(CV, StoreCallResultAddrs[0]);
+ else if (unsigned NumResults = StoreCallResultAddrs.size()) {
+ for (unsigned i = 0; i != NumResults; ++i) {
+ Value *ValI = Builder.CreateGetResult(CV, i, "asmresult");
+ Builder.CreateStore(ValI, StoreCallResultAddrs[i]);
+ }
+ }
// Give the backend a chance to upgrade the inline asm to LLVM code. This
// handles some common cases that LLVM has intrinsics for, e.g. x86 bswap ->
From asl at math.spbu.ru Tue Apr 29 01:20:19 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 29 Apr 2008 06:20:19 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50399 -
/llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/locale_facets.tcc
Message-ID: <200804290620.m3T6KKFS006391@zion.cs.uiuc.edu>
Author: asl
Date: Tue Apr 29 01:20:19 2008
New Revision: 50399
URL: http://llvm.org/viewvc/llvm-project?rev=50399&view=rev
Log:
Backport from mainline (pre-GPLv3).
Fix for sizeof(const void*) > sizeof(unsigned long).
Modified:
llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/locale_facets.tcc
Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/locale_facets.tcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/locale_facets.tcc?rev=50399&r1=50398&r2=50399&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/locale_facets.tcc (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/locale_facets.tcc Tue Apr 29 01:20:19 2008
@@ -885,7 +885,13 @@
const fmtflags __fmt = __io.flags();
__io.flags(__fmt & ~ios_base::basefield | ios_base::hex);
- unsigned long __ul;
+ // LLVM LOCAL begin mainline
+ typedef __gnu_cxx::__conditional_type<(sizeof(void*)
+ <= sizeof(unsigned long)),
+ unsigned long, unsigned long long>::__type _UIntPtrType;
+
+ _UIntPtrType __ul;
+ // LLVM LOCAL end mainline
__beg = _M_extract_int(__beg, __end, __io, __err, __ul);
// Reset from hex formatted input.
@@ -1307,8 +1313,14 @@
| ios_base::internal);
__io.flags(__flags & __fmt | (ios_base::hex | ios_base::showbase));
+ // LLVM LOCAL begin mainline
+ typedef __gnu_cxx::__conditional_type<(sizeof(const void*)
+ <= sizeof(unsigned long)),
+ unsigned long, unsigned long long>::__type _UIntPtrType;
+
__s = _M_insert_int(__s, __io, __fill,
- reinterpret_cast(__v));
+ reinterpret_cast<_UIntPtrType>(__v));
+ // LLVM LOCAL end mainline
__io.flags(__flags);
return __s;
}
From asl at math.spbu.ru Tue Apr 29 01:21:06 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 29 Apr 2008 06:21:06 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50400 - in /llvm-gcc-4.2/trunk:
gcc/config.gcc gcc/config.host gcc/config/i386/t-cygming
libstdc++-v3/configure libtool.m4
Message-ID: <200804290621.m3T6L7qp006433@zion.cs.uiuc.edu>
Author: asl
Date: Tue Apr 29 01:21:06 2008
New Revision: 50400
URL: http://llvm.org/viewvc/llvm-project?rev=50400&view=rev
Log:
Backport from mainline. Add win64 as target to llvm-gcc.
All win64-related changes were explicitely approved by their
author to be backported to llvm-gcc under GPLv2.
Modified:
llvm-gcc-4.2/trunk/gcc/config.gcc
llvm-gcc-4.2/trunk/gcc/config.host
llvm-gcc-4.2/trunk/gcc/config/i386/t-cygming
llvm-gcc-4.2/trunk/libstdc++-v3/configure
llvm-gcc-4.2/trunk/libtool.m4
Modified: llvm-gcc-4.2/trunk/gcc/config.gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=50400&r1=50399&r2=50400&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config.gcc (original)
+++ llvm-gcc-4.2/trunk/gcc/config.gcc Tue Apr 29 01:21:06 2008
@@ -1325,22 +1325,30 @@
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
extra_options="${extra_options} i386/cygming.opt"
extra_objs="winnt.o winnt-stubs.o"
- c_target_objs=cygwin2.o
- cxx_target_objs="cygwin2.o winnt-cxx.o"
+# LLVM LOCAL begin mainline
+ c_target_objs="cygwin2.o msformat-c.o"
+ cxx_target_objs="cygwin2.o winnt-cxx.o msformat-c.o"
+# LLVM LOCAL end mainline
extra_gcc_objs=cygwin1.o
extra_parts="crtbegin.o crtend.o"
if test x$enable_threads = xyes; then
thread_file='posix'
fi
;;
-i[34567]86-*-mingw32*)
+# LLVM LOCAL begin mainline
+i[34567]86-*-mingw32* | x86_64-*-mingw32*)
+# LLVM LOCAL end mainline
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/mingw32.h"
xm_file=i386/xm-mingw32.h
tmake_file="i386/t-cygming i386/t-mingw32"
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
extra_options="${extra_options} i386/cygming.opt"
extra_objs="winnt.o winnt-stubs.o"
- cxx_target_objs=winnt-cxx.o
+# LLVM LOCAL begin mainline
+ c_target_objs="msformat-c.o"
+ cxx_target_objs="winnt-cxx.o msformat-c.o"
+ default_use_cxa_atexit=yes
+# LLVM LOCAL end mainline
extra_parts="crtbegin.o crtend.o"
case ${enable_threads} in
"" | yes | win32)
Modified: llvm-gcc-4.2/trunk/gcc/config.host
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.host?rev=50400&r1=50399&r2=50400&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config.host (original)
+++ llvm-gcc-4.2/trunk/gcc/config.host Tue Apr 29 01:21:06 2008
@@ -168,7 +168,9 @@
host_xmake_file="${host_xmake_file} i386/x-cygwin"
host_exeext=.exe
;;
- i[34567]86-*-mingw32*)
+# LLVM LOCAL begin mainline
+ i[34567]86-*-mingw32* | x86_64-*-mingw32*)
+# LLVM LOCAL end mainline
host_xm_file=i386/xm-mingw32.h
host_xmake_file="${host_xmake_file} i386/x-mingw32"
host_exeext=.exe
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/t-cygming
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/t-cygming?rev=50400&r1=50399&r2=50400&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/t-cygming (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/t-cygming Tue Apr 29 01:21:06 2008
@@ -29,6 +29,14 @@
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/i386/winnt-stubs.c
+# LLVM LOCAL begin mainline
+msformat-c.o: $(srcdir)/config/i386/msformat-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
+ $(TM_P_H) toplev.h $(HASHTAB_H) $(GGC_H)
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ $(srcdir)/config/i386/msformat-c.c
+# LLVM LOCAL end mainline
+
STMP_FIXINC=stmp-fixinc
# LLVM LOCAL begin mainline 125696
Modified: llvm-gcc-4.2/trunk/libstdc++-v3/configure
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/configure?rev=50400&r1=50399&r2=50400&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/configure (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/configure Tue Apr 29 01:21:06 2008
@@ -4207,7 +4207,7 @@
;;
cygwin* | mingw* |pw32*)
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_deplibs_check_method='file_magic file format pe*-i386(.*architecture: i386)?'
lt_cv_file_magic_cmd='$OBJDUMP -f'
;;
Modified: llvm-gcc-4.2/trunk/libtool.m4
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libtool.m4?rev=50400&r1=50399&r2=50400&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libtool.m4 (original)
+++ llvm-gcc-4.2/trunk/libtool.m4 Tue Apr 29 01:21:06 2008
@@ -663,7 +663,7 @@
;;
cygwin* | mingw* |pw32*)
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_deplibs_check_method='file_magic file format pe*-i386(.*architecture: i386)?'
lt_cv_file_magic_cmd='$OBJDUMP -f'
;;
From asl at math.spbu.ru Tue Apr 29 01:21:42 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 29 Apr 2008 06:21:42 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50401 - in
/llvm-gcc-4.2/trunk/libiberty: pex-common.h pex-djgpp.c pex-msdos.c
pex-unix.c pex-win32.c
Message-ID: <200804290621.m3T6Lhbe006471@zion.cs.uiuc.edu>
Author: asl
Date: Tue Apr 29 01:21:42 2008
New Revision: 50401
URL: http://llvm.org/viewvc/llvm-project?rev=50401&view=rev
Log:
Backport from mainline.
Win64-related changes to libiberty.
Modified:
llvm-gcc-4.2/trunk/libiberty/pex-common.h
llvm-gcc-4.2/trunk/libiberty/pex-djgpp.c
llvm-gcc-4.2/trunk/libiberty/pex-msdos.c
llvm-gcc-4.2/trunk/libiberty/pex-unix.c
llvm-gcc-4.2/trunk/libiberty/pex-win32.c
Modified: llvm-gcc-4.2/trunk/libiberty/pex-common.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libiberty/pex-common.h?rev=50401&r1=50400&r2=50401&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libiberty/pex-common.h (original)
+++ llvm-gcc-4.2/trunk/libiberty/pex-common.h Tue Apr 29 01:21:42 2008
@@ -26,6 +26,14 @@
#include "libiberty.h"
#include
+/* LLVM LOCAL begin mainline */
+/* pid_t is may defined by config.h or sys/types.h needs to be
+ included. */
+#if !defined(pid_t) && defined(HAVE_SYS_TYPES_H)
+#include
+#endif
+/* LLVM LOCAL end mainline */
+
#define install_error_msg "installation problem, cannot exec `%s'"
/* stdin file number. */
@@ -104,7 +112,9 @@
closed in the child process. The function should handle the
PEX_STDERR_TO_STDOUT flag. Return >= 0 on success, or -1 on
error and set *ERRMSG and *ERR. */
- long (*exec_child) (struct pex_obj *, int /* flags */,
+/* LLVM LOCAL begin mainline */
+ pid_t (*exec_child) (struct pex_obj *, int /* flags */,
+/* LLVM LOCAL end mainline */
const char */* executable */, char * const * /* argv */,
char * const * /* env */,
int /* in */, int /* out */, int /* errdes */,
@@ -116,7 +126,9 @@
and time in *TIME (if it is not null). CHILD is from fork. DONE
is 1 if this is called via pex_free. ERRMSG and ERR are as in
fork. Return 0 on success, -1 on error. */
- int (*wait) (struct pex_obj *, long /* child */, int * /* status */,
+/* LLVM LOCAL begin mainline */
+ int (*wait) (struct pex_obj *, pid_t /* child */, int * /* status */,
+/* LLVM LOCAL end mainline */
struct pex_time * /* time */, int /* done */,
const char ** /* errmsg */, int * /* err */);
/* Create a pipe (only called if PEX_USE_PIPES is set) storing two
Modified: llvm-gcc-4.2/trunk/libiberty/pex-djgpp.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libiberty/pex-djgpp.c?rev=50401&r1=50400&r2=50401&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libiberty/pex-djgpp.c (original)
+++ llvm-gcc-4.2/trunk/libiberty/pex-djgpp.c Tue Apr 29 01:21:42 2008
@@ -44,12 +44,16 @@
static int pex_djgpp_open_read (struct pex_obj *, const char *, int);
static int pex_djgpp_open_write (struct pex_obj *, const char *, int);
-static long pex_djgpp_exec_child (struct pex_obj *, int, const char *,
+/* LLVM LOCAL begin mainline */
+static pid_t pex_djgpp_exec_child (struct pex_obj *, int, const char *,
+/* LLVM LOCAL end mainline */
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_djgpp_close (struct pex_obj *, int);
-static int pex_djgpp_wait (struct pex_obj *, long, int *, struct pex_time *,
+/* LLVM LOCAL begin mainline */
+static int pex_djgpp_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
+/* LLVM LOCAL end mainline */
int, const char **, int *);
/* The list of functions we pass to the common routines. */
@@ -110,7 +114,9 @@
/* Execute a child. */
-static long
+/* LLVM LOCAL begin mainline */
+static pid_t
+/* LLVM LOCAL end mainline */
pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env,
int in, int out, int errdes,
@@ -132,19 +138,25 @@
{
*err = errno;
*errmsg = "dup";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
if (dup2 (in, STDIN_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
if (close (in) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
}
@@ -155,19 +167,25 @@
{
*err = errno;
*errmsg = "dup";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
if (dup2 (out, STDOUT_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
if (close (out) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
}
@@ -179,14 +197,18 @@
{
*err = errno;
*errmsg = "dup";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
if (dup2 ((flags & PEX_STDERR_TO_STDOUT) != 0 ? STDOUT_FILE_NO : errdes,
STDERR_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
if (errdes != STDERR_FILE_NO)
{
@@ -194,7 +216,9 @@
{
*err = errno;
*errmsg = "close";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
}
}
@@ -218,13 +242,17 @@
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
if (close (org_in) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
}
@@ -234,13 +262,17 @@
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
if (close (org_out) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
}
@@ -251,13 +283,17 @@
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
if (close (org_errdes) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
}
@@ -269,7 +305,9 @@
statuses[obj->count] = status;
obj->sysdep = (void *) statuses;
- return obj->count;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) obj->count;
+ /* LLVM LOCAL end mainline */
}
/* Wait for a child process to complete. Actually the child process
@@ -277,7 +315,9 @@
status. */
static int
-pex_djgpp_wait (struct pex_obj *obj, long pid, int *status,
+/* LLVM LOCAL begin mainline */
+pex_djgpp_wait (struct pex_obj *obj, pid_t pid, int *status,
+/* LLVM LOCAL end mainline */
struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED,
int *err ATTRIBUTE_UNUSED)
Modified: llvm-gcc-4.2/trunk/libiberty/pex-msdos.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libiberty/pex-msdos.c?rev=50401&r1=50400&r2=50401&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libiberty/pex-msdos.c (original)
+++ llvm-gcc-4.2/trunk/libiberty/pex-msdos.c Tue Apr 29 01:21:42 2008
@@ -54,12 +54,16 @@
static int pex_msdos_open (struct pex_obj *, const char *, int);
static int pex_msdos_open (struct pex_obj *, const char *, int);
static int pex_msdos_fdindex (struct pex_msdos *, int);
-static long pex_msdos_exec_child (struct pex_obj *, int, const char *,
+/* LLVM LOCAL begin mainline */
+static pid_t pex_msdos_exec_child (struct pex_obj *, int, const char *,
+/* LLVM LOCAL end mainline */
char * const *, char * const *,
int, int, int, int,
int, const char **, int *);
static int pex_msdos_close (struct pex_obj *, int);
-static int pex_msdos_wait (struct pex_obj *, long, int *, struct pex_time *,
+/* LLVM LOCAL begin mainline */
+static int pex_msdos_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
+/* LLVM LOCAL end mainline */
int, const char **, int *);
static void pex_msdos_cleanup (struct pex_obj *);
@@ -152,7 +156,9 @@
/* Execute a child. */
-static long
+/* LLVM LOCAL begin mainline */
+static pid_t
+/* LLVM LOCAL end mainline */
pex_msdos_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env, int in, int out,
int toclose ATTRIBUTE_UNUSED,
@@ -235,7 +241,9 @@
free (scmd);
free (rf);
*errmsg = "cannot open temporary command file";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
for (i = 1; argv[i] != NULL; ++i)
@@ -262,7 +270,9 @@
free (scmd);
free (rf);
*errmsg = "system";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
remove (rf);
@@ -275,7 +285,9 @@
ms->statuses = XRESIZEVEC(int, ms->statuses, obj->count + 1);
ms->statuses[obj->count] = status;
- return obj->count;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) obj->count;
+ /* LLVM LOCAL end mainline */
}
/* Wait for a child process to complete. Actually the child process
@@ -283,7 +295,9 @@
status. */
static int
-pex_msdos_wait (struct pex_obj *obj, long pid, int *status,
+/* LLVM LOCAL begin mainline */
+pex_msdos_wait (struct pex_obj *obj, pid_t pid, int *status,
+/* LLVM LOCAL end mainline */
struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED,
int *err ATTRIBUTE_UNUSED)
Modified: llvm-gcc-4.2/trunk/libiberty/pex-unix.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libiberty/pex-unix.c?rev=50401&r1=50400&r2=50401&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libiberty/pex-unix.c (original)
+++ llvm-gcc-4.2/trunk/libiberty/pex-unix.c Tue Apr 29 01:21:42 2008
@@ -84,15 +84,21 @@
time that it took. This is simple if we have wait4, slightly
harder if we have waitpid, and is a pain if we only have wait. */
+/* LLVM LOCAL begin mainline */
static pid_t pex_wait (struct pex_obj *, pid_t, int *, struct pex_time *);
+/* LLVM LOCAL end mainline */
#ifdef HAVE_WAIT4
+/* LLVM LOCAL begin mainline */
static pid_t
pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
+/* LLVM LOCAL end mainline */
struct pex_time *time)
{
+ /* LLVM LOCAL begin mainline */
pid_t ret;
+ /* LLVM LOCAL end mainline */
struct rusage r;
#ifdef HAVE_WAITPID
@@ -119,8 +125,10 @@
#ifndef HAVE_GETRUSAGE
+/* LLVM LOCAL begin mainline */
static pid_t
pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
+/* LLVM LOCAL end mainline */
struct pex_time *time)
{
if (time != NULL)
@@ -130,12 +138,16 @@
#else /* defined (HAVE_GETRUSAGE) */
+/* LLVM LOCAL begin mainline */
static pid_t
pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
+/* LLVM LOCAL end mainline */
struct pex_time *time)
{
struct rusage r1, r2;
+ /* LLVM LOCAL begin mainline */
pid_t ret;
+ /* LLVM LOCAL end mainline */
if (time == NULL)
return waitpid (pid, status, 0);
@@ -174,13 +186,17 @@
struct status_list
{
struct status_list *next;
+ /* LLVM LOCAL begin mainline */
pid_t pid;
+ /* LLVM LOCAL end mainline */
int status;
struct pex_time time;
};
+/* LLVM LOCAL begin mainline */
static pid_t
pex_wait (struct pex_obj *obj, pid_t pid, int *status, struct pex_time *time)
+/* LLVM LOCAL end mainline */
{
struct status_list **pp;
@@ -204,7 +220,9 @@
while (1)
{
+ /* LLVM LOCAL begin mainline */
pid_t cpid;
+ /* LLVM LOCAL end mainline */
struct status_list *psl;
struct pex_time pt;
#ifdef HAVE_GETRUSAGE
@@ -269,12 +287,16 @@
ATTRIBUTE_NORETURN;
static int pex_unix_open_read (struct pex_obj *, const char *, int);
static int pex_unix_open_write (struct pex_obj *, const char *, int);
-static long pex_unix_exec_child (struct pex_obj *, int, const char *,
+/* LLVM LOCAL begin mainline */
+static pid_t pex_unix_exec_child (struct pex_obj *, int, const char *,
+/* LLVM LOCAL end mainline */
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_unix_close (struct pex_obj *, int);
-static int pex_unix_wait (struct pex_obj *, long, int *, struct pex_time *,
+/* LLVM LOCAL begin mainline */
+static int pex_unix_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
+/* LLVM LOCAL end mainline */
int, const char **, int *);
static int pex_unix_pipe (struct pex_obj *, int *, int);
static FILE *pex_unix_fdopenr (struct pex_obj *, int, int);
@@ -355,13 +377,17 @@
extern char **environ;
-static long
+/* LLVM LOCAL begin mainline */
+static pid_t
pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
+/* LLVM LOCAL end mainline */
char * const * argv, char * const * env,
int in, int out, int errdes,
int toclose, const char **errmsg, int *err)
{
+ /* LLVM LOCAL begin mainline */
pid_t pid;
+ /* LLVM LOCAL end mainline */
/* We declare these to be volatile to avoid warnings from gcc about
them being clobbered by vfork. */
@@ -384,7 +410,9 @@
case -1:
*err = errno;
*errmsg = VFORK_STRING;
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
case 0:
/* Child process. */
@@ -435,7 +463,9 @@
}
/* NOTREACHED */
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
default:
/* Parent process. */
@@ -445,7 +475,9 @@
{
*err = errno;
*errmsg = "close";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
}
if (out != STDOUT_FILE_NO)
@@ -454,7 +486,9 @@
{
*err = errno;
*errmsg = "close";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
}
if (errdes != STDERR_FILE_NO)
@@ -463,18 +497,22 @@
{
*err = errno;
*errmsg = "close";
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
}
- return (long) pid;
+ return pid;
}
}
/* Wait for a child process to complete. */
static int
-pex_unix_wait (struct pex_obj *obj, long pid, int *status,
+/* LLVM LOCAL begin mainline */
+pex_unix_wait (struct pex_obj *obj, pid_t pid, int *status,
+/* LLVM LOCAL end mainline */
struct pex_time *time, int done, const char **errmsg,
int *err)
{
Modified: llvm-gcc-4.2/trunk/libiberty/pex-win32.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libiberty/pex-win32.c?rev=50401&r1=50400&r2=50401&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libiberty/pex-win32.c (original)
+++ llvm-gcc-4.2/trunk/libiberty/pex-win32.c Tue Apr 29 01:21:42 2008
@@ -79,12 +79,16 @@
static int pex_win32_open_read (struct pex_obj *, const char *, int);
static int pex_win32_open_write (struct pex_obj *, const char *, int);
-static long pex_win32_exec_child (struct pex_obj *, int, const char *,
+/* LLVM LOCAL begin mainline */
+static pid_t pex_win32_exec_child (struct pex_obj *, int, const char *,
+/* LLVM LOCAL end mainline */
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_win32_close (struct pex_obj *, int);
-static int pex_win32_wait (struct pex_obj *, long, int *,
+/* LLVM LOCAL begin mainline */
+static int pex_win32_wait (struct pex_obj *, pid_t, int *,
+/* LLVM LOCAL end mainline */
struct pex_time *, int, const char **, int *);
static int pex_win32_pipe (struct pex_obj *, int *, int);
static FILE *pex_win32_fdopenr (struct pex_obj *, int, int);
@@ -521,7 +525,9 @@
return c1 - c2;
}
-static long
+/* LLVM LOCAL begin mainline */
+static pid_t
+/* LLVM LOCAL end mainline */
win32_spawn (const char *executable,
BOOL search,
char *const *argv,
@@ -596,7 +602,9 @@
free (full_executable);
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
/* Clean up. */
@@ -605,7 +613,9 @@
if (env_block)
free (env_block);
- return (long) pi->hProcess;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) pi->hProcess;
+ /* LLVM LOCAL end mainline */
error:
if (env_block)
@@ -615,17 +625,23 @@
if (full_executable)
free (full_executable);
- return -1;
+ /* LLVM LOCAL begin mainline */
+ return (pid_t) -1;
+ /* LLVM LOCAL end mainline */
}
-static long
+/* LLVM LOCAL begin mainline */
+static pid_t
+/* LLVM LOCAL end mainline */
spawn_script (const char *executable, char *const *argv,
char* const *env,
DWORD dwCreationFlags,
LPSTARTUPINFO si,
LPPROCESS_INFORMATION pi)
{
- int pid = -1;
+ /* LLVM LOCAL begin mainline */
+ pid_t pid = (pid_t) -1;
+ /* LLVM LOCAL end mainline */
int save_errno = errno;
int fd = _open (executable, _O_RDONLY);
@@ -672,7 +688,7 @@
dwCreationFlags, si, pi);
if (executable1 != newex)
free ((char *) newex);
- if (pid < 0)
+ if ((long) pid < 0)
{
newex = msys_rootify (executable1);
if (newex != executable1)
@@ -688,14 +704,16 @@
}
}
}
- if (pid < 0)
+ if ((long) pid < 0)
errno = save_errno;
return pid;
}
/* Execute a child. */
-static long
+/* LLVM LOCAL begin mainline */
+static pid_t
+/* LLVM LOCAL end mainline */
pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
const char *executable, char * const * argv,
char* const* env,
@@ -704,7 +722,9 @@
const char **errmsg,
int *err)
{
- long pid;
+ /* LLVM LOCAL begin mainline */
+ pid_t pid;
+ /* LLVM LOCAL end mainline */
HANDLE stdin_handle;
HANDLE stdout_handle;
HANDLE stderr_handle;
@@ -779,10 +799,14 @@
/* Create the child process. */
pid = win32_spawn (executable, (flags & PEX_SEARCH) != 0,
argv, env, dwCreationFlags, &si, &pi);
- if (pid == -1)
+ /* LLVM LOCAL begin mainline */
+ if (pid == (pid_t) -1)
+ /* LLVM LOCAL end mainline */
pid = spawn_script (executable, argv, env, dwCreationFlags,
&si, &pi);
- if (pid == -1)
+ /* LLVM LOCAL begin mainline */
+ if (pid == (pid_t) -1)
+ /* LLVM LOCAL end mainline */
{
*err = ENOENT;
*errmsg = "CreateProcess";
@@ -807,7 +831,9 @@
macros. Note that WIFSIGNALED will never be true under CRTDLL. */
static int
-pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, long pid,
+/* LLVM LOCAL begin mainline */
+pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid,
+/* LLVM LOCAL end mainline */
int *status, struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg, int *err)
{
@@ -882,7 +908,9 @@
char const *errmsg;
int err;
argv++;
- printf ("%ld\n", pex_win32_exec_child (NULL, PEX_SEARCH, argv[0], argv, NULL, 0, 0, 1, 2, &errmsg, &err));
+ /* LLVM LOCAL begin mainline */
+ printf ("%ld\n", (long) pex_win32_exec_child (NULL, PEX_SEARCH, argv[0], argv, NULL, 0, 0, 1, 2, &errmsg, &err));
+ /* LLVM LOCAL end mainline */
exit (0);
}
#endif
From asl at math.spbu.ru Tue Apr 29 01:22:10 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 29 Apr 2008 06:22:10 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50402 -
/llvm-gcc-4.2/trunk/gcc/config/i386/cygwin.asm
Message-ID: <200804290622.m3T6MAot006492@zion.cs.uiuc.edu>
Author: asl
Date: Tue Apr 29 01:22:09 2008
New Revision: 50402
URL: http://llvm.org/viewvc/llvm-project?rev=50402&view=rev
Log:
Backport from mainline.
Provide win64 version of __alloca()
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/cygwin.asm
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/cygwin.asm
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/cygwin.asm?rev=50402&r1=50401&r2=50402&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/cygwin.asm (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/cygwin.asm Tue Apr 29 01:22:09 2008
@@ -42,27 +42,97 @@
.global ___chkstk
.global __alloca
+/* LLVM LOCAL begin mainline */
+#ifndef _WIN64
___chkstk:
__alloca:
- pushl %ecx /* save temp */
- movl %esp,%ecx /* get sp */
- addl $0x8,%ecx /* and point to return addr */
-
-probe: cmpl $0x1000,%eax /* > 4k ?*/
- jb done
-
- subl $0x1000,%ecx /* yes, move pointer down 4k*/
- orl $0x0,(%ecx) /* probe there */
- subl $0x1000,%eax /* decrement count */
- jmp probe /* and do it again */
-
-done: subl %eax,%ecx
- orl $0x0,(%ecx) /* less that 4k, just peek here */
-
- movl %esp,%eax
- movl %ecx,%esp /* decrement stack */
-
- movl (%eax),%ecx /* recover saved temp */
- movl 4(%eax),%eax /* get return address */
- jmp *%eax
+ pushl %ecx /* save temp */
+ leal 8(%esp), %ecx /* point past return addr */
+ cmpl $0x1000, %eax /* > 4k ?*/
+ jb Ldone
+
+Lprobe:
+ subl $0x1000, %ecx /* yes, move pointer down 4k*/
+ orl $0x0, (%ecx) /* probe there */
+ subl $0x1000, %eax /* decrement count */
+ cmpl $0x1000, %eax
+ ja Lprobe /* and do it again */
+
+Ldone:
+ subl %eax, %ecx
+ orl $0x0, (%ecx) /* less than 4k, just peek here */
+
+ movl %esp, %eax /* save old stack pointer */
+ movl %ecx, %esp /* decrement stack */
+ movl (%eax), %ecx /* recover saved temp */
+ movl 4(%eax), %eax /* recover return address */
+
+ /* Push the return value back. Doing this instead of just
+ jumping to %eax preserves the cached call-return stack
+ used by most modern processors. */
+ pushl %eax
+ ret
+#else
+/* __alloca is a normal function call, which uses %rcx as the argument. And stack space
+ for the argument is saved. */
+__alloca:
+ movq %rcx, %rax
+ addq $0x7, %rax
+ andq $0xfffffffffffffff8, %rax
+ popq %rcx /* pop return address */
+ popq %r10 /* Pop the reserved stack space. */
+ movq %rsp, %r10 /* get sp */
+ cmpq $0x1000, %rax /* > 4k ?*/
+ jb Ldone_alloca
+
+Lprobe_alloca:
+ subq $0x1000, %r10 /* yes, move pointer down 4k*/
+ orq $0x0, (%r10) /* probe there */
+ subq $0x1000, %rax /* decrement count */
+ cmpq $0x1000, %rax
+ ja Lprobe_alloca /* and do it again */
+
+Ldone_alloca:
+ subq %rax, %r10
+ orq $0x0, (%r10) /* less than 4k, just peek here */
+ movq %r10, %rax
+ subq $0x8, %r10 /* Reserve argument stack space. */
+ movq %r10, %rsp /* decrement stack */
+
+ /* Push the return value back. Doing this instead of just
+ jumping to %rcx preserves the cached call-return stack
+ used by most modern processors. */
+ pushq %rcx
+ ret
+
+/* ___chkstk is a *special* function call, which uses %rax as the argument.
+ We avoid clobbering the 4 integer argument registers, %rcx, %rdx,
+ %r8 and %r9, which leaves us with %rax, %r10, and %r11 to use. */
+___chkstk:
+ addq $0x7, %rax /* Make sure stack is on alignment of 8. */
+ andq $0xfffffffffffffff8, %rax
+ popq %r11 /* pop return address */
+ movq %rsp, %r10 /* get sp */
+ cmpq $0x1000, %rax /* > 4k ?*/
+ jb Ldone
+
+Lprobe:
+ subq $0x1000, %r10 /* yes, move pointer down 4k*/
+ orl $0x0, (%r10) /* probe there */
+ subq $0x1000, %rax /* decrement count */
+ cmpq $0x1000, %rax
+ ja Lprobe /* and do it again */
+
+Ldone:
+ subq %rax, %r10
+ orl $0x0, (%r10) /* less than 4k, just peek here */
+ movq %r10, %rsp /* decrement stack */
+
+ /* Push the return value back. Doing this instead of just
+ jumping to %r11 preserves the cached call-return stack
+ used by most modern processors. */
+ pushq %r11
+ ret
+#endif
+/* LLVM LOCAL end mainline */
#endif
From asl at math.spbu.ru Tue Apr 29 01:22:43 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 29 Apr 2008 06:22:43 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50403 - in /llvm-gcc-4.2/trunk/gcc:
config/i386/gthr-win32.c gthr-win32.h
Message-ID: <200804290622.m3T6MhrB006518@zion.cs.uiuc.edu>
Author: asl
Date: Tue Apr 29 01:22:42 2008
New Revision: 50403
URL: http://llvm.org/viewvc/llvm-project?rev=50403&view=rev
Log:
Backport from mainline
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/gthr-win32.c
llvm-gcc-4.2/trunk/gcc/gthr-win32.h
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/gthr-win32.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/gthr-win32.c?rev=50403&r1=50402&r2=50403&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/gthr-win32.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/gthr-win32.c Tue Apr 29 01:22:42 2008
@@ -102,7 +102,10 @@
C++ EH. Mingw uses a thread-support DLL to work-around this problem. */
int
-__gthr_win32_key_create (__gthread_key_t *key, void (*dtor) (void *))
+__gthr_win32_key_create (__gthread_key_t *key,
+/* LLVM LOCAL begin mainline */
+ void (*dtor) (void *) __attribute__((unused)))
+/* LLVM LOCAL end mainline */
{
int status = 0;
DWORD tls_index = TlsAlloc ();
Modified: llvm-gcc-4.2/trunk/gcc/gthr-win32.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gthr-win32.h?rev=50403&r1=50402&r2=50403&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/gthr-win32.h (original)
+++ llvm-gcc-4.2/trunk/gcc/gthr-win32.h Tue Apr 29 01:22:42 2008
@@ -562,7 +562,10 @@
leaks, especially in threaded applications making extensive use of
C++ EH. Mingw uses a thread-support DLL to work-around this problem. */
static inline int
-__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
+__gthread_key_create (__gthread_key_t *key,
+/* LLVM LOCAL begin mainline */
+ void (*dtor) (void *) __attribute__((unused)))
+/* LLVM LOCAL end mainline */
{
int status = 0;
DWORD tls_index = TlsAlloc ();
From asl at math.spbu.ru Tue Apr 29 01:23:26 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 29 Apr 2008 06:23:26 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50404 - in /llvm-gcc-4.2/trunk/gcc:
c-format.c c-format.h config/i386/msformat-c.c doc/extend.texi doc/tm.texi
Message-ID: <200804290623.m3T6NRAB006547@zion.cs.uiuc.edu>
Author: asl
Date: Tue Apr 29 01:23:26 2008
New Revision: 50404
URL: http://llvm.org/viewvc/llvm-project?rev=50404&view=rev
Log:
Backport from mainine. Use MS-style for format specifiers.
Added:
llvm-gcc-4.2/trunk/gcc/config/i386/msformat-c.c
Modified:
llvm-gcc-4.2/trunk/gcc/c-format.c
llvm-gcc-4.2/trunk/gcc/c-format.h
llvm-gcc-4.2/trunk/gcc/doc/extend.texi
llvm-gcc-4.2/trunk/gcc/doc/tm.texi
Modified: llvm-gcc-4.2/trunk/gcc/c-format.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-format.c?rev=50404&r1=50403&r2=50404&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-format.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-format.c Tue Apr 29 01:23:26 2008
@@ -63,13 +63,13 @@
gcc_diag_format_type, gcc_tdiag_format_type,
gcc_cdiag_format_type,
gcc_cxxdiag_format_type, gcc_gfc_format_type,
- scanf_format_type, strftime_format_type,
/* APPLE LOCAL begin radar 4985544 */
- strfmon_format_type, nsstring_format_type,
- /* APPLE LOCAL radar 5096648 */
- cfstring_format_type,
- format_type_error = -1};
+ nsstring_format_type,
/* APPLE LOCAL end radar 4985544 */
+ /* APPLE LOCAL begin radar 5096648 */
+ cfstring_format_type,
+ /* APPLE LOCAL end radar 5096648 */
+ format_type_error = -1};
typedef struct function_format_info
{
@@ -87,6 +87,10 @@
static bool get_constant (tree expr, unsigned HOST_WIDE_INT *value,
int validated_p);
+/* LLVM LOCAL begin mainline */
+static const char *convert_format_name_to_system_name (const char *attr_name);
+static bool cmp_attribs (const char *tattr_name, const char *attr_name);
+/* LLVM LOCAL end mainline */
/* Handle a "format_arg" attribute; arguments as in
struct attribute_spec.handler. */
@@ -209,6 +213,10 @@
{
const char *p = IDENTIFIER_POINTER (format_type_id);
+ /* LLVM LOCAL begin mainline */
+ p = convert_format_name_to_system_name (p);
+ /* LLVM LOCAL end mainline */
+
info->format_type = decode_format_type (p);
/* APPLE LOCAL begin radar 4985544 */
@@ -725,7 +733,9 @@
/* This must be in the same order as enum format_type. */
static const format_kind_info format_types_orig[] =
{
- { "printf", printf_length_specs, print_char_table, " +#0-'I", NULL,
+ /* LLVM LOCAL begin mainline */
+ { "gnu_printf", printf_length_specs, print_char_table, " +#0-'I", NULL,
+ /* LLVM LOCAL end mainline */
printf_flag_specs, printf_flag_pairs,
FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK,
'w', 0, 'p', 0, 'L',
@@ -767,23 +777,29 @@
0, 0, 0, 0, 0,
NULL, NULL
},
- { "scanf", scanf_length_specs, scan_char_table, "*'I", NULL,
+ /* LLVM LOCAL begin mainline */
+ { "gnu_scanf", scanf_length_specs, scan_char_table, "*'I", NULL,
+ /* LLVM LOCAL end mainline */
scanf_flag_specs, scanf_flag_pairs,
FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK,
'w', 0, 0, '*', 'L',
NULL, NULL
},
- { "strftime", NULL, time_char_table, "_-0^#", "EO",
+ /* LLVM LOCAL begin mainline */
+ { "gnu_strftime", NULL, time_char_table, "_-0^#", "EO",
+ /* LLVM LOCAL end mainline */
strftime_flag_specs, strftime_flag_pairs,
FMT_FLAG_FANCY_PERCENT_OK, 'w', 0, 0, 0, 0,
NULL, NULL
},
- { "strfmon", strfmon_length_specs, monetary_char_table, "=^+(!-", NULL,
+ /* LLVM LOCAL begin mainline */
+ { "gnu_strfmon", strfmon_length_specs, monetary_char_table, "=^+(!-", NULL,
+ /* LLVM LOCAL end mainline */
strfmon_flag_specs, strfmon_flag_pairs,
FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L',
NULL, NULL
-/* APPLE LOCAL begin radar 4985544 */
},
+ /* APPLE LOCAL begin radar 4985544 */
{ "NSString", NULL, NULL, NULL, NULL,
NULL, NULL,
FMT_FLAG_ARG_CONVERT, 0, 0, 0, 0, 0,
@@ -871,6 +887,10 @@
{
int i;
int slen;
+
+ /* LLVM LOCAL begin mainline */
+ s = convert_format_name_to_system_name (s);
+ /* LLVM LOCAL end mainline */
slen = strlen (s);
for (i = 0; i < n_format_types; i++)
{
@@ -1805,8 +1825,25 @@
length_chars_std = STD_C89;
if (fli)
{
+ /* LLVM LOCAL begin mainline */
while (fli->name != 0 && fli->name[0] != *format_chars)
- fli++;
+ {
+ if (fli->name[0] == '\0')
+ {
+ int si = strlen (fli->name + 1) + 1;
+ int i = 1;
+ while (fli->name[i] != 0 && fli->name[i] == format_chars [i - 1])
+ ++i;
+ if (si == i)
+ {
+ if (si > 2)
+ format_chars += si - 2;
+ break;
+ }
+ }
+ fli++;
+ }
+ /* LLVM LOCAL end mainline */
if (fli->name != 0)
{
format_chars++;
@@ -2748,6 +2785,86 @@
extern const format_kind_info TARGET_FORMAT_TYPES[];
#endif
+/* LLVM LOCAL begin mainline */
+#ifdef TARGET_OVERRIDES_FORMAT_ATTRIBUTES
+extern const target_ovr_attr TARGET_OVERRIDES_FORMAT_ATTRIBUTES[];
+#endif
+
+/* Attributes such as "printf" are equivalent to those such as
+ "gnu_printf" unless this is overridden by a target. */
+static const target_ovr_attr gnu_target_overrides_format_attributes[] =
+{
+ { "gnu_printf", "printf" },
+ { "gnu_scanf", "scanf" },
+ { "gnu_strftime", "strftime" },
+ { "gnu_strfmon", "strfmon" },
+ { NULL, NULL }
+};
+
+/* Translate to unified attribute name. This is used in decode_format_type and
+ decode_format_attr. In attr_name the user specified argument is passed. It
+ returns the unified format name from TARGET_OVERRIDES_FORMAT_ATTRIBUTES
+ or the attr_name passed to this function, if there is no matching entry. */
+static const char *
+convert_format_name_to_system_name (const char *attr_name)
+{
+ int i;
+
+ if (attr_name == NULL || *attr_name == 0
+ || strncmp (attr_name, "gcc_", 4) == 0)
+ return attr_name;
+
+#ifdef TARGET_OVERRIDES_FORMAT_ATTRIBUTES
+ /* Check if format attribute is overridden by target. */
+ if (TARGET_OVERRIDES_FORMAT_ATTRIBUTES != NULL
+ && TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT > 0)
+ {
+ for (i = 0; i < TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT; ++i)
+ {
+ if (cmp_attribs (TARGET_OVERRIDES_FORMAT_ATTRIBUTES[i].named_attr_src,
+ attr_name))
+ return attr_name;
+ if (cmp_attribs (TARGET_OVERRIDES_FORMAT_ATTRIBUTES[i].named_attr_dst,
+ attr_name))
+ return TARGET_OVERRIDES_FORMAT_ATTRIBUTES[i].named_attr_src;
+ }
+ }
+#endif
+ /* Otherwise default to gnu format. */
+ for (i = 0;
+ gnu_target_overrides_format_attributes[i].named_attr_src != NULL;
+ ++i)
+ {
+ if (cmp_attribs (gnu_target_overrides_format_attributes[i].named_attr_src,
+ attr_name))
+ return attr_name;
+ if (cmp_attribs (gnu_target_overrides_format_attributes[i].named_attr_dst,
+ attr_name))
+ return gnu_target_overrides_format_attributes[i].named_attr_src;
+ }
+
+ return attr_name;
+}
+
+/* Return true if TATTR_NAME and ATTR_NAME are the same format attribute,
+ counting "name" and "__name__" as the same, false otherwise. */
+static bool
+cmp_attribs (const char *tattr_name, const char *attr_name)
+{
+ int alen = strlen (attr_name);
+ int slen = (tattr_name ? strlen (tattr_name) : 0);
+ if (alen > 4 && attr_name[0] == '_' && attr_name[1] == '_'
+ && attr_name[alen - 1] == '_' && attr_name[alen - 2] == '_')
+ {
+ attr_name += 2;
+ alen -= 4;
+ }
+ if (alen != slen || strncmp (tattr_name, attr_name, alen) != 0)
+ return false;
+ return true;
+}
+/* LLVM LOCAL end mainline */
+
/* Handle a "format" attribute; arguments as in
struct attribute_spec.handler. */
tree
@@ -2822,7 +2939,12 @@
}
}
- if (info.format_type == strftime_format_type && info.first_arg_num != 0)
+ /* LLVM LOCAL begin mainline */
+ /* Check if this is a strftime variant. Just for this variant
+ FMT_FLAG_ARG_CONVERT is not set. */
+ if ((format_types[info.format_type].flags & (int) FMT_FLAG_ARG_CONVERT) == 0
+ && info.first_arg_num != 0)
+ /* LLVM LOCAL end mainline */
{
error ("strftime formats cannot format arguments");
*no_add_attrs = true;
Modified: llvm-gcc-4.2/trunk/gcc/c-format.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-format.h?rev=50404&r1=50403&r2=50404&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-format.h (original)
+++ llvm-gcc-4.2/trunk/gcc/c-format.h Tue Apr 29 01:23:26 2008
@@ -81,12 +81,15 @@
of whether length modifiers can occur (length_char_specs). */
};
-
/* Structure describing a length modifier supported in format checking, and
possibly a doubled version such as "hh". */
typedef struct
{
- /* Name of the single-character length modifier. */
+ /* LLVM LOCAL begin mainline */
+ /* Name of the single-character length modifier. If prefixed by
+ a zero character, it describes a multi character length
+ modifier, like I64, I32, etc. */
+ /* LLVM LOCAL end mainline */
const char *name;
/* Index into a format_char_info.types array. */
enum format_lengths index;
@@ -305,4 +308,18 @@
#define T_D128 &dfloat128_type_node
#define TEX_D128 { STD_EXT, "_Decimal128", T_D128 }
+/* LLVM LOCAL begin mainline */
+/* Structure describing how format attributes such as "printf" are
+ interpreted as "gnu_printf" or "ms_printf" on a particular system.
+ TARGET_OVERRIDES_FORMAT_ATTRIBUTES is used to specify target-specific
+ defaults. */
+typedef struct
+{
+ /* The name of the to be copied format attribute. */
+ const char *named_attr_src;
+ /* The name of the to be overridden format attribute. */
+ const char *named_attr_dst;
+} target_ovr_attr;
+/* LLVM LOCAL end mainline */
+
#endif /* GCC_C_FORMAT_H */
Added: llvm-gcc-4.2/trunk/gcc/config/i386/msformat-c.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/msformat-c.c?rev=50404&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/msformat-c.c (added)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/msformat-c.c Tue Apr 29 01:23:26 2008
@@ -0,0 +1,175 @@
+/* Check calls to formatted I/O functions (-Wformat).
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+ . */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "flags.h"
+#include "c-common.h"
+#include "toplev.h"
+#include "intl.h"
+#include "diagnostic.h"
+#include "langhooks.h"
+#include "c-format.h"
+#include "alloc-pool.h"
+
+/* Mingw specific format attributes ms_printf, ms_scanf, and ms_strftime. */
+
+static const format_length_info ms_printf_length_specs[] =
+{
+ { "h", FMT_LEN_h, STD_C89, NULL, 0, 0 },
+ { "l", FMT_LEN_l, STD_C89, NULL, 0, 0 },
+ { "I32", FMT_LEN_l, STD_EXT, NULL, 0, 0 },
+ { "I64", FMT_LEN_ll, STD_EXT, NULL, 0, 0 },
+ { "I", FMT_LEN_L, STD_EXT, NULL, 0, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+};
+
+static const format_flag_spec ms_printf_flag_specs[] =
+{
+ { ' ', 0, 0, N_("' ' flag"), N_("the ' ' printf flag"), STD_C89 },
+ { '+', 0, 0, N_("'+' flag"), N_("the '+' printf flag"), STD_C89 },
+ { '#', 0, 0, N_("'#' flag"), N_("the '#' printf flag"), STD_C89 },
+ { '0', 0, 0, N_("'0' flag"), N_("the '0' printf flag"), STD_C89 },
+ { '-', 0, 0, N_("'-' flag"), N_("the '-' printf flag"), STD_C89 },
+ { '\'', 0, 0, N_("''' flag"), N_("the ''' printf flag"), STD_EXT },
+ { 'w', 0, 0, N_("field width"), N_("field width in printf format"), STD_C89 },
+ { 'p', 0, 0, N_("precision"), N_("precision in printf format"), STD_C89 },
+ { 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 },
+ { 0, 0, 0, NULL, NULL, 0 }
+};
+
+static const format_flag_pair ms_printf_flag_pairs[] =
+{
+ { ' ', '+', 1, 0 },
+ { '0', '-', 1, 0 }, { '0', 'p', 1, 'i' },
+ { 0, 0, 0, 0 }
+};
+
+static const format_flag_spec ms_scanf_flag_specs[] =
+{
+ { '*', 0, 0, N_("assignment suppression"), N_("the assignment suppression scanf feature"), STD_C89 },
+ { 'a', 0, 0, N_("'a' flag"), N_("the 'a' scanf flag"), STD_EXT },
+ { 'w', 0, 0, N_("field width"), N_("field width in scanf format"), STD_C89 },
+ { 'L', 0, 0, N_("length modifier"), N_("length modifier in scanf format"), STD_C89 },
+ { '\'', 0, 0, N_("''' flag"), N_("the ''' scanf flag"), STD_EXT },
+ { 0, 0, 0, NULL, NULL, 0 }
+};
+
+static const format_flag_pair ms_scanf_flag_pairs[] =
+{
+ { '*', 'L', 0, 0 },
+ { 0, 0, 0, 0 }
+};
+
+static const format_flag_spec ms_strftime_flag_specs[] =
+{
+ { '#', 0, 0, N_("'#' flag"), N_("the '#' strftime flag"), STD_EXT },
+ { 0, 0, 0, NULL, NULL, 0 }
+};
+
+static const format_flag_pair ms_strftime_flag_pairs[] =
+{
+ { 0, 0, 0, 0 }
+};
+
+static const format_char_info ms_print_char_table[] =
+{
+ /* C89 conversion specifiers. */
+ { "di", 0, STD_C89, { T89_I, BADLEN, T89_S, T89_L, T9L_LL, T99_SST, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +'", "i", NULL },
+ { "oxX", 0, STD_C89, { T89_UI, BADLEN, T89_US, T89_UL, T9L_ULL, T99_ST, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0#", "i", NULL },
+ { "u", 0, STD_C89, { T89_UI, BADLEN, T89_US, T89_UL, T9L_ULL, T99_ST, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0'", "i", NULL },
+ { "fgG", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#'", "", NULL },
+ { "eE", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "", NULL },
+ { "c", 0, STD_C89, { T89_I, BADLEN, T89_S, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
+ { "s", 1, STD_C89, { T89_C, BADLEN, T89_S, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL },
+ { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c", NULL },
+ { "n", 1, STD_C89, { T89_I, BADLEN, T89_S, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, T99_IM, BADLEN, BADLEN, BADLEN }, "", "W", NULL },
+ /* X/Open conversion specifiers. */
+ { "C", 0, STD_EXT, { TEX_WI, BADLEN, T89_S, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
+ { "S", 1, STD_EXT, { TEX_W, BADLEN, T89_S, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R", NULL },
+ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL }
+};
+
+static const format_char_info ms_scan_char_table[] =
+{
+ /* C89 conversion specifiers. */
+ { "di", 1, STD_C89, { T89_I, BADLEN, T89_S, T89_L, T9L_LL, T99_SST, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w'", "W", NULL },
+ { "u", 1, STD_C89, { T89_UI, BADLEN, T89_US, T89_UL, T9L_ULL, T99_ST, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w'", "W", NULL },
+ { "oxX", 1, STD_C89, { T89_UI, BADLEN, T89_US, T89_UL, T9L_ULL, T99_ST, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w", "W", NULL },
+ { "efgEG", 1, STD_C89, { T89_F, BADLEN, BADLEN, T89_D, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w'", "W", NULL },
+ { "c", 1, STD_C89, { T89_C, BADLEN, T89_S, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w", "cW", NULL },
+ { "s", 1, STD_C89, { T89_C, BADLEN, T89_S, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*aw", "cW", NULL },
+ { "[", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*aw", "cW[", NULL },
+ { "p", 2, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w", "W", NULL },
+ { "n", 1, STD_C89, { T89_I, BADLEN, T89_S, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "W", NULL },
+ /* X/Open conversion specifiers. */
+ { "C", 1, STD_EXT, { TEX_W, BADLEN, T89_S, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w", "W", NULL },
+ { "S", 1, STD_EXT, { TEX_W, BADLEN, T89_S, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*aw", "W", NULL },
+ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL }
+};
+
+static const format_char_info ms_time_char_table[] =
+{
+ /* C89 conversion specifiers. */
+ { "ABZab", 0, STD_C89, NOLENGTHS, "#", "", NULL },
+ { "cx", 0, STD_C89, NOLENGTHS, "#", "3", NULL },
+ { "HIMSUWdmw", 0, STD_C89, NOLENGTHS, "#", "", NULL },
+ { "j", 0, STD_C89, NOLENGTHS, "#", "", NULL },
+ { "p", 0, STD_C89, NOLENGTHS, "#", "", NULL },
+ { "X", 0, STD_C89, NOLENGTHS, "#", "", NULL },
+ { "y", 0, STD_C89, NOLENGTHS, "#", "4", NULL },
+ { "Y", 0, STD_C89, NOLENGTHS, "#", "", NULL },
+ { "%", 0, STD_C89, NOLENGTHS, "", "", NULL },
+ /* C99 conversion specifiers. */
+ { "z", 0, STD_C99, NOLENGTHS, "#", "", NULL },
+ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL }
+};
+
+const format_kind_info mingw_format_attributes[3] =
+{
+ { "ms_printf", ms_printf_length_specs, ms_print_char_table, " +#0-'", NULL,
+ ms_printf_flag_specs, ms_printf_flag_pairs,
+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK,
+ 'w', 0, 'p', 0, 'L',
+ &integer_type_node, &integer_type_node
+ },
+ { "ms_scanf", ms_printf_length_specs, ms_scan_char_table, "*'", NULL,
+ ms_scanf_flag_specs, ms_scanf_flag_pairs,
+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK,
+ 'w', 0, 0, '*', 'L',
+ NULL, NULL
+ },
+ { "ms_strftime", NULL, ms_time_char_table, "", "#",
+ ms_strftime_flag_specs, ms_strftime_flag_pairs,
+ FMT_FLAG_FANCY_PERCENT_OK, 0, 0, 0, 0, 0,
+ NULL, NULL
+ }
+};
+
+/* Default overrides for printf, scanf and strftime. */
+const target_ovr_attr mingw_format_attribute_overrides[4] =
+{
+ { "ms_printf", "printf" },
+ { "ms_scanf", "scanf" },
+ { "ms_strftime", "strftime" }
+};
Modified: llvm-gcc-4.2/trunk/gcc/doc/extend.texi
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/extend.texi?rev=50404&r1=50403&r2=50404&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/doc/extend.texi (original)
+++ llvm-gcc-4.2/trunk/gcc/doc/extend.texi Tue Apr 29 01:23:26 2008
@@ -1914,20 +1914,31 @@
for consistency with the @code{printf} style format string argument
@code{my_format}.
+ at c LLVM LOCAL begin mainline
The parameter @var{archetype} determines how the format string is
-interpreted, and should be @code{printf}, @code{scanf}, @code{strftime}
-or @code{strfmon}. (You can also use @code{__printf__},
- at code{__scanf__}, @code{__strftime__} or @code{__strfmon__}.) The
-parameter @var{string-index} specifies which argument is the format
-string argument (starting from 1), while @var{first-to-check} is the
-number of the first argument to check against the format string. For
-functions where the arguments are not available to be checked (such as
+interpreted, and should be @code{printf}, @code{scanf}, @code{strftime},
+ at code{gnu_printf}, @code{gnu_scanf}, @code{gnu_strftime} or
+ at code{strfmon}. (You can also use @code{__printf__},
+ at code{__scanf__}, @code{__strftime__} or @code{__strfmon__}.) On
+MinGW targets, @code{ms_printf}, @code{ms_scanf}, and
+ at code{ms_strftime} are also present.
+ at var{archtype} values such as @code{printf} refer to the formats accepted
+by the system's C run-time library, while @code{gnu_} values always refer
+to the formats accepted by the GNU C Library. On Microsoft Windows
+targets, @code{ms_} values refer to the formats accepted by the
+ at file{msvcrt.dll} library.
+The parameter @var{string-index}
+specifies which argument is the format string argument (starting
+from 1), while @var{first-to-check} is the number of the first
+argument to check against the format string. For functions
+where the arguments are not available to be checked (such as
@code{vprintf}), specify the third parameter as zero. In this case the
compiler only checks the format string for consistency. For
@code{strftime} formats, the third parameter is required to be zero.
Since non-static C++ methods have an implicit @code{this} argument, the
arguments of such methods should be counted from two, not one, when
giving values for @var{string-index} and @var{first-to-check}.
+ at c LLVM LOCAL end mainline
In the example above, the format string (@code{my_format}) is the second
argument of the function @code{my_print}, and the arguments to check
Modified: llvm-gcc-4.2/trunk/gcc/doc/tm.texi
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/tm.texi?rev=50404&r1=50403&r2=50404&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/doc/tm.texi (original)
+++ llvm-gcc-4.2/trunk/gcc/doc/tm.texi Tue Apr 29 01:23:26 2008
@@ -9944,6 +9944,20 @@
@code{TARGET_FORMAT_TYPES}.
@end defmac
+ at c LLVM LOCAL begin mainline
+ at defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES
+If defined, this macro is the name of a global variable containing
+target-specific format overrides for the @option{-Wformat} option. The
+default is to have no target-specific format overrides. If defined,
+ at code{TARGET_FORMAT_TYPES} must be defined, too.
+ at end defmac
+
+ at defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT
+If defined, this macro specifies the number of entries in
+ at code{TARGET_OVERRIDES_FORMAT_ATTRIBUTES}.
+ at end defmac
+ at c LLVM LOCAL end mainline
+
@deftypefn {Target Hook} bool TARGET_RELAXED_ORDERING
If set to @code{true}, means that the target's memory model does not
guarantee that loads which do not depend on one another will access
From asl at math.spbu.ru Tue Apr 29 01:24:14 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 29 Apr 2008 06:24:14 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50405 - in
/llvm-gcc-4.2/trunk/gcc/config/i386: cygming.h i386.c i386.h i386elf.h
mingw32.h unix.h
Message-ID: <200804290624.m3T6OEYg006600@zion.cs.uiuc.edu>
Author: asl
Date: Tue Apr 29 01:24:14 2008
New Revision: 50405
URL: http://llvm.org/viewvc/llvm-project?rev=50405&view=rev
Log:
Backport from mainline.
Finally add necessary bits for win64
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h
llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h
llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h
llvm-gcc-4.2/trunk/gcc/config/i386/unix.h
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h Tue Apr 29 01:24:14 2008
@@ -21,22 +21,43 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+/* LLVM LOCAL begin mainline */
+#if TARGET_64BIT_DEFAULT
+#ifndef DWARF2_DEBUGGING_INFO
+#define DWARF2_DEBUGGING_INFO 1
+#endif
+#ifndef DWARF2_UNWIND_INFO
+#define DWARF2_UNWIND_INFO 1
+#endif
+#endif
+/* LLVM LOCAL end mainline */
+
#define DBX_DEBUGGING_INFO 1
#define SDB_DEBUGGING_INFO 1
#undef PREFERRED_DEBUGGING_TYPE
+/* LLVM LOCAL begin mainline */
+#if TARGET_64BIT_DEFAULT
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+#else
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#endif
+
+#undef TARGET_64BIT_MS_ABI
+#define TARGET_64BIT_MS_ABI TARGET_64BIT
+/* LLVM LOCAL end mainline */
#ifdef HAVE_GAS_PE_SECREL32_RELOC
#define DWARF2_DEBUGGING_INFO 1
-/* LLVM LOCAL begin mainline 125696 */
+/* LLVM LOCAL begin mainline */
/* Map gcc register number to DBX register number. Maintain
compatibility with old -gstabs compiled code. */
-/* LLVM LOCAL end mainline 125696 */
#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) (write_symbols == DWARF2_DEBUG \
- ? svr4_dbx_register_map[n] \
- : dbx_register_map[n])
+#define DBX_REGISTER_NUMBER(n) \
+ (TARGET_64BIT ? dbx64_register_map[n] \
+ : (write_symbols == DWARF2_DEBUG \
+ ? svr4_dbx_register_map[n] : dbx_register_map[n]))
+/* LLVM LOCAL end mainline */
/* LLVM LOCAL begin mainline 125696 */
/* Map gcc register number to DWARF 2 CFA column number. Always
@@ -109,14 +130,37 @@
#undef MATH_LIBRARY
#define MATH_LIBRARY ""
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
+/* LLVM LOCAL begin mainline */
+#define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
+#define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int")
+
#define WCHAR_TYPE_SIZE 16
#define WCHAR_TYPE "short unsigned int"
+/* Windows64 continues to use a 32-bit long type. */
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 32
+
+#undef REG_PARM_STACK_SPACE
+#define REG_PARM_STACK_SPACE(FNDECL) (TARGET_64BIT_MS_ABI ? 32 : 0)
+
+#undef OUTGOING_REG_PARM_STACK_SPACE
+#define OUTGOING_REG_PARM_STACK_SPACE (TARGET_64BIT_MS_ABI ? 1 : 0)
+
+#undef REGPARM_MAX
+#define REGPARM_MAX (TARGET_64BIT_MS_ABI ? 4 : 3)
+
+#undef SSE_REGPARM_MAX
+#define SSE_REGPARM_MAX (TARGET_64BIT_MS_ABI ? 4 : TARGET_SSE ? 3 : 0)
+/* LLVM LOCAL end mainline */
+
/* Enable parsing of #pragma pack(push,) and #pragma pack(pop). */
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
+/* LLVM LOCAL begin mainline */
+/* Enable push_macro & pop_macro */
+#define HANDLE_PRAGMA_PUSH_POP_MACRO 1
+/* LLVM LOCAL end mainline */
union tree_node;
#define TREE union tree_node *
@@ -202,14 +246,21 @@
#define CHECK_STACK_LIMIT 4000
+/* LLVM LOCAL begin mainline */
+#undef STACK_BOUNDARY
+#define STACK_BOUNDARY (TARGET_64BIT_MS_ABI ? 128 : BITS_PER_WORD)
+/* LLVM LOCAL end mainline */
+
/* By default, target has a 80387, uses IEEE compatible arithmetic,
returns float values in the 387 and needs stack probes.
We also align doubles to 64-bits for MSVC default compatibility. */
+/* LLVM LOCAL begin mainline */
#undef TARGET_SUBTARGET_DEFAULT
#define TARGET_SUBTARGET_DEFAULT \
- (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE \
- | MASK_ALIGN_DOUBLE)
+ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \
+ | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE)
+/* LLVM LOCAL end mainline */
/* This is how to output an assembler line
that says to advance the location counter
@@ -393,9 +444,11 @@
#undef TARGET_USE_LOCAL_THUNK_ALIAS_P
#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!DECL_ONE_ONLY (DECL))
+/* LLVM LOCAL begin mainline */
#define SUBTARGET_ATTRIBUTE_TABLE \
- /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ \
{ "selectany", 0, 0, true, false, false, ix86_handle_selectany_attribute }
+ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
+/* LLVM LOCAL end mainline */
/* mcount() does not need a counter variable. */
#undef NO_PROFILE_COUNTERS
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Tue Apr 29 01:24:14 2008
@@ -1443,6 +1443,10 @@
#define TARGET_INTERNAL_ARG_POINTER ix86_internal_arg_pointer
#undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
#define TARGET_DWARF_HANDLE_FRAME_UNSPEC ix86_dwarf_handle_frame_unspec
+/* LLVM LOCAL begin mainline */
+#undef TARGET_STRICT_ARGUMENT_NAMING
+#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true
+/* LLVM LOCAL end mainline */
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR ix86_gimplify_va_arg
@@ -1776,9 +1780,18 @@
}
else
{
- ix86_cmodel = CM_32;
- if (TARGET_64BIT)
+ /* LLVM LOCAL begin mainline */
+ /* For TARGET_64BIT_MS_ABI, force pic on, in order to enable the
+ use of rip-relative addressing. This eliminates fixups that
+ would otherwise be needed if this object is to be placed in a
+ DLL, and is essentially just as efficient as direct addressing. */
+ if (TARGET_64BIT_MS_ABI)
+ ix86_cmodel = CM_SMALL_PIC, flag_pic = 1;
+ else if (TARGET_64BIT)
ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;
+ else
+ ix86_cmodel = CM_32;
+ /* LLVM LOCAL end mainline */
}
if (ix86_asm_string != 0)
{
@@ -1894,15 +1907,20 @@
/* Validate -mregparm= value. */
if (ix86_regparm_string)
{
+ /* LLVM LOCAL begin mainline */
+ if (TARGET_64BIT)
+ warning (0, "-mregparm is ignored in 64-bit mode");
+ /* LLVM LOCAL end mainline */
i = atoi (ix86_regparm_string);
if (i < 0 || i > REGPARM_MAX)
error ("-mregparm=%d is not between 0 and %d", i, REGPARM_MAX);
else
ix86_regparm = i;
}
- else
- if (TARGET_64BIT)
- ix86_regparm = REGPARM_MAX;
+ /* LLVM LOCAL begin mainline */
+ if (TARGET_64BIT)
+ ix86_regparm = REGPARM_MAX;
+ /* LLVM LOCAL end mainline */
/* If the user has provided any of the -malign-* options,
warn and use that value only if -falign-* is not set.
@@ -1996,8 +2014,6 @@
/* APPLE LOCAL begin mainline */
if (TARGET_64BIT)
{
- if (TARGET_ALIGN_DOUBLE)
- error ("-malign-double makes no sense in the 64bit mode");
if (TARGET_RTD)
error ("-mrtd calling convention not supported in the 64bit mode");
/* APPLE LOCAL begin radar 4877693 */
@@ -2697,8 +2713,12 @@
if (TARGET_64BIT)
{
- warning (OPT_Wattributes, "%qs attribute ignored",
- IDENTIFIER_POINTER (name));
+ /* LLVM LOCAL begin mainline */
+ /* Do not warn when emulating the MS ABI. */
+ if (!TARGET_64BIT_MS_ABI)
+ warning (OPT_Wattributes, "%qs attribute ignored",
+ IDENTIFIER_POINTER (name));
+ /* LLVM LOCAL end mainline */
*no_add_attrs = true;
return NULL_TREE;
}
@@ -4056,23 +4076,44 @@
the argument itself. The pointer is passed in whatever way is
appropriate for passing a pointer to that type. */
+/* LLVM LOCAL begin mainline */
static bool
ix86_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
tree type, bool named ATTRIBUTE_UNUSED)
{
- if (!TARGET_64BIT)
- return 0;
-
- if (type && int_size_in_bytes (type) == -1)
+ /* See Windows x64 Software Convention. */
+ if (TARGET_64BIT_MS_ABI)
{
- if (TARGET_DEBUG_ARG)
- fprintf (stderr, "function_arg_pass_by_reference\n");
- return 1;
+ int msize = (int) GET_MODE_SIZE (mode);
+ if (type)
+ {
+ /* Arrays are passed by reference. */
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ return true;
+
+ if (AGGREGATE_TYPE_P (type))
+ {
+ /* Structs/unions of sizes other than 8, 16, 32, or 64 bits
+ are passed by reference. */
+ msize = int_size_in_bytes (type);
+ }
+ }
+
+ /* __m128 is passed by reference. */
+ switch (msize) {
+ case 1: case 2: case 4: case 8:
+ break;
+ default:
+ return true;
+ }
}
+ else if (TARGET_64BIT && type && int_size_in_bytes (type) == -1)
+ return 1;
return 0;
}
+/* LLVM LOCAL end mainline */
/* Return true when TYPE should be 128bit aligned for 32bit argument passing
ABI. Only called if TARGET_SSE. */
@@ -19708,7 +19749,7 @@
{
int tmp_regno = 2 /* ECX */;
if (lookup_attribute ("fastcall",
- TYPE_ATTRIBUTES (TREE_TYPE (function))))
+ TYPE_ATTRIBUTES (TREE_TYPE (function))))
tmp_regno = 0 /* EAX */;
tmp = gen_rtx_REG (SImode, tmp_regno);
}
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Tue Apr 29 01:24:14 2008
@@ -306,6 +306,12 @@
it's analogous to similar code for Mach-O on PowerPC. darwin.h
redefines this to 1. */
#define TARGET_MACHO 0
+
+/* LLVM LOCAL begin mainline */
+/* Likewise, for the Windows 64-bit ABI. */
+#define TARGET_64BIT_MS_ABI 0
+/* LLVM LOCAL end mainline */
+
/* APPLE LOCAL begin mach-o cleanup */
#define MACHOPIC_INDIRECT 0
#define MACHOPIC_PURE 0
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h Tue Apr 29 01:24:14 2008
@@ -27,11 +27,6 @@
#define TARGET_VERSION fprintf (stderr, " (i386 bare ELF target)");
-/* By default, target has a 80387, uses IEEE compatible arithmetic,
- and returns float values in the 387. */
-
-#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
-
/* The ELF ABI for the i386 says that records and unions are returned
in memory. */
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h Tue Apr 29 01:24:14 2008
@@ -20,10 +20,18 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+/* LLVM LOCAL begin mainline */
#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (x86 MinGW)");
+#if TARGET_64BIT_DEFAULT
+#define TARGET_VERSION fprintf (stderr,"(x86_64 MinGW");
+#else
+#define TARGET_VERSION fprintf (stderr," (x86 MinGW)");
+#endif
+/* LLVM LOCAL end mainline */
-/* See i386/crtdll.h for an alternative definition. */
+/* LLVM LOCAL begin mainline */
+/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
+ is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
do \
{ \
@@ -32,13 +40,28 @@
builtin_define ("_WIN32"); \
builtin_define_std ("WIN32"); \
builtin_define_std ("WINNT"); \
+ builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
+ TYPE_PRECISION (intmax_type_node));\
+ if (TARGET_64BIT_MS_ABI) \
+ { \
+ builtin_define ("__MINGW64__"); \
+ builtin_define_std ("WIN64"); \
+ builtin_define_std ("_WIN64"); \
+ } \
} \
while (0)
+/* LLVM LOCAL end mainline */
/* Override the standard choice of /usr/include as the default prefix
to try when searching for header files. */
#undef STANDARD_INCLUDE_DIR
+/* LLVM LOCAL begin mainline */
+#if TARGET_64BIT_DEFAULT
+#define STANDARD_INCLUDE_DIR "/mingw/include64"
+#else
#define STANDARD_INCLUDE_DIR "/mingw/include"
+#endif
+/* LLVM LOCAL end mainline */
#undef STANDARD_INCLUDE_COMPONENT
#define STANDARD_INCLUDE_COMPONENT "MINGW"
@@ -78,8 +101,14 @@
/* Override startfile prefix defaults. */
#ifndef STANDARD_STARTFILE_PREFIX_1
+/* LLVM LOCAL begin mainline */
+#if TARGET_64BIT_DEFAULT
+#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib64/"
+#else
#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
#endif
+/* LLVM LOCAL end mainline */
+#endif
#ifndef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_2 ""
#endif
@@ -121,10 +150,48 @@
#define GOMP_SELF_SPECS "%{fopenmp: -mthreads}"
-/* LLVM LOCAL begin mainline 125696 */
-/* This works on mingw32. */
-#undef TARGET_USE_JCR_SECTION
-#define TARGET_USE_JCR_SECTION 1
+/* LLVM LOCAL begin mainline */
+/* Contains a pointer to type target_ovr_attr defining the target specific
+ overrides of format attributes. See c-format.h for structure
+ definition. */
+#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES
+#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES mingw_format_attribute_overrides
+
+/* Specify the count of elements in TARGET_OVERRIDES_ATTRIBUTE. */
+#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT
+#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT 3
+
+/* MS specific format attributes for ms_printf, ms_scanf, ms_strftime. */
+#undef TARGET_FORMAT_TYPES
+#define TARGET_FORMAT_TYPES mingw_format_attributes
+
+#undef TARGET_N_FORMAT_TYPES
+#define TARGET_N_FORMAT_TYPES 3
+
+#define TARGET_USE_JCR_SECTION 0
+
+#undef MINGW_ENABLE_EXECUTE_STACK
+#define MINGW_ENABLE_EXECUTE_STACK \
+extern void __enable_execute_stack (void *); \
+void \
+__enable_execute_stack (void *addr) \
+{ \
+ MEMORY_BASIC_INFORMATION b; \
+ if (!VirtualQuery (addr, &b, sizeof(b))) \
+ abort (); \
+ VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, \
+ &b.Protect); \
+}
+
+#undef ENABLE_EXECUTE_STACK
+#define ENABLE_EXECUTE_STACK MINGW_ENABLE_EXECUTE_STACK
+
+#ifdef IN_LIBGCC2
+#include
+#endif
+
+#if !TARGET_64BIT
#define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
-/* LLVM LOCAL end mainline 125696 */
+#endif
+/* LLVM LOCAL end mainline */
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/unix.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/unix.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/unix.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/unix.h Tue Apr 29 01:24:14 2008
@@ -61,5 +61,12 @@
/* By default, target has a 80387, uses IEEE compatible arithmetic,
and returns float values in the 387. */
+/* LLVM LOCAL begin mainline */
+#define TARGET_SUBTARGET_DEFAULT \
+ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
-#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
+/* By default, 64-bit mode uses 128-bit long double. */
+#undef TARGET_SUBTARGET64_DEFAULT
+#define TARGET_SUBTARGET64_DEFAULT \
+ MASK_128BIT_LONG_DOUBLE
+/* LLVM LOCAL end mainline */
From resistor at mac.com Tue Apr 29 01:34:56 2008
From: resistor at mac.com (Owen Anderson)
Date: Tue, 29 Apr 2008 06:34:56 -0000
Subject: [llvm-commits] [llvm] r50406 -
/llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
Message-ID: <200804290634.m3T6YuaF006914@zion.cs.uiuc.edu>
Author: resistor
Date: Tue Apr 29 01:34:55 2008
New Revision: 50406
URL: http://llvm.org/viewvc/llvm-project?rev=50406&view=rev
Log:
Clarify what we mean by a dead loop.
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp?rev=50406&r1=50405&r2=50406&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadLoopElimination.cpp Tue Apr 29 01:34:55 2008
@@ -126,6 +126,10 @@
return true;
}
+/// runOnLoop - Remove dead loops, by which we mean loops that do not impact the
+/// observable behavior of the program other than finite running time. Note
+/// we do ensure that this never remove a loop that might be infinite, as doing
+/// so could change the halting/non-halting nature of a program.
bool DeadLoopElimination::runOnLoop(Loop* L, LPPassManager& LPM) {
// Don't remove loops for which we can't solve the trip count.
// They could be infinite, in which case we'd be changing program behavior.
From evan.cheng at apple.com Tue Apr 29 01:46:11 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 29 Apr 2008 06:46:11 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r50407 -
/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Message-ID: <200804290646.m3T6kBOt007200@zion.cs.uiuc.edu>
Author: evancheng
Date: Tue Apr 29 01:46:11 2008
New Revision: 50407
URL: http://llvm.org/viewvc/llvm-project?rev=50407&view=rev
Log:
Disable 5812818 fix for now.
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=50407&r1=50406&r2=50407&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Tue Apr 29 01:46:11 2008
@@ -8622,6 +8622,7 @@
CLASS_TYPE (class) = record;
/* APPLE LOCAL llvm begin */
+#if 0
#ifdef ENABLE_LLVM
/* Synthesized properties will later be added to this RECORD_DECL as they
* are found in @implementations. We don't want the LLVM tree->llvm
@@ -8633,6 +8634,7 @@
if (flag_objc_abi == 2)
llvm_compute_type(record);
#endif
+#endif
/* APPLE LOCAL llvm end */
}
}
From asl at math.spbu.ru Tue Apr 29 01:52:51 2008
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 29 Apr 2008 10:52:51 +0400
Subject: [llvm-commits] Win64 support to llvm-gcc
Message-ID: <1209451971.5745.76.camel@localhost>
Hello, Everyone
I've just commited some bits ?backported from mainline gcc to llvm-gcc
in order to enable win64 suport. The patches were explicitly approved by
their author, Kai Tietz, to be backported into llvm-gcc under GPLv2.
Please note, that win64 support is really preliminary. It should 'just
work', but it wasn't widely tested. Currently there are some bugs in FP
stackifier preventing clean build of w64 CRT with llvm-gcc, so some
extra workarounds are needed.
Surely, patches and test results are highly welcomed! :)
--
With best regards, Anton Korobeynikov.
Faculty of Mathematics & Mechanics, Saint Petersburg State University.
From sabre at nondot.org Tue Apr 29 01:56:02 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 29 Apr 2008 06:56:02 -0000
Subject: [llvm-commits] [llvm] r50408 -
/llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
Message-ID: <200804290656.m3T6u2EH007519@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Apr 29 01:56:02 2008
New Revision: 50408
URL: http://llvm.org/viewvc/llvm-project?rev=50408&view=rev
Log:
Implement more aggressive support for analyzing string length. This
generalizes the previous code to handle the case when the string is not
an immediate to the strlen call (for example, crazy stuff like
strlen(c ? "foo" : "bart"+1) -> 3). This implements
gcc.c-torture/execute/builtins/strlen-2.c. I will generalize other
cases in simplifylibcalls to use the same routine later.
Modified:
llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
Modified: llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp?rev=50408&r1=50407&r2=50408&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp Tue Apr 29 01:56:02 2008
@@ -24,6 +24,7 @@
#include "llvm/Intrinsics.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Config/config.h"
@@ -398,16 +399,18 @@
return new SimplifyLibCalls();
}
+// Forward declare utility functions.
+static bool GetConstantStringInfo(Value *V, std::string &Str);
+static Value *CastToCStr(Value *V, Instruction *IP);
+static uint64_t GetStringLength(Value *V);
+
+
// Classes below here, in the anonymous namespace, are all subclasses of the
// LibCallOptimization class, each implementing all optimizations possible for a
// single well-known library call. Each has a static singleton instance that
// auto registers it into the "optlist" global above.
namespace {
-// Forward declare utility functions.
-static bool GetConstantStringInfo(Value *V, std::string &Str);
-static Value *CastToCStr(Value *V, Instruction *IP);
-
/// This LibCallOptimization will find instances of a call to "exit" that occurs
/// within the "main" function and change it to a simple "ret" instruction with
/// the same value passed to the exit function. When this is done, it splits the
@@ -812,12 +815,10 @@
}
// Get the length of the constant string operand
- std::string Str;
- if (!GetConstantStringInfo(Src, Str))
- return false;
-
// strlen("xyz") -> 3 (for example)
- return ReplaceCallWith(CI, ConstantInt::get(CI->getType(), Str.size()));
+ if (uint64_t Len = GetStringLength(Src))
+ return ReplaceCallWith(CI, ConstantInt::get(CI->getType(), Len-1));
+ return false;
}
} StrLenOptimizer;
@@ -1876,6 +1877,7 @@
return false; // opt failed
}
} NearByIntOptimizer;
+} // end anon namespace
/// GetConstantStringInfo - This function computes the length of a
/// null-terminated constant array of integers. This function can't rely on the
@@ -1972,6 +1974,131 @@
return false; // The array isn't null terminated.
}
+/// GetStringLengthH - If we can compute the length of the string pointed to by
+/// the specified pointer, return 'len+1'. If we can't, return 0.
+static uint64_t GetStringLengthH(Value *V, SmallPtrSet