[llvm-commits] [123716] Reid's StripDeadPrototypes patch

2007-02-12 Thread jlaskey
Revision: 123716
Author:   jlaskey
Date: 2007-02-12 03:32:30 -0800 (Mon, 12 Feb 2007)

Log Message:
---
Reid's StripDeadPrototypes patch

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

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-02-11 11:46:07 UTC 
(rev 123715)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-02-12 11:32:30 UTC 
(rev 123716)
@@ -260,62 +260,63 @@
 HasPerModulePasses = true;
 PassManager *PM = PerModulePasses;
 if (flag_unit_at_a_time)
-  PM-add(createRaiseAllocationsPass()); // call %malloc - malloc inst
-PM-add(createCFGSimplificationPass());// Clean up disgusting code
-PM-add(createPromoteMemoryToRegisterPass());// Kill useless allocas
+  PM-add(createRaiseAllocationsPass());  // call %malloc - malloc 
inst
+PM-add(createCFGSimplificationPass());   // Clean up disgusting code
+PM-add(createPromoteMemoryToRegisterPass()); // Kill useless allocas
 if (flag_unit_at_a_time) {
-  PM-add(createGlobalOptimizerPass());  // Optimize out global vars
-  PM-add(createGlobalDCEPass());// Remove unused fns and globs
-  PM-add(createIPConstantPropagationPass());// IP Constant Propagation
-  PM-add(createDeadArgEliminationPass());   // Dead argument elimination
+  PM-add(createGlobalOptimizerPass());   // Optimize out global vars
+  PM-add(createGlobalDCEPass()); // Remove unused fns and 
globs
+  PM-add(createIPConstantPropagationPass()); // IP Constant Propagation
+  PM-add(createDeadArgEliminationPass());// Dead argument elimination
 }
-PM-add(createInstructionCombiningPass()); // Clean up after IPCP  DAE
+PM-add(createInstructionCombiningPass());// Clean up after IPCP  DAE
 // DISABLE PREDSIMPLIFY UNTIL PR967 is fixed.
-//PM-add(createPredicateSimplifierPass());  // Canonicalize registers
-PM-add(createCFGSimplificationPass());// Clean up after IPCP  DAE
+//PM-add(createPredicateSimplifierPass());   // Canonicalize registers
+PM-add(createCFGSimplificationPass());   // Clean up after IPCP  DAE
 if (flag_unit_at_a_time)
-  PM-add(createPruneEHPass());  // Remove dead EH info
+  PM-add(createPruneEHPass());   // Remove dead EH info
 
 if (optimize  1) {
-  if (flag_inline_trees  1)   // respect -fno-inline-functions
-PM-add(createFunctionInliningPass());   // Inline small functions
+  if (flag_inline_trees  1)// respect 
-fno-inline-functions
+PM-add(createFunctionInliningPass());  // Inline small functions
   if (flag_unit_at_a_time)
-PM-add(createSimplifyLibCallsPass());   // Library Call Optimizations
+PM-add(createSimplifyLibCallsPass());  // Library Call Optimizations
 
   if (optimize  2)
-   PM-add(createArgumentPromotionPass());  // Scalarize uninlined fn args
+   PM-add(createArgumentPromotionPass()); // Scalarize uninlined fn args
 }
 
-PM-add(createTailDuplicationPass());  // Simplify cfg by copying code
-PM-add(createInstructionCombiningPass()); // Cleanup for scalarrepl.
-PM-add(createCFGSimplificationPass());// Merge  remove BBs
-PM-add(createScalarReplAggregatesPass()); // Break up aggregate allocas
-PM-add(createInstructionCombiningPass()); // Combine silly seq's
-PM-add(createCondPropagationPass());  // Propagate conditionals
-PM-add(createTailCallEliminationPass());  // Eliminate tail calls
-PM-add(createCFGSimplificationPass());// Merge  remove BBs
-PM-add(createReassociatePass());  // Reassociate expressions
-PM-add(createLICMPass()); // Hoist loop invariants
-PM-add(createLoopUnswitchPass()); // Unswitch loops.
-PM-add(createInstructionCombiningPass()); // Clean up after LICM/reassoc
-PM-add(createIndVarSimplifyPass());   // Canonicalize indvars
+PM-add(createTailDuplicationPass());   // Simplify cfg by copying code
+PM-add(createInstructionCombiningPass());  // Cleanup for scalarrepl.
+PM-add(createCFGSimplificationPass()); // Merge  remove BBs
+PM-add(createScalarReplAggregatesPass());  // Break up aggregate allocas
+PM-add(createInstructionCombiningPass());  // Combine silly seq's
+PM-add(createCondPropagationPass());   // Propagate conditionals
+PM-add(createTailCallEliminationPass());   // Eliminate tail calls
+PM-add(createCFGSimplificationPass()); // Merge  remove BBs
+PM-add(createReassociatePass());   // Reassociate expressions
+PM-add(createLICMPass());  // Hoist loop invariants
+PM-add(createLoopUnswitchPass());  // Unswitch loops.
+PM-add(createInstructionCombiningPass());  // Clean up after 

[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/APInt/.cvsignore

2007-02-12 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/Integer/APInt:

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

Ignore the Output directory.


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

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


Index: llvm-test/SingleSource/UnitTests/Integer/APInt/.cvsignore
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/APInt/.cvsignore:1.1
*** /dev/null   Mon Feb 12 11:52:05 2007
--- llvm-test/SingleSource/UnitTests/Integer/APInt/.cvsignore   Mon Feb 12 
11:51:55 2007
***
*** 0 
--- 1 
+ Output



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bit_concat.c bit_concat.reference_output bit_reduce.c bit_reduce.reference_output part_select.c part_select.reference_output bit_select.c

2007-02-12 Thread Reid Spencer


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

bit_concat.c added (r1.1)
bit_concat.reference_output added (r1.1)
bit_reduce.c added (r1.1)
bit_reduce.reference_output added (r1.1)
part_select.c added (r1.1)
part_select.reference_output added (r1.1)
bit_select.c updated: 1.1 - 1.2
---
Log message:

Update/Add tests for the arbitrary bit width builtin functions.


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

 bit_concat.c|   62 ++
 bit_concat.reference_output |  119 
 bit_reduce.c|   67 
 bit_reduce.reference_output |   18 ++
 bit_select.c|6 +-
 part_select.c   |   54 +++
 6 files changed, 323 insertions(+), 3 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/bit_concat.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.1
*** /dev/null   Mon Feb 12 11:53:09 2007
--- llvm-test/SingleSource/UnitTests/Integer/bit_concat.c   Mon Feb 12 
11:52:59 2007
***
*** 0 
--- 1,62 
+ //===--- part_select.c --- Test The bit_select builtin 
===//
+ //
+ // This file was developed by Reid Spencer and is distributed under the 
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ 
//===--===//
+ //
+ // This test case tests the __builtin_part_select builtin function llvm-gcc.
+ // bit_select selects one bit out of a larger 
+ //
+ 
//===--===//
+ 
+ #include stdio.h
+ #include stdlib.h
+ 
+ typedef unsigned int __attribute__((bitwidth(17))) BitType1;
+ typedef unsigned int __attribute__((bitwidth(19))) BitType2;
+ typedef unsigned long long __attribute__((bitwidth(36))) ConcatType;
+ int numbits1 = 17;
+ int numbits2 = 19;
+ 
+ void printBits(ConcatType val, int numbits ) {
+   int j;
+   for (j = numbits-1; j = 0; --j) {
+ if (__builtin_bit_select(val, j))
+   printf(1);
+ else
+   printf(0);
+   }
+ }
+ 
+ int main(int argc, char** argv)
+ {
+   BitType1 X = 0;
+   BitType2 Y = 0;
+   ConcatType Z = 0;
+   int i, j;
+   int count = (argc  1 ? atoi(argv[1]) % 128 : 128);
+ 
+   srand(count);
+ 
+   for (i = 0; i  count; i++) {
+ Y = X = 0;
+ for (j = 0; j  numbits1; j++) {
+   X += (rand() % 2 == 0 ? 0 : 1);
+   X = 1;
+ }
+ for (j = 0; j  numbits2; j++) {
+   Y += (rand() % 2 == 0 ? 0 : 1);
+   Y = 1;
+ }
+ Z = __builtin_bit_concat(X, Y);
+ printf(bit_concat();
+ printBits(X, numbits1);
+ printf(,);
+ printBits(Y, numbits2);
+ printf() = );
+ printBits(Z, numbits1 + numbits2);
+ printf(\n);
+   }
+   return 0;
+ }


Index: llvm-test/SingleSource/UnitTests/Integer/bit_concat.reference_output
diff -c /dev/null 
llvm-test/SingleSource/UnitTests/Integer/bit_concat.reference_output:1.1
*** /dev/null   Mon Feb 12 11:53:16 2007
--- llvm-test/SingleSource/UnitTests/Integer/bit_concat.reference_output
Mon Feb 12 11:52:59 2007
***
*** 0 
--- 1,119 
+ bit_concat(000011100,0100110100110111000) = 
0000111000100110100110111000
+ bit_concat(1000010110100,01001101010) = 
100001011010001001101010
+ bit_concat(100111011,101011010110100) = 
100111011101011010110100
+ bit_concat(1001101011100,100100010110110) = 
1001101011100100100010110110
+ bit_concat(1110100110100,10011110100) = 
111010011010010011110100
+ bit_concat(110101001,00011101110) = 
11010100100011101110
+ bit_concat(0111001001100,0101010101100111000) = 
01110010011000101010101100111000
+ bit_concat(0010010010010,010001000110010) = 
0010010010010010001000110010
+ bit_concat(0100011010100,001001100101010) = 
010001101011001100101010
+ bit_concat(1010100001100,0110110111000110100) = 
10101000011000110110111000110100
+ bit_concat(1000110111010,0110101) = 
10001101110100110101
+ bit_concat(001101000,010011011011000) = 
001101000010011011011000
+ bit_concat(1010110001000,0010100) = 
10101100010000010100
+ bit_concat(1110001100010,01001101100) = 
111000110001001001101100
+ bit_concat(0010001001000,00101100010) = 
00100010010101100010
+ bit_concat(1010110011010,1001011010011000100) = 
10101100110101001011010011000100
+ bit_concat(001010001,00110101101) = 
00101000100110101101
+ bit_concat(0001001101011,000101101101110) = 
0001001101011000101101101110
+ bit_concat(1011010111000,111001011101000) = 
1011010111000111001011101000
+ 

[llvm-commits] [123743] Avoid including GCC's system headers.

2007-02-12 Thread dpatel
Revision: 123743
Author:   dpatel
Date: 2007-02-12 10:01:31 -0800 (Mon, 12 Feb 2007)

Log Message:
---
Avoid including GCC's system headers. They poison stuff
like malloc that we use in LLVM subsystem.

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-debug.h

Modified: apple-local/branches/llvm/gcc/llvm-debug.h
===
--- apple-local/branches/llvm/gcc/llvm-debug.h  2007-02-12 17:41:51 UTC (rev 
123742)
+++ apple-local/branches/llvm/gcc/llvm-debug.h  2007-02-12 18:01:31 UTC (rev 
123743)
@@ -31,10 +31,7 @@
 #include llvm/CodeGen/MachineModuleInfo.h
 
 extern C {
-#include config.h
-#include system.h
-#include coretypes.h
-union tree_node;
+#include llvm.h
 }  
 
 #include string


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


[llvm-commits] updated TargetData mods...

2007-02-12 Thread Scott Michel
Resolved recent commit conflicts.


-scooter
Index: include/llvm/Target/TargetData.h
===
--- include/llvm/Target/TargetData.h	(.../trunk)	(revision 773)
+++ include/llvm/Target/TargetData.h	(.../branches/llvm-spu)	(revision 773)
@@ -22,6 +22,8 @@
 
 #include llvm/Pass.h
 #include llvm/Support/DataTypes.h
+#include llvm/ADT/SmallVector.h
+#include string
 
 namespace llvm {
 
@@ -31,45 +33,96 @@
 class StructLayout;
 class GlobalVariable;
 
+/// Enum used to categorize the alignment types stored by TargetAlignElem
+enum AlignTypeEnum {
+  INTEGER_ALIGN = 'i',   /// Integer type alignment
+  PACKED_ALIGN = 'v',/// Vector type alignment
+  FLOAT_ALIGN = 'f', /// Floating point type alignment
+  AGGREGATE_ALIGN = 'a'  /// Aggregate alignment
+};
+/// Target alignment element.
+///
+/// Stores the alignment data associated with a given alignment type (pointer,
+/// integer, packed/vector, float) and type bit width.
+///
+/// @note The unusual order of elements in the structure attempts to reduce
+/// padding and make the structure slightly more cache friendly.
+struct TargetAlignElem {
+  unsigned char   AlignType;  // Alignment type (AlignTypeEnum)
+  unsigned char   ABIAlign;   // ABI alignment for this type/bitw
+  unsigned char   PrefAlign;  // Pref. alignment for this type/bitw
+  short   TypeBitWidth;   // Type bit width
+
+  /// Initializer
+  static TargetAlignElem get(AlignTypeEnum align_type, unsigned char abi_align,
+ unsigned char pref_align, short bit_width);
+  /// Less-than predicate
+  bool operator(const TargetAlignElem rhs) const;
+  /// Equality predicate
+  bool operator==(const TargetAlignElem rhs) const;
+  /// output stream operator
+  std::ostream dump(std::ostream os) const;
+};
+
+//! TargetAlignElem output stream inserter
+/*!
+  @sa TargetAlignElem::dump()
+ */
+std::ostream operator(std::ostream os, const TargetAlignElem elem);
+
 class TargetData : public ImmutablePass {
-  bool  LittleEndian;  // Defaults to false
+private:
+  bool  LittleEndian;  /// Defaults to false
+  unsigned char PointerMemSize;/// Pointer size in bytes
+  unsigned char PointerABIAlign;   /// Pointer ABI alignment
+  unsigned char PointerPrefAlign;  /// Pointer preferred global alignment
 
-  // ABI alignments
-  unsigned char BoolABIAlignment;   // Defaults to 1 byte
-  unsigned char ByteABIAlignment;   // Defaults to 1 byte
-  unsigned char ShortABIAlignment;  // Defaults to 2 bytes
-  unsigned char IntABIAlignment;// Defaults to 4 bytes
-  unsigned char LongABIAlignment;   // Defaults to 8 bytes
-  unsigned char FloatABIAlignment;  // Defaults to 4 bytes
-  unsigned char DoubleABIAlignment; // Defaults to 8 bytes
-  unsigned char PointerMemSize;// Defaults to 8 bytes
-  unsigned char PointerABIAlignment;// Defaults to 8 bytes
+  //! Where the primitive type alignment data is stored.
+  /*!
+   @sa init().
+   @note Could support multiple size pointer alignments, e.g., 32-bit pointers
+   vs. 64-bit pointers by extending TargetAlignment, but for now, we don't.
+   */
+  SmallVectorTargetAlignElem, 16 Alignments;
+  //! Alignment iterator shorthand
+  typedef SmallVectorTargetAlignElem, 16::iterator align_iterator;
+  //! Constant alignment iterator shorthand
+  typedef SmallVectorTargetAlignElem, 16::const_iterator align_const_iterator;
+  //! Invalid alignment.
+  /*!
+This member is a signal that a requested alignment type and bit width were
+not found in the SmallVector.
+   */
+  static const TargetAlignElem InvalidAlignmentElem;
 
-  // Preferred stack/global type alignments
-  unsigned char BoolPrefAlignment;// Defaults to BoolABIAlignment
-  unsigned char BytePrefAlignment;// Defaults to ByteABIAlignment
-  unsigned char ShortPrefAlignment;   // Defaults to ShortABIAlignment
-  unsigned char IntPrefAlignment; // Defaults to IntABIAlignment
-  unsigned char LongPrefAlignment;// Defaults to LongABIAlignment
-  unsigned char FloatPrefAlignment;   // Defaults to FloatABIAlignment
-  unsigned char DoublePrefAlignment;  // Defaults to DoubleABIAlignment
-  unsigned char PointerPrefAlignment; // Defaults to PointerABIAlignment
-  unsigned char AggMinPrefAlignment;  // Defaults to 0 bytes
+  //! Set/initialize target alignments
+  void setAlignment(AlignTypeEnum align_type, unsigned char abi_align,
+unsigned char pref_align, short bit_width);
+  //! Get TargetAlignElem from alignment type and bit width
+  const TargetAlignElem getAlignment(AlignTypeEnum, short) const;
+  //! Internal helper method that returns requested alignment for type.
+  unsigned char getAlignment(const Type *Ty, bool abi_or_pref) const;
 
+  /// Valid alignment predicate.
+  ///
+  /// Predicate that tests a 

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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Value.cpp updated: 1.66 - 1.67
---
Log message:

Add new setName accessor which doesn't require creating a string.


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

 Value.cpp |   48 
 1 files changed, 28 insertions(+), 20 deletions(-)


Index: llvm/lib/VMCore/Value.cpp
diff -u llvm/lib/VMCore/Value.cpp:1.66 llvm/lib/VMCore/Value.cpp:1.67
--- llvm/lib/VMCore/Value.cpp:1.66  Sun Feb 11 23:18:08 2007
+++ llvm/lib/VMCore/Value.cpp   Mon Feb 12 12:52:59 2007
@@ -119,33 +119,40 @@
 }
 
 void Value::setName(const std::string name) {
-  if (name.empty()  !hasName()) return;
+  setName(name[0], name.size());
+}
+
+void Value::setName(const char *NameStr, unsigned NameLen) {
+  if (NameLen == 0  !hasName()) return;
   if (getType() != Type::VoidTy  Cannot assign a name to void values!);
   
-  
   // Get the symbol table to update for this object.
   ValueSymbolTable *ST;
   if (getSymTab(this, ST))
 return;  // Cannot set a name on this value (e.g. constant).
 
   if (!ST) { // No symbol table to update?  Just do the change.
-if (name.empty()) {
+if (NameLen == 0) {
   // Free the name for this value.
   Name-Destroy();
   Name = 0;
-} else {
-  if (Name) {
-// Name isn't changing.
-if (name.size() == Name-getKeyLength() 
-!memcmp(Name-getKeyData(), name[0], name.size()))
-  return;
-Name-Destroy();
-  }
-  
-  // Create the new name.
-  Name = ValueName::Create(name[0], name[name.size()]);
-  Name-setValue(this);
+  return;
 }
+
+if (Name) {
+  // Name isn't changing?
+  if (NameLen == Name-getKeyLength() 
+  !memcmp(Name-getKeyData(), NameStr, NameLen))
+return;
+  Name-Destroy();
+}
+
+// NOTE: Could optimize for the case the name is shrinking to not 
deallocate
+// then reallocated.
+  
+// Create the new name.
+Name = ValueName::Create(NameStr, NameStr+NameLen);
+Name-setValue(this);
 return;
   }
   
@@ -153,8 +160,8 @@
   // then reallocated.
   if (hasName()) {
 // Name isn't changing?
-if (name.size() == Name-getKeyLength() 
-!memcmp(Name-getKeyData(), name[0], name.size()))
+if (NameLen == Name-getKeyLength() 
+!memcmp(Name-getKeyData(), NameStr, NameLen))
   return;
 
 // Remove old name.
@@ -162,14 +169,15 @@
 Name-Destroy();
 Name = 0;
 
-if (name.empty())
-   return;
+if (NameLen == 0)
+  return;
   }
 
   // Name is changing to something new.
-  Name = ST-createValueName(name[0], name.size(), this);
+  Name = ST-createValueName(NameStr, NameLen, this);
 }
 
+
 /// takeName - transfer the name from V to this value, setting V's name to
 /// empty.  It is an error to call V-takeName(V). 
 void Value::takeName(Value *V) {



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


[llvm-commits] CVS: llvm/include/llvm/Value.h

2007-02-12 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Value.h updated: 1.93 - 1.94
---
Log message:

Add new setName accessor which doesn't require creating a string.


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

 Value.h |1 +
 1 files changed, 1 insertion(+)


Index: llvm/include/llvm/Value.h
diff -u llvm/include/llvm/Value.h:1.93 llvm/include/llvm/Value.h:1.94
--- llvm/include/llvm/Value.h:1.93  Sun Feb 11 23:18:08 2007
+++ llvm/include/llvm/Value.h   Mon Feb 12 12:52:59 2007
@@ -91,6 +91,7 @@
   ValueName *getValueName() const { return Name; }
 
   void setName(const std::string name);
+  void setName(const char *Name, unsigned NameLen);
   
   /// takeName - transfer the name from V to this value, setting V's name to
   /// empty.  It is an error to call V-takeName(V). 



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


[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Analyzer.cpp Reader.cpp Reader.h

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Reader:

Analyzer.cpp updated: 1.36 - 1.37
Reader.cpp updated: 1.235 - 1.236
Reader.h updated: 1.48 - 1.49
---
Log message:

avoid creating a temporary string when reading the symbol table for a
module.  This speeds up the bcreader 11%.


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

 Analyzer.cpp |4 ++--
 Reader.cpp   |   30 +++---
 Reader.h |1 +
 3 files changed, 26 insertions(+), 9 deletions(-)


Index: llvm/lib/Bytecode/Reader/Analyzer.cpp
diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.36 
llvm/lib/Bytecode/Reader/Analyzer.cpp:1.37
--- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.36  Sat Feb 10 08:07:56 2007
+++ llvm/lib/Bytecode/Reader/Analyzer.cpp   Mon Feb 12 12:53:42 2007
@@ -250,10 +250,10 @@
   }
 
   virtual void handleSymbolTableValue(unsigned TySlot, unsigned ValSlot, 
-  const std::string name) {
+  const char *Name, unsigned NameLen) {
 if (os)
   *os  Value   TySlot   Slot=  ValSlot
-   Name:   name  \n;
+Name:   std::string(Name, Name+NameLen)  \n;
 if (ValSlot  bca.maxValueSlot)
   bca.maxValueSlot = ValSlot;
   }


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.235 
llvm/lib/Bytecode/Reader/Reader.cpp:1.236
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.235   Wed Feb  7 15:41:01 2007
+++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Feb 12 12:53:43 2007
@@ -132,6 +132,17 @@
   return std::string((char*)OldAt, Size);
 }
 
+void BytecodeReader::read_str(SmallVectorImplchar StrData) {
+  StrData.clear();
+  unsigned Size = read_vbr_uint();
+  const unsigned char *OldAt = At;
+  At += Size;
+  if (At  BlockEnd) // Size invalid?
+error(Ran out of data reading a string!);
+  StrData.append(OldAt, At);
+}
+
+
 /// Read an arbitrary block of data
 inline void BytecodeReader::read_data(void *Ptr, void *End) {
   unsigned char *Start = (unsigned char *)Ptr;
@@ -943,6 +954,8 @@
E = CurrentFunction-end(); I != E; ++I)
   BBMap.push_back(I);
 
+  SmallVectorchar, 32 NameStr;
+  
   while (moreInBlock()) {
 // Symtab block header: [num entries][type id number]
 unsigned NumEntries = read_vbr_uint();
@@ -951,19 +964,22 @@
 for (unsigned i = 0; i != NumEntries; ++i) {
   // Symtab entry: [def slot #][name]
   unsigned slot = read_vbr_uint();
-  std::string Name = read_str();
+  read_str(NameStr);
   Value *V = 0;
   if (Typ == LabelTySlot) {
-if (slot  BBMap.size())
-  V = BBMap[slot];
+V = (slot  BBMap.size()) ? BBMap[slot] : 0;
   } else {
-V = getValue(Typ, slot, false); // Find mapping...
+V = getValue(Typ, slot, false); // Find mapping.
   }
-  if (Handler) Handler-handleSymbolTableValue(Typ, slot, Name);
+  if (Handler) Handler-handleSymbolTableValue(Typ, slot,
+   NameStr[0], 
NameStr.size());
   if (V == 0)
-error(Failed value look-up for name ' + Name + ', type # + 
+error(Failed value look-up for name ' + 
+  std::string(NameStr.begin(), NameStr.end()) + ', type # + 
   utostr(Typ) +  slot # + utostr(slot));
-  V-setName(Name);
+  V-setName(NameStr[0], NameStr.size());
+  
+  NameStr.clear();
 }
   }
   checkPastBlockEnd(Symbol Table);


Index: llvm/lib/Bytecode/Reader/Reader.h
diff -u llvm/lib/Bytecode/Reader/Reader.h:1.48 
llvm/lib/Bytecode/Reader/Reader.h:1.49
--- llvm/lib/Bytecode/Reader/Reader.h:1.48  Wed Feb  7 17:46:55 2007
+++ llvm/lib/Bytecode/Reader/Reader.h   Mon Feb 12 12:53:43 2007
@@ -438,6 +438,7 @@
 
   /// @brief Read a string
   inline std::string read_str();
+  inline void read_str(SmallVectorImplchar StrData);
 
   /// @brief Read a float value
   inline void read_float(float FloatVal);



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


[llvm-commits] CVS: llvm/include/llvm/Bytecode/BytecodeHandler.h

2007-02-12 Thread Chris Lattner


Changes in directory llvm/include/llvm/Bytecode:

BytecodeHandler.h updated: 1.15 - 1.16
---
Log message:

avoid creating a temporary string when reading the symbol table for a
module.  This speeds up the bcreader 11%.


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

 BytecodeHandler.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/Bytecode/BytecodeHandler.h
diff -u llvm/include/llvm/Bytecode/BytecodeHandler.h:1.15 
llvm/include/llvm/Bytecode/BytecodeHandler.h:1.16
--- llvm/include/llvm/Bytecode/BytecodeHandler.h:1.15   Sat Feb 10 08:07:56 2007
+++ llvm/include/llvm/Bytecode/BytecodeHandler.hMon Feb 12 12:53:42 2007
@@ -175,7 +175,7 @@
   virtual void handleSymbolTableValue(
 unsigned i,  /// The index of the value in this plane
 unsigned slot,   /// Slot number of the named value
-const std::string name  /// Name of the value.
+const char *name, unsigned NameLen  /// Name of the value.
   ) {}
 
   /// @brief Handle the end of a value symbol table



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


[llvm-commits] CVS: llvm/include/llvm/Intrinsics.td

2007-02-12 Thread Jim Laskey


Changes in directory llvm/include/llvm:

Intrinsics.td updated: 1.44 - 1.45
---
Log message:

Wrong value type.

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

 Intrinsics.td |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/Intrinsics.td
diff -u llvm/include/llvm/Intrinsics.td:1.44 
llvm/include/llvm/Intrinsics.td:1.45
--- llvm/include/llvm/Intrinsics.td:1.44Wed Feb  7 14:38:26 2007
+++ llvm/include/llvm/Intrinsics.td Mon Feb 12 13:05:51 2007
@@ -232,7 +232,7 @@
 //===-- Exception Handling 
Intrinsics--===//
 //
 def int_eh_exception : Intrinsic[llvm_ptr_ty];
-def int_eh_handlers : Intrinsic[llvm_ptr_ty, llvm_ptr_ty, llvm_vararg_ty];
+def int_eh_handlers : Intrinsic[llvm_i32_ty, llvm_ptr_ty, llvm_vararg_ty];
 
 
//===--===//
 // Target-specific intrinsics



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bit_concat.reference_output

2007-02-12 Thread Reid Spencer


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

bit_concat.reference_output updated: 1.1 - 1.2
---
Log message:

Update the reference output to what is expected.


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

 bit_concat.reference_output |  236 ++--
 1 files changed, 118 insertions(+), 118 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/bit_concat.reference_output
diff -u 
llvm-test/SingleSource/UnitTests/Integer/bit_concat.reference_output:1.1 
llvm-test/SingleSource/UnitTests/Integer/bit_concat.reference_output:1.2
--- llvm-test/SingleSource/UnitTests/Integer/bit_concat.reference_output:1.1
Mon Feb 12 11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bit_concat.reference_output
Mon Feb 12 13:07:49 2007
@@ -1,119 +1,119 @@
-bit_concat(000011100,0100110100110111000) = 
0000111000100110100110111000
-bit_concat(1000010110100,01001101010) = 
100001011010001001101010
-bit_concat(100111011,101011010110100) = 
100111011101011010110100
-bit_concat(1001101011100,100100010110110) = 
1001101011100100100010110110
-bit_concat(1110100110100,10011110100) = 
111010011010010011110100
-bit_concat(110101001,00011101110) = 
11010100100011101110
-bit_concat(0111001001100,0101010101100111000) = 
01110010011000101010101100111000
-bit_concat(0010010010010,010001000110010) = 
0010010010010010001000110010
-bit_concat(0100011010100,001001100101010) = 
010001101011001100101010
-bit_concat(1010100001100,0110110111000110100) = 
10101000011000110110111000110100
-bit_concat(1000110111010,0110101) = 
10001101110100110101
-bit_concat(001101000,010011011011000) = 
001101000010011011011000
-bit_concat(1010110001000,0010100) = 
10101100010000010100
-bit_concat(1110001100010,01001101100) = 
111000110001001001101100
-bit_concat(0010001001000,00101100010) = 
00100010010101100010
-bit_concat(1010110011010,1001011010011000100) = 
10101100110101001011010011000100
-bit_concat(001010001,00110101101) = 
00101000100110101101
-bit_concat(0001001101011,000101101101110) = 
0001001101011000101101101110
-bit_concat(1011010111000,111001011101000) = 
1011010111000111001011101000
-bit_concat(1110011101100,011101010000110) = 
1110011101100011101010000110
-bit_concat(00111,1000111001010101100) = 
001111000111001010101100
-bit_concat(0001001100010,1001101011101011000) = 
00010011000101001101011101011000
-bit_concat(0100101001010,1000110) = 
01001010010101000110
-bit_concat(101011010,11100100010) = 
10101101011100100010
-bit_concat(0101001000110,100110101010100) = 
0101001000110100110101010100
-bit_concat(10111001110100110,11110001010) = 
1011100111010011011110001010
-bit_concat(10001010001010010,10101001000) = 
1000101000101001010101001000
-bit_concat(11100,10101010110) = 
1110010101010110
-bit_concat(0001001110010,001010111000110) = 
0001001110010001010111000110
-bit_concat(101010110,0010011001011001100) = 
1010101100010011001011001100
-bit_concat(00110100101001100,0100101001110010100) = 
001101001010011000100101001110010100
-bit_concat(00010010100110110,0100100) = 
000100101001101100100100
-bit_concat(1111010111000,0101011011101011100) = 
1111010111101011011101011100
-bit_concat(100110101,00100011000) = 
10011010100100011000
-bit_concat(0110110001110,110100010011100) = 
0110110001110110100010011100
-bit_concat(1011100010100,0111001) = 
10111000101000111001
-bit_concat(00010111001011000,1101101100100101100) = 
000101110010110001101101100100101100
-bit_concat(110000100,110011001110101) = 
110000100110011001110101
-bit_concat(1000111010100,1000111010011001000) = 
10001110101001000111010011001000
-bit_concat(11101,110011101011100) = 
11101110011101011100
-bit_concat(10010001001000100,00010001010) = 
100100010010001010001010
-bit_concat(01110110100100010,011001100110100) = 
01110110100100010011001100110100
-bit_concat(01010010110111010,10001101100) = 
0101001011011101010001101100
-bit_concat(01110101110010010,01001000101) = 
0111010111001001001001000101
-bit_concat(10101100111011010,1010100) = 
101011001110110101010100
-bit_concat(0101001101100,11001001001) = 

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

2007-02-12 Thread Zhou Sheng


Changes in directory llvm/lib/Support:

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

1. Make APInt::shl work correctly and more efficiently.
2. Add functions to support the numberical conversion between APInt and
   double/float.


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

 APInt.cpp |   88 ++
 1 files changed, 78 insertions(+), 10 deletions(-)


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.7 llvm/lib/Support/APInt.cpp:1.8
--- llvm/lib/Support/APInt.cpp:1.7  Fri Feb  9 01:48:24 2007
+++ llvm/lib/Support/APInt.cpp  Mon Feb 12 14:02:55 2007
@@ -955,6 +955,69 @@
   return A;
 }
 
+/// DoubleRoundToAPInt - This function convert a double value to
+/// a APInt value.
+APInt llvm::APIntOps::DoubleRoundToAPInt(double Double) {
+  union {
+double D;
+uint64_t I;
+  } T;
+  T.D = Double;
+  bool isNeg = T.I  63;
+  int64_t exp = ((T.I  52)  0x7ff) - 1023;
+  if (exp  0)
+return APInt(0);
+  uint64_t mantissa = ((T.I  12)  12) | (1ULL  52);
+  if (exp  52)
+return isNeg ? -APInt(mantissa  (52 - exp)) : 
+APInt(mantissa  (52 - exp));
+  APInt Tmp(mantissa, exp + 1);
+  Tmp = Tmp.shl(exp - 52);
+  return isNeg ? -Tmp : Tmp;
+}
+
+/// APIntRoundToDouble - This function convert this APInt to a double.
+/// The layout for double is as following (IEEE Standard 754):
+///  --
+/// |  SignExponentFractionBias |
+/// |-- |
+/// |  1[63]   11[62-52]   52[51-00]   1023 |
+///  -- 
+double APInt::APIntRoundToDouble(bool isSigned) const {
+  bool isNeg = isSigned ? (*this)[BitsNum-1] : false;
+  APInt Tmp(isNeg ? -(*this) : (*this));
+  if (Tmp.isSingleWord())
+return isSigned ? double(int64_t(Tmp.VAL)) : double(Tmp.VAL);
+  unsigned n = Tmp.getNumWords() * 64 - Tmp.CountLeadingZeros();
+  if (n = 64) 
+return isSigned ? double(int64_t(Tmp.pVal[0])) : double(Tmp.pVal[0]);
+  // Exponent when normalized to have decimal point directly after
+  // leading one. This is stored excess 1023 in the exponent bit field.
+  uint64_t exp = n - 1;
+
+  // Gross overflow.
+  assert(exp = 1023  Infinity value!);
+
+  // Number of bits in mantissa including the leading one
+  // equals to 53.
+  uint64_t mantissa;
+  if (n % 64 = 53)
+mantissa = Tmp.pVal[whichWord(n - 1)]  (n % 64 - 53);
+  else
+mantissa = (Tmp.pVal[whichWord(n - 1)]  (53 - n % 64)) | 
+   (Tmp.pVal[whichWord(n - 1) - 1]  (11 + n % 64));
+  // The leading bit of mantissa is implicit, so get rid of it.
+  mantissa = ~(1ULL  52);
+  uint64_t sign = isNeg ? (1ULL  63) : 0;
+  exp += 1023;
+  union {
+double D;
+uint64_t I;
+  } T;
+  T.I = sign | (exp  52) | mantissa;
+  return T.D;
+}
+
 /// Arithmetic right-shift this APInt by shiftAmt.
 /// @brief Arithmetic right-shift function.
 APInt APInt::ashr(unsigned shiftAmt) const {
@@ -1004,17 +1067,22 @@
 /// @brief Left-shift function.
 APInt APInt::shl(unsigned shiftAmt) const {
   APInt API(*this);
-  if (shiftAmt = API.BitsNum) {
-if (API.isSingleWord()) 
-  API.VAL = 0;
-else 
-  memset(API.pVal, 0, API.getNumWords() * 8);
-  } else {
-for (unsigned i = 0; i  shiftAmt; ++i) API.clear(i);
-for (unsigned i = shiftAmt; i  API.BitsNum; ++i) {
-  if (API[i-shiftAmt]) API.set(i);
-  else API.clear(i);
+  if (API.isSingleWord())
+API.VAL = shiftAmt;
+  else if (shiftAmt = API.BitsNum)
+memset(API.pVal, 0, API.getNumWords() * 8);
+  else {
+if (unsigned offset = shiftAmt / 64) {
+  for (unsigned i = API.getNumWords() - 1; i  offset - 1; --i)
+API.pVal[i] = API.pVal[i-offset];
+  memset(API.pVal, 0, offset * 8);
 }
+shiftAmt %= 64;
+unsigned i;
+for (i = API.getNumWords() - 1; i  0; --i)
+  API.pVal[i] = (API.pVal[i]  shiftAmt) | 
+(API.pVal[i-1]  (64-shiftAmt));
+API.pVal[i] = shiftAmt;
   }
   return API;
 }



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


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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.154 - 1.155
---
Log message:

add a note


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

 README.txt |   29 +
 1 files changed, 29 insertions(+)


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.154 
llvm/lib/Target/X86/README.txt:1.155
--- llvm/lib/Target/X86/README.txt:1.154Thu Feb  8 17:53:38 2007
+++ llvm/lib/Target/X86/README.txt  Mon Feb 12 14:26:34 2007
@@ -868,3 +868,32 @@
 
 //===-===//
 
+This code:
+
+void test(int X) {
+  if (X) abort();
+}
+
+is currently compiled to (with -static):
+
+_test:
+subl $12, %esp
+cmpl $0, 16(%esp)
+jne LBB1_1  #cond_true
+addl $12, %esp
+ret
+LBB1_1: #cond_true
+call L_abort$stub
+
+It would be better to produce:
+
+_test:
+subl $12, %esp
+cmpl $0, 16(%esp)
+jne L_abort$stub
+addl $12, %esp
+ret
+
+This can be applied to any no-return function call that takes no arguments etc.
+
+//===-===//



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bit_concat.c bit_reduce.c bit_reduce.reference_output part_select.c

2007-02-12 Thread Reid Spencer


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

bit_concat.c updated: 1.1 - 1.2
bit_reduce.c updated: 1.1 - 1.2
bit_reduce.reference_output updated: 1.1 - 1.2
part_select.c updated: 1.1 - 1.2
---
Log message:

Update test programs.


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

 bit_concat.c|2 
 bit_reduce.c|   43 +++-
 bit_reduce.reference_output |  150 ++--
 part_select.c   |2 
 4 files changed, 159 insertions(+), 38 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/bit_concat.c
diff -u llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.1 
llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.2
--- llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.1   Mon Feb 12 
11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bit_concat.c   Mon Feb 12 
14:57:48 2007
@@ -21,7 +21,7 @@
 
 void printBits(ConcatType val, int numbits ) {
   int j;
-  for (j = numbits-1; j = 0; --j) {
+  for (j = numbits; j  0; --j) {
 if (__builtin_bit_select(val, j))
   printf(1);
 else


Index: llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c
diff -u llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c:1.1 
llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c:1.2
--- llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c:1.1   Mon Feb 12 
11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c   Mon Feb 12 
14:57:48 2007
@@ -16,15 +16,15 @@
 
 #ifdef ENABLE_LARGE_INTEGERS
 typedef int __attribute__((bitwidth(250))) BitType;
-const BitType X = 0xULL;
+const BitType X = 0xULL;
 int numbits = 250;
 #else
-typedef int __attribute__((bitwidth(47))) BitType;
-const BitType X = 0xULL;
-int numbits = 47;
+typedef int __attribute__((bitwidth(15))) BitType;
+const BitType X = 0xFFFULL;
+int numbits = 15;
 #endif
 
-printBits(BitType val, int numbits ) {
+void printBits(BitType val, int numbits ) {
   int j;
   for (j = numbits-1; j = 0; --j) {
 if (__builtin_bit_select(val, j))
@@ -34,6 +34,20 @@
   }
 }
 
+void showReduction(BitType Val) {
+  printf(Value=);
+  _Bool And  = __builtin_bit_and_reduce(Val);
+  _Bool Nand = __builtin_bit_nand_reduce(Val);
+  _Bool Or   = __builtin_bit_or_reduce(Val);
+  _Bool Nor  = __builtin_bit_nor_reduce(Val);
+  _Bool Xor  = __builtin_bit_xor_reduce(Val);
+  _Bool Nxor = __builtin_bit_nxor_reduce(Val);
+  printBits(Val, numbits);
+  printf(, and=%d, nand=%d, or=%d, nor=%d, xor=%d, nxor=%d\n,
+  And, Nand, Or, Nor, Xor, Nxor);
+}
+
+
 int main(int argc, char** argv)
 {
 
@@ -47,21 +61,14 @@
 
   srand(seed);
 
+  showReduction(0);
+  showReduction(1);
+  showReduction(-1);
+
   for (i = 0; i  128; i++) {
-int num = rand();
+unsigned long long num = rand();
 BitType Val = Y * num;
-{
-  unsigned char And  = __builtin_bit_and_reduce(Val);
-  unsigned char Nand = __builtin_bit_nand_reduce(Val);
-  unsigned char Or   = __builtin_bit_or_reduce(Val);
-  unsigned char Nor  = __builtin_bit_nor_reduce(Val);
-  unsigned char Xor  = __builtin_bit_xor_reduce(Val);
-  unsigned char Nxor = __builtin_bit_nxor_reduce(Val);
-  printf(Value=);
-  printBits(Val, numbits);
-  printf(, and=%d, nand=%d, or=%d, nor=%d, xor=%d, nxor=%d\n,
-  And, Nand, Or, Nor, Xor, Nxor);
-}
+showReduction(Val);
   }
   return 0;
 }


Index: llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output
diff -u 
llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output:1.1 
llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output:1.2
--- llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output:1.1
Mon Feb 12 11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output
Mon Feb 12 14:57:48 2007
@@ -1,18 +1,132 @@
-Tried to execute an unknown external function: i1 (...) * 
__builtin_bit_and_reduce
-/proj/llvm/llvm-2/Debug/bin/lli((anonymous 
namespace)::PrintStackTrace()+0x1a)[0x871c18a]
-/proj/llvm/llvm-2/Debug/bin/lli((anonymous 
namespace)::SignalHandler(int)+0x110)[0x871c4b2]
-[0x8e5420]
-/lib/libc.so.6(abort+0x101)[0x3234f1]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::callExternalFunction(llvm::Function*,
 std::vectorllvm::GenericValue, std::allocatorllvm::GenericValue  
const)+0x138)[0x845428c]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::callFunction(llvm::Function*,
 std::vectorllvm::GenericValue, std::allocatorllvm::GenericValue  
const)+0x11a)[0x844f356]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::visitCallSite(llvm::CallSite)+0x433)[0x844f9d9]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::visitCallInst(llvm::CallInst)+0x2a)[0x845a998]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::InstVisitorllvm::Interpreter, 
void::visitCall(llvm::CallInst)+0x18)[0x845a9b2]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::InstVisitorllvm::Interpreter, 

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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.155 - 1.156
---
Log message:

more notes


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

 README.txt |   29 ++---
 1 files changed, 26 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.155 
llvm/lib/Target/X86/README.txt:1.156
--- llvm/lib/Target/X86/README.txt:1.155Mon Feb 12 14:26:34 2007
+++ llvm/lib/Target/X86/README.txt  Mon Feb 12 15:20:26 2007
@@ -874,15 +874,15 @@
   if (X) abort();
 }
 
-is currently compiled to (with -static):
+is currently compiled to:
 
 _test:
 subl $12, %esp
 cmpl $0, 16(%esp)
-jne LBB1_1  #cond_true
+jne LBB1_1
 addl $12, %esp
 ret
-LBB1_1: #cond_true
+LBB1_1:
 call L_abort$stub
 
 It would be better to produce:
@@ -895,5 +895,28 @@
 ret
 
 This can be applied to any no-return function call that takes no arguments etc.
+Alternatively, the stack save/restore logic could be shrink-wrapped, producing
+something like this:
+
+_test:
+cmpl $0, 4(%esp)
+jne LBB1_1
+ret
+LBB1_1:
+subl $12, %esp
+call L_abort$stub
+
+Both are useful in different situations.  Finally, it could be shrink-wrapped
+and tail called, like this:
+
+_test:
+cmpl $0, 4(%esp)
+jne LBB1_1
+ret
+LBB1_1:
+pop %eax   # realign stack.
+call L_abort$stub
+
+Though this probably isn't worth it.
 
 //===-===//



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


[llvm-commits] [123745] Add llvm::createStripDeadPrototypesPass().

2007-02-12 Thread echeng
Revision: 123745
Author:   echeng
Date: 2007-02-12 13:27:35 -0800 (Mon, 12 Feb 2007)

Log Message:
---
Add llvm::createStripDeadPrototypesPass().

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

Modified: apple-local/branches/llvm/gcc/llvm-linker-hack.cpp
===
--- apple-local/branches/llvm/gcc/llvm-linker-hack.cpp  2007-02-12 20:54:12 UTC 
(rev 123744)
+++ apple-local/branches/llvm/gcc/llvm-linker-hack.cpp  2007-02-12 21:27:35 UTC 
(rev 123745)
@@ -76,6 +76,7 @@
   llvm::createTailCallEliminationPass();
   llvm::createDeadStoreEliminationPass();
   llvm::createIPConstantPropagationPass();
+  llvm::createStripDeadPrototypesPass();
 }
 
 /* APPLE LOCAL end LLVM (ENTIRE FILE!)  */


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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp LowerPacked.cpp ScalarReplAggregates.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.629 - 1.630
LowerPacked.cpp updated: 1.16 - 1.17
ScalarReplAggregates.cpp updated: 1.72 - 1.73
---
Log message:

stop using methods that take vectors.


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

 InstructionCombining.cpp |3 ++-
 LowerPacked.cpp  |4 ++--
 ScalarReplAggregates.cpp |   16 ++--
 3 files changed, 14 insertions(+), 9 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.629 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.630
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.629   Sat Feb 10 
19:23:03 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 12 16:56:41 2007
@@ -7832,7 +7832,8 @@
 }
 
 if (!Indices.empty())
-  return new GetElementPtrInst(SrcGEPOperands[0], Indices, GEP.getName());
+  return new GetElementPtrInst(SrcGEPOperands[0], Indices[0],
+   Indices.size(), GEP.getName());
 
   } else if (GlobalValue *GV = dyn_castGlobalValue(PtrOp)) {
 // GEP of global variable.  If all of the indices for this GEP are


Index: llvm/lib/Transforms/Scalar/LowerPacked.cpp
diff -u llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.16 
llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.17
--- llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.16 Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/Scalar/LowerPacked.cpp  Mon Feb 12 16:56:41 2007
@@ -231,7 +231,7 @@
 
 // Get the pointer
 Value* val = new GetElementPtrInst(array,
-   Idx,
+   Idx[0], Idx.size(),
LI.getName() +
.ge. + utostr(i),
LI);
@@ -329,7 +329,7 @@
 // Generate the indices for getelementptr
 Idx[1] = ConstantInt::get(Type::Int32Ty,i);
 Value* val = new GetElementPtrInst(array,
-   Idx,
+   Idx[0], Idx.size(),
store.ge. +
utostr(i) + .,
SI);


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.72 
llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.73
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.72Sat Feb 10 
19:23:03 2007
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Feb 12 16:56:41 2007
@@ -33,6 +33,7 @@
 #include llvm/Support/GetElementPtrTypeIterator.h
 #include llvm/Support/MathExtras.h
 #include llvm/Support/Compiler.h
+#include llvm/ADT/SmallVector.h
 #include llvm/ADT/Statistic.h
 #include llvm/ADT/StringExtras.h
 using namespace llvm;
@@ -224,10 +225,11 @@
 // getelement ptr instruction to finish the indexing.  This may be
 // expanded itself once the worklist is rerun.
 //
-std::vectorValue* NewArgs;
+SmallVectorValue*, 8 NewArgs;
 NewArgs.push_back(Constant::getNullValue(Type::Int32Ty));
-NewArgs.insert(NewArgs.end(), GEPI-op_begin()+3, GEPI-op_end());
-RepValue = new GetElementPtrInst(AllocaToUse, NewArgs, , GEPI);
+NewArgs.append(GEPI-op_begin()+3, GEPI-op_end());
+RepValue = new GetElementPtrInst(AllocaToUse, NewArgs[0],
+ NewArgs.size(), , GEPI);
 RepValue-takeName(GEPI);
   }
 
@@ -397,12 +399,14 @@
   
Constant::getNullValue(I.getOperand()-getType()),
  isone, GEPI);
   // Insert the new GEP instructions, which are properly indexed.
-  std::vectorValue* Indices(GEPI-op_begin()+1, GEPI-op_end());
+  SmallVectorValue*, 8 Indices(GEPI-op_begin()+1, GEPI-op_end());
   Indices[1] = Constant::getNullValue(Type::Int32Ty);
-  Value *ZeroIdx = new GetElementPtrInst(GEPI-getOperand(0), Indices,
+  Value *ZeroIdx = new GetElementPtrInst(GEPI-getOperand(0),
+ Indices[0], Indices.size(),
  GEPI-getName()+.0, GEPI);
   Indices[1] = ConstantInt::get(Type::Int32Ty, 1);
-  Value *OneIdx = new GetElementPtrInst(GEPI-getOperand(0), Indices,
+  Value *OneIdx = new GetElementPtrInst(GEPI-getOperand(0),
+Indices[0], Indices.size(),
 GEPI-getName()+.1, GEPI);
   // Replace all loads of the variable index GEP with loads from both
   // indexes and a select.



___
llvm-commits 

[llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp GlobalOpt.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

ArgumentPromotion.cpp updated: 1.36 - 1.37
GlobalOpt.cpp updated: 1.96 - 1.97
---
Log message:

stop using methods that take vectors.


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

 ArgumentPromotion.cpp |7 +--
 GlobalOpt.cpp |7 ---
 2 files changed, 9 insertions(+), 5 deletions(-)


Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.36 
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.37
--- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.36  Sat Feb 10 19:08:35 2007
+++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp   Mon Feb 12 16:56:41 2007
@@ -370,7 +370,9 @@
   // Add a parameter to the function for each element passed in.
   for (ScalarizeTable::iterator SI = ArgIndices.begin(),
  E = ArgIndices.end(); SI != E; ++SI)
-Params.push_back(GetElementPtrInst::getIndexedType(I-getType(), *SI));
+Params.push_back(GetElementPtrInst::getIndexedType(I-getType(),
+   (*SI)[0],
+   SI-size()));
 
   if (ArgIndices.size() == 1  ArgIndices.begin()-empty())
 ++NumArgumentsPromoted;
@@ -421,7 +423,8 @@
   Value *V = *AI;
   LoadInst *OrigLoad = OriginalLoads[*SI];
   if (!SI-empty()) {
-V = new GetElementPtrInst(V, *SI, V-getName()+.idx, Call);
+V = new GetElementPtrInst(V, (*SI)[0], SI-size(),
+  V-getName()+.idx, Call);
 AA.copyValue(OrigLoad-getOperand(0), V);
   }
   Args.push_back(new LoadInst(V, V-getName()+.val, Call));


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.96 
llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.97
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.96  Sat Feb 10 19:08:35 2007
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp   Mon Feb 12 16:56:41 2007
@@ -908,11 +908,12 @@
 Value *NewPtr = InsertedLoadsForPtr[FieldNo];
 
 // Create the new GEP idx vector.
-std::vectorValue* GEPIdx;
+SmallVectorValue*, 8 GEPIdx;
 GEPIdx.push_back(GEPI-getOperand(1));
-GEPIdx.insert(GEPIdx.end(), GEPI-op_begin()+3, GEPI-op_end());
+GEPIdx.append(GEPI-op_begin()+3, GEPI-op_end());
 
-Value *NGEPI = new GetElementPtrInst(NewPtr, GEPIdx, GEPI-getName(), 
GEPI);
+Value *NGEPI = new GetElementPtrInst(NewPtr, GEPIdx[0], GEPIdx.size(),
+ GEPI-getName(), GEPI);
 GEPI-replaceAllUsesWith(NGEPI);
 GEPI-eraseFromParent();
   }



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


[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerInvoke.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Utils:

LowerInvoke.cpp updated: 1.52 - 1.53
---
Log message:

stop using methods that take vectors.


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

 LowerInvoke.cpp |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp
diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.52 
llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.53
--- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.52  Sat Feb 10 19:37:51 2007
+++ llvm/lib/Transforms/Utils/LowerInvoke.cpp   Mon Feb 12 16:56:41 2007
@@ -441,7 +441,7 @@
 std::vectorValue* Idx;
 Idx.push_back(Constant::getNullValue(Type::Int32Ty));
 Idx.push_back(ConstantInt::get(Type::Int32Ty, 1));
-OldJmpBufPtr = new GetElementPtrInst(JmpBuf, Idx, OldBuf,
+OldJmpBufPtr = new GetElementPtrInst(JmpBuf, Idx[0], 2, OldBuf,
  EntryBB-getTerminator());
 
 // Copy the JBListHead to the alloca.
@@ -480,7 +480,8 @@
  setjmp.cont);
 
 Idx[1] = ConstantInt::get(Type::Int32Ty, 0);
-Value *JmpBufPtr = new GetElementPtrInst(JmpBuf, Idx, TheJmpBuf,
+Value *JmpBufPtr = new GetElementPtrInst(JmpBuf, Idx[0], Idx.size(),
+ TheJmpBuf,
  EntryBB-getTerminator());
 Value *SJRet = new CallInst(SetJmpFn, JmpBufPtr, sjret,
 EntryBB-getTerminator());
@@ -530,7 +531,7 @@
   std::vectorValue* Idx;
   Idx.push_back(Constant::getNullValue(Type::Int32Ty));
   Idx.push_back(ConstantInt::get(Type::Int32Ty, 0));
-  Idx[0] = new GetElementPtrInst(BufPtr, Idx, JmpBuf, UnwindBlock);
+  Idx[0] = new GetElementPtrInst(BufPtr, Idx[0], 2, JmpBuf, UnwindBlock);
   Idx[1] = ConstantInt::get(Type::Int32Ty, 1);
   new CallInst(LongJmpFn, Idx, , UnwindBlock);
   new UnreachableInst(UnwindBlock);



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/part_select.c part_select.reference_output

2007-02-12 Thread Reid Spencer


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

part_select.c updated: 1.2 - 1.3
part_select.reference_output updated: 1.1 - 1.2
---
Log message:

Update the part_select test case to avoid sign extension.


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

 part_select.c|   23 +++-
 part_select.reference_output |   48 +++
 2 files changed, 61 insertions(+), 10 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/part_select.c
diff -u llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.2 
llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.3
--- llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.2  Mon Feb 12 
14:57:48 2007
+++ llvm-test/SingleSource/UnitTests/Integer/part_select.c  Mon Feb 12 
17:17:34 2007
@@ -12,15 +12,16 @@
 
 #include stdio.h
 #include stdlib.h
+#include stdint.h
 
 #ifdef ENABLE_LARGE_INTEGERS
-typedef int __attribute__((bitwidth(256))) BitType;
-const BitType X = 0xULL;
-int numbits = 256;
+typedef unsigned __attribute__((bitwidth(256))) BitType;
+const BitType X = 0xFEDCBA9876543210ULL;
+unsigned numbits = 256;
 #else
-typedef int __attribute__((bitwidth(47))) BitType;
-const BitType X = 0xULL;
-int numbits = 47;
+typedef unsigned __attribute__((bitwidth(47))) BitType;
+const BitType X = 0xFEDCBA9876543210ULL;
+unsigned numbits = 47;
 #endif
 
 int main(int argc, char** argv)
@@ -34,19 +35,21 @@
 
   srand(0);
 
-  int i, j;
+  unsigned i, j;
 
-  for (i = 1; i = numbits; ++i) {
+  for (i = 0; i  numbits; ++i) {
 BitType left = rand() % numbits;
 BitType right = i;
+printf(part_select(Y, %3u, %3u) = , (unsigned)left, (unsigned)right);
 BitType Z = __builtin_bit_part_select(Y, left, right);
-printf(part_select(Y, %3d, %3d) = , (int)left, (int)right);
 for (j = numbits; j  0; --j) {
-  if (__builtin_bit_select(Z, j))
+  if (__builtin_bit_select(Z, j-1))
 printf(1);
   else
 printf(0);
 }
+uint64_t val = Z;
+printf( (%lx), val);
 printf(\n);
   }
 


Index: llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output
diff -u 
llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output:1.1 
llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output:1.2
--- llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output:1.1   
Mon Feb 12 11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output   
Mon Feb 12 17:17:34 2007
@@ -0,0 +1,48 @@
+part_select(Y,  38,   0) = 00111110110010101110011 
(76543210)
+part_select(Y,   4,   1) = 0001000 (8)
+part_select(Y,  18,   2) = 00111001100 
(10c84)
+part_select(Y,  23,   3) = 000101011100110 
(a8642)
+part_select(Y,  17,   4) = 0110011 
(321)
+part_select(Y,  26,   5) = 011001010111001 
(32a190)
+part_select(Y,  16,   6) = 00011001000 (c8)
+part_select(Y,   3,   7) = 0001000 (8)
+part_select(Y,  28,   8) = 0010110010101110010 
(165432)
+part_select(Y,  28,   9) = 0001011001010111001 
(b2a19)
+part_select(Y,  10,  10) = 000 (0)
+part_select(Y,  17,  11) = 110 (6)
+part_select(Y,  44,  12) = 001101010011111011001010111 
(a9876543)
+part_select(Y,  28,  13) = 000101100101011 
(b2a1)
+part_select(Y,   2,  14) = 1100110 
(426)
+part_select(Y,  20,  15) = 0101000 (28)
+part_select(Y,  22,  16) = 1010100 (54)
+part_select(Y,  21,  17) = 0001010 (a)
+part_select(Y,  18,  18) = 001 (1)
+part_select(Y,  36,  19) = 011111011001010 
(30eca)
+part_select(Y,  34,  20) = 11101100101 
(765)
+part_select(Y,  37,  21) = 000111110110010 
(c3b2)
+part_select(Y,  18,  22) = 0010101 (15)
+part_select(Y,  38,  23) = 01111101100 
(30ec)
+part_select(Y,  20,  24) = 0010100 (14)
+part_select(Y,   1,  25) = 011001110101001 
(2130a9)
+part_select(Y,  31,  26) = 0011101 (1d)
+part_select(Y,  17,  27) = 01010100110 
(2a6)
+part_select(Y,  20,  28) = 00101001101 
(14d)
+part_select(Y,   6,  29) = 

[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output

2007-02-12 Thread Reid Spencer


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

general-test.reference_output updated: 1.2 - 1.3
---
Log message:

Update the reference output for this test to correct the values.


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

 general-test.reference_output |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output
diff -u 
llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output:1.2 
llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output:1.3
--- llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output:1.2  
Wed Jan 17 19:31:25 2007
+++ llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output  
Mon Feb 12 17:28:28 2007
@@ -1,18 +1,18 @@
 rand = 1804289383
 argc = 2
 num  = 31415926
-val  = 6988767
+val  = -1399841
 sizeof(MyStruct) == 20
 sizeof(My17BitInt) == 4
 sizeof(j) == 2
-j = 446
-size sum is 26
+j = -66
+size sum is 167356064
 that.i4Field  = 9
 that.i12Field = 2848
 that.i17Field = 31527
-that.i37Field = 48921390
+that.i37Field = -9798866
 next.i4Field  = 15
 next.i12Field = 992
 next.i17Field = 41953
-next.i37Field = 6988770
+next.i37Field = -1399838
 exit 0



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/general-test.c general-test.reference_output

2007-02-12 Thread Reid Spencer


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

general-test.c updated: 1.6 - 1.7
general-test.reference_output updated: 1.3 - 1.4
---
Log message:

Fix a logic bug in this test.


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

 general-test.c|2 +-
 general-test.reference_output |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/general-test.c
diff -u llvm-test/SingleSource/UnitTests/Integer/general-test.c:1.6 
llvm-test/SingleSource/UnitTests/Integer/general-test.c:1.7
--- llvm-test/SingleSource/UnitTests/Integer/general-test.c:1.6 Thu Jan 25 
21:10:17 2007
+++ llvm-test/SingleSource/UnitTests/Integer/general-test.c Mon Feb 12 
17:30:47 2007
@@ -52,7 +52,7 @@
   Data2.next = Data1;
   j = num * 2;
   printf(j = %d\n, j);
-  printf(size sum is %d\n, result);
+  printf(size sum is %d\n, (int)*result);
   return Data2;
 }
 


Index: llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output
diff -u 
llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output:1.3 
llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output:1.4
--- llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output:1.3  
Mon Feb 12 17:28:28 2007
+++ llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output  
Mon Feb 12 17:30:47 2007
@@ -6,7 +6,7 @@
 sizeof(My17BitInt) == 4
 sizeof(j) == 2
 j = -66
-size sum is 167356064
+size sum is 26
 that.i4Field  = 9
 that.i12Field = 2848
 that.i17Field = 31527



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


[llvm-commits] CVS: llvm/include/llvm/Support/PatternMatch.h

2007-02-12 Thread Andrew Lenharth


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.18 - 1.19
---
Log message:

I love non-deturminism.  Returning objects with references to stack objects is 
a bad idea (TM).

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

 PatternMatch.h |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.18 
llvm/include/llvm/Support/PatternMatch.h:1.19
--- llvm/include/llvm/Support/PatternMatch.h:1.18   Thu Feb  1 20:16:21 2007
+++ llvm/include/llvm/Support/PatternMatch.hMon Feb 12 18:37:50 2007
@@ -223,19 +223,22 @@
 
 templatetypename LHS_t, typename RHS_t, typename Class, typename OpcType
 struct BinaryOpClass_match {
-  OpcType Opcode;
+  OpcType *Opcode;
   LHS_t L;
   RHS_t R;
 
   BinaryOpClass_match(OpcType Op, const LHS_t LHS,
   const RHS_t RHS)
-: Opcode(Op), L(LHS), R(RHS) {}
+: Opcode(Op), L(LHS), R(RHS) {}
+  BinaryOpClass_match(const LHS_t LHS, const RHS_t RHS)
+: Opcode(0), L(LHS), R(RHS) {}
 
   templatetypename OpTy
   bool match(OpTy *V) {
 if (Class *I = dyn_castClass(V))
   if (L.match(I-getOperand(0))  R.match(I-getOperand(1))) {
-Opcode = I-getOpcode();
+if (Opcode)
+  *Opcode = I-getOpcode();
 return true;
   }
 #if 0  // Doesn't handle constantexprs yet!
@@ -257,9 +260,8 @@
 templatetypename LHS, typename RHS
 inline BinaryOpClass_matchLHS, RHS, BinaryOperator, Instruction::BinaryOps
 m_Shift(const LHS L, const RHS R) {
-  Instruction::BinaryOps Op; 
   return BinaryOpClass_matchLHS, RHS, 
- BinaryOperator, Instruction::BinaryOps(Op, L, R);
+ BinaryOperator, Instruction::BinaryOps(L, R);
 }
 
 
//===--===//



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


[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.321 - 1.322
---
Log message:

eliminate use of methods that take vectors as args


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

 llvmAsmParser.y |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.321 
llvm/lib/AsmParser/llvmAsmParser.y:1.322
--- llvm/lib/AsmParser/llvmAsmParser.y:1.321Sun Feb 11 15:39:35 2007
+++ llvm/lib/AsmParser/llvmAsmParser.y  Mon Feb 12 18:57:40 2007
@@ -1746,7 +1746,8 @@
   GEN_ERROR(GetElementPtr requires a pointer operand);
 
 const Type *IdxTy =
-  GetElementPtrInst::getIndexedType($3-getType(), *$4, true);
+  GetElementPtrInst::getIndexedType($3-getType(), (*$4)[0], $4-size(),
+true);
 if (!IdxTy)
   GEN_ERROR(Index list invalid for constant getelementptr);
 
@@ -2859,12 +2860,12 @@
 if (!isaPointerType($2-get()))
   GEN_ERROR(getelementptr insn requires pointer operand);
 
-if (!GetElementPtrInst::getIndexedType(*$2, *$4, true))
+if (!GetElementPtrInst::getIndexedType(*$2, (*$4)[0], $4-size(), true))
   GEN_ERROR(Invalid getelementptr indices for type ' +
  (*$2)-getDescription()+ ');
 Value* tmpVal = getVal(*$2, $3);
 CHECK_FOR_ERROR
-$$ = new GetElementPtrInst(tmpVal, *$4);
+$$ = new GetElementPtrInst(tmpVal, (*$4)[0], $4-size());
 delete $2; 
 delete $4;
   };



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


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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instructions.cpp updated: 1.71 - 1.72
---
Log message:

remove some dead methods.


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

 Instructions.cpp |   33 -
 1 files changed, 8 insertions(+), 25 deletions(-)


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.71 
llvm/lib/VMCore/Instructions.cpp:1.72
--- llvm/lib/VMCore/Instructions.cpp:1.71   Thu Feb  1 20:16:22 2007
+++ llvm/lib/VMCore/Instructions.cppMon Feb 12 18:58:44 2007
@@ -196,19 +196,19 @@
   delete [] OperandList;
 }
 
-void CallInst::init(Value *Func, const std::vectorValue* Params) {
-  NumOperands = Params.size()+1;
-  Use *OL = OperandList = new Use[Params.size()+1];
+void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) {
+  NumOperands = NumParams+1;
+  Use *OL = OperandList = new Use[NumParams+1];
   OL[0].init(Func, this);
 
   const FunctionType *FTy =
 castFunctionType(castPointerType(Func-getType())-getElementType());
   FTy = FTy;  // silence warning.
 
-  assert((Params.size() == FTy-getNumParams() ||
-  (FTy-isVarArg()  Params.size()  FTy-getNumParams())) 
+  assert((NumParams == FTy-getNumParams() ||
+  (FTy-isVarArg()  NumParams  FTy-getNumParams())) 
  Calling a function with bad signature!);
-  for (unsigned i = 0, e = Params.size(); i != e; ++i) {
+  for (unsigned i = 0; i != NumParams; ++i) {
 assert((i = FTy-getNumParams() || 
 FTy-getParamType(i) == Params[i]-getType()) 
Calling a function with a bad signature!);
@@ -273,7 +273,7 @@
   : Instruction(castFunctionType(castPointerType(Func-getType())
  -getElementType())-getReturnType(),
 Instruction::Call, 0, 0, Name, InsertBefore) {
-  init(Func, Params);
+  init(Func, Params[0], Params.size());
 }
 
 CallInst::CallInst(Value *Func, const std::vectorValue* Params,
@@ -281,7 +281,7 @@
   : Instruction(castFunctionType(castPointerType(Func-getType())
  -getElementType())-getReturnType(),
 Instruction::Call, 0, 0, Name, InsertAtEnd) {
-  init(Func, Params);
+  init(Func, Params[0], Params.size());
 }
 
 CallInst::CallInst(Value *Func, Value *Actual1, Value *Actual2,
@@ -713,23 +713,6 @@
   OL[1].init(Idx, this);
 }
 
-GetElementPtrInst::GetElementPtrInst(Value *Ptr, const std::vectorValue* 
Idx,
- const std::string Name, Instruction 
*InBe)
-  : Instruction(PointerType::get(checkType(getIndexedType(Ptr-getType(),
-  Idx[0], Idx.size(), 
-  true))),
-GetElementPtr, 0, 0, Name, InBe) {
-  init(Ptr, Idx[0], Idx.size());
-}
-
-GetElementPtrInst::GetElementPtrInst(Value *Ptr, const std::vectorValue* 
Idx,
- const std::string Name, BasicBlock *IAE)
-  : Instruction(PointerType::get(checkType(getIndexedType(Ptr-getType(),
-  Idx[0], Idx.size(),
-  true))),
-GetElementPtr, 0, 0, Name, IAE) {
-  init(Ptr, Idx[0], Idx.size());
-}
 
 GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value* const *Idx,
  unsigned NumIdx,



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


[llvm-commits] CVS: llvm/include/llvm/Instructions.h

2007-02-12 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Instructions.h updated: 1.54 - 1.55
---
Log message:

remove some dead methods.


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

 Instructions.h |   11 +--
 1 files changed, 1 insertion(+), 10 deletions(-)


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.54 
llvm/include/llvm/Instructions.h:1.55
--- llvm/include/llvm/Instructions.h:1.54   Sun Feb 11 23:00:35 2007
+++ llvm/include/llvm/Instructions.hMon Feb 12 18:58:44 2007
@@ -345,10 +345,6 @@
   /// list of indices.  The first ctor can optionally insert before an existing
   /// instruction, the second appends the new instruction to the specified
   /// BasicBlock.
-  GetElementPtrInst(Value *Ptr, const std::vectorValue* Idx,
-const std::string Name = , Instruction *InsertBefore 
=0);
-  GetElementPtrInst(Value *Ptr, const std::vectorValue* Idx,
-const std::string Name, BasicBlock *InsertAtEnd);
   GetElementPtrInst(Value *Ptr, Value* const *Idx, unsigned NumIdx,
 const std::string Name = , Instruction *InsertBefore 
=0);
   GetElementPtrInst(Value *Ptr, Value* const *Idx, unsigned NumIdx,
@@ -383,11 +379,6 @@
 Value* const *Idx, unsigned NumIdx,
 bool AllowStructLeaf = false);
   
-  static const Type *getIndexedType(const Type *Ptr,
-const std::vectorValue* Indices,
-bool AllowStructLeaf = false) {
-return getIndexedType(Ptr, Indices[0], Indices.size(), AllowStructLeaf);
-  }
   static const Type *getIndexedType(const Type *Ptr, Value *Idx0, Value *Idx1,
 bool AllowStructLeaf = false);
   static const Type *getIndexedType(const Type *Ptr, Value *Idx);
@@ -698,7 +689,7 @@
 ///
 class CallInst : public Instruction {
   CallInst(const CallInst CI);
-  void init(Value *Func, const std::vectorValue* Params);
+  void init(Value *Func, Value* const *Params, unsigned NumParams);
   void init(Value *Func, Value *Actual1, Value *Actual2);
   void init(Value *Func, Value *Actual);
   void init(Value *Func);



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


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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instructions.cpp updated: 1.72 - 1.73
---
Log message:

Add invokeinst and callinst ctors that don't take vectors.


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

 Instructions.cpp |   58 ---
 1 files changed, 47 insertions(+), 11 deletions(-)


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.72 
llvm/lib/VMCore/Instructions.cpp:1.73
--- llvm/lib/VMCore/Instructions.cpp:1.72   Mon Feb 12 18:58:44 2007
+++ llvm/lib/VMCore/Instructions.cppMon Feb 12 19:04:01 2007
@@ -276,14 +276,30 @@
   init(Func, Params[0], Params.size());
 }
 
-CallInst::CallInst(Value *Func, const std::vectorValue* Params,
+CallInst::CallInst(Value *Func, Value* const *Args, unsigned NumArgs,
const std::string Name, BasicBlock *InsertAtEnd)
   : Instruction(castFunctionType(castPointerType(Func-getType())
  -getElementType())-getReturnType(),
 Instruction::Call, 0, 0, Name, InsertAtEnd) {
+  init(Func, Args, NumArgs);
+}
+CallInst::CallInst(Value *Func, Value* const *Args, unsigned NumArgs,
+   const std::string Name, Instruction *InsertBefore)
+: Instruction(castFunctionType(castPointerType(Func-getType())
+ -getElementType())-getReturnType(),
+  Instruction::Call, 0, 0, Name, InsertBefore) {
+  init(Func, Args, NumArgs);
+}
+
+CallInst::CallInst(Value *Func, const std::vectorValue* Params,
+   const std::string Name, BasicBlock *InsertAtEnd)
+: Instruction(castFunctionType(castPointerType(Func-getType())
+ -getElementType())-getReturnType(),
+  Instruction::Call, 0, 0, Name, InsertAtEnd) {
   init(Func, Params[0], Params.size());
 }
 
+
 CallInst::CallInst(Value *Func, Value *Actual1, Value *Actual2,
const std::string Name, Instruction  *InsertBefore)
   : Instruction(castFunctionType(castPointerType(Func-getType())
@@ -352,9 +368,9 @@
 }
 
 void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
-  const std::vectorValue* Params) {
-  NumOperands = 3+Params.size();
-  Use *OL = OperandList = new Use[3+Params.size()];
+  Value* const *Args, unsigned NumArgs) {
+  NumOperands = 3+NumArgs;
+  Use *OL = OperandList = new Use[3+NumArgs];
   OL[0].init(Fn, this);
   OL[1].init(IfNormal, this);
   OL[2].init(IfException, this);
@@ -362,27 +378,47 @@
 castFunctionType(castPointerType(Fn-getType())-getElementType());
   FTy = FTy;  // silence warning.
 
-  assert((Params.size() == FTy-getNumParams()) ||
- (FTy-isVarArg()  Params.size()  FTy-getNumParams()) 
+  assert((NumArgs == FTy-getNumParams()) ||
+ (FTy-isVarArg()  NumArgs  FTy-getNumParams()) 
  Calling a function with bad signature);
 
-  for (unsigned i = 0, e = Params.size(); i != e; i++) {
+  for (unsigned i = 0, e = NumArgs; i != e; i++) {
 assert((i = FTy-getNumParams() || 
-FTy-getParamType(i) == Params[i]-getType()) 
+FTy-getParamType(i) == Args[i]-getType()) 
Invoking a function with a bad signature!);
 
-OL[i+3].init(Params[i], this);
+OL[i+3].init(Args[i], this);
   }
 }
 
 InvokeInst::InvokeInst(Value *Fn, BasicBlock *IfNormal,
BasicBlock *IfException,
+   Value* const *Args, unsigned NumArgs,
+   const std::string Name, Instruction *InsertBefore)
+  : TerminatorInst(castFunctionType(castPointerType(Fn-getType())
+-getElementType())-getReturnType(),
+   Instruction::Invoke, 0, 0, Name, InsertBefore) {
+  init(Fn, IfNormal, IfException, Args, NumArgs);
+}
+
+InvokeInst::InvokeInst(Value *Fn, BasicBlock *IfNormal,
+   BasicBlock *IfException,
+   Value* const *Args, unsigned NumArgs,
+   const std::string Name, BasicBlock *InsertAtEnd)
+  : TerminatorInst(castFunctionType(castPointerType(Fn-getType())
+-getElementType())-getReturnType(),
+   Instruction::Invoke, 0, 0, Name, InsertAtEnd) {
+  init(Fn, IfNormal, IfException, Args, NumArgs);
+}
+
+InvokeInst::InvokeInst(Value *Fn, BasicBlock *IfNormal,
+   BasicBlock *IfException,
const std::vectorValue* Params,
const std::string Name, Instruction *InsertBefore)
   : TerminatorInst(castFunctionType(castPointerType(Fn-getType())
 -getElementType())-getReturnType(),
Instruction::Invoke, 0, 0, Name, InsertBefore) {
-  init(Fn, IfNormal, IfException, Params);
+  init(Fn, IfNormal, IfException, Params[0], Params.size());
 }
 
 InvokeInst::InvokeInst(Value *Fn, BasicBlock *IfNormal,
@@ -392,7 +428,7 @@
   : 

[llvm-commits] CVS: llvm/include/llvm/Instructions.h

2007-02-12 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Instructions.h updated: 1.55 - 1.56
---
Log message:

Add invokeinst and callinst ctors that don't take vectors.


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

 Instructions.h |   13 -
 1 files changed, 12 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.55 
llvm/include/llvm/Instructions.h:1.56
--- llvm/include/llvm/Instructions.h:1.55   Mon Feb 12 18:58:44 2007
+++ llvm/include/llvm/Instructions.hMon Feb 12 19:04:01 2007
@@ -695,6 +695,11 @@
   void init(Value *Func);
 
 public:
+  CallInst(Value *F, Value* const *Args, unsigned NumArgs,
+   const std::string Name = , Instruction *InsertBefore = 0);
+  CallInst(Value *F, Value *const *Args, unsigned NumArgs,
+   const std::string Name, BasicBlock *InsertAtEnd);
+  
   CallInst(Value *F, const std::vectorValue* Par,
const std::string Name = , Instruction *InsertBefore = 0);
   CallInst(Value *F, const std::vectorValue* Par,
@@ -1479,7 +1484,7 @@
 class InvokeInst : public TerminatorInst {
   InvokeInst(const InvokeInst BI);
   void init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
-const std::vectorValue* Params);
+Value* const *Args, unsigned NumArgs);
 public:
   InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
  const std::vectorValue* Params, const std::string Name = ,
@@ -1487,6 +1492,12 @@
   InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
  const std::vectorValue* Params, const std::string Name,
  BasicBlock *InsertAtEnd);
+  InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
+ Value* const* Args, unsigned NumArgs, const std::string Name = 
,
+ Instruction *InsertBefore = 0);
+  InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
+ Value* const* Args, unsigned NumArgs, const std::string Name,
+ BasicBlock *InsertAtEnd);
   ~InvokeInst();
 
   virtual InvokeInst *clone() const;



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


[llvm-commits] CVS: llvm/test/CodeGen/Generic/switch-lower.ll

2007-02-12 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/Generic:

switch-lower.ll added (r1.1)
---
Log message:

new testcase for PR1197: http://llvm.org/PR1197 


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

 switch-lower.ll |  335 
 1 files changed, 335 insertions(+)


Index: llvm/test/CodeGen/Generic/switch-lower.ll
diff -c /dev/null llvm/test/CodeGen/Generic/switch-lower.ll:1.1
*** /dev/null   Mon Feb 12 19:05:20 2007
--- llvm/test/CodeGen/Generic/switch-lower.ll   Mon Feb 12 19:05:10 2007
***
*** 0 
--- 1,335 
+ ; RUN: llvm-as  %s | llc
+ ; PR1197
+ 
+ implementation   ; Functions:
+ 
+ define void @exp_attr__expand_n_attribute_reference() {
+ entry:
+   br i1 false, label %cond_next954, label %cond_true924
+ 
+ cond_true924: ; preds = %entry
+   ret void
+ 
+ cond_next954: ; preds = %entry
+   switch i8 0, label %cleanup7419 [
+i8 1, label %bb956
+i8 2, label %bb1069
+i8 4, label %bb7328
+i8 5, label %bb1267
+i8 8, label %bb1348
+i8 9, label %bb7328
+i8 11, label %bb1439
+i8 12, label %bb1484
+i8 13, label %bb1706
+i8 14, label %bb1783
+i8 17, label %bb1925
+i8 18, label %bb1929
+i8 19, label %bb2240
+i8 25, label %bb2447
+i8 27, label %bb2480
+i8 29, label %bb2590
+i8 30, label %bb2594
+i8 31, label %bb2621
+i8 32, label %bb2664
+i8 33, label %bb2697
+i8 34, label %bb2735
+i8 37, label %bb2786
+i8 38, label %bb2849
+i8 39, label %bb3269
+i8 41, label %bb3303
+i8 42, label %bb3346
+i8 43, label %bb3391
+i8 44, label %bb3395
+i8 50, label %bb3673
+i8 52, label %bb3677
+i8 53, label %bb3693
+i8 54, label %bb7328
+i8 56, label %bb3758
+i8 57, label %bb3787
+i8 64, label %bb5019
+i8 68, label %cond_true4235
+i8 69, label %bb4325
+i8 70, label %bb4526
+i8 72, label %bb4618
+i8 73, label %bb4991
+i8 80, label %bb5012
+i8 82, label %bb5019
+i8 84, label %bb5518
+i8 86, label %bb5752
+i8 87, label %bb5953
+i8 89, label %bb6040
+i8 90, label %bb6132
+i8 92, label %bb6186
+i8 93, label %bb6151
+i8 94, label %bb6155
+i8 97, label %bb6355
+i8 98, label %bb5019
+i8 99, label %bb6401
+i8 101, label %bb5019
+i8 102, label %bb1484
+i8 104, label %bb7064
+i8 105, label %bb7068
+i8 106, label %bb7072
+i8 108, label %bb1065
+i8 109, label %bb1702
+i8 110, label %bb2200
+i8 111, label %bb2731
+i8 112, label %bb2782
+i8 113, label %bb2845
+i8 114, label %bb2875
+i8 115, label %bb3669
+i8 116, label %bb7316
+i8 117, label %bb7316
+i8 118, label %bb3875
+i8 119, label %bb4359
+i8 120, label %bb4987
+i8 121, label %bb5008
+i8 122, label %bb5786
+i8 123, label %bb6147
+i8 124, label %bb6916
+i8 125, label %bb6920
+i8 126, label %bb6955
+i8 127, label %bb6990
+i8 -128, label %bb7027
+i8 -127, label %bb3879
+i8 -126, label %bb4700
+i8 -125, label %bb7076
+i8 -124, label %bb2366
+i8 -123, label %bb2366
+i8 -122, label %bb5490
+   ]
+ 
+ bb956:; preds = %cond_next954
+   ret void
+ 
+ bb1065:   ; preds = %cond_next954
+   ret void
+ 
+ bb1069:   ; preds = %cond_next954
+   ret void
+ 
+ bb1267:   ; preds = %cond_next954
+   ret void
+ 
+ bb1348:   ; preds = %cond_next954
+   ret void
+ 
+ bb1439:   ; preds = %cond_next954
+   ret void
+ 
+ bb1484:   ; preds = %cond_next954, %cond_next954
+   ret void
+ 
+ bb1702:   ; preds = %cond_next954
+   ret void
+ 
+ bb1706:   ; preds = %cond_next954
+   ret void
+ 
+ bb1783:   ; preds = %cond_next954
+   ret void
+ 
+ bb1925:   ; preds = %cond_next954
+   ret void
+ 
+ bb1929:   ; 

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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.360 - 1.361
---
Log message:

Fix switch lowering to order cases in zext order, which is how we emit the
comparisons.  This fixes an infinite loop on CodeGen/Generic/switch-lower.ll
and PR1197: http://llvm.org/PR1197 


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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.360 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.361
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.360Sat Feb 10 
13:55:17 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Mon Feb 12 19:05:56 2007
@@ -389,8 +389,8 @@
   struct CaseCmp {
 bool operator () (const Case C1, const Case C2) {
   assert(isaConstantInt(C1.first)  isaConstantInt(C2.first));
-  return castconst ConstantInt(C1.first)-getSExtValue() 
-castconst ConstantInt(C2.first)-getSExtValue();
+  return castconst ConstantInt(C1.first)-getZExtValue() 
+castconst ConstantInt(C2.first)-getZExtValue();
 }
   };
   



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


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

2007-02-12 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.204 - 1.205
LiveVariables.cpp updated: 1.64 - 1.65
---
Log message:

Allow any MachineBasicBlock (not just the entry block) to have live-in physical
registers. Make sure liveinterval analysis is correctly creating live ranges
for them.

---
Diffs of the changes:  (+41 -47)

 LiveIntervalAnalysis.cpp |   72 +--
 LiveVariables.cpp|   16 +-
 2 files changed, 41 insertions(+), 47 deletions(-)


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.204 
llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.205
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.204 Tue Dec 19 16:41:21 2006
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp   Mon Feb 12 19:30:55 2007
@@ -88,28 +88,6 @@
   allocatableRegs_ = mri_-getAllocatableSet(fn);
   r2rMap_.grow(mf_-getSSARegMap()-getLastVirtReg());
 
-  // If this function has any live ins, insert a dummy instruction at the
-  // beginning of the function that we will pretend defines the values.  This
-  // is to make the interval analysis simpler by providing a number.
-  if (fn.livein_begin() != fn.livein_end()) {
-unsigned FirstLiveIn = fn.livein_begin()-first;
-
-// Find a reg class that contains this live in.
-const TargetRegisterClass *RC = 0;
-for (MRegisterInfo::regclass_iterator RCI = mri_-regclass_begin(),
-   E = mri_-regclass_end(); RCI != E; ++RCI)
-  if ((*RCI)-contains(FirstLiveIn)) {
-RC = *RCI;
-break;
-  }
-
-MachineInstr *OldFirstMI = fn.begin()-begin();
-mri_-copyRegToReg(*fn.begin(), fn.begin()-begin(),
-   FirstLiveIn, FirstLiveIn, RC);
-assert(OldFirstMI != fn.begin()-begin() 
-   copyRetToReg didn't insert anything!);
-  }
-
   // Number MachineInstrs and MachineBasicBlocks.
   // Initialize MBB indexes to a sentinal.
   MBB2IdxMap.resize(mf_-getNumBlockIDs(), ~0U);
@@ -119,6 +97,28 @@
MBB != E; ++MBB) {
 // Set the MBB2IdxMap entry for this MBB.
 MBB2IdxMap[MBB-getNumber()] = MIIndex;
+
+// If this BB has any live ins, insert a dummy instruction at the
+// beginning of the function that we will pretend defines the values. 
This
+// is to make the interval analysis simpler by providing a number.
+if (MBB-livein_begin() != MBB-livein_end()) {
+  unsigned FirstLiveIn = *MBB-livein_begin();
+
+  // Find a reg class that contains this live in.
+  const TargetRegisterClass *RC = 0;
+  for (MRegisterInfo::regclass_iterator RCI = mri_-regclass_begin(),
+ RCE = mri_-regclass_end(); RCI != RCE; ++RCI)
+if ((*RCI)-contains(FirstLiveIn)) {
+  RC = *RCI;
+  break;
+}
+
+  MachineInstr *OldFirstMI = MBB-begin();
+  mri_-copyRegToReg(*MBB, MBB-begin(),
+ FirstLiveIn, FirstLiveIn, RC);
+  assert(OldFirstMI != MBB-begin() 
+ copyRetToReg didn't insert anything!);
+}
 
 for (MachineBasicBlock::iterator I = MBB-begin(), E = MBB-end();
  I != E; ++I) {
@@ -129,19 +129,6 @@
 }
   }
 
-  // Note intervals due to live-in values.
-  if (fn.livein_begin() != fn.livein_end()) {
-MachineBasicBlock *Entry = fn.begin();
-for (MachineFunction::livein_iterator I = fn.livein_begin(),
-   E = fn.livein_end(); I != E; ++I) {
-  handlePhysicalRegisterDef(Entry, Entry-begin(), 0,
-getOrCreateInterval(I-first), 0);
-  for (const unsigned* AS = mri_-getAliasSet(I-first); *AS; ++AS)
-handlePhysicalRegisterDef(Entry, Entry-begin(), 0,
-  getOrCreateInterval(*AS), 0);
-}
-  }
-
   computeIntervals();
 
   numIntervals += getNumIntervals();
@@ -691,8 +678,6 @@
   DOUT  ** COMPUTING LIVE INTERVALS **\n
 ** Function: 
 ((Value*)mf_-getFunction())-getName()  '\n';
-  bool IgnoreFirstInstr = mf_-livein_begin() != mf_-livein_end();
-
   // Track the index of the current machine instr.
   unsigned MIIndex = 0;
   for (MachineFunction::iterator MBBI = mf_-begin(), E = mf_-end();
@@ -701,9 +686,18 @@
 DOUT  ((Value*)MBB-getBasicBlock())-getName()  :\n;
 
 MachineBasicBlock::iterator MI = MBB-begin(), miEnd = MBB-end();
-if (IgnoreFirstInstr) {
+
+if (MBB-livein_begin() != MBB-livein_end()) {
+  // Process live-ins to this BB first.
+  for (MachineBasicBlock::livein_iterator LI = MBB-livein_begin(),
+ LE = MBB-livein_end(); LI != LE; ++LI) {
+handlePhysicalRegisterDef(MBB, MBB-begin(), MIIndex,
+  getOrCreateInterval(*LI), 0);
+for (const unsigned* AS = mri_-getAliasSet(*LI); *AS; ++AS)
+  handlePhysicalRegisterDef(MBB, MBB-begin(), MIIndex,
+getOrCreateInterval(*AS), 0);
+  }
   ++MI;
-  IgnoreFirstInstr = 

[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.236 - 1.237
---
Log message:

stop passing vector into ctors


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

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


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.236 
llvm/lib/Bytecode/Reader/Reader.cpp:1.237
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.236   Mon Feb 12 12:53:43 2007
+++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Feb 12 19:53:54 2007
@@ -702,7 +702,7 @@
   Params.push_back(getValue(Oprnds[i], Oprnds[i+1]));
   }
 
-  Result = new CallInst(F, Params);
+  Result = new CallInst(F, Params[0], Params.size());
   if (isTailCall) castCallInst(Result)-setTailCall();
   if (CallingConv) castCallInst(Result)-setCallingConv(CallingConv);
   break;
@@ -756,7 +756,7 @@
   Params.push_back(getValue(Oprnds[i], Oprnds[i+1]));
   }
 
-  Result = new InvokeInst(F, Normal, Except, Params);
+  Result = new InvokeInst(F, Normal, Except, Params[0], Params.size());
   if (CallingConv) castInvokeInst(Result)-setCallingConv(CallingConv);
   break;
 }



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


[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Instrumentation:

ProfilingUtils.cpp updated: 1.14 - 1.15
---
Log message:

Eliminate use of ctors that take vectors.


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

 ProfilingUtils.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.14 
llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.15
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.14 Sun Jan  7 
01:22:20 2007
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp  Mon Feb 12 
20:10:56 2007
@@ -53,7 +53,8 @@
   }
   Args[3] = ConstantInt::get(Type::Int32Ty, NumElements);
 
-  Instruction *InitCall = new CallInst(InitFn, Args, newargc, InsertPos);
+  Instruction *InitCall = new CallInst(InitFn, Args[0], Args.size(),
+   newargc, InsertPos);
 
   // If argc or argv are not available in main, just pass null values in.
   Function::arg_iterator AI;



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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp DeadArgumentElimination.cpp LowerSetJmp.cpp PruneEH.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

ArgumentPromotion.cpp updated: 1.37 - 1.38
DeadArgumentElimination.cpp updated: 1.39 - 1.40
LowerSetJmp.cpp updated: 1.39 - 1.40
PruneEH.cpp updated: 1.30 - 1.31
---
Log message:

Eliminate use of ctors that take vectors.


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

 ArgumentPromotion.cpp   |   11 ++-
 DeadArgumentElimination.cpp |8 
 LowerSetJmp.cpp |   34 ++
 PruneEH.cpp |6 +++---
 4 files changed, 27 insertions(+), 32 deletions(-)


Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.37 
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.38
--- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.37  Mon Feb 12 16:56:41 2007
+++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp   Mon Feb 12 20:10:56 2007
@@ -161,7 +161,8 @@
 static bool AllCalleesPassInValidPointerForArgument(Argument *Arg) {
   Function *Callee = Arg-getParent();
 
-  unsigned ArgNo = std::distance(Callee-arg_begin(), 
Function::arg_iterator(Arg));
+  unsigned ArgNo = std::distance(Callee-arg_begin(),
+ Function::arg_iterator(Arg));
 
   // Look at all call sites of the function.  At this pointer we know we only
   // have direct callees.
@@ -442,10 +443,10 @@
 Instruction *New;
 if (InvokeInst *II = dyn_castInvokeInst(Call)) {
   New = new InvokeInst(NF, II-getNormalDest(), II-getUnwindDest(),
-   Args, , Call);
+   Args[0], Args.size(), , Call);
   castInvokeInst(New)-setCallingConv(CS.getCallingConv());
 } else {
-  New = new CallInst(NF, Args, , Call);
+  New = new CallInst(NF, Args[0], Args.size(), , Call);
   castCallInst(New)-setCallingConv(CS.getCallingConv());
   if (castCallInst(Call)-isTailCall())
 castCallInst(New)-setTailCall();
@@ -474,8 +475,8 @@
   // Loop over the argument list, transfering uses of the old arguments over to
   // the new arguments, also transfering over the names as well.
   //
-  for (Function::arg_iterator I = F-arg_begin(), E = F-arg_end(), I2 = 
NF-arg_begin();
-   I != E; ++I)
+  for (Function::arg_iterator I = F-arg_begin(), E = F-arg_end(),
+   I2 = NF-arg_begin(); I != E; ++I)
 if (!ArgsToPromote.count(I)) {
   // If this is an unmodified argument, move the name and users over to the
   // new version.


Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.39 
llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.40
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.39Sat Feb 10 
19:08:35 2007
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Mon Feb 12 20:10:56 2007
@@ -169,10 +169,10 @@
 Instruction *New;
 if (InvokeInst *II = dyn_castInvokeInst(Call)) {
   New = new InvokeInst(NF, II-getNormalDest(), II-getUnwindDest(),
-   Args, , Call);
+   Args[0], Args.size(), , Call);
   castInvokeInst(New)-setCallingConv(CS.getCallingConv());
 } else {
-  New = new CallInst(NF, Args, , Call);
+  New = new CallInst(NF, Args[0], Args.size(), , Call);
   castCallInst(New)-setCallingConv(CS.getCallingConv());
   if (castCallInst(Call)-isTailCall())
 castCallInst(New)-setTailCall();
@@ -535,10 +535,10 @@
 Instruction *New;
 if (InvokeInst *II = dyn_castInvokeInst(Call)) {
   New = new InvokeInst(NF, II-getNormalDest(), II-getUnwindDest(),
-   Args, , Call);
+   Args[0], Args.size(), , Call);
   castInvokeInst(New)-setCallingConv(CS.getCallingConv());
 } else {
-  New = new CallInst(NF, Args, , Call);
+  New = new CallInst(NF, Args[0], Args.size(), , Call);
   castCallInst(New)-setCallingConv(CS.getCallingConv());
   if (castCallInst(Call)-isTailCall())
 castCallInst(New)-setTailCall();


Index: llvm/lib/Transforms/IPO/LowerSetJmp.cpp
diff -u llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.39 
llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.40
--- llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.39Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/IPO/LowerSetJmp.cpp Mon Feb 12 20:10:56 2007
@@ -259,8 +259,7 @@
   // Inst's uses and doesn't get a name.
   CastInst* CI = 
 new BitCastInst(Inst-getOperand(1), SBPTy, LJBuf, Inst);
-  new CallInst(ThrowLongJmp, make_vectorValue*(CI, Inst-getOperand(2), 0),
-   , Inst);
+  new CallInst(ThrowLongJmp, CI, Inst-getOperand(2), , Inst);
 
   SwitchValuePair SVP = SwitchValMap[Inst-getParent()-getParent()];
 
@@ -303,7 +302,7 @@
   // Fill in the alloca and call to initialize the SJ map.
   const Type *SBPTy = PointerType::get(Type::Int8Ty);
   AllocaInst* Map = new AllocaInst(SBPTy, 0, SJMap, Inst);
-  new CallInst(InitSJMap, make_vectorValue*(Map, 0), , Inst);
+  new 

[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp InstructionCombining.cpp LowerGC.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

ADCE.cpp updated: 1.103 - 1.104
InstructionCombining.cpp updated: 1.630 - 1.631
LowerGC.cpp updated: 1.21 - 1.22
---
Log message:

Eliminate use of ctors that take vectors.


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

 ADCE.cpp |5 +++--
 InstructionCombining.cpp |4 ++--
 LowerGC.cpp  |6 +++---
 3 files changed, 8 insertions(+), 7 deletions(-)


Index: llvm/lib/Transforms/Scalar/ADCE.cpp
diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.103 
llvm/lib/Transforms/Scalar/ADCE.cpp:1.104
--- llvm/lib/Transforms/Scalar/ADCE.cpp:1.103   Sat Feb 10 19:23:03 2007
+++ llvm/lib/Transforms/Scalar/ADCE.cpp Mon Feb 12 20:10:56 2007
@@ -25,6 +25,7 @@
 #include llvm/Transforms/Utils/UnifyFunctionExitNodes.h
 #include llvm/Support/Debug.h
 #include llvm/ADT/DepthFirstIterator.h
+#include llvm/ADT/SmallVector.h
 #include llvm/ADT/Statistic.h
 #include llvm/ADT/STLExtras.h
 #include llvm/Support/Compiler.h
@@ -188,8 +189,8 @@
 if (AA.onlyReadsMemory(F)) {
   // The function cannot unwind.  Convert it to a call with a branch
   // after it to the normal destination.
-  std::vectorValue* Args(II-op_begin()+3, II-op_end());
-  CallInst *NewCall = new CallInst(F, Args, , II);
+  SmallVectorValue*, 8 Args(II-op_begin()+3, II-op_end());
+  CallInst *NewCall = new CallInst(F, Args[0], Args.size(), , II);
   NewCall-takeName(II);
   NewCall-setCallingConv(II-getCallingConv());
   II-replaceAllUsesWith(NewCall);


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.630 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.631
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.630   Mon Feb 12 
16:56:41 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 12 20:10:56 2007
@@ -7352,10 +7352,10 @@
   Instruction *NC;
   if (InvokeInst *II = dyn_castInvokeInst(Caller)) {
 NC = new InvokeInst(Callee, II-getNormalDest(), II-getUnwindDest(),
-Args, Caller-getName(), Caller);
+Args[0], Args.size(), Caller-getName(), Caller);
 castInvokeInst(II)-setCallingConv(II-getCallingConv());
   } else {
-NC = new CallInst(Callee, Args, Caller-getName(), Caller);
+NC = new CallInst(Callee, Args[0], Args.size(), Caller-getName(), 
Caller);
 if (castCallInst(Caller)-isTailCall())
   castCallInst(NC)-setTailCall();

castCallInst(NC)-setCallingConv(castCallInst(Caller)-getCallingConv());


Index: llvm/lib/Transforms/Scalar/LowerGC.cpp
diff -u llvm/lib/Transforms/Scalar/LowerGC.cpp:1.21 
llvm/lib/Transforms/Scalar/LowerGC.cpp:1.22
--- llvm/lib/Transforms/Scalar/LowerGC.cpp:1.21 Mon Feb  5 15:19:13 2007
+++ llvm/lib/Transforms/Scalar/LowerGC.cpp  Mon Feb 12 20:10:56 2007
@@ -314,10 +314,10 @@
   NewBB-getInstList().remove(CI);
 
   // Create a new invoke instruction.
+  std::vectorValue* Args(CI-op_begin()+1, CI-op_end());
+
   Value *II = new InvokeInst(CI-getCalledValue(), NewBB, Cleanup,
- std::vectorValue*(CI-op_begin()+1,
- CI-op_end()),
- CI-getName(), CBB);
+ Args[0], Args.size(), CI-getName(), CBB);
   CI-replaceAllUsesWith(II);
   delete CI;
 }



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


[llvm-commits] CVS: llvm/lib/Transforms/Utils/CodeExtractor.cpp InlineFunction.cpp LowerInvoke.cpp SimplifyCFG.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Utils:

CodeExtractor.cpp updated: 1.49 - 1.50
InlineFunction.cpp updated: 1.52 - 1.53
LowerInvoke.cpp updated: 1.53 - 1.54
SimplifyCFG.cpp updated: 1.116 - 1.117
---
Log message:

Eliminate use of ctors that take vectors.


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

 CodeExtractor.cpp  |2 +-
 InlineFunction.cpp |4 +++-
 LowerInvoke.cpp|   24 
 SimplifyCFG.cpp|   12 +++-
 4 files changed, 23 insertions(+), 19 deletions(-)


Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.49 
llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.50
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.49Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Mon Feb 12 20:10:56 2007
@@ -403,7 +403,7 @@
   }
 
   // Emit the call to the function
-  CallInst *call = new CallInst(newFunction, params,
+  CallInst *call = new CallInst(newFunction, params[0], params.size(),
 NumExitBlocks  1 ? targetBlock : );
   codeReplacer-getInstList().push_back(call);
 


Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.52 
llvm/lib/Transforms/Utils/InlineFunction.cpp:1.53
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.52   Fri Feb  2 18:08:31 2007
+++ llvm/lib/Transforms/Utils/InlineFunction.cppMon Feb 12 20:10:56 2007
@@ -19,6 +19,7 @@
 #include llvm/Instructions.h
 #include llvm/Intrinsics.h
 #include llvm/Analysis/CallGraph.h
+#include llvm/ADT/SmallVector.h
 #include llvm/Support/CallSite.h
 using namespace llvm;
 
@@ -80,9 +81,10 @@
   
   // Next, create the new invoke instruction, inserting it at the end
   // of the old basic block.
+  SmallVectorValue*, 8 InvokeArgs(CI-op_begin()+1, CI-op_end());
   InvokeInst *II =
 new InvokeInst(CI-getCalledValue(), Split, InvokeDest,
-   std::vectorValue*(CI-op_begin()+1, CI-op_end()),
+   InvokeArgs[0], InvokeArgs.size(),
CI-getName(), BB-getTerminator());
   II-setCallingConv(CI-getCallingConv());
   


Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp
diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.53 
llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.54
--- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.53  Mon Feb 12 16:56:41 2007
+++ llvm/lib/Transforms/Utils/LowerInvoke.cpp   Mon Feb 12 20:10:56 2007
@@ -189,21 +189,21 @@
 createAbortMessage(IB-getParent()-getParent()-getParent());
 
   // These are the arguments we WANT...
-  std::vectorValue* Args;
-  Args.push_back(ConstantInt::get(Type::Int32Ty, 2));
-  Args.push_back(AbortMessage);
-  Args.push_back(ConstantInt::get(Type::Int32Ty, AbortMessageLength));
-  (new CallInst(WriteFn, Args, , IB))-setTailCall();
+  Value* Args[3];
+  Args[0] = ConstantInt::get(Type::Int32Ty, 2);
+  Args[1] = AbortMessage;
+  Args[2] = ConstantInt::get(Type::Int32Ty, AbortMessageLength);
+  (new CallInst(WriteFn, Args, 3, , IB))-setTailCall();
 }
 
 bool LowerInvoke::insertCheapEHSupport(Function F) {
   bool Changed = false;
   for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
 if (InvokeInst *II = dyn_castInvokeInst(BB-getTerminator())) {
+  std::vectorValue* CallArgs(II-op_begin()+3, II-op_end());
   // Insert a normal call instruction...
   CallInst *NewCall = new CallInst(II-getCalledValue(),
-   std::vectorValue*(II-op_begin()+3,
-   II-op_end()), , II);
+   CallArgs[0], CallArgs.size(), , II);
   NewCall-takeName(II);
   NewCall-setCallingConv(II-getCallingConv());
   II-replaceAllUsesWith(NewCall);
@@ -223,7 +223,7 @@
   writeAbortMessage(UI);
 
   // Insert a call to abort()
-  (new CallInst(AbortFn, std::vectorValue*(), , UI))-setTailCall();
+  (new CallInst(AbortFn, , UI))-setTailCall();
 
   // Insert a return instruction.  This really should be a barrier, as it
   // is unreachable.
@@ -258,9 +258,9 @@
   CatchSwitch-addCase(InvokeNoC, II-getUnwindDest());
   
   // Insert a normal call instruction.
+  std::vectorValue* CallArgs(II-op_begin()+3, II-op_end());
   CallInst *NewCall = new CallInst(II-getCalledValue(),
-   std::vectorValue*(II-op_begin()+3,
-   II-op_end()), ,
+   CallArgs[0], CallArgs.size(), ,
II);
   NewCall-takeName(II);
   NewCall-setCallingConv(II-getCallingConv());
@@ -533,7 +533,7 @@
   Idx.push_back(ConstantInt::get(Type::Int32Ty, 0));
   Idx[0] = new GetElementPtrInst(BufPtr, Idx[0], 2, JmpBuf, UnwindBlock);
   Idx[1] = ConstantInt::get(Type::Int32Ty, 1);
-  new CallInst(LongJmpFn, Idx, , 

Re: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

2007-02-12 Thread Reid Spencer
Chris,

I have a question ..

On Mon, 2007-02-12 at 19:54 -0600, Chris Lattner wrote:
 
 Changes in directory llvm/lib/Bytecode/Reader:
 
 Reader.cpp updated: 1.236 - 1.237
 ---
 Log message:
 
 stop passing vector into ctors
 
 
 ---
 Diffs of the changes:  (+2 -2)
 
  Reader.cpp |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 
 Index: llvm/lib/Bytecode/Reader/Reader.cpp
 diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.236 
 llvm/lib/Bytecode/Reader/Reader.cpp:1.237
 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.236 Mon Feb 12 12:53:43 2007
 +++ llvm/lib/Bytecode/Reader/Reader.cpp   Mon Feb 12 19:53:54 2007
 @@ -702,7 +702,7 @@
Params.push_back(getValue(Oprnds[i], Oprnds[i+1]));
}
  
 -  Result = new CallInst(F, Params);
 +  Result = new CallInst(F, Params[0], Params.size());

I don't see why this series of changes is better for performance. The
Constructor is currently defined as:

CallInst(Value *F, const std::vectorValue* Par,
 const std::string Name = , Instruction *InsertBefore = 0);

Because Par is a reference to a const std::vectorValue* there should
be no copying of the vector when the argument is passed. It would just
pass the pointer implied by the reference. Your change makes it pass two
arguments, which can't be faster. 

Is there something I'm missing here?

Reid.

if (isTailCall) castCallInst(Result)-setTailCall();
if (CallingConv) castCallInst(Result)-setCallingConv(CallingConv);
break;
 @@ -756,7 +756,7 @@
Params.push_back(getValue(Oprnds[i], Oprnds[i+1]));
}
  
 -  Result = new InvokeInst(F, Normal, Except, Params);
 +  Result = new InvokeInst(F, Normal, Except, Params[0], Params.size());
if (CallingConv) castInvokeInst(Result)-setCallingConv(CallingConv);
break;
  }
 
 
 
 ___
 llvm-commits mailing list
 llvm-commits@cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


[llvm-commits] CVS: llvm-stacker/lib/compiler/StackerCompiler.cpp

2007-02-12 Thread Reid Spencer


Changes in directory llvm-stacker/lib/compiler:

StackerCompiler.cpp updated: 1.33 - 1.34
---
Log message:

Update for recent interface changes in GEP constructor.


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

 StackerCompiler.cpp |   21 -
 1 files changed, 12 insertions(+), 9 deletions(-)


Index: llvm-stacker/lib/compiler/StackerCompiler.cpp
diff -u llvm-stacker/lib/compiler/StackerCompiler.cpp:1.33 
llvm-stacker/lib/compiler/StackerCompiler.cpp:1.34
--- llvm-stacker/lib/compiler/StackerCompiler.cpp:1.33  Mon Feb  5 15:20:45 2007
+++ llvm-stacker/lib/compiler/StackerCompiler.cpp   Mon Feb 12 20:45:57 2007
@@ -427,7 +427,8 @@
 }
 
 // Get the address of the indexed stack element
-GetElementPtrInst* gep = new GetElementPtrInst( TheStack, indexVec );
+GetElementPtrInst* gep = new GetElementPtrInst(TheStack, indexVec[0], 
+   indexVec.size() );
 bb-getInstList().push_back( gep ); // Put GEP in Block
 
 return gep;
@@ -1518,7 +1519,8 @@
 // Get address of op1'th element of the string
 std::vectorValue* indexVec;
 indexVec.push_back( chr_idx );
-GetElementPtrInst* gep = new GetElementPtrInst( ptr, indexVec );
+GetElementPtrInst* gep = new GetElementPtrInst( ptr, indexVec[0], 
+indexVec.size() );
 bb-getInstList().push_back( gep );
 
 // Get the value and push it
@@ -1550,7 +1552,8 @@
 // Get address of op2'th element of the string
 std::vectorValue* indexVec;
 indexVec.push_back( chr_idx );
-GetElementPtrInst* gep = new GetElementPtrInst( ptr, indexVec );
+GetElementPtrInst* gep = new GetElementPtrInst( ptr, indexVec[0], 
+indexVec.size());
 bb-getInstList().push_back( gep );
 
 // Cast the value and put it
@@ -1600,7 +1603,7 @@
 indexVec.push_back( Zero );
 indexVec.push_back( Zero );
 GetElementPtrInst* format_gep =
-new GetElementPtrInst( ChrFormat, indexVec );
+new GetElementPtrInst( ChrFormat, indexVec[0], indexVec.size() );
 bb-getInstList().push_back( format_gep );
 
 // Get the character to print (a tab)
@@ -1622,7 +1625,7 @@
 indexVec.push_back( Zero );
 indexVec.push_back( Zero );
 GetElementPtrInst* format_gep =
-new GetElementPtrInst( ChrFormat, indexVec );
+new GetElementPtrInst( ChrFormat, indexVec[0], indexVec.size() );
 bb-getInstList().push_back( format_gep );
 
 // Get the character to print (a space)
@@ -1644,7 +1647,7 @@
 indexVec.push_back( Zero );
 indexVec.push_back( Zero );
 GetElementPtrInst* format_gep =
-new GetElementPtrInst( ChrFormat, indexVec );
+new GetElementPtrInst( ChrFormat, indexVec[0], indexVec.size() );
 bb-getInstList().push_back( format_gep );
 
 // Get the character to print (a newline)
@@ -1742,7 +1745,7 @@
 indexVec.push_back( Zero );
 indexVec.push_back( Zero );
 GetElementPtrInst* format_gep =
-new GetElementPtrInst( StrFormat, indexVec );
+new GetElementPtrInst( StrFormat, indexVec[0], indexVec.size() );
 bb-getInstList().push_back( format_gep );
 // Build function call arguments
 std::vectorValue* args;
@@ -1763,7 +1766,7 @@
 indexVec.push_back( Zero );
 indexVec.push_back( Zero );
 GetElementPtrInst* format_gep =
-new GetElementPtrInst( NumFormat, indexVec );
+new GetElementPtrInst( NumFormat, indexVec[0], indexVec.size() );
 bb-getInstList().push_back( format_gep );
 
 // Build function call arguments
@@ -1786,7 +1789,7 @@
 indexVec.push_back( Zero );
 indexVec.push_back( Zero );
 GetElementPtrInst* format_gep =
-new GetElementPtrInst( ChrFormat, indexVec );
+new GetElementPtrInst( ChrFormat, indexVec[0], indexVec.size() );
 bb-getInstList().push_back( format_gep );
 
 // Build function call arguments



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


Re: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

2007-02-12 Thread Chris Lattner
On Mon, 12 Feb 2007, Reid Spencer wrote:
 -  Result = new CallInst(F, Params);
 +  Result = new CallInst(F, Params[0], Params.size());

 I don't see why this series of changes is better for performance.

It isn't.

 Is there something I'm missing here?

Nope, it's just an API cleanup.  The perf improvements will happen when 
this change is complete.

-Chris

if (isTailCall) castCallInst(Result)-setTailCall();
if (CallingConv) castCallInst(Result)-setCallingConv(CallingConv);
break;
 @@ -756,7 +756,7 @@
Params.push_back(getValue(Oprnds[i], Oprnds[i+1]));
}

 -  Result = new InvokeInst(F, Normal, Except, Params);
 +  Result = new InvokeInst(F, Normal, Except, Params[0], Params.size());
if (CallingConv) 
 castInvokeInst(Result)-setCallingConv(CallingConv);
break;
  }



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


-Chris

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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.92 - 1.93
---
Log message:

eliminate a bunch of vector-related heap traffic


---
Diffs of the changes:  (+53 -47)

 SimplifyLibCalls.cpp |  100 +++
 1 files changed, 53 insertions(+), 47 deletions(-)


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.92 
llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.93
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.92   Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppMon Feb 12 23:58:53 2007
@@ -512,12 +512,12 @@
 
 // We have enough information to now generate the memcpy call to
 // do the concatenation for us.
-std::vectorValue* vals;
-vals.push_back(gep); // destination
-vals.push_back(ci-getOperand(2)); // source
-vals.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); // length
-vals.push_back(ConstantInt::get(Type::Int32Ty,1)); // alignment
-new CallInst(SLC.get_memcpy(), vals, , ci);
+Value *vals[4];
+vals[0] = gep; // destination
+vals[1] = ci-getOperand(2); // source
+vals[2] = ConstantInt::get(SLC.getIntPtrType(),len); // length
+vals[3] = ConstantInt::get(Type::Int32Ty,1); // alignment
+new CallInst(SLC.get_memcpy(), vals, 4, , ci);
 
 // Finally, substitute the first operand of the strcat call for the
 // strcat call itself since strcat returns its first operand; and,
@@ -565,11 +565,12 @@
   // The second operand is not constant, or not signed. Just lower this to 
   // memchr since we know the length of the string since it is constant.
   Constant *f = SLC.get_memchr();
-  std::vectorValue* args;
-  args.push_back(ci-getOperand(1));
-  args.push_back(ci-getOperand(2));
-  args.push_back(ConstantInt::get(SLC.getIntPtrType(), len));
-  ci-replaceAllUsesWith(new CallInst(f, args, ci-getName(), ci));
+  Value* args[3] = {
+ci-getOperand(1),
+ci-getOperand(2),
+ConstantInt::get(SLC.getIntPtrType(), len)
+  };
+  ci-replaceAllUsesWith(new CallInst(f, args, 3, ci-getName(), ci));
   ci-eraseFromParent();
   return true;
 }
@@ -841,12 +842,12 @@
 
 // We have enough information to now generate the memcpy call to
 // do the concatenation for us.
-std::vectorValue* vals;
-vals.push_back(dest); // destination
-vals.push_back(src); // source
-vals.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); // length
-vals.push_back(ConstantInt::get(Type::Int32Ty,1)); // alignment
-new CallInst(SLC.get_memcpy(), vals, , ci);
+Value *vals[4] = {
+  dest, src,
+  ConstantInt::get(SLC.getIntPtrType(),len), // length
+  ConstantInt::get(Type::Int32Ty, 1) // alignment
+};
+new CallInst(SLC.get_memcpy(), vals, 4, , ci);
 
 // Finally, substitute the first operand of the strcat call for the
 // strcat call itself since strcat returns its first operand; and,
@@ -1423,12 +1424,13 @@
   if (ci-getOperand(2)-getType() != PointerType::get(Type::Int8Ty))
 return false;
 
-  std::vectorValue* args;
-  args.push_back(ci-getOperand(2));
-  args.push_back(ConstantInt::get(SLC.getIntPtrType(),len));
-  args.push_back(ConstantInt::get(SLC.getIntPtrType(),1));
-  args.push_back(ci-getOperand(1));
-  new CallInst(SLC.get_fwrite(FILEptr_type), args, ci-getName(), ci);
+  Value* args[4] = {
+ci-getOperand(2),
+ConstantInt::get(SLC.getIntPtrType(),len),
+ConstantInt::get(SLC.getIntPtrType(),1),
+ci-getOperand(1)
+  };
+  new CallInst(SLC.get_fwrite(FILEptr_type), args, 4, ci-getName(), ci);
   ci-replaceAllUsesWith(ConstantInt::get(Type::Int32Ty,len));
   ci-eraseFromParent();
   return true;
@@ -1454,12 +1456,13 @@
 if (getConstantStringLength(ci-getOperand(3), len, CA)) {
   // fprintf(file,%s,str) - fwrite(str,strlen(str),1,file)
   const Type* FILEptr_type = ci-getOperand(1)-getType();
-  std::vectorValue* args;
-  args.push_back(CastToCStr(ci-getOperand(3), *ci));
-  args.push_back(ConstantInt::get(SLC.getIntPtrType(), len));
-  args.push_back(ConstantInt::get(SLC.getIntPtrType(), 1));
-  args.push_back(ci-getOperand(1));
-  new CallInst(SLC.get_fwrite(FILEptr_type), args, ci-getName(), ci);
+  Value* args[4] = {
+CastToCStr(ci-getOperand(3), *ci),
+ConstantInt::get(SLC.getIntPtrType(), len),
+ConstantInt::get(SLC.getIntPtrType(), 1),
+ci-getOperand(1)
+  };
+  new CallInst(SLC.get_fwrite(FILEptr_type), args, 4,ci-getName(), 
ci);
   ci-replaceAllUsesWith(ConstantInt::get(Type::Int32Ty, len));
 } else {
   // fprintf(file,%s,str) - fputs(str,file)
@@ -1542,12 +1545,13 @@
   len++;
 
   // 

[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/ExecutionEngine/JIT:

JIT.cpp updated: 1.91 - 1.92
---
Log message:

eliminate vector-related allocations


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

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


Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.91 
llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.92
--- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.91   Tue Jan 30 14:08:37 2007
+++ llvm/lib/ExecutionEngine/JIT/JIT.cppTue Feb 13 00:01:22 2007
@@ -187,7 +187,7 @@
 
   // Convert all of the GenericValue arguments over to constants.  Note that we
   // currently don't support varargs.
-  std::vectorValue* Args;
+  SmallVectorValue*, 8 Args;
   for (unsigned i = 0, e = ArgValues.size(); i != e; ++i) {
 Constant *C = 0;
 const Type *ArgTy = FTy-getParamType(i);
@@ -225,7 +225,7 @@
 Args.push_back(C);
   }
 
-  CallInst *TheCall = new CallInst(F, Args, , StubBB);
+  CallInst *TheCall = new CallInst(F, Args[0], Args.size(), , StubBB);
   TheCall-setTailCall();
   if (TheCall-getType() != Type::VoidTy)
 new ReturnInst(TheCall, StubBB); // Return result of the call.



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


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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen:

IntrinsicLowering.cpp updated: 1.66 - 1.67
---
Log message:

eliminate vector-related allocations


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

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


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.66 
llvm/lib/CodeGen/IntrinsicLowering.cpp:1.67
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.66 Tue Feb  6 13:06:38 2007
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp  Tue Feb 13 00:01:22 2007
@@ -19,6 +19,7 @@
 #include llvm/CodeGen/IntrinsicLowering.h
 #include llvm/Support/Streams.h
 #include llvm/Target/TargetData.h
+#include llvm/ADT/SmallVector.h
 using namespace llvm;
 
 template class ArgIt
@@ -52,8 +53,9 @@
 FunctionType::get(RetTy, ParamTys, false));
   }
 
-  std::vectorValue* Operands(ArgBegin, ArgEnd);
-  CallInst *NewCI = new CallInst(FCache, Operands, CI-getName(), CI);
+  SmallVectorValue*, 8 Operands(ArgBegin, ArgEnd);
+  CallInst *NewCI = new CallInst(FCache, Operands[0], Operands.size(),
+ CI-getName(), CI);
   if (!CI-use_empty())
 CI-replaceAllUsesWith(NewCI);
   return NewCI;



___
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-12 Thread Chris Lattner


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.y updated: 1.64 - 1.65
---
Log message:

remove use of vector-related ctors


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

 UpgradeParser.y |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.64 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.65
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.64Mon Feb 12 16:58:38 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Tue Feb 13 00:03:48 2007
@@ -1222,7 +1222,7 @@
   const PointerType *PFTy = PointerType::get(FTy);
   Value* Func = getVal(PFTy, ID);
   Args[0] = new BitCastInst(Args[0], PtrTy, makeNameUnique(va), CurBB);
-  return new CallInst(Func, Args);
+  return new CallInst(Func, Args[0], Args.size());
 } else if (Name == llvm.va_copy) {
   if (Args.size() != 2)
 error(Invalid prototype for  + Name +  prototype);
@@ -1235,7 +1235,7 @@
   std::string InstName1(makeNameUnique(va1));
   Args[0] = new BitCastInst(Args[0], PtrTy, InstName0, CurBB);
   Args[1] = new BitCastInst(Args[1], PtrTy, InstName1, CurBB);
-  return new CallInst(Func, Args);
+  return new CallInst(Func, Args[0], Args.size());
 }
   }
   return 0;
@@ -2978,7 +2978,7 @@
 
 // Create the call node...
 if (!$6) {   // Has no arguments?
-  $$ = new InvokeInst(V, Normal, Except, std::vectorValue*());
+  $$ = new InvokeInst(V, Normal, Except, 0, 0);
 } else { // Has arguments?
   // Loop through FunctionType's arguments and ensure they are specified
   // correctly!
@@ -2998,7 +2998,7 @@
   if (I != E || (ArgI != ArgE  !Ty-isVarArg()))
 error(Invalid number of parameters detected);
 
-  $$ = new InvokeInst(V, Normal, Except, Args);
+  $$ = new InvokeInst(V, Normal, Except, Args[0], Args.size());
 }
 castInvokeInst($$)-setCallingConv(upgradeCallingConv($2));
 delete $3.PAT;
@@ -3379,7 +3379,7 @@
   }
 
   // Create the call instruction
-  CallInst *CI = new CallInst(V, Args);
+  CallInst *CI = new CallInst(V, Args[0], Args.size());
   CI-setTailCall($1);
   CI-setCallingConv(upgradeCallingConv($2));
   $$.I = CI;



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


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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/tools/bugpoint:

Miscompilation.cpp updated: 1.87 - 1.88
---
Log message:

eliminate use of vector-related ctors


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

 Miscompilation.cpp |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)


Index: llvm/tools/bugpoint/Miscompilation.cpp
diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.87 
llvm/tools/bugpoint/Miscompilation.cpp:1.88
--- llvm/tools/bugpoint/Miscompilation.cpp:1.87 Mon Feb  5 15:19:13 2007
+++ llvm/tools/bugpoint/Miscompilation.cpp  Tue Feb 13 00:05:43 2007
@@ -663,7 +663,8 @@
 
   // Call the old main function and return its result
   BasicBlock *BB = new BasicBlock(entry, newMain);
-  CallInst *call = new CallInst(oldMainProto, args, , BB);
+  CallInst *call = new CallInst(oldMainProto, args[0], args.size(),
+, BB);
 
   // If the type of old function wasn't void, return value of call
   new ReturnInst(call, BB);
@@ -734,7 +735,8 @@
   // Resolve the call to function F via the JIT API:
   //
   // call resolver(GetElementPtr...)
-  CallInst *Resolver = new CallInst(resolverFunc, ResolverArgs,
+  CallInst *Resolver = new CallInst(resolverFunc, ResolverArgs[0],
+ResolverArgs.size(),
 resolver, LookupBB);
   // cast the result from the resolver to correctly-typed function
   CastInst *CastedResolver = new BitCastInst(Resolver, 
@@ -756,10 +758,11 @@
 
   // Pass on the arguments to the real function, return its result
   if (F-getReturnType() == Type::VoidTy) {
-new CallInst(FuncPtr, Args, , DoCallBB);
+new CallInst(FuncPtr, Args[0], Args.size(), , DoCallBB);
 new ReturnInst(DoCallBB);
   } else {
-CallInst *Call = new CallInst(FuncPtr, Args, retval, DoCallBB);
+CallInst *Call = new CallInst(FuncPtr, Args[0], Args.size(),
+  retval, DoCallBB);
 new ReturnInst(Call, DoCallBB);
   }
 



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


[llvm-commits] CVS: llvm/examples/HowToUseJIT/HowToUseJIT.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/examples/HowToUseJIT:

HowToUseJIT.cpp updated: 1.15 - 1.16
---
Log message:

eliminate vector-related ctors


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

 HowToUseJIT.cpp |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)


Index: llvm/examples/HowToUseJIT/HowToUseJIT.cpp
diff -u llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.15 
llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.16
--- llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.15  Fri Jan 19 16:45:05 2007
+++ llvm/examples/HowToUseJIT/HowToUseJIT.cpp   Tue Feb 13 00:06:26 2007
@@ -89,9 +89,7 @@
   Value *Ten = ConstantInt::get(Type::Int32Ty, 10);
 
   // Pass Ten to the call call:
-  std::vectorValue* Params;
-  Params.push_back(Ten);
-  CallInst *Add1CallRes = new CallInst(Add1F, Params, add1, BB);
+  CallInst *Add1CallRes = new CallInst(Add1F, Ten, add1, BB);
   Add1CallRes-setTailCall(true);
 
   // Create the return instruction and add it to the basic block.



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


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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instructions.cpp updated: 1.73 - 1.74
---
Log message:

eliminate instruction ctors that take vectors.


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

 Instructions.cpp |   37 -
 1 files changed, 37 deletions(-)


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.73 
llvm/lib/VMCore/Instructions.cpp:1.74
--- llvm/lib/VMCore/Instructions.cpp:1.73   Mon Feb 12 19:04:01 2007
+++ llvm/lib/VMCore/Instructions.cppTue Feb 13 00:22:32 2007
@@ -268,14 +268,6 @@
   assert(FTy-getNumParams() == 0  Calling a function with bad signature);
 }
 
-CallInst::CallInst(Value *Func, const std::vectorValue* Params,
-   const std::string Name, Instruction *InsertBefore)
-  : Instruction(castFunctionType(castPointerType(Func-getType())
- -getElementType())-getReturnType(),
-Instruction::Call, 0, 0, Name, InsertBefore) {
-  init(Func, Params[0], Params.size());
-}
-
 CallInst::CallInst(Value *Func, Value* const *Args, unsigned NumArgs,
const std::string Name, BasicBlock *InsertAtEnd)
   : Instruction(castFunctionType(castPointerType(Func-getType())
@@ -291,15 +283,6 @@
   init(Func, Args, NumArgs);
 }
 
-CallInst::CallInst(Value *Func, const std::vectorValue* Params,
-   const std::string Name, BasicBlock *InsertAtEnd)
-: Instruction(castFunctionType(castPointerType(Func-getType())
- -getElementType())-getReturnType(),
-  Instruction::Call, 0, 0, Name, InsertAtEnd) {
-  init(Func, Params[0], Params.size());
-}
-
-
 CallInst::CallInst(Value *Func, Value *Actual1, Value *Actual2,
const std::string Name, Instruction  *InsertBefore)
   : Instruction(castFunctionType(castPointerType(Func-getType())
@@ -411,26 +394,6 @@
   init(Fn, IfNormal, IfException, Args, NumArgs);
 }
 
-InvokeInst::InvokeInst(Value *Fn, BasicBlock *IfNormal,
-   BasicBlock *IfException,
-   const std::vectorValue* Params,
-   const std::string Name, Instruction *InsertBefore)
-  : TerminatorInst(castFunctionType(castPointerType(Fn-getType())
--getElementType())-getReturnType(),
-   Instruction::Invoke, 0, 0, Name, InsertBefore) {
-  init(Fn, IfNormal, IfException, Params[0], Params.size());
-}
-
-InvokeInst::InvokeInst(Value *Fn, BasicBlock *IfNormal,
-   BasicBlock *IfException,
-   const std::vectorValue* Params,
-   const std::string Name, BasicBlock *InsertAtEnd)
-  : TerminatorInst(castFunctionType(castPointerType(Fn-getType())
--getElementType())-getReturnType(),
-   Instruction::Invoke, 0, 0, Name, InsertAtEnd) {
-  init(Fn, IfNormal, IfException, Params[0], Params.size());
-}
-
 InvokeInst::InvokeInst(const InvokeInst II)
   : TerminatorInst(II.getType(), Instruction::Invoke,
new Use[II.getNumOperands()], II.getNumOperands()) {



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


[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.237 - 1.238
---
Log message:

now that we can pass ranges into CallInst ctors, eliminate vector heap traffic


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

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


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.237 
llvm/lib/Bytecode/Reader/Reader.cpp:1.238
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.237   Mon Feb 12 19:53:54 2007
+++ llvm/lib/Bytecode/Reader/Reader.cpp Tue Feb 13 00:30:42 2007
@@ -669,7 +669,7 @@
   const FunctionType *FTy = dyn_castFunctionType(PTy-getElementType());
   if (FTy == 0) error(Call to non function pointer value!);
 
-  std::vectorValue * Params;
+  SmallVectorValue *, 8 Params;
   if (!FTy-isVarArg()) {
 FunctionType::param_iterator It = FTy-param_begin();
 
@@ -720,7 +720,7 @@
   if (FTy == 0)
 error(Invoke to non function pointer value!);
 
-  std::vectorValue * Params;
+  SmallVectorValue *, 8 Params;
   BasicBlock *Normal, *Except;
   unsigned CallingConv = Oprnds.back();
   Oprnds.pop_back();



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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

SmallVector.h updated: 1.23 - 1.24
---
Log message:

fix a critical bug in smallvector, where it would destroy elements that are
not in its range (!).



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

 SmallVector.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/ADT/SmallVector.h
diff -u llvm/include/llvm/ADT/SmallVector.h:1.23 
llvm/include/llvm/ADT/SmallVector.h:1.24
--- llvm/include/llvm/ADT/SmallVector.h:1.23Wed Jan 31 14:08:34 2007
+++ llvm/include/llvm/ADT/SmallVector.h Tue Feb 13 01:25:36 2007
@@ -275,8 +275,8 @@
   
   void destroy_range(T *S, T *E) {
 while (S != E) {
-  E-~T();
   --E;
+  E-~T();
 }
   }
 };



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


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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Reader:

Reader.h updated: 1.49 - 1.50
---
Log message:

Use a SmallVector to reduce heap traffic.  This speeds up bcreader 10%


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

 Reader.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Bytecode/Reader/Reader.h
diff -u llvm/lib/Bytecode/Reader/Reader.h:1.49 
llvm/lib/Bytecode/Reader/Reader.h:1.50
--- llvm/lib/Bytecode/Reader/Reader.h:1.49  Mon Feb 12 12:53:43 2007
+++ llvm/lib/Bytecode/Reader/Reader.h   Tue Feb 13 01:28:20 2007
@@ -80,7 +80,7 @@
   /// globals section.
   /// @brief A list of values as a User of those Values.
   class ValueList : public User {
-std::vectorUse Uses;
+SmallVectorUse, 32 Uses;
   public:
 ValueList() : User(Type::VoidTy, Value::ArgumentVal, 0, 0) {}
 



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


[llvm-commits] CVS: llvm/include/llvm/Value.h

2007-02-12 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Value.h updated: 1.94 - 1.95
---
Log message:

add a setName variant that takes a null-terminated string.  This can be
used to avoid std::string allocations in common cases.



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

 Value.h |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/include/llvm/Value.h
diff -u llvm/include/llvm/Value.h:1.94 llvm/include/llvm/Value.h:1.95
--- llvm/include/llvm/Value.h:1.94  Mon Feb 12 12:52:59 2007
+++ llvm/include/llvm/Value.h   Tue Feb 13 01:53:34 2007
@@ -92,6 +92,8 @@
 
   void setName(const std::string name);
   void setName(const char *Name, unsigned NameLen);
+  void setName(const char *Name);  // Takes a null-terminated string.
+
   
   /// takeName - transfer the name from V to this value, setting V's name to
   /// empty.  It is an error to call V-takeName(V). 



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


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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.64 - 1.65
Instructions.cpp updated: 1.74 - 1.75
---
Log message:

Switch UnaryOperators to default to passing names up by const char* when 
possible.
This speeds up bcreading by 1.5%.


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

 Instruction.cpp  |   28 
 Instructions.cpp |   54 ++
 2 files changed, 74 insertions(+), 8 deletions(-)


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.64 
llvm/lib/VMCore/Instruction.cpp:1.65
--- llvm/lib/VMCore/Instruction.cpp:1.64Sun Feb 11 23:18:08 2007
+++ llvm/lib/VMCore/Instruction.cpp Tue Feb 13 01:54:42 2007
@@ -44,6 +44,34 @@
   setName(Name);
 }
 
+Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned 
NumOps,
+ const char *Name, Instruction *InsertBefore)
+  : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
+  // Make sure that we get added to a basicblock
+  LeakDetector::addGarbageObject(this);
+
+  // If requested, insert this instruction into a basic block...
+  if (InsertBefore) {
+assert(InsertBefore-getParent() 
+   Instruction to insert before is not in a basic block!);
+InsertBefore-getParent()-getInstList().insert(InsertBefore, this);
+  }
+  if (Name  *Name) setName(Name);
+}
+
+Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned 
NumOps,
+ const char *Name, BasicBlock *InsertAtEnd)
+  : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
+  // Make sure that we get added to a basicblock
+  LeakDetector::addGarbageObject(this);
+
+  // append this instruction into the basic block
+  assert(InsertAtEnd  Basic block to append to may not be NULL!);
+  InsertAtEnd-getInstList().push_back(this);
+  if (Name  *Name) setName(Name);
+}
+
+
 // Out of line virtual method, so the vtable, etc has a home.
 Instruction::~Instruction() {
   assert(Parent == 0  Instruction still linked in the program!);


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.74 
llvm/lib/VMCore/Instructions.cpp:1.75
--- llvm/lib/VMCore/Instructions.cpp:1.74   Tue Feb 13 00:22:32 2007
+++ llvm/lib/VMCore/Instructions.cppTue Feb 13 01:54:42 2007
@@ -531,18 +531,20 @@
unsigned Align, const std::string Name,
Instruction *InsertBefore)
   : UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize),
- Name, InsertBefore), Alignment(Align) {
+ 0, InsertBefore), Alignment(Align) {
   assert((Align  (Align-1)) == 0  Alignment is not a power of 2!);
   assert(Ty != Type::VoidTy  Cannot allocate void!);
+  setName(Name);
 }
 
 AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
unsigned Align, const std::string Name,
BasicBlock *InsertAtEnd)
   : UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize),
- Name, InsertAtEnd), Alignment(Align) {
+ 0, InsertAtEnd), Alignment(Align) {
   assert((Align  (Align-1)) == 0  Alignment is not a power of 2!);
   assert(Ty != Type::VoidTy  Cannot allocate void!);
+  setName(Name);
 }
 
 // Out of line virtual method, so the vtable, etc has a home.
@@ -579,12 +581,12 @@
 }
 
 FreeInst::FreeInst(Value *Ptr, Instruction *InsertBefore)
-  : UnaryInstruction(Type::VoidTy, Free, Ptr, , InsertBefore) {
+  : UnaryInstruction(Type::VoidTy, Free, Ptr, 0, InsertBefore) {
   AssertOK();
 }
 
 FreeInst::FreeInst(Value *Ptr, BasicBlock *InsertAtEnd)
-  : UnaryInstruction(Type::VoidTy, Free, Ptr, , InsertAtEnd) {
+  : UnaryInstruction(Type::VoidTy, Free, Ptr, 0, InsertAtEnd) {
   AssertOK();
 }
 
@@ -600,30 +602,66 @@
 
 LoadInst::LoadInst(Value *Ptr, const std::string Name, Instruction *InsertBef)
   : UnaryInstruction(castPointerType(Ptr-getType())-getElementType(),
- Load, Ptr, Name, InsertBef) {
+ Load, Ptr, 0, InsertBef) {
   setVolatile(false);
   AssertOK();
+  setName(Name);
 }
 
 LoadInst::LoadInst(Value *Ptr, const std::string Name, BasicBlock *InsertAE)
   : UnaryInstruction(castPointerType(Ptr-getType())-getElementType(),
- Load, Ptr, Name, InsertAE) {
+ Load, Ptr, 0, InsertAE) {
   setVolatile(false);
   AssertOK();
+  setName(Name);
 }
 
 LoadInst::LoadInst(Value *Ptr, const std::string Name, bool isVolatile,
Instruction *InsertBef)
   : UnaryInstruction(castPointerType(Ptr-getType())-getElementType(),
- Load, Ptr, Name, InsertBef) {
+ Load, Ptr, 0, InsertBef) {
   setVolatile(isVolatile);
   AssertOK();
+  setName(Name);
 }
 
 LoadInst::LoadInst(Value *Ptr, const std::string Name, bool isVolatile,
BasicBlock 

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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Value.cpp updated: 1.67 - 1.68
---
Log message:

add a setName variant that takes a null-terminated string.  This can be
used to avoid std::string allocations in common cases.



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

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


Index: llvm/lib/VMCore/Value.cpp
diff -u llvm/lib/VMCore/Value.cpp:1.67 llvm/lib/VMCore/Value.cpp:1.68
--- llvm/lib/VMCore/Value.cpp:1.67  Mon Feb 12 12:52:59 2007
+++ llvm/lib/VMCore/Value.cpp   Tue Feb 13 01:53:34 2007
@@ -122,6 +122,10 @@
   setName(name[0], name.size());
 }
 
+void Value::setName(const char *Name) {
+  setName(Name, Name ? strlen(Name) : 0);
+}
+
 void Value::setName(const char *NameStr, unsigned NameLen) {
   if (NameLen == 0  !hasName()) return;
   if (getType() != Type::VoidTy  Cannot assign a name to void values!);



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