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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

APInt.h updated: 1.63 - 1.64
---
Log message:

add a method


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

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


Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.63 llvm/include/llvm/ADT/APInt.h:1.64
--- llvm/include/llvm/ADT/APInt.h:1.63  Wed Apr  4 01:18:21 2007
+++ llvm/include/llvm/ADT/APInt.h   Tue Apr 10 01:43:18 2007
@@ -281,6 +281,13 @@
 return *this != 0;
   }
 
+  /// getLimitedValue - Return this value, or return all ones if it is too 
large
+  /// to return.
+  uint64_t getLimitedValue(uint64_t Limit = ~0ULL) const {
+return (getActiveBits()  64 || getZExtValue()  Limit) ?
+  Limit :  getZExtValue();
+  }
+
   /// @}
   /// @name Value Generators
   /// @{



___
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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Constants.h updated: 1.144 - 1.145
---
Log message:

getLimitedValue now just forward to APInt's getLimitedValue.  Mark it const.


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

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


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.144 llvm/include/llvm/Constants.h:1.145
--- llvm/include/llvm/Constants.h:1.144 Mon Apr  2 20:41:34 2007
+++ llvm/include/llvm/Constants.h   Tue Apr 10 01:44:12 2007
@@ -189,9 +189,8 @@
   /// @returns the 64-bit value of this constant if its active bits number is 
   /// not greater than 64, otherwise, just return the given uint64_t number.
   /// @brief Get the constant's value if possible.
-  uint64_t getLimitedValue(uint64_t Limit) {
-return (Val.getActiveBits()  64 || Val.getZExtValue()  Limit) ? 
-   Limit : Val.getZExtValue();
+  uint64_t getLimitedValue(uint64_t Limit = ~0ULL) const {
+return Val.getLimitedValue(Limit);
   }
 
   /// @returns the value for an integer constant of the given type that has all



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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

APSInt.h updated: 1.1 - 1.2
---
Log message:

add missing methods, mark stuff const


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

 APSInt.h |   10 +-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/ADT/APSInt.h
diff -u llvm/include/llvm/ADT/APSInt.h:1.1 llvm/include/llvm/ADT/APSInt.h:1.2
--- llvm/include/llvm/ADT/APSInt.h:1.1  Thu Apr  5 00:20:11 2007
+++ llvm/include/llvm/ADT/APSInt.h  Tue Apr 10 02:06:21 2007
@@ -68,13 +68,21 @@
   *this = sdiv(RHS);
 return *this;
   }
+  APSInt operator%(const APSInt RHS) const {
+assert(IsUnsigned == RHS.IsUnsigned  Signedness mismatch!);
+return IsUnsigned ? urem(RHS) : srem(RHS);
+  }
+  APSInt operator/(const APSInt RHS) const {
+assert(IsUnsigned == RHS.IsUnsigned  Signedness mismatch!);
+return IsUnsigned ? udiv(RHS) : sdiv(RHS);
+  }
   
   const APSInt operator=(unsigned Amt) {
 *this = *this  Amt;
 return *this;
   }
   
-  APSInt operator(unsigned Amt) {
+  APSInt operator(unsigned Amt) const {
 return IsUnsigned ? lshr(Amt) : ashr(Amt);
   }
   



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


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

2007-04-10 Thread Reid Spencer
Chris,

On Tue, 2007-04-10 at 01:43 -0500, Chris Lattner wrote:
 
 Changes in directory llvm/include/llvm/ADT:
 
 APInt.h updated: 1.63 - 1.64
 ---
 Log message:
 
 add a method
 
 
 ---
 Diffs of the changes:  (+7 -0)
 
  APInt.h |7 +++
  1 files changed, 7 insertions(+)
 
 
 Index: llvm/include/llvm/ADT/APInt.h
 diff -u llvm/include/llvm/ADT/APInt.h:1.63 llvm/include/llvm/ADT/APInt.h:1.64
 --- llvm/include/llvm/ADT/APInt.h:1.63Wed Apr  4 01:18:21 2007
 +++ llvm/include/llvm/ADT/APInt.h Tue Apr 10 01:43:18 2007
 @@ -281,6 +281,13 @@
  return *this != 0;
}
  
 +  /// getLimitedValue - Return this value, or return all ones if it is too 
 large
 +  /// to return.

The comment here doesn't match the action of the function. The Limit
parameter is returned not all ones. All ones is only the default
Limit.

Reid.

 +  uint64_t getLimitedValue(uint64_t Limit = ~0ULL) const {
 +return (getActiveBits()  64 || getZExtValue()  Limit) ?
 +  Limit :  getZExtValue();
 +  }
 +
/// @}
/// @name Value Generators
/// @{
 
 
 
 ___
 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-www/DevMtgMay2007.html

2007-04-10 Thread Reid Spencer


Changes in directory llvm-www:

DevMtgMay2007.html updated: 1.53 - 1.54
---
Log message:

Add a discussion topic for maintenance of a road map.


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

 DevMtgMay2007.html |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm-www/DevMtgMay2007.html
diff -u llvm-www/DevMtgMay2007.html:1.53 llvm-www/DevMtgMay2007.html:1.54
--- llvm-www/DevMtgMay2007.html:1.53Mon Apr  9 21:34:10 2007
+++ llvm-www/DevMtgMay2007.html Tue Apr 10 08:58:56 2007
@@ -148,11 +148,17 @@
   trtdOwen Anderson/tdtdbIntegration of HLVM into LLVM/b - its 
 future as an LLVM subproject, and plans for making LLVM more accessible 
 to scripting and higher level language front ends./td/tr
-  trtdChristopher Lamb/tdtdbConcurrency Primitives/b: for 
multi-threaded
+  trtdChristopher Lamb/tdtdbConcurrency Primitives/b - for 
multi-threaded
   shared memory models. Though I don't claim to be any sort of expert
   myself, I've spent some time looking over the Java Memory Model revision
   and discussions and I think it would be worth discussing similar issues
   with regards to LLVM./td/tr
+  trtdReid Spencer/tdtdbDo we want an LLVM road map?/b - does the
+  development community care to disclose and maintain advance informationa
+  bout what is being worked on?  A page listing Bugzilla #, Title, Owner,
+  and Expected Release would give new users an idea of what is being worked
+  on. The details of each new feature could be tracked in
+  Bugzilla./td/tr
 /table
 /div
 
@@ -292,6 +298,6 @@
   src=http://jigsaw.w3.org/css-validator/images/vcss; alt=Valid CSS!/a
   a href=http://validator.w3.org/check/referer;img
   src=http://www.w3.org/Icons/valid-html401; alt=Valid HTML 4.01!/a
-br/Last modified: $Date: 2007/04/10 02:34:10 $
+br/Last modified: $Date: 2007/04/10 13:58:56 $
 /address
 !--#include virtual=footer.incl --



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


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

2007-04-10 Thread Devang Patel


Changes in directory llvm/tools/opt:

opt.cpp updated: 1.132 - 1.133
---
Log message:

Enable loop rotate pass.


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

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


Index: llvm/tools/opt/opt.cpp
diff -u llvm/tools/opt/opt.cpp:1.132 llvm/tools/opt/opt.cpp:1.133
--- llvm/tools/opt/opt.cpp:1.132Tue Mar  6 18:26:10 2007
+++ llvm/tools/opt/opt.cpp  Tue Apr 10 10:43:36 2007
@@ -212,6 +212,7 @@
   addPass(PM, createTailCallEliminationPass());  // Eliminate tail calls
   addPass(PM, createCFGSimplificationPass());// Merge  remove BBs
   addPass(PM, createReassociatePass());  // Reassociate expressions
+  addPass(PM, createLoopRotatePass());
   addPass(PM, createLICMPass()); // Hoist loop invariants
   addPass(PM, createLoopUnswitchPass()); // Unswitch loops.
   addPass(PM, createInstructionCombiningPass()); // Clean up after LICM/reassoc



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


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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

APInt.h updated: 1.64 - 1.65
---
Log message:

fix a comment bug Reid noticed


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

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


Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.64 llvm/include/llvm/ADT/APInt.h:1.65
--- llvm/include/llvm/ADT/APInt.h:1.64  Tue Apr 10 01:43:18 2007
+++ llvm/include/llvm/ADT/APInt.h   Tue Apr 10 11:33:06 2007
@@ -281,8 +281,9 @@
 return *this != 0;
   }
 
-  /// getLimitedValue - Return this value, or return all ones if it is too 
large
-  /// to return.
+  /// getLimitedValue - If this value is smaller than the specified limit,
+  /// return it, otherwise return the limit value.  This causes the value
+  /// to saturate to the limit.
   uint64_t getLimitedValue(uint64_t Limit = ~0ULL) const {
 return (getActiveBits()  64 || getZExtValue()  Limit) ?
   Limit :  getZExtValue();



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


[llvm-commits] CVS: llvm/test/Transforms/LoopRotate/pr1154.ll

2007-04-10 Thread Devang Patel


Changes in directory llvm/test/Transforms/LoopRotate:

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

Add test case for PR 1154: http://llvm.org/PR1154 .


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

 pr1154.ll |  125 ++
 1 files changed, 125 insertions(+)


Index: llvm/test/Transforms/LoopRotate/pr1154.ll
diff -c /dev/null llvm/test/Transforms/LoopRotate/pr1154.ll:1.1
*** /dev/null   Tue Apr 10 11:57:18 2007
--- llvm/test/Transforms/LoopRotate/pr1154.ll   Tue Apr 10 11:57:08 2007
***
*** 0 
--- 1,125 
+ ; RUN: llvm-upgrade  %s | llvm-as | opt -std-compile-opts | llvm-dis | 
%prcontext strstr 2 | grep -v declare |grep bb36.outer:
+ @str = internal constant [68 x i8] cDot. date. datum. 123. Some more 
doubtful demonstration dummy data.\00  ; [68 x i8]* [#uses=1]
+ @str1 = internal constant [5 x i8] cummy\00 ; [5 x i8]* [#uses=1]
+ @str2 = internal constant [6 x i8] c data\00; [6 x i8]* 
[#uses=1]
+ @str3 = internal constant [3 x i8] cby\00   ; [3 x i8]* [#uses=1]
+ 
+ i32 @stringSearch_Clib(i32 %count) {
+ entry:
+   %count_addr = alloca i32; i32* [#uses=2]
+   %retval = alloca i32, align 4   ; i32* [#uses=2]
+   %tmp = alloca i32, align 4  ; i32* [#uses=2]
+   %i = alloca i32, align 4; i32* [#uses=5]
+   %c = alloca i32, align 4; i32* [#uses=9]
+   %j = alloca i32, align 4; i32* [#uses=4]
+   %p = alloca i8*, align 4; i8** [#uses=6]
+   %b = alloca [68 x i8], align 16 ; [68 x i8]* [#uses=6]
+   alloca point = bitcast i32 0 to i32   ; i32 [#uses=0]
+   store i32 %count, i32* %count_addr
+   store i32 0, i32* %c
+   %b1 = bitcast [68 x i8]* %b to i8*  ; i8* [#uses=1]
+   %tmp2 = getelementptr [68 x i8]* @str, i32 0, i32 0 ; i8* 
[#uses=1]
+   call void @llvm.memcpy.i32( i8* %b1, i8* %tmp2, i32 68, i32 1 )
+   store i32 0, i32* %j
+   br label %bb41
+ 
+ bb:   ; preds = %bb41
+   store i32 0, i32* %i
+   %tmp3 = load i32* %i; i32 [#uses=1]
+   store i32 %tmp3, i32* %c
+   br label %bb36
+ 
+ bb4:  ; preds = %bb36
+   %b5 = bitcast [68 x i8]* %b to i8*  ; i8* [#uses=1]
+   %tmp6 = getelementptr [5 x i8]* @str1, i32 0, i32 0 ; i8* 
[#uses=1]
+   %tmp7 = call i8* @strstr( i8* %b5, i8* %tmp6 )  ; i8* 
[#uses=1]
+   store i8* %tmp7, i8** %p
+   %tmp8 = load i8** %p; i8* [#uses=1]
+   %ttmp8 = icmp ne i8* %tmp8, null; i1:0 [#uses=1]
+   %ttmp10 = zext i1 %ttmp8 to i8  ; i8:1 [#uses=1]
+   %ttmp7 = icmp ne i8 %ttmp10, 0  ; i1:2 [#uses=1]
+   br i1 %ttmp7, label %cond_true, label %cond_next
+ 
+ cond_true:; preds = %bb4
+   %tmp9 = load i8** %p; i8* [#uses=1]
+   %tmp910 = ptrtoint i8* %tmp9 to i32 ; i32 [#uses=1]
+   %b11 = bitcast [68 x i8]* %b to i8* ; i8* [#uses=1]
+   %b1112 = ptrtoint i8* %b11 to i32   ; i32 [#uses=1]
+   %tmp13 = sub i32 %tmp910, %b1112; i32 [#uses=1]
+   %tmp14 = load i32* %c   ; i32 [#uses=1]
+   %tmp15 = add i32 %tmp13, %tmp14 ; i32 [#uses=1]
+   store i32 %tmp15, i32* %c
+   br label %cond_next
+ 
+ cond_next:; preds = %cond_true, %bb4
+   %b16 = bitcast [68 x i8]* %b to i8* ; i8* [#uses=1]
+   %tmp17 = getelementptr [6 x i8]* @str2, i32 0, i32 0; i8* 
[#uses=1]
+   %tmp18 = call i8* @strstr( i8* %b16, i8* %tmp17 )   ; i8* 
[#uses=1]
+   store i8* %tmp18, i8** %p
+   %tmp19 = load i8** %p   ; i8* [#uses=1]
+   %ttmp6 = icmp ne i8* %tmp19, null   ; i1:3 [#uses=1]
+   %ttmp9 = zext i1 %ttmp6 to i8   ; i8:4 [#uses=1]
+   %ttmp4 = icmp ne i8 %ttmp9, 0   ; i1:5 [#uses=1]
+   br i1 %ttmp4, label %cond_true20, label %cond_next28
+ 
+ cond_true20:  ; preds = %cond_next
+   %tmp21 = load i8** %p   ; i8* [#uses=1]
+   %tmp2122 = ptrtoint i8* %tmp21 to i32   ; i32 [#uses=1]
+   %b23 = bitcast [68 x i8]* %b to i8* ; i8* [#uses=1]
+   %b2324 = ptrtoint i8* %b23 to i32   ; i32 [#uses=1]
+   %tmp25 = sub i32 %tmp2122, %b2324   ; i32 [#uses=1]
+   %tmp26 = load i32* %c   ; i32 [#uses=1]
+   %tmp27 = add i32 %tmp25, %tmp26 ; i32 [#uses=1]
+   store i32 %tmp27, i32* %c
+   br label %cond_next28
+ 
+ cond_next28:  ; preds = %cond_true20, %cond_next
+   %b29 = bitcast [68 x i8]* %b to i8* ; i8* [#uses=1]
+   %tmp30 = getelementptr [3 x i8]* @str3, i32 0, i32 0; i8* 
[#uses=1]
+   %tmp31 = call i32 @strcspn( i8* %b29, i8* %tmp30 )  ; i32 

[llvm-commits] CVS: llvm/utils/NewNightlyTest.pl

2007-04-10 Thread Jeff Cohen


Changes in directory llvm/utils:

NewNightlyTest.pl updated: 1.69 - 1.70
---
Log message:

Correctly report version of GCC used.

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

 NewNightlyTest.pl |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/utils/NewNightlyTest.pl
diff -u llvm/utils/NewNightlyTest.pl:1.69 llvm/utils/NewNightlyTest.pl:1.70
--- llvm/utils/NewNightlyTest.pl:1.69   Sat Apr  7 00:20:07 2007
+++ llvm/utils/NewNightlyTest.plTue Apr 10 14:13:43 2007
@@ -1050,6 +1050,8 @@
 $gcc_version_long=;
 if ($GCCPATH ne ) {
$gcc_version_long = `$GCCPATH/gcc --version`;
+} elsif ($ENV{CC}) {
+   $gcc_version_long = `$ENV{CC} --version`;
 } else {
$gcc_version_long = `gcc --version`;
 }



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


Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.162 - 1.163
---
Log message:

new micro optzn


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

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


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.162 
llvm/lib/Target/X86/README.txt:1.163
--- llvm/lib/Target/X86/README.txt:1.162Tue Apr  3 18:41:34 2007
+++ llvm/lib/Target/X86/README.txt  Tue Apr 10 16:14:01 2007
@@ -1047,3 +1047,33 @@
 }
 
 
+//===-===//
+
+Consider:
+
+int isnegative(unsigned int X) {
+   return !(X  2147483648U);
+}
+
+We current compile this to:
+
+define i32 @isnegative(i32 %X) {
+icmp slt i32 %X, 0  ; i1:0 [#uses=1]
+%retval = zext i1 %0 to i32 ; i32 [#uses=1]
+ret i32 %retval
+}
+
+and:
+
+_isnegative:
+cmpl $0, 4(%esp)
+sets %al
+movzbl %al, %eax
+ret
+
+We should produce:
+
+   movl4(%esp), %eax
+   shrl$31, %eax
+ret
+



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


[llvm-commits] CVS: llvm-www/OpenProjects.html

2007-04-10 Thread Anton Korobeynikov


Changes in directory llvm-www:

OpenProjects.html updated: 1.25 - 1.26
---
Log message:

Add new idea


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

 OpenProjects.html |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)


Index: llvm-www/OpenProjects.html
diff -u llvm-www/OpenProjects.html:1.25 llvm-www/OpenProjects.html:1.26
--- llvm-www/OpenProjects.html:1.25 Wed Apr  4 22:55:22 2007
+++ llvm-www/OpenProjects.html  Tue Apr 10 16:16:08 2007
@@ -319,11 +319,16 @@
 div class=www_text
 
 ol
-liImplement GVN-PRE, a powerful and simple Partial Redundancy Elimination
-algorithm for SSA form (in progress, ask on llvmdev)/li
-liImplement a Dependence Analysis Infrastructurebr
- - Design some way to represent and query dep analysis/li
-liValue range propagation pass/li
+  liImplement GVN-PRE, a powerful and simple Partial Redundancy Elimination
+algorithm for SSA form (in progress, ask on llvmdev)/li
+  liImplement a Dependence Analysis Infrastructurebr
+- Design some way to represent and query dep analysis/li
+  liValue range propagation pass/li
+  liMore fun with loops: 
+a href=http://www.cs.ualberta.ca/~amaral/cascon/CDP04/tal.html;
+  Predictive Commoning
+/a
+  /li
 /ol
 
 /div
@@ -406,7 +411,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: 2007/04/05 03:55:22 $
+  Last modified: $Date: 2007/04/10 21:16:08 $
 /address
 
 !--#include virtual=footer.incl --



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


[llvm-commits] CVS: llvm/test/C++Frontend/2007-04-10-PackedUnion.cpp

2007-04-10 Thread Devang Patel


Changes in directory llvm/test/C++Frontend:

2007-04-10-PackedUnion.cpp added (r1.1)
---
Log message:

New test case.


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

 2007-04-10-PackedUnion.cpp |   41 +
 1 files changed, 41 insertions(+)


Index: llvm/test/C++Frontend/2007-04-10-PackedUnion.cpp
diff -c /dev/null llvm/test/C++Frontend/2007-04-10-PackedUnion.cpp:1.1
*** /dev/null   Tue Apr 10 16:43:11 2007
--- llvm/test/C++Frontend/2007-04-10-PackedUnion.cppTue Apr 10 16:43:01 2007
***
*** 0 
--- 1,41 
+ // RUN: %llvmgxx -S %s -o /dev/null
+ extern C {
+ 
+ #pragma pack(push, 2)
+   typedef struct ABC* abc;
+ 
+   struct ABCS {
+ float red;
+ float green;
+ float blue;
+ float alpha;
+   };
+ 
+   typedef void (*XYZ)();
+ #pragma pack(pop)
+ }
+ 
+ 
+ union ABCU {
+   ABCS color;
+   XYZ bg;
+ };
+ 
+ struct AData {
+   ABCU data;
+ };
+ 
+ class L {
+  public:
+   L() {}
+   L(const L other);
+ 
+  private:
+   AData fdata;
+ };
+ 
+ 
+ L::L(const L other)
+ {
+   fdata = other.fdata;
+ }



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


[llvm-commits] [125951] Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/ Week-of-Mon-20070409/047164.html

2007-04-10 Thread dpatel
Revision: 125951
Author:   dpatel
Date: 2007-04-10 14:43:39 -0700 (Tue, 10 Apr 2007)

Log Message:
---
Fix 
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070409/047164.html

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

Modified: apple-local/branches/llvm/gcc/llvm-types.cpp
===
--- apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-10 18:47:54 UTC 
(rev 125950)
+++ apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-10 21:43:39 UTC 
(rev 125951)
@@ -1226,11 +1226,10 @@
 // ordering.  Therefore convert to a packed struct and try again.
 Info.convertToPacked();
 DecodeStructFields(Field, Info);
-  }
-
-  // At this point, we know that adding the element will happen at the right
-  // offset.  Add it.
-  Info.addElement(Ty, StartOffsetInBytes, Info.getTypeSize(Ty));
+  } else 
+// At this point, we know that adding the element will happen at the right
+// offset.  Add it.
+Info.addElement(Ty, StartOffsetInBytes, Info.getTypeSize(Ty));
 }
 
 /// DecodeStructBitField - This method decodes the specified bit-field, adding


___
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/X86.td X86CodeEmitter.cpp X86InstrInfo.h X86InstrInfo.td X86InstrSSE.td X86Subtarget.cpp X86Subtarget.h

2007-04-10 Thread Bill Wendling


Changes in directory llvm/lib/Target/X86:

X86.td updated: 1.29 - 1.30
X86CodeEmitter.cpp updated: 1.131 - 1.132
X86InstrInfo.h updated: 1.62 - 1.63
X86InstrInfo.td updated: 1.300 - 1.301
X86InstrSSE.td updated: 1.179 - 1.180
X86Subtarget.cpp updated: 1.53 - 1.54
X86Subtarget.h updated: 1.28 - 1.29
---
Log message:

Add support for our first SSSE3 instruction pmulhrsw.


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

 X86.td |2 ++
 X86CodeEmitter.cpp |8 
 X86InstrInfo.h |5 -
 X86InstrInfo.td|3 +++
 X86InstrSSE.td |   40 +---
 X86Subtarget.cpp   |1 +
 X86Subtarget.h |5 +++--
 7 files changed, 54 insertions(+), 10 deletions(-)


Index: llvm/lib/Target/X86/X86.td
diff -u llvm/lib/Target/X86/X86.td:1.29 llvm/lib/Target/X86/X86.td:1.30
--- llvm/lib/Target/X86/X86.td:1.29 Mon Feb 26 12:17:14 2007
+++ llvm/lib/Target/X86/X86.td  Tue Apr 10 17:10:25 2007
@@ -30,6 +30,8 @@
 Enable SSE2 instructions;
 def FeatureSSE3  : SubtargetFeaturesse3, X86SSELevel, SSE3,
 Enable SSE3 instructions;
+def FeatureSSSE3 : SubtargetFeaturessse3, X86SSELevel, SSSE3,
+Enable SSSE3 instructions;
 def Feature3DNow : SubtargetFeature3dnow, X863DNowLevel, ThreeDNow,
 Enable 3DNow! instructions;
 def Feature3DNowA: SubtargetFeature3dnowa, X863DNowLevel, 
ThreeDNowA,


Index: llvm/lib/Target/X86/X86CodeEmitter.cpp
diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.131 
llvm/lib/Target/X86/X86CodeEmitter.cpp:1.132
--- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.131Wed Mar 14 15:20:19 2007
+++ llvm/lib/Target/X86/X86CodeEmitter.cpp  Tue Apr 10 17:10:25 2007
@@ -584,6 +584,14 @@
   case X86II::TB:
 Need0FPrefix = true;   // Two-byte opcode prefix
 break;
+  case X86II::T8:
+MCE.emitByte(0x0F);
+MCE.emitByte(0x38);
+break;
+  case X86II::TA:
+MCE.emitByte(0x0F);
+MCE.emitByte(0x3A);
+break;
   case X86II::REP: break; // already handled.
   case X86II::XS:   // F3 0F
 MCE.emitByte(0xF3);


Index: llvm/lib/Target/X86/X86InstrInfo.h
diff -u llvm/lib/Target/X86/X86InstrInfo.h:1.62 
llvm/lib/Target/X86/X86InstrInfo.h:1.63
--- llvm/lib/Target/X86/X86InstrInfo.h:1.62 Fri Jan 26 08:34:52 2007
+++ llvm/lib/Target/X86/X86InstrInfo.h  Tue Apr 10 17:10:25 2007
@@ -154,7 +154,10 @@
 
 // XS, XD - These prefix codes are for single and double precision scalar
 // floating point operations performed in the SSE registers.
-XD = 11  Op0Shift,   XS = 12  Op0Shift,
+XD = 11  Op0Shift,  XS = 12  Op0Shift,
+
+// T8, TA - Prefix after the 0x0F prefix.
+T8 = 13  Op0Shift,  TA = 14  Op0Shift,
 
 
//===--===//
 // REX_W - REX prefixes are instruction prefixes used in 64-bit mode.


Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.300 
llvm/lib/Target/X86/X86InstrInfo.td:1.301
--- llvm/lib/Target/X86/X86InstrInfo.td:1.300   Tue Mar 20 19:16:56 2007
+++ llvm/lib/Target/X86/X86InstrInfo.td Tue Apr 10 17:10:25 2007
@@ -167,6 +167,7 @@
 def HasSSE1  : PredicateSubtarget-hasSSE1();
 def HasSSE2  : PredicateSubtarget-hasSSE2();
 def HasSSE3  : PredicateSubtarget-hasSSE3();
+def HasSSSE3 : PredicateSubtarget-hasSSSE3();
 def FPStack  : Predicate!Subtarget-hasSSE2();
 def In32BitMode  : Predicate!Subtarget-is64Bit();
 def In64BitMode  : PredicateSubtarget-is64Bit();
@@ -248,6 +249,8 @@
 class DF { bits4 Prefix = 10; }
 class XD { bits4 Prefix = 11; }
 class XS { bits4 Prefix = 12; }
+class T8 { bits4 Prefix = 13; }
+class TA { bits4 Prefix = 14; }
 
 
 
//===--===//


Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.179 
llvm/lib/Target/X86/X86InstrSSE.td:1.180
--- llvm/lib/Target/X86/X86InstrSSE.td:1.179Tue Mar 20 19:16:56 2007
+++ llvm/lib/Target/X86/X86InstrSSE.td  Tue Apr 10 17:10:25 2007
@@ -183,15 +183,17 @@
 
//===--===//
 
 // Instruction templates
-// SSI - SSE1 instructions with XS prefix.
-// SDI - SSE2 instructions with XD prefix.
-// PSI - SSE1 instructions with TB prefix.
-// PDI - SSE2 instructions with TB and OpSize prefixes.
+// SSI   - SSE1 instructions with XS prefix.
+// SDI   - SSE2 instructions with XD prefix.
+// PSI   - SSE1 instructions with TB prefix.
+// PDI   - SSE2 instructions with TB and OpSize prefixes.
 // PSIi8 - SSE1 instructions with ImmT == Imm8 and TB prefix.
 // PDIi8 - SSE2 instructions with ImmT == Imm8 and TB and OpSize prefixes.
-// S3I - SSE3 instructions with TB and OpSize prefixes.
-// S3SI - SSE3 instructions with XS prefix.
-// S3DI - SSE3 instructions with XD prefix.

[llvm-commits] [125952] Add SSSSE3 support as a feature.

2007-04-10 Thread bwendlin
Revision: 125952
Author:   bwendlin
Date: 2007-04-10 15:10:29 -0700 (Tue, 10 Apr 2007)

Log Message:
---
Add E3 support as a feature.

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

Modified: apple-local/branches/llvm/gcc/config/i386/i386.h
===
--- apple-local/branches/llvm/gcc/config/i386/i386.h2007-04-10 21:43:39 UTC 
(rev 125951)
+++ apple-local/branches/llvm/gcc/config/i386/i386.h2007-04-10 22:10:29 UTC 
(rev 125952)
@@ -4038,6 +4038,7 @@
 if (TARGET_SSE)   F.AddFeature(sse);\
 if (TARGET_SSE2)  F.AddFeature(sse2);   \
 if (TARGET_SSE3)  F.AddFeature(sse3);   \
+if (TARGET_SSSE3) F.AddFeature(ssse3);  \
 if (TARGET_3DNOW) F.AddFeature(3dnow);  \
 if (TARGET_3DNOW_A) F.AddFeature(3dnowa);   \
   }


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


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

2007-04-10 Thread Bill Wendling


Changes in directory llvm/include/llvm:

IntrinsicsX86.td updated: 1.42 - 1.43
---
Log message:

Add support for our first SSSE3 instruction pmulhrsw.


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

 IntrinsicsX86.td |   10 ++
 1 files changed, 10 insertions(+)


Index: llvm/include/llvm/IntrinsicsX86.td
diff -u llvm/include/llvm/IntrinsicsX86.td:1.42 
llvm/include/llvm/IntrinsicsX86.td:1.43
--- llvm/include/llvm/IntrinsicsX86.td:1.42 Tue Apr  3 18:48:32 2007
+++ llvm/include/llvm/IntrinsicsX86.td  Tue Apr 10 17:10:25 2007
@@ -537,6 +537,16 @@
 }
 
 
//===--===//
+// SSSE3
+
+// FP arithmetic ops
+let TargetPrefix = x86 in {  // All intrinsics start with llvm.x86..
+  def int_x86_ssse3_pmulhrsw_128 : GCCBuiltin__builtin_ia32_pmulhrsw128,
+  Intrinsic[llvm_v8i16_ty, llvm_v8i16_ty,
+ llvm_v8i16_ty], [IntrNoMem];
+}
+
+//===--===//
 // MMX
 
 // Empty MMX state op.



___
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/2007-04-10-BitfieldTest.c Makefile

2007-04-10 Thread Chris Lattner


Changes in directory llvm-test/SingleSource/UnitTests:

2007-04-10-BitfieldTest.c added (r1.1)
Makefile updated: 1.12 - 1.13
---
Log message:

new testcase


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

 2007-04-10-BitfieldTest.c |   31 +++
 Makefile  |2 +-
 2 files changed, 32 insertions(+), 1 deletion(-)


Index: llvm-test/SingleSource/UnitTests/2007-04-10-BitfieldTest.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/2007-04-10-BitfieldTest.c:1.1
*** /dev/null   Tue Apr 10 18:51:35 2007
--- llvm-test/SingleSource/UnitTests/2007-04-10-BitfieldTest.c  Tue Apr 10 
18:51:25 2007
***
*** 0 
--- 1,31 
+ #include stdio.h
+ #include stdlib.h
+ 
+ union u {
+ struct {
+ unsigned int a : 8;
+ unsigned int b : 3;
+ unsigned int c : 3;
+ unsigned int d : 3;
+ unsigned int e : 3;
+ unsigned int f : 3;
+ unsigned int g : 3;
+ unsigned int h : 3;
+ unsigned int i : 3;
+ 
+ unsigned int n : 8;
+ unsigned int o : 8;
+ unsigned int p : 8;
+ unsigned int q : 8;
+ } s;
+ unsigned long long token;
+ };
+ 
+ int main(int argc, char *argv[])
+ {
+ union u uu;
+ uu.token = 0x01249249ULL;
+ printf(p = 0x%02X\n, uu.s.p);
+ return 0;
+ }
+ 


Index: llvm-test/SingleSource/UnitTests/Makefile
diff -u llvm-test/SingleSource/UnitTests/Makefile:1.12 
llvm-test/SingleSource/UnitTests/Makefile:1.13
--- llvm-test/SingleSource/UnitTests/Makefile:1.12  Thu Jan 18 20:36:58 2007
+++ llvm-test/SingleSource/UnitTests/Makefile   Tue Apr 10 18:51:25 2007
@@ -2,7 +2,7 @@
 LEVEL = ../..
 include $(LEVEL)/Makefile.config
 
-DIRS := SetjmpLongjmp
+DIRS := 
 
 # llvm-gcc3 does not support any vector tests.
 ifneq ($(LLVMGCC_MAJVERS),3)



___
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/Vector/Altivec/alti.stepfft.c

2007-04-10 Thread Chris Lattner


Changes in directory llvm-test/SingleSource/UnitTests/Vector/Altivec:

alti.stepfft.c updated: 1.3 - 1.4
---
Log message:

new testcase


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

 alti.stepfft.c |1 -
 1 files changed, 1 deletion(-)


Index: llvm-test/SingleSource/UnitTests/Vector/Altivec/alti.stepfft.c
diff -u llvm-test/SingleSource/UnitTests/Vector/Altivec/alti.stepfft.c:1.3 
llvm-test/SingleSource/UnitTests/Vector/Altivec/alti.stepfft.c:1.4
--- llvm-test/SingleSource/UnitTests/Vector/Altivec/alti.stepfft.c:1.3  Tue Apr 
 4 13:56:15 2006
+++ llvm-test/SingleSource/UnitTests/Vector/Altivec/alti.stepfft.c  Tue Apr 
10 18:51:25 2007
@@ -76,7 +76,6 @@
 float x[][2],y[][2],w[][2],sign;
 {
int jb, m, j, mj, tgle;
-   void ccopy(),step();
m= (int) (log((float) n)/log(1.99));
mj   = 1;
tgle = 1;  /* toggling switch for work array */



___
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/Makefile

2007-04-10 Thread Chris Lattner


Changes in directory llvm-test/SingleSource/UnitTests:

Makefile updated: 1.13 - 1.14
---
Log message:

revert accidental commit


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

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


Index: llvm-test/SingleSource/UnitTests/Makefile
diff -u llvm-test/SingleSource/UnitTests/Makefile:1.13 
llvm-test/SingleSource/UnitTests/Makefile:1.14
--- llvm-test/SingleSource/UnitTests/Makefile:1.13  Tue Apr 10 18:51:25 2007
+++ llvm-test/SingleSource/UnitTests/Makefile   Tue Apr 10 18:52:47 2007
@@ -2,7 +2,7 @@
 LEVEL = ../..
 include $(LEVEL)/Makefile.config
 
-DIRS := 
+DIRS := SetjmpLongjmp
 
 # llvm-gcc3 does not support any vector tests.
 ifneq ($(LLVMGCC_MAJVERS),3)



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


[llvm-commits] CVS: llvm/configure

2007-04-10 Thread Reid Spencer


Changes in directory llvm:

configure updated: 1.273 - 1.274
---
Log message:

Hopefully fix LTDL_SHLIB_EXT on Darwin


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

 configure |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/configure
diff -u llvm/configure:1.273 llvm/configure:1.274
--- llvm/configure:1.273Mon Apr  2 10:41:39 2007
+++ llvm/configure  Tue Apr 10 19:27:39 2007
@@ -8765,7 +8765,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes  echo .so || echo .dylib`'
+  shrext_cmds='.dylib'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test $GCC = yes; then
 sys_lib_search_path_spec=`$CC -print-search-dirs | tr \n 
$PATH_SEPARATOR | sed -e 's/libraries:/@libraries:/' | tr @ \n | grep 
^libraries: | sed -e s/^libraries:// -e s,=/,/,g -e s,$PATH_SEPARATOR, 
,g -e s,.*, /lib /usr/lib /usr/local/lib,g`
@@ -15862,7 +15862,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes  echo .so || echo .dylib`'
+  shrext_cmds='.dylib'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test $GCC = yes; then
 sys_lib_search_path_spec=`$CC -print-search-dirs | tr \n 
$PATH_SEPARATOR | sed -e 's/libraries:/@libraries:/' | tr @ \n | grep 
^libraries: | sed -e s/^libraries:// -e s,=/,/,g -e s,$PATH_SEPARATOR, 
,g -e s,.*, /lib /usr/lib /usr/local/lib,g`
@@ -19925,7 +19925,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes  echo .so || echo .dylib`'
+  shrext_cmds='.dylib'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test $GCC = yes; then
 sys_lib_search_path_spec=`$CC -print-search-dirs | tr \n 
$PATH_SEPARATOR | sed -e 's/libraries:/@libraries:/' | tr @ \n | grep 
^libraries: | sed -e s/^libraries:// -e s,=/,/,g -e s,$PATH_SEPARATOR, 
,g -e s,.*, /lib /usr/lib /usr/local/lib,g`
@@ -22540,7 +22540,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes  echo .so || echo .dylib`'
+  shrext_cmds='.dylib'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test $GCC = yes; then
 sys_lib_search_path_spec=`$CC -print-search-dirs | tr \n 
$PATH_SEPARATOR | sed -e 's/libraries:/@libraries:/' | tr @ \n | grep 
^libraries: | sed -e s/^libraries:// -e s,=/,/,g -e s,$PATH_SEPARATOR, 
,g -e s,.*, /lib /usr/lib /usr/local/lib,g`
@@ -25167,7 +25167,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes  echo .so || echo .dylib`'
+  shrext_cmds='.dylib'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test $GCC = yes; then
 sys_lib_search_path_spec=`$CC -print-search-dirs | tr \n 
$PATH_SEPARATOR | sed -e 's/libraries:/@libraries:/' | tr @ \n | grep 
^libraries: | sed -e s/^libraries:// -e s,=/,/,g -e s,$PATH_SEPARATOR, 
,g -e s,.*, /lib /usr/lib /usr/local/lib,g`



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


[llvm-commits] CVS: llvm/autoconf/m4/libtool.m4

2007-04-10 Thread Reid Spencer


Changes in directory llvm/autoconf/m4:

libtool.m4 updated: 1.8 - 1.9
---
Log message:

Hack the shared library extension for dylib. The existing code just looks
plain wrong since $module was never defined so we always get .so which is
broken on Darwin. Just force it to .dylib.


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

 libtool.m4 |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/autoconf/m4/libtool.m4
diff -u llvm/autoconf/m4/libtool.m4:1.8 llvm/autoconf/m4/libtool.m4:1.9
--- llvm/autoconf/m4/libtool.m4:1.8 Wed Aug  9 00:38:51 2006
+++ llvm/autoconf/m4/libtool.m4 Tue Apr 10 19:33:43 2007
@@ -1365,7 +1365,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes  echo .so || echo .dylib`'
+  shrext_cmds='.dylib'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test $GCC = yes; then
 sys_lib_search_path_spec=`$CC -print-search-dirs | tr \n 
$PATH_SEPARATOR | sed -e 's/libraries:/@libraries:/' | tr @ \n | grep 
^libraries: | sed -e s/^libraries:// -e s,=/,/,g -e s,$PATH_SEPARATOR, 
,g -e s,.*, /lib /usr/lib /usr/local/lib,g`



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


[llvm-commits] CVS: llvm/lib/System/Path.cpp

2007-04-10 Thread Reid Spencer


Changes in directory llvm/lib/System:

Path.cpp updated: 1.22 - 1.23
---
Log message:

Make isDynamicLibrary detect more than just an ELF file.


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

 Path.cpp |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)


Index: llvm/lib/System/Path.cpp
diff -u llvm/lib/System/Path.cpp:1.22 llvm/lib/System/Path.cpp:1.23
--- llvm/lib/System/Path.cpp:1.22   Wed Apr  4 01:30:26 2007
+++ llvm/lib/System/Path.cppTue Apr 10 19:49:39 2007
@@ -103,8 +103,16 @@
 
 bool
 Path::isDynamicLibrary() const {
-  if (canRead())
-return hasMagicNumber(\177ELF);
+  if (canRead()) {
+std::string Magic;
+if (getMagicNumber(Magic, 64))
+  switch (IdentifyFileType(Magic.c_str(), Magic.length())) {
+default: return false;
+case ELF_FileType:
+case Mach_O_FileType:
+case COFF_FileType:  return true;
+  }
+  }
   return false;
 }
 



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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

ScalarReplAggregates.cpp updated: 1.81 - 1.82
---
Log message:

Simplify SROA conversion to integer in some ways, make it more general in 
others.

We now tolerate small amounts of undefined behavior, better emulating what
would happen if the transaction actually occurred in memory.  This fixes
SingleSource/UnitTests/2007-04-10-BitfieldTest.c on PPC, at least until
Devang gets a chance to fix the CFE from doing undefined things with bitfields 
:)


---
Diffs of the changes:  (+138 -131)

 ScalarReplAggregates.cpp |  269 ---
 1 files changed, 138 insertions(+), 131 deletions(-)


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.81 
llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.82
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.81Thu Mar 22 
11:38:57 2007
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Apr 10 19:57:54 2007
@@ -911,7 +911,6 @@
 /// Offset is an offset from the original alloca, in bits that need to be
 /// shifted to the right.  By the end of this, there should be no uses of Ptr.
 void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) 
{
-  bool isVectorInsert = isaVectorType(NewAI-getType()-getElementType());
   const TargetData TD = getAnalysisTargetData();
   while (!Ptr-use_empty()) {
 Instruction *User = castInstruction(Ptr-use_back());
@@ -919,56 +918,76 @@
 if (LoadInst *LI = dyn_castLoadInst(User)) {
   // The load is a bit extract from NewAI shifted right by Offset bits.
   Value *NV = new LoadInst(NewAI, LI-getName(), LI);
-  if (NV-getType() != LI-getType()) {
-if (const VectorType *PTy = dyn_castVectorType(NV-getType())) {
-  // If the result alloca is a vector type, this is either an element
-  // access or a bitcast to another vector type.
-  if (isaVectorType(LI-getType())) {
-NV = new BitCastInst(NV, LI-getType(), LI-getName(), LI);
-  } else {
-// Must be an element access.
-unsigned Elt = Offset/(TD.getTypeSize(PTy-getElementType())*8);
-NV = new ExtractElementInst(
-   NV, ConstantInt::get(Type::Int32Ty, Elt), tmp, 
LI);
-  }
-} else if (isaPointerType(NV-getType())) {
-  assert(isaPointerType(LI-getType()));
-  // Must be ptr-ptr cast.  Anything else would result in NV being
-  // an integer.
+  if (NV-getType() == LI-getType()) {
+// We win, no conversion needed.
+  } else if (const VectorType *PTy = dyn_castVectorType(NV-getType())) {
+// If the result alloca is a vector type, this is either an element
+// access or a bitcast to another vector type.
+if (isaVectorType(LI-getType())) {
   NV = new BitCastInst(NV, LI-getType(), LI-getName(), LI);
 } else {
-  assert(NV-getType()-isInteger()  Unknown promotion!);
-  if (Offset  Offset  TD.getTypeSize(NV-getType())*8) {
-NV = BinaryOperator::createLShr(NV, 
-ConstantInt::get(NV-getType(), 
Offset),
-LI-getName(), LI);
-  }
-  
-  // If the result is an integer, this is a trunc or bitcast.
-  if (LI-getType()-isInteger()) {
-NV = CastInst::createTruncOrBitCast(NV, LI-getType(),
-LI-getName(), LI);
-  } else if (LI-getType()-isFloatingPoint()) {
-// If needed, truncate the integer to the appropriate size.
-if (NV-getType()-getPrimitiveSizeInBits()  
-LI-getType()-getPrimitiveSizeInBits()) {
-  switch (LI-getType()-getTypeID()) {
-  default: assert(0  Unknown FP type!);
-  case Type::FloatTyID:
-NV = new TruncInst(NV, Type::Int32Ty, LI-getName(), LI);
-break;
-  case Type::DoubleTyID:
-NV = new TruncInst(NV, Type::Int64Ty, LI-getName(), LI);
-break;
-  }
+  // Must be an element access.
+  unsigned Elt = Offset/(TD.getTypeSize(PTy-getElementType())*8);
+  NV = new ExtractElementInst(
+ NV, ConstantInt::get(Type::Int32Ty, Elt), tmp, LI);
+}
+  } else if (isaPointerType(NV-getType())) {
+assert(isaPointerType(LI-getType()));
+// Must be ptr-ptr cast.  Anything else would result in NV being
+// an integer.
+NV = new BitCastInst(NV, LI-getType(), LI-getName(), LI);
+  } else {
+const IntegerType *NTy = castIntegerType(NV-getType());
+unsigned LIBitWidth = TD.getTypeSizeInBits(LI-getType());
+
+// If this is a big-endian system and the load is narrower than the
+// full alloca type, we 

[llvm-commits] CVS: llvm/lib/System/Path.cpp

2007-04-10 Thread Reid Spencer


Changes in directory llvm/lib/System:

Path.cpp updated: 1.23 - 1.24
---
Log message:

Teach sys::Path how to recognize different kinds of object files for ELF
and Mach-O systems. Additionally, correct the Mach-O logic code to look at
byte 12 not byte 15. Hopefully this fixes the llvm-ld warning on Darwin.


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

 Path.cpp |   32 +---
 1 files changed, 25 insertions(+), 7 deletions(-)


Index: llvm/lib/System/Path.cpp
diff -u llvm/lib/System/Path.cpp:1.23 llvm/lib/System/Path.cpp:1.24
--- llvm/lib/System/Path.cpp:1.23   Tue Apr 10 19:49:39 2007
+++ llvm/lib/System/Path.cppTue Apr 10 21:02:09 2007
@@ -58,7 +58,14 @@
   
 case '\177':
   if (magic[1] == 'E'  magic[2] == 'L'  magic[3] == 'F')
-return ELF_FileType;
+if (length = 18  magic[17] == 0)
+  switch (magic[16]) {
+default: break;
+case 1: return ELF_Relocatable_FileType;
+case 2: return ELF_Executable_FileType;
+case 3: return ELF_SharedObject_FileType;
+case 4: return ELF_Core_FileType;
+  }
   break;
 
 case 0xCE:
@@ -67,10 +74,19 @@
   // See the Mach-O section in /usr/share/file/magic for details.
   if (magic[1] == char(0xFA)  magic[2] == char(0xED)  
   magic[3] == char(0xFE))
-if (length = 15)
-  if (magic[15] == 1 || magic[15] == 3 || magic[15] == 6 || 
-  magic[15] == 9)
-return Mach_O_FileType;
+if (length = 14  magic[13] == 0)
+  switch (magic[12]) {
+default: break;
+case 1: return Mach_O_Object_FileType;
+case 2: return Mach_O_Executable_FileType;
+case 3: return Mach_O_FixedVirtualMemorySharedLib_FileType;
+case 4: return Mach_O_Core_FileType;
+case 5: return Mach_O_PreloadExectuable_FileType;
+case 6: return Mach_O_DynamicallyLinkedSharedLib_FileType;
+case 7: return Mach_O_DynamicLinker_FileType;
+case 8: return Mach_O_Bundle_FileType;
+case 9: return Mach_O_DynamicallyLinkedSharedLibStub_FileType;
+  }
   break;
 
 case 0xF0: // PowerPC Windows
@@ -108,8 +124,10 @@
 if (getMagicNumber(Magic, 64))
   switch (IdentifyFileType(Magic.c_str(), Magic.length())) {
 default: return false;
-case ELF_FileType:
-case Mach_O_FileType:
+case Mach_O_FixedVirtualMemorySharedLib_FileType:
+case Mach_O_DynamicallyLinkedSharedLib_FileType:
+case Mach_O_DynamicallyLinkedSharedLibStub_FileType:
+case ELF_SharedObject_FileType:
 case COFF_FileType:  return true;
   }
   }



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


[llvm-commits] CVS: llvm/include/llvm/System/Path.h

2007-04-10 Thread Reid Spencer


Changes in directory llvm/include/llvm/System:

Path.h updated: 1.51 - 1.52
---
Log message:

Teach sys::Path how to recognize different kinds of object files for ELF
and Mach-O systems. Additionally, correct the Mach-O logic code to look at
byte 12 not byte 15. Hopefully this fixes the llvm-ld warning on Darwin.


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

 Path.h |   25 ++---
 1 files changed, 18 insertions(+), 7 deletions(-)


Index: llvm/include/llvm/System/Path.h
diff -u llvm/include/llvm/System/Path.h:1.51 
llvm/include/llvm/System/Path.h:1.52
--- llvm/include/llvm/System/Path.h:1.51Sun Apr  8 15:05:10 2007
+++ llvm/include/llvm/System/Path.h Tue Apr 10 21:02:09 2007
@@ -597,13 +597,24 @@
 
   /// This enumeration delineates the kinds of files that LLVM knows about.
   enum LLVMFileType {
-Unknown_FileType = 0,/// Unrecognized file
-Bytecode_FileType = 1,   /// Uncompressed bytecode file
-CompressedBytecode_FileType = 2, /// Compressed bytecode file
-Archive_FileType = 3,/// ar style archive file
-ELF_FileType = 4,/// Native ELF object file or lib
-Mach_O_FileType = 5, /// Native Mach-O object file or lib
-COFF_FileType = 6/// COFF object file or lib
+Unknown_FileType = 0,  /// Unrecognized file
+Bytecode_FileType, /// Uncompressed bytecode file
+CompressedBytecode_FileType,   /// Compressed bytecode file
+Archive_FileType,  /// ar style archive file
+ELF_Relocatable_FileType,  /// ELF Relocatable object file
+ELF_Executable_FileType,   /// ELF Executable image
+ELF_SharedObject_FileType, /// ELF dynamically linked shared lib
+ELF_Core_FileType, /// ELF core image
+Mach_O_Object_FileType,/// Mach-O Object file
+Mach_O_Executable_FileType,/// Mach-O Executable
+Mach_O_FixedVirtualMemorySharedLib_FileType, /// Mach-O Shared Lib, FVM
+Mach_O_Core_FileType,  /// Mach-O Core File
+Mach_O_PreloadExectuable_FileType, /// Mach-O Preloaded Executable
+Mach_O_DynamicallyLinkedSharedLib_FileType, /// Mach-O dynlinked shared 
lib
+Mach_O_DynamicLinker_FileType, /// The Mach-O dynamic linker
+Mach_O_Bundle_FileType,/// Mach-O Bundle file
+Mach_O_DynamicallyLinkedSharedLibStub_FileType, /// Mach-O Shared lib stub
+COFF_FileType  /// COFF object file or lib
   };
 
   /// This utility function allows any memory block to be examined in order



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


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

2007-04-10 Thread Reid Spencer


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.414 - 1.415
---
Log message:

For PR1146: http://llvm.org/PR1146 :
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


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

 SelectionDAGISel.cpp |   26 +-
 1 files changed, 13 insertions(+), 13 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.414 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.415
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.414Mon Apr  9 
22:20:39 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Tue Apr 10 21:44:19 2007
@@ -828,9 +828,9 @@
   const FunctionType *FTy = I.getParent()-getParent()-getFunctionType();
   const ParamAttrsList *Attrs = FTy-getParamAttrs();
   ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
-  if (Attrs  Attrs-paramHasAttr(0, SExtAttribute))
+  if (Attrs  Attrs-paramHasAttr(0, ParamAttr::SExt))
 ExtendKind = ISD::SIGN_EXTEND;
-  if (Attrs  Attrs-paramHasAttr(0, ZExtAttribute))
+  if (Attrs  Attrs-paramHasAttr(0, ParamAttr::ZExt))
 ExtendKind = ISD::ZERO_EXTEND;
   RetOp = DAG.getNode(ExtendKind, TmpVT, RetOp);
 }
@@ -2768,16 +2768,16 @@
 Value *Arg = I.getOperand(i);
 SDOperand ArgNode = getValue(Arg);
 Entry.Node = ArgNode; Entry.Ty = Arg-getType();
-Entry.isSExt   = Attrs  Attrs-paramHasAttr(i, SExtAttribute);
-Entry.isZExt   = Attrs  Attrs-paramHasAttr(i, ZExtAttribute);
-Entry.isInReg  = Attrs  Attrs-paramHasAttr(i, InRegAttribute);
-Entry.isSRet   = Attrs  Attrs-paramHasAttr(i, StructRetAttribute);
+Entry.isSExt   = Attrs  Attrs-paramHasAttr(i, ParamAttr::SExt);
+Entry.isZExt   = Attrs  Attrs-paramHasAttr(i, ParamAttr::ZExt);
+Entry.isInReg  = Attrs  Attrs-paramHasAttr(i, ParamAttr::InReg);
+Entry.isSRet   = Attrs  Attrs-paramHasAttr(i, ParamAttr::StructRet);
 Args.push_back(Entry);
   }
 
   std::pairSDOperand,SDOperand Result =
 TLI.LowerCallTo(getRoot(), I.getType(), 
-Attrs  Attrs-paramHasAttr(0, SExtAttribute),
+Attrs  Attrs-paramHasAttr(0, ParamAttr::SExt),
 FTy-isVarArg(), CallingConv, IsTailCall, 
 Callee, Args, DAG);
   if (I.getType() != Type::VoidTy)
@@ -3617,13 +3617,13 @@
 
 // FIXME: Distinguish between a formal with no [sz]ext attribute from one
 // that is zero extended!
-if (Attrs  Attrs-paramHasAttr(j, ZExtAttribute))
+if (Attrs  Attrs-paramHasAttr(j, ParamAttr::ZExt))
   Flags = ~(ISD::ParamFlags::SExt);
-if (Attrs  Attrs-paramHasAttr(j, SExtAttribute))
+if (Attrs  Attrs-paramHasAttr(j, ParamAttr::SExt))
   Flags |= ISD::ParamFlags::SExt;
-if (Attrs  Attrs-paramHasAttr(j, InRegAttribute))
+if (Attrs  Attrs-paramHasAttr(j, ParamAttr::InReg))
   Flags |= ISD::ParamFlags::InReg;
-if (Attrs  Attrs-paramHasAttr(j, StructRetAttribute))
+if (Attrs  Attrs-paramHasAttr(j, ParamAttr::StructRet))
   Flags |= ISD::ParamFlags::StructReturn;
 Flags |= (OriginalAlignment  ISD::ParamFlags::OrigAlignmentOffs);
 
@@ -3697,10 +3697,10 @@
 case Promote: {
   SDOperand Op(Result, i++);
   if (MVT::isInteger(VT)) {
-if (Attrs  Attrs-paramHasAttr(Idx, SExtAttribute))
+if (Attrs  Attrs-paramHasAttr(Idx, ParamAttr::SExt))
   Op = DAG.getNode(ISD::AssertSext, Op.getValueType(), Op,
DAG.getValueType(VT));
-else if (Attrs  Attrs-paramHasAttr(Idx, ZExtAttribute))
+else if (Attrs  Attrs-paramHasAttr(Idx, ParamAttr::ZExt))
   Op = DAG.getNode(ISD::AssertZext, Op.getValueType(), Op,
DAG.getValueType(VT));
 Op = DAG.getNode(ISD::TRUNCATE, VT, Op);



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


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

2007-04-10 Thread Reid Spencer


Changes in directory llvm/lib/Target/MSIL:

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

For PR1146: http://llvm.org/PR1146 :
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


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

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


Index: llvm/lib/Target/MSIL/MSILWriter.cpp
diff -u llvm/lib/Target/MSIL/MSILWriter.cpp:1.2 
llvm/lib/Target/MSIL/MSILWriter.cpp:1.3
--- llvm/lib/Target/MSIL/MSILWriter.cpp:1.2 Mon Apr  9 01:17:21 2007
+++ llvm/lib/Target/MSIL/MSILWriter.cpp Tue Apr 10 21:44:19 2007
@@ -1133,7 +1133,7 @@
 void MSILWriter::printFunction(const Function F) {
   const FunctionType* FTy = F.getFunctionType();
   const ParamAttrsList *Attrs = FTy-getParamAttrs();
-  bool isSigned = Attrs  Attrs-paramHasAttr(0, SExtAttribute);
+  bool isSigned = Attrs  Attrs-paramHasAttr(0, ParamAttr::SExt);
   Out  \n.method static ;
   Out  (F.hasInternalLinkage() ? private  : public );
   if (F.isVarArg()) Out  vararg ;
@@ -1144,7 +1144,7 @@
   unsigned ArgIdx = 1;
   for (Function::const_arg_iterator I = F.arg_begin(), E = F.arg_end(); I!=E;
++I, ++ArgIdx) {
-isSigned = Attrs  Attrs-paramHasAttr(ArgIdx, SExtAttribute);
+isSigned = Attrs  Attrs-paramHasAttr(ArgIdx, ParamAttr::SExt);
 if (I!=F.arg_begin()) Out  , ;
 Out  getTypeName(I-getType(),isSigned)  getValueName(I);
   }



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


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

2007-04-10 Thread Reid Spencer


Changes in directory llvm/include/llvm:

ParameterAttributes.h updated: 1.6 - 1.7
---
Log message:

For PR1146: http://llvm.org/PR1146 :
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


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

 ParameterAttributes.h |   67 --
 1 files changed, 49 insertions(+), 18 deletions(-)


Index: llvm/include/llvm/ParameterAttributes.h
diff -u llvm/include/llvm/ParameterAttributes.h:1.6 
llvm/include/llvm/ParameterAttributes.h:1.7
--- llvm/include/llvm/ParameterAttributes.h:1.6 Sun Apr  8 20:53:54 2007
+++ llvm/include/llvm/ParameterAttributes.h Tue Apr 10 21:44:19 2007
@@ -1,4 +1,4 @@
-//===-- llvm/ParameterAttributes.h - Container for Param Attrs --*- C++ 
-*-===//
+//===-- llvm/ParameterAttributes.h - Container for ParamAttrs ---*- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -25,16 +25,22 @@
 /// treated by optimizations and code generation. This enumeration lists the
 /// attributes that can be associated with parameters or function results.
 /// @brief Function parameter attributes.
-enum ParameterAttributes {
-  NoAttributeSet = 0,  /// No attributes have been set
-  ZExtAttribute  = 1  0, /// zero extended before/after call
-  SExtAttribute  = 1  1, /// sign extended before/after call
-  NoReturnAttribute  = 1  2, /// mark the function as not returning
-  InRegAttribute = 1  3, /// force argument to be passed in register
-  StructRetAttribute = 1  4, /// hidden pointer to structure to return
-  NoUnwindAttribute  = 1  5  /// Function doesn't unwind stack
+namespace ParamAttr {
+
+enum Attributes {
+  None   = 0,  /// No attributes have been set
+  ZExt   = 1  0, /// zero extended before/after call
+  SExt   = 1  1, /// sign extended before/after call
+  NoReturn   = 1  2, /// mark the function as not returning
+  InReg  = 1  3, /// force argument to be passed in register
+  StructRet  = 1  4, /// hidden pointer to structure to return
+  NoUnwind   = 1  5  /// Function doesn't unwind stack
 };
 
+}
+
+typedef ParamAttr::Attributes ParameterAttributes;
+
 /// This class is used by Function and CallInst to represent the set of 
 /// parameter attributes used. It represents a list of pairs of uint16_t, one
 /// for the parameter index, and one a set of ParameterAttributes bits.
@@ -45,6 +51,39 @@
 /// are provided to obtain information about the attributes.
 /// @brief A List of ParameterAttributes.
 class ParamAttrsList {
+  //void operator=(const ParamAttrsList ); // Do not implement
+  //ParamAttrsList(const ParamAttrsList ); // Do not implement
+
+  /// @name Types
+  /// @{
+  public:
+/// This is an internal structure used to associate the ParameterAttributes
+/// with a parameter index. 
+/// @brief ParameterAttributes with a parameter index.
+struct ParamAttrsWithIndex {
+  uint16_t attrs; /// The attributes that are set, |'d together
+  uint16_t index; /// Index of the parameter for which the attributes 
apply
+};
+
+/// @brief A vector of attribute/index pairs.
+typedef SmallVectorParamAttrsWithIndex,4 ParamAttrsVector;
+
+  /// @}
+  /// @name Construction
+  /// @{
+  public:
+/// @brief Construct an empty ParamAttrsList
+ParamAttrsList() {}
+
+/// This method ensures the uniqueness of ParamAttrsList instances. The
+/// argument is a vector of attribute/index pairs as represented by the
+/// ParamAttrsWithIndex structure. The vector is used in the construction 
of
+/// the ParamAttrsList instance. If an instance with identical vector pairs
+/// exists, it will be returned instead of creating a new instance.
+/// @brief Get a ParamAttrsList instance.
+ParamAttrsList *get(const ParamAttrsVector attrVec);
+
+  /// @}
   /// @name Accessors
   /// @{
   public:
@@ -148,15 +187,7 @@
   /// @name Data
   /// @{
   private:
-/// This is an internal structure used to associate the ParameterAttributes
-/// with a parameter index. 
-/// @brief ParameterAttributes with a parameter index.
-struct ParamAttrsWithIndex {
-  uint16_t attrs; /// The attributes that are set, |'d together
-  uint16_t index; /// Index of the parameter for which the attributes 
apply
-};
-
-SmallVectorParamAttrsWithIndex,4 attrs; /// The list of attributes
+ParamAttrsVector attrs; /// The list of attributes
   /// @}
 };
 



___
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.cpp.cvs UpgradeParser.y UpgradeParser.y.cvs

2007-04-10 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.cpp.cvs updated: 1.73 - 1.74
UpgradeParser.y updated: 1.79 - 1.80
UpgradeParser.y.cvs updated: 1.72 - 1.73
---
Log message:

For PR1146: http://llvm.org/PR1146 :
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


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

 UpgradeParser.cpp.cvs |   16 
 UpgradeParser.y   |   16 
 UpgradeParser.y.cvs   |   16 
 3 files changed, 24 insertions(+), 24 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.73 
llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.74
--- llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.73  Mon Apr  9 01:16:21 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs   Tue Apr 10 21:44:19 2007
@@ -748,7 +748,7 @@
 PAL2 = *F2-getParamAttrs();
   if (PAL1.getParamAttrs(0) != PAL2.getParamAttrs(0))
 return false;
-  unsigned SRetMask = ~unsigned(StructRetAttribute);
+  unsigned SRetMask = ~unsigned(ParamAttr::StructRet);
   for (unsigned i = 0; i  F1-getNumParams(); ++i) {
 if (F1-getParamType(i) != F2-getParamType(i) ||
 unsigned(PAL1.getParamAttrs(i+1))  SRetMask !=
@@ -793,7 +793,7 @@
 const FunctionType *FT2 = dyn_castFunctionType(PF2-getElementType());
 if (FT1  FT2  FuncTysDifferOnlyBySRet(FT1, FT2)) {
   const ParamAttrsList *PAL2 = FT2-getParamAttrs();
-  if (PAL2  PAL2-paramHasAttr(1, StructRetAttribute))
+  if (PAL2  PAL2-paramHasAttr(1, ParamAttr::StructRet))
 return V;
   else if (Constant *C = dyn_castConstant(V))
 return ConstantExpr::getBitCast(C, PF1);
@@ -5389,8 +5389,8 @@
 ParamAttrsList *ParamAttrs = 0;
 if ((yyvsp[-7].UIntVal) == OldCallingConv::CSRet) {
   ParamAttrs = new ParamAttrsList();
-  ParamAttrs-addAttributes(0, NoAttributeSet); // result
-  ParamAttrs-addAttributes(1, StructRetAttribute); // first arg
+  ParamAttrs-addAttributes(0, ParamAttr::None); // result
+  ParamAttrs-addAttributes(1, ParamAttr::StructRet); // first arg
 }
 
 const FunctionType *FT = 
@@ -5867,8 +5867,8 @@
   ParamAttrsList *ParamAttrs = 0;
   if ((yyvsp[-11].UIntVal) == OldCallingConv::CSRet) {
 ParamAttrs = new ParamAttrsList();
-ParamAttrs-addAttributes(0, NoAttributeSet);  // Function result
-ParamAttrs-addAttributes(1, StructRetAttribute);  // first param
+ParamAttrs-addAttributes(0, ParamAttr::None);  // Function result
+ParamAttrs-addAttributes(1, ParamAttr::StructRet);  // first param
   }
   bool isVarArg = ParamTypes.size()  ParamTypes.back() == Type::VoidTy;
   if (isVarArg) ParamTypes.pop_back();
@@ -6369,8 +6369,8 @@
   ParamAttrsList *ParamAttrs = 0;
   if ((yyvsp[-5].UIntVal) == OldCallingConv::CSRet) {
 ParamAttrs = new ParamAttrsList();
-ParamAttrs-addAttributes(0, NoAttributeSet); // function result
-ParamAttrs-addAttributes(1, StructRetAttribute); // first parameter
+ParamAttrs-addAttributes(0, ParamAttr::None); // function result
+ParamAttrs-addAttributes(1, ParamAttr::StructRet); // first parameter
   }
 
   FTy = FunctionType::get(RetTy, ParamTypes, isVarArg, ParamAttrs);


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.79 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.80
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.79Mon Apr  9 01:15:59 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Tue Apr 10 21:44:20 2007
@@ -388,7 +388,7 @@
 PAL2 = *F2-getParamAttrs();
   if (PAL1.getParamAttrs(0) != PAL2.getParamAttrs(0))
 return false;
-  unsigned SRetMask = ~unsigned(StructRetAttribute);
+  unsigned SRetMask = ~unsigned(ParamAttr::StructRet);
   for (unsigned i = 0; i  F1-getNumParams(); ++i) {
 if (F1-getParamType(i) != F2-getParamType(i) ||
 unsigned(PAL1.getParamAttrs(i+1))  SRetMask !=
@@ -433,7 +433,7 @@
 const FunctionType *FT2 = dyn_castFunctionType(PF2-getElementType());
 if (FT1  FT2  FuncTysDifferOnlyBySRet(FT1, FT2)) {
   const ParamAttrsList *PAL2 = FT2-getParamAttrs();
-  if (PAL2  PAL2-paramHasAttr(1, StructRetAttribute))
+  if (PAL2  PAL2-paramHasAttr(1, ParamAttr::StructRet))
 return V;
   else if (Constant *C = dyn_castConstant(V))
 return ConstantExpr::getBitCast(C, PF1);
@@ -2904,8 +2904,8 @@
 ParamAttrsList *ParamAttrs = 0;
 if ($1 == OldCallingConv::CSRet) {
   ParamAttrs = new ParamAttrsList();
-  ParamAttrs-addAttributes(0, NoAttributeSet); // result
-  ParamAttrs-addAttributes(1, StructRetAttribute); // first arg
+  ParamAttrs-addAttributes(0, ParamAttr::None); // result
+  ParamAttrs-addAttributes(1, ParamAttr::StructRet); // first arg
 }
 
 const FunctionType *FT = 
@@ -3293,8 +3293,8 @@
   

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

2007-04-10 Thread Reid Spencer


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.cpp.cvs updated: 1.82 - 1.83
llvmAsmParser.y updated: 1.337 - 1.338
llvmAsmParser.y.cvs updated: 1.83 - 1.84
---
Log message:

For PR1146: http://llvm.org/PR1146 :
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


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

 llvmAsmParser.cpp.cvs |   44 ++--
 llvmAsmParser.y   |   44 ++--
 llvmAsmParser.y.cvs   |   44 ++--
 3 files changed, 66 insertions(+), 66 deletions(-)


Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs
diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.82 
llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.83
--- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.82   Mon Apr  9 01:13:29 2007
+++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvsTue Apr 10 21:44:19 2007
@@ -3337,27 +3337,27 @@
 
   case 93:
 #line 1192 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
-{ (yyval.ParamAttrs) = ZExtAttribute;  ;}
+{ (yyval.ParamAttrs) = ParamAttr::ZExt;  ;}
 break;
 
   case 94:
 #line 1193 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
-{ (yyval.ParamAttrs) = SExtAttribute;  ;}
+{ (yyval.ParamAttrs) = ParamAttr::SExt;  ;}
 break;
 
   case 95:
 #line 1194 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
-{ (yyval.ParamAttrs) = InRegAttribute; ;}
+{ (yyval.ParamAttrs) = ParamAttr::InReg; ;}
 break;
 
   case 96:
 #line 1195 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
-{ (yyval.ParamAttrs) = StructRetAttribute; ;}
+{ (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
 break;
 
   case 97:
 #line 1198 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
-{ (yyval.ParamAttrs) = NoAttributeSet; ;}
+{ (yyval.ParamAttrs) = ParamAttr::None; ;}
 break;
 
   case 98:
@@ -3369,17 +3369,17 @@
 
   case 99:
 #line 1204 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
-{ (yyval.ParamAttrs) = NoReturnAttribute; ;}
+{ (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
 break;
 
   case 100:
 #line 1205 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
-{ (yyval.ParamAttrs) = NoUnwindAttribute; ;}
+{ (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
 break;
 
   case 102:
 #line 1209 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
-{ (yyval.ParamAttrs) = NoAttributeSet; ;}
+{ (yyval.ParamAttrs) = ParamAttr::None; ;}
 break;
 
   case 103:
@@ -3522,7 +3522,7 @@
 {
 std::vectorconst Type* Params;
 ParamAttrsList Attrs;
-if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
+if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
   Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
 unsigned index = 1;
 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)-begin(), E 
= (yyvsp[-2].TypeWithAttrsList)-end();
@@ -3530,7 +3530,7 @@
   const Type *Ty = I-Ty-get();
   Params.push_back(Ty);
   if (Ty != Type::VoidTy)
-if (I-Attrs != NoAttributeSet)
+if (I-Attrs != ParamAttr::None)
   Attrs.addAttributes(index, I-Attrs);
 }
 bool isVarArg = Params.size()  Params.back() == Type::VoidTy;
@@ -3552,7 +3552,7 @@
 {
 std::vectorconst Type* Params;
 ParamAttrsList Attrs;
-if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
+if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
   Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)-begin(), E 
= (yyvsp[-2].TypeWithAttrsList)-end();
 unsigned index = 1;
@@ -3560,7 +3560,7 @@
   const Type* Ty = I-Ty-get();
   Params.push_back(Ty);
   if (Ty != Type::VoidTy)
-if (I-Attrs != NoAttributeSet)
+if (I-Attrs != ParamAttr::None)
   Attrs.addAttributes(index, I-Attrs);
 }
 bool isVarArg = Params.size()  Params.back() == Type::VoidTy;
@@ -3693,7 +3693,7 @@
 #line 1431 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
 {
 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
-TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
+TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
 TWA.Ty = new PATypeHolder(Type::VoidTy);
 (yyval.TypeWithAttrsList)-push_back(TWA);
 CHECK_FOR_ERROR
@@ -3704,7 +3704,7 @@
 #line 1438 /proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y
 {
 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
-TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
+TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
 TWA.Ty = new PATypeHolder(Type::VoidTy);
 (yyval.TypeWithAttrsList)-push_back(TWA);
 CHECK_FOR_ERROR
@@ -4578,7 +4578,7 @@
 struct ArgListEntry E;
 E.Ty = new PATypeHolder(Type::VoidTy);
 E.Name = 0;
-E.Attrs = NoAttributeSet;
+E.Attrs = ParamAttr::None;
 (yyval.ArgList)-push_back(E);
 CHECK_FOR_ERROR
   ;}
@@ -4591,7 +4591,7 @@
 struct ArgListEntry E;
 E.Ty = new 

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

2007-04-10 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.267 - 1.268
Function.cpp updated: 1.117 - 1.118
Type.cpp updated: 1.181 - 1.182
---
Log message:

For PR1146: http://llvm.org/PR1146 :
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


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

 AsmWriter.cpp |   22 +++---
 Function.cpp  |   16 
 Type.cpp  |6 +++---
 3 files changed, 22 insertions(+), 22 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.267 llvm/lib/VMCore/AsmWriter.cpp:1.268
--- llvm/lib/VMCore/AsmWriter.cpp:1.267 Mon Apr  9 01:10:42 2007
+++ llvm/lib/VMCore/AsmWriter.cpp   Tue Apr 10 21:44:19 2007
@@ -291,7 +291,7 @@
   if (I != FTy-param_begin())
 Result += , ;
   calcTypeName(*I, TypeStack, TypeNames, Result);
-  if (Attrs  Attrs-getParamAttrs(Idx) != NoAttributeSet) {
+  if (Attrs  Attrs-getParamAttrs(Idx) != ParamAttr::None) {
 Result += +  ;
 Result += Attrs-getParamAttrsTextByIndex(Idx);
   }
@@ -302,7 +302,7 @@
   Result += ...;
 }
 Result += );
-if (Attrs  Attrs-getParamAttrs(0) != NoAttributeSet) {
+if (Attrs  Attrs-getParamAttrs(0) != ParamAttr::None) {
   Result +=  ;
   Result += Attrs-getParamAttrsTextByIndex(0);
 }
@@ -737,7 +737,7 @@
   if (I != FTy-param_begin())
 Out  , ;
   printType(*I);
-  if (Attrs  Attrs-getParamAttrs(Idx) != NoAttributeSet) {
+  if (Attrs  Attrs-getParamAttrs(Idx) != ParamAttr::None) {
 Out Attrs-getParamAttrsTextByIndex(Idx);
   }
   Idx++;
@@ -747,7 +747,7 @@
   Out  ...;
 }
 Out  ')';
-if (Attrs  Attrs-getParamAttrs(0) != NoAttributeSet)
+if (Attrs  Attrs-getParamAttrs(0) != ParamAttr::None)
   Out  ' '  Attrs-getParamAttrsTextByIndex(0);
   } else if (const StructType *STy = dyn_castStructType(Ty)) {
 if (STy-isPacked())
@@ -974,7 +974,7 @@
 // Insert commas as we go... the first arg doesn't get a comma
 if (I != F-arg_begin()) Out  , ;
 printArgument(I, (Attrs ? Attrs-getParamAttrs(Idx)
-: uint16_t(NoAttributeSet)));
+: uint16_t(ParamAttr::None)));
 Idx++;
   }
 
@@ -984,7 +984,7 @@
 Out  ...;  // Output varargs portion of signature!
   }
   Out  ')';
-  if (Attrs  Attrs-getParamAttrs(0) != NoAttributeSet)
+  if (Attrs  Attrs-getParamAttrs(0) != ParamAttr::None)
 Out  ' '  Attrs-getParamAttrsTextByIndex(0);
   if (F-hasSection())
 Out   section \  F-getSection()  '';
@@ -1013,7 +1013,7 @@
   // Output type...
   printType(Arg-getType());
 
-  if (Attrs != NoAttributeSet)
+  if (Attrs != ParamAttr::None)
 Out  ' '  ParamAttrsList::getParamAttrsText(Attrs);
 
   // Output name, if available...
@@ -1188,11 +1188,11 @@
   if (op  1)
 Out  ',';
   writeOperand(I.getOperand(op), true);
-  if (PAL  PAL-getParamAttrs(op) != NoAttributeSet)
+  if (PAL  PAL-getParamAttrs(op) != ParamAttr::None)
 Out PAL-getParamAttrsTextByIndex(op);
 }
 Out   );
-if (PAL  PAL-getParamAttrs(0) != NoAttributeSet)
+if (PAL  PAL-getParamAttrs(0) != ParamAttr::None)
   Out  ' '  PAL-getParamAttrsTextByIndex(0);
   } else if (const InvokeInst *II = dyn_castInvokeInst(I)) {
 const PointerType*PTy = castPointerType(Operand-getType());
@@ -1228,12 +1228,12 @@
   if (op  3)
 Out  ',';
   writeOperand(I.getOperand(op), true);
-  if (PAL  PAL-getParamAttrs(op-2) != NoAttributeSet)
+  if (PAL  PAL-getParamAttrs(op-2) != ParamAttr::None)
 Out PAL-getParamAttrsTextByIndex(op-2);
 }
 
 Out   );
-if (PAL  PAL-getParamAttrs(0) != NoAttributeSet)
+if (PAL  PAL-getParamAttrs(0) != ParamAttr::None)
   Out PAL-getParamAttrsTextByIndex(0);
 Out  \n\t\t\tto;
 writeOperand(II-getNormalDest(), true);


Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.117 llvm/lib/VMCore/Function.cpp:1.118
--- llvm/lib/VMCore/Function.cpp:1.117  Mon Apr  9 10:01:12 2007
+++ llvm/lib/VMCore/Function.cppTue Apr 10 21:44:19 2007
@@ -81,24 +81,24 @@
   for (unsigned i = 0; i  limit; ++i)
 if (attrs[i].index == Index)
   return attrs[i].attrs;
-  return NoAttributeSet;
+  return ParamAttr::None;
 }
 
 
 std::string 
 ParamAttrsList::getParamAttrsText(uint16_t Attrs) {
   std::string Result;
-  if (Attrs  ZExtAttribute)
+  if (Attrs  ParamAttr::ZExt)
 Result += zext ;
-  if (Attrs  SExtAttribute)
+  if (Attrs  ParamAttr::SExt)
 Result += sext ;
-  if (Attrs  NoReturnAttribute)
+  if (Attrs  ParamAttr::NoReturn)
 Result += noreturn ;
-  if (Attrs  NoUnwindAttribute)
+  if (Attrs  ParamAttr::NoUnwind)
 Result += nounwind ;
-  if (Attrs  InRegAttribute)
+  if (Attrs  ParamAttr::InReg)
 Result += inreg ;
-  if (Attrs  StructRetAttribute)
+  if (Attrs  

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

2007-04-10 Thread Reid Spencer


Changes in directory llvm/lib/Target/CBackend:

CBackend.cpp updated: 1.332 - 1.333
---
Log message:

For PR1146: http://llvm.org/PR1146 :
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


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

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


Index: llvm/lib/Target/CBackend/CBackend.cpp
diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.332 
llvm/lib/Target/CBackend/CBackend.cpp:1.333
--- llvm/lib/Target/CBackend/CBackend.cpp:1.332 Mon Apr  9 01:17:21 2007
+++ llvm/lib/Target/CBackend/CBackend.cpp   Tue Apr 10 21:44:19 2007
@@ -356,7 +356,7 @@
 if (PrintedType)
   FunctionInnards  , ;
 printType(FunctionInnards, *I, 
-/*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, SExtAttribute), );
+/*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, ParamAttr::SExt), );
 PrintedType = true;
   }
   if (FTy-isVarArg()) {
@@ -368,7 +368,7 @@
   FunctionInnards  ')';
   std::string tstr = FunctionInnards.str();
   printType(Out, RetTy, 
-  /*isSigned=*/Attrs  Attrs-paramHasAttr(0, SExtAttribute), tstr);
+  /*isSigned=*/Attrs  Attrs-paramHasAttr(0, ParamAttr::SExt), tstr);
 }
 
 std::ostream 
@@ -430,7 +430,7 @@
   if (I != FTy-param_begin())
 FunctionInnards  , ;
   printType(FunctionInnards, *I, 
- /*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, SExtAttribute), );
+ /*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, ParamAttr::SExt), );
   ++Idx;
 }
 if (FTy-isVarArg()) {
@@ -442,7 +442,7 @@
 FunctionInnards  ')';
 std::string tstr = FunctionInnards.str();
 printType(Out, FTy-getReturnType(), 
-/*isSigned=*/Attrs  Attrs-paramHasAttr(0, SExtAttribute), tstr);
+/*isSigned=*/Attrs  Attrs-paramHasAttr(0, ParamAttr::SExt), tstr);
 return Out;
   }
   case Type::StructTyID: {
@@ -1832,7 +1832,7 @@
 else
   ArgName = ;
 printType(FunctionInnards, I-getType(), 
-/*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, SExtAttribute), 
+/*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, ParamAttr::SExt), 
 ArgName);
 PrintedArg = true;
 ++Idx;
@@ -1853,7 +1853,7 @@
 for (; I != E; ++I) {
   if (PrintedArg) FunctionInnards  , ;
   printType(FunctionInnards, *I,
- /*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, SExtAttribute));
+ /*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, ParamAttr::SExt));
   PrintedArg = true;
   ++Idx;
 }
@@ -1881,7 +1881,7 @@
 
   // Print out the return type and the signature built above.
   printType(Out, RetTy, 
-/*isSigned=*/ Attrs  Attrs-paramHasAttr(0, SExtAttribute), 
+/*isSigned=*/ Attrs  Attrs-paramHasAttr(0, ParamAttr::SExt), 
 FunctionInnards.str());
 }
 
@@ -2586,7 +2586,7 @@
 (*AI)-getType() != FTy-getParamType(ArgNo)) {
   Out  '(';
   printType(Out, FTy-getParamType(ArgNo), 
-/*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, SExtAttribute));
+/*isSigned=*/Attrs  Attrs-paramHasAttr(Idx, ParamAttr::SExt));
   Out  ')';
 }
 writeOperand(*AI);



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


[llvm-commits] [llvm-gcc] ParamAttrs change PLEASE APPLY

2007-04-10 Thread Reid Spencer
Hi,

Attached is a small patch to fix the names of the names of the parameter
attributes. They were put into a namespace. Please apply as soon as
possible.

Thanks,

Reid.
Index: gcc/llvm-types.cpp
===
--- gcc/llvm-types.cpp	(revision 306)
+++ gcc/llvm-types.cpp	(working copy)
@@ -712,7 +712,7 @@
   if (static_chain) {
 // Pass the static chain in a register.
 ParamAttrs = new ParamAttrsList();
-ParamAttrs-addAttributes(1, InRegAttribute);
+ParamAttrs-addAttributes(1, ParamAttr::InReg);
   }
 
   return FunctionType::get(RetTy, ArgTys, false, ParamAttrs);
@@ -768,22 +768,22 @@
   // the function will be correctly sign or zero extended to 32-bits by
   // the LLVM code gen.
   ParamAttrsList Attrs;
-  uint16_t RAttributes = NoAttributeSet;
+  uint16_t RAttributes = ParamAttr::None;
   if (CallingConv == CallingConv::C) {
 tree ResultTy = TREE_TYPE(type);  
 if (TREE_CODE(ResultTy) == BOOLEAN_TYPE) {
   if (TREE_INT_CST_LOW(TYPE_SIZE(ResultTy))  INT_TYPE_SIZE)
-RAttributes |= ZExtAttribute;
+RAttributes |= ParamAttr::ZExt;
 } else {
   if (TREE_CODE(ResultTy) == INTEGER_TYPE  
   TREE_INT_CST_LOW(TYPE_SIZE(ResultTy))  INT_TYPE_SIZE)
 if (TYPE_UNSIGNED(ResultTy))
-  RAttributes |= ZExtAttribute;
+  RAttributes |= ParamAttr::ZExt;
 else 
-  RAttributes |= SExtAttribute;
+  RAttributes |= ParamAttr::SExt;
 }
   }
-  if (RAttributes != NoAttributeSet)
+  if (RAttributes != ParamAttr::None)
 Attrs.addAttributes(0, RAttributes);
   
   unsigned Idx = 1;
@@ -796,30 +796,30 @@
 
   if (static_chain)
 // Pass the static chain in a register.
-Attrs.addAttributes(Idx++, InRegAttribute);
+Attrs.addAttributes(Idx++, ParamAttr::InReg);
   
   // The struct return attribute must be associated with the first
   // parameter but that parameter may have other attributes too so we set up
   // the first Attributes value here based on struct return. This only works
   // Handle the structure return calling convention
   if (ABIConverter.isStructReturn())
-Attrs.addAttributes(Idx++, StructRetAttribute);
+Attrs.addAttributes(Idx++, ParamAttr::StructRet);
   
   for (tree Args = TYPE_ARG_TYPES(type);
Args  TREE_VALUE(Args) != void_type_node; Args = TREE_CHAIN(Args)) {
 tree Ty = TREE_VALUE(Args);
 
-unsigned Attributes = NoAttributeSet;
+unsigned Attributes = ParamAttr::None;
 if (CallingConv == CallingConv::C) {
   if (TREE_CODE(Ty) == BOOLEAN_TYPE) {
 if (TREE_INT_CST_LOW(TYPE_SIZE(Ty))  INT_TYPE_SIZE)
-  Attributes |= ZExtAttribute;
+  Attributes |= ParamAttr::ZExt;
   } else if (TREE_CODE(Ty) == INTEGER_TYPE  
  TREE_INT_CST_LOW(TYPE_SIZE(Ty))  INT_TYPE_SIZE) {
 if (TYPE_UNSIGNED(Ty))
-  Attributes |= ZExtAttribute;
+  Attributes |= ParamAttr::ZExt;
 else
-  Attributes |= SExtAttribute;
+  Attributes |= ParamAttr::SExt;
   }
 }
 
@@ -829,7 +829,7 @@
 isVarArg, lparam);
 #endif // LLVM_TARGET_ENABLE_REGPARM
 
-if (Attributes != NoAttributeSet)
+if (Attributes != ParamAttr::None)
   Attrs.addAttributes(Idx, Attributes);
 Idx++;
   }
Index: gcc/config/i386/llvm-i386-target.h
===
--- gcc/config/i386/llvm-i386-target.h	(revision 306)
+++ gcc/config/i386/llvm-i386-target.h	(working copy)
@@ -54,7 +54,7 @@
   int words = (Size + BITS_PER_WORD - 1) / BITS_PER_WORD;   \
   local_regparm -= words;   \
   if (local_regparm=0) {   \
-Attribute |= InRegAttribute;\
+Attribute |= ParamAttr::InReg;  \
   } else\
 local_regparm = 0;  \
 }   \
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/System/Path.cpp

2007-04-10 Thread Chris Lattner


Changes in directory llvm/lib/System:

Path.cpp updated: 1.24 - 1.25
---
Log message:

Hack to get sys::Path to recognize macho dylibs.


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

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


Index: llvm/lib/System/Path.cpp
diff -u llvm/lib/System/Path.cpp:1.24 llvm/lib/System/Path.cpp:1.25
--- llvm/lib/System/Path.cpp:1.24   Tue Apr 10 21:02:09 2007
+++ llvm/lib/System/Path.cppTue Apr 10 22:15:35 2007
@@ -68,12 +68,14 @@
   }
   break;
 
-case 0xCE:
-case 0xCF:
+case 0xCA:
   // This is complicated by an overlap with Java class files. 
   // See the Mach-O section in /usr/share/file/magic for details.
-  if (magic[1] == char(0xFA)  magic[2] == char(0xED)  
-  magic[3] == char(0xFE))
+  if (magic[1] == char(0xFE)  magic[2] == char(0xBA)  
+  magic[3] == char(0xBE)) {
+return Mach_O_DynamicallyLinkedSharedLib_FileType;
+
+// FIXME: How does this work?
 if (length = 14  magic[13] == 0)
   switch (magic[12]) {
 default: break;
@@ -87,6 +89,7 @@
 case 8: return Mach_O_Bundle_FileType;
 case 9: return Mach_O_DynamicallyLinkedSharedLibStub_FileType;
   }
+  }
   break;
 
 case 0xF0: // PowerPC Windows



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


[llvm-commits] [125963] Apply Reid's parameter attr patch.

2007-04-10 Thread clattner
Revision: 125963
Author:   clattner
Date: 2007-04-10 20:18:43 -0700 (Tue, 10 Apr 2007)

Log Message:
---
Apply Reid's parameter attr patch.

Modified Paths:
--
apple-local/branches/llvm/gcc/config/i386/llvm-i386-target.h
apple-local/branches/llvm/gcc/llvm-types.cpp

Modified: apple-local/branches/llvm/gcc/config/i386/llvm-i386-target.h
===
--- apple-local/branches/llvm/gcc/config/i386/llvm-i386-target.h
2007-04-10 22:30:30 UTC (rev 125962)
+++ apple-local/branches/llvm/gcc/config/i386/llvm-i386-target.h
2007-04-11 03:18:43 UTC (rev 125963)
@@ -54,7 +54,7 @@
   int words = (Size + BITS_PER_WORD - 1) / BITS_PER_WORD;   \
   local_regparm -= words;   \
   if (local_regparm=0) {   \
-Attribute |= InRegAttribute;\
+Attribute |= ParamAttr::InReg;  \
   } else\
 local_regparm = 0;  \
 }   \

Modified: apple-local/branches/llvm/gcc/llvm-types.cpp
===
--- apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-10 22:30:30 UTC 
(rev 125962)
+++ apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-11 03:18:43 UTC 
(rev 125963)
@@ -712,7 +712,7 @@
   if (static_chain) {
 // Pass the static chain in a register.
 ParamAttrs = new ParamAttrsList();
-ParamAttrs-addAttributes(1, InRegAttribute);
+ParamAttrs-addAttributes(1, ParamAttr::InReg);
   }
 
   return FunctionType::get(RetTy, ArgTys, false, ParamAttrs);
@@ -768,22 +768,22 @@
   // the function will be correctly sign or zero extended to 32-bits by
   // the LLVM code gen.
   ParamAttrsList Attrs;
-  uint16_t RAttributes = NoAttributeSet;
+  uint16_t RAttributes = ParamAttr::None;
   if (CallingConv == CallingConv::C) {
 tree ResultTy = TREE_TYPE(type);  
 if (TREE_CODE(ResultTy) == BOOLEAN_TYPE) {
   if (TREE_INT_CST_LOW(TYPE_SIZE(ResultTy))  INT_TYPE_SIZE)
-RAttributes |= ZExtAttribute;
+RAttributes |= ParamAttr::ZExt;
 } else {
   if (TREE_CODE(ResultTy) == INTEGER_TYPE  
   TREE_INT_CST_LOW(TYPE_SIZE(ResultTy))  INT_TYPE_SIZE)
 if (TYPE_UNSIGNED(ResultTy))
-  RAttributes |= ZExtAttribute;
+  RAttributes |= ParamAttr::ZExt;
 else 
-  RAttributes |= SExtAttribute;
+  RAttributes |= ParamAttr::SExt;
 }
   }
-  if (RAttributes != NoAttributeSet)
+  if (RAttributes != ParamAttr::None)
 Attrs.addAttributes(0, RAttributes);
   
   unsigned Idx = 1;
@@ -796,30 +796,30 @@
 
   if (static_chain)
 // Pass the static chain in a register.
-Attrs.addAttributes(Idx++, InRegAttribute);
+Attrs.addAttributes(Idx++, ParamAttr::InReg);
   
   // The struct return attribute must be associated with the first
   // parameter but that parameter may have other attributes too so we set up
   // the first Attributes value here based on struct return. This only works
   // Handle the structure return calling convention
   if (ABIConverter.isStructReturn())
-Attrs.addAttributes(Idx++, StructRetAttribute);
+Attrs.addAttributes(Idx++, ParamAttr::StructRet);
   
   for (tree Args = TYPE_ARG_TYPES(type);
Args  TREE_VALUE(Args) != void_type_node; Args = TREE_CHAIN(Args)) {
 tree Ty = TREE_VALUE(Args);
 
-unsigned Attributes = NoAttributeSet;
+unsigned Attributes = ParamAttr::None;
 if (CallingConv == CallingConv::C) {
   if (TREE_CODE(Ty) == BOOLEAN_TYPE) {
 if (TREE_INT_CST_LOW(TYPE_SIZE(Ty))  INT_TYPE_SIZE)
-  Attributes |= ZExtAttribute;
+  Attributes |= ParamAttr::ZExt;
   } else if (TREE_CODE(Ty) == INTEGER_TYPE  
  TREE_INT_CST_LOW(TYPE_SIZE(Ty))  INT_TYPE_SIZE) {
 if (TYPE_UNSIGNED(Ty))
-  Attributes |= ZExtAttribute;
+  Attributes |= ParamAttr::ZExt;
 else
-  Attributes |= SExtAttribute;
+  Attributes |= ParamAttr::SExt;
   }
 }
 
@@ -829,7 +829,7 @@
 isVarArg, lparam);
 #endif // LLVM_TARGET_ENABLE_REGPARM
 
-if (Attributes != NoAttributeSet)
+if (Attributes != ParamAttr::None)
   Attrs.addAttributes(Idx, Attributes);
 Idx++;
   }


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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

ScalarReplAggregates.cpp updated: 1.82 - 1.83
---
Log message:

fix a regression introduced by my last patch.


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

 ScalarReplAggregates.cpp |   15 +--
 1 files changed, 1 insertion(+), 14 deletions(-)


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.82 
llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.83
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.82Tue Apr 10 
19:57:54 2007
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Apr 10 22:27:24 2007
@@ -970,20 +970,7 @@
 if (isaIntegerType(LI-getType())) {
   assert(NV-getType() == LI-getType()  Truncate wasn't enough?);
 } else if (LI-getType()-isFloatingPoint()) {
-  // If needed, truncate the integer to the appropriate size.
-  if (NTy-getBitWidth()  LIBitWidth) {
-switch (LI-getType()-getTypeID()) {
-default: assert(0  Unknown FP type!);
-case Type::FloatTyID:
-  NV = new TruncInst(NV, Type::Int32Ty, LI-getName(), LI);
-  break;
-case Type::DoubleTyID:
-  NV = new TruncInst(NV, Type::Int64Ty, LI-getName(), LI);
-  break;
-}
-  }
-  
-  // Then do a bitcast.
+  // Just do a bitcast, we know the sizes match up.
   NV = new BitCastInst(NV, LI-getType(), LI-getName(), LI);
 } else {
   // Otherwise must be a pointer.



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


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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/PowerPC:

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

new testcases for integer abs function


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

 iabs.ll |   14 ++
 1 files changed, 14 insertions(+)


Index: llvm/test/CodeGen/PowerPC/iabs.ll
diff -c /dev/null llvm/test/CodeGen/PowerPC/iabs.ll:1.1
*** /dev/null   Wed Apr 11 00:03:07 2007
--- llvm/test/CodeGen/PowerPC/iabs.ll   Wed Apr 11 00:02:57 2007
***
*** 0 
--- 1,14 
+ ; RUN: llvm-as  %s | llc -march=ppc32 -stats 21 | grep '4 .*Number of 
machine instrs printed'
+ 
+ ;; Integer absolute value, should produce something as good as:
+ ;;  srawi r2, r3, 31
+ ;;  add r3, r3, r2
+ ;;  xor r3, r3, r2
+ ;;  blr 
+ define i32 @test(i32 %a) {
+ %tmp1neg = sub i32 0, %a
+ %b = icmp sgt i32 %a, -1
+ %abs = select i1 %b, i32 %a, i32 %tmp1neg
+ ret i32 %abs
+ }
+ 



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


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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/ARM:

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

new testcases for integer abs function


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

 iabs.ll |   20 
 1 files changed, 20 insertions(+)


Index: llvm/test/CodeGen/ARM/iabs.ll
diff -c /dev/null llvm/test/CodeGen/ARM/iabs.ll:1.1
*** /dev/null   Wed Apr 11 00:03:07 2007
--- llvm/test/CodeGen/ARM/iabs.ll   Wed Apr 11 00:02:57 2007
***
*** 0 
--- 1,20 
+ ; RUN: llvm-as  %s | llc -march=arm -stats 21 | grep '3 .*Number of 
machine instrs printed' 
+ ; RUN: llvm-as  %s | llc -march=thumb -stats 21 | grep '4 .*Number of 
machine instrs printed'
+ 
+ ;; Integer absolute value, should produce something as good as: ARM:
+ ;;   add r3, r0, r0, asr #31
+ ;;   eor r0, r3, r0, asr #31
+ ;;   bx lr
+ ;; Thumb:
+ ;;   asr r2, r0, #31
+ ;;   add r0, r0, r2
+ ;;   eor r0, r2
+ ;;   bx lr
+ 
+ define i32 @test(i32 %a) {
+ %tmp1neg = sub i32 0, %a
+ %b = icmp sgt i32 %a, -1
+ %abs = select i1 %b, i32 %a, i32 %tmp1neg
+ ret i32 %abs
+ }
+ 



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


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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/X86:

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

new testcases for integer abs function


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

 iabs.ll |   16 
 1 files changed, 16 insertions(+)


Index: llvm/test/CodeGen/X86/iabs.ll
diff -c /dev/null llvm/test/CodeGen/X86/iabs.ll:1.1
*** /dev/null   Wed Apr 11 00:03:07 2007
--- llvm/test/CodeGen/X86/iabs.ll   Wed Apr 11 00:02:57 2007
***
*** 0 
--- 1,16 
+ ; RUN: llvm-as  %s | llc -march=x86-64 -stats 21 | grep '6 .*Number of 
machine instrs printed'
+ 
+ ;; Integer absolute value, should produce something at least as good as:
+ ;;   movl %edi, %eax
+ ;;   sarl $31, %eax
+ ;;   addl %eax, %edi
+ ;;   xorl %eax, %edi
+ ;;   movl %edi, %eax
+ ;;   ret
+ define i32 @test(i32 %a) {
+ %tmp1neg = sub i32 0, %a
+ %b = icmp sgt i32 %a, -1
+ %abs = select i1 %b, i32 %a, i32 %tmp1neg
+ ret i32 %abs
+ }
+ 



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


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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.285 - 1.286
---
Log message:

Codegen integer abs more efficiently using the trick from the PPC CWG.  This
improves codegen on many architectures.  Tests committed as CodeGen/*/iabs.ll

X86 Old:X86 New:
_test:  _test:
   movl 4(%esp), %ecx  movl 4(%esp), %eax
   movl %ecx, %eax movl %eax, %ecx
   negl %eax   sarl $31, %ecx
   testl %ecx, %ecxaddl %ecx, %eax
   cmovns %ecx, %eax   xorl %ecx, %eax
   ret ret

PPC Old:PPC New:
_test:  _test:
   cmpwi cr0, r3, -1   srawi r2, r3, 31
   neg r2, r3  add r3, r3, r2
   bgt cr0, LBB1_2 ;   xor r3, r3, r2
LBB1_1: ;  blr
   mr r3, r2
LBB1_2: ;
   blr

ARM Old:ARM New:
_test:  _test:
   rsb r3, r0, #0  add r3, r0, r0, asr #31
   cmp r0, #0  eor r0, r3, r0, asr #31
   movge r3, r0bx lr
   mov r0, r3   
   bx lr

Thumb Old:  Thumb New:
_test:  _test:
   neg r2, r0  asr r2, r0, #31
   cmp r0, #0  add r0, r0, r2
   bge LBB1_2  eor r0, r2
LBB1_1: @  bx lr
   cpy r0, r2   
LBB1_2: @   
   bx lr


Sparc Old:  Sparc New:
test:   test:
   save -96, %o6, %o6  save -96, %o6, %o6
   sethi 0, %l0sra %i0, 31, %l0
   sub %l0, %i0, %l0   add %i0, %l0, %l1
   subcc %i0, -1, %l1  xor %l1, %l0, %i0
   bg .BB1_2   restore %g0, %g0, %g0
   nop retl
.BB1_1:nop
   or %g0, %l0, %i0
.BB1_2:
   restore %g0, %g0, %g0
   retl
   nop

It also helps alpha/ia64 :)


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

 DAGCombiner.cpp |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.285 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.286
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.285 Mon Apr  2 16:36:32 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Wed Apr 11 00:11:38 2007
@@ -4159,13 +4159,27 @@
   // Check to see if this is an integer abs. select_cc setl[te] X, 0, -X, X -
   // Y = sra (X, size(X)-1); xor (add (X, Y), Y)
   if (N1C  N1C-isNullValue()  (CC == ISD::SETLT || CC == ISD::SETLE) 
-  N0 == N3  N2.getOpcode() == ISD::SUB  N0 == N2.getOperand(1)) {
-if (ConstantSDNode *SubC = dyn_castConstantSDNode(N2.getOperand(0))) {
+  N0 == N3  N2.getOpcode() == ISD::SUB  N0 == N2.getOperand(1) 
+  N2.getOperand(0) == N1  MVT::isInteger(N0.getValueType())) {
+MVT::ValueType XType = N0.getValueType();
+SDOperand Shift = DAG.getNode(ISD::SRA, XType, N0,
+  DAG.getConstant(MVT::getSizeInBits(XType)-1,
+  TLI.getShiftAmountTy()));
+SDOperand Add = DAG.getNode(ISD::ADD, XType, N0, Shift);
+AddToWorkList(Shift.Val);
+AddToWorkList(Add.Val);
+return DAG.getNode(ISD::XOR, XType, Add, Shift);
+  }
+  // Check to see if this is an integer abs. select_cc setgt X, -1, X, -X -
+  // Y = sra (X, size(X)-1); xor (add (X, Y), Y)
+  if (N1C  N1C-isAllOnesValue()  CC == ISD::SETGT 
+  N0 == N2  N3.getOpcode() == ISD::SUB  N0 == N3.getOperand(1)) {
+if (ConstantSDNode *SubC = dyn_castConstantSDNode(N3.getOperand(0))) {
   MVT::ValueType XType = N0.getValueType();
   if (SubC-isNullValue()  MVT::isInteger(XType)) {
 SDOperand Shift = DAG.getNode(ISD::SRA, XType, N0,
 
DAG.getConstant(MVT::getSizeInBits(XType)-1,
-TLI.getShiftAmountTy()));
+  TLI.getShiftAmountTy()));
 SDOperand Add = DAG.getNode(ISD::ADD, XType, N0, Shift);
 AddToWorkList(Shift.Val);
 AddToWorkList(Add.Val);
@@ -4173,7 +4187,7 @@
   }
 }
   }
-
+  
   return SDOperand();
 }
 



___
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/ispositive.ll

2007-04-10 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/Generic:

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

new testcase


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

 ispositive.ll |   12 
 1 files changed, 12 insertions(+)


Index: llvm/test/CodeGen/Generic/ispositive.ll
diff -c /dev/null llvm/test/CodeGen/Generic/ispositive.ll:1.1
*** /dev/null   Wed Apr 11 00:32:23 2007
--- llvm/test/CodeGen/Generic/ispositive.ll Wed Apr 11 00:32:13 2007
***
*** 0 
--- 1,12 
+ ; RUN: llvm-as  %s | llc -march=x86 | grep shrl.*31 
+ ; RUN: llvm-as  %s | llc -march=ppc32 | grep 'srwi r3, r3, 31' 
+ ; RUN: llvm-as  %s | llc -march=arm | grep 'mov r0, r0, lsr #31' 
+ ; RUN: llvm-as  %s | llc -march=thumb | grep 'lsr r0, r0, #31'
+ 
+ define i32 @isnegative(i32 %X) {
+ entry:
+ icmp slt i32 %X, 0  ; i1:0 [#uses=1]
+ zext i1 %0 to i32   ; i32:1 [#uses=1]
+ ret i32 %1
+ }
+ 



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


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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.286 - 1.287
---
Log message:

Teach the codegen to turn [aez]ext (setcc) - selectcc of 1/0, which often
allows other simplifications.  For example, this compiles:
int isnegative(unsigned int X) {
   return !(X  2147483648U);
}

Into this code:

x86:
movl 4(%esp), %eax
shrl $31, %eax
ret
arm:
mov r0, r0, lsr #31
bx lr
thumb:
lsr r0, r0, #31
bx lr

instead of:

x86:
cmpl $0, 4(%esp)
sets %al
movzbl %al, %eax
ret

arm:
mov r3, #0
cmp r0, #0
movlt r3, #1
mov r0, r3
bx lr

thumb:
mov r2, #1
mov r1, #0
cmp r0, #0
blt LBB1_2  @entry
LBB1_1: @entry
cpy r2, r1
LBB1_2: @entry
cpy r0, r2
bx lr

Testcase here: test/CodeGen/Generic/ispositive.ll


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

 DAGCombiner.cpp |   29 +
 1 files changed, 29 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.286 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.287
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.286 Wed Apr 11 00:11:38 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Wed Apr 11 00:32:27 2007
@@ -2130,6 +2130,15 @@
 }
   }
   
+  // sext(setcc x,y,cc) - select_cc x, y, -1, 0, cc
+  if (N0.getOpcode() == ISD::SETCC) {
+SDOperand SCC = 
+SimplifySelectCC(N0.getOperand(0), N0.getOperand(1),
+ DAG.getConstant(~0ULL, VT), DAG.getConstant(0, VT),
+ castCondCodeSDNode(N0.getOperand(2))-get());
+if (SCC.Val) return SCC;
+  }
+  
   return SDOperand();
 }
 
@@ -2210,6 +2219,16 @@
   ExtLoad.getValue(1));
 return SDOperand(N, 0);   // Return N so it doesn't get rechecked!
   }
+  
+  // zext(setcc x,y,cc) - select_cc x, y, 1, 0, cc
+  if (N0.getOpcode() == ISD::SETCC) {
+SDOperand SCC = 
+  SimplifySelectCC(N0.getOperand(0), N0.getOperand(1),
+   DAG.getConstant(1, VT), DAG.getConstant(0, VT),
+   castCondCodeSDNode(N0.getOperand(2))-get());
+if (SCC.Val) return SCC;
+  }
+  
   return SDOperand();
 }
 
@@ -2294,6 +2313,16 @@
   ExtLoad.getValue(1));
 return SDOperand(N, 0);   // Return N so it doesn't get rechecked!
   }
+  
+  // aext(setcc x,y,cc) - select_cc x, y, 1, 0, cc
+  if (N0.getOpcode() == ISD::SETCC) {
+SDOperand SCC = 
+SimplifySelectCC(N0.getOperand(0), N0.getOperand(1),
+ DAG.getConstant(1, VT), DAG.getConstant(0, VT),
+ castCondCodeSDNode(N0.getOperand(2))-get());
+if (SCC.Val) return SCC;
+  }
+  
   return SDOperand();
 }
 



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


Changes in directory llvm/lib/Target/X86:

README.txt updated: 1.163 - 1.164
---
Log message:

done


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

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


Index: llvm/lib/Target/X86/README.txt
diff -u llvm/lib/Target/X86/README.txt:1.163 
llvm/lib/Target/X86/README.txt:1.164
--- llvm/lib/Target/X86/README.txt:1.163Tue Apr 10 16:14:01 2007
+++ llvm/lib/Target/X86/README.txt  Wed Apr 11 00:34:00 2007
@@ -1049,31 +1049,3 @@
 
 //===-===//
 
-Consider:
-
-int isnegative(unsigned int X) {
-   return !(X  2147483648U);
-}
-
-We current compile this to:
-
-define i32 @isnegative(i32 %X) {
-icmp slt i32 %X, 0  ; i1:0 [#uses=1]
-%retval = zext i1 %0 to i32 ; i32 [#uses=1]
-ret i32 %retval
-}
-
-and:
-
-_isnegative:
-cmpl $0, 4(%esp)
-sets %al
-movzbl %al, %eax
-ret
-
-We should produce:
-
-   movl4(%esp), %eax
-   shrl$31, %eax
-ret
-



___
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

2007-04-10 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.738 - 1.739
---
Log message:

fix a miscompilation of:
define i32 @test(i32 %X) {
entry:
%Y = and i32 %X, 4  ; i32 [#uses=1]
icmp eq i32 %Y, 0   ; i1:0 [#uses=1]
sext i1 %0 to i32   ; i32:1 [#uses=1]
ret i32 %1
}

by moving code out of commonIntCastTransforms into visitZExt.  Simplify the
APInt gymnastics in it etc.



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

 InstructionCombining.cpp |  122 ++-
 1 files changed, 59 insertions(+), 63 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.738 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.739
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.738   Mon Apr  9 
18:52:13 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Apr 11 00:45:39 2007
@@ -6457,69 +6457,6 @@
   }
 }
 break;
-
-  case Instruction::ICmp:
-// If we are just checking for a icmp eq of a single bit and casting it
-// to an integer, then shift the bit to the appropriate place and then
-// cast to integer to avoid the comparison.
-if (ConstantInt *Op1C = dyn_castConstantInt(Op1)) {
-  const APInt Op1CV = Op1C-getValue();
-  // cast (X == 0) to int -- X^1  iff X has only the low bit set.
-  // cast (X == 0) to int -- (X1)^1 iff X has only the 2nd bit set.
-  // cast (X == 1) to int -- Xiff X has only the low bit set.
-  // cast (X == 2) to int -- X1 iff X has only the 2nd bit set.
-  // cast (X != 0) to int -- Xiff X has only the low bit set.
-  // cast (X != 0) to int -- X1 iff X has only the 2nd bit set.
-  // cast (X != 1) to int -- X^1  iff X has only the low bit set.
-  // cast (X != 2) to int -- (X1)^1 iff X has only the 2nd bit set.
-  if (Op1CV == 0 || Op1CV.isPowerOf2()) {
-// If Op1C some other power of two, convert:
-uint32_t BitWidth = Op1C-getType()-getBitWidth();
-APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);
-APInt TypeMask(APInt::getAllOnesValue(BitWidth));
-ComputeMaskedBits(Op0, TypeMask, KnownZero, KnownOne);
-
-// This only works for EQ and NE
-ICmpInst::Predicate pred = castICmpInst(SrcI)-getPredicate();
-if (pred != ICmpInst::ICMP_NE  pred != ICmpInst::ICMP_EQ)
-  break;
-
-APInt KnownZeroMask(KnownZero ^ TypeMask);
-if (KnownZeroMask.isPowerOf2()) { // Exactly 1 possible 1?
-  bool isNE = pred == ICmpInst::ICMP_NE;
-  if (Op1CV != 0  (Op1CV != KnownZeroMask)) {
-// (X4) == 2 -- false
-// (X4) != 2 -- true
-Constant *Res = ConstantInt::get(Type::Int1Ty, isNE);
-Res = ConstantExpr::getZExt(Res, CI.getType());
-return ReplaceInstUsesWith(CI, Res);
-  }
-  
-  uint32_t ShiftAmt = KnownZeroMask.logBase2();
-  Value *In = Op0;
-  if (ShiftAmt) {
-// Perform a logical shr by shiftamt.
-// Insert the shift to put the result in the low bit.
-In = InsertNewInstBefore(
-  BinaryOperator::createLShr(In,
- ConstantInt::get(In-getType(), ShiftAmt),
- In-getName()+.lobit), CI);
-  }
-  
-  if ((Op1CV != 0) == isNE) { // Toggle the low bit.
-Constant *One = ConstantInt::get(In-getType(), 1);
-In = BinaryOperator::createXor(In, One, tmp);
-InsertNewInstBefore(castInstruction(In), CI);
-  }
-  
-  if (CI.getType() == In-getType())
-return ReplaceInstUsesWith(CI, In);
-  else
-return CastInst::createIntegerCast(In, CI.getType(), 
false/*ZExt*/);
-}
-  }
-}
-break;
   }
   return 0;
 }
@@ -6617,6 +6554,65 @@
 }
   }
 
+  if (ICmpInst *ICI = dyn_castICmpInst(Src)) {
+// If we are just checking for a icmp eq of a single bit and zext'ing it
+// to an integer, then shift the bit to the appropriate place and then
+// cast to integer to avoid the comparison.
+if (ConstantInt *Op1C = dyn_castConstantInt(ICI-getOperand(1))) {
+  const APInt Op1CV = Op1C-getValue();
+  // cast (X == 0) to int -- X^1  iff X has only the low bit set.
+  // cast (X == 0) to int -- (X1)^1 iff X has only the 2nd bit set.
+  // cast (X == 1) to int -- Xiff X has only the low bit set.
+  // cast (X == 2) to int -- X1 iff X has only the 2nd bit set.
+  // cast (X != 0) to int -- Xiff X has only the low bit set.
+  // cast (X != 0) to int -- X1 iff X has only the 2nd bit set.
+  // cast (X != 1) to int -- X^1  iff X has only the low bit set.
+  // cast (X != 2) to int --