From alenhar2 at cs.uiuc.edu Mon Sep 25 09:05:07 2006
From: alenhar2 at cs.uiuc.edu (Andrew Lenharth)
Date: Mon, 25 Sep 2006 09:05:07 -0500
Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll
Message-ID: <200609251405.k8PE572a028756@zion.cs.uiuc.edu>
Changes in directory llvm/test/Regression/CodeGen/Alpha:
jmp_table.ll updated: 1.1 -> 1.2
---
Log message:
Fix
---
Diffs of the changes: (+2 -2)
jmp_table.ll | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll
diff -u llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.1 llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.2
--- llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.1 Sun Sep 24 14:42:02 2006
+++ llvm/test/Regression/CodeGen/Alpha/jmp_table.ll Mon Sep 25 09:04:53 2006
@@ -1,6 +1,6 @@
; try to check that we have the most important instructions, which shouldn't appear otherwise
-; RUN: llvm-as < %s | llc -march=alpha | grep 'jmp'
-; RUN: llvm-as < %s | llc -march=alpha | grep 'gprel32'
+; RUN: llvm-as < %s | llc -march=alpha | grep 'jmp' &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 'gprel32' &&
; RUN: llvm-as < %s | llc -march=alpha | grep 'ldl'
target endian = little
From jlaskey at apple.com Mon Sep 25 11:30:08 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Mon, 25 Sep 2006 11:30:08 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200609251630.k8PGU82o031121@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.197 -> 1.198
---
Log message:
Core antialiasing for load and store.
---
Diffs of the changes: (+282 -53)
DAGCombiner.cpp | 335 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 282 insertions(+), 53 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.197 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.198
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.197 Thu Sep 21 14:04:05 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Sep 25 11:29:54 2006
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
using namespace llvm;
namespace {
@@ -132,7 +133,8 @@
// Replace the old value with the new one.
++NodesCombined;
DEBUG(std::cerr << "\nReplacing "; TLO.Old.Val->dump();
- std::cerr << "\nWith: "; TLO.New.Val->dump(&DAG));
+ std::cerr << "\nWith: "; TLO.New.Val->dump(&DAG);
+ std::cerr << '\n');
std::vector NowDead;
DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, NowDead);
@@ -237,7 +239,31 @@
SDOperand BuildSDIV(SDNode *N);
SDOperand BuildUDIV(SDNode *N);
SDNode *MatchRotate(SDOperand LHS, SDOperand RHS);
- bool isNotAlias(SDOperand Ptr1, SDOperand Ptr2);
+
+ /// FindBaseOffset - Return true if we can determine base and offset
+ /// information from a given pointer operand. Provides base and offset as a
+ /// result.
+ static bool FindBaseOffset(SDOperand Ptr,
+ SDOperand &Object, int64_t &Offset);
+
+ /// isAlias - Return true if there is the possibility that the two addresses
+ /// overlap.
+ static bool isAlias(SDOperand Ptr1, int64_t Size1, SDOperand SrcValue1,
+ SDOperand Ptr2, int64_t Size2, SDOperand SrcValue2);
+
+ /// FindAliasInfo - Extracts the relevant alias information from the memory
+ /// node.
+ static void FindAliasInfo(SDNode *N,
+ SDOperand &Ptr, int64_t &Size, SDOperand &SrcValue);
+
+ /// hasChain - Return true if Op has a chain. Provides chain if present.
+ ///
+ static bool hasChain(SDOperand Op, SDOperand &Chain);
+
+ /// FindBetterChain - Walk up chain skipping non-aliasing memory nodes,
+ /// looking for a better chain.
+ SDOperand FindBetterChain(SDNode *N, SDOperand Chain);
+
public:
DAGCombiner(SelectionDAG &D)
: DAG(D), TLI(D.getTargetLoweringInfo()), AfterLegalize(false) {}
@@ -507,9 +533,6 @@
}
SDOperand DAGCombiner::visitTokenFactor(SDNode *N) {
- SmallVector Ops;
- bool Changed = false;
-
// If the token factor has two operands and one is the entry token, replace
// the token factor with the other operand.
if (N->getNumOperands() == 2) {
@@ -520,23 +543,69 @@
return N->getOperand(0);
}
- // fold (tokenfactor (tokenfactor)) -> tokenfactor
- for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
+ SmallVector TFs; // Set of token factor nodes.
+ SmallVector Ops; // Ops for replacing token factor.
+
+ // Add this ndoe to the token factor set.
+ TFs.push_back(N);
+
+ // Separate token factors from other operands.
+ for (unsigned i = 0, ie = N->getNumOperands(); i != ie; ++i) {
SDOperand Op = N->getOperand(i);
- if (Op.getOpcode() == ISD::TokenFactor && Op.hasOneUse()) {
- AddToWorkList(Op.Val); // Remove dead node.
- Changed = true;
- for (unsigned j = 0, e = Op.getNumOperands(); j != e; ++j)
- Ops.push_back(Op.getOperand(j));
- } else if (i == 0 || N->getOperand(i) != N->getOperand(i-1)) {
+ if (Op.getOpcode() == ISD::TokenFactor)
+ TFs.push_back(Op.Val);
+ else if (Op.getOpcode() != ISD::EntryToken)
Ops.push_back(Op);
- } else {
- // Deleted an operand that was the same as the last one.
- Changed = true;
+ }
+
+ // If there are token factor operands.
+ if (TFs.size() > 1) {
+ bool Changed = false; // If we should replace this token factor.
+
+ // For each token factor.
+ for (unsigned j = 1, je = TFs.size(); j != je; ++j) {
+ SDNode *TF = TFs[j];
+ bool CanMerge = true; // Can we merge this token factor.
+
+ if (CombinerAA) {
+ if (!TF->hasOneUse()) {
+ // Check to see if all users point to members of the token factor set.
+ for (SDNode::use_iterator UI = TF->use_begin(), UE = TF->use_end();
+ CanMerge && UI != UE; ++UI) {
+ SDNode *User = *UI;
+ CanMerge = User->getOpcode() == ISD::TokenFactor &&
+ std::find(TFs.begin(), TFs.end(), User) != TFs.end();
+ }
+ }
+ } else {
+ CanMerge = TF->hasOneUse();
+ }
+
+ // If it's valid to merge.
+ if (CanMerge) {
+ // Remove dead token factor node.
+ AddToWorkList(TF);
+
+ // Make sure we don't duplicate operands.
+ unsigned m = Ops.size(); // Number of prior operands.
+ for (unsigned l = 0, le = TF->getNumOperands(); l != le; ++l) {
+ SDOperand Op = TF->getOperand(l);
+ if (std::find(Ops.begin(), Ops.end(), Op) == Ops.end())
+ Ops.push_back(Op);
+ }
+ Changed = true;
+ } else {
+ // Can't merge this token factor.
+ Ops.push_back(SDOperand(TF, 0));
+ }
+ }
+
+ // If we've change things around then replace token factor.
+ if (Changed) {
+ return DAG.getNode(ISD::TokenFactor, MVT::Other, &Ops[0], Ops.size());
}
}
- if (Changed)
- return DAG.getNode(ISD::TokenFactor, MVT::Other, &Ops[0], Ops.size());
+
return SDOperand();
}
@@ -2571,6 +2640,27 @@
Chain.getOperand(1).getValueType() == N->getValueType(0))
return CombineTo(N, Chain.getOperand(1), Chain);
+ if (CombinerAA) {
+ // Walk up chain skipping non-aliasing memory nodes.
+ SDOperand BetterChain = FindBetterChain(N, Chain);
+
+ // If the there is a better chain.
+ if (Chain != BetterChain) {
+ // Replace the chain to void dependency.
+ SDOperand ReplLoad = DAG.getLoad(N->getValueType(0), BetterChain, Ptr,
+ SrcValue);
+
+ // Replace uses with token.
+ CombineTo(N, ReplLoad.getValue(0), ReplLoad.getValue(1));
+
+ // Old chain needs to be cleaned up.
+ AddToWorkList(Chain.Val);
+
+ // Don't recombine on token.
+ return SDOperand(N, 0);
+ }
+ }
+
return SDOperand();
}
@@ -2589,27 +2679,6 @@
return SDOperand();
}
-/// isNotAlias - Return true if we have definitive knowlege that the two
-/// addresses don't overlap.
-bool DAGCombiner::isNotAlias(SDOperand Ptr1, SDOperand Ptr2) {
- // Mind the flag.
- if (!CombinerAA) return false;
-
- // If they are the same then they must be aliases.
- if (Ptr1 == Ptr2) return false;
-
- // If both operands are frame values (not the same location from above test)
- // then they can't alias.
- FrameIndexSDNode *FI1 = dyn_cast(Ptr1);
- FrameIndexSDNode *FI2 = dyn_cast(Ptr2);
- if (FI1 && FI2) {
- return true;
- }
-
- // Otherwise we don't know and have to play it safe.
- return false;
-}
-
SDOperand DAGCombiner::visitSTORE(SDNode *N) {
SDOperand Chain = N->getOperand(0);
SDOperand Value = N->getOperand(1);
@@ -2637,22 +2706,33 @@
// If this is a store of a bit convert, store the input value.
// FIXME: This needs to know that the resultant store does not need a
// higher alignment than the original.
- if (0 && Value.getOpcode() == ISD::BIT_CONVERT)
+ if (Value.getOpcode() == ISD::BIT_CONVERT) {
return DAG.getNode(ISD::STORE, MVT::Other, Chain, Value.getOperand(0),
Ptr, SrcValue);
-
- // If the previous store is not an alias then break artificial chain.
- if (Chain.getOpcode() == ISD::STORE && isNotAlias(Ptr, Chain.getOperand(2))) {
- // Replace the chain to void dependency.
- SDNode *PrevStore = Chain.Val;
- SDOperand ReplStore = DAG.getNode(ISD::STORE, MVT::Other,
- PrevStore->getOperand(0), Value, Ptr,
- SrcValue);
- // Create token to keep both stores around.
- SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other,
- Chain, ReplStore);
- // Replace uses with token.
- return Token;
+ }
+
+ if (CombinerAA) {
+ // Walk up chain skipping non-aliasing memory nodes.
+ SDOperand BetterChain = FindBetterChain(N, Chain);
+
+ // If the there is a better chain.
+ if (Chain != BetterChain) {
+ // Replace the chain to void dependency.
+ SDOperand ReplStore = DAG.getNode(ISD::STORE, MVT::Other,
+ BetterChain, Value, Ptr,
+ SrcValue);
+ // Create token to keep both nodes around.
+ SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other,
+ Chain, ReplStore);
+
+ // Make sure we merge token factors.
+ AddUsersToWorkList(N);
+
+ // Old chain needs to be cleaned up.
+ AddToWorkList(Chain.Val);
+
+ return Token;
+ }
}
return SDOperand();
@@ -3860,6 +3940,155 @@
return S;
}
+/// FindBaseOffset - Return true if we can determine base and offset information
+/// from a given pointer operand. Provides base and offset as a result.
+bool DAGCombiner::FindBaseOffset(SDOperand Ptr,
+ SDOperand &Object, int64_t &Offset) {
+
+ // Is it a frame variable, global or constant.
+ if (isa(Ptr) ||
+ isa(Ptr) ||
+ isa(Ptr)) {
+ Object = Ptr; Offset = 0;
+ return true;
+ } else if (Ptr.getOpcode() == ISD::ADD &&
+ FindBaseOffset(Ptr.getOperand(0), Object, Offset)) {
+ // If it's an add of an simple constant then include it in the offset.
+ if (ConstantSDNode *C = dyn_cast(Ptr.getOperand(1))) {
+ Offset += C->getValue();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/// isAlias - Return true if there is the possibility that the two addresses
+/// overlap.
+bool DAGCombiner::isAlias(SDOperand Ptr1, int64_t Size1,
+ SDOperand SrcValue1,
+ SDOperand Ptr2, int64_t Size2,
+ SDOperand SrcValue2) {
+ // If they are the same then they must be aliases.
+ if (Ptr1 == Ptr2) return true;
+
+ // Gather base offset information. Objects can be frame variables, globals
+ // or constants.
+ SDOperand Object1, Object2;
+ int64_t Offset1, Offset2;
+ if (FindBaseOffset(Ptr1, Object1, Offset1) &&
+ FindBaseOffset(Ptr2, Object2, Offset2)) {
+ // If they have a different base address, then they can't alias.
+ if (Object1 != Object2) return false;
+
+ // Check to see if the addresses overlap.
+ if ((Offset1 + Size1) <= Offset2 || (Offset2 + Size2) <= Offset1)
+ return false;
+ }
+
+ // Otherwise we don't know and have to play it safe.
+ return true;
+}
+
+/// FindAliasInfo - Extracts the relevant alias information from the memory
+/// node.
+void DAGCombiner::FindAliasInfo(SDNode *N,
+ SDOperand &Ptr, int64_t &Size, SDOperand &SrcValue) {
+ switch (N->getOpcode()) {
+ case ISD::LOAD:
+ Ptr = N->getOperand(1);
+ Size = MVT::getSizeInBits(N->getOperand(1).getValueType()) >> 3;
+ SrcValue = N->getOperand(2);
+ break;
+ case ISD::STORE:
+ Ptr = N->getOperand(2);
+ Size = MVT::getSizeInBits(N->getOperand(1).getValueType()) >> 3;
+ SrcValue = N->getOperand(3);
+ break;
+ default:
+ assert(0 && "getAliasInfo expected a memory op");
+ }
+}
+
+/// hasChain - Return true if Op has a chain. Provides chain if present.
+///
+bool DAGCombiner::hasChain(SDOperand Op, SDOperand &Chain) {
+ if (Op.getNumOperands() == 0) return false;
+ Chain = Op.getOperand(0);
+ return Chain.getValueType() == MVT::Other;
+}
+
+/// FindBetterChain - Walk up chain skipping non-aliasing memory nodes, looking
+/// for a better chain.
+SDOperand DAGCombiner::FindBetterChain(SDNode *N, SDOperand Chain) {
+ // Get alias information for node.
+ SDOperand Ptr;
+ int64_t Size;
+ SDOperand SrcValue;
+ FindAliasInfo(N, Ptr, Size, SrcValue);
+
+ // While we don't encounter any aliasing memory nodes walk up chain.
+ while (true) {
+ switch (Chain.getOpcode()) {
+ case ISD::EntryToken:
+ // Entry token is ideal chain operand.
+ return Chain;
+ case ISD::LOAD:
+ case ISD::STORE: {
+ // Get alias information for chain.
+ SDOperand ChainPtr;
+ int64_t ChainSize;
+ SDOperand ChainSrcValue;
+ FindAliasInfo(Chain.Val, ChainPtr, ChainSize, ChainSrcValue);
+
+ // If chain is alias then stop here, otherwise continue up chain.
+ if (isAlias(Ptr, Size, SrcValue, ChainPtr, ChainSize, ChainSrcValue))
+ return Chain;
+ else
+ Chain = Chain.getOperand(0);
+
+ break;
+ }
+ case ISD::TokenFactor: {
+ // Continue up each of token factor operand and accumulate results in
+ // a new token factor. CSE will handle duplicate elimination.
+ SmallVector Ops; // Ops for replacing token factor.
+ bool Change = false;
+
+ // For each token factor operand.
+ for (unsigned i = 0, e = Chain.getNumOperands(); i != e; ++i) {
+ SDOperand Op = Chain.getOperand(i);
+ SDOperand OpChain = FindBetterChain(N, Op);
+
+ // Make sure we don't duplicate an operand.
+ if (OpChain.getOpcode() != ISD::EntryToken &&
+ std::find(Ops.begin(), Ops.end(), OpChain) == Ops.end()) {
+ Ops.push_back(OpChain);
+ }
+
+ // If we added a new operand.
+ Change = Change || Op != OpChain;
+ }
+
+ // If we have new operands.
+ if (Change) {
+ // Create a specialized token factor for this chain. getNode CSE will
+ // handle duplicates. If it's a single operand, getNode will just
+ // return the opernand instead of a new token factor.
+ return DAG.getNode(ISD::TokenFactor, MVT::Other, &Ops[0], Ops.size());
+ }
+
+ // Leave things alone.
+ return Chain;
+ }
+ // For all other instructions we will just have to take what we can get.
+ default: return Chain;
+ }
+ }
+
+ return Chain;
+}
+
// SelectionDAG::Combine - This is the entry point for the file.
//
void SelectionDAG::Combine(bool RunningAfterLegalize) {
From sabre at nondot.org Mon Sep 25 12:12:28 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 12:12:28 -0500
Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt
Message-ID: <200609251712.k8PHCSB0031965@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Target:
README.txt updated: 1.40 -> 1.41
---
Log message:
more notes
---
Diffs of the changes: (+22 -0)
README.txt | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+)
Index: llvm/lib/Target/README.txt
diff -u llvm/lib/Target/README.txt:1.40 llvm/lib/Target/README.txt:1.41
--- llvm/lib/Target/README.txt:1.40 Tue Sep 19 01:19:03 2006
+++ llvm/lib/Target/README.txt Mon Sep 25 12:12:14 2006
@@ -264,3 +264,25 @@
alas...
//===---------------------------------------------------------------------===//
+
+This isn't recognized as bswap by instcombine:
+
+unsigned int swap_32(unsigned int v) {
+ v = ((v & 0x00ff00ffU) << 8) | ((v & 0xff00ff00U) >> 8);
+ v = ((v & 0x0000ffffU) << 16) | ((v & 0xffff0000U) >> 16);
+ return v;
+}
+
+//===---------------------------------------------------------------------===//
+
+These should turn into single 16-bit (unaligned?) loads on little/big endian
+processors.
+
+unsigned short read_16_le(const unsigned char *adr) {
+ return adr[0] | (adr[1] << 8);
+}
+unsigned short read_16_be(const unsigned char *adr) {
+ return (adr[0] << 8) | adr[1];
+}
+
+//===---------------------------------------------------------------------===//
From criswell at cs.uiuc.edu Mon Sep 25 13:12:10 2006
From: criswell at cs.uiuc.edu (John Criswell)
Date: Mon, 25 Sep 2006 13:12:10 -0500
Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-out.c
Message-ID: <200609251812.NAA31236@choi.cs.uiuc.edu>
Changes in directory llvm-gcc/gcc:
llvm-out.c updated: 1.10 -> 1.11
---
Log message:
Fix for PR#922.
Do not re-assign the input locations when expanding statements; the
original GCC code does not do this, and removing this statement generates
correct filename output for LLVM debugging intrinsics.
---
Diffs of the changes: (+0 -1)
llvm-out.c | 1 -
1 files changed, 1 deletion(-)
Index: llvm-gcc/gcc/llvm-out.c
diff -u llvm-gcc/gcc/llvm-out.c:1.10 llvm-gcc/gcc/llvm-out.c:1.11
--- llvm-gcc/gcc/llvm-out.c:1.10 Wed Dec 1 01:09:25 2004
+++ llvm-gcc/gcc/llvm-out.c Mon Sep 25 13:11:43 2006
@@ -136,7 +136,6 @@
assert(nested_p == 0 && "Does not handle nested functions yet!");
current_function_decl = fndecl;
- input_location = DECL_SOURCE_LOCATION (fndecl);
/* Warn if this value is an aggregate type,
regardless of which calling convention we are using for it. */
From criswell at cs.uiuc.edu Mon Sep 25 14:12:27 2006
From: criswell at cs.uiuc.edu (John Criswell)
Date: Mon, 25 Sep 2006 14:12:27 -0500
Subject: [llvm-commits] CVS:
llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr
2006-09-25-DebugFilename.h
Message-ID: <200609251912.OAA04493@choi.cs.uiuc.edu>
Changes in directory llvm/test/Regression/CFrontend:
2006-09-25-DebugFilename.c.tr added (r1.1)
2006-09-25-DebugFilename.h added (r1.1)
---
Log message:
Regression test for PR#922.
---
Diffs of the changes: (+11 -0)
2006-09-25-DebugFilename.c.tr | 5 +++++
2006-09-25-DebugFilename.h | 6 ++++++
2 files changed, 11 insertions(+)
Index: llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr
diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr:1.1
*** /dev/null Mon Sep 25 14:12:11 2006
--- llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr Mon Sep 25 14:12:01 2006
***************
*** 0 ****
--- 1,5 ----
+ // RUN: %llvmgcc -xc %s -S -o /dev/null 2>&1 | grep fluffy | grep '2006-09-25-DebugFilename.c.tr'
+ #include "2006-09-25-DebugFilename.h"
+ int func1() { return hfunc1(); }
+ int func2() { fluffy; return hfunc1(); }
+
Index: llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.h
diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.h:1.1
*** /dev/null Mon Sep 25 14:12:27 2006
--- llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.h Mon Sep 25 14:12:01 2006
***************
*** 0 ****
--- 1,6 ----
+ extern int exfunc(int a);
+
+ static inline int hfunc1()
+ {
+ return exfunc(1);
+ }
From jlaskey at apple.com Mon Sep 25 14:33:12 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Mon, 25 Sep 2006 14:33:12 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200609251933.k8PJXCS3001979@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.198 -> 1.199
---
Log message:
Fix chain dropping in load and drop unused stores in ret blocks.
---
Diffs of the changes: (+14 -7)
DAGCombiner.cpp | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.198 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.199
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.198 Mon Sep 25 11:29:54 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Sep 25 14:32:58 2006
@@ -2650,13 +2650,13 @@
SDOperand ReplLoad = DAG.getLoad(N->getValueType(0), BetterChain, Ptr,
SrcValue);
- // Replace uses with token.
- CombineTo(N, ReplLoad.getValue(0), ReplLoad.getValue(1));
-
- // Old chain needs to be cleaned up.
- AddToWorkList(Chain.Val);
-
- // Don't recombine on token.
+ // Create token factor to keep chain around.
+ SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other,
+ Chain, ReplLoad.getValue(1));
+
+ // Replace uses with load and token factor.
+ CombineTo(N, ReplLoad.getValue(0), Token);
+
return SDOperand(N, 0);
}
}
@@ -2712,6 +2712,13 @@
}
if (CombinerAA) {
+ // If the store ptr is a frame index and the frame index has a use of one
+ // and this is a return block, then the store is redundant.
+ if (Ptr.hasOneUse() && isa(Ptr) &&
+ DAG.getRoot().getOpcode() == ISD::RET) {
+ return Chain;
+ }
+
// Walk up chain skipping non-aliasing memory nodes.
SDOperand BetterChain = FindBetterChain(N, Chain);
From jlaskey at apple.com Mon Sep 25 16:11:46 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Mon, 25 Sep 2006 16:11:46 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200609252111.k8PLBk13003831@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.199 -> 1.200
---
Log message:
Accidental enable of bad code
---
Diffs of the changes: (+1 -1)
DAGCombiner.cpp | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.199 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.200
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.199 Mon Sep 25 14:32:58 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Sep 25 16:11:32 2006
@@ -2706,7 +2706,7 @@
// If this is a store of a bit convert, store the input value.
// FIXME: This needs to know that the resultant store does not need a
// higher alignment than the original.
- if (Value.getOpcode() == ISD::BIT_CONVERT) {
+ if (0 && Value.getOpcode() == ISD::BIT_CONVERT) {
return DAG.getNode(ISD::STORE, MVT::Other, Chain, Value.getOperand(0),
Ptr, SrcValue);
}
From sabre at nondot.org Mon Sep 25 17:23:03 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 17:23:03 -0500
Subject: [llvm-commits] CVS: llvm-test/Makefile.tests
Message-ID: <200609252223.k8PMN3OG004988@zion.cs.uiuc.edu>
Changes in directory llvm-test:
Makefile.tests updated: 1.8 -> 1.9
---
Log message:
Make llvm-test results more closely match the performance a person would get
by running llvm-gcc -O4. In particular, do not run the compile-time optimizer
both within llvm-gcc and as a separate gccas invocation.
---
Diffs of the changes: (+4 -4)
Makefile.tests | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
Index: llvm-test/Makefile.tests
diff -u llvm-test/Makefile.tests:1.8 llvm-test/Makefile.tests:1.9
--- llvm-test/Makefile.tests:1.8 Tue Jun 6 19:05:16 2006
+++ llvm-test/Makefile.tests Mon Sep 25 17:22:49 2006
@@ -50,19 +50,19 @@
# Compile from X.c to Output/X.ll
Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
- -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) $(TARGET_FLAGS) -S $< -o $@ -emit-llvm
+ -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ -emit-llvm
# Compile from X.cpp to Output/X.ll
Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
- -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -S $< -o $@ -emit-llvm
+ -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ -emit-llvm
# Compile from X.cc to Output/X.ll
Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
- -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -S $< -o $@ -emit-llvm
+ -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ -emit-llvm
# Compile from X.C to Output/X.ll
Output/%.ll: %.C $(LCC1XX) Output/.dir $(INCLUDES)
- -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -S $< -o $@ -emit-llvm
+ -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ -emit-llvm
# LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
# from GCC output, so use GCCAS.
From sabre at nondot.org Mon Sep 25 17:38:50 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 17:38:50 -0500
Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h
Message-ID: <200609252238.k8PMcoxi005353@zion.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Target:
TargetAsmInfo.h updated: 1.3 -> 1.4
---
Log message:
order this properly to avoid warnings in TargetAsmInfo.cpp. Add a comment
in a format that matches every other ivars in this class.
---
Diffs of the changes: (+4 -1)
TargetAsmInfo.h | 5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)
Index: llvm/include/llvm/Target/TargetAsmInfo.h
diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.3 llvm/include/llvm/Target/TargetAsmInfo.h:1.4
--- llvm/include/llvm/Target/TargetAsmInfo.h:1.3 Sun Sep 24 14:43:29 2006
+++ llvm/include/llvm/Target/TargetAsmInfo.h Mon Sep 25 17:38:36 2006
@@ -108,7 +108,6 @@
const char *Data16bitsDirective; // Defaults to "\t.short\t"
const char *Data32bitsDirective; // Defaults to "\t.long\t"
const char *Data64bitsDirective; // Defaults to "\t.quad\t"
- const char *JumpTableDirective; // if used, the jump table reloc flag
//===--- Alignment Information ----------------------------------------===//
@@ -156,6 +155,10 @@
/// is PIC.
const char *JumpTableTextSection; // Defaults to "\t.text\n"
+ /// JumpTableDirective - if non-null, the directive to emit before a jump
+ /// table.
+ const char *JumpTableDirective;
+
/// StaticCtorsSection - This is the directive that is emitted to switch to
/// a section to emit the static constructor list.
/// Defaults to "\t.section .ctors,\"aw\", at progbits".
From sabre at nondot.org Mon Sep 25 22:38:36 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 22:38:36 -0500
Subject: [llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp
Message-ID: <200609260338.k8Q3caje010005@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Target:
TargetAsmInfo.cpp updated: 1.3 -> 1.4
---
Log message:
Add support for targets that want to do something with the llvm.used list,
because they have an aggressive linker that does dead code stripping.
---
Diffs of the changes: (+1 -0)
TargetAsmInfo.cpp | 1 +
1 files changed, 1 insertion(+)
Index: llvm/lib/Target/TargetAsmInfo.cpp
diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.3 llvm/lib/Target/TargetAsmInfo.cpp:1.4
--- llvm/lib/Target/TargetAsmInfo.cpp:1.3 Sun Sep 24 14:45:58 2006
+++ llvm/lib/Target/TargetAsmInfo.cpp Mon Sep 25 22:38:18 2006
@@ -58,6 +58,7 @@
COMMDirective("\t.comm\t"),
COMMDirectiveTakesAlignment(true),
HasDotTypeDotSizeDirective(true),
+ UsedDirective(0),
HasLEB128(false),
HasDotLoc(false),
HasDotFile(false),
From sabre at nondot.org Mon Sep 25 22:38:36 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 22:38:36 -0500
Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h
Message-ID: <200609260338.k8Q3caOf010010@zion.cs.uiuc.edu>
Changes in directory llvm/include/llvm/CodeGen:
AsmPrinter.h updated: 1.48 -> 1.49
---
Log message:
Add support for targets that want to do something with the llvm.used list,
because they have an aggressive linker that does dead code stripping.
---
Diffs of the changes: (+1 -0)
AsmPrinter.h | 1 +
1 files changed, 1 insertion(+)
Index: llvm/include/llvm/CodeGen/AsmPrinter.h
diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.48 llvm/include/llvm/CodeGen/AsmPrinter.h:1.49
--- llvm/include/llvm/CodeGen/AsmPrinter.h:1.48 Tue Sep 12 15:59:22 2006
+++ llvm/include/llvm/CodeGen/AsmPrinter.h Mon Sep 25 22:38:18 2006
@@ -197,6 +197,7 @@
void printDataDirective(const Type *type);
private:
+ void EmitLLVMUsedList(Constant *List);
void EmitXXStructorList(Constant *List);
void EmitConstantPool(unsigned Alignment, const char *Section,
std::vector > &CP);
From sabre at nondot.org Mon Sep 25 22:38:38 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 22:38:38 -0500
Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h
Message-ID: <200609260338.k8Q3cc8J010020@zion.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Target:
TargetAsmInfo.h updated: 1.4 -> 1.5
---
Log message:
Add support for targets that want to do something with the llvm.used list,
because they have an aggressive linker that does dead code stripping.
---
Diffs of the changes: (+8 -0)
TargetAsmInfo.h | 8 ++++++++
1 files changed, 8 insertions(+)
Index: llvm/include/llvm/Target/TargetAsmInfo.h
diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.4 llvm/include/llvm/Target/TargetAsmInfo.h:1.5
--- llvm/include/llvm/Target/TargetAsmInfo.h:1.4 Mon Sep 25 17:38:36 2006
+++ llvm/include/llvm/Target/TargetAsmInfo.h Mon Sep 25 22:38:18 2006
@@ -199,6 +199,11 @@
/// directives, this is true for most ELF targets.
bool HasDotTypeDotSizeDirective; // Defaults to true.
+ /// UsedDirective - This directive, if non-null, is used to declare a global
+ /// as being used somehow that the assembler can't see. This prevents dead
+ /// code elimination on some targets.
+ const char *UsedDirective; // Defaults to null.
+
//===--- Dwarf Emission Directives -----------------------------------===//
/// HasLEB128 - True if target asm supports leb128 directives.
@@ -387,6 +392,9 @@
bool hasDotTypeDotSizeDirective() const {
return HasDotTypeDotSizeDirective;
}
+ const char *getUsedDirective() const {
+ return UsedDirective;
+ }
bool hasLEB128() const {
return HasLEB128;
}
From sabre at nondot.org Mon Sep 25 22:38:37 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 22:38:37 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Message-ID: <200609260338.k8Q3cbeM010015@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.98 -> 1.99
---
Log message:
Add support for targets that want to do something with the llvm.used list,
because they have an aggressive linker that does dead code stripping.
---
Diffs of the changes: (+21 -2)
AsmPrinter.cpp | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.98 llvm/lib/CodeGen/AsmPrinter.cpp:1.99
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.98 Sun Sep 24 14:44:59 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Sep 25 22:38:18 2006
@@ -253,8 +253,11 @@
assert(GV->hasInitializer() && "Not a special LLVM global!");
- if (GV->getName() == "llvm.used")
- return true; // No need to emit this at all.
+ if (GV->getName() == "llvm.used") {
+ if (TAI->getUsedDirective() != 0) // No need to emit this at all.
+ EmitLLVMUsedList(GV->getInitializer());
+ return true;
+ }
if (GV->getName() == "llvm.global_ctors" && GV->use_empty()) {
SwitchToDataSection(TAI->getStaticCtorsSection(), 0);
@@ -273,6 +276,22 @@
return false;
}
+/// EmitLLVMUsedList - For targets that define a TAI::UsedDirective, mark each
+/// global in the specified llvm.used list as being used with this directive.
+void AsmPrinter::EmitLLVMUsedList(Constant *List) {
+ const char *Directive = TAI->getUsedDirective();
+
+ // Should be an array of 'sbyte*'.
+ ConstantArray *InitList = dyn_cast(List);
+ if (InitList == 0) return;
+
+ for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
+ O << Directive;
+ EmitConstantValueOnly(InitList->getOperand(i));
+ O << "\n";
+ }
+}
+
/// EmitXXStructorList - Emit the ctor or dtor list. This just prints out the
/// function pointers, ignoring the init priority.
void AsmPrinter::EmitXXStructorList(Constant *List) {
From sabre at nondot.org Mon Sep 25 22:40:07 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 22:40:07 -0500
Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
Message-ID: <200609260340.k8Q3e7Ac010099@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Target/PowerPC:
PPCTargetAsmInfo.cpp updated: 1.2 -> 1.3
---
Log message:
Compile:
int x __attribute__((used));
to:
.data
.comm _x,4 ; 'x'
.no_dead_strip _x
on both x86 and ppc darwin targets.
---
Diffs of the changes: (+1 -0)
PPCTargetAsmInfo.cpp | 1 +
1 files changed, 1 insertion(+)
Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.2 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.3
--- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.2 Fri Sep 8 08:06:56 2006
+++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Mon Sep 25 22:39:53 2006
@@ -32,6 +32,7 @@
LCOMMDirective = "\t.lcomm\t";
StaticCtorsSection = ".mod_init_func";
StaticDtorsSection = ".mod_term_func";
+ UsedDirective = "\t.no_dead_strip\t";
InlineAsmStart = "# InlineAsm Start";
InlineAsmEnd = "# InlineAsm End";
From sabre at nondot.org Mon Sep 25 22:40:08 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 22:40:08 -0500
Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
Message-ID: <200609260340.k8Q3e8JX010104@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Target/X86:
X86TargetAsmInfo.cpp updated: 1.2 -> 1.3
---
Log message:
Compile:
int x __attribute__((used));
to:
.data
.comm _x,4 ; 'x'
.no_dead_strip _x
on both x86 and ppc darwin targets.
---
Diffs of the changes: (+1 -0)
X86TargetAsmInfo.cpp | 1 +
1 files changed, 1 insertion(+)
Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.2 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.3
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.2 Fri Sep 8 01:48:29 2006
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp Mon Sep 25 22:39:53 2006
@@ -44,6 +44,7 @@
InlineAsmStart = "# InlineAsm Start";
InlineAsmEnd = "# InlineAsm End";
SetDirective = "\t.set";
+ UsedDirective = "\t.no_dead_strip\t";
NeedsSet = true;
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
From sabre at nondot.org Mon Sep 25 22:42:14 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 22:42:14 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineBasicBlock.cpp
Message-ID: <200609260342.k8Q3gESx010179@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
MachineBasicBlock.cpp updated: 1.28 -> 1.29
---
Log message:
print the preds of each MBB
---
Diffs of the changes: (+8 -0)
MachineBasicBlock.cpp | 8 ++++++++
1 files changed, 8 insertions(+)
Index: llvm/lib/CodeGen/MachineBasicBlock.cpp
diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.28 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.29
--- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.28 Fri May 12 01:33:48 2006
+++ llvm/lib/CodeGen/MachineBasicBlock.cpp Mon Sep 25 22:41:59 2006
@@ -97,6 +97,14 @@
if (LBB)
OS << "\n" << LBB->getName() << " (" << (const void*)this
<< ", LLVM BB @" << (const void*) LBB << "):\n";
+ // Print the preds of this block according to the CFG.
+ if (!pred_empty()) {
+ OS << " Predecessors according to CFG:";
+ for (const_pred_iterator PI = pred_begin(), E = pred_end(); PI != E; ++PI)
+ OS << " " << *PI;
+ OS << "\n";
+ }
+
for (const_iterator I = begin(); I != end(); ++I) {
OS << "\t";
I->print(OS, &getParent()->getTarget());
From sabre at nondot.org Mon Sep 25 22:44:34 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 22:44:34 -0500
Subject: [llvm-commits] CVS:
llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll
Message-ID: <200609260344.k8Q3iY7M010266@zion.cs.uiuc.edu>
Changes in directory llvm/test/Regression/CodeGen/X86:
darwin-no-dead-strip.ll added (r1.1)
---
Log message:
test that the no_dead_strip directive is emitted on darwin-x86
---
Diffs of the changes: (+7 -0)
darwin-no-dead-strip.ll | 7 +++++++
1 files changed, 7 insertions(+)
Index: llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll
diff -c /dev/null llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll:1.1
*** /dev/null Mon Sep 25 22:44:30 2006
--- llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll Mon Sep 25 22:44:20 2006
***************
*** 0 ****
--- 1,7 ----
+ ; RUN: llvm-as < %s | llc | grep no_dead_strip
+
+ target endian = little
+ target pointersize = 32
+ target triple = "i686-apple-darwin8.7.2"
+ %x = weak global int 0 ; [#uses=1]
+ %llvm.used = appending global [1 x sbyte*] [ sbyte* cast (int* %x to sbyte*) ]
From sabre at nondot.org Mon Sep 25 22:58:07 2006
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 25 Sep 2006 22:58:07 -0500
Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
X86AsmPrinter.cpp X86AsmPrinter.h X86ISelLowering.cpp
X86IntelAsmPrinter.cpp X86MachineFunctionInfo.h
Message-ID: <200609260358.k8Q3w7JR010530@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Target/X86:
X86ATTAsmPrinter.cpp updated: 1.64 -> 1.65
X86AsmPrinter.cpp updated: 1.199 -> 1.200
X86AsmPrinter.h updated: 1.32 -> 1.33
X86ISelLowering.cpp updated: 1.263 -> 1.264
X86IntelAsmPrinter.cpp updated: 1.57 -> 1.58
X86MachineFunctionInfo.h updated: 1.3 -> 1.4
---
Log message:
Various random and minor code cleanups.
---
Diffs of the changes: (+39 -56)
X86ATTAsmPrinter.cpp | 7 ++--
X86AsmPrinter.cpp | 67 ++++++++++++++++++-----------------------------
X86AsmPrinter.h | 7 ++--
X86ISelLowering.cpp | 5 +--
X86IntelAsmPrinter.cpp | 7 ++--
X86MachineFunctionInfo.h | 2 -
6 files changed, 39 insertions(+), 56 deletions(-)
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.64 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.65
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.64 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Sep 25 22:57:53 2006
@@ -48,9 +48,8 @@
// Populate function information map. Actually, We don't want to populate
// non-stdcall or non-fastcall functions' information right now.
- if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) {
- FunctionInfoMap[F] = *(MF.getInfo());
- }
+ if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall)
+ FunctionInfoMap[F] = *MF.getInfo();
X86SharedAsmPrinter::decorateName(CurrentFnName, F);
@@ -200,7 +199,7 @@
bool isExt = (GV->isExternal() || GV->hasWeakLinkage() ||
GV->hasLinkOnceLinkage());
- X86SharedAsmPrinter::decorateName(Name, (Function*)GV);
+ X86SharedAsmPrinter::decorateName(Name, GV);
if (X86PICStyle == PICStyle::Stub &&
TM.getRelocationModel() != Reloc::Static) {
Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.199 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.200
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.199 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Sep 25 22:57:53 2006
@@ -33,88 +33,75 @@
Statistic<> llvm::EmittedInsts("asm-printer",
"Number of machine instrs printed");
-static X86FunctionInfo calculateFunctionInfo(const Function* F,
- const TargetData* TD)
-{
+static X86FunctionInfo calculateFunctionInfo(const Function *F,
+ const TargetData *TD) {
X86FunctionInfo Info;
- uint64_t size = 0;
+ uint64_t Size = 0;
switch (F->getCallingConv()) {
- case CallingConv::X86_StdCall:
+ case CallingConv::X86_StdCall:
Info.setDecorationStyle(StdCall);
break;
- case CallingConv::X86_FastCall:
+ case CallingConv::X86_FastCall:
Info.setDecorationStyle(FastCall);
break;
- default:
+ default:
return Info;
}
- for (Function::const_arg_iterator AI = F->arg_begin(),
- AE = F->arg_end();
- AI != AE;
- ++AI) {
- size += TD->getTypeSize(AI->getType());
- }
+ for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
+ AI != AE; ++AI)
+ Size += TD->getTypeSize(AI->getType());
// We're not supporting tooooo huge arguments :)
- Info.setBytesToPopOnReturn((unsigned int)size);
-
+ Info.setBytesToPopOnReturn((unsigned int)Size);
return Info;
}
-// Query FunctionInfoMap and use this information for various name decoration
-void X86SharedAsmPrinter::decorateName(std::string& Name, const GlobalValue* GV)
-{
- const X86FunctionInfo* Info;
- const Function* F;
-
- if ((F = dyn_cast(GV)) == NULL) {
- return;
- }
-
- unsigned CC = F->getCallingConv();
+/// decorateName - Query FunctionInfoMap and use this information for various
+/// name decoration.
+void X86SharedAsmPrinter::decorateName(std::string &Name,
+ const GlobalValue *GV) {
+ const Function *F = dyn_cast(GV);
+ if (!F) return;
// We don't want to decorate non-stdcall or non-fastcall functions right now
- if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) {
+ unsigned CC = F->getCallingConv();
+ if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall)
return;
- }
FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F);
+ const X86FunctionInfo *Info;
if (info_item == FunctionInfoMap.end()) {
// Calculate apropriate function info and populate map
FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData());
Info = &FunctionInfoMap[F];
} else {
- Info = &(info_item->second);
+ Info = &info_item->second;
}
switch (Info->getDecorationStyle()) {
- case None:
+ case None:
break;
- case StdCall:
- if (!F->isVarArg()) {
- // Variadic functions do not receive @0 suffix
+ case StdCall:
+ if (!F->isVarArg()) // Variadic functions do not receive @0 suffix.
Name += '@' + utostr_32(Info->getBytesToPopOnReturn());
- }
break;
- case FastCall:
- if (!F->isVarArg()) {
- // Variadic functions do not receive @0 suffix
+ case FastCall:
+ if (!F->isVarArg()) // Variadic functions do not receive @0 suffix.
Name += '@' + utostr_32(Info->getBytesToPopOnReturn());
- }
+
if (Name[0] == '_') {
Name[0] = '@';
} else {
Name = '@' + Name;
}
break;
- default:
+ default:
assert(0 && "Unsupported DecorationStyle");
}
-
}
/// doInitialization
Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.32 llvm/lib/Target/X86/X86AsmPrinter.h:1.33
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.32 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h Mon Sep 25 22:57:53 2006
@@ -46,19 +46,18 @@
Subtarget = &TM.getSubtarget();
}
- typedef std::map FMFInfoMap ;
-
// We have to propagate some information about MachineFunction to
// AsmPrinter. It's ok, when we're printing the function, since we have
- // access to MachineFunction and can get the appropriate MachineFunctionInfo.
+ // access to MachineFunction and can get the appropriate MachineFunctionInfo.
// Unfortunately, this is not possible when we're printing reference to
// Function (e.g. calling it and so on). Even more, there is no way to get the
// corresponding MachineFunctions: it can even be not created at all. That's
// why we should use additional structure, when we're collecting all necessary
// information.
-
+ //
// This structure is using e.g. for name decoration for stdcall & fastcall'ed
// function, since we have to use arguments' size for decoration.
+ typedef std::map FMFInfoMap;
FMFInfoMap FunctionInfoMap;
void decorateName(std::string& Name, const GlobalValue* GV);
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.263 llvm/lib/Target/X86/X86ISelLowering.cpp:1.264
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.263 Wed Sep 20 21:08:31 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Mon Sep 25 22:57:53 2006
@@ -1523,9 +1523,8 @@
return DAG.getNode(ISD::MERGE_VALUES, RetVTs, &ArgValues[0],ArgValues.size());
}
-SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op,
- SelectionDAG &DAG,
- bool isFastCall){
+SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG,
+ bool isFastCall) {
SDOperand Chain = Op.getOperand(0);
unsigned CallingConv= cast(Op.getOperand(1))->getValue();
bool isVarArg = cast(Op.getOperand(2))->getValue() != 0;
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.57 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.58
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.57 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Mon Sep 25 22:57:53 2006
@@ -36,14 +36,13 @@
EmitConstantPool(MF.getConstantPool());
// Print out labels for the function.
- const Function* F = MF.getFunction();
+ const Function *F = MF.getFunction();
unsigned CC = F->getCallingConv();
// Populate function information map. Actually, We don't want to populate
// non-stdcall or non-fastcall functions' information right now.
- if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) {
- FunctionInfoMap[F] = *(MF.getInfo());
- }
+ if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall)
+ FunctionInfoMap[F] = *MF.getInfo();
X86SharedAsmPrinter::decorateName(CurrentFnName, F);
Index: llvm/lib/Target/X86/X86MachineFunctionInfo.h
diff -u llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.3 llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.4
--- llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.3 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86MachineFunctionInfo.h Mon Sep 25 22:57:53 2006
@@ -46,7 +46,7 @@
BytesToPopOnReturn(0),
DecorationStyle(None) {}
- X86FunctionInfo(MachineFunction& MF) : ForceFramePointer(false),
+ X86FunctionInfo(MachineFunction &MF) : ForceFramePointer(false),
BytesToPopOnReturn(0),
DecorationStyle(None) {}
From jlaskey at apple.com Tue Sep 26 02:38:02 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Tue, 26 Sep 2006 02:38:02 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200609260738.k8Q7c2wj022297@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.200 -> 1.201
---
Log message:
Can't move a load node if it's chain is not used.
---
Diffs of the changes: (+22 -1)
DAGCombiner.cpp | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletion(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.200 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.201
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.200 Mon Sep 25 16:11:32 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 26 02:37:42 2006
@@ -240,6 +240,10 @@
SDOperand BuildUDIV(SDNode *N);
SDNode *MatchRotate(SDOperand LHS, SDOperand RHS);
+ /// hasChainUsers - Returns true if one of the users of a load node has the
+ /// chain result as an operand.
+ bool hasChainUsers(SDNode *Load);
+
/// FindBaseOffset - Return true if we can determine base and offset
/// information from a given pointer operand. Provides base and offset as a
/// result.
@@ -2640,7 +2644,7 @@
Chain.getOperand(1).getValueType() == N->getValueType(0))
return CombineTo(N, Chain.getOperand(1), Chain);
- if (CombinerAA) {
+ if (CombinerAA && hasChainUsers(N)) {
// Walk up chain skipping non-aliasing memory nodes.
SDOperand BetterChain = FindBetterChain(N, Chain);
@@ -3947,6 +3951,23 @@
return S;
}
+/// hasChainUsers - Returns true if one of the users of a load node has the
+/// chain result as an operand.
+bool DAGCombiner::hasChainUsers(SDNode *Load) {
+ // Don't even bother if the load only has one user (conservatively the value.)
+ if (!Load->hasOneUse()) {
+ SDOperand Chain(Load, 1);
+
+ for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end();
+ UI != UE; ++UI) {
+ if ((*UI)->getOperand(0) == Chain)
+ return true;
+ }
+ }
+
+ return false;
+}
+
/// FindBaseOffset - Return true if we can determine base and offset information
/// from a given pointer operand. Provides base and offset as a result.
bool DAGCombiner::FindBaseOffset(SDOperand Ptr,
From jlaskey at apple.com Tue Sep 26 03:14:20 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Tue, 26 Sep 2006 03:14:20 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200609260814.k8Q8EKem022956@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.201 -> 1.202
---
Log message:
Wrong size for load
---
Diffs of the changes: (+8 -2)
DAGCombiner.cpp | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.201 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.202
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.201 Tue Sep 26 02:37:42 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 26 03:14:06 2006
@@ -2644,6 +2644,8 @@
Chain.getOperand(1).getValueType() == N->getValueType(0))
return CombineTo(N, Chain.getOperand(1), Chain);
+ // We can only move the load if it has a user of it's chain result. Otherwise
+ // there is no place to attach it's old chain.
if (CombinerAA && hasChainUsers(N)) {
// Walk up chain skipping non-aliasing memory nodes.
SDOperand BetterChain = FindBetterChain(N, Chain);
@@ -3956,15 +3958,19 @@
bool DAGCombiner::hasChainUsers(SDNode *Load) {
// Don't even bother if the load only has one user (conservatively the value.)
if (!Load->hasOneUse()) {
- SDOperand Chain(Load, 1);
+ SDOperand Chain(Load, 1); // The load's chain result.
+ // For each user of the load.
for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end();
UI != UE; ++UI) {
+
+ // Chain will be the first operand.
if ((*UI)->getOperand(0) == Chain)
return true;
}
}
+ // No luck.
return false;
}
@@ -4025,7 +4031,7 @@
switch (N->getOpcode()) {
case ISD::LOAD:
Ptr = N->getOperand(1);
- Size = MVT::getSizeInBits(N->getOperand(1).getValueType()) >> 3;
+ Size = MVT::getSizeInBits(N->getValueType(0)) >> 3;
SrcValue = N->getOperand(2);
break;
case ISD::STORE:
From jlaskey at apple.com Tue Sep 26 04:33:01 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Tue, 26 Sep 2006 04:33:01 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200609260933.k8Q9X1Mg019668@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.202 -> 1.203
---
Log message:
Chain can be any operand
---
Diffs of the changes: (+9 -11)
DAGCombiner.cpp | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.202 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.203
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.202 Tue Sep 26 03:14:06 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 26 04:32:41 2006
@@ -3956,17 +3956,15 @@
/// hasChainUsers - Returns true if one of the users of a load node has the
/// chain result as an operand.
bool DAGCombiner::hasChainUsers(SDNode *Load) {
- // Don't even bother if the load only has one user (conservatively the value.)
- if (!Load->hasOneUse()) {
- SDOperand Chain(Load, 1); // The load's chain result.
-
- // For each user of the load.
- for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end();
- UI != UE; ++UI) {
-
- // Chain will be the first operand.
- if ((*UI)->getOperand(0) == Chain)
- return true;
+ SDOperand Chain(Load, 1); // The load's chain result.
+
+ // For each user of the load.
+ for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end();
+ UI != UE; ++UI) {
+ const SDNode *User = *UI;
+
+ for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) {
+ if (User->getOperand(i) == Chain) return true;
}
}
From jlaskey at apple.com Tue Sep 26 07:07:20 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Tue, 26 Sep 2006 07:07:20 -0500
Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.php
testers.php
Message-ID: <200609261207.k8QC7KFD028858@zion.cs.uiuc.edu>
Changes in directory nightlytest-serverside:
NightlyTestAccept.php updated: 1.58 -> 1.59
testers.php updated: 1.2 -> 1.3
---
Log message:
Odds and sods
---
Diffs of the changes: (+3 -3)
NightlyTestAccept.php | 2 --
testers.php | 4 +++-
2 files changed, 3 insertions(+), 3 deletions(-)
Index: nightlytest-serverside/NightlyTestAccept.php
diff -u nightlytest-serverside/NightlyTestAccept.php:1.58 nightlytest-serverside/NightlyTestAccept.php:1.59
--- nightlytest-serverside/NightlyTestAccept.php:1.58 Wed Sep 20 06:31:36 2006
+++ nightlytest-serverside/NightlyTestAccept.php Tue Sep 26 07:07:06 2006
@@ -957,8 +957,6 @@
chdir("$cwd/machines/$machine_id");
WriteFile("$db_date-Build-Log.txt", $build_log);
-// WriteFile("$db_date-O-files.txt", $o_file_size);
-// WriteFile("$db_date-A-files.txt", $a_file_size);
$sentdata="";
foreach ($_GET as $key => $value) {
Index: nightlytest-serverside/testers.php
diff -u nightlytest-serverside/testers.php:1.2 nightlytest-serverside/testers.php:1.3
--- nightlytest-serverside/testers.php:1.2 Fri Sep 8 17:47:25 2006
+++ nightlytest-serverside/testers.php Tue Sep 26 07:07:06 2006
@@ -36,8 +36,9 @@
print "\t\t| ID | \n";
print "\t\tNickname | \n";
print "\t\tMachine name | \n";
- print "\t\tOperating System | \n";
+ print "\t\tOperating system | \n";
print "\t\tHardware | \n";
+ print "\t\tGCC version | \n";
print "\t\tTime of last test | \n";
print "\t\tBuild status of last test | \n";
print "\t\n";
@@ -61,6 +62,7 @@
print "\t\t{$row['name']} | \n";
print "\t\t{$row['os']} | \n";
print "\t\t{$row['hardware']} | \n";
+ print "\t\t{$row['gcc']} | \n";
print "\t\t{$latest_test['added']} | \n";
print "\t\t{$latest_test['buildstatus']} | \n";
print "\t\n";
From jlaskey at apple.com Tue Sep 26 12:45:13 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Tue, 26 Sep 2006 12:45:13 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Message-ID: <200609261745.k8QHjDlc001579@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.203 -> 1.204
---
Log message:
Load chain check is not needed
---
Diffs of the changes: (+1 -24)
DAGCombiner.cpp | 25 +------------------------
1 files changed, 1 insertion(+), 24 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.203 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.204
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.203 Tue Sep 26 04:32:41 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 26 12:44:58 2006
@@ -240,10 +240,6 @@
SDOperand BuildUDIV(SDNode *N);
SDNode *MatchRotate(SDOperand LHS, SDOperand RHS);
- /// hasChainUsers - Returns true if one of the users of a load node has the
- /// chain result as an operand.
- bool hasChainUsers(SDNode *Load);
-
/// FindBaseOffset - Return true if we can determine base and offset
/// information from a given pointer operand. Provides base and offset as a
/// result.
@@ -2646,7 +2642,7 @@
// We can only move the load if it has a user of it's chain result. Otherwise
// there is no place to attach it's old chain.
- if (CombinerAA && hasChainUsers(N)) {
+ if (CombinerAA) {
// Walk up chain skipping non-aliasing memory nodes.
SDOperand BetterChain = FindBetterChain(N, Chain);
@@ -3953,25 +3949,6 @@
return S;
}
-/// hasChainUsers - Returns true if one of the users of a load node has the
-/// chain result as an operand.
-bool DAGCombiner::hasChainUsers(SDNode *Load) {
- SDOperand Chain(Load, 1); // The load's chain result.
-
- // For each user of the load.
- for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end();
- UI != UE; ++UI) {
- const SDNode *User = *UI;
-
- for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) {
- if (User->getOperand(i) == Chain) return true;
- }
- }
-
- // No luck.
- return false;
-}
-
/// FindBaseOffset - Return true if we can determine base and offset information
/// from a given pointer operand. Provides base and offset as a result.
bool DAGCombiner::FindBaseOffset(SDOperand Ptr,
From jlaskey at apple.com Tue Sep 26 12:47:33 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Tue, 26 Sep 2006 12:47:33 -0500
Subject: [llvm-commits] CVS: llvm-test/Makefile.programs
Message-ID: <200609261747.k8QHlXQB001621@zion.cs.uiuc.edu>
Changes in directory llvm-test:
Makefile.programs updated: 1.226 -> 1.227
---
Log message:
Set combiner-alias-analysis as llc-beta for PPC and x86
---
Diffs of the changes: (+2 -2)
Makefile.programs | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.226 llvm-test/Makefile.programs:1.227
--- llvm-test/Makefile.programs:1.226 Fri Sep 15 12:11:45 2006
+++ llvm-test/Makefile.programs Tue Sep 26 12:47:19 2006
@@ -193,7 +193,7 @@
endif#DISABLE_DIFFS
ifeq ($(ARCH),PowerPC)
-LLCBETAOPTION := -regalloc=local -fast
+LLCBETAOPTION := -combiner-alias-analysis
endif
ifeq ($(ARCH),Alpha)
LLCBETAOPTION := -sched=list-td
@@ -203,7 +203,7 @@
LLCBETAOPTION := -sched=simple
endif
ifeq ($(ARCH),x86)
-LLCBETAOPTION := -regalloc=local -fast
+LLCBETAOPTION := -combiner-alias-analysis
endif
ifeq ($(ARCH),Sparc)
LLCBETAOPTION := -enable-sparc-v9-insts
From alenhar2 at cs.uiuc.edu Tue Sep 26 15:02:56 2006
From: alenhar2 at cs.uiuc.edu (Andrew Lenharth)
Date: Tue, 26 Sep 2006 15:02:56 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
SelectionDAGISel.cpp
Message-ID: <200609262002.k8QK2uMG005951@apoc.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAG.cpp updated: 1.340 -> 1.341
SelectionDAGISel.cpp updated: 1.279 -> 1.280
---
Log message:
Comments on JumpTableness
---
Diffs of the changes: (+4 -0)
SelectionDAG.cpp | 1 +
SelectionDAGISel.cpp | 3 +++
2 files changed, 4 insertions(+)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.340 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.341
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.340 Tue Sep 19 00:02:39 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 26 15:02:30 2006
@@ -2403,6 +2403,7 @@
case ISD::GlobalAddress: return "GlobalAddress";
case ISD::FrameIndex: return "FrameIndex";
case ISD::JumpTable: return "JumpTable";
+ case ISD::JumpTableRelocBase: return "JumpTableRelocBase";
case ISD::ConstantPool: return "ConstantPool";
case ISD::ExternalSymbol: return "ExternalSymbol";
case ISD::INTRINSIC_WO_CHAIN: {
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.279 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.280
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.279 Sun Sep 24 14:44:59 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Sep 26 15:02:30 2006
@@ -868,6 +868,9 @@
SDOperand LD = DAG.getLoad(isPIC ? MVT::i32 : PTy, Copy.getValue(1), ADD,
DAG.getSrcValue(0));
if (isPIC) {
+ // For Pic, the sequence is:
+ // BRIND(load(Jumptable + index) + RelocBase)
+ // RelocBase is the JumpTable on PPC and X86, GOT on Alpha
SDOperand Reloc = DAG.getNode(ISD::JumpTableRelocBase, PTy, TAB);
ADD = DAG.getNode(ISD::ADD, PTy,
((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), Reloc);
From evan.cheng at apple.com Tue Sep 26 17:29:45 2006
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 26 Sep 2006 17:29:45 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp
Message-ID: <200609262229.k8QMTj5q006228@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
PrologEpilogInserter.cpp updated: 1.58 -> 1.59
---
Log message:
Rename function. It's determining which callee-save registers to save.
---
Diffs of the changes: (+7 -7)
PrologEpilogInserter.cpp | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.58 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.59
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.58 Sun Aug 27 07:54:01 2006
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Tue Sep 26 17:29:31 2006
@@ -43,11 +43,11 @@
Fn.getFrameInfo()->setMachineDebugInfo(DI);
}
- // Scan the function for modified caller saved registers and insert spill
- // code for any caller saved registers that are modified. Also calculate
+ // Scan the function for modified callee saved registers and insert spill
+ // code for any callee saved registers that are modified. Also calculate
// the MaxCallFrameSize and HasCalls variables for the function's frame
// information and eliminates call frame pseudo instructions.
- calculateCallerSavedRegisters(Fn);
+ calculateCalleeSavedRegisters(Fn);
// Add the code to save and restore the caller saved registers
saveCallerSavedRegisters(Fn);
@@ -61,7 +61,7 @@
// Add prolog and epilog code to the function. This function is required
// to align the stack frame as necessary for any stack variables or
- // called functions. Because of this, calculateCallerSavedRegisters
+ // called functions. Because of this, calculateCalleeSavedRegisters
// must be called before this function in order to set the HasCalls
// and MaxCallFrameSize variables.
insertPrologEpilogCode(Fn);
@@ -75,7 +75,7 @@
}
private:
- void calculateCallerSavedRegisters(MachineFunction &Fn);
+ void calculateCalleeSavedRegisters(MachineFunction &Fn);
void saveCallerSavedRegisters(MachineFunction &Fn);
void calculateFrameObjectOffsets(MachineFunction &Fn);
void replaceFrameIndices(MachineFunction &Fn);
@@ -90,12 +90,12 @@
FunctionPass *llvm::createPrologEpilogCodeInserter() { return new PEI(); }
-/// calculateCallerSavedRegisters - Scan the function for modified caller saved
+/// calculateCalleeSavedRegisters - Scan the function for modified caller saved
/// registers. Also calculate the MaxCallFrameSize and HasCalls variables for
/// the function's frame information and eliminates call frame pseudo
/// instructions.
///
-void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
+void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) {
const MRegisterInfo *RegInfo = Fn.getTarget().getRegisterInfo();
const TargetFrameInfo *TFI = Fn.getTarget().getFrameInfo();
From sabre at nondot.org Tue Sep 26 18:45:23 2006
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 26 Sep 2006 18:45:23 -0500
Subject: [llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp
Message-ID: <200609262345.k8QNjNsf007325@zion.cs.uiuc.edu>
Changes in directory llvm/utils/TableGen:
AsmWriterEmitter.cpp updated: 1.41 -> 1.42
---
Log message:
Add support for ${:foo} syntax, where "foo" is passed into "printSpecial" and
has no associated operand. This is useful for portably encoding stuff like
the comment character into an asm string.
---
Diffs of the changes: (+25 -16)
AsmWriterEmitter.cpp | 41 +++++++++++++++++++++++++----------------
1 files changed, 25 insertions(+), 16 deletions(-)
Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.41 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.42
--- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.41 Mon Sep 4 21:12:02 2006
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp Tue Sep 26 18:45:08 2006
@@ -98,7 +98,9 @@
if (OperandType == isLiteralTextOperand)
return "O << \"" + Str + "\"; ";
- std::string Result = Str + "(MI, " + utostr(MIOpNo);
+ std::string Result = Str + "(MI";
+ if (MIOpNo != ~0U)
+ Result += ", " + utostr(MIOpNo);
if (!MiModifier.empty())
Result += ", \"" + MiModifier + '"';
return Result + "); ";
@@ -172,7 +174,8 @@
AsmString.begin()+VarEnd);
// Modifier - Support ${foo:modifier} syntax, where "modifier" is passed
- // into printOperand.
+ // into printOperand. Also support ${:feature}, which is passed into
+ // printSpecial.
std::string Modifier;
// In order to avoid starting the next string at the terminating curly
@@ -204,23 +207,29 @@
+ CGI.TheDef->getName() + "'";
++VarEnd;
}
- if (VarName.empty())
+ if (VarName.empty() && Modifier.empty())
throw "Stray '$' in '" + CGI.TheDef->getName() +
"' asm string, maybe you want $$?";
- unsigned OpNo = CGI.getOperandNamed(VarName);
- CodeGenInstruction::OperandInfo OpInfo = CGI.OperandList[OpNo];
-
- // If this is a two-address instruction, verify the second operand isn't
- // used.
- unsigned MIOp = OpInfo.MIOperandNo;
- if (CGI.isTwoAddress && MIOp == 1)
- throw "Should refer to operand #0 instead of #1 for two-address"
- " instruction '" + CGI.TheDef->getName() + "'!";
-
- if (CurVariant == Variant || CurVariant == ~0U)
- Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp,
- Modifier));
+ if (VarName.empty()) {
+ // Just a modifier, pass this into printSpecial.
+ Operands.push_back(AsmWriterOperand("printSpecial", ~0U, Modifier));
+ } else {
+ // Otherwise, normal operand.
+ unsigned OpNo = CGI.getOperandNamed(VarName);
+ CodeGenInstruction::OperandInfo OpInfo = CGI.OperandList[OpNo];
+
+ // If this is a two-address instruction, verify the second operand isn't
+ // used.
+ unsigned MIOp = OpInfo.MIOperandNo;
+ if (CGI.isTwoAddress && MIOp == 1)
+ throw "Should refer to operand #0 instead of #1 for two-address"
+ " instruction '" + CGI.TheDef->getName() + "'!";
+
+ if (CurVariant == Variant || CurVariant == ~0U)
+ Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp,
+ Modifier));
+ }
LastEmitted = VarEnd;
}
}
From sabre at nondot.org Tue Sep 26 18:47:25 2006
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 26 Sep 2006 18:47:25 -0500
Subject: [llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp
Message-ID: <200609262347.k8QNlPVg007402@zion.cs.uiuc.edu>
Changes in directory llvm/utils/TableGen:
AsmWriterEmitter.cpp updated: 1.42 -> 1.43
---
Log message:
Actually, name the method PrintSpecial to match other stuff in AsmPrinter.h
---
Diffs of the changes: (+3 -3)
AsmWriterEmitter.cpp | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.42 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.43
--- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.42 Tue Sep 26 18:45:08 2006
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp Tue Sep 26 18:47:10 2006
@@ -175,7 +175,7 @@
// Modifier - Support ${foo:modifier} syntax, where "modifier" is passed
// into printOperand. Also support ${:feature}, which is passed into
- // printSpecial.
+ // PrintSpecial.
std::string Modifier;
// In order to avoid starting the next string at the terminating curly
@@ -212,8 +212,8 @@
"' asm string, maybe you want $$?";
if (VarName.empty()) {
- // Just a modifier, pass this into printSpecial.
- Operands.push_back(AsmWriterOperand("printSpecial", ~0U, Modifier));
+ // Just a modifier, pass this into PrintSpecial.
+ Operands.push_back(AsmWriterOperand("PrintSpecial", ~0U, Modifier));
} else {
// Otherwise, normal operand.
unsigned OpNo = CGI.getOperandNamed(VarName);
From sabre at nondot.org Tue Sep 26 19:00:05 2006
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 26 Sep 2006 19:00:05 -0500
Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h
Message-ID: <200609270000.k8R005oI007688@zion.cs.uiuc.edu>
Changes in directory llvm/include/llvm/CodeGen:
AsmPrinter.h updated: 1.49 -> 1.50
---
Log message:
Add support for ${:comment}, which expands to the current target's comment
character, and ${:uid} which expands to a unique ID for the MachineInstr.
More can be added if/when they are needed.
---
Diffs of the changes: (+8 -0)
AsmPrinter.h | 8 ++++++++
1 files changed, 8 insertions(+)
Index: llvm/include/llvm/CodeGen/AsmPrinter.h
diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.49 llvm/include/llvm/CodeGen/AsmPrinter.h:1.50
--- llvm/include/llvm/CodeGen/AsmPrinter.h:1.49 Mon Sep 25 22:38:18 2006
+++ llvm/include/llvm/CodeGen/AsmPrinter.h Tue Sep 26 18:59:50 2006
@@ -108,6 +108,14 @@
/// doFinalization - Shut down the asmprinter. If you override this in your
/// pass, you must make sure to call it explicitly.
bool doFinalization(Module &M);
+
+ /// PrintSpecial - Print information related to the specified machine instr
+ /// that is independent of the operand, and may be independent of the instr
+ /// itself. This can be useful for portably encoding the comment character
+ /// or other bits of target-specific knowledge into the asmstrings. The
+ /// syntax used is ${:comment}. Targets can override this to add support
+ /// for their own strange codes.
+ virtual void PrintSpecial(const MachineInstr *MI, const char *Code);
/// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
/// instruction, using the specified assembler variant. Targets should
From sabre at nondot.org Tue Sep 26 19:00:06 2006
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 26 Sep 2006 19:00:06 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Message-ID: <200609270000.k8R006JW007693@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.99 -> 1.100
---
Log message:
Add support for ${:comment}, which expands to the current target's comment
character, and ${:uid} which expands to a unique ID for the MachineInstr.
More can be added if/when they are needed.
---
Diffs of the changes: (+24 -0)
AsmPrinter.cpp | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.99 llvm/lib/CodeGen/AsmPrinter.cpp:1.100
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.99 Mon Sep 25 22:38:18 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp Tue Sep 26 18:59:50 2006
@@ -619,6 +619,30 @@
abort();
}
+/// PrintSpecial - Print information related to the specified machine instr
+/// that is independent of the operand, and may be independent of the instr
+/// itself. This can be useful for portably encoding the comment character
+/// or other bits of target-specific knowledge into the asmstrings. The
+/// syntax used is ${:comment}. Targets can override this to add support
+/// for their own strange codes.
+void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) {
+ if (!strcmp(Code, "comment")) {
+ O << TAI->getCommentString();
+ } else if (!strcmp(Code, "uid")) {
+ // Assign a unique ID to this machine instruction.
+ static const MachineInstr *LastMI = 0;
+ static unsigned Counter = 0U-1;
+ // If this is a new machine instruction, bump the counter.
+ if (LastMI != MI) { ++Counter; LastMI = MI; }
+ O << Counter;
+ } else {
+ std::cerr << "Unknown special formatter '" << Code
+ << "' for machine instr: " << *MI;
+ exit(1);
+ }
+}
+
+
/// printInlineAsm - This method formats and prints the specified machine
/// instruction that is an inline asm.
void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
From sabre at nondot.org Tue Sep 26 19:06:21 2006
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 26 Sep 2006 19:06:21 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Message-ID: <200609270006.k8R06Luk007848@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.100 -> 1.101
---
Log message:
Add support for ${:private} which prints "L" on darwin.
---
Diffs of the changes: (+3 -1)
AsmPrinter.cpp | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.100 llvm/lib/CodeGen/AsmPrinter.cpp:1.101
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.100 Tue Sep 26 18:59:50 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp Tue Sep 26 19:06:07 2006
@@ -626,7 +626,9 @@
/// syntax used is ${:comment}. Targets can override this to add support
/// for their own strange codes.
void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) {
- if (!strcmp(Code, "comment")) {
+ if (!strcmp(Code, "private")) {
+ O << TAI->getPrivateGlobalPrefix();
+ } else if (!strcmp(Code, "comment")) {
O << TAI->getCommentString();
} else if (!strcmp(Code, "uid")) {
// Assign a unique ID to this machine instruction.
From sabre at nondot.org Tue Sep 26 21:55:35 2006
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 26 Sep 2006 21:55:35 -0500
Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.td
Message-ID: <200609270255.k8R2tZEs010586@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Target/PowerPC:
PPCInstrInfo.td updated: 1.242 -> 1.243
---
Log message:
Use abstract private/comment directives, to increase portability to ppc/linux
---
Diffs of the changes: (+18 -13)
PPCInstrInfo.td | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.242 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.243
--- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.242 Fri Sep 22 00:01:56 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Tue Sep 26 21:55:21 2006
@@ -275,20 +275,20 @@
let hasCtrlDep = 1 in {
def ADJCALLSTACKDOWN : Pseudo<(ops u16imm:$amt),
- "; ADJCALLSTACKDOWN",
+ "${:comment} ADJCALLSTACKDOWN",
[(callseq_start imm:$amt)]>;
def ADJCALLSTACKUP : Pseudo<(ops u16imm:$amt),
- "; ADJCALLSTACKUP",
+ "${:comment} ADJCALLSTACKUP",
[(callseq_end imm:$amt)]>;
def UPDATE_VRSAVE : Pseudo<(ops GPRC:$rD, GPRC:$rS),
"UPDATE_VRSAVE $rD, $rS", []>;
}
-def IMPLICIT_DEF_GPRC: Pseudo<(ops GPRC:$rD), "; IMPLICIT_DEF_GPRC $rD",
+def IMPLICIT_DEF_GPRC: Pseudo<(ops GPRC:$rD),"${:comment}IMPLICIT_DEF_GPRC $rD",
[(set GPRC:$rD, (undef))]>;
-def IMPLICIT_DEF_F8 : Pseudo<(ops F8RC:$rD), "; IMPLICIT_DEF_F8 $rD",
+def IMPLICIT_DEF_F8 : Pseudo<(ops F8RC:$rD), "${:comment} IMPLICIT_DEF_F8 $rD",
[(set F8RC:$rD, (undef))]>;
-def IMPLICIT_DEF_F4 : Pseudo<(ops F4RC:$rD), "; IMPLICIT_DEF_F4 $rD",
+def IMPLICIT_DEF_F4 : Pseudo<(ops F4RC:$rD), "${:comment} IMPLICIT_DEF_F4 $rD",
[(set F4RC:$rD, (undef))]>;
// SELECT_CC_* - Used to implement the SELECT_CC DAG operation. Expanded by the
@@ -296,15 +296,20 @@
let usesCustomDAGSchedInserter = 1, // Expanded by the scheduler.
PPC970_Single = 1 in {
def SELECT_CC_I4 : Pseudo<(ops GPRC:$dst, CRRC:$cond, GPRC:$T, GPRC:$F,
- i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>;
+ i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!",
+ []>;
def SELECT_CC_I8 : Pseudo<(ops G8RC:$dst, CRRC:$cond, G8RC:$T, G8RC:$F,
- i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>;
+ i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!",
+ []>;
def SELECT_CC_F4 : Pseudo<(ops F4RC:$dst, CRRC:$cond, F4RC:$T, F4RC:$F,
- i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>;
+ i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!",
+ []>;
def SELECT_CC_F8 : Pseudo<(ops F8RC:$dst, CRRC:$cond, F8RC:$T, F8RC:$F,
- i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>;
+ i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!",
+ []>;
def SELECT_CC_VRRC: Pseudo<(ops VRRC:$dst, CRRC:$cond, VRRC:$T, VRRC:$F,
- i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>;
+ i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!",
+ []>;
}
let isTerminator = 1, noResults = 1, PPC970_Unit = 7 in {
@@ -320,7 +325,7 @@
let isBranch = 1, isTerminator = 1, hasCtrlDep = 1,
noResults = 1, PPC970_Unit = 7 in {
def COND_BRANCH : Pseudo<(ops CRRC:$crS, u16imm:$opc, target:$dst),
- "; COND_BRANCH $crS, $opc, $dst",
+ "${:comment} COND_BRANCH $crS, $opc, $dst",
[(PPCcondbranch CRRC:$crS, imm:$opc, bb:$dst)]>;
def B : IForm<18, 0, 0, (ops target:$dst),
"b $dst", BrB,
@@ -895,12 +900,12 @@
//
def DWARF_LOC : Pseudo<(ops i32imm:$line, i32imm:$col, i32imm:$file),
- "; .loc $file, $line, $col",
+ "${:comment} .loc $file, $line, $col",
[(dwarf_loc (i32 imm:$line), (i32 imm:$col),
(i32 imm:$file))]>;
def DWARF_LABEL : Pseudo<(ops i32imm:$id),
- "\nLdebug_loc$id:",
+ "\n${:private}debug_loc$id:",
[(dwarf_label (i32 imm:$id))]>;
//===----------------------------------------------------------------------===//
From dpatel at apple.com Tue Sep 26 21:58:58 2006
From: dpatel at apple.com (Devang Patel)
Date: Tue, 26 Sep 2006 21:58:58 -0500
Subject: [llvm-commits] CVS:
llvm/test/Regression/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll
Message-ID: <200609270258.k8R2ww0S010704@zion.cs.uiuc.edu>
Changes in directory llvm/test/Regression/Analysis/Dominators:
2006-09-26-PostDominanceFrontier.ll added (r1.1)
---
Log message:
Add http://llvm.org/bugs/show_bug.cgi?id=923 test case.
---
Diffs of the changes: (+100 -0)
2006-09-26-PostDominanceFrontier.ll | 100 ++++++++++++++++++++++++++++++++++++
1 files changed, 100 insertions(+)
Index: llvm/test/Regression/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll
diff -c /dev/null llvm/test/Regression/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll:1.1
*** /dev/null Tue Sep 26 21:58:54 2006
--- llvm/test/Regression/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll Tue Sep 26 21:58:44 2006
***************
*** 0 ****
--- 1,100 ----
+ ; RUN: llvm-as < %s | opt -analyze -postdomfrontier -disable-verify
+ ;
+ ; ModuleID = '2006-09-26-PostDominanceFrontier.bc'
+ target endian = little
+ target pointersize = 64
+ target triple = "alphaev67-unknown-linux-gnu"
+ %struct.FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, long, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [44 x sbyte] }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, int }
+ %TOP = external global ulong* ; [#uses=1]
+ %BOT = external global ulong* ; [#uses=1]
+ %str = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0]
+
+ implementation ; Functions:
+
+ declare void %fopen()
+
+ void %main(sbyte** %argv) {
+ entry:
+ %netSelect.i507 = alloca ulong, align 8 ; [#uses=0]
+ %topStart.i = alloca ulong, align 8 ; [#uses=0]
+ %topEnd.i = alloca ulong, align 8 ; [#uses=0]
+ %botStart.i = alloca ulong, align 8 ; [#uses=0]
+ %botEnd.i = alloca ulong, align 8 ; [#uses=0]
+ %c1.i154 = alloca uint, align 4 ; [#uses=0]
+ %b1.i155 = alloca uint, align 4 ; [#uses=0]
+ %t1.i156 = alloca uint, align 4 ; [#uses=0]
+ %c1.i = alloca uint, align 4 ; [#uses=0]
+ %b1.i = alloca uint, align 4 ; [#uses=0]
+ %t1.i = alloca uint, align 4 ; [#uses=0]
+ %netSelect.i5 = alloca ulong, align 8 ; [#uses=0]
+ %netSelect.i = alloca ulong, align 8 ; [#uses=0]
+ %tmp2.i = getelementptr sbyte** %argv, int 1 ; [#uses=1]
+ %tmp3.i4 = load sbyte** %tmp2.i ; [#uses=0]
+ call void %fopen( )
+ br bool false, label %DimensionChannel.exit, label %bb.backedge.i
+
+ bb.backedge.i: ; preds = %entry
+ ret void
+
+ DimensionChannel.exit: ; preds = %entry
+ %tmp13.i137 = malloc ulong, uint 0 ; [#uses=1]
+ %tmp610.i = malloc ulong, uint 0 ; [#uses=1]
+ br label %cond_true.i143
+
+ cond_true.i143: ; preds = %cond_true.i143, %DimensionChannel.exit
+ %tmp9.i140 = getelementptr ulong* %tmp13.i137, ulong 0 ; [#uses=0]
+ %tmp12.i = getelementptr ulong* %tmp610.i, ulong 0 ; [#uses=0]
+ br bool false, label %bb18.i144, label %cond_true.i143
+
+ bb18.i144: ; preds = %cond_true.i143
+ call void %fopen( )
+ %tmp76.i105 = malloc ulong, uint 0 ; [#uses=3]
+ %tmp674.i = malloc ulong, uint 0 ; [#uses=2]
+ %tmp1072.i = malloc ulong, uint 0 ; [#uses=2]
+ %tmp1470.i = malloc ulong, uint 0 ; [#uses=1]
+ br label %cond_true.i114
+
+ cond_true.i114: ; preds = %cond_true.i114, %bb18.i144
+ %tmp17.i108 = getelementptr ulong* %tmp76.i105, ulong 0 ; [#uses=0]
+ %tmp20.i = getelementptr ulong* %tmp674.i, ulong 0 ; [#uses=0]
+ %tmp23.i111 = getelementptr ulong* %tmp1470.i, ulong 0 ; [#uses=0]
+ br bool false, label %cond_true40.i, label %cond_true.i114
+
+ cond_true40.i: ; preds = %cond_true40.i, %cond_true.i114
+ %tmp33.i115 = getelementptr ulong* %tmp1072.i, ulong 0 ; [#uses=0]
+ br bool false, label %bb142.i, label %cond_true40.i
+
+ cond_next54.i: ; preds = %cond_true76.i
+ %tmp57.i = getelementptr ulong* %tmp55.i, ulong 0 ; [#uses=0]
+ br bool false, label %bb64.i, label %bb69.i
+
+ bb64.i: ; preds = %cond_true76.i, %cond_next54.i
+ %tmp67.i117 = getelementptr ulong* %tmp76.i105, ulong 0 ; [#uses=0]
+ br bool false, label %bb114.i, label %cond_true111.i
+
+ bb69.i: ; preds = %cond_next54.i
+ br bool false, label %bb79.i, label %cond_true76.i
+
+ cond_true76.i: ; preds = %bb142.i, %bb69.i
+ %tmp48.i = getelementptr ulong* %tmp46.i, ulong 0 ; [#uses=0]
+ br bool false, label %bb64.i, label %cond_next54.i
+
+ bb79.i: ; preds = %bb69.i
+ br bool false, label %bb114.i, label %cond_true111.i
+
+ cond_true111.i: ; preds = %bb79.i, %bb64.i
+ %tmp84.i127 = getelementptr ulong* %tmp46.i, ulong 0 ; [#uses=0]
+ ret void
+
+ bb114.i: ; preds = %bb142.i, %bb79.i, %bb64.i
+ %tmp117.i = getelementptr ulong* %tmp76.i105, ulong 0 ; [#uses=0]
+ %tmp132.i131 = getelementptr ulong* %tmp674.i, ulong 0 ; [#uses=0]
+ %tmp122.i = getelementptr ulong* %tmp1072.i, ulong 0 ; [#uses=0]
+ ret void
+
+ bb142.i: ; preds = %cond_true40.i
+ %tmp46.i = load ulong** %BOT ; [#uses=2]
+ %tmp55.i = load ulong** %TOP ; [#uses=1]
+ br bool false, label %bb114.i, label %cond_true76.i
+ }
From sabre at nondot.org Tue Sep 26 23:58:37 2006
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 26 Sep 2006 23:58:37 -0500
Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/TailDuplication.cpp
Message-ID: <200609270458.k8R4wbM2012489@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Transforms/Scalar:
TailDuplication.cpp updated: 1.32 -> 1.33
---
Log message:
set DEBUG_TYPE right
---
Diffs of the changes: (+1 -0)
TailDuplication.cpp | 1 +
1 files changed, 1 insertion(+)
Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp
diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.32 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.33
--- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.32 Sun Sep 10 13:17:58 2006
+++ llvm/lib/Transforms/Scalar/TailDuplication.cpp Tue Sep 26 23:58:23 2006
@@ -18,6 +18,7 @@
//
//===----------------------------------------------------------------------===//
+#define DEBUG_TYPE "tailduplicate"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Constant.h"
#include "llvm/Function.h"
From isanbard at gmail.com Wed Sep 27 04:04:30 2006
From: isanbard at gmail.com (Bill Wendling)
Date: Wed, 27 Sep 2006 04:04:30 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp
Message-ID: <200609270904.k8R94UIC011238@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
PHIElimination.cpp updated: 1.45 -> 1.46
---
Log message:
PR878: http://llvm.org/PR878 : Instead of calculating the vreg to PHI use count everytime we get
a function, do it up front in linear time (going through all of the
instructions once). We create a map out of them. Then it's no problem to
use the information in it during elimination...
---
Diffs of the changes: (+44 -24)
PHIElimination.cpp | 68 ++++++++++++++++++++++++++++++++++-------------------
1 files changed, 44 insertions(+), 24 deletions(-)
Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.45 llvm/lib/CodeGen/PHIElimination.cpp:1.46
--- llvm/lib/CodeGen/PHIElimination.cpp:1.45 Sun Aug 27 07:54:01 2006
+++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 04:04:15 2006
@@ -34,12 +34,15 @@
struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
bool runOnMachineFunction(MachineFunction &Fn) {
+ analyzePHINodes(Fn);
+
bool Changed = false;
// Eliminate PHI instructions by inserting copies into predecessor blocks.
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
Changed |= EliminatePHINodes(Fn, *I);
+ VRegPHIUseCount.clear();
return Changed;
}
@@ -54,15 +57,26 @@
///
bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB);
void LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt,
- DenseMap &VUC);
+ MachineBasicBlock::iterator AfterPHIsIt);
+
+ /// analyzePHINodes - Gather information about the PHI nodes in
+ /// here. In particular, we want to map the number of uses of a virtual
+ /// register which is used in a PHI node. We map that to the BB the
+ /// vreg is coming from. This is used later to determine when the vreg
+ /// is killed in the BB.
+ ///
+ void analyzePHINodes(const MachineFunction& Fn);
+
+ typedef std::pair BBVRegPair;
+ typedef std::map VRegPHIUse;
+
+ VRegPHIUse VRegPHIUseCount;
};
RegisterPass X("phi-node-elimination",
"Eliminate PHI nodes for register allocation");
}
-
const PassInfo *llvm::PHIEliminationID = X.getPassInfo();
/// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in
@@ -72,20 +86,6 @@
if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI)
return false; // Quick exit for basic blocks without PHIs.
- // VRegPHIUseCount - Keep track of the number of times each virtual register
- // is used by PHI nodes in successors of this block.
- DenseMap VRegPHIUseCount;
- VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg());
-
- for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(),
- E = MBB.pred_end(); PI != E; ++PI)
- for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(),
- E = (*PI)->succ_end(); SI != E; ++SI)
- for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end();
- BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
- for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
- VRegPHIUseCount[BBI->getOperand(i).getReg()]++;
-
// Get an iterator to the first instruction after the last PHI node (this may
// also be the end of the basic block).
MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
@@ -93,9 +93,9 @@
AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI)
++AfterPHIsIt; // Skip over all of the PHI nodes...
- while (MBB.front().getOpcode() == TargetInstrInfo::PHI) {
- LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount);
- }
+ while (MBB.front().getOpcode() == TargetInstrInfo::PHI)
+ LowerAtomicPHINode(MBB, AfterPHIsIt);
+
return true;
}
@@ -115,8 +115,7 @@
/// atomic execution of PHIs. This lowering method is always correct all of the
/// time.
void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt,
- DenseMap &VRegPHIUseCount) {
+ MachineBasicBlock::iterator AfterPHIsIt) {
// Unlink the PHI node from the basic block, but don't delete the PHI yet.
MachineInstr *MPhi = MBB.remove(MBB.begin());
@@ -167,7 +166,9 @@
// node.
unsigned NumPreds = (MPhi->getNumOperands()-1)/2;
for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2)
- VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds;
+ VRegPHIUseCount[BBVRegPair(
+ MPhi->getOperand(i + 1).getMachineBasicBlock(),
+ MPhi->getOperand(i).getReg())] -= NumPreds;
// Now loop over all of the incoming arguments, changing them to copy into
// the IncomingReg register in the corresponding predecessor basic block.
@@ -219,7 +220,10 @@
//
// Is it used by any PHI instructions in this block?
- bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0;
+ bool ValueIsLive =
+ VRegPHIUseCount[BBVRegPair(
+ MPhi->getOperand(i).getMachineBasicBlock(),
+ SrcReg)] != 0;
std::vector OpSuccBlocks;
@@ -317,3 +321,19 @@
delete MPhi;
++NumAtomic;
}
+
+/// analyzePHINodes - Gather information about the PHI nodes in here. In
+/// particular, we want to map the number of uses of a virtual register which is
+/// used in a PHI node. We map that to the BB the vreg is coming from. This is
+/// used later to determine when the vreg is killed in the BB.
+///
+void PNE::analyzePHINodes(const MachineFunction& Fn) {
+ for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end();
+ I != E; ++I)
+ for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end();
+ BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
+ for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
+ VRegPHIUseCount[BBVRegPair(
+ BBI->getOperand(i + 1).getMachineBasicBlock(),
+ BBI->getOperand(i).getReg())]++;
+}
From sabre at nondot.org Wed Sep 27 11:44:26 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 11:44:26 -0500
Subject: [llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp
Message-ID: <200609271644.k8RGiQ8A009679@zion.cs.uiuc.edu>
Changes in directory llvm/utils/TableGen:
AsmWriterEmitter.cpp updated: 1.43 -> 1.44
---
Log message:
This:
AggregateString += "\0\0";
Doesn't add two nuls to the AggregateString (for obvious reasons), which
broke the asmprinter when the first character of an asm string was not
literal text.
---
Diffs of the changes: (+3 -2)
AsmWriterEmitter.cpp | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.43 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.44
--- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.43 Tue Sep 26 18:47:10 2006
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp Wed Sep 27 11:44:09 2006
@@ -484,9 +484,10 @@
// Build an aggregate string, and build a table of offsets into it.
std::map StringOffset;
std::string AggregateString;
- AggregateString += "\0\0";
+ AggregateString.push_back(0); // "\0"
+ AggregateString.push_back(0); // "\0"
- /// OpcodeInfo - Theis encodes the index of the string to use for the first
+ /// OpcodeInfo - This encodes the index of the string to use for the first
/// chunk of the output as well as indices used for operand printing.
std::vector OpcodeInfo;
From jlaskey at apple.com Wed Sep 27 11:55:34 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Wed, 27 Sep 2006 11:55:34 -0500
Subject: [llvm-commits] CVS:
llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp
Message-ID: <200609271655.k8RGtYmd009847@zion.cs.uiuc.edu>
Changes in directory llvm/test/Regression/C++Frontend:
2006-09-27-Debug-Protection.cpp added (r1.1)
---
Log message:
Make sure C++ protection shows up in debug info
---
Diffs of the changes: (+13 -0)
2006-09-27-Debug-Protection.cpp | 13 +++++++++++++
1 files changed, 13 insertions(+)
Index: llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp
diff -c /dev/null llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp:1.1
*** /dev/null Wed Sep 27 11:55:29 2006
--- llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp Wed Sep 27 11:55:19 2006
***************
*** 0 ****
--- 1,13 ----
+ // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep 'uint 1,' &&
+ // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep 'uint 2,'
+
+ class A {
+ public:
+ int x;
+ protected:
+ int y;
+ private:
+ int z;
+ };
+
+ A a;
From jlaskey at apple.com Wed Sep 27 11:58:43 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Wed, 27 Sep 2006 11:58:43 -0500
Subject: [llvm-commits] CVS: llvm-test/Makefile.programs
Message-ID: <200609271658.k8RGwhoN010022@zion.cs.uiuc.edu>
Changes in directory llvm-test:
Makefile.programs updated: 1.227 -> 1.228
---
Log message:
Disable -combiner-alias-analysis LLCBETA for the time being
---
Diffs of the changes: (+2 -2)
Makefile.programs | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.227 llvm-test/Makefile.programs:1.228
--- llvm-test/Makefile.programs:1.227 Tue Sep 26 12:47:19 2006
+++ llvm-test/Makefile.programs Wed Sep 27 11:58:28 2006
@@ -193,7 +193,7 @@
endif#DISABLE_DIFFS
ifeq ($(ARCH),PowerPC)
-LLCBETAOPTION := -combiner-alias-analysis
+#LLCBETAOPTION := -combiner-alias-analysis
endif
ifeq ($(ARCH),Alpha)
LLCBETAOPTION := -sched=list-td
@@ -203,7 +203,7 @@
LLCBETAOPTION := -sched=simple
endif
ifeq ($(ARCH),x86)
-LLCBETAOPTION := -combiner-alias-analysis
+#LLCBETAOPTION := -combiner-alias-analysis
endif
ifeq ($(ARCH),Sparc)
LLCBETAOPTION := -enable-sparc-v9-insts
From sabre at nondot.org Wed Sep 27 11:59:31 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 11:59:31 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp
Message-ID: <200609271659.k8RGxVwn010103@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
PHIElimination.cpp updated: 1.46 -> 1.47
---
Log message:
Temporarily revert this. This breaks Olden/bisort on PPC
---
Diffs of the changes: (+24 -44)
PHIElimination.cpp | 68 ++++++++++++++++++-----------------------------------
1 files changed, 24 insertions(+), 44 deletions(-)
Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.46 llvm/lib/CodeGen/PHIElimination.cpp:1.47
--- llvm/lib/CodeGen/PHIElimination.cpp:1.46 Wed Sep 27 04:04:15 2006
+++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 11:59:16 2006
@@ -34,15 +34,12 @@
struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
bool runOnMachineFunction(MachineFunction &Fn) {
- analyzePHINodes(Fn);
-
bool Changed = false;
// Eliminate PHI instructions by inserting copies into predecessor blocks.
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
Changed |= EliminatePHINodes(Fn, *I);
- VRegPHIUseCount.clear();
return Changed;
}
@@ -57,26 +54,15 @@
///
bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB);
void LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt);
-
- /// analyzePHINodes - Gather information about the PHI nodes in
- /// here. In particular, we want to map the number of uses of a virtual
- /// register which is used in a PHI node. We map that to the BB the
- /// vreg is coming from. This is used later to determine when the vreg
- /// is killed in the BB.
- ///
- void analyzePHINodes(const MachineFunction& Fn);
-
- typedef std::pair BBVRegPair;
- typedef std::map VRegPHIUse;
-
- VRegPHIUse VRegPHIUseCount;
+ MachineBasicBlock::iterator AfterPHIsIt,
+ DenseMap &VUC);
};
RegisterPass X("phi-node-elimination",
"Eliminate PHI nodes for register allocation");
}
+
const PassInfo *llvm::PHIEliminationID = X.getPassInfo();
/// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in
@@ -86,6 +72,20 @@
if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI)
return false; // Quick exit for basic blocks without PHIs.
+ // VRegPHIUseCount - Keep track of the number of times each virtual register
+ // is used by PHI nodes in successors of this block.
+ DenseMap VRegPHIUseCount;
+ VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg());
+
+ for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(),
+ E = MBB.pred_end(); PI != E; ++PI)
+ for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(),
+ E = (*PI)->succ_end(); SI != E; ++SI)
+ for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end();
+ BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
+ for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
+ VRegPHIUseCount[BBI->getOperand(i).getReg()]++;
+
// Get an iterator to the first instruction after the last PHI node (this may
// also be the end of the basic block).
MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
@@ -93,9 +93,9 @@
AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI)
++AfterPHIsIt; // Skip over all of the PHI nodes...
- while (MBB.front().getOpcode() == TargetInstrInfo::PHI)
- LowerAtomicPHINode(MBB, AfterPHIsIt);
-
+ while (MBB.front().getOpcode() == TargetInstrInfo::PHI) {
+ LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount);
+ }
return true;
}
@@ -115,7 +115,8 @@
/// atomic execution of PHIs. This lowering method is always correct all of the
/// time.
void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt) {
+ MachineBasicBlock::iterator AfterPHIsIt,
+ DenseMap &VRegPHIUseCount) {
// Unlink the PHI node from the basic block, but don't delete the PHI yet.
MachineInstr *MPhi = MBB.remove(MBB.begin());
@@ -166,9 +167,7 @@
// node.
unsigned NumPreds = (MPhi->getNumOperands()-1)/2;
for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2)
- VRegPHIUseCount[BBVRegPair(
- MPhi->getOperand(i + 1).getMachineBasicBlock(),
- MPhi->getOperand(i).getReg())] -= NumPreds;
+ VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds;
// Now loop over all of the incoming arguments, changing them to copy into
// the IncomingReg register in the corresponding predecessor basic block.
@@ -220,10 +219,7 @@
//
// Is it used by any PHI instructions in this block?
- bool ValueIsLive =
- VRegPHIUseCount[BBVRegPair(
- MPhi->getOperand(i).getMachineBasicBlock(),
- SrcReg)] != 0;
+ bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0;
std::vector OpSuccBlocks;
@@ -321,19 +317,3 @@
delete MPhi;
++NumAtomic;
}
-
-/// analyzePHINodes - Gather information about the PHI nodes in here. In
-/// particular, we want to map the number of uses of a virtual register which is
-/// used in a PHI node. We map that to the BB the vreg is coming from. This is
-/// used later to determine when the vreg is killed in the BB.
-///
-void PNE::analyzePHINodes(const MachineFunction& Fn) {
- for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end();
- I != E; ++I)
- for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end();
- BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
- for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
- VRegPHIUseCount[BBVRegPair(
- BBI->getOperand(i + 1).getMachineBasicBlock(),
- BBI->getOperand(i).getReg())]++;
-}
From jlaskey at apple.com Wed Sep 27 12:11:35 2006
From: jlaskey at apple.com (Jim Laskey)
Date: Wed, 27 Sep 2006 12:11:35 -0500
Subject: [llvm-commits] CVS: llvm-test/Makefile.programs
Message-ID: <200609271711.k8RHBZSe010301@zion.cs.uiuc.edu>
Changes in directory llvm-test:
Makefile.programs updated: 1.228 -> 1.229
---
Log message:
Setting LLCBETAOPTION to something useful
---
Diffs of the changes: (+2 -2)
Makefile.programs | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.228 llvm-test/Makefile.programs:1.229
--- llvm-test/Makefile.programs:1.228 Wed Sep 27 11:58:28 2006
+++ llvm-test/Makefile.programs Wed Sep 27 12:11:19 2006
@@ -193,7 +193,7 @@
endif#DISABLE_DIFFS
ifeq ($(ARCH),PowerPC)
-#LLCBETAOPTION := -combiner-alias-analysis
+LLCBETAOPTION := -fast -regalloc=local
endif
ifeq ($(ARCH),Alpha)
LLCBETAOPTION := -sched=list-td
@@ -203,7 +203,7 @@
LLCBETAOPTION := -sched=simple
endif
ifeq ($(ARCH),x86)
-#LLCBETAOPTION := -combiner-alias-analysis
+LLCBETAOPTION := -fast -regalloc=local
endif
ifeq ($(ARCH),Sparc)
LLCBETAOPTION := -enable-sparc-v9-insts
From dpatel at apple.com Wed Sep 27 12:18:20 2006
From: dpatel at apple.com (Devang Patel)
Date: Wed, 27 Sep 2006 12:18:20 -0500
Subject: [llvm-commits] CVS: llvm/lib/Analysis/PostDominators.cpp
Message-ID: <200609271718.k8RHIK1X010419@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Analysis:
PostDominators.cpp updated: 1.60 -> 1.61
---
Log message:
Fix DFS walk.
Fix http://llvm.org/bugs/show_bug.cgi?id=923
---
Diffs of the changes: (+27 -14)
PostDominators.cpp | 41 +++++++++++++++++++++++++++--------------
1 files changed, 27 insertions(+), 14 deletions(-)
Index: llvm/lib/Analysis/PostDominators.cpp
diff -u llvm/lib/Analysis/PostDominators.cpp:1.60 llvm/lib/Analysis/PostDominators.cpp:1.61
--- llvm/lib/Analysis/PostDominators.cpp:1.60 Thu Sep 7 18:29:19 2006
+++ llvm/lib/Analysis/PostDominators.cpp Wed Sep 27 12:18:05 2006
@@ -28,36 +28,49 @@
unsigned ImmediatePostDominators::DFSPass(BasicBlock *V, InfoRec &VInfo,
unsigned N) {
-
std::vector > workStack;
+ std::set visited;
workStack.push_back(std::make_pair(V, &VInfo));
do {
BasicBlock *currentBB = workStack.back().first;
InfoRec *currentVInfo = workStack.back().second;
- workStack.pop_back();
- currentVInfo->Semi = ++N;
- currentVInfo->Label = currentBB;
+ // Visit each block only once.
+ if (visited.count(currentBB) == 0) {
- Vertex.push_back(currentBB); // Vertex[n] = current;
- // Info[currentBB].Ancestor = 0;
- // Ancestor[n] = 0
- // Child[currentBB] = 0;
- currentVInfo->Size = 1; // Size[currentBB] = 1
+ visited.insert(currentBB);
+ currentVInfo->Semi = ++N;
+ currentVInfo->Label = currentBB;
+
+ Vertex.push_back(currentBB); // Vertex[n] = current;
+ // Info[currentBB].Ancestor = 0;
+ // Ancestor[n] = 0
+ // Child[currentBB] = 0;
+ currentVInfo->Size = 1; // Size[currentBB] = 1
+ }
- // For PostDominators, we want to walk predecessors rather than successors
- // as we do in forward Dominators.
+ // Visit children
+ bool visitChild = false;
for (pred_iterator PI = pred_begin(currentBB), PE = pred_end(currentBB);
- PI != PE; ++PI) {
+ PI != PE && !visitChild; ++PI) {
InfoRec &SuccVInfo = Info[*PI];
if (SuccVInfo.Semi == 0) {
SuccVInfo.Parent = currentBB;
-
- workStack.push_back(std::make_pair(*PI, &SuccVInfo));
+ if (visited.count (*PI) == 0) {
+ workStack.push_back(std::make_pair(*PI, &SuccVInfo));
+ visitChild = true;
+ }
}
}
+
+ // If all children are visited or if this block has no child then pop this
+ // block out of workStack.
+ if (!visitChild)
+ workStack.pop_back();
+
} while (!workStack.empty());
+
return N;
}
From sabre at nondot.org Wed Sep 27 13:29:54 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 13:29:54 -0500
Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Message-ID: <200609271829.k8RITs32011803@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Target/X86:
X86ISelLowering.cpp updated: 1.264 -> 1.265
---
Log message:
silence warnings in release build
---
Diffs of the changes: (+14 -14)
X86ISelLowering.cpp | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.264 llvm/lib/Target/X86/X86ISelLowering.cpp:1.265
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.264 Mon Sep 25 22:57:53 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Sep 27 13:29:38 2006
@@ -4286,20 +4286,20 @@
return LowerX86_64CCCCallTo(Op, DAG);
else
switch (CallingConv) {
- case CallingConv::Fast:
+ default:
+ assert(0 && "Unsupported calling convention");
+ case CallingConv::Fast:
if (EnableFastCC) {
return LowerFastCCCallTo(Op, DAG, false);
}
// Falls through
- case CallingConv::C:
- case CallingConv::CSRet:
+ case CallingConv::C:
+ case CallingConv::CSRet:
return LowerCCCCallTo(Op, DAG);
- case CallingConv::X86_StdCall:
+ case CallingConv::X86_StdCall:
return LowerStdCallCCCallTo(Op, DAG);
- case CallingConv::X86_FastCall:
+ case CallingConv::X86_FastCall:
return LowerFastCCCallTo(Op, DAG, true);
- default:
- assert(0 && "Unsupported calling convention");
}
}
@@ -4421,22 +4421,22 @@
return LowerX86_64CCCArguments(Op, DAG);
else
switch(CC) {
- case CallingConv::Fast:
+ default:
+ assert(0 && "Unsupported calling convention");
+ case CallingConv::Fast:
if (EnableFastCC) {
return LowerFastCCArguments(Op, DAG);
}
// Falls through
- case CallingConv::C:
- case CallingConv::CSRet:
+ case CallingConv::C:
+ case CallingConv::CSRet:
return LowerCCCArguments(Op, DAG);
- case CallingConv::X86_StdCall:
+ case CallingConv::X86_StdCall:
MF.getInfo()->setDecorationStyle(StdCall);
return LowerStdCallCCArguments(Op, DAG);
- case CallingConv::X86_FastCall:
+ case CallingConv::X86_FastCall:
MF.getInfo()->setDecorationStyle(FastCall);
return LowerFastCallCCArguments(Op, DAG);
- default:
- assert(0 && "Unsupported calling convention");
}
}
From isanbard at gmail.com Wed Sep 27 16:57:31 2006
From: isanbard at gmail.com (Bill Wendling)
Date: Wed, 27 Sep 2006 16:57:31 -0500
Subject: [llvm-commits] CVS:
llvm-test/External/SPEC/CFP2006/454.calculix/Makefile
Message-ID: <200609272157.k8RLvVBY015540@zion.cs.uiuc.edu>
Changes in directory llvm-test/External/SPEC/CFP2006/454.calculix:
Makefile updated: 1.3 -> 1.4
---
Log message:
Was outputing the wrong filename. Needed to have the correct recipe for some of
the files.
---
Diffs of the changes: (+11 -3)
Makefile | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
Index: llvm-test/External/SPEC/CFP2006/454.calculix/Makefile
diff -u llvm-test/External/SPEC/CFP2006/454.calculix/Makefile:1.3 llvm-test/External/SPEC/CFP2006/454.calculix/Makefile:1.4
--- llvm-test/External/SPEC/CFP2006/454.calculix/Makefile:1.3 Thu Sep 7 19:59:14 2006
+++ llvm-test/External/SPEC/CFP2006/454.calculix/Makefile Wed Sep 27 16:57:16 2006
@@ -241,15 +241,20 @@
-I$(SPEC_BENCH_DIR)/src \
-I$(SPEC_BENCH_DIR)/src/include
+NAGFORTRAN_FLAGS += \
+ -I$(SPEC_BENCH_DIR)/src \
+ -I$(SPEC_BENCH_DIR)/src/SPOOLES \
+ -maxcontin=256
+
include ../../Makefile.spec2006
include $(PROJ_SRC_ROOT)/Makefile.FORTRAN
ifeq ($(RUN_TYPE),test)
RUN_OPTIONS := -i beampic
- STDOUT_FILENAME := beampic.log
+ STDOUT_FILENAME := beampic.dat
else
RUN_OPTIONS := -i stairs
- STDOUT_FILENAME := stairs.log
+ STDOUT_FILENAME := stairs.dat
endif
##===----------------------------------------------------------------------===##
@@ -282,6 +287,9 @@
$(addprefix dstree_,$(notdir $(DSTREESources))) : dstree_% : \
$(SPEC_BENCH_DIR)/src/SPOOLES/DSTree/src/%
cp $< $@
+$(addprefix dv_,$(notdir $(DVSources))) : dv_% : \
+$(SPEC_BENCH_DIR)/src/SPOOLES/DV/src/%
+ cp $< $@
$(addprefix dmtx_,$(notdir $(DENSEMTXSources))) : dmtx_% : \
$(SPEC_BENCH_DIR)/src/SPOOLES/DenseMtx/src/%
cp $< $@
@@ -312,7 +320,7 @@
$(addprefix ivl_,$(notdir $(IVLSources))) : ivl_% : \
$(SPEC_BENCH_DIR)/src/SPOOLES/IVL/src/%
cp $< $@
-$(addprefix ideq_,$(notdir $(IEQSources))) : ideq_% : \
+$(addprefix ideq_,$(notdir $(IDEQSources))) : ideq_% : \
$(SPEC_BENCH_DIR)/src/SPOOLES/Ideq/src/%
cp $< $@
$(addprefix inpmtx_,$(notdir $(INPMTXSources))) : inpmtx_% : \
From isanbard at gmail.com Wed Sep 27 17:37:50 2006
From: isanbard at gmail.com (Bill Wendling)
Date: Wed, 27 Sep 2006 17:37:50 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp
Message-ID: <200609272237.k8RMbo0M016240@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
PHIElimination.cpp updated: 1.47 -> 1.48
---
Log message:
Reapplying this patch. With the newest commits, the error in Olden/bisort
has disappeared.
---
Diffs of the changes: (+44 -24)
PHIElimination.cpp | 68 ++++++++++++++++++++++++++++++++++-------------------
1 files changed, 44 insertions(+), 24 deletions(-)
Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.47 llvm/lib/CodeGen/PHIElimination.cpp:1.48
--- llvm/lib/CodeGen/PHIElimination.cpp:1.47 Wed Sep 27 11:59:16 2006
+++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 17:37:35 2006
@@ -34,12 +34,15 @@
struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
bool runOnMachineFunction(MachineFunction &Fn) {
+ analyzePHINodes(Fn);
+
bool Changed = false;
// Eliminate PHI instructions by inserting copies into predecessor blocks.
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
Changed |= EliminatePHINodes(Fn, *I);
+ VRegPHIUseCount.clear();
return Changed;
}
@@ -54,15 +57,26 @@
///
bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB);
void LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt,
- DenseMap &VUC);
+ MachineBasicBlock::iterator AfterPHIsIt);
+
+ /// analyzePHINodes - Gather information about the PHI nodes in
+ /// here. In particular, we want to map the number of uses of a virtual
+ /// register which is used in a PHI node. We map that to the BB the
+ /// vreg is coming from. This is used later to determine when the vreg
+ /// is killed in the BB.
+ ///
+ void analyzePHINodes(const MachineFunction& Fn);
+
+ typedef std::pair BBVRegPair;
+ typedef std::map VRegPHIUse;
+
+ VRegPHIUse VRegPHIUseCount;
};
RegisterPass X("phi-node-elimination",
"Eliminate PHI nodes for register allocation");
}
-
const PassInfo *llvm::PHIEliminationID = X.getPassInfo();
/// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in
@@ -72,20 +86,6 @@
if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI)
return false; // Quick exit for basic blocks without PHIs.
- // VRegPHIUseCount - Keep track of the number of times each virtual register
- // is used by PHI nodes in successors of this block.
- DenseMap VRegPHIUseCount;
- VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg());
-
- for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(),
- E = MBB.pred_end(); PI != E; ++PI)
- for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(),
- E = (*PI)->succ_end(); SI != E; ++SI)
- for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end();
- BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
- for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
- VRegPHIUseCount[BBI->getOperand(i).getReg()]++;
-
// Get an iterator to the first instruction after the last PHI node (this may
// also be the end of the basic block).
MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
@@ -93,9 +93,9 @@
AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI)
++AfterPHIsIt; // Skip over all of the PHI nodes...
- while (MBB.front().getOpcode() == TargetInstrInfo::PHI) {
- LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount);
- }
+ while (MBB.front().getOpcode() == TargetInstrInfo::PHI)
+ LowerAtomicPHINode(MBB, AfterPHIsIt);
+
return true;
}
@@ -115,8 +115,7 @@
/// atomic execution of PHIs. This lowering method is always correct all of the
/// time.
void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt,
- DenseMap &VRegPHIUseCount) {
+ MachineBasicBlock::iterator AfterPHIsIt) {
// Unlink the PHI node from the basic block, but don't delete the PHI yet.
MachineInstr *MPhi = MBB.remove(MBB.begin());
@@ -167,7 +166,9 @@
// node.
unsigned NumPreds = (MPhi->getNumOperands()-1)/2;
for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2)
- VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds;
+ VRegPHIUseCount[BBVRegPair(
+ MPhi->getOperand(i + 1).getMachineBasicBlock(),
+ MPhi->getOperand(i).getReg())] -= NumPreds;
// Now loop over all of the incoming arguments, changing them to copy into
// the IncomingReg register in the corresponding predecessor basic block.
@@ -219,7 +220,10 @@
//
// Is it used by any PHI instructions in this block?
- bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0;
+ bool ValueIsLive =
+ VRegPHIUseCount[BBVRegPair(
+ MPhi->getOperand(i).getMachineBasicBlock(),
+ SrcReg)] != 0;
std::vector OpSuccBlocks;
@@ -317,3 +321,19 @@
delete MPhi;
++NumAtomic;
}
+
+/// analyzePHINodes - Gather information about the PHI nodes in here. In
+/// particular, we want to map the number of uses of a virtual register which is
+/// used in a PHI node. We map that to the BB the vreg is coming from. This is
+/// used later to determine when the vreg is killed in the BB.
+///
+void PNE::analyzePHINodes(const MachineFunction& Fn) {
+ for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end();
+ I != E; ++I)
+ for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end();
+ BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
+ for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
+ VRegPHIUseCount[BBVRegPair(
+ BBI->getOperand(i + 1).getMachineBasicBlock(),
+ BBI->getOperand(i).getReg())]++;
+}
From sabre at nondot.org Wed Sep 27 19:04:36 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 19:04:36 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp
Message-ID: <200609280004.k8S04aYJ017656@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
PHIElimination.cpp updated: 1.48 -> 1.49
---
Log message:
re-revert this patch, bisort and mst are still broken in Olden.
---
Diffs of the changes: (+3 -3)
PHIElimination.cpp | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.48 llvm/lib/CodeGen/PHIElimination.cpp:1.49
--- llvm/lib/CodeGen/PHIElimination.cpp:1.48 Wed Sep 27 17:37:35 2006
+++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 19:04:21 2006
@@ -64,7 +64,7 @@
/// register which is used in a PHI node. We map that to the BB the
/// vreg is coming from. This is used later to determine when the vreg
/// is killed in the BB.
- ///
+ ///
void analyzePHINodes(const MachineFunction& Fn);
typedef std::pair BBVRegPair;
@@ -220,7 +220,7 @@
//
// Is it used by any PHI instructions in this block?
- bool ValueIsLive =
+ bool ValueIsLive =
VRegPHIUseCount[BBVRegPair(
MPhi->getOperand(i).getMachineBasicBlock(),
SrcReg)] != 0;
@@ -326,7 +326,7 @@
/// particular, we want to map the number of uses of a virtual register which is
/// used in a PHI node. We map that to the BB the vreg is coming from. This is
/// used later to determine when the vreg is killed in the BB.
-///
+///
void PNE::analyzePHINodes(const MachineFunction& Fn) {
for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end();
I != E; ++I)
From evan.cheng at apple.com Wed Sep 27 19:07:35 2006
From: evan.cheng at apple.com (Evan Cheng)
Date: Wed, 27 Sep 2006 19:07:35 -0500
Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MRegisterInfo.h
Message-ID: <200609280007.k8S07Z2a017716@zion.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Target:
MRegisterInfo.h updated: 1.83 -> 1.84
---
Log message:
- Added a hook processFunctionBeforeCalleeSaveScn(). This is called by PEI just
before it determines which callee-save registers are to be spilled. This allows
the target to make changes such as forcing certain physical registers to be
spilled.
- Modified comments. It's important to note the order of registers in the array
returns by getCalleeSaveRegs() determines the order of callee save spill code.
---
Diffs of the changes: (+10 -4)
MRegisterInfo.h | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
Index: llvm/include/llvm/Target/MRegisterInfo.h
diff -u llvm/include/llvm/Target/MRegisterInfo.h:1.83 llvm/include/llvm/Target/MRegisterInfo.h:1.84
--- llvm/include/llvm/Target/MRegisterInfo.h:1.83 Wed Aug 23 19:21:32 2006
+++ llvm/include/llvm/Target/MRegisterInfo.h Wed Sep 27 19:07:19 2006
@@ -283,7 +283,9 @@
}
/// getCalleeSaveRegs - Return a null-terminated list of all of the
- /// callee-save registers on this target.
+ /// callee-save registers on this target. The register should be in the
+ /// order of desired callee-save stack frame offset. The first register is
+ /// closed to the incoming stack pointer if stack grows down, and vice versa.
virtual const unsigned* getCalleeSaveRegs() const = 0;
/// getCalleeSaveRegClasses - Return a null-terminated list of the preferred
@@ -371,12 +373,16 @@
assert(0 && "Call Frame Pseudo Instructions do not exist on this target!");
}
+ /// processFunctionBeforeCalleeSaveScan - This method is called immediately
+ /// before PrologEpilogInserter scans the physical registers used to determine
+ /// what callee-save registers should be spilled. This method is optional.
+ virtual void processFunctionBeforeCalleeSaveScan(MachineFunction &MF) const {
+ }
+
/// processFunctionBeforeFrameFinalized - This method is called immediately
/// before the specified functions frame layout (MF.getFrameInfo()) is
/// finalized. Once the frame is finalized, MO_FrameIndex operands are
- /// replaced with direct constants. This method is optional. The return value
- /// is the number of instructions added to (negative if removed from) the
- /// basic block
+ /// replaced with direct constants. This method is optional.
///
virtual void processFunctionBeforeFrameFinalized(MachineFunction &MF) const {
}
From evan.cheng at apple.com Wed Sep 27 19:10:42 2006
From: evan.cheng at apple.com (Evan Cheng)
Date: Wed, 27 Sep 2006 19:10:42 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp
Message-ID: <200609280010.k8S0AgKq017783@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
PrologEpilogInserter.cpp updated: 1.59 -> 1.60
---
Log message:
PEI now place callee save spills closest to the address pointed to by the
incoming stack. This allows X86 backend to use push / pop in epilogue /
prologue.
---
Diffs of the changes: (+67 -11)
PrologEpilogInserter.cpp | 78 ++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 67 insertions(+), 11 deletions(-)
Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.59 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.60
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.59 Tue Sep 26 17:29:31 2006
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Wed Sep 27 19:10:27 2006
@@ -25,6 +25,7 @@
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Support/Compiler.h"
+#include
using namespace llvm;
namespace {
@@ -42,15 +43,19 @@
if (MachineDebugInfo *DI = getAnalysisToUpdate()) {
Fn.getFrameInfo()->setMachineDebugInfo(DI);
}
-
+
+ // Allow the target machine to make some adjustments to the function
+ // e.g. UsedPhysRegs before calculateCalleeSavedRegisters.
+ Fn.getTarget().getRegisterInfo()->processFunctionBeforeCalleeSaveScan(Fn);
+
// Scan the function for modified callee saved registers and insert spill
// code for any callee saved registers that are modified. Also calculate
// the MaxCallFrameSize and HasCalls variables for the function's frame
// information and eliminates call frame pseudo instructions.
calculateCalleeSavedRegisters(Fn);
- // Add the code to save and restore the caller saved registers
- saveCallerSavedRegisters(Fn);
+ // Add the code to save and restore the callee saved registers
+ saveCalleeSavedRegisters(Fn);
// Allow the target machine to make final modifications to the function
// before the frame layout is finalized.
@@ -75,8 +80,12 @@
}
private:
+ // MinCSFrameIndex, MaxCSFrameIndex - Keeps the range of callee save
+ // stack frame indexes.
+ unsigned MinCSFrameIndex, MaxCSFrameIndex;
+
void calculateCalleeSavedRegisters(MachineFunction &Fn);
- void saveCallerSavedRegisters(MachineFunction &Fn);
+ void saveCalleeSavedRegisters(MachineFunction &Fn);
void calculateFrameObjectOffsets(MachineFunction &Fn);
void replaceFrameIndices(MachineFunction &Fn);
void insertPrologEpilogCode(MachineFunction &Fn);
@@ -90,7 +99,7 @@
FunctionPass *llvm::createPrologEpilogCodeInserter() { return new PEI(); }
-/// calculateCalleeSavedRegisters - Scan the function for modified caller saved
+/// calculateCalleeSavedRegisters - Scan the function for modified callee saved
/// registers. Also calculate the MaxCallFrameSize and HasCalls variables for
/// the function's frame information and eliminates call frame pseudo
/// instructions.
@@ -157,7 +166,7 @@
}
if (CSI.empty())
- return; // Early exit if no caller saved registers are modified!
+ return; // Early exit if no callee saved registers are modified!
unsigned NumFixedSpillSlots;
const std::pair *FixedSpillSlots =
@@ -165,6 +174,8 @@
// Now that we know which registers need to be saved and restored, allocate
// stack slots for them.
+ MinCSFrameIndex = INT_MAX;
+ MaxCSFrameIndex = 0;
for (unsigned i = 0, e = CSI.size(); i != e; ++i) {
unsigned Reg = CSI[i].getReg();
const TargetRegisterClass *RC = CSI[i].getRegClass();
@@ -180,6 +191,8 @@
if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) {
// Nope, just spill it anywhere convenient.
FrameIdx = FFI->CreateStackObject(RC->getSize(), RC->getAlignment());
+ if ((unsigned)FrameIdx < MinCSFrameIndex) MinCSFrameIndex = FrameIdx;
+ if ((unsigned)FrameIdx > MaxCSFrameIndex) MaxCSFrameIndex = FrameIdx;
} else {
// Spill it to the stack where we must.
FrameIdx = FFI->CreateFixedObject(RC->getSize(), FixedSlot->second);
@@ -190,15 +203,15 @@
FFI->setCalleeSavedInfo(CSI);
}
-/// saveCallerSavedRegisters - Insert spill code for any caller saved registers
+/// saveCalleeSavedRegisters - Insert spill code for any callee saved registers
/// that are modified in the function.
///
-void PEI::saveCallerSavedRegisters(MachineFunction &Fn) {
+void PEI::saveCalleeSavedRegisters(MachineFunction &Fn) {
// Get callee saved register information.
MachineFrameInfo *FFI = Fn.getFrameInfo();
const std::vector &CSI = FFI->getCalleeSavedInfo();
- // Early exit if no caller saved registers are modified!
+ // Early exit if no callee saved registers are modified!
if (CSI.empty())
return;
@@ -298,7 +311,49 @@
if (FixedOff > Offset) Offset = FixedOff;
}
+ // First assign frame offsets to stack objects that are used to spill
+ // callee save registers.
+ if (StackGrowsDown) {
+ for (unsigned i = 0, e = FFI->getObjectIndexEnd(); i != e; ++i) {
+ if (i < MinCSFrameIndex || i > MaxCSFrameIndex)
+ continue;
+
+ // If stack grows down, we need to add size of find the lowest
+ // address of the object.
+ Offset += FFI->getObjectSize(i);
+
+ unsigned Align = FFI->getObjectAlignment(i);
+ // If the alignment of this object is greater than that of the stack, then
+ // increase the stack alignment to match.
+ MaxAlign = std::max(MaxAlign, Align);
+ // Adjust to alignment boundary
+ Offset = (Offset+Align-1)/Align*Align;
+
+ FFI->setObjectOffset(i, -Offset); // Set the computed offset
+ }
+ } else {
+ for (int i = FFI->getObjectIndexEnd()-1; i >= 0; --i) {
+ if ((unsigned)i < MinCSFrameIndex || (unsigned)i > MaxCSFrameIndex)
+ continue;
+
+ unsigned Align = FFI->getObjectAlignment(i);
+ // If the alignment of this object is greater than that of the stack, then
+ // increase the stack alignment to match.
+ MaxAlign = std::max(MaxAlign, Align);
+ // Adjust to alignment boundary
+ Offset = (Offset+Align-1)/Align*Align;
+
+ FFI->setObjectOffset(i, Offset);
+ Offset += FFI->getObjectSize(i);
+ }
+ }
+
+ // Then assign frame offsets to stack objects that are not used to spill
+ // callee save registers.
for (unsigned i = 0, e = FFI->getObjectIndexEnd(); i != e; ++i) {
+ if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex)
+ continue;
+
// If stack grows down, we need to add size of find the lowest
// address of the object.
if (StackGrowsDown)
@@ -319,6 +374,7 @@
}
}
+
// Align the final stack pointer offset, but only if there are calls in the
// function. This ensures that any calls to subroutines have their stack
// frames suitable aligned.
@@ -335,8 +391,8 @@
}
-/// insertPrologEpilogCode - Scan the function for modified caller saved
-/// registers, insert spill code for these caller saved registers, then add
+/// insertPrologEpilogCode - Scan the function for modified callee saved
+/// registers, insert spill code for these callee saved registers, then add
/// prolog and epilog code to the function.
///
void PEI::insertPrologEpilogCode(MachineFunction &Fn) {
From sabre at nondot.org Wed Sep 27 19:12:09 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 19:12:09 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp
Message-ID: <200609280012.k8S0C96R017872@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
PHIElimination.cpp updated: 1.49 -> 1.50
---
Log message:
re-re-revert this, back to the right revision. It currently breaks bisort/mst
in olden among others.
---
Diffs of the changes: (+24 -44)
PHIElimination.cpp | 68 ++++++++++++++++++-----------------------------------
1 files changed, 24 insertions(+), 44 deletions(-)
Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.49 llvm/lib/CodeGen/PHIElimination.cpp:1.50
--- llvm/lib/CodeGen/PHIElimination.cpp:1.49 Wed Sep 27 19:04:21 2006
+++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 19:11:54 2006
@@ -34,15 +34,12 @@
struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
bool runOnMachineFunction(MachineFunction &Fn) {
- analyzePHINodes(Fn);
-
bool Changed = false;
// Eliminate PHI instructions by inserting copies into predecessor blocks.
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
Changed |= EliminatePHINodes(Fn, *I);
- VRegPHIUseCount.clear();
return Changed;
}
@@ -57,26 +54,15 @@
///
bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB);
void LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt);
-
- /// analyzePHINodes - Gather information about the PHI nodes in
- /// here. In particular, we want to map the number of uses of a virtual
- /// register which is used in a PHI node. We map that to the BB the
- /// vreg is coming from. This is used later to determine when the vreg
- /// is killed in the BB.
- ///
- void analyzePHINodes(const MachineFunction& Fn);
-
- typedef std::pair BBVRegPair;
- typedef std::map VRegPHIUse;
-
- VRegPHIUse VRegPHIUseCount;
+ MachineBasicBlock::iterator AfterPHIsIt,
+ DenseMap &VUC);
};
RegisterPass X("phi-node-elimination",
"Eliminate PHI nodes for register allocation");
}
+
const PassInfo *llvm::PHIEliminationID = X.getPassInfo();
/// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in
@@ -86,6 +72,20 @@
if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI)
return false; // Quick exit for basic blocks without PHIs.
+ // VRegPHIUseCount - Keep track of the number of times each virtual register
+ // is used by PHI nodes in successors of this block.
+ DenseMap VRegPHIUseCount;
+ VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg());
+
+ for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(),
+ E = MBB.pred_end(); PI != E; ++PI)
+ for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(),
+ E = (*PI)->succ_end(); SI != E; ++SI)
+ for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end();
+ BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
+ for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
+ VRegPHIUseCount[BBI->getOperand(i).getReg()]++;
+
// Get an iterator to the first instruction after the last PHI node (this may
// also be the end of the basic block).
MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
@@ -93,9 +93,9 @@
AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI)
++AfterPHIsIt; // Skip over all of the PHI nodes...
- while (MBB.front().getOpcode() == TargetInstrInfo::PHI)
- LowerAtomicPHINode(MBB, AfterPHIsIt);
-
+ while (MBB.front().getOpcode() == TargetInstrInfo::PHI) {
+ LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount);
+ }
return true;
}
@@ -115,7 +115,8 @@
/// atomic execution of PHIs. This lowering method is always correct all of the
/// time.
void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt) {
+ MachineBasicBlock::iterator AfterPHIsIt,
+ DenseMap &VRegPHIUseCount) {
// Unlink the PHI node from the basic block, but don't delete the PHI yet.
MachineInstr *MPhi = MBB.remove(MBB.begin());
@@ -166,9 +167,7 @@
// node.
unsigned NumPreds = (MPhi->getNumOperands()-1)/2;
for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2)
- VRegPHIUseCount[BBVRegPair(
- MPhi->getOperand(i + 1).getMachineBasicBlock(),
- MPhi->getOperand(i).getReg())] -= NumPreds;
+ VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds;
// Now loop over all of the incoming arguments, changing them to copy into
// the IncomingReg register in the corresponding predecessor basic block.
@@ -220,10 +219,7 @@
//
// Is it used by any PHI instructions in this block?
- bool ValueIsLive =
- VRegPHIUseCount[BBVRegPair(
- MPhi->getOperand(i).getMachineBasicBlock(),
- SrcReg)] != 0;
+ bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0;
std::vector OpSuccBlocks;
@@ -321,19 +317,3 @@
delete MPhi;
++NumAtomic;
}
-
-/// analyzePHINodes - Gather information about the PHI nodes in here. In
-/// particular, we want to map the number of uses of a virtual register which is
-/// used in a PHI node. We map that to the BB the vreg is coming from. This is
-/// used later to determine when the vreg is killed in the BB.
-///
-void PNE::analyzePHINodes(const MachineFunction& Fn) {
- for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end();
- I != E; ++I)
- for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end();
- BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
- for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
- VRegPHIUseCount[BBVRegPair(
- BBI->getOperand(i + 1).getMachineBasicBlock(),
- BBI->getOperand(i).getReg())]++;
-}
From sabre at nondot.org Wed Sep 27 19:32:11 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 19:32:11 -0500
Subject: [llvm-commits] CVS: llvm/lib/Support/ManagedStatic.cpp
Message-ID: <200609280032.k8S0WB4f018226@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Support:
ManagedStatic.cpp added (r1.1)
---
Log message:
new helper class to provide more explicit management of static ctor/dtors.
---
Diffs of the changes: (+53 -0)
ManagedStatic.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 53 insertions(+)
Index: llvm/lib/Support/ManagedStatic.cpp
diff -c /dev/null llvm/lib/Support/ManagedStatic.cpp:1.1
*** /dev/null Wed Sep 27 19:32:05 2006
--- llvm/lib/Support/ManagedStatic.cpp Wed Sep 27 19:31:55 2006
***************
*** 0 ****
--- 1,53 ----
+ //===-- ManagedStatic.cpp - Static Global wrapper -------------------------===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Chris Lattner and is distributed under
+ // the University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This file implements the ManagedStatic class and llvm_shutdown().
+ //
+ //===----------------------------------------------------------------------===//
+
+ #include "llvm/Support/ManagedStatic.h"
+ #include
+ using namespace llvm;
+
+ static const ManagedStaticBase *StaticList = 0;
+
+ void ManagedStaticBase::RegisterManagedStatic(void *ObjPtr,
+ void (*Deleter)(void*)) const {
+ assert(Ptr == 0 && DeleterFn == 0 && Next == 0 &&
+ "Partially init static?");
+ Ptr = ObjPtr;
+ DeleterFn = Deleter;
+
+ // Add to list of managed statics.
+ Next = StaticList;
+ StaticList = this;
+ }
+
+ void ManagedStaticBase::destroy() const {
+ assert(Ptr && DeleterFn && "ManagedStatic not initialized correctly!");
+ assert(StaticList == this &&
+ "Not destroyed in reverse order of construction?");
+ // Unlink from list.
+ StaticList = Next;
+ Next = 0;
+
+ // Destroy memory.
+ DeleterFn(Ptr);
+
+ // Cleanup.
+ Ptr = 0;
+ DeleterFn = 0;
+ }
+
+ /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
+ void llvm_shutdown() {
+ while (StaticList)
+ StaticList->destroy();
+ }
+
From sabre at nondot.org Wed Sep 27 19:32:10 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 19:32:10 -0500
Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ManagedStatic.h
Message-ID: <200609280032.k8S0WAuo018221@zion.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Support:
ManagedStatic.h added (r1.1)
---
Log message:
new helper class to provide more explicit management of static ctor/dtors.
---
Diffs of the changes: (+79 -0)
ManagedStatic.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+)
Index: llvm/include/llvm/Support/ManagedStatic.h
diff -c /dev/null llvm/include/llvm/Support/ManagedStatic.h:1.1
*** /dev/null Wed Sep 27 19:32:05 2006
--- llvm/include/llvm/Support/ManagedStatic.h Wed Sep 27 19:31:55 2006
***************
*** 0 ****
--- 1,79 ----
+ //===-- llvm/Support/ManagedStatic.h - Static Global wrapper ----*- C++ -*-===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Chris Lattner and is distributed under
+ // the University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This file defines the ManagedStatic class and the llvm_shutdown() function.
+ //
+ //===----------------------------------------------------------------------===//
+
+ #ifndef LLVM_SUPPORT_MANAGED_STATIC_H
+ #define LLVM_SUPPORT_MANAGED_STATIC_H
+
+ namespace llvm {
+
+ /// object_deleter - Helper method for ManagedStatic.
+ ///
+ template
+ void object_deleter(void *Ptr) {
+ delete (C*)Ptr;
+ }
+
+ /// ManagedStaticBase - Common base class for ManagedStatic instances.
+ class ManagedStaticBase {
+ protected:
+ // This should only be used as a static variable, which guarantees that this
+ // will be zero initialized.
+ mutable void *Ptr;
+ mutable void (*DeleterFn)(void*);
+ mutable const ManagedStaticBase *Next;
+
+ void RegisterManagedStatic(void *ObjPtr, void (*deleter)(void*)) const;
+ public:
+ void destroy() const;
+ };
+
+ /// ManagedStatic - This transparently changes the behavior of global statics to
+ /// be lazily constructed on demand (good for reducing startup times of dynamic
+ /// libraries that link in LLVM components) and for making destruction be
+ /// explicit through the llvm_shutdown() function call.
+ ///
+ template
+ class ManagedStatic : public ManagedStaticBase {
+ public:
+
+ // Accessors.
+ C &operator*() {
+ if (!Ptr) LazyInit();
+ return *static_cast(Ptr);
+ }
+ C *operator->() {
+ if (!Ptr) LazyInit();
+ return static_cast(Ptr);
+ }
+ const C &operator*() const {
+ if (!Ptr) LazyInit();
+ return *static_cast(Ptr);
+ }
+ const C *operator->() const {
+ if (!Ptr) LazyInit();
+ return static_cast(Ptr);
+ }
+
+ public:
+ void LazyInit() const {
+ RegisterManagedStatic(new C(), object_deleter);
+ }
+ };
+
+
+ /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
+ void llvm_shutdown();
+
+ }
+
+ #endif
From sabre at nondot.org Wed Sep 27 19:35:21 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 19:35:21 -0500
Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Message-ID: <200609280035.k8S0ZLbn018318@zion.cs.uiuc.edu>
Changes in directory llvm/lib/VMCore:
Constants.cpp updated: 1.160 -> 1.161
---
Log message:
Use the new ManagedStatic class to explicitly manage static variables, eliminating static ctors/dtors
---
Diffs of the changes: (+47 -71)
Constants.cpp | 118 +++++++++++++++++++++++-----------------------------------
1 files changed, 47 insertions(+), 71 deletions(-)
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.160 llvm/lib/VMCore/Constants.cpp:1.161
--- llvm/lib/VMCore/Constants.cpp:1.160 Sun Sep 17 14:14:47 2006
+++ llvm/lib/VMCore/Constants.cpp Wed Sep 27 19:35:06 2006
@@ -21,6 +21,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ManagedStatic.h"
#include
#include
using namespace llvm;
@@ -879,15 +880,15 @@
//---- ConstantUInt::get() and ConstantSInt::get() implementations...
//
-static ValueMap< int64_t, Type, ConstantSInt> SIntConstants;
-static ValueMap UIntConstants;
+static ManagedStatic > SIntConstants;
+static ManagedStatic > UIntConstants;
ConstantSInt *ConstantSInt::get(const Type *Ty, int64_t V) {
- return SIntConstants.getOrCreate(Ty, V);
+ return SIntConstants->getOrCreate(Ty, V);
}
ConstantUInt *ConstantUInt::get(const Type *Ty, uint64_t V) {
- return UIntConstants.getOrCreate(Ty, V);
+ return UIntConstants->getOrCreate(Ty, V);
}
ConstantInt *ConstantInt::get(const Type *Ty, unsigned char V) {
@@ -915,8 +916,8 @@
};
}
-static ValueMap DoubleConstants;
-static ValueMap FloatConstants;
+static ManagedStatic > DoubleConstants;
+static ManagedStatic > FloatConstants;
bool ConstantFP::isNullValue() const {
return DoubleToBits(Val) == 0;
@@ -930,10 +931,10 @@
ConstantFP *ConstantFP::get(const Type *Ty, double V) {
if (Ty == Type::FloatTy) {
// Force the value through memory to normalize it.
- return FloatConstants.getOrCreate(Ty, FloatToBits(V));
+ return FloatConstants->getOrCreate(Ty, FloatToBits(V));
} else {
assert(Ty == Type::DoubleTy);
- return DoubleConstants.getOrCreate(Ty, DoubleToBits(V));
+ return DoubleConstants->getOrCreate(Ty, DoubleToBits(V));
}
}
@@ -960,20 +961,21 @@
};
}
-static ValueMap AggZeroConstants;
+static ManagedStatic > AggZeroConstants;
static char getValType(ConstantAggregateZero *CPZ) { return 0; }
Constant *ConstantAggregateZero::get(const Type *Ty) {
assert((isa(Ty) || isa(Ty) || isa(Ty)) &&
"Cannot create an aggregate zero of non-aggregate type!");
- return AggZeroConstants.getOrCreate(Ty, 0);
+ return AggZeroConstants->getOrCreate(Ty, 0);
}
// destroyConstant - Remove the constant from the constant table...
//
void ConstantAggregateZero::destroyConstant() {
- AggZeroConstants.remove(this);
+ AggZeroConstants->remove(this);
destroyConstantImpl();
}
@@ -1005,7 +1007,7 @@
typedef ValueMap, ArrayType,
ConstantArray, true /*largekey*/> ArrayConstantsTy;
-static ArrayConstantsTy ArrayConstants;
+static ManagedStatic ArrayConstants;
Constant *ConstantArray::get(const ArrayType *Ty,
const std::vector &V) {
@@ -1013,10 +1015,10 @@
if (!V.empty()) {
Constant *C = V[0];
if (!C->isNullValue())
- return ArrayConstants.getOrCreate(Ty, V);
+ return ArrayConstants->getOrCreate(Ty, V);
for (unsigned i = 1, e = V.size(); i != e; ++i)
if (V[i] != C)
- return ArrayConstants.getOrCreate(Ty, V);
+ return ArrayConstants->getOrCreate(Ty, V);
}
return ConstantAggregateZero::get(Ty);
}
@@ -1024,7 +1026,7 @@
// destroyConstant - Remove the constant from the constant table...
//
void ConstantArray::destroyConstant() {
- ArrayConstants.remove(this);
+ ArrayConstants->remove(this);
destroyConstantImpl();
}
@@ -1098,7 +1100,7 @@
typedef ValueMap, StructType,
ConstantStruct, true /*largekey*/> StructConstantsTy;
-static StructConstantsTy StructConstants;
+static ManagedStatic StructConstants;
static std::vector getValType(ConstantStruct *CS) {
std::vector Elements;
@@ -1113,7 +1115,7 @@
// Create a ConstantAggregateZero value if all elements are zeros...
for (unsigned i = 0, e = V.size(); i != e; ++i)
if (!V[i]->isNullValue())
- return StructConstants.getOrCreate(Ty, V);
+ return StructConstants->getOrCreate(Ty, V);
return ConstantAggregateZero::get(Ty);
}
@@ -1129,7 +1131,7 @@
// destroyConstant - Remove the constant from the constant table...
//
void ConstantStruct::destroyConstant() {
- StructConstants.remove(this);
+ StructConstants->remove(this);
destroyConstantImpl();
}
@@ -1159,8 +1161,8 @@
return Elements;
}
-static ValueMap, PackedType,
- ConstantPacked> PackedConstants;
+static ManagedStatic, PackedType,
+ ConstantPacked> > PackedConstants;
Constant *ConstantPacked::get(const PackedType *Ty,
const std::vector &V) {
@@ -1168,10 +1170,10 @@
if (!V.empty()) {
Constant *C = V[0];
if (!C->isNullValue())
- return PackedConstants.getOrCreate(Ty, V);
+ return PackedConstants->getOrCreate(Ty, V);
for (unsigned i = 1, e = V.size(); i != e; ++i)
if (V[i] != C)
- return PackedConstants.getOrCreate(Ty, V);
+ return PackedConstants->getOrCreate(Ty, V);
}
return ConstantAggregateZero::get(Ty);
}
@@ -1184,7 +1186,7 @@
// destroyConstant - Remove the constant from the constant table...
//
void ConstantPacked::destroyConstant() {
- PackedConstants.remove(this);
+ PackedConstants->remove(this);
destroyConstantImpl();
}
@@ -1212,7 +1214,8 @@
};
}
-static ValueMap NullPtrConstants;
+static ManagedStatic > NullPtrConstants;
static char getValType(ConstantPointerNull *) {
return 0;
@@ -1220,13 +1223,13 @@
ConstantPointerNull *ConstantPointerNull::get(const PointerType *Ty) {
- return NullPtrConstants.getOrCreate(Ty, 0);
+ return NullPtrConstants->getOrCreate(Ty, 0);
}
// destroyConstant - Remove the constant from the constant table...
//
void ConstantPointerNull::destroyConstant() {
- NullPtrConstants.remove(this);
+ NullPtrConstants->remove(this);
destroyConstantImpl();
}
@@ -1255,7 +1258,7 @@
};
}
-static ValueMap UndefValueConstants;
+static ManagedStatic > UndefValueConstants;
static char getValType(UndefValue *) {
return 0;
@@ -1263,13 +1266,13 @@
UndefValue *UndefValue::get(const Type *Ty) {
- return UndefValueConstants.getOrCreate(Ty, 0);
+ return UndefValueConstants->getOrCreate(Ty, 0);
}
// destroyConstant - Remove the constant from the constant table.
//
void UndefValue::destroyConstant() {
- UndefValueConstants.remove(this);
+ UndefValueConstants->remove(this);
destroyConstantImpl();
}
@@ -1355,7 +1358,8 @@
return ExprMapKeyType(CE->getOpcode(), Operands);
}
-static ValueMap ExprConstants;
+static ManagedStatic > ExprConstants;
Constant *ConstantExpr::getCast(Constant *C, const Type *Ty) {
assert(Ty->isFirstClassType() && "Cannot cast to an aggregate type!");
@@ -1366,7 +1370,7 @@
// Look up the constant in the table first to ensure uniqueness
std::vector argVec(1, C);
ExprMapKeyType Key = std::make_pair(Instruction::Cast, argVec);
- return ExprConstants.getOrCreate(Ty, Key);
+ return ExprConstants->getOrCreate(Ty, Key);
}
Constant *ConstantExpr::getSignExtend(Constant *C, const Type *Ty) {
@@ -1426,7 +1430,7 @@
std::vector argVec(1, C1); argVec.push_back(C2);
ExprMapKeyType Key = std::make_pair(Opcode, argVec);
- return ExprConstants.getOrCreate(ReqTy, Key);
+ return ExprConstants->getOrCreate(ReqTy, Key);
}
Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) {
@@ -1482,7 +1486,7 @@
argVec[1] = V1;
argVec[2] = V2;
ExprMapKeyType Key = std::make_pair(Instruction::Select, argVec);
- return ExprConstants.getOrCreate(ReqTy, Key);
+ return ExprConstants->getOrCreate(ReqTy, Key);
}
/// getShiftTy - Return a shift left or shift right constant expr
@@ -1501,7 +1505,7 @@
// Look up the constant in the table first to ensure uniqueness
std::vector argVec(1, C1); argVec.push_back(C2);
ExprMapKeyType Key = std::make_pair(Opcode, argVec);
- return ExprConstants.getOrCreate(ReqTy, Key);
+ return ExprConstants->getOrCreate(ReqTy, Key);
}
@@ -1522,7 +1526,7 @@
for (unsigned i = 0, e = IdxList.size(); i != e; ++i)
ArgVec.push_back(cast(IdxList[i]));
const ExprMapKeyType &Key = std::make_pair(Instruction::GetElementPtr,ArgVec);
- return ExprConstants.getOrCreate(ReqTy, Key);
+ return ExprConstants->getOrCreate(ReqTy, Key);
}
Constant *ConstantExpr::getGetElementPtr(Constant *C,
@@ -1553,7 +1557,7 @@
std::vector ArgVec(1, Val);
ArgVec.push_back(Idx);
const ExprMapKeyType &Key = std::make_pair(Instruction::ExtractElement,ArgVec);
- return ExprConstants.getOrCreate(ReqTy, Key);
+ return ExprConstants->getOrCreate(ReqTy, Key);
}
Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) {
@@ -1574,7 +1578,7 @@
ArgVec.push_back(Elt);
ArgVec.push_back(Idx);
const ExprMapKeyType &Key = std::make_pair(Instruction::InsertElement,ArgVec);
- return ExprConstants.getOrCreate(ReqTy, Key);
+ return ExprConstants->getOrCreate(ReqTy, Key);
}
Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt,
@@ -1598,7 +1602,7 @@
ArgVec.push_back(V2);
ArgVec.push_back(Mask);
const ExprMapKeyType &Key = std::make_pair(Instruction::ShuffleVector,ArgVec);
- return ExprConstants.getOrCreate(ReqTy, Key);
+ return ExprConstants->getOrCreate(ReqTy, Key);
}
Constant *ConstantExpr::getShuffleVector(Constant *V1, Constant *V2,
@@ -1612,7 +1616,7 @@
// destroyConstant - Remove the constant from the constant table...
//
void ConstantExpr::destroyConstant() {
- ExprConstants.remove(this);
+ ExprConstants->remove(this);
destroyConstantImpl();
}
@@ -1661,7 +1665,7 @@
// Check to see if we have this array type already.
bool Exists;
ArrayConstantsTy::MapTy::iterator I =
- ArrayConstants.InsertOrGetItem(Lookup, Exists);
+ ArrayConstants->InsertOrGetItem(Lookup, Exists);
if (Exists) {
Replacement = I->second;
@@ -1670,7 +1674,7 @@
// creating a new constant array, inserting it, replaceallusesof'ing the
// old with the new, then deleting the old... just update the current one
// in place!
- ArrayConstants.MoveConstantToNewSlot(this, I);
+ ArrayConstants->MoveConstantToNewSlot(this, I);
// Update to the new value.
setOperand(OperandToUpdate, ToC);
@@ -1726,7 +1730,7 @@
// Check to see if we have this array type already.
bool Exists;
StructConstantsTy::MapTy::iterator I =
- StructConstants.InsertOrGetItem(Lookup, Exists);
+ StructConstants->InsertOrGetItem(Lookup, Exists);
if (Exists) {
Replacement = I->second;
@@ -1735,7 +1739,7 @@
// creating a new constant struct, inserting it, replaceallusesof'ing the
// old with the new, then deleting the old... just update the current one
// in place!
- StructConstants.MoveConstantToNewSlot(this, I);
+ StructConstants->MoveConstantToNewSlot(this, I);
// Update to the new value.
setOperand(OperandToUpdate, ToC);
@@ -1846,34 +1850,6 @@
}
-
-/// clearAllValueMaps - This method frees all internal memory used by the
-/// constant subsystem, which can be used in environments where this memory
-/// is otherwise reported as a leak.
-void Constant::clearAllValueMaps() {
- std::vector Constants;
-
- DoubleConstants.clear(Constants);
- FloatConstants.clear(Constants);
- SIntConstants.clear(Constants);
- UIntConstants.clear(Constants);
- AggZeroConstants.clear(Constants);
- ArrayConstants.clear(Constants);
- StructConstants.clear(Constants);
- PackedConstants.clear(Constants);
- NullPtrConstants.clear(Constants);
- UndefValueConstants.clear(Constants);
- ExprConstants.clear(Constants);
-
- for (std::vector::iterator I = Constants.begin(),
- E = Constants.end(); I != E; ++I)
- (*I)->dropAllReferences();
- for (std::vector::iterator I = Constants.begin(),
- E = Constants.end(); I != E; ++I)
- (*I)->destroyConstantImpl();
- Constants.clear();
-}
-
/// getStringValue - Turn an LLVM constant pointer that eventually points to a
/// global into a string value. Return an empty string if we can't do it.
/// Parameter Chop determines if the result is chopped at the first null
From sabre at nondot.org Wed Sep 27 19:37:59 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 19:37:59 -0500
Subject: [llvm-commits] CVS: llvm/include/llvm/Constant.h
Message-ID: <200609280037.k8S0bxrR018423@zion.cs.uiuc.edu>
Changes in directory llvm/include/llvm:
Constant.h updated: 1.30 -> 1.31
---
Log message:
remove dead method
---
Diffs of the changes: (+0 -5)
Constant.h | 5 -----
1 files changed, 5 deletions(-)
Index: llvm/include/llvm/Constant.h
diff -u llvm/include/llvm/Constant.h:1.30 llvm/include/llvm/Constant.h:1.31
--- llvm/include/llvm/Constant.h:1.30 Mon Jun 5 11:29:06 2006
+++ llvm/include/llvm/Constant.h Wed Sep 27 19:37:43 2006
@@ -103,11 +103,6 @@
assert(0 && "Constants that do not have operands cannot be using 'From'!");
}
- /// clearAllValueMaps - This method frees all internal memory used by the
- /// constant subsystem, which can be used in environments where this memory
- /// is otherwise reported as a leak.
- static void clearAllValueMaps();
-
/// getStringValue - Turn an LLVM constant pointer that eventually points to a
/// global into a string value. Return an empty string if we can't do it.
/// Parameter Chop determines if the result is chopped at the first null
From sabre at nondot.org Wed Sep 27 19:38:34 2006
From: sabre at nondot.org (Chris Lattner)
Date: Wed, 27 Sep 2006 19:38:34 -0500
Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Message-ID: <200609280038.k8S0cYTK018460@zion.cs.uiuc.edu>
Changes in directory llvm/lib/VMCore:
Constants.cpp updated: 1.161 -> 1.162
---
Log message:
remove reference to dead method
---
Diffs of the changes: (+0 -1)
Constants.cpp | 1 -
1 files changed, 1 deletion(-)
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.161 llvm/lib/VMCore/Constants.cpp:1.162
--- llvm/lib/VMCore/Constants.cpp:1.161 Wed Sep 27 19:35:06 2006
+++ llvm/lib/VMCore/Constants.cpp Wed Sep 27 19:38:19 2006
@@ -681,7 +681,6 @@
///
AbstractTypeMapTy AbstractTypeMap;
- friend void Constant::clearAllValueMaps();
private:
void clear(std::vector &Constants) {
for(typename MapTy::iterator I = Map.begin(); I != Map.end(); ++I)
From rspencer at reidspencer.com Wed Sep 27 20:21:49 2006
From: rspencer at reidspencer.com (Reid Spencer)
Date: Wed, 27 Sep 2006 18:21:49 -0700
Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ManagedStatic.h
In-Reply-To: <200609280032.k8S0WAuo018221@zion.cs.uiuc.edu>
References: <200609280032.k8S0WAuo018221@zion.cs.uiuc.edu>
Message-ID: <1159406509.20547.155.camel@bashful.x10sys.com>
On Wed, 2006-09-27 at 19:32 -0500, Chris Lattner wrote:
>
> Changes in directory llvm/include/llvm/Support:
>
> ManagedStatic.h added (r1.1)
> ---
> Log message:
>
> new helper class to provide more explicit management of static ctor/dtors.
Looks like an interesting approach to this problem. One question ..
below
>
>
> ---
> Diffs of the changes: (+79 -0)
>
> ManagedStatic.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 79 insertions(+)
>
>
> Index: llvm/include/llvm/Support/ManagedStatic.h
> diff -c /dev/null llvm/include/llvm/Support/ManagedStatic.h:1.1
> *** /dev/null Wed Sep 27 19:32:05 2006
> --- llvm/include/llvm/Support/ManagedStatic.h Wed Sep 27 19:31:55 2006
> ***************
> *** 0 ****
> --- 1,79 ----
> + //===-- llvm/Support/ManagedStatic.h - Static Global wrapper ----*- C++ -*-===//
> + //
> + // The LLVM Compiler Infrastructure
> + //
> + // This file was developed by Chris Lattner and is distributed under
> + // the University of Illinois Open Source License. See LICENSE.TXT for details.
> + //
> + //===----------------------------------------------------------------------===//
> + //
> + // This file defines the ManagedStatic class and the llvm_shutdown() function.
> + //
> + //===----------------------------------------------------------------------===//
> +
> + #ifndef LLVM_SUPPORT_MANAGED_STATIC_H
> + #define LLVM_SUPPORT_MANAGED_STATIC_H
> +
> + namespace llvm {
> +
> + /// object_deleter - Helper method for ManagedStatic.
> + ///
> + template
> + void object_deleter(void *Ptr) {
> + delete (C*)Ptr;
> + }
> +
> + /// ManagedStaticBase - Common base class for ManagedStatic instances.
> + class ManagedStaticBase {
> + protected:
> + // This should only be used as a static variable, which guarantees that this
> + // will be zero initialized.
> + mutable void *Ptr;
> + mutable void (*DeleterFn)(void*);
> + mutable const ManagedStaticBase *Next;
> +
> + void RegisterManagedStatic(void *ObjPtr, void (*deleter)(void*)) const;
> + public:
> + void destroy() const;
> + };
> +
> + /// ManagedStatic - This transparently changes the behavior of global statics to
> + /// be lazily constructed on demand (good for reducing startup times of dynamic
> + /// libraries that link in LLVM components) and for making destruction be
> + /// explicit through the llvm_shutdown() function call.
> + ///
> + template
> + class ManagedStatic : public ManagedStaticBase {
> + public:
> +
> + // Accessors.
> + C &operator*() {
> + if (!Ptr) LazyInit();
> + return *static_cast(Ptr);
> + }
> + C *operator->() {
> + if (!Ptr) LazyInit();
> + return static_cast(Ptr);
> + }
> + const C &operator*() const {
> + if (!Ptr) LazyInit();
> + return *static_cast(Ptr);
> + }
> + const C *operator->() const {
> + if (!Ptr) LazyInit();
> + return static_cast(Ptr);
> + }
> +
> + public:
> + void LazyInit() const {
> + RegisterManagedStatic(new C(), object_deleter);
This requires a default constructor for class "C". How would that work
for things like:
static PrimType TheVoidTy ("void" , Type::VoidTyID);
in Type.cpp ?
Reid.
From clattner at apple.com Wed Sep 27 23:29:17 2006
From: clattner at apple.com (Chris Lattner)
Date: Wed, 27 Sep 2006 21:29:17 -0700
Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ManagedStatic.h
In-Reply-To: <1159406509.20547.155.camel@bashful.x10sys.com>
References: <200609280032.k8S0WAuo018221@zion.cs.uiuc.edu>
<1159406509.20547.155.camel@bashful.x10sys.com>
Message-ID:
>> + void LazyInit() const {
>> + RegisterManagedStatic(new C(), object_deleter);
>
> This requires a default constructor for class "C". How would that work
> for things like:
>
> static PrimType TheVoidTy ("void" , Type::VoidTyID);
It doesn't. That specific case can be handled by making a type
derived from PrimType whose default ctor passes down the values.
The uglier case to handle is stuff like the initializer for
"ConstantBool::True".
-Chris
From sabre at nondot.org Thu Sep 28 01:01:33 2006
From: sabre at nondot.org (Chris Lattner)
Date: Thu, 28 Sep 2006 01:01:33 -0500
Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt
Message-ID: <200609280601.k8S61XDc023253@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Target:
README.txt updated: 1.41 -> 1.42
---
Log message:
add a note about a general improvement to the code generator
---
Diffs of the changes: (+15 -1)
README.txt | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletion(-)
Index: llvm/lib/Target/README.txt
diff -u llvm/lib/Target/README.txt:1.41 llvm/lib/Target/README.txt:1.42
--- llvm/lib/Target/README.txt:1.41 Mon Sep 25 12:12:14 2006
+++ llvm/lib/Target/README.txt Thu Sep 28 01:01:17 2006
@@ -1,6 +1,20 @@
Target Independent Opportunities:
-===-------------------------------------------------------------------------===
+//===---------------------------------------------------------------------===//
+
+We should make the following changes to clean up MachineInstr:
+
+1. Add an Opcode field to TargetInstrDescriptor, so you can tell the opcode of
+ an instruction with just a TargetInstrDescriptor*.
+2. Remove the Opcode field from MachineInstr, replacing it with a
+ TargetInstrDescriptor*.
+3. Getting information about a machine instr then becomes:
+ MI->getInfo()->isTwoAddress()
+ instead of:
+ const TargetInstrInfo &TII = ...
+ TII.isTwoAddrInstr(MI->getOpcode())
+
+//===---------------------------------------------------------------------===//
FreeBench/mason contains code like this:
From sabre at nondot.org Thu Sep 28 01:17:26 2006
From: sabre at nondot.org (Chris Lattner)
Date: Thu, 28 Sep 2006 01:17:26 -0500
Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h
Message-ID: <200609280617.k8S6HQNs023543@zion.cs.uiuc.edu>
Changes in directory llvm/include/llvm/CodeGen:
SelectionDAGISel.h updated: 1.24 -> 1.25
---
Log message:
refactor critical edge breaking out into the SplitCritEdgesForPHIConstants method.
This is a baby step towards fixing PR925: http://llvm.org/PR925 .
---
Diffs of the changes: (+1 -0)
SelectionDAGISel.h | 1 +
1 files changed, 1 insertion(+)
Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.24 llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.25
--- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.24 Mon Aug 7 17:16:08 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGISel.h Thu Sep 28 01:17:10 2006
@@ -124,6 +124,7 @@
SelectionDAG &DAG);
private:
+ void SplitCritEdgesForPHIConstants(BasicBlock *BB);
SDOperand CopyValueToVirtualRegister(SelectionDAGLowering &SDL,
Value *V, unsigned Reg);
void SelectBasicBlock(BasicBlock *BB, MachineFunction &MF,
From sabre at nondot.org Thu Sep 28 01:17:27 2006
From: sabre at nondot.org (Chris Lattner)
Date: Thu, 28 Sep 2006 01:17:27 -0500
Subject: [llvm-commits] CVS:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200609280617.k8S6HRYI023548@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGISel.cpp updated: 1.280 -> 1.281
---
Log message:
refactor critical edge breaking out into the SplitCritEdgesForPHIConstants method.
This is a baby step towards fixing PR925: http://llvm.org/PR925 .
---
Diffs of the changes: (+20 -9)
SelectionDAGISel.cpp | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.280 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.281
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.280 Tue Sep 26 15:02:30 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Sep 28 01:17:10 2006
@@ -845,8 +845,6 @@
CurMBB->addSuccessor(CB.RHSBB);
}
-/// visitSwitchCase - Emits the necessary code to represent a single node in
-/// the binary search tree resulting from lowering a switch instruction.
void SelectionDAGLowering::visitJumpTable(SelectionDAGISel::JumpTable &JT) {
// FIXME: Need to emit different code for PIC vs. Non-PIC, specifically,
// we need to add the address of the jump table to the value loaded, since
@@ -3207,6 +3205,21 @@
return true;
}
+/// SplitCritEdgesForPHIConstants - If this block has any PHI nodes with
+/// constant operands, and if any of the edges feeding the PHI node are
+/// critical, split them so that the assignments of a constant to a register
+/// will not be executed on a path that isn't relevant.
+void SelectionDAGISel::SplitCritEdgesForPHIConstants(BasicBlock *BB) {
+ PHINode *PN;
+ BasicBlock::iterator BBI = BB->begin();
+ while ((PN = dyn_cast(BBI++))) {
+ for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
+ if (isa(PN->getIncomingValue(i)))
+ SplitCriticalEdge(PN->getIncomingBlock(i), BB);
+ }
+}
+
+
bool SelectionDAGISel::runOnFunction(Function &Fn) {
MachineFunction &MF = MachineFunction::construct(&Fn, TLI.getTargetMachine());
RegMap = MF.getSSARegMap();
@@ -3225,14 +3238,12 @@
while (MadeChange) {
MadeChange = false;
for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) {
- PHINode *PN;
- BasicBlock::iterator BBI;
- for (BBI = BB->begin(); (PN = dyn_cast(BBI)); ++BBI)
- for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
- if (isa(PN->getIncomingValue(i)))
- SplitCriticalEdge(PN->getIncomingBlock(i), BB);
+ // If this block has any PHI nodes with constant operands, and if any of the
+ // edges feeding the PHI node are critical, split them.
+ if (isa(BB->begin()))
+ SplitCritEdgesForPHIConstants(BB);
- for (BasicBlock::iterator E = BB->end(); BBI != E; ) {
+ for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) {
Instruction *I = BBI++;
if (GetElementPtrInst *GEPI = dyn_cast(I)) {
MadeChange |= OptimizeGEPExpression(GEPI, TLI.getTargetData());
From isanbard at gmail.com Thu Sep 28 02:10:40 2006
From: isanbard at gmail.com (Bill Wendling)
Date: Thu, 28 Sep 2006 02:10:40 -0500
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp
Message-ID: <200609280710.k8S7AeWx027041@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
PHIElimination.cpp updated: 1.50 -> 1.51
---
Log message:
"Once more into the breach, dear friends, once more, or fill the wall up
with our English dead."
No! Really! Serious this time...It was how the vreg uses were being
adjusted that was causing hte Olden tests to fail. I corrected this and
the Olden and Regression tests all passed.
---
Diffs of the changes: (+42 -26)
PHIElimination.cpp | 68 ++++++++++++++++++++++++++++++++---------------------
1 files changed, 42 insertions(+), 26 deletions(-)
Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.50 llvm/lib/CodeGen/PHIElimination.cpp:1.51
--- llvm/lib/CodeGen/PHIElimination.cpp:1.50 Wed Sep 27 19:11:54 2006
+++ llvm/lib/CodeGen/PHIElimination.cpp Thu Sep 28 02:10:24 2006
@@ -34,12 +34,15 @@
struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
bool runOnMachineFunction(MachineFunction &Fn) {
+ analyzePHINodes(Fn);
+
bool Changed = false;
// Eliminate PHI instructions by inserting copies into predecessor blocks.
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
Changed |= EliminatePHINodes(Fn, *I);
+ VRegPHIUseCount.clear();
return Changed;
}
@@ -54,15 +57,26 @@
///
bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB);
void LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt,
- DenseMap &VUC);
+ MachineBasicBlock::iterator AfterPHIsIt);
+
+ /// analyzePHINodes - Gather information about the PHI nodes in
+ /// here. In particular, we want to map the number of uses of a virtual
+ /// register which is used in a PHI node. We map that to the BB the
+ /// vreg is coming from. This is used later to determine when the vreg
+ /// is killed in the BB.
+ ///
+ void analyzePHINodes(const MachineFunction& Fn);
+
+ typedef std::pair BBVRegPair;
+ typedef std::map VRegPHIUse;
+
+ VRegPHIUse VRegPHIUseCount;
};
RegisterPass X("phi-node-elimination",
"Eliminate PHI nodes for register allocation");
}
-
const PassInfo *llvm::PHIEliminationID = X.getPassInfo();
/// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in
@@ -72,20 +86,6 @@
if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI)
return false; // Quick exit for basic blocks without PHIs.
- // VRegPHIUseCount - Keep track of the number of times each virtual register
- // is used by PHI nodes in successors of this block.
- DenseMap VRegPHIUseCount;
- VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg());
-
- for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(),
- E = MBB.pred_end(); PI != E; ++PI)
- for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(),
- E = (*PI)->succ_end(); SI != E; ++SI)
- for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end();
- BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
- for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
- VRegPHIUseCount[BBI->getOperand(i).getReg()]++;
-
// Get an iterator to the first instruction after the last PHI node (this may
// also be the end of the basic block).
MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
@@ -93,9 +93,9 @@
AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI)
++AfterPHIsIt; // Skip over all of the PHI nodes...
- while (MBB.front().getOpcode() == TargetInstrInfo::PHI) {
- LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount);
- }
+ while (MBB.front().getOpcode() == TargetInstrInfo::PHI)
+ LowerAtomicPHINode(MBB, AfterPHIsIt);
+
return true;
}
@@ -115,14 +115,13 @@
/// atomic execution of PHIs. This lowering method is always correct all of the
/// time.
void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator AfterPHIsIt,
- DenseMap &VRegPHIUseCount) {
+ MachineBasicBlock::iterator AfterPHIsIt) {
// Unlink the PHI node from the basic block, but don't delete the PHI yet.
MachineInstr *MPhi = MBB.remove(MBB.begin());
unsigned DestReg = MPhi->getOperand(0).getReg();
- // Create a new register for the incoming PHI arguments/
+ // Create a new register for the incoming PHI arguments.
MachineFunction &MF = *MBB.getParent();
const TargetRegisterClass *RC = MF.getSSARegMap()->getRegClass(DestReg);
unsigned IncomingReg = MF.getSSARegMap()->createVirtualRegister(RC);
@@ -165,9 +164,10 @@
// Adjust the VRegPHIUseCount map to account for the removal of this PHI
// node.
- unsigned NumPreds = (MPhi->getNumOperands()-1)/2;
for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2)
- VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds;
+ --VRegPHIUseCount[BBVRegPair(
+ MPhi->getOperand(i + 1).getMachineBasicBlock(),
+ MPhi->getOperand(i).getReg())];
// Now loop over all of the incoming arguments, changing them to copy into
// the IncomingReg register in the corresponding predecessor basic block.
@@ -219,7 +219,7 @@
//
// Is it used by any PHI instructions in this block?
- bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0;
+ bool ValueIsLive = VRegPHIUseCount[BBVRegPair(&opBlock, SrcReg)] != 0;
std::vector OpSuccBlocks;
@@ -317,3 +317,19 @@
delete MPhi;
++NumAtomic;
}
+
+/// analyzePHINodes - Gather information about the PHI nodes in here. In
+/// particular, we want to map the number of uses of a virtual register which is
+/// used in a PHI node. We map that to the BB the vreg is coming from. This is
+/// used later to determine when the vreg is killed in the BB.
+///
+void PNE::analyzePHINodes(const MachineFunction& Fn) {
+ for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end();
+ I != E; ++I)
+ for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end();
+ BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
+ for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
+ ++VRegPHIUseCount[BBVRegPair(
+ BBI->getOperand(i + 1).getMachineBasicBlock(),
+ BBI->getOperand(i).getReg())];
+}
From reid at x10sys.com Thu Sep 28 11:54:02 2006
From: reid at x10sys.com (Reid Spencer)
Date: Thu, 28 Sep 2006 11:54:02 -0500
Subject: [llvm-commits] CVS: llvm/docs/WritingAnLLVMPass.html
Message-ID: <200609281654.k8SGs2FY012151@zion.cs.uiuc.edu>
Changes in directory llvm/docs:
WritingAnLLVMPass.html updated: 1.49 -> 1.50
---
Log message:
Provide a gdb usage fix provided by Zhongzing Xu.
---
Diffs of the changes: (+2 -2)
WritingAnLLVMPass.html | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: llvm/docs/WritingAnLLVMPass.html
diff -u llvm/docs/WritingAnLLVMPass.html:1.49 llvm/docs/WritingAnLLVMPass.html:1.50
--- llvm/docs/WritingAnLLVMPass.html:1.49 Sun Aug 27 19:45:38 2006
+++ llvm/docs/WritingAnLLVMPass.html Thu Sep 28 11:53:47 2006
@@ -1593,7 +1593,7 @@
want:
-(gdb) break PassManager::run
+(gdb) break llvm::PassManager::run
Breakpoint 1 at 0x2413bc: file Pass.cpp, line 70.
(gdb) run test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]
Starting program: opt test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]
@@ -1711,7 +1711,7 @@
Chris Lattner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2006/08/28 00:45:38 $
+ Last modified: $Date: 2006/09/28 16:53:47 $