[llvm-commits] CVS: llvm-www/RandomBoxes/001-C++Compiler.html

2007-01-19 Thread Reid Spencer


Changes in directory llvm-www/RandomBoxes:

001-C++Compiler.html updated: 1.4 - 1.5
---
Log message:

Update to mention GCC 4.0 not 3.4


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

 001-C++Compiler.html |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm-www/RandomBoxes/001-C++Compiler.html
diff -u llvm-www/RandomBoxes/001-C++Compiler.html:1.4 
llvm-www/RandomBoxes/001-C++Compiler.html:1.5
--- llvm-www/RandomBoxes/001-C++Compiler.html:1.4   Sat Jul 16 00:45:44 2005
+++ llvm-www/RandomBoxes/001-C++Compiler.html   Fri Jan 19 02:16:19 2007
@@ -1,4 +1,4 @@
-Did you know that LLVM has a GCC 3.4 compatible C++ front-end and a great 
+Did you know that LLVM has a GCC 4.0 compatible C++ front-end and a great 
 optimizer?  We find that LLVM is able to compile C++ into substantially better
 code than GCC (for example).  Also, because LLVM code can be converted to C,
 you can even use LLVM as a a 
href=http://lists.cs.uiuc.edu/pipermail/llvmdev/2004-June/001380.html;C++-to-C
 translator/a.



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


[llvm-commits] llvm-gcc4: implement FLOOR_MOD_EXPR and ROUND_DIV_EXPR

2007-01-19 Thread Duncan Sands
FLOOR_MOD_EXPR is generated by the Ada and Fortran front-ends.
ROUND_DIV_EXPR is only generated by the Ada front-end.

Tested by taking all possible combinations of 8 bit signed and unsigned
input operands, and checking that the results coincide with those produced
by mainline gcc.  I also checked by hand the output from taking all possible
3 bit inputs.  I also checked that results agree with mainline gcc for a
range of 32 bit inputs, including extreme large and small values.  I would
love to provide testcases, but this is not so easy.  For FLOOR_MOD_EXPR, my
testcases are written in Ada since there seems to be no way of getting any
of the C-like front-ends to produce FLOOR_MOD_EXPR.  It would be nice to have
an Ada language LLVM testsuite, but it's too early for that: the Ada front-end
only builds partially right now, and I had to do evil tricks to get working
programs out of the testcases.  The situation for ROUND_DIV_EXPR is even worse:
the Ada front-end only produces this expression in special circumstances, making
it hard to get decent coverage.  I ended up hacking the compiler to produce
ROUND_DIV_EXPR instead of TRUNC_DIV_EXPR (= normal integer division).  With
this change a testcase can be written in C.  But I somehow have the feeling
that you don't want testcases that require being built with a specially modified
compiler!

Index: gcc/llvm-convert.cpp
===
--- gcc/llvm-convert.cpp(revision 250)
+++ gcc/llvm-convert.cpp(working copy)
@@ -609,12 +609,18 @@
   case RDIV_EXPR:  
 Result = EmitBinOp(exp, DestLoc, Instruction::FDiv);
 break;
+  case ROUND_DIV_EXPR:
+Result = EmitROUND_DIV_EXPR(exp);
+break;
   case TRUNC_MOD_EXPR: 
 if (TYPE_UNSIGNED(TREE_TYPE(exp)))
   Result = EmitBinOp(exp, DestLoc, Instruction::URem);
 else
   Result = EmitBinOp(exp, DestLoc, Instruction::SRem);
 break;
+  case FLOOR_MOD_EXPR:
+Result = EmitFLOOR_MOD_EXPR(exp, DestLoc);
+break;
   case BIT_AND_EXPR:   Result = EmitBinOp(exp, DestLoc, 
Instruction::And);break;
   case BIT_IOR_EXPR:   Result = EmitBinOp(exp, DestLoc, Instruction::Or 
);break;
   case BIT_XOR_EXPR:   Result = EmitBinOp(exp, DestLoc, 
Instruction::Xor);break;
@@ -2590,6 +2607,143 @@
 TREE_CODE(exp) == MAX_EXPR ? max : min, CurBB);
 }
 
+Value *TreeToLLVM::EmitFLOOR_MOD_EXPR(tree exp, Value *DestLoc) {
+  // Notation: FLOOR_MOD_EXPR - Mod, TRUNC_MOD_EXPR - Rem.
+
+  // We express Mod in terms of Rem as follows: if RHS exactly divides LHS,
+  // or the values of LHS and RHS have the same sign, then Mod equals Rem.
+  // Otherwise Mod equals Rem + RHS.  This means that LHS Mod RHS traps iff
+  // LHS Rem RHS traps.
+
+  if (TYPE_UNSIGNED(TREE_TYPE(exp)))
+// LHS and RHS values must have the same sign if their type is unsigned.
+return EmitBinOp(exp, DestLoc, Instruction::URem);
+
+  const Type *Ty = ConvertType(TREE_TYPE(exp));
+  Constant *Zero = ConstantInt::get(Ty, 0);
+
+  Value *LHS = Emit(TREE_OPERAND(exp, 0), 0);
+  Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
+
+  // The two possible values for Mod.
+  Value *Rem = BinaryOperator::create(Instruction::SRem, LHS, RHS, rem,
+ CurBB);
+  Value *RemPlusRHS = BinaryOperator::create(Instruction::Add, Rem, RHS, tmp,
+CurBB);
+
+  // HaveSameSign: (LHS = 0) == (RHS = 0).
+  Value *LHSIsPositive = new ICmpInst(ICmpInst::ICMP_SGE, LHS, Zero, tmp,
+ CurBB);
+  Value *RHSIsPositive = new ICmpInst(ICmpInst::ICMP_SGE, RHS, Zero, tmp,
+ CurBB);
+  Value *HaveSameSign = new ICmpInst(ICmpInst::ICMP_EQ, LHSIsPositive,
+RHSIsPositive, tmp, CurBB);
+
+  // RHS exactly divides LHS iff Rem is zero.
+  Value *RemIsZero = new ICmpInst(ICmpInst::ICMP_EQ, Rem, Zero, tmp, CurBB);
+
+  Value *SameAsRem = BinaryOperator::create(Instruction::Or, HaveSameSign,
+   RemIsZero, tmp, CurBB);
+  return new SelectInst(SameAsRem, Rem, RemPlusRHS, mod, CurBB);
+}
+
+Value *TreeToLLVM::EmitROUND_DIV_EXPR(tree exp) {
+  // Notation: ROUND_DIV_EXPR - RDiv, TRUNC_DIV_EXPR - Div.
+
+  // RDiv calculates LHS/RHS by rounding to the nearest integer.  Ties
+  // are broken by rounding away from zero.  In terms of Div this means:
+  //   LHS RDiv RHS = (LHS + (RHS Div 2)) Div RHS
+  // if the values of LHS and RHS have the same sign; and
+  //   LHS RDiv RHS = (LHS - (RHS Div 2)) Div RHS
+  // if the values of LHS and RHS differ in sign.  The intermediate
+  // expressions in these formulae can overflow, so some tweaking is
+  // required to ensure correct results.  The details depend on whether
+  // we are doing signed or unsigned arithmetic.
+
+  const Type *Ty = ConvertType(TREE_TYPE(exp));
+  Constant *Zero = ConstantInt::get(Ty, 0);
+  Constant *Two = 

[llvm-commits] CVS: llvm/test/Integer/a1.ll a1.ll.out a15.ll a15.ll.out a17.ll a17.ll.out a31.ll a31.ll.out a33.ll a33.ll.out a63.ll a63.ll.out a7.ll a7.ll.out a9.ll a9.ll.out

2007-01-19 Thread Zhou Sheng


Changes in directory llvm/test/Integer:

a1.ll updated: 1.1 - 1.2
a1.ll.out updated: 1.1 - 1.2
a15.ll updated: 1.1 - 1.2
a15.ll.out updated: 1.1 - 1.2
a17.ll updated: 1.1 - 1.2
a17.ll.out updated: 1.1 - 1.2
a31.ll updated: 1.1 - 1.2
a31.ll.out updated: 1.1 - 1.2
a33.ll updated: 1.1 - 1.2
a33.ll.out updated: 1.1 - 1.2
a63.ll updated: 1.1 - 1.2
a63.ll.out updated: 1.1 - 1.2
a7.ll updated: 1.1 - 1.2
a7.ll.out updated: 1.1 - 1.2
a9.ll updated: 1.1 - 1.2
a9.ll.out updated: 1.1 - 1.2
---
Log message:

Cover more arithmetics for arbitrary bitwidth integers.


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

 a1.ll  |4 
 a1.ll.out  |4 
 a15.ll |5 +
 a15.ll.out |5 +
 a17.ll |4 
 a17.ll.out |4 
 a31.ll |4 
 a31.ll.out |4 
 a33.ll |4 
 a33.ll.out |4 
 a63.ll |5 +
 a63.ll.out |5 +
 a7.ll  |9 +
 a7.ll.out  |9 +
 a9.ll  |4 
 a9.ll.out  |4 
 16 files changed, 78 insertions(+)


Index: llvm/test/Integer/a1.ll
diff -u llvm/test/Integer/a1.ll:1.1 llvm/test/Integer/a1.ll:1.2
--- llvm/test/Integer/a1.ll:1.1 Thu Jan 18 19:35:08 2007
+++ llvm/test/Integer/a1.ll Fri Jan 19 08:23:46 2007
@@ -18,3 +18,7 @@
 %n = constant i1 mul(i1 -1, i1 1)
 %o = constant i1 sdiv(i1 -1, i1 1)
 %p = constant i1 sdiv(i1 1 , i1 -1)
+%q = constant i1 udiv(i1 -1, i1 1)
+%r = constant i1 udiv(i1 1, i1 -1)
+%s = constant i1 srem(i1 -1, i1 1)
+%t = constant i1 urem(i1 -1, i1 1)


Index: llvm/test/Integer/a1.ll.out
diff -u llvm/test/Integer/a1.ll.out:1.1 llvm/test/Integer/a1.ll.out:1.2
--- llvm/test/Integer/a1.ll.out:1.1 Thu Jan 18 19:35:08 2007
+++ llvm/test/Integer/a1.ll.out Fri Jan 19 08:23:46 2007
@@ -12,5 +12,9 @@
 %n = constant i1 true  ; i1* [#uses=0]
 %o = constant i1 true  ; i1* [#uses=0]
 %p = constant i1 true  ; i1* [#uses=0]
+%q = constant i1 true  ; i1* [#uses=0]
+%r = constant i1 true  ; i1* [#uses=0]
+%s = constant i1 false ; i1* [#uses=0]
+%t = constant i1 false ; i1* [#uses=0]
 
 implementation   ; Functions:


Index: llvm/test/Integer/a15.ll
diff -u llvm/test/Integer/a15.ll:1.1 llvm/test/Integer/a15.ll:1.2
--- llvm/test/Integer/a15.ll:1.1Tue Jan 16 12:08:22 2007
+++ llvm/test/Integer/a15.llFri Jan 19 08:23:46 2007
@@ -18,6 +18,11 @@
 %m = constant i15 ashr(i15 32767 , i8 15)
 
 %n = constant i15 mul(i15 32767, i15 2)
+%q = constant i15 mul(i15 -16383,i15 -3)
+%r = constant i15 sdiv(i15 -1,   i15 16383)
+%s = constant i15 udiv(i15 -1,   i15 16383)
+%t = constant i15 srem(i15 1,i15 32766)
+%u = constant i15 urem(i15 32767,i15 -1)
 %o = constant i15 trunc( i16 32768  to i15 )
 %p = constant i15 trunc( i16 32767  to i15 )
  


Index: llvm/test/Integer/a15.ll.out
diff -u llvm/test/Integer/a15.ll.out:1.1 llvm/test/Integer/a15.ll.out:1.2
--- llvm/test/Integer/a15.ll.out:1.1Tue Jan 16 12:08:22 2007
+++ llvm/test/Integer/a15.ll.outFri Jan 19 08:23:46 2007
@@ -12,6 +12,11 @@
 %l = constant i15 -1   ; i15* [#uses=0]
 %m = constant i15 -1   ; i15* [#uses=0]
 %n = constant i15 -2   ; i15* [#uses=0]
+%q = constant i15 16381; i15* [#uses=0]
+%r = constant i15 0; i15* [#uses=0]
+%s = constant i15 2; i15* [#uses=0]
+%t = constant i15 1; i15* [#uses=0]
+%u = constant i15 0; i15* [#uses=0]
 %o = constant i15 0; i15* [#uses=0]
 %p = constant i15 -1   ; i15* [#uses=0]
 


Index: llvm/test/Integer/a17.ll
diff -u llvm/test/Integer/a17.ll:1.1 llvm/test/Integer/a17.ll:1.2
--- llvm/test/Integer/a17.ll:1.1Tue Jan 16 12:08:22 2007
+++ llvm/test/Integer/a17.llFri Jan 19 08:23:46 2007
@@ -18,5 +18,9 @@
 %m = constant i17 ashr(i17 131071 , i8 17)
 
 %n = constant i17 mul(i17 131071, i17 2) 
+%q = constant i17 sdiv(i17 -1,i17 65535)
+%r = constant i17 udiv(i17 -1,i17 65535)
+%s = constant i17 srem(i17  1,i17 131070)
+%t = constant i17 urem(i17 131071,i17 -1)
 %o = constant i17 trunc( i18 131072  to i17 )
 %p = constant i17 trunc( i18 131071  to i17 )


Index: llvm/test/Integer/a17.ll.out
diff -u llvm/test/Integer/a17.ll.out:1.1 llvm/test/Integer/a17.ll.out:1.2
--- llvm/test/Integer/a17.ll.out:1.1Tue Jan 16 12:08:22 2007
+++ llvm/test/Integer/a17.ll.outFri Jan 19 08:23:46 2007
@@ -12,6 +12,10 @@
 %l = constant i17 -1   ; i17* [#uses=0]
 %m = constant i17 -1   ; i17* [#uses=0]
 %n = constant i17 -2   ; i17* [#uses=0]
+%q = constant i17 0; i17* [#uses=0]
+%r = constant i17 2; i17* [#uses=0]
+%s = constant i17 1; i17* [#uses=0]
+%t = constant i17 0; i17* [#uses=0]
 %o = constant i17 0; i17* [#uses=0]
 %p = constant i17 -1   ; i17* [#uses=0]
 


Index: llvm/test/Integer/a31.ll
diff -u llvm/test/Integer/a31.ll:1.1 llvm/test/Integer/a31.ll:1.2
--- llvm/test/Integer/a31.ll:1.1Tue Jan 16 

[llvm-commits] CVS: llvm/test/Integer/testarith_bt.ll

2007-01-19 Thread Zhou Sheng


Changes in directory llvm/test/Integer:

testarith_bt.ll updated: 1.1 - 1.2
---
Log message:

Cover more arithmetics for arbitrary bitwidth integers.


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

 testarith_bt.ll |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/test/Integer/testarith_bt.ll
diff -u llvm/test/Integer/testarith_bt.ll:1.1 
llvm/test/Integer/testarith_bt.ll:1.2
--- llvm/test/Integer/testarith_bt.ll:1.1   Tue Jan 16 12:08:22 2007
+++ llvm/test/Integer/testarith_bt.ll   Fri Jan 19 08:26:57 2007
@@ -13,6 +13,9 @@
 %t5 = sdiv i31 %t1, %t2
 %t6 = urem i31 %t1, %t2
 %t7 = srem i31 %t1, %t2
+%t8 = shl  i31 %t1, i8 9
+%t9 = lshr i31 %t1, i8 9
+%t10= ashr i31 %t1, i8 9
 %f1 = sitofp i31 %t1 to float
 %f2 = fdiv float 4.0, %f1
ret i31 %t3



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


[llvm-commits] CVS: llvm/test/Integer/fold-fpcast_bt.ll undefined_bt.ll

2007-01-19 Thread Zhou Sheng


Changes in directory llvm/test/Integer:

fold-fpcast_bt.ll updated: 1.1 - 1.2
undefined_bt.ll updated: 1.1 - 1.2
---
Log message:

Cover non-byte-width BATs situation.


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

 fold-fpcast_bt.ll |   15 +++
 undefined_bt.ll   |   12 ++--
 2 files changed, 21 insertions(+), 6 deletions(-)


Index: llvm/test/Integer/fold-fpcast_bt.ll
diff -u llvm/test/Integer/fold-fpcast_bt.ll:1.1 
llvm/test/Integer/fold-fpcast_bt.ll:1.2
--- llvm/test/Integer/fold-fpcast_bt.ll:1.1 Tue Jan 16 12:08:22 2007
+++ llvm/test/Integer/fold-fpcast_bt.ll Fri Jan 19 08:30:59 2007
@@ -16,3 +16,18 @@
   ret double bitcast (i64 42 to double)
 }
 
+define i30 %test5() {
+  ret i30 fptoui(float 3.7 to i30)
+}
+
+define float %test6() {
+  ret float uitofp(i30 17 to float)
+}
+
+define i6 %test7() {
+  ret i6 bitcast (double 3.1415926 to i6)
+}
+
+define double %test8() {
+  ret double bitcast (i9 42 to double)
+}


Index: llvm/test/Integer/undefined_bt.ll
diff -u llvm/test/Integer/undefined_bt.ll:1.1 
llvm/test/Integer/undefined_bt.ll:1.2
--- llvm/test/Integer/undefined_bt.ll:1.1   Tue Jan 16 12:08:22 2007
+++ llvm/test/Integer/undefined_bt.ll   Fri Jan 19 08:30:59 2007
@@ -3,17 +3,17 @@
 ; RUN: diff %t1.ll %t2.ll
 
 
-%X = global i32 undef
+%X = global i31 undef
 
 implementation
 
 declare i32 atoi(i8 *)
 
-define i32 %test() {
-   ret i32 undef
+define i63 %test() {
+   ret i63 undef
 }
 
-define i32 %test2() {
-   %X = add i32 undef, 1
-   ret i32 %X
+define i31 %test2() {
+   %X = add i31 undef, 1
+   ret i31 %X
 }



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.200 - 1.201
---
Log message:

icmp doesn't support comparison of packed types.


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

 LangRef.html |5 +
 1 files changed, 1 insertion(+), 4 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.200 llvm/docs/LangRef.html:1.201
--- llvm/docs/LangRef.html:1.200Mon Jan 15 12:28:34 2007
+++ llvm/docs/LangRef.html  Fri Jan 19 11:11:12 2007
@@ -3185,9 +3185,6 @@
 /ol
 pIf the operands are a href=#t_pointerpointer/a typed, the pointer
 values are treated as integers and then compared./p
-pIf the operands are a href=#t_packedpacked/a typed, the elements of 
-the vector are compared in turn and the predicate must hold for all
-elements./p
 
 h5Example:/h5
 pre  lt;resultgt; = icmp eq i32 4, 5  i; yields: result=false/i
@@ -4487,7 +4484,7 @@
 
   a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
   a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2007/01/15 18:28:34 $
+  Last modified: $Date: 2007/01/19 17:11:12 $
 /address
 /body
 /html



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


[llvm-commits] CVS: llvm/autoconf/configure.ac

2007-01-19 Thread Anton Korobeynikov


Changes in directory llvm/autoconf:

configure.ac updated: 1.259 - 1.260
---
Log message:

Adding disassembler interface and external hook to udis86 library.


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

 configure.ac |   23 +--
 1 files changed, 21 insertions(+), 2 deletions(-)


Index: llvm/autoconf/configure.ac
diff -u llvm/autoconf/configure.ac:1.259 llvm/autoconf/configure.ac:1.260
--- llvm/autoconf/configure.ac:1.259Tue Jan 16 20:14:46 2007
+++ llvm/autoconf/configure.ac  Fri Jan 19 11:25:17 2007
@@ -35,8 +35,8 @@
 
 dnl Provide a copyright substitution and ensure the copyright notice is 
included
 dnl in the output of --version option of the generated configure script.
-AC_SUBST(LLVM_COPYRIGHT,[Copyright (c) 2003-2005 University of Illinois at 
Urbana-Champaign.])
-AC_COPYRIGHT([Copyright (c) 2003-2005 University of Illinois at 
Urbana-Champaign.])
+AC_SUBST(LLVM_COPYRIGHT,[Copyright (c) 2003-2007 University of Illinois at 
Urbana-Champaign.])
+AC_COPYRIGHT([Copyright (c) 2003-2007 University of Illinois at 
Urbana-Champaign.])
 
 dnl Indicate that we require autoconf 2.59 or later. Ths is needed because we
 dnl use some autoconf macros only available in 2.59.
@@ -629,6 +629,25 @@
[Have pthread_mutex_lock]))
 fi
 
+dnl Allow extra x86-disassembler library
+AC_ARG_WITH(udis86,
+  AS_HELP_STRING([--with-udis86=path],
+[Use udis86 external x86 disassembler library]),
+[
+  AC_SUBST(USE_UDIS86, [1])
+  case $withval in
+/usr/lib) ;;
+*) LDFLAGS=$LDFLAGS -L${withval} ;;
+  esac
+  AC_CHECK_LIB(udis86, ud_init, [], [
+echo Error! You need to have libudis86 around.
+exit -1
+  ])
+],
+AC_SUBST(USE_UDIS86, [0]))
+AC_DEFINE_UNQUOTED([USE_UDIS86],$USE_UDIS86,
+   [Define if use udis86 library])
+
 
dnl===---===
 dnl===
 dnl=== SECTION 6: Check for header files



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


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

2007-01-19 Thread Anton Korobeynikov


Changes in directory llvm/lib/Support:

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

Adding disassembler interface and external hook to udis86 library.


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

 Disassembler.cpp |   53 +
 1 files changed, 53 insertions(+)


Index: llvm/lib/Support/Disassembler.cpp
diff -c /dev/null llvm/lib/Support/Disassembler.cpp:1.1
*** /dev/null   Fri Jan 19 11:25:27 2007
--- llvm/lib/Support/Disassembler.cpp   Fri Jan 19 11:25:17 2007
***
*** 0 
--- 1,53 
+ //===- lib/Support/Disassembler.cpp -*- C++ 
-*-===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Anton Korobeynikov and is distributed under the
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ 
//===--===//
+ //
+ // This file implements the necessary glue to call external disassembler
+ // libraries.
+ //
+ 
//===--===//
+ 
+ #include llvm/Config/config.h
+ #include llvm/Support/Disassembler.h
+ 
+ #include cassert
+ #include iomanip
+ #include string
+ #include sstream
+ 
+ #if USE_UDIS86
+ #include udis86.h
+ #endif
+ 
+ using namespace llvm;
+ 
+ std::string llvm::disassembleBuffer(uint8_t* start, size_t length,
+   Disassembler::Type type, uint64_t pc) {
+   std::stringstream res;
+   
+   if (type == Disassembler::X86_32 || type == Disassembler::X86_64) {
+ #if USE_UDIS86
+ ud_t ud_obj;
+
+ ud_init(ud_obj);
+ ud_set_input_buffer(ud_obj, start, length);
+ ud_set_mode(ud_obj, (type == Disassembler::X86_32 ? 32 : 64));
+ ud_set_pc(ud_obj, pc);
+ ud_set_syntax(ud_obj, UD_SYN_ATT);
+ 
+ res  std::setbase(16)
+  std::setw((type == Disassembler::X86_32 ? 8 : 16));
+ 
+ while (ud_disassemble(ud_obj)) {
+   res  ud_insn_off(ud_obj)  :\t  ud_insn_asm(ud_obj)  \n;
+ }
+ #endif
+   }
+ 
+   return res.str();
+ }



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


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

2007-01-19 Thread Anton Korobeynikov


Changes in directory llvm/include/llvm/Support:

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

Adding disassembler interface and external hook to udis86 library.


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

 Disassembler.h |   36 
 1 files changed, 36 insertions(+)


Index: llvm/include/llvm/Support/Disassembler.h
diff -c /dev/null llvm/include/llvm/Support/Disassembler.h:1.1
*** /dev/null   Fri Jan 19 11:25:27 2007
--- llvm/include/llvm/Support/Disassembler.hFri Jan 19 11:25:17 2007
***
*** 0 
--- 1,36 
+ //===- llvm/Support/Disassembler.h --*- C++ 
-*-===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Anton Korobeynikov and is distributed under the
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ 
//===--===//
+ //
+ // This file implements the necessary glue to call external disassembler
+ // libraries.
+ //
+ 
//===--===//
+ 
+ #ifndef LLVM_SUPPORT_DISASSEMBLER_H
+ #define LLVM_SUPPORT_DISASSEMBLER_H
+ 
+ #include llvm/Support/DataTypes.h
+ #include string
+ 
+ namespace llvm {
+ 
+ namespace Disassembler {
+   enum Type {
+ X86_32,
+ X86_64,
+ Undefined
+   };
+ }
+   
+ 
+ std::string disassembleBuffer(uint8_t* start, size_t length,
+   Disassembler::Type type, uint64_t pc);
+ }
+ 
+ #endif // LLVM_SUPPORT_DISASSEMBLER_H



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


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

2007-01-19 Thread Anton Korobeynikov


Changes in directory llvm/lib/ExecutionEngine/JIT:

JITEmitter.cpp updated: 1.124 - 1.125
---
Log message:

Adding disassembler interface and external hook to udis86 library.


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

 JITEmitter.cpp |   15 ++-
 1 files changed, 14 insertions(+), 1 deletion(-)


Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.124 
llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.125
--- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.124   Tue Dec 19 16:43:32 2006
+++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Fri Jan 19 11:25:17 2007
@@ -27,6 +27,7 @@
 #include llvm/Target/TargetJITInfo.h
 #include llvm/Target/TargetMachine.h
 #include llvm/Support/Debug.h
+#include llvm/Support/Disassembler.h
 #include llvm/Support/MutexGuard.h
 #include llvm/ADT/Statistic.h
 #include llvm/System/Memory.h
@@ -847,7 +848,7 @@
   }
 
   // Update the GOT entry for F to point to the new code.
-  if(MemMgr.isManagingGOT()) {
+  if (MemMgr.isManagingGOT()) {
 unsigned idx = getJITResolver(this).getGOTIndexForAddr((void*)BufferBegin);
 if (((void**)MemMgr.getGOTBase())[idx] != (void*)BufferBegin) {
   DOUT  GOT was out of date for   (void*)BufferBegin
@@ -864,6 +865,18 @@
 :   (FnEnd-FnStart)   bytes of text, 
 Relocations.size()   relocations\n;
   Relocations.clear();
+
+  DOUT  Disassembled code:\n
+#if defined(__i386__)
+disassembleBuffer(FnStart, FnEnd-FnStart,
+Disassembler::X86_32, (uint32_t)FnStart);
+#elif defined(__amd64__) || defined(__x86_64__)
+disassembleBuffer(FnStart, FnEnd-FnStart,
+Disassembler::X86_64, (uint32_t)FnStart);
+#else
+N/A\n;
+#endif
+  
   return false;
 }
 



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


[llvm-commits] CVS: llvm/include/llvm/Config/config.h.in

2007-01-19 Thread Anton Korobeynikov


Changes in directory llvm/include/llvm/Config:

config.h.in updated: 1.73 - 1.74
---
Log message:

Adding disassembler interface and external hook to udis86 library.


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

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


Index: llvm/include/llvm/Config/config.h.in
diff -u llvm/include/llvm/Config/config.h.in:1.73 
llvm/include/llvm/Config/config.h.in:1.74
--- llvm/include/llvm/Config/config.h.in:1.73   Sun Dec 17 22:11:16 2006
+++ llvm/include/llvm/Config/config.h.inFri Jan 19 11:25:17 2007
@@ -190,6 +190,9 @@
 /* Define to 1 if you have the `pthread' library (-lpthread). */
 #undef HAVE_LIBPTHREAD
 
+/* Define to 1 if you have the `udis86' library (-ludis86). */
+#undef HAVE_LIBUDIS86
+
 /* Define to 1 if you have the limits.h header file. */
 #undef HAVE_LIMITS_H
 
@@ -526,6 +529,9 @@
 /* Define to 1 if your sys/time.h declares `struct tm'. */
 #undef TM_IN_SYS_TIME
 
+/* Define if use udis86 library */
+#undef USE_UDIS86
+
 /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
 #undef YYTEXT_POINTER



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


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

2007-01-19 Thread Lauro Ramos Venancio


Changes in directory llvm/lib/Target/ARM:

ARMAsmPrinter.cpp updated: 1.43 - 1.44
---
Log message:

Fix section definition.


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

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


Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp
diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.43 
llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.44
--- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.43  Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp   Fri Jan 19 11:33:22 2007
@@ -753,7 +753,7 @@
  \t.weak_definition   name  \n;
   SwitchToDataSection(\t.section __DATA,__const_coal,coalesced, I);
 } else {
-  O  \t.section\t.llvm.linkonce.d.  name  ,\aw\,@progbits\n
+  O  \t.section\t.llvm.linkonce.d.  name  ,\aw\,%progbits\n
  \t.weak   name  \n;
 }
 break;
@@ -774,7 +774,7 @@
  I-getSection() == .dtors)) {
   assert(!Subtarget-isDarwin());
   std::string SectionName = .section  + I-getSection();
-  SectionName += ,\aw\,@progbits;
+  SectionName += ,\aw\,%progbits;
   SwitchToDataSection(SectionName.c_str());
 } else {
   SwitchToDataSection(TAI-getDataSection(), I);



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


[llvm-commits] CVS: llvm/configure

2007-01-19 Thread Reid Spencer


Changes in directory llvm:

configure updated: 1.264 - 1.265
---
Log message:

Add the check for udis86 to support disassembly.

Regenerated for Anton Korobeynikov.


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

 configure |  173 +++---
 1 files changed, 145 insertions(+), 28 deletions(-)


Index: llvm/configure
diff -u llvm/configure:1.264 llvm/configure:1.265
--- llvm/configure:1.264Tue Jan 16 20:14:46 2007
+++ llvm/configure  Fri Jan 19 11:41:47 2007
@@ -9,7 +9,7 @@
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 #
-# Copyright (c) 2003-2005 University of Illinois at Urbana-Champaign.
+# Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign.
 ## - ##
 ## M4sh Initialization.  ##
 ## - ##
@@ -897,6 +897,7 @@
 ETAGSFLAGS
 LLVMGCC
 LLVMGXX
+USE_UDIS86
 HAVE_PTHREAD
 HUGE_VAL_SANITY
 ALLOCA
@@ -1554,6 +1555,7 @@
   --with-pic  try to use only PIC/non-PIC objects [default=use
   both]
   --with-tags[=TAGS]  include additional configurations [automatic]
+  --with-udis86=pathUse udis86 external x86 disassembler library
 
 Some influential environment variables:
   CC  C compiler command
@@ -1646,7 +1648,7 @@
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 
-Copyright (c) 2003-2005 University of Illinois at Urbana-Champaign.
+Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign.
 _ACEOF
   exit
 fi
@@ -2008,7 +2010,7 @@
 
 
 
-LLVM_COPYRIGHT=Copyright (c) 2003-2005 University of Illinois at 
Urbana-Champaign.
+LLVM_COPYRIGHT=Copyright (c) 2003-2007 University of Illinois at 
Urbana-Champaign.
 
 
 
@@ -10327,7 +10329,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext EOF
-#line 10330 configure
+#line 10332 configure
 #include confdefs.h
 
 #if HAVE_DLFCN_H
@@ -12471,7 +12473,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 12474 configure'  conftest.$ac_ext
+  echo '#line 12476 configure'  conftest.$ac_ext
   if { (eval echo $as_me:$LINENO: \$ac_compile\) 5
   (eval $ac_compile) 25
   ac_status=$?
@@ -14189,11 +14191,11 @@
-e 's:.*FLAGS}\{0,1\} :$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag:; t' \
-e 's:$: $lt_compiler_flag:'`
-   (eval echo \\$as_me:14192: $lt_compile\ 5)
+   (eval echo \\$as_me:14194: $lt_compile\ 5)
(eval $lt_compile 2conftest.err)
ac_status=$?
cat conftest.err 5
-   echo $as_me:14196: \$? = $ac_status 5
+   echo $as_me:14198: \$? = $ac_status 5
if (exit $ac_status)  test -s $ac_outfile; then
  # The compiler can only warn and ignore the option if not recognized
  # So say no if there are warnings other than the usual output.
@@ -14457,11 +14459,11 @@
-e 's:.*FLAGS}\{0,1\} :$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag:; t' \
-e 's:$: $lt_compiler_flag:'`
-   (eval echo \\$as_me:14460: $lt_compile\ 5)
+   (eval echo \\$as_me:14462: $lt_compile\ 5)
(eval $lt_compile 2conftest.err)
ac_status=$?
cat conftest.err 5
-   echo $as_me:14464: \$? = $ac_status 5
+   echo $as_me:14466: \$? = $ac_status 5
if (exit $ac_status)  test -s $ac_outfile; then
  # The compiler can only warn and ignore the option if not recognized
  # So say no if there are warnings other than the usual output.
@@ -14561,11 +14563,11 @@
-e 's:.*FLAGS}\{0,1\} :$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag:; t' \
-e 's:$: $lt_compiler_flag:'`
-   (eval echo \\$as_me:14564: $lt_compile\ 5)
+   (eval echo \\$as_me:14566: $lt_compile\ 5)
(eval $lt_compile 2out/conftest.err)
ac_status=$?
cat out/conftest.err 5
-   echo $as_me:14568: \$? = $ac_status 5
+   echo $as_me:14570: \$? = $ac_status 5
if (exit $ac_status)  test -s out/conftest2.$ac_objext
then
  # The compiler can only warn and ignore the option if not recognized
@@ -17013,7 +17015,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext EOF
-#line 17016 configure
+#line 17018 configure
 #include confdefs.h
 
 #if HAVE_DLFCN_H
@@ -17113,7 +17115,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext EOF
-#line 17116 configure
+#line 17118 configure
 #include confdefs.h
 
 #if HAVE_DLFCN_H
@@ -19481,11 +19483,11 @@
-e 's:.*FLAGS}\{0,1\} :$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag:; t' \
-e 's:$: $lt_compiler_flag:'`
-   (eval echo \\$as_me:19484: $lt_compile\ 5)
+   (eval echo \\$as_me:19486: $lt_compile\ 5)
(eval $lt_compile 2conftest.err)
ac_status=$?
cat conftest.err 5
-   echo $as_me:19488: \$? = 

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

2007-01-19 Thread Reid Spencer
On Fri, 2007-01-19 at 11:25 -0600, Anton Korobeynikov wrote:
 
 Changes in directory llvm/lib/ExecutionEngine/JIT:
 
 JITEmitter.cpp updated: 1.124 - 1.125
 ---
 Log message:
 
 Adding disassembler interface and external hook to udis86 library.

Some notes below.

 
 
 ---
 Diffs of the changes:  (+14 -1)
 
  JITEmitter.cpp |   15 ++-
  1 files changed, 14 insertions(+), 1 deletion(-)
 
 
 Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
 diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.124 
 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.125
 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.124 Tue Dec 19 16:43:32 2006
 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp   Fri Jan 19 11:25:17 2007
 @@ -27,6 +27,7 @@
  #include llvm/Target/TargetJITInfo.h
  #include llvm/Target/TargetMachine.h
  #include llvm/Support/Debug.h
 +#include llvm/Support/Disassembler.h
  #include llvm/Support/MutexGuard.h
  #include llvm/ADT/Statistic.h
  #include llvm/System/Memory.h
 @@ -847,7 +848,7 @@
}
  
// Update the GOT entry for F to point to the new code.
 -  if(MemMgr.isManagingGOT()) {
 +  if (MemMgr.isManagingGOT()) {
  unsigned idx = 
 getJITResolver(this).getGOTIndexForAddr((void*)BufferBegin);
  if (((void**)MemMgr.getGOTBase())[idx] != (void*)BufferBegin) {
DOUT  GOT was out of date for   (void*)BufferBegin
 @@ -864,6 +865,18 @@
  :   (FnEnd-FnStart)   bytes of text, 
  Relocations.size()   relocations\n;
Relocations.clear();
 +
 +  DOUT  Disassembled code:\n
 +#if defined(__i386__)
 +disassembleBuffer(FnStart, FnEnd-FnStart,
 +Disassembler::X86_32, (uint32_t)FnStart);

I'm not thrilled about having this system specific
#if/#elif/#else/#endif in the JITEmitter. I would prefer to see the
disassemblBuffer function become part of lib/System instead of
lib/Support and DTRT for any combination of supported platforms. The
list of disassembled architectures will grow over time (PPC/ARM/Sparc)
and I'd rather not have this sprinkled across the users of
disassembleBuffer but in one location in lib/System.

 +#elif defined(__amd64__) || defined(__x86_64__)
 +disassembleBuffer(FnStart, FnEnd-FnStart,
 +Disassembler::X86_64, (uint32_t)FnStart);
 +#else
 +N/A\n;

That's not very descriptive message. How about architecture not
supported.

 +#endif
 +  
return false;
  }
  
 
 
 
 ___
 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/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2007-01-19 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.267 - 1.268
---
Log message:

Remove this xform:
(shl (add x, c1), c2) - (add (shl x, c2), c1c2)
Replace it with:
(add (shl (add x, c1), c2), ) - (add (add (shl x, c2), c1c2), )

This fixes test/CodeGen/ARM/smul.ll

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

 DAGCombiner.cpp |   33 ++---
 1 files changed, 26 insertions(+), 7 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.267 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.268
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.267 Mon Jan 15 23:59:59 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Fri Jan 19 11:51:44 2007
@@ -653,6 +653,22 @@
   return Result;
 }
 
+static
+SDOperand combineShlAddConstant(SDOperand N0, SDOperand N1, SelectionDAG DAG) 
{
+  MVT::ValueType VT = N0.getValueType();
+  SDOperand N00 = N0.getOperand(0);
+  SDOperand N01 = N0.getOperand(1);
+  ConstantSDNode *N01C = dyn_castConstantSDNode(N01);
+  if (N01C  N00.getOpcode() == ISD::ADD  N00.Val-hasOneUse() 
+  isaConstantSDNode(N00.getOperand(1))) {
+N0 = DAG.getNode(ISD::ADD, VT,
+ DAG.getNode(ISD::SHL, VT, N00.getOperand(0), N01),
+ DAG.getNode(ISD::SHL, VT, N00.getOperand(1), N01));
+return DAG.getNode(ISD::ADD, VT, N0, N1);
+  }
+  return SDOperand();
+}
+
 SDOperand DAGCombiner::visitADD(SDNode *N) {
   SDOperand N0 = N-getOperand(0);
   SDOperand N1 = N-getOperand(1);
@@ -711,6 +727,16 @@
 }
   }
 
+  // fold (add (shl (add x, c1), c2), ) - (add (add (shl x, c2), c1c2), )
+  if (N0.getOpcode() == ISD::SHL  N0.Val-hasOneUse()) {
+SDOperand Result = combineShlAddConstant(N0, N1, DAG);
+if (Result.Val) return Result;
+  }
+  if (N1.getOpcode() == ISD::SHL  N1.Val-hasOneUse()) {
+SDOperand Result = combineShlAddConstant(N1, N0, DAG);
+if (Result.Val) return Result;
+  }
+
   return SDOperand();
 }
 
@@ -1615,13 +1641,6 @@
   if (N1C  N0.getOpcode() == ISD::SRA  N1 == N0.getOperand(1))
 return DAG.getNode(ISD::AND, VT, N0.getOperand(0),
DAG.getConstant(~0ULL  N1C-getValue(), VT));
-  // fold (shl (add x, c1), c2) - (add (shl x, c2), c1c2)
-  if (N1C  N0.getOpcode() == ISD::ADD  N0.Val-hasOneUse()  
-  isaConstantSDNode(N0.getOperand(1))) {
-return DAG.getNode(ISD::ADD, VT, 
-   DAG.getNode(ISD::SHL, VT, N0.getOperand(0), N1),
-   DAG.getNode(ISD::SHL, VT, N0.getOperand(1), N1));
-  }
   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/ARM/ARMTargetAsmInfo.cpp

2007-01-19 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

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

Modify emission of jump tables on darwin to emit an extra l label that
delimits the boundaries of jump tables.  This lets the linker's dead code
stripping optimization do a better job.

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

 ARMTargetAsmInfo.cpp |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp
diff -u llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:1.4 
llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:1.5
--- llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:1.4Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMTargetAsmInfo.cppFri Jan 19 12:59:56 2007
@@ -33,6 +33,13 @@
 LCOMMDirective = \t.lcomm\t;
 COMMDirectiveTakesAlignment = false;
 
+// In non-PIC modes, emit a special label before jump tables so that the
+// linker can perform more accurate dead code stripping.
+if (TM.getRelocationModel() != Reloc::PIC_) {
+  // Emit a local label that is preserved until the linker runs.
+  JumpTableSpecialLabelPrefix = l;
+}
+
 NeedsSet = true;
 DwarfAbbrevSection = .section __DWARF,__debug_abbrev,regular,debug;
 DwarfInfoSection = .section __DWARF,__debug_info,regular,debug;



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


[llvm-commits] CVS: llvm/lib/Target/ARM/ARMSubtarget.h ARMSubtarget.cpp

2007-01-19 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMSubtarget.h updated: 1.1 - 1.2
ARMSubtarget.cpp updated: 1.1 - 1.2
---
Log message:

Introduce TargetType's ELF and Darwin.

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

 ARMSubtarget.cpp |   15 ++-
 ARMSubtarget.h   |   10 +++---
 2 files changed, 17 insertions(+), 8 deletions(-)


Index: llvm/lib/Target/ARM/ARMSubtarget.h
diff -u llvm/lib/Target/ARM/ARMSubtarget.h:1.1 
llvm/lib/Target/ARM/ARMSubtarget.h:1.2
--- llvm/lib/Target/ARM/ARMSubtarget.h:1.1  Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMSubtarget.h  Fri Jan 19 13:22:40 2007
@@ -37,8 +37,6 @@
   /// IsThumb - True if we are in thumb mode, false if in ARM mode.
   bool IsThumb;
 
-  bool IsDarwin;
-  
   /// UseThumbBacktraces - True if we use thumb style backtraces.
   bool UseThumbBacktraces;
 
@@ -50,6 +48,10 @@
   unsigned stackAlignment;
 
  public:
+  enum {
+isELF, isDarwin
+  } TargetType;
+
   /// This constructor initializes the data members to match that
   /// of the specified module.
   ///
@@ -66,7 +68,9 @@
 
   bool hasVFP2() const { return HasVFP2; }
   
-  bool isDarwin() const { return IsDarwin; }
+  bool isTargetDarwin() const { return TargetType == isDarwin; }
+  bool isTargetELF() const { return TargetType == isELF; }
+
   bool isThumb() const { return IsThumb; }
 
   bool useThumbBacktraces() const { return UseThumbBacktraces; }


Index: llvm/lib/Target/ARM/ARMSubtarget.cpp
diff -u llvm/lib/Target/ARM/ARMSubtarget.cpp:1.1 
llvm/lib/Target/ARM/ARMSubtarget.cpp:1.2
--- llvm/lib/Target/ARM/ARMSubtarget.cpp:1.1Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMSubtarget.cppFri Jan 19 13:22:40 2007
@@ -22,8 +22,12 @@
cl::desc(Switch to thumb mode in ARM backend));
 
 ARMSubtarget::ARMSubtarget(const Module M, const std::string FS)
-  : ARMArchVersion(V4T), HasVFP2(false), IsDarwin(false),
-UseThumbBacktraces(false), IsR9Reserved(false), stackAlignment(8) {
+  : ARMArchVersion(V4T)
+  , HasVFP2(false)
+  , UseThumbBacktraces(false)
+  , IsR9Reserved(false)
+  , stackAlignment(8)
+  , TargetType(isELF) { // Default to ELF unless otherwise specified.
 
   // Determine default and user specified characteristics
   std::string CPU = generic;
@@ -37,14 +41,15 @@
   // if one cannot be determined, to true.
   const std::string TT = M.getTargetTriple();
   if (TT.length()  5) {
-IsDarwin = TT.find(-darwin) != std::string::npos;
+if (TT.find(-darwin) != std::string::npos)
+  TargetType = isDarwin;
   } else if (TT.empty()) {
 #if defined(__APPLE__)
-IsDarwin = true;
+TargetType = isDarwin;
 #endif
   }
 
-  if (IsDarwin) {
+  if (isTargetDarwin()) {
 UseThumbBacktraces = true;
 IsR9Reserved = true;
 stackAlignment = 4;



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


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

2007-01-19 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

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

Darwin doesn't support .bss, but it does have .zerofill

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

 ARMTargetAsmInfo.cpp |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp
diff -u llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:1.5 
llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:1.6
--- llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:1.5Fri Jan 19 12:59:56 2007
+++ llvm/lib/Target/ARM/ARMTargetAsmInfo.cppFri Jan 19 13:23:47 2007
@@ -17,21 +17,23 @@
 
 ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine TM) {
   const ARMSubtarget *Subtarget = TM.getSubtargetARMSubtarget();
-  if (Subtarget-isDarwin()) {
-HasDotTypeDotSizeDirective = false;
-PrivateGlobalPrefix = L;
+  if (Subtarget-isTargetDarwin()) {
 GlobalPrefix = _;
 ZeroDirective = \t.space\t;
+PrivateGlobalPrefix = L;
+BSSSection = 0;   // no BSS section.
+ZeroFillDirective = \t.zerofill\t;  // Uses .zerofill
 SetDirective = \t.set;
 WeakRefDirective = \t.weak_reference\t;
 JumpTableDataSection = .const;
 CStringSection = \t.cstring;
+LCOMMDirective = \t.lcomm\t;
+COMMDirectiveTakesAlignment = false;
+HasDotTypeDotSizeDirective = false;
 StaticCtorsSection = .mod_init_func;
 StaticDtorsSection = .mod_term_func;
 InlineAsmStart = @ InlineAsm Start;
 InlineAsmEnd = @ InlineAsm End;
-LCOMMDirective = \t.lcomm\t;
-COMMDirectiveTakesAlignment = false;
 
 // In non-PIC modes, emit a special label before jump tables so that the
 // linker can perform more accurate dead code stripping.



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


[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp ARMRegisterInfo.cpp ARMTargetMachine.cpp

2007-01-19 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMISelLowering.cpp updated: 1.1 - 1.2
ARMRegisterInfo.cpp updated: 1.34 - 1.35
ARMTargetMachine.cpp updated: 1.14 - 1.15
---
Log message:

isDarwin - isTargetDarwin

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

 ARMISelLowering.cpp  |8 
 ARMRegisterInfo.cpp  |6 +++---
 ARMTargetMachine.cpp |2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/lib/Target/ARM/ARMISelLowering.cpp
diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.1 
llvm/lib/Target/ARM/ARMISelLowering.cpp:1.2
--- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.1 Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMISelLowering.cpp Fri Jan 19 13:28:01 2007
@@ -146,7 +146,7 @@
   setOperationAction(ISD::LOCATION, MVT::Other, Expand);
   setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand);
   // FIXME - use subtarget debug flags
-  if (Subtarget-isDarwin())
+  if (Subtarget-isTargetDarwin())
 setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand);
 
   setOperationAction(ISD::RET,   MVT::Other, Custom);
@@ -470,7 +470,7 @@
 isDirect = true;
 bool isExt = (GV-isExternal() || GV-hasWeakLinkage() ||
   GV-hasLinkOnceLinkage());
-bool isStub = (isExt  Subtarget-isDarwin()) 
+bool isStub = (isExt  Subtarget-isTargetDarwin()) 
getTargetMachine().getRelocationModel() != Reloc::Static;
 isARMFunc = !Subtarget-isThumb() || isStub;
 // Wrap it since tBX takes a register source operand.
@@ -479,7 +479,7 @@
   } else if (ExternalSymbolSDNode *S = dyn_castExternalSymbolSDNode(Callee)) 
{
 Callee = DAG.getTargetExternalSymbol(S-getSymbol(), getPointerTy());
 isDirect = true;
-bool isStub = Subtarget-isDarwin() 
+bool isStub = Subtarget-isTargetDarwin() 
   getTargetMachine().getRelocationModel() != Reloc::Static;
 isARMFunc = !Subtarget-isThumb() || isStub;
 // Wrap it since tBX takes a register source operand.
@@ -641,7 +641,7 @@
   MVT::ValueType PtrVT = getPointerTy();
   GlobalValue *GV = castGlobalAddressSDNode(Op)-getGlobal();
   Reloc::Model RelocM = getTargetMachine().getRelocationModel();
-  bool IsIndirect = Subtarget-isDarwin()  GVIsIndirectSymbol(GV);
+  bool IsIndirect = Subtarget-isTargetDarwin()  GVIsIndirectSymbol(GV);
   SDOperand CPAddr;
   if (RelocM == Reloc::Static)
 CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 2);


Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.34 
llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.35
--- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.34Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Fri Jan 19 13:28:01 2007
@@ -256,7 +256,7 @@
 ARM::D11, ARM::D10, ARM::D9,  ARM::D8,
 0
   };
-  return STI.isDarwin() ? DarwinCalleeSavedRegs : CalleeSavedRegs;
+  return STI.isTargetDarwin() ? DarwinCalleeSavedRegs : CalleeSavedRegs;
 }
 
 const TargetRegisterClass* const *
@@ -807,7 +807,7 @@
   case ARM::R9:
   case ARM::R10:
   case ARM::R11:
-Category = STI.isDarwin() ? 2 : 1;
+Category = STI.isTargetDarwin() ? 2 : 1;
 break;
   case ARM::D8:
   case ARM::D9:
@@ -870,7 +870,7 @@
   case ARM::R11:
 if (Reg == FramePtr)
   FramePtrSpillFI = FI;
-if (STI.isDarwin()) {
+if (STI.isTargetDarwin()) {
   AFI-addGPRCalleeSavedArea2Frame(FI);
   GPRCS2Size += 4;
 } else {


Index: llvm/lib/Target/ARM/ARMTargetMachine.cpp
diff -u llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.14 
llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.15
--- llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.14   Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMTargetMachine.cppFri Jan 19 13:28:01 2007
@@ -35,7 +35,7 @@
 ARMTargetMachine::ARMTargetMachine(const Module M, const std::string FS)
   : Subtarget(M, FS), DataLayout(e-p:32:32-d:32), InstrInfo(Subtarget),
 FrameInfo(Subtarget) {
-  if (Subtarget.isDarwin())
+  if (Subtarget.isTargetDarwin())
 NoFramePointerElim = true;
 }
 



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


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

2007-01-19 Thread Andrew Lenharth


Changes in directory llvm/lib/ExecutionEngine/JIT:

JITEmitter.cpp updated: 1.125 - 1.126
---
Log message:

fix build on amd64

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

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


Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.125 
llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.126
--- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.125   Fri Jan 19 11:25:17 2007
+++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Fri Jan 19 14:17:59 2007
@@ -872,7 +872,7 @@
 Disassembler::X86_32, (uint32_t)FnStart);
 #elif defined(__amd64__) || defined(__x86_64__)
 disassembleBuffer(FnStart, FnEnd-FnStart,
-Disassembler::X86_64, (uint32_t)FnStart);
+Disassembler::X86_64, (uint64_t)FnStart);
 #else
 N/A\n;
 #endif



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


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

2007-01-19 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMInstrInfo.td updated: 1.84 - 1.85
---
Log message:

Code clean up. Use def : pat instead of defining new instructions.

---
Diffs of the changes:  (+87 -127)

 ARMInstrInfo.td |  214 ++--
 1 files changed, 87 insertions(+), 127 deletions(-)


Index: llvm/lib/Target/ARM/ARMInstrInfo.td
diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.84 
llvm/lib/Target/ARM/ARMInstrInfo.td:1.85
--- llvm/lib/Target/ARM/ARMInstrInfo.td:1.84Fri Jan 19 01:51:42 2007
+++ llvm/lib/Target/ARM/ARMInstrInfo.td Fri Jan 19 14:27:35 2007
@@ -320,11 +320,13 @@
 class ARMPatdag pattern, dag result : Patpattern, result {
   listPredicate Predicates = [IsARM];
 }
+class ARMV5TEPatdag pattern, dag result : Patpattern, result {
+  listPredicate Predicates = [IsARM, HasV5TE];
+}
 class ARMV6Patdag pattern, dag result : Patpattern, result {
   listPredicate Predicates = [IsARM, HasV6];
 }
 
-
 class InstARMbits4 opcod, AddrMode am, SizeFlagVal sz, IndexMode im,
   dag ops, string asmstr, string cstr
   : Instruction {
@@ -870,72 +872,31 @@
Requires[IsARM, HasV6];
 
 multiclass AI_smulstring opc, PatFrag opnode {
-  def BB1 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, bb $dst, $a, $b),
-   [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
-   (sext_inreg GPR:$b, i16)))],
-Requires[IsARM, HasV5TE];
-  def BB2 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, bb $dst, $a, $b),
-   [(set GPR:$dst, (opnode (sra (shl GPR:$a, 16), 16),
-   (sra (shl GPR:$b, 16), 16)))],
-Requires[IsARM, HasV5TE];
-  def BB3 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, bb $dst, $a, $b),
-   [(set GPR:$dst, (opnode sext_16_node:$a, sext_16_node:$b))],
-Requires[IsARM, HasV5TE];
-
-  def BT1 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, bt $dst, $a, $b),
-   [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
-   (sra GPR:$b, 16)))],
-Requires[IsARM, HasV5TE];
-  def BT2 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, bt $dst, $a, $b),
-   [(set GPR:$dst, (opnode (sra (shl GPR:$a, 16), 16),
-   (sra GPR:$b, 16)))],
-Requires[IsARM, HasV5TE];
-  def BT3 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, bt $dst, $a, $b),
-   [(set GPR:$dst, (opnode sext_16_node:$a, (sra GPR:$b, 16)))],
-Requires[IsARM, HasV5TE];
-
-  def TB1 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, tb $dst, $a, $b),
-   [(set GPR:$dst, (opnode (sra GPR:$a, 16),
-   (sext_inreg GPR:$b, i16)))],
-Requires[IsARM, HasV5TE];
-  def TB2 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, tb $dst, $a, $b),
-   [(set GPR:$dst, (opnode (sra GPR:$a, 16),
-   (sra (shl GPR:$b, 16), 16)))],
-Requires[IsARM, HasV5TE];
-  def TB3 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, tb $dst, $a, $b),
-   [(set GPR:$dst, (opnode (sra GPR:$a, 16), sext_16_node:$b))],
-Requires[IsARM, HasV5TE];
-
+  def BB : AI(ops GPR:$dst, GPR:$a, GPR:$b),
+  !strconcat(opc, bb $dst, $a, $b),
+  [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
+  (sext_inreg GPR:$b, i16)))],
+   Requires[IsARM, HasV5TE];
+  def BT : AI(ops GPR:$dst, GPR:$a, GPR:$b),
+  !strconcat(opc, bt $dst, $a, $b),
+  [(set GPR:$dst, (opnode (sext_inreg GPR:$a, i16),
+  (sra GPR:$b, 16)))],
+   Requires[IsARM, HasV5TE];
+  def TB : AI(ops GPR:$dst, GPR:$a, GPR:$b),
+  !strconcat(opc, tb $dst, $a, $b),
+  [(set GPR:$dst, (opnode (sra GPR:$a, 16),
+  (sext_inreg GPR:$b, i16)))],
+   Requires[IsARM, HasV5TE];
   def TT : AI(ops GPR:$dst, GPR:$a, GPR:$b),
   !strconcat(opc, tt $dst, $a, $b),
   [(set GPR:$dst, (opnode (sra GPR:$a, 16),
   (sra GPR:$b, 16)))],
 Requires[IsARM, HasV5TE];
-
-  def WB1 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, wb $dst, $a, $b),
-   [(set GPR:$dst, (sra (opnode GPR:$a,
- (sext_inreg GPR:$b, i16)), 16))],
-Requires[IsARM, HasV5TE];
-  def WB2 : AI(ops GPR:$dst, GPR:$a, GPR:$b),
-   !strconcat(opc, wb $dst, $a, $b),
-   [(set GPR:$dst, (sra (opnode GPR:$a,
- (sra (shl GPR:$b, 16), 16)), 16))],
-

[llvm-commits] CVS: llvm/test/CFrontend/bit-accurate-int.c

2007-01-19 Thread Reid Spencer


Changes in directory llvm/test/CFrontend:

bit-accurate-int.c updated: 1.1 - 1.2
---
Log message:

Make this test actually test what its supposed to test.


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

 bit-accurate-int.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/test/CFrontend/bit-accurate-int.c
diff -u llvm/test/CFrontend/bit-accurate-int.c:1.1 
llvm/test/CFrontend/bit-accurate-int.c:1.2
--- llvm/test/CFrontend/bit-accurate-int.c:1.1  Tue Jan 16 12:40:08 2007
+++ llvm/test/CFrontend/bit-accurate-int.c  Fri Jan 19 15:06:38 2007
@@ -1,4 +1,5 @@
-// RUN: %llvmgcc -S %s -o - /dev/null
+// RUN: %llvmgcc -S %s -o - /dev/null 21  /dev/null | \
+// RUN:   not grep warning
 // XFAIL: *
 
 #define ATTR_BITS(N) __attribute__((bitwidth(N))) 



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/AsmParser:

Lexer.cpp.cvs updated: 1.26 - 1.27
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



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

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


Index: llvm/lib/AsmParser/Lexer.cpp.cvs
diff -u llvm/lib/AsmParser/Lexer.cpp.cvs:1.26 
llvm/lib/AsmParser/Lexer.cpp.cvs:1.27
--- llvm/lib/AsmParser/Lexer.cpp.cvs:1.26   Fri Jan 12 23:00:46 2007
+++ llvm/lib/AsmParser/Lexer.cpp.cvsFri Jan 19 15:13:56 2007
@@ -20,7 +20,7 @@
 /* A lexical scanner generated by flex*/
 
 /* Scanner skeleton version:
- * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.26 2007/01/13 
05:00:46 reid Exp $
+ * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.27 2007/01/19 
21:13:56 reid Exp $
  */
 
 #define FLEX_SCANNER



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/IPO:

IndMemRemoval.cpp updated: 1.10 - 1.11
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



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

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


Index: llvm/lib/Transforms/IPO/IndMemRemoval.cpp
diff -u llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.10 
llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.11
--- llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.10  Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/IPO/IndMemRemoval.cpp   Fri Jan 19 15:13:56 2007
@@ -21,6 +21,7 @@
 #include llvm/Module.h
 #include llvm/Instructions.h
 #include llvm/Type.h
+#include llvm/DerivedTypes.h
 #include llvm/ADT/Statistic.h
 using namespace llvm;
 



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Utils:

SimplifyCFG.cpp updated: 1.113 - 1.114
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



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

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


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.113 
llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.114
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.113 Sun Jan 14 20:27:26 2007
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp   Fri Jan 19 15:13:56 2007
@@ -16,6 +16,7 @@
 #include llvm/Constants.h
 #include llvm/Instructions.h
 #include llvm/Type.h
+#include llvm/DerivedTypes.h
 #include llvm/Support/CFG.h
 #include llvm/Support/Debug.h
 #include llvm/Transforms/Utils/BasicBlockUtils.h



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine:

ExecutionEngine.cpp updated: 1.100 - 1.101
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



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

 ExecutionEngine.cpp |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)


Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.100 
llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.101
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.100  Thu Jan 18 12:01:32 2007
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cppFri Jan 19 15:13:56 2007
@@ -456,9 +456,7 @@
 switch (Ty-getTypeID()) {
 case Type::IntegerTyID: {
   unsigned BitWidth = castIntegerType(Ty)-getBitWidth();
-  uint64_t BitMask = (1ull  BitWidth) - 1;
-  if (BitWidth = 64)
-BitMask = (uint64_t)-1;
+  uint64_t BitMask = castIntegerType(Ty)-getBitMask();
   GenericValue TmpVal = Val;
   if (BitWidth = 8)
 Ptr-Untyped[0] = Val.Int8Val  BitMask;
@@ -514,9 +512,7 @@
 switch (Ty-getTypeID()) {
 case Type::IntegerTyID: {
   unsigned BitWidth = castIntegerType(Ty)-getBitWidth();
-  uint64_t BitMask = (1ull  BitWidth) - 1;
-  if (BitWidth = 64)
-BitMask = (uint64_t)-1;
+  uint64_t BitMask = castIntegerType(Ty)-getBitMask();
   GenericValue TmpVal = Val;
   if (BitWidth = 8)
 Ptr-Untyped[0] = Val.Int8Val  BitMask;



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/Target/Alpha:

AlphaISelDAGToDAG.cpp updated: 1.65 - 1.66
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



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

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


Index: llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
diff -u llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.65 
llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.66
--- llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.65Sat Dec 30 23:55:36 2006
+++ llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Fri Jan 19 15:13:56 2007
@@ -23,6 +23,7 @@
 #include llvm/CodeGen/SelectionDAGISel.h
 #include llvm/Target/TargetOptions.h
 #include llvm/Constants.h
+#include llvm/DerivedTypes.h
 #include llvm/GlobalValue.h
 #include llvm/Intrinsics.h
 #include llvm/Support/Debug.h



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/Analysis:

ConstantRange.cpp updated: 1.32 - 1.33
ScalarEvolution.cpp updated: 1.89 - 1.90
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



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

 ConstantRange.cpp   |1 +
 ScalarEvolution.cpp |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.32 
llvm/lib/Analysis/ConstantRange.cpp:1.33
--- llvm/lib/Analysis/ConstantRange.cpp:1.32Sun Jan 14 20:27:26 2007
+++ llvm/lib/Analysis/ConstantRange.cpp Fri Jan 19 15:13:56 2007
@@ -26,6 +26,7 @@
 #include llvm/Instruction.h
 #include llvm/Instructions.h
 #include llvm/Type.h
+#include llvm/DerivedTypes.h
 #include llvm/Support/Streams.h
 #include ostream
 using namespace llvm;


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.89 
llvm/lib/Analysis/ScalarEvolution.cpp:1.90
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.89  Mon Jan 15 14:27:18 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Fri Jan 19 15:13:56 2007
@@ -1333,7 +1333,7 @@
 
   if (SCEVTruncateExpr *T = dyn_castSCEVTruncateExpr(S))
 return GetConstantFactor(T-getOperand()) 
-   T-getType()-getIntegerTypeMask();
+   castIntegerType(T-getType())-getBitMask();
   if (SCEVZeroExtendExpr *E = dyn_castSCEVZeroExtendExpr(S))
 return GetConstantFactor(E-getOperand());
   



___
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 DerivedTypes.h Type.h

2007-01-19 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.119 - 1.120
DerivedTypes.h updated: 1.80 - 1.81
Type.h updated: 1.101 - 1.102
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



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

 Constants.h|   13 ++---
 DerivedTypes.h |7 +++
 Type.h |   20 +++-
 3 files changed, 20 insertions(+), 20 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.119 llvm/include/llvm/Constants.h:1.120
--- llvm/include/llvm/Constants.h:1.119 Fri Jan 12 17:39:50 2007
+++ llvm/include/llvm/Constants.h   Fri Jan 19 15:13:56 2007
@@ -60,7 +60,7 @@
   /// sign extended as appropriate for the type of this constant.
   /// @brief Return the sign extended value.
   inline int64_t getSExtValue() const {
-unsigned Size = getType()-getPrimitiveSizeInBits();
+unsigned Size = Value::getType()-getPrimitiveSizeInBits();
 return (int64_t(Val)  (64-Size))  (64-Size);
   }
   /// A helper method that can be used to determine if the constant contained 
@@ -92,6 +92,13 @@
   /// @brief Get a ConstantInt for a specific value.
   static ConstantInt *get(const Type *Ty, int64_t V);
 
+  /// getType - Specialize the getType() method to always return an 
IntegerType,
+  /// which reduces the amount of casting needed in parts of the compiler.
+  ///
+  inline const IntegerType *getType() const {
+return reinterpret_castconst IntegerType*(Value::getType());
+  }
+
   /// This static method returns true if the type Ty is big enough to 
   /// represent the value V. This can be used to avoid having the get method 
   /// assert when V is larger than Ty can represent. Note that there are two
@@ -130,7 +137,7 @@
   int64_t V = getSExtValue();
   if (V  0) return false;// Be careful about wrap-around on 'long's
   ++V;
-  return !isValueValidForType(getType(), V) || V  0;
+  return !isValueValidForType(Value::getType(), V) || V  0;
 }
 return isAllOnesValue();
   }
@@ -145,7 +152,7 @@
   int64_t V = getSExtValue();
   if (V  0) return false;// Be careful about wrap-around on 'long's
   --V;
-  return !isValueValidForType(getType(), V) || V  0;
+  return !isValueValidForType(Value::getType(), V) || V  0;
 }
 return getZExtValue() == 0;
   }


Index: llvm/include/llvm/DerivedTypes.h
diff -u llvm/include/llvm/DerivedTypes.h:1.80 
llvm/include/llvm/DerivedTypes.h:1.81
--- llvm/include/llvm/DerivedTypes.h:1.80   Wed Jan 17 20:59:54 2007
+++ llvm/include/llvm/DerivedTypes.hFri Jan 19 15:13:56 2007
@@ -101,6 +101,13 @@
   /// @brief Get the number of bits in this IntegerType
   unsigned getBitWidth() const { return getSubclassData(); }
 
+  /// getBitMask - Return a bitmask with ones set for all of the bits
+  /// that can be set by an unsigned version of this type.  This is 0xFF for
+  /// sbyte/ubyte, 0x for shorts, etc.
+  uint64_t getBitMask() const {
+return ~uint64_t(0UL)  (64-getPrimitiveSizeInBits());
+  }
+
   /// This method determines if the width of this IntegerType is a power-of-2
   /// in terms of 8 bit bytes. 
   /// @returns true if this is a power-of-2 byte width.


Index: llvm/include/llvm/Type.h
diff -u llvm/include/llvm/Type.h:1.101 llvm/include/llvm/Type.h:1.102
--- llvm/include/llvm/Type.h:1.101  Tue Jan 16 19:49:59 2007
+++ llvm/include/llvm/Type.hFri Jan 19 15:13:56 2007
@@ -24,6 +24,7 @@
 
 class DerivedType;
 class PointerType;
+class IntegerType;
 class TypeMapBase;
 
 /// This file contains the declaration of the Type class.  For more Type type
@@ -217,14 +218,6 @@
   ///
   unsigned getPrimitiveSizeInBits() const;
 
-  /// getIntegerTypeMask - Return a bitmask with ones set for all of the bits
-  /// that can be set by an unsigned version of this type.  This is 0xFF for
-  /// sbyte/ubyte, 0x for shorts, etc.
-  uint64_t getIntegerTypeMask() const {
-assert(isInteger()  This only works for integer types!);
-return ~uint64_t(0UL)  (64-getPrimitiveSizeInBits());
-  }
-
   /// getForwaredType - Return the type that this type has been resolved to if
   /// it has been resolved to anything.  This is used to implement the
   /// union-find algorithm for type resolution, and shouldn't be used by 
general
@@ -237,14 +230,7 @@
   /// getVAArgsPromotedType - Return the type an argument of this type
   /// will be promoted to if passed through a variable argument
   /// function.
-  const Type *getVAArgsPromotedType() const {
-if (ID == IntegerTyID  getSubclassData()  32)
-  return Type::Int32Ty;
-else if (ID == FloatTyID)
-  return 

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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.455 - 1.456
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



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

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


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.455 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.456
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.455 Thu Jan 11 20:11:51 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Fri Jan 19 15:13:56 2007
@@ -21,6 +21,7 @@
 #include llvm/Target/TargetOptions.h
 #include llvm/CallingConv.h
 #include llvm/Constants.h
+#include llvm/DerivedTypes.h
 #include llvm/Support/MathExtras.h
 #include llvm/Support/CommandLine.h
 #include llvm/Support/Compiler.h



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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

CorrelatedExprs.cpp updated: 1.49 - 1.50
InstructionCombining.cpp updated: 1.603 - 1.604
LoopUnswitch.cpp updated: 1.57 - 1.58
ScalarReplAggregates.cpp updated: 1.66 - 1.67
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



---
Diffs of the changes:  (+42 -40)

 CorrelatedExprs.cpp  |1 
 InstructionCombining.cpp |   76 +++
 LoopUnswitch.cpp |3 +
 ScalarReplAggregates.cpp |2 -
 4 files changed, 42 insertions(+), 40 deletions(-)


Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp
diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.49 
llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.50
--- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.49 Sun Jan 14 20:27:26 2007
+++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp  Fri Jan 19 15:13:56 2007
@@ -33,6 +33,7 @@
 #include llvm/Function.h
 #include llvm/Instructions.h
 #include llvm/Type.h
+#include llvm/DerivedTypes.h
 #include llvm/Analysis/Dominators.h
 #include llvm/Assembly/Writer.h
 #include llvm/Transforms/Utils/Local.h


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.603 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.604
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.603   Thu Jan 18 
16:16:33 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Jan 19 15:13:56 2007
@@ -558,7 +558,7 @@
   Instruction *I = dyn_castInstruction(V);
   if (!I) return;
 
-  Mask = V-getType()-getIntegerTypeMask();
+  Mask = castIntegerType(V-getType())-getBitMask();
   
   switch (I-getOpcode()) {
   case Instruction::And:
@@ -632,11 +632,11 @@
   }
   case Instruction::ZExt:  {
 // Compute the bits in the result that are not present in the input.
-const Type *SrcTy = I-getOperand(0)-getType();
-uint64_t NotIn = ~SrcTy-getIntegerTypeMask();
-uint64_t NewBits = I-getType()-getIntegerTypeMask()  NotIn;
+const IntegerType *SrcTy = castIntegerType(I-getOperand(0)-getType());
+uint64_t NotIn = ~SrcTy-getBitMask();
+uint64_t NewBits = castIntegerType(I-getType())-getBitMask()  NotIn;
   
-Mask = SrcTy-getIntegerTypeMask();
+Mask = SrcTy-getBitMask();
 ComputeMaskedBits(I-getOperand(0), Mask, KnownZero, KnownOne, Depth+1);
 assert((KnownZero  KnownOne) == 0  Bits known to be one AND zero?); 
 // The top bits are known to be zero.
@@ -645,11 +645,11 @@
   }
   case Instruction::SExt: {
 // Compute the bits in the result that are not present in the input.
-const Type *SrcTy = I-getOperand(0)-getType();
-uint64_t NotIn = ~SrcTy-getIntegerTypeMask();
-uint64_t NewBits = I-getType()-getIntegerTypeMask()  NotIn;
+const IntegerType *SrcTy = castIntegerType(I-getOperand(0)-getType());
+uint64_t NotIn = ~SrcTy-getBitMask();
+uint64_t NewBits = castIntegerType(I-getType())-getBitMask()  NotIn;
   
-Mask = SrcTy-getIntegerTypeMask();
+Mask = SrcTy-getBitMask();
 ComputeMaskedBits(I-getOperand(0), Mask, KnownZero, KnownOne, Depth+1);
 assert((KnownZero  KnownOne) == 0  Bits known to be one AND zero?); 
 
@@ -766,7 +766,7 @@
uint64_t KnownZero,
uint64_t KnownOne,
int64_t Min, int64_t Max) 
{
-  uint64_t TypeBits = Ty-getIntegerTypeMask();
+  uint64_t TypeBits = castIntegerType(Ty)-getBitMask();
   uint64_t UnknownBits = ~(KnownZero|KnownOne)  TypeBits;
 
   uint64_t SignBit = 1ULL  (Ty-getPrimitiveSizeInBits()-1);
@@ -796,7 +796,7 @@
  uint64_t KnownOne,
  uint64_t Min,
  uint64_t Max) {
-  uint64_t TypeBits = Ty-getIntegerTypeMask();
+  uint64_t TypeBits = castIntegerType(Ty)-getBitMask();
   uint64_t UnknownBits = ~(KnownZero|KnownOne)  TypeBits;
   
   // The minimum value is when the unknown bits are all zeros.
@@ -831,7 +831,7 @@
 }
 // If this is the root being simplified, allow it to have multiple uses,
 // just set the DemandedMask to all bits.
-DemandedMask = V-getType()-getIntegerTypeMask();
+DemandedMask = castIntegerType(V-getType())-getBitMask();
   } else if (DemandedMask == 0) {   // Not demanding any bits from V.
 if (V != UndefValue::get(V-getType()))
   return UpdateValueUsesWith(V, UndefValue::get(V-getType()));
@@ -843,7 +843,7 @@
   Instruction *I = 

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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.132 - 1.133
Constants.cpp updated: 1.201 - 1.202
Type.cpp updated: 1.163 - 1.164
ValueTypes.cpp updated: 1.10 - 1.11
---
Log message:

For PR1043: http://llvm.org/PR1043 :
This is the final patch for this PR. It implements some minor cleanup 
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask - IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120: http://llvm.org/PR1120 .

Patch by Sheng Zhou.



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

 ConstantFolding.cpp |7 +--
 Constants.cpp   |4 ++--
 Type.cpp|   11 ++-
 ValueTypes.cpp  |1 +
 4 files changed, 14 insertions(+), 9 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.132 
llvm/lib/VMCore/ConstantFolding.cpp:1.133
--- llvm/lib/VMCore/ConstantFolding.cpp:1.132   Sun Jan 14 20:27:26 2007
+++ llvm/lib/VMCore/ConstantFolding.cpp Fri Jan 19 15:13:56 2007
@@ -295,13 +295,8 @@
 // Handle ConstantFP input.
 if (const ConstantFP *FP = dyn_castConstantFP(V)) {
   // FP - Integral.
-  if (DestTy-isInteger()) {
-if (DestTy == Type::Int32Ty)
-  return ConstantInt::get(DestTy, FloatToBits(FP-getValue()));
-assert(DestTy == Type::Int64Ty  
-   Incorrect integer type for bitcast!);
+  if (DestTy-isInteger())
 return ConstantInt::get(DestTy, DoubleToBits(FP-getValue()));
-  }
 }
 return 0;
   default:


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.201 llvm/lib/VMCore/Constants.cpp:1.202
--- llvm/lib/VMCore/Constants.cpp:1.201 Sun Jan 14 20:27:26 2007
+++ llvm/lib/VMCore/Constants.cpp   Fri Jan 19 15:13:56 2007
@@ -568,7 +568,7 @@
   unsigned NumBits = castIntegerType(Ty)-getBitWidth(); // assert okay
   assert(NumBits = 64  Not implemented: integers  64-bits);
   if (Ty == Type::Int1Ty)
-return Val == 0 || Val == 1;
+return Val == 0 || Val == 1 || Val == -1;
   if (NumBits == 64)
 return true; // always true, has to fit in largest type
   int64_t Min = -(1ll  (NumBits-1));
@@ -849,7 +849,7 @@
   return getTrue();
 else
   return getFalse();
-  return IntConstants-getOrCreate(Ty, V  Ty-getIntegerTypeMask());
+  return IntConstants-getOrCreate(Ty, V  
castIntegerType(Ty)-getBitMask());
 }
 
 // ConstantFP::get() implementation...


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.163 llvm/lib/VMCore/Type.cpp:1.164
--- llvm/lib/VMCore/Type.cpp:1.163  Thu Jan 18 12:14:49 2007
+++ llvm/lib/VMCore/Type.cppFri Jan 19 15:13:56 2007
@@ -81,6 +81,15 @@
   }
 }
 
+const Type *Type::getVAArgsPromotedType() const {
+  if (ID == IntegerTyID  getSubclassData()  32)
+return Type::Int32Ty;
+  else if (ID == FloatTyID)
+return Type::DoubleTy;
+  else
+return this;
+}
+
 /// isFPOrFPVector - Return true if this is a FP type or a vector of FP types.
 ///
 bool Type::isFPOrFPVector() const {
@@ -352,7 +361,7 @@
 };   \
   }  \
   static ManagedStaticTY##Type The##TY##Ty;\
-  const Type *Type::TY##Ty = *The##TY##Ty
+  const IntegerType *Type::TY##Ty = *The##TY##Ty
 
 DeclarePrimType(Void,   void);
 DeclarePrimType(Float,  float);


Index: llvm/lib/VMCore/ValueTypes.cpp
diff -u llvm/lib/VMCore/ValueTypes.cpp:1.10 llvm/lib/VMCore/ValueTypes.cpp:1.11
--- llvm/lib/VMCore/ValueTypes.cpp:1.10 Thu Jan 11 12:21:29 2007
+++ llvm/lib/VMCore/ValueTypes.cpp  Fri Jan 19 15:13:56 2007
@@ -13,6 +13,7 @@
 
 #include llvm/CodeGen/ValueTypes.h
 #include llvm/Type.h
+#include llvm/DerivedTypes.h
 using namespace llvm;
 
 /// MVT::getValueTypeString - This function returns value type as a string,



___
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-01-19 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.604 - 1.605
---
Log message:

For this transform: store V, (cast P) - store (cast V), P
don't allow the transform if V and the pointer's element type are different
width integer types.



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

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


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.604 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.605
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.604   Fri Jan 19 
15:13:56 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Jan 19 15:20:31 2007
@@ -8162,7 +8162,7 @@
   return 0;
 }
 
-/// InstCombineStoreToCast - Fold 'store V, (cast P)' - store (cast V), P'
+/// InstCombineStoreToCast - Fold store V, (cast P) - store (cast V), P
 /// when possible.
 static Instruction *InstCombineStoreToCast(InstCombiner IC, StoreInst SI) {
   User *CI = castUser(SI.getOperand(1));
@@ -8206,8 +8206,9 @@
   if (isaPointerType(SIOp0-getType()))
 opcode = Instruction::PtrToInt;
   else if (const IntegerType* SITy = dyn_castIntegerType(CastSrcTy))
-assert(DITy-getBitWidth() == SITy-getBitWidth() 
-   Illegal store instruction);
+if (SITy-getBitWidth() != DITy-getBitWidth())
+  return 0; // Don't do this transform on unequal bit widths.
+// else, BitCast is fine
 }
 if (Constant *C = dyn_castConstant(SIOp0))
   NewCast = ConstantExpr::getCast(opcode, C, CastDstTy);



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

Type.cpp updated: 1.164 - 1.165
---
Log message:

Remove dead methods in the ValTypes.


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

 Type.cpp |   31 ---
 1 files changed, 31 deletions(-)


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.164 llvm/lib/VMCore/Type.cpp:1.165
--- llvm/lib/VMCore/Type.cpp:1.164  Fri Jan 19 15:13:56 2007
+++ llvm/lib/VMCore/Type.cppFri Jan 19 15:25:12 2007
@@ -1013,13 +1013,6 @@
 return FT-getNumParams()*64+FT-getNumAttrs()*2+FT-isVarArg();
   }
 
-  // Subclass should override this... to update self as usual
-  void doRefinement(const DerivedType *OldType, const Type *NewType) {
-if (RetTy == OldType) RetTy = NewType;
-for (unsigned i = 0, e = ArgTypes.size(); i != e; ++i)
-  if (ArgTypes[i] == OldType) ArgTypes[i] = NewType;
-  }
-
   inline bool operator(const FunctionValType MTV) const {
 if (RetTy  MTV.RetTy) return true;
 if (RetTy  MTV.RetTy) return false;
@@ -1114,12 +1107,6 @@
 return (unsigned)AT-getNumElements();
   }
 
-  // Subclass should override this... to update self as usual
-  void doRefinement(const DerivedType *OldType, const Type *NewType) {
-assert(ValTy == OldType);
-ValTy = NewType;
-  }
-
   inline bool operator(const ArrayValType MTV) const {
 if (Size  MTV.Size) return true;
 return Size == MTV.Size  ValTy  MTV.ValTy;
@@ -1164,12 +1151,6 @@
 return PT-getNumElements();
   }
 
-  // Subclass should override this... to update self as usual
-  void doRefinement(const DerivedType *OldType, const Type *NewType) {
-assert(ValTy == OldType);
-ValTy = NewType;
-  }
-
   inline bool operator(const PackedValType MTV) const {
 if (Size  MTV.Size) return true;
 return Size == MTV.Size  ValTy  MTV.ValTy;
@@ -1223,12 +1204,6 @@
 return ST-getNumElements();
   }
 
-  // Subclass should override this... to update self as usual
-  void doRefinement(const DerivedType *OldType, const Type *NewType) {
-for (unsigned i = 0; i  ElTypes.size(); ++i)
-  if (ElTypes[i] == OldType) ElTypes[i] = NewType;
-  }
-
   inline bool operator(const StructValType STV) const {
 if (ElTypes  STV.ElTypes) return true;
 else if (ElTypes  STV.ElTypes) return false;
@@ -1276,12 +1251,6 @@
 return getSubElementHash(PT);
   }
 
-  // Subclass should override this... to update self as usual
-  void doRefinement(const DerivedType *OldType, const Type *NewType) {
-assert(ValTy == OldType);
-ValTy = NewType;
-  }
-
   bool operator(const PointerValType MTV) const {
 return ValTy  MTV.ValTy;
   }



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/System:

DynamicLibrary.cpp updated: 1.20 - 1.21
---
Log message:

Handle each of stderr/stdin/stdout separately.


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

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


Index: llvm/lib/System/DynamicLibrary.cpp
diff -u llvm/lib/System/DynamicLibrary.cpp:1.20 
llvm/lib/System/DynamicLibrary.cpp:1.21
--- llvm/lib/System/DynamicLibrary.cpp:1.20 Wed Jan 10 18:35:10 2007
+++ llvm/lib/System/DynamicLibrary.cpp  Fri Jan 19 15:30:39 2007
@@ -172,7 +172,11 @@
   {
 #ifndef stdin
 EXPLICIT_SYMBOL(stdin);
+#endif
+#ifndef stdout
 EXPLICIT_SYMBOL(stdout);
+#endif
+#ifndef stderr
 EXPLICIT_SYMBOL(stderr);
 #endif
   }



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/System:

DynamicLibrary.cpp updated: 1.21 - 1.22
---
Log message:

Help the lli interpreter find the stderr/stdin/stdout symbols. These are
needed for output to be generated. On Linux these are both global vars and
macro definitions so we have to special case Linux.


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

 DynamicLibrary.cpp |   22 +++---
 1 files changed, 19 insertions(+), 3 deletions(-)


Index: llvm/lib/System/DynamicLibrary.cpp
diff -u llvm/lib/System/DynamicLibrary.cpp:1.21 
llvm/lib/System/DynamicLibrary.cpp:1.22
--- llvm/lib/System/DynamicLibrary.cpp:1.21 Fri Jan 19 15:30:39 2007
+++ llvm/lib/System/DynamicLibrary.cpp  Fri Jan 19 15:41:04 2007
@@ -164,11 +164,23 @@
   }
 #undef EXPLICIT_SYMBOL
 #endif
+
+// This macro returns the address of a well-known, explicit symbol
 #define EXPLICIT_SYMBOL(SYM) \
if (!strcmp(symbolName, #SYM)) return SYM
-  // Try a few well known symbols just to give lli a shot at working.
-  // Note that on some systems stdin, etc. are macros so we have to
-  // avoid attempting to take the address of a macro :)
+
+// On linux we have a weird situation. The stderr/out/in symbols are both
+// macros and global variables because of standards requirements. So, we 
+// boldly use the EXPLICIT_SYMBOL macro without checking for a #define first.
+#if defined(__linux__)
+  {
+EXPLICIT_SYMBOL(stderr);
+EXPLICIT_SYMBOL(stdout);
+EXPLICIT_SYMBOL(stdin);
+  }
+#else
+  // For everything else, we want to check to make sure the symbol isn't 
defined
+  // as a macro before using EXPLICIT_SYMBOL.
   {
 #ifndef stdin
 EXPLICIT_SYMBOL(stdin);
@@ -179,7 +191,11 @@
 #ifndef stderr
 EXPLICIT_SYMBOL(stderr);
 #endif
+#ifndef errno
+EXPLICIT_SYMBOL(errno);
+#endif
   }
+#endif
 #undef EXPLICIT_SYMBOL
 
   return 0;



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


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

2007-01-19 Thread Gordon Henriksen

This bit:


+#ifndef errno
+EXPLICIT_SYMBOL(errno);
+#endif


Is broken on Darwin.

— Gordon



On Jan 19, 2007, at 16:41, Reid Spencer wrote:




Changes in directory llvm/lib/System:

DynamicLibrary.cpp updated: 1.21 - 1.22
---
Log message:

Help the lli interpreter find the stderr/stdin/stdout symbols.  
These are
needed for output to be generated. On Linux these are both global  
vars and

macro definitions so we have to special case Linux.


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

 DynamicLibrary.cpp |   22 +++---
 1 files changed, 19 insertions(+), 3 deletions(-)


Index: llvm/lib/System/DynamicLibrary.cpp
diff -u llvm/lib/System/DynamicLibrary.cpp:1.21 llvm/lib/System/ 
DynamicLibrary.cpp:1.22

--- llvm/lib/System/DynamicLibrary.cpp:1.21 Fri Jan 19 15:30:39 2007
+++ llvm/lib/System/DynamicLibrary.cpp  Fri Jan 19 15:41:04 2007
@@ -164,11 +164,23 @@
   }
 #undef EXPLICIT_SYMBOL
 #endif
+
+// This macro returns the address of a well-known, explicit symbol
 #define EXPLICIT_SYMBOL(SYM) \
if (!strcmp(symbolName, #SYM)) return SYM
-  // Try a few well known symbols just to give lli a shot at working.
-  // Note that on some systems stdin, etc. are macros so we have to
-  // avoid attempting to take the address of a macro :)
+
+// On linux we have a weird situation. The stderr/out/in symbols  
are both
+// macros and global variables because of standards requirements.  
So, we
+// boldly use the EXPLICIT_SYMBOL macro without checking for a  
#define first.

+#if defined(__linux__)
+  {
+EXPLICIT_SYMBOL(stderr);
+EXPLICIT_SYMBOL(stdout);
+EXPLICIT_SYMBOL(stdin);
+  }
+#else
+  // For everything else, we want to check to make sure the symbol  
isn't defined

+  // as a macro before using EXPLICIT_SYMBOL.
   {
 #ifndef stdin
 EXPLICIT_SYMBOL(stdin);
@@ -179,7 +191,11 @@
 #ifndef stderr
 EXPLICIT_SYMBOL(stderr);
 #endif
+#ifndef errno
+EXPLICIT_SYMBOL(errno);
+#endif
   }
+#endif
 #undef EXPLICIT_SYMBOL

   return 0;



___
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/lib/System/DynamicLibrary.cpp

2007-01-19 Thread Reid Spencer


Changes in directory llvm/lib/System:

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

Unbreak Darwin.


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

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


Index: llvm/lib/System/DynamicLibrary.cpp
diff -u llvm/lib/System/DynamicLibrary.cpp:1.22 
llvm/lib/System/DynamicLibrary.cpp:1.23
--- llvm/lib/System/DynamicLibrary.cpp:1.22 Fri Jan 19 15:41:04 2007
+++ llvm/lib/System/DynamicLibrary.cpp  Fri Jan 19 16:04:24 2007
@@ -191,9 +191,6 @@
 #ifndef stderr
 EXPLICIT_SYMBOL(stderr);
 #endif
-#ifndef errno
-EXPLICIT_SYMBOL(errno);
-#endif
   }
 #endif
 #undef EXPLICIT_SYMBOL



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


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

2007-01-19 Thread Reid Spencer
Hi Gordon,

On Fri, 2007-01-19 at 17:01 -0500, Gordon Henriksen wrote:
 This bit:
 
 
  +#ifndef errno
  +EXPLICIT_SYMBOL(errno);
  +#endif

 
 
 Is broken on Darwin.

Sorry about that. I reverted that part of the patch. 

Reid.

 
 — Gordon
 
 
 
 
 
 On Jan 19, 2007, at 16:41, Reid Spencer wrote:
 
  
  
  
  
  Changes in directory llvm/lib/System:
  
  
  DynamicLibrary.cpp updated: 1.21 - 1.22
  ---
  Log message:
  
  
  Help the lli interpreter find the stderr/stdin/stdout symbols. These
  are
  needed for output to be generated. On Linux these are both global
  vars and
  macro definitions so we have to special case Linux.
  
  
  
  
  ---
  Diffs of the changes:  (+19 -3)
  
  
   DynamicLibrary.cpp |   22 +++---
   1 files changed, 19 insertions(+), 3 deletions(-)
  
  
  
  
  Index: llvm/lib/System/DynamicLibrary.cpp
  diff -u llvm/lib/System/DynamicLibrary.cpp:1.21
  llvm/lib/System/DynamicLibrary.cpp:1.22
  --- llvm/lib/System/DynamicLibrary.cpp:1.21 Fri Jan 19 15:30:39 2007
  +++ llvm/lib/System/DynamicLibrary.cpp Fri Jan 19 15:41:04 2007
  @@ -164,11 +164,23 @@
 }
   #undef EXPLICIT_SYMBOL
   #endif
  +
  +// This macro returns the address of a well-known, explicit symbol
   #define EXPLICIT_SYMBOL(SYM) \
  if (!strcmp(symbolName, #SYM)) return SYM
  -  // Try a few well known symbols just to give lli a shot at
  working.
  -  // Note that on some systems stdin, etc. are macros so we have to
  -  // avoid attempting to take the address of a macro :)
  +
  +// On linux we have a weird situation. The stderr/out/in symbols
  are both
  +// macros and global variables because of standards requirements.
  So, we 
  +// boldly use the EXPLICIT_SYMBOL macro without checking for a
  #define first.
  +#if defined(__linux__)
  +  {
  +EXPLICIT_SYMBOL(stderr);
  +EXPLICIT_SYMBOL(stdout);
  +EXPLICIT_SYMBOL(stdin);
  +  }
  +#else
  +  // For everything else, we want to check to make sure the symbol
  isn't defined
  +  // as a macro before using EXPLICIT_SYMBOL.
 {
   #ifndef stdin
   EXPLICIT_SYMBOL(stdin);
  @@ -179,7 +191,11 @@
   #ifndef stderr
   EXPLICIT_SYMBOL(stderr);
   #endif
  +#ifndef errno
  +EXPLICIT_SYMBOL(errno);
  +#endif
 }
  +#endif
   #undef EXPLICIT_SYMBOL
  
  
 return 0;
  
  
  
  
  
  
  ___
  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 mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/override.cpp

2007-01-19 Thread Reid Spencer


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

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

Print something useful out.


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

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


Index: llvm-test/SingleSource/UnitTests/Integer/override.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.1 
llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.2
--- llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.1   Thu Jan 18 
20:22:46 2007
+++ llvm-test/SingleSource/UnitTests/Integer/override.cpp   Fri Jan 19 
16:20:57 2007
@@ -4,16 +4,17 @@
 
 void func(int32 i)
 {
-printf(call func with int32);
+printf(call func with int32: %d\n, (int)i);
 }
 
 void func(int31 s)
 {
-printf(call func with int31\n);
+printf(call func with int31: %d\n, (int)s);
 }
 
 int main()
 {
 func( (int31) 1);
+func( (int32) 2);
 return 0;
 }



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


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

2007-01-19 Thread Reid Spencer


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

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

Add needed #include.


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

 list.c |1 +
 1 files changed, 1 insertion(+)


Index: llvm-test/SingleSource/UnitTests/Integer/list.c
diff -u llvm-test/SingleSource/UnitTests/Integer/list.c:1.1 
llvm-test/SingleSource/UnitTests/Integer/list.c:1.2
--- llvm-test/SingleSource/UnitTests/Integer/list.c:1.1 Thu Jan 18 20:22:46 2007
+++ llvm-test/SingleSource/UnitTests/Integer/list.c Fri Jan 19 16:25:30 2007
@@ -1,4 +1,5 @@
 #include stdio.h
+#include stdlib.h
 
 typedef int __attribute__ ((bitwidth(9))) int9;
 typedef int __attribute__ ((bitwidth(7))) int7;



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


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

2007-01-19 Thread Reid Spencer


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

matrix.c updated: 1.2 - 1.3
---
Log message:

Rearrange code so sort definition comes before use and is not conflicting
with builtin sort function name.


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

 matrix.c |   83 +++
 1 files changed, 42 insertions(+), 41 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/matrix.c
diff -u llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.2 
llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.3
--- llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.2   Thu Jan 18 
20:48:16 2007
+++ llvm-test/SingleSource/UnitTests/Integer/matrix.c   Fri Jan 19 16:28:01 2007
@@ -2,9 +2,50 @@
 // Date: Fri Jan 12 17:32:33 CST 2007
 #include matrix.h
 #include stdio.h
+#include stdlib.h
 
 typedef enum bool{false=0, true=1} bool;
 
+// Thread: void mysort(const sc_int17 X[8], sc_int17 Y[8]);
+void mysort(const int17  X[8], int17  Y[8]){
+{
+  unsigned int i, j;
+  int17 temp;
+  {
+  j = 0;
+  for ( ; ; ) {
+  bool ssdm_tmp_4 = (j  8);
+  if (!ssdm_tmp_4) break;
+Y[j] = X[j];
+  j++;
+  }
+  }
+  {
+  j = 0;
+  for ( ; ; ) {
+  bool ssdm_tmp_5 = (j  8);
+  if (!ssdm_tmp_5) break;
+{
+  temp = -0x;
+  {
+  i = j;
+  for ( ; ; ) {
+  bool ssdm_tmp_6 = (i  8);
+  if (!ssdm_tmp_6) break;
+{
+  temp = Y[i]  temp ? Y[i] : temp;
+}
+  ++i;
+  }
+  }
+  Y[j] = temp;
+}
+  j++;
+  }
+  }
+}
+}
+
 // Module | Test
 // Thread: int my_test(sc_int17 A[8][8], sc_int17 B[8][8] );
 int my_test(int17  A[8][8], int17  B[8][8]){
@@ -32,7 +73,7 @@
 ++k;
 }
 }
-sort(A[i], C);
+mysort(A[i], C);
 t = get_gcd(C[0], C[1]);
 printf(t=%d\n, t);
   }
@@ -54,46 +95,6 @@
   return get_gcd( b, a % b );
 }
 }
-// Thread: void sort(const sc_int17 X[8], sc_int17 Y[8]);
-void sort(const int17  X[8], int17  Y[8]){
-{
-  unsigned int i, j;
-  int17 temp;
-  {
-  j = 0;
-  for ( ; ; ) {
-  bool ssdm_tmp_4 = (j  8);
-  if (!ssdm_tmp_4) break;
-Y[j] = X[j];
-  j++;
-  }
-  }
-  {
-  j = 0;
-  for ( ; ; ) {
-  bool ssdm_tmp_5 = (j  8);
-  if (!ssdm_tmp_5) break;
-{
-  temp = -0x;
-  {
-  i = j;
-  for ( ; ; ) {
-  bool ssdm_tmp_6 = (i  8);
-  if (!ssdm_tmp_6) break;
-{
-  temp = Y[i]  temp ? Y[i] : temp;
-}
-  ++i;
-  }
-  }
-  Y[j] = temp;
-}
-  j++;
-  }
-  }
-}
-}
-
 
 int main()
 {



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


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

2007-01-19 Thread Reid Spencer


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

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

Add needed #include


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

 memory.c |1 +
 1 files changed, 1 insertion(+)


Index: llvm-test/SingleSource/UnitTests/Integer/memory.c
diff -u llvm-test/SingleSource/UnitTests/Integer/memory.c:1.1 
llvm-test/SingleSource/UnitTests/Integer/memory.c:1.2
--- llvm-test/SingleSource/UnitTests/Integer/memory.c:1.1   Thu Jan 18 
20:22:46 2007
+++ llvm-test/SingleSource/UnitTests/Integer/memory.c   Fri Jan 19 16:28:37 2007
@@ -1,4 +1,5 @@
 #include stdio.h
+#include stdlib.h
 
 typedef int __attribute__ ((bitwidth(31))) int31;
 typedef int __attribute__ ((bitwidth(3))) int3;



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


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

2007-01-19 Thread Reid Spencer


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

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

Add casts to eliminate warnings.


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

 switch.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/switch.c
diff -u llvm-test/SingleSource/UnitTests/Integer/switch.c:1.1 
llvm-test/SingleSource/UnitTests/Integer/switch.c:1.2
--- llvm-test/SingleSource/UnitTests/Integer/switch.c:1.1   Thu Jan 18 
20:22:46 2007
+++ llvm-test/SingleSource/UnitTests/Integer/switch.c   Fri Jan 19 16:30:40 2007
@@ -3,8 +3,8 @@
 typedef unsigned int __attribute__ ((bitwidth(7))) int7;
 typedef unsigned int __attribute__ ((bitwidth(3))) int3;
 
-const int7 zero = 1  8; // constant 0;
-static int3 seven = 0xf; // constant 7;
+const int7 zero = (int7)(1  8); // constant 0;
+static int3 seven = (int3)0xf; // constant 7;
 
 int3  test(unsigned char c)
 {



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


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

2007-01-19 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

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

GetRegForReload() now keeps track which registers have been considered and 
rejected during its quest to find a suitable reload register. This avoids an 
infinite loop in case like this:
  t1 := op t2, t3   


  t2 - assigned r0 for use by the reload but ended up reuse r1 


  t3 - assigned r1 for use by the reload but ended up reuse r0 

 
  t1 - desires r1  

 
sees r1 is taken by t2, tries t2's reload register r0   

 
sees r0 is taken by t3, tries t3's reload register r1   

 
sees r1 is taken by t2, tries t2's reload register r0 ...

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

 VirtRegMap.cpp |   40 
 1 files changed, 32 insertions(+), 8 deletions(-)


Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.92 
llvm/lib/CodeGen/VirtRegMap.cpp:1.93
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.92Tue Dec 19 16:41:21 2006
+++ llvm/lib/CodeGen/VirtRegMap.cpp Fri Jan 19 16:40:14 2007
@@ -30,6 +30,7 @@
 #include llvm/ADT/Statistic.h
 #include llvm/ADT/STLExtras.h
 #include algorithm
+#include set
 using namespace llvm;
 
 STATISTIC(NumSpills, Number of register spills);
@@ -469,18 +470,23 @@
 /// a new register to use, or evict the previous reload and use this reg. 
 unsigned GetRegForReload(unsigned PhysReg, MachineInstr *MI,
  AvailableSpills Spills,
- std::mapint, MachineInstr* MaybeDeadStores) {
+ std::mapint, MachineInstr* MaybeDeadStores,
+ std::setunsigned Rejected) {
   if (Reuses.empty()) return PhysReg;  // This is most often empty.
 
   for (unsigned ro = 0, e = Reuses.size(); ro != e; ++ro) {
 ReusedOp Op = Reuses[ro];
 // If we find some other reuse that was supposed to use this register
 // exactly for its reload, we can change this reload to use ITS reload
-// register.
-if (Op.PhysRegReused == PhysReg) {
+// register. That is, unless its reload register has already been
+// considered and subsequently rejected because it has also been reused
+// by another operand.
+if (Op.PhysRegReused == PhysReg 
+Rejected.count(Op.AssignedPhysReg) == 0) {
   // Yup, use the reload register that we didn't use before.
-  unsigned NewReg = Op.AssignedPhysReg;  
-  return GetRegForReload(NewReg, MI, Spills, MaybeDeadStores);
+  unsigned NewReg = Op.AssignedPhysReg;
+  Rejected.insert(PhysReg);
+  return GetRegForReload(NewReg, MI, Spills, MaybeDeadStores, 
Rejected);
 } else {
   // Otherwise, we might also have a problem if a previously reused
   // value aliases the new register.  If so, codegen the previous 
reload
@@ -505,7 +511,7 @@
 // register could hold a reuse.  Check to see if it conflicts or
 // would prefer us to use a different register.
 unsigned NewPhysReg = GetRegForReload(NewOp.AssignedPhysReg,
-  MI, Spills, MaybeDeadStores);
+ MI, Spills, MaybeDeadStores, 
Rejected);
 
 MRI-loadRegFromStackSlot(*MBB, MI, NewPhysReg,
   NewOp.StackSlot, AliasRC);
@@ -532,6 +538,24 @@
   }
   return PhysReg;
 }
+
+/// GetRegForReload - Helper for the above GetRegForReload(). Add a
+/// 'Rejected' set to remember which registers have been considered and
+/// rejected for the reload. This avoids infinite looping in case like
+/// this:
+/// t1 := op t2, t3
+/// t2 - assigned r0 for use by the reload but ended up reuse r1
+/// t3 - assigned r1 for use by the reload but ended up reuse r0
+/// t1 - desires r1
+///   sees r1 is taken by t2, tries t2's reload register r0
+///   sees r0 is taken by t3, tries t3's reload register r1
+///   sees r1 is taken by t2, tries t2's reload register r0 ...
+unsigned 

[llvm-commits] CVS: llvm/test/CodeGen/ARM/2007-01-19-InfiniteLoop.ll ldr.ll

2007-01-19 Thread Evan Cheng


Changes in directory llvm/test/CodeGen/ARM:

2007-01-19-InfiniteLoop.ll added (r1.1)
ldr.ll updated: 1.3 - 1.4
---
Log message:

Add test case extracted from lencod. Spiller was infinite looping in 
GetRegForReload().

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

 2007-01-19-InfiniteLoop.ll |  103 +
 ldr.ll |3 -
 2 files changed, 104 insertions(+), 2 deletions(-)


Index: llvm/test/CodeGen/ARM/2007-01-19-InfiniteLoop.ll
diff -c /dev/null llvm/test/CodeGen/ARM/2007-01-19-InfiniteLoop.ll:1.1
*** /dev/null   Fri Jan 19 16:43:24 2007
--- llvm/test/CodeGen/ARM/2007-01-19-InfiniteLoop.llFri Jan 19 16:43:14 2007
***
*** 0 
--- 1,103 
+ ; RUN: llvm-as  %s | llc -march=arm -mattr=+v6,+vfp2
+ 
+ %quant_coef = external global [6 x [4 x [4 x i32]]]   ; [6 x [4 x [4 
x i32]]]* [#uses=1]
+ %dequant_coef = external global [6 x [4 x [4 x i32]]] ; [6 x [4 x [4 
x i32]]]* [#uses=1]
+ %A = external global [4 x [4 x i32]]  ; [4 x [4 x i32]]* [#uses=1]
+ 
+ define fastcc i32 %dct_luma_sp(i32 %block_x, i32 %block_y, i32* %coeff_cost) {
+ entry:
+   %predicted_block = alloca [4 x [4 x i32]], align 4  ; [4 x 
[4 x i32]]* [#uses=1]
+   br label %cond_next489
+ 
+ cond_next489: ; preds = %cond_false, %bb471
+   %j.7.in = load i8* null ; i8 [#uses=1]
+   %i.8.in = load i8* null ; i8 [#uses=1]
+   %i.8 = zext i8 %i.8.in to i32   ; i32 [#uses=4]
+   %j.7 = zext i8 %j.7.in to i32   ; i32 [#uses=4]
+   %tmp495 = getelementptr [4 x [4 x i32]]* %predicted_block, i32 0, i32 
%i.8, i32 %j.7; i32* [#uses=2]
+   %tmp496 = load i32* %tmp495 ; i32 [#uses=2]
+   %tmp502 = load i32* null; i32 [#uses=1]
+   %tmp542 = getelementptr [6 x [4 x [4 x i32]]]* %quant_coef, i32 0, i32 
0, i32 %i.8, i32 %j.7; i32* [#uses=1]
+   %tmp543 = load i32* %tmp542 ; i32 [#uses=1]
+   %tmp548 = ashr i32 0, i8 0  ; i32 [#uses=3]
+   %tmp561 = sub i32 0, %tmp496; i32 [#uses=3]
+   %abscond563 = icmp sgt i32 %tmp561, -1  ; i1 [#uses=1]
+   %abs564 = select i1 %abscond563, i32 %tmp561, i32 0 ; i32 
[#uses=1]
+   %tmp572 = mul i32 %abs564, %tmp543  ; i32 [#uses=1]
+   %tmp574 = add i32 %tmp572, 0; i32 [#uses=1]
+   %tmp576 = ashr i32 %tmp574, i8 0; i32 [#uses=7]
+   %tmp579 = icmp eq i32 %tmp548, %tmp576  ; i1 [#uses=1]
+   br i1 %tmp579, label %bb712, label %cond_next589
+ 
+ cond_next589: ; preds = %cond_next489
+   %tmp605 = getelementptr [6 x [4 x [4 x i32]]]* %dequant_coef, i32 0, 
i32 0, i32 %i.8, i32 %j.7  ; i32* [#uses=1]
+   %tmp606 = load i32* %tmp605 ; i32 [#uses=1]
+   %tmp612 = load i32* null; i32 [#uses=1]
+   %tmp629 = load i32* null; i32 [#uses=1]
+   %tmp629 = sitofp i32 %tmp629 to double  ; double [#uses=1]
+   %tmp631 = mul double %tmp629, 0.00e+00  ; double 
[#uses=1]
+   %tmp632 = add double 0.00e+00, %tmp631  ; double 
[#uses=1]
+   %tmp642 = call fastcc i32 %sign( i32 %tmp576, i32 %tmp561 ) 
; i32 [#uses=1]
+   %tmp650 = mul i32 %tmp606, %tmp642  ; i32 [#uses=1]
+   %tmp656 = mul i32 %tmp650, %tmp612  ; i32 [#uses=1]
+   %tmp658 = shl i32 %tmp656, i8 0 ; i32 [#uses=1]
+   %tmp659 = ashr i32 %tmp658, i8 6; i32 [#uses=1]
+   %tmp660 = sub i32 0, %tmp659; i32 [#uses=1]
+   %tmp666 = sub i32 %tmp660, %tmp496  ; i32 [#uses=1]
+   %tmp666 = sitofp i32 %tmp666 to double  ; double [#uses=2]
+   call void %levrun_linfo_inter( i32 %tmp576, i32 0, i32* null, i32* null 
)
+   %tmp671 = mul double %tmp666, %tmp666   ; double [#uses=1]
+   %tmp675 = add double %tmp671, 0.00e+00  ; double 
[#uses=1]
+   %tmp678 = fcmp oeq double %tmp632, %tmp675  ; i1 [#uses=1]
+   br i1 %tmp678, label %cond_true679, label %cond_false693
+ 
+ cond_true679: ; preds = %cond_next589
+   %abscond681 = icmp sgt i32 %tmp548, -1  ; i1 [#uses=1]
+   %abs682 = select i1 %abscond681, i32 %tmp548, i32 0 ; i32 
[#uses=1]
+   %abscond684 = icmp sgt i32 %tmp576, -1  ; i1 [#uses=1]
+   %abs685 = select i1 %abscond684, i32 %tmp576, i32 0 ; i32 
[#uses=1]
+   %tmp686 = icmp slt i32 %abs682, %abs685 ; i1 [#uses=1]
+   br i1 %tmp686, label %cond_next702, label %cond_false689
+ 
+ cond_false689:; preds = %cond_true679
+   %tmp739 = icmp eq i32 %tmp576, 0; i1 [#uses=1]
+   br i1 %tmp579, label %bb737, label %cond_false708
+ 
+ cond_false693:; preds = %cond_next589
+   

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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/examples/HowToUseJIT:

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

Add a #include to resolve IntegerType class.


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

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


Index: llvm/examples/HowToUseJIT/HowToUseJIT.cpp
diff -u llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.14 
llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.15
--- llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.14  Sun Jan  7 01:40:09 2007
+++ llvm/examples/HowToUseJIT/HowToUseJIT.cpp   Fri Jan 19 16:45:05 2007
@@ -36,7 +36,7 @@
 
 #include llvm/Module.h
 #include llvm/Constants.h
-#include llvm/Type.h
+#include llvm/DerivedTypes.h
 #include llvm/Instructions.h
 #include llvm/ModuleProvider.h
 #include llvm/ExecutionEngine/JIT.h



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


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

2007-01-19 Thread Reid Spencer


Changes in directory llvm/examples/ParallelJIT:

ParallelJIT.cpp updated: 1.9 - 1.10
---
Log message:

Fix a #include to resolve IntegerType class.


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

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


Index: llvm/examples/ParallelJIT/ParallelJIT.cpp
diff -u llvm/examples/ParallelJIT/ParallelJIT.cpp:1.9 
llvm/examples/ParallelJIT/ParallelJIT.cpp:1.10
--- llvm/examples/ParallelJIT/ParallelJIT.cpp:1.9   Sun Jan  7 01:40:09 2007
+++ llvm/examples/ParallelJIT/ParallelJIT.cpp   Fri Jan 19 16:45:50 2007
@@ -20,7 +20,7 @@
 #include pthread.h
 #include llvm/Module.h
 #include llvm/Constants.h
-#include llvm/Type.h
+#include llvm/DerivedTypes.h
 #include llvm/Instructions.h
 #include llvm/ModuleProvider.h
 #include llvm/ExecutionEngine/JIT.h



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


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

2007-01-19 Thread Reid Spencer


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

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

Get rid of compilation warnings.


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

 general-test.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/general-test.c
diff -u llvm-test/SingleSource/UnitTests/Integer/general-test.c:1.2 
llvm-test/SingleSource/UnitTests/Integer/general-test.c:1.3
--- llvm-test/SingleSource/UnitTests/Integer/general-test.c:1.2 Wed Jan 17 
19:31:25 2007
+++ llvm-test/SingleSource/UnitTests/Integer/general-test.c Fri Jan 19 
16:24:05 2007
@@ -11,7 +11,7 @@
 typedef unsigned short ATTR_BITS(16) My16BitInt;
 typedef unsigned int ATTR_BITS(17) My17BitInt;
 typedef unsigned long long ATTR_BITS(37) My37BitInt;
-typedef unsigned ATTR_BITS(65) My65BitInt;
+typedef unsigned ATTR_BITS(63) My63BitInt;
 
 struct MyStruct {
   struct MyStruct* next;
@@ -30,7 +30,7 @@
   printf(sizeof(MyStruct) == %d\n, sizeof(struct MyStruct));
   printf(sizeof(My17BitInt) == %d\n, sizeof(My17BitInt));
   printf(sizeof(j) == %d\n, sizeof(j));
-  result = sizeof(My17BitInt) + sizeof(j) + sizeof(struct MyStruct);
+  *result = sizeof(My17BitInt) + sizeof(j) + sizeof(struct MyStruct);
   Data1.i4Field = num;
   Data1.i12Field = num + 1;
   Data1.i17Field = num + 2;
@@ -56,7 +56,7 @@
   int r = rand();
   int num = 0;
   int ATTR_BITS(23) val = 0;
-  My37BitInt* sizes = 0;
+  My37BitInt sizes = 0;
   printf(rand = %d\n, r);
   printf(argc = %d\n, argc);
   if (argc  1)
@@ -64,7 +64,7 @@
   printf(num  = %d\n, num);
   val = r + argc + num;
   printf(val  = %d\n, val);
-  struct MyStruct* that = ((int ATTR_BITS(32)) getSizes(val, sizes));
+  struct MyStruct* that = getSizes(val, sizes);
   printf(that.i4Field  = %d\n, (int)that-i4Field);
   printf(that.i12Field = %d\n, (int)that-i12Field);
   printf(that.i17Field = %d\n, (int)that-i17Field);



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/SSAtest.c arith.c array.c bigint.c bitbit.c bitlogic.c cond-expr.c enum.cpp exception.cpp extern-inline-redef.c field.c folding.c global.c

2007-01-19 Thread Reid Spencer


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

SSAtest.c updated: 1.2 - 1.3
arith.c updated: 1.2 - 1.3
array.c updated: 1.2 - 1.3
bigint.c updated: 1.2 - 1.3
bitbit.c updated: 1.2 - 1.3
bitlogic.c updated: 1.2 - 1.3
cond-expr.c updated: 1.2 - 1.3
enum.cpp updated: 1.2 - 1.3
exception.cpp updated: 1.1 - 1.2
extern-inline-redef.c updated: 1.2 - 1.3
field.c updated: 1.1 - 1.2
folding.c updated: 1.1 - 1.2
global.c updated: 1.1 - 1.2
large-array.c updated: 1.2 - 1.3
list.c updated: 1.2 - 1.3
local-array.c updated: 1.2 - 1.3
local-union.c updated: 1.2 - 1.3
matrix.c updated: 1.3 - 1.4
memory.c updated: 1.2 - 1.3
offset.c updated: 1.2 - 1.3
override.cpp updated: 1.2 - 1.3
pointer.c updated: 1.2 - 1.3
static.c updated: 1.1 - 1.2
struct1.c updated: 1.2 - 1.3
struct2.c updated: 1.2 - 1.3
structInit.c updated: 1.2 - 1.3
switch.c updated: 1.2 - 1.3
template.cpp updated: 1.2 - 1.3
template2.cpp updated: 1.1 - 1.2
template3.cpp updated: 1.1 - 1.2
union-init.c updated: 1.2 - 1.3
union-struct.c updated: 1.2 - 1.3
union2.c updated: 1.1 - 1.2
---
Log message:

Updates to test cases by Guoling Han. 


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

 SSAtest.c |7 +++
 arith.c   |7 ++-
 array.c   |8 +++-
 bigint.c  |8 ++--
 bitbit.c  |   24 ++--
 bitlogic.c|   18 --
 cond-expr.c   |   10 --
 enum.cpp  |6 ++
 exception.cpp |8 
 extern-inline-redef.c |6 ++
 field.c   |8 
 folding.c |   21 ++---
 global.c  |7 +++
 large-array.c |   16 +---
 list.c|7 +++
 local-array.c |7 +++
 local-union.c |7 +++
 matrix.c  |   12 +---
 memory.c  |6 ++
 offset.c  |7 +++
 override.cpp  |6 ++
 pointer.c |   12 +---
 static.c  |6 ++
 struct1.c |8 
 struct2.c |8 
 structInit.c  |6 ++
 switch.c  |   10 +-
 template.cpp  |7 +++
 template2.cpp |6 ++
 template3.cpp |6 ++
 union-init.c  |7 +++
 union-struct.c|8 
 union2.c  |7 +++
 33 files changed, 262 insertions(+), 35 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/SSAtest.c
diff -u llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.2 
llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.3
--- llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.2  Thu Jan 18 
20:48:16 2007
+++ llvm-test/SingleSource/UnitTests/Integer/SSAtest.c  Fri Jan 19 16:54:01 2007
@@ -1,3 +1,10 @@
+//===--- SSAtest.c --- Test Cases for Bit Accurate Types 
---===//
+//
+// Adopted the test from previous test-cases. Changed it with
+// non-regular int data type.
+//
+//======//
+
 #include stdio.h
 
 typedef int __attribute__ ((bitwidth(4))) int4;


Index: llvm-test/SingleSource/UnitTests/Integer/arith.c
diff -u llvm-test/SingleSource/UnitTests/Integer/arith.c:1.2 
llvm-test/SingleSource/UnitTests/Integer/arith.c:1.3
--- llvm-test/SingleSource/UnitTests/Integer/arith.c:1.2Thu Jan 18 
20:48:16 2007
+++ llvm-test/SingleSource/UnitTests/Integer/arith.cFri Jan 19 16:54:01 2007
@@ -1,5 +1,10 @@
+//===--- arith.c --- Test Cases for Bit Accurate Types 
---===//
+//
+// This is a general test for arithmatic operations.
+//
+//======//
+
 
-// Date: Fri Jan 12 17:19:09 CST 2007
 #include arith.h
 #include stdio.h
 


Index: llvm-test/SingleSource/UnitTests/Integer/array.c
diff -u llvm-test/SingleSource/UnitTests/Integer/array.c:1.2 
llvm-test/SingleSource/UnitTests/Integer/array.c:1.3
--- llvm-test/SingleSource/UnitTests/Integer/array.c:1.2Thu Jan 18 
20:48:16 2007
+++ llvm-test/SingleSource/UnitTests/Integer/array.cFri Jan 19 16:54:01 2007
@@ -1,3 +1,9 @@
+//===--- array.c --- Test Cases for Bit Accurate Types 
---===//
+//
+// This is a general test for array data types.
+//
+//======//
+
 
 #include array.h
 #include stdio.h
@@ -38,4 +44,4 @@
 return 0;
 }
 
-// End of Module | Test
+


Index: llvm-test/SingleSource/UnitTests/Integer/bigint.c
diff -u llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.2 
llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.3
--- llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.2   Thu Jan 18 
20:48:16 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bigint.c   Fri Jan 19 16:54:01 2007
@@ -1,5 +1,9 @@

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

2007-01-19 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

PrologEpilogInserter.cpp updated: 1.63 - 1.64
---
Log message:

We not align the final stack slot but instead let the target do so in 
emitPrologue(). Each target can make adjustments to the stack frame and 
re-align the stack as it deem appropriate. Do not align it twice which can end 
up wasting stack space.

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

 PrologEpilogInserter.cpp |7 ---
 1 files changed, 7 deletions(-)


Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.63 
llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.64
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.63  Tue Jan  2 15:31:15 2007
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp   Fri Jan 19 20:07:13 2007
@@ -387,13 +387,6 @@
 }
   }
 
-
-  // Align the final stack pointer offset, but only if there are calls in the
-  // function.  This ensures that any calls to subroutines have their stack
-  // frames suitable aligned.
-  if (FFI-hasCalls())
-Offset = (Offset+StackAlignment-1)/StackAlignment*StackAlignment;
-
   // Set the final value of the stack pointer...
   FFI-setStackSize(Offset+TFI.getOffsetOfLocalArea());
 



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


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

2007-01-19 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMRegisterInfo.cpp updated: 1.36 - 1.37
---
Log message:

Prologue and epilogue bugs for non-Darwin targets.

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

 ARMRegisterInfo.cpp |   68 +++-
 1 files changed, 46 insertions(+), 22 deletions(-)


Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.36 
llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.37
--- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.36Fri Jan 19 20:09:25 2007
+++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Fri Jan 19 21:24:07 2007
@@ -484,7 +484,8 @@
 // There is alloca()'s in this function, must reference off the frame
 // pointer instead.
 FrameReg = getFrameRegister(MF);
-Offset -= AFI-getFramePtrSpillOffset();
+if (STI.isTargetDarwin())
+  Offset -= AFI-getFramePtrSpillOffset();
   }
 
   unsigned Opcode = MI.getOpcode();
@@ -724,6 +725,14 @@
   if (Spilled) {
 NumGPRSpills++;
 
+if (!STI.isTargetDarwin()) {
+  if (Reg == ARM::LR)
+LRSpilled = true;
+  else
+CS1Spilled = true;
+  continue;
+}
+
 // Keep track if LR and any of R4, R5, R6, and R7 is spilled.
 switch (Reg) {
 case ARM::LR:
@@ -739,6 +748,11 @@
   break;
 }
   } else { 
+if (!STI.isTargetDarwin()) {
+  UnspilledCS1GPRs.push_back(Reg);
+  continue;
+}
+
 switch (Reg) {
 case ARM::R4:
 case ARM::R5:
@@ -768,17 +782,21 @@
 UnspilledCS1GPRs.end(), 
(unsigned)ARM::LR));
 }
 
-// If stack and double are 8-byte aligned and we are spilling a odd number
+if (STI.isTargetDarwin()) {
+  MF.changePhyRegUsed(FramePtr, true);
+  NumGPRSpills++;
+}
+
+// If stack and double are 8-byte aligned and we are spilling an odd number
 // of GPRs. Spill one extra callee save GPR so we won't have to pad between
 // the integer and double callee save areas.
 unsigned TargetAlign = MF.getTarget().getFrameInfo()-getStackAlignment();
 if (TargetAlign == 8  (NumGPRSpills  1)) {
   if (CS1Spilled  !UnspilledCS1GPRs.empty())
 MF.changePhyRegUsed(UnspilledCS1GPRs.front(), true);
-  else
+  else if (!UnspilledCS2GPRs.empty())
 MF.changePhyRegUsed(UnspilledCS2GPRs.front(), true);
 }
-MF.changePhyRegUsed(FramePtr, true);
   }
 }
 
@@ -871,18 +889,21 @@
   }
 }
 
+if (Align == 8  (GPRCS1Size  7) != 0)
+  // Pad CS1 to ensure proper alignment.
+  GPRCS1Size += 4;
+
 if (!isThumb) {
   // Build the new SUBri to adjust SP for integer callee-save spill area 1.
   emitSPUpdate(MBB, MBBI, -GPRCS1Size, isThumb, TII);
   movePastCSLoadStoreOps(MBB, MBBI, ARM::STR, 1, STI);
-} else {
-  if (MBBI != MBB.end()  MBBI-getOpcode() == ARM::tPUSH)
-++MBBI;
-}
+} else if (MBBI != MBB.end()  MBBI-getOpcode() == ARM::tPUSH)
+  ++MBBI;
 
 // Point FP to the stack slot that contains the previous FP.
-BuildMI(MBB, MBBI, TII.get(isThumb ? ARM::tADDrSPi : ARM::ADDri), FramePtr)
-  .addFrameIndex(FramePtrSpillFI).addImm(0);
+if (STI.isTargetDarwin())
+  BuildMI(MBB, MBBI, TII.get(isThumb ? ARM::tADDrSPi : ARM::ADDri), 
FramePtr)
+.addFrameIndex(FramePtrSpillFI).addImm(0);
 
 if (!isThumb) {
   // Build the new SUBri to adjust SP for integer callee-save spill area 2.
@@ -977,18 +998,21 @@
 if (isThumb)
   emitSPUpdate(MBB, MBBI, -NumBytes, isThumb, TII);
 else {
-  NumBytes = AFI-getFramePtrSpillOffset() - NumBytes;
-  // Reset SP based on frame pointer only if the stack frame extends beyond
-  // frame pointer stack slot.
-  if (AFI-getGPRCalleeSavedArea2Size() ||
-  AFI-getDPRCalleeSavedAreaSize()  ||
-  AFI-getDPRCalleeSavedAreaOffset())
-if (NumBytes)
-  BuildMI(MBB, MBBI, TII.get(ARM::SUBri), ARM::SP).addReg(FramePtr)
-.addImm(NumBytes);
-else
-  BuildMI(MBB, MBBI, TII.get(isThumb ? ARM::tMOVrr : ARM::MOVrr),
-  ARM::SP).addReg(FramePtr);
+  if (STI.isTargetDarwin()) {
+NumBytes = AFI-getFramePtrSpillOffset() - NumBytes;
+// Reset SP based on frame pointer only if the stack frame extends 
beyond
+// frame pointer stack slot.
+if (AFI-getGPRCalleeSavedArea2Size() ||
+AFI-getDPRCalleeSavedAreaSize()  ||
+AFI-getDPRCalleeSavedAreaOffset())
+  if (NumBytes)
+BuildMI(MBB, MBBI, TII.get(ARM::SUBri), ARM::SP).addReg(FramePtr)
+  .addImm(NumBytes);
+  else
+BuildMI(MBB, MBBI, TII.get(ARM::MOVrr), ARM::SP).addReg(FramePtr);
+  } else if (NumBytes) {
+emitSPUpdate(MBB, MBBI, NumBytes, false, TII);
+  }
 
   // Move SP to start of integer callee save spill area 2.
   

[llvm-commits] CVS: llvm/autoconf/configure.ac

2007-01-19 Thread Anton Korobeynikov


Changes in directory llvm/autoconf:

configure.ac updated: 1.260 - 1.261
---
Log message:

Cleanup


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

 configure.ac |   34 +-
 1 files changed, 17 insertions(+), 17 deletions(-)


Index: llvm/autoconf/configure.ac
diff -u llvm/autoconf/configure.ac:1.260 llvm/autoconf/configure.ac:1.261
--- llvm/autoconf/configure.ac:1.260Fri Jan 19 11:25:17 2007
+++ llvm/autoconf/configure.ac  Sat Jan 20 01:40:26 2007
@@ -636,7 +636,7 @@
 [
   AC_SUBST(USE_UDIS86, [1])
   case $withval in
-/usr/lib) ;;
+/usr/lib|yes) ;;
 *) LDFLAGS=$LDFLAGS -L${withval} ;;
   esac
   AC_CHECK_LIB(udis86, ud_init, [], [
@@ -718,22 +718,22 @@
 AC_FUNC_ISNAN
 AC_FUNC_ISINF
 
-dnl Check for mmap and mprotect support. We need both to do the JIT and for
-dnl bytecode loading, etc. We also need to know if /dev/zero is required to
-dnl be opened for allocating RWX memory.
-AC_FUNC_MMAP
-AC_FUNC_MMAP_FILE
-AC_NEED_DEV_ZERO_FOR_MMAP
-AC_CHECK_FUNC(mprotect,,
-  AC_MSG_ERROR([Function mprotect() required but not found]))
-
-if test $ac_cv_func_mmap_fixed_mapped = no
-then
-  AC_MSG_WARN([mmap() of a fixed address required but not supported])
-fi
-if test $ac_cv_func_mmap_file = no
-then
-  AC_MSG_WARN([mmap() of files required but not found])
+dnl Check for mmap support.We also need to know if /dev/zero is required to 
+dnl be opened for allocating RWX memory.  
+dnl Make sure we aren't attempting to configure for an unknown system
+if test $llvm_cv_platform_type = Unix ; then
+  AC_FUNC_MMAP 
+  AC_FUNC_MMAP_FILE
+  AC_NEED_DEV_ZERO_FOR_MMAP
+
+  if test $ac_cv_func_mmap_fixed_mapped = no
+  then
+AC_MSG_WARN([mmap() of a fixed address required but not supported])
+  fi
+  if test $ac_cv_func_mmap_file = no
+  then
+AC_MSG_WARN([mmap() of files required but not found])
+  fi
 fi
 
 
dnl===---===



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


[llvm-commits] CVS: llvm/configure

2007-01-19 Thread Reid Spencer


Changes in directory llvm:

configure updated: 1.265 - 1.266
---
Log message:

Regenerate for Anton Korobeynikov.


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

 configure |  127 +-
 1 files changed, 12 insertions(+), 115 deletions(-)


Index: llvm/configure
diff -u llvm/configure:1.265 llvm/configure:1.266
--- llvm/configure:1.265Fri Jan 19 11:41:47 2007
+++ llvm/configure  Sat Jan 20 01:48:49 2007
@@ -27586,7 +27586,7 @@
   USE_UDIS86=1
 
   case $withval in
-/usr/lib) ;;
+/usr/lib|yes) ;;
 *) LDFLAGS=$LDFLAGS -L${withval} ;;
   esac
 
@@ -32717,6 +32717,7 @@
 
 
 
+if test $llvm_cv_platform_type = Unix ; then
 
 
 for ac_header in stdlib.h unistd.h
@@ -33183,7 +33184,7 @@
 fi
 rm -f conftest.mmap
 
-{ echo $as_me:$LINENO: checking for mmap of files 5
+  { echo $as_me:$LINENO: checking for mmap of files 5
 echo $ECHO_N checking for mmap of files... $ECHO_C 6; }
 if test ${ac_cv_func_mmap_file+set} = set; then
   echo $ECHO_N (cached) $ECHO_C 6
@@ -33275,7 +33276,7 @@
 
 fi
 
-{ echo $as_me:$LINENO: checking if /dev/zero is needed for mmap 5
+  { echo $as_me:$LINENO: checking if /dev/zero is needed for mmap 5
 echo $ECHO_N checking if /dev/zero is needed for mmap... $ECHO_C 6; }
 if test ${ac_cv_need_dev_zero_for_mmap+set} = set; then
   echo $ECHO_N (cached) $ECHO_C 6
@@ -33296,121 +33297,17 @@
 _ACEOF
 
 fi
-{ echo $as_me:$LINENO: checking for mprotect 5
-echo $ECHO_N checking for mprotect... $ECHO_C 6; }
-if test ${ac_cv_func_mprotect+set} = set; then
-  echo $ECHO_N (cached) $ECHO_C 6
-else
-  cat conftest.$ac_ext _ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h conftest.$ac_ext
-cat conftest.$ac_ext _ACEOF
-/* end confdefs.h.  */
-/* Define mprotect to an innocuous variant, in case limits.h declares 
mprotect.
-   For example, HP-UX 11i limits.h declares gettimeofday.  */
-#define mprotect innocuous_mprotect
-
-/* System header to define __stub macros and hopefully few prototypes,
-which can conflict with char mprotect (); below.
-Prefer limits.h to assert.h if __STDC__ is defined, since
-limits.h exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include limits.h
-#else
-# include assert.h
-#endif
-
-#undef mprotect
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern C
-#endif
-char mprotect ();
-/* The GNU C library defines this for functions which it implements
-to always fail with ENOSYS.  Some functions are actually named
-something starting with __ and the normal name is an alias.  */
-#if defined __stub_mprotect || defined __stub___mprotect
-choke me
-#endif
-
-int
-main ()
-{
-return mprotect ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try=$ac_link
-case (($ac_try in
-  *\* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval echo \\$as_me:$LINENO: $ac_try_echo\) 5
-  (eval $ac_link) 2conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 conftest.err
-  rm -f conftest.er1
-  cat conftest.err 5
-  echo $as_me:$LINENO: \$? = $ac_status 5
-  (exit $ac_status); } 
-{ ac_try='test -z $ac_c_werror_flag || test ! -s conftest.err'
-  { (case (($ac_try in
-  *\* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval echo \\$as_me:$LINENO: $ac_try_echo\) 5
-  (eval $ac_try) 25
-  ac_status=$?
-  echo $as_me:$LINENO: \$? = $ac_status 5
-  (exit $ac_status); }; } 
-{ ac_try='test -s conftest$ac_exeext'
-  { (case (($ac_try in
-  *\* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval echo \\$as_me:$LINENO: $ac_try_echo\) 5
-  (eval $ac_try) 25
-  ac_status=$?
-  echo $as_me:$LINENO: \$? = $ac_status 5
-  (exit $ac_status); }; }; then
-  ac_cv_func_mprotect=yes
-else
-  echo $as_me: failed program was: 5
-sed 's/^/| /' conftest.$ac_ext 5
-
-   ac_cv_func_mprotect=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-  conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo $as_me:$LINENO: result: $ac_cv_func_mprotect 5
-echo ${ECHO_T}$ac_cv_func_mprotect 6; }
-if test $ac_cv_func_mprotect = yes; then
-  :
-else
-  { { echo $as_me:$LINENO: error: Function mprotect() required but not found 
5
-echo $as_me: error: Function mprotect() required but not found 2;}
-   { (exit 1); exit 1; }; }
-fi
-
-
-if test $ac_cv_func_mmap_fixed_mapped = no
-then
-  { echo $as_me:$LINENO: WARNING: mmap() of a fixed address required but not 
supported 5
+  if test $ac_cv_func_mmap_fixed_mapped = no
+  then
+{ echo $as_me:$LINENO: WARNING: mmap() of a fixed address required but 
not supported 5
 echo $as_me: WARNING: mmap() of a fixed address required but not supported 
2;}
-fi
-if test $ac_cv_func_mmap_file = no
-then
-  { echo $as_me:$LINENO: WARNING: mmap() of files required but