From kremenek at apple.com Mon Oct 20 01:07:14 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Mon, 20 Oct 2008 06:07:14 -0000
Subject: [llvm-commits] [llvm] r57799 - /llvm/tags/checker/checker-112/
Message-ID: <200810200607.m9K67Egd022622@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 01:07:13 2008
New Revision: 57799
URL: http://llvm.org/viewvc/llvm-project?rev=57799&view=rev
Log:
Removing checker-112.
Removed:
llvm/tags/checker/checker-112/
From kremenek at apple.com Mon Oct 20 01:07:43 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Mon, 20 Oct 2008 06:07:43 -0000
Subject: [llvm-commits] [llvm] r57801 - /llvm/tags/checker/checker-112/
Message-ID: <200810200607.m9K67h1W022654@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 01:07:43 2008
New Revision: 57801
URL: http://llvm.org/viewvc/llvm-project?rev=57801&view=rev
Log:
Tagging checker-112.
Added:
llvm/tags/checker/checker-112/
- copied from r57800, llvm/trunk/
From evan.cheng at apple.com Mon Oct 20 01:10:40 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Sun, 19 Oct 2008 23:10:40 -0700
Subject: [llvm-commits] [llvm] r57786 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
In-Reply-To: <200810192051.m9JKpExj003636@zion.cs.uiuc.edu>
References: <200810192051.m9JKpExj003636@zion.cs.uiuc.edu>
Message-ID:
Hi Bill,
Just a suggestion. It would make the patch more readable if you commit
the cosmetic changes separately.
Thanks,
Evan
On Oct 19, 2008, at 1:51 PM, Bill Wendling wrote:
> Author: void
> Date: Sun Oct 19 15:51:12 2008
> New Revision: 57786
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57786&view=rev
> Log:
> Set N->OperandList to 0 after deletion. Otherwise, it's possible
> that it will
> be either deleted or referenced afterwards.
>
> Modified:
> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=57786&r1=57785&r2=57786&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Oct 19
> 15:51:12 2008
> @@ -216,7 +216,7 @@
> unsigned OldG = (Operation >> 1) & 1;
> return ISD::CondCode((Operation & ~6) | // Keep the N, U, E bits
> (OldL << 1) | // New G bit
> - (OldG << 2)); // New L bit.
> + (OldG << 2)); // New L bit.
> }
>
> /// getSetCCInverse - Return the operation corresponding to !(X op
> Y), where
> @@ -227,8 +227,10 @@
> Operation ^= 7; // Flip L, G, E bits, but not U.
> else
> Operation ^= 15; // Flip all of the condition bits.
> +
> if (Operation > ISD::SETTRUE2)
> - Operation &= ~8; // Don't let N and U bits get set.
> + Operation &= ~8; // Don't let N and U bits get set.
> +
> return ISD::CondCode(Operation);
> }
>
> @@ -506,7 +508,8 @@
> /// encodeMemSDNodeFlags - Generic routine for computing a value for
> use in
> /// the CSE map that carries both alignment and volatility
> information.
> ///
> -static unsigned encodeMemSDNodeFlags(bool isVolatile, unsigned
> Alignment) {
> +static inline unsigned
> +encodeMemSDNodeFlags(bool isVolatile, unsigned Alignment) {
> return isVolatile | ((Log2_32(Alignment) + 1) << 1);
> }
>
> @@ -561,9 +564,10 @@
> if (Operand->use_empty())
> DeadNodes.push_back(Operand);
> }
> - if (N->OperandsNeedDelete) {
> +
> + if (N->OperandsNeedDelete)
> delete[] N->OperandList;
> - }
> +
> N->OperandList = 0;
> N->NumOperands = 0;
>
> @@ -589,12 +593,14 @@
> }
>
> void SelectionDAG::DeleteNodeNotInCSEMaps(SDNode *N) {
> -
> // Drop all of the operands and decrement used node's use counts.
> for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I !=
> E; ++I)
> I->getVal()->removeUser(std::distance(N->op_begin(), I), N);
> - if (N->OperandsNeedDelete)
> +
> + if (N->OperandsNeedDelete) {
> delete[] N->OperandList;
> + N->OperandList = 0;
> + }
>
> assert(N != AllNodes.begin());
> NodeAllocator.Deallocate(AllNodes.remove(N));
> @@ -675,13 +681,13 @@
> case ISD::DBG_STOPPOINT:
> case ISD::EH_LABEL:
> case ISD::DECLARE:
> - return 0; // Never add these nodes.
> + return 0; // Never add these nodes.
> }
>
> // Check that remaining values produced are not flags.
> for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
> if (N->getValueType(i) == MVT::Flag)
> - return 0; // Never CSE anything that produces a flag.
> + return 0; // Never CSE anything that produces a flag.
>
> SDNode *New = CSEMap.GetOrInsertNode(N);
> if (New != N) return New; // Node already existed.
> @@ -703,13 +709,13 @@
> case ISD::DBG_LABEL:
> case ISD::DBG_STOPPOINT:
> case ISD::EH_LABEL:
> - return 0; // Never add these nodes.
> + return 0; // Never add these nodes.
> }
>
> // Check that remaining values produced are not flags.
> for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
> if (N->getValueType(i) == MVT::Flag)
> - return 0; // Never CSE anything that produces a flag.
> + return 0; // Never CSE anything that produces a flag.
>
> SDValue Ops[] = { Op };
> FoldingSetNodeID ID;
> @@ -729,7 +735,7 @@
> // Check that remaining values produced are not flags.
> for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
> if (N->getValueType(i) == MVT::Flag)
> - return 0; // Never CSE anything that produces a flag.
> + return 0; // Never CSE anything that produces a flag.
>
> SDValue Ops[] = { Op1, Op2 };
> FoldingSetNodeID ID;
> @@ -755,13 +761,13 @@
> case ISD::DBG_STOPPOINT:
> case ISD::EH_LABEL:
> case ISD::DECLARE:
> - return 0; // Never add these nodes.
> + return 0; // Never add these nodes.
> }
>
> // Check that remaining values produced are not flags.
> for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
> if (N->getValueType(i) == MVT::Flag)
> - return 0; // Never CSE anything that produces a flag.
> + return 0; // Never CSE anything that produces a flag.
>
> FoldingSetNodeID ID;
> AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops, NumOps);
> @@ -833,8 +839,12 @@
> while (!AllNodes.empty()) {
> SDNode *N = AllNodes.remove(AllNodes.begin());
> N->SetNextInBucket(0);
> - if (N->OperandsNeedDelete)
> +
> + if (N->OperandsNeedDelete) {
> delete [] N->OperandList;
> + N->OperandList = 0;
> + }
> +
> NodeAllocator.Deallocate(N);
> }
> }
> @@ -4208,6 +4218,7 @@
> if (NumOps > N->NumOperands) {
> if (N->OperandsNeedDelete)
> delete[] N->OperandList;
> +
> if (N->isMachineOpcode()) {
> // We're creating a final node that will live unmorphed for the
> // remainder of the current SelectionDAG iteration, so we can
> allocate
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From isanbard at gmail.com Mon Oct 20 01:26:53 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Sun, 19 Oct 2008 23:26:53 -0700
Subject: [llvm-commits] [llvm] r57786 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
In-Reply-To: <200810200502.53130.baldrick@free.fr>
References: <200810192051.m9JKpExj003636@zion.cs.uiuc.edu>
<200810200502.53130.baldrick@free.fr>
Message-ID: <16F8D279-C057-4CC0-BEC0-2642C96733E3@gmail.com>
On Oct 19, 2008, at 8:02 PM, Duncan Sands wrote:
> Hi Bill,
>
>> @@ -4208,6 +4218,7 @@
>> if (NumOps > N->NumOperands) {
>> if (N->OperandsNeedDelete)
>> delete[] N->OperandList;
>> +
>> if (N->isMachineOpcode()) {
>> // We're creating a final node that will live unmorphed for the
>> // remainder of the current SelectionDAG iteration, so we can
>> allocate
>
> is it needed here too?
>
I had it there at first, but then noticed that the N->OperandList is
assigned right afterwards, so I didn't add it.
-bw
From isanbard at gmail.com Mon Oct 20 01:27:34 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Sun, 19 Oct 2008 23:27:34 -0700
Subject: [llvm-commits] [llvm] r57786 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
In-Reply-To:
References: <200810192051.m9JKpExj003636@zion.cs.uiuc.edu>
Message-ID: <6AC89150-C446-4332-A48B-B5F60C9A877B@gmail.com>
Sorry about that. I didn't realize that there were so many of them
until afterwards. :-(
-bw
On Oct 19, 2008, at 11:10 PM, Evan Cheng wrote:
> Hi Bill,
>
> Just a suggestion. It would make the patch more readable if you commit
> the cosmetic changes separately.
>
> Thanks,
>
> Evan
>
> On Oct 19, 2008, at 1:51 PM, Bill Wendling wrote:
>
>> Author: void
>> Date: Sun Oct 19 15:51:12 2008
>> New Revision: 57786
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=57786&view=rev
>> Log:
>> Set N->OperandList to 0 after deletion. Otherwise, it's possible
>> that it will
>> be either deleted or referenced afterwards.
>>
>> Modified:
>> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
>>
>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=57786&r1=57785&r2=57786&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Oct 19
>> 15:51:12 2008
>> @@ -216,7 +216,7 @@
>> unsigned OldG = (Operation >> 1) & 1;
>> return ISD::CondCode((Operation & ~6) | // Keep the N, U, E bits
>> (OldL << 1) | // New G bit
>> - (OldG << 2)); // New L bit.
>> + (OldG << 2)); // New L bit.
>> }
>>
>> /// getSetCCInverse - Return the operation corresponding to !(X op
>> Y), where
>> @@ -227,8 +227,10 @@
>> Operation ^= 7; // Flip L, G, E bits, but not U.
>> else
>> Operation ^= 15; // Flip all of the condition bits.
>> +
>> if (Operation > ISD::SETTRUE2)
>> - Operation &= ~8; // Don't let N and U bits get set.
>> + Operation &= ~8; // Don't let N and U bits get set.
>> +
>> return ISD::CondCode(Operation);
>> }
>>
>> @@ -506,7 +508,8 @@
>> /// encodeMemSDNodeFlags - Generic routine for computing a value for
>> use in
>> /// the CSE map that carries both alignment and volatility
>> information.
>> ///
>> -static unsigned encodeMemSDNodeFlags(bool isVolatile, unsigned
>> Alignment) {
>> +static inline unsigned
>> +encodeMemSDNodeFlags(bool isVolatile, unsigned Alignment) {
>> return isVolatile | ((Log2_32(Alignment) + 1) << 1);
>> }
>>
>> @@ -561,9 +564,10 @@
>> if (Operand->use_empty())
>> DeadNodes.push_back(Operand);
>> }
>> - if (N->OperandsNeedDelete) {
>> +
>> + if (N->OperandsNeedDelete)
>> delete[] N->OperandList;
>> - }
>> +
>> N->OperandList = 0;
>> N->NumOperands = 0;
>>
>> @@ -589,12 +593,14 @@
>> }
>>
>> void SelectionDAG::DeleteNodeNotInCSEMaps(SDNode *N) {
>> -
>> // Drop all of the operands and decrement used node's use counts.
>> for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I !=
>> E; ++I)
>> I->getVal()->removeUser(std::distance(N->op_begin(), I), N);
>> - if (N->OperandsNeedDelete)
>> +
>> + if (N->OperandsNeedDelete) {
>> delete[] N->OperandList;
>> + N->OperandList = 0;
>> + }
>>
>> assert(N != AllNodes.begin());
>> NodeAllocator.Deallocate(AllNodes.remove(N));
>> @@ -675,13 +681,13 @@
>> case ISD::DBG_STOPPOINT:
>> case ISD::EH_LABEL:
>> case ISD::DECLARE:
>> - return 0; // Never add these nodes.
>> + return 0; // Never add these nodes.
>> }
>>
>> // Check that remaining values produced are not flags.
>> for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
>> if (N->getValueType(i) == MVT::Flag)
>> - return 0; // Never CSE anything that produces a flag.
>> + return 0; // Never CSE anything that produces a flag.
>>
>> SDNode *New = CSEMap.GetOrInsertNode(N);
>> if (New != N) return New; // Node already existed.
>> @@ -703,13 +709,13 @@
>> case ISD::DBG_LABEL:
>> case ISD::DBG_STOPPOINT:
>> case ISD::EH_LABEL:
>> - return 0; // Never add these nodes.
>> + return 0; // Never add these nodes.
>> }
>>
>> // Check that remaining values produced are not flags.
>> for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
>> if (N->getValueType(i) == MVT::Flag)
>> - return 0; // Never CSE anything that produces a flag.
>> + return 0; // Never CSE anything that produces a flag.
>>
>> SDValue Ops[] = { Op };
>> FoldingSetNodeID ID;
>> @@ -729,7 +735,7 @@
>> // Check that remaining values produced are not flags.
>> for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
>> if (N->getValueType(i) == MVT::Flag)
>> - return 0; // Never CSE anything that produces a flag.
>> + return 0; // Never CSE anything that produces a flag.
>>
>> SDValue Ops[] = { Op1, Op2 };
>> FoldingSetNodeID ID;
>> @@ -755,13 +761,13 @@
>> case ISD::DBG_STOPPOINT:
>> case ISD::EH_LABEL:
>> case ISD::DECLARE:
>> - return 0; // Never add these nodes.
>> + return 0; // Never add these nodes.
>> }
>>
>> // Check that remaining values produced are not flags.
>> for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
>> if (N->getValueType(i) == MVT::Flag)
>> - return 0; // Never CSE anything that produces a flag.
>> + return 0; // Never CSE anything that produces a flag.
>>
>> FoldingSetNodeID ID;
>> AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops, NumOps);
>> @@ -833,8 +839,12 @@
>> while (!AllNodes.empty()) {
>> SDNode *N = AllNodes.remove(AllNodes.begin());
>> N->SetNextInBucket(0);
>> - if (N->OperandsNeedDelete)
>> +
>> + if (N->OperandsNeedDelete) {
>> delete [] N->OperandList;
>> + N->OperandList = 0;
>> + }
>> +
>> NodeAllocator.Deallocate(N);
>> }
>> }
>> @@ -4208,6 +4218,7 @@
>> if (NumOps > N->NumOperands) {
>> if (N->OperandsNeedDelete)
>> delete[] N->OperandList;
>> +
>> if (N->isMachineOpcode()) {
>> // We're creating a final node that will live unmorphed for the
>> // remainder of the current SelectionDAG iteration, so we can
>> allocate
>>
>>
>> _______________________________________________
>> 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 matthijs at stdin.nl Mon Oct 20 02:55:17 2008
From: matthijs at stdin.nl (Matthijs Kooijman)
Date: Mon, 20 Oct 2008 09:55:17 +0200
Subject: [llvm-commits] [llvm] r57442
- /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
In-Reply-To: <200810131800.44959.baldrick@free.fr>
References: <200810131517.m9DFH380013820@zion.cs.uiuc.edu>
<200810131739.51434.baldrick@free.fr>
<20081013154735.GL28837@katherina.student.utwente.nl>
<200810131800.44959.baldrick@free.fr>
Message-ID: <20081020075517.GI26043@katherina.student.utwente.nl>
Hi Duncan,
> > > can stripPointerCasts be used here somehow?
> > it does actually seem that that method does exactly what getBitCastOperand()
> > does, with the exception that getBitCastOperand() works for non-pointers as
> > well. However, both uses of getBitCastOperand only work with pointers AFAICS,
> > so perhaps getBitCastOperand should just be removed alltogether, then?
> do you mean that getBitCastOperand never actually returns null? In that case,
> I agree that it's best to delete it.
Uh, no. getBitCastOperand returns null in the cast the Value passed in is not
bitcast-like. However, stripPointerCasts just returns the Value itself in that
case, so both function do exactly the same thing. By updating the callers to
use stripPointerCasts instead and checking for the old Value instead of NULL,
getBitCastOperand could be deleted, I think?
Agree to replace them?
Gr.
Matthijs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081020/14b306af/attachment.bin
From matthijs at stdin.nl Mon Oct 20 03:45:35 2008
From: matthijs at stdin.nl (Matthijs Kooijman)
Date: Mon, 20 Oct 2008 08:45:35 -0000
Subject: [llvm-commits] [llvm] r57820 -
/llvm/trunk/docs/TableGenFundamentals.html
Message-ID: <200810200845.m9K8jZuM004936@zion.cs.uiuc.edu>
Author: matthijs
Date: Mon Oct 20 03:45:34 2008
New Revision: 57820
URL: http://llvm.org/viewvc/llvm-project?rev=57820&view=rev
Log:
Fix spelling error.
Modified:
llvm/trunk/docs/TableGenFundamentals.html
Modified: llvm/trunk/docs/TableGenFundamentals.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=57820&r1=57819&r2=57820&view=diff
==============================================================================
--- llvm/trunk/docs/TableGenFundamentals.html (original)
+++ llvm/trunk/docs/TableGenFundamentals.html Mon Oct 20 03:45:34 2008
@@ -694,7 +694,7 @@
end-user to factor out commonality from the records.
File-scope "let" expressions take a comma-separated list of bindings to
-apply, and one of more records to bind the values in. Here are some
+apply, and one or more records to bind the values in. Here are some
examples:
From baldrick at free.fr Mon Oct 20 04:28:18 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Oct 2008 11:28:18 +0200
Subject: [llvm-commits] [llvm] r57442 -
/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
In-Reply-To: <20081020075517.GI26043@katherina.student.utwente.nl>
References: <200810131517.m9DFH380013820@zion.cs.uiuc.edu>
<200810131800.44959.baldrick@free.fr>
<20081020075517.GI26043@katherina.student.utwente.nl>
Message-ID: <200810201128.19147.baldrick@free.fr>
> Uh, no. getBitCastOperand returns null in the cast the Value passed in is not
> bitcast-like. However, stripPointerCasts just returns the Value itself in that
> case, so both function do exactly the same thing. By updating the callers to
> use stripPointerCasts instead and checking for the old Value instead of NULL,
> getBitCastOperand could be deleted, I think?
>
> Agree to replace them?
Sure, be my guest :)
Ciao,
Duncan.
From matthijs at stdin.nl Mon Oct 20 06:21:14 2008
From: matthijs at stdin.nl (Matthijs Kooijman)
Date: Mon, 20 Oct 2008 11:21:14 -0000
Subject: [llvm-commits] [llvm] r57827 -
/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
Message-ID: <200810201121.m9KBLFtK011039@zion.cs.uiuc.edu>
Author: matthijs
Date: Mon Oct 20 06:21:12 2008
New Revision: 57827
URL: http://llvm.org/viewvc/llvm-project?rev=57827&view=rev
Log:
Remove an inappropriate (probably outdated) comment.
Modified:
llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=57827&r1=57826&r2=57827&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Mon Oct 20 06:21:12 2008
@@ -554,9 +554,7 @@
int SPAdj, RegScavenger *RS=NULL) const = 0;
/// emitProlog/emitEpilog - These methods insert prolog and epilog code into
- /// the function. The return value is the number of instructions
- /// added to (negative if removed from) the basic block (entry for prologue).
- ///
+ /// the function.
virtual void emitPrologue(MachineFunction &MF) const = 0;
virtual void emitEpilogue(MachineFunction &MF,
MachineBasicBlock &MBB) const = 0;
From matthijs at stdin.nl Mon Oct 20 06:23:18 2008
From: matthijs at stdin.nl (Matthijs Kooijman)
Date: Mon, 20 Oct 2008 11:23:18 -0000
Subject: [llvm-commits] [llvm] r57828 -
/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
Message-ID: <200810201123.m9KBNI1V011095@zion.cs.uiuc.edu>
Author: matthijs
Date: Mon Oct 20 06:23:18 2008
New Revision: 57828
URL: http://llvm.org/viewvc/llvm-project?rev=57828&view=rev
Log:
Remove another stale comment.
Modified:
llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=57828&r1=57827&r2=57828&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Mon Oct 20 06:23:18 2008
@@ -547,9 +547,7 @@
/// eliminated by this method. This method may modify or replace the
/// specified instruction, as long as it keeps the iterator pointing the the
/// finished product. SPAdj is the SP adjustment due to call frame setup
- /// instruction. The return value is the number of instructions added to
- /// (negative if removed from) the basic block.
- ///
+ /// instruction.
virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI,
int SPAdj, RegScavenger *RS=NULL) const = 0;
From matthijs at stdin.nl Mon Oct 20 06:24:58 2008
From: matthijs at stdin.nl (Matthijs Kooijman)
Date: Mon, 20 Oct 2008 11:24:58 -0000
Subject: [llvm-commits] [llvm] r57829 -
/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
Message-ID: <200810201124.m9KBOwFJ011161@zion.cs.uiuc.edu>
Author: matthijs
Date: Mon Oct 20 06:24:57 2008
New Revision: 57829
URL: http://llvm.org/viewvc/llvm-project?rev=57829&view=rev
Log:
Fix typo in a comment.
Modified:
llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=57829&r1=57828&r2=57829&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Mon Oct 20 06:24:57 2008
@@ -563,7 +563,7 @@
/// getDwarfRegNum - Map a target register to an equivalent dwarf register
/// number. Returns -1 if there is no equivalent value. The second
/// parameter allows targets to use different numberings for EH info and
- /// deubgging info.
+ /// debugging info.
virtual int getDwarfRegNum(unsigned RegNum, bool isEH) const = 0;
/// getFrameRegister - This method should return the register used as a base
From stefanus.dutoit at rapidmind.com Mon Oct 20 10:18:01 2008
From: stefanus.dutoit at rapidmind.com (Stefanus Du Toit)
Date: Mon, 20 Oct 2008 11:18:01 -0400
Subject: [llvm-commits] vector widening patch
In-Reply-To:
References:
Message-ID: <5101CC65-BB18-4133-8A1A-1D852CD8EECA@rapidmind.com>
Hi Mon Ping,
> + // If it a vector of two, we will assume it doesn't make sense to
> widen
> + if (NElts == 2)
> + return MVT::Other;
What's the reasoning behind this? In our experience this makes a lot
of sense, at least on x86 SSE2+ (assuming MMX is disabled).
Stefanus
On 18-Oct-08, at 12:12 AM, Mon Ping Wang wrote:
> Hi,
>
> Here is a patch for vector widen. In certain cases, it is more
> profitable to widen a vector from an illegal type to a legal type
> (e.g., v7i8 to v8i8) instead of scalarzing the vector. This patch
> implements that. The default implementation is to widen if there is a
> legal type that is wider than the illegal type and the vector has more
> elements. Any target can override the default logic and implement it
> own policy. Please let me know if you have any comments or concerns.
>
> Thanks,
> -- Mon Ping
>
--
Stefanus Du Toit
RapidMind Inc.
phone: +1 519 885 5455 x116 -- fax: +1 519 885 1463
From alenhar2 at cs.uiuc.edu Mon Oct 20 10:48:54 2008
From: alenhar2 at cs.uiuc.edu (Andrew Lenharth)
Date: Mon, 20 Oct 2008 15:48:54 -0000
Subject: [llvm-commits] [poolalloc] r57830 - in /poolalloc/trunk:
include/dsa/ include/poolalloc/ lib/DSA/ lib/PoolAllocate/
Message-ID: <200810201548.m9KFmtSa021869@zion.cs.uiuc.edu>
Author: alenhar2
Date: Mon Oct 20 10:48:53 2008
New Revision: 57830
URL: http://llvm.org/viewvc/llvm-project?rev=57830&view=rev
Log:
fix use after free errors and make interfaces more uniform
Modified:
poolalloc/trunk/include/dsa/DSGraph.h
poolalloc/trunk/include/dsa/DataStructure.h
poolalloc/trunk/include/poolalloc/PoolAllocate.h
poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
poolalloc/trunk/lib/DSA/CallTargets.cpp
poolalloc/trunk/lib/DSA/DataStructure.cpp
poolalloc/trunk/lib/DSA/DataStructureAA.cpp
poolalloc/trunk/lib/DSA/DataStructureOpt.cpp
poolalloc/trunk/lib/DSA/DataStructureStats.cpp
poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp
poolalloc/trunk/lib/DSA/GraphChecker.cpp
poolalloc/trunk/lib/DSA/Local.cpp
poolalloc/trunk/lib/DSA/Printer.cpp
poolalloc/trunk/lib/DSA/StdLibPass.cpp
poolalloc/trunk/lib/DSA/TopDownClosure.cpp
poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp
poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp
poolalloc/trunk/lib/PoolAllocate/Heuristic.h
poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
Modified: poolalloc/trunk/include/dsa/DSGraph.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSGraph.h?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSGraph.h (original)
+++ poolalloc/trunk/include/dsa/DSGraph.h Mon Oct 20 10:48:53 2008
@@ -250,7 +250,7 @@
// source. You need to set a new GlobalsGraph with the setGlobalsGraph
// method.
//
- DSGraph( DSGraph &DSG, EquivalenceClasses &ECs,
+ DSGraph( DSGraph* DSG, EquivalenceClasses &ECs,
unsigned CloneFlags = 0);
~DSGraph();
@@ -316,6 +316,10 @@
return AuxFunctionCalls;
}
+ // addAuxFunctionCall - Add a call site to the AuxFunctionCallList
+ void addAuxFunctionCall(DSCallSite D) { AuxFunctionCalls.push_front(D); }
+
+
/// removeFunction - Specify that all call sites to the function have been
/// fully specified by a pass such as StdLibPass.
void removeFunctionCalls(Function& F);
@@ -498,13 +502,13 @@
/// this graph, then clearing the RHS graph. Instead of performing this as
/// two seperate operations, do it as a single, much faster, one.
///
- void spliceFrom(DSGraph &RHS);
+ void spliceFrom(DSGraph* RHS);
/// cloneInto - Clone the specified DSGraph into the current graph.
///
/// The CloneFlags member controls various aspects of the cloning process.
///
- void cloneInto(DSGraph &G, unsigned CloneFlags = 0);
+ void cloneInto(DSGraph* G, unsigned CloneFlags = 0);
/// getFunctionArgumentsForCall - Given a function that is currently in this
/// graph, return the DSNodeHandles that correspond to the pointer-compatible
@@ -567,8 +571,8 @@
/// all of the nodes reachable from it are automatically brought over as well.
///
class ReachabilityCloner {
- DSGraph &Dest;
- const DSGraph &Src;
+ DSGraph* Dest;
+ const DSGraph* Src;
/// BitsToKeep - These bits are retained from the source node when the
/// source nodes are merged into the destination graph.
@@ -579,9 +583,9 @@
// represent them in the destination graph.
DSGraph::NodeMapTy NodeMap;
public:
- ReachabilityCloner(DSGraph &dest, const DSGraph &src, unsigned cloneFlags)
+ ReachabilityCloner(DSGraph* dest, const DSGraph* src, unsigned cloneFlags)
: Dest(dest), Src(src), CloneFlags(cloneFlags) {
- assert(&Dest != &Src && "Cannot clone from graph to same graph!");
+ assert(Dest != Src && "Cannot clone from graph to same graph!");
BitsToKeep = ~DSNode::DeadNode;
if (CloneFlags & DSGraph::StripAllocaBit)
BitsToKeep &= ~DSNode::AllocaNode;
Modified: poolalloc/trunk/include/dsa/DataStructure.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DataStructure.h (original)
+++ poolalloc/trunk/include/dsa/DataStructure.h Mon Oct 20 10:48:53 2008
@@ -140,19 +140,19 @@
/// getDSGraph - Return the data structure graph for the specified function.
///
- DSGraph &getDSGraph(const Function &F) const {
+ DSGraph *getDSGraph(const Function &F) const {
hash_map::const_iterator I = DSInfo.find(&F);
assert(I != DSInfo.end() && "Function not in module!");
- return *I->second;
+ return I->second;
}
void setDSGraph(const Function& F, DSGraph* G) {
DSInfo[&F] = G;
}
- DSGraph& getOrCreateGraph(const Function* F);
+ DSGraph* getOrCreateGraph(const Function* F);
- DSGraph &getGlobalsGraph() const { return *GlobalsGraph; }
+ DSGraph* getGlobalsGraph() const { return GlobalsGraph; }
EquivalenceClasses &getGlobalECs() { return GlobalECs; }
@@ -246,9 +246,9 @@
bool runOnModuleInternal(Module &M);
private:
- void calculateGraph(DSGraph &G);
+ void calculateGraph(DSGraph* G);
- void inlineUnresolved(DSGraph &G);
+ void inlineUnresolved(DSGraph* G);
unsigned calculateGraphs(const Function *F,
std::vector &Stack,
@@ -256,7 +256,7 @@
hash_map &ValMap);
- void CloneAuxIntoGlobal(DSGraph& G);
+ void CloneAuxIntoGlobal(DSGraph* G);
void finalizeGlobals(void);
};
@@ -367,7 +367,7 @@
void markReachableFunctionsExternallyAccessible(DSNode *N,
hash_set &Visited);
- void InlineCallersIntoGraph(DSGraph &G);
+ void InlineCallersIntoGraph(DSGraph* G);
void ComputePostOrder(const Function &F, hash_set &Visited,
std::vector &PostOrder);
};
Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original)
+++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Mon Oct 20 10:48:53 2008
@@ -121,11 +121,11 @@
return Graphs->hasDSGraph (F);
}
- virtual DSGraph & getDSGraph (const Function & F) const {
+ virtual DSGraph* getDSGraph (const Function & F) const {
return Graphs->getDSGraph (F);
}
- virtual DSGraph & getGlobalsGraph () const {
+ virtual DSGraph* getGlobalsGraph () const {
return Graphs->getGlobalsGraph ();
}
@@ -237,11 +237,11 @@
return ArrayType::get(VoidPtrType, 16);
}
- virtual DSGraph & getDSGraph (const Function & F) const {
+ virtual DSGraph* getDSGraph (const Function & F) const {
return Graphs->getDSGraph (F);
}
- virtual DSGraph & getGlobalsGraph () const {
+ virtual DSGraph* getGlobalsGraph () const {
return Graphs->getGlobalsGraph ();
}
@@ -320,11 +320,11 @@
/// pools specified in the NodesToPA list. This adds an entry to the
/// PoolDescriptors map for each DSNode.
///
- void CreatePools(Function &F, DSGraph &G,
+ void CreatePools(Function &F, DSGraph* G,
const std::vector &NodesToPA,
std::map &PoolDescriptors);
- void TransformBody(DSGraph &g, PA::FuncInfo &fi,
+ void TransformBody(DSGraph* g, PA::FuncInfo &fi,
std::multimap &poolUses,
std::multimap &poolFrees,
Function &F);
@@ -378,12 +378,12 @@
void ProcessFunctionBodySimple(Function& F, TargetData & TD);
- virtual DSGraph & getDSGraph (const Function & F) const {
- return *CombinedDSGraph;
+ virtual DSGraph* getDSGraph (const Function & F) const {
+ return CombinedDSGraph;
}
- virtual DSGraph & getGlobalsGraph () const {
- return *CombinedDSGraph;
+ virtual DSGraph* getGlobalsGraph () const {
+ return CombinedDSGraph;
}
virtual Value * getGlobalPool (const DSNode * Node) {
Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Mon Oct 20 10:48:53 2008
@@ -95,21 +95,21 @@
// into the main function's graph so that the main function contains all of
// the information about global pools and GV usage in the program.
if (MainFunc && !MainFunc->isDeclaration()) {
- DSGraph &MainGraph = getOrCreateGraph(MainFunc);
- const DSGraph &GG = *MainGraph.getGlobalsGraph();
+ DSGraph* MainGraph = getOrCreateGraph(MainFunc);
+ const DSGraph* GG = MainGraph->getGlobalsGraph();
ReachabilityCloner RC(MainGraph, GG,
DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
// Clone the global nodes into this graph.
- for (DSScalarMap::global_iterator I = GG.getScalarMap().global_begin(),
- E = GG.getScalarMap().global_end(); I != E; ++I)
+ for (DSScalarMap::global_iterator I = GG->getScalarMap().global_begin(),
+ E = GG->getScalarMap().global_end(); I != E; ++I)
if (isa(*I))
- RC.getClonedNH(GG.getNodeForValue(*I));
+ RC.getClonedNH(GG->getNodeForValue(*I));
- MainGraph.maskIncompleteMarkers();
- MainGraph.markIncompleteNodes(DSGraph::MarkFormalArgs |
- DSGraph::IgnoreGlobals);
+ MainGraph->maskIncompleteMarkers();
+ MainGraph->markIncompleteNodes(DSGraph::MarkFormalArgs |
+ DSGraph::IgnoreGlobals);
}
NumCallEdges += callee_size();
@@ -194,17 +194,17 @@
/// GetAllAuxCallees - Return a list containing all of the resolvable callees in
/// the aux list for the specified graph in the Callees vector.
-static void GetAllAuxCallees(DSGraph &G, std::vector &Callees) {
+static void GetAllAuxCallees(DSGraph* G, std::vector &Callees) {
Callees.clear();
- for (DSGraph::afc_iterator I = G.afc_begin(), E = G.afc_end(); I != E; ++I)
+ for (DSGraph::afc_iterator I = G->afc_begin(), E = G->afc_end(); I != E; ++I)
GetAllCallees(*I, Callees);
}
/// GetAnyAuxCallees - Return a list containing all of the callees in
/// the aux list for the specified graph in the Callees vector.
-static void GetAnyAuxCallees(DSGraph &G, std::vector &Callees) {
+static void GetAnyAuxCallees(DSGraph* G, std::vector &Callees) {
Callees.clear();
- for (DSGraph::afc_iterator I = G.afc_begin(), E = G.afc_end(); I != E; ++I)
+ for (DSGraph::afc_iterator I = G->afc_begin(), E = G->afc_end(); I != E; ++I)
GetAnyCallees(*I, Callees);
}
@@ -227,7 +227,7 @@
return Min;
}
- DSGraph &Graph = getOrCreateGraph(F);
+ DSGraph* Graph = getOrCreateGraph(F);
// Find all callee functions.
std::vector CalleeFunctions;
@@ -261,7 +261,7 @@
DOUT << " [BU] Calculating graph for: " << F->getName()<< "\n";
calculateGraph(Graph);
DOUT << " [BU] Done inlining: " << F->getName() << " ["
- << Graph.getGraphSize() << "+" << Graph.getAuxFunctionCalls().size()
+ << Graph->getGraphSize() << "+" << Graph->getAuxFunctionCalls().size()
<< "]\n";
if (MaxSCC < 1) MaxSCC = 1;
@@ -295,7 +295,7 @@
unsigned SCCSize = 1;
const Function *NF = Stack.back();
ValMap[NF] = ~0U;
- DSGraph &SCCGraph = getDSGraph(*NF);
+ DSGraph* SCCGraph = getDSGraph(*NF);
// First thing first, collapse all of the DSGraphs into a single graph for
// the entire SCC. Splice all of the graphs into one and discard all of the
@@ -306,17 +306,18 @@
NF = Stack.back();
ValMap[NF] = ~0U;
- DSGraph &NFG = getDSGraph(*NF);
+ DSGraph* NFG = getDSGraph(*NF);
- // Update the Function -> DSG map.
- for (DSGraph::retnodes_iterator I = NFG.retnodes_begin(),
- E = NFG.retnodes_end(); I != E; ++I)
- setDSGraph(*I->first, &SCCGraph);
-
- SCCGraph.spliceFrom(NFG);
- delete &NFG;
-
- ++SCCSize;
+ if (NFG != SCCGraph) {
+ // Update the Function -> DSG map.
+ for (DSGraph::retnodes_iterator I = NFG->retnodes_begin(),
+ E = NFG->retnodes_end(); I != E; ++I)
+ setDSGraph(*I->first, SCCGraph);
+
+ SCCGraph->spliceFrom(NFG);
+ delete NFG;
+ ++SCCSize;
+ }
}
Stack.pop_back();
@@ -328,13 +329,13 @@
MaxSCC = SCCSize;
// Clean up the graph before we start inlining a bunch again...
- SCCGraph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
+ SCCGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
// Now that we have one big happy family, resolve all of the call sites in
// the graph...
calculateGraph(SCCGraph);
- DOUT << " [BU] Done inlining SCC [" << SCCGraph.getGraphSize()
- << "+" << SCCGraph.getAuxFunctionCalls().size() << "]\n"
+ DOUT << " [BU] Done inlining SCC [" << SCCGraph->getGraphSize()
+ << "+" << SCCGraph->getAuxFunctionCalls().size() << "]\n"
<< "DONE with SCC #: " << MyID << "\n";
// We never have to revisit "SCC" processed functions...
@@ -346,35 +347,35 @@
return MyID; // == Min
}
-void BUDataStructures::CloneAuxIntoGlobal(DSGraph& G) {
- DSGraph& GG = *G.getGlobalsGraph();
+void BUDataStructures::CloneAuxIntoGlobal(DSGraph* G) {
+ DSGraph* GG = G->getGlobalsGraph();
ReachabilityCloner RC(GG, G, 0);
- for(DSGraph::afc_iterator ii = G.afc_begin(), ee = G.afc_end();
+ for(DSGraph::afc_iterator ii = G->afc_begin(), ee = G->afc_end();
ii != ee; ++ii) {
//cerr << "Pushing " << ii->getCallSite().getInstruction()->getOperand(0) << "\n";
//If we can, merge with an existing call site for this instruction
- if (GG.hasNodeForValue(ii->getCallSite().getInstruction()->getOperand(0))) {
+ if (GG->hasNodeForValue(ii->getCallSite().getInstruction()->getOperand(0))) {
DSGraph::afc_iterator GGii;
- for(GGii = GG.afc_begin(); GGii != GG.afc_end(); ++GGii)
+ for(GGii = GG->afc_begin(); GGii != GG->afc_end(); ++GGii)
if (GGii->getCallSite().getInstruction()->getOperand(0) ==
ii->getCallSite().getInstruction()->getOperand(0))
break;
- if (GGii != GG.afc_end())
+ if (GGii != GG->afc_end())
RC.cloneCallSite(*ii).mergeWith(*GGii);
else
- GG.getAuxFunctionCalls().push_front(RC.cloneCallSite(*ii));
+ GG->addAuxFunctionCall(RC.cloneCallSite(*ii));
} else {
- GG.getAuxFunctionCalls().push_front(RC.cloneCallSite(*ii));
+ GG->addAuxFunctionCall(RC.cloneCallSite(*ii));
}
}
}
-void BUDataStructures::calculateGraph(DSGraph &Graph) {
+void BUDataStructures::calculateGraph(DSGraph* Graph) {
// If this graph contains the main function, clone the globals graph into this
// graph before we inline callees and other fun stuff.
bool ContainsMain = false;
- DSGraph::ReturnNodesTy &ReturnNodes = Graph.getReturnNodes();
+ DSGraph::ReturnNodesTy &ReturnNodes = Graph->getReturnNodes();
for (DSGraph::ReturnNodesTy::iterator I = ReturnNodes.begin(),
E = ReturnNodes.end(); I != E; ++I)
@@ -388,22 +389,22 @@
// of a global, we have to make sure to link up nodes due to global-argument
// bindings.
if (ContainsMain || ReInlineGlobals) {
- const DSGraph &GG = *Graph.getGlobalsGraph();
+ const DSGraph* GG = Graph->getGlobalsGraph();
ReachabilityCloner RC(Graph, GG,
DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
if (ContainsMain) {
// Clone the global nodes into this graph.
- for (DSScalarMap::global_iterator I = GG.getScalarMap().global_begin(),
- E = GG.getScalarMap().global_end(); I != E; ++I)
+ for (DSScalarMap::global_iterator I = GG->getScalarMap().global_begin(),
+ E = GG->getScalarMap().global_end(); I != E; ++I)
if (isa(*I))
- RC.getClonedNH(GG.getNodeForValue(*I));
+ RC.getClonedNH(GG->getNodeForValue(*I));
} else {
// Clone used the global nodes into this graph.
- for (DSScalarMap::global_iterator I = Graph.getScalarMap().global_begin(),
- E = Graph.getScalarMap().global_end(); I != E; ++I)
+ for (DSScalarMap::global_iterator I = Graph->getScalarMap().global_begin(),
+ E = Graph->getScalarMap().global_end(); I != E; ++I)
if (isa(*I))
- RC.getClonedNH(GG.getNodeForValue(*I));
+ RC.getClonedNH(GG->getNodeForValue(*I));
}
}
@@ -411,7 +412,7 @@
// Move our call site list into TempFCs so that inline call sites go into the
// new call site list and doesn't invalidate our iterators!
std::list TempFCs;
- std::list &AuxCallsList = Graph.getAuxFunctionCalls();
+ std::list &AuxCallsList = Graph->getAuxFunctionCalls();
TempFCs.swap(AuxCallsList);
std::vector CalledFuncs;
@@ -447,18 +448,18 @@
const Function *Callee = CalledFuncs[0];
// Get the data structure graph for the called function.
- GI = &getDSGraph(*Callee); // Graph to inline
+ GI = getDSGraph(*Callee); // Graph to inline
DOUT << " Inlining graph for " << Callee->getName()
<< "[" << GI->getGraphSize() << "+"
<< GI->getAuxFunctionCalls().size() << "] into '"
- << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
- << Graph.getAuxFunctionCalls().size() << "]\n";
- Graph.mergeInGraph(CS, *Callee, *GI,
- DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes|
- (isComplete?0:DSGraph::DontCloneAuxCallNodes));
+ << Graph->getFunctionNames() << "' [" << Graph->getGraphSize() <<"+"
+ << Graph->getAuxFunctionCalls().size() << "]\n";
+ Graph->mergeInGraph(CS, *Callee, *GI,
+ DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes|
+ (isComplete?0:DSGraph::DontCloneAuxCallNodes));
++NumInlines;
} else if (CalledFuncs.size() > 1) {
- DEBUG(std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n");
+ DEBUG(std::cerr << "In Fns: " << Graph->getFunctionNames() << "\n");
DEBUG(std::cerr << " calls " << CalledFuncs.size()
<< " fns from site: " << CS.getCallSite().getInstruction()
<< " " << *CS.getCallSite().getInstruction());
@@ -489,7 +490,7 @@
// Start with a copy of the first graph.
GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs);
- GI->setGlobalsGraph(Graph.getGlobalsGraph());
+ GI->setGlobalsGraph(Graph->getGlobalsGraph());
std::vector &Args = IndCallGraph.second;
// Get the argument nodes for the first callee. The return value is
@@ -528,13 +529,13 @@
DOUT << " Inlining multi callee graph "
<< "[" << GI->getGraphSize() << "+"
<< GI->getAuxFunctionCalls().size() << "] into '"
- << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
- << Graph.getAuxFunctionCalls().size() << "]\n";
+ << Graph->getFunctionNames() << "' [" << Graph->getGraphSize() <<"+"
+ << Graph->getAuxFunctionCalls().size() << "]\n";
- Graph.mergeInGraph(CS, IndCallGraph.second, *GI,
- DSGraph::StripAllocaBit |
- DSGraph::DontCloneCallNodes|
- (isComplete?0:DSGraph::DontCloneAuxCallNodes));
+ Graph->mergeInGraph(CS, IndCallGraph.second, *GI,
+ DSGraph::StripAllocaBit |
+ DSGraph::DontCloneCallNodes|
+ (isComplete?0:DSGraph::DontCloneAuxCallNodes));
++NumInlines;
}
}
@@ -544,17 +545,17 @@
}
// Recompute the Incomplete markers
- Graph.maskIncompleteMarkers();
- Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
+ Graph->maskIncompleteMarkers();
+ Graph->markIncompleteNodes(DSGraph::MarkFormalArgs);
// Delete dead nodes. Treat globals that are unreachable but that can
// reach live nodes as live.
- Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
+ Graph->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
// When this graph is finalized, clone the globals in the graph into the
// globals graph to make sure it has everything, from all graphs.
- DSScalarMap &MainSM = Graph.getScalarMap();
- ReachabilityCloner RC(*GlobalsGraph, Graph, DSGraph::StripAllocaBit);
+ DSScalarMap &MainSM = Graph->getScalarMap();
+ ReachabilityCloner RC(GlobalsGraph, Graph, DSGraph::StripAllocaBit);
// Clone everything reachable from globals in the function graph into the
// globals graph.
@@ -565,8 +566,8 @@
//Graph.writeGraphToFile(cerr, "bu_" + F.getName());
}
-void BUDataStructures::inlineUnresolved(DSGraph &Graph) {
- for (DSGraph::afc_iterator aii = Graph.afc_begin(), aee = Graph.afc_end();
+void BUDataStructures::inlineUnresolved(DSGraph* Graph) {
+ for (DSGraph::afc_iterator aii = Graph->afc_begin(), aee = Graph->afc_end();
aii != aee; ++aii) {
std::vector CalledFuncs;
DSCallSite CS = *aii;
@@ -585,18 +586,18 @@
const Function *Callee = CalledFuncs[0];
// Get the data structure graph for the called function.
- GI = &getDSGraph(*Callee); // Graph to inline
- if (GI == &Graph) continue;
+ GI = getDSGraph(*Callee); // Graph to inline
+ if (GI == Graph) continue;
DOUT << " Inlining graph for " << Callee->getName()
<< "[" << GI->getGraphSize() << "+"
<< GI->getAuxFunctionCalls().size() << "] into '"
- << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
- << Graph.getAuxFunctionCalls().size() << "]\n";
- Graph.mergeInGraph(CS, *Callee, *GI,
+ << Graph->getFunctionNames() << "' [" << Graph->getGraphSize() <<"+"
+ << Graph->getAuxFunctionCalls().size() << "]\n";
+ Graph->mergeInGraph(CS, *Callee, *GI,
DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes);
++NumInlines;
} else {
- DEBUG(std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n");
+ DEBUG(std::cerr << "In Fns: " << Graph->getFunctionNames() << "\n");
DEBUG(std::cerr << " calls " << CalledFuncs.size()
<< " fns from site: " << CS.getCallSite().getInstruction()
<< " " << *CS.getCallSite().getInstruction());
@@ -621,7 +622,7 @@
std::pair > &IndCallGraph =
IndCallGraphMap[CalledFuncs];
- if (IndCallGraph.first == &Graph) continue;
+ if (IndCallGraph.first == Graph) continue;
if (IndCallGraph.first == 0) {
std::vector::iterator I = CalledFuncs.begin(),
@@ -629,7 +630,7 @@
// Start with a copy of the first graph.
GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs);
- GI->setGlobalsGraph(Graph.getGlobalsGraph());
+ GI->setGlobalsGraph(Graph->getGlobalsGraph());
std::vector &Args = IndCallGraph.second;
// Get the argument nodes for the first callee. The return value is
@@ -668,28 +669,28 @@
DOUT << " Inlining multi callee graph "
<< "[" << GI->getGraphSize() << "+"
<< GI->getAuxFunctionCalls().size() << "] into '"
- << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
- << Graph.getAuxFunctionCalls().size() << "]\n";
+ << Graph->getFunctionNames() << "' [" << Graph->getGraphSize() <<"+"
+ << Graph->getAuxFunctionCalls().size() << "]\n";
- Graph.mergeInGraph(CS, IndCallGraph.second, *GI,
- DSGraph::StripAllocaBit |
- DSGraph::DontCloneCallNodes);
+ Graph->mergeInGraph(CS, IndCallGraph.second, *GI,
+ DSGraph::StripAllocaBit |
+ DSGraph::DontCloneCallNodes);
++NumInlines;
}
}
// Recompute the Incomplete markers
- Graph.maskIncompleteMarkers();
- Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
+ Graph->maskIncompleteMarkers();
+ Graph->markIncompleteNodes(DSGraph::MarkFormalArgs);
// Delete dead nodes. Treat globals that are unreachable but that can
// reach live nodes as live.
- Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
+ Graph->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
// When this graph is finalized, clone the globals in the graph into the
// globals graph to make sure it has everything, from all graphs.
- DSScalarMap &MainSM = Graph.getScalarMap();
- ReachabilityCloner RC(*GlobalsGraph, Graph, DSGraph::StripAllocaBit);
+ DSScalarMap &MainSM = Graph->getScalarMap();
+ ReachabilityCloner RC(GlobalsGraph, Graph, DSGraph::StripAllocaBit);
// Clone everything reachable from globals in the function graph into the
// globals graph.
Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/CallTargets.cpp (original)
+++ poolalloc/trunk/lib/DSA/CallTargets.cpp Mon Oct 20 10:48:53 2008
@@ -53,7 +53,7 @@
if (!cs.getCalledFunction()) {
IndCall++;
DSNode* N = T->getDSGraph(*cs.getCaller())
- .getNodeForValue(cs.getCalledValue()).getNode();
+ ->getNodeForValue(cs.getCalledValue()).getNode();
N->addFullFunctionList(IndMap[cs]);
if (N->isCompleteNode() && IndMap[cs].size()) {
CompleteSites.insert(cs);
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Mon Oct 20 10:48:53 2008
@@ -1040,14 +1040,14 @@
// If SrcNH has globals and the destination graph has one of the same globals,
// merge this node with the destination node, which is much more efficient.
if (SN->globals_begin() != SN->globals_end()) {
- DSScalarMap &DestSM = Dest.getScalarMap();
+ DSScalarMap &DestSM = Dest->getScalarMap();
for (DSNode::globals_iterator I = SN->globals_begin(),E = SN->globals_end();
I != E; ++I) {
const GlobalValue *GV = *I;
DSScalarMap::iterator GI = DestSM.find(GV);
if (GI != DestSM.end() && !GI->second.isNull()) {
// We found one, use merge instead!
- merge(GI->second, Src.getNodeForValue(GV));
+ merge(GI->second, Src->getNodeForValue(GV));
assert(!NH.isNull() && "Didn't merge node!");
DSNode *NHN = NH.getNode();
return DSNodeHandle(NHN, NH.getOffset()+SrcNH.getOffset());
@@ -1055,7 +1055,7 @@
}
}
- DSNode *DN = new DSNode(*SN, &Dest, true /* Null out all links */);
+ DSNode *DN = new DSNode(*SN, Dest, true /* Null out all links */);
DN->maskNodeTypes(BitsToKeep);
NH = DN;
//DOUT << "getClonedNH: " << SN << " becomes " << DN << "\n";
@@ -1100,11 +1100,11 @@
for (DSNode::globals_iterator I = SN->globals_begin(), E = SN->globals_end();
I != E; ++I) {
const GlobalValue *GV = *I;
- const DSNodeHandle &SrcGNH = Src.getNodeForValue(GV);
+ const DSNodeHandle &SrcGNH = Src->getNodeForValue(GV);
DSNodeHandle &DestGNH = NodeMap[SrcGNH.getNode()];
assert(DestGNH.getNode() == NH.getNode() &&"Global mapping inconsistent");
- Dest.getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(),
- DestGNH.getOffset()+SrcGNH.getOffset()));
+ Dest->getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(),
+ DestGNH.getOffset()+SrcGNH.getOffset()));
}
NH.getNode()->mergeGlobals(SN->getGlobalsList());
@@ -1189,10 +1189,10 @@
for (DSNode::globals_iterator I = SN->globals_begin(),
E = SN->globals_end(); I != E; ++I) {
const GlobalValue *GV = *I;
- const DSNodeHandle &SrcGNH = Src.getNodeForValue(GV);
+ const DSNodeHandle &SrcGNH = Src->getNodeForValue(GV);
DSNodeHandle &DestGNH = NodeMap[SrcGNH.getNode()];
assert(DestGNH.getNode()==NH.getNode() &&"Global mapping inconsistent");
- Dest.getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(),
+ Dest->getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(),
DestGNH.getOffset()+SrcGNH.getOffset()));
}
NH.getNode()->mergeGlobals(SN->getGlobalsList());
@@ -1200,7 +1200,7 @@
} else {
// We cannot handle this case without allocating a temporary node. Fall
// back on being simple.
- DSNode *NewDN = new DSNode(*SN, &Dest, true /* Null out all links */);
+ DSNode *NewDN = new DSNode(*SN, Dest, true /* Null out all links */);
NewDN->maskNodeTypes(BitsToKeep);
unsigned NHOffset = NH.getOffset();
@@ -1220,11 +1220,11 @@
for (DSNode::globals_iterator I = SN->globals_begin(),
E = SN->globals_end(); I != E; ++I) {
const GlobalValue *GV = *I;
- const DSNodeHandle &SrcGNH = Src.getNodeForValue(GV);
+ const DSNodeHandle &SrcGNH = Src->getNodeForValue(GV);
DSNodeHandle &DestGNH = NodeMap[SrcGNH.getNode()];
assert(DestGNH.getNode()==NH.getNode() &&"Global mapping inconsistent");
assert(SrcGNH.getNode() == SN && "Global mapping inconsistent");
- Dest.getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(),
+ Dest->getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(),
DestGNH.getOffset()+SrcGNH.getOffset()));
}
}
@@ -1428,9 +1428,9 @@
}
-DSGraph::DSGraph(DSGraph &G, EquivalenceClasses &ECs,
+DSGraph::DSGraph(DSGraph* G, EquivalenceClasses &ECs,
unsigned CloneFlags)
- : GlobalsGraph(0), ScalarMap(ECs), TD(G.TD) {
+ : GlobalsGraph(0), ScalarMap(ECs), TD(G->TD) {
PrintAuxCalls = false;
cloneInto(G, CloneFlags);
}
@@ -1514,9 +1514,9 @@
///
/// The CloneFlags member controls various aspects of the cloning process.
///
-void DSGraph::cloneInto( DSGraph &G, unsigned CloneFlags) {
+void DSGraph::cloneInto( DSGraph* G, unsigned CloneFlags) {
TIME_REGION(X, "cloneInto");
- assert(&G != this && "Cannot clone graph into itself!");
+ assert(G != this && "Cannot clone graph into itself!");
NodeMapTy OldNodeMap;
@@ -1526,7 +1526,7 @@
| ((CloneFlags & StripIncompleteBit)? DSNode::IncompleteNode : 0);
BitsToClear |= DSNode::DeadNode; // Clear dead flag...
- for (node_const_iterator I = G.node_begin(), E = G.node_end(); I != E; ++I) {
+ for (node_const_iterator I = G->node_begin(), E = G->node_end(); I != E; ++I) {
assert(!I->isForwarding() &&
"Forward nodes shouldn't be in node list!");
DSNode *New = new DSNode(*I, this);
@@ -1550,8 +1550,8 @@
I->second.getNode()->remapLinks(OldNodeMap);
// Copy the scalar map... merging all of the global nodes...
- for (DSScalarMap::const_iterator I = G.ScalarMap.begin(),
- E = G.ScalarMap.end(); I != E; ++I) {
+ for (DSScalarMap::const_iterator I = G->ScalarMap.begin(),
+ E = G->ScalarMap.end(); I != E; ++I) {
DSNodeHandle &MappedNode = OldNodeMap[I->second.getNode()];
DSNodeHandle &H = ScalarMap.getRawEntryRef(I->first);
DSNode *MappedNodeN = MappedNode.getNode();
@@ -1561,19 +1561,19 @@
if (!(CloneFlags & DontCloneCallNodes)) {
// Copy the function calls list.
- for (fc_iterator I = G.fc_begin(), E = G.fc_end(); I != E; ++I)
+ for (fc_iterator I = G->fc_begin(), E = G->fc_end(); I != E; ++I)
FunctionCalls.push_back(DSCallSite(*I, OldNodeMap));
}
if (!(CloneFlags & DontCloneAuxCallNodes)) {
// Copy the auxiliary function calls list.
- for (afc_iterator I = G.afc_begin(), E = G.afc_end(); I != E; ++I)
+ for (afc_iterator I = G->afc_begin(), E = G->afc_end(); I != E; ++I)
AuxFunctionCalls.push_back(DSCallSite(*I, OldNodeMap));
}
// Map the return node pointers over...
- for (retnodes_iterator I = G.retnodes_begin(),
- E = G.retnodes_end(); I != E; ++I) {
+ for (retnodes_iterator I = G->retnodes_begin(),
+ E = G->retnodes_end(); I != E; ++I) {
const DSNodeHandle &Ret = I->second;
DSNodeHandle &MappedRet = OldNodeMap[Ret.getNode()];
DSNode *MappedRetN = MappedRet.getNode();
@@ -1587,28 +1587,29 @@
/// this graph, then clearing the RHS graph. Instead of performing this as
/// two seperate operations, do it as a single, much faster, one.
///
-void DSGraph::spliceFrom(DSGraph &RHS) {
+void DSGraph::spliceFrom(DSGraph* RHS) {
+ assert(this != RHS && "Splicing self");
// Change all of the nodes in RHS to think we are their parent.
- for (NodeListTy::iterator I = RHS.Nodes.begin(), E = RHS.Nodes.end();
+ for (NodeListTy::iterator I = RHS->Nodes.begin(), E = RHS->Nodes.end();
I != E; ++I)
I->setParentGraph(this);
// Take all of the nodes.
- Nodes.splice(Nodes.end(), RHS.Nodes);
+ Nodes.splice(Nodes.end(), RHS->Nodes);
// Take all of the calls.
- FunctionCalls.splice(FunctionCalls.end(), RHS.FunctionCalls);
- AuxFunctionCalls.splice(AuxFunctionCalls.end(), RHS.AuxFunctionCalls);
+ FunctionCalls.splice(FunctionCalls.end(), RHS->FunctionCalls);
+ AuxFunctionCalls.splice(AuxFunctionCalls.end(), RHS->AuxFunctionCalls);
// Take all of the return nodes.
if (ReturnNodes.empty()) {
- ReturnNodes.swap(RHS.ReturnNodes);
+ ReturnNodes.swap(RHS->ReturnNodes);
} else {
- ReturnNodes.insert(RHS.ReturnNodes.begin(), RHS.ReturnNodes.end());
- RHS.ReturnNodes.clear();
+ ReturnNodes.insert(RHS->ReturnNodes.begin(), RHS->ReturnNodes.end());
+ RHS->ReturnNodes.clear();
}
// Merge the scalar map in.
- ScalarMap.spliceFrom(RHS.ScalarMap);
+ ScalarMap.spliceFrom(RHS->ScalarMap);
}
/// spliceFrom - Copy all entries from RHS, then clear RHS.
@@ -1783,7 +1784,7 @@
// Clone the callee's graph into the current graph, keeping track of where
// scalars in the old graph _used_ to point, and of the new nodes matching
// nodes of the old graph.
- ReachabilityCloner RC(*this, Graph, CloneFlags);
+ ReachabilityCloner RC(this, &Graph, CloneFlags);
// Map the return node pointer over.
if (!CS.getRetVal().isNull())
@@ -2348,7 +2349,7 @@
// Strip all incomplete bits since they are short-lived properties and they
// will be correctly computed when rematerializing nodes into the functions.
//
- ReachabilityCloner GGCloner(*GlobalsGraph, *this, DSGraph::StripAllocaBit |
+ ReachabilityCloner GGCloner(GlobalsGraph, this, DSGraph::StripAllocaBit |
DSGraph::StripIncompleteBit);
// Mark all nodes reachable by (non-global) scalar nodes as alive...
@@ -2647,7 +2648,7 @@
///
void DSGraph::updateFromGlobalGraph() {
TIME_REGION(X, "updateFromGlobalGraph");
- ReachabilityCloner RC(*this, *GlobalsGraph, 0);
+ ReachabilityCloner RC(this, GlobalsGraph, 0);
// Clone the non-up-to-date global nodes into this graph.
for (DSScalarMap::global_iterator I = getScalarMap().global_begin(),
@@ -2678,12 +2679,12 @@
void DataStructures::deleteValue(Value *V) {
if (const Function *F = getFnForValue(V)) { // Function local value?
// If this is a function local value, just delete it from the scalar map!
- getDSGraph(*F).getScalarMap().eraseIfExists(V);
+ getDSGraph(*F)->getScalarMap().eraseIfExists(V);
return;
}
if (Function *F = dyn_cast(V)) {
- assert(getDSGraph(*F).getReturnNodes().size() == 1 &&
+ assert(getDSGraph(*F)->getReturnNodes().size() == 1 &&
"cannot handle scc's");
delete DSInfo[F];
DSInfo.erase(F);
@@ -2697,7 +2698,7 @@
if (From == To) return;
if (const Function *F = getFnForValue(From)) { // Function local value?
// If this is a function local value, just delete it from the scalar map!
- getDSGraph(*F).getScalarMap().copyScalarIfExists(From, To);
+ getDSGraph(*F)->getScalarMap().copyScalarIfExists(From, To);
return;
}
@@ -2716,8 +2717,7 @@
}
if (const Function *F = getFnForValue(To)) {
- DSGraph &G = getDSGraph(*F);
- G.getScalarMap().copyScalarIfExists(From, To);
+ getDSGraph(*F)->getScalarMap().copyScalarIfExists(From, To);
return;
}
@@ -2727,12 +2727,12 @@
abort();
}
-DSGraph& DataStructures::getOrCreateGraph(const Function* F) {
+DSGraph* DataStructures::getOrCreateGraph(const Function* F) {
assert(F && "No function");
DSGraph *&G = DSInfo[F];
if (!G) {
//Clone or Steal the Source Graph
- DSGraph &BaseGraph = GraphSource->getDSGraph(*F);
+ DSGraph* BaseGraph = GraphSource->getDSGraph(*F);
if (Clone) {
G = new DSGraph(BaseGraph, GlobalECs, DSGraph::DontCloneAuxCallNodes);
} else {
@@ -2751,7 +2751,7 @@
if (RI->first != F)
DSInfo[RI->first] = G;
}
- return *G;
+ return G;
}
@@ -2873,11 +2873,13 @@
}
void DataStructures::releaseMemory() {
+ hash_set toDelete;
for (DSInfoTy::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) {
- I->second->getReturnNodes().erase(I->first);
- if (I->second->getReturnNodes().empty())
- delete I->second;
+ I->second->getReturnNodes().clear();
+ toDelete.insert(I->second);
}
+ for (hash_set::iterator I = toDelete.begin(), E = toDelete.end(); I != E; ++I)
+ delete *I;
// Empty map so next time memory is released, data structures are not
// re-deleted.
Modified: poolalloc/trunk/lib/DSA/DataStructureAA.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructureAA.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructureAA.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructureAA.cpp Mon Oct 20 10:48:53 2008
@@ -113,11 +113,11 @@
//
DSGraph *DSAA::getGraphForValue(const Value *V) {
if (const Instruction *I = dyn_cast(V))
- return &TD->getDSGraph(*I->getParent()->getParent());
+ return TD->getDSGraph(*I->getParent()->getParent());
else if (const Argument *A = dyn_cast(V))
- return &TD->getDSGraph(*A->getParent());
+ return TD->getDSGraph(*A->getParent());
else if (const BasicBlock *BB = dyn_cast(V))
- return &TD->getDSGraph(*BB->getParent());
+ return TD->getDSGraph(*BB->getParent());
return 0;
}
@@ -130,9 +130,9 @@
assert((!G1 || !G2 || G1 == G2) && "Alias query for 2 different functions?");
// Get the graph to use...
- DSGraph &G = *(G1 ? G1 : (G2 ? G2 : &TD->getGlobalsGraph()));
+ DSGraph* G = G1 ? G1 : (G2 ? G2 : TD->getGlobalsGraph());
- const DSGraph::ScalarMapTy &GSM = G.getScalarMap();
+ const DSGraph::ScalarMapTy &GSM = G->getScalarMap();
DSGraph::ScalarMapTy::const_iterator I = GSM.find((Value*)V1);
if (I == GSM.end()) return NoAlias;
@@ -178,10 +178,10 @@
if (CS.getInstruction() == MapCS.getInstruction()) {
{
const Function *Caller = CS.getInstruction()->getParent()->getParent();
- DSGraph &CallerTDGraph = TD->getDSGraph(*Caller);
+ DSGraph* CallerTDGraph = TD->getDSGraph(*Caller);
// Figure out which node in the TD graph this pointer corresponds to.
- DSScalarMap &CallerSM = CallerTDGraph.getScalarMap();
+ DSScalarMap &CallerSM = CallerTDGraph->getScalarMap();
DSScalarMap::iterator NI = CallerSM.find(P);
if (NI == CallerSM.end()) {
InvalidateCache();
@@ -229,7 +229,7 @@
// the portion of the program we have analyzed, we can draw conclusions
// based on whether the global escapes the program.
Function *Caller = CS.getInstruction()->getParent()->getParent();
- DSGraph *G = &TD->getDSGraph(*Caller);
+ DSGraph *G = TD->getDSGraph(*Caller);
DSScalarMap::iterator NI = G->getScalarMap().find(P);
if (NI == G->getScalarMap().end()) {
// If it wasn't in the local function graph, check the global graph. This
@@ -251,11 +251,11 @@
// Get the graphs for the callee and caller. Note that we want the BU graph
// for the callee because we don't want all caller's effects incorporated!
const Function *Caller = CS.getInstruction()->getParent()->getParent();
- DSGraph &CallerTDGraph = TD->getDSGraph(*Caller);
- DSGraph &CalleeBUGraph = BU->getDSGraph(*F);
+ DSGraph* CallerTDGraph = TD->getDSGraph(*Caller);
+ DSGraph* CalleeBUGraph = BU->getDSGraph(*F);
// Figure out which node in the TD graph this pointer corresponds to.
- DSScalarMap &CallerSM = CallerTDGraph.getScalarMap();
+ DSScalarMap &CallerSM = CallerTDGraph->getScalarMap();
DSScalarMap::iterator NI = CallerSM.find(P);
if (NI == CallerSM.end()) {
ModRefResult Result = ModRef;
@@ -267,9 +267,9 @@
"This isn't a global that DSA inconsiderately dropped "
"from the graph?");
- DSGraph &GG = *CallerTDGraph.getGlobalsGraph();
- DSScalarMap::iterator NI = GG.getScalarMap().find(P);
- if (NI != GG.getScalarMap().end() && !NI->second.isNull()) {
+ DSGraph* GG = CallerTDGraph->getGlobalsGraph();
+ DSScalarMap::iterator NI = GG->getScalarMap().find(P);
+ if (NI != GG->getScalarMap().end() && !NI->second.isNull()) {
// Otherwise, if the node is only M or R, return this. This can be
// useful for globals that should be marked const but are not.
DSNode *N = NI->second.getNode();
@@ -287,9 +287,9 @@
// Compute the mapping from nodes in the callee graph to the nodes in the
// caller graph for this call site.
DSGraph::NodeMapTy CalleeCallerMap;
- DSCallSite DSCS = CallerTDGraph.getDSCallSiteForCallSite(CS);
- CallerTDGraph.computeCalleeCallerMapping(DSCS, *F, CalleeBUGraph,
- CalleeCallerMap);
+ DSCallSite DSCS = CallerTDGraph->getDSCallSiteForCallSite(CS);
+ CallerTDGraph->computeCalleeCallerMapping(DSCS, *F, *CalleeBUGraph,
+ CalleeCallerMap);
// Remember the mapping and the call site for future queries.
MapCS = CS;
Modified: poolalloc/trunk/lib/DSA/DataStructureOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructureOpt.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructureOpt.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructureOpt.cpp Mon Oct 20 10:48:53 2008
@@ -60,8 +60,8 @@
/// global variables.
///
bool DSOpt::OptimizeGlobals(Module &M) {
- DSGraph &GG = TD->getGlobalsGraph();
- const DSGraph::ScalarMapTy &SM = GG.getScalarMap();
+ DSGraph* GG = TD->getGlobalsGraph();
+ const DSGraph::ScalarMapTy &SM = GG->getScalarMap();
bool Changed = false;
for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
Modified: poolalloc/trunk/lib/DSA/DataStructureStats.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructureStats.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructureStats.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructureStats.cpp Mon Oct 20 10:48:53 2008
@@ -146,7 +146,7 @@
bool DSGraphStats::runOnFunction(Function& F) {
- TDGraph = &getAnalysis().getDSGraph(F);
+ TDGraph = getAnalysis().getDSGraph(F);
countCallees(F);
visit(F);
return true;
Modified: poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp (original)
+++ poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp Mon Oct 20 10:48:53 2008
@@ -65,7 +65,7 @@
MI != GlobalECs.member_end(); ++MI) {
if (const Function* F = dyn_cast(*MI)) {
if (!BaseGraph) {
- BaseGraph = &getOrCreateGraph(F);
+ BaseGraph = getOrCreateGraph(F);
BaseGraph->getFunctionArgumentsForCall(F, Args);
} else if (BaseGraph->containsFunction(F)) {
//already merged
Modified: poolalloc/trunk/lib/DSA/GraphChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/GraphChecker.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/GraphChecker.cpp (original)
+++ poolalloc/trunk/lib/DSA/GraphChecker.cpp Mon Oct 20 10:48:53 2008
@@ -71,7 +71,7 @@
void print(std::ostream &O, const Module *M) const {}
private:
- void verify(const DSGraph &G);
+ void verify(const DSGraph* G);
};
RegisterPass X("datastructure-gc", "DSA Graph Checking Pass");
@@ -120,14 +120,14 @@
/// verify - This is the function which checks to make sure that all of the
/// invariants established on the command line are true.
///
-void DSGC::verify(const DSGraph &G) {
+void DSGC::verify(const DSGraph* G) {
// Loop over all of the nodes, checking to see if any are collapsed...
if (AbortIfAnyCollapsed) {
- for (DSGraph::node_const_iterator I = G.node_begin(), E = G.node_end();
+ for (DSGraph::node_const_iterator I = G->node_begin(), E = G->node_end();
I != E; ++I)
if (I->isNodeCompletelyFolded()) {
cerr << "Node is collapsed: ";
- I->print(cerr, &G);
+ I->print(cerr, G);
abort();
}
}
@@ -168,7 +168,7 @@
// Now we loop over all of the scalars, checking to see if any are collapsed
// that are not supposed to be, or if any are merged together.
- const DSGraph::ScalarMapTy &SM = G.getScalarMap();
+ const DSGraph::ScalarMapTy &SM = G->getScalarMap();
std::map AbortIfMergedNodes;
for (DSGraph::ScalarMapTy::const_iterator I = SM.begin(), E = SM.end();
@@ -180,7 +180,7 @@
// Verify it is not collapsed if it is not supposed to be...
if (N->isNodeCompletelyFolded() && AbortIfCollapsedS.count(Name)) {
cerr << "Node for value '%" << Name << "' is collapsed: ";
- N->print(cerr, &G);
+ N->print(cerr, G);
abort();
}
@@ -188,7 +188,7 @@
cerr << "Node flags are not as expected for node: " << Name
<< " (" << CheckFlagsM[Name] << ":" <getNodeFlags()
<< ")\n";
- N->print(cerr, &G);
+ N->print(cerr, G);
abort();
}
@@ -197,7 +197,7 @@
if (AbortIfMergedNodes.count(N)) {
cerr << "Nodes for values '%" << Name << "' and '%"
<< AbortIfMergedNodes[N] << "' is merged: ";
- N->print(cerr, &G);
+ N->print(cerr, G);
abort();
}
AbortIfMergedNodes[N] = Name;
Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Mon Oct 20 10:48:53 2008
@@ -140,7 +140,7 @@
// If there are any constant globals referenced in this function, merge their
// initializers into the local graph from the globals graph.
if (g.getScalarMap().global_begin() != g.getScalarMap().global_end()) {
- ReachabilityCloner RC(g, *g.getGlobalsGraph(), 0);
+ ReachabilityCloner RC(&g, g.getGlobalsGraph(), 0);
for (DSScalarMap::global_iterator I = g.getScalarMap().global_begin();
I != g.getScalarMap().global_end(); ++I)
Modified: poolalloc/trunk/lib/DSA/Printer.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Printer.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Printer.cpp (original)
+++ poolalloc/trunk/lib/DSA/Printer.cpp Mon Oct 20 10:48:53 2008
@@ -283,15 +283,15 @@
unsigned TotalNumNodes = 0, TotalCallNodes = 0;
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
if (C.hasDSGraph(*I)) {
- DSGraph &Gr = C.getDSGraph((Function&)*I);
- unsigned NumCalls = Gr.shouldPrintAuxCalls() ?
- Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size();
+ DSGraph* Gr = C.getDSGraph((Function&)*I);
+ unsigned NumCalls = Gr->shouldPrintAuxCalls() ?
+ Gr->getAuxFunctionCalls().size() : Gr->getFunctionCalls().size();
bool IsDuplicateGraph = false;
if (I->getName() == "main" || !OnlyPrintMain) {
- const Function *SCCFn = Gr.retnodes_begin()->first;
+ const Function *SCCFn = Gr->retnodes_begin()->first;
if (&*I == SCCFn) {
- Gr.writeGraphToFile(O, Prefix+I->getName());
+ Gr->writeGraphToFile(O, Prefix+I->getName());
} else {
IsDuplicateGraph = true; // Don't double count node/call nodes.
O << "Didn't write '" << Prefix+I->getName()
@@ -299,36 +299,36 @@
<< "\n";
}
} else {
- const Function *SCCFn = Gr.retnodes_begin()->first;
+ const Function *SCCFn = Gr->retnodes_begin()->first;
if (&*I == SCCFn) {
O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... ["
- << Gr.getGraphSize() << "+" << NumCalls << "]\n";
+ << Gr->getGraphSize() << "+" << NumCalls << "]\n";
} else {
IsDuplicateGraph = true; // Don't double count node/call nodes.
}
}
if (!IsDuplicateGraph) {
- unsigned GraphSize = Gr.getGraphSize();
+ unsigned GraphSize = Gr->getGraphSize();
if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize;
- TotalNumNodes += Gr.getGraphSize();
+ TotalNumNodes += Gr->getGraphSize();
TotalCallNodes += NumCalls;
- for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end();
+ for (DSGraph::node_iterator NI = Gr->node_begin(), E = Gr->node_end();
NI != E; ++NI)
if (NI->isNodeCompletelyFolded())
++NumFoldedNodes;
}
}
- DSGraph &GG = C.getGlobalsGraph();
- TotalNumNodes += GG.getGraphSize();
- TotalCallNodes += GG.getFunctionCalls().size();
+ DSGraph* GG = C.getGlobalsGraph();
+ TotalNumNodes += GG->getGraphSize();
+ TotalCallNodes += GG->getFunctionCalls().size();
if (!OnlyPrintMain) {
- GG.writeGraphToFile(O, Prefix+"GlobalsGraph");
+ GG->writeGraphToFile(O, Prefix+"GlobalsGraph");
} else {
O << "Skipped Writing '" << Prefix << "GlobalsGraph.dot'... ["
- << GG.getGraphSize() << "+" << GG.getFunctionCalls().size() << "]\n";
+ << GG->getGraphSize() << "+" << GG->getFunctionCalls().size() << "]\n";
}
O << "\nGraphs contain [" << TotalNumNodes << "+" << TotalCallNodes
Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original)
+++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Mon Oct 20 10:48:53 2008
@@ -170,10 +170,10 @@
ii != ee; ++ii)
if (CallInst* CI = dyn_cast(ii))
if (CI->getOperand(0) == F) {
- DSGraph& Graph = getDSGraph(*CI->getParent()->getParent());
+ DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
//delete the call
DOUT << "Removing " << F->getName() << " from " << CI->getParent()->getParent()->getName() << "\n";
- Graph.removeFunctionCalls(*F);
+ Graph->removeFunctionCalls(*F);
}
}
@@ -194,46 +194,46 @@
ii != ee; ++ii)
if (CallInst* CI = dyn_cast(ii))
if (CI->getOperand(0) == F) {
- DSGraph& Graph = getDSGraph(*CI->getParent()->getParent());
+ DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
if (recFuncs[x].action.read[0])
- Graph.getNodeForValue(CI).getNode()->setReadMarker();
+ Graph->getNodeForValue(CI).getNode()->setReadMarker();
if (recFuncs[x].action.write[0])
- Graph.getNodeForValue(CI).getNode()->setModifiedMarker();
+ Graph->getNodeForValue(CI).getNode()->setModifiedMarker();
if (recFuncs[x].action.heap[0])
- Graph.getNodeForValue(CI).getNode()->setHeapMarker();
+ Graph->getNodeForValue(CI).getNode()->setHeapMarker();
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (recFuncs[x].action.read[y])
if (isa(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph.getNodeForValue(CI->getOperand(y)).getNode())
+ if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
Node->setReadMarker();
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (recFuncs[x].action.write[y])
if (isa(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph.getNodeForValue(CI->getOperand(y)).getNode())
+ if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
Node->setModifiedMarker();
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (recFuncs[x].action.heap[y])
if (isa(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph.getNodeForValue(CI->getOperand(y)).getNode())
+ if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
Node->setHeapMarker();
std::vector toMerge;
if (recFuncs[x].action.mergeWithRet)
- toMerge.push_back(Graph.getNodeForValue(CI));
+ toMerge.push_back(Graph->getNodeForValue(CI));
if (recFuncs[x].action.mergeAllArgs || recFuncs[x].action.mergeWithRet)
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (isa(CI->getOperand(y)->getType()))
- toMerge.push_back(Graph.getNodeForValue(CI->getOperand(y)));
+ toMerge.push_back(Graph->getNodeForValue(CI->getOperand(y)));
for (unsigned y = 1; y < toMerge.size(); ++y)
toMerge[0].mergeWith(toMerge[y]);
if (recFuncs[x].action.collapse) {
if (isa(CI->getType()))
- Graph.getNodeForValue(CI).getNode()->foldNodeCompletely();
+ Graph->getNodeForValue(CI).getNode()->foldNodeCompletely();
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (isa(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph.getNodeForValue(CI->getOperand(y)).getNode())
+ if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
Node->foldNodeCompletely();
}
}
@@ -241,10 +241,10 @@
ii != ee; ++ii)
if (CallInst* CI = dyn_cast(ii))
if (CI->getOperand(0) == F) {
- DSGraph& Graph = getDSGraph(*CI->getParent()->getParent());
+ DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
//delete the call
DOUT << "Removing " << F->getName() << " from " << CI->getParent()->getParent()->getName() << "\n";
- Graph.removeFunctionCalls(*F);
+ Graph->removeFunctionCalls(*F);
}
}
Modified: poolalloc/trunk/lib/DSA/TopDownClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TopDownClosure.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/TopDownClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/TopDownClosure.cpp Mon Oct 20 10:48:53 2008
@@ -125,7 +125,7 @@
// Visit each of the graphs in reverse post-order now!
while (!PostOrder.empty()) {
- InlineCallersIntoGraph(*PostOrder.back());
+ InlineCallersIntoGraph(PostOrder.back());
PostOrder.pop_back();
}
}
@@ -148,29 +148,29 @@
hash_set &Visited,
std::vector &PostOrder) {
if (F.isDeclaration()) return;
- DSGraph &G = getOrCreateGraph(&F);
- if (Visited.count(&G)) return;
- Visited.insert(&G);
+ DSGraph* G = getOrCreateGraph(&F);
+ if (Visited.count(G)) return;
+ Visited.insert(G);
// Recursively traverse all of the callee graphs.
- for (DSGraph::fc_iterator CI = G.fc_begin(), CE = G.fc_end(); CI != CE; ++CI){
+ for (DSGraph::fc_iterator CI = G->fc_begin(), CE = G->fc_end(); CI != CE; ++CI){
Instruction *CallI = CI->getCallSite().getInstruction();
for (callee_iterator I = callee_begin(CallI),
E = callee_end(CallI); I != E; ++I)
ComputePostOrder(**I, Visited, PostOrder);
}
- PostOrder.push_back(&G);
+ PostOrder.push_back(G);
}
/// InlineCallersIntoGraph - Inline all of the callers of the specified DS graph
/// into it, then recompute completeness of nodes in the resultant graph.
-void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) {
+void TDDataStructures::InlineCallersIntoGraph(DSGraph* DSG) {
// Inline caller graphs into this graph. First step, get the list of call
// sites that call into this graph.
std::vector EdgesFromCaller;
std::map >::iterator
- CEI = CallerEdges.find(&DSG);
+ CEI = CallerEdges.find(DSG);
if (CEI != CallerEdges.end()) {
std::swap(CEI->second, EdgesFromCaller);
CallerEdges.erase(CEI);
@@ -186,21 +186,21 @@
// post-pass over all of the graphs. We need to take cloning out of
// removeDeadNodes and gut removeDeadNodes at the same time first though. :(
{
- DSGraph &GG = *DSG.getGlobalsGraph();
+ DSGraph* GG = DSG->getGlobalsGraph();
ReachabilityCloner RC(DSG, GG,
DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
for (DSScalarMap::global_iterator
- GI = DSG.getScalarMap().global_begin(),
- E = DSG.getScalarMap().global_end(); GI != E; ++GI)
- RC.getClonedNH(GG.getNodeForValue(*GI));
+ GI = DSG->getScalarMap().global_begin(),
+ E = DSG->getScalarMap().global_end(); GI != E; ++GI)
+ RC.getClonedNH(GG->getNodeForValue(*GI));
}
- DOUT << "[TD] Inlining callers into '" << DSG.getFunctionNames() << "'\n";
+ DOUT << "[TD] Inlining callers into '" << DSG->getFunctionNames() << "'\n";
// Iteratively inline caller graphs into this graph.
while (!EdgesFromCaller.empty()) {
- DSGraph &CallerGraph = *EdgesFromCaller.back().CallerGraph;
+ DSGraph* CallerGraph = EdgesFromCaller.back().CallerGraph;
// Iterate through all of the call sites of this graph, cloning and merging
// any nodes required by the call.
@@ -213,7 +213,7 @@
const DSCallSite &CS = *EdgesFromCaller.back().CS;
const Function &CF = *EdgesFromCaller.back().CalledFunction;
DOUT << " [TD] Inlining graph into Fn '" << CF.getName() << "' from ";
- if (CallerGraph.getReturnNodes().empty())
+ if (CallerGraph->getReturnNodes().empty())
DOUT << "SYNTHESIZED INDIRECT GRAPH";
else
DOUT << "Fn '" << CS.getCallSite().getInstruction()->
@@ -222,25 +222,25 @@
// Get the formal argument and return nodes for the called function and
// merge them with the cloned subgraph.
- DSCallSite T1 = DSG.getCallSiteForArguments(CF);
+ DSCallSite T1 = DSG->getCallSiteForArguments(CF);
RC.mergeCallSite(T1, CS);
++NumTDInlines;
EdgesFromCaller.pop_back();
} while (!EdgesFromCaller.empty() &&
- EdgesFromCaller.back().CallerGraph == &CallerGraph);
+ EdgesFromCaller.back().CallerGraph == CallerGraph);
}
// Next, now that this graph is finalized, we need to recompute the
// incompleteness markers for this graph and remove unreachable nodes.
- DSG.maskIncompleteMarkers();
+ DSG->maskIncompleteMarkers();
// If any of the functions has incomplete incoming arguments, don't mark any
// of them as complete.
bool HasIncompleteArgs = false;
- for (DSGraph::retnodes_iterator I = DSG.retnodes_begin(),
- E = DSG.retnodes_end(); I != E; ++I)
+ for (DSGraph::retnodes_iterator I = DSG->retnodes_begin(),
+ E = DSG->retnodes_end(); I != E; ++I)
if (ArgsRemainIncomplete.count(I->first)) {
HasIncompleteArgs = true;
break;
@@ -249,28 +249,28 @@
// Recompute the Incomplete markers. Depends on whether args are complete
unsigned Flags
= HasIncompleteArgs ? DSGraph::MarkFormalArgs : DSGraph::IgnoreFormalArgs;
- DSG.markIncompleteNodes(Flags | DSGraph::IgnoreGlobals);
+ DSG->markIncompleteNodes(Flags | DSGraph::IgnoreGlobals);
// Delete dead nodes. Treat globals that are unreachable as dead also.
- DSG.removeDeadNodes(DSGraph::RemoveUnreachableGlobals);
+ DSG->removeDeadNodes(DSGraph::RemoveUnreachableGlobals);
// We are done with computing the current TD Graph! Finally, before we can
// finish processing this function, we figure out which functions it calls and
// records these call graph edges, so that we have them when we process the
// callee graphs.
- if (DSG.fc_begin() == DSG.fc_end()) return;
+ if (DSG->fc_begin() == DSG->fc_end()) return;
// Loop over all the call sites and all the callees at each call site, and add
// edges to the CallerEdges structure for each callee.
- for (DSGraph::fc_iterator CI = DSG.fc_begin(), E = DSG.fc_end();
+ for (DSGraph::fc_iterator CI = DSG->fc_begin(), E = DSG->fc_end();
CI != E; ++CI) {
// Handle direct calls efficiently.
if (CI->isDirectCall()) {
if (!CI->getCalleeFunc()->isDeclaration() &&
- !DSG.getReturnNodes().count(CI->getCalleeFunc()))
- CallerEdges[&getOrCreateGraph(CI->getCalleeFunc())]
- .push_back(CallerCallEdge(&DSG, &*CI, CI->getCalleeFunc()));
+ !DSG->getReturnNodes().count(CI->getCalleeFunc()))
+ CallerEdges[getOrCreateGraph(CI->getCalleeFunc())]
+ .push_back(CallerCallEdge(DSG, &*CI, CI->getCalleeFunc()));
continue;
}
@@ -280,7 +280,7 @@
callee_begin(CallI), IPE = callee_end(CallI);
// Skip over all calls to this graph (SCC calls).
- while (IPI != IPE && &getDSGraph(**IPI) == &DSG)
+ while (IPI != IPE && getDSGraph(**IPI) == DSG)
++IPI;
// All SCC calls?
@@ -290,15 +290,15 @@
++IPI;
// Skip over more SCC calls.
- while (IPI != IPE && &getDSGraph(**IPI) == &DSG)
+ while (IPI != IPE && getDSGraph(**IPI) == DSG)
++IPI;
// If there is exactly one callee from this call site, remember the edge in
// CallerEdges.
if (IPI == IPE) {
if (!FirstCallee->isDeclaration())
- CallerEdges[&getOrCreateGraph(FirstCallee)]
- .push_back(CallerCallEdge(&DSG, &*CI, FirstCallee));
+ CallerEdges[getOrCreateGraph(FirstCallee)]
+ .push_back(CallerCallEdge(DSG, &*CI, FirstCallee));
continue;
}
@@ -326,7 +326,7 @@
IndCallGraph = IndCallRecI->second;
} else {
// Otherwise, create a new DSGraph to represent this.
- IndCallGraph = new DSGraph(DSG.getGlobalECs(), DSG.getTargetData());
+ IndCallGraph = new DSGraph(DSG->getGlobalECs(), DSG->getTargetData());
// Make a nullary dummy call site, which will eventually get some content
// merged into it. The actual callee function doesn't matter here, so we
// just pass it something to keep the ctor happy.
@@ -342,16 +342,16 @@
// exactly once.
DSCallSite *NCS = &IndCallGraph->getFunctionCalls().front();
for (unsigned i = 0, e = Callees.size(); i != e; ++i) {
- DSGraph& CalleeGraph = getDSGraph(*Callees[i]);
- if (&CalleeGraph != &DSG)
- CallerEdges[&CalleeGraph].push_back(CallerCallEdge(IndCallGraph, NCS,
- Callees[i]));
+ DSGraph* CalleeGraph = getDSGraph(*Callees[i]);
+ if (CalleeGraph != DSG)
+ CallerEdges[CalleeGraph].push_back(CallerCallEdge(IndCallGraph, NCS,
+ Callees[i]));
}
}
// Now that we know which graph to use for this, merge the caller
// information into the graph, based on information from the call site.
- ReachabilityCloner RC(*IndCallGraph, DSG, 0);
+ ReachabilityCloner RC(IndCallGraph, DSG, 0);
RC.mergeCallSite(IndCallGraph->getFunctionCalls().front(), *CI);
}
}
Modified: poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp Mon Oct 20 10:48:53 2008
@@ -38,7 +38,7 @@
void getAnalysisUsage(AnalysisUsage &AU) const;
- const DSGraph &getGraphForFunc(PA::FuncInfo *FI) const {
+ const DSGraph* getGraphForFunc(PA::FuncInfo *FI) const {
return G->getDSGraph(FI->F);
}
static char ID;
@@ -46,7 +46,7 @@
private:
void InitializeLibraryFunctions(Module &M);
void InstrumentAccess(Instruction *I, Value *Ptr,
- PA::FuncInfo *FI, DSGraph &DSG);
+ PA::FuncInfo *FI, DSGraph* DSG);
};
char PoolAccessTrace::ID = 0;
@@ -72,7 +72,7 @@
}
void PoolAccessTrace::InstrumentAccess(Instruction *I, Value *Ptr,
- PA::FuncInfo *FI, DSGraph &DSG) {
+ PA::FuncInfo *FI, DSGraph* DSG) {
// Don't trace loads of globals or the stack.
if (isa(Ptr) || isa(Ptr)) return;
@@ -82,7 +82,7 @@
// Value didn't exist in the orig program (pool desc?).
return;
}
- DSNode *Node = DSG.getNodeForValue(MappedPtr).getNode();
+ DSNode *Node = DSG->getNodeForValue(MappedPtr).getNode();
if (Node == 0) return;
Value *PD = FI->PoolDescriptors[Node];
@@ -124,7 +124,7 @@
continue;
// Get the DSGraph for this function.
- DSGraph &DSG = G->getDSGraph(FI->F);
+ DSGraph* DSG = G->getDSGraph(FI->F);
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
Modified: poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp Mon Oct 20 10:48:53 2008
@@ -127,7 +127,7 @@
struct AllNodesHeuristic : public Heuristic {
void AssignToPools(const std::vector &NodesToPA,
- Function *F, DSGraph &G,
+ Function *F, DSGraph* G,
std::vector &ResultPools) {
for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i)
ResultPools.push_back(OnePool(NodesToPA[i]));
@@ -145,13 +145,13 @@
struct AllButUnreachableFromMemoryHeuristic : public Heuristic {
void AssignToPools(const std::vector &NodesToPA,
- Function *F, DSGraph &G,
+ Function *F, DSGraph* G,
std::vector &ResultPools) {
// Build a set of all nodes that are reachable from another node in the
// graph. Here we ignore scalar nodes that are only globals as they are
// often global pointers to big arrays.
std::set ReachableFromMemory;
- for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end();
+ for (DSGraph::node_iterator I = G->node_begin(), E = G->node_end();
I != E; ++I) {
DSNode *N = I;
// Ignore nodes that are just globals and not arrays.
@@ -183,7 +183,7 @@
struct CyclicNodesHeuristic : public Heuristic {
void AssignToPools(const std::vector &NodesToPA,
- Function *F, DSGraph &G,
+ Function *F, DSGraph* G,
std::vector &ResultPools);
};
@@ -196,7 +196,7 @@
void CyclicNodesHeuristic::AssignToPools(const std::vector &NodesToPA,
- Function *F, DSGraph &G,
+ Function *F, DSGraph* G,
std::vector &ResultPools) {
for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i)
if (NodeExistsInCycle(NodesToPA[i]))
@@ -212,7 +212,7 @@
struct SmartCoallesceNodesHeuristic : public Heuristic {
void AssignToPools(const std::vector &NodesToPA,
- Function *F, DSGraph &G,
+ Function *F, DSGraph* G,
std::vector &ResultPools) {
// For globals, do not pool allocate unless the node is cyclic and not an
// array (unless it's collapsed).
@@ -397,7 +397,7 @@
virtual bool IsRealHeuristic() { return false; }
void AssignToPools(const std::vector &NodesToPA,
- Function *F, DSGraph &G,
+ Function *F, DSGraph* G,
std::vector &ResultPools) {
if (TheGlobalPD == 0)
TheGlobalPD = PA->CreateGlobalPool(0, 0);
@@ -421,7 +421,7 @@
virtual bool IsRealHeuristic() { return false; }
void AssignToPools(const std::vector &NodesToPA,
- Function *F, DSGraph &G,
+ Function *F, DSGraph* G,
std::vector &ResultPools) {
// For this heuristic, we assign everything possible to its own pool.
for (unsigned i = 0, e = NodesToPA.size(); i != e; ++i)
@@ -485,7 +485,7 @@
virtual bool IsRealHeuristic() { return false; }
void AssignToPools(const std::vector &NodesToPA,
- Function *F, DSGraph &G,
+ Function *F, DSGraph* G,
std::vector &ResultPools) {
// Nothing to pool allocate here.
}
Modified: poolalloc/trunk/lib/PoolAllocate/Heuristic.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/Heuristic.h?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/Heuristic.h (original)
+++ poolalloc/trunk/lib/PoolAllocate/Heuristic.h Mon Oct 20 10:48:53 2008
@@ -37,8 +37,8 @@
Heuristic() {}
public:
- void Initialize(Module &m, DSGraph &gg, PoolAllocate &pa) {
- M = &m; GG = ≫ PA = &pa;
+ void Initialize(Module &m, DSGraph* gg, PoolAllocate &pa) {
+ M = &m; GG = gg; PA = &pa;
}
virtual ~Heuristic();
@@ -79,7 +79,7 @@
/// returning the result in ResultPools. If this is a function being pool
/// allocated, F will not be null.
virtual void AssignToPools(const std::vector &NodesToPA,
- Function *F, DSGraph &G,
+ Function *F, DSGraph* G,
std::vector &ResultPools) = 0;
// Hacks for the OnlyOverhead heuristic.
Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Mon Oct 20 10:48:53 2008
@@ -18,7 +18,6 @@
#include "dsa/DSGraph.h"
#include "dsa/CallTargets.h"
#include "poolalloc/PoolAllocate.h"
-#include "Heuristic.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
@@ -121,7 +120,7 @@
// Merge all of the DSNodes in the DSGraphs.
//
GlobalECs = Graphs->getGlobalECs();
- CombinedDSGraph = new DSGraph (GlobalECs, TD, &(Graphs->getGlobalsGraph()));
+ CombinedDSGraph = new DSGraph (GlobalECs, TD, Graphs->getGlobalsGraph());
//CombinedDSGraph.cloneInto (getGlobalsGraph());
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
if (Graphs->hasDSGraph (*I))
@@ -161,13 +160,13 @@
//
// Get the DSGraph for this function.
//
- DSGraph &ECG = Graphs->getDSGraph(F);
+ DSGraph* ECG = Graphs->getDSGraph(F);
for (Function::iterator i = F.begin(), e = F.end(); i != e; ++i)
for (BasicBlock::iterator ii = i->begin(), ee = i->end(); ii != ee; ++ii) {
if (MallocInst * MI = dyn_cast(ii)) {
// Associate the global pool decriptor with the DSNode
- DSNode * Node = ECG.getNodeForValue(MI).getNode();
+ DSNode * Node = ECG->getNodeForValue(MI).getNode();
FInfo.PoolDescriptors.insert(std::make_pair(Node,TheGlobalPool));
// Mark the malloc as an instruction to delete
@@ -202,7 +201,7 @@
CF = cast(CE->getOperand(0));
if (CF && (CF->isDeclaration()) && (CF->getName() == "realloc")) {
// Associate the global pool decriptor with the DSNode
- DSNode * Node = ECG.getNodeForValue(CI).getNode();
+ DSNode * Node = ECG->getNodeForValue(CI).getNode();
FInfo.PoolDescriptors.insert(std::make_pair(Node,TheGlobalPool));
// Mark the realloc as an instruction to delete
@@ -243,7 +242,7 @@
CI->replaceAllUsesWith(Casted);
} else if (CF && (CF->isDeclaration()) && (CF->getName() == "calloc")) {
// Associate the global pool decriptor with the DSNode
- DSNode * Node = ECG.getNodeForValue(CI).getNode();
+ DSNode * Node = ECG->getNodeForValue(CI).getNode();
FInfo.PoolDescriptors.insert(std::make_pair(Node,TheGlobalPool));
// Mark the realloc as an instruction to delete
@@ -285,7 +284,7 @@
CI->replaceAllUsesWith(Casted);
} else if (CF && (CF->isDeclaration()) && (CF->getName() == "strdup")) {
// Associate the global pool decriptor with the DSNode
- DSNode * Node = ECG.getNodeForValue(CI).getNode();
+ DSNode * Node = ECG->getNodeForValue(CI).getNode();
FInfo.PoolDescriptors.insert(std::make_pair(Node,TheGlobalPool));
// Mark the realloc as an instruction to delete
Modified: poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp Mon Oct 20 10:48:53 2008
@@ -134,7 +134,7 @@
PoolAllocate *getPoolAlloc() const { return PoolAlloc; }
- const DSGraph &getGraphForFunc(PA::FuncInfo *FI) const {
+ const DSGraph* getGraphForFunc(PA::FuncInfo *FI) const {
return ECG->getDSGraph(FI->F);
}
@@ -161,7 +161,7 @@
void FindPoolsToCompress(std::set &Pools,
std::map &PreassignedPools,
- Function &F, DSGraph &DSG, PA::FuncInfo *FI);
+ Function &F, DSGraph* DSG, PA::FuncInfo *FI);
};
char PointerCompress::ID = 0;
@@ -348,7 +348,7 @@
const TargetData &TD;
- DSGraph &DSG;
+ DSGraph* DSG;
/// PAFuncInfo - Information about the transformation the pool allocator did
/// to the original function.
@@ -362,9 +362,9 @@
PointerCompress &PtrComp;
public:
InstructionRewriter(const PointerCompress::PoolInfoMap &poolInfo,
- DSGraph &dsg, PA::FuncInfo &pafi,
+ DSGraph* dsg, PA::FuncInfo &pafi,
FunctionCloneRecord *fcr, PointerCompress &ptrcomp)
- : PoolInfo(poolInfo), TD(dsg.getTargetData()), DSG(dsg),
+ : PoolInfo(poolInfo), TD(dsg->getTargetData()), DSG(dsg),
PAFuncInfo(pafi), FCR(fcr), PtrComp(ptrcomp) {
}
@@ -425,7 +425,7 @@
// Value didn't exist in the orig program (pool desc?).
return DSNodeHandle();
- return DSG.getNodeForValue(V);
+ return DSG->getNodeForValue(V);
}
/// getNodeIfCompressed - If the specified value is a pointer that will be
@@ -479,7 +479,7 @@
} else {
// Otherwise if this was in the original function, remove it from the
// DSG scalar map if it is there.
- DSG.getScalarMap().eraseIfExists(V);
+ DSG->getScalarMap().eraseIfExists(V);
}
}
@@ -507,8 +507,8 @@
// Finally, if this occurred in a function that neither the pool
// allocator nor the ptr compression implementation had to change,
// update the DSGraph.
- if (DSG.getScalarMap().count(&Old))
- DSG.getScalarMap().replaceScalar(&Old, New);
+ if (DSG->getScalarMap().count(&Old))
+ DSG->getScalarMap().replaceScalar(&Old, New);
}
}
@@ -946,7 +946,7 @@
Function *Callee = CI.getCalledFunction();
if (Callee)
if ((FI = PtrComp.getPoolAlloc()->getFuncInfoOrClone(*Callee)))
- CG = &PtrComp.getGraphForFunc(FI);
+ CG = PtrComp.getGraphForFunc(FI);
if (!Callee) {
// Indirect call: you CAN'T passed compress pointers in. Don't even think
@@ -1183,7 +1183,7 @@
void PointerCompress::FindPoolsToCompress(std::set &Pools,
std::map &PreassignedPools,
- Function &F, DSGraph &DSG,
+ Function &F, DSGraph* DSG,
PA::FuncInfo *FI) {
DEBUG(std::cerr << "In function '" << F.getName() << "':\n");
for (unsigned i = 0, e = FI->NodesToPA.size(); i != e; ++i) {
@@ -1212,11 +1212,11 @@
// Map all node reachable from this global to the corresponding nodes in the
// globals graph.
DSGraph::NodeMapTy GlobalsGraphNodeMapping;
- DSG.computeGToGGMapping(GlobalsGraphNodeMapping);
+ DSG->computeGToGGMapping(GlobalsGraphNodeMapping);
// See if there are nodes in this graph that correspond to nodes in the
// globals graph, and if so, if it is compressed.
- for (DSGraph::node_iterator I = DSG.node_begin(), E = DSG.node_end();
+ for (DSGraph::node_iterator I = DSG->node_begin(), E = DSG->node_end();
I != E;++I)
if (GlobalsGraphNodeMapping.count(I)) {
// If it is a global pool, set up the pool descriptor appropriately.
@@ -1262,7 +1262,7 @@
return false;
// Get the DSGraph for this function.
- DSGraph &DSG = ECG->getDSGraph(FI->F);
+ DSGraph* DSG = ECG->getDSGraph(FI->F);
std::set PoolsToCompressSet;
@@ -1301,7 +1301,7 @@
// Use these to compute the closure of compression information. In
// particular, if one pool points to another, we need to know if the outgoing
// pointer is compressed.
- const TargetData &TD = DSG.getTargetData();
+ const TargetData &TD = DSG->getTargetData();
std::cerr << "In function '" << F.getName() << "':\n";
for (std::map::iterator
I = PoolsToCompress.begin(), E = PoolsToCompress.end(); I != E; ++I) {
Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Mon Oct 20 10:48:53 2008
@@ -294,30 +294,30 @@
-static void GetNodesReachableFromGlobals(DSGraph &G,
+static void GetNodesReachableFromGlobals(DSGraph* G,
hash_set &NodesFromGlobals) {
- for (DSScalarMap::global_iterator I = G.getScalarMap().global_begin(),
- E = G.getScalarMap().global_end(); I != E; ++I)
- G.getNodeForValue(*I).getNode()->markReachableNodes(NodesFromGlobals);
+ for (DSScalarMap::global_iterator I = G->getScalarMap().global_begin(),
+ E = G->getScalarMap().global_end(); I != E; ++I)
+ G->getNodeForValue(*I).getNode()->markReachableNodes(NodesFromGlobals);
}
static void MarkNodesWhichMustBePassedIn(hash_set &MarkedNodes,
- Function &F, DSGraph &G,
+ Function &F, DSGraph* G,
bool PassAllArguments) {
// Mark globals and incomplete nodes as live... (this handles arguments)
if (F.getName() != "main") {
// All DSNodes reachable from arguments must be passed in.
for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end();
I != E; ++I) {
- DSGraph::ScalarMapTy::iterator AI = G.getScalarMap().find(I);
- if (AI != G.getScalarMap().end())
+ DSGraph::ScalarMapTy::iterator AI = G->getScalarMap().find(I);
+ if (AI != G->getScalarMap().end())
if (DSNode *N = AI->second.getNode())
N->markReachableNodes(MarkedNodes);
}
}
// Marked the returned node as needing to be passed in.
- if (DSNode *RetNode = G.getReturnNodeFor(F).getNode())
+ if (DSNode *RetNode = G->getReturnNodeFor(F).getNode())
RetNode->markReachableNodes(MarkedNodes);
// Calculate which DSNodes are reachable from globals. If a node is reachable
@@ -343,14 +343,14 @@
/// arguments will have to be added for each function, build the FunctionInfo
/// map and recording this info in the ArgNodes set.
void PoolAllocate::FindFunctionPoolArgs(Function &F) {
- DSGraph &G = Graphs->getDSGraph(F);
+ DSGraph* G = Graphs->getDSGraph(F);
// Create a new entry for F.
FuncInfo &FI =
FunctionInfo.insert(std::make_pair(&F, FuncInfo(F))).first->second;
hash_set &MarkedNodes = FI.MarkedNodes;
- if (G.node_begin() == G.node_end())
+ if (G->node_begin() == G->node_end())
return; // No memory activity, nothing is required
// Find DataStructure nodes which are allocated in pools non-local to the
@@ -366,8 +366,8 @@
// necessary, and return it. If not, just return null.
//
Function *PoolAllocate::MakeFunctionClone(Function &F) {
- DSGraph &G = Graphs->getDSGraph(F);
- if (G.node_begin() == G.node_end()) return 0;
+ DSGraph* G = Graphs->getDSGraph(F);
+ if (G->node_begin() == G->node_end()) return 0;
FuncInfo &FI = *getFuncInfo(F);
if (FI.ArgNodes.empty())
@@ -471,7 +471,7 @@
//
bool PoolAllocate::SetupGlobalPools(Module &M) {
// Get the globals graph for the program.
- DSGraph &GG = Graphs->getGlobalsGraph();
+ DSGraph* GG = Graphs->getGlobalsGraph();
// Get all of the nodes reachable from globals.
hash_set GlobalHeapNodes;
@@ -557,7 +557,7 @@
CurModule);
// Update the global DSGraph to include this.
- DSNode *GNode = Graphs->getGlobalsGraph().addObjectToGraph(GV);
+ DSNode *GNode = Graphs->getGlobalsGraph()->addObjectToGraph(GV);
GNode->setModifiedMarker()->setReadMarker();
Function *MainFunc = CurModule->getFunction("main");
@@ -584,7 +584,7 @@
// the DSNodes specified by the NodesToPA list. This adds an entry to the
// PoolDescriptors map for each DSNode.
//
-void PoolAllocate::CreatePools(Function &F, DSGraph &DSG,
+void PoolAllocate::CreatePools(Function &F, DSGraph* DSG,
const std::vector &NodesToPA,
std::map &PoolDescriptors) {
@@ -592,7 +592,7 @@
TIME_REGION(X, "CreatePools");
std::vector ResultPools;
- CurHeuristic->AssignToPools(NodesToPA, &F, *NodesToPA[0]->getParentGraph(),
+ CurHeuristic->AssignToPools(NodesToPA, &F, NodesToPA[0]->getParentGraph(),
ResultPools);
std::set UnallocatedNodes(NodesToPA.begin(), NodesToPA.end());
@@ -614,14 +614,14 @@
PoolDesc = new AllocaInst(PoolDescType, 0, "PD", InsertPoint);
// Create a node in DSG to represent the new alloca.
- DSNode *NewNode = DSG.addObjectToGraph(PoolDesc);
+ DSNode *NewNode = DSG->addObjectToGraph(PoolDesc);
NewNode->setModifiedMarker()->setReadMarker(); // This is M/R
} else {
PoolDesc = CreateGlobalPool(Pool.PoolSize, Pool.PoolAlignment,
InsertPoint);
// Add the global node to main's graph.
- DSNode *NewNode = DSG.addObjectToGraph(PoolDesc);
+ DSNode *NewNode = DSG->addObjectToGraph(PoolDesc);
NewNode->setModifiedMarker()->setReadMarker(); // This is M/R
if (Pool.NodesInPool.size() == 1 &&
@@ -647,9 +647,9 @@
// the specified function.
//
void PoolAllocate::ProcessFunctionBody(Function &F, Function &NewF) {
- DSGraph &G = Graphs->getDSGraph(F);
+ DSGraph* G = Graphs->getDSGraph(F);
- if (G.node_begin() == G.node_end()) return; // Quick exit if nothing to do.
+ if (G->node_begin() == G->node_end()) return; // Quick exit if nothing to do.
FuncInfo &FI = *getFuncInfo(F);
hash_set &MarkedNodes = FI.MarkedNodes;
@@ -662,11 +662,11 @@
// Map all node reachable from this global to the corresponding nodes in
// the globals graph.
DSGraph::NodeMapTy GlobalsGraphNodeMapping;
- G.computeGToGGMapping(GlobalsGraphNodeMapping);
+ G->computeGToGGMapping(GlobalsGraphNodeMapping);
// Loop over all of the nodes which are non-escaping, adding pool-allocatable
// ones to the NodesToPA vector.
- for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end(); I != E;++I){
+ for (DSGraph::node_iterator I = G->node_begin(), E = G->node_end(); I != E;++I){
// We only need to make a pool if there is a heap object in it...
DSNode *N = I;
if ((N->isHeapNode()) || (BoundsChecksEnabled && (N->isArray()))) {
Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=57830&r1=57829&r2=57830&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Mon Oct 20 10:48:53 2008
@@ -34,7 +34,7 @@
/// allocated functions.
struct FuncTransform : public InstVisitor {
PoolAllocate &PAInfo;
- DSGraph &G; // The Bottom-up DS Graph
+ DSGraph* G; // The Bottom-up DS Graph
FuncInfo &FI;
// PoolUses - For each pool (identified by the pool descriptor) keep track
@@ -47,7 +47,7 @@
// inserted into the code. This is seperated out from PoolUses.
std::multimap &PoolFrees;
- FuncTransform(PoolAllocate &P, DSGraph &g, FuncInfo &fi,
+ FuncTransform(PoolAllocate &P, DSGraph* g, FuncInfo &fi,
std::multimap &poolUses,
std::multimap &poolFrees)
: PAInfo(P), G(g), FI(fi),
@@ -105,7 +105,7 @@
}
DSNodeHandle& getDSNodeHFor(Value *V) {
- return G.getScalarMap()[getOldValueIfAvailable(V)];
+ return G->getScalarMap()[getOldValueIfAvailable(V)];
}
Value *getPoolHandle(Value *V) {
@@ -120,7 +120,7 @@
};
}
-void PoolAllocate::TransformBody(DSGraph &g, PA::FuncInfo &fi,
+void PoolAllocate::TransformBody(DSGraph* g, PA::FuncInfo &fi,
std::multimap &poolUses,
std::multimap &poolFrees,
Function &F) {
@@ -180,9 +180,9 @@
// If we are modifying the original function, update the DSGraph.
if (!FI.Clone) {
// V and Casted now point to whatever the original allocation did.
- G.getScalarMap().replaceScalar(I, V);
+ G->getScalarMap().replaceScalar(I, V);
if (V != Casted)
- G.getScalarMap()[Casted] = G.getScalarMap()[V];
+ G->getScalarMap()[Casted] = G->getScalarMap()[V];
} else { // Otherwise, update the NewToOldValueMap
UpdateNewToOldValueMap(I, V, V != Casted ? Casted : 0);
}
@@ -296,7 +296,7 @@
if (Arg->getType() != PointerType::getUnqual(Type::Int8Ty)) {
Casted = CastInst::CreatePointerCast(Arg, PointerType::getUnqual(Type::Int8Ty),
Arg->getName()+".casted", Where);
- G.getScalarMap()[Casted] = G.getScalarMap()[Arg];
+ G->getScalarMap()[Casted] = G->getScalarMap()[Arg];
}
Value* Opts[2] = {PH, Casted};
@@ -395,9 +395,9 @@
// If we are modifying the original function, update the DSGraph.
if (!FI.Clone) {
// V and Casted now point to whatever the original allocation did.
- G.getScalarMap().replaceScalar(I, V);
+ G->getScalarMap().replaceScalar(I, V);
if (V != Casted)
- G.getScalarMap()[Casted] = G.getScalarMap()[V];
+ G->getScalarMap()[Casted] = G->getScalarMap()[V];
} else { // Otherwise, update the NewToOldValueMap
UpdateNewToOldValueMap(I, V, V != Casted ? Casted : 0);
}
@@ -466,9 +466,9 @@
// If we are modifying the original function, update the DSGraph.
if (!FI.Clone) {
// V and Casted now point to whatever the original allocation did.
- G.getScalarMap().replaceScalar(I, V);
+ G->getScalarMap().replaceScalar(I, V);
if (V != Casted)
- G.getScalarMap()[Casted] = G.getScalarMap()[V];
+ G->getScalarMap()[Casted] = G->getScalarMap()[V];
} else { // Otherwise, update the NewToOldValueMap
UpdateNewToOldValueMap(I, V, V != Casted ? Casted : 0);
}
@@ -518,9 +518,9 @@
// If we are modifying the original function, update the DSGraph.
if (!FI.Clone) {
// V and Casted now point to whatever the original allocation did.
- G.getScalarMap().replaceScalar(I, V);
+ G->getScalarMap().replaceScalar(I, V);
if (V != Casted)
- G.getScalarMap()[Casted] = G.getScalarMap()[V];
+ G->getScalarMap()[Casted] = G->getScalarMap()[V];
} else { // Otherwise, update the NewToOldValueMap
UpdateNewToOldValueMap(I, V, V != Casted ? Casted : 0);
}
@@ -602,7 +602,7 @@
ArgNodes = CFI->ArgNodes;
assert ((Graphs.hasDSGraph (*CF)) && "Function has no ECGraph!\n");
- CalleeGraph = &Graphs.getDSGraph(*CF);
+ CalleeGraph = Graphs.getDSGraph(*CF);
} else {
DEBUG(std::cerr << " Handling indirect call: " << *TheCall);
@@ -619,14 +619,14 @@
CF = *I;
// Get the common graph for the set of functions this call may invoke.
- CalleeGraph = &Graphs.getDSGraph(*CF);
+ CalleeGraph = Graphs.getDSGraph(*CF);
#ifndef NDEBUG
// Verify that all potential callees at call site have the same DS graph.
DataStructures::callee_iterator E = Graphs.callee_end(OrigInst);
for (; I != E; ++I)
if (!(*I)->isDeclaration())
- assert(CalleeGraph == &Graphs.getDSGraph(**I) &&
+ assert(CalleeGraph == Graphs.getDSGraph(**I) &&
"Callees at call site do not have a common graph!");
#endif
@@ -750,7 +750,7 @@
if (TheCall->getType() != Type::VoidTy) {
// If we are modifying the original function, update the DSGraph...
- DSGraph::ScalarMapTy &SM = G.getScalarMap();
+ DSGraph::ScalarMapTy &SM = G->getScalarMap();
DSGraph::ScalarMapTy::iterator CII = SM.find(TheCall);
if (CII != SM.end()) {
SM[NewCall] = CII->second;
From gohman at apple.com Mon Oct 20 10:51:45 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Oct 2008 08:51:45 -0700 (PDT)
Subject: [llvm-commits] [llvm] r57786 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
In-Reply-To: <200810192051.m9JKpExj003636@zion.cs.uiuc.edu>
References: <200810192051.m9JKpExj003636@zion.cs.uiuc.edu>
Message-ID: <56982.76.220.41.203.1224517905.squirrel@webmail.apple.com>
On Sun, October 19, 2008 1:51 pm, Bill Wendling wrote:
> Author: void
> Date: Sun Oct 19 15:51:12 2008
> New Revision: 57786
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57786&view=rev
> Log:
> Set N->OperandList to 0 after deletion. Otherwise, it's possible that it
> will
> be either deleted or referenced afterwards.
Hi Bill,
Is this addressing an actual bug? Both of the changes are
modifying fields of objects immediately before they are
deallocated, so if there is code somewhere else that is using
uninitialized SDNode fields, we should fix that code,
regardless of this change.
Thanks,
Dan
From baldrick at free.fr Mon Oct 20 10:56:33 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Oct 2008 15:56:33 -0000
Subject: [llvm-commits] [llvm] r57831 -
/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Message-ID: <200810201556.m9KFuYHB022141@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Oct 20 10:56:33 2008
New Revision: 57831
URL: http://llvm.org/viewvc/llvm-project?rev=57831&view=rev
Log:
Have X86 custom lowering for LegalizeTypes use
LowerOperation if it doesn't know what else to do.
This methods should probably be factorized some,
but this is good enough for the moment. Have
LowerATOMIC_BINARY_64 use EXTRACT_ELEMENT rather
than assuming the operand is a BUILD_PAIR (if it
is then getNode will automagically simplify the
EXTRACT_ELEMENT). This way LowerATOMIC_BINARY_64
usable from LegalizeTypes.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57831&r1=57830&r2=57831&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Oct 20 10:56:33 2008
@@ -5980,7 +5980,7 @@
case MVT::i64:
if (Subtarget->is64Bit()) {
Reg = X86::RAX; size = 8;
- } else //Should go away when LowerType stuff lands
+ } else //Should go away when LegalizeType stuff lands
return SDValue(ExpandATOMIC_CMP_SWAP(Op.getNode(), DAG), 0);
break;
};
@@ -6044,9 +6044,10 @@
SDValue Chain = Node->getOperand(0);
SDValue In1 = Node->getOperand(1);
- assert(Node->getOperand(2).getNode()->getOpcode()==ISD::BUILD_PAIR);
- SDValue In2L = Node->getOperand(2).getNode()->getOperand(0);
- SDValue In2H = Node->getOperand(2).getNode()->getOperand(1);
+ SDValue In2L = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32,
+ Node->getOperand(2), DAG.getIntPtrConstant(0));
+ SDValue In2H = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32,
+ Node->getOperand(2), DAG.getIntPtrConstant(1));
// This is a generalized SDNode, not an AtomicSDNode, so it doesn't
// have a MemOperand. Pass the info through as a normal operand.
SDValue LSI = DAG.getMemOperand(cast(Node)->getMemOperand());
@@ -6082,12 +6083,12 @@
SDValue X86TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
switch (Op.getOpcode()) {
default: assert(0 && "Should not custom lower this!");
- case ISD::ATOMIC_CMP_SWAP_8:
- case ISD::ATOMIC_CMP_SWAP_16:
- case ISD::ATOMIC_CMP_SWAP_32:
+ case ISD::ATOMIC_CMP_SWAP_8:
+ case ISD::ATOMIC_CMP_SWAP_16:
+ case ISD::ATOMIC_CMP_SWAP_32:
case ISD::ATOMIC_CMP_SWAP_64: return LowerCMP_SWAP(Op,DAG);
- case ISD::ATOMIC_LOAD_SUB_8:
- case ISD::ATOMIC_LOAD_SUB_16:
+ case ISD::ATOMIC_LOAD_SUB_8:
+ case ISD::ATOMIC_LOAD_SUB_16:
case ISD::ATOMIC_LOAD_SUB_32: return LowerLOAD_SUB(Op,DAG);
case ISD::ATOMIC_LOAD_SUB_64: return (Subtarget->is64Bit()) ?
LowerLOAD_SUB(Op,DAG) :
@@ -6155,7 +6156,8 @@
/// with a new node built out of custom code.
SDNode *X86TargetLowering::ReplaceNodeResults(SDNode *N, SelectionDAG &DAG) {
switch (N->getOpcode()) {
- default: assert(0 && "Should not custom lower this!");
+ default:
+ return X86TargetLowering::LowerOperation(SDValue (N, 0), DAG).getNode();
case ISD::FP_TO_SINT: return ExpandFP_TO_SINT(N, DAG);
case ISD::READCYCLECOUNTER: return ExpandREADCYCLECOUNTER(N, DAG);
case ISD::ATOMIC_CMP_SWAP_64: return ExpandATOMIC_CMP_SWAP(N, DAG);
From gohman at apple.com Mon Oct 20 10:58:02 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Oct 2008 15:58:02 -0000
Subject: [llvm-commits] [llvm] r57832 -
/llvm/trunk/include/llvm/Target/TargetInstrInfo.h
Message-ID: <200810201558.m9KFw2CZ022207@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 10:58:02 2008
New Revision: 57832
URL: http://llvm.org/viewvc/llvm-project?rev=57832&view=rev
Log:
Fix a typo in a comment.
Modified:
llvm/trunk/include/llvm/Target/TargetInstrInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=57832&r1=57831&r2=57832&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Mon Oct 20 10:58:02 2008
@@ -200,7 +200,7 @@
}
/// RemoveBranch - Remove the branching code at the end of the specific MBB.
- /// this is only invoked in cases where AnalyzeBranch returns success. It
+ /// This is only invoked in cases where AnalyzeBranch returns success. It
/// returns the number of instructions that were removed.
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const {
assert(0 && "Target didn't implement TargetInstrInfo::RemoveBranch!");
From baldrick at free.fr Mon Oct 20 11:04:57 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Oct 2008 16:04:57 -0000
Subject: [llvm-commits] [llvm] r57833 -
/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Message-ID: <200810201604.m9KG4vs3022547@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Oct 20 11:04:57 2008
New Revision: 57833
URL: http://llvm.org/viewvc/llvm-project?rev=57833&view=rev
Log:
Don't use a random type for the select condition,
use an MVT::i1 and simplify the code while there.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=57833&r1=57832&r2=57833&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Oct 20 11:04:57 2008
@@ -272,8 +272,7 @@
if (TLI.isBigEndian())
std::swap(Lo, Hi);
- SDValue Odd = DAG.getNode(ISD::AND, OldIdx.getValueType(), OldIdx,
- DAG.getConstant(1, TLI.getShiftAmountTy()));
+ SDValue Odd = DAG.getNode(ISD::TRUNCATE, MVT::i1, OldIdx);
return DAG.getNode(ISD::SELECT, NewVT, Odd, Hi, Lo);
}
From baldrick at free.fr Mon Oct 20 11:06:47 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Oct 2008 16:06:47 -0000
Subject: [llvm-commits] [llvm] r57834 - in
/llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeIntegerTypes.cpp
LegalizeTypes.h
Message-ID: <200810201606.m9KG6lxc022620@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Oct 20 11:06:47 2008
New Revision: 57834
URL: http://llvm.org/viewvc/llvm-project?rev=57834&view=rev
Log:
Formatting - no functional change.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=57834&r1=57833&r2=57834&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Oct 20 11:06:47 2008
@@ -1198,7 +1198,7 @@
MVT NVT = Lo.getValueType();
SDValue HiNotZero = DAG.getSetCC(TLI.getSetCCResultType(Hi), Hi,
- DAG.getConstant(0, NVT), ISD::SETNE);
+ DAG.getConstant(0, NVT), ISD::SETNE);
SDValue LoLZ = DAG.getNode(ISD::CTLZ, NVT, Lo);
SDValue HiLZ = DAG.getNode(ISD::CTLZ, NVT, Hi);
@@ -1226,7 +1226,7 @@
MVT NVT = Lo.getValueType();
SDValue LoNotZero = DAG.getSetCC(TLI.getSetCCResultType(Lo), Lo,
- DAG.getConstant(0, NVT), ISD::SETNE);
+ DAG.getConstant(0, NVT), ISD::SETNE);
SDValue LoLZ = DAG.getNode(ISD::CTTZ, NVT, Lo);
SDValue HiLZ = DAG.getNode(ISD::CTTZ, NVT, Hi);
@@ -2032,8 +2032,8 @@
SDValue Lo, Hi;
GetExpandedInteger(Op, Lo, Hi);
SDValue SignSet = DAG.getSetCC(TLI.getSetCCResultType(Hi), Hi,
- DAG.getConstant(0, Hi.getValueType()),
- ISD::SETLT);
+ DAG.getConstant(0, Hi.getValueType()),
+ ISD::SETLT);
// Build a 64 bit pair (0, FF) in the constant pool, with FF in the lo bits.
SDValue FudgePtr = DAG.getConstantPool(ConstantInt::get(FF.zext(64)),
@@ -2044,7 +2044,7 @@
SDValue Four = DAG.getIntPtrConstant(4);
if (TLI.isBigEndian()) std::swap(Zero, Four);
SDValue Offset = DAG.getNode(ISD::SELECT, Zero.getValueType(), SignSet,
- Zero, Four);
+ Zero, Four);
unsigned Alignment =
1 << cast(FudgePtr)->getAlignment();
FudgePtr = DAG.getNode(ISD::ADD, TLI.getPointerTy(), FudgePtr, Offset);
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=57834&r1=57833&r2=57834&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Mon Oct 20 11:06:47 2008
@@ -188,8 +188,7 @@
void SplitInteger(SDValue Op, MVT LoVT, MVT HiVT,
SDValue &Lo, SDValue &Hi);
- SDValue GetVectorElementPointer(SDValue VecPtr, MVT EltVT,
- SDValue Index);
+ SDValue GetVectorElementPointer(SDValue VecPtr, MVT EltVT, SDValue Index);
//===--------------------------------------------------------------------===//
// Integer Promotion Support: LegalizeIntegerTypes.cpp
From baldrick at free.fr Mon Oct 20 11:13:05 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Oct 2008 16:13:05 -0000
Subject: [llvm-commits] [llvm] r57836 -
/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Message-ID: <200810201613.m9KGD5ed022840@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Oct 20 11:13:04 2008
New Revision: 57836
URL: http://llvm.org/viewvc/llvm-project?rev=57836&view=rev
Log:
Always use either MVT::i1 or getSetCCResultType for
the condition of a SELECT node. Make sure that the
correct extension type (any-, sign- or zero-extend)
is used.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=57836&r1=57835&r2=57836&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Oct 20 11:13:04 2008
@@ -364,14 +364,18 @@
}
SDValue DAGTypeLegalizer::PromoteIntRes_SETCC(SDNode *N) {
- MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
MVT SVT = TLI.getSetCCResultType(N->getOperand(0));
- assert(isTypeLegal(SVT) && "SetCC type not legal??");
+ assert(isTypeLegal(SVT) && "Illegal SetCC type!");
+
+ // Get the SETCC result using the canonical SETCC type.
+ SDValue SetCC = DAG.getNode(ISD::SETCC, SVT, N->getOperand(0),
+ N->getOperand(1), N->getOperand(2));
+
+ // Convert to the expected type.
+ MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
assert(NVT.getSizeInBits() <= SVT.getSizeInBits() &&
"Integer type overpromoted?");
- return DAG.getNode(ISD::TRUNCATE, NVT,
- DAG.getNode(ISD::SETCC, SVT, N->getOperand(0),
- N->getOperand(1), N->getOperand(2)));
+ return DAG.getNode(ISD::TRUNCATE, NVT, SetCC);
}
SDValue DAGTypeLegalizer::PromoteIntRes_SHL(SDNode *N) {
@@ -731,18 +735,50 @@
SDValue DAGTypeLegalizer::PromoteIntOp_SELECT(SDNode *N, unsigned OpNo) {
assert(OpNo == 0 && "Only know how to promote condition");
- SDValue Cond = GetPromotedInteger(N->getOperand(0)); // Promote condition.
+ assert(N->getOperand(0).getValueType() == MVT::i1 &&
+ "SetCC type is not legal??");
+ SDValue Cond = GetPromotedInteger(N->getOperand(0));
+
+ // Promote all the way up to SVT, the canonical SetCC type.
+ MVT SVT = TLI.getSetCCResultType(Cond);
+ assert(isTypeLegal(SVT) && "Illegal SetCC type!");
+ assert(Cond.getValueSizeInBits() <= SVT.getSizeInBits() &&
+ "Integer type overpromoted?");
- // The top bits of the promoted condition are not necessarily zero, ensure
- // that the value is properly zero extended.
- unsigned BitWidth = Cond.getValueSizeInBits();
- if (!DAG.MaskedValueIsZero(Cond,
- APInt::getHighBitsSet(BitWidth, BitWidth-1)))
- Cond = DAG.getZeroExtendInReg(Cond, MVT::i1);
+ // Make sure the extra bits conform to getSetCCResultContents. There are
+ // two sets of extra bits: those in Cond, which come from type promotion,
+ // and those we need to add to have the final type be SVT (for most targets
+ // this last set of bits is empty).
+ unsigned CondBits = Cond.getValueSizeInBits();
+ ISD::NodeType ExtendCode;
+ switch (TLI.getSetCCResultContents()) {
+ default:
+ assert(false && "Unknown SetCCResultValue!");
+ case TargetLowering::UndefinedSetCCResult:
+ // Extend to SVT by adding rubbish.
+ ExtendCode = ISD::ANY_EXTEND;
+ break;
+ case TargetLowering::ZeroOrOneSetCCResult:
+ ExtendCode = ISD::ZERO_EXTEND;
+ if (!DAG.MaskedValueIsZero(Cond,APInt::getHighBitsSet(CondBits,CondBits-1)))
+ // All extra bits need to be cleared. Do this by zero extending the
+ // original MVT::i1 condition value all the way to SVT.
+ Cond = N->getOperand(0);
+ break;
+ case TargetLowering::ZeroOrNegativeOneSetCCResult: {
+ ExtendCode = ISD::SIGN_EXTEND;
+ unsigned SignBits = DAG.ComputeNumSignBits(Cond);
+ if (SignBits != CondBits)
+ // All extra bits need to be sign extended. Do this by sign extending the
+ // original MVT::i1 condition value all the way to SVT.
+ Cond = N->getOperand(0);
+ break;
+ }
+ }
+ Cond = DAG.getNode(ExtendCode, SVT, Cond);
- // The chain (Op#0) and basic block destination (Op#2) are always legal types.
- return DAG.UpdateNodeOperands(SDValue(N, 0), Cond, N->getOperand(1),
- N->getOperand(2));
+ return DAG.UpdateNodeOperands(SDValue(N, 0), Cond,
+ N->getOperand(1), N->getOperand(2));
}
SDValue DAGTypeLegalizer::PromoteIntOp_SELECT_CC(SDNode *N, unsigned OpNo) {
From baldrick at free.fr Mon Oct 20 11:14:43 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Oct 2008 16:14:43 -0000
Subject: [llvm-commits] [llvm] r57837 - in
/llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeFloatTypes.cpp
LegalizeIntegerTypes.cpp
Message-ID: <200810201614.m9KGEhFD022891@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Oct 20 11:14:43 2008
New Revision: 57837
URL: http://llvm.org/viewvc/llvm-project?rev=57837&view=rev
Log:
Use DAG.getIntPtrConstant rather than DAG.getConstant
with TLI.getPointerTy for a small simplification.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=57837&r1=57836&r2=57837&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Mon Oct 20 11:14:43 2008
@@ -767,10 +767,8 @@
MVT::ppcf128));
Lo = DAG.getNode(ISD::SELECT_CC, VT, Src, DAG.getConstant(0, SrcVT), Lo, Hi,
DAG.getCondCode(ISD::SETLT));
- Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Lo,
- DAG.getConstant(1, TLI.getPointerTy()));
- Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Lo,
- DAG.getConstant(0, TLI.getPointerTy()));
+ Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Lo, DAG.getIntPtrConstant(1));
+ Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Lo, DAG.getIntPtrConstant(0));
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=57837&r1=57836&r2=57837&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Oct 20 11:14:43 2008
@@ -469,7 +469,7 @@
// of zero here!).
unsigned Increment = VT.getSizeInBits() / 8;
SDValue Tmp = DAG.getNode(ISD::ADD, TLI.getPointerTy(), VAList,
- DAG.getConstant(Increment, TLI.getPointerTy()));
+ DAG.getIntPtrConstant(Increment));
// Store the incremented VAList to the pointer.
Tmp = DAG.getStore(VAList.getValue(1), Tmp, Ptr, V, 0);
@@ -2073,7 +2073,7 @@
// Build a 64 bit pair (0, FF) in the constant pool, with FF in the lo bits.
SDValue FudgePtr = DAG.getConstantPool(ConstantInt::get(FF.zext(64)),
- TLI.getPointerTy());
+ TLI.getPointerTy());
// Get a pointer to FF if the sign bit was set, or to 0 otherwise.
SDValue Zero = DAG.getIntPtrConstant(0);
From baldrick at free.fr Mon Oct 20 11:17:42 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Oct 2008 16:17:42 -0000
Subject: [llvm-commits] [llvm] r57838 - in
/llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeIntegerTypes.cpp
LegalizeTypes.h
Message-ID: <200810201617.m9KGHhrg023010@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Oct 20 11:17:42 2008
New Revision: 57838
URL: http://llvm.org/viewvc/llvm-project?rev=57838&view=rev
Log:
LegalizeTypes support for atomic operation promotion.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=57838&r1=57837&r2=57838&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Oct 20 11:17:42 2008
@@ -89,13 +89,65 @@
case ISD::XOR:
case ISD::ADD:
case ISD::SUB:
- case ISD::MUL: Result = PromoteIntRes_SimpleIntBinOp(N); break;
+ case ISD::MUL: Result = PromoteIntRes_SimpleIntBinOp(N); break;
case ISD::SDIV:
- case ISD::SREM: Result = PromoteIntRes_SDIV(N); break;
+ case ISD::SREM: Result = PromoteIntRes_SDIV(N); break;
case ISD::UDIV:
- case ISD::UREM: Result = PromoteIntRes_UDIV(N); break;
+ case ISD::UREM: Result = PromoteIntRes_UDIV(N); break;
+
+ case ISD::ATOMIC_LOAD_ADD_8:
+ case ISD::ATOMIC_LOAD_SUB_8:
+ case ISD::ATOMIC_LOAD_AND_8:
+ case ISD::ATOMIC_LOAD_OR_8:
+ case ISD::ATOMIC_LOAD_XOR_8:
+ case ISD::ATOMIC_LOAD_NAND_8:
+ case ISD::ATOMIC_LOAD_MIN_8:
+ case ISD::ATOMIC_LOAD_MAX_8:
+ case ISD::ATOMIC_LOAD_UMIN_8:
+ case ISD::ATOMIC_LOAD_UMAX_8:
+ case ISD::ATOMIC_SWAP_8:
+ case ISD::ATOMIC_LOAD_ADD_16:
+ case ISD::ATOMIC_LOAD_SUB_16:
+ case ISD::ATOMIC_LOAD_AND_16:
+ case ISD::ATOMIC_LOAD_OR_16:
+ case ISD::ATOMIC_LOAD_XOR_16:
+ case ISD::ATOMIC_LOAD_NAND_16:
+ case ISD::ATOMIC_LOAD_MIN_16:
+ case ISD::ATOMIC_LOAD_MAX_16:
+ case ISD::ATOMIC_LOAD_UMIN_16:
+ case ISD::ATOMIC_LOAD_UMAX_16:
+ case ISD::ATOMIC_SWAP_16:
+ case ISD::ATOMIC_LOAD_ADD_32:
+ case ISD::ATOMIC_LOAD_SUB_32:
+ case ISD::ATOMIC_LOAD_AND_32:
+ case ISD::ATOMIC_LOAD_OR_32:
+ case ISD::ATOMIC_LOAD_XOR_32:
+ case ISD::ATOMIC_LOAD_NAND_32:
+ case ISD::ATOMIC_LOAD_MIN_32:
+ case ISD::ATOMIC_LOAD_MAX_32:
+ case ISD::ATOMIC_LOAD_UMIN_32:
+ case ISD::ATOMIC_LOAD_UMAX_32:
+ case ISD::ATOMIC_SWAP_32:
+ case ISD::ATOMIC_LOAD_ADD_64:
+ case ISD::ATOMIC_LOAD_SUB_64:
+ case ISD::ATOMIC_LOAD_AND_64:
+ case ISD::ATOMIC_LOAD_OR_64:
+ case ISD::ATOMIC_LOAD_XOR_64:
+ case ISD::ATOMIC_LOAD_NAND_64:
+ case ISD::ATOMIC_LOAD_MIN_64:
+ case ISD::ATOMIC_LOAD_MAX_64:
+ case ISD::ATOMIC_LOAD_UMIN_64:
+ case ISD::ATOMIC_LOAD_UMAX_64:
+ case ISD::ATOMIC_SWAP_64:
+ Result = PromoteIntRes_Atomic1(cast(N)); break;
+
+ case ISD::ATOMIC_CMP_SWAP_8:
+ case ISD::ATOMIC_CMP_SWAP_16:
+ case ISD::ATOMIC_CMP_SWAP_32:
+ case ISD::ATOMIC_CMP_SWAP_64:
+ Result = PromoteIntRes_Atomic2(cast(N)); break;
}
// If Result is null, the sub-method took care of registering the result.
@@ -120,6 +172,27 @@
DAG.getZeroExtendInReg(Op, OldVT), N->getOperand(1));
}
+SDValue DAGTypeLegalizer::PromoteIntRes_Atomic1(AtomicSDNode *N) {
+ SDValue Op2 = GetPromotedInteger(N->getOperand(2));
+ SDValue Res = DAG.getAtomic(N->getOpcode(), N->getChain(), N->getBasePtr(),
+ Op2, N->getSrcValue(), N->getAlignment());
+ // Legalized the chain result - switch anything that used the old chain to
+ // use the new one.
+ ReplaceValueWith(SDValue(N, 1), Res.getValue(1));
+ return Res;
+}
+
+SDValue DAGTypeLegalizer::PromoteIntRes_Atomic2(AtomicSDNode *N) {
+ SDValue Op2 = GetPromotedInteger(N->getOperand(2));
+ SDValue Op3 = GetPromotedInteger(N->getOperand(3));
+ SDValue Res = DAG.getAtomic(N->getOpcode(), N->getChain(), N->getBasePtr(),
+ Op2, Op3, N->getSrcValue(), N->getAlignment());
+ // Legalized the chain result - switch anything that used the old chain to
+ // use the new one.
+ ReplaceValueWith(SDValue(N, 1), Res.getValue(1));
+ return Res;
+}
+
SDValue DAGTypeLegalizer::PromoteIntRes_BIT_CONVERT(SDNode *N) {
SDValue InOp = N->getOperand(0);
MVT InVT = InOp.getValueType();
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=57838&r1=57837&r2=57838&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Mon Oct 20 11:17:42 2008
@@ -214,6 +214,8 @@
void PromoteIntegerResult(SDNode *N, unsigned ResNo);
SDValue PromoteIntRes_AssertSext(SDNode *N);
SDValue PromoteIntRes_AssertZext(SDNode *N);
+ SDValue PromoteIntRes_Atomic1(AtomicSDNode *N);
+ SDValue PromoteIntRes_Atomic2(AtomicSDNode *N);
SDValue PromoteIntRes_BIT_CONVERT(SDNode *N);
SDValue PromoteIntRes_BSWAP(SDNode *N);
SDValue PromoteIntRes_BUILD_PAIR(SDNode *N);
From baldrick at free.fr Mon Oct 20 11:24:25 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Oct 2008 16:24:25 -0000
Subject: [llvm-commits] [llvm] r57839 -
/llvm/trunk/include/llvm/Target/TargetLowering.h
Message-ID: <200810201624.m9KGOPeW023206@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Oct 20 11:24:25 2008
New Revision: 57839
URL: http://llvm.org/viewvc/llvm-project?rev=57839&view=rev
Log:
Teach getTypeToTransformTo to return something
sensible for vectors being scalarized. Note
that this method can't return anything very
sensible when splitting non-power-of-two vectors.
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=57839&r1=57838&r2=57839&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Oct 20 11:24:25 2008
@@ -209,10 +209,11 @@
return NVT;
}
- if (VT.isVector())
- return MVT::getVectorVT(VT.getVectorElementType(),
- VT.getVectorNumElements() / 2);
- if (VT.isInteger()) {
+ if (VT.isVector()) {
+ unsigned NumElts = VT.getVectorNumElements();
+ MVT EltVT = VT.getVectorElementType();
+ return (NumElts == 1) ? EltVT : MVT::getVectorVT(EltVT, NumElts / 2);
+ } else if (VT.isInteger()) {
MVT NVT = VT.getRoundIntegerType();
if (NVT == VT)
// Size is a power of two - expand to half the size.
From baldrick at free.fr Mon Oct 20 11:31:21 2008
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 20 Oct 2008 16:31:21 -0000
Subject: [llvm-commits] [llvm] r57840 - in
/llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.h
LegalizeVectorTypes.cpp
Message-ID: <200810201631.m9KGVLY8023456@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Oct 20 11:31:21 2008
New Revision: 57840
URL: http://llvm.org/viewvc/llvm-project?rev=57840&view=rev
Log:
Support operations like fp_to_uint with a vector
result type when the result type is legal but
not the operand type. Add additional support
for EXTRACT_SUBVECTOR and CONCAT_VECTORS,
needed to handle such cases.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=57840&r1=57839&r2=57840&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Mon Oct 20 11:31:21 2008
@@ -416,6 +416,7 @@
SDValue ScalarizeVecRes_UnaryOp(SDNode *N);
SDValue ScalarizeVecRes_BIT_CONVERT(SDNode *N);
+ SDValue ScalarizeVecRes_EXTRACT_SUBVECTOR(SDNode *N);
SDValue ScalarizeVecRes_FPOWI(SDNode *N);
SDValue ScalarizeVecRes_INSERT_VECTOR_ELT(SDNode *N);
SDValue ScalarizeVecRes_LOAD(LoadSDNode *N);
@@ -427,6 +428,7 @@
// Vector Operand Scalarization: <1 x ty> -> ty.
bool ScalarizeVectorOperand(SDNode *N, unsigned OpNo);
SDValue ScalarizeVecOp_BIT_CONVERT(SDNode *N);
+ SDValue ScalarizeVecOp_CONCAT_VECTORS(SDNode *N);
SDValue ScalarizeVecOp_EXTRACT_VECTOR_ELT(SDNode *N);
SDValue ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo);
@@ -455,6 +457,7 @@
// Vector Operand Splitting: <128 x ty> -> 2 x <64 x ty>.
bool SplitVectorOperand(SDNode *N, unsigned OpNo);
+ SDValue SplitVecOp_UnaryOp(SDNode *N);
SDValue SplitVecOp_BIT_CONVERT(SDNode *N);
SDValue SplitVecOp_EXTRACT_SUBVECTOR(SDNode *N);
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=57840&r1=57839&r2=57840&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Mon Oct 20 11:31:21 2008
@@ -43,6 +43,7 @@
case ISD::BIT_CONVERT: R = ScalarizeVecRes_BIT_CONVERT(N); break;
case ISD::BUILD_VECTOR: R = N->getOperand(0); break;
+ case ISD::EXTRACT_SUBVECTOR: R = ScalarizeVecRes_EXTRACT_SUBVECTOR(N); break;
case ISD::FPOWI: R = ScalarizeVecRes_FPOWI(N); break;
case ISD::INSERT_VECTOR_ELT: R = ScalarizeVecRes_INSERT_VECTOR_ELT(N); break;
case ISD::LOAD: R = ScalarizeVecRes_LOAD(cast(N));break;
@@ -67,6 +68,7 @@
case ISD::FRINT:
case ISD::FNEARBYINT:
case ISD::SINT_TO_FP:
+ case ISD::TRUNCATE:
case ISD::UINT_TO_FP: R = ScalarizeVecRes_UnaryOp(N); break;
case ISD::ADD:
@@ -103,6 +105,12 @@
return DAG.getNode(ISD::BIT_CONVERT, NewVT, N->getOperand(0));
}
+SDValue DAGTypeLegalizer::ScalarizeVecRes_EXTRACT_SUBVECTOR(SDNode *N) {
+ return DAG.getNode(ISD::EXTRACT_VECTOR_ELT,
+ N->getValueType(0).getVectorElementType(),
+ N->getOperand(0), N->getOperand(1));
+}
+
SDValue DAGTypeLegalizer::ScalarizeVecRes_FPOWI(SDNode *N) {
SDValue Op = GetScalarizedVector(N->getOperand(0));
return DAG.getNode(ISD::FPOWI, Op.getValueType(), Op, N->getOperand(1));
@@ -139,7 +147,7 @@
SDValue DAGTypeLegalizer::ScalarizeVecRes_UnaryOp(SDNode *N) {
// Get the dest type - it doesn't always match the input type, e.g. int_to_fp.
- MVT DestVT = TLI.getTypeToTransformTo(N->getValueType(0));
+ MVT DestVT = N->getValueType(0).getVectorElementType();
SDValue Op = GetScalarizedVector(N->getOperand(0));
return DAG.getNode(N->getOpcode(), DestVT, Op);
}
@@ -199,6 +207,9 @@
case ISD::BIT_CONVERT:
Res = ScalarizeVecOp_BIT_CONVERT(N); break;
+ case ISD::CONCAT_VECTORS:
+ Res = ScalarizeVecOp_CONCAT_VECTORS(N); break;
+
case ISD::EXTRACT_VECTOR_ELT:
Res = ScalarizeVecOp_EXTRACT_VECTOR_ELT(N); break;
@@ -234,6 +245,16 @@
return DAG.getNode(ISD::BIT_CONVERT, N->getValueType(0), Elt);
}
+/// ScalarizeVecOp_CONCAT_VECTORS - The vectors to concatenate have length one -
+/// use a BUILD_VECTOR instead.
+SDValue DAGTypeLegalizer::ScalarizeVecOp_CONCAT_VECTORS(SDNode *N) {
+ SmallVector Ops(N->getNumOperands());
+ for (unsigned i = 0, e = N->getNumOperands(); i < e; ++i)
+ Ops[i] = GetScalarizedVector(N->getOperand(i));
+ return DAG.getNode(ISD::BUILD_VECTOR, N->getValueType(0),
+ &Ops[0], Ops.size());
+}
+
/// ScalarizeVecOp_EXTRACT_VECTOR_ELT - If the input is a vector that needs to
/// be scalarized, it must be <1 x ty>, so just return the element, ignoring the
/// index.
@@ -313,6 +334,7 @@
case ISD::FP_TO_SINT:
case ISD::FP_TO_UINT:
case ISD::SINT_TO_FP:
+ case ISD::TRUNCATE:
case ISD::UINT_TO_FP: SplitVecRes_UnaryOp(N, Lo, Hi); break;
case ISD::ADD:
@@ -636,6 +658,15 @@
case ISD::STORE: Res = SplitVecOp_STORE(cast(N),
OpNo); break;
case ISD::VECTOR_SHUFFLE: Res = SplitVecOp_VECTOR_SHUFFLE(N, OpNo);break;
+
+ case ISD::CTTZ:
+ case ISD::CTLZ:
+ case ISD::CTPOP:
+ case ISD::FP_TO_SINT:
+ case ISD::FP_TO_UINT:
+ case ISD::SINT_TO_FP:
+ case ISD::TRUNCATE:
+ case ISD::UINT_TO_FP: Res = SplitVecOp_UnaryOp(N); break;
}
}
@@ -659,6 +690,24 @@
return false;
}
+SDValue DAGTypeLegalizer::SplitVecOp_UnaryOp(SDNode *N) {
+ // The result has a legal vector type, but the input needs splitting.
+ MVT ResVT = N->getValueType(0);
+ SDValue Lo, Hi;
+ GetSplitVector(N->getOperand(0), Lo, Hi);
+ assert(Lo.getValueType() == Hi.getValueType() &&
+ "Returns legal non-power-of-two vector type?");
+ MVT InVT = Lo.getValueType();
+
+ MVT OutVT = MVT::getVectorVT(ResVT.getVectorElementType(),
+ InVT.getVectorNumElements());
+
+ Lo = DAG.getNode(N->getOpcode(), OutVT, Lo);
+ Hi = DAG.getNode(N->getOpcode(), OutVT, Hi);
+
+ return DAG.getNode(ISD::CONCAT_VECTORS, ResVT, Lo, Hi);
+}
+
SDValue DAGTypeLegalizer::SplitVecOp_BIT_CONVERT(SDNode *N) {
// For example, i64 = BIT_CONVERT v4i16 on alpha. Typically the vector will
// end up being split all the way down to individual components. Convert the
From clattner at apple.com Mon Oct 20 11:40:15 2008
From: clattner at apple.com (Chris Lattner)
Date: Mon, 20 Oct 2008 09:40:15 -0700
Subject: [llvm-commits] [llvm] r57765 -
/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
In-Reply-To: <0D069F7F-5FC0-4F3D-B293-A342A47B4D05@apple.com>
References: <200810180518.m9I5Iujh007695@zion.cs.uiuc.edu>
<60B7C920-BCC7-4CCD-AE6B-DD09FA25760D@apple.com>
<0D069F7F-5FC0-4F3D-B293-A342A47B4D05@apple.com>
Message-ID: <35A72553-F89D-4C9A-831E-9BBFA9628BFC@apple.com>
On Oct 18, 2008, at 1:12 PM, Evan Cheng wrote:
> It shouldn't. Owen had fixed that problem.
Ok, thanks!
-Chris
From isanbard at gmail.com Mon Oct 20 12:01:40 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 20 Oct 2008 10:01:40 -0700
Subject: [llvm-commits] [llvm] r57786 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
In-Reply-To: <56982.76.220.41.203.1224517905.squirrel@webmail.apple.com>
References: <200810192051.m9JKpExj003636@zion.cs.uiuc.edu>
<56982.76.220.41.203.1224517905.squirrel@webmail.apple.com>
Message-ID: <16e5fdf90810201001w223e5905uaf9d650818cae66b@mail.gmail.com>
On Mon, Oct 20, 2008 at 8:51 AM, Dan Gohman wrote:
> On Sun, October 19, 2008 1:51 pm, Bill Wendling wrote:
>> Author: void
>> Date: Sun Oct 19 15:51:12 2008
>> New Revision: 57786
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=57786&view=rev
>> Log:
>> Set N->OperandList to 0 after deletion. Otherwise, it's possible that it
>> will
>> be either deleted or referenced afterwards.
>
> Hi Bill,
>
> Is this addressing an actual bug? Both of the changes are
> modifying fields of objects immediately before they are
> deallocated, so if there is code somewhere else that is using
> uninitialized SDNode fields, we should fix that code,
> regardless of this change.
>
Hi Dan,
It's not a bug that showed up in code. I noticed it while looking at
the selection DAG stuff. It's just a sanity check, basically. I'm
hoping that if anything (later on) does use these fields then a
segfault will occur.
-bw
From lattner at apple.com Mon Oct 20 12:38:59 2008
From: lattner at apple.com (Tanya Lattner)
Date: Mon, 20 Oct 2008 10:38:59 -0700
Subject: [llvm-commits] [test-suite] r57768 -
/test-suite/trunk/MultiSource/Applications/lua/Makefile
In-Reply-To: <200810181821.m9IILX4H011913@zion.cs.uiuc.edu>
References: <200810181821.m9IILX4H011913@zion.cs.uiuc.edu>
Message-ID:
Ok for 2.4?
-Tanya
On Oct 18, 2008, at 11:21 AM, Chris Lattner wrote:
> Author: lattner
> Date: Sat Oct 18 13:21:31 2008
> New Revision: 57768
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57768&view=rev
> Log:
> make this program work when srcdir != objdir, patch by
> Julien Lerouge!
> Fixes PR2912
>
> Modified:
> test-suite/trunk/MultiSource/Applications/lua/Makefile
>
> Modified: test-suite/trunk/MultiSource/Applications/lua/Makefile
> URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/lua/Makefile?rev=57768&r1=57767&r2=57768&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- test-suite/trunk/MultiSource/Applications/lua/Makefile (original)
> +++ test-suite/trunk/MultiSource/Applications/lua/Makefile Sat Oct
> 18 13:21:31 2008
> @@ -9,7 +9,7 @@
> CPPFLAGS += -DLUA_USE_POSIX
>
> PROG = lua
> -RUN_OPTIONS = alltests.lua +RUN_OPTIONS = alltests.lua "\
> include $(LEVEL)/Makefile.config
>
> @@ -17,7 +17,14 @@
> DIFFPROG := $(PROGDIR)/DiffOutput.sh "diff "
>
> # generate input files
> -lua.c: .input_generated
> +$(PROJ_SRC_DIR)/lua.c: .input_generated
>
> .input_generated:
> + if [ ! -f ./generate_inputs.sh ]; \
> + then \
> + cp -f $(PROJ_SRC_DIR)/generate_inputs.sh . ; \
> + cp -f -r $(PROJ_SRC_DIR)/{test,bench,input} . ; \
> + cp -f $(PROJ_SRC_DIR)/*.lua . ; \
> + fi
> ./generate_inputs.sh
> +
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081020/21177407/attachment.html
From lattner at apple.com Mon Oct 20 12:38:57 2008
From: lattner at apple.com (Tanya Lattner)
Date: Mon, 20 Oct 2008 10:38:57 -0700
Subject: [llvm-commits] [test-suite] r57071 [1/7] - in
/test-suite/trunk/MultiSource/Applications/lua: ./ bench/
input/ test/
In-Reply-To: <4354d3270810181022n6fe9f75doe42f5a92f3d7862f@mail.gmail.com>
References: <200810042058.m94KwJxP005655@zion.cs.uiuc.edu>
<570225F6-8E8C-4CC5-8D58-014A59AAE2D7@apple.com>
<4354d3270810181022n6fe9f75doe42f5a92f3d7862f@mail.gmail.com>
Message-ID:
On Oct 18, 2008, at 10:22 AM, T?r?k Edvin wrote:
> On Fri, Oct 17, 2008 at 21:17, Tanya Lattner
> wrote:
>> Adding a new test program to llvm-test just 2 days before the
>> branch is
>> probably not a good idea in the future. We experienced issues with
>> the
>> gen_input script on darwin and I've gotten a report that it doesn't
>> work
>> with srcDir != objDir. I'm investigating this now.
>
> Is there a PR open for this? I can help.
>
Yes (PR2912), and a fix has been checked in. I think it will go into
2.4.
Thanks,
Tanya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081020/c6e205ce/attachment.html
From wangmp at apple.com Mon Oct 20 12:46:48 2008
From: wangmp at apple.com (Mon Ping Wang)
Date: Mon, 20 Oct 2008 10:46:48 -0700
Subject: [llvm-commits] vector widening patch
In-Reply-To: <5101CC65-BB18-4133-8A1A-1D852CD8EECA@rapidmind.com>
References:
<5101CC65-BB18-4133-8A1A-1D852CD8EECA@rapidmind.com>
Message-ID: <332607FD-6A93-4662-9038-F3210C4E1DFB@apple.com>
Hi Stefanus,
No numbers to back that choice up. The thinking was that instead of
worrying about packing and unpacking a two element vector that it
might be cheaper to treat it as two scalar computation as a general
rule. For x86 with SSE2+, I have no problem saying that we should
always widen. With MMX, it is less clear. Do you think that in
general, it always make sense to widen?
-- Mon Ping
On Oct 20, 2008, at 8:18 AM, Stefanus Du Toit wrote:
> Hi Mon Ping,
>
>> + // If it a vector of two, we will assume it doesn't make sense
>> to widen
>> + if (NElts == 2)
>> + return MVT::Other;
>
> What's the reasoning behind this? In our experience this makes a lot
> of sense, at least on x86 SSE2+ (assuming MMX is disabled).
>
> Stefanus
>
> On 18-Oct-08, at 12:12 AM, Mon Ping Wang wrote:
>> Hi,
>>
>> Here is a patch for vector widen. In certain cases, it is more
>> profitable to widen a vector from an illegal type to a legal type
>> (e.g., v7i8 to v8i8) instead of scalarzing the vector. This patch
>> implements that. The default implementation is to widen if there
>> is a
>> legal type that is wider than the illegal type and the vector has
>> more
>> elements. Any target can override the default logic and implement it
>> own policy. Please let me know if you have any comments or concerns.
>>
>> Thanks,
>> -- Mon Ping
>>
>
> --
> Stefanus Du Toit
> RapidMind Inc.
> phone: +1 519 885 5455 x116 -- fax: +1 519 885 1463
>
>
>
From stefanus.dutoit at rapidmind.com Mon Oct 20 13:26:44 2008
From: stefanus.dutoit at rapidmind.com (Stefanus Du Toit)
Date: Mon, 20 Oct 2008 14:26:44 -0400
Subject: [llvm-commits] vector widening patch
In-Reply-To: <332607FD-6A93-4662-9038-F3210C4E1DFB@apple.com>
References:
<5101CC65-BB18-4133-8A1A-1D852CD8EECA@rapidmind.com>
<332607FD-6A93-4662-9038-F3210C4E1DFB@apple.com>
Message-ID:
Hi Mon Ping,
On 20-Oct-08, at 1:46 PM, Mon Ping Wang wrote:
> No numbers to back that choice up. The thinking was that instead of
> worrying about packing and unpacking a two element vector that it
> might be cheaper to treat it as two scalar computation as a general
> rule. For x86 with SSE2+, I have no problem saying that we should
> always widen. With MMX, it is less clear. Do you think that in
> general, it always make sense to widen?
It probably depends on your architecture. In our experience, using MMX
when you have SSE2 is not productive, and so we actually just turn off
anything that legalizes MMX operations and types. The one
microarchitecture where you might benefit from MMX is pre-Barcelona
Opteron, which supports SSE2 but performs and SSE operation as two 64
bit operations. But in this case, 2-vectors would be legal anyways.
I would think that for most ISAs, if a 2-vector is not legal, it
probably makes sense to widen. Chances are the two scalars are already
sitting in a vector register, and thus scalarizing will actually
involve more packing and unpacking. A client could always scalarize in
the frontend (which is much easier than widening in the frontend!) if
they really want to -- if they're using 2-vectors, that's probably a
good indication they want their data in vector registers (I know
that's the case for us). [*]
But others might have different experiences. Please speak up!
--
Stefanus Du Toit
RapidMind Inc.
phone: +1 519 885 5455 x116 -- fax: +1 519 885 1463
[*] We have seen cases where scalarizing is a benefit, but in those
cases the values where typically being packed in the IR (rather than
loaded as a vector), and usually related to induction variables in
loops, where scalarizing can enable other optimizations. I would be
interested in an optimization pass that recognized such cases and
scalarized them, but this would have to happen at the IR level.
From alenhar2 at cs.uiuc.edu Mon Oct 20 14:37:55 2008
From: alenhar2 at cs.uiuc.edu (Andrew Lenharth)
Date: Mon, 20 Oct 2008 19:37:55 -0000
Subject: [llvm-commits] [poolalloc] r57842 - in /poolalloc/trunk:
include/dsa/DSNode.h lib/DSA/BottomUpClosure.cpp lib/DSA/DataStructure.cpp
lib/DSA/Printer.cpp
Message-ID: <200810201937.m9KJbtIP031993@zion.cs.uiuc.edu>
Author: alenhar2
Date: Mon Oct 20 14:37:54 2008
New Revision: 57842
URL: http://llvm.org/viewvc/llvm-project?rev=57842&view=rev
Log:
remove direct access to Globals List
Modified:
poolalloc/trunk/include/dsa/DSNode.h
poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
poolalloc/trunk/lib/DSA/DataStructure.cpp
poolalloc/trunk/lib/DSA/Printer.cpp
Modified: poolalloc/trunk/include/dsa/DSNode.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSNode.h?rev=57842&r1=57841&r2=57842&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSNode.h (original)
+++ poolalloc/trunk/include/dsa/DSNode.h Mon Oct 20 14:37:54 2008
@@ -297,13 +297,11 @@
/// globals list.
void removeGlobal(const GlobalValue *GV);
- void mergeGlobals(const std::vector &RHS);
+ void mergeGlobals(const DSNode& RHS);
void clearGlobals() { Globals.clear(); }
- /// getGlobalsList - Return the set of global leaders that are represented by
- /// this node. Note that globals that are in this equivalence class but are
- /// not leaders are not returned: for that, use addFullGlobalsList().
- const std::vector &getGlobalsList() const { return Globals; }
+ bool isEmptyGlobals() const { return Globals.empty(); }
+ unsigned numGlobals() const { return Globals.size(); }
/// addFullGlobalsList - Compute the full set of global values that are
/// represented by this node. Unlike getGlobalsList(), this requires fair
Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=57842&r1=57841&r2=57842&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Mon Oct 20 14:37:54 2008
@@ -372,6 +372,8 @@
}
void BUDataStructures::calculateGraph(DSGraph* Graph) {
+ DEBUG(Graph->AssertGraphOK(); Graph->getGlobalsGraph()->AssertGraphOK());
+
// If this graph contains the main function, clone the globals graph into this
// graph before we inline callees and other fun stuff.
bool ContainsMain = false;
@@ -408,7 +410,6 @@
}
}
-
// Move our call site list into TempFCs so that inline call sites go into the
// new call site list and doesn't invalidate our iterators!
std::list TempFCs;
@@ -417,6 +418,8 @@
std::vector CalledFuncs;
while (!TempFCs.empty()) {
+ DEBUG(Graph->AssertGraphOK(); Graph->getGlobalsGraph()->AssertGraphOK());
+
DSCallSite &CS = *TempFCs.begin();
Instruction *TheCall = CS.getCallSite().getInstruction();
@@ -449,6 +452,7 @@
// Get the data structure graph for the called function.
GI = getDSGraph(*Callee); // Graph to inline
+ DEBUG(GI->AssertGraphOK(); GI->getGlobalsGraph()->AssertGraphOK());
DOUT << " Inlining graph for " << Callee->getName()
<< "[" << GI->getGraphSize() << "+"
<< GI->getAuxFunctionCalls().size() << "] into '"
@@ -539,6 +543,7 @@
++NumInlines;
}
}
+ DEBUG(Graph->AssertGraphOK(); Graph->getGlobalsGraph()->AssertGraphOK());
if (!isComplete)
AuxCallsList.push_front(CS);
TempFCs.erase(TempFCs.begin());
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=57842&r1=57841&r2=57842&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Mon Oct 20 14:37:54 2008
@@ -802,11 +802,11 @@
}
-void DSNode::mergeGlobals(const std::vector &RHS) {
+void DSNode::mergeGlobals(const DSNode &RHS) {
std::vector Temp;
std::back_insert_iterator< std::vector > back_it (Temp);
std::set_union(Globals.begin(), Globals.end(),
- RHS.begin(), RHS.end(),
+ RHS.Globals.begin(), RHS.Globals.end(),
back_it);
Globals.swap(Temp);
}
@@ -961,7 +961,7 @@
// Merge the globals list...
if (!N->Globals.empty()) {
- CurNodeH.getNode()->mergeGlobals(N->Globals);
+ CurNodeH.getNode()->mergeGlobals(*N);
// Delete the globals from the old node...
N->Globals.clear();
@@ -1106,7 +1106,7 @@
Dest->getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(),
DestGNH.getOffset()+SrcGNH.getOffset()));
}
- NH.getNode()->mergeGlobals(SN->getGlobalsList());
+ NH.getNode()->mergeGlobals(*SN);
return DSNodeHandle(NH.getNode(), NH.getOffset()+SrcNH.getOffset());
}
@@ -1182,7 +1182,7 @@
// scalar map with the correct offset.
if (SN->globals_begin() != SN->globals_end()) {
// Update the globals in the destination node itself.
- DN->mergeGlobals(SN->getGlobalsList());
+ DN->mergeGlobals(*SN);
// Update the scalar map for the graph we are merging the source node
// into.
@@ -1195,7 +1195,7 @@
Dest->getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(),
DestGNH.getOffset()+SrcGNH.getOffset()));
}
- NH.getNode()->mergeGlobals(SN->getGlobalsList());
+ NH.getNode()->mergeGlobals(*SN);
}
} else {
// We cannot handle this case without allocating a temporary node. Fall
@@ -2030,7 +2030,7 @@
// If the Callee is a useless edge, this must be an unreachable call site,
// eliminate it.
if (Callee->getNumReferrers() == 1 && Callee->isCompleteNode() &&
- Callee->getGlobalsList().empty()) { // No useful info?
+ Callee->isEmptyGlobals()) { // No useful info?
DOUT << "WARNING: Useless call site found.\n";
Calls.erase(OldIt);
++NumDeleted;
@@ -2214,20 +2214,21 @@
// have all of these properties and still have incoming edges, due to the
// scalar map, so we check those now.
//
- if (Node.getNumReferrers() == Node.getGlobalsList().size()) {
- const std::vector &Globals = Node.getGlobalsList();
+ if (Node.getNumReferrers() == Node.numGlobals()) {
// Loop through and make sure all of the globals are referring directly
// to the node...
- for (unsigned j = 0, e = Globals.size(); j != e; ++j) {
- DSNode *N = getNodeForValue(Globals[j]).getNode();
+ for (DSNode::globals_iterator j = Node.globals_begin(), e = Node.globals_end();
+ j != e; ++j) {
+ DSNode *N = getNodeForValue(*j).getNode();
assert(N == &Node && "ScalarMap doesn't match globals list!");
}
// Make sure NumReferrers still agrees, if so, the node is truly dead.
- if (Node.getNumReferrers() == Globals.size()) {
- for (unsigned j = 0, e = Globals.size(); j != e; ++j)
- ScalarMap.erase(Globals[j]);
+ if (Node.getNumReferrers() == Node.numGlobals()) {
+ for (DSNode::globals_iterator j = Node.globals_begin(), e = Node.globals_end();
+ j != e; ++j)
+ ScalarMap.erase(*j);
Node.makeNodeDead();
++NumTrivialGlobalDNE;
}
@@ -2779,7 +2780,7 @@
for (DSGraph::node_iterator I = GlobalsGraph->node_begin(),
E = GlobalsGraph->node_end();
I != E; ++I) {
- if (I->getGlobalsList().size() <= 1) continue;
+ if (I->numGlobals() <= 1) continue;
// First, build up the equivalence set for this block of globals.
DSNode::globals_iterator i = I->globals_begin();
Modified: poolalloc/trunk/lib/DSA/Printer.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Printer.cpp?rev=57842&r1=57841&r2=57842&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Printer.cpp (original)
+++ poolalloc/trunk/lib/DSA/Printer.cpp Mon Oct 20 14:37:54 2008
@@ -87,13 +87,14 @@
EquivalenceClasses *GlobalECs = 0;
if (G) GlobalECs = &G->getGlobalECs();
- for (unsigned i = 0, e = N->getGlobalsList().size(); i != e; ++i) {
- WriteAsOperand(OS, N->getGlobalsList()[i], false, M);
+ for (DSNode::globals_iterator i = N->globals_begin(), e = N->globals_end();
+ i != e; ++i) {
+ WriteAsOperand(OS, *i, false, M);
// Figure out how many globals are equivalent to this one.
if (GlobalECs) {
EquivalenceClasses::iterator I =
- GlobalECs->findValue(N->getGlobalsList()[i]);
+ GlobalECs->findValue(*i);
if (I != GlobalECs->end()) {
unsigned NumMembers =
std::distance(GlobalECs->member_begin(I), GlobalECs->member_end());
From evan.cheng at apple.com Mon Oct 20 15:02:17 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Oct 2008 20:02:17 -0000
Subject: [llvm-commits] [llvm] r57843 -
/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
Message-ID: <200810202002.m9KK2IPW000409@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 20 15:02:17 2008
New Revision: 57843
URL: http://llvm.org/viewvc/llvm-project?rev=57843&view=rev
Log:
This forward declaration is unnecessary.
Modified:
llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=57843&r1=57842&r2=57843&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Mon Oct 20 15:02:17 2008
@@ -31,7 +31,6 @@
class RegScavenger;
class SDNode;
class SelectionDAG;
-class TargetRegisterClass;
class Type;
/// TargetRegisterDesc - This record contains all of the information known about
From evan.cheng at apple.com Mon Oct 20 15:03:30 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Oct 2008 20:03:30 -0000
Subject: [llvm-commits] [llvm] r57844 - in /llvm/trunk:
include/llvm/CodeGen/MachineRegisterInfo.h
lib/CodeGen/MachineRegisterInfo.cpp
Message-ID: <200810202003.m9KK3U5f000470@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 20 15:03:28 2008
New Revision: 57844
URL: http://llvm.org/viewvc/llvm-project?rev=57844&view=rev
Log:
Add a register class -> virtual registers map.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h
llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h?rev=57844&r1=57843&r2=57844&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Mon Oct 20 15:03:28 2008
@@ -32,6 +32,11 @@
/// Each element in this list contains the register class of the vreg and the
/// start of the use/def list for the register.
std::vector > VRegInfo;
+
+ /// RegClassVRegMap - This vector acts as a map from TargetRegisterClass to
+ /// virtual registers. For each target register class, it keeps a list of
+ /// virtual registers belonging to the class.
+ std::vector > RegClass2VRegMap;
/// PhysRegUseDefLists - This is an array of the head of the use/def list for
/// physical registers.
@@ -130,6 +135,7 @@
//===--------------------------------------------------------------------===//
/// getRegClass - Return the register class of the specified virtual register.
+ ///
const TargetRegisterClass *getRegClass(unsigned Reg) const {
Reg -= TargetRegisterInfo::FirstVirtualRegister;
assert(Reg < VRegInfo.size() && "Invalid vreg!");
@@ -137,10 +143,22 @@
}
/// setRegClass - Set the register class of the specified virtual register.
+ ///
void setRegClass(unsigned Reg, const TargetRegisterClass *RC) {
+ unsigned VR = Reg;
Reg -= TargetRegisterInfo::FirstVirtualRegister;
assert(Reg < VRegInfo.size() && "Invalid vreg!");
+ const TargetRegisterClass *OldRC = VRegInfo[Reg].first;
VRegInfo[Reg].first = RC;
+
+ // Remove from old register class's vregs list. This may be slow but
+ // fortunately this operation is rarely needed.
+ std::vector &VRegs = RegClass2VRegMap[OldRC->getID()];
+ std::vector::iterator I=std::find(VRegs.begin(), VRegs.end(), VR);
+ VRegs.erase(I);
+
+ // Add to new register class's vregs list.
+ RegClass2VRegMap[RC->getID()].push_back(VR);
}
/// createVirtualRegister - Create and return a new virtual register in the
@@ -151,13 +169,13 @@
// Add a reg, but keep track of whether the vector reallocated or not.
void *ArrayBase = VRegInfo.empty() ? 0 : &VRegInfo[0];
VRegInfo.push_back(std::make_pair(RegClass, (MachineOperand*)0));
-
- if (&VRegInfo[0] == ArrayBase || VRegInfo.size() == 1)
- return getLastVirtReg();
- // Otherwise, the vector reallocated, handle this now.
- HandleVRegListReallocation();
- return getLastVirtReg();
+ if (!((&VRegInfo[0] == ArrayBase || VRegInfo.size() == 1)))
+ // The vector reallocated, handle this now.
+ HandleVRegListReallocation();
+ unsigned VR = getLastVirtReg();
+ RegClass2VRegMap[RegClass->getID()].push_back(VR);
+ return VR;
}
/// getLastVirtReg - Return the highest currently assigned virtual register.
@@ -165,7 +183,12 @@
unsigned getLastVirtReg() const {
return (unsigned)VRegInfo.size()+TargetRegisterInfo::FirstVirtualRegister-1;
}
-
+
+ /// getRegClassVirtRegs - Return the list of virtual registers of the given
+ /// target register class.
+ std::vector &getRegClassVirtRegs(const TargetRegisterClass *RC) {
+ return RegClass2VRegMap[RC->getID()];
+ }
//===--------------------------------------------------------------------===//
// Physical Register Use Info
Modified: llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp?rev=57844&r1=57843&r2=57844&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Mon Oct 20 15:03:28 2008
@@ -16,6 +16,7 @@
MachineRegisterInfo::MachineRegisterInfo(const TargetRegisterInfo &TRI) {
VRegInfo.reserve(256);
+ RegClass2VRegMap.resize(TRI.getNumRegClasses()+1); // RC ID starts at 1.
UsedPhysRegs.resize(TRI.getNumRegs());
// Create the physreg use/def lists.
From clattner at apple.com Mon Oct 20 16:15:24 2008
From: clattner at apple.com (Chris Lattner)
Date: Mon, 20 Oct 2008 14:15:24 -0700
Subject: [llvm-commits] [test-suite] r57768 -
/test-suite/trunk/MultiSource/Applications/lua/Makefile
In-Reply-To:
References: <200810181821.m9IILX4H011913@zion.cs.uiuc.edu>
Message-ID: <661B7D79-2097-4197-BD7B-3BE5788DC69E@apple.com>
On Oct 20, 2008, at 10:38 AM, Tanya Lattner wrote:
> Ok for 2.4?
Yes. I'd also be fine with removing lua for 2.4 if you prefer that,
-Chris
From gohman at apple.com Mon Oct 20 16:30:14 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Oct 2008 21:30:14 -0000
Subject: [llvm-commits] [llvm] r57845 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200810202130.m9KLUEnk003845@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 16:30:12 2008
New Revision: 57845
URL: http://llvm.org/viewvc/llvm-project?rev=57845&view=rev
Log:
Fast-isel no longer an experiment.
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=57845&r1=57844&r2=57845&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Oct 20 16:30:12 2008
@@ -57,7 +57,7 @@
EnableLegalizeTypes("enable-legalize-types", cl::Hidden);
static cl::opt
EnableFastISelVerbose("fast-isel-verbose", cl::Hidden,
- cl::desc("Enable verbose messages in the experimental \"fast\" "
+ cl::desc("Enable verbose messages in the \"fast\" "
"instruction selector"));
static cl::opt
EnableFastISelAbort("fast-isel-abort", cl::Hidden,
From grosbach at apple.com Mon Oct 20 16:39:24 2008
From: grosbach at apple.com (Jim Grosbach)
Date: Mon, 20 Oct 2008 21:39:24 -0000
Subject: [llvm-commits] [llvm] r57846 - in /llvm/trunk:
include/llvm/System/Memory.h lib/System/Unix/Memory.inc
lib/System/Win32/Memory.inc lib/Target/ARM/ARMJITInfo.cpp
Message-ID: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
Author: grosbach
Date: Mon Oct 20 16:39:23 2008
New Revision: 57846
URL: http://llvm.org/viewvc/llvm-project?rev=57846&view=rev
Log:
Update the stub and callback code to handle lazy compilation. The stub
is re-written by the callback to branch directly to the compiled code
in future invocations.
Added back in range-based memory permission functions for the updating of
the stub on Darwin.
Modified:
llvm/trunk/include/llvm/System/Memory.h
llvm/trunk/lib/System/Unix/Memory.inc
llvm/trunk/lib/System/Win32/Memory.inc
llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp
Modified: llvm/trunk/include/llvm/System/Memory.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Memory.h?rev=57846&r1=57845&r2=57846&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Memory.h (original)
+++ llvm/trunk/include/llvm/System/Memory.h Mon Oct 20 16:39:23 2008
@@ -79,6 +79,14 @@
/// to mark a block of code as RW since the protections are on page
/// boundaries, and the JIT internal allocations are not page aligned.
static bool setWritable (MemoryBlock &M, std::string *ErrMsg = 0);
+
+ /// setRangeExecutable - Mark the page containing a range of addresses
+ /// as executable.
+ static bool setRangeExecutable(const void *Addr, size_t Size);
+
+ /// setRangeWritable - Mark the page containing a range of addresses
+ /// as writable.
+ static bool setRangeWritable(const void *Addr, size_t Size);
};
}
}
Modified: llvm/trunk/lib/System/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Memory.inc?rev=57846&r1=57845&r2=57846&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Memory.inc (original)
+++ llvm/trunk/lib/System/Unix/Memory.inc Mon Oct 20 16:39:23 2008
@@ -127,3 +127,24 @@
#endif
}
+bool llvm::sys::Memory::setRangeWritable(const void *Addr, size_t Size) {
+#if defined(__APPLE__) && defined(__arm__)
+ kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)Addr,
+ (vm_size_t)Size, 0,
+ VM_PROT_READ | VM_PROT_WRITE);
+ return KERN_SUCCESS == kr;
+#else
+ return true;
+#endif
+}
+
+bool llvm::sys::Memory::setRangeExecutable(const void *Addr, size_t Size) {
+#if defined(__APPLE__) && defined(__arm__)
+ kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)Addr,
+ (vm_size_t)Size, 0,
+ VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY);
+ return KERN_SUCCESS == kr;
+#else
+ return true;
+#endif
+}
Modified: llvm/trunk/lib/System/Win32/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Memory.inc?rev=57846&r1=57845&r2=57846&view=diff
==============================================================================
--- llvm/trunk/lib/System/Win32/Memory.inc (original)
+++ llvm/trunk/lib/System/Win32/Memory.inc Mon Oct 20 16:39:23 2008
@@ -53,13 +53,20 @@
return false;
}
-bool Memory::setWritable (MemoryBlock &M, std::string *ErrMsg) {
+bool Memory::setWritable(MemoryBlock &M, std::string *ErrMsg) {
return true;
}
-bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
+bool Memory::setExecutable(MemoryBlock &M, std::string *ErrMsg) {
return false;
}
+bool Memory::setRangeWritable(const void *Addr, size_t Size) {
+ return true;
}
+bool Memory::setRangeExecutable(const void *Addr, size_t Size) {
+ return false;
+}
+
+}
Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?rev=57846&r1=57845&r2=57846&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Mon Oct 20 16:39:23 2008
@@ -18,6 +18,8 @@
#include "llvm/Function.h"
#include "llvm/CodeGen/MachineCodeEmitter.h"
#include "llvm/Config/alloca.h"
+#include "llvm/Support/Streams.h"
+#include "llvm/System/Memory.h"
#include
using namespace llvm;
@@ -38,9 +40,10 @@
#define ASMPREFIX GETASMPREFIX(__USER_LABEL_PREFIX__)
// CompilationCallback stub - We can't use a C function with inline assembly in
-// it, because we the prolog/epilog inserted by GCC won't work for us. Instead,
-// write our own wrapper, which does things our way, so we have complete control
-// over register saving and restoring.
+// it, because we the prolog/epilog inserted by GCC won't work for us (we need
+// to preserve more context and manipulate the stack directly). Instead,
+// write our own wrapper, which does things our way, so we have complete
+// control over register saving and restoring.
extern "C" {
#if defined(__arm__)
void ARMCompilationCallback(void);
@@ -49,33 +52,42 @@
".align 2\n"
".globl " ASMPREFIX "ARMCompilationCallback\n"
ASMPREFIX "ARMCompilationCallback:\n"
- // save main registers
-#if defined(__APPLE__)
- "stmfd sp!, {r4, r5, r6, r7, lr}\n"
- "mov r0, r7\n" // stub's frame
- "stmfd sp!, {r8, r10, r11}\n"
-#else
- "mov ip, sp\n"
- "stmfd sp!, {fp, ip, lr, pc}\n"
- "sub fp, ip, #4\n"
-#endif // __APPLE__
- // arguments to Compilation Callback
- // r0 - our lr (address of the call instruction in stub plus 4)
- // r1 - stub's lr (address of instruction that called the stub plus 4)
-#if defined(__APPLE__)
- "mov r0, r7\n" // stub's frame
-#else
- "mov r0, fp\n" // stub's frame
-#endif // __APPLE__
- "mov r1, lr\n" // stub's lr
- "bl " ASMPREFIX "ARMCompilationCallbackC\n"
- // restore main registers
-#if defined(__APPLE__)
- "ldmfd sp!, {r8, r10, r11}\n"
- "ldmfd sp!, {r4, r5, r6, r7, pc}\n"
-#else
- "ldmfd sp, {fp, sp, pc}\n"
-#endif // __APPLE__
+ // Save caller saved registers since they may contain stuff
+ // for the real target function right now. We have to act as if this
+ // whole compilation callback doesn't exist as far as the caller is
+ // concerned, so we can't just preserve the callee saved regs.
+ "push {r0, r1, r2, r3, lr}\n"
+ // The LR contains the address of the stub function on entry.
+ // pass it as the argument to the C part of the callback
+ "mov r0, lr\n"
+ "sub sp, sp, #4\n"
+ // Call the C portion of the callback
+ "bl " ASMPREFIX "ARMCompilationCallbackC\n"
+ "add sp, sp, #4\n"
+ // Restoring the LR to the return address of the function that invoked
+ // the stub and de-allocating the stack space for it requires us to
+ // swap the two saved LR values on the stack, as they're backwards
+ // for what we need since the pop instruction has a pre-determined
+ // order for the registers.
+ // +--------+
+ // 0 | LR | Original return address
+ // +--------+
+ // 1 | LR | Stub address (start of stub)
+ // 2-5 | R3..R0 | Saved registers (we need to preserve all regs)
+ // +--------+
+ //
+ // We need to exchange the values in slots 0 and 1 so we can
+ // return to the address in slot 1 with the address in slot 0
+ // restored to the LR.
+ "ldr r0, [sp,#20]\n"
+ "ldr r1, [sp,#16]\n"
+ "str r1, [sp,#20]\n"
+ "str r0, [sp,#16]\n"
+ // Return to the (newly modified) stub to invoke the real function.
+ // The above twiddling of the saved return addresses allows us to
+ // deallocate everything, including the LR the stub saved, all in one
+ // pop instruction.
+ "pop {r0, r1, r2, r3, lr, pc}\n"
);
#else // Not an ARM host
void ARMCompilationCallback() {
@@ -85,31 +97,37 @@
#endif
}
-/// ARMCompilationCallbackC - This is the target-specific function invoked by the
-/// function stub when we did not know the real target of a call. This function
-/// must locate the start of the stub or call site and pass it into the JIT
-/// compiler function.
-extern "C" void ARMCompilationCallbackC(intptr_t *StackPtr, intptr_t RetAddr) {
- intptr_t *RetAddrLoc = &StackPtr[-1];
-
- assert(*RetAddrLoc == RetAddr &&
- "Could not find return address on the stack!");
-#if 0
- DOUT << "In callback! Addr=" << (void*)RetAddr
- << " FP=" << (void*)StackPtr
- << ": Resolving call to function: "
- << TheVM->getFunctionReferencedName((void*)RetAddr) << "\n";
-#endif
- intptr_t Addr = RetAddr - 4;
-
- intptr_t NewVal = (intptr_t)JITCompilerFunction((void*)Addr);
+/// ARMCompilationCallbackC - This is the target-specific function invoked
+/// by the function stub when we did not know the real target of a call.
+/// This function must locate the start of the stub or call site and pass
+/// it into the JIT compiler function.
+extern "C" void ARMCompilationCallbackC(intptr_t StubAddr) {
+ // Get the address of the compiled code for this function.
+ intptr_t NewVal = (intptr_t)JITCompilerFunction((void*)StubAddr);
// Rewrite the call target... so that we don't end up here every time we
- // execute the call.
- *(intptr_t *)Addr = NewVal;
-
- // Change the return address to reexecute the branch and link instruction...
- *RetAddrLoc -= 12;
+ // execute the call. We're replacing the first two instructions of the
+ // stub with:
+ // ldr pc, [pc,#-4]
+ //
+#if defined(__APPLE__)
+ bool ok = sys::Memory::setRangeWritable ((void*)StubAddr, 8);
+ if (!ok)
+ {
+ cerr << "ERROR: Unable to mark stub writable\n";
+ abort();
+ }
+#endif
+ *(intptr_t *)StubAddr = 0xe51ff004;
+ *(intptr_t *)(StubAddr+4) = NewVal;
+#if defined(__APPLE__)
+ ok = sys::Memory::setRangeExecutable ((void*)StubAddr, 8);
+ if (!ok)
+ {
+ cerr << "ERROR: Unable to mark stub executable\n";
+ abort();
+ }
+#endif
}
TargetJITInfo::LazyResolverFn
@@ -127,17 +145,27 @@
// branch to the corresponding function addr
// the stub is 8-byte size and 4-aligned
MCE.startFunctionStub(F, 8, 4);
- MCE.emitWordLE(0xE51FF004); // LDR PC, [PC,#-4]
+ MCE.emitWordLE(0xe51ff004); // LDR PC, [PC,#-4]
MCE.emitWordLE(addr); // addr of function
} else {
- // branch and link to the corresponding function addr
- // the stub is 20-byte size and 4-aligned
- MCE.startFunctionStub(F, 20, 4);
- MCE.emitWordLE(0xE92D4800); // STMFD SP!, [R11, LR]
- MCE.emitWordLE(0xE28FE004); // ADD LR, PC, #4
- MCE.emitWordLE(0xE51FF004); // LDR PC, [PC,#-4]
- MCE.emitWordLE(addr); // addr of function
- MCE.emitWordLE(0xE8BD8800); // LDMFD SP!, [R11, PC]
+ // The compilation callback will overwrite the first two words of this
+ // stub with indirect branch instructions targeting the compiled code.
+ // This stub sets the return address to restart the stub, so that
+ // the new branch will be invoked when we come back.
+ //
+ // branch and link to the compilation callback.
+ // the stub is 16-byte size and 4-byte aligned.
+ MCE.startFunctionStub(F, 16, 4);
+ // Save LR so the callback can determine which stub called it.
+ // The compilation callback is responsible for popping this prior
+ // to returning.
+ MCE.emitWordLE(0xe92d4000); // PUSH {lr}
+ // Set the return address to go back to the start of this stub
+ MCE.emitWordLE(0xe24fe00c); // SUB LR, PC, #12
+ // Invoke the compilation callback
+ MCE.emitWordLE(0xe51ff004); // LDR PC, [PC,#-4]
+ // The address of the compilation callback
+ MCE.emitWordLE((intptr_t)ARMCompilationCallback);
}
return MCE.finishFunctionStub(F);
From evan.cheng at apple.com Mon Oct 20 16:44:59 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Oct 2008 21:44:59 -0000
Subject: [llvm-commits] [llvm] r57847 - in /llvm/trunk:
include/llvm/CodeGen/Passes.h lib/CodeGen/PreAllocSplitting.cpp
Message-ID: <200810202144.m9KLixuI004320@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Oct 20 16:44:59 2008
New Revision: 57847
URL: http://llvm.org/viewvc/llvm-project?rev=57847&view=rev
Log:
Add skeleton for the pre-register allocation live interval splitting pass.
Added:
llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
Modified:
llvm/trunk/include/llvm/CodeGen/Passes.h
Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=57847&r1=57846&r2=57847&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/Passes.h Mon Oct 20 16:44:59 2008
@@ -61,6 +61,8 @@
/// This pass is still in development
extern const PassInfo *const StrongPHIEliminationID;
+ extern const PassInfo *const PreAllocSplittingID;
+
/// SimpleRegisterCoalescing pass. Aggressively coalesces every register
/// copy it can.
///
Added: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=57847&view=auto
==============================================================================
--- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (added)
+++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Mon Oct 20 16:44:59 2008
@@ -0,0 +1,81 @@
+//===-- PreAllocSplitting.cpp - Pre-allocation Interval Spltting 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 machine instruction level pre-register allocation
+// live interval splitting pass. It finds live interval barriers, i.e.
+// instructions which will kill all physical registers in certain register
+// classes, and split all live intervals which cross the barrier.
+//
+//===----------------------------------------------------------------------===//
+
+#define DEBUG_TYPE "pre-alloc-split"
+#include "llvm/CodeGen/LiveIntervalAnalysis.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineLoopInfo.h"
+#include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/CodeGen/Passes.h"
+#include "llvm/CodeGen/RegisterCoalescer.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/ADT/PostOrderIterator.h"
+#include "llvm/ADT/SmallPtrSet.h"
+using namespace llvm;
+
+namespace {
+ class VISIBILITY_HIDDEN PreAllocSplitting : public MachineFunctionPass {
+ // ProcessedBarriers - Register live interval barriers that have already
+ // been processed.
+ SmallPtrSet ProcessedBarriers;
+
+ // ActiveBarriers - Register live interval barriers that are currently
+ // being processed.
+ SmallSet ActiveBarriers;
+ public:
+ static char ID;
+ PreAllocSplitting() : MachineFunctionPass(&ID) {}
+
+ virtual bool runOnMachineFunction(MachineFunction &MF);
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.addRequired();
+ AU.addPreserved();
+ AU.addPreserved();
+ AU.addPreserved();
+ if (StrongPHIElim)
+ AU.addPreservedID(StrongPHIEliminationID);
+ else
+ AU.addPreservedID(PHIEliminationID);
+ AU.addPreservedID(TwoAddressInstructionPassID);
+ MachineFunctionPass::getAnalysisUsage(AU);
+ }
+
+ virtual void releaseMemory() {
+ ProcessedBarriers.clear();
+ ActiveBarriers.clear();
+ }
+
+ virtual const char *getPassName() const {
+ return "Pre-Register Allocaton Live Interval Splitting";
+ }
+ };
+} // end anonymous namespace
+
+char PreAllocSplitting::ID = 0;
+
+static RegisterPass
+X("pre-alloc-splitting", "Pre-Register Allocation Live Interval Splitting");
+
+const PassInfo *const llvm::PreAllocSplittingID = &X;
+
+bool PreAllocSplitting::runOnMachineFunction(MachineFunction &MF) {
+ return false;
+}
From alenhar2 at cs.uiuc.edu Mon Oct 20 17:40:33 2008
From: alenhar2 at cs.uiuc.edu (Andrew Lenharth)
Date: Mon, 20 Oct 2008 22:40:33 -0000
Subject: [llvm-commits] [poolalloc] r57848 - in /poolalloc/trunk/lib/DSA:
BottomUpClosure.cpp CompleteBottomUp.cpp DataStructure.cpp Local.cpp
Message-ID: <200810202240.m9KMeYeM006700@zion.cs.uiuc.edu>
Author: alenhar2
Date: Mon Oct 20 17:40:32 2008
New Revision: 57848
URL: http://llvm.org/viewvc/llvm-project?rev=57848&view=rev
Log:
Make simpler and more correct
Modified:
poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp
poolalloc/trunk/lib/DSA/DataStructure.cpp
poolalloc/trunk/lib/DSA/Local.cpp
Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=57848&r1=57847&r2=57848&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Mon Oct 20 17:40:32 2008
@@ -462,6 +462,7 @@
DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes|
(isComplete?0:DSGraph::DontCloneAuxCallNodes));
++NumInlines;
+ DEBUG(Graph->AssertGraphOK(););
} else if (CalledFuncs.size() > 1) {
DEBUG(std::cerr << "In Fns: " << Graph->getFunctionNames() << "\n");
DEBUG(std::cerr << " calls " << CalledFuncs.size()
@@ -543,7 +544,8 @@
++NumInlines;
}
}
- DEBUG(Graph->AssertGraphOK(); Graph->getGlobalsGraph()->AssertGraphOK());
+ DEBUG(Graph->AssertGraphOK(););
+ DEBUG(Graph->getGlobalsGraph()->AssertGraphOK());
if (!isComplete)
AuxCallsList.push_front(CS);
TempFCs.erase(TempFCs.begin());
Modified: poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp?rev=57848&r1=57847&r2=57848&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp (original)
+++ poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp Mon Oct 20 17:40:32 2008
@@ -35,6 +35,7 @@
init(&getAnalysis(), false, true, false, true);
buildIndirectFunctionSets(M);
+ formGlobalECs();
return runOnModuleInternal(M);
}
@@ -50,12 +51,13 @@
for (std::vector::iterator ii = keys.begin(), ee = keys.end();
ii != ee; ++ii) {
if (*ii) {
- callee_iterator base = callee_begin(*ii);
-
- for (callee_iterator csi = callee_begin(*ii), cse = callee_end(*ii);
- csi != cse; ++csi) {
- GlobalECs.unionSets(*base, *csi);
- GlobalsGraph->getNodeForValue(*base).mergeWith(GlobalsGraph->getNodeForValue(*csi));
+ callee_iterator csi = callee_begin(*ii), cse = callee_end(*ii);
+ if (csi != cse) ++csi;
+ DSGraph* G = getOrCreateGraph((*ii)->getParent()->getParent());
+ for ( ; csi != cse; ++csi) {
+ G->getNodeForValue(*csi).mergeWith(G->getNodeForValue((*ii)->getOperand(0)));
+ G->getNodeForValue((*ii)->getOperand(0)).getNode()->setGlobalMarker();
+ G->getNodeForValue((*ii)->getOperand(0)).getNode()->addGlobal(*csi);
}
}
}
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=57848&r1=57847&r2=57848&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Mon Oct 20 17:40:32 2008
@@ -146,7 +146,6 @@
if (T) mergeTypeInfo(T, 0);
if (G) G->addNode(this);
++NumNodeAllocated;
- // DOUT << "LLVA: Creating (1) DSNode " << this << "\n";
}
// DSNode copy constructor... do not copy over the referrers list!
@@ -159,7 +158,6 @@
Links.resize(N.Links.size()); // Create the appropriate number of null links
G->addNode(this);
++NumNodeAllocated;
- // DOUT << "LLVA: Creating (2) DSNode " << this << "\n";
}
DSNode::~DSNode() {
@@ -193,6 +191,7 @@
assert(ParentGraph && "Node has no parent?");
const DSScalarMap &SM = ParentGraph->getScalarMap();
for (unsigned i = 0, e = Globals.size(); i != e; ++i) {
+ Globals[i]->dump();
assert(SM.global_count(Globals[i]));
assert(SM.find(Globals[i])->second.getNode() == this);
}
@@ -808,6 +807,11 @@
std::set_union(Globals.begin(), Globals.end(),
RHS.Globals.begin(), RHS.Globals.end(),
back_it);
+ DEBUG(
+ for (std::vector::iterator ii = Temp.begin(),
+ ee = Temp.end(); ii != ee; ++ii)
+ assert(isa(*ii) && "Non global merged");
+ );
Globals.swap(Temp);
}
Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=57848&r1=57847&r2=57848&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Mon Oct 20 17:40:32 2008
@@ -641,6 +641,11 @@
if (isa(I->getType()))
RetVal = getValueDest(*I);
+ if (!isa(Callee))
+ if (ConstantExpr* EX = dyn_cast(Callee))
+ if (EX->isCast() && isa(EX->getOperand(0)))
+ Callee = cast(EX->getOperand(0));
+
DSNode *CalleeNode = 0;
if (!isa(Callee)) {
CalleeNode = getValueDest(*Callee).getNode();
From alenhar2 at cs.uiuc.edu Mon Oct 20 17:41:19 2008
From: alenhar2 at cs.uiuc.edu (Andrew Lenharth)
Date: Mon, 20 Oct 2008 22:41:19 -0000
Subject: [llvm-commits] [poolalloc] r57849 -
/poolalloc/trunk/lib/DSA/DataStructure.cpp
Message-ID: <200810202241.m9KMfJF6006731@zion.cs.uiuc.edu>
Author: alenhar2
Date: Mon Oct 20 17:41:18 2008
New Revision: 57849
URL: http://llvm.org/viewvc/llvm-project?rev=57849&view=rev
Log:
silence debugging output
Modified:
poolalloc/trunk/lib/DSA/DataStructure.cpp
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=57849&r1=57848&r2=57849&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Mon Oct 20 17:41:18 2008
@@ -191,7 +191,6 @@
assert(ParentGraph && "Node has no parent?");
const DSScalarMap &SM = ParentGraph->getScalarMap();
for (unsigned i = 0, e = Globals.size(); i != e; ++i) {
- Globals[i]->dump();
assert(SM.global_count(Globals[i]));
assert(SM.find(Globals[i])->second.getNode() == this);
}
From echristo at apple.com Mon Oct 20 17:59:47 2008
From: echristo at apple.com (Eric Christopher)
Date: Mon, 20 Oct 2008 15:59:47 -0700
Subject: [llvm-commits] {PATCH] fix 'make check' on Solaris10
In-Reply-To:
References: <4354d3270810181030l6c93a546gd800642e7d9b93ea@mail.gmail.com>
Message-ID:
On Oct 18, 2008, at 11:25 AM, Chris Lattner wrote:
> This looks good to me, but I'm not autoconf wizard :). Eric, can
> you take a look?
Yep. It should be good.
-eric
From kremenek at apple.com Mon Oct 20 18:15:01 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Mon, 20 Oct 2008 23:15:01 -0000
Subject: [llvm-commits] [llvm] r57853 - /llvm/tags/checker/checker-113/
Message-ID: <200810202315.m9KNF1aD007654@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 18:15:01 2008
New Revision: 57853
URL: http://llvm.org/viewvc/llvm-project?rev=57853&view=rev
Log:
Tagging checker-113.
Added:
llvm/tags/checker/checker-113/
- copied from r57852, llvm/trunk/
From kremenek at apple.com Mon Oct 20 18:40:49 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Mon, 20 Oct 2008 23:40:49 -0000
Subject: [llvm-commits] [llvm] r57856 - /llvm/tags/checker/checker-113/
Message-ID: <200810202340.m9KNena4008406@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 18:40:49 2008
New Revision: 57856
URL: http://llvm.org/viewvc/llvm-project?rev=57856&view=rev
Log:
Removing checker-113.
Removed:
llvm/tags/checker/checker-113/
From kremenek at apple.com Mon Oct 20 18:41:13 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Mon, 20 Oct 2008 23:41:13 -0000
Subject: [llvm-commits] [llvm] r57858 - /llvm/tags/checker/checker-113/
Message-ID: <200810202341.m9KNfDG0008436@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 18:41:13 2008
New Revision: 57858
URL: http://llvm.org/viewvc/llvm-project?rev=57858&view=rev
Log:
Tagging checker-113.
Added:
llvm/tags/checker/checker-113/
- copied from r57857, llvm/trunk/
From gohman at apple.com Mon Oct 20 18:43:13 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Oct 2008 23:43:13 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r57860 - in /llvm-gcc-4.2/trunk/gcc:
llvm-backend.cpp llvm.h toplev.c
Message-ID: <200810202343.m9KNhD5P008508@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 18:43:13 2008
New Revision: 57860
URL: http://llvm.org/viewvc/llvm-project?rev=57860&view=rev
Log:
Don't call llvm_shutdown() in llvm_asm_file_end(), because
PCH uses llvm_asm_file_end() in a special way, such that
it's too early to destroy all of LLVM's global state.
Instead, wait until the end of compile_file() to call
llvm_shutdown().
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
llvm-gcc-4.2/trunk/gcc/llvm.h
llvm-gcc-4.2/trunk/gcc/toplev.c
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=57860&r1=57859&r2=57860&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Oct 20 18:43:13 2008
@@ -574,7 +574,6 @@
// llvm_asm_file_end - Finish the .s file.
void llvm_asm_file_end(void) {
timevar_push(TV_LLVM_PERFILE);
- llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
performLateBackendInitialization();
createOptimizationPasses();
@@ -692,6 +691,11 @@
timevar_pop(TV_LLVM_PERFILE);
}
+// llvm_call_llvm_shutdown - Release LLVM global state.
+void llvm_call_llvm_shutdown(void) {
+ llvm_shutdown();
+}
+
// llvm_emit_code_for_current_function - Top level interface for emitting a
// function to the .s file.
void llvm_emit_code_for_current_function(tree fndecl) {
Modified: llvm-gcc-4.2/trunk/gcc/llvm.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm.h?rev=57860&r1=57859&r2=57860&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm.h Mon Oct 20 18:43:13 2008
@@ -109,6 +109,9 @@
/* llvm_asm_file_end - Finish the .s file. */
void llvm_asm_file_end(void);
+/* llvm_call_llvm_shutdown - Release LLVM global state. */
+void llvm_call_llvm_shutdown(void);
+
/* refine_type_to - Cause all users of the opaque type old_type to switch
* to the more concrete type new_type.
*/
Modified: llvm-gcc-4.2/trunk/gcc/toplev.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/toplev.c?rev=57860&r1=57859&r2=57860&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/toplev.c (original)
+++ llvm-gcc-4.2/trunk/gcc/toplev.c Mon Oct 20 18:43:13 2008
@@ -1184,6 +1184,8 @@
#else
if (!flag_pch_file)
llvm_asm_file_end();
+ /* Release LLVM global state. */
+ llvm_call_llvm_shutdown();
#endif
/* LLVM LOCAL end */
}
From gohman at apple.com Mon Oct 20 18:45:28 2008
From: gohman at apple.com (Dan Gohman)
Date: Mon, 20 Oct 2008 23:45:28 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r57861 -
/llvm-gcc-4.2/trunk/gcc/except.c
Message-ID: <200810202345.m9KNjS4F008577@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 18:45:28 2008
New Revision: 57861
URL: http://llvm.org/viewvc/llvm-project?rev=57861&view=rev
Log:
Re-apply r57527, with some cleanups from Duncan, now that
r57860 is in, which fixed the PCH problem that r57527
uncovered.
Modified:
llvm-gcc-4.2/trunk/gcc/except.c
Modified: llvm-gcc-4.2/trunk/gcc/except.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=57861&r1=57860&r2=57861&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/except.c (original)
+++ llvm-gcc-4.2/trunk/gcc/except.c Mon Oct 20 18:45:28 2008
@@ -4079,13 +4079,24 @@
/* The default c++ routines aren't actually c++ specific, so use those. */
/* LLVM LOCAL begin */
#ifdef ENABLE_LLVM
- llvm_unwind_resume_libfunc = llvm_init_one_libfunc ( USING_SJLJ_EXCEPTIONS ?
- "_Unwind_SjLj_Resume"
+ /* Create the decl with build_decl instead of using llvm_init_one_libfunc
+ so that we can specify an argument type instead of just using '...'.
+ '...' is functionally correct, but more work for codegen to handle,
+ and even requires additional instructions on some targets. */
+ const char *name = USING_SJLJ_EXCEPTIONS ?
+ "_Unwind_SjLj_Resume"
#ifdef LLVM_STACKSENSITIVE_UNWIND_RESUME
- : "_Unwind_Resume_or_Rethrow");
+ : "_Unwind_Resume_or_Rethrow";
#else
- : "_Unwind_Resume");
+ : "_Unwind_Resume";
#endif
+ tree decl = build_decl (FUNCTION_DECL, get_identifier (name),
+ build_function_type_list (void_type_node,
+ ptr_type_node, NULL_TREE));
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+ llvm_unwind_resume_libfunc = decl;
#else
unwind_resume_libfunc =
init_one_libfunc ( USING_SJLJ_EXCEPTIONS ? "_Unwind_SjLj_Resume"
From sabre at nondot.org Mon Oct 20 19:45:37 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 21 Oct 2008 00:45:37 -0000
Subject: [llvm-commits] [llvm] r57862 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
test/CodeGen/X86/2008-10-20-AsmDoubleInI32.ll
Message-ID: <200810210045.m9L0jcK3010493@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Oct 20 19:45:36 2008
New Revision: 57862
URL: http://llvm.org/viewvc/llvm-project?rev=57862&view=rev
Log:
Fix gcc.c-torture/compile/920520-1.c by inserting bitconverts
for strange asm conditions earlier. In this case, we have a
double being passed in an integer reg class. Convert to like
sized integer register so that we allocate the right number
for the class (two i32's for the f64 in this case).
Added:
llvm/trunk/test/CodeGen/X86/2008-10-20-AsmDoubleInI32.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=57862&r1=57861&r2=57862&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Oct 20 19:45:36 2008
@@ -512,11 +512,8 @@
/// getCopyToParts - Create a series of nodes that contain the specified value
/// split into legal parts. If the parts contain more bits than Val, then, for
/// integers, ExtendKind can be used to specify how to generate the extra bits.
-static void getCopyToParts(SelectionDAG &DAG,
- SDValue Val,
- SDValue *Parts,
- unsigned NumParts,
- MVT PartVT,
+static void getCopyToParts(SelectionDAG &DAG, SDValue Val,
+ SDValue *Parts, unsigned NumParts, MVT PartVT,
ISD::NodeType ExtendKind = ISD::ANY_EXTEND) {
TargetLowering &TLI = DAG.getTargetLoweringInfo();
MVT PtrVT = TLI.getPointerTy();
@@ -4497,11 +4494,37 @@
OpInfo.ConstraintVT);
unsigned NumRegs = 1;
- if (OpInfo.ConstraintVT != MVT::Other)
+ if (OpInfo.ConstraintVT != MVT::Other) {
+ // If this is a FP input in an integer register (or visa versa) insert a bit
+ // cast of the input value. More generally, handle any case where the input
+ // value disagrees with the register class we plan to stick this in.
+ if (OpInfo.Type == InlineAsm::isInput &&
+ PhysReg.second && !PhysReg.second->hasType(OpInfo.ConstraintVT)) {
+ // Try to convert to the first MVT that the reg class contains. If the
+ // types are identical size, use a bitcast to convert (e.g. two differing
+ // vector types).
+ MVT RegVT = *PhysReg.second->vt_begin();
+ if (RegVT.getSizeInBits() == OpInfo.ConstraintVT.getSizeInBits()) {
+ OpInfo.CallOperand = DAG.getNode(ISD::BIT_CONVERT, RegVT,
+ OpInfo.CallOperand);
+ OpInfo.ConstraintVT = RegVT;
+ } else if (RegVT.isInteger() && OpInfo.ConstraintVT.isFloatingPoint()) {
+ // If the input is a FP value and we want it in FP registers, do a
+ // bitcast to the corresponding integer type. This turns an f64 value
+ // into i64, which can be passed with two i32 values on a 32-bit
+ // machine.
+ RegVT = MVT::getIntegerVT(OpInfo.ConstraintVT.getSizeInBits());
+ OpInfo.CallOperand = DAG.getNode(ISD::BIT_CONVERT, RegVT,
+ OpInfo.CallOperand);
+ OpInfo.ConstraintVT = RegVT;
+ }
+ }
+
NumRegs = TLI.getNumRegisters(OpInfo.ConstraintVT);
+ }
+
MVT RegVT;
MVT ValueVT = OpInfo.ConstraintVT;
-
// If this is a constraint for a specific physical register, like {r17},
// assign it now.
Added: llvm/trunk/test/CodeGen/X86/2008-10-20-AsmDoubleInI32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-20-AsmDoubleInI32.ll?rev=57862&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2008-10-20-AsmDoubleInI32.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2008-10-20-AsmDoubleInI32.ll Mon Oct 20 19:45:36 2008
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -march=x86
+; RUN: llvm-as < %s | llc -march=x86-64
+
+; from gcc.c-torture/compile/920520-1.c
+
+define i32 @g() nounwind {
+entry:
+ call void asm sideeffect "$0", "r"(double 1.500000e+00) nounwind
+ ret i32 0
+}
+
From gohman at apple.com Mon Oct 20 20:08:08 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 01:08:08 -0000
Subject: [llvm-commits] [llvm] r57864 -
/llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
Message-ID: <200810210108.m9L188O4011201@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 20:08:07 2008
New Revision: 57864
URL: http://llvm.org/viewvc/llvm-project?rev=57864&view=rev
Log:
Fix a bug that prevented llvm-extract -delete from working.
Modified:
llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
Modified: llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp?rev=57864&r1=57863&r2=57864&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp Mon Oct 20 20:08:07 2008
@@ -52,7 +52,7 @@
bool deleteGV() {
for (std::vector::iterator GI = Named.begin(),
GE = Named.end(); GI != GE; ++GI) {
- if (Function* NamedFunc = dyn_cast(&*GI)) {
+ if (Function* NamedFunc = dyn_cast(*GI)) {
// If we're in relinking mode, set linkage of all internal callees to
// external. This will allow us extract function, and then - link
// everything together
From kremenek at apple.com Mon Oct 20 21:36:36 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 02:36:36 -0000
Subject: [llvm-commits] [llvm] r57865 - /llvm/tags/checker/checker-113/
Message-ID: <200810210236.m9L2abh4013789@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 21:36:36 2008
New Revision: 57865
URL: http://llvm.org/viewvc/llvm-project?rev=57865&view=rev
Log:
Removing checker-113.
Removed:
llvm/tags/checker/checker-113/
From kremenek at apple.com Mon Oct 20 21:37:14 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 02:37:14 -0000
Subject: [llvm-commits] [llvm] r57867 - /llvm/tags/checker/checker-113/
Message-ID: <200810210237.m9L2bE2n013830@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 21:37:14 2008
New Revision: 57867
URL: http://llvm.org/viewvc/llvm-project?rev=57867&view=rev
Log:
Tagging checker-113.
Added:
llvm/tags/checker/checker-113/
- copied from r57866, llvm/trunk/
From ofv at wanadoo.es Mon Oct 20 21:37:50 2008
From: ofv at wanadoo.es (Oscar Fuentes)
Date: Tue, 21 Oct 2008 02:37:50 -0000
Subject: [llvm-commits] [llvm] r57869 -
/llvm/trunk/lib/CodeGen/CMakeLists.txt
Message-ID: <200810210237.m9L2boIe013872@zion.cs.uiuc.edu>
Author: ofv
Date: Mon Oct 20 21:37:50 2008
New Revision: 57869
URL: http://llvm.org/viewvc/llvm-project?rev=57869&view=rev
Log:
CMake: updated lib/CodeGen/CMakeLists.txt
Modified:
llvm/trunk/lib/CodeGen/CMakeLists.txt
Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CMakeLists.txt?rev=57869&r1=57868&r2=57869&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CMakeLists.txt (original)
+++ llvm/trunk/lib/CodeGen/CMakeLists.txt Mon Oct 20 21:37:50 2008
@@ -30,6 +30,7 @@
PHIElimination.cpp
Passes.cpp
PostRASchedulerList.cpp
+ PreAllocSplitting.cpp
PrologEpilogInserter.cpp
PseudoSourceValue.cpp
RegAllocBigBlock.cpp
From gohman at apple.com Mon Oct 20 22:10:30 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 03:10:30 -0000
Subject: [llvm-commits] [llvm] r57870 -
/llvm/trunk/lib/Transforms/Instrumentation/BlockProfiling.cpp
Message-ID: <200810210310.m9L3AVJe014762@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 22:10:28 2008
New Revision: 57870
URL: http://llvm.org/viewvc/llvm-project?rev=57870&view=rev
Log:
Use Function::getEntryBlock() instead of Function::front(), for clarity.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/BlockProfiling.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/BlockProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/BlockProfiling.cpp?rev=57870&r1=57869&r2=57870&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/BlockProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/BlockProfiling.cpp Mon Oct 20 22:10:28 2008
@@ -72,7 +72,7 @@
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!I->isDeclaration())
// Insert counter at the start of the function
- IncrementCounterInBlock(I->begin(), i++, Counters);
+ IncrementCounterInBlock(&I->getEntryBlock(), i++, Counters);
// Add the initialization call to main.
InsertProfilingInitCall(Main, "llvm_start_func_profiling", Counters);
From gohman at apple.com Mon Oct 20 22:12:54 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 03:12:54 -0000
Subject: [llvm-commits] [llvm] r57871 -
/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Message-ID: <200810210312.m9L3CsIg014869@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 22:12:54 2008
New Revision: 57871
URL: http://llvm.org/viewvc/llvm-project?rev=57871&view=rev
Log:
Make the NaN test come second, heuristically assuming
that NaNs are less common.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=57871&r1=57870&r2=57871&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Oct 20 22:12:54 2008
@@ -4901,18 +4901,18 @@
unsigned Opc = 0;
switch (CCCode) {
default: assert(0 && "Don't know how to expand this condition!"); abort();
- case ISD::SETOEQ: CC1 = ISD::SETO; CC2 = ISD::SETEQ; Opc = ISD::AND; break;
- case ISD::SETOGT: CC1 = ISD::SETO; CC2 = ISD::SETGT; Opc = ISD::AND; break;
- case ISD::SETOGE: CC1 = ISD::SETO; CC2 = ISD::SETGE; Opc = ISD::AND; break;
- case ISD::SETOLT: CC1 = ISD::SETO; CC2 = ISD::SETLT; Opc = ISD::AND; break;
- case ISD::SETOLE: CC1 = ISD::SETO; CC2 = ISD::SETLE; Opc = ISD::AND; break;
- case ISD::SETONE: CC1 = ISD::SETO; CC2 = ISD::SETNE; Opc = ISD::AND; break;
- case ISD::SETUEQ: CC1 = ISD::SETUO; CC2 = ISD::SETEQ; Opc = ISD::OR; break;
- case ISD::SETUGT: CC1 = ISD::SETUO; CC2 = ISD::SETGT; Opc = ISD::OR; break;
- case ISD::SETUGE: CC1 = ISD::SETUO; CC2 = ISD::SETGE; Opc = ISD::OR; break;
- case ISD::SETULT: CC1 = ISD::SETUO; CC2 = ISD::SETLT; Opc = ISD::OR; break;
- case ISD::SETULE: CC1 = ISD::SETUO; CC2 = ISD::SETLE; Opc = ISD::OR; break;
- case ISD::SETUNE: CC1 = ISD::SETUO; CC2 = ISD::SETNE; Opc = ISD::OR; break;
+ case ISD::SETOEQ: CC1 = ISD::SETEQ; CC2 = ISD::SETO; Opc = ISD::AND; break;
+ case ISD::SETOGT: CC1 = ISD::SETGT; CC2 = ISD::SETO; Opc = ISD::AND; break;
+ case ISD::SETOGE: CC1 = ISD::SETGE; CC2 = ISD::SETO; Opc = ISD::AND; break;
+ case ISD::SETOLT: CC1 = ISD::SETLT; CC2 = ISD::SETO; Opc = ISD::AND; break;
+ case ISD::SETOLE: CC1 = ISD::SETLE; CC2 = ISD::SETO; Opc = ISD::AND; break;
+ case ISD::SETONE: CC1 = ISD::SETNE; CC2 = ISD::SETO; Opc = ISD::AND; break;
+ case ISD::SETUEQ: CC1 = ISD::SETEQ; CC2 = ISD::SETUO; Opc = ISD::OR; break;
+ case ISD::SETUGT: CC1 = ISD::SETGT; CC2 = ISD::SETUO; Opc = ISD::OR; break;
+ case ISD::SETUGE: CC1 = ISD::SETGE; CC2 = ISD::SETUO; Opc = ISD::OR; break;
+ case ISD::SETULT: CC1 = ISD::SETLT; CC2 = ISD::SETUO; Opc = ISD::OR; break;
+ case ISD::SETULE: CC1 = ISD::SETLE; CC2 = ISD::SETUO; Opc = ISD::OR; break;
+ case ISD::SETUNE: CC1 = ISD::SETNE; CC2 = ISD::SETUO; Opc = ISD::OR; break;
// FIXME: Implement more expansions.
}
From gohman at apple.com Mon Oct 20 22:24:39 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 03:24:39 -0000
Subject: [llvm-commits] [llvm] r57872 - in /llvm/trunk:
lib/CodeGen/SimpleRegisterCoalescing.cpp lib/Target/X86/X86InstrInfo.cpp
test/CodeGen/X86/ret-i64-0.ll
Message-ID: <200810210324.m9L3Odmc015190@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 22:24:31 2008
New Revision: 57872
URL: http://llvm.org/viewvc/llvm-project?rev=57872&view=rev
Log:
When the coalescer is doing rematerializing, have it remove
the copy instruction from the instruction list before asking the
target to create the new instruction. This gets the old instruction
out of the way so that it doesn't interfere with the target's
rematerialization code. In the case of x86, this helps it find
more cases where EFLAGS is not live.
Also, in the X86InstrInfo.cpp, teach isSafeToClobberEFLAGS to check
to see if it reached the end of the block after scanning each
instruction, instead of just before. This lets it notice when the
end of the block is only two instructions away, without doing any
additional scanning.
These changes allow rematerialization to clobber EFLAGS in more
cases, for example using xor instead of mov to set the return value
to zero in the included testcase.
Added:
llvm/trunk/test/CodeGen/X86/ret-i64-0.ll
Modified:
llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=57872&r1=57871&r2=57872&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Oct 20 22:24:31 2008
@@ -471,8 +471,9 @@
}
}
- MachineBasicBlock::iterator MII = CopyMI;
MachineBasicBlock *MBB = CopyMI->getParent();
+ MachineBasicBlock::iterator MII = next(MachineBasicBlock::iterator(CopyMI));
+ CopyMI->removeFromParent();
tii_->reMaterialize(*MBB, MII, DstReg, DefMI);
MachineInstr *NewMI = prior(MII);
// CopyMI may have implicit operands, transfer them over to the newly
@@ -491,7 +492,7 @@
}
li_->ReplaceMachineInstrInMaps(CopyMI, NewMI);
- CopyMI->eraseFromParent();
+ MBB->getParent()->DeleteMachineInstr(CopyMI);
ReMatCopies.insert(CopyMI);
ReMatDefs.insert(DefMI);
++NumReMats;
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=57872&r1=57871&r2=57872&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Oct 20 22:24:31 2008
@@ -848,12 +848,13 @@
/// two instructions it assumes it's not safe.
static bool isSafeToClobberEFLAGS(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I) {
+ // It's always safe to clobber EFLAGS at the end of a block.
+ if (I == MBB.end())
+ return true;
+
// For compile time consideration, if we are not able to determine the
// safety after visiting 2 instructions, we will assume it's not safe.
for (unsigned i = 0; i < 2; ++i) {
- if (I == MBB.end())
- // Reached end of block, it's safe.
- return true;
bool SeenDef = false;
for (unsigned j = 0, e = I->getNumOperands(); j != e; ++j) {
MachineOperand &MO = I->getOperand(j);
@@ -870,6 +871,10 @@
// This instruction defines EFLAGS, no need to look any further.
return true;
++I;
+
+ // If we make it to the end of the block, it's safe to clobber EFLAGS.
+ if (I == MBB.end())
+ return true;
}
// Conservative answer.
Added: llvm/trunk/test/CodeGen/X86/ret-i64-0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ret-i64-0.ll?rev=57872&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/ret-i64-0.ll (added)
+++ llvm/trunk/test/CodeGen/X86/ret-i64-0.ll Mon Oct 20 22:24:31 2008
@@ -0,0 +1,5 @@
+; RUN: llvm-as < %s | llc -march=x86 | grep xor | count 2
+
+define i64 @foo() {
+ ret i64 0
+}
From gohman at apple.com Mon Oct 20 22:29:32 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 03:29:32 -0000
Subject: [llvm-commits] [llvm] r57873 - in /llvm/trunk:
lib/CodeGen/IfConversion.cpp lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h
test/CodeGen/X86/isint.ll
Message-ID: <200810210329.m9L3TXbd015336@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 22:29:32 2008
New Revision: 57873
URL: http://llvm.org/viewvc/llvm-project?rev=57873&view=rev
Log:
Optimized FCMP_OEQ and FCMP_UNE for x86.
Where previously LLVM might emit code like this:
ucomisd %xmm1, %xmm0
setne %al
setp %cl
orb %al, %cl
jne .LBB4_2
it now emits this:
ucomisd %xmm1, %xmm0
jne .LBB4_2
jp .LBB4_2
It has fewer instructions and uses fewer registers, but it does
have more branches. And in the case that this code is followed by
a non-fallthrough edge, it may be followed by a jmp instruction,
resulting in three branch instructions in sequence. Some effort
is made to avoid this situation.
To achieve this, X86ISelLowering.cpp now recognizes FCMP_OEQ and
FCMP_UNE in lowered form, and replace them with code that emits
two branches, except in the case where it would require converting
a fall-through edge to an explicit branch.
Also, X86InstrInfo.cpp's branch analysis and transform code now
knows now to handle blocks with multiple conditional branches. It
uses loops instead of having fixed checks for up to two
instructions. It can now analyze and transform code generated
from FCMP_OEQ and FCMP_UNE.
Added:
llvm/trunk/test/CodeGen/X86/isint.ll
Modified:
llvm/trunk/lib/CodeGen/IfConversion.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
llvm/trunk/lib/Target/X86/X86InstrInfo.h
Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=57873&r1=57872&r2=57873&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Mon Oct 20 22:29:32 2008
@@ -849,7 +849,8 @@
}
if (Kind == ICSimpleFalse)
- TII->ReverseBranchCondition(Cond);
+ if (TII->ReverseBranchCondition(Cond))
+ assert(false && "Unable to reverse branch condition!");
if (CvtBBI->BB->pred_size() > 1) {
BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB);
@@ -914,21 +915,23 @@
}
if (Kind == ICTriangleFalse || Kind == ICTriangleFRev)
- TII->ReverseBranchCondition(Cond);
+ if (TII->ReverseBranchCondition(Cond))
+ assert(false && "Unable to reverse branch condition!");
if (Kind == ICTriangleRev || Kind == ICTriangleFRev) {
- ReverseBranchCondition(*CvtBBI);
- // BB has been changed, modify its predecessors (except for this
- // one) so they don't get ifcvt'ed based on bad intel.
- for (MachineBasicBlock::pred_iterator PI = CvtBBI->BB->pred_begin(),
- E = CvtBBI->BB->pred_end(); PI != E; ++PI) {
- MachineBasicBlock *PBB = *PI;
- if (PBB == BBI.BB)
- continue;
- BBInfo &PBBI = BBAnalysis[PBB->getNumber()];
- if (PBBI.IsEnqueued) {
- PBBI.IsAnalyzed = false;
- PBBI.IsEnqueued = false;
+ if (ReverseBranchCondition(*CvtBBI)) {
+ // BB has been changed, modify its predecessors (except for this
+ // one) so they don't get ifcvt'ed based on bad intel.
+ for (MachineBasicBlock::pred_iterator PI = CvtBBI->BB->pred_begin(),
+ E = CvtBBI->BB->pred_end(); PI != E; ++PI) {
+ MachineBasicBlock *PBB = *PI;
+ if (PBB == BBI.BB)
+ continue;
+ BBInfo &PBBI = BBAnalysis[PBB->getNumber()];
+ if (PBBI.IsEnqueued) {
+ PBBI.IsAnalyzed = false;
+ PBBI.IsEnqueued = false;
+ }
}
}
}
@@ -1028,7 +1031,8 @@
BBInfo *BBI1 = &TrueBBI;
BBInfo *BBI2 = &FalseBBI;
SmallVector RevCond(BBI.BrCond.begin(), BBI.BrCond.end());
- TII->ReverseBranchCondition(RevCond);
+ if (TII->ReverseBranchCondition(RevCond))
+ assert(false && "Unable to reverse branch condition!");
SmallVector *Cond1 = &BBI.BrCond;
SmallVector *Cond2 = &RevCond;
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57873&r1=57872&r2=57873&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Oct 20 22:29:32 2008
@@ -5100,6 +5100,71 @@
Cond = Cmp;
addTest = false;
}
+ // Also, recognize the pattern generated by an FCMP_UNE. We can emit
+ // two branches instead of an explicit OR instruction with a
+ // separate test.
+ } else if (Cond.getOpcode() == ISD::OR &&
+ Cond.hasOneUse() &&
+ Cond.getOperand(0).getOpcode() == X86ISD::SETCC &&
+ Cond.getOperand(0).hasOneUse() &&
+ Cond.getOperand(1).getOpcode() == X86ISD::SETCC &&
+ Cond.getOperand(1).hasOneUse()) {
+ SDValue Cmp = Cond.getOperand(0).getOperand(1);
+ unsigned Opc = Cmp.getOpcode();
+ if (Cmp == Cond.getOperand(1).getOperand(1) &&
+ (Opc == X86ISD::CMP ||
+ Opc == X86ISD::COMI ||
+ Opc == X86ISD::UCOMI)) {
+ CC = Cond.getOperand(0).getOperand(0);
+ Chain = DAG.getNode(X86ISD::BRCOND, Op.getValueType(),
+ Chain, Dest, CC, Cmp);
+ CC = Cond.getOperand(1).getOperand(0);
+ Cond = Cmp;
+ addTest = false;
+ }
+ // Also, recognize the pattern generated by an FCMP_OEQ. We can emit
+ // two branches instead of an explicit AND instruction with a
+ // separate test. However, we only do this if this block doesn't
+ // have a fall-through edge, because this requires an explicit
+ // jmp when the condition is false.
+ } else if (Cond.getOpcode() == ISD::AND &&
+ Cond.hasOneUse() &&
+ Cond.getOperand(0).getOpcode() == X86ISD::SETCC &&
+ Cond.getOperand(0).hasOneUse() &&
+ Cond.getOperand(1).getOpcode() == X86ISD::SETCC &&
+ Cond.getOperand(1).hasOneUse()) {
+ SDValue Cmp = Cond.getOperand(0).getOperand(1);
+ unsigned Opc = Cmp.getOpcode();
+ if (Cmp == Cond.getOperand(1).getOperand(1) &&
+ (Opc == X86ISD::CMP ||
+ Opc == X86ISD::COMI ||
+ Opc == X86ISD::UCOMI) &&
+ Op.getNode()->hasOneUse()) {
+ X86::CondCode CCode =
+ (X86::CondCode)Cond.getOperand(0).getConstantOperandVal(0);
+ CCode = X86::GetOppositeBranchCondition(CCode);
+ CC = DAG.getConstant(CCode, MVT::i8);
+ SDValue User = SDValue(*Op.getNode()->use_begin(), 0);
+ // Look for an unconditional branch following this conditional branch.
+ // We need this because we need to reverse the successors in order
+ // to implement FCMP_OEQ.
+ if (User.getOpcode() == ISD::BR) {
+ SDValue FalseBB = User.getOperand(1);
+ SDValue NewBR =
+ DAG.UpdateNodeOperands(User, User.getOperand(0), Dest);
+ assert(NewBR == User);
+ Dest = FalseBB;
+
+ Chain = DAG.getNode(X86ISD::BRCOND, Op.getValueType(),
+ Chain, Dest, CC, Cmp);
+ X86::CondCode CCode =
+ (X86::CondCode)Cond.getOperand(1).getConstantOperandVal(0);
+ CCode = X86::GetOppositeBranchCondition(CCode);
+ CC = DAG.getConstant(CCode, MVT::i8);
+ Cond = Cmp;
+ addTest = false;
+ }
+ }
}
if (addTest) {
@@ -5107,7 +5172,7 @@
Cond= DAG.getNode(X86ISD::CMP, MVT::i32, Cond, DAG.getConstant(0, MVT::i8));
}
return DAG.getNode(X86ISD::BRCOND, Op.getValueType(),
- Chain, Op.getOperand(2), CC, Cond);
+ Chain, Dest, CC, Cond);
}
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=57873&r1=57872&r2=57873&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Oct 20 22:29:32 2008
@@ -1455,88 +1455,101 @@
MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
SmallVectorImpl &Cond) const {
- // If the block has no terminators, it just falls into the block after it.
+ // Start from the bottom of the block and work up, examining the
+ // terminator instructions.
MachineBasicBlock::iterator I = MBB.end();
- if (I == MBB.begin() || !isBrAnalysisUnpredicatedTerminator(--I, *this))
- return false;
-
- // Get the last instruction in the block.
- MachineInstr *LastInst = I;
-
- // If there is only one terminator instruction, process it.
- if (I == MBB.begin() || !isBrAnalysisUnpredicatedTerminator(--I, *this)) {
- if (!LastInst->getDesc().isBranch())
+ while (I != MBB.begin()) {
+ --I;
+ // Working from the bottom, when we see a non-terminator
+ // instruction, we're done.
+ if (!isBrAnalysisUnpredicatedTerminator(I, *this))
+ break;
+ // A terminator that isn't a branch can't easily be handled
+ // by this analysis.
+ if (!I->getDesc().isBranch())
return true;
-
- // If the block ends with a branch there are 3 possibilities:
- // it's an unconditional, conditional, or indirect branch.
-
- if (LastInst->getOpcode() == X86::JMP) {
- TBB = LastInst->getOperand(0).getMBB();
- return false;
+ // Handle unconditional branches.
+ if (I->getOpcode() == X86::JMP) {
+ // If the block has any instructions after a JMP, delete them.
+ while (next(I) != MBB.end())
+ next(I)->eraseFromParent();
+ Cond.clear();
+ FBB = 0;
+ // Delete the JMP if it's equivalent to a fall-through.
+ if (MBB.isLayoutSuccessor(I->getOperand(0).getMBB())) {
+ TBB = 0;
+ I->eraseFromParent();
+ I = MBB.end();
+ continue;
+ }
+ // TBB is used to indicate the unconditinal destination.
+ TBB = I->getOperand(0).getMBB();
+ continue;
}
- X86::CondCode BranchCode = GetCondFromBranchOpc(LastInst->getOpcode());
+ // Handle conditional branches.
+ X86::CondCode BranchCode = GetCondFromBranchOpc(I->getOpcode());
if (BranchCode == X86::COND_INVALID)
return true; // Can't handle indirect branch.
-
- // Otherwise, block ends with fall-through condbranch.
- TBB = LastInst->getOperand(0).getMBB();
- Cond.push_back(MachineOperand::CreateImm(BranchCode));
- return false;
- }
-
- // Get the instruction before it if it's a terminator.
- MachineInstr *SecondLastInst = I;
-
- // If there are three terminators, we don't know what sort of block this is.
- if (SecondLastInst && I != MBB.begin() &&
- isBrAnalysisUnpredicatedTerminator(--I, *this))
- return true;
-
- // If the block ends with X86::JMP and a conditional branch, handle it.
- X86::CondCode BranchCode = GetCondFromBranchOpc(SecondLastInst->getOpcode());
- if (BranchCode != X86::COND_INVALID && LastInst->getOpcode() == X86::JMP) {
- TBB = SecondLastInst->getOperand(0).getMBB();
- Cond.push_back(MachineOperand::CreateImm(BranchCode));
- FBB = LastInst->getOperand(0).getMBB();
- return false;
- }
-
- // If the block ends with two X86::JMPs, handle it. The second one is not
- // executed, so remove it.
- if (SecondLastInst->getOpcode() == X86::JMP &&
- LastInst->getOpcode() == X86::JMP) {
- TBB = SecondLastInst->getOperand(0).getMBB();
- I = LastInst;
- I->eraseFromParent();
- return false;
+ // Working from the bottom, handle the first conditional branch.
+ if (Cond.empty()) {
+ FBB = TBB;
+ TBB = I->getOperand(0).getMBB();
+ Cond.push_back(MachineOperand::CreateImm(BranchCode));
+ continue;
+ }
+ // Handle subsequent conditional branches. Only handle the case
+ // where all conditional branches branch to the same destination
+ // and their condition opcodes fit one of the special
+ // multi-branch idioms.
+ assert(Cond.size() == 1);
+ assert(TBB);
+ // Only handle the case where all conditional branches branch to
+ // the same destination.
+ if (TBB != I->getOperand(0).getMBB())
+ return true;
+ X86::CondCode OldBranchCode = (X86::CondCode)Cond[0].getImm();
+ // If the conditions are the same, we can leave them alone.
+ if (OldBranchCode == BranchCode)
+ continue;
+ // If they differ, see if they fit one of the known patterns.
+ // Theoretically we could handle more patterns here, but
+ // we shouldn't expect to see them if instruction selection
+ // has done a reasonable job.
+ if ((OldBranchCode == X86::COND_NP &&
+ BranchCode == X86::COND_E) ||
+ (OldBranchCode == X86::COND_E &&
+ BranchCode == X86::COND_NP))
+ BranchCode = X86::COND_NP_OR_E;
+ else if ((OldBranchCode == X86::COND_P &&
+ BranchCode == X86::COND_NE) ||
+ (OldBranchCode == X86::COND_NE &&
+ BranchCode == X86::COND_P))
+ BranchCode = X86::COND_NE_OR_P;
+ else
+ return true;
+ // Update the MachineOperand.
+ Cond[0].setImm(BranchCode);
}
- // Otherwise, can't handle this.
- return true;
+ return false;
}
unsigned X86InstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
MachineBasicBlock::iterator I = MBB.end();
- if (I == MBB.begin()) return 0;
- --I;
- if (I->getOpcode() != X86::JMP &&
- GetCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID)
- return 0;
-
- // Remove the branch.
- I->eraseFromParent();
-
- I = MBB.end();
-
- if (I == MBB.begin()) return 1;
- --I;
- if (GetCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID)
- return 1;
+ unsigned Count = 0;
+
+ while (I != MBB.begin()) {
+ --I;
+ if (I->getOpcode() != X86::JMP &&
+ GetCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID)
+ break;
+ // Remove the branch.
+ I->eraseFromParent();
+ I = MBB.end();
+ ++Count;
+ }
- // Remove the branch.
- I->eraseFromParent();
- return 2;
+ return Count;
}
static const MachineInstrBuilder &X86InstrAddOperand(MachineInstrBuilder &MIB,
@@ -1571,23 +1584,43 @@
assert((Cond.size() == 1 || Cond.size() == 0) &&
"X86 branch conditions have one component!");
- if (FBB == 0) { // One way branch.
- if (Cond.empty()) {
- // Unconditional branch?
- BuildMI(&MBB, get(X86::JMP)).addMBB(TBB);
- } else {
- // Conditional branch.
- unsigned Opc = GetCondBranchFromCond((X86::CondCode)Cond[0].getImm());
- BuildMI(&MBB, get(Opc)).addMBB(TBB);
- }
+ if (Cond.empty()) {
+ // Unconditional branch?
+ assert(!FBB && "Unconditional branch with multiple successors!");
+ BuildMI(&MBB, get(X86::JMP)).addMBB(TBB);
return 1;
}
-
- // Two-way Conditional branch.
- unsigned Opc = GetCondBranchFromCond((X86::CondCode)Cond[0].getImm());
- BuildMI(&MBB, get(Opc)).addMBB(TBB);
- BuildMI(&MBB, get(X86::JMP)).addMBB(FBB);
- return 2;
+
+ // Conditional branch.
+ unsigned Count = 0;
+ X86::CondCode CC = (X86::CondCode)Cond[0].getImm();
+ switch (CC) {
+ case X86::COND_NP_OR_E:
+ // Synthesize NP_OR_E with two branches.
+ BuildMI(&MBB, get(X86::JNP)).addMBB(TBB);
+ ++Count;
+ BuildMI(&MBB, get(X86::JE)).addMBB(TBB);
+ ++Count;
+ break;
+ case X86::COND_NE_OR_P:
+ // Synthesize NE_OR_P with two branches.
+ BuildMI(&MBB, get(X86::JNE)).addMBB(TBB);
+ ++Count;
+ BuildMI(&MBB, get(X86::JP)).addMBB(TBB);
+ ++Count;
+ break;
+ default: {
+ unsigned Opc = GetCondBranchFromCond(CC);
+ BuildMI(&MBB, get(Opc)).addMBB(TBB);
+ ++Count;
+ }
+ }
+ if (FBB) {
+ // Two-way Conditional branch. Insert the second branch.
+ BuildMI(&MBB, get(X86::JMP)).addMBB(FBB);
+ ++Count;
+ }
+ return Count;
}
bool X86InstrInfo::copyRegToReg(MachineBasicBlock &MBB,
@@ -2372,6 +2405,8 @@
ReverseBranchCondition(SmallVectorImpl &Cond) const {
assert(Cond.size() == 1 && "Invalid X86 branch condition!");
X86::CondCode CC = static_cast(Cond[0].getImm());
+ if (CC == X86::COND_NE_OR_P || CC == X86::COND_NP_OR_E)
+ return true;
Cond[0].setImm(GetOppositeBranchCondition(CC));
return false;
}
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=57873&r1=57872&r2=57873&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Mon Oct 20 22:29:32 2008
@@ -44,6 +44,15 @@
COND_O = 13,
COND_P = 14,
COND_S = 15,
+
+ // Artificial condition codes. These are used by AnalyzeBranch
+ // to indicate a block terminated with two conditional branches to
+ // the same location. This occurs in code using FCMP_OEQ or FCMP_UNE,
+ // which can't be represented on x86 with a single condition. These
+ // are never used in MachineInstrs.
+ COND_NE_OR_P,
+ COND_NP_OR_E,
+
COND_INVALID
};
Added: llvm/trunk/test/CodeGen/X86/isint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/isint.ll?rev=57873&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/isint.ll (added)
+++ llvm/trunk/test/CodeGen/X86/isint.ll Mon Oct 20 22:29:32 2008
@@ -0,0 +1,31 @@
+; llvm-as < %s | llc -march=x86 > %t
+; not grep cmp %t
+; not grep xor %t
+; grep jne %t | count 1
+; grep jp %t | count 1
+; grep setnp %t | count 1
+; grep sete %t | count 1
+; grep and %t | count 1
+; grep cvt %t | count 4
+
+define i32 @isint_return(double %d) nounwind {
+ %i = fptosi double %d to i32
+ %e = sitofp i32 %i to double
+ %c = fcmp oeq double %d, %e
+ %z = zext i1 %c to i32
+ ret i32 %z
+}
+
+declare void @foo()
+
+define void @isint_branch(double %d) nounwind {
+ %i = fptosi double %d to i32
+ %e = sitofp i32 %i to double
+ %c = fcmp oeq double %d, %e
+ br i1 %c, label %true, label %false
+true:
+ call void @foo()
+ ret void
+false:
+ ret void
+}
From kremenek at apple.com Mon Oct 20 22:31:12 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 03:31:12 -0000
Subject: [llvm-commits] [llvm] r57874 - /llvm/tags/checker/checker-113/
Message-ID: <200810210331.m9L3VCcT015423@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 22:31:12 2008
New Revision: 57874
URL: http://llvm.org/viewvc/llvm-project?rev=57874&view=rev
Log:
Removing checker-113.
Removed:
llvm/tags/checker/checker-113/
From kremenek at apple.com Mon Oct 20 22:33:18 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 03:33:18 -0000
Subject: [llvm-commits] [llvm] r57879 - /llvm/tags/checker/checker-113/
Message-ID: <200810210333.m9L3XIUd015639@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 22:33:18 2008
New Revision: 57879
URL: http://llvm.org/viewvc/llvm-project?rev=57879&view=rev
Log:
Tagging checker-113.
Added:
llvm/tags/checker/checker-113/
- copied from r57878, llvm/trunk/
From kremenek at apple.com Mon Oct 20 22:35:19 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 03:35:19 -0000
Subject: [llvm-commits] [llvm] r57881 - /llvm/tags/checker/checker-113/
Message-ID: <200810210335.m9L3ZJbX015714@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 22:35:19 2008
New Revision: 57881
URL: http://llvm.org/viewvc/llvm-project?rev=57881&view=rev
Log:
Removing checker-113.
Removed:
llvm/tags/checker/checker-113/
From kremenek at apple.com Mon Oct 20 22:35:36 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 03:35:36 -0000
Subject: [llvm-commits] [llvm] r57883 - /llvm/tags/checker/checker-113/
Message-ID: <200810210335.m9L3ZasH015743@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Oct 20 22:35:36 2008
New Revision: 57883
URL: http://llvm.org/viewvc/llvm-project?rev=57883&view=rev
Log:
Tagging checker-113.
Added:
llvm/tags/checker/checker-113/
- copied from r57882, llvm/trunk/
From gohman at apple.com Mon Oct 20 22:38:43 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 03:38:43 -0000
Subject: [llvm-commits] [llvm] r57885 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/x86-64-disp.ll
Message-ID: <200810210338.m9L3chcj015852@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 22:38:42 2008
New Revision: 57885
URL: http://llvm.org/viewvc/llvm-project?rev=57885&view=rev
Log:
Don't create TargetGlobalAddress nodes with offsets that don't fit
in the 32-bit signed offset field of addresses. Even though this
may be intended, some linkers refuse to relocate code where the
relocated address computation overflows.
Also, fix the sign-extension of constant offsets to use the
actual pointer size, rather than the size of the GlobalAddress
node, which may be different, for example on x86-64 where MVT::i32
is used when the address is being fit into the 32-bit displacement
field.
Added:
llvm/trunk/test/CodeGen/X86/x86-64-disp.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=57885&r1=57884&r2=57885&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Oct 20 22:38:42 2008
@@ -974,7 +974,7 @@
unsigned Opc;
// Truncate (with sign-extension) the offset value to the pointer size.
- unsigned BitWidth = VT.getSizeInBits();
+ unsigned BitWidth = TLI.getPointerTy().getSizeInBits();
if (BitWidth < 64)
Offset = (Offset << (64 - BitWidth) >> (64 - BitWidth));
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57885&r1=57884&r2=57885&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Oct 20 22:38:42 2008
@@ -4400,7 +4400,7 @@
// Create the TargetGlobalAddress node, folding in the constant
// offset if it is legal.
SDValue Result;
- if (!IsPic && !ExtraLoadRequired) {
+ if (!IsPic && !ExtraLoadRequired && isInt32(Offset)) {
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), Offset);
Offset = 0;
} else
Added: llvm/trunk/test/CodeGen/X86/x86-64-disp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/x86-64-disp.ll?rev=57885&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/x86-64-disp.ll (added)
+++ llvm/trunk/test/CodeGen/X86/x86-64-disp.ll Mon Oct 20 22:38:42 2008
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | llc -march=x86-64 | grep mov | count 2
+
+; Fold an offset into an address even if it's not a 32-bit
+; signed integer.
+
+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-unknown-linux-gnu"
+ at call_used_regs = external global [53 x i8], align 32
+
+define fastcc void @foo() nounwind {
+ %t = getelementptr [53 x i8]* @call_used_regs, i64 0, i64 4294967295
+ store i8 1, i8* %t, align 1
+ ret void
+}
From gohman at apple.com Mon Oct 20 22:41:47 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 03:41:47 -0000
Subject: [llvm-commits] [llvm] r57886 - in /llvm/trunk/lib/Target/PowerPC:
PPCISelLowering.cpp PPCISelLowering.h
Message-ID: <200810210341.m9L3flAB015942@zion.cs.uiuc.edu>
Author: djg
Date: Mon Oct 20 22:41:46 2008
New Revision: 57886
URL: http://llvm.org/viewvc/llvm-project?rev=57886&view=rev
Log:
Disable constant-offset folding for PowerPC, as the PowerPC target
isn't yet prepared for it.
Modified:
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=57886&r1=57885&r2=57886&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Oct 20 22:41:46 2008
@@ -4912,3 +4912,9 @@
return DAG.getCopyFromReg(DAG.getEntryNode(), is31 ? PPC::R31 : PPC::R1,
MVT::i32);
}
+
+bool
+PPCTargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const {
+ // The PowerPC target isn't yet aware of offsets.
+ return false;
+}
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=57886&r1=57885&r2=57886&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Mon Oct 20 22:41:46 2008
@@ -329,6 +329,8 @@
SDValue Ret,
SelectionDAG &DAG) const;
+ virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
+
private:
SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const;
SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const;
From sabre at nondot.org Mon Oct 20 22:49:20 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 21 Oct 2008 03:49:20 -0000
Subject: [llvm-commits] [llvm] r57887 -
/llvm/trunk/test/CodeGen/X86/ret-i64-0.ll
Message-ID: <200810210349.m9L3nKBT016163@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Oct 20 22:49:19 2008
New Revision: 57887
URL: http://llvm.org/viewvc/llvm-project?rev=57887&view=rev
Log:
remove some unneeded eh generation
Modified:
llvm/trunk/test/CodeGen/X86/ret-i64-0.ll
Modified: llvm/trunk/test/CodeGen/X86/ret-i64-0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ret-i64-0.ll?rev=57887&r1=57886&r2=57887&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/ret-i64-0.ll (original)
+++ llvm/trunk/test/CodeGen/X86/ret-i64-0.ll Mon Oct 20 22:49:19 2008
@@ -1,5 +1,5 @@
; RUN: llvm-as < %s | llc -march=x86 | grep xor | count 2
-define i64 @foo() {
+define i64 @foo() nounwind {
ret i64 0
}
From sabre at nondot.org Mon Oct 20 22:54:49 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 21 Oct 2008 03:54:49 -0000
Subject: [llvm-commits] [llvm] r57888 - /llvm/trunk/test/CodeGen/X86/isint.ll
Message-ID: <200810210354.m9L3snDX016313@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Oct 20 22:54:49 2008
New Revision: 57888
URL: http://llvm.org/viewvc/llvm-project?rev=57888&view=rev
Log:
fix run line
Modified:
llvm/trunk/test/CodeGen/X86/isint.ll
Modified: llvm/trunk/test/CodeGen/X86/isint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/isint.ll?rev=57888&r1=57887&r2=57888&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/isint.ll (original)
+++ llvm/trunk/test/CodeGen/X86/isint.ll Mon Oct 20 22:54:49 2008
@@ -1,4 +1,4 @@
-; llvm-as < %s | llc -march=x86 > %t
+; RUN: llvm-as < %s | llc -march=x86 > %t
; not grep cmp %t
; not grep xor %t
; grep jne %t | count 1
From sabre at nondot.org Mon Oct 20 22:55:19 2008
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 21 Oct 2008 03:55:19 -0000
Subject: [llvm-commits] [llvm] r57889 - /llvm/trunk/test/CodeGen/X86/isint.ll
Message-ID: <200810210355.m9L3tJJs016335@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Oct 20 22:55:19 2008
New Revision: 57889
URL: http://llvm.org/viewvc/llvm-project?rev=57889&view=rev
Log:
really fix run line
Modified:
llvm/trunk/test/CodeGen/X86/isint.ll
Modified: llvm/trunk/test/CodeGen/X86/isint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/isint.ll?rev=57889&r1=57888&r2=57889&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/isint.ll (original)
+++ llvm/trunk/test/CodeGen/X86/isint.ll Mon Oct 20 22:55:19 2008
@@ -1,12 +1,12 @@
; RUN: llvm-as < %s | llc -march=x86 > %t
-; not grep cmp %t
-; not grep xor %t
-; grep jne %t | count 1
-; grep jp %t | count 1
-; grep setnp %t | count 1
-; grep sete %t | count 1
-; grep and %t | count 1
-; grep cvt %t | count 4
+; RUN: not grep cmp %t
+; RUN: not grep xor %t
+; RUN: grep jne %t | count 1
+; RUN: grep jp %t | count 1
+; RUN: grep setnp %t | count 1
+; RUN: grep sete %t | count 1
+; RUN: grep and %t | count 1
+; RUN: grep cvt %t | count 4
define i32 @isint_return(double %d) nounwind {
%i = fptosi double %d to i32
From evan.cheng at apple.com Tue Oct 21 00:42:46 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 20 Oct 2008 22:42:46 -0700
Subject: [llvm-commits] [llvm] r57846 - in /llvm/trunk:
include/llvm/System/Memory.h lib/System/Unix/Memory.inc
lib/System/Win32/Memory.inc lib/Target/ARM/ARMJITInfo.cpp
In-Reply-To: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
References: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
Message-ID: <5E3E66A9-D54A-43CA-8CB4-E9BC1A42FCCC@apple.com>
On Oct 20, 2008, at 2:39 PM, Jim Grosbach wrote:
Thanks Jim. Good job getting this working. It's a big step.
>
> + // Save caller saved registers since they may contain stuff
> + // for the real target function right now. We have to act as if
> this
> + // whole compilation callback doesn't exist as far as the
> caller is
> + // concerned, so we can't just preserve the callee saved regs.
> + "push {r0, r1, r2, r3, lr}\n"
Is this code Mac OS X specific? Is "push" accepted by all the
assemblers?
>
> + // The LR contains the address of the stub function on entry.
> + // pass it as the argument to the C part of the callback
> + "mov r0, lr\n"
> + "sub sp, sp, #4\n"
> + // Call the C portion of the callback
> + "bl " ASMPREFIX "ARMCompilationCallbackC\n"
> + "add sp, sp, #4\n"
> + // Restoring the LR to the return address of the function that
> invoked
> + // the stub and de-allocating the stack space for it requires
> us to
> + // swap the two saved LR values on the stack, as they're
> backwards
> + // for what we need since the pop instruction has a pre-
> determined
> + // order for the registers.
> + // +--------+
> + // 0 | LR | Original return address
> + // +--------+
> + // 1 | LR | Stub address (start of stub)
> + // 2-5 | R3..R0 | Saved registers (we need to preserve all regs)
> + // +--------+
> + //
> + // We need to exchange the values in slots 0 and 1 so we can
> + // return to the address in slot 1 with the address in
> slot 0
> + // restored to the LR.
> + "ldr r0, [sp,#20]\n"
> + "ldr r1, [sp,#16]\n"
> + "str r1, [sp,#20]\n"
> + "str r0, [sp,#16]\n"
> + // Return to the (newly modified) stub to invoke the real
> function.
> + // The above twiddling of the saved return addresses allows us to
> + // deallocate everything, including the LR the stub saved, all
> in one
> + // pop instruction.
> + "pop {r0, r1, r2, r3, lr, pc}\n"
> );
> #else // Not an ARM host
> void ARMCompilationCallback() {
> @@ -85,31 +97,37 @@
> #endif
> }
>
> -/// ARMCompilationCallbackC - This is the target-specific function
> invoked by the
> -/// function stub when we did not know the real target of a call.
> This function
> -/// must locate the start of the stub or call site and pass it into
> the JIT
> -/// compiler function.
> -extern "C" void ARMCompilationCallbackC(intptr_t *StackPtr,
> intptr_t RetAddr) {
> - intptr_t *RetAddrLoc = &StackPtr[-1];
> -
> - assert(*RetAddrLoc == RetAddr &&
> - "Could not find return address on the stack!");
> -#if 0
> - DOUT << "In callback! Addr=" << (void*)RetAddr
> - << " FP=" << (void*)StackPtr
> - << ": Resolving call to function: "
> - << TheVM->getFunctionReferencedName((void*)RetAddr) << "\n";
> -#endif
> - intptr_t Addr = RetAddr - 4;
> -
> - intptr_t NewVal = (intptr_t)JITCompilerFunction((void*)Addr);
> +/// ARMCompilationCallbackC - This is the target-specific function
> invoked
> +/// by the function stub when we did not know the real target of a
> call.
> +/// This function must locate the start of the stub or call site
> and pass
> +/// it into the JIT compiler function.
> +extern "C" void ARMCompilationCallbackC(intptr_t StubAddr) {
> + // Get the address of the compiled code for this function.
> + intptr_t NewVal = (intptr_t)JITCompilerFunction((void*)StubAddr);
>
> // Rewrite the call target... so that we don't end up here every
> time we
> - // execute the call.
> - *(intptr_t *)Addr = NewVal;
> -
> - // Change the return address to reexecute the branch and link
> instruction...
> - *RetAddrLoc -= 12;
> + // execute the call. We're replacing the first two instructions
> of the
> + // stub with:
> + // ldr pc, [pc,#-4]
> + //
> +#if defined(__APPLE__)
> + bool ok = sys::Memory::setRangeWritable ((void*)StubAddr, 8);
This works. But it's probably somewhat inefficient. Do you have any
ideas for improving the efficiency? I have some ideas, we should talk
about it.
Thanks,
Evan
>
> + if (!ok)
> + {
> + cerr << "ERROR: Unable to mark stub writable\n";
> + abort();
> + }
> +#endif
> + *(intptr_t *)StubAddr = 0xe51ff004;
> + *(intptr_t *)(StubAddr+4) = NewVal;
> +#if defined(__APPLE__)
> + ok = sys::Memory::setRangeExecutable ((void*)StubAddr, 8);
> + if (!ok)
> + {
> + cerr << "ERROR: Unable to mark stub executable\n";
> + abort();
> + }
> +#endif
> }
>
> TargetJITInfo::LazyResolverFn
> @@ -127,17 +145,27 @@
> // branch to the corresponding function addr
> // the stub is 8-byte size and 4-aligned
> MCE.startFunctionStub(F, 8, 4);
> - MCE.emitWordLE(0xE51FF004); // LDR PC, [PC,#-4]
> + MCE.emitWordLE(0xe51ff004); // LDR PC, [PC,#-4]
> MCE.emitWordLE(addr); // addr of function
> } else {
> - // branch and link to the corresponding function addr
> - // the stub is 20-byte size and 4-aligned
> - MCE.startFunctionStub(F, 20, 4);
> - MCE.emitWordLE(0xE92D4800); // STMFD SP!, [R11, LR]
> - MCE.emitWordLE(0xE28FE004); // ADD LR, PC, #4
> - MCE.emitWordLE(0xE51FF004); // LDR PC, [PC,#-4]
> - MCE.emitWordLE(addr); // addr of function
> - MCE.emitWordLE(0xE8BD8800); // LDMFD SP!, [R11, PC]
> + // The compilation callback will overwrite the first two words
> of this
> + // stub with indirect branch instructions targeting the
> compiled code.
> + // This stub sets the return address to restart the stub, so that
> + // the new branch will be invoked when we come back.
> + //
> + // branch and link to the compilation callback.
> + // the stub is 16-byte size and 4-byte aligned.
> + MCE.startFunctionStub(F, 16, 4);
> + // Save LR so the callback can determine which stub called it.
> + // The compilation callback is responsible for popping this prior
> + // to returning.
> + MCE.emitWordLE(0xe92d4000); // PUSH {lr}
> + // Set the return address to go back to the start of this stub
> + MCE.emitWordLE(0xe24fe00c); // SUB LR, PC, #12
> + // Invoke the compilation callback
> + MCE.emitWordLE(0xe51ff004); // LDR PC, [PC,#-4]
> + // The address of the compilation callback
> + MCE.emitWordLE((intptr_t)ARMCompilationCallback);
> }
>
> return MCE.finishFunctionStub(F);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From kremenek at apple.com Tue Oct 21 00:59:33 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 05:59:33 -0000
Subject: [llvm-commits] [llvm] r57894 -
/llvm/trunk/include/llvm/ADT/ImmutableList.h
Message-ID: <200810210559.m9L5xXvk020140@zion.cs.uiuc.edu>
Author: kremenek
Date: Tue Oct 21 00:59:33 2008
New Revision: 57894
URL: http://llvm.org/viewvc/llvm-project?rev=57894&view=rev
Log:
constify some methods and variables in ImmutableList.
Modified:
llvm/trunk/include/llvm/ADT/ImmutableList.h
Modified: llvm/trunk/include/llvm/ADT/ImmutableList.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableList.h?rev=57894&r1=57893&r2=57894&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableList.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableList.h Tue Oct 21 00:59:33 2008
@@ -26,9 +26,9 @@
template
class ImmutableListImpl : public FoldingSetNode {
T Head;
- ImmutableListImpl* Tail;
+ const ImmutableListImpl* Tail;
- ImmutableListImpl(const T& head, ImmutableListImpl* tail = 0)
+ ImmutableListImpl(const T& head, const ImmutableListImpl* tail = 0)
: Head(head), Tail(tail) {}
friend class ImmutableListFactory;
@@ -39,10 +39,10 @@
public:
const T& getHead() const { return Head; }
- ImmutableListImpl* getTail() const { return Tail; }
+ const ImmutableListImpl* getTail() const { return Tail; }
static inline void Profile(FoldingSetNodeID& ID, const T& H,
- ImmutableListImpl* L){
+ const ImmutableListImpl* L){
ID.AddPointer(L);
ID.Add(H);
}
@@ -67,20 +67,20 @@
typedef ImmutableListFactory Factory;
private:
- ImmutableListImpl* X;
+ const ImmutableListImpl* X;
public:
// This constructor should normally only be called by ImmutableListFactory.
// There may be cases, however, when one needs to extract the internal pointer
// and reconstruct a list object from that pointer.
- ImmutableList(ImmutableListImpl* x = 0) : X(x) {}
+ ImmutableList(const ImmutableListImpl* x = 0) : X(x) {}
- ImmutableListImpl* getInternalPointer() const {
+ const ImmutableListImpl* getInternalPointer() const {
return X;
}
class iterator {
- ImmutableListImpl* L;
+ const ImmutableListImpl* L;
public:
iterator() : L(0) {}
iterator(ImmutableList l) : L(l.getInternalPointer()) {}
@@ -157,7 +157,7 @@
FoldingSetNodeID ID;
void* InsertPos;
- ListTy* TailImpl = Tail.getInternalPointer();
+ const ListTy* TailImpl = Tail.getInternalPointer();
ListTy::Profile(ID, Head, TailImpl);
ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);
From baldrick at free.fr Tue Oct 21 02:41:52 2008
From: baldrick at free.fr (Duncan Sands)
Date: Tue, 21 Oct 2008 09:41:52 +0200
Subject: [llvm-commits] [llvm] r57846 - in /llvm/trunk:
include/llvm/System/Memory.h lib/System/Unix/Memory.inc
lib/System/Win32/Memory.inc lib/Target/ARM/ARMJITInfo.cpp
In-Reply-To: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
References: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
Message-ID: <200810210941.52782.baldrick@free.fr>
> Added back in range-based memory permission functions for the updating of
> the stub on Darwin.
Is this really Darwin specific?
Also, there doesn't seem to be any need for the #if defined(__APPLE__)
in these kinds of places:
+#if defined(__APPLE__)
+ ok = sys::Memory::setRangeExecutable ((void*)StubAddr, 8);
+ if (!ok)
+ {
+ cerr << "ERROR: Unable to mark stub executable\n";
+ abort();
+ }
+#endif
After all, the functions complete successfully on non-__APPLE__
platforms.
Ciao,
Duncan.
From nunoplopes at sapo.pt Tue Oct 21 06:42:23 2008
From: nunoplopes at sapo.pt (Nuno Lopes)
Date: Tue, 21 Oct 2008 11:42:23 -0000
Subject: [llvm-commits] [llvm] r57900 - in /llvm/trunk:
include/llvm/CodeGen/MachineCodeEmitter.h
include/llvm/ExecutionEngine/JITMemoryManager.h
lib/ExecutionEngine/JIT/JITEmitter.cpp
lib/ExecutionEngine/JIT/JITMemoryManager.cpp
Message-ID: <200810211142.m9LBgO0s008638@zion.cs.uiuc.edu>
Author: nlopes
Date: Tue Oct 21 06:42:16 2008
New Revision: 57900
URL: http://llvm.org/viewvc/llvm-project?rev=57900&view=rev
Log:
fix a tricky bug in the JIT global variable emitter, that was triggered when JITing a variable independently of a function. This lead to sharing memory memory between functions and GVs thus changing the value of a GV could change the code in execution. more details on the ML.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h
llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h
llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h?rev=57900&r1=57899&r2=57900&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h Tue Oct 21 06:42:16 2008
@@ -207,7 +207,7 @@
/// allocateSpace - Allocate a block of space in the current output buffer,
/// returning null (and setting conditions to indicate buffer overflow) on
/// failure. Alignment is the alignment in bytes of the buffer desired.
- void *allocateSpace(intptr_t Size, unsigned Alignment) {
+ virtual void *allocateSpace(intptr_t Size, unsigned Alignment) {
emitAlignment(Alignment);
void *Result = CurBufferPtr;
Modified: llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h?rev=57900&r1=57899&r2=57900&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h Tue Oct 21 06:42:16 2008
@@ -101,6 +101,9 @@
/// and remember where it is in case the client wants to deallocate it.
virtual void endFunctionBody(const Function *F, unsigned char *FunctionStart,
unsigned char *FunctionEnd) = 0;
+
+ /// allocateSpace - Allocate a memory block of the given size.
+ virtual unsigned char *allocateSpace(intptr_t Size, unsigned Alignment) = 0;
/// deallocateMemForFunction - Free JIT memory for the specified function.
/// This is never called when the JIT is currently emitting a function.
Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=57900&r1=57899&r2=57900&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Tue Oct 21 06:42:16 2008
@@ -518,6 +518,10 @@
unsigned Alignment = 1);
virtual void* finishFunctionStub(const GlobalValue *F);
+ /// allocateSpace - Reserves space in the current block if any, or
+ /// allocate a new one of the given size.
+ virtual void *allocateSpace(intptr_t Size, unsigned Alignment);
+
virtual void addRelocation(const MachineRelocation &MR) {
Relocations.push_back(MR);
}
@@ -915,11 +919,6 @@
Relocations.size(), MemMgr->getGOTBase());
}
- unsigned char *FnEnd = CurBufferPtr;
-
- MemMgr->endFunctionBody(F.getFunction(), BufferBegin, FnEnd);
- NumBytes += FnEnd-FnStart;
-
// Update the GOT entry for F to point to the new code.
if (MemMgr->isManagingGOT()) {
unsigned idx = Resolver.getGOTIndexForAddr((void*)BufferBegin);
@@ -930,6 +929,12 @@
}
}
+ unsigned char *FnEnd = CurBufferPtr;
+
+ MemMgr->endFunctionBody(F.getFunction(), BufferBegin, FnEnd);
+ BufferBegin = CurBufferPtr = 0;
+ NumBytes += FnEnd-FnStart;
+
// Invalidate the icache if necessary.
sys::Memory::InvalidateInstructionCache(FnStart, FnEnd-FnStart);
@@ -993,6 +998,18 @@
return false;
}
+void* JITEmitter::allocateSpace(intptr_t Size, unsigned Alignment) {
+ if (BufferBegin)
+ return MachineCodeEmitter::allocateSpace(Size, Alignment);
+
+ // create a new memory block if there is no active one.
+ // care must be taken so that BufferBegin is invalidated when a
+ // block is trimmed
+ BufferBegin = CurBufferPtr = MemMgr->allocateSpace(Size, Alignment);
+ BufferEnd = BufferBegin+Size;
+ return CurBufferPtr;
+}
+
void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
const std::vector &Constants = MCP->getConstants();
if (Constants.empty()) return;
Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp?rev=57900&r1=57899&r2=57900&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp Tue Oct 21 06:42:16 2008
@@ -298,7 +298,24 @@
// Release the memory at the end of this block that isn't needed.
FreeMemoryList =CurBlock->TrimAllocationToSize(FreeMemoryList, BlockSize);
}
-
+
+ /// allocateSpace - Allocate a memory block of the given size.
+ unsigned char *allocateSpace(intptr_t Size, unsigned Alignment) {
+ CurBlock = FreeMemoryList;
+ FreeMemoryList = FreeMemoryList->AllocateBlock();
+
+ unsigned char *result = (unsigned char *)CurBlock+1;
+
+ if (Alignment == 0) Alignment = 1;
+ result = (unsigned char*)(((intptr_t)result+Alignment-1) &
+ ~(intptr_t)(Alignment-1));
+
+ uintptr_t BlockSize = result + Size - (unsigned char *)CurBlock;
+ FreeMemoryList =CurBlock->TrimAllocationToSize(FreeMemoryList, BlockSize);
+
+ return result;
+ }
+
/// startExceptionTable - Use startFunctionBody to allocate memory for the
/// function's exception table.
unsigned char* startExceptionTable(const Function* F,
From criswell at uiuc.edu Tue Oct 21 09:42:01 2008
From: criswell at uiuc.edu (John Criswell)
Date: Tue, 21 Oct 2008 14:42:01 -0000
Subject: [llvm-commits] [poolalloc] r57905 -
/poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h
Message-ID: <200810211442.m9LEg17g015751@zion.cs.uiuc.edu>
Author: criswell
Date: Tue Oct 21 09:42:00 2008
New Revision: 57905
URL: http://llvm.org/viewvc/llvm-project?rev=57905&view=rev
Log:
Fixed compilation error in SAFECode runtime.
It seems that RangeSplayTree will place the type T in a range_tree_node<> on
its own, so RangeSplayMap does not need to do it explicitly.
Modified:
poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h
Modified: poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h?rev=57905&r1=57904&r2=57905&view=diff
==============================================================================
--- poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h (original)
+++ poolalloc/trunk/include/poolalloc_runtime/Support/SplayTree.h Tue Oct 21 09:42:00 2008
@@ -232,7 +232,7 @@
template >
class RangeSplayMap {
- RangeSplayTree, Allocator> Tree;
+ RangeSplayTree Tree;
public:
explicit RangeSplayMap(const Allocator& A= Allocator() )
From alenhar2 at cs.uiuc.edu Tue Oct 21 09:48:21 2008
From: alenhar2 at cs.uiuc.edu (Andrew Lenharth)
Date: Tue, 21 Oct 2008 14:48:21 -0000
Subject: [llvm-commits] [poolalloc] r57906 -
/poolalloc/trunk/include/poolalloc_runtime/test.ex
Message-ID: <200810211448.m9LEmLKC015977@zion.cs.uiuc.edu>
Author: alenhar2
Date: Tue Oct 21 09:48:20 2008
New Revision: 57906
URL: http://llvm.org/viewvc/llvm-project?rev=57906&view=rev
Log:
fix this for the map too, not just the set
Modified:
poolalloc/trunk/include/poolalloc_runtime/test.ex
Modified: poolalloc/trunk/include/poolalloc_runtime/test.ex
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc_runtime/test.ex?rev=57906&r1=57905&r2=57906&view=diff
==============================================================================
--- poolalloc/trunk/include/poolalloc_runtime/test.ex (original)
+++ poolalloc/trunk/include/poolalloc_runtime/test.ex Tue Oct 21 09:48:20 2008
@@ -6,7 +6,7 @@
PoolAllocator, MallocSlabManager<> > > c(8, 8);
-RangeSplayMap x;
+RangeSplayMap ma;
int main() {
void* x = a.alloc();
@@ -24,6 +24,8 @@
c.dealloc(x);
c.dealloc(y);
+ unsigned asdf = 2;
+ ma.insert((void*)0, (void*)1, asdf);
return 0;
}
From grosbach at apple.com Tue Oct 21 10:22:44 2008
From: grosbach at apple.com (Jim Grosbach)
Date: Tue, 21 Oct 2008 08:22:44 -0700
Subject: [llvm-commits] [llvm] r57846 - in /llvm/trunk:
include/llvm/System/Memory.h lib/System/Unix/Memory.inc
lib/System/Win32/Memory.inc lib/Target/ARM/ARMJITInfo.cpp
In-Reply-To: <5E3E66A9-D54A-43CA-8CB4-E9BC1A42FCCC@apple.com>
References: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
<5E3E66A9-D54A-43CA-8CB4-E9BC1A42FCCC@apple.com>
Message-ID: <8EB5CE96-3003-4DAB-A22B-2E7039765B43@apple.com>
On Oct 20, 2008, at 10:42 PM, Evan Cheng wrote:
>
> On Oct 20, 2008, at 2:39 PM, Jim Grosbach wrote:
>
> Thanks Jim. Good job getting this working. It's a big step.
>
>>
>> + // Save caller saved registers since they may contain stuff
>> + // for the real target function right now. We have to act as if
>> this
>> + // whole compilation callback doesn't exist as far as the
>> caller is
>> + // concerned, so we can't just preserve the callee saved regs.
>> + "push {r0, r1, r2, r3, lr}\n"
>
> Is this code Mac OS X specific? Is "push" accepted by all the
> assemblers?
>
It's standard, but relatively recent (sometime in the last few years,
depending on toolchain) for the mnemonic to be recognized in ARM
state. How concerned are we about older assemblers?
>
> This works. But it's probably somewhat inefficient. Do you have any
> ideas for improving the efficiency? I have some ideas, we should talk
> about it.
A bit. Not a huge amount, though. At this point, I was mainly just
focused on correctness. That said, there's a few things I've been
tossing around in the back of my head. I'd love to hear any ideas you
have as well. There's a strange constant pool thing I was hoping to
find time to bounce off of you today, anyway, so we can kill two birds
with one conversation.
I haven't been very concerned about making the compilation hooks all
that efficient, really. Any time spent there is going to be so swamped
by the compilation (or probably even just the function address
lookup), that it didn't seem worth it, at least in a first pass. Seem
reasonable to you?
Where I want things to be relatively quick is in subsequent
invocations, which is why I re-write the stub to be just an indirect
branch. The tweak I'd like to make there is to check the range of the
branch and use a direct branch instruction instead if possible. We
know both addresses, after all, so there's no unknowns we have to be
pessimistic about. Similarly, I'm thinking about putting in some logic
to go all the way back to the original call point and adjusting the
call instruction there, if it's a direct branch.
-Jim
From grosbach at apple.com Tue Oct 21 10:26:38 2008
From: grosbach at apple.com (Jim Grosbach)
Date: Tue, 21 Oct 2008 08:26:38 -0700
Subject: [llvm-commits] [llvm] r57846 - in /llvm/trunk:
include/llvm/System/Memory.h lib/System/Unix/Memory.inc
lib/System/Win32/Memory.inc lib/Target/ARM/ARMJITInfo.cpp
In-Reply-To: <200810210941.52782.baldrick@free.fr>
References: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
<200810210941.52782.baldrick@free.fr>
Message-ID:
On Oct 21, 2008, at 12:41 AM, Duncan Sands wrote:
>> Added back in range-based memory permission functions for the
>> updating of
>> the stub on Darwin.
>
> Is this really Darwin specific?
> Also, there doesn't seem to be any need for the #if defined(__APPLE__)
> in these kinds of places:
>
True. At the moment, it's Darwin specific, yes. Normally, the memory
is allocated read-write-execute and none of the twiddling about is
necessary at all.
The ifdef here isn't strictly necessary, regardless, as you point out.
Not something I feel strongly about at all. Prefer having it always
execute?
> +#if defined(__APPLE__)
> + ok = sys::Memory::setRangeExecutable ((void*)StubAddr, 8);
> + if (!ok)
> + {
> + cerr << "ERROR: Unable to mark stub executable\n";
> + abort();
> + }
> +#endif
>
> After all, the functions complete successfully on non-__APPLE__
> platforms.
>
> Ciao,
>
> Duncan.
From evan.cheng at apple.com Tue Oct 21 11:24:30 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 21 Oct 2008 09:24:30 -0700
Subject: [llvm-commits] [llvm] r57846 - in /llvm/trunk:
include/llvm/System/Memory.h lib/System/Unix/Memory.inc
lib/System/Win32/Memory.inc lib/Target/ARM/ARMJITInfo.cpp
In-Reply-To: <8EB5CE96-3003-4DAB-A22B-2E7039765B43@apple.com>
References: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
<5E3E66A9-D54A-43CA-8CB4-E9BC1A42FCCC@apple.com>
<8EB5CE96-3003-4DAB-A22B-2E7039765B43@apple.com>
Message-ID: <1B266834-90E6-4CD4-B072-0F4A40CBB6CD@apple.com>
On Oct 21, 2008, at 8:22 AM, Jim Grosbach wrote:
>
> On Oct 20, 2008, at 10:42 PM, Evan Cheng wrote:
>
>>
>> On Oct 20, 2008, at 2:39 PM, Jim Grosbach wrote:
>>
>> Thanks Jim. Good job getting this working. It's a big step.
>>
>>>
>>> + // Save caller saved registers since they may contain stuff
>>> + // for the real target function right now. We have to act as if
>>> this
>>> + // whole compilation callback doesn't exist as far as the
>>> caller is
>>> + // concerned, so we can't just preserve the callee saved regs.
>>> + "push {r0, r1, r2, r3, lr}\n"
>>
>> Is this code Mac OS X specific? Is "push" accepted by all the
>> assemblers?
>>
>
> It's standard, but relatively recent (sometime in the last few years,
> depending on toolchain) for the mnemonic to be recognized in ARM
> state. How concerned are we about older assemblers?
I think we should use mnemonic that are as widely accepted as
possible. I believe the original author did test the callback routine
on his target. We should be careful not to break it.
>
>>
>> This works. But it's probably somewhat inefficient. Do you have any
>> ideas for improving the efficiency? I have some ideas, we should talk
>> about it.
>
>
> A bit. Not a huge amount, though. At this point, I was mainly just
> focused on correctness. That said, there's a few things I've been
> tossing around in the back of my head. I'd love to hear any ideas you
> have as well. There's a strange constant pool thing I was hoping to
> find time to bounce off of you today, anyway, so we can kill two birds
> with one conversation.
Sure.
>
>
> I haven't been very concerned about making the compilation hooks all
> that efficient, really. Any time spent there is going to be so swamped
> by the compilation (or probably even just the function address
> lookup), that it didn't seem worth it, at least in a first pass. Seem
> reasonable to you?
Right. I am not too concerned with getting it perfect at this point.
It's definitely not a critical task. That said, this is something we
should plan on cleaning up later. I am actually more concerned with
"cleanliness" than anything else. Having the stub making a system
call to change memory privilege just seem icky to me. My basic idea is
to allocate a chunk RX memory for code (like what's being done now)
and a chunk of RW memory for data and anything that's going to be
changed during execution (i.e. putting addresses of lazily compiled
functions there). This will require a larger scale rewrite so it's not
something that should be planned for the near future.
>
>
> Where I want things to be relatively quick is in subsequent
> invocations, which is why I re-write the stub to be just an indirect
> branch. The tweak I'd like to make there is to check the range of the
> branch and use a direct branch instruction instead if possible. We
> know both addresses, after all, so there's no unknowns we have to be
> pessimistic about. Similarly, I'm thinking about putting in some logic
> to go all the way back to the original call point and adjusting the
> call instruction there, if it's a direct branch.
Sounds good.
Evan
>
>
> -Jim
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From grosbach at apple.com Tue Oct 21 11:36:58 2008
From: grosbach at apple.com (Jim Grosbach)
Date: Tue, 21 Oct 2008 09:36:58 -0700
Subject: [llvm-commits] [llvm] r57846 - in /llvm/trunk:
include/llvm/System/Memory.h lib/System/Unix/Memory.inc
lib/System/Win32/Memory.inc lib/Target/ARM/ARMJITInfo.cpp
In-Reply-To: <1B266834-90E6-4CD4-B072-0F4A40CBB6CD@apple.com>
References: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
<5E3E66A9-D54A-43CA-8CB4-E9BC1A42FCCC@apple.com>
<8EB5CE96-3003-4DAB-A22B-2E7039765B43@apple.com>
<1B266834-90E6-4CD4-B072-0F4A40CBB6CD@apple.com>
Message-ID: <9063F4D1-6023-455F-9970-A4CBDE0CDFF8@apple.com>
On Oct 21, 2008, at 9:24 AM, Evan Cheng wrote:
>>> Is this code Mac OS X specific? Is "push" accepted by all the
>>> assemblers?
>>>
>>
>> It's standard, but relatively recent (sometime in the last few years,
>> depending on toolchain) for the mnemonic to be recognized in ARM
>> state. How concerned are we about older assemblers?
>
> I think we should use mnemonic that are as widely accepted as
> possible. I believe the original author did test the callback routine
> on his target. We should be careful not to break it.
>
Sounds good. I'll tweak it this morning.
> Having the stub making a system
> call to change memory privilege just seem icky to me. My basic idea is
> to allocate a chunk RX memory for code (like what's being done now)
> and a chunk of RW memory for data and anything that's going to be
> changed during execution (i.e. putting addresses of lazily compiled
> functions there). This will require a larger scale rewrite so it's not
> something that should be planned for the near future.
>
No disagreement here. I played with that for a while, but it gets
pretty hairy, especially with lazy compilation. I backed off and chose
to get it working first, even with the ugly syscalls. Not that in re-
writing the stub we're writing not just an address, but an
instruction, for example. The meta-data for the memory blocks are
another tricky spot.
Doing something about this stuff would require a new, or at least
significantly re-worked, JIT Memory Manager, possibly one that's
target specific. As you say, a pretty significant refactoring and
probably outside the scope of what we want to look at right now.
From evan.cheng at apple.com Tue Oct 21 11:52:57 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 21 Oct 2008 09:52:57 -0700
Subject: [llvm-commits] [llvm] r57846 - in /llvm/trunk:
include/llvm/System/Memory.h lib/System/Unix/Memory.inc
lib/System/Win32/Memory.inc lib/Target/ARM/ARMJITInfo.cpp
In-Reply-To: <9063F4D1-6023-455F-9970-A4CBDE0CDFF8@apple.com>
References: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
<5E3E66A9-D54A-43CA-8CB4-E9BC1A42FCCC@apple.com>
<8EB5CE96-3003-4DAB-A22B-2E7039765B43@apple.com>
<1B266834-90E6-4CD4-B072-0F4A40CBB6CD@apple.com>
<9063F4D1-6023-455F-9970-A4CBDE0CDFF8@apple.com>
Message-ID: <040D546A-26BC-419B-8AEA-413A53E367B5@apple.com>
On Oct 21, 2008, at 9:36 AM, Jim Grosbach wrote:
>
> On Oct 21, 2008, at 9:24 AM, Evan Cheng wrote:
>>>> Is this code Mac OS X specific? Is "push" accepted by all the
>>>> assemblers?
>>>>
>>>
>>> It's standard, but relatively recent (sometime in the last few
>>> years,
>>> depending on toolchain) for the mnemonic to be recognized in ARM
>>> state. How concerned are we about older assemblers?
>>
>> I think we should use mnemonic that are as widely accepted as
>> possible. I believe the original author did test the callback routine
>> on his target. We should be careful not to break it.
>>
>
> Sounds good. I'll tweak it this morning.
Thanks.
>
>
>> Having the stub making a system
>> call to change memory privilege just seem icky to me. My basic idea
>> is
>> to allocate a chunk RX memory for code (like what's being done now)
>> and a chunk of RW memory for data and anything that's going to be
>> changed during execution (i.e. putting addresses of lazily compiled
>> functions there). This will require a larger scale rewrite so it's
>> not
>> something that should be planned for the near future.
>>
>
> No disagreement here. I played with that for a while, but it gets
> pretty hairy, especially with lazy compilation. I backed off and chose
> to get it working first, even with the ugly syscalls. Not that in re-
> writing the stub we're writing not just an address, but an
> instruction, for example. The meta-data for the memory blocks are
> another tricky spot.
This can be simplified if codegen always generate indirect calls and
the addresses are always loaded from the RW region. We can populate
them with the address of the callback routine first and update them as
lazy compilation happens.
>
>
> Doing something about this stuff would require a new, or at least
> significantly re-worked, JIT Memory Manager, possibly one that's
> target specific. As you say, a pretty significant refactoring and
> probably outside the scope of what we want to look at right now.
Yep. Not something we want to deal with right now.
Evan
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From grosbach at apple.com Tue Oct 21 11:54:19 2008
From: grosbach at apple.com (Jim Grosbach)
Date: Tue, 21 Oct 2008 16:54:19 -0000
Subject: [llvm-commits] [llvm] r57911 -
/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp
Message-ID: <200810211654.m9LGsJJO020453@zion.cs.uiuc.edu>
Author: grosbach
Date: Tue Oct 21 11:54:12 2008
New Revision: 57911
URL: http://llvm.org/viewvc/llvm-project?rev=57911&view=rev
Log:
use pre-UAL mnemonics for push/pop for compilaton callback function
Modified:
llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?rev=57911&r1=57910&r2=57911&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp Tue Oct 21 11:54:12 2008
@@ -56,7 +56,7 @@
// for the real target function right now. We have to act as if this
// whole compilation callback doesn't exist as far as the caller is
// concerned, so we can't just preserve the callee saved regs.
- "push {r0, r1, r2, r3, lr}\n"
+ "stmdb sp!, {r0, r1, r2, r3, lr}\n"
// The LR contains the address of the stub function on entry.
// pass it as the argument to the C part of the callback
"mov r0, lr\n"
@@ -87,7 +87,7 @@
// The above twiddling of the saved return addresses allows us to
// deallocate everything, including the LR the stub saved, all in one
// pop instruction.
- "pop {r0, r1, r2, r3, lr, pc}\n"
+ "ldmia sp!, {r0, r1, r2, r3, lr, pc}\n"
);
#else // Not an ARM host
void ARMCompilationCallback() {
From baldrick at free.fr Tue Oct 21 12:10:54 2008
From: baldrick at free.fr (Duncan Sands)
Date: Tue, 21 Oct 2008 19:10:54 +0200
Subject: [llvm-commits] [llvm] r57846 - in /llvm/trunk:
include/llvm/System/Memory.h lib/System/Unix/Memory.inc
lib/System/Win32/Memory.inc lib/Target/ARM/ARMJITInfo.cpp
In-Reply-To:
References: <200810202139.m9KLdOJK004141@zion.cs.uiuc.edu>
<200810210941.52782.baldrick@free.fr>
Message-ID: <200810211910.54989.baldrick@free.fr>
Hi Jim,
> The ifdef here isn't strictly necessary, regardless, as you point out.
> Not something I feel strongly about at all. Prefer having it always
> execute?
personally I'd prefer to have it always execute.
Ciao,
Duncan.
> > +#if defined(__APPLE__)
> > + ok = sys::Memory::setRangeExecutable ((void*)StubAddr, 8);
> > + if (!ok)
> > + {
> > + cerr << "ERROR: Unable to mark stub executable\n";
> > + abort();
> > + }
> > +#endif
> >
> > After all, the functions complete successfully on non-__APPLE__
> > platforms.
> >
> > Ciao,
> >
> > Duncan.
>
>
From edwintorok at gmail.com Tue Oct 21 12:21:33 2008
From: edwintorok at gmail.com (Torok Edwin)
Date: Tue, 21 Oct 2008 17:21:33 -0000
Subject: [llvm-commits] [llvm] r57912 - in /llvm/trunk: Makefile.config.in
autoconf/configure.ac test/Makefile test/lib/llvm.exp
Message-ID: <200810211721.m9LHLXSW021465@zion.cs.uiuc.edu>
Author: edwin
Date: Tue Oct 21 12:21:32 2008
New Revision: 57912
URL: http://llvm.org/viewvc/llvm-project?rev=57912&view=rev
Log:
Fix make check on Solaris 10/x86: the default grep is not GNU grep, same for as.
Modified:
llvm/trunk/Makefile.config.in
llvm/trunk/autoconf/configure.ac
llvm/trunk/test/Makefile
llvm/trunk/test/lib/llvm.exp
Modified: llvm/trunk/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=57912&r1=57911&r2=57912&view=diff
==============================================================================
--- llvm/trunk/Makefile.config.in (original)
+++ llvm/trunk/Makefile.config.in Tue Oct 21 12:21:32 2008
@@ -160,6 +160,7 @@
OCAMLOPT := @OCAMLOPT@
OCAMLDEP := @OCAMLDEP@
OCAMLDOC := @OCAMLDOC@
+GAS := @GAS@
POD2HTML := @POD2HTML@
POD2MAN := @POD2MAN@
RUNTEST := @RUNTEST@
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=57912&r1=57911&r2=57912&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Tue Oct 21 12:21:32 2008
@@ -614,6 +614,7 @@
AC_PATH_PROGS(OCAMLOPT, [ocamlopt.opt ocamlopt])
AC_PATH_PROGS(OCAMLDEP, [ocamldep.opt ocamldep])
AC_PATH_PROGS(OCAMLDOC, [ocamldoc.opt ocamldoc])
+AC_PATH_PROGS(GAS, [gas as])
dnl Determine if the linker supports the -R option.
AC_LINK_USE_R
Modified: llvm/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=57912&r1=57911&r2=57912&view=diff
==============================================================================
--- llvm/trunk/test/Makefile (original)
+++ llvm/trunk/test/Makefile Tue Oct 21 12:21:32 2008
@@ -110,6 +110,8 @@
@echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp
@echo 'set ocamlc "$(OCAMLC) -cc $(CXX) -I $(LibDir)/ocaml"' >> site.tmp
@echo 'set valgrind "$(VALGRIND)"' >> site.tmp
+ @echo 'set grep "$(GREP)"' >>site.tmp
+ @echo 'set gas "$(GAS)"' >>site.tmp
@echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
@test ! -f site.exp || \
sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
Modified: llvm/trunk/test/lib/llvm.exp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lib/llvm.exp?rev=57912&r1=57911&r2=57912&view=diff
==============================================================================
--- llvm/trunk/test/lib/llvm.exp (original)
+++ llvm/trunk/test/lib/llvm.exp Tue Oct 21 12:21:32 2008
@@ -49,7 +49,7 @@
global srcroot objroot srcdir objdir subdir target_triplet prcontext
global llvmgcc llvmgxx llvmgcc_version llvmgccmajvers ocamlc
global gccpath gxxpath compile_c compile_cxx link shlibext llvmlibsdir
- global valgrind
+ global valgrind grep gas
set path [file join $srcdir $subdir]
# Substitute all Tcl variables.
@@ -84,6 +84,11 @@
#replace _#MARKER#_ with %
regsub -all {_#MARKER#_} $new_line % new_line
+ #replace grep with GNU grep
+ regsub -all { grep } $new_line " $grep " new_line
+ #replace as with GNU as
+ regsub -all {\| as } $new_line "| $gas " new_line
+
#valgind related stuff
# regsub -all {bugpoint } $new_line "$valgrind bugpoint " new_line
regsub -all {llc } $new_line "$valgrind llc " new_line
From edwintorok at gmail.com Tue Oct 21 12:22:24 2008
From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edvin?=)
Date: Tue, 21 Oct 2008 20:22:24 +0300
Subject: [llvm-commits] {PATCH] fix 'make check' on Solaris10
In-Reply-To:
References: <4354d3270810181030l6c93a546gd800642e7d9b93ea@mail.gmail.com>
Message-ID: <4354d3270810211022v63de47d8qa06745f4e2991492@mail.gmail.com>
On Tue, Oct 21, 2008 at 01:59, Eric Christopher wrote:
>
> On Oct 18, 2008, at 11:25 AM, Chris Lattner wrote:
>
>> This looks good to me, but I'm not autoconf wizard :). Eric, can
>> you take a look?
>
> Yep. It should be good.
>
Thanks committed in SVN r57912.
Should I also commit the new configure? (I have autoconf-2.61)
Best regards,
--Edwin
From gohman at apple.com Tue Oct 21 13:24:51 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 18:24:51 -0000
Subject: [llvm-commits] [llvm] r57915 -
/llvm/trunk/lib/Target/X86/X86FastISel.cpp
Message-ID: <200810211824.m9LIOp59023752@zion.cs.uiuc.edu>
Author: djg
Date: Tue Oct 21 13:24:51 2008
New Revision: 57915
URL: http://llvm.org/viewvc/llvm-project?rev=57915&view=rev
Log:
Implement the optimized FCMP_OEQ/FCMP_UNE code for x86 fast-isel.
Modified:
llvm/trunk/lib/Target/X86/X86FastISel.cpp
Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=57915&r1=57914&r2=57915&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Tue Oct 21 13:24:51 2008
@@ -692,6 +692,11 @@
unsigned BranchOpc; // Opcode to jump on, e.g. "X86::JA"
switch (Predicate) {
+ case CmpInst::FCMP_OEQ:
+ std::swap(TrueMBB, FalseMBB);
+ Predicate = CmpInst::FCMP_UNE;
+ // FALL THROUGH
+ case CmpInst::FCMP_UNE: SwapArgs = false; BranchOpc = X86::JNE; break;
case CmpInst::FCMP_OGT: SwapArgs = false; BranchOpc = X86::JA; break;
case CmpInst::FCMP_OGE: SwapArgs = false; BranchOpc = X86::JAE; break;
case CmpInst::FCMP_OLT: SwapArgs = true; BranchOpc = X86::JA; break;
@@ -728,6 +733,13 @@
return false;
BuildMI(MBB, TII.get(BranchOpc)).addMBB(TrueMBB);
+
+ if (Predicate == CmpInst::FCMP_UNE) {
+ // X86 requires a second branch to handle UNE (and OEQ,
+ // which is mapped to UNE above).
+ BuildMI(MBB, TII.get(X86::JP)).addMBB(TrueMBB);
+ }
+
FastEmitBranch(FalseMBB);
MBB->addSuccessor(TrueMBB);
return true;
From kremenek at apple.com Tue Oct 21 14:49:24 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 19:49:24 -0000
Subject: [llvm-commits] [llvm] r57918 - /llvm/tags/checker/checker-114/
Message-ID: <200810211949.m9LJnOxY027564@zion.cs.uiuc.edu>
Author: kremenek
Date: Tue Oct 21 14:49:23 2008
New Revision: 57918
URL: http://llvm.org/viewvc/llvm-project?rev=57918&view=rev
Log:
Tagging checker-114.
Added:
llvm/tags/checker/checker-114/
- copied from r57917, llvm/trunk/
From gohman at apple.com Tue Oct 21 14:50:00 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 19:50:00 -0000
Subject: [llvm-commits] [llvm] r57920 - /llvm/trunk/CREDITS.TXT
Message-ID: <200810211950.m9LJo00I027602@zion.cs.uiuc.edu>
Author: djg
Date: Tue Oct 21 14:50:00 2008
New Revision: 57920
URL: http://llvm.org/viewvc/llvm-project?rev=57920&view=rev
Log:
Updated email address.
Modified:
llvm/trunk/CREDITS.TXT
Modified: llvm/trunk/CREDITS.TXT
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=57920&r1=57919&r2=57920&view=diff
==============================================================================
--- llvm/trunk/CREDITS.TXT (original)
+++ llvm/trunk/CREDITS.TXT Tue Oct 21 14:50:00 2008
@@ -102,7 +102,7 @@
D: Author of llvmc2
N: Dan Gohman
-E: djg at cray.com
+E: gohman at apple.com
D: Miscellaneous bug fixes
N: David Greene
From nicolas.geoffray at lip6.fr Tue Oct 21 14:51:31 2008
From: nicolas.geoffray at lip6.fr (Nicolas Geoffray)
Date: Tue, 21 Oct 2008 21:51:31 +0200
Subject: [llvm-commits] Thread local storage support in the JIT
Message-ID: <48FE32C3.3010501@lip6.fr>
Hi everyone,
This patch enables thread local storage in JIT/Interpreter environments
(on linux/x86). It does 2 things:
- The emission of thread local global variables by giving it an offset
in the thread local register (ie SG).
- The code generation of thread local global variable loads and stores.
What do you guys think?
Thanks,
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jit-tls.patch
Type: text/x-diff
Size: 6927 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20081021/45355e97/attachment.bin
From kremenek at apple.com Tue Oct 21 14:52:55 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 19:52:55 -0000
Subject: [llvm-commits] [llvm] r57921 - /llvm/tags/checker/checker-114/
Message-ID: <200810211952.m9LJqtep027811@zion.cs.uiuc.edu>
Author: kremenek
Date: Tue Oct 21 14:52:54 2008
New Revision: 57921
URL: http://llvm.org/viewvc/llvm-project?rev=57921&view=rev
Log:
Removing checker-114.
Removed:
llvm/tags/checker/checker-114/
From daniel at zuster.org Tue Oct 21 14:53:11 2008
From: daniel at zuster.org (Daniel Dunbar)
Date: Tue, 21 Oct 2008 19:53:11 -0000
Subject: [llvm-commits] [llvm] r57923 - in /llvm/trunk:
include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp
Message-ID: <200810211953.m9LJrBjH027841@zion.cs.uiuc.edu>
Author: ddunbar
Date: Tue Oct 21 14:53:10 2008
New Revision: 57923
URL: http://llvm.org/viewvc/llvm-project?rev=57923&view=rev
Log:
Clear raw_fd_ostream error string on success and explain behavior in
documentation.
Add C++ header marker.
Modified:
llvm/trunk/include/llvm/Support/raw_ostream.h
llvm/trunk/lib/Support/raw_ostream.cpp
Modified: llvm/trunk/include/llvm/Support/raw_ostream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=57923&r1=57922&r2=57923&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Oct 21 14:53:10 2008
@@ -1,4 +1,4 @@
-//===--- raw_ostream.h - Raw output stream --------------------------------===//
+//===--- raw_ostream.h - Raw output stream ----------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -152,9 +152,10 @@
int FD;
bool ShouldClose;
public:
- /// raw_fd_ostream - Open the specified file for writing. If an error occurs,
- /// information about the error is put into ErrorInfo, and the stream should
- /// be immediately destroyed.
+ /// raw_fd_ostream - Open the specified file for writing. If an
+ /// error occurs, information about the error is put into ErrorInfo,
+ /// and the stream should be immediately destroyed; the string will
+ /// be empty if no error occurred.
raw_fd_ostream(const char *Filename, std::string &ErrorInfo);
/// raw_fd_ostream ctor - FD is the file descriptor that this writes to. If
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=57923&r1=57922&r2=57923&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Oct 21 14:53:10 2008
@@ -196,10 +196,13 @@
// raw_fd_ostream
//===----------------------------------------------------------------------===//
-/// raw_fd_ostream - Open the specified file for writing. If an error occurs,
-/// information about the error is put into ErrorInfo, and the stream should
-/// be immediately destroyed.
+/// raw_fd_ostream - Open the specified file for writing. If an error
+/// occurs, information about the error is put into ErrorInfo, and the
+/// stream should be immediately destroyed; the string will be empty
+/// if no error occurred.
raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo) {
+ ErrorInfo.clear();
+
// Handle "-" as stdout.
if (Filename[0] == '-' && Filename[1] == 0) {
FD = STDOUT_FILENO;
From gohman at apple.com Tue Oct 21 15:00:43 2008
From: gohman at apple.com (Dan Gohman)
Date: Tue, 21 Oct 2008 20:00:43 -0000
Subject: [llvm-commits] [llvm] r57925 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp test/CodeGen/X86/pr2924.ll
Message-ID: <200810212000.m9LK0h2U028185@zion.cs.uiuc.edu>
Author: djg
Date: Tue Oct 21 15:00:42 2008
New Revision: 57925
URL: http://llvm.org/viewvc/llvm-project?rev=57925&view=rev
Log:
Fix SelectionDAGBuild lowering of Select instructions to
handle first-class aggregate values. Also, fix a bug in
the Ret handling for empty aggregates.
Added:
llvm/trunk/test/CodeGen/X86/pr2924.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=57925&r1=57924&r2=57925&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Oct 21 15:00:42 2008
@@ -902,11 +902,13 @@
SmallVector NewValues;
NewValues.push_back(getControlRoot());
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
- SDValue RetOp = getValue(I.getOperand(i));
-
SmallVector ValueVTs;
ComputeValueVTs(TLI, I.getOperand(i)->getType(), ValueVTs);
- for (unsigned j = 0, f = ValueVTs.size(); j != f; ++j) {
+ unsigned NumValues = ValueVTs.size();
+ if (NumValues == 0) continue;
+
+ SDValue RetOp = getValue(I.getOperand(i));
+ for (unsigned j = 0, f = NumValues; j != f; ++j) {
MVT VT = ValueVTs[j];
// FIXME: C calling convention requires the return type to be promoted to
@@ -2137,11 +2139,23 @@
}
void SelectionDAGLowering::visitSelect(User &I) {
- SDValue Cond = getValue(I.getOperand(0));
- SDValue TrueVal = getValue(I.getOperand(1));
- SDValue FalseVal = getValue(I.getOperand(2));
- setValue(&I, DAG.getNode(ISD::SELECT, TrueVal.getValueType(), Cond,
- TrueVal, FalseVal));
+ SmallVector ValueVTs;
+ ComputeValueVTs(TLI, I.getType(), ValueVTs);
+ unsigned NumValues = ValueVTs.size();
+ if (NumValues != 0) {
+ SmallVector Values(NumValues);
+ SDValue Cond = getValue(I.getOperand(0));
+ SDValue TrueVal = getValue(I.getOperand(1));
+ SDValue FalseVal = getValue(I.getOperand(2));
+
+ for (unsigned i = 0; i != NumValues; ++i)
+ Values[i] = DAG.getNode(ISD::SELECT, TrueVal.getValueType(), Cond,
+ SDValue(TrueVal.getNode(), TrueVal.getResNo() + i),
+ SDValue(FalseVal.getNode(), FalseVal.getResNo() + i));
+
+ setValue(&I, DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], NumValues),
+ &Values[0], NumValues));
+ }
}
Added: llvm/trunk/test/CodeGen/X86/pr2924.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr2924.ll?rev=57925&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pr2924.ll (added)
+++ llvm/trunk/test/CodeGen/X86/pr2924.ll Tue Oct 21 15:00:42 2008
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | llc
+; PR2924
+
+target datalayout =
+"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+
+define x86_stdcallcc { i32, i8* } @_D3std6string7toupperFAaZAa({ i32, i8* } %s) {
+entry_std.string.toupper:
+ %tmp58 = load i32* null
+ %tmp59 = icmp eq i32 %tmp58, 0
+ %r.val = load { i32, i8* }* null, align 8
+ %condtmp.0 = select i1 %tmp59, { i32, i8* } undef, { i32, i8* } %r.val
+
+ ret { i32, i8* } %condtmp.0
+}
+define { } @empty({ } %s) {
+entry_std.string.toupper:
+ %tmp58 = load i32* null
+ %tmp59 = icmp eq i32 %tmp58, 0
+ %r.val = load { }* null, align 8
+ %condtmp.0 = select i1 %tmp59, { } undef, { } %r.val
+ ret { } %condtmp.0
+}
From isanbard at gmail.com Tue Oct 21 15:41:19 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 21 Oct 2008 13:41:19 -0700
Subject: [llvm-commits] [llvm] r57912 - in /llvm/trunk:
Makefile.config.in autoconf/configure.ac test/Makefile
test/lib/llvm.exp
In-Reply-To: <200810211721.m9LHLXSW021465@zion.cs.uiuc.edu>
References: <200810211721.m9LHLXSW021465@zion.cs.uiuc.edu>
Message-ID: <16e5fdf90810211341v3913677fo1baeacb143f781a1@mail.gmail.com>
T?r?k,
Please regenerate the configure file. I'm getting this error during
"make check":
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/Generic/2008-07-29-EHLabel.ll
for PR2609
Failed with posix(ENOENT,no such file or directory) at line 1
while running: llvm-as <
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/Generic/2008-07-29-EHLabel.ll
| llc -o - | @GAS@ -o /dev/null
couldn't execute "@GAS@": no such file or directory
-bw
On Tue, Oct 21, 2008 at 10:21 AM, Torok Edwin wrote:
> Author: edwin
> Date: Tue Oct 21 12:21:32 2008
> New Revision: 57912
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57912&view=rev
> Log:
> Fix make check on Solaris 10/x86: the default grep is not GNU grep, same for as.
>
> Modified:
> llvm/trunk/Makefile.config.in
> llvm/trunk/autoconf/configure.ac
> llvm/trunk/test/Makefile
> llvm/trunk/test/lib/llvm.exp
>
> Modified: llvm/trunk/Makefile.config.in
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=57912&r1=57911&r2=57912&view=diff
>
> ==============================================================================
> --- llvm/trunk/Makefile.config.in (original)
> +++ llvm/trunk/Makefile.config.in Tue Oct 21 12:21:32 2008
> @@ -160,6 +160,7 @@
> OCAMLOPT := @OCAMLOPT@
> OCAMLDEP := @OCAMLDEP@
> OCAMLDOC := @OCAMLDOC@
> +GAS := @GAS@
> POD2HTML := @POD2HTML@
> POD2MAN := @POD2MAN@
> RUNTEST := @RUNTEST@
>
> Modified: llvm/trunk/autoconf/configure.ac
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=57912&r1=57911&r2=57912&view=diff
>
> ==============================================================================
> --- llvm/trunk/autoconf/configure.ac (original)
> +++ llvm/trunk/autoconf/configure.ac Tue Oct 21 12:21:32 2008
> @@ -614,6 +614,7 @@
> AC_PATH_PROGS(OCAMLOPT, [ocamlopt.opt ocamlopt])
> AC_PATH_PROGS(OCAMLDEP, [ocamldep.opt ocamldep])
> AC_PATH_PROGS(OCAMLDOC, [ocamldoc.opt ocamldoc])
> +AC_PATH_PROGS(GAS, [gas as])
>
> dnl Determine if the linker supports the -R option.
> AC_LINK_USE_R
>
> Modified: llvm/trunk/test/Makefile
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=57912&r1=57911&r2=57912&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/Makefile (original)
> +++ llvm/trunk/test/Makefile Tue Oct 21 12:21:32 2008
> @@ -110,6 +110,8 @@
> @echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp
> @echo 'set ocamlc "$(OCAMLC) -cc $(CXX) -I $(LibDir)/ocaml"' >> site.tmp
> @echo 'set valgrind "$(VALGRIND)"' >> site.tmp
> + @echo 'set grep "$(GREP)"' >>site.tmp
> + @echo 'set gas "$(GAS)"' >>site.tmp
> @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
> @test ! -f site.exp || \
> sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
>
> Modified: llvm/trunk/test/lib/llvm.exp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lib/llvm.exp?rev=57912&r1=57911&r2=57912&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/lib/llvm.exp (original)
> +++ llvm/trunk/test/lib/llvm.exp Tue Oct 21 12:21:32 2008
> @@ -49,7 +49,7 @@
> global srcroot objroot srcdir objdir subdir target_triplet prcontext
> global llvmgcc llvmgxx llvmgcc_version llvmgccmajvers ocamlc
> global gccpath gxxpath compile_c compile_cxx link shlibext llvmlibsdir
> - global valgrind
> + global valgrind grep gas
> set path [file join $srcdir $subdir]
>
> # Substitute all Tcl variables.
> @@ -84,6 +84,11 @@
> #replace _#MARKER#_ with %
> regsub -all {_#MARKER#_} $new_line % new_line
>
> + #replace grep with GNU grep
> + regsub -all { grep } $new_line " $grep " new_line
> + #replace as with GNU as
> + regsub -all {\| as } $new_line "| $gas " new_line
> +
> #valgind related stuff
> # regsub -all {bugpoint } $new_line "$valgrind bugpoint " new_line
> regsub -all {llc } $new_line "$valgrind llc " new_line
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From dalej at apple.com Tue Oct 21 15:50:02 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 21 Oct 2008 20:50:02 -0000
Subject: [llvm-commits] [llvm] r57926 - in /llvm/trunk/lib:
CodeGen/SelectionDAG/LegalizeDAG.cpp Target/X86/X86ISelLowering.cpp
Target/X86/X86ISelLowering.h
Message-ID: <200810212050.m9LKo2jD029848@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Oct 21 15:50:01 2008
New Revision: 57926
URL: http://llvm.org/viewvc/llvm-project?rev=57926&view=rev
Log:
Add an SSE2 algorithm for uint64->f64 conversion.
The same one Apple gcc uses, faster. Also gets the
extreme case in gcc.c-torture/execute/ieee/rbug.c
correct which we weren't before; this is not
sufficient to get the test to pass though, there
is another bug.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.h
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=57926&r1=57925&r2=57926&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Oct 21 15:50:01 2008
@@ -5473,6 +5473,22 @@
Hi = Source;
}
+ // Check to see if the target has a custom way to lower this. If so, use it.
+ // (Note we've already expanded the operand in this case.)
+ switch (TLI.getOperationAction(ISD::UINT_TO_FP, SourceVT)) {
+ default: assert(0 && "This action not implemented for this operation!");
+ case TargetLowering::Legal:
+ case TargetLowering::Expand:
+ break; // This case is handled below.
+ case TargetLowering::Custom: {
+ SDValue NV = TLI.LowerOperation(DAG.getNode(ISD::UINT_TO_FP, DestTy,
+ Source), DAG);
+ if (NV.getNode())
+ return LegalizeOp(NV);
+ break; // The target decided this was legal after all
+ }
+ }
+
// If this is unsigned, and not supported, first perform the conversion to
// signed, then adjust the result if the sign bit is set.
SDValue SignedConv = ExpandIntToFP(true, DestTy, Source);
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57926&r1=57925&r2=57926&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 21 15:50:01 2008
@@ -112,10 +112,12 @@
setOperationAction(ISD::UINT_TO_FP , MVT::i64 , Expand);
setOperationAction(ISD::UINT_TO_FP , MVT::i32 , Promote);
} else {
- if (X86ScalarSSEf64)
+ if (X86ScalarSSEf64) {
+ // We have an impenetrably clever algorithm for ui64->double only.
+ setOperationAction(ISD::UINT_TO_FP , MVT::i64 , Custom);
// If SSE i64 SINT_TO_FP is not available, expand i32 UINT_TO_FP.
setOperationAction(ISD::UINT_TO_FP , MVT::i32 , Expand);
- else
+ } else
setOperationAction(ISD::UINT_TO_FP , MVT::i32 , Promote);
}
@@ -4686,6 +4688,70 @@
return Result;
}
+SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG) {
+ MVT SrcVT = Op.getOperand(0).getValueType();
+ assert(SrcVT.getSimpleVT() == MVT::i64 && "Unknown UINT_TO_FP to lower!");
+
+ // We only handle SSE2 f64 target here; caller can handle the rest.
+ if (Op.getValueType() != MVT::f64 || !X86ScalarSSEf64)
+ return SDValue();
+
+ // Get a XMM-vector-sized stack slot.
+ unsigned Size = 128/8;
+ MachineFunction &MF = DAG.getMachineFunction();
+ int SSFI = MF.getFrameInfo()->CreateStackObject(Size, Size);
+ SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
+
+ // Build some magic constants.
+ std::vectorCV0;
+ CV0.push_back(ConstantInt::get(APInt(32, 0x45300000)));
+ CV0.push_back(ConstantInt::get(APInt(32, 0x43300000)));
+ CV0.push_back(ConstantInt::get(APInt(32, 0)));
+ CV0.push_back(ConstantInt::get(APInt(32, 0)));
+ Constant *C0 = ConstantVector::get(CV0);
+ SDValue CPIdx0 = DAG.getConstantPool(C0, getPointerTy(), 4);
+
+ std::vectorCV1;
+ CV1.push_back(ConstantFP::get(APFloat(APInt(64, 0x4530000000000000ULL))));
+ CV1.push_back(ConstantFP::get(APFloat(APInt(64, 0x4330000000000000ULL))));
+ Constant *C1 = ConstantVector::get(CV1);
+ SDValue CPIdx1 = DAG.getConstantPool(C1, getPointerTy(), 4);
+
+ SmallVector MaskVec;
+ MaskVec.push_back(DAG.getConstant(0, MVT::i32));
+ MaskVec.push_back(DAG.getConstant(4, MVT::i32));
+ MaskVec.push_back(DAG.getConstant(1, MVT::i32));
+ MaskVec.push_back(DAG.getConstant(5, MVT::i32));
+ SDValue UnpcklMask = DAG.getNode(ISD::BUILD_VECTOR, MVT::v4i32, &MaskVec[0],
+ MaskVec.size());
+ SmallVector MaskVec2;
+ MaskVec2.push_back(DAG.getConstant(1, MVT::i64));
+ MaskVec2.push_back(DAG.getConstant(0, MVT::i64));
+ SDValue ShufMask = DAG.getNode(ISD::BUILD_VECTOR, MVT::v2i64, &MaskVec2[0],
+ MaskVec2.size());
+
+ SDValue XR1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v4i32,
+ Op.getOperand(0).getOperand(1));
+ SDValue XR2 = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v4i32,
+ Op.getOperand(0).getOperand(0));
+ SDValue Unpck1 = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v4i32,
+ XR1, XR2, UnpcklMask);
+ SDValue CLod0 = DAG.getLoad(MVT::v4i32, DAG.getEntryNode(), CPIdx0,
+ PseudoSourceValue::getConstantPool(), 0, false, 16);
+ SDValue Unpck2 = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v4i32,
+ Unpck1, CLod0, UnpcklMask);
+ SDValue XR2F = DAG.getNode(ISD::BIT_CONVERT, MVT::v2f64, Unpck2);
+ SDValue CLod1 = DAG.getLoad(MVT::v2f64, CLod0.getValue(1), CPIdx1,
+ PseudoSourceValue::getConstantPool(), 0, false, 16);
+ SDValue Sub = DAG.getNode(ISD::FSUB, MVT::v2f64, XR2F, CLod1);
+ // Add the halves; easiest way is to swap them into another reg first.
+ SDValue Shuf = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v2f64,
+ Sub, Sub, ShufMask);
+ SDValue Add = DAG.getNode(ISD::FADD, MVT::v2f64, Shuf, Sub);
+ return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, MVT::f64, Add,
+ DAG.getIntPtrConstant(0));
+}
+
std::pair X86TargetLowering::
FP_TO_SINTHelper(SDValue Op, SelectionDAG &DAG) {
assert(Op.getValueType().getSimpleVT() <= MVT::i64 &&
@@ -6184,6 +6250,7 @@
case ISD::SRA_PARTS:
case ISD::SRL_PARTS: return LowerShift(Op, DAG);
case ISD::SINT_TO_FP: return LowerSINT_TO_FP(Op, DAG);
+ case ISD::UINT_TO_FP: return LowerUINT_TO_FP(Op, DAG);
case ISD::FP_TO_SINT: return LowerFP_TO_SINT(Op, DAG);
case ISD::FABS: return LowerFABS(Op, DAG);
case ISD::FNEG: return LowerFNEG(Op, DAG);
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=57926&r1=57925&r2=57926&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Oct 21 15:50:01 2008
@@ -558,6 +558,7 @@
SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG);
SDValue LowerShift(SDValue Op, SelectionDAG &DAG);
SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG);
+ SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG);
SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG);
SDValue LowerFABS(SDValue Op, SelectionDAG &DAG);
SDValue LowerFNEG(SDValue Op, SelectionDAG &DAG);
From kremenek at apple.com Tue Oct 21 16:32:11 2008
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 21 Oct 2008 21:32:11 -0000
Subject: [llvm-commits] [llvm] r57928 - /llvm/tags/checker/checker-114/
Message-ID: <200810212132.m9LLWBCh031506@zion.cs.uiuc.edu>
Author: kremenek
Date: Tue Oct 21 16:32:11 2008
New Revision: 57928
URL: http://llvm.org/viewvc/llvm-project?rev=57928&view=rev
Log:
Tagging checker-114.
Added:
llvm/tags/checker/checker-114/
- copied from r57927, llvm/trunk/
From evan.cheng at apple.com Tue Oct 21 16:58:03 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 21 Oct 2008 14:58:03 -0700
Subject: [llvm-commits] [llvm] r57926 - in /llvm/trunk/lib:
CodeGen/SelectionDAG/LegalizeDAG.cpp
Target/X86/X86ISelLowering.cpp Target/X86/X86ISelLowering.h
In-Reply-To: <200810212050.m9LKo2jD029848@zion.cs.uiuc.edu>
References: <200810212050.m9LKo2jD029848@zion.cs.uiuc.edu>
Message-ID:
On Oct 21, 2008, at 1:50 PM, Dale Johannesen wrote:
> Author: johannes
> Date: Tue Oct 21 15:50:01 2008
> New Revision: 57926
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57926&view=rev
> Log:
> Add an SSE2 algorithm for uint64->f64 conversion.
> The same one Apple gcc uses, faster. Also gets the
> extreme case in gcc.c-torture/execute/ieee/rbug.c
> correct which we weren't before; this is not
> sufficient to get the test to pass though, there
> is another bug.
>
Awesome!
>
> +SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op, SelectionDAG
> &DAG) {
> + MVT SrcVT = Op.getOperand(0).getValueType();
> + assert(SrcVT.getSimpleVT() == MVT::i64 && "Unknown UINT_TO_FP to
> lower!");
> +
> + // We only handle SSE2 f64 target here; caller can handle the rest.
> + if (Op.getValueType() != MVT::f64 || !X86ScalarSSEf64)
> + return SDValue();
> +
> + // Get a XMM-vector-sized stack slot.
> + unsigned Size = 128/8;
> + MachineFunction &MF = DAG.getMachineFunction();
> + int SSFI = MF.getFrameInfo()->CreateStackObject(Size, Size);
> + SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
> +
> + // Build some magic constants.
Can you add comments describing the algorithm? I can't figure out
what's going on here.
Thanks,
Evan
>
> + std::vectorCV0;
> + CV0.push_back(ConstantInt::get(APInt(32, 0x45300000)));
> + CV0.push_back(ConstantInt::get(APInt(32, 0x43300000)));
> + CV0.push_back(ConstantInt::get(APInt(32, 0)));
> + CV0.push_back(ConstantInt::get(APInt(32, 0)));
> + Constant *C0 = ConstantVector::get(CV0);
> + SDValue CPIdx0 = DAG.getConstantPool(C0, getPointerTy(), 4);
> +
> + std::vectorCV1;
> + CV1.push_back(ConstantFP::get(APFloat(APInt(64,
> 0x4530000000000000ULL))));
> + CV1.push_back(ConstantFP::get(APFloat(APInt(64,
> 0x4330000000000000ULL))));
> + Constant *C1 = ConstantVector::get(CV1);
> + SDValue CPIdx1 = DAG.getConstantPool(C1, getPointerTy(), 4);
> +
> + SmallVector MaskVec;
> + MaskVec.push_back(DAG.getConstant(0, MVT::i32));
> + MaskVec.push_back(DAG.getConstant(4, MVT::i32));
> + MaskVec.push_back(DAG.getConstant(1, MVT::i32));
> + MaskVec.push_back(DAG.getConstant(5, MVT::i32));
> + SDValue UnpcklMask = DAG.getNode(ISD::BUILD_VECTOR, MVT::v4i32,
> &MaskVec[0],
> + MaskVec.size());
> + SmallVector MaskVec2;
> + MaskVec2.push_back(DAG.getConstant(1, MVT::i64));
> + MaskVec2.push_back(DAG.getConstant(0, MVT::i64));
> + SDValue ShufMask = DAG.getNode(ISD::BUILD_VECTOR, MVT::v2i64,
> &MaskVec2[0],
> + MaskVec2.size());
> +
> + SDValue XR1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v4i32,
> + Op.getOperand(0).getOperand(1));
> + SDValue XR2 = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v4i32,
> + Op.getOperand(0).getOperand(0));
> + SDValue Unpck1 = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v4i32,
> + XR1, XR2, UnpcklMask);
> + SDValue CLod0 = DAG.getLoad(MVT::v4i32, DAG.getEntryNode(), CPIdx0,
> + PseudoSourceValue::getConstantPool(), 0,
> false, 16);
> + SDValue Unpck2 = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v4i32,
> + Unpck1, CLod0, UnpcklMask);
> + SDValue XR2F = DAG.getNode(ISD::BIT_CONVERT, MVT::v2f64, Unpck2);
> + SDValue CLod1 = DAG.getLoad(MVT::v2f64, CLod0.getValue(1), CPIdx1,
> + PseudoSourceValue::getConstantPool(), 0,
> false, 16);
> + SDValue Sub = DAG.getNode(ISD::FSUB, MVT::v2f64, XR2F, CLod1);
> + // Add the halves; easiest way is to swap them into another reg
> first.
> + SDValue Shuf = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v2f64,
> + Sub, Sub, ShufMask);
> + SDValue Add = DAG.getNode(ISD::FADD, MVT::v2f64, Shuf, Sub);
> + return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, MVT::f64, Add,
> + DAG.getIntPtrConstant(0));
> +}
> +
> std::pair X86TargetLowering::
> FP_TO_SINTHelper(SDValue Op, SelectionDAG &DAG) {
> assert(Op.getValueType().getSimpleVT() <= MVT::i64 &&
> @@ -6184,6 +6250,7 @@
> case ISD::SRA_PARTS:
> case ISD::SRL_PARTS: return LowerShift(Op, DAG);
> case ISD::SINT_TO_FP: return LowerSINT_TO_FP(Op, DAG);
> + case ISD::UINT_TO_FP: return LowerUINT_TO_FP(Op, DAG);
> case ISD::FP_TO_SINT: return LowerFP_TO_SINT(Op, DAG);
> case ISD::FABS: return LowerFABS(Op, DAG);
> case ISD::FNEG: return LowerFNEG(Op, DAG);
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=57926&r1=57925&r2=57926&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Oct 21 15:50:01
> 2008
> @@ -558,6 +558,7 @@
> SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG);
> SDValue LowerShift(SDValue Op, SelectionDAG &DAG);
> SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG);
> + SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG);
> SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG);
> SDValue LowerFABS(SDValue Op, SelectionDAG &DAG);
> SDValue LowerFNEG(SDValue Op, SelectionDAG &DAG);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From dalej at apple.com Tue Oct 21 17:08:15 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 21 Oct 2008 15:08:15 -0700
Subject: [llvm-commits] [llvm] r57926 - in /llvm/trunk/lib:
CodeGen/SelectionDAG/LegalizeDAG.cpp Target/X86/X86ISelLowering.cpp
Target/X86/X86ISelLowering.h
In-Reply-To:
References: <200810212050.m9LKo2jD029848@zion.cs.uiuc.edu>
Message-ID: <61299DEB-E5F5-4C70-B78C-24986EADB58E@apple.com>
On Oct 21, 2008, at 2:58 PMPDT, Evan Cheng wrote:
>>
>> +SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op, SelectionDAG
>> &DAG) {
>> + MVT SrcVT = Op.getOperand(0).getValueType();
>> + assert(SrcVT.getSimpleVT() == MVT::i64 && "Unknown UINT_TO_FP to
>> lower!");
>> +
>> + // We only handle SSE2 f64 target here; caller can handle the
>> rest.
>> + if (Op.getValueType() != MVT::f64 || !X86ScalarSSEf64)
>> + return SDValue();
>> +
>> + // Get a XMM-vector-sized stack slot.
>> + unsigned Size = 128/8;
>> + MachineFunction &MF = DAG.getMachineFunction();
>> + int SSFI = MF.getFrameInfo()->CreateStackObject(Size, Size);
>> + SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
>> +
>> + // Build some magic constants.
>
> Can you add comments describing the algorithm? I can't figure out
> what's going on here.
I was afraid somebody would ask for that:( I'll come up with something.
From dalej at apple.com Tue Oct 21 18:07:50 2008
From: dalej at apple.com (Dale Johannesen)
Date: Tue, 21 Oct 2008 23:07:50 -0000
Subject: [llvm-commits] [llvm] r57932 -
/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Message-ID: <200810212307.m9LN7p3S001712@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Oct 21 18:07:49 2008
New Revision: 57932
URL: http://llvm.org/viewvc/llvm-project?rev=57932&view=rev
Log:
Add comments to explain uint64->f64 algorithm,
well, sort of. (Algorithm by Ian Ollmann.)
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57932&r1=57931&r2=57932&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 21 18:07:49 2008
@@ -4696,6 +4696,41 @@
if (Op.getValueType() != MVT::f64 || !X86ScalarSSEf64)
return SDValue();
+ // This algorithm is not obvious. Here it is in C code, more or less:
+/*
+ double uint64_to_double( uint32_t hi, uint32_t lo )
+ {
+ static const __m128i exp = { 0x4330000045300000ULL, 0 };
+ static const __m128d bias = { 0x1.0p84, 0x1.0p52 };
+
+ //copy ints to xmm registers
+ __m128i xh = _mm_cvtsi32_si128( hi );
+ __m128i xl = _mm_cvtsi32_si128( lo );
+
+ //combine into low half of a single xmm register
+ __m128i x = _mm_unpacklo_epi32( xh, xl );
+ __m128d d;
+ double sd;
+
+ //merge in appropriate exponents to give the integer bits the
+ // right magnitude
+ x = _mm_unpacklo_epi32( x, exp );
+
+ //subtract away the biases to deal with the IEEE-754 double precision
+ //implicit 1
+ d = _mm_sub_pd( (__m128d) x, bias );
+
+ //All conversions up to here are exact. The correctly rounded result is
+ // calculated using the
+ //current rounding mode using the following horizontal add.
+ d = _mm_add_sd( d, _mm_unpackhi_pd( d, d ) );
+ _mm_store_sd( &sd, d ); //since we are returning doubles in XMM, this
+ //store doesn't really need to be here (except maybe to zero the other
+ //double)
+ return sd;
+ }
+*/
+
// Get a XMM-vector-sized stack slot.
unsigned Size = 128/8;
MachineFunction &MF = DAG.getMachineFunction();
From daniel at zuster.org Tue Oct 21 18:33:39 2008
From: daniel at zuster.org (Daniel Dunbar)
Date: Tue, 21 Oct 2008 23:33:39 -0000
Subject: [llvm-commits] [llvm] r57933 - in /llvm/trunk:
include/llvm/Assembly/PrintModulePass.h include/llvm/LinkAllPasses.h
lib/CodeGen/LLVMTargetMachine.cpp lib/VMCore/AsmWriter.cpp
lib/VMCore/PrintModulePass.cpp tools/llvm-dis/llvm-dis.cpp
tools/opt/opt.cpp
Message-ID: <200810212333.m9LNXeFW002430@zion.cs.uiuc.edu>
Author: ddunbar
Date: Tue Oct 21 18:33:38 2008
New Revision: 57933
URL: http://llvm.org/viewvc/llvm-project?rev=57933&view=rev
Log:
Privatize PrintModulePass and PrintFunctionPass and add
createPrintModulePass and createPrintFunctionPass.
- So clients who compile w/o RTTI can use them.
Added:
llvm/trunk/lib/VMCore/PrintModulePass.cpp
Modified:
llvm/trunk/include/llvm/Assembly/PrintModulePass.h
llvm/trunk/include/llvm/LinkAllPasses.h
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
llvm/trunk/lib/VMCore/AsmWriter.cpp
llvm/trunk/tools/llvm-dis/llvm-dis.cpp
llvm/trunk/tools/opt/opt.cpp
Modified: llvm/trunk/include/llvm/Assembly/PrintModulePass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/PrintModulePass.h?rev=57933&r1=57932&r2=57933&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Assembly/PrintModulePass.h (original)
+++ llvm/trunk/include/llvm/Assembly/PrintModulePass.h Tue Oct 21 18:33:38 2008
@@ -18,64 +18,22 @@
#ifndef LLVM_ASSEMBLY_PRINTMODULEPASS_H
#define LLVM_ASSEMBLY_PRINTMODULEPASS_H
-#include "llvm/Pass.h"
-#include "llvm/Module.h"
#include "llvm/Support/Streams.h"
+#include
namespace llvm {
-
-class PrintModulePass : public ModulePass {
- OStream *Out; // ostream to print on
- bool DeleteStream; // Delete the ostream in our dtor?
-public:
- static char ID;
- PrintModulePass() : ModulePass(intptr_t(&ID)), Out(&cerr),
- DeleteStream(false) {}
- PrintModulePass(OStream *o, bool DS = false)
- : ModulePass(intptr_t(&ID)), Out(o), DeleteStream(DS) {}
-
- ~PrintModulePass() {
- if (DeleteStream) delete Out;
- }
-
- bool runOnModule(Module &M) {
- (*Out) << M << std::flush;
- return false;
- }
-
- virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- }
-};
-
-class PrintFunctionPass : public FunctionPass {
- std::string Banner; // String to print before each function
- OStream *Out; // ostream to print on
- bool DeleteStream; // Delete the ostream in our dtor?
-public:
- static char ID;
- PrintFunctionPass() : FunctionPass(intptr_t(&ID)), Banner(""), Out(&cerr),
- DeleteStream(false) {}
- PrintFunctionPass(const std::string &B, OStream *o = &cout,
- bool DS = false)
- : FunctionPass(intptr_t(&ID)), Banner(B), Out(o), DeleteStream(DS) {}
-
- inline ~PrintFunctionPass() {
- if (DeleteStream) delete Out;
- }
-
- // runOnFunction - This pass just prints a banner followed by the function as
- // it's processed.
- //
- bool runOnFunction(Function &F) {
- (*Out) << Banner << static_cast(F);
- return false;
- }
-
- virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- }
-};
+ class FunctionPass;
+ class ModulePass;
+
+ /// createPrintModulePass - Create and return a pass that writes the
+ /// module to the specified OStream.
+ ModulePass *createPrintModulePass(llvm::OStream *OS, bool DeleteStream=false);
+
+ /// createPrintFunctionPass - Create and return a pass that prints
+ /// functions to the specified OStream as they are processed.
+ FunctionPass *createPrintFunctionPass(const std::string &Banner,
+ llvm::OStream *OS,
+ bool DeleteStream=false);
} // End llvm namespace
Modified: llvm/trunk/include/llvm/LinkAllPasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=57933&r1=57932&r2=57933&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LinkAllPasses.h (original)
+++ llvm/trunk/include/llvm/LinkAllPasses.h Tue Oct 21 18:33:38 2008
@@ -23,6 +23,7 @@
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/ScalarEvolution.h"
+#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Function.h"
#include "llvm/Transforms/Instrumentation.h"
@@ -120,6 +121,8 @@
(void) llvm::createInstructionNamerPass();
(void) llvm::createPartialSpecializationPass();
(void) llvm::createAddReadAttrsPass();
+ (void) llvm::createPrintModulePass(0);
+ (void) llvm::createPrintFunctionPass("", 0);
(void)new llvm::IntervalPartition();
(void)new llvm::FindUsedTypes();
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=57933&r1=57932&r2=57933&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Tue Oct 21 18:33:38 2008
@@ -151,7 +151,7 @@
if (!Fast) {
PM.add(createLoopStrengthReducePass(getTargetLowering()));
if (PrintLSR)
- PM.add(new PrintFunctionPass("\n\n*** Code after LSR ***\n", &cerr));
+ PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &cerr));
}
PM.add(createGCLoweringPass());
@@ -166,8 +166,9 @@
PM.add(createCodeGenPreparePass(getTargetLowering()));
if (PrintISelInput)
- PM.add(new PrintFunctionPass("\n\n*** Final LLVM Code input to ISel ***\n",
- &cerr));
+ PM.add(createPrintFunctionPass("\n\n"
+ "*** Final LLVM Code input to ISel ***\n",
+ &cerr));
// Standard Lower-Level Passes.
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=57933&r1=57932&r2=57933&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Oct 21 18:33:38 2008
@@ -39,14 +39,6 @@
// Make virtual table appear in this compilation unit.
AssemblyAnnotationWriter::~AssemblyAnnotationWriter() {}
-char PrintModulePass::ID = 0;
-static RegisterPass
-X("print-module", "Print module to stderr");
-char PrintFunctionPass::ID = 0;
-static RegisterPass
-Y("print-function","Print function to stderr");
-
-
//===----------------------------------------------------------------------===//
// Helper Functions
//===----------------------------------------------------------------------===//
Added: llvm/trunk/lib/VMCore/PrintModulePass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PrintModulePass.cpp?rev=57933&view=auto
==============================================================================
--- llvm/trunk/lib/VMCore/PrintModulePass.cpp (added)
+++ llvm/trunk/lib/VMCore/PrintModulePass.cpp Tue Oct 21 18:33:38 2008
@@ -0,0 +1,96 @@
+//===--- VMCore/PrintModulePass.cpp - Module/Function Printer -------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// PrintModulePass and PrintFunctionPass implementations.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Assembly/PrintModulePass.h"
+
+#include "llvm/Function.h"
+#include "llvm/Module.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
+using namespace llvm;
+
+namespace {
+
+ class VISIBILITY_HIDDEN PrintModulePass : public ModulePass {
+ OStream *Out; // ostream to print on
+ bool DeleteStream; // Delete the ostream in our dtor?
+ public:
+ static char ID;
+ PrintModulePass() : ModulePass(intptr_t(&ID)), Out(&cerr),
+ DeleteStream(false) {}
+ PrintModulePass(OStream *o, bool DS)
+ : ModulePass(intptr_t(&ID)), Out(o), DeleteStream(DS) {}
+
+ ~PrintModulePass() {
+ if (DeleteStream) delete Out;
+ }
+
+ bool runOnModule(Module &M) {
+ (*Out) << M << std::flush;
+ return false;
+ }
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ }
+ };
+
+ class PrintFunctionPass : public FunctionPass {
+ std::string Banner; // String to print before each function
+ OStream *Out; // ostream to print on
+ bool DeleteStream; // Delete the ostream in our dtor?
+ public:
+ static char ID;
+ PrintFunctionPass() : FunctionPass(intptr_t(&ID)), Banner(""), Out(&cerr),
+ DeleteStream(false) {}
+ PrintFunctionPass(const std::string &B, OStream *o, bool DS)
+ : FunctionPass(intptr_t(&ID)), Banner(B), Out(o), DeleteStream(DS) {}
+
+ inline ~PrintFunctionPass() {
+ if (DeleteStream) delete Out;
+ }
+
+ // runOnFunction - This pass just prints a banner followed by the
+ // function as it's processed.
+ //
+ bool runOnFunction(Function &F) {
+ (*Out) << Banner << static_cast(F);
+ return false;
+ }
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ }
+ };
+}
+
+char PrintModulePass::ID = 0;
+static RegisterPass
+X("print-module", "Print module to stderr");
+char PrintFunctionPass::ID = 0;
+static RegisterPass
+Y("print-function","Print function to stderr");
+
+/// createPrintModulePass - Create and return a pass that writes the
+/// module to the specified OStream.
+ModulePass *llvm::createPrintModulePass(llvm::OStream *OS, bool DeleteStream) {
+ return new PrintModulePass(OS, DeleteStream);
+}
+
+/// createPrintFunctionPass - Create and return a pass that prints
+/// functions to the specified OStream as they are processed.
+FunctionPass *llvm::createPrintFunctionPass(const std::string &Banner,
+ OStream *OS, bool DeleteStream) {
+ return new PrintFunctionPass(Banner, OS, DeleteStream);
+}
+
Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/llvm-dis.cpp?rev=57933&r1=57932&r2=57933&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dis/llvm-dis.cpp (original)
+++ llvm/trunk/tools/llvm-dis/llvm-dis.cpp Tue Oct 21 18:33:38 2008
@@ -118,7 +118,7 @@
if (!DontPrint) {
PassManager Passes;
OStream L(*Out);
- Passes.add(new PrintModulePass(&L));
+ Passes.add(createPrintModulePass(&L));
Passes.run(*M.get());
}
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=57933&r1=57932&r2=57933&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Tue Oct 21 18:33:38 2008
@@ -543,7 +543,7 @@
}
if (PrintEachXForm)
- Passes.add(new PrintModulePass(&cerr));
+ Passes.add(createPrintModulePass(&cerr));
}
// If -std-compile-opts was specified at the end of the pass list, add them.
From daniel at zuster.org Tue Oct 21 18:34:13 2008
From: daniel at zuster.org (Daniel Dunbar)
Date: Tue, 21 Oct 2008 23:34:13 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r57934 - in /llvm-gcc-4.2/trunk/gcc:
llvm-backend.cpp llvm-linker-hack.cpp
Message-ID: <200810212334.m9LNYD6S002457@zion.cs.uiuc.edu>
Author: ddunbar
Date: Tue Oct 21 18:34:13 2008
New Revision: 57934
URL: http://llvm.org/viewvc/llvm-project?rev=57934&view=rev
Log:
Update for PrintModulePass API change.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=57934&r1=57933&r2=57934&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Oct 21 18:34:13 2008
@@ -469,7 +469,7 @@
} else if (emit_llvm) {
// Emit an LLVM .ll file to the output. This is used when passed
// -emit-llvm -S to the GCC driver.
- PerModulePasses->add(new PrintModulePass(AsmOutFile));
+ PerModulePasses->add(createPrintModulePass(AsmOutFile));
HasPerModulePasses = true;
} else {
FunctionPassManager *PM;
@@ -656,7 +656,7 @@
if (emit_llvm_bc)
IntermediatePM->add(CreateBitcodeWriterPass(*AsmIntermediateOutStream));
if (emit_llvm)
- IntermediatePM->add(new PrintModulePass(AsmIntermediateOutFile));
+ IntermediatePM->add(createPrintModulePass(AsmIntermediateOutFile));
IntermediatePM->run(*TheModule);
AsmIntermediateOutStream->flush();
fflush(asm_intermediate_out_file);
Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=57934&r1=57933&r2=57934&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Tue Oct 21 18:34:13 2008
@@ -23,6 +23,7 @@
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/Analysis/Verifier.h"
+#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/IPO.h"
@@ -86,6 +87,7 @@
llvm::createDeadTypeEliminationPass();
llvm::createLoopDeletionPass();
llvm::createAddReadAttrsPass();
+ llvm::createPrintModulePass(0);
std::string Err;
llvm::TargetMachineRegistry::getClosestStaticTargetForModule(*MP->getModule(),
From evan.cheng at apple.com Tue Oct 21 18:51:15 2008
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 21 Oct 2008 16:51:15 -0700
Subject: [llvm-commits] [llvm] r57932 -
/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
In-Reply-To: <200810212307.m9LN7p3S001712@zion.cs.uiuc.edu>
References: <200810212307.m9LN7p3S001712@zion.cs.uiuc.edu>
Message-ID:
Nice. Thanks. However, can you fix the comments so there is a space
between "//" and the first letter? It's driving me nuts. :-)
Evan
On Oct 21, 2008, at 4:07 PM, Dale Johannesen wrote:
> Author: johannes
> Date: Tue Oct 21 18:07:49 2008
> New Revision: 57932
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57932&view=rev
> Log:
> Add comments to explain uint64->f64 algorithm,
> well, sort of. (Algorithm by Ian Ollmann.)
>
>
> Modified:
> llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57932&r1=57931&r2=57932&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 21
> 18:07:49 2008
> @@ -4696,6 +4696,41 @@
> if (Op.getValueType() != MVT::f64 || !X86ScalarSSEf64)
> return SDValue();
>
> + // This algorithm is not obvious. Here it is in C code, more or
> less:
> +/*
> + double uint64_to_double( uint32_t hi, uint32_t lo )
> + {
> + static const __m128i exp = { 0x4330000045300000ULL, 0 };
> + static const __m128d bias = { 0x1.0p84, 0x1.0p52 };
> +
> + //copy ints to xmm registers
> + __m128i xh = _mm_cvtsi32_si128( hi );
> + __m128i xl = _mm_cvtsi32_si128( lo );
> +
> + //combine into low half of a single xmm register
> + __m128i x = _mm_unpacklo_epi32( xh, xl );
> + __m128d d;
> + double sd;
> +
> + //merge in appropriate exponents to give the integer bits the
> + // right magnitude
> + x = _mm_unpacklo_epi32( x, exp );
> +
> + //subtract away the biases to deal with the IEEE-754 double
> precision
> + //implicit 1
> + d = _mm_sub_pd( (__m128d) x, bias );
> +
> + //All conversions up to here are exact. The correctly rounded
> result is
> + // calculated using the
> + //current rounding mode using the following horizontal add.
> + d = _mm_add_sd( d, _mm_unpackhi_pd( d, d ) );
> + _mm_store_sd( &sd, d ); //since we are returning doubles in
> XMM, this
> + //store doesn't really need to be here (except maybe to zero
> the other
> + //double)
> + return sd;
> + }
> +*/
> +
> // Get a XMM-vector-sized stack slot.
> unsigned Size = 128/8;
> MachineFunction &MF = DAG.getMachineFunction();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From ofv at wanadoo.es Tue Oct 21 18:52:03 2008
From: ofv at wanadoo.es (Oscar Fuentes)
Date: Tue, 21 Oct 2008 23:52:03 -0000
Subject: [llvm-commits] [llvm] r57937 - /llvm/trunk/lib/VMCore/CMakeLists.txt
Message-ID: <200810212352.m9LNq3Mv002975@zion.cs.uiuc.edu>
Author: ofv
Date: Tue Oct 21 18:52:03 2008
New Revision: 57937
URL: http://llvm.org/viewvc/llvm-project?rev=57937&view=rev
Log:
CMake: updated lib/VMCore/CMakeLists.txt
Modified:
llvm/trunk/lib/VMCore/CMakeLists.txt
Modified: llvm/trunk/lib/VMCore/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/CMakeLists.txt?rev=57937&r1=57936&r2=57937&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/CMakeLists.txt (original)
+++ llvm/trunk/lib/VMCore/CMakeLists.txt Tue Oct 21 18:52:03 2008
@@ -20,6 +20,7 @@
ModuleProvider.cpp
Pass.cpp
PassManager.cpp
+ PrintModulePass.cpp
Type.cpp
TypeSymbolTable.cpp
Use.cpp
From isanbard at gmail.com Tue Oct 21 18:57:52 2008
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 21 Oct 2008 23:57:52 -0000
Subject: [llvm-commits] [llvm] r57939 -
/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
Message-ID: <200810212357.m9LNvqfp003139@zion.cs.uiuc.edu>
Author: void
Date: Tue Oct 21 18:57:52 2008
New Revision: 57939
URL: http://llvm.org/viewvc/llvm-project?rev=57939&view=rev
Log:
Fix comment to name "TokenFactor" instead of "Token factor".
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=57939&r1=57938&r2=57939&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Oct 21 18:57:52 2008
@@ -73,7 +73,7 @@
// EntryToken - This is the marker used to indicate the start of the region.
EntryToken,
- // Token factor - This node takes multiple tokens as input and produces a
+ // TokenFactor - This node takes multiple tokens as input and produces a
// single token result. This is used to represent the fact that the operand
// operators are independent of each other.
TokenFactor,
From dalej at apple.com Tue Oct 21 19:02:32 2008
From: dalej at apple.com (Dale Johannesen)
Date: Wed, 22 Oct 2008 00:02:32 -0000
Subject: [llvm-commits] [llvm] r57940 -
/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Message-ID: <200810220002.m9M02XGE003275@zion.cs.uiuc.edu>
Author: johannes
Date: Tue Oct 21 19:02:32 2008
New Revision: 57940
URL: http://llvm.org/viewvc/llvm-project?rev=57940&view=rev
Log:
Adjust comments for pedantic satisfaction.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=57940&r1=57939&r2=57940&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 21 19:02:32 2008
@@ -4703,30 +4703,30 @@
static const __m128i exp = { 0x4330000045300000ULL, 0 };
static const __m128d bias = { 0x1.0p84, 0x1.0p52 };
- //copy ints to xmm registers
+ // copy ints to xmm registers
__m128i xh = _mm_cvtsi32_si128( hi );
__m128i xl = _mm_cvtsi32_si128( lo );
- //combine into low half of a single xmm register
+ // combine into low half of a single xmm register
__m128i x = _mm_unpacklo_epi32( xh, xl );
__m128d d;
double sd;
- //merge in appropriate exponents to give the integer bits the
+ // merge in appropriate exponents to give the integer bits the
// right magnitude
x = _mm_unpacklo_epi32( x, exp );
- //subtract away the biases to deal with the IEEE-754 double precision
- //implicit 1
+ // subtract away the biases to deal with the IEEE-754 double precision
+ // implicit 1
d = _mm_sub_pd( (__m128d) x, bias );
- //All conversions up to here are exact. The correctly rounded result is
+ // All conversions up to here are exact. The correctly rounded result is
// calculated using the
- //current rounding mode using the following horizontal add.
+ // current rounding mode using the following horizontal add.
d = _mm_add_sd( d, _mm_unpackhi_pd( d, d ) );
_mm_store_sd( &sd, d ); //since we are returning doubles in XMM, this
- //store doesn't really need to be here (except maybe to zero the other
- //double)
+ // store doesn't really need to be here (except maybe to zero the other
+ // double)
return sd;
}
*/
From ofv at wanadoo.es Tue Oct 21 21:51:55 2008
From: ofv at wanadoo.es (Oscar Fuentes)
Date: Wed, 22 Oct 2008 02:51:55 -0000
Subject: [llvm-commits] [llvm] r57943 - in /llvm/trunk/lib:
ExecutionEngine/CMakeLists.txt Target/ARM/CMakeLists.txt
Target/PowerPC/AsmPrinter/CMakeLists.txt
Target/X86/AsmPrinter/CMakeLists.txt VMCore/CMakeLists.txt
Message-ID: <200810220251.m9M2pt9Z008069@zion.cs.uiuc.edu>
Author: ofv
Date: Tue Oct 21 21:51:53 2008
New Revision: 57943
URL: http://llvm.org/viewvc/llvm-project?rev=57943&view=rev
Log:
CMake: Turned some libraries into partially linked objects. Corrected
names of LLVMCore and ARMCodeGen.
Modified:
llvm/trunk/lib/ExecutionEngine/CMakeLists.txt
llvm/trunk/lib/Target/ARM/CMakeLists.txt
llvm/trunk/lib/Target/PowerPC/AsmPrinter/CMakeLists.txt
llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt
llvm/trunk/lib/VMCore/CMakeLists.txt
Modified: llvm/trunk/lib/ExecutionEngine/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/CMakeLists.txt?rev=57943&r1=57942&r2=57943&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/CMakeLists.txt (original)
+++ llvm/trunk/lib/ExecutionEngine/CMakeLists.txt Tue Oct 21 21:51:53 2008
@@ -1,4 +1,4 @@
-add_llvm_library(LLVMExecutionEngine
+add_partially_linked_object(LLVMExecutionEngine
ExecutionEngine.cpp
ExecutionEngineBindings.cpp
)
Modified: llvm/trunk/lib/Target/ARM/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/CMakeLists.txt?rev=57943&r1=57942&r2=57943&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/CMakeLists.txt (original)
+++ llvm/trunk/lib/Target/ARM/CMakeLists.txt Tue Oct 21 21:51:53 2008
@@ -10,7 +10,7 @@
tablegen(ARMGenDAGISel.inc -gen-dag-isel)
tablegen(ARMGenSubtarget.inc -gen-subtarget)
-add_llvm_target(ARM
+add_llvm_target(ARMCodeGen
ARMCodeEmitter.cpp
ARMConstantIslandPass.cpp
ARMConstantPoolValue.cpp
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/CMakeLists.txt?rev=57943&r1=57942&r2=57943&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/CMakeLists.txt (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/CMakeLists.txt Tue Oct 21 21:51:53 2008
@@ -1,6 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
-add_llvm_library(LLVMPowerPCAsmPrinter
+add_partially_linked_object(LLVMPowerPCAsmPrinter
PPCAsmPrinter.cpp
)
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt?rev=57943&r1=57942&r2=57943&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt Tue Oct 21 21:51:53 2008
@@ -1,6 +1,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
-add_llvm_library(LLVMX86AsmPrinter
+add_partially_linked_object(LLVMX86AsmPrinter
X86ATTAsmPrinter.cpp
X86AsmPrinter.cpp
X86IntelAsmPrinter.cpp
Modified: llvm/trunk/lib/VMCore/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/CMakeLists.txt?rev=57943&r1=57942&r2=57943&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/CMakeLists.txt (original)
+++ llvm/trunk/lib/VMCore/CMakeLists.txt Tue Oct 21 21:51:53 2008
@@ -1,4 +1,4 @@
-add_llvm_library(LLVMVMCore
+add_llvm_library(LLVMCore
AsmWriter.cpp
Attributes.cpp
AutoUpgrade.cpp
From ofv at wanadoo.es Tue Oct 21 21:52:59 2008
From: ofv at wanadoo.es (Oscar Fuentes)
Date: Wed, 22 Oct 2008 02:52:59 -0000
Subject: [llvm-commits] [llvm] r57944 -
/llvm/trunk/examples/HowToUseJIT/CMakeLists.txt
Message-ID: <200810220252.m9M2qxJd008156@zion.cs.uiuc.edu>
Author: ofv
Date: Tue Oct 21 21:52:59 2008
New Revision: 57944
URL: http://llvm.org/viewvc/llvm-project?rev=57944&view=rev
Log:
CMake: use add_llvm_example for HowToUseJIT.
Modified:
llvm/trunk/examples/HowToUseJIT/CMakeLists.txt
Modified: llvm/trunk/examples/HowToUseJIT/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/HowToUseJIT/CMakeLists.txt?rev=57944&r1=57943&r2=57944&view=diff
==============================================================================
--- llvm/trunk/examples/HowToUseJIT/CMakeLists.txt (original)
+++ llvm/trunk/examples/HowToUseJIT/CMakeLists.txt Tue Oct 21 21:52:59 2008
@@ -1,5 +1,5 @@
set(LLVM_LINK_COMPONENTS jit interpreter nativecodegen)
-add_llvm_executable(HowToUseJIT
+add_llvm_example(HowToUseJIT
HowToUseJIT.cpp
)
From ofv at wanadoo.es Tue Oct 21 21:56:07 2008
From: ofv at wanadoo.es (Oscar Fuentes)
Date: Wed, 22 Oct 2008 02:56:07 -0000
Subject: [llvm-commits] [llvm] r57945 - in /llvm/trunk: CMakeLists.txt
cmake/modules/AddLLVM.cmake cmake/modules/AddPartiallyLinkedObject.cmake
tools/llvm-config/CMakeLists.txt
Message-ID: <200810220256.m9M2u7pZ008241@zion.cs.uiuc.edu>
Author: ofv
Date: Tue Oct 21 21:56:07 2008
New Revision: 57945
URL: http://llvm.org/viewvc/llvm-project?rev=57945&view=rev
Log:
CMake: `make install' for libraries, executables and header files.
Modified:
llvm/trunk/CMakeLists.txt
llvm/trunk/cmake/modules/AddLLVM.cmake
llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake
llvm/trunk/tools/llvm-config/CMakeLists.txt
Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=57945&r1=57944&r2=57945&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Tue Oct 21 21:56:07 2008
@@ -157,3 +157,16 @@
add_subdirectory(tools)
add_subdirectory(examples)
+
+install(DIRECTORY include
+ DESTINATION .
+ PATTERN ".svn" EXCLUDE
+ PATTERN "*.cmake" EXCLUDE
+ PATTERN "*.in" EXCLUDE
+ )
+
+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include
+ DESTINATION .
+ )
+
+# TODO: make and install documentation.
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=57945&r1=57944&r2=57945&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue Oct 21 21:56:07 2008
@@ -7,6 +7,9 @@
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
+ install(TARGETS ${name}
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
endmacro(add_llvm_library name)
@@ -34,12 +37,16 @@
macro(add_llvm_tool name)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
add_llvm_executable(${name} ${ARGN})
+ install(TARGETS ${name}
+ RUNTIME DESTINATION bin)
endmacro(add_llvm_tool name)
macro(add_llvm_example name)
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR})
add_llvm_executable(${name} ${ARGN})
+ install(TARGETS ${name}
+ RUNTIME DESTINATION examples)
endmacro(add_llvm_example name)
Modified: llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake?rev=57945&r1=57944&r2=57945&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake (original)
+++ llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake Tue Oct 21 21:56:07 2008
@@ -32,4 +32,6 @@
set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE)
set( llvm_lib_targets ${llvm_lib_targets} ${tnplo} PARENT_SCOPE )
endif( MSVC )
+ install(FILES ${pll}
+ DESTINATION lib)
endmacro(add_partially_linked_object lib)
Modified: llvm/trunk/tools/llvm-config/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/CMakeLists.txt?rev=57945&r1=57944&r2=57945&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-config/CMakeLists.txt Tue Oct 21 21:56:07 2008
@@ -104,3 +104,8 @@
DEPENDS ${LLVM_CONFIG})
add_dependencies(llvm-config.target ${llvm_lib_targets})
+
+install(FILES ${LLVM_CONFIG}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+ DESTINATION bin)
From daniel at zuster.org Tue Oct 21 22:25:24 2008
From: daniel at zuster.org (Daniel Dunbar)
Date: Wed, 22 Oct 2008 03:25:24 -0000
Subject: [llvm-commits] [llvm] r57946 - in /llvm/trunk:
include/llvm/Assembly/PrintModulePass.h lib/CodeGen/LLVMTargetMachine.cpp
lib/VMCore/PrintModulePass.cpp tools/llvm-dis/llvm-dis.cpp
tools/opt/opt.cpp
Message-ID: <200810220325.m9M3POJ9009033@zion.cs.uiuc.edu>
Author: ddunbar
Date: Tue Oct 21 22:25:22 2008
New Revision: 57946
URL: http://llvm.org/viewvc/llvm-project?rev=57946&view=rev
Log:
Move Print*Pass to use raw_ostream.
Modified:
llvm/trunk/include/llvm/Assembly/PrintModulePass.h
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
llvm/trunk/lib/VMCore/PrintModulePass.cpp
llvm/trunk/tools/llvm-dis/llvm-dis.cpp
llvm/trunk/tools/opt/opt.cpp
Modified: llvm/trunk/include/llvm/Assembly/PrintModulePass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/PrintModulePass.h?rev=57946&r1=57945&r2=57946&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Assembly/PrintModulePass.h (original)
+++ llvm/trunk/include/llvm/Assembly/PrintModulePass.h Tue Oct 21 22:25:22 2008
@@ -18,21 +18,21 @@
#ifndef LLVM_ASSEMBLY_PRINTMODULEPASS_H
#define LLVM_ASSEMBLY_PRINTMODULEPASS_H
-#include "llvm/Support/Streams.h"
#include
namespace llvm {
class FunctionPass;
class ModulePass;
+ class raw_ostream;
/// createPrintModulePass - Create and return a pass that writes the
- /// module to the specified OStream.
- ModulePass *createPrintModulePass(llvm::OStream *OS, bool DeleteStream=false);
+ /// module to the specified raw_ostream.
+ ModulePass *createPrintModulePass(raw_ostream *OS, bool DeleteStream=false);
/// createPrintFunctionPass - Create and return a pass that prints
- /// functions to the specified OStream as they are processed.
+ /// functions to the specified raw_ostream as they are processed.
FunctionPass *createPrintFunctionPass(const std::string &Banner,
- llvm::OStream *OS,
+ raw_ostream *OS,
bool DeleteStream=false);
} // End llvm namespace
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=57946&r1=57945&r2=57946&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Tue Oct 21 22:25:22 2008
@@ -151,7 +151,7 @@
if (!Fast) {
PM.add(createLoopStrengthReducePass(getTargetLowering()));
if (PrintLSR)
- PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &cerr));
+ PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &errs()));
}
PM.add(createGCLoweringPass());
@@ -168,7 +168,7 @@
if (PrintISelInput)
PM.add(createPrintFunctionPass("\n\n"
"*** Final LLVM Code input to ISel ***\n",
- &cerr));
+ &errs()));
// Standard Lower-Level Passes.
Modified: llvm/trunk/lib/VMCore/PrintModulePass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PrintModulePass.cpp?rev=57946&r1=57945&r2=57946&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PrintModulePass.cpp (original)
+++ llvm/trunk/lib/VMCore/PrintModulePass.cpp Tue Oct 21 22:25:22 2008
@@ -17,18 +17,19 @@
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
namespace {
class VISIBILITY_HIDDEN PrintModulePass : public ModulePass {
- OStream *Out; // ostream to print on
+ raw_ostream *Out; // raw_ostream to print on
bool DeleteStream; // Delete the ostream in our dtor?
public:
static char ID;
- PrintModulePass() : ModulePass(intptr_t(&ID)), Out(&cerr),
+ PrintModulePass() : ModulePass(intptr_t(&ID)), Out(&errs()),
DeleteStream(false) {}
- PrintModulePass(OStream *o, bool DS)
+ PrintModulePass(raw_ostream *o, bool DS)
: ModulePass(intptr_t(&ID)), Out(o), DeleteStream(DS) {}
~PrintModulePass() {
@@ -36,7 +37,8 @@
}
bool runOnModule(Module &M) {
- (*Out) << M << std::flush;
+ (*Out) << M;
+ Out->flush();
return false;
}
@@ -47,13 +49,13 @@
class PrintFunctionPass : public FunctionPass {
std::string Banner; // String to print before each function
- OStream *Out; // ostream to print on
+ raw_ostream *Out; // raw_ostream to print on
bool DeleteStream; // Delete the ostream in our dtor?
public:
static char ID;
- PrintFunctionPass() : FunctionPass(intptr_t(&ID)), Banner(""), Out(&cerr),
+ PrintFunctionPass() : FunctionPass(intptr_t(&ID)), Banner(""), Out(&errs()),
DeleteStream(false) {}
- PrintFunctionPass(const std::string &B, OStream *o, bool DS)
+ PrintFunctionPass(const std::string &B, raw_ostream *o, bool DS)
: FunctionPass(intptr_t(&ID)), Banner(B), Out(o), DeleteStream(DS) {}
inline ~PrintFunctionPass() {
@@ -65,6 +67,7 @@
//
bool runOnFunction(Function &F) {
(*Out) << Banner << static_cast(F);
+ Out->flush();
return false;
}
@@ -82,15 +85,17 @@
Y("print-function","Print function to stderr");
/// createPrintModulePass - Create and return a pass that writes the
-/// module to the specified OStream.
-ModulePass *llvm::createPrintModulePass(llvm::OStream *OS, bool DeleteStream) {
+/// module to the specified raw_ostream.
+ModulePass *llvm::createPrintModulePass(llvm::raw_ostream *OS,
+ bool DeleteStream) {
return new PrintModulePass(OS, DeleteStream);
}
/// createPrintFunctionPass - Create and return a pass that prints
-/// functions to the specified OStream as they are processed.
+/// functions to the specified raw_ostream as they are processed.
FunctionPass *llvm::createPrintFunctionPass(const std::string &Banner,
- OStream *OS, bool DeleteStream) {
+ llvm::raw_ostream *OS,
+ bool DeleteStream) {
return new PrintFunctionPass(Banner, OS, DeleteStream);
}
Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/llvm-dis.cpp?rev=57946&r1=57945&r2=57946&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dis/llvm-dis.cpp (original)
+++ llvm/trunk/tools/llvm-dis/llvm-dis.cpp Tue Oct 21 22:25:22 2008
@@ -24,6 +24,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Streams.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Signals.h"
#include
#include
@@ -117,7 +118,7 @@
// All that llvm-dis does is write the assembly to a file.
if (!DontPrint) {
PassManager Passes;
- OStream L(*Out);
+ raw_os_ostream L(*Out);
Passes.add(createPrintModulePass(&L));
Passes.run(*M.get());
}
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=57946&r1=57945&r2=57946&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Tue Oct 21 22:25:22 2008
@@ -30,6 +30,7 @@
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/Streams.h"
#include "llvm/Support/SystemUtils.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/LinkAllPasses.h"
#include "llvm/LinkAllVMCore.h"
#include
@@ -543,7 +544,7 @@
}
if (PrintEachXForm)
- Passes.add(createPrintModulePass(&cerr));
+ Passes.add(createPrintModulePass(&errs()));
}
// If -std-compile-opts was specified at the end of the pass list, add them.
From daniel at zuster.org Tue Oct 21 22:26:55 2008
From: daniel at zuster.org (Daniel Dunbar)
Date: Wed, 22 Oct 2008 03:26:55 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r57947 -
/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Message-ID: <200810220326.m9M3QuJd009078@zion.cs.uiuc.edu>
Author: ddunbar
Date: Tue Oct 21 22:26:55 2008
New Revision: 57947
URL: http://llvm.org/viewvc/llvm-project?rev=57947&view=rev
Log:
Update to use raw_ostream for PrintModulePass.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=57947&r1=57946&r2=57947&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Oct 21 22:26:55 2008
@@ -469,7 +469,7 @@
} else if (emit_llvm) {
// Emit an LLVM .ll file to the output. This is used when passed
// -emit-llvm -S to the GCC driver.
- PerModulePasses->add(createPrintModulePass(AsmOutFile));
+ PerModulePasses->add(createPrintModulePass(AsmOutRawStream));
HasPerModulePasses = true;
} else {
FunctionPassManager *PM;
@@ -653,11 +653,16 @@
FILE *asm_intermediate_out_file = fopen(asm_intermediate_out_filename, "w+b");
AsmIntermediateOutStream = new oFILEstream(asm_intermediate_out_file);
AsmIntermediateOutFile = new OStream(*AsmIntermediateOutStream);
+ raw_ostream *AsmIntermediateRawOutStream =
+ new raw_os_ostream(*AsmIntermediateOutStream);
if (emit_llvm_bc)
IntermediatePM->add(CreateBitcodeWriterPass(*AsmIntermediateOutStream));
if (emit_llvm)
- IntermediatePM->add(createPrintModulePass(AsmIntermediateOutFile));
+ IntermediatePM->add(createPrintModulePass(AsmIntermediateRawOutStream));
IntermediatePM->run(*TheModule);
+ AsmIntermediateRawOutStream->flush();
+ delete AsmIntermediateRawOutStream;
+ AsmIntermediateRawOutStream = 0;
AsmIntermediateOutStream->flush();
fflush(asm_intermediate_out_file);
delete AsmIntermediateOutStream;
From clattner at apple.com Tue Oct 21 22:54:03 2008
From: clattner at apple.com (Chris Lattner)
Date: Tue, 21 Oct 2008 20:54:03 -0700
Subject: [llvm-commits] [llvm] r57946 - in /llvm/trunk:
include/llvm/Assembly/PrintModulePass.h
lib/CodeGen/LLVMTargetMachine.cpp
lib/VMCore/PrintModulePass.cpp tools/llvm-dis/llvm-dis.cpp
tools/opt/opt.cpp
In-Reply-To: <200810220325.m9M3POJ9009033@zion.cs.uiuc.edu>
References: <200810220325.m9M3POJ9009033@zion.cs.uiuc.edu>
Message-ID: <50A6BBF4-B6ED-44B7-A699-E4D365320C38@apple.com>
On Oct 21, 2008, at 8:25 PM, Daniel Dunbar wrote:
> Author: ddunbar
> Date: Tue Oct 21 22:25:22 2008
> New Revision: 57946
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57946&view=rev
> Log:
> Move Print*Pass to use raw_ostream.
nice!
-Chris
From sabre at nondot.org Tue Oct 21 23:09:39 2008
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 22 Oct 2008 04:09:39 -0000
Subject: [llvm-commits] [test-suite] r57950 -
/test-suite/trunk/External/SPEC/CFP2000/188.ammp/Makefile
Message-ID: <200810220409.m9M49dQ9010197@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Oct 21 23:09:39 2008
New Revision: 57950
URL: http://llvm.org/viewvc/llvm-project?rev=57950&view=rev
Log:
Specify the FP tolerance that SPEC uses. This fixes PR2891 by allowing
the CBE to produce a slightly different result than GCC due to awesome
x87 numerical precision fu.
Modified:
test-suite/trunk/External/SPEC/CFP2000/188.ammp/Makefile
Modified: test-suite/trunk/External/SPEC/CFP2000/188.ammp/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CFP2000/188.ammp/Makefile?rev=57950&r1=57949&r2=57950&view=diff
==============================================================================
--- test-suite/trunk/External/SPEC/CFP2000/188.ammp/Makefile (original)
+++ test-suite/trunk/External/SPEC/CFP2000/188.ammp/Makefile Tue Oct 21 23:09:39 2008
@@ -5,6 +5,9 @@
STDOUT_FILENAME = ammp.out
CPPFLAGS =
+FP_ABSTOLERANCE=0.0001
+FP_TOLERANCE=0.003
+
# override RUN_TYPE (this is a long running test):
ifndef RUN_TYPE
ifdef SMALL_PROBLEM_SIZE
From tonic at nondot.org Tue Oct 21 23:22:16 2008
From: tonic at nondot.org (Tanya Lattner)
Date: Wed, 22 Oct 2008 04:22:16 -0000
Subject: [llvm-commits] [test-suite] r57952 -
/test-suite/branches/release_24/External/SPEC/CFP2000/188.ammp/Makefile
Message-ID: <200810220422.m9M4MH0D010763@zion.cs.uiuc.edu>
Author: tbrethou
Date: Tue Oct 21 23:22:16 2008
New Revision: 57952
URL: http://llvm.org/viewvc/llvm-project?rev=57952&view=rev
Log:
Merge from mainline.
Modified:
test-suite/branches/release_24/External/SPEC/CFP2000/188.ammp/Makefile
Modified: test-suite/branches/release_24/External/SPEC/CFP2000/188.ammp/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_24/External/SPEC/CFP2000/188.ammp/Makefile?rev=57952&r1=57951&r2=57952&view=diff
==============================================================================
--- test-suite/branches/release_24/External/SPEC/CFP2000/188.ammp/Makefile (original)
+++ test-suite/branches/release_24/External/SPEC/CFP2000/188.ammp/Makefile Tue Oct 21 23:22:16 2008
@@ -5,6 +5,9 @@
STDOUT_FILENAME = ammp.out
CPPFLAGS =
+FP_ABSTOLERANCE=0.0001
+FP_TOLERANCE=0.003
+
# override RUN_TYPE (this is a long running test):
ifndef RUN_TYPE
ifdef SMALL_PROBLEM_SIZE
From tonic at nondot.org Tue Oct 21 23:23:59 2008
From: tonic at nondot.org (Tanya Lattner)
Date: Wed, 22 Oct 2008 04:23:59 -0000
Subject: [llvm-commits] [llvm] r57953 -
/llvm/branches/release_24/lib/Transforms/IPO/ExtractGV.cpp
Message-ID: <200810220423.m9M4Nxkr010911@zion.cs.uiuc.edu>
Author: tbrethou
Date: Tue Oct 21 23:23:59 2008
New Revision: 57953
URL: http://llvm.org/viewvc/llvm-project?rev=57953&view=rev
Log:
Merge from mainline
Fix a bug that prevented llvm-extract -delete from working.
Modified:
llvm/branches/release_24/lib/Transforms/IPO/ExtractGV.cpp
Modified: llvm/branches/release_24/lib/Transforms/IPO/ExtractGV.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/lib/Transforms/IPO/ExtractGV.cpp?rev=57953&r1=57952&r2=57953&view=diff
==============================================================================
--- llvm/branches/release_24/lib/Transforms/IPO/ExtractGV.cpp (original)
+++ llvm/branches/release_24/lib/Transforms/IPO/ExtractGV.cpp Tue Oct 21 23:23:59 2008
@@ -52,7 +52,7 @@
bool deleteGV() {
for (std::vector::iterator GI = Named.begin(),
GE = Named.end(); GI != GE; ++GI) {
- if (Function* NamedFunc = dyn_cast(&*GI)) {
+ if (Function* NamedFunc = dyn_cast(*GI)) {
// If we're in relinking mode, set linkage of all internal callees to
// external. This will allow us extract function, and then - link
// everything together
From tonic at nondot.org Tue Oct 21 23:30:56 2008
From: tonic at nondot.org (Tanya Lattner)
Date: Wed, 22 Oct 2008 04:30:56 -0000
Subject: [llvm-commits] [test-suite] r57954 -
/test-suite/branches/release_24/MultiSource/Applications/lua/
Message-ID: <200810220430.m9M4Uu3t011131@zion.cs.uiuc.edu>
Author: tbrethou
Date: Tue Oct 21 23:30:56 2008
New Revision: 57954
URL: http://llvm.org/viewvc/llvm-project?rev=57954&view=rev
Log:
Remove lua from the release.
Removed:
test-suite/branches/release_24/MultiSource/Applications/lua/
From tonic at nondot.org Tue Oct 21 23:35:42 2008
From: tonic at nondot.org (Tanya Lattner)
Date: Wed, 22 Oct 2008 04:35:42 -0000
Subject: [llvm-commits] [llvm] r57955 - in /llvm/branches/release_24:
lib/CodeGen/AsmPrinter/DwarfWriter.cpp
test/DebugInfo/2008-10-17-C++DebugCrash.ll
Message-ID: <200810220435.m9M4Zg5m011274@zion.cs.uiuc.edu>
Author: tbrethou
Date: Tue Oct 21 23:35:41 2008
New Revision: 57955
URL: http://llvm.org/viewvc/llvm-project?rev=57955&view=rev
Log:
Merge from mainline.
Added:
llvm/branches/release_24/test/DebugInfo/2008-10-17-C++DebugCrash.ll
- copied unchanged from r57714, llvm/trunk/test/DebugInfo/2008-10-17-C++DebugCrash.ll
Modified:
llvm/branches/release_24/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Modified: llvm/branches/release_24/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=57955&r1=57954&r2=57955&view=diff
==============================================================================
--- llvm/branches/release_24/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/branches/release_24/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Tue Oct 21 23:35:41 2008
@@ -2060,8 +2060,11 @@
return;
}
}
-
+#if 0
+ // FIXME: This is causing an abort because C++ mangled names are compared
+ // with their unmangled counterparts. See PR2885. Don't do this assert.
assert(0 && "Couldn't find DIE for machine function!");
+#endif
}
/// EmitInitial - Emit initial Dwarf declarations. This is necessary for cc
From sabre at nondot.org Tue Oct 21 23:53:17 2008
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 22 Oct 2008 04:53:17 -0000
Subject: [llvm-commits] [llvm] r57956 - in /llvm/trunk:
lib/Target/CBackend/CBackend.cpp
test/CodeGen/CBackend/2008-10-21-PPCLongDoubleConstant.ll
Message-ID: <200810220453.m9M4rHul011748@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Oct 21 23:53:16 2008
New Revision: 57956
URL: http://llvm.org/viewvc/llvm-project?rev=57956&view=rev
Log:
Fix PR2907 by digging through constant expressions to find FP constants that
are their operands.
Added:
llvm/trunk/test/CodeGen/CBackend/2008-10-21-PPCLongDoubleConstant.ll
Modified:
llvm/trunk/lib/Target/CBackend/CBackend.cpp
Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=57956&r1=57955&r2=57956&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Tue Oct 21 23:53:16 2008
@@ -88,12 +88,15 @@
std::map FPConstantMap;
std::set intrinsicPrototypesAlreadyGenerated;
std::set ByValParams;
+ unsigned FPCounter;
public:
static char ID;
explicit CWriter(raw_ostream &o)
: FunctionPass(&ID), Out(o), IL(0), Mang(0), LI(0),
- TheModule(0), TAsm(0), TD(0) {}
+ TheModule(0), TAsm(0), TD(0) {
+ FPCounter = 0;
+ }
virtual const char *getPassName() const { return "C backend"; }
@@ -181,6 +184,7 @@
void printModuleTypes(const TypeSymbolTable &ST);
void printContainedStructs(const Type *Ty, std::set &);
void printFloatingPointConstants(Function &F);
+ void printFloatingPointConstants(const Constant *C);
void printFunctionSignature(const Function *F, bool Prototype);
void printFunction(Function &);
@@ -834,10 +838,10 @@
static bool isFPCSafeToPrint(const ConstantFP *CFP) {
bool ignored;
// Do long doubles in hex for now.
- if (CFP->getType()!=Type::FloatTy && CFP->getType()!=Type::DoubleTy)
+ if (CFP->getType() != Type::FloatTy && CFP->getType() != Type::DoubleTy)
return false;
APFloat APF = APFloat(CFP->getValueAPF()); // copy
- if (CFP->getType()==Type::FloatTy)
+ if (CFP->getType() == Type::FloatTy)
APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &ignored);
#if HAVE_PRINTF_A && ENABLE_CBE_PRINTF_A
char Buffer[100];
@@ -2029,51 +2033,68 @@
// the precision of the printed form, unless the printed form preserves
// precision.
//
- static unsigned FPCounter = 0;
for (constant_iterator I = constant_begin(&F), E = constant_end(&F);
I != E; ++I)
- if (const ConstantFP *FPC = dyn_cast(*I))
- if (!isFPCSafeToPrint(FPC) && // Do not put in FPConstantMap if safe.
- !FPConstantMap.count(FPC)) {
- FPConstantMap[FPC] = FPCounter; // Number the FP constants
-
- if (FPC->getType() == Type::DoubleTy) {
- double Val = FPC->getValueAPF().convertToDouble();
- uint64_t i = FPC->getValueAPF().bitcastToAPInt().getZExtValue();
- Out << "static const ConstantDoubleTy FPConstant" << FPCounter++
- << " = 0x" << utohexstr(i)
- << "ULL; /* " << Val << " */\n";
- } else if (FPC->getType() == Type::FloatTy) {
- float Val = FPC->getValueAPF().convertToFloat();
- uint32_t i = (uint32_t)FPC->getValueAPF().bitcastToAPInt().
- getZExtValue();
- Out << "static const ConstantFloatTy FPConstant" << FPCounter++
- << " = 0x" << utohexstr(i)
- << "U; /* " << Val << " */\n";
- } else if (FPC->getType() == Type::X86_FP80Ty) {
- // api needed to prevent premature destruction
- APInt api = FPC->getValueAPF().bitcastToAPInt();
- const uint64_t *p = api.getRawData();
- Out << "static const ConstantFP80Ty FPConstant" << FPCounter++
- << " = { 0x"
- << utohexstr((uint16_t)p[1] | (p[0] & 0xffffffffffffLL)<<16)
- << "ULL, 0x" << utohexstr((uint16_t)(p[0] >> 48)) << ",{0,0,0}"
- << "}; /* Long double constant */\n";
- } else if (FPC->getType() == Type::PPC_FP128Ty) {
- APInt api = FPC->getValueAPF().bitcastToAPInt();
- const uint64_t *p = api.getRawData();
- Out << "static const ConstantFP128Ty FPConstant" << FPCounter++
- << " = { 0x"
- << utohexstr(p[0]) << ", 0x" << utohexstr(p[1])
- << "}; /* Long double constant */\n";
-
- } else
- assert(0 && "Unknown float type!");
- }
+ printFloatingPointConstants(*I);
Out << '\n';
}
+void CWriter::printFloatingPointConstants(const Constant *C) {
+ // If this is a constant expression, recursively check for constant fp values.
+ if (const ConstantExpr *CE = dyn_cast(C)) {
+ for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i)
+ printFloatingPointConstants(CE->getOperand(i));
+ return;
+ }
+
+ // Otherwise, check for a FP constant that we need to print.
+ const ConstantFP *FPC = dyn_cast(C);
+ if (FPC == 0 ||
+ // Do not put in FPConstantMap if safe.
+ isFPCSafeToPrint(FPC) ||
+ // Already printed this constant?
+ FPConstantMap.count(FPC))
+ return;
+
+ FPConstantMap[FPC] = FPCounter; // Number the FP constants
+
+ if (FPC->getType() == Type::DoubleTy) {
+ double Val = FPC->getValueAPF().convertToDouble();
+ uint64_t i = FPC->getValueAPF().bitcastToAPInt().getZExtValue();
+ Out << "static const ConstantDoubleTy FPConstant" << FPCounter++
+ << " = 0x" << utohexstr(i)
+ << "ULL; /* " << Val << " */\n";
+ } else if (FPC->getType() == Type::FloatTy) {
+ float Val = FPC->getValueAPF().convertToFloat();
+ uint32_t i = (uint32_t)FPC->getValueAPF().bitcastToAPInt().
+ getZExtValue();
+ Out << "static const ConstantFloatTy FPConstant" << FPCounter++
+ << " = 0x" << utohexstr(i)
+ << "U; /* " << Val << " */\n";
+ } else if (FPC->getType() == Type::X86_FP80Ty) {
+ // api needed to prevent premature destruction
+ APInt api = FPC->getValueAPF().bitcastToAPInt();
+ const uint64_t *p = api.getRawData();
+ Out << "static const ConstantFP80Ty FPConstant" << FPCounter++
+ << " = { 0x"
+ << utohexstr((uint16_t)p[1] | (p[0] & 0xffffffffffffLL)<<16)
+ << "ULL, 0x" << utohexstr((uint16_t)(p[0] >> 48)) << ",{0,0,0}"
+ << "}; /* Long double constant */\n";
+ } else if (FPC->getType() == Type::PPC_FP128Ty) {
+ APInt api = FPC->getValueAPF().bitcastToAPInt();
+ const uint64_t *p = api.getRawData();
+ Out << "static const ConstantFP128Ty FPConstant" << FPCounter++
+ << " = { 0x"
+ << utohexstr(p[0]) << ", 0x" << utohexstr(p[1])
+ << "}; /* Long double constant */\n";
+
+ } else {
+ assert(0 && "Unknown float type!");
+ }
+}
+
+
/// printSymbolTable - Run through symbol table looking for type names. If a
/// type name is found, emit its declaration...
Added: llvm/trunk/test/CodeGen/CBackend/2008-10-21-PPCLongDoubleConstant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2008-10-21-PPCLongDoubleConstant.ll?rev=57956&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/CBackend/2008-10-21-PPCLongDoubleConstant.ll (added)
+++ llvm/trunk/test/CodeGen/CBackend/2008-10-21-PPCLongDoubleConstant.ll Tue Oct 21 23:53:16 2008
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | llc -march=c
+; PR2907
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
+target triple = "powerpc-apple-darwin9.5"
+ %"struct.Point<0>" = type { %"struct.Tensor<1,0>" }
+ %"struct.QGauss2<1>" = type { %"struct.Quadrature<0>" }
+ %"struct.Quadrature<0>" = type { %struct.Subscriptor, i32, %"struct.std::vector,std::allocator > >", %"struct.std::vector >" }
+ %struct.Subscriptor = type { i32 (...)**, i32, %"struct.std::type_info"* }
+ %"struct.Tensor<1,0>" = type { [1 x double] }
+ %"struct.std::_Vector_base,std::allocator > >" = type { %"struct.std::_Vector_base,std::allocator > >::_Vector_impl" }
+ %"struct.std::_Vector_base