[llvm-commits] CVS: llvm/lib/Bytecode/Writer/WriterInternals.h

2007-02-08 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

WriterInternals.h updated: 1.30 -> 1.31
---
Log message:

remove unneeded #includes


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

 WriterInternals.h |3 ---
 1 files changed, 3 deletions(-)


Index: llvm/lib/Bytecode/Writer/WriterInternals.h
diff -u llvm/lib/Bytecode/Writer/WriterInternals.h:1.30 
llvm/lib/Bytecode/Writer/WriterInternals.h:1.31
--- llvm/lib/Bytecode/Writer/WriterInternals.h:1.30 Fri Feb  9 01:53:20 2007
+++ llvm/lib/Bytecode/Writer/WriterInternals.h  Fri Feb  9 01:54:13 2007
@@ -19,9 +19,6 @@
 #include "llvm/Bytecode/Writer.h"
 #include "llvm/Bytecode/Format.h"
 #include "llvm/Instruction.h"
-#include "llvm/Support/DataTypes.h"
-#include 
-#include 
 
 namespace llvm {
   class InlineAsm;



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp WriterInternals.h

2007-02-08 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.157 -> 1.158
WriterInternals.h updated: 1.29 -> 1.30
---
Log message:

remove dead code, the outputConstants function is now only called at module 
scope.


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

 Writer.cpp|   18 +-
 WriterInternals.h |2 +-
 2 files changed, 6 insertions(+), 14 deletions(-)


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.157 
llvm/lib/Bytecode/Writer/Writer.cpp:1.158
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.157   Fri Feb  9 01:51:47 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Fri Feb  9 01:53:20 2007
@@ -826,7 +826,7 @@
   outputModuleInfoBlock(M);
 
   // Output module level constants, used for global variable initializers
-  outputConstants(false);
+  outputConstants();
 
   // Do the whole module now! Process each function at a time...
   for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
@@ -904,30 +904,22 @@
   return Ty != Type::LabelTy && Ty != Type::VoidTy && !isa(Ty);
 }
 
-void BytecodeWriter::outputConstants(bool isFunction) {
+void BytecodeWriter::outputConstants() {
   BytecodeBlock CPool(BytecodeFormat::ConstantPoolBlockID, *this,
   true  /* Elide block if empty */);
 
   unsigned NumPlanes = Table.getNumPlanes();
 
-  if (isFunction)
-// Output the type plane before any constants!
-outputTypes(Table.getModuleTypeLevel());
-  else
-// Output module-level string constants before any other constants.
-outputConstantStrings();
+  // Output module-level string constants before any other constants.
+  outputConstantStrings();
 
   for (unsigned pno = 0; pno != NumPlanes; pno++) {
 const std::vector &Plane = Table.getPlane(pno);
 if (!Plane.empty()) {  // Skip empty type planes...
   unsigned ValNo = 0;
-  if (isFunction)  // Don't re-emit module constants
-ValNo += Table.getModuleLevel(pno);
-
   if (hasNullValue(Plane[0]->getType())) {
 // Skip zero initializer
-if (ValNo == 0)
-  ValNo = 1;
+ValNo = 1;
   }
 
   // Write out constants in the plane


Index: llvm/lib/Bytecode/Writer/WriterInternals.h
diff -u llvm/lib/Bytecode/Writer/WriterInternals.h:1.29 
llvm/lib/Bytecode/Writer/WriterInternals.h:1.30
--- llvm/lib/Bytecode/Writer/WriterInternals.h:1.29 Mon Feb  5 14:47:20 2007
+++ llvm/lib/Bytecode/Writer/WriterInternals.h  Fri Feb  9 01:53:20 2007
@@ -35,7 +35,7 @@
   BytecodeWriter(std::vector &o, const Module *M);
 
 private:
-  void outputConstants(bool isFunction);
+  void outputConstants();
   void outputConstantStrings();
   void outputFunction(const Function *F);
   void outputCompactionTable();



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


[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h Writer.cpp

2007-02-08 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.82 -> 1.83
SlotCalculator.h updated: 1.27 -> 1.28
Writer.cpp updated: 1.156 -> 1.157
---
Log message:

1. constants can never occur in the symbol table.
2. All function-level constants are now incorporated into the module-level
  constant pool, since the compaction table was removed.  Eliminate extra
  work to check for them.

This speeds up the bcwriter from 24.4s to 13.1s on 447.dealII and .73 -> .56s
on kc++ in a release build.



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

 SlotCalculator.cpp |   18 --
 SlotCalculator.h   |1 -
 Writer.cpp |2 --
 3 files changed, 21 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.82 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.83
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.82Mon Feb  5 14:47:20 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Fri Feb  9 01:51:47 2007
@@ -171,7 +171,6 @@
   }
   getOrCreateSlot(I->getType());
 }
-processSymbolTableConstants(&F->getValueSymbolTable());
   }
 
   // Insert constants that are named at module level into the slot pool so that
@@ -233,15 +232,6 @@
 getOrCreateSlot(VI->second);
 }
 
-void SlotCalculator::processSymbolTableConstants(const ValueSymbolTable *VST) {
-  // Now do the constant values in all planes
-  for (ValueSymbolTable::const_iterator VI = VST->begin(), VE = VST->end(); 
-   VI != VE; ++VI)
-if (isa(VI->second) && !isa(VI->second))
-  getOrCreateSlot(VI->second);
-}
-
-
 void SlotCalculator::incorporateFunction(const Function *F) {
   assert((ModuleLevel.empty() ||
   ModuleTypeLevel == 0) && "Module already incorporated!");
@@ -270,14 +260,6 @@
 for (constant_iterator CI = constant_begin(F), CE = constant_end(F);
  CI != CE; ++CI)
   getOrCreateSlot(*CI);
-
-// If there is a symbol table, it is possible that the user has names for
-// constants that are not being used.  In this case, we will have problems
-// if we don't emit the constants now, because otherwise we will get
-// symbol table references to constants not in the output.  Scan for these
-// constants now.
-//
-processSymbolTableConstants(&F->getValueSymbolTable());
   }
 
   SC_DEBUG("Inserting Instructions:\n");


Index: llvm/lib/Bytecode/Writer/SlotCalculator.h
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.h:1.27 
llvm/lib/Bytecode/Writer/SlotCalculator.h:1.28
--- llvm/lib/Bytecode/Writer/SlotCalculator.h:1.27  Mon Feb  5 14:47:20 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.h   Fri Feb  9 01:51:47 2007
@@ -132,7 +132,6 @@
   //
   void processTypeSymbolTable(const TypeSymbolTable *ST);
   void processValueSymbolTable(const ValueSymbolTable *ST);
-  void processSymbolTableConstants(const ValueSymbolTable *ST);
 
   // insertPrimitives - helper for constructors to insert primitive types.
   void insertPrimitives();


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.156 
llvm/lib/Bytecode/Writer/Writer.cpp:1.157
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.156   Mon Feb  5 14:47:20 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Fri Feb  9 01:51:47 2007
@@ -1112,8 +1112,6 @@
   // Get slot information about the function...
   Table.incorporateFunction(F);
 
-  outputConstants(true);
-
   // Output all of the instructions in the body of the function
   outputInstructions(F);
 



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


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

2007-02-08 Thread Zhou Sheng


Changes in directory llvm/lib/Support:

APInt.cpp updated: 1.6 -> 1.7
---
Log message:

Eliminates friend function declaration inside APInt, instead, adds public
methods as those global function's internal implementation.


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

 APInt.cpp |   46 +++---
 1 files changed, 23 insertions(+), 23 deletions(-)


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.6 llvm/lib/Support/APInt.cpp:1.7
--- llvm/lib/Support/APInt.cpp:1.6  Thu Feb  8 10:45:48 2007
+++ llvm/lib/Support/APInt.cpp  Fri Feb  9 01:48:24 2007
@@ -674,8 +674,8 @@
 
 /// @brief Array-indexing support.
 bool APInt::operator[](unsigned bitPosition) const {
-  return maskBit(bitPosition) & (isSingleWord() ? 
- VAL : pVal[whichWord(bitPosition)]) != 0;
+  return (maskBit(bitPosition) & (isSingleWord() ? 
+  VAL : pVal[whichWord(bitPosition)])) != 0;
 }
 
 /// @brief Equality operator. Compare this APInt with the given APInt& RHS 
@@ -932,14 +932,14 @@
 
 
 /// ByteSwap - This function returns a byte-swapped representation of the
-/// APInt argument, APIVal.
-APInt llvm::APIntOps::ByteSwap(const APInt& APIVal) {
-  if (APIVal.BitsNum <= 32)
-return APInt(APIVal.BitsNum, ByteSwap_32(unsigned(APIVal.VAL)));
-  else if (APIVal.BitsNum <= 64)
-return APInt(APIVal.BitsNum, ByteSwap_64(APIVal.VAL));
+/// this APInt.
+APInt APInt::ByteSwap() const {
+  if (BitsNum <= 32)
+return APInt(BitsNum, ByteSwap_32(unsigned(VAL)));
+  else if (BitsNum <= 64)
+return APInt(BitsNum, ByteSwap_64(VAL));
   else
-return APIVal;
+return *this;
 }
 
 /// GreatestCommonDivisor - This function returns the greatest common
@@ -955,10 +955,10 @@
   return A;
 }
 
-/// Arithmetic right-shift the APInt by shiftAmt.
+/// Arithmetic right-shift this APInt by shiftAmt.
 /// @brief Arithmetic right-shift function.
-APInt llvm::APIntOps::ashr(const APInt& LHS, unsigned shiftAmt) {
-  APInt API(LHS);
+APInt APInt::ashr(unsigned shiftAmt) const {
+  APInt API(*this);
   if (API.isSingleWord())
 API.VAL = (((int64_t(API.VAL) << (64 - API.BitsNum)) >> (64 - API.BitsNum))
>> shiftAmt) & (~uint64_t(0UL) >> (64 - API.BitsNum));
@@ -981,10 +981,10 @@
   return API;
 }
 
-/// Logical right-shift the APInt by shiftAmt.
+/// Logical right-shift this APInt by shiftAmt.
 /// @brief Logical right-shift function.
-APInt llvm::APIntOps::lshr(const APInt& RHS, unsigned shiftAmt) {
-  APInt API(RHS);
+APInt APInt::lshr(unsigned shiftAmt) const {
+  APInt API(*this);
   if (API.isSingleWord())
 API.VAL >>= shiftAmt;
   else {
@@ -1000,10 +1000,10 @@
   return API;
 }
 
-/// Left-shift the APInt by shiftAmt.
+/// Left-shift this APInt by shiftAmt.
 /// @brief Left-shift function.
-APInt llvm::APIntOps::shl(const APInt& RHS, unsigned shiftAmt) {
-  APInt API(RHS);
+APInt APInt::shl(unsigned shiftAmt) const {
+  APInt API(*this);
   if (shiftAmt >= API.BitsNum) {
 if (API.isSingleWord()) 
   API.VAL = 0;
@@ -1019,10 +1019,10 @@
   return API;
 }
 
-/// Unsigned divide APInt LHS by APInt RHS.
+/// Unsigned divide this APInt by APInt RHS.
 /// @brief Unsigned division function for APInt.
-APInt llvm::APIntOps::udiv(const APInt& LHS, const APInt& RHS) {
-  APInt API(LHS);
+APInt APInt::udiv(const APInt& RHS) const {
+  APInt API(*this);
   unsigned first = RHS.getNumWords() * APInt::APINT_BITS_PER_WORD - 
RHS.CountLeadingZeros();
   unsigned ylen = !first ? 0 : APInt::whichWord(first - 1) + 1;
@@ -1066,8 +1066,8 @@
 
 /// Unsigned remainder operation on APInt.
 /// @brief Function for unsigned remainder operation.
-APInt llvm::APIntOps::urem(const APInt& LHS, const APInt& RHS) {
-  APInt API(LHS);
+APInt APInt::urem(const APInt& RHS) const {
+  APInt API(*this);
   unsigned first = RHS.getNumWords() * APInt::APINT_BITS_PER_WORD -
RHS.CountLeadingZeros();
   unsigned ylen = !first ? 0 : APInt::whichWord(first - 1) + 1;



___
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/APInt.h

2007-02-08 Thread Zhou Sheng


Changes in directory llvm/include/llvm/ADT:

APInt.h updated: 1.5 -> 1.6
---
Log message:

Eliminates friend function declaration inside APInt, instead, adds public
methods as those global function's internal implementation.


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

 APInt.h |  146 +---
 1 files changed, 103 insertions(+), 43 deletions(-)


Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.5 llvm/include/llvm/ADT/APInt.h:1.6
--- llvm/include/llvm/ADT/APInt.h:1.5   Thu Feb  8 08:30:42 2007
+++ llvm/include/llvm/ADT/APInt.h   Fri Feb  9 01:47:22 2007
@@ -24,15 +24,7 @@
 /// Forward declaration.
 class APInt;
 namespace APIntOps {
-  bool isIntN(unsigned N, const APInt& APIVal);
-  APInt ByteSwap(const APInt& APIVal);
-  APInt LogBase2(const APInt& APIVal);
-  APInt ashr(const APInt& LHS, unsigned shiftAmt);
-  APInt lshr(const APInt& LHS, unsigned shiftAmt);
-  APInt shl(const APInt& LHS, unsigned shiftAmt);
-  APInt sdiv(const APInt& LHS, const APInt& RHS);
   APInt udiv(const APInt& LHS, const APInt& RHS);
-  APInt srem(const APInt& LHS, const APInt& RHS);
   APInt urem(const APInt& LHS, const APInt& RHS);
 }
 
@@ -53,19 +45,6 @@
 /// Note: In this class, all bit/byte/word positions are zero-based.
 ///
 class APInt {
-  /// Friend Functions of APInt declared here. For detailed comments,
-  /// see bottom of this file.
-  friend bool APIntOps::isIntN(unsigned N, const APInt& APIVal);
-  friend APInt APIntOps::ByteSwap(const APInt& APIVal);
-  friend APInt APIntOps::LogBase2(const APInt& APIVal);
-  friend APInt APIntOps::ashr(const APInt& LHS, unsigned shiftAmt);
-  friend APInt APIntOps::lshr(const APInt& LHS, unsigned shiftAmt);
-  friend APInt APIntOps::shl(const APInt& LHS, unsigned shiftAmt);
-  friend APInt APIntOps::sdiv(const APInt& LHS, const APInt& RHS);
-  friend APInt APIntOps::udiv(const APInt& LHS, const APInt& RHS);
-  friend APInt APIntOps::srem(const APInt& LHS, const APInt& RHS);
-  friend APInt APIntOps::urem(const APInt& LHS, const APInt& RHS);
-
   unsigned BitsNum;  ///< The number of bits.
 
   /// This union is used to store the integer value. When the
@@ -387,19 +366,68 @@
   inline unsigned getNumBits() const
   { return BitsNum; }
 
+  /// @brief Check if this APInt has a N-bits integer value.
+  inline bool isIntN(unsigned N) const {
+if (isSingleWord()) {
+  return VAL == VAL & (~uint64_t(0ULL) >> (64 - N));
+} else {
+  APInt Tmp(N, pVal);
+  return Tmp == (*this);
+}
+  }
+
+  /// @returns a byte-swapped representation of this APInt Value.
+  APInt ByteSwap() const;
+
+  /// @returns the floor log base 2 of this APInt.
+  inline unsigned LogBase2() const {
+return getNumWords() * APINT_BITS_PER_WORD - 
+   CountLeadingZeros();
+  }
+
+  /// Arithmetic right-shift this APInt by shiftAmt.
+  /// @brief Arithmetic right-shift function.
+  APInt ashr(unsigned shiftAmt) const;
+
+  /// Logical right-shift this APInt by shiftAmt.
+  /// @brief Logical right-shift function.
+  APInt lshr(unsigned shiftAmt) const;
+
+  /// Left-shift this APInt by shiftAmt.
+  /// @brief Left-shift function.
+  APInt shl(unsigned shiftAmt) const;
+
+  /// Signed divide this APInt by APInt RHS.
+  /// @brief Signed division function for APInt.
+  inline APInt sdiv(const APInt& RHS) const {
+bool isSignedLHS = (*this)[BitsNum - 1], isSignedRHS = RHS[RHS.BitsNum - 
1];
+APInt API = APIntOps::udiv(isSignedLHS ? -(*this) : (*this), isSignedRHS ? 
-RHS : RHS);
+return isSignedLHS != isSignedRHS ? -API : API;;
+  }
+
+  /// Unsigned divide this APInt by APInt RHS.
+  /// @brief Unsigned division function for APInt.
+  APInt udiv(const APInt& RHS) const;
+
+  /// Signed remainder operation on APInt.
+  /// @brief Function for signed remainder operation.
+  inline APInt srem(const APInt& RHS) const {
+bool isSignedLHS = (*this)[BitsNum - 1], isSignedRHS = RHS[RHS.BitsNum - 
1];
+APInt API = APIntOps::urem(isSignedLHS ? -(*this) : (*this), isSignedRHS ? 
-RHS : RHS);
+return isSignedLHS ? -API : API;
+  }
+
+  /// Unsigned remainder operation on APInt.
+  /// @brief Function for unsigned remainder operation.
+  APInt urem(const APInt& RHS) const;
+
 };
 
 namespace APIntOps {
 
 /// @brief Check if the specified APInt has a N-bits integer value.
 inline bool isIntN(unsigned N, const APInt& APIVal) {
-  if (APIVal.isSingleWord()) {
-APInt Tmp(N, APIVal.VAL);
-return Tmp == APIVal;
-  } else {
-APInt Tmp(N, APIVal.pVal);
-return Tmp == APIVal;
-  }
+  return APIVal.isIntN(N);
 }
 
 /// @returns true if the argument APInt value is a sequence of ones
@@ -415,12 +443,13 @@
 }
 
 /// @returns a byte-swapped representation of the specified APInt Value.
-APInt ByteSwap(const APInt& APIVal);
+inline APInt ByteSwap(const APInt& APIVal) {
+  return APIVal.ByteSwap();
+}
 
 /// @returns the floor log base 2 of the specified APInt value.
-inline APInt Lo

[llvm-commits] CVS: llvm/test/CodeGen/PowerPC/long-compare.ll

2007-02-08 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/PowerPC:

long-compare.ll added (r1.1)
---
Log message:

Add ppc-specific test for better i64 compare codegen.


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

 long-compare.ll |9 +
 1 files changed, 9 insertions(+)


Index: llvm/test/CodeGen/PowerPC/long-compare.ll
diff -c /dev/null llvm/test/CodeGen/PowerPC/long-compare.ll:1.1
*** /dev/null   Thu Feb  8 22:49:56 2007
--- llvm/test/CodeGen/PowerPC/long-compare.ll   Thu Feb  8 22:49:46 2007
***
*** 0 
--- 1,9 
+ ; RUN: llvm-as < %s | llc -march=ppc32 | grep cntlzw &&
+ ; RUN: llvm-as < %s | llc -march=ppc32 | not grep xori &&
+ ; RUN: llvm-as < %s | llc -march=ppc32 | not grep 'li ' &&
+ ; RUN: llvm-as < %s | llc -march=ppc32 | not grep 'mr '
+ 
+ define i1 @test(i64 %x) {
+   %tmp = icmp ult i64 %x, 4294967296
+   ret i1 %tmp
+ }



___
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

2007-02-08 Thread Nate Begeman


Changes in directory llvm/lib/Target/PowerPC:

README.txt updated: 1.109 -> 1.110
---
Log message:

Remove fixed item


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

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


Index: llvm/lib/Target/PowerPC/README.txt
diff -u llvm/lib/Target/PowerPC/README.txt:1.109 
llvm/lib/Target/PowerPC/README.txt:1.110
--- llvm/lib/Target/PowerPC/README.txt:1.109Wed Jan 31 13:49:20 2007
+++ llvm/lib/Target/PowerPC/README.txt  Thu Feb  8 22:19:54 2007
@@ -267,32 +267,6 @@
 
 ===-===
 
-The legalizer should lower this:
-
-bool %test(ulong %x) {
-  %tmp = setlt ulong %x, 4294967296
-  ret bool %tmp
-}
-
-into "if x.high == 0", not:
-
-_test:
-cntlzw r2, r3
-xori r3, r3, 1
-cmplwi cr0, r3, 0
-srwi r2, r2, 5
-li r3, 0
-beq cr0, LBB1_2 ;entry
-LBB1_1: ;entry
-mr r3, r2
-LBB1_2: ;entry
-blr 
-
-noticed in 2005-05-11-Popcount-ffs-fls.c.
-
-
-===-===
-
 We should custom expand setcc instead of pretending that we have it.  That
 would allow us to expose the access of the crbit after the mfcr, allowing
 that access to be trivially folded into other ops.  A simple example:



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


[llvm-commits] CVS: llvm/docs/CommandGuide/llvm-ld.pod

2007-02-08 Thread Reid Spencer


Changes in directory llvm/docs/CommandGuide:

llvm-ld.pod updated: 1.5 -> 1.6
---
Log message:

Fix some formatting mistakes.


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

 llvm-ld.pod |   13 ++---
 1 files changed, 6 insertions(+), 7 deletions(-)


Index: llvm/docs/CommandGuide/llvm-ld.pod
diff -u llvm/docs/CommandGuide/llvm-ld.pod:1.5 
llvm/docs/CommandGuide/llvm-ld.pod:1.6
--- llvm/docs/CommandGuide/llvm-ld.pod:1.5  Thu Feb  8 22:12:51 2007
+++ llvm/docs/CommandGuide/llvm-ld.pod  Thu Feb  8 22:15:08 2007
@@ -71,6 +71,8 @@
 
 =head2 General Options
 
+=over 
+
 =item B<-help>
 
 Print a summary of command line options.
@@ -89,6 +91,8 @@
 Record the amount of time needed for each pass and print it to standard
 error.
 
+=back 
+
 =head2 Input/Output Options
 
 =over
@@ -242,16 +246,11 @@
 temporary file into which the program should place its optimized output. For
 example, the "no-op optimization" would be a simple shell script:
 
-=over
-
-#!/bin/bash
-cp $1 $2
-
-=back
+#!/bin/bash
+cp $1 $2
 
 =back
 
-
 =head1 EXIT STATUS
 
 If B succeeds, it will exit with 0 return code.  If an error occurs,



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


[llvm-commits] CVS: llvm/docs/CommandGuide/llvm-ld.pod

2007-02-08 Thread Reid Spencer


Changes in directory llvm/docs/CommandGuide:

llvm-ld.pod updated: 1.4 -> 1.5
---
Log message:

Merge gccld documentation in here. gccld will go away soon.


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

 llvm-ld.pod |  126 ++--
 1 files changed, 107 insertions(+), 19 deletions(-)


Index: llvm/docs/CommandGuide/llvm-ld.pod
diff -u llvm/docs/CommandGuide/llvm-ld.pod:1.4 
llvm/docs/CommandGuide/llvm-ld.pod:1.5
--- llvm/docs/CommandGuide/llvm-ld.pod:1.4  Mon Mar 13 23:42:07 2006
+++ llvm/docs/CommandGuide/llvm-ld.pod  Thu Feb  8 22:12:51 2007
@@ -10,11 +10,85 @@
 
 =head1 DESCRIPTION
 
-The B command is similar to the common Unix utility, C. It 
-links together bytecode modules to produce an executable program.
+The B tool takes a set of LLVM bytecode files and links them
+together into a single LLVM bytecode file.  The output bytecode file can be
+another bytecode file or an executable bytecode program.  Using additional
+options, B is able to produce native code executables.
+
+The B tool is the main linker for LLVM. It is used to link together
+the output of LLVM front-end compilers and run "link time" optimizations 
(mostly
+the inter-procedural kind).
+
+The B tools attemps to mimic the interface provided by the default
+system linker so that it can act as a I replacement.
+
+=head2 Search Order
+
+When looking for objects specified on the command line, B will search 
+for the object first in the current directory and then in the directory 
+specified by the B environment variable.  If it cannot 
+find the object, it fails.
+
+When looking for a library specified with the B<-l> option, B first
+attempts to load a file with that name from the current directory.  If that
+fails, it looks for libI.bc, libI.a, or 
libI.I, in that order, in each directory added to the library 
search
+path with the B<-L> option.  These directories are searched in the order they
+are specified.  If the library cannot be located, then B looks in the
+directory specified by the B environment variable.  If it
+does not find a library there, it fails.
+
+The I may be I<.so>, I<.dyld>, I<.dll>, or something
+different, depending upon the system.
+
+The B<-L> option is global.  It does not matter where it is specified in the
+list of command line arguments; the directory is simply added to the search 
path
+and is applied to all libraries, preceding or succeeding, in the command line.
+
+=head2 Link order
+
+All object and bytecode files are linked first in the order they were 
+specified on the command line.  All library files are linked next.  
+Some libraries may not be linked into the object program; see below.
+
+=head2 Library Linkage
+
+Object files and static bytecode objects are always linked into the output
+file.  Library archives (.a files) load only the objects within the archive
+that define symbols needed by the output file.  Hence, libraries should be
+listed after the object files and libraries which need them; otherwise, the
+library may not be linked in, and the dependent library will not have its
+undefined symbols defined.
+
+=head2 Native code generation
+
+The B program has limited support for native code generation, when
+using the B<-native> or B<-native-cbe> options. Native code generation is
+perfomed by converting the linked bytecode into native assembly (.s) or C code
+and running the system compiler (typically gcc) on the result.
 
 =head1 OPTIONS
 
+=head2 General Options
+
+=item B<-help>
+
+Print a summary of command line options.
+
+=item B<-v>
+
+Specifies verbose mode. In this mode the linker will print additional
+information about the actions it takes, programs it executes, etc. 
+
+=item B<-stats>
+
+Print statistics.
+
+=item B<-time-passes>
+
+Record the amount of time needed for each pass and print it to standard
+error.
+
 =head2 Input/Output Options
 
 =over
@@ -56,12 +130,24 @@
 
 =item B<-native>
 
-Generate a native binary instead of a shell script that runs the JIT from
-bytecode.
+Generate a native machine code executable.
+
+When generating native executables, B first checks for a bytecode
+version of the library and links it in, if necessary.  If the library is
+missing, B skips it.  Then, B links in the same
+libraries as native code.
+
+In this way, B should be able to link in optimized bytecode
+subsets of common libraries and then link in any part of the library that
+hasn't been converted to bytecode.
 
 =item B<-native-cbe>
 
-Generate a native binary with the C back end and compilation with GCC.
+Generate a native machine code executable with the LLVM C backend.
+  
+This option is identical to the B<-native> option, but uses the
+C backend to generate code for the program instead of an LLVM native
+code generator.
 
 =item B<-disable-compression>
 
@@ -115,18 +201,30 @@
 
 Do not mark all symbols as internal.
 
-=item B<-verify>
+=item B<-verify-each>
 
 Run the verification pass after each of the passes to verify i

[llvm-commits] CVS: llvm-test/SingleSource/Makefile.singlesrc

2007-02-08 Thread Reid Spencer


Changes in directory llvm-test/SingleSource:

Makefile.singlesrc updated: 1.34 -> 1.35
---
Log message:

Remove last vestiges of GCCAS/gccas, GCCLD/gccld


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

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


Index: llvm-test/SingleSource/Makefile.singlesrc
diff -u llvm-test/SingleSource/Makefile.singlesrc:1.34 
llvm-test/SingleSource/Makefile.singlesrc:1.35
--- llvm-test/SingleSource/Makefile.singlesrc:1.34  Thu Feb  8 21:38:16 2007
+++ llvm-test/SingleSource/Makefile.singlesrc   Thu Feb  8 21:43:45 2007
@@ -40,6 +40,6 @@
-$(CXX) $(CXXFLAGS) -O2 $(TARGET_FLAGS) $< -lm -o $@ $(LDFLAGS)
 
 
-bugpoint-gccas bugpoint-llvm-ld bugpoint-jit bugpoint-llc bugpoint-llc-beta:
+bugpoint-gccas bugpoint-opt bugpoint-llvm-ld bugpoint-gccld bugpoint-jit 
bugpoint-llc bugpoint-llc-beta:
@echo "The $@ target doesn't work in SingleSource.  Try:"
@echo "  'make Output/[programname].$@' instead."



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


[llvm-commits] CVS: llvm-test/Makefile.programs Makefile.rules

2007-02-08 Thread Reid Spencer


Changes in directory llvm-test:

Makefile.programs updated: 1.256 -> 1.257
Makefile.rules updated: 1.24 -> 1.25
---
Log message:

Remove last vestiges of GCCAS/gccas, GCCLD/gccld


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

 Makefile.programs |2 +-
 Makefile.rules|5 -
 2 files changed, 1 insertion(+), 6 deletions(-)


Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.256 llvm-test/Makefile.programs:1.257
--- llvm-test/Makefile.programs:1.256   Thu Feb  8 21:38:16 2007
+++ llvm-test/Makefile.programs Thu Feb  8 21:43:45 2007
@@ -430,7 +430,7 @@
 BUGPOINT_OPTIONS += --tool-args $(LLCFLAGS)
 BUGPOINT_ARGS += --args -- $(RUN_OPTIONS)
 
-# Rules to bugpoint the GCCAS, GCCLD, LLC, or LLI commands...
+# Rules to bugpoint the opt, llvm-ld, llc, or lli commands...
 $(PROGRAMS_TO_TEST:%=Output/%.bugpoint-opt): \
 Output/%.bugpoint-opt: Output/%.noopt-llvm.bc $(LBUGPOINT) \
  Output/opt-pass-args Output/%.out-nat


Index: llvm-test/Makefile.rules
diff -u llvm-test/Makefile.rules:1.24 llvm-test/Makefile.rules:1.25
--- llvm-test/Makefile.rules:1.24   Thu Feb  8 21:38:16 2007
+++ llvm-test/Makefile.rulesThu Feb  8 21:43:45 2007
@@ -275,7 +275,6 @@
 # Makefile.rules) 
 LLI   = $(LLVMTOOLCURRENT)/lli$(EXEEXT)
 LLC   = $(LLVMTOOLCURRENT)/llc$(EXEEXT)
-LGCCAS= $(LLVMTOOLCURRENT)/gccas$(EXEEXT)
 LLVMLD= $(LLVMLDPROG) -L$(LLVMGCCLIBDIR) -L$(LLVMGCCDIR)/lib
 LDIS  = $(LLVMTOOLCURRENT)/llvm-dis$(EXEEXT)
 LOPT  = $(LLVMTOOLCURRENT)/opt$(EXEEXT)
@@ -518,10 +517,6 @@
 #  be used in this way, it is better to define DONT_BUILD_RELINKED, and define
 #  BUILD_ARCHIVE instead.
 #
-#  Some libraries must be built as .a files (libscalar for example) because if
-#  it's built as a .o file, then all of the constituent .o files in it will be
-#  linked into tools (for example gccas) even if they only use one of the parts
-#  of it.  For this reason, sometimes it's useful to use libraries as .a files.
 ###
 
 # Install rule for making bytecode library directory if it does not exist.



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


[llvm-commits] CVS: llvm-test/SingleSource/Makefile.singlesrc

2007-02-08 Thread Reid Spencer


Changes in directory llvm-test/SingleSource:

Makefile.singlesrc updated: 1.33 -> 1.34
---
Log message:

Let's try using llvm-ld for the nightly test. If all goes well, gccld will
go away tomorrow. This patch replaces all uses of gccld with llvm-ld. 


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

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


Index: llvm-test/SingleSource/Makefile.singlesrc
diff -u llvm-test/SingleSource/Makefile.singlesrc:1.33 
llvm-test/SingleSource/Makefile.singlesrc:1.34
--- llvm-test/SingleSource/Makefile.singlesrc:1.33  Fri Feb  2 22:30:17 2007
+++ llvm-test/SingleSource/Makefile.singlesrc   Thu Feb  8 21:38:16 2007
@@ -40,6 +40,6 @@
-$(CXX) $(CXXFLAGS) -O2 $(TARGET_FLAGS) $< -lm -o $@ $(LDFLAGS)
 
 
-bugpoint-gccas bugpoint-gccld bugpoint-jit bugpoint-llc bugpoint-llc-beta:
+bugpoint-gccas bugpoint-llvm-ld bugpoint-jit bugpoint-llc bugpoint-llc-beta:
@echo "The $@ target doesn't work in SingleSource.  Try:"
@echo "  'make Output/[programname].$@' instead."



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


[llvm-commits] CVS: llvm-test/Makefile.dummylib Makefile.programs Makefile.rules Makefile.tests

2007-02-08 Thread Reid Spencer


Changes in directory llvm-test:

Makefile.dummylib updated: 1.7 -> 1.8
Makefile.programs updated: 1.255 -> 1.256
Makefile.rules updated: 1.23 -> 1.24
Makefile.tests updated: 1.14 -> 1.15
---
Log message:

Let's try using llvm-ld for the nightly test. If all goes well, gccld will
go away tomorrow. This patch replaces all uses of gccld with llvm-ld. 


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

 Makefile.dummylib |2 +-
 Makefile.programs |   48 
 Makefile.rules|4 ++--
 Makefile.tests|2 +-
 4 files changed, 28 insertions(+), 28 deletions(-)


Index: llvm-test/Makefile.dummylib
diff -u llvm-test/Makefile.dummylib:1.7 llvm-test/Makefile.dummylib:1.8
--- llvm-test/Makefile.dummylib:1.7 Mon Jan 24 15:11:06 2005
+++ llvm-test/Makefile.dummylib Thu Feb  8 21:38:16 2007
@@ -20,4 +20,4 @@
 LINKED_PROGS := $(PROGRAMS_TO_TEST:%=Output/%.lib.bc)
 
 $(LINKED_PROGS): Output/%.lib.bc: Output/%.llvm.bc $(DUMMYLIB)
-   $(LGCCLDPROG) --link-as-library $< $(DUMMYLIB) -o $@
+   $(LLVMLDPROG) --link-as-library $< $(DUMMYLIB) -o $@


Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.255 llvm-test/Makefile.programs:1.256
--- llvm-test/Makefile.programs:1.255   Sun Feb  4 17:50:20 2007
+++ llvm-test/Makefile.programs Thu Feb  8 21:38:16 2007
@@ -251,49 +251,49 @@
 # optimization...
 
 $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc): \
-Output/%.llvm.bc: Output/%.linked.bc $(LGCCLDPROG)
-   -$(LGCCLD) $(STATS) $< $(EXTRA_LINKTIME_OPT_FLAGS) -lc $(LIBS) -o 
Output/$*.llvm
+Output/%.llvm.bc: Output/%.linked.bc $(LLVM_LDDPROG)
+   -$(LLVMLD) $(STATS) $< $(EXTRA_LINKTIME_OPT_FLAGS) -lc $(LIBS) -o 
Output/$*.llvm
 ifneq ($(OPTPASSES),)
-$(LOPT) -q $(OPTPASSES) $@ -o [EMAIL PROTECTED] -f
$(MV) -f [EMAIL PROTECTED] $@
 endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.llvm): \
-Output/%.llvm: Output/%.linked.bc $(LGCCLDPROG)
-   -$(LGCCLD) $(STATS) $< -lc $(LIBS) -o Output/$*.llvm
+Output/%.llvm: Output/%.linked.bc $(LLVMLDPROG)
+   -$(LLVMLD) $(STATS) $< -lc $(LIBS) -o Output/$*.llvm
 ifneq ($(OPTPASSES),)
-$(LOPT) -q $(OPTPASSES) $@ -o [EMAIL PROTECTED] -f
$(MV) -f [EMAIL PROTECTED] $@
 endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.noopt-llvm.bc): \
-Output/%.noopt-llvm.bc: Output/%.linked.rbc $(LGCCLDPROG)
-   -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -o Output/$*.noopt-llvm
+Output/%.noopt-llvm.bc: Output/%.linked.rbc $(LLVMLDPROG)
+   -$(LLVMLD) -disable-opt $(STATS) $< -lc $(LIBS) -o Output/$*.noopt-llvm
 
 $(PROGRAMS_TO_TEST:%=Output/%.noopt-llvm): \
-Output/%.noopt-llvm: Output/%.linked.rbc $(LGCCLDPROG)
-   -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -o Output/$*.noopt-llvm
+Output/%.noopt-llvm: Output/%.linked.rbc $(LLVMLDPROG)
+   -$(LLVMLD) -disable-opt $(STATS) $< -lc $(LIBS) -o Output/$*.noopt-llvm
 
 
-$(PROGRAMS_TO_TEST:%=Output/%.nogccldopt-llvm.bc): \
-Output/%.nogccldopt-llvm.bc: Output/%.linked.bc $(LGCCLDPROG)
-   -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS) -o 
Output/$*.nogccldopt-llvm
+$(PROGRAMS_TO_TEST:%=Output/%.nollvm-ldopt-llvm.bc): \
+Output/%.nollvm-ldopt-llvm.bc: Output/%.linked.bc $(LLVMLDPROG)
+   -$(LLVMLD) -disable-opt $(STATS) $< -lc $(LIBS) -o 
Output/$*.nollvm-ldopt-llvm
 
-$(PROGRAMS_TO_TEST:%=Output/%.nogccldopt-llvm): \
-Output/%.nogccldopt-llvm: Output/%.linked.rbc $(LGCCLDPROG)
-   -$(LGCCLD) -disable-opt $(STATS) $< -lc $(LIBS)  -o 
Output/$*.nogccldopt-llvm
+$(PROGRAMS_TO_TEST:%=Output/%.nollvm-ldopt-llvm): \
+Output/%.nollvm-ldopt-llvm: Output/%.linked.rbc $(LLVMLDPROG)
+   -$(LLVMLD) -disable-opt $(STATS) $< -lc $(LIBS)  -o 
Output/$*.nollvm-ldopt-llvm
 
 endif   # ifndef DISABLE_FOR_LLVM_PROGRAMS
 
-# Targets to get the pass arguments that gccas and gccld are using...
+# Targets to get the pass arguments that opt and llvm-ld are using...
 Output/opt-pass-args: $(LOPT) Output/.dir
-$(LLVMAS) < /dev/null -o - | \
  $(LOPT) $(EXTRA_LOPT_OPTIONS) -std-compile-opts -disable-output 
-debug-pass=Arguments 2>&1 | \
  sed 's/Pass Arguments: //' | sed 's/-emitbytecode//' > $@
 
-Output/gccld-pass-args: $(LGCCLDPROG) Output/.dir
-   $(LLVMAS) < /dev/null > Output/gccld.test.bc
-   $(LGCCLD) Output/gccld.test.bc -o Output/gccld.test-out 
-debug-pass=Arguments > [EMAIL PROTECTED] 2>&1
+Output/llvm-ld-pass-args: $(LLVMLDPROG) Output/.dir
+   $(LLVMAS) < /dev/null > Output/llvm-ld.test.bc
+   $(LLVMLD) Output/llvm-ld.test.bc -o Output/llvm-ld.test-out 
-debug-pass=Arguments > [EMAIL PROTECTED] 2>&1
sed 's/Pass Arguments: //' < [EMAIL PROTECTED] | sed 
's/-emitbytecode//' > $@
 
 # If the program requires exception handling support, enable (potentially
@@ -431,15 +431,15 @@
 BUGPOINT_ARGS += --args -- $(RUN_OPTIONS)
 
 # Rules to bugpoint the GCCAS, GCCLD, LLC, or LLI commands...
-$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-gccas): \
-Output/%.bugpoint-gccas: Output/%.noopt-llvm.bc $(LBUGPOINT) \
+$(PR

[llvm-commits] CVS: llvm-test/External/SPEC/Makefile.spec

2007-02-08 Thread Reid Spencer


Changes in directory llvm-test/External/SPEC:

Makefile.spec updated: 1.61 -> 1.62
---
Log message:

Let's try using llvm-ld for the nightly test. If all goes well, gccld will
go away tomorrow. This patch replaces all uses of gccld with llvm-ld. 


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

 Makefile.spec |   15 +++
 1 files changed, 7 insertions(+), 8 deletions(-)


Index: llvm-test/External/SPEC/Makefile.spec
diff -u llvm-test/External/SPEC/Makefile.spec:1.61 
llvm-test/External/SPEC/Makefile.spec:1.62
--- llvm-test/External/SPEC/Makefile.spec:1.61  Sun Feb  4 13:39:34 2007
+++ llvm-test/External/SPEC/Makefile.spec   Thu Feb  8 21:38:16 2007
@@ -118,20 +118,20 @@
 BUGPOINT_OPTIONS += --tool-args $(LLCFLAGS)
 BUGPOINT_ARGS += --args -- $(RUN_OPTIONS)
 
-# Rules to bugpoint the GCCAS, GCCLD, LLC, or LLI commands...
-$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-gccas): \
-Output/%.bugpoint-gccas: Output/%.noopt-llvm.bc $(LBUGPOINT) \
+# Rules to bugpoint the opt, llvm-ld, llc, or lli commands...
+$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-opt): \
+Output/%.bugpoint-opt: Output/%.noopt-llvm.bc $(LBUGPOINT) \
  Output/opt-pass-args Output/%.out-nat
$(SPEC_SANDBOX) bugpoint-$(RUN_TYPE) $@ $(REF_IN_DIR) \
$(LBUGPOINT) ../$*.noopt-llvm.bc `cat Output/opt-pass-args` 
$(OPTPASSES) \
$(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS)
@echo "===> Leaving Output/bugpoint-$(RUN_TYPE)"
 
-$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-gccld): \
-Output/%.bugpoint-gccld: Output/%.nogccldopt-llvm.bc $(LBUGPOINT) \
- Output/gccld-pass-args Output/%.out-nat
+$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-llvm-ld): \
+Output/%.bugpoint-llvm-ld: Output/%.nollvm-ldopt-llvm.bc $(LBUGPOINT) \
+ Output/llvm-ld-pass-args Output/%.out-nat
$(SPEC_SANDBOX) bugpoint-$(RUN_TYPE) $@ $(REF_IN_DIR) \
-   $(LBUGPOINT) ../$*.nogccldopt-llvm.bc `cat Output/gccld-pass-args` 
$(OPTPASSES) \
+   $(LBUGPOINT) ../$*.nollvm-ldopt-llvm.bc `cat 
Output/llvm-ld-pass-args` $(OPTPASSES) \
$(BUGPOINT_OPTIONS) $(BUGPOINT_ARGS)
@echo "===> Leaving Output/bugpoint-$(RUN_TYPE)"
 
@@ -162,7 +162,6 @@
@echo "===> Leaving Output/bugpoint-$(RUN_TYPE)"
 
 
-
 LIBPROFILESO = $(LLVM_OBJ_ROOT)/Debug/lib/libprofile_rt.so
 
 $(PROGRAMS_TO_TEST:%=Output/%.prof): \



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


[llvm-commits] CVS: llvm-test/MultiSource/Makefile.multisrc

2007-02-08 Thread Reid Spencer


Changes in directory llvm-test/MultiSource:

Makefile.multisrc updated: 1.57 -> 1.58
---
Log message:

Let's try using llvm-ld for the nightly test. If all goes well, gccld will
go away tomorrow. This patch replaces all uses of gccld with llvm-ld. 


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

 Makefile.multisrc |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)


Index: llvm-test/MultiSource/Makefile.multisrc
diff -u llvm-test/MultiSource/Makefile.multisrc:1.57 
llvm-test/MultiSource/Makefile.multisrc:1.58
--- llvm-test/MultiSource/Makefile.multisrc:1.57Fri Feb  2 22:30:17 2007
+++ llvm-test/MultiSource/Makefile.multisrc Thu Feb  8 21:38:16 2007
@@ -40,8 +40,10 @@
 Output/%.o: %.cc Output/.dir
-$(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 $(TARGET_FLAGS) -c $< -o $@
 
-bugpoint-gccas: Output/$(PROG).bugpoint-gccas
-bugpoint-gccld: Output/$(PROG).bugpoint-gccld
+bugpoint-opt: Output/$(PROG).bugpoint-opt
+bugpoint-gccas: Output/$(PROG).bugpoint-opt
+bugpoint-llvm-ld: Output/$(PROG).bugpoint-llvm-ld
+bugpoint-gccld: Output/$(PROG).bugpoint-llvm-ld
 bugpoint-jit:   Output/$(PROG).bugpoint-jit
 bugpoint-llc:   Output/$(PROG).bugpoint-llc
 bugpoint-llc-beta: Output/$(PROG).bugpoint-llc-beta
@@ -52,8 +54,8 @@
 ifndef USE_PRECOMPILED_BYTECODE
 
 $(PROGRAMS_TO_TEST:%=Output/%.linked.rbc): \
-Output/%.linked.rbc: $(LObjects) $(LGCCLDPROG)
-   -$(LGCCLDPROG) -link-as-library -disable-opt $(LObjects) -o $@
+Output/%.linked.rbc: $(LObjects) $(LLVMLDPROG)
+   -$(LLVMLDPROG) -link-as-library -disable-opt $(LObjects) -o $@
 
 $(PROGRAMS_TO_TEST:%=Output/%.LOC.txt): \
 Output/%.LOC.txt: $(Source)



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


[llvm-commits] MultiSource/Benchmarks/MiBench/consumer-typeset/lout.li

2007-02-08 Thread Reid Spencer
Anyone know about this file?

Every time I run this test, this file gets modified. However, its
checked into CVS. I'm thinking it is just an output file and it
shouldn't be in CVS. But, before I cvs rm it, I thought I'd ask.

Reid.

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


[llvm-commits] CVS: llvm/tools/gccld/Makefile

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/gccld:

Makefile updated: 1.17 -> 1.18
---
Log message:

Put in a disabled template for when gccld is replaced by the shell script.


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

 Makefile |   19 +++
 1 files changed, 19 insertions(+)


Index: llvm/tools/gccld/Makefile
diff -u llvm/tools/gccld/Makefile:1.17 llvm/tools/gccld/Makefile:1.18
--- llvm/tools/gccld/Makefile:1.17  Mon Sep  4 00:59:09 2006
+++ llvm/tools/gccld/Makefile   Thu Feb  8 21:15:18 2007
@@ -14,3 +14,22 @@
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
+
+ifdef DONT_USE_THIS
+install-local:: $(PROJ_bindir)/gccld
+   
+$(PROJ_bindir)/gccld : gccld.sh Makefile
+   $(Echo)Installing gccld shell script.
+   $(Verb)sed "[EMAIL PROTECTED]@#$(PROJ_bindir)#" $< > $@
+   $(Verb)chmod 0755 $@
+
+all-local:: $(ToolDir)/gccld
+   
+$(ToolDir)/gccld : gccld.sh Makefile
+   $(Echo)Making $(ToolDir)/gccld shell script.
+   $(Verb)sed "[EMAIL PROTECTED]@#$(ToolDir)#" $< > $@
+   $(Verb)chmod 0755 $@
+
+clean-local::
+   $(Verb)$(RM) -f $(ToolDir)/gccld
+endif



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


[llvm-commits] CVS: llvm/tools/gccld/gccld.sh

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/gccld:

gccld.sh updated: 1.1 -> 1.2
---
Log message:

Get the right warning message.


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

 gccld.sh |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/tools/gccld/gccld.sh
diff -u llvm/tools/gccld/gccld.sh:1.1 llvm/tools/gccld/gccld.sh:1.2
--- llvm/tools/gccld/gccld.sh:1.1   Thu Feb  8 21:09:26 2007
+++ llvm/tools/gccld/gccld.sh   Thu Feb  8 21:12:21 2007
@@ -18,6 +18,6 @@
 # 
 
##===--===##
 #
-echo "gccas: This tool is deprecated, please use opt"
+echo "gccld: This tool is deprecated, please use llvm-ld"
 [EMAIL PROTECTED]@
 $TOOLDIR/llvm-ld "$@"



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


[llvm-commits] CVS: llvm/tools/gccld/gccld.sh

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/gccld:

gccld.sh added (r1.1)
---
Log message:

New shell script to replace gccld, eventually.


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

 gccld.sh |   23 +++
 1 files changed, 23 insertions(+)


Index: llvm/tools/gccld/gccld.sh
diff -c /dev/null llvm/tools/gccld/gccld.sh:1.1
*** /dev/null   Thu Feb  8 21:09:36 2007
--- llvm/tools/gccld/gccld.sh   Thu Feb  8 21:09:26 2007
***
*** 0 
--- 1,23 
+ #!/bin/sh
+ ##===- tools/gccld/gccld.sh *- bash 
-*-===##
+ # 
+ # The LLVM Compiler Infrastructure
+ #
+ # This file was developed by Reid Spencer and is distributed under the
+ # University of Illinois Open Source License. See LICENSE.TXT for details.
+ # 
+ 
##===--===##
+ #
+ # Synopsis: This shell script is a replacement for the old "gccld" tool that
+ #   existed in LLVM versions before 2.0. The functionality of gccld 
has
+ #   now been moved to llvm-ld. This shell script provides backwards 
+ #   compatibility so build environments invoking gccld can still get 
+ #   link (under the covers) with llvm-ld.
+ #
+ # Syntax:   gccld OPTIONS... (see llvm-ld for details)
+ # 
+ 
##===--===##
+ #
+ echo "gccas: This tool is deprecated, please use opt"
+ [EMAIL PROTECTED]@
+ $TOOLDIR/llvm-ld "$@"



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


[llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/llvm-ld:

llvm-ld.cpp updated: 1.47 -> 1.48
---
Log message:

Clean up error handling.


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

 llvm-ld.cpp |  127 +---
 1 files changed, 55 insertions(+), 72 deletions(-)


Index: llvm/tools/llvm-ld/llvm-ld.cpp
diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.47 llvm/tools/llvm-ld/llvm-ld.cpp:1.48
--- llvm/tools/llvm-ld/llvm-ld.cpp:1.47 Thu Feb  8 13:03:11 2007
+++ llvm/tools/llvm-ld/llvm-ld.cpp  Thu Feb  8 21:08:06 2007
@@ -59,6 +59,7 @@
   cl::desc("Specify libraries to link to"),
   cl::value_desc("library prefix"));
 
+// Options to control the linking, optimization, and code gen processes
 static cl::opt LinkAsLibrary("link-as-library",
   cl::desc("Link the .bc files together as a library, not an executable"));
 
@@ -84,7 +85,8 @@
 static cl::list XLinker("Xlinker", cl::value_desc("option"),
   cl::desc("Pass options to the system linker"));
 
-// Compatibility options that are ignored but supported by LD
+// Compatibility options that llvm-ld ignores but are supported for 
+// compatibility with LD
 static cl::opt CO3("soname", cl::Hidden,
   cl::desc("Compatibility option: ignored"));
 
@@ -107,15 +109,15 @@
 /// everywhere.
 static std::string progname;
 
-/// PrintAndReturn - Prints a message to standard error and returns true.
+/// PrintAndExit - Prints a message to standard error and exits with error code
 ///
 /// Inputs:
-///  progname - The name of the program (i.e. argv[0]).
 ///  Message  - The message to print to standard error.
 ///
-static int PrintAndReturn(const std::string &Message) {
+static void PrintAndExit(const std::string &Message, int errcode = 1) {
   cerr << progname << ": " << Message << "\n";
-  return 1;
+  llvm_shutdown();
+  exit(errcode);
 }
 
 /// CopyEnv - This function takes an array of environment variables and makes a
@@ -203,10 +205,8 @@
   std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
std::ios::binary;
   std::ofstream Out(FileName.c_str(), io_mode);
-  if (!Out.good()) {
-PrintAndReturn("error opening '" + FileName + "' for writing!");
-return;
-  }
+  if (!Out.good())
+PrintAndExit("error opening '" + FileName + "' for writing!");
 
   // Ensure that the bytecode file gets removed from the disk if we get a
   // terminating signal.
@@ -356,15 +356,11 @@
   // build tree to the destination file.
   std::string ErrMsg;  
   sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]);
-  if (llvmstub.isEmpty()) {
-cerr << "Could not find llvm-stub.exe executable!\n";
-exit(1);
-  }
+  if (llvmstub.isEmpty())
+PrintAndExit("Could not find llvm-stub.exe executable!");
 
-  if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) {
-cerr << argv[0] << ": " << ErrMsg << "\n";
-exit(1);
-  }
+  if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg))
+PrintAndExit(ErrMsg);
 
   return;
 #endif
@@ -372,7 +368,7 @@
   // Output the script to start the program...
   std::ofstream Out2(OutputFilename.c_str());
   if (!Out2.good())
-exit(PrintAndReturn("error opening '" + OutputFilename + "' for 
writing!"));
+PrintAndExit("error opening '" + OutputFilename + "' for writing!");
 
   Out2 << "#!/bin/sh\n";
   // Allow user to setenv LLVMINTERP if lli is not in their PATH.
@@ -481,7 +477,7 @@
 
   // Link all the items together
   if (TheLinker.LinkInItems(Items,LinkItems) )
-return 1;
+return 1; // Error already printed
 }
 
 std::auto_ptr Composite(TheLinker.releaseModule());
@@ -506,15 +502,15 @@
   if (!prog.canExecute()) {
 prog = sys::Program::FindProgramByName(*I);
 if (prog.isEmpty())
-  return PrintAndReturn(std::string("Optimization program '") + *I 
+
+  PrintAndExit(std::string("Optimization program '") + *I +
 "' is not found or not executable.");
   }
   // Get the program arguments
   sys::Path tmp_output("opt_result");
   std::string ErrMsg;
-  if (tmp_output.createTemporaryFileOnDisk(true, &ErrMsg)) {
-return PrintAndReturn(ErrMsg);
-  }
+  if (tmp_output.createTemporaryFileOnDisk(true, &ErrMsg))
+PrintAndExit(ErrMsg);
+
   const char* args[4];
   args[0] = I->c_str();
   args[1] = RealBytecodeOutput.c_str();
@@ -524,16 +520,12 @@
 if (tmp_output.isBytecodeFile()) {
   sys::Path target(RealBytecodeOutput);
   target.eraseFromDisk();
-  if (tmp_output.renamePathOnDisk(target, &ErrMsg)) {
-cerr << argv[0] << ": " << ErrMsg << "\n";
-return 2;
-  }
+  if (tmp_output.renamePathOnDisk(target, &ErrMsg))
+PrintAndExit(ErrMsg, 2);
 } else
-  return PrintAndReturn(
-

Re: [llvm-commits] [patch] Intruction Constraint DestReg!=SrcReg (for review)

2007-02-08 Thread Evan Cheng
> Index: lib/CodeGen/LiveIntervalAnalysis.cpp
> ===
> RCS file: /var/cvs/llvm/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp,v
> retrieving revision 1.204
> diff -u -r1.204 LiveIntervalAnalysis.cpp
> --- lib/CodeGen/LiveIntervalAnalysis.cpp  19 Dec 2006 22:41:21 -  
>  
> 1.204
> +++ lib/CodeGen/LiveIntervalAnalysis.cpp  5 Feb 2007 21:05:57 -
> -354,15 +354,26 @@
>  //
>  // Keep track of whether we replace a use and/or def  
> so that we can
>  // create the spill interval with the appropriate range.

Please update comment.

> -mop.setReg(NewVReg);
> -
> -bool HasUse = mop.isUse();
> -bool HasDef = mop.isDef();
> -for (unsigned j = i+1, e = MI->getNumOperands(); j !=  
> e; ++j) {
> +
> +bool HasUse = false;
> +bool HasDef = false;
> +int ReadLatency = InstrSlots::USE; //default read latency
> +for (unsigned j = i, e = MI->getNumOperands(); j != e;  
> ++j) {
>if (MI->getOperand(j).isReg() &&
>MI->getOperand(j).getReg() == li.reg) {
>  MI->getOperand(j).setReg(NewVReg);

Is this right? Aren't you in danger of modifying MO?


> -HasUse |= MI->getOperand(j).isUse();
> +
> +if (MI->getOperand(j).isUse()) {
> +  HasUse = true;
> +  //get the greatest read latency
> +  if (!MI->getOperand(j).isImplicit()){
> +int read_latency = MI->getInstrDescriptor()->
> +  getOperandConstraint(j,TOI::READ_LATENCY);
> +if (read_latency != -1 && read_latency >  
> ReadLatency)
> +  ReadLatency = read_latency;
> +  }
> +}
> +
>  HasDef |= MI->getOperand(j).isDef();
>}
>  }

> @@ -376,16 +387,16 @@
>  // the spill weight is now infinity as it
>  // cannot be spilled again
>  nI.weight = HUGE_VALF;
> -
> +unsigned ValNum = nI.getNextValue(~0U, 0);
>  if (HasUse) {
> -  LiveRange LR(getLoadIndex(index), getUseIndex(index),
> -   nI.getNextValue(~0U, 0));
> +  LiveRange LR(getLoadIndex(index),
> +   getBaseIndex(index) + ReadLatency + 1,  
> ValNum);
>DOUT << " +" << LR;
>nI.addRange(LR);
>  }
>  if (HasDef) {
>LiveRange LR(getDefIndex(index), getStoreIndex(index),
> -   nI.getNextValue(~0U, 0));
> +   ValNum);
>DOUT << " +" << LR;
>nI.addRange(LR);
>  }

Is this right? I think this is adding live intervals for the spill /  
restore instruction?


> @@ -441,6 +441,24 @@
>DOUT << "\t\tregister: "; DEBUG(printRegName(interval.reg));
>LiveVariables::VarInfo& vi = lv_->getVarInfo(interval.reg);
> +  // For each kill, get the greatest read latency of the virtual  
> register.
> +  std::vector ReadLatency(vi.Kills.size());
> +  for (unsigned i = 0, e = vi.Kills.size(); i != e; ++i){
> +const TargetInstrDescriptor *instrDescriptor =
> +  vi.Kills[i]->getInstrDescriptor();
> +ReadLatency[i] = InstrSlots::USE; //default read latency
> +//find the operands that use the virtual register
> +for (unsigned j = 0, f = vi.Kills[i]->getNumOperands(); j !=  
> f; ++j){
> +  MachineOperand op = vi.Kills[i]->getOperand(j);
> +  if (op.isRegister() && op.isUse() && (op.getReg() ==  
> interval.reg)) {
> +int read_latency =
> +  instrDescriptor->getOperandConstraint(j,  
> TOI::READ_LATENCY);
> +if (read_latency != -1 && read_latency > ReadLatency[i])
> +  ReadLatency[i] = (char) read_latency;
> +  }
> +}
> +  }

Question: is it necessary to calculate ReadLatency up front rather  
than calculated it on demand (i.e. the rest of the changes in this  
file which use ReadLatency)?

Some nit picks.

1. Please pick identifiers that are more consistent with the rest of  
the LLVM code. e.g. You'll find TID is used for TargetInstrDescriptor  
all over the place.
2. Please use getUseIndex() instead of InstrSlots::Use.
3. Please "unsigned" instead of "char" for ReadLatency to match  
getUseIndex(), etc.

>// Virtual registers may be defined multiple times (due to phi
>// elimination and 2-addr elimination).  Much of what we do only  
> has to be
>// done once for the vreg.  We use an empty interval to detect  
> the first
> @@ -467,7 +485,7 @@
>// FIXME: what about dead vars?
>unsigned killIdx;
>if (vi.Kills[0] != mi)
> -killIdx = getUseIndex(getInstructionIndex(vi.Kills[0]))+1;
> +killIdx = getInstructionIndex(vi.Kills[0]) + ReadLatency 
> [0] + 1;
>  

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

2007-02-08 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.153 -> 1.154
---
Log message:

This is done.

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

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


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.153 
llvm/lib/Target/X86/README.txt:1.154
--- llvm/lib/Target/X86/README.txt:1.153Sun Jan 21 01:03:37 2007
+++ llvm/lib/Target/X86/README.txt  Thu Feb  8 17:53:38 2007
@@ -665,20 +665,6 @@
 
 //===-===//
 
-We generate really bad code in some cases due to lowering SETCC/SELECT at 
-legalize time, which prevents the post-legalize dag combine pass from
-understanding the code.  As a silly example, this prevents us from folding 
-stuff like this:
-
-bool %test(ulong %x) {
-  %tmp = setlt ulong %x, 4294967296
-  ret bool %tmp
-}
-
-into x.h == 0
-
-//===-===//
-
 We currently compile sign_extend_inreg into two shifts:
 
 long foo(long X) {



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


[llvm-commits] CVS: llvm-test/MultiSource/Applications/JM/ldecod/Makefile

2007-02-08 Thread Evan Cheng


Changes in directory llvm-test/MultiSource/Applications/JM/ldecod:

Makefile updated: 1.6 -> 1.7
---
Log message:

Don't compile with -g

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

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


Index: llvm-test/MultiSource/Applications/JM/ldecod/Makefile
diff -u llvm-test/MultiSource/Applications/JM/ldecod/Makefile:1.6 
llvm-test/MultiSource/Applications/JM/ldecod/Makefile:1.7
--- llvm-test/MultiSource/Applications/JM/ldecod/Makefile:1.6   Sun Feb  4 
08:38:31 2007
+++ llvm-test/MultiSource/Applications/JM/ldecod/Makefile   Thu Feb  8 
16:42:38 2007
@@ -1,6 +1,6 @@
 LEVEL = ../../../..
 PROG = ldecod
-CPPFLAGS = -D __USE_LARGEFILE64 -D _FILE_OFFSET_BITS=64 -g
+CPPFLAGS = -D __USE_LARGEFILE64 -D _FILE_OFFSET_BITS=64
 LDFLAGS  = -lm $(TOOLLINKOPTS)
 
 RUN_OPTIONS = -i $(PROJ_SRC_DIR)/data/test.264 -o 
$(PROJ_SRC_DIR)/data/test_dec.yuv -r $(PROJ_SRC_DIR)/data/test_rec.yuv



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


[llvm-commits] CVS: llvm-test/MultiSource/Applications/JM/ldecod/global.h

2007-02-08 Thread Evan Cheng


Changes in directory llvm-test/MultiSource/Applications/JM/ldecod:

global.h updated: 1.5 -> 1.6
---
Log message:

Increase pathname buffer sizes.

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

 global.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm-test/MultiSource/Applications/JM/ldecod/global.h
diff -u llvm-test/MultiSource/Applications/JM/ldecod/global.h:1.5 
llvm-test/MultiSource/Applications/JM/ldecod/global.h:1.6
--- llvm-test/MultiSource/Applications/JM/ldecod/global.h:1.5   Thu Feb  8 
16:38:32 2007
+++ llvm-test/MultiSource/Applications/JM/ldecod/global.h   Thu Feb  8 
16:40:47 2007
@@ -634,9 +634,9 @@
 // input parameters from configuration file
 struct inp_par
 {
-  char infile[100];   //!< H.264 inputfile
-  char outfile[100];  //!< Decoded YUV 4:2:0 output
-  char reffile[100];  //!< Optional YUV 4:2:0 reference 
file for SNR measurement
+  char infile[1000];   //!< H.264 inputfile
+  char outfile[1000];  //!< Decoded YUV 4:2:0 output
+  char reffile[1000];  //!< Optional YUV 4:2:0 reference 
file for SNR measurement
   int FileFormat; //!< File format of the Input file, 
PAR_OF_ANNEXB or PAR_OF_RTP
   int ref_offset;
   int poc_scale;
@@ -647,7 +647,7 @@
   unsigned long R_decoder;//!< Decoder Rate in HRD Model
   unsigned long B_decoder;//!< Decoder Buffer size in HRD model
   unsigned long F_decoder;//!< Decoder Initial buffer fullness 
in HRD model
-  char LeakyBucketParamFile[100]; //!< LeakyBucketParamFile
+  char LeakyBucketParamFile[1000]; //!< LeakyBucketParamFile
 #endif
 
   // picture error concealment



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


[llvm-commits] CVS: llvm/test/CodeGen/ARM/long-setcc.ll

2007-02-08 Thread Evan Cheng


Changes in directory llvm/test/CodeGen/ARM:

long-setcc.ll added (r1.1)
---
Log message:

i64 setcc tests.

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

 long-setcc.ll |   20 
 1 files changed, 20 insertions(+)


Index: llvm/test/CodeGen/ARM/long-setcc.ll
diff -c /dev/null llvm/test/CodeGen/ARM/long-setcc.ll:1.1
*** /dev/null   Thu Feb  8 16:28:05 2007
--- llvm/test/CodeGen/ARM/long-setcc.ll Thu Feb  8 16:27:55 2007
***
*** 0 
--- 1,20 
+ ; RUN: llvm-as < %s | llc -march=arm &&
+ ; RUN: llvm-as < %s | llc -march=arm | grep cmp | wc -l | grep 2 &&
+ ; RUN: llvm-as < %s | llc -march=arm -enable-thumb &&
+ ; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep cmp | wc -l | grep 2
+ 
+ 
+ define i1 @t1(i64 %x) {
+   %B = icmp slt i64 %x, 0
+   ret i1 %B
+ }
+ 
+ define i1 @t2(i64 %x) {
+   %tmp = icmp ult i64 %x, 4294967296
+   ret i1 %tmp
+ }
+ 
+ define i1 @t3(i32 %x) {
+   %tmp = icmp ugt i32 %x, -1
+   ret i1 %tmp
+ }



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


[llvm-commits] CVS: llvm/test/CodeGen/X86/long-setcc.ll 2006-01-30-LongSetcc.ll

2007-02-08 Thread Evan Cheng


Changes in directory llvm/test/CodeGen/X86:

long-setcc.ll added (r1.1)
2006-01-30-LongSetcc.ll (r1.2) removed
---
Log message:

i64 setcc tests.

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

 long-setcc.ll |   18 ++
 1 files changed, 18 insertions(+)


Index: llvm/test/CodeGen/X86/long-setcc.ll
diff -c /dev/null llvm/test/CodeGen/X86/long-setcc.ll:1.1
*** /dev/null   Thu Feb  8 16:25:47 2007
--- llvm/test/CodeGen/X86/long-setcc.ll Thu Feb  8 16:25:37 2007
***
*** 0 
--- 1,18 
+ ; RUN: llvm-as < %s | llc -march=x86 &&
+ ; RUN: llvm-as < %s | llc -march=x86 | grep cmp | wc -l | grep 2 &&
+ ; RUN: llvm-as < %s | llc -march=x86 | grep xor | wc -l | grep 1
+ 
+ define i1 @t1(i64 %x) {
+   %B = icmp slt i64 %x, 0
+   ret i1 %B
+ }
+ 
+ define i1 @t2(i64 %x) {
+   %tmp = icmp ult i64 %x, 4294967296
+   ret i1 %tmp
+ }
+ 
+ define i1 @t3(i32 %x) {
+   %tmp = icmp ugt i32 %x, -1
+   ret i1 %tmp
+ }



___
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/LegalizeDAG.cpp

2007-02-08 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.471 -> 1.472
---
Log message:

Make use of TLI.SimplifySetCC() in LegalizeSetCCOperands().

---
Diffs of the changes:  (+36 -8)

 LegalizeDAG.cpp |   44 
 1 files changed, 36 insertions(+), 8 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.471 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.472
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.471 Sat Feb  3 19:20:02 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Thu Feb  8 16:16:19 2007
@@ -3732,7 +3732,8 @@
 
   // FIXME: This generated code sucks.
   ISD::CondCode LowCC;
-  switch (cast(CC)->get()) {
+  ISD::CondCode CCCode = cast(CC)->get();
+  switch (CCCode) {
   default: assert(0 && "Unknown integer setcc!");
   case ISD::SETLT:
   case ISD::SETULT: LowCC = ISD::SETULT; break;
@@ -3750,13 +3751,40 @@
 
   // NOTE: on targets without efficient SELECT of bools, we can always use
   // this identity: (B1 ? B2 : B3) --> (B1 & B2)|(!B1&B3)
-  Tmp1 = DAG.getSetCC(TLI.getSetCCResultTy(), LHSLo, RHSLo, LowCC);
-  Tmp2 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), LHSHi, RHSHi, CC);
-  Result = DAG.getSetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi, ISD::SETEQ);
-  Result = LegalizeOp(DAG.getNode(ISD::SELECT, Tmp1.getValueType(),
-  Result, Tmp1, Tmp2));
-  Tmp1 = Result;
-  Tmp2 = SDOperand();
+  TargetLowering::DAGCombinerInfo DagCombineInfo(DAG, false, true, NULL);
+  Tmp1 = TLI.SimplifySetCC(TLI.getSetCCResultTy(), LHSLo, RHSLo, LowCC,
+   false, DagCombineInfo);
+  if (!Tmp1.Val)
+Tmp1 = DAG.getSetCC(TLI.getSetCCResultTy(), LHSLo, RHSLo, LowCC);
+  Tmp2 = TLI.SimplifySetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi,
+   CCCode, false, DagCombineInfo);
+  if (!Tmp2.Val)
+Tmp2 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), LHSHi, RHSHi, 
CC);
+  
+  ConstantSDNode *Tmp1C = dyn_cast(Tmp1.Val);
+  ConstantSDNode *Tmp2C = dyn_cast(Tmp2.Val);
+  if ((Tmp1C && Tmp1C->getValue() == 0) ||
+  (Tmp2C && Tmp2C->getValue() == 0 &&
+   (CCCode == ISD::SETLE || CCCode == ISD::SETGE ||
+CCCode == ISD::SETUGE || CCCode == ISD::SETULE)) ||
+  (Tmp2C && Tmp2C->getValue() == 1 &&
+   (CCCode == ISD::SETLT || CCCode == ISD::SETGT ||
+CCCode == ISD::SETUGT || CCCode == ISD::SETULT))) {
+// low part is known false, returns high part.
+// For LE / GE, if high part is known false, ignore the low part.
+// For LT / GT, if high part is known true, ignore the low part.
+Tmp1 = Tmp2;
+Tmp2 = SDOperand();
+  } else {
+Result = TLI.SimplifySetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi,
+   ISD::SETEQ, false, DagCombineInfo);
+if (!Result.Val)
+  Result=DAG.getSetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi, 
ISD::SETEQ);
+Result = LegalizeOp(DAG.getNode(ISD::SELECT, Tmp1.getValueType(),
+Result, Tmp1, Tmp2));
+Tmp1 = Result;
+Tmp2 = SDOperand();
+  }
 }
   }
   }



___
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/DAGCombiner.cpp TargetLowering.cpp

2007-02-08 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.269 -> 1.270
TargetLowering.cpp updated: 1.88 -> 1.89
---
Log message:

Move SimplifySetCC to TargetLowering and allow it to be shared with legalizer.

---
Diffs of the changes:  (+426 -399)

 DAGCombiner.cpp|  404 --
 TargetLowering.cpp |  421 +
 2 files changed, 426 insertions(+), 399 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.269 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.270
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.269 Sat Jan 20 04:10:26 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Thu Feb  8 16:13:59 2007
@@ -423,7 +423,7 @@
   
   /// DagCombineInfo - Expose the DAG combiner to the target combiner impls.
   TargetLowering::DAGCombinerInfo 
-DagCombineInfo(DAG, !RunningAfterLegalize, this);
+DagCombineInfo(DAG, !RunningAfterLegalize, false, this);
 
   // while the worklist isn't empty, inspect the node on the end of it and
   // try and combine it.
@@ -3944,407 +3944,13 @@
   return SDOperand();
 }
 
+/// SimplifySetCC - This is a stub for TargetLowering::SimplifySetCC.
 SDOperand DAGCombiner::SimplifySetCC(MVT::ValueType VT, SDOperand N0,
  SDOperand N1, ISD::CondCode Cond,
  bool foldBooleans) {
-  // These setcc operations always fold.
-  switch (Cond) {
-  default: break;
-  case ISD::SETFALSE:
-  case ISD::SETFALSE2: return DAG.getConstant(0, VT);
-  case ISD::SETTRUE:
-  case ISD::SETTRUE2:  return DAG.getConstant(1, VT);
-  }
-
-  if (ConstantSDNode *N1C = dyn_cast(N1.Val)) {
-uint64_t C1 = N1C->getValue();
-if (isa(N0.Val)) {
-  return DAG.FoldSetCC(VT, N0, N1, Cond);
-} else {
-  // If the LHS is '(srl (ctlz x), 5)', the RHS is 0/1, and this is an
-  // equality comparison, then we're just comparing whether X itself is
-  // zero.
-  if (N0.getOpcode() == ISD::SRL && (C1 == 0 || C1 == 1) &&
-  N0.getOperand(0).getOpcode() == ISD::CTLZ &&
-  N0.getOperand(1).getOpcode() == ISD::Constant) {
-unsigned ShAmt = cast(N0.getOperand(1))->getValue();
-if ((Cond == ISD::SETEQ || Cond == ISD::SETNE) &&
-ShAmt == Log2_32(MVT::getSizeInBits(N0.getValueType( {
-  if ((C1 == 0) == (Cond == ISD::SETEQ)) {
-// (srl (ctlz x), 5) == 0  -> X != 0
-// (srl (ctlz x), 5) != 1  -> X != 0
-Cond = ISD::SETNE;
-  } else {
-// (srl (ctlz x), 5) != 0  -> X == 0
-// (srl (ctlz x), 5) == 1  -> X == 0
-Cond = ISD::SETEQ;
-  }
-  SDOperand Zero = DAG.getConstant(0, N0.getValueType());
-  return DAG.getSetCC(VT, N0.getOperand(0).getOperand(0),
-  Zero, Cond);
-}
-  }
-  
-  // If the LHS is a ZERO_EXTEND, perform the comparison on the input.
-  if (N0.getOpcode() == ISD::ZERO_EXTEND) {
-unsigned InSize = MVT::getSizeInBits(N0.getOperand(0).getValueType());
-
-// If the comparison constant has bits in the upper part, the
-// zero-extended value could never match.
-if (C1 & (~0ULL << InSize)) {
-  unsigned VSize = MVT::getSizeInBits(N0.getValueType());
-  switch (Cond) {
-  case ISD::SETUGT:
-  case ISD::SETUGE:
-  case ISD::SETEQ: return DAG.getConstant(0, VT);
-  case ISD::SETULT:
-  case ISD::SETULE:
-  case ISD::SETNE: return DAG.getConstant(1, VT);
-  case ISD::SETGT:
-  case ISD::SETGE:
-// True if the sign bit of C1 is set.
-return DAG.getConstant((C1 & (1ULL << VSize)) != 0, VT);
-  case ISD::SETLT:
-  case ISD::SETLE:
-// True if the sign bit of C1 isn't set.
-return DAG.getConstant((C1 & (1ULL << VSize)) == 0, VT);
-  default:
-break;
-  }
-}
-
-// Otherwise, we can perform the comparison with the low bits.
-switch (Cond) {
-case ISD::SETEQ:
-case ISD::SETNE:
-case ISD::SETUGT:
-case ISD::SETUGE:
-case ISD::SETULT:
-case ISD::SETULE:
-  return DAG.getSetCC(VT, N0.getOperand(0),
-  DAG.getConstant(C1, N0.getOperand(0).getValueType()),
-  Cond);
-default:
-  break;   // todo, be more careful with signed comparisons
-}
-  } else if (N0.getOpcode() == ISD::SIGN_EXTEND_INREG &&
- (Cond == ISD::SETEQ || Cond == ISD::SETNE)) {
-MVT::ValueType ExtSrcTy = cast(N0.getOperand(1))->getVT();
-unsigned ExtSrcTyBits = MVT::getSizeInBits(ExtSrcTy);
-MVT::ValueType ExtDstTy = N0.getValueType();
-unsigned ExtDstTyBits = M

[llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h

2007-02-08 Thread Evan Cheng


Changes in directory llvm/include/llvm/Target:

TargetLowering.h updated: 1.106 -> 1.107
---
Log message:

Move SimplifySetCC to TargetLowering and allow it to be shared with legalizer.

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

 TargetLowering.h |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Target/TargetLowering.h
diff -u llvm/include/llvm/Target/TargetLowering.h:1.106 
llvm/include/llvm/Target/TargetLowering.h:1.107
--- llvm/include/llvm/Target/TargetLowering.h:1.106 Thu Feb  1 02:39:52 2007
+++ llvm/include/llvm/Target/TargetLowering.h   Thu Feb  8 16:13:59 2007
@@ -513,13 +513,15 @@
   struct DAGCombinerInfo {
 void *DC;  // The DAG Combiner object.
 bool BeforeLegalize;
+bool CalledByLegalizer;
   public:
 SelectionDAG &DAG;
 
-DAGCombinerInfo(SelectionDAG &dag, bool bl, void *dc)
-  : DC(dc), BeforeLegalize(bl), DAG(dag) {}
+DAGCombinerInfo(SelectionDAG &dag, bool bl, bool cl, void *dc)
+  : DC(dc), BeforeLegalize(bl), CalledByLegalizer(cl), DAG(dag) {}
 
 bool isBeforeLegalize() const { return BeforeLegalize; }
+bool isCalledByLegalizer() const { return CalledByLegalizer; }
 
 void AddToWorklist(SDNode *N);
 SDOperand CombineTo(SDNode *N, const std::vector &To);
@@ -527,6 +529,12 @@
 SDOperand CombineTo(SDNode *N, SDOperand Res0, SDOperand Res1);
   };
 
+  /// SimplifySetCC - Try to simplify a setcc built with the specified 
operands 
+  /// and cc. If it is unable to simplify it, return a null SDOperand.
+  SDOperand SimplifySetCC(MVT::ValueType VT, SDOperand N0, SDOperand N1,
+  ISD::CondCode Cond, bool foldBooleans,
+  DAGCombinerInfo &DCI) const;
+
   /// PerformDAGCombine - This method will be invoked for all target nodes and
   /// for any target-independent nodes that the target has registered with
   /// invoke it for.



___
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/StringMap.h CStringMap.h

2007-02-08 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

StringMap.h updated: 1.4 -> 1.5
CStringMap.h (r1.4) removed
---
Log message:

Rename CStringMap -> StringMap, since it now supports nul characters in the
strings.


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

 StringMap.h |   34 +-
 1 files changed, 17 insertions(+), 17 deletions(-)


Index: llvm/include/llvm/ADT/StringMap.h
diff -u llvm/include/llvm/ADT/StringMap.h:1.4 
llvm/include/llvm/ADT/StringMap.h:1.5
--- llvm/include/llvm/ADT/StringMap.h:1.4   Thu Feb  8 13:08:37 2007
+++ llvm/include/llvm/ADT/StringMap.h   Thu Feb  8 13:20:57 2007
@@ -1,4 +1,4 @@
-//===--- CStringMap.h - CString Hash table map interface *- C++ 
-*-===//
+//===--- StringMap.h - String Hash table map interface --*- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -7,12 +7,12 @@
 //
 
//===--===//
 //
-// This file defines the CStringMap class.
+// This file defines the StringMap class.
 //
 
//===--===//
 
-#ifndef LLVM_ADT_CSTRINGMAP_H
-#define LLVM_ADT_CSTRINGMAP_H
+#ifndef LLVM_ADT_STRINGMAP_H
+#define LLVM_ADT_STRINGMAP_H
 
 #include "llvm/Support/Allocator.h"
 #include 
@@ -28,17 +28,17 @@
   unsigned getKeyLength() const { return StrLen; }
 };
   
-/// CStringMapVisitor - Subclasses of this class may be implemented to walk all
-/// of the items in a CStringMap.
-class CStringMapVisitor {
+/// StringMapVisitor - Subclasses of this class may be implemented to walk all
+/// of the items in a StringMap.
+class StringMapVisitor {
 public:
-  virtual ~CStringMapVisitor();
+  virtual ~StringMapVisitor();
   virtual void Visit(const char *Key, StringMapEntryBase *Value) const = 0;
 };
 
-/// CStringMapImpl - This is the base class of CStringMap that is shared among
+/// StringMapImpl - This is the base class of StringMap that is shared among
 /// all of its instantiations.
-class CStringMapImpl {
+class StringMapImpl {
 protected:
   /// ItemBucket - The hash table consists of an array of these.  If Item is
   /// non-null, this is an extant entry, otherwise, it is a hole.
@@ -56,7 +56,7 @@
   unsigned NumItems;
   unsigned ItemSize;
 protected:
-  CStringMapImpl(unsigned InitSize, unsigned ItemSize);
+  StringMapImpl(unsigned InitSize, unsigned ItemSize);
   void RehashTable();
   
   /// LookupBucketFor - Look up the bucket that the specified string should end
@@ -70,7 +70,7 @@
   unsigned getNumBuckets() const { return NumBuckets; }
   unsigned getNumItems() const { return NumItems; }
 
-  void VisitEntries(const CStringMapVisitor &Visitor) const;
+  void VisitEntries(const StringMapVisitor &Visitor) const;
 };
 
 /// StringMapEntry - This is used to represent one value that is inserted into
@@ -97,17 +97,17 @@
 };
 
 
-/// CStringMap - This is an unconventional map that is specialized for handling
+/// StringMap - This is an unconventional map that is specialized for handling
 /// keys that are "strings", which are basically ranges of bytes. This does 
some
 /// funky memory allocation and hashing things to make it extremely efficient,
 /// storing the string data *after* the value in the map.
 template
-class CStringMap : public CStringMapImpl {
+class StringMap : public StringMapImpl {
   AllocatorTy Allocator;
   typedef StringMapEntry MapEntryTy;
 public:
-  CStringMap(unsigned InitialSize = 0)
-: CStringMapImpl(InitialSize, sizeof(MapEntryTy)) {}
+  StringMap(unsigned InitialSize = 0)
+: StringMapImpl(InitialSize, sizeof(MapEntryTy)) {}
   
   AllocatorTy &getAllocator() { return Allocator; }
   const AllocatorTy &getAllocator() const { return Allocator; }
@@ -164,7 +164,7 @@
 return *NewItem;
   }
   
-  ~CStringMap() {
+  ~StringMap() {
 for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) {
   if (MapEntryTy *Id = static_cast(I->Item)) {
 // Free memory referenced by the item.



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


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

2007-02-08 Thread Chris Lattner


Changes in directory llvm/lib/Support:

StringMap.cpp updated: 1.4 -> 1.5
CStringMap.cpp (r1.4) removed
---
Log message:

Rename CStringMap -> StringMap, since it now supports nul characters in the
strings.


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

 StringMap.cpp |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/lib/Support/StringMap.cpp
diff -u llvm/lib/Support/StringMap.cpp:1.4 llvm/lib/Support/StringMap.cpp:1.5
--- llvm/lib/Support/StringMap.cpp:1.4  Thu Feb  8 13:08:37 2007
+++ llvm/lib/Support/StringMap.cpp  Thu Feb  8 13:20:57 2007
@@ -1,4 +1,4 @@
-//===--- CStringMap.cpp - CString Hash table map implementation 
---===//
+//===--- StringMap.cpp - String Hash table map implementation 
-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -7,18 +7,18 @@
 //
 
//===--===//
 //
-// This file implements the CStringMap class.
+// This file implements the StringMap class.
 //
 
//===--===//
 
-#include "llvm/ADT/CStringMap.h"
+#include "llvm/ADT/StringMap.h"
 #include 
 using namespace llvm;
 
-CStringMapVisitor::~CStringMapVisitor() {
+StringMapVisitor::~StringMapVisitor() {
 }
 
-CStringMapImpl::CStringMapImpl(unsigned InitSize, unsigned itemSize) {
+StringMapImpl::StringMapImpl(unsigned InitSize, unsigned itemSize) {
   assert((InitSize & (InitSize-1)) == 0 &&
  "Init Size must be a power of 2 or zero!");
   NumBuckets = InitSize ? InitSize : 512;
@@ -49,7 +49,7 @@
 /// specified bucket will be non-null.  Otherwise, it will be null.  In either
 /// case, the FullHashValue field of the bucket will be set to the hash value
 /// of the string.
-unsigned CStringMapImpl::LookupBucketFor(const char *NameStart,
+unsigned StringMapImpl::LookupBucketFor(const char *NameStart,
  const char *NameEnd) {
   unsigned HTSize = NumBuckets;
   unsigned FullHashValue = HashString(NameStart, NameEnd);
@@ -92,7 +92,7 @@
 
 /// RehashTable - Grow the table, redistributing values into the buckets with
 /// the appropriate mod-of-hashtable-size.
-void CStringMapImpl::RehashTable() {
+void StringMapImpl::RehashTable() {
   unsigned NewSize = NumBuckets*2;
   ItemBucket *NewTableArray = new ItemBucket[NewSize]();
   memset(NewTableArray, 0, NewSize*sizeof(ItemBucket));
@@ -130,7 +130,7 @@
 
 /// VisitEntries - This method walks through all of the items,
 /// invoking Visitor.Visit for each of them.
-void CStringMapImpl::VisitEntries(const CStringMapVisitor &Visitor) const {
+void StringMapImpl::VisitEntries(const StringMapVisitor &Visitor) const {
   for (ItemBucket *IB = TheTable, *E = TheTable+NumBuckets; IB != E; ++IB) {
 if (StringMapEntryBase *Id = IB->Item)
   Visitor.Visit((char*)Id + ItemSize, Id);



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


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

2007-02-08 Thread Chris Lattner


Changes in directory llvm/docs:

ProgrammersManual.html updated: 1.122 -> 1.123
---
Log message:

update this.


---
Diffs of the changes:  (+10 -11)

 ProgrammersManual.html |   21 ++---
 1 files changed, 10 insertions(+), 11 deletions(-)


Index: llvm/docs/ProgrammersManual.html
diff -u llvm/docs/ProgrammersManual.html:1.122 
llvm/docs/ProgrammersManual.html:1.123
--- llvm/docs/ProgrammersManual.html:1.122  Wed Feb  7 00:24:17 2007
+++ llvm/docs/ProgrammersManual.htmlThu Feb  8 13:14:21 2007
@@ -71,7 +71,7 @@
 Map-Like Containers (std::map, DenseMap, etc)
 
   A sorted 'vector'
-  "llvm/ADT/CStringMap.h"
+  "llvm/ADT/StringMap.h"
   "llvm/ADT/IndexedMap.h"
   "llvm/ADT/DenseMap.h"
   
@@ -1152,7 +1152,7 @@
 
 
 
-  "llvm/ADT/CStringMap.h"
+  "llvm/ADT/StringMap.h"
 
 
 
@@ -1160,12 +1160,11 @@
 
 Strings are commonly used as keys in maps, and they are difficult to support
 efficiently: they are variable length, inefficient to hash and compare when
-long, expensive to copy, etc.  CStringMap is a specialized container designed 
to
-cope with these issues.  It supports mapping an arbitrary range of bytes that
-does not have an embedded nul character in it ("C strings") to an arbitrary
-other object.
+long, expensive to copy, etc.  StringMap is a specialized container designed to
+cope with these issues.  It supports mapping an arbitrary range of bytes to an
+arbitrary other object.
 
-The CStringMap implementation uses a quadratically-probed hash table, where
+The StringMap implementation uses a quadratically-probed hash table, where
 the buckets store a pointer to the heap allocated entries (and some other
 stuff).  The entries in the map must be heap allocated because the strings are
 variable length.  The string data (key) and the element object (value) are
@@ -1173,15 +1172,15 @@
 object.  This container guarantees the "(char*)(&Value+1)" points
 to the key string for a value.
 
-The CStringMap is very fast for several reasons: quadratic probing is very
+The StringMap is very fast for several reasons: quadratic probing is very
 cache efficient for lookups, the hash value of strings in buckets is not
-recomputed when lookup up an element, CStringMap rarely has to touch the
+recomputed when lookup up an element, StringMap rarely has to touch the
 memory for unrelated objects when looking up a value (even when hash collisions
 happen), hash table growth does not recompute the hash values for strings
 already in the table, and each pair in the map is store in a single allocation
 (the string data is stored in the same allocation as the Value of a pair).
 
-CStringMap also provides query methods that take byte ranges, so it only 
ever
+StringMap also provides query methods that take byte ranges, so it only ever
 copies a string if a value is inserted into the table.
 
 
@@ -3178,7 +3177,7 @@
   mailto:[EMAIL PROTECTED]">Dinakar Dhurjati and
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/02/07 06:24:17 $
+  Last modified: $Date: 2007/02/08 19:14:21 $
 
 
 



___
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/CStringMap.h

2007-02-08 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

CStringMap.h updated: 1.3 -> 1.4
---
Log message:

Allow cstringmap to contain strings with nul characters in them.


---
Diffs of the changes:  (+57 -28)

 CStringMap.h |   85 +++
 1 files changed, 57 insertions(+), 28 deletions(-)


Index: llvm/include/llvm/ADT/CStringMap.h
diff -u llvm/include/llvm/ADT/CStringMap.h:1.3 
llvm/include/llvm/ADT/CStringMap.h:1.4
--- llvm/include/llvm/ADT/CStringMap.h:1.3  Sun Oct 29 21:14:15 2006
+++ llvm/include/llvm/ADT/CStringMap.h  Thu Feb  8 13:08:37 2007
@@ -19,14 +19,23 @@
 
 namespace llvm {
   
+/// StringMapEntryBase - Shared base class of StringMapEntry instances.
+class StringMapEntryBase {
+  unsigned StrLen;
+public:
+  StringMapEntryBase(unsigned Len) : StrLen(Len) {}
+  
+  unsigned getKeyLength() const { return StrLen; }
+};
+  
 /// CStringMapVisitor - Subclasses of this class may be implemented to walk all
 /// of the items in a CStringMap.
 class CStringMapVisitor {
 public:
   virtual ~CStringMapVisitor();
-  virtual void Visit(const char *Key, void *Value) const = 0;
+  virtual void Visit(const char *Key, StringMapEntryBase *Value) const = 0;
 };
-  
+
 /// CStringMapImpl - This is the base class of CStringMap that is shared among
 /// all of its instantiations.
 class CStringMapImpl {
@@ -39,7 +48,7 @@
 unsigned FullHashValue;
 
 /// Item - This is a pointer to the actual item object.
-void *Item;
+StringMapEntryBase *Item;
   };
   
   ItemBucket *TheTable;
@@ -64,66 +73,86 @@
   void VisitEntries(const CStringMapVisitor &Visitor) const;
 };
 
+/// StringMapEntry - This is used to represent one value that is inserted into
+/// a StringMap.  It contains the Value itself and the key: the string length
+/// and data.
+template
+class StringMapEntry : public StringMapEntryBase {
+  ValueTy Val;
+public:
+  StringMapEntry(unsigned StrLen)
+: StringMapEntryBase(StrLen), Val() {}
+  StringMapEntry(unsigned StrLen, const ValueTy &V)
+: StringMapEntryBase(StrLen), Val(V) {}
+
+  const ValueTy &getValue() const { return Val; }
+  ValueTy &getValue() { return Val; }
+  
+  void setValue(const ValueTy &V) { Val = V; }
+  
+  /// getKeyData - Return the start of the string data that is the key for this
+  /// value.  The string data is always stored immediately after the
+  /// StringMapEntry object.
+  const char *getKeyData() const {return reinterpret_cast(this+1);}
+};
+
 
 /// CStringMap - This is an unconventional map that is specialized for handling
-/// keys that are "C strings", that is, null-terminated strings.  This does 
some
+/// keys that are "strings", which are basically ranges of bytes. This does 
some
 /// funky memory allocation and hashing things to make it extremely efficient,
 /// storing the string data *after* the value in the map.
 template
 class CStringMap : public CStringMapImpl {
   AllocatorTy Allocator;
+  typedef StringMapEntry MapEntryTy;
 public:
   CStringMap(unsigned InitialSize = 0)
-: CStringMapImpl(InitialSize, sizeof(ValueTy)) {}
+: CStringMapImpl(InitialSize, sizeof(MapEntryTy)) {}
   
   AllocatorTy &getAllocator() { return Allocator; }
   const AllocatorTy &getAllocator() const { return Allocator; }
 
   /// FindValue - Look up the specified key in the map.  If it exists, return a
   /// pointer to the element, otherwise return null.
-  ValueTy *FindValue(const char *KeyStart, const char *KeyEnd) {
+  MapEntryTy *FindValue(const char *KeyStart, const char *KeyEnd) {
 unsigned BucketNo = LookupBucketFor(KeyStart, KeyEnd);
-return static_cast(TheTable[BucketNo].Item);
-  }
-  
-  /// GetKeyForValueInMap - Given a value that is inserted into this map, 
return
-  /// the string that corresponds to it.  This is an efficient operation that
-  /// is provided by CStringMap.  The string is live as long as the value is in
-  /// the map.
-  static const char *GetKeyForValueInMap(const ValueTy &Val) {
-return reinterpret_cast(&Val+1);
+return static_cast(TheTable[BucketNo].Item);
   }
   
   /// GetOrCreateValue - Look up the specified key in the table.  If a value
   /// exists, return it.  Otherwise, default construct a value, insert it, and
   /// return.
-  ValueTy &GetOrCreateValue(const char *KeyStart, const char *KeyEnd) {
+  StringMapEntry &GetOrCreateValue(const char *KeyStart, 
+const char *KeyEnd) {
 unsigned BucketNo = LookupBucketFor(KeyStart, KeyEnd);
 ItemBucket &Bucket = TheTable[BucketNo];
 if (Bucket.Item)
-  return *static_cast(Bucket.Item);
+  return *static_cast(Bucket.Item);
 
 unsigned KeyLength = KeyEnd-KeyStart;
 
-// Okay, the item doesn't already exist, and Bucket is the bucket to fill
-// in.  Allocate a new item with space for the null-terminated string at 
the
-// end.
-unsigned AllocSize = sizeof(ValueTy)+KeyLength+1;
+// Okay, the item doesn't alread

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

2007-02-08 Thread Chris Lattner


Changes in directory llvm/lib/Support:

CStringMap.cpp updated: 1.3 -> 1.4
---
Log message:

Allow cstringmap to contain strings with nul characters in them.


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

 CStringMap.cpp |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)


Index: llvm/lib/Support/CStringMap.cpp
diff -u llvm/lib/Support/CStringMap.cpp:1.3 llvm/lib/Support/CStringMap.cpp:1.4
--- llvm/lib/Support/CStringMap.cpp:1.3 Sat Jan  6 17:20:51 2007
+++ llvm/lib/Support/CStringMap.cpp Thu Feb  8 13:08:37 2007
@@ -58,7 +58,7 @@
   unsigned ProbeAmt = 1;
   while (1) {
 ItemBucket &Bucket = TheTable[BucketNo];
-void *BucketItem = Bucket.Item;
+StringMapEntryBase *BucketItem = Bucket.Item;
 // If we found an empty bucket, this key isn't in the table yet, return it.
 if (BucketItem == 0) {
   Bucket.FullHashValue = FullHashValue;
@@ -73,8 +73,9 @@
   // Do the comparison like this because NameStart isn't necessarily
   // null-terminated!
   char *ItemStr = (char*)BucketItem+ItemSize;
-  if (strlen(ItemStr) == unsigned(NameEnd-NameStart) &&
-  memcmp(ItemStr, NameStart, (NameEnd-NameStart)) == 0) {
+  unsigned ItemStrLen = BucketItem->getKeyLength();
+  if (unsigned(NameEnd-NameStart) == ItemStrLen &&
+  memcmp(ItemStr, NameStart, ItemStrLen) == 0) {
 // We found a match!
 return BucketNo;
   }
@@ -131,7 +132,7 @@
 /// invoking Visitor.Visit for each of them.
 void CStringMapImpl::VisitEntries(const CStringMapVisitor &Visitor) const {
   for (ItemBucket *IB = TheTable, *E = TheTable+NumBuckets; IB != E; ++IB) {
-if (void *Id = IB->Item)
+if (StringMapEntryBase *Id = IB->Item)
   Visitor.Visit((char*)Id + ItemSize, Id);
   }
 }



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


[llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/llvm-ld:

llvm-ld.cpp updated: 1.46 -> 1.47
---
Log message:

For PR1153: http://llvm.org/PR1153 :
Copy a couple more missing options from gccld to llvm-ld.


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

 llvm-ld.cpp |5 +
 1 files changed, 5 insertions(+)


Index: llvm/tools/llvm-ld/llvm-ld.cpp
diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.46 llvm/tools/llvm-ld/llvm-ld.cpp:1.47
--- llvm/tools/llvm-ld/llvm-ld.cpp:1.46 Sun Jan 21 00:33:59 2007
+++ llvm/tools/llvm-ld/llvm-ld.cpp  Thu Feb  8 13:03:11 2007
@@ -97,6 +97,11 @@
 static  cl::opt CO6("h", cl::Hidden,
   cl::desc("Compatibility option: ignored"));
 
+static cl::opt CO7("start-group", cl::Hidden, 
+  cl::desc("Compatibility option: ignored"));
+
+static cl::opt CO8("end-group", cl::Hidden, 
+  cl::desc("Compatibility option: ignored"));
 
 /// This is just for convenience so it doesn't have to be passed around
 /// everywhere.



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


[llvm-commits] CVS: llvm-test/MultiSource/Applications/minisat/Makefile

2007-02-08 Thread Chris Lattner


Changes in directory llvm-test/MultiSource/Applications/minisat:

Makefile updated: 1.4 -> 1.5
---
Log message:

let this sort-of work with darwin at least


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

 Makefile |3 +++
 1 files changed, 3 insertions(+)


Index: llvm-test/MultiSource/Applications/minisat/Makefile
diff -u llvm-test/MultiSource/Applications/minisat/Makefile:1.4 
llvm-test/MultiSource/Applications/minisat/Makefile:1.5
--- llvm-test/MultiSource/Applications/minisat/Makefile:1.4 Thu Feb  8 
11:51:53 2007
+++ llvm-test/MultiSource/Applications/minisat/Makefile Thu Feb  8 12:14:03 2007
@@ -10,3 +10,6 @@
 endif
 
 include ../../Makefile.multisrc
+
+JIT_OPTS += -load libz.dylib
+



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


[llvm-commits] CVS: llvm/tools/llvm-ld/Optimize.cpp

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/llvm-ld:

Optimize.cpp updated: 1.16 -> 1.17
---
Log message:

For PR1153: http://llvm.org/PR1153 :
Make llvm-ld more gccld-like by having it run the same set of passes. The
delta was probably due to lack of llvm-ld being maintained. Just another
reason to have only one optimizing linker in in LLVM.


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

 Optimize.cpp |   45 -
 1 files changed, 32 insertions(+), 13 deletions(-)


Index: llvm/tools/llvm-ld/Optimize.cpp
diff -u llvm/tools/llvm-ld/Optimize.cpp:1.16 
llvm/tools/llvm-ld/Optimize.cpp:1.17
--- llvm/tools/llvm-ld/Optimize.cpp:1.16Mon Feb  5 14:47:21 2007
+++ llvm/tools/llvm-ld/Optimize.cpp Thu Feb  8 12:13:59 2007
@@ -73,13 +73,22 @@
 static cl::opt VerifyEach("verify-each",
  cl::desc("Verify intermediate results of all passes"));
 
-static cl::opt Strip("s",
-  cl::desc("Strip symbol info from executable"));
-
 static cl::alias ExportDynamic("export-dynamic",
   cl::aliasopt(DisableInternalize),
   cl::desc("Alias for -disable-internalize"));
 
+static cl::opt Strip("strip-all", 
+  cl::desc("Strip all symbol info from executable"));
+
+static cl::alias A0("s", cl::desc("Alias for --strip-all"), 
+  cl::aliasopt(Strip));
+
+static cl::opt StripDebug("strip-debug",
+  cl::desc("Strip debugger symbol info from executable"));
+
+static cl::alias A1("S", cl::desc("Alias for --strip-debug"),
+  cl::aliasopt(StripDebug));
+
 // A utility function that adds a pass to the pass manager but will also add
 // a verifier pass after if we're supposed to verify.
 static inline void addPass(PassManager &PM, Pass *P) {
@@ -114,6 +123,11 @@
 // internal.
 addPass(Passes, createInternalizePass(!DisableInternalize));
 
+// Propagate constants at call sites into the functions they call.  This
+// opens opportunities for globalopt (and inlining) by substituting 
function
+// pointers passed as arguments to direct uses of functions.  
+addPass(Passes, createIPSCCPPass());
+
 // Now that we internalized some globals, see if we can hack on them!
 addPass(Passes, createGlobalOptimizerPass());
 
@@ -121,22 +135,20 @@
 // keep one copy of each constant...
 addPass(Passes, createConstantMergePass());
 
-// If the -s command line option was specified, strip the symbols out of 
the
-// resulting program to make it smaller.  -s is a GLD option that we are
-// supporting.
-if (Strip)
-  addPass(Passes, createStripSymbolsPass());
-
-// Propagate constants at call sites into the functions they call.
-addPass(Passes, createIPConstantPropagationPass());
-
 // Remove unused arguments from functions...
 addPass(Passes, createDeadArgEliminationPass());
 
+// Reduce the code after globalopt and ipsccp.  Both can open up 
significant
+// simplification opportunities, and both can propagate functions through
+// function pointers.  When this happens, we often have to resolve varargs
+// calls, etc, so let instcombine do this.
+addPass(Passes, createInstructionCombiningPass());
+
 if (!DisableInline)
   addPass(Passes, createFunctionInliningPass()); // Inline small functions
 
 addPass(Passes, createPruneEHPass());// Remove dead EH info
+addPass(Passes, createGlobalOptimizerPass());// Optimize globals again.
 addPass(Passes, createGlobalDCEPass());  // Remove dead functions
 
 // If we didn't decide to inline a function, check to see if we can
@@ -148,8 +160,9 @@
 
 addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas
 
-// Run a few AA driven optimizations, to cleanup the code.
+// Run a few AA driven optimizations here and now, to cleanup the code.
 addPass(Passes, createGlobalsModRefPass());  // IP alias analysis
+
 addPass(Passes, createLICMPass());   // Hoist loop invariants
 addPass(Passes, createLoadValueNumberingPass()); // GVN for load instrs
 addPass(Passes, createGCSEPass());   // Remove common subexprs
@@ -165,6 +178,12 @@
 addPass(Passes, createGlobalDCEPass());
   }
 
+  // If the -s or -S command line options were specified, strip the symbols out
+  // of the resulting program to make it smaller.  -s and -S are GNU ld options
+  // that we are supporting; they alias -strip-all and -strip-debug.
+  if (Strip || StripDebug)
+addPass(Passes, createStripSymbolsPass(StripDebug && !Strip));
+
   // Create a new optimization pass for each one specified on the command line
   std::auto_ptr target;
   for (unsigned i = 0; i < OptimizationList.size(); ++i) {



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


[llvm-commits] CVS: llvm-test/MultiSource/Applications/Makefile

2007-02-08 Thread Chris Lattner


Changes in directory llvm-test/MultiSource/Applications:

Makefile updated: 1.25 -> 1.26
---
Log message:

add minisat


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

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


Index: llvm-test/MultiSource/Applications/Makefile
diff -u llvm-test/MultiSource/Applications/Makefile:1.25 
llvm-test/MultiSource/Applications/Makefile:1.26
--- llvm-test/MultiSource/Applications/Makefile:1.25Tue Oct  3 17:05:26 2006
+++ llvm-test/MultiSource/Applications/Makefile Thu Feb  8 12:14:36 2007
@@ -5,7 +5,7 @@
 include $(LEVEL)/Makefile.config
 
 PARALLEL_DIRS  = Burg aha sgefa siod lambda-0.1.3 d spiff hbd treecc SPASS \
- hexxagon oggenc JM viterbi
+ hexxagon oggenc JM viterbi minisat
 
 # Obsequi uses Linux-only features; need to fix that
 ifeq ($(OS),Linux)



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


[llvm-commits] [123593] Fix build.

2007-02-08 Thread jlaskey
Revision: 123593
Author:   jlaskey
Date: 2007-02-08 10:12:42 -0800 (Thu, 08 Feb 2007)

Log Message:
---
Fix build.

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-backend.cpp
apple-local/branches/llvm/gcc/llvm-linker-hack.cpp

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-02-08 09:56:34 UTC 
(rev 123592)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-02-08 18:12:42 UTC 
(rev 123593)
@@ -192,7 +192,9 @@
 
   fclose (asm_out_file);
   std::string ErrMsg;
-  TheModule = ParseBytecodeFile(asm_file_name, &ErrMsg);
+  TheModule = ParseBytecodeFile(asm_file_name,
+Compressor::decompressToNewBuffer,
+&ErrMsg);
   if (!TheModule) {
 cerr << "Error reading bytecodes from PCH file\n";
 cerr << ErrMsg << "\n";

Modified: apple-local/branches/llvm/gcc/llvm-linker-hack.cpp
===
--- apple-local/branches/llvm/gcc/llvm-linker-hack.cpp  2007-02-08 09:56:34 UTC 
(rev 123592)
+++ apple-local/branches/llvm/gcc/llvm-linker-hack.cpp  2007-02-08 18:12:42 UTC 
(rev 123593)
@@ -42,7 +42,7 @@
   new llvm::ExistingModuleProvider(0);
   llvm::createVerifierPass();
   llvm::WriteBytecodeToFile(0, llvm::cout);
-  llvm::ParseBytecodeFile(NULL,NULL);
+  llvm::ParseBytecodeFile(NULL);
 
   llvm::createInstructionCombiningPass();
   llvm::createScalarReplAggregatesPass();


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


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

2007-02-08 Thread Chris Lattner

>>  // 
>> ===-- 
>> ===//
>>  //  APInt Class
>>  // 
>> ===-- 
>> ===//
>> @@ -40,14 +55,18 @@
>>  class APInt {
>>/// Friend Functions of APInt declared here. For detailed  
>> comments,
>>/// see bottom of this file.
>> -  friend bool isIntN(unsigned N, const APInt& APIVal);
>> -  friend APInt ByteSwap(const APInt& APIVal);
>> -  friend APInt LogBase2(const APInt& APIVal);
>> -  friend double APIntToDouble(const APInt& APIVal);
>> -  friend float APIntToFloat(const APInt& APIVal);
>> +  friend bool APIntOps::isIntN(unsigned N, const APInt& APIVal);
>> +  friend APInt APIntOps::ByteSwap(const APInt& APIVal);
>> +  friend APInt APIntOps::LogBase2(const APInt& APIVal);
>> +  friend APInt APIntOps::ashr(const APInt& LHS, unsigned shiftAmt);
>> +  friend APInt APIntOps::lshr(const APInt& LHS, unsigned shiftAmt);
>> +  friend APInt APIntOps::shl(const APInt& LHS, unsigned shiftAmt);
>> +  friend APInt APIntOps::sdiv(const APInt& LHS, const APInt& RHS);
>> +  friend APInt APIntOps::udiv(const APInt& LHS, const APInt& RHS);
>> +  friend APInt APIntOps::srem(const APInt& LHS, const APInt& RHS);
>> +  friend APInt APIntOps::urem(const APInt& LHS, const APInt& RHS);
>
> There's a lot of friend functions here. Perhaps these could go at the
> bottom of the class declaration instead of the top.

Actually, please make each of these a public method.  This provides  
the ugly "X = X.udiv(Y)" syntax.  Then add the namespace versions as  
simple inline functions that that just call the method version.

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


[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/minisat/Alg.h BasicHeap.h BoxedVec.h Heap.h Map.h Queue.h SolverTypes.h Sort.h Vec.h Makefile

2007-02-08 Thread Owen Anderson


Changes in directory llvm-test/MultiSource/Benchmarks/minisat:

Alg.h added (r1.1)
BasicHeap.h added (r1.1)
BoxedVec.h added (r1.1)
Heap.h added (r1.1)
Map.h added (r1.1)
Queue.h added (r1.1)
SolverTypes.h added (r1.1)
Sort.h added (r1.1)
Vec.h added (r1.1)
Makefile updated: 1.3 -> 1.4
---
Log message:

Flatten minisat's directory structure, and default to the shorter test case.


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

 Alg.h |   57 
 BasicHeap.h   |   98 
 BoxedVec.h|  147 +++
 Heap.h|  169 +
 Makefile  |5 +
 Map.h |  118 ++
 Queue.h   |   82 
 SolverTypes.h |  197 ++
 Sort.h|   93 +++
 Vec.h |  133 +++
 10 files changed, 1098 insertions(+), 1 deletion(-)


Index: llvm-test/MultiSource/Benchmarks/minisat/Alg.h
diff -c /dev/null llvm-test/MultiSource/Benchmarks/minisat/Alg.h:1.1
*** /dev/null   Thu Feb  8 11:52:03 2007
--- llvm-test/MultiSource/Benchmarks/minisat/Alg.h  Thu Feb  8 11:51:53 2007
***
*** 0 
--- 1,57 
+ 
/***[Alg.h]
+ MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and
+ associated documentation files (the "Software"), to deal in the Software 
without restriction,
+ including without limitation the rights to use, copy, modify, merge, publish, 
distribute,
+ sublicense, and/or sell copies of the Software, and to permit persons to whom 
the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in 
all copies or
+ substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
OTHERWISE, ARISING FROM, OUT
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
+ 
**/
+ 
+ #ifndef Alg_h
+ #define Alg_h
+ 
+ 
//=
+ // Useful functions on vectors
+ 
+ 
+ #if 1
+ template
+ static inline void remove(V& ts, const T& t)
+ {
+ int j = 0;
+ for (; j < ts.size() && ts[j] != t; j++);
+ assert(j < ts.size());
+ for (; j < ts.size()-1; j++) ts[j] = ts[j+1];
+ ts.pop();
+ }
+ #else
+ template
+ static inline void remove(V& ts, const T& t)
+ {
+ int j = 0;
+ for (; j < ts.size() && ts[j] != t; j++);
+ assert(j < ts.size());
+ ts[j] = ts.last();
+ ts.pop();
+ }
+ #endif
+ 
+ template
+ static inline bool find(V& ts, const T& t)
+ {
+ int j = 0;
+ for (; j < ts.size() && ts[j] != t; j++);
+ return j < ts.size();
+ }
+ 
+ #endif


Index: llvm-test/MultiSource/Benchmarks/minisat/BasicHeap.h
diff -c /dev/null llvm-test/MultiSource/Benchmarks/minisat/BasicHeap.h:1.1
*** /dev/null   Thu Feb  8 11:52:09 2007
--- llvm-test/MultiSource/Benchmarks/minisat/BasicHeap.hThu Feb  8 
11:51:53 2007
***
*** 0 
--- 1,98 
+ 
/**[Heap.h]
+ MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and
+ associated documentation files (the "Software"), to deal in the Software 
without restriction,
+ including without limitation the rights to use, copy, modify, merge, publish, 
distribute,
+ sublicense, and/or sell copies of the Software, and to permit persons to whom 
the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in 
all copies or
+ substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
OTHERWISE, ARISING FROM, OUT
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE

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

2007-02-08 Thread Andrew Lenharth


Changes in directory llvm/lib/Target/Alpha:

AlphaISelLowering.cpp updated: 1.80 -> 1.81
---
Log message:

return addresses, those I already have

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

 AlphaISelLowering.cpp |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp
diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.80 
llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.81
--- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.80Tue Jan 30 14:08:37 2007
+++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Thu Feb  8 11:37:41 2007
@@ -544,8 +544,9 @@
 return DAG.getTruncStore(S1, DAG.getConstant(VarArgsOffset, MVT::i64),
  SA2, NULL, 0, MVT::i32);
   }
-  // Frame & Return address.  Currently unimplemented
-  case ISD::RETURNADDR: break;
+  case ISD::RETURNADDR:
+return DAG.getNode(AlphaISD::GlobalRetAddr, MVT::i64);
+  //FIXME: implement
   case ISD::FRAMEADDR:  break;
   }
 



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


[llvm-commits] llvm-gcc4: compile fix due to ParseBytecodeFile changes

2007-02-08 Thread Duncan Sands
"Read bytecodes from PCH file",
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070205/044159.html,

and "Push bytecode decompressor out through APIs",
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070205/044106.html,

passed each other in the night.  The attached patch gets llvm-gcc4 building
again.

Ciao,

Duncan.
Index: gcc.llvm.master/gcc/llvm-backend.cpp
===
--- gcc.llvm.master.orig/gcc/llvm-backend.cpp	2007-02-08 18:00:28.0 +0100
+++ gcc.llvm.master/gcc/llvm-backend.cpp	2007-02-08 18:01:12.0 +0100
@@ -37,6 +37,7 @@
 #include "llvm/CodeGen/SchedulerRegistry.h"
 #include "llvm/CodeGen/ScheduleDAG.h"
 #include "llvm/Support/Streams.h"
+#include "llvm/Support/Compressor.h"
 #include "llvm/Target/SubtargetFeature.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetLowering.h"
@@ -192,7 +193,8 @@
 
   fclose (asm_out_file);
   std::string ErrMsg;
-  TheModule = ParseBytecodeFile(asm_file_name, &ErrMsg);
+  TheModule = ParseBytecodeFile(asm_file_name,
+Compressor::decompressToNewBuffer, &ErrMsg);
   if (!TheModule) {
 cerr << "Error reading bytecodes from PCH file\n";
 cerr << ErrMsg << "\n";
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-02-08 Thread Reid Spencer
Sheng, 

Some feedback for you ...

On Thu, 2007-02-08 at 08:30 -0600, Zhou Sheng wrote:
> 
> Changes in directory llvm/include/llvm/ADT:
> 
> APInt.h updated: 1.4 -> 1.5
> ---
> Log message:
> 
> As Chris and Reid suggested, remove "isSigned" field from APInt, instead,
> add some signed/unsigned arithmetic operation functions into APInt.h to
> handle the signed/unsigned issue. These functions will be defined inside a
> namespace "APIntOps" which is inside llvm namespace.
> 
> 
> ---
> Diffs of the changes:  (+92 -48)
> 
>  APInt.h |  140 
> ++--
>  1 files changed, 92 insertions(+), 48 deletions(-)
> 
> 
> Index: llvm/include/llvm/ADT/APInt.h
> diff -u llvm/include/llvm/ADT/APInt.h:1.4 llvm/include/llvm/ADT/APInt.h:1.5
> --- llvm/include/llvm/ADT/APInt.h:1.4 Wed Feb  7 10:59:17 2007
> +++ llvm/include/llvm/ADT/APInt.h Thu Feb  8 08:30:42 2007
> @@ -21,6 +21,21 @@
>  
>  namespace llvm {
>  
> +/// Forward declaration.
> +class APInt;
> +namespace APIntOps {
> +  bool isIntN(unsigned N, const APInt& APIVal);
> +  APInt ByteSwap(const APInt& APIVal);
> +  APInt LogBase2(const APInt& APIVal);
> +  APInt ashr(const APInt& LHS, unsigned shiftAmt);
> +  APInt lshr(const APInt& LHS, unsigned shiftAmt);
> +  APInt shl(const APInt& LHS, unsigned shiftAmt);
> +  APInt sdiv(const APInt& LHS, const APInt& RHS);
> +  APInt udiv(const APInt& LHS, const APInt& RHS);
> +  APInt srem(const APInt& LHS, const APInt& RHS);
> +  APInt urem(const APInt& LHS, const APInt& RHS);
> +}
> +
>  
> //===--===//
>  //  APInt Class
>  
> //===--===//
> @@ -40,14 +55,18 @@
>  class APInt {
>/// Friend Functions of APInt declared here. For detailed comments,
>/// see bottom of this file.
> -  friend bool isIntN(unsigned N, const APInt& APIVal);
> -  friend APInt ByteSwap(const APInt& APIVal);
> -  friend APInt LogBase2(const APInt& APIVal);
> -  friend double APIntToDouble(const APInt& APIVal);
> -  friend float APIntToFloat(const APInt& APIVal);
> +  friend bool APIntOps::isIntN(unsigned N, const APInt& APIVal);
> +  friend APInt APIntOps::ByteSwap(const APInt& APIVal);
> +  friend APInt APIntOps::LogBase2(const APInt& APIVal);
> +  friend APInt APIntOps::ashr(const APInt& LHS, unsigned shiftAmt);
> +  friend APInt APIntOps::lshr(const APInt& LHS, unsigned shiftAmt);
> +  friend APInt APIntOps::shl(const APInt& LHS, unsigned shiftAmt);
> +  friend APInt APIntOps::sdiv(const APInt& LHS, const APInt& RHS);
> +  friend APInt APIntOps::udiv(const APInt& LHS, const APInt& RHS);
> +  friend APInt APIntOps::srem(const APInt& LHS, const APInt& RHS);
> +  friend APInt APIntOps::urem(const APInt& LHS, const APInt& RHS);

There's a lot of friend functions here. Perhaps these could go at the
bottom of the class declaration instead of the top. 

>  
>unsigned BitsNum;  ///< The number of bits.

How about "width"

> -  bool isSigned; ///< The sign flag for this APInt.
>  
>/// This union is used to store the integer value. When the
>/// integer bit-width <= 64, it uses VAL; 
> @@ -114,20 +133,19 @@
>  
>  public:
>/// @brief Create a new APInt of numBits bit-width, and initialized as val.
> -  APInt(uint64_t val = 0, unsigned numBits = APINT_BITS_PER_WORD, 
> -bool sign = false);
> +  APInt(uint64_t val = 0, unsigned numBits = APINT_BITS_PER_WORD);
>  
>/// @brief Create a new APInt of numBits bit-width, and initialized as 
>/// bigVal[].
> -  APInt(unsigned numBits, uint64_t bigVal[], bool sign = false);
> +  APInt(unsigned numBits, uint64_t bigVal[]);
>  
>/// @brief Create a new APInt by translating the string represented 
>/// integer value.
> -  APInt(const std::string& Val, uint8_t radix = 10, bool sign = false);
> +  APInt(const std::string& Val, uint8_t radix = 10);
>  
>/// @brief Create a new APInt by translating the char array represented
>/// integer value.
> -  APInt(const char StrStart[], unsigned slen, uint8_t radix, bool sign = 
> false);
> +  APInt(const char StrStart[], unsigned slen, uint8_t radix);
>  
>/// @brief Copy Constructor.
>APInt(const APInt& API);
> @@ -179,14 +197,6 @@
>/// @brief Bitwise XOR assignment operator. 
>APInt& operator^=(const APInt& RHS);
>  
> -  /// Left-shift the APInt by shiftAmt and assigns the result to this APInt.
> -  /// @brief Left-shift assignment operator. 
> -  APInt& operator<<=(unsigned shiftAmt);
> -
> -  /// Right-shift the APInt by shiftAmt and assigns the result to this APInt.
> -  /// @brief Right-shift assignment operator. 
> -  APInt& operator>>=(unsigned shiftAmt);
> -
>/// Performs a bitwise complement operation on this APInt.
>/// @brief Bitwise complement operator. 
>APInt operator~() const;
> @@ -196,11 +206,6 @@
>/// @brief Multiplication assignment operator

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

2007-02-08 Thread Reid Spencer


Changes in directory llvm/docs:

TestingGuide.html updated: 1.39 -> 1.40
---
Log message:

Describe llvm/test more accurately given recent changes.


---
Diffs of the changes:  (+22 -14)

 TestingGuide.html |   36 ++--
 1 files changed, 22 insertions(+), 14 deletions(-)


Index: llvm/docs/TestingGuide.html
diff -u llvm/docs/TestingGuide.html:1.39 llvm/docs/TestingGuide.html:1.40
--- llvm/docs/TestingGuide.html:1.39Fri Aug 11 18:27:02 2006
+++ llvm/docs/TestingGuide.html Thu Feb  8 11:00:55 2007
@@ -216,19 +216,27 @@
 subtrees of the test suite directory tree are as follows:
 
 
-llvm/test/Features
-This directory contains sample codes that test various features of the
-LLVM language.  These pieces of sample code are run through various
-assembler, disassembler, and optimizer passes.
-
-
-llvm/test/Regression
-This directory contains regression tests for LLVM.  When a bug is found
-in LLVM, a regression test containing just enough code to reproduce the
-problem should be written and placed somewhere underneath this directory.
-In most cases, this will be a small piece of LLVM assembly language code,
-often distilled from an actual application or benchmark.
-
+  llvm/test
+  This directory contains a large array of small tests
+  that exercise various features of LLVM and to ensure that regressions do not
+  occur. The directory is broken into several sub-directories, each focused on
+  a particular area of LLVM. A few of the important ones are:
+Analysis: checks Analysis passes.
+Archive: checks the Archive library.
+Assembler: checks Assembly reader/writer functionality.
+Bytecode: checks Bytecode reader/writer functionality.
+CodeGen: checks code generation and each target.
+Features: checks various features of the LLVM language.
+Linker: tests bytecode linking.
+Transforms: tests each of the scalar, IPO, and utility
+transforms to ensure they make the right transformations.
+Verifier: tests the IR verifier.
+  
+  Typically when a bug is found in LLVM, a regression test containing 
+  just enough code to reproduce the problem should be written and placed 
+  somewhere underneath this directory.  In most cases, this will be a small 
+  piece of LLVM assembly language code, often distilled from an actual 
+  application or benchmark.
 
 llvm-test
 The llvm-test CVS module contains programs that can be compiled 
@@ -630,7 +638,7 @@
 
   John T. Criswell, Reid Spencer, and Tanya Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2006/08/11 23:27:02 $
+  Last modified: $Date: 2007/02/08 17:00:55 $
 
 
 



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


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

2007-02-08 Thread Zhou Sheng


Changes in directory llvm/lib/Support:

APInt.cpp updated: 1.5 -> 1.6
---
Log message:

Switched this file on accidently.


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

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


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.5 llvm/lib/Support/APInt.cpp:1.6
--- llvm/lib/Support/APInt.cpp:1.5  Thu Feb  8 08:35:19 2007
+++ llvm/lib/Support/APInt.cpp  Thu Feb  8 10:45:48 2007
@@ -14,7 +14,7 @@
 
 #include "llvm/ADT/APInt.h"
 
-#if 1
+#if 0
 #include "llvm/DerivedTypes.h"
 #include "llvm/Support/MathExtras.h"
 #include 



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


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

2007-02-08 Thread Zhou Sheng


Changes in directory llvm/lib/Support:

APInt.cpp updated: 1.4 -> 1.5
---
Log message:

As Chris and Reid suggested, remove "isSigned" field from APInt, instead,
add some signed/unsigned arithmetic operation functions into APInt.h to
handle the signed/unsigned issue. These functions will be defined inside a
namespace "APIntOps" which is inside llvm namespace.


---
Diffs of the changes:  (+170 -178)

 APInt.cpp |  348 ++
 1 files changed, 170 insertions(+), 178 deletions(-)


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.4 llvm/lib/Support/APInt.cpp:1.5
--- llvm/lib/Support/APInt.cpp:1.4  Wed Feb  7 00:14:53 2007
+++ llvm/lib/Support/APInt.cpp  Thu Feb  8 08:35:19 2007
@@ -14,7 +14,7 @@
 
 #include "llvm/ADT/APInt.h"
 
-#if 0
+#if 1
 #include "llvm/DerivedTypes.h"
 #include "llvm/Support/MathExtras.h"
 #include 
@@ -262,8 +262,8 @@
   return retVal;
 }
 
-APInt::APInt(uint64_t val, unsigned numBits, bool sign)
-  : BitsNum(numBits), isSigned(sign) {
+APInt::APInt(uint64_t val, unsigned numBits)
+  : BitsNum(numBits) {
   assert(BitsNum >= IntegerType::MIN_INT_BITS && "bitwidth too small");
   assert(BitsNum <= IntegerType::MAX_INT_BITS && "bitwidth too large");
   if (isSingleWord()) 
@@ -277,8 +277,8 @@
   }
 }
 
-APInt::APInt(unsigned numBits, uint64_t bigVal[], bool sign)
-  : BitsNum(numBits), isSigned(sign) {
+APInt::APInt(unsigned numBits, uint64_t bigVal[])
+  : BitsNum(numBits) {
   assert(BitsNum >= IntegerType::MIN_INT_BITS && "bitwidth too small");
   assert(BitsNum <= IntegerType::MAX_INT_BITS && "bitwidth too large");
   assert(bigVal && "Null pointer detected!");
@@ -301,15 +301,13 @@
 
 /// @brief Create a new APInt by translating the char array represented
 /// integer value.
-APInt::APInt(const char StrStart[], unsigned slen, uint8_t radix, bool sign)
-  : isSigned(sign) {
+APInt::APInt(const char StrStart[], unsigned slen, uint8_t radix) {
   StrToAPInt(StrStart, slen, radix);
 }
 
 /// @brief Create a new APInt by translating the string represented
 /// integer value.
-APInt::APInt(const std::string& Val, uint8_t radix, bool sign)
-  : isSigned(sign) {
+APInt::APInt(const std::string& Val, uint8_t radix) {
   assert(!Val.empty() && "String empty?");
   StrToAPInt(Val.c_str(), Val.size(), radix);
 }
@@ -386,7 +384,7 @@
 }
 
 APInt::APInt(const APInt& APIVal)
-  : BitsNum(APIVal.BitsNum), isSigned(APIVal.isSigned) {
+  : BitsNum(APIVal.BitsNum) {
   if (isSingleWord()) VAL = APIVal.VAL;
   else {
 // Memory allocation and check if successful.
@@ -421,6 +419,7 @@
 pVal[0] = RHS;
 memset(pVal, 0, (getNumWords() - 1) * 8);
   }
+  TruncToBits();
   return *this;
 }
 
@@ -514,101 +513,6 @@
   return *this;
 }
 
-/// @brief Division assignment operator. Divides this APInt by the given APInt
-/// &RHS and assigns the result to this APInt.
-APInt& APInt::operator/=(const APInt& RHS) {
-  unsigned first = RHS.getNumWords() * APINT_BITS_PER_WORD - 
-   RHS.CountLeadingZeros();
-  unsigned ylen = !first ? 0 : whichWord(first - 1) + 1;
-  assert(ylen && "Divided by zero???");
-  if (isSingleWord()) {
-if (isSigned && RHS.isSigned)
-  VAL = RHS.isSingleWord() ? (int64_t(VAL) / int64_t(RHS.VAL)) :
-(ylen > 1 ? 0 : int64_t(VAL) / int64_t(RHS.pVal[0]));
-else
-  VAL = RHS.isSingleWord() ? (VAL / RHS.VAL) : 
-  (ylen > 1 ? 0 : VAL / RHS.pVal[0]);
-  } else {
-unsigned first2 = getNumWords() * APINT_BITS_PER_WORD - 
CountLeadingZeros();
-unsigned xlen = !first2 ? 0 : whichWord(first2 - 1) + 1;
-if (!xlen)
-  return *this;
-else if ((*this) < RHS)
-  memset(pVal, 0, getNumWords() * 8);
-else if ((*this) == RHS) {
-  memset(pVal, 0, getNumWords() * 8);
-  pVal[0] = 1;
-} else if (xlen == 1)
-  pVal[0] /= RHS.isSingleWord() ? RHS.VAL : RHS.pVal[0];
-else {
-  uint64_t *xwords = new uint64_t[xlen+1], *ywords = new uint64_t[ylen];
-  assert(xwords && ywords && "Memory Allocation Failed!");
-  memcpy(xwords, pVal, xlen * 8);
-  xwords[xlen] = 0;
-  memcpy(ywords, RHS.isSingleWord() ? &RHS.VAL : RHS.pVal, ylen * 8);
-  if (unsigned nshift = 63 - (first - 1) % 64) {
-lshift(ywords, 0, ywords, ylen, nshift);
-unsigned xlentmp = xlen;
-xwords[xlen++] = lshift(xwords, 0, xwords, xlentmp, nshift);
-  }
-  div((unsigned*)xwords, xlen*2-1, (unsigned*)ywords, ylen*2);
-  memset(pVal, 0, getNumWords() * 8);
-  memcpy(pVal, xwords + ylen, (xlen - ylen) * 8);
-  delete[] xwords;
-  delete[] ywords;
-}
-  }
-  return *this;
-}
-
-/// @brief Remainder assignment operator. Yields the remainder from the 
-/// division of this APInt by the given APInt& RHS and assigns the remainder 
-/// to this APInt.
-APInt& APInt::operator%=(const APInt& RHS) {
-  unsigned first = RHS.getNumWords() * APINT_BITS_PER_WORD -
-   RHS.CountLeadingZeros();
- 

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

2007-02-08 Thread Zhou Sheng


Changes in directory llvm/include/llvm/ADT:

APInt.h updated: 1.4 -> 1.5
---
Log message:

As Chris and Reid suggested, remove "isSigned" field from APInt, instead,
add some signed/unsigned arithmetic operation functions into APInt.h to
handle the signed/unsigned issue. These functions will be defined inside a
namespace "APIntOps" which is inside llvm namespace.


---
Diffs of the changes:  (+92 -48)

 APInt.h |  140 ++--
 1 files changed, 92 insertions(+), 48 deletions(-)


Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.4 llvm/include/llvm/ADT/APInt.h:1.5
--- llvm/include/llvm/ADT/APInt.h:1.4   Wed Feb  7 10:59:17 2007
+++ llvm/include/llvm/ADT/APInt.h   Thu Feb  8 08:30:42 2007
@@ -21,6 +21,21 @@
 
 namespace llvm {
 
+/// Forward declaration.
+class APInt;
+namespace APIntOps {
+  bool isIntN(unsigned N, const APInt& APIVal);
+  APInt ByteSwap(const APInt& APIVal);
+  APInt LogBase2(const APInt& APIVal);
+  APInt ashr(const APInt& LHS, unsigned shiftAmt);
+  APInt lshr(const APInt& LHS, unsigned shiftAmt);
+  APInt shl(const APInt& LHS, unsigned shiftAmt);
+  APInt sdiv(const APInt& LHS, const APInt& RHS);
+  APInt udiv(const APInt& LHS, const APInt& RHS);
+  APInt srem(const APInt& LHS, const APInt& RHS);
+  APInt urem(const APInt& LHS, const APInt& RHS);
+}
+
 
//===--===//
 //  APInt Class
 
//===--===//
@@ -40,14 +55,18 @@
 class APInt {
   /// Friend Functions of APInt declared here. For detailed comments,
   /// see bottom of this file.
-  friend bool isIntN(unsigned N, const APInt& APIVal);
-  friend APInt ByteSwap(const APInt& APIVal);
-  friend APInt LogBase2(const APInt& APIVal);
-  friend double APIntToDouble(const APInt& APIVal);
-  friend float APIntToFloat(const APInt& APIVal);
+  friend bool APIntOps::isIntN(unsigned N, const APInt& APIVal);
+  friend APInt APIntOps::ByteSwap(const APInt& APIVal);
+  friend APInt APIntOps::LogBase2(const APInt& APIVal);
+  friend APInt APIntOps::ashr(const APInt& LHS, unsigned shiftAmt);
+  friend APInt APIntOps::lshr(const APInt& LHS, unsigned shiftAmt);
+  friend APInt APIntOps::shl(const APInt& LHS, unsigned shiftAmt);
+  friend APInt APIntOps::sdiv(const APInt& LHS, const APInt& RHS);
+  friend APInt APIntOps::udiv(const APInt& LHS, const APInt& RHS);
+  friend APInt APIntOps::srem(const APInt& LHS, const APInt& RHS);
+  friend APInt APIntOps::urem(const APInt& LHS, const APInt& RHS);
 
   unsigned BitsNum;  ///< The number of bits.
-  bool isSigned; ///< The sign flag for this APInt.
 
   /// This union is used to store the integer value. When the
   /// integer bit-width <= 64, it uses VAL; 
@@ -114,20 +133,19 @@
 
 public:
   /// @brief Create a new APInt of numBits bit-width, and initialized as val.
-  APInt(uint64_t val = 0, unsigned numBits = APINT_BITS_PER_WORD, 
-bool sign = false);
+  APInt(uint64_t val = 0, unsigned numBits = APINT_BITS_PER_WORD);
 
   /// @brief Create a new APInt of numBits bit-width, and initialized as 
   /// bigVal[].
-  APInt(unsigned numBits, uint64_t bigVal[], bool sign = false);
+  APInt(unsigned numBits, uint64_t bigVal[]);
 
   /// @brief Create a new APInt by translating the string represented 
   /// integer value.
-  APInt(const std::string& Val, uint8_t radix = 10, bool sign = false);
+  APInt(const std::string& Val, uint8_t radix = 10);
 
   /// @brief Create a new APInt by translating the char array represented
   /// integer value.
-  APInt(const char StrStart[], unsigned slen, uint8_t radix, bool sign = 
false);
+  APInt(const char StrStart[], unsigned slen, uint8_t radix);
 
   /// @brief Copy Constructor.
   APInt(const APInt& API);
@@ -179,14 +197,6 @@
   /// @brief Bitwise XOR assignment operator. 
   APInt& operator^=(const APInt& RHS);
 
-  /// Left-shift the APInt by shiftAmt and assigns the result to this APInt.
-  /// @brief Left-shift assignment operator. 
-  APInt& operator<<=(unsigned shiftAmt);
-
-  /// Right-shift the APInt by shiftAmt and assigns the result to this APInt.
-  /// @brief Right-shift assignment operator. 
-  APInt& operator>>=(unsigned shiftAmt);
-
   /// Performs a bitwise complement operation on this APInt.
   /// @brief Bitwise complement operator. 
   APInt operator~() const;
@@ -196,11 +206,6 @@
   /// @brief Multiplication assignment operator. 
   APInt& operator*=(const APInt& RHS);
 
-  /// Divides this APInt by the given APInt &RHS and 
-  /// assigns the result to this APInt.
-  /// @brief Division assignment operator. 
-  APInt& operator/=(const APInt& RHS);
-
   /// Adds this APInt by the given APInt& RHS and 
   /// assigns the result to this APInt.
   /// @brief Addition assignment operator. 
@@ -211,11 +216,6 @@
   /// @brief Subtraction assignment operator. 
   APInt& operator-=(const AP

[llvm-commits] CVS: llvm/test/Assembler/2007-02-07-BasicBlockRename.ll 2007-02-07-UpgradeGVarConflict.ll

2007-02-08 Thread Reid Spencer


Changes in directory llvm/test/Assembler:

2007-02-07-BasicBlockRename.ll added (r1.1)
2007-02-07-UpgradeGVarConflict.ll added (r1.1)
---
Log message:

New test cases for PR1187: http://llvm.org/PR1187 


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

 2007-02-07-BasicBlockRename.ll|   14 ++
 2007-02-07-UpgradeGVarConflict.ll |   19 +++
 2 files changed, 33 insertions(+)


Index: llvm/test/Assembler/2007-02-07-BasicBlockRename.ll
diff -c /dev/null llvm/test/Assembler/2007-02-07-BasicBlockRename.ll:1.1
*** /dev/null   Thu Feb  8 03:10:32 2007
--- llvm/test/Assembler/2007-02-07-BasicBlockRename.ll  Thu Feb  8 03:10:22 2007
***
*** 0 
--- 1,14 
+ ; PR1187
+ ; RUN: llvm-upgrade < %s | llvm-as > /dev/null
+ 
+ implementation
+ 
+ int @main(int %argc, sbyte** %argv) {
+ entry:
+   %exit = alloca int, align 4 ;  [#uses=11]
+ store int 0, int* %exit
+   br label %exit
+ 
+ exit:
+   ret int 0
+ }


Index: llvm/test/Assembler/2007-02-07-UpgradeGVarConflict.ll
diff -c /dev/null llvm/test/Assembler/2007-02-07-UpgradeGVarConflict.ll:1.1
*** /dev/null   Thu Feb  8 03:10:39 2007
--- llvm/test/Assembler/2007-02-07-UpgradeGVarConflict.ll   Thu Feb  8 
03:10:22 2007
***
*** 0 
--- 1,19 
+ ; For PR1187
+ ; RUN: llvm-upgrade < %s > /dev/null
+ 
+ %struct.isc_hash_t = type { uint, sbyte*, int, uint, uint, 
+ [4 x ubyte], ulong, ushort* }
+ %hash = internal global %struct.isc_hash_t* null
+ 
+ implementation
+ 
+ void %somefunc() {
+   %key_addr = alloca sbyte*
+   %tmp21 = load sbyte** %key_addr
+   %tmp22 = call fastcc uint %hash(sbyte* %tmp21, uint 0)
+   ret void
+ }
+ 
+ internal fastcc uint %hash(sbyte* %key, uint %case_sensitive) {
+   ret uint 0
+ }



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


[llvm-commits] CVS: llvm/test/Assembler/2007-02-07-RenameInternals.ll

2007-02-08 Thread Reid Spencer


Changes in directory llvm/test/Assembler:

2007-02-07-RenameInternals.ll updated: 1.1 -> 1.2
---
Log message:

Make this legal input.


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

 2007-02-07-RenameInternals.ll |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/Assembler/2007-02-07-RenameInternals.ll
diff -u llvm/test/Assembler/2007-02-07-RenameInternals.ll:1.1 
llvm/test/Assembler/2007-02-07-RenameInternals.ll:1.2
--- llvm/test/Assembler/2007-02-07-RenameInternals.ll:1.1   Wed Feb  7 
17:41:10 2007
+++ llvm/test/Assembler/2007-02-07-RenameInternals.ll   Thu Feb  8 03:09:36 2007
@@ -6,6 +6,6 @@
   ret void
 }
 
-internal void %func(int %x) {
+internal void %func(uint %x) {
   ret void
 }



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


[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeInternals.h

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeInternals.h updated: 1.8 -> 1.9
---
Log message:

Rename a field so there's less confusion between fields of the same name.


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

 UpgradeInternals.h |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeInternals.h
diff -u llvm/tools/llvm-upgrade/UpgradeInternals.h:1.8 
llvm/tools/llvm-upgrade/UpgradeInternals.h:1.9
--- llvm/tools/llvm-upgrade/UpgradeInternals.h:1.8  Thu Feb  1 20:16:22 2007
+++ llvm/tools/llvm-upgrade/UpgradeInternals.h  Thu Feb  8 03:08:23 2007
@@ -216,7 +216,8 @@
 // An enumeration for the old calling conventions, ala LLVM 1.9
 namespace OldCallingConv {
   enum ID {
-C = 0, CSRet = 1, Fast = 8, Cold = 9, X86_StdCall = 64, X86_FastCall = 65 
+C = 0, CSRet = 1, Fast = 8, Cold = 9, X86_StdCall = 64, X86_FastCall = 65,
+None = 9
   };
 }
 
@@ -234,7 +235,7 @@
 };
 
 struct PATypeInfo {
-  llvm::PATypeHolder* T;
+  llvm::PATypeHolder* PAT;
   Signedness S;
 };
 



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


[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.y updated: 1.61 -> 1.62
---
Log message:

For PR1187: http://llvm.org/PR1187 :
Rename function scope names that conflict with basic block names. 


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

 UpgradeParser.y |   31 ---
 1 files changed, 20 insertions(+), 11 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.61 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.62
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.61Thu Feb  8 02:47:38 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Thu Feb  8 03:07:25 2007
@@ -475,6 +475,14 @@
   return V;
 }
 
+/// @brief This just makes any name given to it unique, up to MAX_UINT times.
+static std::string makeNameUnique(const std::string& Name) {
+  static unsigned UniqueNameCounter = 1;
+  std::string Result(Name);
+  Result += ".upgrd." + llvm::utostr(UniqueNameCounter++);
+  return Result;
+}
+
 /// getBBVal - This is used for two purposes:
 ///  * If isDefinition is true, a new basic block with the specified ID is 
being
 ///defined.
@@ -499,9 +507,18 @@
 Name = ID.Name;
 if (Value *N = CurFun.CurrentFunction->
getValueSymbolTable().lookup(Name)) {
-  if (N->getType() != Type::LabelTy)
-error("Name '" + Name + "' does not refer to a BasicBlock");
-  BB = cast(N);
+  if (N->getType() != Type::LabelTy) {
+// Register names didn't use to conflict with basic block names
+// because of type planes. Now they all have to be unique. So, we just
+// rename the register and treat this name as if no basic block
+// had been found.
+RenameMapKey Key = std::make_pair(N->getName(),N->getType());
+N->setName(makeNameUnique(N->getName()));
+CurModule.RenameMap[Key] = N->getName();
+BB = 0;
+  } else {
+BB = cast(N);
+  }
 }
 break;
   }
@@ -623,14 +640,6 @@
   }
 }
 
-/// @brief This just makes any name given to it unique, up to MAX_UINT times.
-static std::string makeNameUnique(const std::string& Name) {
-  static unsigned UniqueNameCounter = 1;
-  std::string Result(Name);
-  Result += ".upgrd." + llvm::utostr(UniqueNameCounter++);
-  return Result;
-}
-
 /// This is the implementation portion of TypeHasInteger. It traverses the
 /// type given, avoiding recursive types, and returns true as soon as it finds
 /// an integer type. If no integer type is found, it returns false.



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


[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.y updated: 1.60 -> 1.61
---
Log message:

For PR1187: http://llvm.org/PR1187 :
Always rename, never give a redef error. We could check for collapsed type
planes and generate an error if that's not the cause, but the 99.
percentile case will be that its the result of collapsed type planes. So,
rather than doing an expensive check, just rename.


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

 UpgradeParser.y |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.60 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.61
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.60Thu Feb  8 02:09:36 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Thu Feb  8 02:47:38 2007
@@ -2626,10 +2626,24 @@
   if (Conflict && PFT == Conflict->getType()) {
 if (!CurFun.isDeclare && !Conflict->isDeclaration()) {
   // We have two function definitions that conflict, same type, same
-  // name. This wasn't allowed in 1.9, its not allowed here either
-  error("Redefinition of function '" + FunctionName + "' of type '" +
-PFT->getDescription() + "'");
-
+  // name. We should really check to make sure that this is the result
+  // of integer type planes collapsing and generate an error if it is
+  // not, but we'll just rename on the assumption that it is. However,
+  // let's do it intelligently and rename the internal linkage one
+  // if there is one.
+  std::string NewName(makeNameUnique(FunctionName));
+  if (Conflict->hasInternalLinkage()) {
+Conflict->setName(NewName);
+RenameMapKey Key = 
std::make_pair(FunctionName,Conflict->getType());
+CurModule.RenameMap[Key] = NewName;
+Fn = new Function(FT, CurFun.Linkage, FunctionName, M);
+InsertValue(Fn, CurModule.Values);
+  } else {
+Fn = new Function(FT, CurFun.Linkage, NewName, M);
+InsertValue(Fn, CurModule.Values);
+RenameMapKey Key = std::make_pair(FunctionName,PFT);
+CurModule.RenameMap[Key] = NewName;
+  }
 } else {
   // If they are not both definitions, then just use the function we
   // found since the types are the same.



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


[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/minisat/Makefile

2007-02-08 Thread Owen Anderson


Changes in directory llvm-test/MultiSource/Benchmarks/minisat:

Makefile updated: 1.2 -> 1.3
---
Log message:

Fix a comment.


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

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


Index: llvm-test/MultiSource/Benchmarks/minisat/Makefile
diff -u llvm-test/MultiSource/Benchmarks/minisat/Makefile:1.2 
llvm-test/MultiSource/Benchmarks/minisat/Makefile:1.3
--- llvm-test/MultiSource/Benchmarks/minisat/Makefile:1.2   Thu Feb  8 
02:40:59 2007
+++ llvm-test/MultiSource/Benchmarks/minisat/Makefile   Thu Feb  8 02:47:12 2007
@@ -1,4 +1,4 @@
-# MultiSource/minisat Makefile:  Build all subdirectories automatically
+# MultiSource/minisat Makefile
 
 LEVEL = ../../..
 PROG = minisat



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


[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/minisat/long.cnf.gz short.cnf.gz Main.cpp Makefile

2007-02-08 Thread Owen Anderson


Changes in directory llvm-test/MultiSource/Benchmarks/minisat:

long.cnf.gz added (r1.1)
short.cnf.gz added (r1.1)
Main.cpp updated: 1.1 -> 1.2
Makefile updated: 1.1 -> 1.2
---
Log message:

Reenable some hacked out output from minisat to better indentify failures.
Also, gzip the input files to save some bandwidth.

NOTE: This currently fails the JIT which can't load zlib symbols for it.



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

 Main.cpp |   29 +++--
 Makefile |3 ++-
 long.cnf.gz  |0 
 short.cnf.gz |0 
 4 files changed, 21 insertions(+), 11 deletions(-)


Index: llvm-test/MultiSource/Benchmarks/minisat/long.cnf.gz


Index: llvm-test/MultiSource/Benchmarks/minisat/short.cnf.gz


Index: llvm-test/MultiSource/Benchmarks/minisat/Main.cpp
diff -u llvm-test/MultiSource/Benchmarks/minisat/Main.cpp:1.1 
llvm-test/MultiSource/Benchmarks/minisat/Main.cpp:1.2
--- llvm-test/MultiSource/Benchmarks/minisat/Main.cpp:1.1   Thu Feb  8 
02:25:16 2007
+++ llvm-test/MultiSource/Benchmarks/minisat/Main.cpp   Thu Feb  8 02:40:59 2007
@@ -23,6 +23,7 @@
 #include 
 
 #include 
+#include 
 
 #include "Solver.h"
 
@@ -83,7 +84,7 @@
 #define CHUNK_LIMIT 1048576
 
 class StreamBuffer {
-FILE*  in;
+gzFile  in;
 charbuf[CHUNK_LIMIT];
 int pos;
 int size;
@@ -91,10 +92,10 @@
 void assureLookahead() {
 if (pos >= size) {
 pos  = 0;
-size = fread(buf, 1, sizeof(buf), in); } }
+size = gzread(in, buf, sizeof(buf)); } }
 
 public:
-StreamBuffer(FILE* i) : in(i), pos(0), size(0) {
+StreamBuffer(gzFile i) : in(i), pos(0), size(0) {
 assureLookahead(); }
 
 int  operator *  () { return (pos >= size) ? EOF : buf[pos]; }
@@ -161,6 +162,8 @@
 if (match(in, "p cnf")){
 int vars= parseInt(in);
 int clauses = parseInt(in);
+reportf("|  Number of variables:  %-12d
 |\n", vars);
+reportf("|  Number of clauses:%-12d
 |\n", clauses);
 }else{
 reportf("PARSE ERROR! Unexpected char: %c\n", *in), exit(3);
 }
@@ -174,7 +177,7 @@
 
 // Inserts problem into solver.
 //
-static void parse_DIMACS(FILE* input_stream, Solver& S) {
+static void parse_DIMACS(gzFile input_stream, Solver& S) {
 StreamBuffer in(input_stream);
 parse_DIMACS_main(in, S); }
 
@@ -187,12 +190,11 @@
 double   cpu_time = cpuTime();
 uint64_t mem_used = memUsed();
 reportf("restarts  : %lld\n", solver.starts);
-reportf("conflicts : %-12lld   (%.0f /sec)\n", 
solver.conflicts   , solver.conflicts   /cpu_time);
-reportf("decisions : %-12lld   (%4.2f %% random) (%.0f 
/sec)\n", solver.decisions, (float)solver.rnd_decisions*100 / 
(float)solver.decisions, solver.decisions   /cpu_time);
-reportf("propagations  : %-12lld   (%.0f /sec)\n", 
solver.propagations, solver.propagations/cpu_time);
+reportf("conflicts : %-12lld\n", solver.conflicts);
+reportf("decisions : %-12lld   (%4.2f %% random)\n", 
solver.decisions, (float)solver.rnd_decisions*100 / (float)solver.decisions);
+reportf("propagations  : %-12lld\n", solver.propagations);
 reportf("conflict literals : %-12lld   (%4.2f %% deleted)\n", 
solver.tot_literals, (solver.max_literals - solver.tot_literals)*100 / 
(double)solver.max_literals);
 if (mem_used != 0) reportf("Memory used   : %.2f MB\n", mem_used / 
1048576.0);
-reportf("CPU time  : %g s\n", cpu_time);
 }
 
 Solver* solver;
@@ -283,6 +285,7 @@
 argc = j;
 
 
+reportf("This is MiniSat 2.0 beta\n");
 #if defined(__linux__)
 fpu_control_t oldcw, newcw;
 _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; 
_FPU_SETCW(newcw);
@@ -297,11 +300,15 @@
 if (argc == 1)
 reportf("Reading from standard input... Use '-h' or '--help' for 
help.\n");
 
-FILE* in = fopen(argv[1], "rb");
+gzFile in = (argc == 1) ? gzdopen(0, "rb") : gzopen(argv[1], "rb");
 if (in == NULL)
 reportf("ERROR! Could not open file: %s\n", argc == 1 ? "" : 
argv[1]), exit(1);
 
-parse_DIMACS(in, S);;
+reportf("[ Problem Statistics 
]=\n");
+reportf("| 
|\n");
+
+parse_DIMACS(in, S);
+gzclose(in);
 FILE* res = (argc >= 3) ? fopen(argv[2], "wb") : NULL;
 
 if (!S.simplify()){
@@ -312,6 +319,8 @@
 }
 
 bool ret = S.solve();
+printStats(S);
+reportf("\n");
 printf(ret ? "SATISFIABLE\n" : "UNSATISFIABLE\n");
 if (res != NULL){
 if (ret){


Index: llvm-test/MultiSource/Benchmarks/minisat/Makefile
diff -u llvm-test/MultiSource/Benchmarks/minisat/Makefile:1.1 
llvm-test/MultiSource/B

[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/minisat/mtl/Alg.h BasicHeap.h BoxedVec.h Heap.h Map.h Queue.h SolverTypes.h Sort.h Vec.h

2007-02-08 Thread Owen Anderson


Changes in directory llvm-test/MultiSource/Benchmarks/minisat/mtl:

Alg.h added (r1.1)
BasicHeap.h added (r1.1)
BoxedVec.h added (r1.1)
Heap.h added (r1.1)
Map.h added (r1.1)
Queue.h added (r1.1)
SolverTypes.h added (r1.1)
Sort.h added (r1.1)
Vec.h added (r1.1)
---
Log message:

Add minisat to the testsuite.  This test was recommended by Domagoj Babic.


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

 Alg.h |   57 
 BasicHeap.h   |   98 
 BoxedVec.h|  147 +++
 Heap.h|  169 +
 Map.h |  118 ++
 Queue.h   |   82 
 SolverTypes.h |  197 ++
 Sort.h|   93 +++
 Vec.h |  133 +++
 9 files changed, 1094 insertions(+)


Index: llvm-test/MultiSource/Benchmarks/minisat/mtl/Alg.h
diff -c /dev/null llvm-test/MultiSource/Benchmarks/minisat/mtl/Alg.h:1.1
*** /dev/null   Thu Feb  8 02:25:27 2007
--- llvm-test/MultiSource/Benchmarks/minisat/mtl/Alg.h  Thu Feb  8 02:25:17 2007
***
*** 0 
--- 1,57 
+ 
/***[Alg.h]
+ MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and
+ associated documentation files (the "Software"), to deal in the Software 
without restriction,
+ including without limitation the rights to use, copy, modify, merge, publish, 
distribute,
+ sublicense, and/or sell copies of the Software, and to permit persons to whom 
the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in 
all copies or
+ substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
OTHERWISE, ARISING FROM, OUT
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
+ 
**/
+ 
+ #ifndef Alg_h
+ #define Alg_h
+ 
+ 
//=
+ // Useful functions on vectors
+ 
+ 
+ #if 1
+ template
+ static inline void remove(V& ts, const T& t)
+ {
+ int j = 0;
+ for (; j < ts.size() && ts[j] != t; j++);
+ assert(j < ts.size());
+ for (; j < ts.size()-1; j++) ts[j] = ts[j+1];
+ ts.pop();
+ }
+ #else
+ template
+ static inline void remove(V& ts, const T& t)
+ {
+ int j = 0;
+ for (; j < ts.size() && ts[j] != t; j++);
+ assert(j < ts.size());
+ ts[j] = ts.last();
+ ts.pop();
+ }
+ #endif
+ 
+ template
+ static inline bool find(V& ts, const T& t)
+ {
+ int j = 0;
+ for (; j < ts.size() && ts[j] != t; j++);
+ return j < ts.size();
+ }
+ 
+ #endif


Index: llvm-test/MultiSource/Benchmarks/minisat/mtl/BasicHeap.h
diff -c /dev/null llvm-test/MultiSource/Benchmarks/minisat/mtl/BasicHeap.h:1.1
*** /dev/null   Thu Feb  8 02:25:40 2007
--- llvm-test/MultiSource/Benchmarks/minisat/mtl/BasicHeap.hThu Feb  8 
02:25:17 2007
***
*** 0 
--- 1,98 
+ 
/**[Heap.h]
+ MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and
+ associated documentation files (the "Software"), to deal in the Software 
without restriction,
+ including without limitation the rights to use, copy, modify, merge, publish, 
distribute,
+ sublicense, and/or sell copies of the Software, and to permit persons to whom 
the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in 
all copies or
+ substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
OTHERWISE, ARISING FROM, OUT
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
+ 
**

[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/minisat/mtl/

2007-02-08 Thread LLVM


Changes in directory llvm-test/MultiSource/Benchmarks/minisat/mtl:

---
Log message:

Directory /var/cvs/llvm/llvm-test/MultiSource/Benchmarks/minisat/mtl added to 
the repository


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

 0 files changed



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


[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/minisat/

2007-02-08 Thread LLVM


Changes in directory llvm-test/MultiSource/Benchmarks/minisat:

---
Log message:

Directory /var/cvs/llvm/llvm-test/MultiSource/Benchmarks/minisat added to the 
repository


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

 0 files changed



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


[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y

2007-02-08 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.y updated: 1.59 -> 1.60
---
Log message:

For PR1187: http://llvm.org/PR1187 :
Some changes to get the smbd.ll test case working:
1. Move the logic for CSRETCC->sret attribute out of the ResolveDefinitions
   code and into getExistingValue. This resolves it much earlier and works
   in function scope as well.
2. Fix handling of CSRETCC->sret for the store instruction.
3. Rewrite the code for handling renaming to factor in linkage types.
4. Rename a structure filed for a PATypeInfo* so it doesn't get confused 
   with a field for a Type*.


---
Diffs of the changes:  (+277 -253)

 UpgradeParser.y |  530 +---
 1 files changed, 277 insertions(+), 253 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.59 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.60
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.59Wed Feb  7 18:21:06 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Thu Feb  8 02:09:36 2007
@@ -171,7 +171,6 @@
   std::map > BBForwardRefs;
   std::vector NumberedBlocks;
   RenameMapType RenameMap;
-  unsigned LastCC;
   unsigned NextBBNum;
 
   inline PerFunctionInfo() {
@@ -268,6 +267,55 @@
   return Typ;
  }
 
+/// This function determines if two function types differ only in their use of
+/// the sret parameter attribute in the first argument. If they are identical 
+/// in all other respects, it returns true. Otherwise, it returns false.
+bool FuncTysDifferOnlyBySRet(const FunctionType *F1, 
+   const FunctionType *F2) {
+  if (F1->getReturnType() != F2->getReturnType() ||
+  F1->getNumParams() != F2->getNumParams() ||
+  F1->getParamAttrs(0) != F2->getParamAttrs(0))
+return false;
+  unsigned SRetMask = ~unsigned(FunctionType::StructRetAttribute);
+  for (unsigned i = 0; i < F1->getNumParams(); ++i) {
+if (F1->getParamType(i) != F2->getParamType(i) ||
+unsigned(F1->getParamAttrs(i+1)) & SRetMask !=
+unsigned(F2->getParamAttrs(i+1)) & SRetMask)
+  return false;
+  }
+  return true;
+}
+
+// The upgrade of csretcc to sret param attribute may have caused a function 
+// to not be found because the param attribute changed the type of the called 
+// function. This helper function, used in getExistingValue, detects that
+// situation and returns V if it occurs and 0 otherwise. 
+static Value* handleSRetFuncTypeMerge(Value *V, const Type* Ty) {
+  // Handle degenerate cases
+  if (!V)
+return 0;
+  if (V->getType() == Ty)
+return V;
+
+  Value* Result = 0;
+  const PointerType *PF1 = dyn_cast(Ty);
+  const PointerType *PF2 = dyn_cast(V->getType());
+  if (PF1 && PF2) {
+const FunctionType *FT1 =
+  dyn_cast(PF1->getElementType());
+const FunctionType *FT2 =
+  dyn_cast(PF2->getElementType());
+if (FT1 && FT2 && FuncTysDifferOnlyBySRet(FT1, FT2))
+  if (FT2->paramHasAttr(1, FunctionType::StructRetAttribute))
+Result = V;
+  else if (Constant *C = dyn_cast(V))
+Result = ConstantExpr::getBitCast(C, PF1);
+  else
+Result = new BitCastInst(V, PF1, "upgrd.cast", CurBB);
+  }
+  return Result;
+}
+
 // getExistingValue - Look up the value specified by the provided type and
 // the provided ValID.  If the value exists and has already been defined, 
return
 // it.  Otherwise return null.
@@ -314,8 +362,7 @@
 LookupName = Name;
   ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
   V = SymTab.lookup(LookupName);
-  if (V && V->getType() != Ty)
-V = 0;
+  V = handleSRetFuncTypeMerge(V, Ty);
 }
 if (!V) {
   RenameMapType::const_iterator I = CurModule.RenameMap.find(Key);
@@ -325,8 +372,7 @@
   else
 LookupName = Name;
   V = CurModule.CurrentModule->getValueSymbolTable().lookup(LookupName);
-  if (V && V->getType() != Ty)
-V = 0;
+  V = handleSRetFuncTypeMerge(V, Ty);
 }
 if (!V) 
   return 0;
@@ -509,25 +555,6 @@
 // and back patchs after we are done.
 //
 
-/// This function determines if two function types differ only in their use of
-/// the sret parameter attribute in the first argument. If they are identical 
-/// in all other respects, it returns true. Otherwise, it returns false.
-bool FuncTysDifferOnlyBySRet(const FunctionType *F1, 
-   const FunctionType *F2) {
-  if (F1->getReturnType() != F2->getReturnType() ||
-  F1->getNumParams() != F2->getNumParams() ||
-  F1->getParamAttrs(0) != F2->getParamAttrs(0))
-return false;
-  unsigned SRetMask = ~unsigned(FunctionType::StructRetAttribute);
-  for (unsigned i = 0; i < F1->getNumParams(); ++i) {
-if (F1->getParamType(i) != F2->getParamType(i) ||
-unsigned(F1->getParamAttrs(i+1)) & SRetMask !=
-unsigned(F2->getParamAttrs(i+1)) & SRetMask)
-  return false;
-  }
-  return true;
-

[llvm-commits] CVS: llvm/test/Assembler/2007-02-07-UpgradeCSRETCC.ll

2007-02-08 Thread Reid Spencer


Changes in directory llvm/test/Assembler:

2007-02-07-UpgradeCSRETCC.ll updated: 1.1 -> 1.2
---
Log message:

Add some more interesting cases to this test.


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

 2007-02-07-UpgradeCSRETCC.ll |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/test/Assembler/2007-02-07-UpgradeCSRETCC.ll
diff -u llvm/test/Assembler/2007-02-07-UpgradeCSRETCC.ll:1.1 
llvm/test/Assembler/2007-02-07-UpgradeCSRETCC.ll:1.2
--- llvm/test/Assembler/2007-02-07-UpgradeCSRETCC.ll:1.1Thu Feb  8 
00:45:02 2007
+++ llvm/test/Assembler/2007-02-07-UpgradeCSRETCC.llThu Feb  8 02:03:46 2007
@@ -17,5 +17,7 @@
   %fptr = alloca void (%mystruct*, i32)*
   %f = load void (%mystruct*, i32)**%fptr
   call csretcc void %f(%mystruct* %astr, i32 7)
+  store void (%mystruct* , i32)* %nada, void (%mystruct*, i32)** %fptr
+
   ret int 0
 }



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