[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile

2006-10-27 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes:

rem.c added (r1.1)
Makefile updated: 1.2 - 1.3
---
Log message:

Add a test for remainder testing. Also, in the Makefile, compute a seed 
for the random number generator based on julian date so that rem isn't
always running the same test but it runs the same on any given day.

Thanks to Domagoj Babic for writing this!


---
Diffs of the changes:  (+160 -1)

 Makefile |3 -
 rem.c|  158 +++
 2 files changed, 160 insertions(+), 1 deletion(-)


Index: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c:1.1
*** /dev/null   Fri Oct 27 10:45:35 2006
--- llvm-test/SingleSource/UnitTests/SignlessTypes/rem.cFri Oct 27 
10:45:24 2006
***
*** 0 
--- 1,158 
+ #include stdio.h
+ #include stdlib.h
+ 
+ // Simple REM test case. Tests some basic properties of remainder
+ // operation. 
+ 
+ // All macros must evaluate to true. x,y can be signed/unsigned, m
+ // should be unsigned.
+ 
+ // Returns true if multiplication will overflow.
+ #define MultOverflow(x,y) x) * (y)) / (y)) != (x))
+ 
+ // x == y = (x mod m) == (y mod m)
+ #define CongruenceTest(x,y,m) \
+ (((x) != (y)) || (((x) % (m)) == ((y) % (m
+ 
+ 
+ /**
+  * These three tests can be done only for unsigned case because they
+  * contain add/sub. If you're eager to get this working with signed
+  * numbers, take care of overflows.
+  **/
+ 
+ // Return true if add/sub will cause overflow.
+ #define UnsignedAddOverflow(x,y) (((x) + (y))  (x))
+ #define UnsignedSubUnderflow(x,y) (((x) - (y))  (x))
+ 
+ // ((x % m) + (y % m)) % m = (x + y) % m
+ #define AdditionOfCongruences(x,y,m) \
+ (UnsignedAddOverflow((x)%(m),(y)%(m)) || \
+ UnsignedAddOverflow((x),(y)) || \
+ (x) % (m)) + ((y) % (m))) % m) == (((x) + (y)) % (m
+ 
+ // ((x % m) == ((y + z) % m)) == (((x - z) % m) == (y % m))
+ #define SimpleCongruenceEquation(x,y,z,m) \
+ (UnsignedAddOverflow((y),(z)) || \
+  UnsignedSubUnderflow((x),(z)) || \
+ x) % (m)) == (((y) + (z)) % (m))) % m) == \
+ x) - (z)) % (m)) == ((y) % (m
+ 
+ // If y*m does not overflow: (x % m) == (x + y*m) % m
+ #define AdditionOfMultipleOfModIsNOP(x,y,m) \
+ (MultOverflow(y,m) || \
+  UnsignedAddOverflow((x),(y)*(m)) || \
+ (((x) % (m)) == (((x) + ((y)*(m))) % (m
+ 
+ /**/
+ 
+ // Greatest common divisor
+ long gcd(long a, long b) {
+ long c;
+ while(1) {
+ c = a % b;
+ if(c == 0) return b;
+ a = b;
+ b = c;
+ }
+ }
+ 
+ // If gcd(z,m)==1: ((x == y) % m) == ((x / z == y / z) % m). This holds
+ // only if both sides are actually divisble by z.
+ #define BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x,y,z,m) \
+ ((gcd((z),(m)) != 1) || ((z) == 0) || \
+ (gcd((x),(z)) != (z)) || ((gcd((y),(z)) != (z))) || \
+ (((x) % (m)) == ((y) % (m))) == (x) / (z)) % m) == (((y) / (z))) % 
m)))
+ 
+ // If z divides x,y,m: ((x % m) == (y % m)) == (((x/z) % (m/z)) == ((y/z) % 
(m/z)))
+ #define DivideBothSidesAndModulus(x,y,z,m) \
+ (((z) == 0) || (gcd((x),(z)) != (z)) || \
+ (gcd((y),(z)) != (z)) || \
+ (gcd((m),(z)) != (z)) || \
+ (((x)%(m)) == ((y)%(m))) == \
+ x)/(z)) % ((m)/(z))) == (((y)/(z)) % ((m)/(z)
+ 
+ // If z divides m, than: ((x % m) == (y % m)) == ((x % z) == (y % z))
+ // z should be unsigned.
+ #define SubModulusTest(x,y,z,m) \
+ (((z) == 0) || (gcd((m),(z)) != (z)) || \
+ x)%(m)) == ((y)%(m))) == (((x)%(z)) == ((y)%(z)
+ 
+ // Runs the test c under number t.
+ #define test(t,c) \
+ if (!c) { \
+ printf(Test #%u, failed in iteration #: %u\n, t, idx); \
+ printf(Failing test vector:\n); \
+ printf(m=%u, x_u=%u, y_u=%u, z_u=%u, x_s=%d, y_s=%d, z_s=%d\n, \
+ m, x_u, y_u, z_u, x_s, y_s, z_s); \
+ return 1; \
+ }
+ 
+ // The higher the number the better the testing. 
+ #define ITERATIONS 100
+ 
+ int main(int argc, char **argv) {
+ // Since the test vectors are printed out anyways, I suggest leaving
+ // the test nondeterministic. Many people run tests on various
+ // machines, so REM-related code will be covered with a much better
+ // coverage... If you really don't like the idea of having better
+ // coverage, uncomment the srand line:
+ 
+ if (argc  1) {
+   int seed = atoi(argv[1]);
+   srand(seed);
+ }
+ 
+ unsigned idx = 0;
+ for (; idx  ITERATIONS; ++idx) {
+ unsigned m = (unsigned)rand();
+ 
+ if (m == 0) { // Repeat again
+ idx--; continue;
+ }
+ 
+ unsigned x_u = (unsigned)rand();
+ unsigned y_u = (unsigned)rand();
+ 

[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c

2006-10-27 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes:

rem.c updated: 1.1 - 1.2
---
Log message:

Make it iterate 10,000 times instead of 100 .. tests more cases.


---
Diffs of the changes:  (+1 -1)

 rem.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c
diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c:1.1 
llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c:1.2
--- llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c:1.1Fri Oct 27 
10:45:24 2006
+++ llvm-test/SingleSource/UnitTests/SignlessTypes/rem.cFri Oct 27 
10:47:18 2006
@@ -89,7 +89,7 @@
 }
 
 // The higher the number the better the testing. 
-#define ITERATIONS 100
+#define ITERATIONS 1
 
 int main(int argc, char **argv) {
 // Since the test vectors are printed out anyways, I suggest leaving



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile

2006-10-27 Thread Chris Lattner

Please change this to set the seed to a constant in main().

-Chris

On Oct 27, 2006, at 8:45 AM, Reid Spencer wrote:



 Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes:

 rem.c added (r1.1)
 Makefile updated: 1.2 - 1.3
 ---
 Log message:

 Add a test for remainder testing. Also, in the Makefile, compute a  
 seed
 for the random number generator based on julian date so that rem isn't
 always running the same test but it runs the same on any given day.

 Thanks to Domagoj Babic for writing this!


 ---
 Diffs of the changes:  (+160 -1)

  Makefile |3 -
  rem.c|  158 +++ 
 
  2 files changed, 160 insertions(+), 1 deletion(-)


 Index: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c
 diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/ 
 rem.c:1.1
 *** /dev/null Fri Oct 27 10:45:35 2006
 --- llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c  Fri Oct 27  
 10:45:24 2006
 ***
 *** 0 
 --- 1,158 
 + #include stdio.h
 + #include stdlib.h
 +
 + // Simple REM test case. Tests some basic properties of remainder
 + // operation.
 +
 + // All macros must evaluate to true. x,y can be signed/unsigned, m
 + // should be unsigned.
 +
 + // Returns true if multiplication will overflow.
 + #define MultOverflow(x,y) x) * (y)) / (y)) != (x))
 +
 + // x == y = (x mod m) == (y mod m)
 + #define CongruenceTest(x,y,m) \
 + (((x) != (y)) || (((x) % (m)) == ((y) % (m
 +
 +
 + /**
 +  * These three tests can be done only for unsigned case because they
 +  * contain add/sub. If you're eager to get this working with signed
 +  * numbers, take care of overflows.
 +  **/
 +
 + // Return true if add/sub will cause overflow.
 + #define UnsignedAddOverflow(x,y) (((x) + (y))  (x))
 + #define UnsignedSubUnderflow(x,y) (((x) - (y))  (x))
 +
 + // ((x % m) + (y % m)) % m = (x + y) % m
 + #define AdditionOfCongruences(x,y,m) \
 + (UnsignedAddOverflow((x)%(m),(y)%(m)) || \
 + UnsignedAddOverflow((x),(y)) || \
 + (x) % (m)) + ((y) % (m))) % m) == (((x) + (y)) % (m
 +
 + // ((x % m) == ((y + z) % m)) == (((x - z) % m) == (y % m))
 + #define SimpleCongruenceEquation(x,y,z,m) \
 + (UnsignedAddOverflow((y),(z)) || \
 +  UnsignedSubUnderflow((x),(z)) || \
 + x) % (m)) == (((y) + (z)) % (m))) % m) == \
 + x) - (z)) % (m)) == ((y) % (m
 +
 + // If y*m does not overflow: (x % m) == (x + y*m) % m
 + #define AdditionOfMultipleOfModIsNOP(x,y,m) \
 + (MultOverflow(y,m) || \
 +  UnsignedAddOverflow((x),(y)*(m)) || \
 + (((x) % (m)) == (((x) + ((y)*(m))) % (m
 +
 + /**/
 +
 + // Greatest common divisor
 + long gcd(long a, long b) {
 + long c;
 + while(1) {
 + c = a % b;
 + if(c == 0) return b;
 + a = b;
 + b = c;
 + }
 + }
 +
 + // If gcd(z,m)==1: ((x == y) % m) == ((x / z == y / z) % m). This  
 holds
 + // only if both sides are actually divisble by z.
 + #define BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod 
 (x,y,z,m) \
 + ((gcd((z),(m)) != 1) || ((z) == 0) || \
 + (gcd((x),(z)) != (z)) || ((gcd((y),(z)) != (z))) || \
 + (((x) % (m)) == ((y) % (m))) == (x) / (z)) % m) ==  
 (((y) / (z))) % m)))
 +
 + // If z divides x,y,m: ((x % m) == (y % m)) == (((x/z) % (m/z))  
 == ((y/z) % (m/z)))
 + #define DivideBothSidesAndModulus(x,y,z,m) \
 + (((z) == 0) || (gcd((x),(z)) != (z)) || \
 + (gcd((y),(z)) != (z)) || \
 + (gcd((m),(z)) != (z)) || \
 + (((x)%(m)) == ((y)%(m))) == \
 + x)/(z)) % ((m)/(z))) == (((y)/(z)) % ((m)/(z)
 +
 + // If z divides m, than: ((x % m) == (y % m)) == ((x % z) == (y %  
 z))
 + // z should be unsigned.
 + #define SubModulusTest(x,y,z,m) \
 + (((z) == 0) || (gcd((m),(z)) != (z)) || \
 + x)%(m)) == ((y)%(m))) == (((x)%(z)) == ((y)%(z)
 +
 + // Runs the test c under number t.
 + #define test(t,c) \
 + if (!c) { \
 + printf(Test #%u, failed in iteration #: %u\n, t, idx); \
 + printf(Failing test vector:\n); \
 + printf(m=%u, x_u=%u, y_u=%u, z_u=%u, x_s=%d, y_s=%d, z_s=%d\n, \
 + m, x_u, y_u, z_u, x_s, y_s, z_s); \
 + return 1; \
 + }
 +
 + // The higher the number the better the testing.
 + #define ITERATIONS 100
 +
 + int main(int argc, char **argv) {
 + // Since the test vectors are printed out anyways, I suggest  
 leaving
 + // the test nondeterministic. Many people run tests on various
 + // machines, so REM-related code will be covered with a much  
 better
 + // coverage... If you really don't like the idea of having  
 better
 + // coverage, uncomment the srand line:
 +
 + if (argc  1) {
 +   int seed = atoi(argv[1]);
 +   srand(seed);
 + }
 +
 + unsigned idx = 0;
 + for (; idx  

[llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp

2006-10-27 Thread Reid Spencer


Changes in directory llvm/lib/Target:

TargetAsmInfo.cpp updated: 1.7 - 1.8
---
Log message:

Initialize CStringSection member var.


---
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.7 
llvm/lib/Target/TargetAsmInfo.cpp:1.8
--- llvm/lib/Target/TargetAsmInfo.cpp:1.7   Fri Oct 13 12:50:07 2006
+++ llvm/lib/Target/TargetAsmInfo.cpp   Fri Oct 27 11:14:06 2006
@@ -49,6 +49,7 @@
   ConstantPoolSection(\t.section .rodata\n),
   JumpTableDataSection(\t.section .rodata\n),
   JumpTableDirective(0),
+  CStringSection(0),
   StaticCtorsSection(\t.section .ctors,\aw\,@progbits),
   StaticDtorsSection(\t.section .dtors,\aw\,@progbits),
   FourByteConstantSection(0),



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/ADT/FoldingSet.h

2006-10-27 Thread Jim Laskey


Changes in directory llvm/include/llvm/ADT:

FoldingSet.h added (r1.1)
---
Log message:

Breakout folding hash set from SelectionDAGCSEMap.

---
Diffs of the changes:  (+281 -0)

 FoldingSet.h |  281 +++
 1 files changed, 281 insertions(+)


Index: llvm/include/llvm/ADT/FoldingSet.h
diff -c /dev/null llvm/include/llvm/ADT/FoldingSet.h:1.1
*** /dev/null   Fri Oct 27 11:16:26 2006
--- llvm/include/llvm/ADT/FoldingSet.h  Fri Oct 27 11:16:16 2006
***
*** 0 
--- 1,281 
+ //===-- llvm/ADT/FoldingSet.h - Uniquing Hash Set ---*- C++ 
-*-===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by James M. Laskey and is distributed under
+ // the University of Illinois Open Source License. See LICENSE.TXT for 
details.
+ //
+ 
//===--===//
+ //
+ // This file defines a hash set that can be used to remove duplication of 
nodes
+ // in a graph.  This code was originally created by Chris Lattner for use with
+ // SelectionDAGCSEMap, but was isolated to provide use across the llvm code 
set. 
+ //
+ 
//===--===//
+ 
+ #ifndef LLVM_ADT_FOLDINGSET_H
+ #define LLVM_ADT_FOLDINGSET_H
+ 
+ #include llvm/ADT/SmallVector.h
+ 
+ namespace llvm {
+ 
+ /// This folding set used for two purposes:
+ ///   1. Given information about a node we want to create, look up the unique
+ ///  instance of the node in the set.  If the node already exists, return
+ ///  it, otherwise return the bucket it should be inserted into.
+ ///   2. Given a node that has already been created, remove it from the set.
+ /// 
+ /// This class is implemented as a single-link chained hash table, where the
+ /// buckets are actually the nodes themselves (the next pointer is in the
+ /// node).  The last node points back to the bucket to simplified node 
removal.
+ ///
+ /// Any node that is to be included in the folding set must be a subclass of
+ /// FoldingSetNode.  The node class must also define a Profile method used to
+ /// establish the unique bits of data for the node.  The Profile method is
+ /// passed a FoldingSetNodeID object which is used to gather the bits.  Just 
+ /// call one of the Add* functions defined in the FoldingSetImpl::NodeID 
class.
+ ///
+ /// Eg.
+ ///class MyNode : public FoldingSetNode {
+ ///private:
+ ///  std::string Name;
+ ///  unsigned Value;
+ ///public:
+ ///  MyNode(const char *N, unsigned V) : Name(N), Value(V) {}
+ ///   ...
+ ///  void Profile(FoldingSetNodeID ID) {
+ ///ID.AddString(Name);
+ ///ID.AddInteger(Value);
+ ///   }
+ ///   ...
+ /// };
+ ///
+ /// To define the folding set itself use the FoldingSet template;
+ ///
+ /// Eg.
+ ///FoldingSetMyNode MyFoldingSet;
+ ///
+ /// Four public methods are available to manipulate the folding set; 
+ ///
+ /// 1) If you have an existing node that you want add to the set but unsure
+ /// that the node might already exist then call;
+ ///
+ ///MyNode *M = MyFoldingSet.GetOrInsertNode(N);
+ ///
+ /// If The result is equal to the input then the node has been inserted.
+ /// Otherwise, the result is the node existing in the folding set, and the
+ /// input can be discarded (use the result instead.)
+ ///
+ /// 2) If you are ready to construct a node but want to check if it already
+ /// exists, then call FindNodeOrInsertPos with a FoldingSetNodeID of the bits 
to
+ /// check;
+ ///
+ ///   FoldingSetNodeID ID;
+ ///   ID.AddString(Name);
+ ///   ID.AddInteger(Value);
+ ///   void *InsertPoint;
+ ///
+ ///MyNode *M = MyFoldingSet.FindNodeOrInsertPos(ID, InsertPoint);
+ ///
+ /// If found then M with be non-NULL, else InsertPoint will point to where it
+ /// should be inserted using InsertNode.
+ ///
+ /// 3) If you get a NULL result from FindNodeOrInsertPos then you can ass a 
new
+ /// node with FindNodeOrInsertPos;
+ ///
+ ///InsertNode(N, InsertPoint);
+ ///
+ /// 4) Finally, if you want to remove a node from the folding set call;
+ ///
+ ///bool WasRemoved = RemoveNode(N);
+ ///
+ /// The result indicates whether the node did exist in the folding set.
+ 
+ 
+ 
//===--===//
+ /// FoldingSetImpl - Implements the folding set functionality.  The main
+ /// structure is an array of buckets.  Each bucket is indexed by the hash of
+ /// the nodes it contains.  The bucket itself points to the nodes contained
+ /// in the bucket via a singly linked list.  The last node in the list points
+ /// back to the bucket to facilitate node removal.
+ /// 
+ class FoldingSetImpl {
+ private:
+   // Buckets - Array of bucket chains.
+   void **Buckets;
+   
+   // NumBuckets - Length of the Buckets array.  Always a power of 2.
+   unsigned NumBuckets;
+   
+   // 

Re: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile

2006-10-27 Thread Chris Lattner

On Oct 27, 2006, at 9:15 AM, Reid Spencer wrote:

 Is something wrong with one constant seed per day?

Yes.  Say I do one test run today.

Tommorrow I do another test run.

the out-nat won't be regenerated tomorrow but llc output will, the  
test will fail.

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

2006-10-27 Thread Jim Laskey


Changes in directory llvm/lib/Support:

FoldingSet.cpp added (r1.1)
---
Log message:

Breakout folding hash set from SelectionDAGCSEMap.

---
Diffs of the changes:  (+282 -0)

 FoldingSet.cpp |  282 +
 1 files changed, 282 insertions(+)


Index: llvm/lib/Support/FoldingSet.cpp
diff -c /dev/null llvm/lib/Support/FoldingSet.cpp:1.1
*** /dev/null   Fri Oct 27 11:16:26 2006
--- llvm/lib/Support/FoldingSet.cpp Fri Oct 27 11:16:16 2006
***
*** 0 
--- 1,282 
+ //===-- Support/FoldingSet.cpp - Uniquing Hash Set --*- C++ 
-*-===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by James M. Laskey and is distributed under
+ // the University of Illinois Open Source License. See LICENSE.TXT for 
details.
+ //
+ 
//===--===//
+ //
+ // This file implements a hash set that can be used to remove duplication of
+ // nodes in a graph.  This code was originally created by Chris Lattner for 
use
+ // with SelectionDAGCSEMap, but was isolated to provide use across the llvm 
code
+ // set. 
+ //
+ 
//===--===//
+ 
+ #include llvm/ADT/FoldingSet.h
+ 
+ #include llvm/ADT/MathExtras.h
+ 
+ using namespace llvm;
+ 
+ 
//===--===//
+ // FoldingSetImpl::NodeID Implementation
+ 
+ /// Add* - Add various data types to Bit data.
+ ///
+ void FoldingSetImpl::NodeID::AddPointer(const void *Ptr) {
+   // Note: this adds pointers to the hash using sizes and endianness that
+   // depend on the host.  It doesn't matter however, because hashing on
+   // pointer values in inherently unstable.  Nothing  should depend on the 
+   // ordering of nodes in the folding set.
+   intptr_t PtrI = (intptr_t)Ptr;
+   Bits.push_back(unsigned(PtrI));
+   if (sizeof(intptr_t)  sizeof(unsigned))
+ Bits.push_back(unsigned(uint64_t(PtrI)  32));
+ }
+ void FoldingSetImpl::NodeID::AddInteger(signed I) {
+   Bits.push_back(I);
+ }
+ void FoldingSetImpl::NodeID::AddInteger(unsigned I) {
+   Bits.push_back(I);
+ }
+ void FoldingSetImpl::NodeID::AddInteger(uint64_t I) {
+   Bits.push_back(unsigned(I));
+   Bits.push_back(unsigned(I  32));
+ }
+ void FoldingSetImpl::NodeID::AddFloat(float F) {
+   Bits.push_back(FloatToBits(F));
+ }
+ void FoldingSetImpl::NodeID::AddDouble(double D) {
+   Bits.push_back(DoubleToBits(D));
+ }
+ void FoldingSetImpl::NodeID::AddString(const std::string String) {
+   // Note: An assumption is made here that strings are composed of one byte
+   // chars.
+   unsigned Size = String.size();
+   unsigned Units = Size / sizeof(unsigned);
+   const unsigned *Base = (const unsigned *)String.data();
+   Bits.insert(Bits.end(), Base, Base + Units);
+   if (Size  3) {
+ unsigned V = 0;
+ for (unsigned i = Units * sizeof(unsigned); i  Size; ++i)
+   V = (V  8) | String[i];
+ Bits.push_back(V);
+   }
+ }
+ 
+ /// ComputeHash - Compute a strong hash value for this NodeID, used to 
+ /// lookup the node in the FoldingSetImpl.
+ unsigned FoldingSetImpl::NodeID::ComputeHash() const {
+   // This is adapted from SuperFastHash by Paul Hsieh.
+   unsigned Hash = Bits.size();
+   for (const unsigned *BP = Bits[0], *E = BP+Bits.size(); BP != E; ++BP) {
+ unsigned Data = *BP;
+ Hash += Data  0x;
+ unsigned Tmp  = ((Data  16)  11) ^ Hash;
+ Hash  = (Hash  16) ^ Tmp;
+ Hash += Hash  11;
+   }
+   
+   // Force avalanching of final 127 bits.
+   Hash ^= Hash  3;
+   Hash += Hash  5;
+   Hash ^= Hash  4;
+   Hash += Hash  17;
+   Hash ^= Hash  25;
+   Hash += Hash  6;
+   return Hash;
+ }
+ 
+ /// operator== - Used to compare two nodes to each other.
+ ///
+ bool FoldingSetImpl::NodeID::operator==(const FoldingSetImpl::NodeID 
RHS)const{
+   if (Bits.size() != RHS.Bits.size()) return false;
+   return memcmp(Bits[0], RHS.Bits[0], Bits.size()*sizeof(Bits[0])) == 0;
+ }
+ 
+ 
+ 
//===--===//
+ // FoldingSetImpl Implementation
+ 
+ FoldingSetImpl::FoldingSetImpl() : NumNodes(0) {
+   NumBuckets = 64;
+   Buckets = new void*[NumBuckets];
+   memset(Buckets, 0, NumBuckets*sizeof(void*));
+ }
+ FoldingSetImpl::~FoldingSetImpl() {
+   delete [] Buckets;
+ }
+ 
+ /// GetNextPtr - In order to save space, each bucket is a
+ /// singly-linked-list. In order to make deletion more efficient, we make
+ /// the list circular, so we can delete a node without computing its hash.
+ /// The problem with this is that the start of the hash buckets are not
+ /// Nodes.  If NextInBucketPtr is a bucket pointer, this method returns null
+ /// : use GetBucketPtr when this happens.
+ FoldingSetImpl::Node *FoldingSetImpl::GetNextPtr(void *NextInBucketPtr) {
+   if (NextInBucketPtr = Buckets  NextInBucketPtr  

Re: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile

2006-10-27 Thread Reid Spencer
Is something wrong with one constant seed per day?

Reid.

On Fri, 2006-10-27 at 09:04 -0700, Chris Lattner wrote:
 Please change this to set the seed to a constant in main().
 
 -Chris
 
 On Oct 27, 2006, at 8:45 AM, Reid Spencer wrote:
 
 
 
  Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes:
 
  rem.c added (r1.1)
  Makefile updated: 1.2 - 1.3
  ---
  Log message:
 
  Add a test for remainder testing. Also, in the Makefile, compute a  
  seed
  for the random number generator based on julian date so that rem isn't
  always running the same test but it runs the same on any given day.
 
  Thanks to Domagoj Babic for writing this!
 
 
  ---
  Diffs of the changes:  (+160 -1)
 
   Makefile |3 -
   rem.c|  158 +++ 
  
   2 files changed, 160 insertions(+), 1 deletion(-)
 
 
  Index: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c
  diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/ 
  rem.c:1.1
  *** /dev/null   Fri Oct 27 10:45:35 2006
  --- llvm-test/SingleSource/UnitTests/SignlessTypes/rem.cFri Oct 27  
  10:45:24 2006
  ***
  *** 0 
  --- 1,158 
  + #include stdio.h
  + #include stdlib.h
  +
  + // Simple REM test case. Tests some basic properties of remainder
  + // operation.
  +
  + // All macros must evaluate to true. x,y can be signed/unsigned, m
  + // should be unsigned.
  +
  + // Returns true if multiplication will overflow.
  + #define MultOverflow(x,y) x) * (y)) / (y)) != (x))
  +
  + // x == y = (x mod m) == (y mod m)
  + #define CongruenceTest(x,y,m) \
  + (((x) != (y)) || (((x) % (m)) == ((y) % (m
  +
  +
  + /**
  +  * These three tests can be done only for unsigned case because they
  +  * contain add/sub. If you're eager to get this working with signed
  +  * numbers, take care of overflows.
  +  **/
  +
  + // Return true if add/sub will cause overflow.
  + #define UnsignedAddOverflow(x,y) (((x) + (y))  (x))
  + #define UnsignedSubUnderflow(x,y) (((x) - (y))  (x))
  +
  + // ((x % m) + (y % m)) % m = (x + y) % m
  + #define AdditionOfCongruences(x,y,m) \
  + (UnsignedAddOverflow((x)%(m),(y)%(m)) || \
  + UnsignedAddOverflow((x),(y)) || \
  + (x) % (m)) + ((y) % (m))) % m) == (((x) + (y)) % (m
  +
  + // ((x % m) == ((y + z) % m)) == (((x - z) % m) == (y % m))
  + #define SimpleCongruenceEquation(x,y,z,m) \
  + (UnsignedAddOverflow((y),(z)) || \
  +  UnsignedSubUnderflow((x),(z)) || \
  + x) % (m)) == (((y) + (z)) % (m))) % m) == \
  + x) - (z)) % (m)) == ((y) % (m
  +
  + // If y*m does not overflow: (x % m) == (x + y*m) % m
  + #define AdditionOfMultipleOfModIsNOP(x,y,m) \
  + (MultOverflow(y,m) || \
  +  UnsignedAddOverflow((x),(y)*(m)) || \
  + (((x) % (m)) == (((x) + ((y)*(m))) % (m
  +
  + /**/
  +
  + // Greatest common divisor
  + long gcd(long a, long b) {
  + long c;
  + while(1) {
  + c = a % b;
  + if(c == 0) return b;
  + a = b;
  + b = c;
  + }
  + }
  +
  + // If gcd(z,m)==1: ((x == y) % m) == ((x / z == y / z) % m). This  
  holds
  + // only if both sides are actually divisble by z.
  + #define BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod 
  (x,y,z,m) \
  + ((gcd((z),(m)) != 1) || ((z) == 0) || \
  + (gcd((x),(z)) != (z)) || ((gcd((y),(z)) != (z))) || \
  + (((x) % (m)) == ((y) % (m))) == (x) / (z)) % m) ==  
  (((y) / (z))) % m)))
  +
  + // If z divides x,y,m: ((x % m) == (y % m)) == (((x/z) % (m/z))  
  == ((y/z) % (m/z)))
  + #define DivideBothSidesAndModulus(x,y,z,m) \
  + (((z) == 0) || (gcd((x),(z)) != (z)) || \
  + (gcd((y),(z)) != (z)) || \
  + (gcd((m),(z)) != (z)) || \
  + (((x)%(m)) == ((y)%(m))) == \
  + x)/(z)) % ((m)/(z))) == (((y)/(z)) % ((m)/(z)
  +
  + // If z divides m, than: ((x % m) == (y % m)) == ((x % z) == (y %  
  z))
  + // z should be unsigned.
  + #define SubModulusTest(x,y,z,m) \
  + (((z) == 0) || (gcd((m),(z)) != (z)) || \
  + x)%(m)) == ((y)%(m))) == (((x)%(z)) == ((y)%(z)
  +
  + // Runs the test c under number t.
  + #define test(t,c) \
  + if (!c) { \
  + printf(Test #%u, failed in iteration #: %u\n, t, idx); \
  + printf(Failing test vector:\n); \
  + printf(m=%u, x_u=%u, y_u=%u, z_u=%u, x_s=%d, y_s=%d, z_s=%d\n, \
  + m, x_u, y_u, z_u, x_s, y_s, z_s); \
  + return 1; \
  + }
  +
  + // The higher the number the better the testing.
  + #define ITERATIONS 100
  +
  + int main(int argc, char **argv) {
  + // Since the test vectors are printed out anyways, I suggest  
  leaving
  + // the test nondeterministic. Many people run tests on various
  + // machines, so REM-related code will be covered with a much  
  

[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile

2006-10-27 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes:

Makefile updated: 1.3 - 1.4
---
Log message:

1. Add some comments about the seed values for the random number generate
2. Make the seed a constant value for reliable results.


---
Diffs of the changes:  (+9 -1)

 Makefile |   10 +-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile
diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.3 
llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.4
--- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.3 Fri Oct 27 
10:45:24 2006
+++ llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Fri Oct 27 
11:37:45 2006
@@ -1,6 +1,14 @@
 # SingleSource/UnitTests/Vector/Makefile
 LEVEL = ../../..
+
+# You can use this seed value to get a different test
+# each day, but don't forget to 'make clean' To use it,
+# change RUN_OPTIONS (below) to be $(SEED)
 SEED := $(shell date +%j)
-RUN_OPTIONS := $(SEED)
+
+# Use a consistent seed value for the tests so they produce
+# the same results regardless of whether you make clean or not.
+RUN_OPTIONS := 31415926
+
 include $(LEVEL)/Makefile.config
 include $(LEVEL)/SingleSource/Makefile.singlesrc



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile

2006-10-27 Thread Reid Spencer
Okay. I'm going to allow the seed to still be specified in the Makefile
though, just to a constant fixed value .. so you can easily try
different seeds (assuming you also remember to make clean)

Reid.

On Fri, 2006-10-27 at 09:24 -0700, Chris Lattner wrote:
 On Oct 27, 2006, at 9:15 AM, Reid Spencer wrote:
 
  Is something wrong with one constant seed per day?
 
 Yes.  Say I do one test run today.
 
 Tommorrow I do another test run.
 
 the out-nat won't be regenerated tomorrow but llc output will, the  
 test will fail.
 
 -Chris

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/.cvsignore

2006-10-27 Thread Reid Spencer


Changes in directory llvm/test/Regression/CodeGen/ARM:

.cvsignore added (r1.1)
---
Log message:

Improve cvs ignoring of test results.


---
Diffs of the changes:  (+1 -0)

 .cvsignore |1 +
 1 files changed, 1 insertion(+)


Index: llvm/test/Regression/CodeGen/ARM/.cvsignore
diff -c /dev/null llvm/test/Regression/CodeGen/ARM/.cvsignore:1.1
*** /dev/null   Fri Oct 27 11:43:44 2006
--- llvm/test/Regression/CodeGen/ARM/.cvsignore Fri Oct 27 11:43:33 2006
***
*** 0 
--- 1 
+ Output



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/Transforms/LCSSA/.cvsignore

2006-10-27 Thread Reid Spencer


Changes in directory llvm/test/Regression/Transforms/LCSSA:

.cvsignore added (r1.1)
---
Log message:

Improve cvs ignoring of test results.


---
Diffs of the changes:  (+1 -0)

 .cvsignore |1 +
 1 files changed, 1 insertion(+)


Index: llvm/test/Regression/Transforms/LCSSA/.cvsignore
diff -c /dev/null llvm/test/Regression/Transforms/LCSSA/.cvsignore:1.1
*** /dev/null   Fri Oct 27 11:43:44 2006
--- llvm/test/Regression/Transforms/LCSSA/.cvsignoreFri Oct 27 11:43:34 2006
***
*** 0 
--- 1 
+ Output



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/Analysis/DSGraph/.cvsignore

2006-10-27 Thread Reid Spencer


Changes in directory llvm/test/Regression/Analysis/DSGraph:

.cvsignore updated: 1.1 - 1.2
---
Log message:

Improve cvs ignoring of test results.


---
Diffs of the changes:  (+1 -0)

 .cvsignore |1 +
 1 files changed, 1 insertion(+)


Index: llvm/test/Regression/Analysis/DSGraph/.cvsignore
diff -u llvm/test/Regression/Analysis/DSGraph/.cvsignore:1.1 
llvm/test/Regression/Analysis/DSGraph/.cvsignore:1.2
--- llvm/test/Regression/Analysis/DSGraph/.cvsignore:1.1Thu Mar 23 
17:41:54 2006
+++ llvm/test/Regression/Analysis/DSGraph/.cvsignoreFri Oct 27 11:43:32 2006
@@ -1,3 +1,4 @@
 Output
 *.log
 *.sum
+ds.*



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/.cvsignore

2006-10-27 Thread Reid Spencer


Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier:

.cvsignore added (r1.1)
---
Log message:

Improve cvs ignoring of test results.


---
Diffs of the changes:  (+1 -0)

 .cvsignore |1 +
 1 files changed, 1 insertion(+)


Index: llvm/test/Regression/Transforms/PredicateSimplifier/.cvsignore
diff -c /dev/null 
llvm/test/Regression/Transforms/PredicateSimplifier/.cvsignore:1.1
*** /dev/null   Fri Oct 27 11:43:44 2006
--- llvm/test/Regression/Transforms/PredicateSimplifier/.cvsignore  Fri Oct 
27 11:43:34 2006
***
*** 0 
--- 1 
+ Output



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

2006-10-27 Thread Jim Laskey


Changes in directory llvm/lib/Support:

FoldingSet.cpp updated: 1.1 - 1.2
---
Log message:

Apply editorials.

---
Diffs of the changes:  (+55 -43)

 FoldingSet.cpp |   98 +++--
 1 files changed, 55 insertions(+), 43 deletions(-)


Index: llvm/lib/Support/FoldingSet.cpp
diff -u llvm/lib/Support/FoldingSet.cpp:1.1 llvm/lib/Support/FoldingSet.cpp:1.2
--- llvm/lib/Support/FoldingSet.cpp:1.1 Fri Oct 27 11:16:16 2006
+++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 13:05:12 2006
@@ -15,9 +15,7 @@
 
//===--===//
 
 #include llvm/ADT/FoldingSet.h
-
 #include llvm/ADT/MathExtras.h
-
 using namespace llvm;
 
 
//===--===//
@@ -49,21 +47,40 @@
   Bits.push_back(FloatToBits(F));
 }
 void FoldingSetImpl::NodeID::AddDouble(double D) {
-  Bits.push_back(DoubleToBits(D));
+ AddInteger(DoubleToBits(D));
 }
 void FoldingSetImpl::NodeID::AddString(const std::string String) {
-  // Note: An assumption is made here that strings are composed of one byte
-  // chars.
   unsigned Size = String.size();
-  unsigned Units = Size / sizeof(unsigned);
+  unsigned Units = Size / 4;
+  unsigned Pos = 0;
   const unsigned *Base = (const unsigned *)String.data();
-  Bits.insert(Bits.end(), Base, Base + Units);
-  if (Size  3) {
-unsigned V = 0;
-for (unsigned i = Units * sizeof(unsigned); i  Size; ++i)
-  V = (V  8) | String[i];
-Bits.push_back(V);
+  
+  // If the string is aligned do a bulk transfer.
+  if (!((intptr_t)Base  3)) {
+Bits.insert(Bits.end(), Base, Base + Units);
+Pos = Units * sizeof(unsigned);
+  } else {
+// Otherwise do it the hard way.
+for ( Pos += 4; Pos  Size; Pos += 4) {
+  unsigned V = ((unsigned char)String[Pos - 4]  24) |
+   ((unsigned char)String[Pos - 3]  16) |
+   ((unsigned char)String[Pos - 2]  8) |
+(unsigned char)String[Pos - 1];
+  Bits.push_back(V);
+}
   }
+  
+  // With the leftover bits.
+  unsigned V = 0;
+  // Pos will have overshot size by 4 - #bytes left over. 
+  switch (Pos - Size) {
+  case 1: V = (V  8) | (unsigned char)String[Size - 3]; // Fall thru.
+  case 2: V = (V  8) | (unsigned char)String[Size - 2]; // Fall thru.
+  case 3: V = (V  8) | (unsigned char)String[Size - 1]; break;
+  case 0: return; // Nothing left.
+  }
+
+  Bits.push_back(V);
 }
 
 /// ComputeHash - Compute a strong hash value for this NodeID, used to 
@@ -98,16 +115,7 @@
 
 
 
//===--===//
-// FoldingSetImpl Implementation
-
-FoldingSetImpl::FoldingSetImpl() : NumNodes(0) {
-  NumBuckets = 64;
-  Buckets = new void*[NumBuckets];
-  memset(Buckets, 0, NumBuckets*sizeof(void*));
-}
-FoldingSetImpl::~FoldingSetImpl() {
-  delete [] Buckets;
-}
+/// Helper functions for FoldingSetImpl.
 
 /// GetNextPtr - In order to save space, each bucket is a
 /// singly-linked-list. In order to make deletion more efficient, we make
@@ -115,34 +123,38 @@
 /// The problem with this is that the start of the hash buckets are not
 /// Nodes.  If NextInBucketPtr is a bucket pointer, this method returns null
 /// : use GetBucketPtr when this happens.
-FoldingSetImpl::Node *FoldingSetImpl::GetNextPtr(void *NextInBucketPtr) {
-  if (NextInBucketPtr = Buckets  NextInBucketPtr  Buckets+NumBuckets)
-return 0;
-  return static_castNode*(NextInBucketPtr);
-}
-
-/// GetNextPtr - This is just like the previous GetNextPtr implementation,
-/// but allows a bucket array to be specified.
-FoldingSetImpl::Node *FoldingSetImpl::GetNextPtr(void *NextInBucketPtr,
- void **Bucks,
- unsigned NumBuck) {
-  if (NextInBucketPtr = Bucks  NextInBucketPtr  Bucks+NumBuck)
+static FoldingSetImpl::Node *GetNextPtr(void *NextInBucketPtr,
+void **Buckets, unsigned NumBuckets) {
+  if (NextInBucketPtr = Buckets  NextInBucketPtr  Buckets + NumBuckets)
 return 0;
-  return static_castNode*(NextInBucketPtr);
+  return static_castFoldingSetImpl::Node*(NextInBucketPtr);
 }
 
 /// GetBucketPtr - Provides a casting of a bucket pointer for isNode
 /// testing.
-void **FoldingSetImpl::GetBucketPtr(void *NextInBucketPtr) {
+static void **GetBucketPtr(void *NextInBucketPtr) {
   return static_castvoid**(NextInBucketPtr);
 }
 
 /// GetBucketFor - Hash the specified node ID and return the hash bucket for
 /// the specified ID.
-void **FoldingSetImpl::GetBucketFor(const NodeID ID) const {
+static void **GetBucketFor(const FoldingSetImpl::NodeID ID,
+   void **Buckets, unsigned NumBuckets) {
   // NumBuckets is always a power of 2.
   unsigned BucketNum = ID.ComputeHash()  (NumBuckets-1);
-  return Buckets+BucketNum;
+  return Buckets + BucketNum;
+}
+

[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

2006-10-27 Thread Bill Wendling


Changes in directory llvm/lib/Support:

FoldingSet.cpp updated: 1.2 - 1.3
---
Log message:

MathExtras isn't in the llvm/ADT directory but in the llvm/Support directory.


---
Diffs of the changes:  (+1 -1)

 FoldingSet.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Support/FoldingSet.cpp
diff -u llvm/lib/Support/FoldingSet.cpp:1.2 llvm/lib/Support/FoldingSet.cpp:1.3
--- llvm/lib/Support/FoldingSet.cpp:1.2 Fri Oct 27 13:05:12 2006
+++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 13:47:29 2006
@@ -15,7 +15,7 @@
 
//===--===//
 
 #include llvm/ADT/FoldingSet.h
-#include llvm/ADT/MathExtras.h
+#include llvm/Support/MathExtras.h
 using namespace llvm;
 
 
//===--===//



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp

2006-10-27 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.279 - 1.280
---
Log message:

Fix for PR968: http://llvm.org/PR968 : expand vector sdiv, udiv, srem, urem.

---
Diffs of the changes:  (+16 -9)

 X86ISelLowering.cpp |   25 -
 1 files changed, 16 insertions(+), 9 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.279 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.280
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.279   Wed Oct 25 16:49:50 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Oct 27 13:49:08 2006
@@ -287,7 +287,15 @@
VT != (unsigned)MVT::LAST_VALUETYPE; VT++) {
 setOperationAction(ISD::ADD , (MVT::ValueType)VT, Expand);
 setOperationAction(ISD::SUB , (MVT::ValueType)VT, Expand);
+setOperationAction(ISD::FADD, (MVT::ValueType)VT, Expand);
+setOperationAction(ISD::FSUB, (MVT::ValueType)VT, Expand);
 setOperationAction(ISD::MUL , (MVT::ValueType)VT, Expand);
+setOperationAction(ISD::FMUL, (MVT::ValueType)VT, Expand);
+setOperationAction(ISD::SDIV, (MVT::ValueType)VT, Expand);
+setOperationAction(ISD::UDIV, (MVT::ValueType)VT, Expand);
+setOperationAction(ISD::FDIV, (MVT::ValueType)VT, Expand);
+setOperationAction(ISD::SREM, (MVT::ValueType)VT, Expand);
+setOperationAction(ISD::UREM, (MVT::ValueType)VT, Expand);
 setOperationAction(ISD::LOAD, (MVT::ValueType)VT, Expand);
 setOperationAction(ISD::VECTOR_SHUFFLE, (MVT::ValueType)VT, Expand);
 setOperationAction(ISD::EXTRACT_VECTOR_ELT, (MVT::ValueType)VT, Expand);
@@ -308,12 +316,10 @@
   if (Subtarget-hasSSE1()) {
 addRegisterClass(MVT::v4f32, X86::VR128RegisterClass);
 
-setOperationAction(ISD::AND,MVT::v4f32, Legal);
-setOperationAction(ISD::OR, MVT::v4f32, Legal);
-setOperationAction(ISD::XOR,MVT::v4f32, Legal);
-setOperationAction(ISD::ADD,MVT::v4f32, Legal);
-setOperationAction(ISD::SUB,MVT::v4f32, Legal);
-setOperationAction(ISD::MUL,MVT::v4f32, Legal);
+setOperationAction(ISD::FADD,   MVT::v4f32, Legal);
+setOperationAction(ISD::FSUB,   MVT::v4f32, Legal);
+setOperationAction(ISD::FMUL,   MVT::v4f32, Legal);
+setOperationAction(ISD::FDIV,   MVT::v4f32, Legal);
 setOperationAction(ISD::LOAD,   MVT::v4f32, Legal);
 setOperationAction(ISD::BUILD_VECTOR,   MVT::v4f32, Custom);
 setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v4f32, Custom);
@@ -328,16 +334,17 @@
 addRegisterClass(MVT::v4i32, X86::VR128RegisterClass);
 addRegisterClass(MVT::v2i64, X86::VR128RegisterClass);
 
-setOperationAction(ISD::ADD,MVT::v2f64, Legal);
 setOperationAction(ISD::ADD,MVT::v16i8, Legal);
 setOperationAction(ISD::ADD,MVT::v8i16, Legal);
 setOperationAction(ISD::ADD,MVT::v4i32, Legal);
-setOperationAction(ISD::SUB,MVT::v2f64, Legal);
 setOperationAction(ISD::SUB,MVT::v16i8, Legal);
 setOperationAction(ISD::SUB,MVT::v8i16, Legal);
 setOperationAction(ISD::SUB,MVT::v4i32, Legal);
 setOperationAction(ISD::MUL,MVT::v8i16, Legal);
-setOperationAction(ISD::MUL,MVT::v2f64, Legal);
+setOperationAction(ISD::FADD,   MVT::v2f64, Legal);
+setOperationAction(ISD::FSUB,   MVT::v2f64, Legal);
+setOperationAction(ISD::FMUL,   MVT::v2f64, Legal);
+setOperationAction(ISD::FDIV,   MVT::v2f64, Legal);
 
 setOperationAction(ISD::SCALAR_TO_VECTOR,   MVT::v16i8, Custom);
 setOperationAction(ISD::SCALAR_TO_VECTOR,   MVT::v8i16, Custom);



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp

2006-10-27 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.210 - 1.211
---
Log message:

Make the Value and Type methods print a newline so it prints nicely in gdb


---
Diffs of the changes:  (+2 -2)

 AsmWriter.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.210 llvm/lib/VMCore/AsmWriter.cpp:1.211
--- llvm/lib/VMCore/AsmWriter.cpp:1.210 Sun Oct 22 01:06:56 2006
+++ llvm/lib/VMCore/AsmWriter.cpp   Fri Oct 27 13:58:54 2006
@@ -1357,11 +1357,11 @@
 
 // Value::dump - allow easy printing of  Values from the debugger.
 // Located here because so much of the needed functionality is here.
-void Value::dump() const { print(std::cerr); }
+void Value::dump() const { print(std::cerr); std::cerr  '\n'; }
 
 // Type::dump - allow easy printing of  Values from the debugger.
 // Located here because so much of the needed functionality is here.
-void Type::dump() const { print(std::cerr); }
+void Type::dump() const { print(std::cerr); std::cerr  '\n'; }
 
 
//===--===//
 //  CachedWriter Class Implementation



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

2006-10-27 Thread Jim Laskey


Changes in directory llvm/lib/Support:

FoldingSet.cpp updated: 1.3 - 1.4
---
Log message:

Temp patch for missing functionality.

---
Diffs of the changes:  (+4 -0)

 FoldingSet.cpp |4 
 1 files changed, 4 insertions(+)


Index: llvm/lib/Support/FoldingSet.cpp
diff -u llvm/lib/Support/FoldingSet.cpp:1.3 llvm/lib/Support/FoldingSet.cpp:1.4
--- llvm/lib/Support/FoldingSet.cpp:1.3 Fri Oct 27 13:47:29 2006
+++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 14:14:16 2006
@@ -56,10 +56,14 @@
   const unsigned *Base = (const unsigned *)String.data();
   
   // If the string is aligned do a bulk transfer.
+#if 0  // FIXME - Add insert to SmallVector (tested with vector)
   if (!((intptr_t)Base  3)) {
 Bits.insert(Bits.end(), Base, Base + Units);
 Pos = Units * sizeof(unsigned);
   } else {
+#else
+  }
+#endif
 // Otherwise do it the hard way.
 for ( Pos += 4; Pos  Size; Pos += 4) {
   unsigned V = ((unsigned char)String[Pos - 4]  24) |



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

2006-10-27 Thread Jim Laskey


Changes in directory llvm/lib/Support:

FoldingSet.cpp updated: 1.5 - 1.6
---
Log message:

SmallVector append not insert.

---
Diffs of the changes:  (+1 -5)

 FoldingSet.cpp |6 +-
 1 files changed, 1 insertion(+), 5 deletions(-)


Index: llvm/lib/Support/FoldingSet.cpp
diff -u llvm/lib/Support/FoldingSet.cpp:1.5 llvm/lib/Support/FoldingSet.cpp:1.6
--- llvm/lib/Support/FoldingSet.cpp:1.5 Fri Oct 27 14:20:12 2006
+++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 14:38:32 2006
@@ -56,14 +56,10 @@
   const unsigned *Base = (const unsigned *)String.data();
   
   // If the string is aligned do a bulk transfer.
-#if 0  // FIXME - Add insert to SmallVector (tested with vector)
   if (!((intptr_t)Base  3)) {
-Bits.insert(Bits.end(), Base, Base + Units);
+Bits.append(Base, Base + Units);
 Pos = Units * sizeof(unsigned);
   } else {
-#else
-  {
-#endif
 // Otherwise do it the hard way.
 for ( Pos += 4; Pos  Size; Pos += 4) {
   unsigned V = ((unsigned char)String[Pos - 4]  24) |



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

2006-10-27 Thread Jim Laskey


Changes in directory llvm/lib/Support:

FoldingSet.cpp updated: 1.4 - 1.5
---
Log message:

Grrr.

---
Diffs of the changes:  (+1 -1)

 FoldingSet.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Support/FoldingSet.cpp
diff -u llvm/lib/Support/FoldingSet.cpp:1.4 llvm/lib/Support/FoldingSet.cpp:1.5
--- llvm/lib/Support/FoldingSet.cpp:1.4 Fri Oct 27 14:14:16 2006
+++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 14:20:12 2006
@@ -62,7 +62,7 @@
 Pos = Units * sizeof(unsigned);
   } else {
 #else
-  }
+  {
 #endif
 // Otherwise do it the hard way.
 for ( Pos += 4; Pos  Size; Pos += 4) {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/vec_extract.ll

2006-10-27 Thread Evan Cheng


Changes in directory llvm/test/Regression/CodeGen/X86:

vec_extract.ll updated: 1.3 - 1.4
---
Log message:

Add a new vextract test case.

---
Diffs of the changes:  (+12 -2)

 vec_extract.ll |   14 --
 1 files changed, 12 insertions(+), 2 deletions(-)


Index: llvm/test/Regression/CodeGen/X86/vec_extract.ll
diff -u llvm/test/Regression/CodeGen/X86/vec_extract.ll:1.3 
llvm/test/Regression/CodeGen/X86/vec_extract.ll:1.4
--- llvm/test/Regression/CodeGen/X86/vec_extract.ll:1.3 Tue May 30 19:48:09 2006
+++ llvm/test/Regression/CodeGen/X86/vec_extract.ll Fri Oct 27 16:05:18 2006
@@ -1,6 +1,7 @@
 ; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep movss| wc -l | 
grep 3 
 ; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep movhlps  | wc -l | 
grep 1 
-; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep pshufd   | wc -l | 
grep 1
+; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep pshufd   | wc -l | 
grep 1 
+; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep unpckhpd | wc -l | 
grep 1
 
 void %test1(4 x float* %F, float* %f) {
%tmp = load 4 x float* %F
@@ -17,9 +18,18 @@
 ret float %tmp2
 }
 
-void %test2(float* %R, 4 x float* %P1) {
+void %test3(float* %R, 4 x float* %P1) {
%X = load 4 x float* %P1
%tmp = extractelement 4 x float %X, uint 3
store float %tmp, float* %R
ret void
 }
+
+double %test4(double %A) {
+%tmp1 = call 2 x double %foo()
+%tmp2 = extractelement 2 x double %tmp1, uint 1
+%tmp3 = add double %tmp2, %A
+ret double %tmp3
+}
+
+declare 2 x double %foo()



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrSSE.td

2006-10-27 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.280 - 1.281
X86ISelLowering.h updated: 1.76 - 1.77
X86InstrSSE.td updated: 1.166 - 1.167
---
Log message:

Fixed a significant bug where unpcklpd is incorrectly used to extract element 1 
from a v2f64 value.

---
Diffs of the changes:  (+25 -6)

 X86ISelLowering.cpp |   11 +++
 X86ISelLowering.h   |4 
 X86InstrSSE.td  |   16 ++--
 3 files changed, 25 insertions(+), 6 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.280 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.281
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.280   Fri Oct 27 13:49:08 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Oct 27 16:08:32 2006
@@ -2868,6 +2868,17 @@
   return ::isSplatMask(N);
 }
 
+/// isSplatLoMask - Return true if the specified VECTOR_SHUFFLE operand
+/// specifies a splat of zero element.
+bool X86::isSplatLoMask(SDNode *N) {
+  assert(N-getOpcode() == ISD::BUILD_VECTOR);
+
+  for (unsigned i = 0, e = N-getNumOperands(); i  e; ++i) 
+if (!isUndefOrEqual(N-getOperand(i), 0))
+  return false;
+  return true;
+}
+
 /// getShuffleSHUFImmediate - Return the appropriate immediate to shuffle
 /// the specified isShuffleMask VECTOR_SHUFFLE mask with PSHUF* and SHUFP*
 /// instructions.


Index: llvm/lib/Target/X86/X86ISelLowering.h
diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.76 
llvm/lib/Target/X86/X86ISelLowering.h:1.77
--- llvm/lib/Target/X86/X86ISelLowering.h:1.76  Fri Oct 20 12:42:20 2006
+++ llvm/lib/Target/X86/X86ISelLowering.h   Fri Oct 27 16:08:32 2006
@@ -225,6 +225,10 @@
/// specifies a splat of a single element.
bool isSplatMask(SDNode *N);
 
+   /// isSplatLoMask - Return true if the specified VECTOR_SHUFFLE operand
+   /// specifies a splat of zero element.
+   bool isSplatLoMask(SDNode *N);
+
/// getShuffleSHUFImmediate - Return the appropriate immediate to shuffle
/// the specified isShuffleMask VECTOR_SHUFFLE mask with PSHUF* and SHUFP*
/// instructions.


Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.166 
llvm/lib/Target/X86/X86InstrSSE.td:1.167
--- llvm/lib/Target/X86/X86InstrSSE.td:1.166Wed Oct 25 16:35:05 2006
+++ llvm/lib/Target/X86/X86InstrSSE.td  Fri Oct 27 16:08:32 2006
@@ -104,8 +104,8 @@
   return X86::isSplatMask(N);
 }], SHUFFLE_get_shuf_imm;
 
-def SSE_splat_v2_mask : PatLeaf(build_vector), [{
-  return X86::isSplatMask(N);
+def SSE_splat_lo_mask : PatLeaf(build_vector), [{
+  return X86::isSplatLoMask(N);
 }];
 
 def MOVHLPS_shuffle_mask : PatLeaf(build_vector), [{
@@ -812,13 +812,13 @@
   movddup {$src, $dst|$dst, $src},
   [(set VR128:$dst, (v2f64 (vector_shuffle
 VR128:$src, (undef),
-SSE_splat_v2_mask)))];
+SSE_splat_lo_mask)))];
 def MOVDDUPrm : S3DI0x12, MRMSrcMem, (ops VR128:$dst, f64mem:$src),
   movddup {$src, $dst|$dst, $src},
   [(set VR128:$dst, (v2f64 (vector_shuffle
  (scalar_to_vector (loadf64 
addr:$src)),
  (undef),
-SSE_splat_v2_mask)))];
+SSE_splat_lo_mask)))];
 
 // SSE2 instructions without OpSize prefix
 def Int_CVTDQ2PSrr : I0x5B, MRMSrcReg, (ops VR128:$dst, VR128:$src),
@@ -1908,10 +1908,14 @@
 
 // Splat v2f64 / v2i64
 let AddedComplexity = 10 in {
-def : Pat(vector_shuffle (v2f64 VR128:$src), (undef), SSE_splat_v2_mask:$sm),
+def : Pat(vector_shuffle (v2f64 VR128:$src), (undef), SSE_splat_lo_mask:$sm),
   (UNPCKLPDrr VR128:$src, VR128:$src),   Requires[HasSSE2];
-def : Pat(vector_shuffle (v2i64 VR128:$src), (undef), SSE_splat_v2_mask:$sm),
+def : Pat(vector_shuffle (v2f64 VR128:$src), (undef), 
UNPCKH_shuffle_mask:$sm),
+  (UNPCKHPDrr VR128:$src, VR128:$src),   Requires[HasSSE2];
+def : Pat(vector_shuffle (v2i64 VR128:$src), (undef), SSE_splat_lo_mask:$sm),
   (PUNPCKLQDQrr VR128:$src, VR128:$src), Requires[HasSSE2];
+def : Pat(vector_shuffle (v2i64 VR128:$src), (undef), 
UNPCKH_shuffle_mask:$sm),
+  (PUNPCKHQDQrr VR128:$src, VR128:$src), Requires[HasSSE2];
 }
 
 // Splat v4f32



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp

2006-10-27 Thread Bill Wendling


Changes in directory llvm/tools/bugpoint:

CrashDebugger.cpp updated: 1.50 - 1.51
---
Log message:

Re-added the part where it tries to remove all global variables first.


---
Diffs of the changes:  (+38 -13)

 CrashDebugger.cpp |   51 ++-
 1 files changed, 38 insertions(+), 13 deletions(-)


Index: llvm/tools/bugpoint/CrashDebugger.cpp
diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.50 
llvm/tools/bugpoint/CrashDebugger.cpp:1.51
--- llvm/tools/bugpoint/CrashDebugger.cpp:1.50  Wed Oct 25 13:36:14 2006
+++ llvm/tools/bugpoint/CrashDebugger.cpp   Fri Oct 27 15:18:06 2006
@@ -357,22 +357,47 @@
   if (BD.getProgram()-global_begin() != BD.getProgram()-global_end()) {
 // Now try to reduce the number of global variable initializers in the
 // module to something small.
-std::vectorGlobalVariable* GVs;
+Module *M = CloneModule(BD.getProgram());
+bool DeletedInit = false;
 
-for (Module::global_iterator I = BD.getProgram()-global_begin(),
-   E = BD.getProgram()-global_end(); I != E; ++I)
-  if (I-hasInitializer())
-GVs.push_back(I);
-
-if (GVs.size()  1  !BugpointIsInterrupted) {
-  std::cout  \n*** Attempting to reduce the number of global variables 
- in the testcase\n;
+for (Module::global_iterator I = M-global_begin(), E = M-global_end();
+ I != E; ++I)
+  if (I-hasInitializer()) {
+I-setInitializer(0);
+I-setLinkage(GlobalValue::ExternalLinkage);
+DeletedInit = true;
+  }
 
-  unsigned OldSize = GVs.size();
-  ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs);
+if (!DeletedInit) {
+  delete M;  // No change made...
+} else {
+  // See if the program still causes a crash...
+  std::cout  \nChecking to see if we can delete global inits: ;
 
-  if (GVs.size()  OldSize)
-BD.EmitProgressBytecode(reduced-global-variables);
+  if (TestFn(BD, M)) {  // Still crashes?
+BD.setNewProgram(M);
+std::cout  \n*** Able to remove all global initializers!\n;
+  } else {  // No longer crashes?
+std::cout- Removing all global inits hides problem!\n;
+delete M;
+
+std::vectorGlobalVariable* GVs;
+
+for (Module::global_iterator I = BD.getProgram()-global_begin(),
+   E = BD.getProgram()-global_end(); I != E; ++I)
+  if (I-hasInitializer())
+GVs.push_back(I);
+
+if (GVs.size()  1  !BugpointIsInterrupted) {
+  std::cout  \n*** Attempting to reduce the number of global 
+ variables in the testcase\n;
+
+  unsigned OldSize = GVs.size();
+  ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs);
+
+  if (GVs.size()  OldSize)
+BD.EmitProgressBytecode(reduced-global-variables);
+}
 }
   }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/or-branch.ll

2006-10-27 Thread Chris Lattner


Changes in directory llvm/test/Regression/CodeGen/X86:

or-branch.ll added (r1.1)
---
Log message:

new testcase


---
Diffs of the changes:  (+19 -0)

 or-branch.ll |   19 +++
 1 files changed, 19 insertions(+)


Index: llvm/test/Regression/CodeGen/X86/or-branch.ll
diff -c /dev/null llvm/test/Regression/CodeGen/X86/or-branch.ll:1.1
*** /dev/null   Fri Oct 27 16:32:20 2006
--- llvm/test/Regression/CodeGen/X86/or-branch.ll   Fri Oct 27 16:32:10 2006
***
*** 0 
--- 1,19 
+ ; RUN: llvm-as  %s | llc -march=x86 | not grep set
+ 
+ void %foo(int %X, int %Y, int %Z) {
+ entry:
+   %tmp = tail call int (...)* %bar( ) ; int [#uses=0]
+   %tmp = seteq int %X, 0  ; bool [#uses=1]
+   %tmp3 = setlt int %Y, 5 ; bool [#uses=1]
+   %tmp4 = or bool %tmp3, %tmp ; bool [#uses=1]
+   br bool %tmp4, label %cond_true, label %UnifiedReturnBlock
+ 
+ cond_true:; preds = %entry
+   %tmp5 = tail call int (...)* %bar( ); int [#uses=0]
+   ret void
+ 
+ UnifiedReturnBlock:   ; preds = %entry
+   ret void
+ }
+ 
+ declare int %bar(...)



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h

2006-10-27 Thread Chris Lattner


Changes in directory llvm/include/llvm/CodeGen:

SelectionDAGISel.h updated: 1.29 - 1.30
---
Log message:

Turn conditions like xY|z==q  into multiple blocks.

This compiles Regression/CodeGen/X86/or-branch.ll into:

_foo:
subl $12, %esp
call L_bar$stub
movl 20(%esp), %eax
movl 16(%esp), %ecx
cmpl $5, %eax
jl LBB1_1   #cond_true
LBB1_3: #entry
testl %ecx, %ecx
jne LBB1_2  #UnifiedReturnBlock
LBB1_1: #cond_true
call L_bar$stub
addl $12, %esp
ret
LBB1_2: #UnifiedReturnBlock
addl $12, %esp
ret

instead of:

_foo:
subl $12, %esp
call L_bar$stub
movl 20(%esp), %eax
movl 16(%esp), %ecx
cmpl $4, %eax
setg %al
testl %ecx, %ecx
setne %cl
testb %cl, %al
jne LBB1_2  #UnifiedReturnBlock
LBB1_1: #cond_true
call L_bar$stub
addl $12, %esp
ret
LBB1_2: #UnifiedReturnBlock
addl $12, %esp
ret

And on ppc to:

cmpwi cr0, r29, 5
blt cr0, LBB1_1 ;cond_true
LBB1_3: ;entry
cmplwi cr0, r30, 0
bne cr0, LBB1_2 ;UnifiedReturnBlock

instead of:

cmpwi cr7, r4, 4
mfcr r2
addic r4, r3, -1
subfe r30, r4, r3
rlwinm r29, r2, 30, 31, 31
and r2, r29, r30
cmplwi cr0, r2, 0
bne cr0, LBB1_2 ;UnifiedReturnBlock



---
Diffs of the changes:  (+1 -4)

 SelectionDAGISel.h |5 +
 1 files changed, 1 insertion(+), 4 deletions(-)


Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.29 
llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.30
--- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.29   Tue Oct 24 12:57:59 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGISel.hFri Oct 27 16:36:01 2006
@@ -89,8 +89,7 @@
 TrueBB(truebb), FalseBB(falsebb), ThisBB(me) {}
 // CC - the condition code to use for the case block's setcc node
 ISD::CondCode CC;
-// CmpLHS/CmpRHS - The LHS/RHS of the comparison to emit.  If CmpRHS is
-// null, CmpLHS is treated as a bool condition for the branch.
+// CmpLHS/CmpRHS - The LHS/RHS of the comparison to emit.
 Value *CmpLHS, *CmpRHS;
 // TrueBB/FalseBB - the block to branch to if the setcc is true/false.
 MachineBasicBlock *TrueBB, *FalseBB;
@@ -128,8 +127,6 @@
   
 private:
   void SplitCritEdgesForPHIConstants(BasicBlock *BB);
-  SDOperand CopyValueToVirtualRegister(SelectionDAGLowering SDL,
-   Value *V, unsigned Reg);
   void SelectBasicBlock(BasicBlock *BB, MachineFunction MF,
 FunctionLoweringInfo FuncInfo);
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.299 - 1.300
---
Log message:

Turn conditions like xY|z==q  into multiple blocks.

This compiles Regression/CodeGen/X86/or-branch.ll into:

_foo:
subl $12, %esp
call L_bar$stub
movl 20(%esp), %eax
movl 16(%esp), %ecx
cmpl $5, %eax
jl LBB1_1   #cond_true
LBB1_3: #entry
testl %ecx, %ecx
jne LBB1_2  #UnifiedReturnBlock
LBB1_1: #cond_true
call L_bar$stub
addl $12, %esp
ret
LBB1_2: #UnifiedReturnBlock
addl $12, %esp
ret

instead of:

_foo:
subl $12, %esp
call L_bar$stub
movl 20(%esp), %eax
movl 16(%esp), %ecx
cmpl $4, %eax
setg %al
testl %ecx, %ecx
setne %cl
testb %cl, %al
jne LBB1_2  #UnifiedReturnBlock
LBB1_1: #cond_true
call L_bar$stub
addl $12, %esp
ret
LBB1_2: #UnifiedReturnBlock
addl $12, %esp
ret

And on ppc to:

cmpwi cr0, r29, 5
blt cr0, LBB1_1 ;cond_true
LBB1_3: ;entry
cmplwi cr0, r30, 0
bne cr0, LBB1_2 ;UnifiedReturnBlock

instead of:

cmpwi cr7, r4, 4
mfcr r2
addic r4, r3, -1
subfe r30, r4, r3
rlwinm r29, r2, 30, 31, 31
and r2, r29, r30
cmplwi cr0, r2, 0
bne cr0, LBB1_2 ;UnifiedReturnBlock



---
Diffs of the changes:  (+185 -19)

 SelectionDAGISel.cpp |  204 ++-
 1 files changed, 185 insertions(+), 19 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.299 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.300
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.299Thu Oct 26 
01:15:43 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Fri Oct 27 16:36:01 2006
@@ -184,6 +184,12 @@
 unsigned MakeReg(MVT::ValueType VT) {
   return RegMap-createVirtualRegister(TLI.getRegClassFor(VT));
 }
+
+/// isExportedInst - Return true if the specified value is an instruction
+/// exported from its block.
+bool isExportedInst(const Value *V) {
+  return ValueMap.count(V);
+}
 
 unsigned CreateRegForValue(const Value *V);
 
@@ -203,6 +209,7 @@
   BasicBlock *BB = I-getParent();
   for (Value::use_iterator UI = I-use_begin(), E = I-use_end(); UI != E; 
++UI)
 if (castInstruction(*UI)-getParent() != BB || isaPHINode(*UI) ||
+// FIXME: Remove switchinst special case.
 isaSwitchInst(*UI))
   return true;
   return false;
@@ -448,6 +455,8 @@
 return Root;
   }
 
+  SDOperand CopyValueToVirtualRegister(Value *V, unsigned Reg);
+
   void visit(Instruction I) { visit(I.getOpcode(), I); }
 
   void visit(unsigned Opcode, User I) {
@@ -485,6 +494,11 @@
 std::setunsigned OutputRegs, 
 std::setunsigned InputRegs);
 
+  void FindMergedConditions(Value *Cond, MachineBasicBlock *TBB,
+MachineBasicBlock *FBB, MachineBasicBlock *CurBB,
+unsigned Opc);
+  void ExportFromCurrentBlock(Value *V);
+
   // Terminator instructions.
   void visitRet(ReturnInst I);
   void visitBr(BranchInst I);
@@ -770,6 +784,128 @@
   NewValues[0], NewValues.size()));
 }
 
+/// ExportFromCurrentBlock - If this condition isn't known to be exported from
+/// the current basic block, add it to ValueMap now so that we'll get a
+/// CopyTo/FromReg.
+void SelectionDAGLowering::ExportFromCurrentBlock(Value *V) {
+  // No need to export constants.
+  if (!isaInstruction(V)  !isaArgument(V)) return;
+  
+  // Already exported?
+  if (FuncInfo.isExportedInst(V)) return;
+
+  unsigned Reg = FuncInfo.InitializeRegForValue(V);
+  PendingLoads.push_back(CopyValueToVirtualRegister(V, Reg));
+}
+
+/// FindMergedConditions - If Cond is an expression like 
+void SelectionDAGLowering::FindMergedConditions(Value *Cond,
+MachineBasicBlock *TBB,
+MachineBasicBlock *FBB,
+MachineBasicBlock *CurBB,
+unsigned Opc) {
+  // FIXME: HANDLE AND.
+  // FIXME: HANDLE NOT
+
+  // If this node is not part of the or/and tree, emit it as a branch.
+  BinaryOperator *BOp = dyn_castBinaryOperator(Cond);
+
+  if (!BOp || (unsigned)BOp-getOpcode() != Opc || !BOp-hasOneUse() ||
+  BOp-getParent() != CurBB-getBasicBlock()) {
+const BasicBlock *BB = CurBB-getBasicBlock();
+
+// If the leaf of the tree is a setcond inst, merge the condition into the
+// caseblock.
+if (BOp  isaSetCondInst(BOp) 
+// The operands of the setcc have to be in this block.  We don't know
+// how to export them 

[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.300 - 1.301
---
Log message:

Codegen condcond with two branches.  This compiles (f.e.) 
PowerPC/and-branch.ll to:

cmpwi cr0, r4, 4
bgt cr0, LBB1_2 ;UnifiedReturnBlock
LBB1_3: ;entry
cmplwi cr0, r3, 0
bne cr0, LBB1_2 ;UnifiedReturnBlock

instead of:

cmpwi cr7, r4, 4
mfcr r2
addic r4, r3, -1
subfe r3, r4, r3
rlwinm r2, r2, 30, 31, 31
or r2, r2, r3
cmplwi cr0, r2, 0
bne cr0, LBB1_2 ;UnifiedReturnBlock
LBB1_1: ;cond_true




---
Diffs of the changes:  (+35 -15)

 SelectionDAGISel.cpp |   50 +++---
 1 files changed, 35 insertions(+), 15 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.300 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.301
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.300Fri Oct 27 
16:36:01 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Fri Oct 27 16:54:23 2006
@@ -888,22 +888,43 @@
 return;
   }
   
-  // Codegen X | Y as:
-  //   jmp_if_X TBB
-  // TmpBB:
-  //   jmp_if_Y TBB
-  //   jmp FBB
-  //
-  //  This requires creation of TmpBB after CurBB.
+  
+  //  Create TmpBB after CurBB.
   MachineFunction::iterator BBI = CurBB;
   MachineBasicBlock *TmpBB = new MachineBasicBlock(CurBB-getBasicBlock());
   CurBB-getParent()-getBasicBlockList().insert(++BBI, TmpBB);
   
-  // Emit the LHS condition.
-  FindMergedConditions(BOp-getOperand(0), TBB, TmpBB, CurBB, Opc);
+  if (Opc == Instruction::Or) {
+// Codegen X | Y as:
+//   jmp_if_X TBB
+//   jmp TmpBB
+// TmpBB:
+//   jmp_if_Y TBB
+//   jmp FBB
+//
   
-  // Emit the RHS condition into TmpBB.
-  FindMergedConditions(BOp-getOperand(1), TBB, FBB, TmpBB, Opc);
+// Emit the LHS condition.
+FindMergedConditions(BOp-getOperand(0), TBB, TmpBB, CurBB, Opc);
+  
+// Emit the RHS condition into TmpBB.
+FindMergedConditions(BOp-getOperand(1), TBB, FBB, TmpBB, Opc);
+  } else {
+assert(Opc == Instruction::And  Unknown merge op!);
+// Codegen X  Y as:
+//   jmp_if_X TmpBB
+//   jmp FBB
+// TmpBB:
+//   jmp_if_Y TBB
+//   jmp FBB
+//
+//  This requires creation of TmpBB after CurBB.
+
+// Emit the LHS condition.
+FindMergedConditions(BOp-getOperand(0), TmpBB, FBB, CurBB, Opc);
+
+// Emit the RHS condition into TmpBB.
+FindMergedConditions(BOp-getOperand(1), TBB, FBB, TmpBB, Opc);
+  }
 }
 
 void SelectionDAGLowering::visitBr(BranchInst I) {
@@ -950,12 +971,11 @@
   //
   if (BinaryOperator *BOp = dyn_castBinaryOperator(CondVal)) {
 if (BOp-hasOneUse()  
-(/*BOp-getOpcode() == Instruction::And ||*/
+(BOp-getOpcode() == Instruction::And ||
  BOp-getOpcode() == Instruction::Or)) {
+  if (BOp-getOpcode() == Instruction::And)
+I.getParent()-dump();
   FindMergedConditions(BOp, Succ0MBB, Succ1MBB, CurMBB, BOp-getOpcode());
-  //std::cerr  FOUND:   SwitchCases.size()   merged 
conditions:\n;
-  //I.getParent()-dump();
-  
   visitSwitchCase(SwitchCases[0]);
   SwitchCases.erase(SwitchCases.begin());
   return;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/and-branch.ll

2006-10-27 Thread Chris Lattner


Changes in directory llvm/test/Regression/CodeGen/PowerPC:

and-branch.ll added (r1.1)
---
Log message:

new testcase


---
Diffs of the changes:  (+19 -0)

 and-branch.ll |   19 +++
 1 files changed, 19 insertions(+)


Index: llvm/test/Regression/CodeGen/PowerPC/and-branch.ll
diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/and-branch.ll:1.1
*** /dev/null   Fri Oct 27 16:52:49 2006
--- llvm/test/Regression/CodeGen/PowerPC/and-branch.ll  Fri Oct 27 16:52:39 2006
***
*** 0 
--- 1,19 
+ ; RUN: llvm-as  %s | llc -march=ppc32 
+ ; RUN: llvm-as  %s | llc -march=ppc32 | not grep mfcr
+ 
+ void %foo(int %X, int %Y, int %Z) {
+ entry:
+   %tmp = seteq int %X, 0  ; bool [#uses=1]
+   %tmp3 = setlt int %Y, 5 ; bool [#uses=1]
+   %tmp4 = and bool %tmp3, %tmp; bool [#uses=1]
+   br bool %tmp4, label %cond_true, label %UnifiedReturnBlock
+ 
+ cond_true:; preds = %entry
+   %tmp5 = tail call int (...)* %bar( ); int [#uses=0]
+   ret void
+ 
+ UnifiedReturnBlock:   ; preds = %entry
+   ret void
+ }
+ 
+ declare int %bar(...)



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

README.txt updated: 1.101 - 1.102
---
Log message:

the code in question is now:

cmpw cr0, r7, r3
ble cr0, LBB1_5 ;bb25
LBB1_8: ;bb17
cmpw cr0, r8, r5
bgt cr0, LBB1_2 ;bb

which is just as good as crnand.



---
Diffs of the changes:  (+0 -30)

 README.txt |   30 --
 1 files changed, 30 deletions(-)


Index: llvm/lib/Target/PowerPC/README.txt
diff -u llvm/lib/Target/PowerPC/README.txt:1.101 
llvm/lib/Target/PowerPC/README.txt:1.102
--- llvm/lib/Target/PowerPC/README.txt:1.101Fri Oct 13 15:20:58 2006
+++ llvm/lib/Target/PowerPC/README.txt  Fri Oct 27 17:00:55 2006
@@ -150,36 +150,6 @@
 
 ===-===
 
-PowerPC i1/setcc stuff (depends on subreg stuff):
-
-Check out the PPC code we get for 'compare' in this testcase:
-http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19672
-
-oof.  on top of not doing the logical crnand instead of (mfcr, mfcr,
-invert, invert, or), we then have to compare it against zero instead of
-using the value already in a CR!
-
-that should be something like
-cmpw cr7, r8, r5
-cmpw cr0, r7, r3
-crnand cr0, cr0, cr7
-bne cr0, LBB_compare_4
-
-instead of
-cmpw cr7, r8, r5
-cmpw cr0, r7, r3
-mfcr r7, 1
-mcrf cr7, cr0
-mfcr r8, 1
-rlwinm r7, r7, 30, 31, 31
-rlwinm r8, r8, 30, 31, 31
-xori r7, r7, 1
-xori r8, r8, 1
-addi r2, r2, 1
-or r7, r8, r7
-cmpwi cr0, r7, 0
-bne cr0, LBB_compare_4  ; loopexit
-
 FreeBench/mason has a basic block that looks like this:
 
  %tmp.130 = seteq int %p.0__, 5  ; bool [#uses=1]



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.301 - 1.302
---
Log message:

remove debug code


---
Diffs of the changes:  (+0 -2)

 SelectionDAGISel.cpp |2 --
 1 files changed, 2 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.301 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.302
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.301Fri Oct 27 
16:54:23 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Fri Oct 27 16:58:03 2006
@@ -973,8 +973,6 @@
 if (BOp-hasOneUse()  
 (BOp-getOpcode() == Instruction::And ||
  BOp-getOpcode() == Instruction::Or)) {
-  if (BOp-getOpcode() == Instruction::And)
-I.getParent()-dump();
   FindMergedConditions(BOp, Succ0MBB, Succ1MBB, CurMBB, BOp-getOpcode());
   visitSwitchCase(SwitchCases[0]);
   SwitchCases.erase(SwitchCases.begin());



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

README.txt updated: 1.102 - 1.103
---
Log message:

this doesn't occur any more in mason


---
Diffs of the changes:  (+0 -19)

 README.txt |   19 ---
 1 files changed, 19 deletions(-)


Index: llvm/lib/Target/PowerPC/README.txt
diff -u llvm/lib/Target/PowerPC/README.txt:1.102 
llvm/lib/Target/PowerPC/README.txt:1.103
--- llvm/lib/Target/PowerPC/README.txt:1.102Fri Oct 27 17:00:55 2006
+++ llvm/lib/Target/PowerPC/README.txt  Fri Oct 27 17:02:19 2006
@@ -150,25 +150,6 @@
 
 ===-===
 
-FreeBench/mason has a basic block that looks like this:
-
- %tmp.130 = seteq int %p.0__, 5  ; bool [#uses=1]
- %tmp.134 = seteq int %p.1__, 6  ; bool [#uses=1]
- %tmp.139 = seteq int %p.2__, 12 ; bool [#uses=1]
- %tmp.144 = seteq int %p.3__, 13 ; bool [#uses=1]
- %tmp.149 = seteq int %p.4__, 14 ; bool [#uses=1]
- %tmp.154 = seteq int %p.5__, 15 ; bool [#uses=1]
- %bothcond = and bool %tmp.134, %tmp.130 ; bool [#uses=1]
- %bothcond123 = and bool %bothcond, %tmp.139 ; bool
- %bothcond124 = and bool %bothcond123, %tmp.144  ; bool
- %bothcond125 = and bool %bothcond124, %tmp.149  ; bool
- %bothcond126 = and bool %bothcond125, %tmp.154  ; bool
- br bool %bothcond126, label %shortcirc_next.5, label %else.0
-
-This is a particularly important case where handling CRs better will help.
-
-===-===
-
 Simple IPO for argument passing, change:
   void foo(int X, double Y, int Z) - void foo(int X, int Z, double Y)
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/LinkTimeOptimization.html

2006-10-27 Thread Devang Patel


Changes in directory llvm/docs:

LinkTimeOptimization.html updated: 1.8 - 1.9
---
Log message:

Document removeModule().


---
Diffs of the changes:  (+13 -1)

 LinkTimeOptimization.html |   14 +-
 1 files changed, 13 insertions(+), 1 deletion(-)


Index: llvm/docs/LinkTimeOptimization.html
diff -u llvm/docs/LinkTimeOptimization.html:1.8 
llvm/docs/LinkTimeOptimization.html:1.9
--- llvm/docs/LinkTimeOptimization.html:1.8 Fri Oct 27 16:58:31 2006
+++ llvm/docs/LinkTimeOptimization.html Fri Oct 27 17:02:30 2006
@@ -30,6 +30,7 @@
 lia href=#readllvmobjectfilereadLLVMObjectFile()/a/li
 lia href=#optimizemodulesoptimizeModules()/a/li
 lia href=#gettargettriplegetTargetTriple()/a/li
+lia href=#removemoduleremoveModule()/a/li
 lia href=#getalignmentgetAlignment()/a/li
   /ul/li
   lia href=#debugDebugging Information/a/li
@@ -340,6 +341,17 @@
 
 !-- === 
--
 div class=doc_subsection
+  a name=removemoduleremoveModule()/a
+/div
+
+div class=doc_text
+  pInternally, a href=#ltoLLVMlto/a maintains LLVM bytecode modules in 
+  memory. The linker may use ttremoveModule()/tt method to remove desired
+  modules from memory. /p
+/div
+
+!-- === 
--
+div class=doc_subsection
   a name=getalignmentgetAlignment()/a
 /div
 
@@ -371,7 +383,7 @@
 
   Devang Patelbr
   a href=http://llvm.org;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/10/27 21:58:31 $
+  Last modified: $Date: 2006/10/27 22:02:30 $
 /address
 
 /body



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/ADT/FoldingSet.h

2006-10-27 Thread Jim Laskey


Changes in directory llvm/include/llvm/ADT:

FoldingSet.h updated: 1.2 - 1.3
---
Log message:

Clean up

---
Diffs of the changes:  (+2 -2)

 FoldingSet.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/ADT/FoldingSet.h
diff -u llvm/include/llvm/ADT/FoldingSet.h:1.2 
llvm/include/llvm/ADT/FoldingSet.h:1.3
--- llvm/include/llvm/ADT/FoldingSet.h:1.2  Fri Oct 27 13:05:12 2006
+++ llvm/include/llvm/ADT/FoldingSet.h  Fri Oct 27 17:52:02 2006
@@ -118,7 +118,7 @@
   
 public:
   FoldingSetImpl();
-  ~FoldingSetImpl();
+  virtual ~FoldingSetImpl();
   
   // Forward declaration.
   class Node;
@@ -245,7 +245,7 @@
   }
 };
 
-}; // End of namespace llvm.
+} // End of namespace llvm.
 
 
 #endif



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/LinkTimeOptimization.html

2006-10-27 Thread Devang Patel


Changes in directory llvm/docs:

LinkTimeOptimization.html updated: 1.7 - 1.8
---
Log message:

Document getAlignment()


---
Diffs of the changes:  (+12 -1)

 LinkTimeOptimization.html |   13 -
 1 files changed, 12 insertions(+), 1 deletion(-)


Index: llvm/docs/LinkTimeOptimization.html
diff -u llvm/docs/LinkTimeOptimization.html:1.7 
llvm/docs/LinkTimeOptimization.html:1.8
--- llvm/docs/LinkTimeOptimization.html:1.7 Wed Sep  6 15:22:55 2006
+++ llvm/docs/LinkTimeOptimization.html Fri Oct 27 16:58:31 2006
@@ -30,6 +30,7 @@
 lia href=#readllvmobjectfilereadLLVMObjectFile()/a/li
 lia href=#optimizemodulesoptimizeModules()/a/li
 lia href=#gettargettriplegetTargetTriple()/a/li
+lia href=#getalignmentgetAlignment()/a/li
   /ul/li
   lia href=#debugDebugging Information/a/li
 /ul
@@ -337,6 +338,16 @@
   while validating LLVM bytecode file./p
 /div
 
+!-- === 
--
+div class=doc_subsection
+  a name=getalignmentgetAlignment()/a
+/div
+
+div class=doc_text
+  pThe linker may use a href=#llvmsymbolLLVMSymbol/a method 
+  ttgetAlignment()/tt to query symbol alignment information./p
+/div
+
 !-- *** 
--
 div class=doc_section
   a name=debugDebugging Information/a
@@ -360,7 +371,7 @@
 
   Devang Patelbr
   a href=http://llvm.org;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/09/06 20:22:55 $
+  Last modified: $Date: 2006/10/27 21:58:31 $
 /address
 
 /body



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/LinkTimeOptimization.html

2006-10-27 Thread Devang Patel


Changes in directory llvm/docs:

LinkTimeOptimization.html updated: 1.9 - 1.10
---
Log message:

Use doc_code class.


---
Diffs of the changes:  (+3 -3)

 LinkTimeOptimization.html |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/docs/LinkTimeOptimization.html
diff -u llvm/docs/LinkTimeOptimization.html:1.9 
llvm/docs/LinkTimeOptimization.html:1.10
--- llvm/docs/LinkTimeOptimization.html:1.9 Fri Oct 27 17:02:30 2006
+++ llvm/docs/LinkTimeOptimization.html Fri Oct 27 18:06:27 2006
@@ -88,7 +88,7 @@
 li Input source file tta.c/tt is compiled into LLVM byte code form.
 li Input source file ttmain.c/tt is compiled into native object code.
   /ul
-pre
+div class=doc_codepre
 --- a.h ---
 extern int foo1(void);
 extern void foo2(void);
@@ -132,7 +132,7 @@
 $ llvm-gcc4 --emit-llvm -c a.c -o a.o  # lt;-- a.o is LLVM bytecode file
 $ llvm-gcc4 -c main.c -o main.o # lt;-- main.o is native object file
 $ llvm-gcc4 a.o main.o -o main # lt;-- standard link command without any 
modifications
-/pre
+/pre/div
   pIn this example, the linker recognizes that ttfoo2()/tt is an 
   externally visible symbol defined in LLVM byte code file. This information 
   is collected using a href=#readllvmobjectfile readLLVMObjectFile()/a. 
@@ -383,7 +383,7 @@
 
   Devang Patelbr
   a href=http://llvm.org;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/10/27 22:02:30 $
+  Last modified: $Date: 2006/10/27 23:06:27 $
 /address
 
 /body



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h SelectionDAG.h SelectionDAGNodes.h SelectionDAGCSEMap.h

2006-10-27 Thread Jim Laskey


Changes in directory llvm/include/llvm/CodeGen:

MachineConstantPool.h updated: 1.20 - 1.21
SelectionDAG.h updated: 1.140 - 1.141
SelectionDAGNodes.h updated: 1.156 - 1.157
SelectionDAGCSEMap.h (r1.8) removed
---
Log message:

Switch over from SelectionNodeCSEMap to FoldingSet.

---
Diffs of the changes:  (+13 -20)

 MachineConstantPool.h |5 +++--
 SelectionDAG.h|6 --
 SelectionDAGNodes.h   |   22 ++
 3 files changed, 13 insertions(+), 20 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineConstantPool.h
diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.20 
llvm/include/llvm/CodeGen/MachineConstantPool.h:1.21
--- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.20Thu Sep 14 
02:32:32 2006
+++ llvm/include/llvm/CodeGen/MachineConstantPool.h Fri Oct 27 18:46:08 2006
@@ -15,7 +15,8 @@
 #ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H
 #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H
 
-#include llvm/CodeGen/SelectionDAGCSEMap.h
+#include llvm/ADT/FoldingSet.h
+#include llvm/CodeGen/SelectionDAGNodes.h
 #include vector
 #include iosfwd
 
@@ -43,7 +44,7 @@
   virtual int getExistingMachineCPValue(MachineConstantPool *CP,
 unsigned Alignment) = 0;
 
-  virtual void AddSelectionDAGCSEId(SelectionDAGCSEMap::NodeID *Id) = 0;
+  virtual void AddSelectionDAGCSEId(FoldingSetNodeID ID) = 0;
 
   /// print - Implement operator...
   ///


Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.140 
llvm/include/llvm/CodeGen/SelectionDAG.h:1.141
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.140  Thu Oct 26 16:52:23 2006
+++ llvm/include/llvm/CodeGen/SelectionDAG.hFri Oct 27 18:46:08 2006
@@ -15,8 +15,9 @@
 #ifndef LLVM_CODEGEN_SELECTIONDAG_H
 #define LLVM_CODEGEN_SELECTIONDAG_H
 
-#include llvm/CodeGen/SelectionDAGCSEMap.h
+#include llvm/ADT/FoldingSet.h
 #include llvm/ADT/ilist
+#include llvm/CodeGen/SelectionDAGNodes.h
 
 #include list
 #include vector
@@ -31,6 +32,7 @@
   class MachineDebugInfo;
   class MachineFunction;
   class MachineConstantPoolValue;
+  class SDOperand;
 
 /// SelectionDAG class - This is used to represent a portion of an LLVM 
function
 /// in a low-level Data Dependence DAG representation suitable for instruction
@@ -56,7 +58,7 @@
 
   /// CSEMap - This structure is used to memoize nodes, automatically 
performing
   /// CSE with existing nodes with a duplicate is requested.
-  SelectionDAGCSEMap CSEMap;
+  FoldingSetSDNode CSEMap;
 
 public:
   SelectionDAG(TargetLowering tli, MachineFunction mf, MachineDebugInfo *di)


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.156 
llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.157
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.156 Thu Oct 26 16:52:24 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h   Fri Oct 27 18:46:08 2006
@@ -20,6 +20,7 @@
 #define LLVM_CODEGEN_SELECTIONDAGNODES_H
 
 #include llvm/Value.h
+#include llvm/ADT/FoldingSet.h
 #include llvm/ADT/GraphTraits.h
 #include llvm/ADT/iterator
 #include llvm/ADT/SmallVector.h
@@ -742,7 +743,7 @@
 
 /// SDNode - Represents one node in the SelectionDAG.
 ///
-class SDNode {
+class SDNode : public FoldingSetNode {
   /// NodeType - The operation that this node performs.
   ///
   unsigned short NodeType;
@@ -766,9 +767,6 @@
   SDNode *Prev, *Next;
   friend struct ilist_traitsSDNode;
 
-  /// NextInBucket - This is used by the SelectionDAGCSEMap.
-  void *NextInBucket;
-  
   /// Uses - These are all of the SDNode's that use a value produced by this
   /// node.
   SmallVectorSDNode*,3 Uses;
@@ -778,7 +776,6 @@
 public:
   virtual ~SDNode() {
 assert(NumOperands == 0  Operand list not cleared before deletion);
-assert(NextInBucket == 0  Still in CSEMap?);
 NodeType = ISD::DELETED_NODE;
   }
   
@@ -863,11 +860,10 @@
 
   static bool classof(const SDNode *) { return true; }
 
-  
-  /// NextInBucket accessors, these are private to SelectionDAGCSEMap.
-  void *getNextInBucket() const { return NextInBucket; }
-  void SetNextInBucket(void *N) { NextInBucket = N; }
-  
+  /// Profile - Gather unique data for the node.
+  ///
+  void Profile(FoldingSetNodeID ID);
+
 protected:
   friend class SelectionDAG;
   
@@ -880,7 +876,6 @@
 ValueList = getValueTypeList(VT);
 NumValues = 1;
 Prev = 0; Next = 0;
-NextInBucket = 0;
   }
   SDNode(unsigned NT, SDOperand Op)
 : NodeType(NT), NodeId(-1) {
@@ -891,7 +886,6 @@
 ValueList = 0;
 NumValues = 0;
 Prev = 0; Next = 0;
-NextInBucket = 0;
   }
   SDNode(unsigned NT, SDOperand N1, SDOperand N2)
 : NodeType(NT), NodeId(-1) {
@@ -903,7 +897,6 @@
 ValueList = 0;
 NumValues = 0;
 Prev = 0; Next = 0;
-NextInBucket = 0;
   }
   SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3)
 : NodeType(NT), NodeId(-1) {
@@ -918,7 +911,6 @@
 ValueList = 0;
 NumValues = 0;

[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGCSEMap.cpp

2006-10-27 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.356 - 1.357
SelectionDAGCSEMap.cpp (r1.9) removed
---
Log message:

Switch over from SelectionNodeCSEMap to FoldingSet.

---
Diffs of the changes:  (+211 -49)

 SelectionDAG.cpp |  260 ---
 1 files changed, 211 insertions(+), 49 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.356 
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.357
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.356Thu Oct 26 
16:53:40 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp  Fri Oct 27 18:46:08 2006
@@ -252,6 +252,144 @@
 }
 
 
//===--===//
+//   SDNode Profile Support
+//===--===//
+
+/// getNodeIDOpcode - Return the opcode that has been set for this NodeID.
+///
+static unsigned getNodeIDOpcode(FoldingSetNodeID ID)  {
+  return ID.getRawData(0);
+}
+static void AddNodeIDOpcode(FoldingSetNodeID ID, unsigned OpC)  {
+  ID.AddInteger(OpC);
+}
+
+/// AddNodeIDValueTypes - Value type lists are intern'd so we can represent 
them
+/// solely with their pointer.
+void AddNodeIDValueTypes(FoldingSetNodeID ID, SDVTList VTList) {
+  ID.AddPointer(VTList.VTs);  
+}
+
+
+static void AddNodeIDOperand(FoldingSetNodeID ID, SDOperand Op) {
+  ID.AddPointer(Op.Val);
+  ID.AddInteger(Op.ResNo);
+}
+
+static void AddNodeIDOperands(FoldingSetNodeID ID) {
+}
+void AddNodeIDOperands(FoldingSetNodeID ID, SDOperand Op) {
+  AddNodeIDOperand(ID, Op);
+}
+static void AddNodeIDOperands(FoldingSetNodeID ID,
+ SDOperand Op1, SDOperand Op2) {
+  AddNodeIDOperand(ID, Op1);
+  AddNodeIDOperand(ID, Op2);
+}
+static void AddNodeIDOperands(FoldingSetNodeID ID,
+  SDOperand Op1, SDOperand Op2, SDOperand Op3) {
+  AddNodeIDOperand(ID, Op1);
+  AddNodeIDOperand(ID, Op2);
+  AddNodeIDOperand(ID, Op3);
+}
+static void AddNodeIDOperands(FoldingSetNodeID ID,
+  const SDOperand *Ops, unsigned NumOps) {
+  for (; NumOps; --NumOps, ++Ops)
+AddNodeIDOperand(ID, *Ops);
+}
+
+static void AddNodeIDNode(FoldingSetNodeID ID,
+  unsigned short OpC, SDVTList VTList) {
+  AddNodeIDOpcode(ID, OpC);
+  AddNodeIDValueTypes(ID, VTList);
+  AddNodeIDOperands(ID);
+}
+static void AddNodeIDNode(FoldingSetNodeID ID,
+  unsigned short OpC, SDVTList VTList,
+  SDOperand Op) {
+  AddNodeIDOpcode(ID, OpC);
+  AddNodeIDValueTypes(ID, VTList);
+  AddNodeIDOperands(ID, Op);
+}
+static void AddNodeIDNode(FoldingSetNodeID ID,
+  unsigned short OpC, SDVTList VTList, 
+  SDOperand Op1, SDOperand Op2) {
+  AddNodeIDOpcode(ID, OpC);
+  AddNodeIDValueTypes(ID, VTList);
+  AddNodeIDOperands(ID, Op1, Op2);
+}
+static void AddNodeIDNode(FoldingSetNodeID ID,
+  unsigned short OpC, SDVTList VTList, 
+  SDOperand Op1, SDOperand Op2, SDOperand Op3) {
+  AddNodeIDOpcode(ID, OpC);
+  AddNodeIDValueTypes(ID, VTList);
+  AddNodeIDOperands(ID, Op1, Op2);
+}
+static void AddNodeIDNode(FoldingSetNodeID ID,
+  unsigned short OpC, SDVTList VTList, 
+  const SDOperand *OpList, unsigned N) {
+  AddNodeIDOpcode(ID, OpC);
+  AddNodeIDValueTypes(ID, VTList);
+  AddNodeIDOperands(ID, OpList, N);
+}
+
+static void AddNodeIDNode(FoldingSetNodeID ID, SDNode *N) {
+  AddNodeIDOpcode(ID, N-getOpcode());
+  // Add the return value info.
+  AddNodeIDValueTypes(ID, N-getVTList());
+  // Add the operand info.
+  AddNodeIDOperands(ID, N-op_begin(), N-getNumOperands());
+
+  // Handle SDNode leafs with special info.
+  if (N-getNumOperands() == 0) {
+switch (N-getOpcode()) {
+default: break;  // Normal nodes don't need extra info.
+case ISD::TargetConstant:
+case ISD::Constant:
+  ID.AddInteger(castConstantSDNode(N)-getValue());
+  break;
+case ISD::TargetConstantFP:
+case ISD::ConstantFP:
+  ID.AddDouble(castConstantFPSDNode(N)-getValue());
+  break;
+case ISD::TargetGlobalAddress:
+case ISD::GlobalAddress:
+  ID.AddPointer(castGlobalAddressSDNode(N)-getGlobal());
+  ID.AddInteger(castGlobalAddressSDNode(N)-getOffset());
+  break;
+case ISD::BasicBlock:
+  ID.AddPointer(castBasicBlockSDNode(N)-getBasicBlock());
+  break;
+case ISD::Register:
+  ID.AddInteger(castRegisterSDNode(N)-getReg());
+  break;
+case ISD::SRCVALUE:
+  ID.AddPointer(castSrcValueSDNode(N)-getValue());
+  ID.AddInteger(castSrcValueSDNode(N)-getOffset());
+  break;
+case ISD::FrameIndex:
+case ISD::TargetFrameIndex:
+  

[llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-10-27-CondFolding.ll

2006-10-27 Thread Chris Lattner


Changes in directory llvm/test/Regression/CodeGen/Generic:

2006-10-27-CondFolding.ll added (r1.1)
---
Log message:

new testcase


---
Diffs of the changes:  (+21 -0)

 2006-10-27-CondFolding.ll |   21 +
 1 files changed, 21 insertions(+)


Index: llvm/test/Regression/CodeGen/Generic/2006-10-27-CondFolding.ll
diff -c /dev/null 
llvm/test/Regression/CodeGen/Generic/2006-10-27-CondFolding.ll:1.1
*** /dev/null   Fri Oct 27 18:47:44 2006
--- llvm/test/Regression/CodeGen/Generic/2006-10-27-CondFolding.ll  Fri Oct 
27 18:47:34 2006
***
*** 0 
--- 1,21 
+ ; RUN: llvm-as  %s | llc 
+ 
+ void %start_pass_huff(int %gather_statistics) {
+ entry:
+ %tmp = seteq int %gather_statistics, 0  ; bool [#uses=1]
+ br bool false, label %cond_next22, label %bb166
+ 
+ cond_next22:; preds = %entry
+ %bothcond = and bool false, %tmp; bool [#uses=1]
+ br bool %bothcond, label %bb34, label %bb46
+ 
+ bb34:   ; preds = %cond_next22
+ ret void
+ 
+ bb46:   ; preds = %cond_next22
+ ret void
+ 
+ bb166:  ; preds = %entry
+ ret void
+ }
+ 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.302 - 1.303
---
Log message:

Fix a bug in merged condition handling 
(CodeGen/Generic/2006-10-27-CondFolding.ll).

Add many fewer CFG edges and PHI node entries.  If there is a switch which has
the same block as multiple destinations, only add that block once as a 
successor/phi 
node (in the jumptable case)



---
Diffs of the changes:  (+111 -68)

 SelectionDAGISel.cpp |  179 +++
 1 files changed, 111 insertions(+), 68 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.302 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.303
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.302Fri Oct 27 
16:58:03 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Fri Oct 27 18:50:33 2006
@@ -282,24 +282,24 @@
 // Create Machine PHI nodes for LLVM PHI nodes, lowering them as
 // appropriate.
 PHINode *PN;
-for (BasicBlock::iterator I = BB-begin();
- (PN = dyn_castPHINode(I)); ++I)
-  if (!PN-use_empty()) {
-MVT::ValueType VT = TLI.getValueType(PN-getType());
-unsigned NumElements;
-if (VT != MVT::Vector)
-  NumElements = TLI.getNumElements(VT);
-else {
-  MVT::ValueType VT1,VT2;
-  NumElements = 
-TLI.getPackedTypeBreakdown(castPackedType(PN-getType()),
-   VT1, VT2);
-}
-unsigned PHIReg = ValueMap[PN];
-assert(PHIReg PHI node does not have an assigned virtual 
register!);
-for (unsigned i = 0; i != NumElements; ++i)
-  BuildMI(MBB, TargetInstrInfo::PHI, PN-getNumOperands(), PHIReg+i);
-  }
+for (BasicBlock::iterator I = BB-begin();(PN = dyn_castPHINode(I)); 
++I){
+  if (PN-use_empty()) continue;
+  
+  MVT::ValueType VT = TLI.getValueType(PN-getType());
+  unsigned NumElements;
+  if (VT != MVT::Vector)
+NumElements = TLI.getNumElements(VT);
+  else {
+MVT::ValueType VT1,VT2;
+NumElements = 
+  TLI.getPackedTypeBreakdown(castPackedType(PN-getType()),
+ VT1, VT2);
+  }
+  unsigned PHIReg = ValueMap[PN];
+  assert(PHIReg  PHI node does not have an assigned virtual register!);
+  for (unsigned i = 0; i != NumElements; ++i)
+BuildMI(MBB, TargetInstrInfo::PHI, PN-getNumOperands(), PHIReg+i);
+}
   }
 }
 
@@ -497,6 +497,7 @@
   void FindMergedConditions(Value *Cond, MachineBasicBlock *TBB,
 MachineBasicBlock *FBB, MachineBasicBlock *CurBB,
 unsigned Opc);
+  bool isExportableFromCurrentBlock(Value *V, const BasicBlock *FromBB);
   void ExportFromCurrentBlock(Value *V);
 
   // Terminator instructions.
@@ -798,15 +799,39 @@
   PendingLoads.push_back(CopyValueToVirtualRegister(V, Reg));
 }
 
+bool SelectionDAGLowering::isExportableFromCurrentBlock(Value *V,
+const BasicBlock *FromBB) {
+  // The operands of the setcc have to be in this block.  We don't know
+  // how to export them from some other block.
+  if (Instruction *VI = dyn_castInstruction(V)) {
+// Can export from current BB.
+if (VI-getParent() == FromBB)
+  return true;
+
+// Is already exported, noop.
+return FuncInfo.isExportedInst(V);
+  }
+  
+  // If this is an argument, we can export it if the BB is the entry block or
+  // if it is already exported.
+  if (isaArgument(V)) {
+if (FromBB == FromBB-getParent()-getEntryBlock())
+  return true;
+
+// Otherwise, can only export this if it is already exported.
+return FuncInfo.isExportedInst(V);
+  }
+  
+  // Otherwise, constants can always be exported.
+  return true;
+}
+
 /// FindMergedConditions - If Cond is an expression like 
 void SelectionDAGLowering::FindMergedConditions(Value *Cond,
 MachineBasicBlock *TBB,
 MachineBasicBlock *FBB,
 MachineBasicBlock *CurBB,
 unsigned Opc) {
-  // FIXME: HANDLE AND.
-  // FIXME: HANDLE NOT
-
   // If this node is not part of the or/and tree, emit it as a branch.
   BinaryOperator *BOp = dyn_castBinaryOperator(Cond);
 
@@ -819,12 +844,8 @@
 if (BOp  isaSetCondInst(BOp) 
 // The operands of the setcc have to be in this block.  We don't know
 // how to export them from some other block.
-(!isaInstruction(BOp-getOperand(0)) || 
- castInstruction(BOp-getOperand(0))-getParent() == BB ||
- FuncInfo.isExportedInst(BOp-getOperand(0))) 
-(!isaInstruction(BOp-getOperand(1)) || 
- castInstruction(BOp-getOperand(1))-getParent() == BB ||
- 

[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

2006-10-27 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.357 - 1.358
---
Log message:

Clean up.

---
Diffs of the changes:  (+12 -2)

 SelectionDAG.cpp |   14 --
 1 files changed, 12 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.357 
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.358
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.357Fri Oct 27 
18:46:08 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp  Fri Oct 27 18:52:51 2006
@@ -260,6 +260,9 @@
 static unsigned getNodeIDOpcode(FoldingSetNodeID ID)  {
   return ID.getRawData(0);
 }
+
+/// AddNodeIDOpcode - Add the node opcode to the NodeID data.
+///
 static void AddNodeIDOpcode(FoldingSetNodeID ID, unsigned OpC)  {
   ID.AddInteger(OpC);
 }
@@ -270,15 +273,18 @@
   ID.AddPointer(VTList.VTs);  
 }
 
-
+/// AddNodeIDOperand - Add an operands data to the NodeID data.
+///
 static void AddNodeIDOperand(FoldingSetNodeID ID, SDOperand Op) {
   ID.AddPointer(Op.Val);
   ID.AddInteger(Op.ResNo);
 }
 
+/// AddNodeIDOperands - Various routines for adding operands to the NodeID 
data.
+///
 static void AddNodeIDOperands(FoldingSetNodeID ID) {
 }
-void AddNodeIDOperands(FoldingSetNodeID ID, SDOperand Op) {
+static void AddNodeIDOperands(FoldingSetNodeID ID, SDOperand Op) {
   AddNodeIDOperand(ID, Op);
 }
 static void AddNodeIDOperands(FoldingSetNodeID ID,
@@ -298,6 +304,8 @@
 AddNodeIDOperand(ID, *Ops);
 }
 
+/// AddNodeIDOperands - Various routines for adding node info to the NodeID
+/// data.
 static void AddNodeIDNode(FoldingSetNodeID ID,
   unsigned short OpC, SDVTList VTList) {
   AddNodeIDOpcode(ID, OpC);
@@ -333,6 +341,8 @@
   AddNodeIDOperands(ID, OpList, N);
 }
 
+/// AddNodeIDNode - Generic routine for adding a nodes info to the NodeID
+/// data.
 static void AddNodeIDNode(FoldingSetNodeID ID, SDNode *N) {
   AddNodeIDOpcode(ID, N-getOpcode());
   // Add the return value info.



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/Makefile

2006-10-27 Thread Reid Spencer


Changes in directory llvm/lib/Target/X86:

Makefile updated: 1.29 - 1.30
---
Log message:

Make sure all the readme files get distributed.


---
Diffs of the changes:  (+1 -1)

 Makefile |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Target/X86/Makefile
diff -u llvm/lib/Target/X86/Makefile:1.29 llvm/lib/Target/X86/Makefile:1.30
--- llvm/lib/Target/X86/Makefile:1.29   Fri Oct  6 04:17:41 2006
+++ llvm/lib/Target/X86/MakefileFri Oct 27 19:11:39 2006
@@ -9,7 +9,7 @@
 LEVEL = ../../..
 LIBRARYNAME = LLVMX86
 TARGET = X86
-EXTRA_DIST = README.txt
+EXTRA_DIST = README.txt README-FPStack.txt README-SSE.txt README-X86-64.txt
 # Make sure that tblgen is run, first thing.
 BUILT_SOURCES = X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \
 X86GenRegisterInfo.inc X86GenInstrNames.inc \



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/PowerPC/Makefile

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

Makefile updated: 1.22 - 1.23
---
Log message:

don't dist internal readme's



---
Diffs of the changes:  (+0 -1)

 Makefile |1 -
 1 files changed, 1 deletion(-)


Index: llvm/lib/Target/PowerPC/Makefile
diff -u llvm/lib/Target/PowerPC/Makefile:1.22 
llvm/lib/Target/PowerPC/Makefile:1.23
--- llvm/lib/Target/PowerPC/Makefile:1.22   Thu Apr 13 01:39:24 2006
+++ llvm/lib/Target/PowerPC/MakefileFri Oct 27 19:49:54 2006
@@ -9,7 +9,6 @@
 LEVEL = ../../..
 LIBRARYNAME = LLVMPowerPC
 TARGET = PPC
-EXTRA_DIST = README.txt README_ALTIVEC.txt
 
 # Make sure that tblgen is run, first thing.
 BUILT_SOURCES = PPCGenInstrNames.inc PPCGenRegisterNames.inc \



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/Makefile

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

Makefile updated: 1.30 - 1.31
---
Log message:

don't distribute internal readme's



---
Diffs of the changes:  (+1 -1)

 Makefile |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Target/X86/Makefile
diff -u llvm/lib/Target/X86/Makefile:1.30 llvm/lib/Target/X86/Makefile:1.31
--- llvm/lib/Target/X86/Makefile:1.30   Fri Oct 27 19:11:39 2006
+++ llvm/lib/Target/X86/MakefileFri Oct 27 19:48:27 2006
@@ -9,7 +9,7 @@
 LEVEL = ../../..
 LIBRARYNAME = LLVMX86
 TARGET = X86
-EXTRA_DIST = README.txt README-FPStack.txt README-SSE.txt README-X86-64.txt
+
 # Make sure that tblgen is run, first thing.
 BUILT_SOURCES = X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \
 X86GenRegisterInfo.inc X86GenInstrNames.inc \



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/Sparc/Makefile

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/Target/Sparc:

Makefile updated: 1.15 - 1.16
---
Log message:

don't dist internal readme


---
Diffs of the changes:  (+0 -1)

 Makefile |1 -
 1 files changed, 1 deletion(-)


Index: llvm/lib/Target/Sparc/Makefile
diff -u llvm/lib/Target/Sparc/Makefile:1.15 llvm/lib/Target/Sparc/Makefile:1.16
--- llvm/lib/Target/Sparc/Makefile:1.15 Thu Apr 13 01:39:24 2006
+++ llvm/lib/Target/Sparc/Makefile  Fri Oct 27 19:50:45 2006
@@ -9,7 +9,6 @@
 LEVEL = ../../..
 LIBRARYNAME = LLVMSparc
 TARGET = Sparc
-EXTRA_DIST = README.txt
 
 # Make sure that tblgen is run, first thing.
 BUILT_SOURCES = SparcGenRegisterInfo.h.inc SparcGenRegisterNames.inc \



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/Makefile

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/Target:

Makefile updated: 1.27 - 1.28
---
Log message:

don't dist internal readme


---
Diffs of the changes:  (+0 -1)

 Makefile |1 -
 1 files changed, 1 deletion(-)


Index: llvm/lib/Target/Makefile
diff -u llvm/lib/Target/Makefile:1.27 llvm/lib/Target/Makefile:1.28
--- llvm/lib/Target/Makefile:1.27   Thu Apr 13 01:39:24 2006
+++ llvm/lib/Target/MakefileFri Oct 27 19:51:15 2006
@@ -10,7 +10,6 @@
 LEVEL = ../..
 LIBRARYNAME = LLVMTarget
 BUILD_ARCHIVE = 1
-EXTRA_DIST = README.txt
 
 # We include this early so we can access the value of TARGETS_TO_BUILD as the
 # value for PARALLEL_DIRS which must be set before Makefile.rules is included



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp

2006-10-27 Thread Chris Lattner


Changes in directory llvm/lib/Analysis:

LoopInfo.cpp updated: 1.78 - 1.79
---
Log message:

add a method


---
Diffs of the changes:  (+20 -0)

 LoopInfo.cpp |   20 
 1 files changed, 20 insertions(+)


Index: llvm/lib/Analysis/LoopInfo.cpp
diff -u llvm/lib/Analysis/LoopInfo.cpp:1.78 llvm/lib/Analysis/LoopInfo.cpp:1.79
--- llvm/lib/Analysis/LoopInfo.cpp:1.78 Tue Aug 29 17:29:16 2006
+++ llvm/lib/Analysis/LoopInfo.cpp  Fri Oct 27 20:24:05 2006
@@ -332,6 +332,26 @@
 // APIs for simple analysis of the loop.
 //
 
+/// getExitingBlocks - Return all blocks inside the loop that have successors
+/// outside of the loop.  These are the blocks _inside of the current loop_
+/// which branch out.  The returned list is always unique.
+///
+void Loop::getExitingBlocks(std::vectorBasicBlock* ExitingBlocks) const {
+  // Sort the blocks vector so that we can use binary search to do quick
+  // lookups.
+  std::vectorBasicBlock* LoopBBs(block_begin(), block_end());
+  std::sort(LoopBBs.begin(), LoopBBs.end());
+  
+  for (std::vectorBasicBlock*::const_iterator BI = Blocks.begin(),
+   BE = Blocks.end(); BI != BE; ++BI)
+for (succ_iterator I = succ_begin(*BI), E = succ_end(*BI); I != E; ++I)
+  if (!std::binary_search(LoopBBs.begin(), LoopBBs.end(), *I)) {
+// Not in current loop? It must be an exit block.
+ExitingBlocks.push_back(*BI);
+break;
+  }
+}
+
 /// getExitBlocks - Return all of the successor blocks of this loop.  These
 /// are the blocks _outside of the current loop_ which are branched to.
 ///



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Analysis/LoopInfo.h

2006-10-27 Thread Chris Lattner


Changes in directory llvm/include/llvm/Analysis:

LoopInfo.h updated: 1.58 - 1.59
---
Log message:

add a method


---
Diffs of the changes:  (+6 -0)

 LoopInfo.h |6 ++
 1 files changed, 6 insertions(+)


Index: llvm/include/llvm/Analysis/LoopInfo.h
diff -u llvm/include/llvm/Analysis/LoopInfo.h:1.58 
llvm/include/llvm/Analysis/LoopInfo.h:1.59
--- llvm/include/llvm/Analysis/LoopInfo.h:1.58  Tue Aug 29 17:29:16 2006
+++ llvm/include/llvm/Analysis/LoopInfo.h   Fri Oct 27 20:24:05 2006
@@ -107,6 +107,12 @@
   // induction variable canonicalization pass should be used to normalize loops
   // for easy analysis.  These methods assume canonical loops.
 
+  /// getExitingBlocks - Return all blocks inside the loop that have successors
+  /// outside of the loop.  These are the blocks _inside of the current loop_
+  /// which branch out.  The returned list is always unique.
+  ///
+  void getExitingBlocks(std::vectorBasicBlock* Blocks) const;
+
   /// getExitBlocks - Return all of the successor blocks of this loop.  These
   /// are the blocks _outside of the current loop_ which are branched to.
   ///



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h

2006-10-27 Thread Jim Laskey


Changes in directory llvm/include/llvm/CodeGen:

SelectionDAG.h updated: 1.141 - 1.142
SelectionDAGNodes.h updated: 1.157 - 1.158
---
Log message:

Editorial clean up.

---
Diffs of the changes:  (+0 -2)

 SelectionDAG.h  |1 -
 SelectionDAGNodes.h |1 -
 2 files changed, 2 deletions(-)


Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.141 
llvm/include/llvm/CodeGen/SelectionDAG.h:1.142
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.141  Fri Oct 27 18:46:08 2006
+++ llvm/include/llvm/CodeGen/SelectionDAG.hFri Oct 27 20:34:21 2006
@@ -32,7 +32,6 @@
   class MachineDebugInfo;
   class MachineFunction;
   class MachineConstantPoolValue;
-  class SDOperand;
 
 /// SelectionDAG class - This is used to represent a portion of an LLVM 
function
 /// in a low-level Data Dependence DAG representation suitable for instruction


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.157 
llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.158
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.157 Fri Oct 27 18:46:08 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h   Fri Oct 27 20:34:21 2006
@@ -23,7 +23,6 @@
 #include llvm/ADT/FoldingSet.h
 #include llvm/ADT/GraphTraits.h
 #include llvm/ADT/iterator
-#include llvm/ADT/SmallVector.h
 #include llvm/CodeGen/ValueTypes.h
 #include llvm/Support/DataTypes.h
 #include cassert



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll

2006-10-27 Thread Nick Lewycky


Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier:

2006-10-22-IntOr.ll updated: 1.2 - 1.3
---
Log message:

Emitting raw bytecode is awfully rude. Add -disable-output.
Clarify the test.


---
Diffs of the changes:  (+17 -7)

 2006-10-22-IntOr.ll |   24 +---
 1 files changed, 17 insertions(+), 7 deletions(-)


Index: llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll
diff -u 
llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll:1.2 
llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll:1.3
--- llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll:1.2 
Wed Oct 25 19:51:58 2006
+++ llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll 
Fri Oct 27 21:34:41 2006
@@ -1,6 +1,6 @@
-; RUN: llvm-as  %s | opt -predsimplify -instcombine -simplifycfg 
-; RUN: llvm-as  %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | 
grep -v declare | grep -c fail | grep 1 
-; RUN: llvm-as  %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | 
grep -v declare | grep -c pass | grep 1
+; RUN: llvm-as  %s | opt -predsimplify -instcombine -simplifycfg 
-disable-output 
+; RUN: llvm-as  %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | 
grep -v declare | not grep fail 
+; RUN: llvm-as  %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | 
grep -v declare | grep -c pass | grep 3
 
 int %test1(int %x, int %y) {
 entry:
@@ -10,12 +10,16 @@
 
 cond_true: ; preds = %entry
%tmp4 = seteq int %x, 0 ; bool [#uses=1]
-   br bool %tmp4, label %cond_true5, label %return
+   br bool %tmp4, label %cond_true5, label %cond_false
 
 cond_true5:; preds = %cond_true
-   %tmp6 = call int %fail( )   ; int [#uses=0]
+   %tmp6 = call int %pass( )   ; int [#uses=1]
ret int %tmp6
 
+cond_false:
+   %tmp8 = call int %fail ( )  ; int [#uses=1]
+   ret int %tmp8
+
 return:; preds = %cond_next7
ret int 0
 }
@@ -28,15 +32,21 @@
 
 cond_true: ; preds = %entry
%tmp4 = seteq int %x, 0 ; bool [#uses=1]
-   br bool %tmp4, label %cond_true5, label %return
+   br bool %tmp4, label %cond_true5, label %cond_false
 
 cond_true5:; preds = %cond_true
-   %tmp6 = call int %pass( )   ; int [#uses=0]
+   %tmp6 = call int %pass1( )  ; int [#uses=1]
ret int %tmp6
 
+cond_false:
+   %tmp8 = call int %pass2( )  ; int [#uses=1]
+   ret int %tmp8
+
 return:; preds = %cond_next7
ret int 0
 }
 
 declare int %fail()
 declare int %pass()
+declare int %pass1()
+declare int %pass2()



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp

2006-10-27 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86AsmPrinter.cpp updated: 1.206 - 1.207
---
Log message:

Doh. Must check if GV is constant first.

---
Diffs of the changes:  (+2 -2)

 X86AsmPrinter.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.206 
llvm/lib/Target/X86/X86AsmPrinter.cpp:1.207
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.206 Thu Oct 26 14:18:18 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp   Sat Oct 28 00:56:06 2006
@@ -205,9 +205,9 @@
 O  \t.globl   name  \n;
 // FALL THROUGH
   case GlobalValue::InternalLinkage: {
-if (TAI-getCStringSection()) {
+if (I-isConstant()) {
   const ConstantArray *CVA = dyn_castConstantArray(C);
-  if (CVA  CVA-isCString()) {
+  if (TAI-getCStringSection()  CVA  CVA-isCString()) {
 SwitchToDataSection(TAI-getCStringSection(), I);
 break;
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

2006-10-27 Thread Evan Cheng


Changes in directory llvm/lib/Target/PowerPC:

PPCAsmPrinter.cpp updated: 1.203 - 1.204
---
Log message:

Doh. Must check if GV is constant first before putting it in .cstring.

---
Diffs of the changes:  (+2 -2)

 PPCAsmPrinter.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.203 
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.204
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.203 Thu Oct 26 16:48:57 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp   Sat Oct 28 00:56:51 2006
@@ -548,9 +548,9 @@
 O  \t.globl   name  \n;
 // FALL THROUGH
   case GlobalValue::InternalLinkage:
-if (TAI-getCStringSection()) {
+if (I-isConstant()) {
   const ConstantArray *CVA = dyn_castConstantArray(C);
-  if (CVA  CVA-isCString()) {
+  if (TAI-getCStringSection()  CVA  CVA-isCString()) {
 SwitchToDataSection(TAI-getCStringSection(), I);
 break;
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits