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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.113 - 1.114
---
Log message:

Some new entries about truncate / anyext

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

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


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.113 
llvm/lib/Target/X86/README.txt:1.114
--- llvm/lib/Target/X86/README.txt:1.113Mon May 22 00:54:49 2006
+++ llvm/lib/Target/X86/README.txt  Tue May 30 01:23:50 2006
@@ -606,3 +606,19 @@
 
 The current isel scheme will not allow the load to be folded in the call since
 the load's chain result is read by the callseq_start.
+
+//===-===//
+
+Don't forget to find a way to squash noop truncates in the JIT environment.
+
+//===-===//
+
+Implement anyext in the same manner as truncate that would allow them to be
+eliminated.
+
+//===-===//
+
+How about implementing truncate / anyext as a property of machine instruction
+operand? i.e. Print as 32-bit super-class register / 16-bit sub-class register.
+Do this for the cases where a truncate / anyext is guaranteed to be eliminated.
+For IA32 that is truncate from 32 to 16 and anyext from 16 to 32.



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


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

2006-05-30 Thread Evan Cheng


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

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

Add a lea instruction selection test case.

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

 lea.ll |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/test/Regression/CodeGen/X86/lea.ll
diff -u /dev/null llvm/test/Regression/CodeGen/X86/lea.ll:1.4
--- /dev/null   Tue May 30 01:54:05 2006
+++ llvm/test/Regression/CodeGen/X86/lea.ll Tue May 30 01:53:55 2006
@@ -0,0 +1,7 @@
+; RUN: llvm-as  %s | llc -march=x86
+; RUN: llvm-as  %s | llc -march=x86 | not grep orl
+int %test(int %x) {
+   %tmp1 = shl int %x, ubyte 3
+   %tmp2 = add int %tmp1, 7
+   ret int %tmp2
+}



___
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/X86ISelDAGToDAG.cpp X86InstrInfo.td

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelDAGToDAG.cpp updated: 1.69 - 1.70
X86InstrInfo.td updated: 1.271 - 1.272
---
Log message:

A addressing mode folding enhancement:
Fold c2 in (x  c1) | c2 where (c2  c1)
e.g.
int test(int x) {
  return (x  3) + 7;
}

This can be codegen'd as:
leal 7(,%eax,8), %eax


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

 X86ISelDAGToDAG.cpp |   24 
 X86InstrInfo.td |2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.69 
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.70
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.69Wed May 24 19:24:27 2006
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Tue May 30 01:59:36 2006
@@ -392,6 +392,30 @@
 }
 break;
   }
+
+  case ISD::OR: {
+if (!Available) {
+  X86ISelAddressMode Backup = AM;
+  // Look for (x  c1) | c2 where (c2  c1)
+  ConstantSDNode *CN = dyn_castConstantSDNode(N.Val-getOperand(0));
+  if (CN  !MatchAddress(N.Val-getOperand(1), AM, false)) {
+if (AM.GV == NULL  AM.Disp == 0  CN-getValue()  AM.Scale) {
+  AM.Disp = CN-getValue();
+  return false;
+}
+  }
+  AM = Backup;
+  CN = dyn_castConstantSDNode(N.Val-getOperand(1));
+  if (CN  !MatchAddress(N.Val-getOperand(0), AM, false)) {
+if (AM.GV == NULL  AM.Disp == 0  CN-getValue()  AM.Scale) {
+  AM.Disp = CN-getValue();
+  return false;
+}
+  }
+  AM = Backup;
+}
+break;
+  }
   }
 
   // Is the base register already occupied?


Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.271 
llvm/lib/Target/X86/X86InstrInfo.td:1.272
--- llvm/lib/Target/X86/X86InstrInfo.td:1.271   Fri May 19 20:40:16 2006
+++ llvm/lib/Target/X86/X86InstrInfo.td Tue May 30 01:59:36 2006
@@ -133,7 +133,7 @@
 // Define X86 specific addressing mode.
 def addr: ComplexPatterniPTR, 4, SelectAddr, [];
 def leaaddr : ComplexPatterniPTR, 4, SelectLEAAddr,
- [add, mul, shl, frameindex];
+ [add, mul, shl, or, frameindex];
 
 
//===--===//
 // X86 Instruction Format Definitions.



___
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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.114 - 1.115
---
Log message:

Add a note about integer multiplication by constants.

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

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


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.114 
llvm/lib/Target/X86/README.txt:1.115
--- llvm/lib/Target/X86/README.txt:1.114Tue May 30 01:23:50 2006
+++ llvm/lib/Target/X86/README.txt  Tue May 30 02:37:37 2006
@@ -622,3 +622,30 @@
 operand? i.e. Print as 32-bit super-class register / 16-bit sub-class register.
 Do this for the cases where a truncate / anyext is guaranteed to be eliminated.
 For IA32 that is truncate from 32 to 16 and anyext from 16 to 32.
+
+//===-===//
+
+For this:
+
+int test(int a)
+{
+  return a * 3;
+}
+
+We currently emits
+   imull $3, 4(%esp), %eax
+
+Perhaps this is what we really should generate is? Is imull three or four
+cycles? Note: ICC generates this:
+   movl4(%esp), %eax
+   leal(%eax,%eax,2), %eax
+
+The current instruction priority is based on pattern complexity. The former is
+more complex because it folds a load so the latter will not be emitted.
+
+Perhaps we should use AddedComplexity to give LEA32r a higher priority? We
+should always try to match LEA first since the LEA matching code does some
+estimate to determine whether the match is profitable.
+
+However, if we care more about code size, then imull is better. It's two bytes
+shorter than movl + leal.



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


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

2006-05-30 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.151 - 1.152
---
Log message:

Adjust the interface to ConstantArray::get. The previous 
implementation always added a null byte to the end of the string. It turns
out that this is not always wanted. By adding a length parameter we preserve
this behavior when length==0 (default value) but also allow other lengths
(not null terminated) to be created.


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

 Constants.cpp |   23 +++
 1 files changed, 15 insertions(+), 8 deletions(-)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.151 llvm/lib/VMCore/Constants.cpp:1.152
--- llvm/lib/VMCore/Constants.cpp:1.151 Wed May 24 12:04:04 2006
+++ llvm/lib/VMCore/Constants.cpp   Tue May 30 03:23:18 2006
@@ -924,20 +924,27 @@
   destroyConstantImpl();
 }
 
-// ConstantArray::get(const string) - Return an array that is initialized to
-// contain the specified string.  A null terminator is added to the specified
-// string so that it may be used in a natural way...
-//
-Constant *ConstantArray::get(const std::string Str) {
+/// ConstantArray::get(const string) - Return an array that is initialized to
+/// contain the specified string.  If length is zero then a null terminator is 
+/// added to the specified string so that it may be used in a natural way. 
+/// Otherwise, the length parameter specifies how much of the string to use 
+/// and it won't be null terminated.
+///
+Constant *ConstantArray::get(const std::string Str, unsigned length) {
+  assert(length = Str.length()  Invalid length for string);
   std::vectorConstant* ElementVals;
 
-  for (unsigned i = 0; i  Str.length(); ++i)
+  unsigned copy_len = (length == 0 ? Str.length() : length);
+  for (unsigned i = 0; i  copy_len; ++i)
 ElementVals.push_back(ConstantSInt::get(Type::SByteTy, Str[i]));
 
   // Add a null terminator to the string...
-  ElementVals.push_back(ConstantSInt::get(Type::SByteTy, 0));
+  if (length == 0) {
+ElementVals.push_back(ConstantSInt::get(Type::SByteTy, 0));
+copy_len++;
+  }
 
-  ArrayType *ATy = ArrayType::get(Type::SByteTy, Str.length()+1);
+  ArrayType *ATy = ArrayType::get(Type::SByteTy, copy_len);
   return ConstantArray::get(ATy, ElementVals);
 }
 



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


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

2006-05-30 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.80 - 1.81
---
Log message:

Adjust the interface to ConstantArray::get. The previous 
implementation always added a null byte to the end of the string. It turns
out that this is not always wanted. By adding a length parameter we preserve
this behavior when length==0 (default value) but also allow other lengths
(not null terminated) to be created.


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

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


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.80 llvm/include/llvm/Constants.h:1.81
--- llvm/include/llvm/Constants.h:1.80  Wed May 24 14:21:13 2006
+++ llvm/include/llvm/Constants.h   Tue May 30 03:23:18 2006
@@ -345,7 +345,7 @@
 public:
   /// get() - Static factory methods - Return objects of the specified value
   static Constant *get(const ArrayType *T, const std::vectorConstant* );
-  static Constant *get(const std::string Initializer);
+  static Constant *get(const std::string Initializer, unsigned len = 0);
 
   /// getType - Specialize the getType() method to always return an ArrayType,
   /// which reduces the amount of casting needed in parts of the compiler.



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


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

2006-05-30 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.81 - 1.82
---
Log message:

Properly document the second form of ConstArray::get()


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

 Constants.h |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.81 llvm/include/llvm/Constants.h:1.82
--- llvm/include/llvm/Constants.h:1.81  Tue May 30 03:23:18 2006
+++ llvm/include/llvm/Constants.h   Tue May 30 03:26:13 2006
@@ -345,6 +345,13 @@
 public:
   /// get() - Static factory methods - Return objects of the specified value
   static Constant *get(const ArrayType *T, const std::vectorConstant* );
+
+  /// This method constructs a ConstantArray and initializes it with a text
+  /// string. The default behavior (len==0) causes the null terminator to
+  /// be copied as well. However, in some situations this is not desired so
+  /// if len = Initializer.length() (but not 0) then only that portion of
+  /// the string is copied and there is no null termination. If len 
+  /// than Initializer's length then the function asserts out (don't do that).
   static Constant *get(const std::string Initializer, unsigned len = 0);
 
   /// getType - Specialize the getType() method to always return an ArrayType,



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


[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp

2006-05-30 Thread Reid Spencer


Changes in directory llvm/tools/llvm2cpp:

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

Fix many small bugs in llvm2cpp. This patch gets llvm2cpp working with
everything except PHI nodes and one odd recurse/opaque type situation.
PHI nodes forward reference INSTRUCTIONS (hhh!) :)


---
Diffs of the changes:  (+161 -73)

 CppWriter.cpp |  234 +++---
 1 files changed, 161 insertions(+), 73 deletions(-)


Index: llvm/tools/llvm2cpp/CppWriter.cpp
diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.4 
llvm/tools/llvm2cpp/CppWriter.cpp:1.5
--- llvm/tools/llvm2cpp/CppWriter.cpp:1.4   Mon May 29 22:43:49 2006
+++ llvm/tools/llvm2cpp/CppWriter.cpp   Tue May 30 05:21:41 2006
@@ -59,7 +59,8 @@
   void printTypes(const Module* M);
   void printConstants(const Module* M);
   void printConstant(const Constant *CPV);
-  void printGlobal(const GlobalVariable *GV);
+  void printGlobalHead(const GlobalVariable *GV);
+  void printGlobalBody(const GlobalVariable *GV);
   void printFunctionHead(const Function *F);
   void printFunctionBody(const Function *F);
   void printInstruction(const Instruction *I, const std::string bbname);
@@ -86,13 +87,20 @@
 if (isprint(C)  C != ''  C != '\\') {
   Out  C;
 } else {
-  Out  '\\'
+  Out  \\x
(char) ((C/16   10) ? ( C/16 +'0') : ( C/16 -10+'A'))
(char)(((C15)  10) ? ((C15)+'0') : ((C15)-10+'A'));
 }
   }
 }
 
+inline void
+sanitize(std::string str) {
+  for (size_t i = 0; i  str.length(); ++i)
+if (!isalnum(str[i])  str[i] != '_')
+  str[i] = '_';
+}
+
 inline const char* 
 getTypePrefix(const Type* Ty ) {
   const char* prefix;
@@ -139,6 +147,7 @@
 name = getTypePrefix(val-getType());
   }
   name += (val-hasName() ? val-getName() : utostr(uniqueNum++));
+  sanitize(name);
   NameSet::iterator NI = UsedNames.find(name);
   if (NI != UsedNames.end())
 name += std::string(_) + utostr(uniqueNum++);
@@ -221,6 +230,7 @@
 name = std::string(prefix) + *tName;
   else
 name = std::string(prefix) + utostr(uniqueNum++);
+  sanitize(name);
 
   // Save the name
   return TypeNames[Ty] = name;
@@ -267,30 +277,44 @@
   Out  \n// Type Definitions\n;
   printTypes(M);
 
-  // Print out all the constants declarations
+  // Functions can call each other and global variables can reference them so 
+  // define all the functions first before emitting their function bodies.
+  Out  \n// Function Declarations\n;
+  for (Module::const_iterator I = M-begin(), E = M-end(); I != E; ++I)
+printFunctionHead(I);
+
+  // Process the global variables declarations. We can't initialze them until
+  // after the constants are printed so just print a header for each global
+  Out  \n// Global Variable Declarations\n;
+  for (Module::const_global_iterator I = M-global_begin(), E = 
M-global_end();
+   I != E; ++I) {
+printGlobalHead(I);
+  }
+
+  // Print out all the constants definitions. Constants don't recurse except
+  // through GlobalValues. All GlobalValues have been declared at this point
+  // so we can proceed to generate the constants.
   Out  \n// Constant Definitions\n;
   printConstants(M);
 
-  // Process the global variables
+  // Process the global variables definitions now that all the constants have
+  // been emitted. These definitions just couple the gvars with their constant
+  // initializers.
   Out  \n// Global Variable Definitions\n;
   for (Module::const_global_iterator I = M-global_begin(), E = 
M-global_end();
I != E; ++I) {
-printGlobal(I);
+printGlobalBody(I);
   }
 
-  // Functions can call each other so define all the functions first before
-  // emitting their function bodies.
-  Out  \n// Function Declarations\n;
-  for (Module::const_iterator I = M-begin(), E = M-end(); I != E; ++I)
-printFunctionHead(I);
-
-  // Output all of the function bodies.
+  // Finally, we can safely put out all of the function bodies.
   Out  \n// Function Definitions\n;
   for (Module::const_iterator I = M-begin(), E = M-end(); I != E; ++I) {
-Out  \n// Function:   I-getName()  (  getCppName(I)  )\n;
-Out  {\n;
-printFunctionBody(I);
-Out  }\n;
+if (!I-isExternal()) {
+  Out  \n// Function:   I-getName()   (  getCppName(I) 
+   )\n{\n;
+  printFunctionBody(I);
+  Out  }\n;
+}
   }
 }
 
@@ -324,7 +348,8 @@
   Out  GlobalValue::GhostLinkage; break;
   }
 }
-void CppWriter::printGlobal(const GlobalVariable *GV) {
+
+void CppWriter::printGlobalHead(const GlobalVariable *GV) {
   Out  \n;
   Out  GlobalVariable* ;
   printCppName(GV);
@@ -335,13 +360,11 @@
   Out/*isConstant=*/  (GV-isConstant()?true:false) 
,\n  /*Linkage=*/;
   printLinkageType(GV-getLinkage());
-  Out  ,\n  /*Initializer=*/;
+  Out  ,\n  /*Initializer=*/0, ;
   if (GV-hasInitializer()) {
-printCppName(GV-getInitializer());
-  } else {
-Out  0;
+Out  // has initializer, specified below;
   }
-  Out  

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

2006-05-30 Thread Vladimir Prus


Changes in directory llvm/include/llvm:

Type.h updated: 1.85 - 1.86
---
Log message:

Make doc comment visible in doxygen output. Clarify Type construction.


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

 Type.h |   50 ++
 1 files changed, 26 insertions(+), 24 deletions(-)


Index: llvm/include/llvm/Type.h
diff -u llvm/include/llvm/Type.h:1.85 llvm/include/llvm/Type.h:1.86
--- llvm/include/llvm/Type.h:1.85   Wed May 24 14:21:13 2006
+++ llvm/include/llvm/Type.hTue May 30 10:49:30 2006
@@ -6,30 +6,7 @@
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
 //
 
//===--===//
-//
-// This file contains the declaration of the Type class.  For more Type type
-// stuff, look in DerivedTypes.h.
-//
-// Note that instances of the Type class are immutable: once they are created,
-// they are never changed.  Also note that only one instance of a particular
-// type is ever created.  Thus seeing if two types are equal is a matter of
-// doing a trivial pointer comparison.
-//
-// Types, once allocated, are never free'd, unless they are an abstract type
-// that is resolved to a more concrete type.
-//
-// Opaque types are simple derived types with no state.  There may be many
-// different Opaque type objects floating around, but two are only considered
-// identical if they are pointer equals of each other.  This allows us to have
-// two opaque types that end up resolving to different concrete types later.
-//
-// Opaque types are also kinda weird and scary and different because they have
-// to keep a list of uses of the type.  When, through linking, parsing, or
-// bytecode reading, they become resolved, they need to find and update all
-// users of the unknown type, causing them to reference a new, more concrete
-// type.  Opaque types are deleted when their use list dwindles to zero users.
-//
-//===--===//
+
 
 #ifndef LLVM_TYPE_H
 #define LLVM_TYPE_H
@@ -53,6 +30,31 @@
 class PackedType;
 class TypeMapBase;
 
+/// This file contains the declaration of the Type class.  For more Type type
+/// stuff, look in DerivedTypes.h.
+///
+/// The instances of the Type class are immutable: once they are created,
+/// they are never changed.  Also note that only one instance of a particular
+/// type is ever created.  Thus seeing if two types are equal is a matter of
+/// doing a trivial pointer comparison. To enforce that no two equal instances
+/// are created, Type instances can only be created via static factory methods 
+/// in class Type and in derived classes.
+/// 
+/// Once allocated, Types are never free'd, unless they are an abstract type
+/// that is resolved to a more concrete type.
+///
+/// Opaque types are simple derived types with no state.  There may be many
+/// different Opaque type objects floating around, but two are only considered
+/// identical if they are pointer equals of each other.  This allows us to have
+/// two opaque types that end up resolving to different concrete types later.
+///
+/// Opaque types are also kinda weird and scary and different because they have
+/// to keep a list of uses of the type.  When, through linking, parsing, or
+/// bytecode reading, they become resolved, they need to find and update all
+/// users of the unknown type, causing them to reference a new, more concrete
+/// type.  Opaque types are deleted when their use list dwindles to zero users.
+///
+/// @brief Root of type hierarchy
 class Type : public AbstractTypeUser {
 public:
   
///===---===//



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


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

2006-05-30 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

AutoUpgrade.cpp updated: 1.19 - 1.20
---
Log message:

Undo a patch that breaks llvm-as because the warning message is written to
stdout when the output of llvm-as is also written to stdout. We'll have to
fix tcl some other way.


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

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


Index: llvm/lib/VMCore/AutoUpgrade.cpp
diff -u llvm/lib/VMCore/AutoUpgrade.cpp:1.19 
llvm/lib/VMCore/AutoUpgrade.cpp:1.20
--- llvm/lib/VMCore/AutoUpgrade.cpp:1.19Tue May 30 11:05:59 2006
+++ llvm/lib/VMCore/AutoUpgrade.cpp Tue May 30 11:34:59 2006
@@ -193,7 +193,7 @@
   // See if its one of the name's we're interested in.
   if (Function *R = getUpgradedIntrinsic(F)) {
 if (R-getName() != F-getName())
-  std::cout  WARNING: change   F-getName()   to 
+  std::cerr  WARNING: change   F-getName()   to 
  R-getName()  \n;
 return R;
   }



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


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

2006-05-30 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

AutoUpgrade.cpp updated: 1.18 - 1.19
---
Log message:

Write the WARNING message to cout instead of cerr. Writing to cerr causes
Tcl to claim that the program had an error and thus produces errors in
the dejagnu testing when its really just a warning. 


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

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


Index: llvm/lib/VMCore/AutoUpgrade.cpp
diff -u llvm/lib/VMCore/AutoUpgrade.cpp:1.18 
llvm/lib/VMCore/AutoUpgrade.cpp:1.19
--- llvm/lib/VMCore/AutoUpgrade.cpp:1.18Wed Apr 12 12:56:16 2006
+++ llvm/lib/VMCore/AutoUpgrade.cpp Tue May 30 11:05:59 2006
@@ -193,7 +193,7 @@
   // See if its one of the name's we're interested in.
   if (Function *R = getUpgradedIntrinsic(F)) {
 if (R-getName() != F-getName())
-  std::cerr  WARNING: change   F-getName()   to 
+  std::cout  WARNING: change   F-getName()   to 
  R-getName()  \n;
 return R;
   }



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


[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp ARMInstrInfo.td

2006-05-30 Thread Rafael Espindola


Changes in directory llvm/lib/Target/ARM:

ARMISelDAGToDAG.cpp updated: 1.9 - 1.10
ARMInstrInfo.td updated: 1.3 - 1.4
---
Log message:

Expand ret into CopyToReg;BRIND



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

 ARMISelDAGToDAG.cpp |   12 +++-
 ARMInstrInfo.td |   10 +-
 2 files changed, 4 insertions(+), 18 deletions(-)


Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.9 
llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.10
--- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.9 Fri May 26 18:10:12 2006
+++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue May 30 12:33:19 2006
@@ -28,13 +28,6 @@
 #include set
 using namespace llvm;
 
-namespace ARMISD {
-  enum {
-FIRST_NUMBER = ISD::BUILTIN_OP_END+ARM::INSTRUCTION_LIST_END,
-RET_FLAG
-  };
-}
-
 namespace {
   class ARMTargetLowering : public TargetLowering {
   public:
@@ -63,11 +56,12 @@
   case 1:
 return SDOperand(); // ret void is legal
   case 3:
-Copy = DAG.getCopyToReg(Op.getOperand(0), ARM::R0, Op.getOperand(2), 
SDOperand());
+Copy = DAG.getCopyToReg(Op.getOperand(0), ARM::R0, Op.getOperand(1), 
SDOperand());
 break;
   }
+  SDOperand LR = DAG.getRegister(ARM::R14, MVT::i32);
 
-  return DAG.getNode(ARMISD::RET_FLAG, MVT::Other, Copy, Copy.getValue(1));
+  return DAG.getNode(ISD::BRIND, MVT::Other, Copy, LR);
 }
 
 static SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG DAG) {


Index: llvm/lib/Target/ARM/ARMInstrInfo.td
diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.3 
llvm/lib/Target/ARM/ARMInstrInfo.td:1.4
--- llvm/lib/Target/ARM/ARMInstrInfo.td:1.3 Fri May 26 05:56:17 2006
+++ llvm/lib/Target/ARM/ARMInstrInfo.td Tue May 30 12:33:19 2006
@@ -30,10 +30,6 @@
 def callseq_start  : SDNodeISD::CALLSEQ_START, SDT_ARMCallSeq, 
[SDNPHasChain];
 def callseq_end: SDNodeISD::CALLSEQ_END,   SDT_ARMCallSeq, 
[SDNPHasChain];
 
-def SDT_ARMRetFlag : SDTypeProfile0, 0, [];
-def retflag: SDNodeARMISD::RET_FLAG, SDT_ARMRetFlag,
-   [SDNPHasChain, SDNPOptInFlag];
-
 def ADJCALLSTACKUP : InstARM(ops i32imm:$amt),
 !ADJCALLSTACKUP $amt,
 [(callseq_end imm:$amt)];
@@ -42,11 +38,7 @@
!ADJCALLSTACKDOWN $amt,
[(callseq_start imm:$amt)];
 
-//bx supports other registers as operands. So this looks like a
-//hack. Maybe a ret should be expanded to a branch lr and bx
-//declared as a regular instruction
-
-def BX: InstARM(ops), bx lr, [(retflag)];
+def bxr: InstARM(ops IntRegs:$dst), bx $dst, [(brind IntRegs:$dst)];
 
 def ldr   : InstARM(ops IntRegs:$dst, IntRegs:$addr),
  ldr $dst, [$addr],



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


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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAGList.cpp updated: 1.59 - 1.60
---
Log message:

When a priority_queue is empty, the behavior of top() operator is
non-deterministic. Returns NULL when it's empty!


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

 ScheduleDAGList.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.59 
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.60
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.59  Fri May 12 
01:33:48 2006
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp   Tue May 30 13:04:34 2006
@@ -356,6 +356,7 @@
 }
 
 SUnit *pop() {
+  if (empty()) return NULL;
   SUnit *V = Queue.top();
   Queue.pop();
   return V;



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


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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

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

Make sure the register pressure reduction schedulers work for non-uniform
latency targets, e.g. PPC32.


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

 ScheduleDAGRRList.cpp |   26 ++
 1 files changed, 14 insertions(+), 12 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.5 
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.6
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.5 Thu May 25 
03:37:31 2006
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue May 30 13:05:39 2006
@@ -63,8 +63,8 @@
 private:
   void ReleasePred(SUnit *PredSU, bool isChain, unsigned CurCycle);
   void ReleaseSucc(SUnit *SuccSU, bool isChain, unsigned CurCycle);
-  void ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle);
-  void ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle);
+  void ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle);
+  void ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle);
   void ListScheduleTopDown();
   void ListScheduleBottomUp();
   void CommuteNodesToReducePressure();
@@ -78,8 +78,6 @@
   
   // Build scheduling units.
   BuildSchedUnits();
-  DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
-SUnits[su].dumpAll(DAG));
 
   CalculateDepths();
   CalculateHeights();
@@ -217,7 +215,7 @@
 /// ScheduleNodeBottomUp - Add the node to the schedule. Decrement the pending
 /// count of its predecessors. If a predecessor pending count is zero, add it 
to
 /// the Available queue.
-void ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
+void ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
   DEBUG(std::cerr  *** Scheduling [  CurCycle  ]: );
   DEBUG(SU-dump(DAG));
   SU-Cycle = CurCycle;
@@ -230,7 +228,6 @@
  E = SU-Preds.end(); I != E; ++I)
 ReleasePred(I-first, I-second, CurCycle);
   SU-isScheduled = true;
-  CurCycle++;
 }
 
 /// isReady - True if node's lower cycle bound is less or equal to the current
@@ -252,7 +249,7 @@
   SUnit *CurNode = NULL;
   while (!AvailableQueue-empty()) {
 SUnit *CurNode = AvailableQueue-pop();
-while (!isReady(CurNode, CurCycle)) {
+while (CurNode  !isReady(CurNode, CurCycle)) {
   NotReady.push_back(CurNode);
   CurNode = AvailableQueue-pop();
 }
@@ -261,7 +258,9 @@
 AvailableQueue-push_all(NotReady);
 NotReady.clear();
 
-ScheduleNodeBottomUp(CurNode, CurCycle);
+if (CurNode != NULL)
+  ScheduleNodeBottomUp(CurNode, CurCycle);
+CurCycle++;
   }
 
   // Add entry node last
@@ -328,7 +327,7 @@
 /// ScheduleNodeTopDown - Add the node to the schedule. Decrement the pending
 /// count of its successors. If a successor pending count is zero, add it to
 /// the Available queue.
-void ScheduleDAGRRList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
+void ScheduleDAGRRList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
   DEBUG(std::cerr  *** Scheduling [  CurCycle  ]: );
   DEBUG(SU-dump(DAG));
   SU-Cycle = CurCycle;
@@ -341,7 +340,6 @@
  E = SU-Succs.end(); I != E; ++I)
 ReleaseSucc(I-first, I-second, CurCycle);
   SU-isScheduled = true;
-  CurCycle++;
 }
 
 void ScheduleDAGRRList::ListScheduleTopDown() {
@@ -359,6 +357,7 @@
   
   // Emit the entry node first.
   ScheduleNodeTopDown(Entry, CurCycle);
+  CurCycle++;
 
   // While Available queue is not empty, grab the node with the highest
   // priority. If it is not ready put it back. Schedule the node.
@@ -366,7 +365,7 @@
   SUnit *CurNode = NULL;
   while (!AvailableQueue-empty()) {
 SUnit *CurNode = AvailableQueue-pop();
-while (!isReady(CurNode, CurCycle)) {
+while (CurNode  !isReady(CurNode, CurCycle)) {
   NotReady.push_back(CurNode);
   CurNode = AvailableQueue-pop();
 }
@@ -375,7 +374,9 @@
 AvailableQueue-push_all(NotReady);
 NotReady.clear();
 
-ScheduleNodeTopDown(CurNode, CurCycle);
+if (CurNode != NULL)
+  ScheduleNodeTopDown(CurNode, CurCycle);
+CurCycle++;
   }
   
   
@@ -453,6 +454,7 @@
 }
 
 SUnit *pop() {
+  if (empty()) return NULL;
   SUnit *V = Queue.top();
   Queue.pop();
   return 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/Constants.h

2006-05-30 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.82 - 1.83
---
Log message:

Provide a simpler interface for getting a ConstantArray from a character
string. Instead of specifying the length, just specify whether the user
wants a terminating null or not. The default is true to retain the same
behavior as previously provided by this function.


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

 Constants.h |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.82 llvm/include/llvm/Constants.h:1.83
--- llvm/include/llvm/Constants.h:1.82  Tue May 30 03:26:13 2006
+++ llvm/include/llvm/Constants.h   Tue May 30 13:15:07 2006
@@ -347,12 +347,12 @@
   static Constant *get(const ArrayType *T, const std::vectorConstant* );
 
   /// This method constructs a ConstantArray and initializes it with a text
-  /// string. The default behavior (len==0) causes the null terminator to
-  /// be copied as well. However, in some situations this is not desired so
-  /// if len = Initializer.length() (but not 0) then only that portion of
-  /// the string is copied and there is no null termination. If len 
-  /// than Initializer's length then the function asserts out (don't do that).
-  static Constant *get(const std::string Initializer, unsigned len = 0);
+  /// string. The default behavior (AddNull==true) causes a null terminator to
+  /// be placed at the end of the array. This effectively increases the length
+  /// of the array by one (you've been warned).  However, in some situations 
+  /// this is not desired so if AddNull==false then the string is copied 
without
+  /// null termination. 
+  static Constant *get(const std::string Initializer, bool AddNull = true);
 
   /// getType - Specialize the getType() method to always return an ArrayType,
   /// which reduces the amount of casting needed in parts of the compiler.



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


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

2006-05-30 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.152 - 1.153
---
Log message:

Provide a simpler interface for getting a ConstantArray from a character
string. Instead of specifying the length, just specify whether the user
wants a terminating null or not. The default is true to retain the same
behavior as previously provided by this function.


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

 Constants.cpp |   12 
 1 files changed, 4 insertions(+), 8 deletions(-)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.152 llvm/lib/VMCore/Constants.cpp:1.153
--- llvm/lib/VMCore/Constants.cpp:1.152 Tue May 30 03:23:18 2006
+++ llvm/lib/VMCore/Constants.cpp   Tue May 30 13:15:07 2006
@@ -930,21 +930,17 @@
 /// Otherwise, the length parameter specifies how much of the string to use 
 /// and it won't be null terminated.
 ///
-Constant *ConstantArray::get(const std::string Str, unsigned length) {
-  assert(length = Str.length()  Invalid length for string);
+Constant *ConstantArray::get(const std::string Str, bool AddNull) {
   std::vectorConstant* ElementVals;
-
-  unsigned copy_len = (length == 0 ? Str.length() : length);
-  for (unsigned i = 0; i  copy_len; ++i)
+  for (unsigned i = 0; i  Str.length(); ++i)
 ElementVals.push_back(ConstantSInt::get(Type::SByteTy, Str[i]));
 
   // Add a null terminator to the string...
-  if (length == 0) {
+  if (AddNull) {
 ElementVals.push_back(ConstantSInt::get(Type::SByteTy, 0));
-copy_len++;
   }
 
-  ArrayType *ATy = ArrayType::get(Type::SByteTy, copy_len);
+  ArrayType *ATy = ArrayType::get(Type::SByteTy, ElementVals.size());
   return ConstantArray::get(ATy, ElementVals);
 }
 



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


[llvm-commits] CVS: llvm/docs/CommandGuide/llvm2cpp.pod index.html

2006-05-30 Thread Reid Spencer


Changes in directory llvm/docs/CommandGuide:

llvm2cpp.pod added (r1.1)
index.html updated: 1.26 - 1.27
---
Log message:

Add llvm2cpp program.


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

 index.html   |6 ++--
 llvm2cpp.pod |   88 +++
 2 files changed, 92 insertions(+), 2 deletions(-)


Index: llvm/docs/CommandGuide/llvm2cpp.pod
diff -c /dev/null llvm/docs/CommandGuide/llvm2cpp.pod:1.1
*** /dev/null   Tue May 30 14:56:41 2006
--- llvm/docs/CommandGuide/llvm2cpp.pod Tue May 30 14:56:31 2006
***
*** 0 
--- 1,88 
+ =pod
+ 
+ =head1 NAME
+ 
+ llvm2xpp - LLVM assembler to LLVM C++ IR translator
+ 
+ =head1 SYNOPSIS
+ 
+ Bllvm2cpp [Ioptions] [Ifilename]
+ 
+ =head1 DESCRIPTION
+ 
+ Bllvm2cpp translates from human readable LLVM assembly (.ll files) to a 
+ corresponding C++ source file that will make calls against the LLVM C++ API to
+ build the same module as the input. By default, the C++ output is a complete
+ program that builds the module, verifies it and then emits the module as
+ LLVM assembly again. This technique assists with testing because the input to
+ Bllvm2cpp and the output of the generated C++ program should be identical.
+ 
+ If Ffilename is omitted or is C-, then Bllvm2cpp reads its input from
+ standard input.
+ 
+ If an output file is not specified with the B-o option, then
+ Bllvm-as sends its output to a file or standard output by following
+ these rules:
+ 
+ =over 
+ 
+ =item *
+ 
+ If the input is standard input, then the output is standard output.
+ 
+ =item *
+ 
+ If the input is a file that ends with C.ll, then the output file is of
+ the same name, except that the suffix is changed to C.cpp.
+ 
+ =item *
+ 
+ If the input is a file that does not end with the C.ll suffix, then the
+ output file has the same name as the input file, except that the C.cpp
+ suffix is appended.
+ 
+ =back
+ 
+ =head1 OPTIONS
+ 
+ =over
+ 
+ =item B-f
+ 
+ Force overwrite.  Normally, Bllvm2cpp will refuse to overwrite an
+ output file that already exists.  With this option, Bllvm2cpp
+ will overwrite the output file and replace it with new C++ source code.
+ 
+ =item B--help
+ 
+ Print a summary of command line options.
+ 
+ =item B-o Ffilename
+ 
+ Specify the output file name.  If Ffilename is C-, then Bllvm2cpp
+ sends its output to standard output.
+ 
+ =item B-modname FmoduleName
+ 
+ Specify the name of the module to be generated. Normally the generated program
+ creates a module that has the same name as the input file. If the input file 
was
+ read from the standard input then the module name will be 'stdin'. This 
option
+ overrides both these default actions and specifies that the module name used
+ must be FmoduleName.
+ 
+ =back
+ 
+ =head1 EXIT STATUS
+ 
+ If Bllvm2cpp succeeds, it will exit with 0.  Otherwise, if an error
+ occurs, it will exit with a non-zero value.
+ 
+ =head1 SEE ALSO
+ 
+ Lllvm-as|llvm-as
+ 
+ =head1 AUTHORS
+ 
+ Maintained by the LLVM Team (Lhttp://llvm.org).
+ 
+ =cut


Index: llvm/docs/CommandGuide/index.html
diff -u llvm/docs/CommandGuide/index.html:1.26 
llvm/docs/CommandGuide/index.html:1.27
--- llvm/docs/CommandGuide/index.html:1.26  Thu Mar 23 18:03:37 2006
+++ llvm/docs/CommandGuide/index.html   Tue May 30 14:56:30 2006
@@ -73,8 +73,10 @@
   general purpose linker with loadable runtime optimization support/li
 
 lia href=html/llvm-config.htmlbllvm-config/b/a - 
-  print out LLVM compilation options, libraries, etc. as configured.
+  print out LLVM compilation options, libraries, etc. as configured./li
 
+  lia href=html/llvm2cpp.htmlbllvm2cpp/b/a - convert LLVM assembly
+  into the corresponding LLVM C++ API calls to produce it/li
 /ul
 
 /div
@@ -143,7 +145,7 @@
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
 
   a href=http://llvm.org;LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2006/03/24 00:03:37 $
+  Last modified: $Date: 2006/05/30 19:56:30 $
 /address
 
 /body



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


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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelDAGToDAG.cpp updated: 1.70 - 1.71
---
Log message:

Remove bogus comment.


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

 X86ISelDAGToDAG.cpp |1 -
 1 files changed, 1 deletion(-)


Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.70 
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.71
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.70Tue May 30 01:59:36 2006
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Tue May 30 15:24:48 2006
@@ -461,7 +461,6 @@
 
 /// SelectLEAAddr - it calls SelectAddr and determines if the maximal 
addressing
 /// mode it matches can be cost effectively emitted as an LEA instruction.
-/// For X86, it always is unless it's just a (Reg + const).
 bool X86DAGToDAGISel::SelectLEAAddr(SDOperand N, SDOperand Base,
 SDOperand Scale,
 SDOperand Index, SDOperand Disp) {



___
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/X86InstrInfo.cpp X86InstrSSE.td

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86InstrInfo.cpp updated: 1.52 - 1.53
X86InstrSSE.td updated: 1.117 - 1.118
---
Log message:

Allow shufps x, x, mask to be converted to pshufd x, mask to save a move.


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

 X86InstrInfo.cpp |   13 -
 X86InstrSSE.td   |1 +
 2 files changed, 13 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.52 
llvm/lib/Target/X86/X86InstrInfo.cpp:1.53
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.52   Fri May 19 13:43:41 2006
+++ llvm/lib/Target/X86/X86InstrInfo.cppTue May 30 15:26:50 2006
@@ -102,7 +102,6 @@
 }
 
 
-
 /// convertToThreeAddress - This method must be implemented by targets that
 /// set the M_CONVERTIBLE_TO_3_ADDR flag.  When this flag is set, the target
 /// may be able to convert a two-address instruction into a true
@@ -118,6 +117,18 @@
   unsigned Dest = MI-getOperand(0).getReg();
   unsigned Src = MI-getOperand(1).getReg();
 
+  switch (MI-getOpcode()) {
+  default: break;
+  case X86::SHUFPSrri: {
+assert(MI-getNumOperands() == 4  Unknown shufps instruction!);
+unsigned A = MI-getOperand(0).getReg();
+unsigned B = MI-getOperand(1).getReg();
+unsigned C = MI-getOperand(2).getReg();
+unsigned M = MI-getOperand(3).getImmedValue();
+return BuildMI(X86::PSHUFDri, 2, A).addReg(B).addImm(M);
+  }
+  }
+
   // FIXME: None of these instructions are promotable to LEAs without
   // additional information.  In particular, LEA doesn't set the flags that
   // add and inc do.  :(


Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.117 
llvm/lib/Target/X86/X86InstrSSE.td:1.118
--- llvm/lib/Target/X86/X86InstrSSE.td:1.117Tue May 16 02:21:53 2006
+++ llvm/lib/Target/X86/X86InstrSSE.td  Tue May 30 15:26:50 2006
@@ -1218,6 +1218,7 @@
 
 // Shuffle and unpack instructions
 let isTwoAddress = 1 in {
+let isConvertibleToThreeAddress = 1 in // Convert to pshufd
 def SHUFPSrri : PSIi80xC6, MRMSrcReg, 
  (ops VR128:$dst, VR128:$src1, VR128:$src2, 
i32i8imm:$src3),
  shufps {$src3, $src2, $dst|$dst, $src2, $src3},



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-04-27-ISelFoldingBug.ll

2006-05-30 Thread Evan Cheng


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

2006-04-27-ISelFoldingBug.ll updated: 1.1 - 1.2
---
Log message:

Fix the test failure on non-Darwin targets.


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

 2006-04-27-ISelFoldingBug.ll |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/Regression/CodeGen/X86/2006-04-27-ISelFoldingBug.ll
diff -u llvm/test/Regression/CodeGen/X86/2006-04-27-ISelFoldingBug.ll:1.1 
llvm/test/Regression/CodeGen/X86/2006-04-27-ISelFoldingBug.ll:1.2
--- llvm/test/Regression/CodeGen/X86/2006-04-27-ISelFoldingBug.ll:1.1   Thu Apr 
27 20:21:37 2006
+++ llvm/test/Regression/CodeGen/X86/2006-04-27-ISelFoldingBug.ll   Tue May 
30 15:35:46 2006
@@ -1,4 +1,4 @@
-; RUN: llvm-as  %s | llc -march=x86 -relocation-model=static | grep 'movl 
_last' | wc -l | grep 2
+; RUN: llvm-as  %s | llc -march=x86 -mtriple=i686-apple-darwin8.6.1 
-relocation-model=static | grep 'movl _last' | wc -l | grep 2
 
 %block = external global ubyte*; ubyte** [#uses=1]
 %last = external global int; int* [#uses=3]



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


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

2006-05-30 Thread Evan Cheng


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

vec_call.ll added (r1.1)
---
Log message:

Added a test case for parameter passing of vector values.


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

 vec_call.ll |9 +
 1 files changed, 9 insertions(+)


Index: llvm/test/Regression/CodeGen/X86/vec_call.ll
diff -c /dev/null llvm/test/Regression/CodeGen/X86/vec_call.ll:1.1
*** /dev/null   Tue May 30 15:37:10 2006
--- llvm/test/Regression/CodeGen/X86/vec_call.llTue May 30 15:37:00 2006
***
*** 0 
--- 1,9 
+ ; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep 'subl.*60'
+ ; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep 'movdqa.*32'
+ 
+ void %test() {
+   tail call void %xx( int 1, int 2, int 3, int 4, int 5, int 6, int 7, 2 
x long cast (4 x int  int 4, int 3, int 2, int 1  to 2 x long), 2 x 
long cast (4 x int  int 8, int 7, int 6, int 5  to 2 x long), 2 x long 
cast (4 x int  int 6, int 4, int 2, int 0  to 2 x long), 2 x long cast 
(4 x int  int 8, int 4, int 2, int 1  to 2 x long), 2 x long cast (4 x 
int  int 0, int 1, int 3, int 9  to 2 x long) )
+   ret void
+ }
+ 
+ declare void %xx(int, int, int, int, int, int, int, 2 x long, 2 x long, 
2 x long, 2 x long, 2 x long)



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


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

2006-05-30 Thread Reid Spencer


Changes in directory llvm/docs/CommandGuide:

llvm2cpp.pod updated: 1.1 - 1.2
---
Log message:

Add the new command line arguments.


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

 llvm2cpp.pod |   16 
 1 files changed, 16 insertions(+)


Index: llvm/docs/CommandGuide/llvm2cpp.pod
diff -u llvm/docs/CommandGuide/llvm2cpp.pod:1.1 
llvm/docs/CommandGuide/llvm2cpp.pod:1.2
--- llvm/docs/CommandGuide/llvm2cpp.pod:1.1 Tue May 30 14:56:31 2006
+++ llvm/docs/CommandGuide/llvm2cpp.pod Tue May 30 16:19:29 2006
@@ -70,6 +70,22 @@
 overrides both these default actions and specifies that the module name used
 must be FmoduleName.
 
+=item B-funcname FfunctionName
+
+Specify the name of the function to be generated. The generated code contains a
+single function that produces the input module. By default its name is
+ImakeLLVMModule. The B-funcname option overrides this default and allows
+you to control the name of the generated function. This is handy in conjunction
+with the B-fragment option when you only want Bllvm2cpp to generate a
+single function that produces the module. With both options, such generated 
code
+could be I#included into another program.
+
+=item B-fragment
+
+This boolean option tells Bllvm2cpp to generate only a program fragment. By
+deault Bllvm2cpp generates a full program. With this option specified, only a
+single function that generates the input module will be generated.
+
 =back
 
 =head1 EXIT STATUS



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


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

2006-05-30 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCISelLowering.cpp updated: 1.185 - 1.186
---
Log message:

Always reserve space for 8 spilled GPRs.  GCC apparently assumes that this
space will be available, even if the callee isn't varargs.


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

 PPCISelLowering.cpp |   19 +++
 1 files changed, 7 insertions(+), 12 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.185 
llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.186
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.185   Fri May 26 18:10:12 2006
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue May 30 16:21:04 2006
@@ -916,18 +916,13 @@
   for (unsigned i = 0; i != NumOps; ++i)
 NumBytes += MVT::getSizeInBits(Op.getOperand(5+2*i).getValueType())/8;
 
-  // If we are calling what looks like a varargs function on the caller side,
-  // there are two cases:
-  //  1) The callee uses va_start.
-  //  2) The callee doesn't use va_start.
-  //
-  // In the case of #1, the prolog code will store up to 8 GPR argument
-  // registers to the stack, allowing va_start to index over them in memory.
-  // Because we cannot tell the difference (on the caller side) between #1/#2,
-  // we have to conservatively assume we have #1.  As such, make sure we have
-  // at least enough stack space for the caller to store the 8 GPRs.
-  if (isVarArg  Op.getNumOperands()  5  NumBytes  56)
-NumBytes = 56;
+  // The prolog code of the callee may store up to 8 GPR argument registers to
+  // the stack, allowing va_start to index over them in memory if its varargs.
+  // Because we cannot tell if this is needed on the caller side, we have to
+  // conservatively assume that it is needed.  As such, make sure we have at
+  // least enough stack space for the caller to store the 8 GPRs.
+  if (NumBytes  24+8*4)
+NumBytes = 24+8*4;
   
   // Adjust the stack pointer for the new arguments...
   // These operations are automatically eliminated by the prolog/epilog pass



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


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

2006-05-30 Thread Reid Spencer


Changes in directory llvm/tools:

Makefile updated: 1.47 - 1.48
---
Log message:

llvm2cpp is ready to be compiled so add it to the makefile, but make it
optional.


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

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


Index: llvm/tools/Makefile
diff -u llvm/tools/Makefile:1.47 llvm/tools/Makefile:1.48
--- llvm/tools/Makefile:1.47Wed May 17 16:20:50 2006
+++ llvm/tools/Makefile Tue May 30 16:20:55 2006
@@ -12,4 +12,6 @@
  analyze llvm-extract llvm-nm llvm-prof llvm-ar llvm-ranlib \
  llvm-bcanalyzer llvmc llvm-ld llvm-db bugpoint llvm-config
 
+OPTIONAL_DIRS := llvm2cpp
+
 include $(LEVEL)/Makefile.common



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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86InstrInfo.cpp updated: 1.53 - 1.54
---
Log message:

Oops. PSHUFD is only available with SSE2.


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

 X86InstrInfo.cpp |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.53 
llvm/lib/Target/X86/X86InstrInfo.cpp:1.54
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.53   Tue May 30 15:26:50 2006
+++ llvm/lib/Target/X86/X86InstrInfo.cppTue May 30 16:30:59 2006
@@ -121,11 +121,14 @@
   default: break;
   case X86::SHUFPSrri: {
 assert(MI-getNumOperands() == 4  Unknown shufps instruction!);
-unsigned A = MI-getOperand(0).getReg();
-unsigned B = MI-getOperand(1).getReg();
-unsigned C = MI-getOperand(2).getReg();
-unsigned M = MI-getOperand(3).getImmedValue();
-return BuildMI(X86::PSHUFDri, 2, A).addReg(B).addImm(M);
+const X86Subtarget *Subtarget = TM.getSubtargetX86Subtarget();
+if (Subtarget-hasSSE2()) {
+  unsigned A = MI-getOperand(0).getReg();
+  unsigned B = MI-getOperand(1).getReg();
+  unsigned C = MI-getOperand(2).getReg();
+  unsigned M = MI-getOperand(3).getImmedValue();
+  return BuildMI(X86::PSHUFDri, 2, A).addReg(B).addImm(M);
+}
   }
   }
 



___
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/X86InstrInfo.cpp X86InstrInfo.h X86TargetMachine.cpp X86TargetMachine.h

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86InstrInfo.cpp updated: 1.54 - 1.55
X86InstrInfo.h updated: 1.52 - 1.53
X86TargetMachine.cpp updated: 1.115 - 1.116
X86TargetMachine.h updated: 1.36 - 1.37
---
Log message:

Fix a build breaker.


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

 X86InstrInfo.cpp |   22 --
 X86InstrInfo.h   |4 +++-
 X86TargetMachine.cpp |4 ++--
 X86TargetMachine.h   |4 ++--
 4 files changed, 19 insertions(+), 15 deletions(-)


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.54 
llvm/lib/Target/X86/X86InstrInfo.cpp:1.55
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.54   Tue May 30 16:30:59 2006
+++ llvm/lib/Target/X86/X86InstrInfo.cppTue May 30 16:45:53 2006
@@ -13,13 +13,16 @@
 
 #include X86InstrInfo.h
 #include X86.h
+#include X86GenInstrInfo.inc
 #include X86InstrBuilder.h
+#include X86Subtarget.h
+#include X86TargetMachine.h
 #include llvm/CodeGen/MachineInstrBuilder.h
-#include X86GenInstrInfo.inc
 using namespace llvm;
 
-X86InstrInfo::X86InstrInfo()
-  : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0])) {
+X86InstrInfo::X86InstrInfo(X86TargetMachine tm)
+  : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0])),
+TM(tm) {
 }
 
 
@@ -122,13 +125,12 @@
   case X86::SHUFPSrri: {
 assert(MI-getNumOperands() == 4  Unknown shufps instruction!);
 const X86Subtarget *Subtarget = TM.getSubtargetX86Subtarget();
-if (Subtarget-hasSSE2()) {
-  unsigned A = MI-getOperand(0).getReg();
-  unsigned B = MI-getOperand(1).getReg();
-  unsigned C = MI-getOperand(2).getReg();
-  unsigned M = MI-getOperand(3).getImmedValue();
-  return BuildMI(X86::PSHUFDri, 2, A).addReg(B).addImm(M);
-}
+if (!Subtarget-hasSSE2()) return 0;
+unsigned A = MI-getOperand(0).getReg();
+unsigned B = MI-getOperand(1).getReg();
+unsigned C = MI-getOperand(2).getReg();
+unsigned M = MI-getOperand(3).getImmedValue();
+return BuildMI(X86::PSHUFDri, 2, A).addReg(B).addImm(M);
   }
   }
 


Index: llvm/lib/Target/X86/X86InstrInfo.h
diff -u llvm/lib/Target/X86/X86InstrInfo.h:1.52 
llvm/lib/Target/X86/X86InstrInfo.h:1.53
--- llvm/lib/Target/X86/X86InstrInfo.h:1.52 Wed May 24 12:04:04 2006
+++ llvm/lib/Target/X86/X86InstrInfo.h  Tue May 30 16:45:53 2006
@@ -18,6 +18,7 @@
 #include X86RegisterInfo.h
 
 namespace llvm {
+  class X86TargetMachine;
 
 /// X86II - This namespace holds all of the target specific flags that
 /// instruction info tracks.
@@ -168,9 +169,10 @@
 }
 
 class X86InstrInfo : public TargetInstrInfo {
+  X86TargetMachine TM;
   const X86RegisterInfo RI;
 public:
-  X86InstrInfo();
+  X86InstrInfo(X86TargetMachine tm);
 
   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
   /// such, whenever a client has an instance of instruction info, it should


Index: llvm/lib/Target/X86/X86TargetMachine.cpp
diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.115 
llvm/lib/Target/X86/X86TargetMachine.cpp:1.116
--- llvm/lib/Target/X86/X86TargetMachine.cpp:1.115  Sat May 20 18:28:54 2006
+++ llvm/lib/Target/X86/X86TargetMachine.cppTue May 30 16:45:53 2006
@@ -69,11 +69,11 @@
 ///
 X86TargetMachine::X86TargetMachine(const Module M, const std::string FS)
   : TargetMachine(X86),
-DataLayout(std::string(X86), std::string(e-p:32:32-d:32-l:32)),
 Subtarget(M, FS),
+DataLayout(std::string(X86), std::string(e-p:32:32-d:32-l:32)),
 FrameInfo(TargetFrameInfo::StackGrowsDown,
   Subtarget.getStackAlignment(), -4),
-JITInfo(*this), TLInfo(*this) {
+InstrInfo(*this), JITInfo(*this), TLInfo(*this) {
   if (getRelocationModel() == Reloc::Default)
 if (Subtarget.isTargetDarwin())
   setRelocationModel(Reloc::DynamicNoPIC);


Index: llvm/lib/Target/X86/X86TargetMachine.h
diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.36 
llvm/lib/Target/X86/X86TargetMachine.h:1.37
--- llvm/lib/Target/X86/X86TargetMachine.h:1.36 Fri May 12 16:14:20 2006
+++ llvm/lib/Target/X86/X86TargetMachine.h  Tue May 30 16:45:53 2006
@@ -27,10 +27,10 @@
 namespace llvm {
 
 class X86TargetMachine : public TargetMachine {
-  const TargetData DataLayout;   // Calculates type size  alignment
-  X86InstrInfo  InstrInfo;
   X86Subtarget  Subtarget;
+  const TargetData DataLayout;   // Calculates type size  alignment
   TargetFrameInfo   FrameInfo;
+  X86InstrInfo  InstrInfo;
   X86JITInfoJITInfo;
   X86TargetLowering TLInfo;
 public:



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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86InstrInfo.cpp updated: 1.55 - 1.56
---
Log message:

Somehow I lost a condition when I was shuffling some code around. Anyway,
only transform a shufps to pshufd when the first two operands are the same.


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

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


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.55 
llvm/lib/Target/X86/X86InstrInfo.cpp:1.56
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.55   Tue May 30 16:45:53 2006
+++ llvm/lib/Target/X86/X86InstrInfo.cppTue May 30 17:13:36 2006
@@ -125,11 +125,11 @@
   case X86::SHUFPSrri: {
 assert(MI-getNumOperands() == 4  Unknown shufps instruction!);
 const X86Subtarget *Subtarget = TM.getSubtargetX86Subtarget();
-if (!Subtarget-hasSSE2()) return 0;
 unsigned A = MI-getOperand(0).getReg();
 unsigned B = MI-getOperand(1).getReg();
 unsigned C = MI-getOperand(2).getReg();
 unsigned M = MI-getOperand(3).getImmedValue();
+if (!Subtarget-hasSSE2() || B != C) return 0;
 return BuildMI(X86::PSHUFDri, 2, A).addReg(B).addImm(M);
   }
   }



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


[llvm-commits] CVS: llvm-www/pubs/2005-11-SAFECodeTR.html

2006-05-30 Thread Chris Lattner


Changes in directory llvm-www/pubs:

2005-11-SAFECodeTR.html updated: 1.1 - 1.2
---
Log message:

Add a bibtex entry, contributed by Nick Lewycky


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

 2005-11-SAFECodeTR.html |   14 ++
 1 files changed, 14 insertions(+)


Index: llvm-www/pubs/2005-11-SAFECodeTR.html
diff -u llvm-www/pubs/2005-11-SAFECodeTR.html:1.1 
llvm-www/pubs/2005-11-SAFECodeTR.html:1.2
--- llvm-www/pubs/2005-11-SAFECodeTR.html:1.1   Thu Nov 17 15:46:30 2005
+++ llvm-www/pubs/2005-11-SAFECodeTR.html   Tue May 30 17:40:56 2006
@@ -66,5 +66,19 @@
   Weakly Typed Languages/a (PDF)/li
 /ul
 
+h2BibTeX Entry:/h2
+
+pre
[EMAIL PROTECTED],
+  author = {Dinakar Dhurjati and Sumant Kowshik and Vikram Adve},
+  title = {Enforcing Alias Analysis for Weakly Typed Languages},
+  institution = {Computer Science Dept., Univ. of Illinois},
+  year = {2005},
+  month = {Nov},
+  number = {\#UIUCDCS-R-2005-2657},
+  url = {http://llvm.org/pubs/2005-11-SAFECodeTR.html}
+}
+/pre
+
 /body
 /html



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


[llvm-commits] CVS: llvm/test/lib/llvm2cpp.exp

2006-05-30 Thread Reid Spencer


Changes in directory llvm/test/lib:

llvm2cpp.exp updated: 1.3 - 1.4
---
Log message:

1. No need to thwart this test with an environment variable. Turning it off
   is the default and handled by the makefile system and runtest
2. Redirect stderr of llvm-as and llvm2cpp so that warning messages about
   instrinsics don't cause Tcl to report the run as failed.


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

 llvm2cpp.exp |  133 ++-
 1 files changed, 68 insertions(+), 65 deletions(-)


Index: llvm/test/lib/llvm2cpp.exp
diff -u llvm/test/lib/llvm2cpp.exp:1.3 llvm/test/lib/llvm2cpp.exp:1.4
--- llvm/test/lib/llvm2cpp.exp:1.3  Mon May 29 13:09:38 2006
+++ llvm/test/lib/llvm2cpp.exp  Tue May 30 18:07:17 2006
@@ -6,73 +6,76 @@
 # the original input to llvm2cpp.
 
 proc llvm2cpp-test { files } {
-#  if { $env(LLVM_RUNLLVM2CPP_TEST) == 1 } {
-global subdir llvmtoolsdir llvmlibsdir objdir srcdir objroot srcroot 
-set timeout 30
-set path [file join $objdir $subdir]
-set llvm2cpp [file join $llvmtoolsdir llvm2cpp ]
-set llvmas [file join $llvmtoolsdir llvm-as ]
-set llvmdis [file join $llvmtoolsdir llvm-dis ]
-
-#Make Output Directory if it does not exist already
-if { [file exists path] } {
-   cd $path
-} else {
-   file mkdir $path
-   cd $path
+  global subdir llvmtoolsdir llvmlibsdir objdir srcdir objroot srcroot 
+  set timeout 30
+  set path [file join $objdir $subdir]
+  set llvm2cpp [file join $llvmtoolsdir llvm2cpp ]
+  set llvmas [file join $llvmtoolsdir llvm-as ]
+  set llvmdis [file join $llvmtoolsdir llvm-dis ]
+
+  #Make Output Directory if it does not exist already
+  if { [file exists path] } {
+  cd $path
+  } else {
+  file mkdir $path
+  cd $path
+  }
+  
+  file mkdir Output
+
+  foreach test $files {
+  
+set filename [file tail $test]
+set generated [file join Output $filename.cpp]
+set executable [file join Output $filename.exe]
+set output [file join Output $filename.gen]
+set assembly [file join Output $filename.asm]
+set testname [file rootname $filename]
+set bytecode [file join Output $filename.bc]
+
+# Note that the stderr for llvm-as must be redirected to /dev/null because
+# otherwise exec will see the msgs and return 1 even though they are only 
+# warnings. If real errors are generated on stderr then llvm-as will return
+# a non-zero retval anyway so we're good.
+set retval [ catch { 
+  exec -keepnewline $llvmas $test -o - | $llvmdis -f -o $assembly 
2/dev/null } msg ]
+
+if { $retval != 0 } {
+  fail $test: llvm-as/llvm-dis returned $retval\n$msg
+  continue 
 }
-
-file mkdir Output
- 
-foreach test $files {
-   
-  set filename [file tail $test]
-  set generated [file join Output $filename.cpp]
-  set executable [file join Output $filename.exe]
-  set output [file join Output $filename.gen]
-  set assembly [file join Output $filename.asm]
-  set testname [file rootname $filename]
-
-  set retval [ catch { 
-exec -keepnewline $llvmas $test -o - | $llvmdis -f -o $assembly } msg 
] 
-
-  if { $retval != 0 } {
-fail $test: llvm-as/llvm-dis returned $retval\n$msg
-continue 
-  }
-
-  set retval [ catch { 
-exec -keepnewline $llvm2cpp -f -o $generated  $test } msg]
-
-  if { $retval != 0 } {
-fail $test: llvm2cpp returned $retval\n$msg
-continue
-  }
-
-  set retval [ catch { 
-exec -keepnewline gcc -g -D__STDC_LIMIT_MACROS -o $executable 
$generated -I$srcroot/include -I$objroot/include -L$llvmlibsdir 
$llvmlibsdir/LLVMCore.o -lLLVMSupport $llvmlibsdir/LLVMbzip2.o -lLLVMSystem 
-lstdc++ } msg ] 
-  if { $retval != 0 } {
-fail $test: gcc returned $retval\n$msg
-continue
-  }
-
-  set retval [ catch { exec -keepnewline $executable  $output } msg ]
-  if { $retval != 0 } {
-set execname [file tail $executable]
-fail $test: $execname returned $retval:\n$msg
-continue
-  } 
-
-  set retval [ catch { 
-exec -keepnewline diff $assembly $output } msg ]
-
-  if { $retval != 0 } {
-fail $test: diff returned $retval:\n$msg
-continue
-  }
-  pass $test
+
+set retval [ catch { 
+  exec -keepnewline $llvm2cpp -f -o $generated  $test 2/dev/null } msg]
+
+if { $retval != 0 } {
+  fail $test: llvm2cpp returned $retval\n$msg
+  continue
+}
+
+set retval [ catch { 
+  exec -keepnewline gcc -g -D__STDC_LIMIT_MACROS -o $executable $generated 
-I$srcroot/include -I$objroot/include -L$llvmlibsdir $llvmlibsdir/LLVMCore.o 
-lLLVMSupport $llvmlibsdir/LLVMbzip2.o -lLLVMSystem -lstdc++ } msg ] 
+if { $retval != 0 } {
+  fail $test: gcc returned $retval\n$msg
+  continue
+}
+
+set retval [ catch { exec -keepnewline $executable  $output } msg ]
+if { $retval 

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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86InstrInfo.cpp updated: 1.56 - 1.57
X86InstrSSE.td updated: 1.118 - 1.119
---
Log message:

Commute shufps / shufpd.


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

 X86InstrInfo.cpp |   18 ++
 X86InstrSSE.td   |3 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.56 
llvm/lib/Target/X86/X86InstrInfo.cpp:1.57
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.56   Tue May 30 17:13:36 2006
+++ llvm/lib/Target/X86/X86InstrInfo.cppTue May 30 18:34:30 2006
@@ -207,6 +207,24 @@
 ///
 MachineInstr *X86InstrInfo::commuteInstruction(MachineInstr *MI) const {
   switch (MI-getOpcode()) {
+  case X86::SHUFPSrri: { // A = SHUFPSrri B,C, M - A = SHUFPSrri C,B, 
rotl(M,4)
+unsigned A = MI-getOperand(0).getReg();
+unsigned B = MI-getOperand(1).getReg();
+unsigned C = MI-getOperand(2).getReg();
+unsigned M = MI-getOperand(3).getImmedValue();
+if (B == C) return 0;
+return BuildMI(X86::SHUFPSrri, 3, A).addReg(C).addReg(B).
+  addImm(((M  0xF)  4) | ((M  0xF0)  4));
+  }
+  case X86::SHUFPDrri: { // A = SHUFPDrri B,C, M - A = SHUFPDrri C,B, 
rotl(M,1)
+unsigned A = MI-getOperand(0).getReg();
+unsigned B = MI-getOperand(1).getReg();
+unsigned C = MI-getOperand(2).getReg();
+unsigned M = MI-getOperand(3).getImmedValue();
+if (B == C) return 0;
+return BuildMI(X86::SHUFPDrri, 3, A).addReg(C).addReg(B).
+  addImm(((M  0x1)  1) | ((M  0x2)  1));
+  }
   case X86::SHRD16rri8: // A = SHRD16rri8 B, C, I - A = SHLD16rri8 C, B, 
(16-I)
   case X86::SHLD16rri8: // A = SHLD16rri8 B, C, I - A = SHRD16rri8 C, B, 
(16-I)
   case X86::SHRD32rri8: // A = SHRD32rri8 B, C, I - A = SHLD32rri8 C, B, 
(32-I)


Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.118 
llvm/lib/Target/X86/X86InstrSSE.td:1.119
--- llvm/lib/Target/X86/X86InstrSSE.td:1.118Tue May 30 15:26:50 2006
+++ llvm/lib/Target/X86/X86InstrSSE.td  Tue May 30 18:34:30 2006
@@ -1218,7 +1218,7 @@
 
 // Shuffle and unpack instructions
 let isTwoAddress = 1 in {
-let isConvertibleToThreeAddress = 1 in // Convert to pshufd
+let isCommutable = 1, isConvertibleToThreeAddress = 1 in // Convert to pshufd
 def SHUFPSrri : PSIi80xC6, MRMSrcReg, 
  (ops VR128:$dst, VR128:$src1, VR128:$src2, 
i32i8imm:$src3),
  shufps {$src3, $src2, $dst|$dst, $src2, $src3},
@@ -1231,6 +1231,7 @@
  [(set VR128:$dst, (v4f32 (vector_shuffle
VR128:$src1, (load addr:$src2),
SHUFP_shuffle_mask:$src3)))];
+let isCommutable = 1 in
 def SHUFPDrri : PDIi80xC6, MRMSrcReg, 
  (ops VR128:$dst, VR128:$src1, VR128:$src2, i8imm:$src3),
  shufpd {$src3, $src2, $dst|$dst, $src2, $src3},



___
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/X86InstrSSE.td

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86InstrSSE.td updated: 1.119 - 1.120
---
Log message:

MAXP{D|S} and MINP{D|S} are commutable.


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

 X86InstrSSE.td |   42 --
 1 files changed, 24 insertions(+), 18 deletions(-)


Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.119 
llvm/lib/Target/X86/X86InstrSSE.td:1.120
--- llvm/lib/Target/X86/X86InstrSSE.td:1.119Tue May 30 18:34:30 2006
+++ llvm/lib/Target/X86/X86InstrSSE.td  Tue May 30 18:47:30 2006
@@ -391,20 +391,22 @@
  rcpss {$src, $dst|$dst, $src}, [];
 
 let isTwoAddress = 1 in {
+let isCommutable = 1 in {
 def MAXSSrr : SSI0x5F, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2),
   maxss {$src2, $dst|$dst, $src2}, [];
-def MAXSSrm : SSI0x5F, MRMSrcMem, (ops FR32:$dst, FR32:$src1, f32mem:$src2),
-  maxss {$src2, $dst|$dst, $src2}, [];
 def MAXSDrr : SDI0x5F, MRMSrcReg, (ops FR64:$dst, FR32:$src1, FR64:$src2),
   maxsd {$src2, $dst|$dst, $src2}, [];
-def MAXSDrm : SDI0x5F, MRMSrcMem, (ops FR64:$dst, FR32:$src1, f64mem:$src2),
-  maxsd {$src2, $dst|$dst, $src2}, [];
 def MINSSrr : SSI0x5D, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2),
   minss {$src2, $dst|$dst, $src2}, [];
-def MINSSrm : SSI0x5D, MRMSrcMem, (ops FR32:$dst, FR32:$src1, f32mem:$src2),
-  minss {$src2, $dst|$dst, $src2}, [];
 def MINSDrr : SDI0x5D, MRMSrcReg, (ops FR64:$dst, FR32:$src1, FR64:$src2),
   minsd {$src2, $dst|$dst, $src2}, [];
+}
+def MAXSSrm : SSI0x5F, MRMSrcMem, (ops FR32:$dst, FR32:$src1, f32mem:$src2),
+  maxss {$src2, $dst|$dst, $src2}, [];
+def MAXSDrm : SDI0x5F, MRMSrcMem, (ops FR64:$dst, FR32:$src1, f64mem:$src2),
+  maxsd {$src2, $dst|$dst, $src2}, [];
+def MINSSrm : SSI0x5D, MRMSrcMem, (ops FR32:$dst, FR32:$src1, f32mem:$src2),
+  minss {$src2, $dst|$dst, $src2}, [];
 def MINSDrm : SDI0x5D, MRMSrcMem, (ops FR64:$dst, FR32:$src1, f64mem:$src2),
   minsd {$src2, $dst|$dst, $src2}, [];
 }
@@ -469,20 +471,22 @@
int_x86_sse_rcp_ss;
 
 let isTwoAddress = 1 in {
+let isCommutable = 1 in {
 def Int_MAXSSrr : SS_Intrr0x5F, maxss {$src2, $dst|$dst, $src2},
int_x86_sse_max_ss;
-def Int_MAXSSrm : SS_Intrm0x5F, maxss {$src2, $dst|$dst, $src2},
-   int_x86_sse_max_ss;
 def Int_MAXSDrr : SD_Intrr0x5F, maxsd {$src2, $dst|$dst, $src2},
int_x86_sse2_max_sd;
-def Int_MAXSDrm : SD_Intrm0x5F, maxsd {$src2, $dst|$dst, $src2},
-   int_x86_sse2_max_sd;
 def Int_MINSSrr : SS_Intrr0x5D, minss {$src2, $dst|$dst, $src2},
int_x86_sse_min_ss;
-def Int_MINSSrm : SS_Intrm0x5D, minss {$src2, $dst|$dst, $src2},
-   int_x86_sse_min_ss;
 def Int_MINSDrr : SD_Intrr0x5D, minsd {$src2, $dst|$dst, $src2},
int_x86_sse2_min_sd;
+}
+def Int_MAXSSrm : SS_Intrm0x5F, maxss {$src2, $dst|$dst, $src2},
+   int_x86_sse_max_ss;
+def Int_MAXSDrm : SD_Intrm0x5F, maxsd {$src2, $dst|$dst, $src2},
+   int_x86_sse2_max_sd;
+def Int_MINSSrm : SS_Intrm0x5D, minss {$src2, $dst|$dst, $src2},
+   int_x86_sse_min_ss;
 def Int_MINSDrm : SD_Intrm0x5D, minsd {$src2, $dst|$dst, $src2},
int_x86_sse2_min_sd;
 }
@@ -1098,20 +1102,22 @@
  int_x86_sse_rcp_ps;
 
 let isTwoAddress = 1 in {
+let isCommutable = 1 in {
 def MAXPSrr : PS_Intrr0x5F, maxps {$src2, $dst|$dst, $src2},
int_x86_sse_max_ps;
-def MAXPSrm : PS_Intrm0x5F, maxps {$src2, $dst|$dst, $src2},
-   int_x86_sse_max_ps;
 def MAXPDrr : PD_Intrr0x5F, maxpd {$src2, $dst|$dst, $src2},
int_x86_sse2_max_pd;
-def MAXPDrm : PD_Intrm0x5F, maxpd {$src2, $dst|$dst, $src2},
-   int_x86_sse2_max_pd;
 def MINPSrr : PS_Intrr0x5D, minps {$src2, $dst|$dst, $src2},
int_x86_sse_min_ps;
-def MINPSrm : PS_Intrm0x5D, minps {$src2, $dst|$dst, $src2},
-   int_x86_sse_min_ps;
 def MINPDrr : PD_Intrr0x5D, minpd {$src2, $dst|$dst, $src2},
int_x86_sse2_min_pd;
+}
+def MAXPSrm : PS_Intrm0x5F, maxps {$src2, $dst|$dst, $src2},
+   int_x86_sse_max_ps;
+def MAXPDrm : PD_Intrm0x5F, maxpd {$src2, $dst|$dst, $src2},
+   int_x86_sse2_max_pd;
+def MINPSrm : PS_Intrm0x5D, minps {$src2, $dst|$dst, $src2},
+   int_x86_sse_min_ps;
 def MINPDrm : PD_Intrm0x5D, minpd {$src2, $dst|$dst, $src2},
int_x86_sse2_min_pd;
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu

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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

README-SSE.txt updated: 1.1 - 1.2
---
Log message:

A new entry

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

 README-SSE.txt |4 
 1 files changed, 4 insertions(+)


Index: llvm/lib/Target/X86/README-SSE.txt
diff -u llvm/lib/Target/X86/README-SSE.txt:1.1 
llvm/lib/Target/X86/README-SSE.txt:1.2
--- llvm/lib/Target/X86/README-SSE.txt:1.1  Fri May 19 15:51:43 2006
+++ llvm/lib/Target/X86/README-SSE.txt  Tue May 30 18:56:31 2006
@@ -660,3 +660,7 @@
 Accelerate_sse_migration/index.html
 
 e.g. SSE select using and, andnot, or. Various SSE compare translations.
+
+//===-===//
+
+Add hooks to commute some CMPP operations.



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


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

2006-05-30 Thread Evan Cheng


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

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

Update vector extract test cases.


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

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


Index: llvm/test/Regression/CodeGen/X86/vec_extract.ll
diff -u llvm/test/Regression/CodeGen/X86/vec_extract.ll:1.2 
llvm/test/Regression/CodeGen/X86/vec_extract.ll:1.3
--- llvm/test/Regression/CodeGen/X86/vec_extract.ll:1.2 Thu Apr 20 23:58:23 2006
+++ llvm/test/Regression/CodeGen/X86/vec_extract.ll Tue May 30 19:48:09 2006
@@ -1,5 +1,5 @@
 ; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep movss| wc -l | 
grep 3 
-; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep unpckhps | wc -l | 
grep 1 
+; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep movhlps  | wc -l | 
grep 1 
 ; RUN: llvm-as  %s | llc -march=x86 -mattr=+sse2 | grep pshufd   | wc -l | 
grep 1
 
 void %test1(4 x float* %F, float* %f) {
@@ -19,7 +19,7 @@
 
 void %test2(float* %R, 4 x float* %P1) {
%X = load 4 x float* %P1
-   %tmp = extractelement 4 x float %X, uint 2
+   %tmp = extractelement 4 x float %X, uint 3
store float %tmp, float* %R
ret void
 }



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


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

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.223 - 1.224
---
Log message:

Remove dead code.

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

 X86ISelLowering.cpp |3 ---
 1 files changed, 3 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.223 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.224
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.223   Fri May 26 18:10:12 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue May 30 19:50:42 2006
@@ -2758,11 +2758,8 @@
 unsigned Idx = castConstantSDNode(Op.getOperand(1))-getValue();
 if (Idx == 0)
   return Op;
-
 // SHUFPS the element to the lowest double word, then movss.
 MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(4);
-SDOperand IdxNode = DAG.getConstant((Idx  2) ? Idx : Idx+4,
-MVT::getVectorBaseType(MaskVT));
 std::vectorSDOperand IdxVec;
 IdxVec.push_back(DAG.getConstant(Idx, MVT::getVectorBaseType(MaskVT)));
 IdxVec.push_back(DAG.getNode(ISD::UNDEF, MVT::getVectorBaseType(MaskVT)));



___
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/X86InstrSSE.td

2006-05-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86InstrSSE.td updated: 1.120 - 1.121
---
Log message:

Select vector_shuffle v1, undef 2, 3, ?, ? to MOVHLPS.


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

 X86InstrSSE.td |8 
 1 files changed, 8 insertions(+)


Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.120 
llvm/lib/Target/X86/X86InstrSSE.td:1.121
--- llvm/lib/Target/X86/X86InstrSSE.td:1.120Tue May 30 18:47:30 2006
+++ llvm/lib/Target/X86/X86InstrSSE.td  Tue May 30 19:51:37 2006
@@ -2453,6 +2453,14 @@
   MOVHLPS_shuffle_mask)),
   (v4i32 (MOVHLPSrr VR128:$src1, VR128:$src2));
 
+// vector_shuffle v1, undef 2, 3, ?, ? using MOVHLPS
+def : Pat(v4f32 (vector_shuffle VR128:$src1, (undef),
+  UNPCKH_shuffle_mask)),
+  (v4f32 (MOVHLPSrr VR128:$src1, VR128:$src1));
+def : Pat(v4i32 (vector_shuffle VR128:$src1, (undef),
+  UNPCKH_shuffle_mask)),
+  (v4i32 (MOVHLPSrr VR128:$src1, VR128:$src1));
+
 // vector_shuffle v1, (load v2) 4, 5, 2, 3 using MOVLPS
 // vector_shuffle v1, (load v2) 0, 1, 4, 5 using MOVHPS
 def : Pat(v4f32 (vector_shuffle VR128:$src1, (loadv4f32 addr:$src2),



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


[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp

2006-05-30 Thread Reid Spencer


Changes in directory llvm/tools/llvm2cpp:

CppWriter.cpp updated: 1.6 - 1.7
---
Log message:

Don't generate module definitions when the -fragment option is given.


---
Diffs of the changes:  (+59 -51)

 CppWriter.cpp |  110 +++---
 1 files changed, 59 insertions(+), 51 deletions(-)


Index: llvm/tools/llvm2cpp/CppWriter.cpp
diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.6 
llvm/tools/llvm2cpp/CppWriter.cpp:1.7
--- llvm/tools/llvm2cpp/CppWriter.cpp:1.6   Tue May 30 16:18:23 2006
+++ llvm/tools/llvm2cpp/CppWriter.cpp   Tue May 30 23:43:19 2006
@@ -71,7 +71,8 @@
 
   const Module* getModule() { return TheModule; }
 
-  void printModule(const Module *M);
+  void printModule();
+  void printFragment();
 
 private:
   void printTypes(const Module* M);
@@ -321,60 +322,23 @@
   return TypeNames[Ty] = name;
 }
 
-void CppWriter::printModule(const Module *M) {
-  Out  \n// Module Construction\n;
-  Out  Module* mod = new Module(\;
-  if (!ModName.empty())
-printEscapedString(ModName);
-  else if (M-getModuleIdentifier() == -)
-printEscapedString(stdin);
-  else 
-printEscapedString(M-getModuleIdentifier());
-  Out  \);\n;
-  Out  mod-setEndianness(;
-  switch (M-getEndianness()) {
-case Module::LittleEndian: Out  Module::LittleEndian);\n; break;
-case Module::BigEndian:Out  Module::BigEndian);\n;break;
-case Module::AnyEndianness:Out  Module::AnyEndianness);\n;  break;
-  }
-  Out  mod-setPointerSize(;
-  switch (M-getPointerSize()) {
-case Module::Pointer32:  Out  Module::Pointer32);\n; break;
-case Module::Pointer64:  Out  Module::Pointer64);\n; break;
-case Module::AnyPointerSize: Out  Module::AnyPointerSize);\n; break;
-  }
-  if (!M-getTargetTriple().empty())
-Out  mod-setTargetTriple(\  M-getTargetTriple()  \);\n;
-
-  if (!M-getModuleInlineAsm().empty()) {
-Out  mod-setModuleInlineAsm(\;
-printEscapedString(M-getModuleInlineAsm());
-Out  \);\n;
-  }
-  
-  // Loop over the dependent libraries and emit them.
-  Module::lib_iterator LI = M-lib_begin();
-  Module::lib_iterator LE = M-lib_end();
-  while (LI != LE) {
-Out  mod-addLibrary(\  *LI  \);\n;
-++LI;
-  }
-
+void CppWriter::printFragment() {
   // Print out all the type definitions
   Out  \n// Type Definitions\n;
-  printTypes(M);
+  printTypes(TheModule);
 
   // Functions can call each other and global variables can reference them so 
   // define all the functions first before emitting their function bodies.
   Out  \n// Function Declarations\n;
-  for (Module::const_iterator I = M-begin(), E = M-end(); I != E; ++I)
+  for (Module::const_iterator I = TheModule-begin(), E = TheModule-end(); 
+   I != E; ++I)
 printFunctionHead(I);
 
   // Process the global variables declarations. We can't initialze them until
   // after the constants are printed so just print a header for each global
   Out  \n// Global Variable Declarations\n;
-  for (Module::const_global_iterator I = M-global_begin(), E = 
M-global_end();
-   I != E; ++I) {
+  for (Module::const_global_iterator I = TheModule-global_begin(), 
+   E = TheModule-global_end(); I != E; ++I) {
 printGlobalHead(I);
   }
 
@@ -382,20 +346,21 @@
   // through GlobalValues. All GlobalValues have been declared at this point
   // so we can proceed to generate the constants.
   Out  \n// Constant Definitions\n;
-  printConstants(M);
+  printConstants(TheModule);
 
   // Process the global variables definitions now that all the constants have
   // been emitted. These definitions just couple the gvars with their constant
   // initializers.
   Out  \n// Global Variable Definitions\n;
-  for (Module::const_global_iterator I = M-global_begin(), E = 
M-global_end();
-   I != E; ++I) {
+  for (Module::const_global_iterator I = TheModule-global_begin(), 
+   E = TheModule-global_end(); I != E; ++I) {
 printGlobalBody(I);
   }
 
   // Finally, we can safely put out all of the function bodies.
   Out  \n// Function Definitions\n;
-  for (Module::const_iterator I = M-begin(), E = M-end(); I != E; ++I) {
+  for (Module::const_iterator I = TheModule-begin(), E = TheModule-end(); 
+   I != E; ++I) {
 if (!I-isExternal()) {
   Out  \n// Function:   I-getName()   (  getCppName(I) 
)\n{\n;
@@ -405,6 +370,48 @@
   }
 }
 
+void CppWriter::printModule() {
+  Out  \n// Module Construction\n;
+  Out  Module* mod = new Module(\;
+  if (!ModName.empty())
+printEscapedString(ModName);
+  else if (TheModule-getModuleIdentifier() == -)
+printEscapedString(stdin);
+  else 
+printEscapedString(TheModule-getModuleIdentifier());
+  Out  \);\n;
+  Out  mod-setEndianness(;
+  switch (TheModule-getEndianness()) {
+case Module::LittleEndian: Out  Module::LittleEndian);\n; break;
+case Module::BigEndian:Out  Module::BigEndian);\n;break;
+case Module::AnyEndianness:Out  Module::AnyEndianness);\n;  break;
+  }
+  Out