[llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp

2006-11-07 Thread Reid Spencer


Changes in directory llvm/test/Regression/DebugInfo:

2006-11-06-StackTrace.cpp updated: 1.1 -> 1.2
---
Log message:

Make some corrections to this test case.


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

 2006-11-06-StackTrace.cpp |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)


Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp
diff -u llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.1 
llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.2
--- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.1Tue Nov 
 7 01:31:37 2006
+++ llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cppTue Nov  7 
01:58:02 2006
@@ -1,9 +1,11 @@
 // This is a regression test on debug info to make sure that we can get a
 // meaningful stack trace from a C++ program.
-// RUN: %llvmgcc -S -O0 -g %s -o Output/%s.ll
-// RUN: llvm-as < Output/%s.ll | llc -o Output/%s.s
-// RUN: gcc -g Output/%s.s -o Output/%s.exe
-// RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) | 
gdb Output/%s.exe | grep '#0  DeepStack::deepest (this=.*,x=33)'
+// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc -o Output/StackTrace.s -f
+// RUN: gcc -g Output/StackTrace.s -o Output/StackTrace.exe -lstdc++
+// RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > 
Output/StackTrace.gdbin 
+// RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | 
tee Output/StackTrace.out | grep '#0  DeepStack::deepest (this=.*,x=33)'
+// RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | 
grep '#7  0x.* in main(argc=1, argv=.*)'
+
 
 #include 
 



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


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

2006-11-07 Thread Evan Cheng


Changes in directory llvm/include/llvm/Target:

TargetLowering.h updated: 1.86 -> 1.87
---
Log message:

Added target hook for post-indexed memory ops transformation.

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

 TargetLowering.h |   10 ++
 1 files changed, 10 insertions(+)


Index: llvm/include/llvm/Target/TargetLowering.h
diff -u llvm/include/llvm/Target/TargetLowering.h:1.86 
llvm/include/llvm/Target/TargetLowering.h:1.87
--- llvm/include/llvm/Target/TargetLowering.h:1.86  Fri Nov  3 01:19:02 2006
+++ llvm/include/llvm/Target/TargetLowering.h   Tue Nov  7 03:04:16 2006
@@ -382,6 +382,16 @@
 return false;
   }
   
+  /// getPostIndexedAddressParts - returns true by value, base pointer and
+  /// offset pointer and addressing mode by reference if this node can be
+  /// combined with a load / store to form a post-indexed load / store.
+  virtual bool getPostIndexedAddressParts(SDNode *N, MVT::ValueType VT,
+  SDOperand &Base, SDOperand &Offset,
+  ISD::MemOpAddrMode &AM,
+  SelectionDAG &DAG) {
+return false;
+  }
+  
   
//======//
   // TargetLowering Optimization Methods
   //



___
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

2006-11-07 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.238 -> 1.239
---
Log message:

Add post-indexed load / store transformations.

---
Diffs of the changes:  (+199 -50)

 DAGCombiner.cpp |  249 
 1 files changed, 199 insertions(+), 50 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.238 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.239
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.238 Mon Nov  6 02:14:30 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Tue Nov  7 03:03:05 2006
@@ -47,6 +47,11 @@
   static Statistic<> NodesCombined ("dagcombiner", 
"Number of dag nodes combined");
 
+  static Statistic<> PreIndexedNodes ("pre_indexed_ops", 
+  "Number of pre-indexed nodes created");
+  static Statistic<> PostIndexedNodes ("post_indexed_ops", 
+   "Number of post-indexed nodes created");
+
   static cl::opt
 CombinerAA("combiner-alias-analysis", cl::Hidden,
cl::desc("Turn on alias analysis during testing"));
@@ -174,13 +179,16 @@
   return true;
 }
 
-/// CombineToPreIndexedLoadStore - Try turning a load / store into a
-/// pre-indexed load store when the base pointer is a add or subtract
-/// and it has other uses besides the load / store. When the
-/// transformation is done, the new indexed load / store effectively
-/// folded the add / subtract in and all of its other uses are redirected
-/// to the new load / store.
+/// CombineToPreIndexedLoadStore - Try turning a load / store and a
+/// pre-indexed load / store when the base pointer is a add or subtract
+/// and it has other uses besides the load / store. After the
+/// transformation, the new indexed load / store has effectively folded
+/// the add / subtract in and all of its other uses are redirected to the
+/// new load / store.
 bool CombineToPreIndexedLoadStore(SDNode *N) {
+  if (!AfterLegalize)
+return false;
+
   bool isLoad = true;
   SDOperand Ptr;
   if (LoadSDNode *LD  = dyn_cast(N)) {
@@ -191,8 +199,7 @@
   } else
 return false;
 
-  if (AfterLegalize &&
-  (Ptr.getOpcode() == ISD::ADD || Ptr.getOpcode() == ISD::SUB) &&
+  if ((Ptr.getOpcode() == ISD::ADD || Ptr.getOpcode() == ISD::SUB) &&
   Ptr.Val->use_size() > 1) {
 SDOperand BasePtr;
 SDOperand Offset;
@@ -203,57 +210,56 @@
   //that would create a cycle.
   // 2) All uses are load / store ops that use it as base ptr and 
offset
   //is just an addressing mode immediate.
-  // 3) If the would-be new base may not to be dead at N. FIXME: The
-  //proper check is too expensive (in turns of compile time) to 
-  //check. Just make sure other uses of the new base are not also
-  //themselves use of loads / stores.
-
-  bool OffIsAMImm = Offset.getOpcode() == ISD::Constant &&
-TLI.isLegalAddressImmediate(
-  cast(Offset)->getValue());
+  // 3) If the would-be new base may not to be dead at N.
+
+  bool OffIsAMImm = Offset.getOpcode() == ISD::Constant && TLI.
+isLegalAddressImmediate(cast(Offset)->getValue());
 
   // Check for #3.
-  if (OffIsAMImm && BasePtr.Val->use_size() > 1) {
-for (SDNode::use_iterator I = BasePtr.Val->use_begin(),
-   E = BasePtr.Val->use_end(); I != E; ++I) {
-  SDNode *Use = *I;
-  if (Use == Ptr.Val)
-continue;
-  if (Use->getOpcode() == ISD::ADD || Use->getOpcode() == 
ISD::SUB){
-for (SDNode::use_iterator II = Use->use_begin(),
-   EE = Use->use_end(); II != EE; ++II) {
-  SDNode *UseUse = *II;
-  if (UseUse->getOpcode() == ISD::LOAD &&
-  cast(UseUse)->getBasePtr().Val == Use)
-return false;
-  else if (UseUse->getOpcode() == ISD::STORE &&
-   cast(UseUse)->getBasePtr().Val == Use)
-return false;
-}
+  for (SDNode::use_iterator I = BasePtr.Val->use_begin(),
+ E = BasePtr.Val->use_end(); I != E; ++I) {
+SDNode *Use = *I;
+if (Use == Ptr.Val)
+  continue;
+if (Use->getOpcode() == ISD::CopyToReg)
+  return false;
+if (OffIsAMImm && (Use->getOpcode() == ISD::ADD ||
+   Use->getOpcode() == ISD::SUB)) {
+  for (SDNode::use_iterator II = Use->use_begin(),
+ EE = Use->use_end(); II != EE; ++II) {
+SDNode *UseUse = *II;
+  

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

2006-11-07 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.190 -> 1.191
RegAllocLinearScan.cpp updated: 1.129 -> 1.130
---
Log message:

Use correct value for float HUGH_VAL.

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

 LiveIntervalAnalysis.cpp |8 
 RegAllocLinearScan.cpp   |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 
llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.191
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 Tue Nov  7 01:18:40 2006
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp   Tue Nov  7 06:25:45 2006
@@ -219,7 +219,7 @@
   // range the use follows def immediately, it doesn't make sense to spill
   // it and hope it will be easier to allocate for this li.
   if (isZeroLengthInterval(&LI))
-LI.weight = float(HUGE_VAL);
+LI.weight = HUGE_VALF;
   
   if (EnableReweight) {
 // Divide the weight of the interval by its size.  This encourages 
@@ -265,7 +265,7 @@
 
   std::vector added;
 
-  assert(li.weight != HUGE_VAL &&
+  assert(li.weight != HUGE_VALF &&
  "attempt to spill already spilled interval!");
 
   DEBUG(std::cerr << "\t\t\t\tadding intervals for spills for interval: ";
@@ -340,7 +340,7 @@
 
 // the spill weight is now infinity as it
 // cannot be spilled again
-nI.weight = float(HUGE_VAL);
+nI.weight = HUGE_VALF;
 
 if (HasUse) {
   LiveRange LR(getLoadIndex(index), getUseIndex(index),
@@ -1362,6 +1362,6 @@
 
 LiveInterval LiveIntervals::createInterval(unsigned reg) {
   float Weight = MRegisterInfo::isPhysicalRegister(reg) ?
-   (float)HUGE_VAL : 0.0F;
+   HUGE_VALF : 0.0F;
   return LiveInterval(reg, Weight);
 }


Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 
llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.130
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129   Tue Oct 24 09:35:25 2006
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Nov  7 06:25:45 2006
@@ -545,7 +545,7 @@
   DEBUG(std::cerr << "\tassigning stack slot at interval "<< *cur << ":\n");
 
   // Find a register to spill.
-  float minWeight = float(HUGE_VAL);
+  float minWeight = HUGE_VALF;
   unsigned minReg = 0;
   for (TargetRegisterClass::iterator i = RC->allocation_order_begin(*mf_),
e = RC->allocation_order_end(*mf_); i != e; ++i) {
@@ -582,7 +582,7 @@
   // if the current has the minimum weight, we need to spill it and
   // add any added intervals back to unhandled, and restart
   // linearscan.
-  if (cur->weight != float(HUGE_VAL) && cur->weight <= minWeight) {
+  if (cur->weight != HUGE_VALF && cur->weight <= minWeight) {
 DEBUG(std::cerr << "\t\t\tspilling(c): " << *cur << '\n';);
 int slot = vrm_->assignVirt2StackSlot(cur->reg);
 std::vector added =



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


[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2006-11-03-Memmove64.ll 2007-11-03-Memmove64.ll

2006-11-07 Thread Andrew Lenharth


Changes in directory llvm/test/Regression/Transforms/InstCombine:

2006-11-03-Memmove64.ll added (r1.1)
2007-11-03-Memmove64.ll (r1.1) removed
---
Log message:

Got a little ahead of myself here

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

 2006-11-03-Memmove64.ll |   18 ++
 1 files changed, 18 insertions(+)


Index: llvm/test/Regression/Transforms/InstCombine/2006-11-03-Memmove64.ll
diff -c /dev/null 
llvm/test/Regression/Transforms/InstCombine/2006-11-03-Memmove64.ll:1.1
*** /dev/null   Tue Nov  7 10:40:30 2006
--- llvm/test/Regression/Transforms/InstCombine/2006-11-03-Memmove64.ll Tue Nov 
 7 10:40:19 2006
***
*** 0 
--- 1,18 
+ ;RUN: llvm-as < %s | opt -instcombine | llvm-dis |not grep memmove.i32
+ ; Instcombine was trying to turn this into a memmove.i32
+ 
+ target datalayout = "e-p:64:64"
+ target endian = little
+ target pointersize = 64
+ target triple = "alphaev67-unknown-linux-gnu"
+ %str10 = internal constant [1 x sbyte] zeroinitializer; <[1 x 
sbyte]*> [#uses=1]
+ 
+ implementation   ; Functions:
+ 
+ void %do_join(sbyte* %b) {
+ entry:
+   call void %llvm.memmove.i64( sbyte* %b, sbyte* getelementptr ([1 x 
sbyte]* %str10, int 0, ulong 0), ulong 1, uint 1 )
+   ret void
+ }
+ 
+ declare void %llvm.memmove.i64(sbyte*, sbyte*, ulong, uint)



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/add.ll

2006-11-07 Thread Andrew Lenharth


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

add.ll updated: 1.1 -> 1.2
---
Log message:

Fix this test

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

 add.ll |   28 ++--
 1 files changed, 14 insertions(+), 14 deletions(-)


Index: llvm/test/Regression/CodeGen/Alpha/add.ll
diff -u llvm/test/Regression/CodeGen/Alpha/add.ll:1.1 
llvm/test/Regression/CodeGen/Alpha/add.ll:1.2
--- llvm/test/Regression/CodeGen/Alpha/add.ll:1.1   Tue Oct 31 13:50:55 2006
+++ llvm/test/Regression/CodeGen/Alpha/add.ll   Tue Nov  7 10:32:55 2006
@@ -1,19 +1,19 @@
 ;test all the shifted and signextending adds and subs with and without consts
 
-; RUN: llvm-as < %s | llc -march=alpha | grep 'addl' |wc -l |grep 2
-; RUN: llvm-as < %s | llc -march=alpha | grep 'addq' |wc -l |grep 2
-; RUN: llvm-as < %s | llc -march=alpha | grep 'subl' |wc -l |grep 2
-; RUN: llvm-as < %s | llc -march=alpha | grep 'subq' |wc -l |grep 1
-; RUN: llvm-as < %s | llc -march=alpha | grep 'lda $0,-100($16)' |wc -l |grep 1
-
-; RUN: llvm-as < %s | llc -march=alpha | grep 's4addl' |wc -l |grep 2
-; RUN: llvm-as < %s | llc -march=alpha | grep 's8addl' |wc -l |grep 2
-; RUN: llvm-as < %s | llc -march=alpha | grep 's4addq' |wc -l |grep 2
-; RUN: llvm-as < %s | llc -march=alpha | grep 's8addq' |wc -l |grep 2
-
-; RUN: llvm-as < %s | llc -march=alpha | grep 's4subl' |wc -l |grep 2
-; RUN: llvm-as < %s | llc -march=alpha | grep 's8subl' |wc -l |grep 2
-; RUN: llvm-as < %s | llc -march=alpha | grep 's4subq' |wc -l |grep 2
+; RUN: llvm-as < %s | llc -march=alpha | grep 'addl' |wc -l |grep 2 &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 'addq' |wc -l |grep 2 &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 'subl' |wc -l |grep 2 &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 'subq' |wc -l |grep 1 &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 'lda $0,-100($16)' |wc -l |grep 
1 &&
+
+; RUN: llvm-as < %s | llc -march=alpha | grep 's4addl' |wc -l |grep 2 &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 's8addl' |wc -l |grep 2 &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 's4addq' |wc -l |grep 2 &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 's8addq' |wc -l |grep 2 &&
+
+; RUN: llvm-as < %s | llc -march=alpha | grep 's4subl' |wc -l |grep 2 &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 's8subl' |wc -l |grep 2 &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 's4subq' |wc -l |grep 2 &&
 ; RUN: llvm-as < %s | llc -march=alpha | grep 's8subq' |wc -l |grep 2
 
 implementation   ; Functions:



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


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

2006-11-07 Thread Chris Lattner


Changes in directory llvm-test:

Makefile.programs updated: 1.236 -> 1.237
---
Log message:

disable majik-f00


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

 Makefile.programs |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)


Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.236 llvm-test/Makefile.programs:1.237
--- llvm-test/Makefile.programs:1.236   Tue Nov  7 01:19:03 2006
+++ llvm-test/Makefile.programs Tue Nov  7 11:57:53 2006
@@ -193,8 +193,7 @@
 endif#DISABLE_DIFFS
 
 ifeq ($(ARCH),PowerPC)
-LLCBETAOPTION := -enable-majik-f00
-#--enable-tail-merge
+LLCBETAOPTION := --enable-tail-merge
 #-regalloc=local -fast
 endif
 ifeq ($(ARCH),Alpha)
@@ -205,8 +204,7 @@
 LLCBETAOPTION := -sched=simple 
 endif
 ifeq ($(ARCH),x86)
-LLCBETAOPTION := -enable-majik-f00
-#--enable-tail-merge
+LLCBETAOPTION := --enable-tail-merge
 #-regalloc=local -fast
 endif
 ifeq ($(ARCH),Sparc)



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


[llvm-commits] CVS: llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c

2006-11-07 Thread Chris Lattner


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

dec_viterbi_F.c updated: 1.2 -> 1.3
---
Log message:

patch by Anton, which 'fixes viterbi algorithm on coderates other than 1/2'.

This shouldn't affect performance.


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

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


Index: llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c
diff -u llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c:1.2 
llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c:1.3
--- llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c:1.2  Tue Oct 
 3 18:31:21 2006
+++ llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c  Tue Nov  7 
12:13:00 2006
@@ -55,10 +55,6 @@
   fflush(stdout);
 }
 #endif /* 0 */
-if (i_punct == param->n_in) {
-  i_punct = 0; 
-}
-
 memcpy(Metr0, Metr, Metr_mem->length*sizeof(double));
 memcpy(Metr1, Metr, Metr_mem->length*sizeof(double));
 
@@ -129,6 +125,10 @@
 history[i][j] = history_new[i][j];
   }
 }
+
+if (++i_punct == param->n_in) {
+  i_punct = 0; 
+}
   }
 
   bit_stream->data = (unsigned char*)realloc(bit_stream->data, 
bv*sizeof(unsigned char));



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


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

2006-11-07 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.191 -> 1.192
---
Log message:

Enable improved spilling costs by default.  This speeds up viterbi on x86
by 40%, FreeBench/fourinarow by 20%, and many other programs 10-25%.

On PPC, this speeds up fourinarow by 18%, and probably other things as well.



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

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


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.191 
llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.192
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.191 Tue Nov  7 06:25:45 2006
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp   Tue Nov  7 12:04:58 2006
@@ -59,9 +59,6 @@
   EnableJoining("join-liveintervals",
 cl::desc("Coallesce copies (default=true)"),
 cl::init(true));
-  static cl::opt
-  EnableReweight("enable-majik-f00");
-  
 }
 
 void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
@@ -221,16 +218,14 @@
   if (isZeroLengthInterval(&LI))
 LI.weight = HUGE_VALF;
   
-  if (EnableReweight) {
-// Divide the weight of the interval by its size.  This encourages 
-// spilling of intervals that are large and have few uses, and
-// discourages spilling of small intervals with many uses.
-unsigned Size = 0;
-for (LiveInterval::iterator II = LI.begin(), E = LI.end(); II != 
E;++II)
-  Size += II->end - II->start;
+  // Divide the weight of the interval by its size.  This encourages 
+  // spilling of intervals that are large and have few uses, and
+  // discourages spilling of small intervals with many uses.
+  unsigned Size = 0;
+  for (LiveInterval::iterator II = LI.begin(), E = LI.end(); II != E;++II)
+Size += II->end - II->start;
   
-LI.weight /= Size;
-  }
+  LI.weight /= Size;
 }
   }
 



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


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

2006-11-07 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

README.txt updated: 1.103 -> 1.104
---
Log message:

add a note from viterbi


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

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


Index: llvm/lib/Target/PowerPC/README.txt
diff -u llvm/lib/Target/PowerPC/README.txt:1.103 
llvm/lib/Target/PowerPC/README.txt:1.104
--- llvm/lib/Target/PowerPC/README.txt:1.103Fri Oct 27 17:02:19 2006
+++ llvm/lib/Target/PowerPC/README.txt  Tue Nov  7 12:30:21 2006
@@ -11,6 +11,35 @@
 
 ===-===
 
+We compile the hottest inner loop of viterbi to:
+
+li r6, 0
+b LBB1_84   ;bb432.i
+LBB1_83:;bb420.i
+lbzx r8, r5, r7
+addi r6, r7, 1
+stbx r8, r4, r7
+LBB1_84:;bb432.i
+mr r7, r6
+cmplwi cr0, r7, 143
+bne cr0, LBB1_83;bb420.i
+
+The CBE manages to produce:
+
+   li r0, 143
+   mtctr r0
+loop:
+   lbzx r2, r2, r11
+   stbx r0, r2, r9
+   addi r2, r2, 1
+   bdz later
+   b loop
+
+This could be much better (bdnz instead of bdz) but it still beats us.  If we
+produced this with bdnz, the loop would be a single dispatch group.
+
+===-===
+
 Compile:
 
 void foo(int *P) {



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


[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h Passes.h

2006-11-07 Thread Jim Laskey


Changes in directory llvm/include/llvm/CodeGen:

MachineDebugInfo.h updated: 1.44 -> 1.45
Passes.h updated: 1.21 -> 1.22
---
Log message:

1. Add a pass to fold debug label instructions so a debug info client can detect
empty ranges.

2. Reorg how MachineDebugInfo maintains changes to debug labels.

3. Have dwarf writer use debug label info to simplify scopes and source line
coorespondence.

4. Revert the merging of compile units until I can get the bugs ironed out.



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

 MachineDebugInfo.h |   36 +---
 Passes.h   |5 +
 2 files changed, 30 insertions(+), 11 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h
diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.44 
llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.45
--- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.44   Tue Oct 24 06:50:43 2006
+++ llvm/include/llvm/CodeGen/MachineDebugInfo.hTue Nov  7 13:33:46 2006
@@ -969,8 +969,11 @@
   // Lines - List of of source line correspondence.
   std::vector Lines;
   
-  // LabelID - Current number assigned to unique label numbers.
-  unsigned LabelID;
+  // LabelIDList - One entry per assigned label.  Normally the entry is equal 
to
+  // the list index(+1).  If the entry is zero then the label has been deleted.
+  // Any other value indicates the label has been deleted by is mapped to
+  // another label.
+  std::vector LabelIDList;
   
   // ScopeMap - Tracks the scopes in the current function.
   std::map ScopeMap;
@@ -979,10 +982,6 @@
   //
   DebugScope *RootScope;
   
-  // DeletedLabelIDs - Sorted list of label IDs that have been removed from the
-  // module.
-  std::vector DeletedLabelIDs;
-  
   // FrameMoves - List of moves done by a function's prolog.  Used to construct
   // frame maps by debug consumers.
   std::vector FrameMoves;
@@ -1026,7 +1025,11 @@
   
   /// NextLabelID - Return the next unique label id.
   ///
-  unsigned NextLabelID() { return ++LabelID; }
+  unsigned NextLabelID() {
+unsigned ID = LabelIDList.size() + 1;
+LabelIDList.push_back(ID);
+return ID;
+  }
   
   /// RecordLabel - Records location information and associates it with a
   /// debug label.  Returns a unique label ID used to generate a label and 
@@ -1035,11 +1038,22 @@
   
   /// InvalidateLabel - Inhibit use of the specified label # from
   /// MachineDebugInfo, for example because the code was deleted.
-  void InvalidateLabel(unsigned LabelID);
+  void InvalidateLabel(unsigned LabelID) {
+// Remap to zero to indicate deletion.
+RemapLabel(LabelID, 0);
+  }
+
+  /// RemapLabel - Indicate that a label has been merged into another.
+  ///
+  void RemapLabel(unsigned OldLabelID, unsigned NewLabelID) {
+LabelIDList[OldLabelID - 1] = NewLabelID;
+  }
   
-  /// isLabelValid - Check to make sure the label is still valid before
-  /// attempting to use.
-  bool isLabelValid(unsigned LabelID);
+  /// MappedLabel - Find out the label's final ID.  Zero indicates deletion.
+  /// ID != Mapped ID indicates that the label was folded into another label.
+  unsigned MappedLabel(unsigned LabelID) const {
+return LabelIDList[LabelID - 1];
+  }
 
   /// RecordSource - Register a source file with debug info. Returns an source
   /// ID.


Index: llvm/include/llvm/CodeGen/Passes.h
diff -u llvm/include/llvm/CodeGen/Passes.h:1.21 
llvm/include/llvm/CodeGen/Passes.h:1.22
--- llvm/include/llvm/CodeGen/Passes.h:1.21 Sun Oct 23 23:13:21 2005
+++ llvm/include/llvm/CodeGen/Passes.h  Tue Nov  7 13:33:46 2006
@@ -81,6 +81,11 @@
   /// branches.
   FunctionPass *createBranchFoldingPass();
 
+  /// DebugLabelFoldingPass - This pass prunes out redundant debug labels.  
This
+  /// allows a debug emitter to determine if the range of two labels is empty,
+  /// by seeing if the labels map to the same reduced label.
+  FunctionPass *createDebugLabelFoldingPass();
+
   /// MachineCodeDeletion Pass - This pass deletes all of the machine code for
   /// the current function, which should happen after the function has been
   /// emitted to a .s file or to memory.



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


[llvm-commits] CVS: nightlytest-serverside/ProgramResults.php

2006-11-07 Thread Jim Laskey


Changes in directory nightlytest-serverside:

ProgramResults.php updated: 1.100 -> 1.101
---
Log message:

Fix heading selector.

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

 ProgramResults.php |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: nightlytest-serverside/ProgramResults.php
diff -u nightlytest-serverside/ProgramResults.php:1.100 
nightlytest-serverside/ProgramResults.php:1.101
--- nightlytest-serverside/ProgramResults.php:1.100 Fri Nov  3 13:52:02 2006
+++ nightlytest-serverside/ProgramResults.php   Tue Nov  7 14:00:07 2006
@@ -36,7 +36,7 @@
 $category_array=array("GCCAS","Bytecode","LLC compile","LLC\-BETA compile",
  "JIT codegen","GCC","CBE","LLC",
  "LLC\-BETA","JIT","GCC\/\s*CBE", "GCC\/\s*LLC",
- "GCC\/\s*LLC\-BETA","LLC\/ LLC\-BETA");
+ "GCC\/\s*LLC\-BETA","LLC\/\s*LLC\-BETA");
 $category_print_array=array("GCCAS","Bytecode","LLC compile","LLC-BETA 
compile",
  "JIT codegen","GCC","CBE","LLC",
  "LLC-BETA","JIT","GCC/ CBE", "GCC/ LLC",



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


[llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp LLVMTargetMachine.cpp DwarfWriter.cpp

2006-11-07 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

MachineDebugInfo.cpp updated: 1.54 -> 1.55
LLVMTargetMachine.cpp updated: 1.4 -> 1.5
DwarfWriter.cpp updated: 1.98 -> 1.99
---
Log message:

1. Add a pass to fold debug label instructions so a debug info client can detect
empty ranges.

2. Reorg how MachineDebugInfo maintains changes to debug labels.

3. Have dwarf writer use debug label info to simplify scopes and source line
coorespondence.

4. Revert the merging of compile units until I can get the bugs ironed out.



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

 DwarfWriter.cpp   |   37 +-
 LLVMTargetMachine.cpp |3 +
 MachineDebugInfo.cpp  |  102 ++
 3 files changed, 94 insertions(+), 48 deletions(-)


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.54 
llvm/lib/CodeGen/MachineDebugInfo.cpp:1.55
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.54  Mon Nov  6 07:20:29 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp   Tue Nov  7 13:33:46 2006
@@ -10,7 +10,11 @@
 #include "llvm/CodeGen/MachineDebugInfo.h"
 
 #include "llvm/Constants.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineLocation.h"
+#include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/Target/TargetMachine.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/Intrinsics.h"
@@ -1448,10 +1452,9 @@
 , Directories()
 , SourceFiles()
 , Lines()
-, LabelID(0)
+, LabelIDList()
 , ScopeMap()
 , RootScope(NULL)
-, DeletedLabelIDs()
 , FrameMoves()
 {}
 MachineDebugInfo::~MachineDebugInfo() {
@@ -1544,35 +1547,6 @@
   return ID;
 }
 
-static bool LabelUIDComparison(const SourceLineInfo &LI, unsigned UID) {
-  return LI.getLabelID() < UID;
-}
- 
-/// InvalidateLabel - Inhibit use of the specified label # from
-/// MachineDebugInfo, for example because the code was deleted.
-void MachineDebugInfo::InvalidateLabel(unsigned LabelID) {
-  // Check source line list first.  SourceLineInfo is sorted by LabelID.
-  std::vector::iterator I =
-std::lower_bound(Lines.begin(), Lines.end(), LabelID, LabelUIDComparison);
-  if (I != Lines.end() && I->getLabelID() == LabelID) {
-Lines.erase(I);
-return;
-  }
-  
-  // Otherwise add for use by isLabelValid.
-  std::vector::iterator J =
-std::lower_bound(DeletedLabelIDs.begin(), DeletedLabelIDs.end(), LabelID);
-  DeletedLabelIDs.insert(J, LabelID);
-}
-
-/// isLabelValid - Check to make sure the label is still valid before
-/// attempting to use.
-bool MachineDebugInfo::isLabelValid(unsigned LabelID) {
-  std::vector::iterator I =
-std::lower_bound(DeletedLabelIDs.begin(), DeletedLabelIDs.end(), LabelID);
-  return I == DeletedLabelIDs.end() || *I != LabelID;
-}
-
 /// RecordSource - Register a source file with debug info. Returns an source
 /// ID.
 unsigned MachineDebugInfo::RecordSource(const std::string &Directory,
@@ -1642,4 +1616,70 @@
   return Slot;
 }
 
+//===--===//
+/// DebugLabelFolding pass - This pass prunes out redundant debug labels.  This
+/// allows a debug emitter to determine if the range of two labels is empty,
+/// by seeing if the labels map to the same reduced label.
+
+namespace llvm {
+
+struct DebugLabelFolder : public MachineFunctionPass {
+  virtual bool runOnMachineFunction(MachineFunction &MF);
+  virtual const char *getPassName() const { return "Debug Label Folder"; }
+};
+
+bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
+  // Get machine debug info.
+  MachineDebugInfo *MDI = getAnalysisToUpdate();
+  if (!MDI) return false;
+  // Get target instruction info.
+  const TargetInstrInfo *TII = MF.getTarget().getInstrInfo();
+  if (!TII) return false;
+  // Get target version of the debug label opcode.
+  unsigned DWARF_LABELOpc = TII->getDWARF_LABELOpcode();
+  if (!DWARF_LABELOpc) return false;
+  
+  // Track if change is made.
+  bool MadeChange = false;
+  // No prior label to begin.
+  unsigned PriorLabel = 0;
+  
+  // Iterate through basic blocks.
+  for (MachineFunction::iterator BB = MF.begin(), E = MF.end();
+   BB != E; ++BB) {
+// Iterate through instructions.
+for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) 
{
+  // Is it a debug label.
+  if ((unsigned)I->getOpcode() == DWARF_LABELOpc) {
+// The label ID # is always operand #0, an immediate.
+unsigned NextLabel = I->getOperand(0).getImm();
+
+// If there was an immediate prior label.
+if (PriorLabel) {
+  // Remap the current label to prior label.
+  MDI->RemapLabel(NextLabel, PriorLabel);
+  // Delete the current label.
+  I = BB->erase(I);
+  // Indicate a change has been made.
+  MadeChange = true;
+  continue;
+} else {
+  // Start a new round.
+  Pr

[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp

2006-11-07 Thread Andrew Lenharth


Changes in directory llvm/lib/Analysis/DataStructure:

TopDownClosure.cpp updated: 1.92 -> 1.93
---
Log message:

debug type for DSA TD

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

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


Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.92 
llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.93
--- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.92 Fri Oct 13 
12:38:22 2006
+++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp  Tue Nov  7 14:35:11 2006
@@ -13,7 +13,7 @@
 // like pointer analysis.
 //
 
//===--===//
-
+#define DEBUG_TYPE "td_dsa"
 #include "llvm/Analysis/DataStructure/DataStructure.h"
 #include "llvm/Module.h"
 #include "llvm/DerivedTypes.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/DataStructure/DataStructure.cpp

2006-11-07 Thread Andrew Lenharth


Changes in directory llvm/lib/Analysis/DataStructure:

DataStructure.cpp updated: 1.248 -> 1.249
---
Log message:

Allow loop detection during debug in forwarding nodes, and revert auxcall patch 
as it make 176.gcc untenable

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

 DataStructure.cpp |   28 
 1 files changed, 20 insertions(+), 8 deletions(-)


Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.248 
llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.249
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.248 Thu Nov  2 
14:25:49 2006
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp   Tue Nov  7 14:36:02 2006
@@ -62,7 +62,17 @@
 
 DSNode *DSNodeHandle::HandleForwarding() const {
   assert(N->isForwarding() && "Can only be invoked if forwarding!");
-
+  DEBUG(
+{ //assert not looping
+  DSNode* NH = N;
+  std::set seen;
+  while(NH && NH->isForwarding()) {
+assert(seen.find(NH) == seen.end() && "Loop detected");
+seen.insert(NH);
+NH = NH->ForwardNH.N;
+  }
+}
+);
   // Handle node forwarding here!
   DSNode *Next = N->ForwardNH.getNode();  // Cause recursive shrinkage
   Offset += N->ForwardNH.getOffset();
@@ -421,6 +431,8 @@
 ///
 bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
bool FoldIfIncompatible) {
+  DEBUG(std::cerr << "merging " << *NewTy << " at " << Offset 
+  << " with " << *Ty << "\n");
   const TargetData &TD = getTargetData();
   // Check to make sure the Size member is up-to-date.  Size can be one of the
   // following:
@@ -1595,13 +1607,13 @@
 for (afc_iterator I = Graph.afc_begin(), E = Graph.afc_end(); I!=E; ++I)
   if (SCCFinder.PathExistsToClonedNode(*I))
 AuxCallToCopy.push_back(&*I);
-  else if (I->isIndirectCall()){
-   //If the call node doesn't have any callees, clone it
-   std::vector< Function *> List;
-   I->getCalleeNode()->addFullFunctionList(List);
-   if (!List.size())
- AuxCallToCopy.push_back(&*I);
-   }
+//   else if (I->isIndirectCall()){
+// //If the call node doesn't have any callees, clone it
+// std::vector< Function *> List;
+// I->getCalleeNode()->addFullFunctionList(List);
+// if (!List.size())
+//   AuxCallToCopy.push_back(&*I);
+//}
 
   const DSScalarMap &GSM = Graph.getScalarMap();
   for (DSScalarMap::global_iterator GI = GSM.global_begin(),



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


[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp

2006-11-07 Thread Andrew Lenharth


Changes in directory llvm/lib/Analysis/DataStructure:

Local.cpp updated: 1.158 -> 1.159
---
Log message:

Optionally allow comparison operations from affect DSGraphs

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

 Local.cpp |7 ++-
 1 files changed, 6 insertions(+), 1 deletion(-)


Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.158 
llvm/lib/Analysis/DataStructure/Local.cpp:1.159
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.158 Fri Nov  3 11:43:19 2006
+++ llvm/lib/Analysis/DataStructure/Local.cpp   Tue Nov  7 14:39:05 2006
@@ -40,6 +40,10 @@
 TrackIntegersAsPointers("dsa-track-integers", cl::Hidden,
  cl::desc("If this is set, track integers as potential pointers"));
 
+static cl::opt
+IgnoreSetCC("dsa-ignore-setcc", cl::Hidden,
+ cl::desc("If this is set, do nothing at pointer comparisons"));
+
 static cl::list
 AllocList("dsa-alloc-list",
   cl::value_desc("list"),
@@ -336,7 +340,8 @@
 void GraphBuilder::visitSetCondInst(SetCondInst &SCI) {
   if (!isPointerType(SCI.getOperand(0)->getType()) ||
   isa(SCI.getOperand(1))) return; // Only pointers
-  ScalarMap[SCI.getOperand(0)].mergeWith(getValueDest(*SCI.getOperand(1)));
+  if(!IgnoreSetCC)
+ScalarMap[SCI.getOperand(0)].mergeWith(getValueDest(*SCI.getOperand(1)));
 }
 
 



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


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

2006-11-07 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

MachineDebugInfo.cpp updated: 1.55 -> 1.56
---
Log message:

Missed a label map, reverting till covered.

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

 MachineDebugInfo.cpp |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.55 
llvm/lib/CodeGen/MachineDebugInfo.cpp:1.56
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.55  Tue Nov  7 13:33:46 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp   Tue Nov  7 14:53:05 2006
@@ -1629,6 +1629,9 @@
 };
 
 bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
+  // FIXME - Missing label mapping.
+  return false;
+  
   // Get machine debug info.
   MachineDebugInfo *MDI = getAnalysisToUpdate();
   if (!MDI) 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/PassManager.h

2006-11-07 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.15 -> 1.16
---
Log message:

Add BasicBlockPassManager_New.


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

 PassManager.h |   23 +++
 1 files changed, 23 insertions(+)


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.15 
llvm/include/llvm/PassManager.h:1.16
--- llvm/include/llvm/PassManager.h:1.15Sun Sep  3 23:07:39 2006
+++ llvm/include/llvm/PassManager.h Tue Nov  7 15:31:57 2006
@@ -17,6 +17,9 @@
 #ifndef LLVM_PASSMANAGER_H
 #define LLVM_PASSMANAGER_H
 
+#include "llvm/Pass.h"
+#include 
+
 namespace llvm {
 
 class Pass;
@@ -85,6 +88,26 @@
   bool doFinalization();
 };
 
+/// BasicBlockpassManager_New manages BasicBlockPass. It batches all the
+/// pass together and sequence them to process one basic block before
+/// processing next basic block.
+class BasicBlockPassManager_New: public Pass {
+
+public:
+  BasicBlockPassManager_New() { }
+
+  /// Add a pass into a passmanager queue. 
+  bool addPass(Pass *p);
+  
+  /// Execute all of the passes scheduled for execution.  Keep track of
+  /// whether any of the passes modifies the function, and if so, return true.
+  bool runOnFunction(Function &F);
+
+private:
+  // Collection of pass that are not yet scheduled
+  std::vector PassVector;
+};
+
 } // End llvm namespace
 
 #endif



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

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

Add BasicBlockPassManager_New.


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

 PassManager.cpp |   56 
 1 files changed, 56 insertions(+)


Index: llvm/lib/VMCore/PassManager.cpp
diff -c /dev/null llvm/lib/VMCore/PassManager.cpp:1.1
*** /dev/null   Tue Nov  7 15:32:07 2006
--- llvm/lib/VMCore/PassManager.cpp Tue Nov  7 15:31:57 2006
***
*** 0 
--- 1,56 
+ //===- PassManager.cpp - LLVM Pass Infrastructure Implementation 
--===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by the LLVM research group and is distributed under
+ // the University of Illinois Open Source License. See LICENSE.TXT for 
details.
+ //
+ 
//===--===//
+ //
+ // This file implements the LLVM Pass Manager infrastructure. 
+ //
+ 
//===--===//
+ 
+ 
+ #include "llvm/PassManager.h"
+ #include "llvm/Function.h"
+ #include "llvm/Module.h"
+ 
+ using namespace llvm;
+ 
+ /// BasicBlockPassManager implementation
+ 
+ /// Add pass P into PassVector and return TRUE. If this pass is not
+ /// manageable by this manager then return FALSE.
+ bool
+ BasicBlockPassManager_New::addPass (Pass *P) {
+ 
+   BasicBlockPass *BP = dynamic_cast(P);
+   if (!BP)
+ return false;
+ 
+   // TODO: Check if it suitable to manage P using this BasicBlockPassManager
+   // or we need another instance of BasicBlockPassManager
+ 
+   // Add pass
+   PassVector.push_back(BP);
+   return true;
+ }
+ 
+ /// Execute all of the passes scheduled for execution by invoking 
+ /// runOnBasicBlock method.  Keep track of whether any of the passes modifies 
+ /// the function, and if so, return true.
+ bool
+ BasicBlockPassManager_New::runOnFunction(Function &F) {
+ 
+   bool Changed = false;
+   for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
+ for (std::vector::iterator itr = PassVector.begin(),
+e = PassVector.end(); itr != e; ++itr) {
+   Pass *P = *itr;
+   BasicBlockPass *BP = dynamic_cast(P);
+   Changed |= BP->runOnBasicBlock(*I);
+ }
+   return Changed;
+ }
+ 



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


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

2006-11-07 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

MachineDebugInfo.cpp updated: 1.56 -> 1.57
---
Log message:

Missed a label map, reverting till covered.

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

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


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.56 
llvm/lib/CodeGen/MachineDebugInfo.cpp:1.57
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.56  Tue Nov  7 14:53:05 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp   Tue Nov  7 15:37:31 2006
@@ -1629,9 +1629,6 @@
 };
 
 bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
-  // FIXME - Missing label mapping.
-  return false;
-  
   // Get machine debug info.
   MachineDebugInfo *MDI = getAnalysisToUpdate();
   if (!MDI) return false;



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.1 -> 1.2
---
Log message:

Add FunctionPassManager_New.


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

 PassManager.cpp |   56 
 1 files changed, 56 insertions(+)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.1 llvm/lib/VMCore/PassManager.cpp:1.2
--- llvm/lib/VMCore/PassManager.cpp:1.1 Tue Nov  7 15:31:57 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Nov  7 15:49:50 2006
@@ -54,3 +54,59 @@
   return Changed;
 }
 
+// FunctionPassManager_New implementation
+
+///
+// FunctionPassManager
+
+/// Add pass P into the pass manager queue. If P is a BasicBlockPass then
+/// either use it into active basic block pass manager or create new basic
+/// block pass manager to handle pass P.
+bool
+FunctionPassManager_New::addPass (Pass *P) {
+
+  // If P is a BasicBlockPass then use BasicBlockPassManager_New.
+  if (BasicBlockPass *BP = dynamic_cast(P)) {
+
+if (!activeBBPassManager
+|| !activeBBPassManager->addPass(BP)) {
+
+  activeBBPassManager = new BasicBlockPassManager_New();
+
+  PassVector.push_back(activeBBPassManager);
+  assert (!activeBBPassManager->addPass(BP) &&
+  "Unable to add Pass");
+}
+return true;
+  }
+
+  FunctionPass *FP = dynamic_cast(P);
+  if (!FP)
+return false;
+
+  // TODO: Check if it suitable to manage P using this FunctionPassManager
+  // or we need another instance of BasicBlockPassManager
+
+  PassVector.push_back(FP);
+  activeBBPassManager = NULL;
+  return true;
+}
+
+/// Execute all of the passes scheduled for execution by invoking 
+/// runOnFunction method.  Keep track of whether any of the passes modifies 
+/// the function, and if so, return true.
+bool
+FunctionPassManager_New::runOnModule(Module &M) {
+
+  bool Changed = false;
+  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
+for (std::vector::iterator itr = PassVector.begin(),
+   e = PassVector.end(); itr != e; ++itr) {
+  Pass *P = *itr;
+  FunctionPass *FP = dynamic_cast(P);
+  Changed |= FP->runOnFunction(*I);
+}
+  return Changed;
+}
+
+



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.16 -> 1.17
---
Log message:

Add FunctionPassManager_New.


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

 PassManager.h |   35 +++
 1 files changed, 35 insertions(+)


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.16 
llvm/include/llvm/PassManager.h:1.17
--- llvm/include/llvm/PassManager.h:1.16Tue Nov  7 15:31:57 2006
+++ llvm/include/llvm/PassManager.h Tue Nov  7 15:49:50 2006
@@ -108,6 +108,41 @@
   std::vector PassVector;
 };
 
+/// FunctionPassManager_New manages FunctionPasses and BasicBlockPassManagers.
+/// It batches all function passes and basic block pass managers together and
+/// sequence them to process one function at a time before processing next
+/// function.
+class FunctionPassManager_New:public Pass {
+public:
+  FunctionPassManager_New(ModuleProvider *P) { /* TODO */ }
+  FunctionPassManager_New() { 
+activeBBPassManager = NULL;
+  }
+  ~FunctionPassManager_New() { /* TODO */ };
+ 
+  /// add - Add a pass to the queue of passes to run.  This passes
+  /// ownership of the Pass to the PassManager.  When the
+  /// PassManager_X is destroyed, the pass will be destroyed as well, so
+  /// there is no need to delete the pass. (TODO delete passes.)
+  /// This implies that all passes MUST be allocated with 'new'.
+  void add(Pass *P) { /* TODO*/  }
+
+  /// Add pass into the pass manager queue.
+  bool addPass(Pass *P);
+
+  /// Execute all of the passes scheduled for execution.  Keep
+  /// track of whether any of the passes modifies the function, and if
+  /// so, return true.
+  bool runOnModule(Module &M);
+
+private:
+  // Collection of pass that are not yet scheduled
+  std::vector PassVector;
+ 
+  // Active Pass Managers
+  BasicBlockPassManager_New *activeBBPassManager;
+};
+
 } // End llvm namespace
 
 #endif



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


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

2006-11-07 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

MachineDebugInfo.cpp updated: 1.57 -> 1.58
---
Log message:

Accidently reran commit.


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

 MachineDebugInfo.cpp |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.57 
llvm/lib/CodeGen/MachineDebugInfo.cpp:1.58
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.57  Tue Nov  7 15:37:31 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp   Tue Nov  7 15:58:55 2006
@@ -1629,6 +1629,9 @@
 };
 
 bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
+  // FIXME - Missing label mapping.
+  return false;
+  
   // Get machine debug info.
   MachineDebugInfo *MDI = getAnalysisToUpdate();
   if (!MDI) 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/PassManager.h

2006-11-07 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.17 -> 1.18
---
Log message:

Add ModulePassManager_New.


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

 PassManager.h |   23 +++
 1 files changed, 23 insertions(+)


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.17 
llvm/include/llvm/PassManager.h:1.18
--- llvm/include/llvm/PassManager.h:1.17Tue Nov  7 15:49:50 2006
+++ llvm/include/llvm/PassManager.h Tue Nov  7 16:03:15 2006
@@ -143,6 +143,29 @@
   BasicBlockPassManager_New *activeBBPassManager;
 };
 
+/// FunctionPassManager_New manages FunctionPasses.
+/// It batches all Module passes  passes and function pass managers together 
and
+/// sequence them to process one module.
+class ModulePassManager_New: public Pass {
+ 
+public:
+  ModulePassManager_New() { activeFunctionPassManager = NULL; }
+  
+  /// Add a pass into a passmanager queue. 
+  bool addPass(Pass *p);
+  
+  /// run - Execute all of the passes scheduled for execution.  Keep track of
+  /// whether any of the passes modifies the module, and if so, return true.
+  bool runOnModule(Module &M);
+  
+private:
+  // Collection of pass that are not yet scheduled
+  std::vector PassVector;
+  
+  // Active Pass Manager
+  FunctionPassManager_New *activeFunctionPassManager;
+};
+
 } // End llvm namespace
 
 #endif



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.2 -> 1.3
---
Log message:

Add ModulePassManager_New.


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

 PassManager.cpp |   55 ++-
 1 files changed, 54 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.2 llvm/lib/VMCore/PassManager.cpp:1.3
--- llvm/lib/VMCore/PassManager.cpp:1.2 Tue Nov  7 15:49:50 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Nov  7 16:03:15 2006
@@ -85,7 +85,7 @@
 return false;
 
   // TODO: Check if it suitable to manage P using this FunctionPassManager
-  // or we need another instance of BasicBlockPassManager
+  // or we need another instance of FunctionPassManager
 
   PassVector.push_back(FP);
   activeBBPassManager = NULL;
@@ -110,3 +110,56 @@
 }
 
 
+// ModulePassManager implementation
+
+/// Add P into pass vector if it is manageble. If P is a FunctionPass
+/// then use FunctionPassManager_New to manage it. Return FALSE if P
+/// is not manageable by this manager.
+bool
+ModulePassManager_New::addPass (Pass *P) {
+
+  // If P is FunctionPass then use function pass maanager.
+  if (FunctionPass *FP = dynamic_cast(P)) {
+
+activeFunctionPassManager = NULL;
+
+if (!activeFunctionPassManager
+|| !activeFunctionPassManager->addPass(P)) {
+
+  activeFunctionPassManager = new FunctionPassManager_New();
+
+  PassVector.push_back(activeFunctionPassManager);
+  assert (!activeFunctionPassManager->addPass(FP) &&
+  "Unable to add Pass");
+}
+return true;
+  }
+
+  ModulePass *MP = dynamic_cast(P);
+  if (!MP)
+return false;
+
+  // TODO: Check if it suitable to manage P using this ModulePassManager
+  // or we need another instance of ModulePassManager
+
+  PassVector.push_back(MP);
+  activeFunctionPassManager = NULL;
+  return true;
+}
+
+
+/// Execute all of the passes scheduled for execution by invoking 
+/// runOnModule method.  Keep track of whether any of the passes modifies 
+/// the module, and if so, return true.
+bool
+ModulePassManager_New::runOnModule(Module &M) {
+  bool Changed = false;
+  for (std::vector::iterator itr = PassVector.begin(),
+ e = PassVector.end(); itr != e; ++itr) {
+Pass *P = *itr;
+ModulePass *MP = dynamic_cast(P);
+Changed |= MP->runOnModule(M);
+  }
+  return Changed;
+}
+



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


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

2006-11-07 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.287 -> 1.288
X86ISelLowering.h updated: 1.78 -> 1.79
X86InstrSSE.td updated: 1.169 -> 1.170
---
Log message:

Fixed a bug which causes x86 be to incorrectly match
shuffle v, undef, <2, ?, 3, ?>
to movhlps
It should match to unpckhps instead.

Added proper matching code for
shuffle v, undef, <2, 3, 2, 3>


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

 X86ISelLowering.cpp |   18 +-
 X86ISelLowering.h   |5 +
 X86InstrSSE.td  |   12 
 3 files changed, 30 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.287 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.288
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.287   Thu Nov  2 14:25:49 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Nov  7 16:14:24 2006
@@ -2582,6 +2582,22 @@
  isUndefOrEqual(N->getOperand(3), 3);
 }
 
+/// isMOVHLPS_v_undef_Mask - Special case of isMOVHLPSMask for canonical form
+/// of vector_shuffle v, v, <2, 3, 2, 3>, i.e. vector_shuffle v, undef,
+/// <2, 3, 2, 3>
+bool X86::isMOVHLPS_v_undef_Mask(SDNode *N) {
+  assert(N->getOpcode() == ISD::BUILD_VECTOR);
+
+  if (N->getNumOperands() != 4)
+return false;
+
+  // Expect bit0 == 2, bit1 == 3, bit2 == 2, bit3 == 3
+  return isUndefOrEqual(N->getOperand(0), 2) &&
+ isUndefOrEqual(N->getOperand(1), 3) &&
+ isUndefOrEqual(N->getOperand(2), 2) &&
+ isUndefOrEqual(N->getOperand(3), 3);
+}
+
 /// isMOVLPMask - Return true if the specified VECTOR_SHUFFLE operand
 /// specifies a shuffle of elements that is suitable for input to MOVLP{S|D}.
 bool X86::isMOVLPMask(SDNode *N) {
@@ -3724,7 +3740,7 @@
 SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT,
  &IdxVec[0], IdxVec.size());
 Vec = DAG.getNode(ISD::VECTOR_SHUFFLE, Vec.getValueType(),
-  Vec, Vec, Mask);
+  Vec, DAG.getNode(ISD::UNDEF, Vec.getValueType()), Mask);
 return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, VT, Vec,
DAG.getConstant(0, getPointerTy()));
   } else if (MVT::getSizeInBits(VT) == 64) {


Index: llvm/lib/Target/X86/X86ISelLowering.h
diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.78 
llvm/lib/Target/X86/X86ISelLowering.h:1.79
--- llvm/lib/Target/X86/X86ISelLowering.h:1.78  Tue Oct 31 14:13:11 2006
+++ llvm/lib/Target/X86/X86ISelLowering.h   Tue Nov  7 16:14:24 2006
@@ -186,6 +186,11 @@
/// specifies a shuffle of elements that is suitable for input to MOVHLPS.
bool isMOVHLPSMask(SDNode *N);
 
+   /// isMOVHLPS_v_undef_Mask - Special case of isMOVHLPSMask for canonical 
form
+   /// of vector_shuffle v, v, <2, 3, 2, 3>, i.e. vector_shuffle v, undef,
+   /// <2, 3, 2, 3>
+   bool isMOVHLPS_v_undef_Mask(SDNode *N);
+
/// isMOVLPMask - Return true if the specified VECTOR_SHUFFLE operand
/// specifies a shuffle of elements that is suitable for input to 
MOVLP{S|D}.
bool isMOVLPMask(SDNode *N);


Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.169 
llvm/lib/Target/X86/X86InstrSSE.td:1.170
--- llvm/lib/Target/X86/X86InstrSSE.td:1.169Fri Nov  3 17:48:56 2006
+++ llvm/lib/Target/X86/X86InstrSSE.td  Tue Nov  7 16:14:24 2006
@@ -110,6 +110,10 @@
   return X86::isMOVHLPSMask(N);
 }]>;
 
+def MOVHLPS_v_undef_shuffle_mask : PatLeaf<(build_vector), [{
+  return X86::isMOVHLPS_v_undef_Mask(N);
+}]>;
+
 def MOVHP_shuffle_mask : PatLeaf<(build_vector), [{
   return X86::isMOVHPMask(N);
 }]>;
@@ -1987,16 +1991,16 @@
   MOVHLPS_shuffle_mask)),
   (MOVHLPSrr VR128:$src1, VR128:$src2)>;
 
-// vector_shuffle v1, undef <2, 3, ?, ?> using MOVHLPS
+// vector_shuffle v1, undef <2, ?, ?, ?> using MOVHLPS
 def : Pat<(v4f32 (vector_shuffle VR128:$src1, (undef),
-  UNPCKH_shuffle_mask)),
+  MOVHLPS_v_undef_shuffle_mask)),
   (MOVHLPSrr VR128:$src1, VR128:$src1)>;
 def : Pat<(v4i32 (vector_shuffle VR128:$src1, (undef),
-  UNPCKH_shuffle_mask)),
+  MOVHLPS_v_undef_shuffle_mask)),
   (MOVHLPSrr VR128:$src1, VR128:$src1)>;
 }
 
-  let AddedComplexity = 20 in {
+let AddedComplexity = 20 in {
 // vector_shuffle v1, (load v2) <4, 5, 2, 3> using MOVLPS
 // vector_shuffle v1, (load v2) <0, 1, 4, 5> using MOVHPS
 def : Pat<(v4f32 (vector_shuffle VR128:$src1, (loadv4f32 addr:$src2),



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

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

Add PassManager_New.


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

 PassManager.cpp |   41 +
 1 files changed, 41 insertions(+)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.3 llvm/lib/VMCore/PassManager.cpp:1.4
--- llvm/lib/VMCore/PassManager.cpp:1.3 Tue Nov  7 16:03:15 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Nov  7 16:23:34 2006
@@ -163,3 +163,44 @@
   return Changed;
 }
 
+/// Schedule all passes from the queue by adding them in their
+/// respective manager's queue. 
+void
+PassManager_New::schedulePasses() {
+  /* TODO */
+}
+
+/// Add pass P to the queue of passes to run.
+void
+PassManager_New::add(Pass *P) {
+  /* TODO */
+}
+
+// PassManager_New implementation
+/// Add P into active pass manager or use new module pass manager to
+/// manage it.
+bool
+PassManager_New::addPass (Pass *P) {
+
+  if (!activeManager) {
+activeManager = new ModulePassManager_New();
+PassManagers.push_back(activeManager);
+  }
+
+  return activeManager->addPass(P);
+}
+
+/// run - Execute all of the passes scheduled for execution.  Keep track of
+/// whether any of the passes modifies the module, and if so, return true.
+bool
+PassManager_New::run(Module &M) {
+
+  schedulePasses();
+  bool Changed = false;
+  for (std::vector::iterator itr = 
PassManagers.begin(),
+ e = PassManagers.end(); itr != e; ++itr) {
+ModulePassManager_New *pm = *itr;
+Changed |= pm->runOnModule(M);
+  }
+  return Changed;
+}



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.19 -> 1.20
---
Log message:

Add PassManager_New.


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

 PassManager.h |   34 ++
 1 files changed, 34 insertions(+)


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.19 
llvm/include/llvm/PassManager.h:1.20
--- llvm/include/llvm/PassManager.h:1.19Tue Nov  7 16:04:53 2006
+++ llvm/include/llvm/PassManager.h Tue Nov  7 16:23:34 2006
@@ -166,6 +166,40 @@
   FunctionPassManager_New *activeFunctionPassManager;
 };
 
+/// PassManager_New manages ModulePassManagers
+class PassManager_New: public Pass {
+
+public:
+
+  /// add - Add a pass to the queue of passes to run.  This passes ownership of
+  /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
+  /// will be destroyed as well, so there is no need to delete the pass.  This
+  /// implies that all passes MUST be allocated with 'new'.
+  void add(Pass *P);
+ 
+  /// run - Execute all of the passes scheduled for execution.  Keep track of
+  /// whether any of the passes modifies the module, and if so, return true.
+  bool run(Module &M);
+
+private:
+ 
+  /// Add a pass into a passmanager queue. This is used by schedulePasses
+  bool addPass(Pass *p);
+
+  /// Schedule all passes collected in pass queue using add(). Add all the
+  /// schedule passes into various manager's queue using addPass().
+  void schedulePasses();
+
+  // Collection of pass managers
+  std::vector PassManagers;
+
+  // Collection of pass that are not yet scheduled
+  std::vector PassVector;
+  
+  // Active Pass Manager
+  ModulePassManager_New *activeManager;
+};
+
 } // End llvm namespace
 
 #endif



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.20 -> 1.21
---
Log message:

Introduce PassManagerAnalysisHelper.


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

 PassManager.h |   30 ++
 1 files changed, 30 insertions(+)


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.20 
llvm/include/llvm/PassManager.h:1.21
--- llvm/include/llvm/PassManager.h:1.20Tue Nov  7 16:23:34 2006
+++ llvm/include/llvm/PassManager.h Tue Nov  7 16:35:17 2006
@@ -88,6 +88,36 @@
   bool doFinalization();
 };
 
+/// PassManagerAnalysisHelper helpes pass manager analysis required by
+/// the managed passes.
+class PassManagerAnalysisHelper {
+
+public:
+
+  /// Return TRUE IFF pass P's required analysis set does not required new
+  /// manager.
+  bool manageablePass(Pass *P);
+
+  /// Return TRUE iff AnalysisID AID is currently available.
+  bool analysisCurrentlyAvailable(AnalysisID AID);
+
+  /// Augment RequiredSet by adding analysis required by pass P.
+  void noteDownRequiredAnalysis(Pass *P);
+
+  /// Remove AnalysisID from the RequiredSet
+  void removeAnalysis(AnalysisID AID);
+
+  /// Remove Analysis that is not preserved by the pass
+  void removeNotPreservedAnalysis(Pass *P);
+  
+  /// Remove dead passes
+  void removeDeadPasses() { /* TODO : Implement */ }
+
+private:
+   // Required set of analysis for the passes managed by this manager
+  std::vector RequiredSet;
+};
+
 /// BasicBlockpassManager_New manages BasicBlockPass. It batches all the
 /// pass together and sequence them to process one basic block before
 /// processing next basic block.



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

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

Introduce PassManagerAnalysisHelper.


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

 PassManager.cpp |   40 
 1 files changed, 40 insertions(+)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.4 llvm/lib/VMCore/PassManager.cpp:1.5
--- llvm/lib/VMCore/PassManager.cpp:1.4 Tue Nov  7 16:23:34 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Nov  7 16:35:17 2006
@@ -18,6 +18,46 @@
 
 using namespace llvm;
 
+// PassManagerAnalysisHelper implementation
+
+/// Return TRUE IFF pass P's required analysis set does not required new
+/// manager.
+bool PassManagerAnalysisHelper::manageablePass(Pass *P) {
+
+  AnalysisUsage AnUsage;
+  P->getAnalysisUsage(AnUsage);
+
+  // If this pass is not preserving information that is required by the other 
passes
+  // managed by this manager then use new manager
+  // TODO
+  return true;
+}
+
+/// Return TRUE iff AnalysisID AID is currently available.
+bool PassManagerAnalysisHelper::analysisCurrentlyAvailable(AnalysisID AID) {
+
+  // TODO
+  return false;
+}
+
+/// Augment RequiredSet by adding analysis required by pass P.
+void PassManagerAnalysisHelper::noteDownRequiredAnalysis(Pass *P) {
+
+  // TODO
+}
+
+/// Remove AnalysisID from the RequiredSet
+void PassManagerAnalysisHelper::removeAnalysis(AnalysisID AID) {
+
+  // TODO
+}
+
+/// Remove Analyss not preserved by Pass P
+void PassManagerAnalysisHelper::removeNotPreservedAnalysis(Pass *P) {
+
+  // TODO
+}
+
 /// BasicBlockPassManager implementation
 
 /// Add pass P into PassVector and return TRUE. If this pass is not



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


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

2006-11-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

ScalarReplAggregates.cpp updated: 1.47 -> 1.48
---
Log message:

scalarrepl should not split the two elements of the vsiidx array:
int func(vFloat v0, vFloat v1) {
int ii;
vSInt32 vsiidx[2];
vsiidx[0] = _mm_cvttps_epi32(v0);
vsiidx[1] = _mm_cvttps_epi32(v1);
ii = ((int *) vsiidx)[4];
return ii;
}

This fixes Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll



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

 ScalarReplAggregates.cpp |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.47 
llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.48
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.47Thu Nov  2 
14:25:50 2006
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Nov  7 16:42:47 2006
@@ -316,9 +316,13 @@
   //
   // Scalar replacing *just* the outer index of the array is probably not
   // going to be a win anyway, so just give up.
-  for (++I; I != E && isa(*I); ++I) {
-const ArrayType *SubArrayTy = cast(*I);
-uint64_t NumElements = SubArrayTy->getNumElements();
+  for (++I; I != E && (isa(*I) || isa(*I)); ++I) {
+uint64_t NumElements;
+if (const ArrayType *SubArrayTy = dyn_cast(*I))
+  NumElements = SubArrayTy->getNumElements();
+else
+  NumElements = cast(*I)->getNumElements();
+
 if (!isa(I.getOperand())) return 0;
 if (cast(I.getOperand())->getZExtValue() >= NumElements)
   return 0;



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.21 -> 1.22
---
Log message:

Derive new pass managers from PassManagerAnalysisHelper.


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

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


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.21 
llvm/include/llvm/PassManager.h:1.22
--- llvm/include/llvm/PassManager.h:1.21Tue Nov  7 16:35:17 2006
+++ llvm/include/llvm/PassManager.h Tue Nov  7 16:44:55 2006
@@ -121,7 +121,8 @@
 /// BasicBlockpassManager_New manages BasicBlockPass. It batches all the
 /// pass together and sequence them to process one basic block before
 /// processing next basic block.
-class BasicBlockPassManager_New: public Pass {
+class BasicBlockPassManager_New: public Pass,
+ public PassManagerAnalysisHelper {
 
 public:
   BasicBlockPassManager_New() { }
@@ -142,7 +143,8 @@
 /// It batches all function passes and basic block pass managers together and
 /// sequence them to process one function at a time before processing next
 /// function.
-class FunctionPassManager_New:public Pass {
+class FunctionPassManager_New: public Pass,
+   public PassManagerAnalysisHelper {
 public:
   FunctionPassManager_New(ModuleProvider *P) { /* TODO */ }
   FunctionPassManager_New() { 
@@ -176,7 +178,8 @@
 /// ModulePassManager_New manages ModulePasses and function pass managers.
 /// It batches all Module passes  passes and function pass managers together 
and
 /// sequence them to process one module.
-class ModulePassManager_New: public Pass {
+class ModulePassManager_New: public Pass,
+ public PassManagerAnalysisHelper {
  
 public:
   ModulePassManager_New() { activeFunctionPassManager = NULL; }
@@ -197,7 +200,8 @@
 };
 
 /// PassManager_New manages ModulePassManagers
-class PassManager_New: public Pass {
+class PassManager_New: public Pass,
+   public PassManagerAnalysisHelper {
 
 public:
 



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.18 -> 1.19
---
Log message:

Fix comment.


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

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


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.18 
llvm/include/llvm/PassManager.h:1.19
--- llvm/include/llvm/PassManager.h:1.18Tue Nov  7 16:03:15 2006
+++ llvm/include/llvm/PassManager.h Tue Nov  7 16:04:53 2006
@@ -143,7 +143,7 @@
   BasicBlockPassManager_New *activeBBPassManager;
 };
 
-/// FunctionPassManager_New manages FunctionPasses.
+/// ModulePassManager_New manages ModulePasses and function pass managers.
 /// It batches all Module passes  passes and function pass managers together 
and
 /// sequence them to process one module.
 class ModulePassManager_New: public Pass {



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

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

Update new pass managers to use PassManagerAnalysisHelper API.



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

 PassManager.cpp |   27 +--
 1 files changed, 21 insertions(+), 6 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.5 llvm/lib/VMCore/PassManager.cpp:1.6
--- llvm/lib/VMCore/PassManager.cpp:1.5 Tue Nov  7 16:35:17 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Nov  7 16:56:50 2006
@@ -69,8 +69,13 @@
   if (!BP)
 return false;
 
-  // TODO: Check if it suitable to manage P using this BasicBlockPassManager
-  // or we need another instance of BasicBlockPassManager
+  // If this pass does not preserve anlysis that is used by other passes
+  // managed by this manager than it is not a suiable pass for this manager.
+  if (!manageablePass (P))
+return false;
+
+  // Take a note of analysis required by this pass.
+  noteDownRequiredAnalysis(P);
 
   // Add pass
   PassVector.push_back(BP);
@@ -124,8 +129,13 @@
   if (!FP)
 return false;
 
-  // TODO: Check if it suitable to manage P using this FunctionPassManager
-  // or we need another instance of FunctionPassManager
+  // If this pass does not preserve anlysis that is used by other passes
+  // managed by this manager than it is not a suiable pass for this manager.
+  if (!manageablePass (P))
+return false;
+
+  // Take a note of analysis required by this pass.
+  noteDownRequiredAnalysis(P);
 
   PassVector.push_back(FP);
   activeBBPassManager = NULL;
@@ -179,8 +189,13 @@
   if (!MP)
 return false;
 
-  // TODO: Check if it suitable to manage P using this ModulePassManager
-  // or we need another instance of ModulePassManager
+  // If this pass does not preserve anlysis that is used by other passes
+  // managed by this manager than it is not a suiable pass for this manager.
+  if (!manageablePass (P))
+return false;
+
+  // Take a note of analysis required by this pass.
+  noteDownRequiredAnalysis(P);
 
   PassVector.push_back(MP);
   activeFunctionPassManager = NULL;



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/vec_shuffle-10.ll unpcklps.ll

2006-11-07 Thread Evan Cheng


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

vec_shuffle-10.ll added (r1.1)
unpcklps.ll (r1.1) removed
---
Log message:

New test case.

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

 vec_shuffle-10.ll |   25 +
 1 files changed, 25 insertions(+)


Index: llvm/test/Regression/CodeGen/X86/vec_shuffle-10.ll
diff -c /dev/null llvm/test/Regression/CodeGen/X86/vec_shuffle-10.ll:1.1
*** /dev/null   Tue Nov  7 16:18:24 2006
--- llvm/test/Regression/CodeGen/X86/vec_shuffle-10.ll  Tue Nov  7 16:18:14 2006
***
*** 0 
--- 1,25 
+ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 &&
+ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep unpcklps | wc -l | 
grep 1 &&
+ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep unpckhps | wc -l | 
grep 1 &&
+ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep 'sub.*esp'
+ 
+ void %test(<4 x float>* %res, <4 x float>* %A, <4 x float>* %B) {
+ %tmp = load <4 x float>* %B ; <<4 x float>> [#uses=2]
+ %tmp3 = load <4 x float>* %A; <<4 x float>> [#uses=2]
+ %tmp = extractelement <4 x float> %tmp3, uint 0 ;  
[#uses=1]
+ %tmp7 = extractelement <4 x float> %tmp, uint 0 ;  
[#uses=1]
+ %tmp8 = extractelement <4 x float> %tmp3, uint 1; 
 [#uses=1]
+ %tmp9 = extractelement <4 x float> %tmp, uint 1 ;  
[#uses=1]
+ %tmp10 = insertelement <4 x float> undef, float %tmp, uint 0  
  ; <<4 x float>> [#uses=1]
+ %tmp11 = insertelement <4 x float> %tmp10, float %tmp7, uint 1
  ; <<4 x float>> [#uses=1]
+ %tmp12 = insertelement <4 x float> %tmp11, float %tmp8, uint 2
  ; <<4 x float>> [#uses=1]
+ %tmp13 = insertelement <4 x float> %tmp12, float %tmp9, uint 3
  ; <<4 x float>> [#uses=1]
+ store <4 x float> %tmp13, <4 x float>* %res
+ ret void
+ }
+ 
+ void %test2(<4 x float> %X, <4 x float>* %res) {
+   %tmp5 = shufflevector <4 x float> %X, <4 x float> undef, <4 x uint> < 
uint 2, uint 6, uint 3, uint 7 >
+   store <4 x float> %tmp5, <4 x float>* %res
+   ret void
+ }



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


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

2006-11-07 Thread Andrew Lenharth


Changes in directory llvm-test:

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

analyze went away

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

 Makefile.rules |1 -
 1 files changed, 1 deletion(-)


Index: llvm-test/Makefile.rules
diff -u llvm-test/Makefile.rules:1.17 llvm-test/Makefile.rules:1.18
--- llvm-test/Makefile.rules:1.17   Tue Sep 19 11:59:51 2006
+++ llvm-test/Makefile.rulesTue Nov  7 17:17:30 2006
@@ -279,7 +279,6 @@
 LOPT  = $(LLVMTOOLCURRENT)/opt$(EXEEXT)
 LLINK = $(LLVMTOOLCURRENT)/llvm-link$(EXEEXT)
 LPROF = $(LLVMTOOLCURRENT)/llvm-prof$(EXEEXT)
-LANALYZE  = $(LLVMTOOLCURRENT)/analyze$(EXEEXT)
 LBUGPOINT = $(LLVMTOOLCURRENT)/bugpoint$(EXEEXT)
 LLVMC = $(LLVMTOOLCURRENT)/llvmc$(EXEEXT)
 



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


[llvm-commits] CVS: llvm-test/TEST.dsgraph.Makefile TEST.dsgraph.report

2006-11-07 Thread Andrew Lenharth


Changes in directory llvm-test:

TEST.dsgraph.Makefile updated: 1.17 -> 1.18
TEST.dsgraph.report updated: 1.14 -> 1.15
---
Log message:

analyze is gone

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

 TEST.dsgraph.Makefile |8 
 TEST.dsgraph.report   |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm-test/TEST.dsgraph.Makefile
diff -u llvm-test/TEST.dsgraph.Makefile:1.17 
llvm-test/TEST.dsgraph.Makefile:1.18
--- llvm-test/TEST.dsgraph.Makefile:1.17Fri Mar 25 20:04:44 2005
+++ llvm-test/TEST.dsgraph.Makefile Tue Nov  7 17:23:25 2006
@@ -18,10 +18,10 @@
 MEM := -track-memory -time-passes
 
 $(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \
-Output/%.$(TEST).report.txt: Output/%.lib.bc Output/%.LOC.txt $(LANALYZE) 
$(LOPT)
+Output/%.$(TEST).report.txt: Output/%.lib.bc Output/%.LOC.txt $(LOPT)
@# Gather data
-   -($(LANALYZE) -$(PASS)datastructure $(ANALYZE_OPTS) $<)> [EMAIL 
PROTECTED] 2>&1
-   -($(LANALYZE) $(MEM) -$(PASS)datastructure -disable-verify $<)> [EMAIL 
PROTECTED] 2>&1
+   -($(LOPT) -analyze -$(PASS)datastructure $(ANALYZE_OPTS) $<)> [EMAIL 
PROTECTED] 2>&1
+   -($(LOPT) -analyze $(MEM) -$(PASS)datastructure -disable-verify $<)> 
[EMAIL PROTECTED] 2>&1
-($(LOPT) -steens-aa -time-passes -disable-output $<) > [EMAIL 
PROTECTED] 2>&1
-($(LOPT) -steens-aa $(MEM) -disable-output $<) > [EMAIL PROTECTED] 2>&1
@# Emit data.
@@ -74,5 +74,5 @@
 # Define REPORT_DEPENDENCIES so that the report is regenerated if analyze or
 # dummylib is updated.
 #
-REPORT_DEPENDENCIES := $(DUMMYLIB) $(LANALYZE) $(LOPT)
+REPORT_DEPENDENCIES := $(DUMMYLIB) $(LOPT)
 


Index: llvm-test/TEST.dsgraph.report
diff -u llvm-test/TEST.dsgraph.report:1.14 llvm-test/TEST.dsgraph.report:1.15
--- llvm-test/TEST.dsgraph.report:1.14  Fri Mar 25 20:04:44 2005
+++ llvm-test/TEST.dsgraph.report   Tue Nov  7 17:23:25 2006
@@ -28,7 +28,7 @@
   $TS = 0 if ($TS eq "*");
   $NTS = 0 if ($NTS eq "*");
 
-  if ($TS + NTS != 0) {
+  if ($TS + $NTS != 0) {
 return sprintf("%4.1f%%", 100*$TS/($TS+$NTS+0.0));
   } else {
 return "n/a";



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


[llvm-commits] CVS: llvm/test/Regression/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll

2006-11-07 Thread Chris Lattner


Changes in directory llvm/test/Regression/Transforms/ScalarRepl:

2006-11-07-InvalidArrayPromote.ll added (r1.1)
---
Log message:

scalarrepl should not split the two elements of the vsiidx array:
int func(vFloat v0, vFloat v1) {
int ii;
vSInt32 vsiidx[2];
vsiidx[0] = _mm_cvttps_epi32(v0);
vsiidx[1] = _mm_cvttps_epi32(v1);
ii = ((int *) vsiidx)[4];
return ii;
}




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

 2006-11-07-InvalidArrayPromote.ll |   19 +++
 1 files changed, 19 insertions(+)


Index: 
llvm/test/Regression/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll
diff -c /dev/null 
llvm/test/Regression/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll:1.1
*** /dev/null   Tue Nov  7 16:42:39 2006
--- 
llvm/test/Regression/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll
Tue Nov  7 16:42:29 2006
***
*** 0 
--- 1,19 
+ ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis &&
+ ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep -F 'alloca [2 x <4 x 
int>]'
+ 
+ int %func(<4 x float> %v0, <4 x float> %v1) {
+   %vsiidx = alloca [2 x <4 x int>], align 16  ; <[2 x <4 x 
int>]*> [#uses=3]
+   %tmp = call <4 x int> %llvm.x86.sse2.cvttps2dq( <4 x float> %v0 )   
; <<4 x int>> [#uses=2]
+   %tmp = cast <4 x int> %tmp to <2 x long>; <<2 x long>> 
[#uses=0]
+   %tmp = getelementptr [2 x <4 x int>]* %vsiidx, int 0, int 0 
; <<4 x int>*> [#uses=1]
+   store <4 x int> %tmp, <4 x int>* %tmp
+   %tmp10 = call <4 x int> %llvm.x86.sse2.cvttps2dq( <4 x float> %v1 ) 
; <<4 x int>> [#uses=2]
+   %tmp10 = cast <4 x int> %tmp10 to <2 x long>; <<2 x long>> 
[#uses=0]
+   %tmp14 = getelementptr [2 x <4 x int>]* %vsiidx, int 0, int 1   
; <<4 x int>*> [#uses=1]
+   store <4 x int> %tmp10, <4 x int>* %tmp14
+   %tmp15 = getelementptr [2 x <4 x int>]* %vsiidx, int 0, int 0, int 4
;  [#uses=1]
+   %tmp = load int* %tmp15 ;  [#uses=1]
+   ret int %tmp
+ }
+ 
+ declare <4 x int> %llvm.x86.sse2.cvttps2dq(<4 x float>)



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManager.h updated: 1.22 -> 1.23
---
Log message:

Beautify.
Clarify comments.


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

 PassManager.h |   33 +
 1 files changed, 17 insertions(+), 16 deletions(-)


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.22 
llvm/include/llvm/PassManager.h:1.23
--- llvm/include/llvm/PassManager.h:1.22Tue Nov  7 16:44:55 2006
+++ llvm/include/llvm/PassManager.h Tue Nov  7 18:19:31 2006
@@ -88,17 +88,18 @@
   bool doFinalization();
 };
 
-/// PassManagerAnalysisHelper helpes pass manager analysis required by
-/// the managed passes.
+/// PassManagerAnalysisHelper helps pass manager analysis required by
+/// the managed passes. It provides methods to add/remove analysis
+/// available and query if certain analysis is available or not.
 class PassManagerAnalysisHelper {
 
 public:
 
-  /// Return TRUE IFF pass P's required analysis set does not required new
+  /// Return true IFF pass P's required analysis set does not required new
   /// manager.
   bool manageablePass(Pass *P);
 
-  /// Return TRUE iff AnalysisID AID is currently available.
+  /// Return true IFF AnalysisID AID is currently available.
   bool analysisCurrentlyAvailable(AnalysisID AID);
 
   /// Augment RequiredSet by adding analysis required by pass P.
@@ -118,11 +119,11 @@
   std::vector RequiredSet;
 };
 
-/// BasicBlockpassManager_New manages BasicBlockPass. It batches all the
+/// BasicBlockPassManager_New manages BasicBlockPass. It batches all the
 /// pass together and sequence them to process one basic block before
 /// processing next basic block.
-class BasicBlockPassManager_New: public Pass,
- public PassManagerAnalysisHelper {
+class BasicBlockPassManager_New : public Pass,
+  public PassManagerAnalysisHelper {
 
 public:
   BasicBlockPassManager_New() { }
@@ -135,7 +136,7 @@
   bool runOnFunction(Function &F);
 
 private:
-  // Collection of pass that are not yet scheduled
+  // Collection of pass that are managed by this manager
   std::vector PassVector;
 };
 
@@ -143,8 +144,8 @@
 /// It batches all function passes and basic block pass managers together and
 /// sequence them to process one function at a time before processing next
 /// function.
-class FunctionPassManager_New: public Pass,
-   public PassManagerAnalysisHelper {
+class FunctionPassManager_New : public Pass,
+public PassManagerAnalysisHelper {
 public:
   FunctionPassManager_New(ModuleProvider *P) { /* TODO */ }
   FunctionPassManager_New() { 
@@ -168,7 +169,7 @@
   bool runOnModule(Module &M);
 
 private:
-  // Collection of pass that are not yet scheduled
+  // Collection of pass that are manged by this manager
   std::vector PassVector;
  
   // Active Pass Managers
@@ -178,8 +179,8 @@
 /// ModulePassManager_New manages ModulePasses and function pass managers.
 /// It batches all Module passes  passes and function pass managers together 
and
 /// sequence them to process one module.
-class ModulePassManager_New: public Pass,
- public PassManagerAnalysisHelper {
+class ModulePassManager_New : public Pass,
+  public PassManagerAnalysisHelper {
  
 public:
   ModulePassManager_New() { activeFunctionPassManager = NULL; }
@@ -192,7 +193,7 @@
   bool runOnModule(Module &M);
   
 private:
-  // Collection of pass that are not yet scheduled
+  // Collection of pass that are managed by this manager
   std::vector PassVector;
   
   // Active Pass Manager
@@ -200,8 +201,8 @@
 };
 
 /// PassManager_New manages ModulePassManagers
-class PassManager_New: public Pass,
-   public PassManagerAnalysisHelper {
+class PassManager_New : public Pass,
+public PassManagerAnalysisHelper {
 
 public:
 



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


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

2006-11-07 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen:

BranchFolding.cpp updated: 1.32 -> 1.33
---
Log message:

optimize single MBB loops better.  In particular, produce:

LBB1_57:#bb207.i
movl 72(%esp), %ecx
movb (%ecx,%eax), %cl
movl 80(%esp), %edx
movb %cl, 1(%edx,%eax)
incl %eax
cmpl $143, %eax
jne LBB1_57 #bb207.i
jmp LBB1_64 #cond_next255.i

intead of:

LBB1_57:#bb207.i
movl 72(%esp), %ecx
movb (%ecx,%eax), %cl
movl 80(%esp), %edx
movb %cl, 1(%edx,%eax)
incl %eax
cmpl $143, %eax
je LBB1_64  #cond_next255.i
jmp LBB1_57 #bb207.i

This eliminates a branch per iteration of the loop.  This hurted PPC 
particularly, because the extra branch meant another dispatch group for each
iteration of the loop.



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

 BranchFolding.cpp |   17 +
 1 files changed, 17 insertions(+)


Index: llvm/lib/CodeGen/BranchFolding.cpp
diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.32 
llvm/lib/CodeGen/BranchFolding.cpp:1.33
--- llvm/lib/CodeGen/BranchFolding.cpp:1.32 Sun Nov  5 13:31:28 2006
+++ llvm/lib/CodeGen/BranchFolding.cpp  Tue Nov  7 19:03:21 2006
@@ -687,6 +687,23 @@
!CurCond.empty(),
++MachineFunction::iterator(MBB));
 
+// If this is a two-way branch, and the FBB branches to this block, 
reverse 
+// the condition so the single-basic-block loop is faster.  Instead of:
+//Loop: xxx; jcc Out; jmp Loop
+// we want:
+//Loop: xxx; jncc Loop; jmp Out
+if (CurTBB && CurFBB && CurFBB == MBB && CurTBB != MBB) {
+  std::vector NewCond(CurCond);
+  if (!TII->ReverseBranchCondition(NewCond)) {
+TII->RemoveBranch(*MBB);
+TII->InsertBranch(*MBB, CurFBB, CurTBB, NewCond);
+MadeChange = true;
+++NumBranchOpts;
+return OptimizeBlock(MBB);
+  }
+}
+
+
 // If this branch is the only thing in its block, see if we can forward
 // other blocks across it.
 if (CurTBB && CurCond.empty() && CurFBB == 0 && 



___
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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.160 -> 1.161
---
Log message:

For PR950: http://llvm.org/PR950 :
Early commit of the documentation for new conversion instructions for 
easier review.


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

 LangRef.html |  438 ++-
 1 files changed, 405 insertions(+), 33 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.160 llvm/docs/LangRef.html:1.161
--- llvm/docs/LangRef.html:1.160Wed Nov  1 19:53:58 2006
+++ llvm/docs/LangRef.html  Tue Nov  7 19:11:31 2006
@@ -115,10 +115,22 @@
  'getelementptr' 
Instruction
 
   
+  Cast Operations
+
+  'trunc .. to' Instruction
+  'zext .. to' Instruction
+  'sext .. to' Instruction
+  'fptrunc .. to' 
Instruction
+  'fpext .. to' Instruction
+  'fp2uint .. to' 
Instruction
+  'fp2sint .. to' 
Instruction
+  'uint2fp .. to' 
Instruction
+  'sint2fp .. to' 
Instruction
+  'bitconvert .. to' 
Instruction
+
   Other Operations
 
   'phi'   Instruction
-  'cast .. to' Instruction
   'select' Instruction
   'call'  Instruction
   'va_arg'  Instruction
@@ -1170,9 +1182,54 @@
 following is the syntax for constant expressions:
 
 
-  cast ( CST to TYPE )
-
-  Cast a constant to another type.
+  trunc ( CST to TYPE )
+  Truncate a constant to another type. The bit size of CST must be larger 
+  than the bit size of TYPE. Both types must be integral.
+
+  zext ( CST to TYPE )
+  Zero extend a constant to another type. The bit size of CST must be 
+  smaller or equal to the bit size of TYPE.  Both types must be integral.
+
+  sext ( CST to TYPE )
+  Sign extend a constant to another type. The bit size of CST must be 
+  smaller or equal to the bit size of TYPE.  Both types must be integral.
+
+  fptrunc ( CST to TYPE )
+  Truncate a floating point constant to another floating point type. The 
+  size of CST must be larger than the size of TYPE. Both types must be 
+  floating point.
+
+  fpext ( CST to TYPE )
+  Floating point extend a constant to another type. The size of CST must 
be 
+  smaller or equal to the size of TYPE. Both types must be floating point.
+
+  fp2uint ( CST to TYPE )
+  Convert a floating point constant to the corresponding unsigned integer
+  constant. TYPE must be an integer type. CST must be floating point. If the 
+  value won't fit in the integer type, the results are undefined.
+
+  fp2sint ( CST to TYPE )
+  Convert a floating point constant to the corresponding signed integer
+  constant. TYPE must be an integer type. CST must be floating point. If the 
+  value won't fit in the integer type, the results are undefined.
+
+  uint2fp ( CST to TYPE )
+  Convert an unsigned integer constant to the corresponding floating point
+  constant. TYPE must be floating point. CST must be of integer type. If the
+  value won't fit in the floating point type, the results are undefined.
+
+  sint2fp ( CST to TYPE )
+  Convert a signed integer constant to the corresponding floating point
+  constant. TYPE must be floating point. CST must be of integer type. If the
+  value won't fit in the floating point type, the results are undefined.
+
+  bitconvert ( CST to TYPE )
+  Convert a constant, CST, to another TYPE. The size of CST and TYPE must 
be
+  identical (same number of bits). The conversion is done as if the CST value
+  was stored to memory and read back as TYPE. In other words, no bits change 
+  with this operator, just the type.  This can be used for conversion of 
pointer
+  and packed types to any other type, as long as they have the same bit width.
+  
 
   getelementptr ( CSTPTR, IDX0, IDX1, ... )
 
@@ -1403,7 +1460,7 @@
 
 
  ; Emulate a conditional br instruction
- %Val = cast bool %value to int
+ %Val = zext bool %value to int
  switch int %Val, label %truedest [int 0, label %falsedest ]
 
  ; Emulate an unconditional br instruction
@@ -2740,60 +2797,375 @@
 
 
 
-   'cast .. to' Instruction
+   'trunc .. to' Instruction
 
-
 
 
 Syntax:
-
 
-   = cast   to  
; yields ty2
+   = trunc   to  
; yields ty2
 
 
 Overview:
-
 
-The 'cast' instruction is used as the primitive means to convert
-integers to floating point, change data type sizes, and break type safety (by
-casting pointers).
+The 'trunc' instruction truncates its operand to the type 
ty2.
 
 
-
 Arguments:
+
+The 'trunc' instruction takes a value to trunc, which must 
+be an integer type, and a type that specifies the 
size 
+and type of the result, which must be an integral 
+type.
 
+Semantics:
 
-The 'cast' instruction takes a value to cast, which must be a first
-class value, and a type to cast it to, which must also be a first class type.
-
+The 'trunc' instruction truncates the high order bits in 
value
+a

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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.161 -> 1.162
---
Log message:

Fix the section headings.


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

 LangRef.html |   69 +--
 1 files changed, 39 insertions(+), 30 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.161 llvm/docs/LangRef.html:1.162
--- llvm/docs/LangRef.html:1.161Tue Nov  7 19:11:31 2006
+++ llvm/docs/LangRef.html  Tue Nov  7 19:18:52 2006
@@ -115,7 +115,7 @@
  'getelementptr' 
Instruction
 
   
-  Cast Operations
+  Conversion Operations
 
   'trunc .. to' Instruction
   'zext .. to' Instruction
@@ -2763,36 +2763,12 @@
 
 
 
- Other Operations 
-
-The instructions in this category are the "miscellaneous"
-instructions, which defy better classification.
+ Conversion Operations
 
-
- 'phi'
-Instruction 
 
-Syntax:
-   = phi  [ , ], 
...
-Overview:
-The 'phi' instruction is used to implement the φ node in
-the SSA graph representing the function.
-Arguments:
-The type of the incoming values are specified with the first type
-field. After this, the 'phi' instruction takes a list of pairs
-as arguments, with one pair for each predecessor basic block of the
-current block.  Only values of first class
-type may be used as the value arguments to the PHI node.  Only labels
-may be used as the label arguments.
-There must be no non-phi instructions between the start of a basic
-block and the PHI instructions: i.e. PHI instructions must be first in
-a basic block.
-Semantics:
-At runtime, the 'phi' instruction logically takes on the
-value specified by the parameter, depending on which basic block we
-came from in the last terminator instruction.
-Example:
-Loop:   ; Infinite loop that counts from 0 on up...  %indvar = 
phi uint [ 0, %LoopHeader ], [ %nextindvar, %Loop ]  %nextindvar = add uint 
%indvar, 1  br label %Loop
+The instructions in this category are the conversion instructions (casting)
+which all take a single operand and a type. They perform various bit 
conversions
+on the operand.
 
 
 
@@ -3169,6 +3145,39 @@
 
 
 
+
+ Other Operations 
+
+The instructions in this category are the "miscellaneous"
+instructions, which defy better classification.
+
+
+ 'phi'
+Instruction 
+
+Syntax:
+   = phi  [ , ], 
...
+Overview:
+The 'phi' instruction is used to implement the φ node in
+the SSA graph representing the function.
+Arguments:
+The type of the incoming values are specified with the first type
+field. After this, the 'phi' instruction takes a list of pairs
+as arguments, with one pair for each predecessor basic block of the
+current block.  Only values of first class
+type may be used as the value arguments to the PHI node.  Only labels
+may be used as the label arguments.
+There must be no non-phi instructions between the start of a basic
+block and the PHI instructions: i.e. PHI instructions must be first in
+a basic block.
+Semantics:
+At runtime, the 'phi' instruction logically takes on the
+value specified by the parameter, depending on which basic block we
+came from in the last terminator instruction.
+Example:
+Loop:   ; Infinite loop that counts from 0 on up...  %indvar = 
phi uint [ 0, %LoopHeader ], [ %nextindvar, %Loop ]  %nextindvar = add uint 
%indvar, 1  br label %Loop
+
+
 
 
'select' Instruction
@@ -4372,7 +4381,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2006/11/08 01:11:31 $
+  Last modified: $Date: 2006/11/08 01:18:52 $
 
 
 



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


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

2006-11-07 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

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

Beautify.


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

 PassManager.cpp |   36 +---
 1 files changed, 17 insertions(+), 19 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.6 llvm/lib/VMCore/PassManager.cpp:1.7
--- llvm/lib/VMCore/PassManager.cpp:1.6 Tue Nov  7 16:56:50 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Nov  7 19:31:28 2006
@@ -2,7 +2,7 @@
 //
 // The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
+// This file was developed by Devang Patel  and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
 //
 
//===--===//
@@ -13,14 +13,13 @@
 
 
 #include "llvm/PassManager.h"
-#include "llvm/Function.h"
 #include "llvm/Module.h"
 
 using namespace llvm;
 
 // PassManagerAnalysisHelper implementation
 
-/// Return TRUE IFF pass P's required analysis set does not required new
+/// Return true IFF pass P's required analysis set does not required new
 /// manager.
 bool PassManagerAnalysisHelper::manageablePass(Pass *P) {
 
@@ -33,7 +32,7 @@
   return true;
 }
 
-/// Return TRUE iff AnalysisID AID is currently available.
+/// Return true IFF AnalysisID AID is currently available.
 bool PassManagerAnalysisHelper::analysisCurrentlyAvailable(AnalysisID AID) {
 
   // TODO
@@ -60,10 +59,10 @@
 
 /// BasicBlockPassManager implementation
 
-/// Add pass P into PassVector and return TRUE. If this pass is not
-/// manageable by this manager then return FALSE.
+/// Add pass P into PassVector and return true. If this pass is not
+/// manageable by this manager then return false.
 bool
-BasicBlockPassManager_New::addPass (Pass *P) {
+BasicBlockPassManager_New::addPass(Pass *P) {
 
   BasicBlockPass *BP = dynamic_cast(P);
   if (!BP)
@@ -71,7 +70,7 @@
 
   // If this pass does not preserve anlysis that is used by other passes
   // managed by this manager than it is not a suiable pass for this manager.
-  if (!manageablePass (P))
+  if (!manageablePass(P))
 return false;
 
   // Take a note of analysis required by this pass.
@@ -101,14 +100,13 @@
 
 // FunctionPassManager_New implementation
 
-///
 // FunctionPassManager
 
 /// Add pass P into the pass manager queue. If P is a BasicBlockPass then
 /// either use it into active basic block pass manager or create new basic
 /// block pass manager to handle pass P.
 bool
-FunctionPassManager_New::addPass (Pass *P) {
+FunctionPassManager_New::addPass(Pass *P) {
 
   // If P is a BasicBlockPass then use BasicBlockPassManager_New.
   if (BasicBlockPass *BP = dynamic_cast(P)) {
@@ -119,8 +117,8 @@
   activeBBPassManager = new BasicBlockPassManager_New();
 
   PassVector.push_back(activeBBPassManager);
-  assert (!activeBBPassManager->addPass(BP) &&
-  "Unable to add Pass");
+  if (!activeBBPassManager->addPass(BP))
+assert(0 && "Unable to add Pass");
 }
 return true;
   }
@@ -131,7 +129,7 @@
 
   // If this pass does not preserve anlysis that is used by other passes
   // managed by this manager than it is not a suiable pass for this manager.
-  if (!manageablePass (P))
+  if (!manageablePass(P))
 return false;
 
   // Take a note of analysis required by this pass.
@@ -163,10 +161,10 @@
 // ModulePassManager implementation
 
 /// Add P into pass vector if it is manageble. If P is a FunctionPass
-/// then use FunctionPassManager_New to manage it. Return FALSE if P
+/// then use FunctionPassManager_New to manage it. Return false if P
 /// is not manageable by this manager.
 bool
-ModulePassManager_New::addPass (Pass *P) {
+ModulePassManager_New::addPass(Pass *P) {
 
   // If P is FunctionPass then use function pass maanager.
   if (FunctionPass *FP = dynamic_cast(P)) {
@@ -179,8 +177,8 @@
   activeFunctionPassManager = new FunctionPassManager_New();
 
   PassVector.push_back(activeFunctionPassManager);
-  assert (!activeFunctionPassManager->addPass(FP) &&
-  "Unable to add Pass");
+  if (!activeFunctionPassManager->addPass(FP))
+assert(0 && "Unable to add pass");
 }
 return true;
   }
@@ -191,7 +189,7 @@
 
   // If this pass does not preserve anlysis that is used by other passes
   // managed by this manager than it is not a suiable pass for this manager.
-  if (!manageablePass (P))
+  if (!manageablePass(P))
 return false;
 
   // Take a note of analysis required by this pass.
@@ -235,7 +233,7 @@
 /// Add P into active pass manager or use new module pass manager to
 /// manage it.
 bool
-PassManager_New::addPass (Pass *P) {
+PassManager_New::addPass(Pass *P) {
 
   if (!activeManager) {
 activeManager = new ModulePassManager_New()

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

2006-11-07 Thread Chris Lattner


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

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

preincrement case we miss.  xfail until we catch it


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

 mem_update.ll |   11 +++
 1 files changed, 11 insertions(+)


Index: llvm/test/Regression/CodeGen/PowerPC/mem_update.ll
diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/mem_update.ll:1.1
*** /dev/null   Tue Nov  7 19:44:45 2006
--- llvm/test/Regression/CodeGen/PowerPC/mem_update.ll  Tue Nov  7 19:44:35 2006
***
*** 0 
--- 1,11 
+ ; RUN: llvm-as < %s | llc -march=ppc32 &&
+ ; RUN: llvm-as < %s | llc -march=ppc32 | not grep addi
+ 
+ ; XFAIL: *
+ 
+ int *%test(int *%X,  int *%dest) {
+   %Y = getelementptr int* %X, int 4
+   %A = load int* %Y
+   store int %A, int* %dest
+   ret int* %Y
+ }



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


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.td

2006-11-07 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCInstrInfo.td updated: 1.253 -> 1.254
---
Log message:

correct the (currently unused) pattern for lwzu.


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

 PPCInstrInfo.td |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.253 
llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.254
--- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.253   Fri Nov  3 23:42:48 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Tue Nov  7 20:13:12 2006
@@ -197,6 +197,9 @@
   bit RC  = 1;
 }
 
+class RegConstraint {
+  string Constraints = C;
+}
 
 
 
//===--===//
@@ -418,10 +421,13 @@
 def LWZ : DForm_1<32, (ops GPRC:$rD, memri:$src),
   "lwz $rD, $src", LdStGeneral,
   [(set GPRC:$rD, (load iaddr:$src))]>;
-def LWZU : DForm_1<35, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA),
+
+def LWZU : DForm_1<33, (ops GPRC:$rD, GPRC:$rA_result, i32imm:$disp, GPRC:$rA),
"lwzu $rD, $disp($rA)", LdStGeneral,
-   []>;
+   []>, RegConstraint<"$rA = $rA_result">;
 }
+
+
 let PPC970_Unit = 1 in {  // FXU Operations.
 def ADDI   : DForm_2<14, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
  "addi $rD, $rA, $imm", IntGeneral,



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


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

2006-11-07 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCISelDAGToDAG.cpp updated: 1.213 -> 1.214
PPCISelLowering.cpp updated: 1.218 -> 1.219
PPCISelLowering.h updated: 1.54 -> 1.55
---
Log message:

Refactor all the addressing mode selection stuff into the isel lowering
class, where it can be used for preinc formation.


---
Diffs of the changes:  (+325 -229)

 PPCISelDAGToDAG.cpp |  241 ++--
 PPCISelLowering.cpp |  279 
 PPCISelLowering.h   |   34 ++
 3 files changed, 325 insertions(+), 229 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.213 
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.214
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.213   Thu Nov  2 14:25:49 2006
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue Nov  7 20:15:41 2006
@@ -104,22 +104,30 @@
 
 /// SelectAddrImm - Returns true if the address N can be represented by
 /// a base register plus a signed 16-bit displacement [r+imm].
-bool SelectAddrImm(SDOperand N, SDOperand &Disp, SDOperand &Base);
+bool SelectAddrImm(SDOperand N, SDOperand &Disp, SDOperand &Base) {
+  return PPCLowering.SelectAddressRegImm(N, Disp, Base, *CurDAG);
+}
   
 /// SelectAddrIdx - Given the specified addressed, check to see if it can 
be
 /// represented as an indexed [r+r] operation.  Returns false if it can
 /// be represented by [r+imm], which are preferred.
-bool SelectAddrIdx(SDOperand N, SDOperand &Base, SDOperand &Index);
+bool SelectAddrIdx(SDOperand N, SDOperand &Base, SDOperand &Index) {
+  return PPCLowering.SelectAddressRegReg(N, Base, Index, *CurDAG);
+}
 
 /// SelectAddrIdxOnly - Given the specified addressed, force it to be
 /// represented as an indexed [r+r] operation.
-bool SelectAddrIdxOnly(SDOperand N, SDOperand &Base, SDOperand &Index);
+bool SelectAddrIdxOnly(SDOperand N, SDOperand &Base, SDOperand &Index) {
+  return PPCLowering.SelectAddressRegRegOnly(N, Base, Index, *CurDAG);
+}
 
 /// SelectAddrImmShift - Returns true if the address N can be represented 
by
 /// a base register plus a signed 14-bit displacement [r+imm*4].  Suitable
 /// for use by STD and friends.
-bool SelectAddrImmShift(SDOperand N, SDOperand &Disp, SDOperand &Base);
-
+bool SelectAddrImmShift(SDOperand N, SDOperand &Disp, SDOperand &Base) {
+  return PPCLowering.SelectAddressRegImmShift(N, Disp, Base, *CurDAG);
+}
+  
 /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for
 /// inline asm expressions.
 virtual bool SelectInlineAsmMemoryOperand(const SDOperand &Op,
@@ -472,229 +480,6 @@
   return 0;
 }
 
-/// SelectAddrImm - Returns true if the address N can be represented by
-/// a base register plus a signed 16-bit displacement [r+imm].
-bool PPCDAGToDAGISel::SelectAddrImm(SDOperand N, SDOperand &Disp, 
-SDOperand &Base) {
-  // If this can be more profitably realized as r+r, fail.
-  if (SelectAddrIdx(N, Disp, Base))
-return false;
-
-  if (N.getOpcode() == ISD::ADD) {
-short imm = 0;
-if (isIntS16Immediate(N.getOperand(1), imm)) {
-  Disp = getI32Imm((int)imm & 0x);
-  if (FrameIndexSDNode *FI = dyn_cast(N.getOperand(0))) {
-Base = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType());
-  } else {
-Base = N.getOperand(0);
-  }
-  return true; // [r+i]
-} else if (N.getOperand(1).getOpcode() == PPCISD::Lo) {
-  // Match LOAD (ADD (X, Lo(G))).
-  assert(!cast(N.getOperand(1).getOperand(1))->getValue()
- && "Cannot handle constant offsets yet!");
-  Disp = N.getOperand(1).getOperand(0);  // The global address.
-  assert(Disp.getOpcode() == ISD::TargetGlobalAddress ||
- Disp.getOpcode() == ISD::TargetConstantPool ||
- Disp.getOpcode() == ISD::TargetJumpTable);
-  Base = N.getOperand(0);
-  return true;  // [&g+r]
-}
-  } else if (N.getOpcode() == ISD::OR) {
-short imm = 0;
-if (isIntS16Immediate(N.getOperand(1), imm)) {
-  // If this is an or of disjoint bitfields, we can codegen this as an add
-  // (for better address arithmetic) if the LHS and RHS of the OR are
-  // provably disjoint.
-  uint64_t LHSKnownZero, LHSKnownOne;
-  PPCLowering.ComputeMaskedBits(N.getOperand(0), ~0U,
-LHSKnownZero, LHSKnownOne);
-  if ((LHSKnownZero|~(unsigned)imm) == ~0U) {
-// If all of the bits are known zero on the LHS or RHS, the add won't
-// carry.
-Base = N.getOperand(0);
-Disp = getI32Imm((int)imm & 0x);
-return true;
-  }
-}
-  } else if (ConstantSDNode *CN = dyn_cast(N)) {
-// Loading from a constant address.
-
-// If this address fits entirely in a 16-bit sext immediate field

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

2006-11-07 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.239 -> 1.240
---
Log message:

Fix a obscure post-indexed load / store dag combine bug.

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

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


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.239 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.240
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.239 Tue Nov  7 03:03:05 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Tue Nov  7 20:38:55 2006
@@ -338,7 +338,7 @@
   SDOperand Offset;
   ISD::MemOpAddrMode AM = ISD::UNINDEXED;
   if (TLI.getPostIndexedAddressParts(Op, VT, BasePtr, Offset, AM,DAG) 
&&
-  BasePtr.Val == Ptr.Val) {
+  BasePtr == Ptr) {
 // Try turning it into a post-indexed load / store except when
 // 1) Op must be independent of N, i.e. Op is neither a predecessor
 //nor a successor of N. Otherwise, if Op is folded that would



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


Re: [llvm-commits] SHR Patch (For Review)

2006-11-07 Thread Chris Lattner

On Nov 7, 2006, at 5:33 PM, Reid Spencer wrote:

> Attached is the 3rd attempt to get the SHR patch right. This one  
> passes
> all the tests and eliminates many more casts than previous versions.
>
> NOTE: Please don't commit this!
>
> Reid.

Overall, the patch looks excellent.  There is some minor  
typographical cruft like "return  new ShiftInst" in various places.   
Please grep for that (turning two spaces before new into one).



In this hunk:

@@ -5250,12 +5230,16 @@ Instruction *InstCombiner::FoldShiftByCo
  Amt = Op0->getType()->getPrimitiveSizeInBits();

Value *Op = ShiftOp->getOperand(0);
if (isShiftOfSignedShift != isSignedShift)
  Op = InsertNewInstBefore(new CastInst(Op, I.getType(),  
"tmp"), I);
-  return new ShiftInst(I.getOpcode(), Op,
+  ShiftInst* ShiftResult = new ShiftInst(I.getOpcode(), Op,
 ConstantInt::get(Type::UByteTy, Amt));
+  if (I.getType() == ShiftResult->getType())
+return ShiftResult;
+  InsertNewInstBefore(ShiftResult, I);
+  return new CastInst(ShiftResult, I.getType());
  }

Why do you need the two casts?  If you don't, please remove them.




In this hunk:
@@ -5790,33 +5768,28 @@ Instruction *InstCombiner::visitCastInst
...
-// Insert the new shift, which is now unsigned.
-N1 = InsertNewInstBefore(new ShiftInst(Instruction::Shr,  
N1,
-   Op1, Src->getName 
()), CI);
-return new CastInst(N1, CI.getType());
+// Insert the new logical shift right.
+return new ShiftInst(Instruction::LShr, Op0, Op1, Src- 
 >getName());

You shouldn't pass Src->getName() to the instruction ctor.




RCS file: /var/cvs/llvm/llvm/lib/VMCore/Instructions.cpp,v
retrieving revision 1.45
diff -t -d -u -p -5 -r1.45 Instructions.cpp
--- lib/VMCore/Instructions.cpp 2 Nov 2006 01:53:58 -   1.45
+++ lib/VMCore/Instructions.cpp 8 Nov 2006 00:31:58 -
@@ -1228,11 +1228,11 @@ bool BinaryOperator::swapOperands() {
  // 
===- 
-===//

  /// isLogicalShift - Return true if this is a logical shift left or  
a logical
  /// shift right.
  bool ShiftInst::isLogicalShift() const {
-  return getOpcode() == Instruction::Shl || getType()->isUnsigned();
+  return getOpcode() == Instruction::Shl || getOpcode() ==  
Instruction::LShr;
  }

isLogicalShift can now be an inline method in the header for  
ShiftInst, now that it isn't touching getType().  Please move it to  
the header.




After making the changes above and retesting, please commit this!   
After this goes in, please remember to do the next patch which turns  
ConstantExpr::getUShr -> ConstantExpr::getLShr etc.  Thanks guys,

-Chris

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


Re: [llvm-commits] SHR Patch (For Review)

2006-11-07 Thread Reid Spencer
On Tue, 2006-11-07 at 19:58 -0800, Chris Lattner wrote:
> On Nov 7, 2006, at 5:33 PM, Reid Spencer wrote:
> 
> > Attached is the 3rd attempt to get the SHR patch right. This one  
> > passes
> > all the tests and eliminates many more casts than previous versions.
> >
> > NOTE: Please don't commit this!
> >
> > Reid.
> 
> Overall, the patch looks excellent.  There is some minor  
> typographical cruft like "return  new ShiftInst" in various places.   
> Please grep for that (turning two spaces before new into one).
> 

Found 3, only in InstCombine

> 
> In this hunk:
> 
> @@ -5250,12 +5230,16 @@ Instruction *InstCombiner::FoldShiftByCo
>   Amt = Op0->getType()->getPrimitiveSizeInBits();
> 
> Value *Op = ShiftOp->getOperand(0);
> if (isShiftOfSignedShift != isSignedShift)
>   Op = InsertNewInstBefore(new CastInst(Op, I.getType(),  
> "tmp"), I);
> -  return new ShiftInst(I.getOpcode(), Op,
> +  ShiftInst* ShiftResult = new ShiftInst(I.getOpcode(), Op,
>  ConstantInt::get(Type::UByteTy, Amt));
> +  if (I.getType() == ShiftResult->getType())
> +return ShiftResult;
> +  InsertNewInstBefore(ShiftResult, I);
> +  return new CastInst(ShiftResult, I.getType());
>   }
> 
> Why do you need the two casts?  If you don't, please remove them.

That's the one that causes InstCombiner's replaceAllUsesWith call to
assert because its the wrong type.  This is specifically the one I
warned you about :)

If you can see a way to eliminate it, please feel free after I commit
it. We already tried and it breaks.

> 
> In this hunk:
> @@ -5790,33 +5768,28 @@ Instruction *InstCombiner::visitCastInst
> ...
> -// Insert the new shift, which is now unsigned.
> -N1 = InsertNewInstBefore(new ShiftInst(Instruction::Shr,  
> N1,
> -   Op1, Src->getName 
> ()), CI);
> -return new CastInst(N1, CI.getType());
> +// Insert the new logical shift right.
> +return new ShiftInst(Instruction::LShr, Op0, Op1, Src- 
>  >getName());
> 
> You shouldn't pass Src->getName() to the instruction ctor.

Right. Done.

> 
> 
> 
> RCS file: /var/cvs/llvm/llvm/lib/VMCore/Instructions.cpp,v
> retrieving revision 1.45
> diff -t -d -u -p -5 -r1.45 Instructions.cpp
> --- lib/VMCore/Instructions.cpp   2 Nov 2006 01:53:58 -   1.45
> +++ lib/VMCore/Instructions.cpp   8 Nov 2006 00:31:58 -
> @@ -1228,11 +1228,11 @@ bool BinaryOperator::swapOperands() {
>   // 
> ===- 
> -===//
> 
>   /// isLogicalShift - Return true if this is a logical shift left or  
> a logical
>   /// shift right.
>   bool ShiftInst::isLogicalShift() const {
> -  return getOpcode() == Instruction::Shl || getType()->isUnsigned();
> +  return getOpcode() == Instruction::Shl || getOpcode() ==  
> Instruction::LShr;
>   }
> 
> isLogicalShift can now be an inline method in the header for  
> ShiftInst, now that it isn't touching getType().  Please move it to  
> the header.

Done.

> 
> 
> 
> After making the changes above and retesting, please commit this!   
> After this goes in, please remember to do the next patch which turns  
> ConstantExpr::getUShr -> ConstantExpr::getLShr etc.  Thanks guys,

Will do immediately after the commit.

Thanks Chris!


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


Re: [llvm-commits] SHR Patch (For Review)

2006-11-07 Thread Chris Lattner

On Nov 7, 2006, at 9:20 PM, Reid Spencer wrote:

>>   Op = InsertNewInstBefore(new CastInst(Op, I.getType(),
>> "tmp"), I);
>> -  return new ShiftInst(I.getOpcode(), Op,
>> +  ShiftInst* ShiftResult = new ShiftInst(I.getOpcode(), Op,
>>  ConstantInt::get(Type::UByteTy, Amt));
>> +  if (I.getType() == ShiftResult->getType())
>> +return ShiftResult;
>> +  InsertNewInstBefore(ShiftResult, I);
>> +  return new CastInst(ShiftResult, I.getType());
>>   }
>>
>> Why do you need the two casts?  If you don't, please remove them.
>
> That's the one that causes InstCombiner's replaceAllUsesWith call to
> assert because its the wrong type.  This is specifically the one I
> warned you about :)
>
> If you can see a way to eliminate it, please feel free after I commit
> it. We already tried and it breaks.

Fair enough.  Thanks,

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


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

2006-11-07 Thread Chris Lattner


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.272 -> 1.273
---
Log message:

Fix a bug noticed by Emil Mikulic.


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

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


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.272 
llvm/lib/AsmParser/llvmAsmParser.y:1.273
--- llvm/lib/AsmParser/llvmAsmParser.y:1.272Wed Nov  1 19:53:58 2006
+++ llvm/lib/AsmParser/llvmAsmParser.y  Tue Nov  7 23:58:11 2006
@@ -2102,8 +2102,8 @@
 };
 
 FnDeclareLinkage: /*default*/ |
-  DLLIMPORT   { CurFun.Linkage = GlobalValue::DLLImportLinkage 
} |
-  EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage 
};
+  DLLIMPORT   { CurFun.Linkage = 
GlobalValue::DLLImportLinkage; } |
+  EXTERN_WEAK { CurFun.Linkage = 
GlobalValue::DLLImportLinkage; };
   
 FunctionProto : DECLARE { CurFun.isDeclare = true; } FnDeclareLinkage 
FunctionHeaderH {
 $$ = CurFun.CurrentFunction;



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll

2006-11-07 Thread Chris Lattner


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

branch-opt.ll updated: 1.1 -> 1.2
---
Log message:

now that we handle single mbb loops better, one branch is allowed


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

 branch-opt.ll |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll
diff -u llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll:1.1 
llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll:1.2
--- llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll:1.1  Tue Oct 17 
13:14:39 2006
+++ llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll  Wed Nov  8 00:42:42 2006
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | llc -march=ppc32 &&
-; RUN: llvm-as < %s | llc -march=ppc32 | not grep 'b LBB.*cond_next48.loopexit'
+; RUN: llvm-as < %s | llc -march=ppc32 | grep 'b LBB.*cond_next48.loopexit' | 
wc -l | grep 1
 
 target endian = big
 target pointersize = 32



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


[llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp

2006-11-07 Thread Reid Spencer


Changes in directory llvm/test/Regression/DebugInfo:

2006-11-06-StackTrace.cpp updated: 1.2 -> 1.3
---
Log message:

XFAIL this on Linux until Jim gets Darwin ship shape.


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

 2006-11-06-StackTrace.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp
diff -u llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.2 
llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.3
--- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.2Tue Nov 
 7 01:58:02 2006
+++ llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cppWed Nov  8 
00:43:16 2006
@@ -5,6 +5,7 @@
 // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > 
Output/StackTrace.gdbin 
 // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | 
tee Output/StackTrace.out | grep '#0  DeepStack::deepest (this=.*,x=33)'
 // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | 
grep '#7  0x.* in main(argc=1, argv=.*)'
+// XFAIL: linux
 
 
 #include 



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


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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.280 -> 1.281
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 Writer.cpp |   41 -
 1 files changed, 24 insertions(+), 17 deletions(-)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.280 
llvm/lib/Target/CBackend/Writer.cpp:1.281
--- llvm/lib/Target/CBackend/Writer.cpp:1.280   Sun Nov  5 13:26:37 2006
+++ llvm/lib/Target/CBackend/Writer.cpp Wed Nov  8 00:47:33 2006
@@ -606,7 +606,8 @@
 case Instruction::SetGT:
 case Instruction::SetGE:
 case Instruction::Shl:
-case Instruction::Shr:
+case Instruction::LShr:
+case Instruction::AShr:
 {
   Out << '(';
   bool NeedsClosingParens = printConstExprCast(CE); 
@@ -631,7 +632,8 @@
   case Instruction::SetGT: Out << " > "; break;
   case Instruction::SetGE: Out << " >= "; break;
   case Instruction::Shl: Out << " << "; break;
-  case Instruction::Shr: Out << " >> "; break;
+  case Instruction::LShr:
+  case Instruction::AShr: Out << " >> "; break;
   default: assert(0 && "Illegal opcode here!");
   }
   printConstantWithCast(CE->getOperand(1), CE->getOpcode());
@@ -826,23 +828,23 @@
 // because their operands were casted to the expected type. This function takes
 // care of detecting that case and printing the cast for the ConstantExpr.
 bool CWriter::printConstExprCast(const ConstantExpr* CE) {
-  bool Result = false;
+  bool NeedsExplicitCast = false;
   const Type* Ty = CE->getOperand(0)->getType();
   switch (CE->getOpcode()) {
-  case Instruction::UDiv: 
+  case Instruction::LShr:
   case Instruction::URem: 
-Result = Ty->isSigned(); break;
-  case Instruction::SDiv: 
+  case Instruction::UDiv: NeedsExplicitCast = Ty->isSigned(); break;
+  case Instruction::AShr:
   case Instruction::SRem: 
-Result = Ty->isUnsigned(); break;
+  case Instruction::SDiv: NeedsExplicitCast = Ty->isUnsigned(); break;
   default: break;
   }
-  if (Result) {
+  if (NeedsExplicitCast) {
 Out << "((";
 printType(Out, Ty);
 Out << ")(";
   }
-  return Result;
+  return NeedsExplicitCast;
 }
 
 //  Print a constant assuming that it is the operand for a given Opcode. The
@@ -863,6 +865,7 @@
 default:
   // for most instructions, it doesn't matter
   break; 
+case Instruction::LShr:
 case Instruction::UDiv:
 case Instruction::URem:
   // For UDiv/URem get correct type
@@ -871,6 +874,7 @@
 shouldCast = true;
   }
   break;
+case Instruction::AShr:
 case Instruction::SDiv:
 case Instruction::SRem:
   // For SDiv/SRem get correct type
@@ -927,23 +931,23 @@
 // This function takes care of detecting that case and printing the cast 
 // for the Instruction.
 bool CWriter::writeInstructionCast(const Instruction &I) {
-  bool Result = false;
+  bool NeedsExplicitCast = false;
   const Type* Ty = I.getOperand(0)->getType();
   switch (I.getOpcode()) {
-  case Instruction::UDiv: 
+  case Instruction::LShr:
   case Instruction::URem: 
-Result = Ty->isSigned(); break;
-  case Instruction::SDiv: 
+  case Instruction::UDiv: NeedsExplicitCast = Ty->isSigned(); break;
+  case Instruction::AShr:
   case Instruction::SRem: 
-Result = Ty->isUnsigned(); break;
+  case Instruction::SDiv: NeedsExplicitCast = Ty->isUnsigned(); break;
   default: break;
   }
-  if (Result) {
+  if (NeedsExplicitCast) {
 Out << "((";
 printType(Out, Ty);
 Out << ")(";
   }
-  return Result;
+  return NeedsExplicitCast;
 }
 
 // Write the operand with a cast to another type based on the Opcode being 
used.
@@ -964,6 +968,7 @@
 default:
   // for most instructions, it doesn't matter
   break; 
+case Instruction::LShr:
 case Instruction::UDiv:
 case Instruction::URem:
   // For UDiv to have unsigned operands
@@ -972,6 +977,7 @@
 shouldCast = true;
   }
   break;
+case Instruction::AShr:
 case Instruction::SDiv:
 case Instruction::SRem:
   if (OpTy->isUnsigned()) {
@@ -1832,7 +1838,8 @@
 case Instruction::SetLT: Out << " < "; break;
 case Instruction::SetGT: Out << " > "; break;
 case Instruction::Shl : Out << " << "; break;
-case Instruction::Shr : Out << " >> "; break;
+case Instruction::LShr:
+case Instruction::AShr: Out << " >> "; break;
 default: std::cerr << "Invalid operator type!" << I; abort();
 }
 



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


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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/tools/llvm2cpp:

CppWriter.cpp updated: 1.20 -> 1.21
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 CppWriter.cpp |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)


Index: llvm/tools/llvm2cpp/CppWriter.cpp
diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.20 
llvm/tools/llvm2cpp/CppWriter.cpp:1.21
--- llvm/tools/llvm2cpp/CppWriter.cpp:1.20  Thu Nov  2 14:25:50 2006
+++ llvm/tools/llvm2cpp/CppWriter.cpp   Wed Nov  8 00:47:33 2006
@@ -788,7 +788,8 @@
 case Instruction::SetLT:  Out << "getSetLT"; break;
 case Instruction::SetGT:  Out << "getSetGT"; break;
 case Instruction::Shl:Out << "getShl"; break;
-case Instruction::Shr:Out << "getShr"; break;
+case Instruction::LShr:Out << "getLShr"; break;
+case Instruction::AShr:Out << "getAShr"; break;
 case Instruction::Select: Out << "getSelect"; break;
 case Instruction::ExtractElement: Out << "getExtractElement"; break;
 case Instruction::InsertElement:  Out << "getInsertElement"; break;
@@ -1034,7 +1035,8 @@
 case Instruction::Or:
 case Instruction::Xor:
 case Instruction::Shl: 
-case Instruction::Shr:{
+case Instruction::LShr: 
+case Instruction::AShr:{
   Out << "BinaryOperator* " << iName << " = BinaryOperator::create(";
   switch (I->getOpcode()) {
 case Instruction::Add: Out << "Instruction::Add"; break;
@@ -1050,7 +1052,8 @@
 case Instruction::Or:  Out << "Instruction::Or";  break;
 case Instruction::Xor: Out << "Instruction::Xor"; break;
 case Instruction::Shl: Out << "Instruction::Shl"; break;
-case Instruction::Shr: Out << "Instruction::Shr"; break;
+case Instruction::LShr:Out << "Instruction::LShr"; break;
+case Instruction::AShr:Out << "Instruction::AShr"; break;
 default: Out << "Instruction::BadOpCode"; break;
   }
   Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";



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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Utils:

Local.cpp updated: 1.59 -> 1.60
SimplifyCFG.cpp updated: 1.103 -> 1.104
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 Local.cpp   |3 ++-
 SimplifyCFG.cpp |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Utils/Local.cpp
diff -u llvm/lib/Transforms/Utils/Local.cpp:1.59 
llvm/lib/Transforms/Utils/Local.cpp:1.60
--- llvm/lib/Transforms/Utils/Local.cpp:1.59Fri Oct 20 02:07:24 2006
+++ llvm/lib/Transforms/Utils/Local.cpp Wed Nov  8 00:47:33 2006
@@ -120,7 +120,8 @@
 }
 return 0;
   case Instruction::Shl:
-  case Instruction::Shr:
+  case Instruction::LShr:
+  case Instruction::AShr:
 return ConstantExpr::get(Opc, Ops[0], Ops[1]);
   case Instruction::Cast:
 return ConstantExpr::getCast(Ops[0], DestTy);


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.103 
llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.104
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.103 Thu Nov  2 14:25:50 2006
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp   Wed Nov  8 00:47:33 2006
@@ -368,7 +368,8 @@
   case Instruction::Or:
   case Instruction::Xor:
   case Instruction::Shl:
-  case Instruction::Shr:
+  case Instruction::LShr:
+  case Instruction::AShr:
   case Instruction::SetEQ:
   case Instruction::SetNE:
   case Instruction::SetLT:



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


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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/CodeGen:

IntrinsicLowering.cpp updated: 1.44 -> 1.45
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 IntrinsicLowering.cpp |   52 +-
 1 files changed, 14 insertions(+), 38 deletions(-)


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.44 
llvm/lib/CodeGen/IntrinsicLowering.cpp:1.45
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.44 Fri Oct 20 02:07:24 2006
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp  Wed Nov  8 00:47:33 2006
@@ -138,12 +138,6 @@
 static Value *LowerBSWAP(Value *V, Instruction *IP) {
   assert(V->getType()->isInteger() && "Can't bswap a non-integer type!");
 
-  const Type *DestTy = V->getType();
-  
-  // Force to unsigned so that the shift rights are logical.
-  if (DestTy->isSigned())
-V = new CastInst(V, DestTy->getUnsignedVersion(), V->getName(), IP);
-
   unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
   
   switch(BitSize) {
@@ -151,7 +145,7 @@
   case 16: {
 Value *Tmp1 = new ShiftInst(Instruction::Shl, V,
 
ConstantInt::get(Type::UByteTy,8),"bswap.2",IP);
-Value *Tmp2 = new ShiftInst(Instruction::Shr, V,
+Value *Tmp2 = new ShiftInst(Instruction::LShr, V,
 
ConstantInt::get(Type::UByteTy,8),"bswap.1",IP);
 V = BinaryOperator::createOr(Tmp1, Tmp2, "bswap.i16", IP);
 break;
@@ -160,10 +154,10 @@
 Value *Tmp4 = new ShiftInst(Instruction::Shl, V,
   ConstantInt::get(Type::UByteTy,24),"bswap.4", 
IP);
 Value *Tmp3 = new ShiftInst(Instruction::Shl, V,
-
ConstantInt::get(Type::UByteTy,8),"bswap.3",IP);
-Value *Tmp2 = new ShiftInst(Instruction::Shr, V,
-
ConstantInt::get(Type::UByteTy,8),"bswap.2",IP);
-Value *Tmp1 = new ShiftInst(Instruction::Shr, V,
+  ConstantInt::get(Type::UByteTy,8),"bswap.3",IP);
+Value *Tmp2 = new ShiftInst(Instruction::LShr, V,
+  ConstantInt::get(Type::UByteTy,8),"bswap.2",IP);
+Value *Tmp1 = new ShiftInst(Instruction::LShr, V,
   ConstantInt::get(Type::UByteTy,24),"bswap.1", 
IP);
 Tmp3 = BinaryOperator::createAnd(Tmp3, 
  ConstantInt::get(Type::UIntTy, 0xFF),
@@ -184,14 +178,14 @@
 Value *Tmp6 = new ShiftInst(Instruction::Shl, V,
   ConstantInt::get(Type::UByteTy,24),"bswap.6", 
IP);
 Value *Tmp5 = new ShiftInst(Instruction::Shl, V,
-
ConstantInt::get(Type::UByteTy,8),"bswap.5",IP);
-Value *Tmp4 = new ShiftInst(Instruction::Shr, V,
-
ConstantInt::get(Type::UByteTy,8),"bswap.4",IP);
-Value *Tmp3 = new ShiftInst(Instruction::Shr, V,
+  ConstantInt::get(Type::UByteTy,8),"bswap.5", IP);
+Value* Tmp4 = new ShiftInst(Instruction::LShr, V,
+  ConstantInt::get(Type::UByteTy,8),"bswap.4", IP);
+Value* Tmp3 = new ShiftInst(Instruction::LShr, V,
   ConstantInt::get(Type::UByteTy,24),"bswap.3", 
IP);
-Value *Tmp2 = new ShiftInst(Instruction::Shr, V,
+Value* Tmp2 = new ShiftInst(Instruction::LShr, V,
   ConstantInt::get(Type::UByteTy,40),"bswap.2", 
IP);
-Value *Tmp1 = new ShiftInst(Instruction::Shr, V,
+Value* Tmp1 = new ShiftInst(Instruction::LShr, V,
   ConstantInt::get(Type::UByteTy,56),"bswap.1", 
IP);
 Tmp7 = BinaryOperator::createAnd(Tmp7,
  ConstantInt::get(Type::ULongTy, 
@@ -222,9 +216,6 @@
 break;
   }
   }
-  
-  if (V->getType() != DestTy)
-V = new CastInst(V, DestTy, V->getName(), IP);
   return V;
 }
 
@@ -239,48 +230,33 @@
 0xULL, 0xULL
   };
 
-  const Type *DestTy = V->getType();
-
-  // Force to unsigned so that the shift rights are logical.
-  if (DestTy->isSigned())
-V = new CastInst(V, DestTy->getUnsignedVersion(), V->getName(), IP);
-
   unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
+
   for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) {
 Value *MaskCst =
   ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]),
  V->getType());
 Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP);
-Value *VShift = new ShiftInst(Instruction::Shr, V,
+Value *VShift = new ShiftInst(Instruction::LShr, V,
   ConstantInt::get(Type::UByteTy, i), "ctpop.sh", IP);
 Value *RHS = BinaryOperator::createAnd(VShi

[llvm-commits] CVS: llvm/lib/Analysis/IPA/Andersens.cpp

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/Analysis/IPA:

Andersens.cpp updated: 1.34 -> 1.35
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

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


Index: llvm/lib/Analysis/IPA/Andersens.cpp
diff -u llvm/lib/Analysis/IPA/Andersens.cpp:1.34 
llvm/lib/Analysis/IPA/Andersens.cpp:1.35
--- llvm/lib/Analysis/IPA/Andersens.cpp:1.34Thu Nov  2 14:25:49 2006
+++ llvm/lib/Analysis/IPA/Andersens.cpp Wed Nov  8 00:47:33 2006
@@ -784,7 +784,8 @@
   case Instruction::Unreachable:
   case Instruction::Free:
   case Instruction::Shl:
-  case Instruction::Shr:
+  case Instruction::LShr:
+  case Instruction::AShr:
 return;
   default:
 // Is this something we aren't handling yet?



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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.536 -> 1.537
ScalarReplAggregates.cpp updated: 1.48 -> 1.49
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


---
Diffs of the changes:  (+179 -207)

 InstructionCombining.cpp |  379 +--
 ScalarReplAggregates.cpp |7 
 2 files changed, 179 insertions(+), 207 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.536 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.537
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.536   Fri Nov  3 
16:45:50 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Nov  8 00:47:33 2006
@@ -731,7 +731,7 @@
   return;
 }
 break;
-  case Instruction::Shr:
+  case Instruction::LShr:
 // (ushr X, C1) & C2 == 0   iff  (-1 >> C1) & C2 == 0
 if (ConstantInt *SA = dyn_cast(I->getOperand(1))) {
   // Compute the new bits that are at the top now.
@@ -739,29 +739,39 @@
   uint64_t HighBits = (1ULL << ShiftAmt)-1;
   HighBits <<= I->getType()->getPrimitiveSizeInBits()-ShiftAmt;
   
-  if (I->getType()->isUnsigned()) {   // Unsigned shift right.
-Mask <<= ShiftAmt;
-ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1);
-assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); 
-KnownZero >>= ShiftAmt;
-KnownOne  >>= ShiftAmt;
-KnownZero |= HighBits;  // high bits known zero.
-  } else {
-Mask <<= ShiftAmt;
-ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1);
-assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); 
-KnownZero >>= ShiftAmt;
-KnownOne  >>= ShiftAmt;
+  // Unsigned shift right.
+  Mask <<= ShiftAmt;
+  ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1);
+  assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); 
+  KnownZero >>= ShiftAmt;
+  KnownOne  >>= ShiftAmt;
+  KnownZero |= HighBits;  // high bits known zero.
+  return;
+}
+break;
+  case Instruction::AShr:
+// (ushr X, C1) & C2 == 0   iff  (-1 >> C1) & C2 == 0
+if (ConstantInt *SA = dyn_cast(I->getOperand(1))) {
+  // Compute the new bits that are at the top now.
+  uint64_t ShiftAmt = SA->getZExtValue();
+  uint64_t HighBits = (1ULL << ShiftAmt)-1;
+  HighBits <<= I->getType()->getPrimitiveSizeInBits()-ShiftAmt;
+  
+  // Signed shift right.
+  Mask <<= ShiftAmt;
+  ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1);
+  assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); 
+  KnownZero >>= ShiftAmt;
+  KnownOne  >>= ShiftAmt;
 
-// Handle the sign bits.
-uint64_t SignBit = 1ULL << (I->getType()->getPrimitiveSizeInBits()-1);
-SignBit >>= ShiftAmt;  // Adjust to where it is now in the mask.
+  // Handle the sign bits.
+  uint64_t SignBit = 1ULL << (I->getType()->getPrimitiveSizeInBits()-1);
+  SignBit >>= ShiftAmt;  // Adjust to where it is now in the mask.
 
-if (KnownZero & SignBit) {   // New bits are known zero.
-  KnownZero |= HighBits;
-} else if (KnownOne & SignBit) { // New bits are known one.
-  KnownOne |= HighBits;
-}
+  if (KnownZero & SignBit) {   // New bits are known zero.
+KnownZero |= HighBits;
+  } else if (KnownOne & SignBit) { // New bits are known one.
+KnownOne |= HighBits;
   }
   return;
 }
@@ -1119,21 +1129,37 @@
   KnownZero |= (1ULL << ShiftAmt) - 1;  // low bits known zero.
 }
 break;
-  case Instruction::Shr:
+  case Instruction::LShr:
+// For a logical shift right
+if (ConstantInt *SA = dyn_cast(I->getOperand(1))) {
+  unsigned ShiftAmt = SA->getZExtValue();
+  
+  // Compute the new bits that are at the top now.
+  uint64_t HighBits = (1ULL << ShiftAmt)-1;
+  HighBits <<= I->getType()->getPrimitiveSizeInBits() - ShiftAmt;
+  uint64_t TypeMask = I->getType()->getIntegralTypeMask();
+  // Unsigned shift right.
+  if (SimplifyDemandedBits(I->getOperand(0),
+  (DemandedMask << ShiftAmt) & TypeMask,
+   KnownZero, KnownOne, Depth+1))
+return true;
+  assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); 
+  KnownZero &= TypeMask;
+  KnownOne  &= TypeMask;
+  KnownZero >>= ShiftAmt;
+  KnownOne  >>= ShiftAmt;
+  KnownZero |= HighBits;  // high bits known zero.
+}
+break;
+  case Instruction::AShr:
 // If this is an arithm

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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.202 -> 1.203
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 Reader.cpp |   18 +++---
 1 files changed, 15 insertions(+), 3 deletions(-)


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.202 
llvm/lib/Bytecode/Reader/Reader.cpp:1.203
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.202   Thu Nov  2 14:25:49 2006
+++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Nov  8 00:47:33 2006
@@ -719,7 +719,15 @@
   Opcode = Instruction::Shl;
   break;
 case 31: // Shr
-  Opcode = Instruction::Shr;
+  // The type of the instruction is based on the operands. We need to 
+  // select ashr or lshr based on that type. The iType values are hardcoded
+  // to the values used in bytecode version 5 (and prior) because it is 
+  // likely these codes will change in future versions of LLVM. This if 
+  // statement says "if (integer type and signed)"
+  if (iType >= 2 && iType <= 9 && iType % 2 != 0)
+Opcode = Instruction::AShr;
+  else
+Opcode = Instruction::LShr;
   break;
 case 32: { //VANext_old ( <= llvm 1.5 )
   const Type* ArgTy = getValue(iType, Oprnds[0])->getType();
@@ -987,7 +995,8 @@
 }
 
 case Instruction::Shl:
-case Instruction::Shr:
+case Instruction::LShr:
+case Instruction::AShr:
   Result = new ShiftInst(Instruction::OtherOps(Opcode),
  getValue(iType, Oprnds[0]),
  getValue(Type::UByteTyID, Oprnds[1]));
@@ -1707,7 +1716,10 @@
   Opcode = Instruction::Shl;
   break;
 case 31: // Shr
-  Opcode = Instruction::Shr;
+  if (ArgVec[0]->getType()->isSigned())
+Opcode = Instruction::AShr;
+  else
+Opcode = Instruction::LShr;
   break;
 case 34: // Select
   Opcode = Instruction::Select;



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


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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/projects/Stacker/lib/compiler:

StackerCompiler.cpp updated: 1.22 -> 1.23
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

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


Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp
diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.22 
llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.23
--- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.22 Thu Nov  2 
14:25:50 2006
+++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp  Wed Nov  8 
00:47:33 2006
@@ -1257,7 +1257,7 @@
 LoadInst* op2 = cast(pop_integer(bb));
 CastInst* castop = new CastInst( op1, Type::UByteTy );
 bb->getInstList().push_back( castop );
-ShiftInst* shrop = new ShiftInst( Instruction::Shr, op2, castop );
+ShiftInst* shrop = new ShiftInst( Instruction::AShr, op2, castop );
 bb->getInstList().push_back( shrop );
 push_value( bb, shrop );
 break;



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


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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Execution.cpp updated: 1.145 -> 1.146
Interpreter.h updated: 1.75 -> 1.76
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 Execution.cpp |   69 ++
 Interpreter.h |3 +-
 2 files changed, 52 insertions(+), 20 deletions(-)


Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.145 
llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.146
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.145Thu Nov  2 
02:12:02 2006
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp  Wed Nov  8 00:47:33 2006
@@ -72,8 +72,10 @@
const Type *Ty);
 static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2,
const Type *Ty);
-static GenericValue executeShrInst(GenericValue Src1, GenericValue Src2,
-   const Type *Ty);
+static GenericValue executeLShrInst(GenericValue Src1, GenericValue Src2,
+const Type *Ty);
+static GenericValue executeAShrInst(GenericValue Src1, GenericValue Src2,
+const Type *Ty);
 static GenericValue executeSelectInst(GenericValue Src1, GenericValue Src2,
   GenericValue Src3);
 
@@ -161,10 +163,14 @@
 return executeShlInst(getOperandValue(CE->getOperand(0), SF),
   getOperandValue(CE->getOperand(1), SF),
   CE->getOperand(0)->getType());
-  case Instruction::Shr:
-return executeShrInst(getOperandValue(CE->getOperand(0), SF),
-  getOperandValue(CE->getOperand(1), SF),
-  CE->getOperand(0)->getType());
+  case Instruction::LShr:
+return executeLShrInst(getOperandValue(CE->getOperand(0), SF),
+   getOperandValue(CE->getOperand(1), SF),
+   CE->getOperand(0)->getType());
+  case Instruction::AShr:
+return executeAShrInst(getOperandValue(CE->getOperand(0), SF),
+   getOperandValue(CE->getOperand(1), SF),
+   CE->getOperand(0)->getType());
   case Instruction::Select:
 return executeSelectInst(getOperandValue(CE->getOperand(0), SF),
  getOperandValue(CE->getOperand(1), SF),
@@ -943,6 +949,10 @@
 #define IMPLEMENT_SHIFT(OP, TY) \
case Type::TY##TyID: Dest.TY##Val = Src1.TY##Val OP Src2.UByteVal; break
 
+#define IMPLEMENT_SIGNLESS_SHIFT(OP, TY1, TY2) \
+   case Type::TY2##TyID: \
+   IMPLEMENT_SHIFT(OP, TY1) 
+
 static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2,
const Type *Ty) {
   GenericValue Dest;
@@ -961,20 +971,31 @@
   return Dest;
 }
 
-static GenericValue executeShrInst(GenericValue Src1, GenericValue Src2,
-   const Type *Ty) {
+static GenericValue executeLShrInst(GenericValue Src1, GenericValue Src2,
+const Type *Ty) {
+  GenericValue Dest;
+  switch (Ty->getTypeID()) {
+IMPLEMENT_SIGNLESS_SHIFT(>>, UByte,  SByte);
+IMPLEMENT_SIGNLESS_SHIFT(>>, UShort, Short);
+IMPLEMENT_SIGNLESS_SHIFT(>>, UInt,   Int);
+IMPLEMENT_SIGNLESS_SHIFT(>>, ULong,  Long);
+  default:
+std::cout << "Unhandled type for LShr instruction: " << *Ty << "\n";
+abort();
+  }
+  return Dest;
+}
+
+static GenericValue executeAShrInst(GenericValue Src1, GenericValue Src2,
+const Type *Ty) {
   GenericValue Dest;
   switch (Ty->getTypeID()) {
-IMPLEMENT_SHIFT(>>, UByte);
-IMPLEMENT_SHIFT(>>, SByte);
-IMPLEMENT_SHIFT(>>, UShort);
-IMPLEMENT_SHIFT(>>, Short);
-IMPLEMENT_SHIFT(>>, UInt);
-IMPLEMENT_SHIFT(>>, Int);
-IMPLEMENT_SHIFT(>>, ULong);
-IMPLEMENT_SHIFT(>>, Long);
+IMPLEMENT_SIGNLESS_SHIFT(>>, SByte, UByte);
+IMPLEMENT_SIGNLESS_SHIFT(>>, Short, UShort);
+IMPLEMENT_SIGNLESS_SHIFT(>>, Int,   UInt);
+IMPLEMENT_SIGNLESS_SHIFT(>>, Long,  ULong);
   default:
-std::cout << "Unhandled type for Shr instruction: " << *Ty << "\n";
+std::cout << "Unhandled type for AShr instruction: " << *Ty << "\n";
 abort();
   }
   return Dest;
@@ -990,13 +1011,23 @@
   SetValue(&I, Dest, SF);
 }
 
-void Interpreter::visitShr(ShiftInst &I) {
+void Interpreter::visitLShr(ShiftInst &I) {
+  ExecutionContext &SF = ECStack.back();
+  const Type *Ty= I.getOperand(0)->getType();
+  GenericValue Src1 = getOperandValue(I.getOperand(0), SF);
+  GenericValue Src2 = getOperandValue(I.getOperand(1), SF);
+  GenericValue Dest;
+  Dest = executeLShrInst 

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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.12 -> 1.13
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 PatternMatch.h |   46 +++---
 1 files changed, 43 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.12 
llvm/include/llvm/Support/PatternMatch.h:1.13
--- llvm/include/llvm/Support/PatternMatch.h:1.12   Mon Nov  6 12:47:14 2006
+++ llvm/include/llvm/Support/PatternMatch.hWed Nov  8 00:47:32 2006
@@ -172,9 +172,49 @@
 }
 
 template
-inline BinaryOp_match m_Shr(const LHS &L, const RHS &R) {
-  return BinaryOp_match(L, R);
+inline BinaryOp_match m_LShr(const LHS &L, const RHS &R) {
+  return BinaryOp_match(L, R);
+}
+
+template
+inline BinaryOp_match m_AShr(const LHS &L, const RHS &R) {
+  return BinaryOp_match(L, R);
+}
+
+//===--===//
+// Matchers for either AShr or LShr .. for convenience
+//
+template
+struct Shr_match {
+  LHS_t L;
+  RHS_t R;
+
+  Shr_match(const LHS_t &LHS, const RHS_t &RHS) : L(LHS), R(RHS) {}
+
+  template
+  bool match(OpTy *V) {
+if (V->getValueType() == Value::InstructionVal + Instruction::LShr ||
+V->getValueType() == Value::InstructionVal + Instruction::AShr) {
+  ConcreteTy *I = cast(V);
+  return (I->getOpcode() == Instruction::AShr ||
+  I->getOpcode() == Instruction::LShr) &&
+ L.match(I->getOperand(0)) &&
+ R.match(I->getOperand(1));
+}
+if (ConstantExpr *CE = dyn_cast(V))
+  return (CE->getOpcode() == Instruction::LShr ||
+  CE->getOpcode() == Instruction::AShr) &&
+ L.match(CE->getOperand(0)) &&
+ R.match(CE->getOperand(1));
+return false;
+  }
+};
+
+template
+inline Shr_match m_Shr(const LHS &L, const RHS &R) {
+  return Shr_match(L, R);
 }
 
 
//===--===//



___
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 Instruction.def Instructions.h

2006-11-07 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.93 -> 1.94
Instruction.def updated: 1.21 -> 1.22
Instructions.h updated: 1.44 -> 1.45
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 Constants.h |6 ++
 Instruction.def |   25 +
 Instructions.h  |   12 +---
 3 files changed, 24 insertions(+), 19 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.93 llvm/include/llvm/Constants.h:1.94
--- llvm/include/llvm/Constants.h:1.93  Wed Nov  1 19:53:58 2006
+++ llvm/include/llvm/Constants.h   Wed Nov  8 00:47:32 2006
@@ -564,10 +564,8 @@
   static Constant *getSetLE(Constant *C1, Constant *C2);
   static Constant *getSetGE(Constant *C1, Constant *C2);
   static Constant *getShl(Constant *C1, Constant *C2);
-  static Constant *getShr(Constant *C1, Constant *C2);
-
-  static Constant *getUShr(Constant *C1, Constant *C2); // unsigned shr
-  static Constant *getSShr(Constant *C1, Constant *C2); // signed shr
+  static Constant *getLShr(Constant *C1, Constant *C2);
+  static Constant *getAShr(Constant *C1, Constant *C2);
 
   /// Getelementptr form.  std::vector is only accepted for 
convenience:
   /// all elements must be Constant's.


Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.21 
llvm/include/llvm/Instruction.def:1.22
--- llvm/include/llvm/Instruction.def:1.21  Wed Nov  1 19:53:58 2006
+++ llvm/include/llvm/Instruction.def   Wed Nov  8 00:47:32 2006
@@ -15,8 +15,8 @@
 
 // NOTE: NO INCLUDE GUARD DESIRED!
 
-// Provide definitions of macros so that users of this file do not have to 
define
-// everything to use it...
+// Provide definitions of macros so that users of this file do not have to 
+// define everything to use it...
 //
 #ifndef FIRST_TERM_INST
 #define FIRST_TERM_INST(num)
@@ -129,16 +129,17 @@
 HANDLE_OTHER_INST(31, PHI, PHINode)  // PHI node instruction
 HANDLE_OTHER_INST(32, Cast   , CastInst   )  // Type cast
 HANDLE_OTHER_INST(33, Call   , CallInst   )  // Call a function
-HANDLE_OTHER_INST(34, Shl, ShiftInst  )  // Shift operations
-HANDLE_OTHER_INST(35, Shr, ShiftInst  )
-HANDLE_OTHER_INST(36, Select , SelectInst )  // select instruction
-HANDLE_OTHER_INST(37, UserOp1, Instruction)  // May be used internally in a 
pass
-HANDLE_OTHER_INST(38, UserOp2, Instruction)
-HANDLE_OTHER_INST(39, VAArg  , VAArgInst  )  // vaarg instruction
-HANDLE_OTHER_INST(40, ExtractElement, ExtractElementInst)// extract from 
vector.
-HANDLE_OTHER_INST(41, InsertElement, InsertElementInst)  // insert into vector
-HANDLE_OTHER_INST(42, ShuffleVector, ShuffleVectorInst)  // shuffle two 
vectors.
-  LAST_OTHER_INST(42)
+HANDLE_OTHER_INST(34, Shl, ShiftInst  )  // Shift Left operations (logical)
+HANDLE_OTHER_INST(35, LShr   , ShiftInst  )  // Logical Shift right (unsigned) 
+HANDLE_OTHER_INST(36, AShr   , ShiftInst  )  // Arithmetic shift right (signed)
+HANDLE_OTHER_INST(37, Select , SelectInst )  // select instruction
+HANDLE_OTHER_INST(38, UserOp1, Instruction)  // May be used internally in a 
pass
+HANDLE_OTHER_INST(39, UserOp2, Instruction)  // Internal to passes only
+HANDLE_OTHER_INST(40, VAArg  , VAArgInst  )  // vaarg instruction
+HANDLE_OTHER_INST(41, ExtractElement, ExtractElementInst)// extract from 
vector.
+HANDLE_OTHER_INST(42, InsertElement, InsertElementInst)  // insert into vector
+HANDLE_OTHER_INST(43, ShuffleVector, ShuffleVectorInst)  // shuffle two 
vectors.
+  LAST_OTHER_INST(43)
 
 #undef  FIRST_TERM_INST
 #undef HANDLE_TERM_INST


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.44 
llvm/include/llvm/Instructions.h:1.45
--- llvm/include/llvm/Instructions.h:1.44   Thu Oct  5 01:24:58 2006
+++ llvm/include/llvm/Instructions.hWed Nov  8 00:47:32 2006
@@ -604,7 +604,8 @@
 Ops[1].init(SI.Ops[1], this);
   }
   void init(OtherOps Opcode, Value *S, Value *SA) {
-assert((Opcode == Shl || Opcode == Shr) && "ShiftInst Opcode invalid!");
+assert((Opcode == Shl || Opcode == LShr || Opcode == AShr) && 
+  "ShiftInst Opcode invalid!");
 Ops[0].init(S, this);
 Ops[1].init(SA, this);
   }
@@ -638,7 +639,11 @@
 
   /// isLogicalShift - Return true if this is a logical shift left or a logical
   /// shift right.
-  bool isLogicalShift() const;
+  bool isLogicalShift() const {
+unsigned opcode = getOpcode();
+return opcode == Instruction::Shl || opcode == Instruction::LShr;
+  }
+
 
   /// isArithmeticShift - Return true if this is a sign-extending shift right
   /// operation.
@@ -652,7 +657,8 @@
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ShiftInst *) { return true; }
   static inline bool class

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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/Transforms:

ExprTypeConvert.cpp updated: 1.111 -> 1.112
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 ExprTypeConvert.cpp |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/ExprTypeConvert.cpp
diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.111 
llvm/lib/Transforms/ExprTypeConvert.cpp:1.112
--- llvm/lib/Transforms/ExprTypeConvert.cpp:1.111   Thu Nov  2 14:25:50 2006
+++ llvm/lib/Transforms/ExprTypeConvert.cpp Wed Nov  8 00:47:33 2006
@@ -76,10 +76,12 @@
 !ExpressionConvertibleToType(I->getOperand(1), Ty, CTMap, TD))
   return false;
 break;
-  case Instruction::Shr:
+  case Instruction::LShr:
+  case Instruction::AShr:
 if (!Ty->isInteger()) return false;
-if (Ty->isSigned() != V->getType()->isSigned()) return false;
-// FALL THROUGH
+if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD))
+  return false;
+break;
   case Instruction::Shl:
 if (!Ty->isInteger()) return false;
 if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD))
@@ -243,7 +245,8 @@
 break;
 
   case Instruction::Shl:
-  case Instruction::Shr:
+  case Instruction::LShr:
+  case Instruction::AShr:
 Res = new ShiftInst(cast(I)->getOpcode(), Dummy,
 I->getOperand(1), Name);
 VMC.ExprMap[I] = Res;
@@ -476,7 +479,8 @@
 Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0);
 return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD);
   }
-  case Instruction::Shr:
+  case Instruction::LShr:
+  case Instruction::AShr:
 if (Ty->isSigned() != V->getType()->isSigned()) return false;
 // FALL THROUGH
   case Instruction::Shl:
@@ -746,7 +750,8 @@
 break;
   }
   case Instruction::Shl:
-  case Instruction::Shr:
+  case Instruction::LShr:
+  case Instruction::AShr:
 assert(I->getOperand(0) == OldVal);
 Res = new ShiftInst(cast(I)->getOpcode(), NewVal,
 I->getOperand(1), Name);



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


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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.97 -> 1.98
Constants.cpp updated: 1.169 -> 1.170
Instruction.cpp updated: 1.56 -> 1.57
Instructions.cpp updated: 1.45 -> 1.46
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 ConstantFolding.cpp |   62 +++-
 Constants.cpp   |   37 ++-
 Instruction.cpp |3 +-
 Instructions.cpp|   11 -
 4 files changed, 52 insertions(+), 61 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.97 
llvm/lib/VMCore/ConstantFolding.cpp:1.98
--- llvm/lib/VMCore/ConstantFolding.cpp:1.97Thu Nov  2 02:18:15 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp Wed Nov  8 00:47:33 2006
@@ -50,7 +50,8 @@
 virtual Constant *op_or (const Constant *V1, const Constant *V2) const = 0;
 virtual Constant *op_xor(const Constant *V1, const Constant *V2) const = 0;
 virtual Constant *shl(const Constant *V1, const Constant *V2) const = 0;
-virtual Constant *shr(const Constant *V1, const Constant *V2) const = 0;
+virtual Constant *lshr(const Constant *V1, const Constant *V2) const = 0;
+virtual Constant *ashr(const Constant *V1, const Constant *V2) const = 0;
 virtual Constant *lessthan(const Constant *V1, const Constant *V2) const 
=0;
 virtual Constant *equalto(const Constant *V1, const Constant *V2) const = 
0;
 
@@ -140,8 +141,11 @@
   virtual Constant *shl(const Constant *V1, const Constant *V2) const {
 return SubClassName::Shl((const ArgType *)V1, (const ArgType *)V2);
   }
-  virtual Constant *shr(const Constant *V1, const Constant *V2) const {
-return SubClassName::Shr((const ArgType *)V1, (const ArgType *)V2);
+  virtual Constant *lshr(const Constant *V1, const Constant *V2) const {
+return SubClassName::LShr((const ArgType *)V1, (const ArgType *)V2);
+  }
+  virtual Constant *ashr(const Constant *V1, const Constant *V2) const {
+return SubClassName::AShr((const ArgType *)V1, (const ArgType *)V2);
   }
 
   virtual Constant *lessthan(const Constant *V1, const Constant *V2) const {
@@ -207,7 +211,8 @@
   static Constant *Or  (const ArgType *V1, const ArgType *V2) { return 0; }
   static Constant *Xor (const ArgType *V1, const ArgType *V2) { return 0; }
   static Constant *Shl (const ArgType *V1, const ArgType *V2) { return 0; }
-  static Constant *Shr (const ArgType *V1, const ArgType *V2) { return 0; }
+  static Constant *LShr(const ArgType *V1, const ArgType *V2) { return 0; }
+  static Constant *AShr(const ArgType *V1, const ArgType *V2) { return 0; }
   static Constant *LessThan(const ArgType *V1, const ArgType *V2) {
 return 0;
   }
@@ -420,12 +425,6 @@
   static Constant *Xor(const ConstantPacked *V1, const ConstantPacked *V2) {
 return EvalVectorOp(V1, V2, ConstantExpr::getXor);
   }
-  static Constant *Shl(const ConstantPacked *V1, const ConstantPacked *V2) {
-return EvalVectorOp(V1, V2, ConstantExpr::getShl);
-  }
-  static Constant *Shr(const ConstantPacked *V1, const ConstantPacked *V2) {
-return EvalVectorOp(V1, V2, ConstantExpr::getShr);
-  }
   static Constant *LessThan(const ConstantPacked *V1, const ConstantPacked 
*V2){
 return 0;
   }
@@ -581,9 +580,13 @@
 return ConstantInt::get(*Ty, R);
   }
 
-  static Constant *Shr(const ConstantInt *V1, const ConstantInt *V2) {
-BuiltinType R = 
-  (BuiltinType)V1->getZExtValue() >> (BuiltinType)V2->getZExtValue();
+  static Constant *LShr(const ConstantInt *V1, const ConstantInt *V2) {
+BuiltinType R = BuiltinType(V1->getZExtValue() >> V2->getZExtValue());
+return ConstantInt::get(*Ty, R);
+  }
+
+  static Constant *AShr(const ConstantInt *V1, const ConstantInt *V2) {
+BuiltinType R = BuiltinType(V1->getSExtValue() >> V2->getZExtValue());
 return ConstantInt::get(*Ty, R);
   }
 };
@@ -1278,7 +1281,8 @@
   case Instruction::Or:  C = ConstRules::get(V1, V2).op_or (V1, V2); break;
   case Instruction::Xor: C = ConstRules::get(V1, V2).op_xor(V1, V2); break;
   case Instruction::Shl: C = ConstRules::get(V1, V2).shl(V1, V2); break;
-  case Instruction::Shr: C = ConstRules::get(V1, V2).shr(V1, V2); break;
+  case Instruction::LShr:C = ConstRules::get(V1, V2).lshr(V1, V2); break;
+  case Instruction::AShr:C = ConstRules::get(V1, V2).ashr(V1, V2); break;
   case Instruction::SetEQ:   C = ConstRules::get(V1, V2).equalto(V1, V2); 
break;
   case Instruction::SetLT:   C = ConstRules::get(V1, V2).lessthan(V1, 
V2);break;
   case Instruction::SetGT:   C = ConstRules::get(V1, V2).lessthan(V2, 
V1);break;
@@ -1366,21 +1370,20 @@
   return const_cast(V2);// X / undef -> undef
 case Instruction::Or:  // 

[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/shift-sra.ll

2006-11-07 Thread Reid Spencer


Changes in directory llvm/test/Regression/Transforms/InstCombine:

shift-sra.ll updated: 1.1 -> 1.2
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 shift-sra.ll |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/Regression/Transforms/InstCombine/shift-sra.ll
diff -u llvm/test/Regression/Transforms/InstCombine/shift-sra.ll:1.1 
llvm/test/Regression/Transforms/InstCombine/shift-sra.ll:1.2
--- llvm/test/Regression/Transforms/InstCombine/shift-sra.ll:1.1Sun Sep 
17 23:31:18 2006
+++ llvm/test/Regression/Transforms/InstCombine/shift-sra.llWed Nov  8 
00:47:33 2006
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'shr int'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'lshr int'
 
 int %test0(int %X, ubyte %A) {
%Y = shr int %X, ubyte %A  ; can be logical shift.



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


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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.315 -> 1.316
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.315 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.316
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.315Thu Nov  2 
14:25:49 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Wed Nov  8 00:47:33 2006
@@ -538,10 +538,8 @@
   void visitOr (User &I) { visitIntBinary(I, ISD::OR,  ISD::VOR); }
   void visitXor(User &I) { visitIntBinary(I, ISD::XOR, ISD::VXOR); }
   void visitShl(User &I) { visitShift(I, ISD::SHL); }
-  void visitShr(User &I) { 
-visitShift(I, I.getType()->isUnsigned() ? ISD::SRL : ISD::SRA);
-  }
-
+  void visitLShr(User &I) { visitShift(I, ISD::SRL); }
+  void visitAShr(User &I) { visitShift(I, ISD::SRA); }
   void visitSetCC(User &I, ISD::CondCode SignedOpc, ISD::CondCode UnsignedOpc,
   ISD::CondCode FPOpc);
   void visitSetEQ(User &I) { visitSetCC(I, ISD::SETEQ, ISD::SETEQ, 



___
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

2006-11-07 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.240 -> 1.241
---
Log message:

Fixed a minor bug preventing some pre-indexed load / store transformation.


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

 DAGCombiner.cpp |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.240 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.241
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.240 Tue Nov  7 20:38:55 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Wed Nov  8 00:56:05 2006
@@ -239,8 +239,8 @@
   }
 
   // Now check for #1 and #2.
-  unsigned NumRealUses = 0;
   if (OffIsAMImm) {
+unsigned NumRealUses = 0;
 for (SDNode::use_iterator I = Ptr.Val->use_begin(),
E = Ptr.Val->use_end(); I != E; ++I) {
   SDNode *Use = *I;
@@ -260,9 +260,9 @@
   } else
 NumRealUses++;
 }
+if (NumRealUses == 0)
+  return false;
   }
-  if (NumRealUses == 0)
-return false;
 
   SDOperand Result = isLoad
 ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM)



___
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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.162 -> 1.163
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


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

 LangRef.html |   73 +++
 1 files changed, 54 insertions(+), 19 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.162 llvm/docs/LangRef.html:1.163
--- llvm/docs/LangRef.html:1.162Tue Nov  7 19:18:52 2006
+++ llvm/docs/LangRef.html  Wed Nov  8 00:47:32 2006
@@ -92,7 +92,8 @@
   'or'  Instruction
   'xor' Instruction
   'shl' Instruction
-  'shr' Instruction
+  'lshr' Instruction
+  'ashr' Instruction
 
   
   Vector Operations
@@ -2070,30 +2071,64 @@
 
 
 
- 'shr'
+ 'lshr'
 Instruction 
 
 Syntax:
-   = shr  , ubyte    ; 
yields {ty}:result
+   = lshr  , ubyte    
; yields {ty}:result
 
+
 Overview:
-The 'shr' instruction returns the first operand shifted to
-the right a specified number of bits.
+The 'lshr' instruction (logical shift right) returns the first 
+operand shifted to the right a specified number of bits.
+
 Arguments:
-The first argument to the 'shr' instruction must be an integer type.  The second argument must be an 
'ubyte'
-type.
+The first argument to the 'lshr' instruction must be an integer type.  The second argument must be an 
'ubyte' type.
+
+Semantics:
+This instruction always performs a logical shift right operation, regardless
+of whether the arguments are unsigned or not. The var2 most 
significant
+bits will be filled with zero bits after the shift.
+
+Example:
+
+   = lshr uint 4, ubyte 1   ; yields {uint}:result = 2
+   = lshr int 4, ubyte 2; yields {uint}:result = 1
+   = lshr sbyte 4, ubyte 3  ; yields {sbyte}:result = 0
+   = lshr sbyte -2, ubyte 1 ; yields {sbyte}:result = 
0x7FFF 
+
+
+
+
+ 'ashr'
+Instruction 
+
+
+Syntax:
+   = ashr  , ubyte    
; yields {ty}:result
+
+
+Overview:
+The 'ashr' instruction (arithmetic shift right) returns the first 
+operand shifted to the right a specified number of bits.
+
+Arguments:
+The first argument to the 'ashr' instruction must be an 
+integer type.  The second argument must be an
+'ubyte' type.
+
 Semantics:
-If the first argument is a signed type, the
-most significant bit is duplicated in the newly free'd bit positions. 
-If the first argument is unsigned, zero bits shall fill the empty
-positions.
-Example:
-   = shr int 4, ubyte %var   ; yields {int}:result = 4 
>> %var
-   = shr uint 4, ubyte 1 ; yields {uint}:result = 2
-   = shr int 4, ubyte 2  ; yields {int}:result = 1
-   = shr sbyte 4, ubyte 3; yields {sbyte}:result = 0
-   = shr sbyte -2, ubyte 1   ; yields {sbyte}:result = -1
+This instruction always performs an arithmetic shift right operation, 
+regardless of whether the arguments are signed or not. The var2 most
+significant bits will be filled with the sign bit of var1.
+
+Example:
+
+   = ashr uint 4, ubyte 1; yields {uint}:result = 2
+   = ashr int 4, ubyte 2  ; yields {int}:result = 1
+   = ashr ubyte 4, ubyte 3; yields {ubyte}:result = 0
+   = ashr sbyte -2, ubyte 1   ; yields {sbyte}:result = -1
 
 
 
@@ -4381,7 +4416,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2006/11/08 01:18:52 $
+  Last modified: $Date: 2006/11/08 06:47:32 $
 
 
 



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


[llvm-commits] [llvm-gcc4] SHR Patch (Please Apply!)

2006-11-07 Thread Reid Spencer
This patch for llvm-gcc4 is needed to make llvm-gcc4 work correctly with
the just committed SHR patch.  Please commit at earliest convenience. If
you're building llvm-gcc4 and you have updated your LLVM tree to include
the SHR patch, please apply this to your llvm-gcc4 tree so that it will
compile correctly.

Thanks,

Reid.
Index: gcc/llvm-convert.cpp
===
--- gcc/llvm-convert.cpp	(revision 199)
+++ gcc/llvm-convert.cpp	(working copy)
@@ -570,12 +570,17 @@
   case TRUTH_AND_EXPR: Result = EmitTruthOp(exp, Instruction::And); break;
   case TRUTH_OR_EXPR:  Result = EmitTruthOp(exp, Instruction::Or); break;
   case TRUTH_XOR_EXPR: Result = EmitTruthOp(exp, Instruction::Xor); break;
-  case RSHIFT_EXPR:Result = EmitShiftOp(exp,DestLoc,Instruction::Shr);break;
+  case RSHIFT_EXPR:
+Result = EmitShiftOp(exp,DestLoc,
+   TYPE_UNSIGNED(TREE_TYPE(exp)) ? Instruction::LShr : Instruction::AShr);
+break;
   case LSHIFT_EXPR:Result = EmitShiftOp(exp,DestLoc,Instruction::Shl);break;
-  case RROTATE_EXPR:   Result = EmitRotateOp(exp, Instruction::Shr,
- Instruction::Shl); break;
-  case LROTATE_EXPR:   Result = EmitRotateOp(exp, Instruction::Shl, 
- Instruction::Shr); break;
+  case RROTATE_EXPR: 
+Result = EmitRotateOp(exp, Instruction::LShr, Instruction::Shl);
+break;
+  case LROTATE_EXPR:
+Result = EmitRotateOp(exp, Instruction::Shl, Instruction::LShr);
+break;
   case MIN_EXPR:   Result = EmitMinMaxExpr(exp, Instruction::SetLE); break;
   case MAX_EXPR:   Result = EmitMinMaxExpr(exp, Instruction::SetGE); break;
   case CONSTRUCTOR:Result = EmitCONSTRUCTOR(exp, DestLoc); break;
@@ -1723,7 +1728,8 @@
   }
 
   Value *ShAmt = ConstantInt::get(Type::UByteTy, ValSizeInBits-LV.BitSize);
-  Val = new ShiftInst(Instruction::Shr, Val, ShAmt, "tmp", CurBB);
+  Val = new ShiftInst( TYPE_UNSIGNED(TREE_TYPE(exp)) ? 
+Instruction::LShr : Instruction::AShr, Val, ShAmt, "tmp", CurBB);
 }
 
 return CastToType(Val, ConvertType(TREE_TYPE(exp)));
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm-gcc4] SHR Patch (Please Apply!)

2006-11-07 Thread Chris Lattner
applied, thanks

-Chris

On Nov 7, 2006, at 11:20 PM, Reid Spencer wrote:

> This patch for llvm-gcc4 is needed to make llvm-gcc4 work correctly  
> with
> the just committed SHR patch.  Please commit at earliest  
> convenience. If
> you're building llvm-gcc4 and you have updated your LLVM tree to  
> include
> the SHR patch, please apply this to your llvm-gcc4 tree so that it  
> will
> compile correctly.
>
> Thanks,
>
> Reid.
> 
> ___
> 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