[llvm-commits] fix cases of assert("foo")

2007-02-13 Thread Dan Gohman
While preparing http://llvm.org/PR1198 I noticed several asserts
protecting unprepared code from i128 types that weren't actually failing
when they should because they were written as assert("foo") instead of
something like assert(0 && "foo"). This patch fixes all the cases that a
quick grep found.

Dan

-- 
Dan Gohman, Cray Inc. <[EMAIL PROTECTED]>
Index: lib/Bytecode/Reader/Reader.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/Bytecode/Reader/Reader.cpp,v
retrieving revision 1.238
diff -u -r1.238 Reader.cpp
--- lib/Bytecode/Reader/Reader.cpp
+++ lib/Bytecode/Reader/Reader.cpp
@@ -1265,7 +1265,7 @@
   Result = ConstantInt::get(IT, Val);
   if (Handler) Handler->handleConstantValue(Result);
 } else 
-  assert("Integer types > 64 bits not supported");
+  assert(0 && "Integer types > 64 bits not supported");
 break;
   }
   case Type::FloatTyID: {
Index: lib/Bytecode/Writer/Writer.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/Bytecode/Writer/Writer.cpp,v
retrieving revision 1.166
diff -u -r1.166 Writer.cpp
--- lib/Bytecode/Writer/Writer.cpp
+++ lib/Bytecode/Writer/Writer.cpp
@@ -313,7 +313,7 @@
 else if (NumBits <= 64)
   output_vbr(uint64_t(cast(CPV)->getZExtValue()));
 else 
-  assert("Integer types > 64 bits not supported.");
+  assert(0 && "Integer types > 64 bits not supported.");
 break;
   }
 
Index: lib/ExecutionEngine/ExecutionEngine.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/ExecutionEngine/ExecutionEngine.cpp,v
retrieving revision 1.105
diff -u -r1.105 ExecutionEngine.cpp
--- lib/ExecutionEngine/ExecutionEngine.cpp
+++ lib/ExecutionEngine/ExecutionEngine.cpp
@@ -292,7 +292,7 @@
   const_cast(dyn_cast(GV)))
 EmitGlobalVariable(GVar);
   else
-assert("Global hasn't had an address allocated yet!");
+assert(0 && "Global hasn't had an address allocated yet!");
   return state.getGlobalAddressMap(locked)[GV];
 }
 
@@ -425,7 +425,7 @@
 else if (BitWidth <= 64)
   Result.Int64Val = (uint64_t )cast(C)->getZExtValue();
 else
-  assert("Integers with > 64-bits not implemented");
+  assert(0 && "Integers with > 64-bits not implemented");
 break;
   }
 
Index: lib/ExecutionEngine/Interpreter/Execution.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp,v
retrieving revision 1.169
diff -u -r1.169 Execution.cpp
--- lib/ExecutionEngine/Interpreter/Execution.cpp
+++ lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -1690,7 +1690,7 @@
   else if (BitWidth <= 64)
 Dest.Int64Val = Src.Int64Val;
   else
-assert("Integer types > 64 bits not supported");
+assert(0 && "Integer types > 64 bits not supported");
   maskToBitWidth(Dest, BitWidth);
 }
 IMPLEMENT_VAARG(Pointer);
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/CREDITS.TXT

2007-02-15 Thread Dan Gohman


Changes in directory llvm:

CREDITS.TXT updated: 1.67 -> 1.68
---
Log message:

Add myself to the credits.


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

 CREDITS.TXT |4 
 1 files changed, 4 insertions(+)


Index: llvm/CREDITS.TXT
diff -u llvm/CREDITS.TXT:1.67 llvm/CREDITS.TXT:1.68
--- llvm/CREDITS.TXT:1.67   Sun Jan  7 21:10:00 2007
+++ llvm/CREDITS.TXTThu Feb 15 16:05:14 2007
@@ -85,6 +85,10 @@
 E: [EMAIL PROTECTED]
 D: Callgraph class cleanups
 
+N: Dan Gohman
+E: [EMAIL PROTECTED]
+D: Miscellaneous bug fixes
+
 N: Paolo Invernizzi
 E: [EMAIL PROTECTED]
 D: Visual C++ compatibility fixes 



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

2007-02-20 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Utils:

InlineFunction.cpp updated: 1.53 -> 1.54
---
Log message:

Fix typos in comments.


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

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


Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.53 
llvm/lib/Transforms/Utils/InlineFunction.cpp:1.54
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.53   Mon Feb 12 20:10:56 2007
+++ llvm/lib/Transforms/Utils/InlineFunction.cppTue Feb 20 14:52:03 2007
@@ -263,7 +263,7 @@
 ++I;
 
   // Transfer all of the allocas over in a block.  Using splice means
-  // that they instructions aren't removed from the symbol table, then
+  // that the instructions aren't removed from the symbol table, then
   // reinserted.
   Caller->front().getInstList().splice(InsertPoint,
FirstNewBlock->getInstList(),



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


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

2007-02-20 Thread Dan Gohman


Changes in directory llvm/lib/Target:

Target.td updated: 1.92 -> 1.93
---
Log message:

Fix typos in comments.


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

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


Index: llvm/lib/Target/Target.td
diff -u llvm/lib/Target/Target.td:1.92 llvm/lib/Target/Target.td:1.93
--- llvm/lib/Target/Target.td:1.92  Fri Jan 26 08:34:51 2007
+++ llvm/lib/Target/Target.td   Tue Feb 20 14:52:03 2007
@@ -39,7 +39,7 @@
   int SpillAlignment = 0;
 
   // Aliases - A list of registers that this register overlaps with.  A read or
-  // modification of this register can potentially read or modifie the aliased
+  // modification of this register can potentially read or modify the aliased
   // registers.
   //
   list Aliases = [];



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


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

2007-03-22 Thread Dan Gohman


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.264 -> 1.265
Instructions.cpp updated: 1.80 -> 1.81
---
Log message:

Change uses of Function::front to Function::getEntryBlock for readability.


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

 AsmWriter.cpp|2 +-
 Instructions.cpp |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.264 llvm/lib/VMCore/AsmWriter.cpp:1.265
--- llvm/lib/VMCore/AsmWriter.cpp:1.264 Mon Mar 19 13:32:53 2007
+++ llvm/lib/VMCore/AsmWriter.cpp   Thu Mar 22 11:38:57 2007
@@ -1036,7 +1036,7 @@
   if (BB->getParent() == 0)
 Out << "\t\t; Error: Block without parent!";
   else {
-if (BB != &BB->getParent()->front()) {  // Not the entry block?
+if (BB != &BB->getParent()->getEntryBlock()) {  // Not the entry block?
   // Output predecessors for the block...
   Out << "\t\t;";
   pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.80 
llvm/lib/VMCore/Instructions.cpp:1.81
--- llvm/lib/VMCore/Instructions.cpp:1.80   Thu Mar  1 14:27:41 2007
+++ llvm/lib/VMCore/Instructions.cppThu Mar 22 11:38:57 2007
@@ -170,7 +170,7 @@
   if (HasUndefInput && !AllowNonDominatingInstruction)
 if (Instruction *IV = dyn_cast(InVal))
   // If it's in the entry block, it dominates everything.
-  if (IV->getParent() != &IV->getParent()->getParent()->front() ||
+  if (IV->getParent() != &IV->getParent()->getParent()->getEntryBlock() ||
   isa(IV))
 return 0;   // Cannot guarantee that InVal dominates this PHINode.
 



___
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/CloneFunction.cpp CodeExtractor.cpp InlineFunction.cpp SimplifyCFG.cpp

2007-03-22 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Utils:

CloneFunction.cpp updated: 1.43 -> 1.44
CodeExtractor.cpp updated: 1.50 -> 1.51
InlineFunction.cpp updated: 1.54 -> 1.55
SimplifyCFG.cpp updated: 1.118 -> 1.119
---
Log message:

Change uses of Function::front to Function::getEntryBlock for readability.


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

 CloneFunction.cpp  |2 +-
 CodeExtractor.cpp  |2 +-
 InlineFunction.cpp |7 ---
 SimplifyCFG.cpp|3 ++-
 4 files changed, 8 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Utils/CloneFunction.cpp
diff -u llvm/lib/Transforms/Utils/CloneFunction.cpp:1.43 
llvm/lib/Transforms/Utils/CloneFunction.cpp:1.44
--- llvm/lib/Transforms/Utils/CloneFunction.cpp:1.43Thu Mar  1 21:11:20 2007
+++ llvm/lib/Transforms/Utils/CloneFunction.cpp Thu Mar 22 11:38:57 2007
@@ -59,7 +59,7 @@
 CodeInfo->ContainsUnwinds|= isa(BB->getTerminator());
 CodeInfo->ContainsDynamicAllocas |= hasDynamicAllocas;
 CodeInfo->ContainsDynamicAllocas |= hasStaticAllocas && 
-BB != &BB->getParent()->front();
+BB != 
&BB->getParent()->getEntryBlock();
   }
   return NewBB;
 }


Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.50 
llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.51
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.50Mon Feb 12 20:10:56 2007
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Thu Mar 22 11:38:57 2007
@@ -104,7 +104,7 @@
   bool HasPredsFromRegion = false;
   unsigned NumPredsOutsideRegion = 0;
 
-  if (Header != &Header->getParent()->front()) {
+  if (Header != &Header->getParent()->getEntryBlock()) {
 PHINode *PN = dyn_cast(Header->begin());
 if (!PN) return;  // No PHI nodes.
 


Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.54 
llvm/lib/Transforms/Utils/InlineFunction.cpp:1.55
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.54   Tue Feb 20 14:52:03 2007
+++ llvm/lib/Transforms/Utils/InlineFunction.cppThu Mar 22 11:38:57 2007
@@ -265,9 +265,10 @@
   // Transfer all of the allocas over in a block.  Using splice means
   // that the instructions aren't removed from the symbol table, then
   // reinserted.
-  Caller->front().getInstList().splice(InsertPoint,
-   FirstNewBlock->getInstList(),
-   AI, I);
+  Caller->getEntryBlock().getInstList().splice(
+  InsertPoint,
+  FirstNewBlock->getInstList(),
+  AI, I);
 }
   }
   }


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.118 
llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.119
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.118 Fri Mar  2 17:01:14 2007
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp   Thu Mar 22 11:38:57 2007
@@ -1185,7 +1185,8 @@
 
   assert(BB && BB->getParent() && "Block not embedded in function!");
   assert(BB->getTerminator() && "Degenerate basic block encountered!");
-  assert(&BB->getParent()->front() != BB && "Can't Simplify entry block!");
+  assert(&BB->getParent()->getEntryBlock() != BB &&
+ "Can't Simplify entry block!");
 
   // Remove basic blocks that have no predecessors... which are unreachable.
   if (pred_begin(BB) == pred_end(BB) ||



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


[llvm-commits] CVS: llvm/lib/Analysis/ProfileInfo.cpp ProfileInfoLoader.cpp

2007-03-22 Thread Dan Gohman


Changes in directory llvm/lib/Analysis:

ProfileInfo.cpp updated: 1.10 -> 1.11
ProfileInfoLoader.cpp updated: 1.11 -> 1.12
---
Log message:

Change uses of Function::front to Function::getEntryBlock for readability.


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

 ProfileInfo.cpp   |2 +-
 ProfileInfoLoader.cpp |3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/Analysis/ProfileInfo.cpp
diff -u llvm/lib/Analysis/ProfileInfo.cpp:1.10 
llvm/lib/Analysis/ProfileInfo.cpp:1.11
--- llvm/lib/Analysis/ProfileInfo.cpp:1.10  Mon Feb  5 17:42:17 2007
+++ llvm/lib/Analysis/ProfileInfo.cpp   Thu Mar 22 11:38:57 2007
@@ -33,7 +33,7 @@
   // Are there zero predecessors of this block?
   if (PI == PE) {
 // If this is the entry block, look for the Null -> Entry edge.
-if (BB == &BB->getParent()->front())
+if (BB == &BB->getParent()->getEntryBlock())
   return getEdgeWeight(0, BB);
 else
   return 0;   // Otherwise, this is a dead block.


Index: llvm/lib/Analysis/ProfileInfoLoader.cpp
diff -u llvm/lib/Analysis/ProfileInfoLoader.cpp:1.11 
llvm/lib/Analysis/ProfileInfoLoader.cpp:1.12
--- llvm/lib/Analysis/ProfileInfoLoader.cpp:1.11Tue Jan 30 14:08:36 2007
+++ llvm/lib/Analysis/ProfileInfoLoader.cpp Thu Mar 22 11:38:57 2007
@@ -152,7 +152,8 @@
   getBlockCounts(BlockCounts);
 
   for (unsigned i = 0, e = BlockCounts.size(); i != e; ++i)
-if (&BlockCounts[i].first->getParent()->front() == 
BlockCounts[i].first)
+if (&BlockCounts[i].first->getParent()->getEntryBlock() ==
+BlockCounts[i].first)
   Counts.push_back(std::make_pair(BlockCounts[i].first->getParent(),
   BlockCounts[i].second));
 } else {



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


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

2007-03-22 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.390 -> 1.391
---
Log message:

Change uses of Function::front to Function::getEntryBlock for readability.


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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.390 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.391
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.390Tue Mar 20 
14:32:11 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Thu Mar 22 11:38:57 2007
@@ -4328,7 +4328,7 @@
   std::vector UnorderedChains;
 
   // Lower any arguments needed in this block if this is the entry block.
-  if (LLVMBB == &LLVMBB->getParent()->front())
+  if (LLVMBB == &LLVMBB->getParent()->getEntryBlock())
 LowerArguments(LLVMBB, SDL, UnorderedChains);
 
   BB = FuncInfo.MBBMap[LLVMBB];



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

2007-03-22 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.671 -> 1.672
LICM.cpp updated: 1.88 -> 1.89
ScalarReplAggregates.cpp updated: 1.80 -> 1.81
TailRecursionElimination.cpp updated: 1.29 -> 1.30
---
Log message:

Change uses of Function::front to Function::getEntryBlock for readability.


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

 InstructionCombining.cpp |3 ++-
 LICM.cpp |2 +-
 ScalarReplAggregates.cpp |2 +-
 TailRecursionElimination.cpp |2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.671 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.672
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.671   Wed Mar 21 
18:19:50 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Mar 22 11:38:57 2007
@@ -9946,7 +9946,8 @@
   if (isa(I) || I->mayWriteToMemory()) return false;
 
   // Do not sink alloca instructions out of the entry block.
-  if (isa(I) && I->getParent() == &DestBlock->getParent()->front())
+  if (isa(I) && I->getParent() ==
+&DestBlock->getParent()->getEntryBlock())
 return false;
 
   // We can only sink load instructions if there is nothing between the load 
and


Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.88 
llvm/lib/Transforms/Scalar/LICM.cpp:1.89
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.88Tue Mar  6 22:41:30 2007
+++ llvm/lib/Transforms/Scalar/LICM.cpp Thu Mar 22 11:38:57 2007
@@ -471,7 +471,7 @@
 
 if (I.getType() != Type::VoidTy)
   AI = new AllocaInst(I.getType(), 0, I.getName(),
-  I.getParent()->getParent()->front().begin());
+  I.getParent()->getParent()->getEntryBlock().begin());
 
 // Secondly, insert load instructions for each use of the instruction
 // outside of the loop.


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.80 
llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.81
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.80Mon Mar 19 
13:25:57 2007
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Thu Mar 22 11:38:57 2007
@@ -891,7 +891,7 @@
   ++NumConverted;
   
   BasicBlock *EntryBlock = AI->getParent();
-  assert(EntryBlock == &EntryBlock->getParent()->front() &&
+  assert(EntryBlock == &EntryBlock->getParent()->getEntryBlock() &&
  "Not in the entry block!");
   EntryBlock->getInstList().remove(AI);  // Take the alloca out of the program.
   


Index: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
diff -u llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.29 
llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.30
--- llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.29Sat Feb 
10 19:23:03 2007
+++ llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp Thu Mar 22 
11:38:57 2007
@@ -108,7 +108,7 @@
   // If this alloca is in the body of the function, or if it is a variable
   // sized allocation, we cannot tail call eliminate calls marked 'tail'
   // with this mechanism.
-  if (BB != &BB->getParent()->front() ||
+  if (BB != &BB->getParent()->getEntryBlock() ||
   !isa(AI->getArraySize()))
 CannotTCETailMarkedCall = true;
 }



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


[llvm-commits] CVS: llvm/include/llvm/Argument.h BasicBlock.h Constants.h DerivedTypes.h Module.h PassAnalysisSupport.h PassManager.h PassManagers.h PassSupport.h Type.h

2007-03-23 Thread Dan Gohman


Changes in directory llvm/include/llvm:

Argument.h updated: 1.13 -> 1.14
BasicBlock.h updated: 1.62 -> 1.63
Constants.h updated: 1.139 -> 1.140
DerivedTypes.h updated: 1.88 -> 1.89
Module.h updated: 1.84 -> 1.85
PassAnalysisSupport.h updated: 1.28 -> 1.29
PassManager.h updated: 1.38 -> 1.39
PassManagers.h updated: 1.14 -> 1.15
PassSupport.h updated: 1.36 -> 1.37
Type.h updated: 1.104 -> 1.105
---
Log message:

Add the 'explicit' keyword to several constructors that accept one
argument that don't appear intended as implicit-conversion operators.


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

 Argument.h|4 +++-
 BasicBlock.h  |4 ++--
 Constants.h   |6 +++---
 DerivedTypes.h|8 
 Module.h  |2 +-
 PassAnalysisSupport.h |2 +-
 PassManager.h |2 +-
 PassManagers.h|6 +++---
 PassSupport.h |   10 +-
 Type.h|4 ++--
 10 files changed, 25 insertions(+), 23 deletions(-)


Index: llvm/include/llvm/Argument.h
diff -u llvm/include/llvm/Argument.h:1.13 llvm/include/llvm/Argument.h:1.14
--- llvm/include/llvm/Argument.h:1.13   Sat Dec 16 23:15:12 2006
+++ llvm/include/llvm/Argument.hFri Mar 23 13:44:11 2007
@@ -41,7 +41,9 @@
   /// Argument ctor - If Function argument is specified, this argument is
   /// inserted at the end of the argument list for the function.
   ///
-  Argument(const Type *Ty, const std::string &Name = "", Function *F = 0);
+  explicit Argument(const Type *Ty,
+const std::string &Name = "",
+Function *F = 0);
 
   inline const Function *getParent() const { return Parent; }
   inline   Function *getParent()   { return Parent; }


Index: llvm/include/llvm/BasicBlock.h
diff -u llvm/include/llvm/BasicBlock.h:1.62 llvm/include/llvm/BasicBlock.h:1.63
--- llvm/include/llvm/BasicBlock.h:1.62 Sat Dec 16 23:15:12 2006
+++ llvm/include/llvm/BasicBlock.h  Fri Mar 23 13:44:11 2007
@@ -70,8 +70,8 @@
   /// is automatically inserted at either the end of the function (if
   /// InsertBefore is null), or before the specified basic block.
   ///
-  BasicBlock(const std::string &Name = "", Function *Parent = 0,
- BasicBlock *InsertBefore = 0);
+  explicit BasicBlock(const std::string &Name = "", Function *Parent = 0,
+  BasicBlock *InsertBefore = 0);
   ~BasicBlock();
 
   /// getParent - Return the enclosing method, or null if none


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.139 llvm/include/llvm/Constants.h:1.140
--- llvm/include/llvm/Constants.h:1.139 Mon Mar 19 15:39:08 2007
+++ llvm/include/llvm/Constants.h   Fri Mar 23 13:44:11 2007
@@ -231,7 +231,7 @@
   friend struct ConstantCreator;
   ConstantAggregateZero(const ConstantAggregateZero &);  // DO NOT 
IMPLEMENT
 protected:
-  ConstantAggregateZero(const Type *Ty)
+  explicit ConstantAggregateZero(const Type *Ty)
 : Constant(Ty, ConstantAggregateZeroVal, 0, 0) {}
 public:
   /// get() - static factory method for creating a null aggregate.  It is
@@ -420,7 +420,7 @@
   friend struct ConstantCreator;
   ConstantPointerNull(const ConstantPointerNull &);  // DO NOT IMPLEMENT
 protected:
-  ConstantPointerNull(const PointerType *T)
+  explicit ConstantPointerNull(const PointerType *T)
 : Constant(reinterpret_cast(T),
Value::ConstantPointerNullVal, 0, 0) {}
 
@@ -669,7 +669,7 @@
   friend struct ConstantCreator;
   UndefValue(const UndefValue &);  // DO NOT IMPLEMENT
 protected:
-  UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {}
+  explicit UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {}
 public:
   /// get() - Static factory methods - Return an 'undef' object of the 
specified
   /// type.


Index: llvm/include/llvm/DerivedTypes.h
diff -u llvm/include/llvm/DerivedTypes.h:1.88 
llvm/include/llvm/DerivedTypes.h:1.89
--- llvm/include/llvm/DerivedTypes.h:1.88   Wed Mar 21 19:32:02 2007
+++ llvm/include/llvm/DerivedTypes.hFri Mar 23 13:44:11 2007
@@ -36,7 +36,7 @@
   friend class Type;
 
 protected:
-  DerivedType(TypeID id) : Type(id) {}
+  explicit DerivedType(TypeID id) : Type(id) {}
 
   /// notifyUsesThatTypeBecameConcrete - Notify AbstractTypeUsers of this type
   /// that the current type has transitioned from being abstract to being
@@ -79,7 +79,7 @@
 /// @brief Integer representation type
 class IntegerType : public DerivedType {
 protected:
-  IntegerType(unsigned NumBits) : DerivedType(IntegerTyID) {
+  explicit IntegerType(unsigned NumBits) : DerivedType(IntegerTyID) {
 setSubclassData(NumBits);
   }
   friend class TypeMap;
@@ -230,7 +230,7 @@
 /// and VectorType
 class CompositeType : public DerivedType {
 protected:
-  inline CompositeType(TypeID id) : DerivedType(id) { }
+  inline explicit CompositeType(TypeID id) : DerivedType(id) { }
 public:
 
   /// getTypeAtIndex - Given an index value into the type, return the type

[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h MachineConstantPool.h MachineInstrBuilder.h MachineJumpTableInfo.h MachineLocation.h SelectionDAGISel.h SelectionDAGNodes.h

2007-03-23 Thread Dan Gohman


Changes in directory llvm/include/llvm/CodeGen:

MachineBasicBlock.h updated: 1.61 -> 1.62
MachineConstantPool.h updated: 1.25 -> 1.26
MachineInstrBuilder.h updated: 1.43 -> 1.44
MachineJumpTableInfo.h updated: 1.11 -> 1.12
MachineLocation.h updated: 1.3 -> 1.4
SelectionDAGISel.h updated: 1.33 -> 1.34
SelectionDAGNodes.h updated: 1.181 -> 1.182
---
Log message:

Add the 'explicit' keyword to several constructors that accept one
argument that don't appear intended as implicit-conversion operators.


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

 MachineBasicBlock.h|7 ---
 MachineConstantPool.h  |2 +-
 MachineInstrBuilder.h  |2 +-
 MachineJumpTableInfo.h |3 ++-
 MachineLocation.h  |2 +-
 SelectionDAGISel.h |3 ++-
 SelectionDAGNodes.h|   10 +-
 7 files changed, 16 insertions(+), 13 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h
diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.61 
llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.62
--- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.61  Wed Feb 28 20:00:40 2007
+++ llvm/include/llvm/CodeGen/MachineBasicBlock.h   Fri Mar 23 13:44:11 2007
@@ -79,9 +79,10 @@
   bool IsLandingPad;
 
 public:
-  MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0), BB(bb),
-Number(-1), Parent(0),
-IsLandingPad(false) {
+  explicit MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0),
+ BB(bb), Number(-1),
+ Parent(0),
+ IsLandingPad(false) {
 Insts.parent = this;
   }
 


Index: llvm/include/llvm/CodeGen/MachineConstantPool.h
diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.25 
llvm/include/llvm/CodeGen/MachineConstantPool.h:1.26
--- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.25Sat Dec 16 
23:15:12 2006
+++ llvm/include/llvm/CodeGen/MachineConstantPool.h Fri Mar 23 13:44:11 2007
@@ -35,7 +35,7 @@
   const Type *Ty;
 
 public:
-  MachineConstantPoolValue(const Type *ty) : Ty(ty) {}
+  explicit MachineConstantPoolValue(const Type *ty) : Ty(ty) {}
   virtual ~MachineConstantPoolValue() {};
 
   /// getType - get type of this MachineConstantPoolValue.


Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h
diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.43 
llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.44
--- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.43Wed Feb 14 
20:52:40 2007
+++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h Fri Mar 23 13:44:11 2007
@@ -27,7 +27,7 @@
 class MachineInstrBuilder {
   MachineInstr *MI;
 public:
-  MachineInstrBuilder(MachineInstr *mi) : MI(mi) {}
+  explicit MachineInstrBuilder(MachineInstr *mi) : MI(mi) {}
 
   /// Allow automatic conversion to the machine instruction we are working on.
   ///


Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h
diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.11 
llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.12
--- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.11   Sat Dec 16 
23:15:12 2006
+++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.hFri Mar 23 13:44:11 2007
@@ -34,7 +34,8 @@
   /// MBBs - The vector of basic blocks from which to create the jump table.
   std::vector MBBs;
   
-  MachineJumpTableEntry(const std::vector &M) : MBBs(M) {}
+  explicit MachineJumpTableEntry(const std::vector &M)
+  : MBBs(M) {}
 };
   
 class MachineJumpTableInfo {


Index: llvm/include/llvm/CodeGen/MachineLocation.h
diff -u llvm/include/llvm/CodeGen/MachineLocation.h:1.3 
llvm/include/llvm/CodeGen/MachineLocation.h:1.4
--- llvm/include/llvm/CodeGen/MachineLocation.h:1.3 Wed Jan 24 12:45:12 2007
+++ llvm/include/llvm/CodeGen/MachineLocation.h Fri Mar 23 13:44:11 2007
@@ -40,7 +40,7 @@
   , Register(0)
   , Offset(0)
   {}
-  MachineLocation(unsigned R)
+  explicit MachineLocation(unsigned R)
   : IsRegister(true)
   , Register(R)
   , Offset(0)


Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.33 
llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.34
--- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.33   Wed Mar  7 10:25:08 2007
+++ llvm/include/llvm/CodeGen/SelectionDAGISel.hFri Mar 23 13:44:11 2007
@@ -42,7 +42,8 @@
   std::vector TopOrder;
   unsigned DAGSize;
 
-  SelectionDAGISel(TargetLowering &tli) : TLI(tli), DAGSize(0), JT(0,0,0,0) {}
+  explicit SelectionDAGISel(TargetLowering &tli)
+  : TLI(tli), DAGSize(0), JT(0,0,0,0) {}
   
   TargetLowering &getTargetLowering() { return TLI; }
 


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.181 
llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.182
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.1

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

2007-03-28 Thread Dan Gohman
Chris Lattner wrote:
> Fix a problem building llvm-gcc on amd64-unknown-freebsd6.2, due to the 
> system assembler not groking legal instructions like "leal (,%esi,8), %ecx".

I was just about to report this. Thanks!

BTW, I believe this also fixes the fifth entry in

llvm/lib/Target/X86/README-X86-64.txt

Dan

-- 
Dan Gohman, Cray Inc.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [patch] minor instcombine+bitcast improvement

2007-04-06 Thread Dan Gohman
This patch makes instcombine convert this:

 %t = getelementptr float* cast ([2 x i32]* %str to float*), i32 %V

into this:

 %t = getelementptr float* cast ([2 x i32]* %str to [2 x float]*), i32 0, 
i32 %V

instead of this:

 %s = getelementptr [2 x i32]* %str, i32 0, i32 %V
 %t = bitcast i32* %s to float*

I'm not yet familiar with instcombine's canonicalization style; is this
a desireable change? It doesn't cause any regressions for me.

Dan

-- 
Dan Gohman, Cray Inc.
Index: InstructionCombining.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/InstructionCombining.cpp,v
retrieving revision 1.731
diff -t -d -u -p -5 -r1.731 InstructionCombining.cpp
--- InstructionCombining.cpp
+++ InstructionCombining.cpp
@@ -8113,23 +8113,24 @@ Instruction *InstCombiner::visitGetEleme
 // is a leading zero) we can fold the cast into this GEP.
 GEP.setOperand(0, X);
 return &GEP;
   }
 } else if (GEP.getNumOperands() == 2) {
-  // Transform things like:
-  // %t = getelementptr ubyte* cast ([2 x int]* %str to uint*), uint %V
-  // into:  %t1 = getelementptr [2 x int*]* %str, int 0, uint %V; cast
+  // transform: GEP cast ([2 x int]* %str to float*), uint %V
+  // into : GEP cast ([2 x int]* %str to [2 x float]*), int 0, uint %V
   const Type *SrcElTy = cast(X->getType())->getElementType();
   const Type 
*ResElTy=cast(PtrOp->getType())->getElementType();
   if (isa(SrcElTy) &&
   TD->getTypeSize(cast(SrcElTy)->getElementType()) ==
   TD->getTypeSize(ResElTy)) {
+const Type *NewArrayTy =
+ArrayType::get(ResElTy,
+   cast(SrcElTy)->getNumElements());
 Value *V = InsertNewInstBefore(
-   new GetElementPtrInst(X, Constant::getNullValue(Type::Int32Ty),
- GEP.getOperand(1), GEP.getName()), GEP);
-// V and GEP are both pointer types --> BitCast
-return new BitCastInst(V, GEP.getType());
+   new BitCastInst(X, PointerType::get(NewArrayTy)), GEP);
+return new GetElementPtrInst(V, Constant::getNullValue(Type::Int32Ty),
+ GEP.getOperand(1), GEP.getName());
   }
   
   // Transform things like:
   // getelementptr sbyte* cast ([100 x double]* X to sbyte*), int %tmp
   //   (where tmp = 8*tmp2) into:
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Argument.h BasicBlock.h Constant.h Constants.h Function.h GlobalValue.h GlobalVariable.h InlineAsm.h Instruction.h Value.h

2007-04-13 Thread Dan Gohman


Changes in directory llvm/include/llvm:

Argument.h updated: 1.14 -> 1.15
BasicBlock.h updated: 1.63 -> 1.64
Constant.h updated: 1.35 -> 1.36
Constants.h updated: 1.145 -> 1.146
Function.h updated: 1.73 -> 1.74
GlobalValue.h updated: 1.34 -> 1.35
GlobalVariable.h updated: 1.40 -> 1.41
InlineAsm.h updated: 1.14 -> 1.15
Instruction.h updated: 1.82 -> 1.83
Value.h updated: 1.99 -> 1.100
---
Log message:

Rename Value::getValueType to getValueID, to avoid confusion with
other things named getValueType.


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

 Argument.h   |2 +-
 BasicBlock.h |2 +-
 Constant.h   |4 ++--
 Constants.h  |   18 +-
 Function.h   |2 +-
 GlobalValue.h|4 ++--
 GlobalVariable.h |2 +-
 InlineAsm.h  |2 +-
 Instruction.h|4 ++--
 Value.h  |   20 ++--
 10 files changed, 30 insertions(+), 30 deletions(-)


Index: llvm/include/llvm/Argument.h
diff -u llvm/include/llvm/Argument.h:1.14 llvm/include/llvm/Argument.h:1.15
--- llvm/include/llvm/Argument.h:1.14   Fri Mar 23 13:44:11 2007
+++ llvm/include/llvm/Argument.hFri Apr 13 13:12:09 2007
@@ -64,7 +64,7 @@
   ///
   static inline bool classof(const Argument *) { return true; }
   static inline bool classof(const Value *V) {
-return V->getValueType() == ArgumentVal;
+return V->getValueID() == ArgumentVal;
   }
 };
 


Index: llvm/include/llvm/BasicBlock.h
diff -u llvm/include/llvm/BasicBlock.h:1.63 llvm/include/llvm/BasicBlock.h:1.64
--- llvm/include/llvm/BasicBlock.h:1.63 Fri Mar 23 13:44:11 2007
+++ llvm/include/llvm/BasicBlock.h  Fri Apr 13 13:12:09 2007
@@ -158,7 +158,7 @@
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const BasicBlock *) { return true; }
   static inline bool classof(const Value *V) {
-return V->getValueType() == Value::BasicBlockVal;
+return V->getValueID() == Value::BasicBlockVal;
   }
 
   /// dropAllReferences() - This function causes all the subinstructions to 
"let


Index: llvm/include/llvm/Constant.h
diff -u llvm/include/llvm/Constant.h:1.35 llvm/include/llvm/Constant.h:1.36
--- llvm/include/llvm/Constant.h:1.35   Wed Mar  7 18:59:12 2007
+++ llvm/include/llvm/Constant.hFri Apr 13 13:12:09 2007
@@ -88,8 +88,8 @@
   static inline bool classof(const Constant *) { return true; }
   static inline bool classof(const GlobalValue *) { return true; }
   static inline bool classof(const Value *V) {
-return V->getValueType() >= ConstantFirstVal &&
-   V->getValueType() <= ConstantLastVal;
+return V->getValueID() >= ConstantFirstVal &&
+   V->getValueID() <= ConstantLastVal;
   }
 
   /// replaceUsesOfWithOnConstant - This method is a special form of


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.145 llvm/include/llvm/Constants.h:1.146
--- llvm/include/llvm/Constants.h:1.145 Tue Apr 10 01:44:12 2007
+++ llvm/include/llvm/Constants.h   Fri Apr 13 13:12:09 2007
@@ -201,7 +201,7 @@
   /// @brief Methods to support type inquiry through isa, cast, and dyn_cast.
   static inline bool classof(const ConstantInt *) { return true; }
   static bool classof(const Value *V) {
-return V->getValueType() == ConstantIntVal;
+return V->getValueID() == ConstantIntVal;
   }
   static void ResetTrueFalse() { TheTrueVal = TheFalseVal = 0; }
 private:
@@ -239,7 +239,7 @@
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantFP *) { return true; }
   static bool classof(const Value *V) {
-return V->getValueType() == ConstantFPVal;
+return V->getValueID() == ConstantFPVal;
   }
 };
 
@@ -267,7 +267,7 @@
   ///
   static bool classof(const ConstantAggregateZero *) { return true; }
   static bool classof(const Value *V) {
-return V->getValueType() == ConstantAggregateZeroVal;
+return V->getValueID() == ConstantAggregateZeroVal;
   }
 };
 
@@ -331,7 +331,7 @@
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantArray *) { return true; }
   static bool classof(const Value *V) {
-return V->getValueType() == ConstantArrayVal;
+return V->getValueID() == ConstantArrayVal;
   }
 };
 
@@ -376,7 +376,7 @@
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantStruct *) { return true; }
   static bool classof(const Value *V) {
-return V->getValueType() == ConstantStructVal;
+return V->getValueID() == ConstantStructVal;
   }
 };
 
@@ -428,7 +428,7 @@
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantVector *) { return true; }
   static bool classof(const Value *V) {
-return V->getValueType() == ConstantVectorVal;
+return V->getValueID() == ConstantVectorVal;
   }
 };
 
@@ -464,7 +464,7 @@
   /// Methods for support type inquiry th

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

2007-04-13 Thread Dan Gohman


Changes in directory llvm/include/llvm/Support:

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

Rename Value::getValueType to getValueID, to avoid confusion with
other things named getValueType.


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

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


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.19 
llvm/include/llvm/Support/PatternMatch.h:1.20
--- llvm/include/llvm/Support/PatternMatch.h:1.19   Mon Feb 12 18:37:50 2007
+++ llvm/include/llvm/Support/PatternMatch.hFri Apr 13 13:12:09 2007
@@ -81,7 +81,7 @@
 
   template
   bool match(OpTy *V) {
-if (V->getValueType() == Value::InstructionVal + Opcode) {
+if (V->getValueID() == Value::InstructionVal + Opcode) {
   ConcreteTy *I = cast(V);
   return I->getOpcode() == Opcode && L.match(I->getOperand(0)) &&
  R.match(I->getOperand(1));
@@ -195,8 +195,8 @@
 
   template
   bool match(OpTy *V) {
-if (V->getValueType() == Value::InstructionVal + Instruction::LShr ||
-V->getValueType() == Value::InstructionVal + Instruction::AShr) {
+if (V->getValueID() == Value::InstructionVal + Instruction::LShr ||
+V->getValueID() == Value::InstructionVal + Instruction::AShr) {
   ConcreteTy *I = cast(V);
   return (I->getOpcode() == Instruction::AShr ||
   I->getOpcode() == Instruction::LShr) &&



___
llvm-commits mailing list
[EMAIL PROTECTED]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-04-16 Thread Dan Gohman
> -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | \
> +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 
> -mtriple=powerpc-apple-darwin8 | \

Did you really mean to use a powerpc triple with -march=x86?

Dan

-- 
Dan Gohman, Cray Inc.
___
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/LICM.cpp

2007-04-17 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

LICM.cpp updated: 1.90 -> 1.91
---
Log message:

Spell doFinalization right, so that it is a proper virtual override and
gets called.


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

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


Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.90 
llvm/lib/Transforms/Scalar/LICM.cpp:1.91
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.90Sat Apr 14 18:32:02 2007
+++ llvm/lib/Transforms/Scalar/LICM.cpp Tue Apr 17 13:21:36 2007
@@ -77,7 +77,7 @@
   AU.addRequired();
 }
 
-bool doFinalize() {
+bool doFinalization() {
   LoopToAliasMap.clear();
   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/Target/X86/X86InstrSSE.td

2007-04-18 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86InstrSSE.td updated: 1.180 -> 1.181
---
Log message:

Fix the spelling of the prefetchnta instruction.


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

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


Index: llvm/lib/Target/X86/X86InstrSSE.td
diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.180 
llvm/lib/Target/X86/X86InstrSSE.td:1.181
--- llvm/lib/Target/X86/X86InstrSSE.td:1.180Tue Apr 10 17:10:25 2007
+++ llvm/lib/Target/X86/X86InstrSSE.td  Wed Apr 18 09:09:14 2007
@@ -1645,7 +1645,7 @@
 def PREFETCHT0   : PSI<0x18, MRM1m, (ops i8mem:$src), "prefetcht0 $src", []>;
 def PREFETCHT1   : PSI<0x18, MRM2m, (ops i8mem:$src), "prefetcht1 $src", []>;
 def PREFETCHT2   : PSI<0x18, MRM3m, (ops i8mem:$src), "prefetcht2 $src", []>;
-def PREFETCHTNTA : PSI<0x18, MRM0m, (ops i8mem:$src), "prefetchtnta $src", []>;
+def PREFETCHNTA  : PSI<0x18, MRM0m, (ops i8mem:$src), "prefetchnta $src", []>;
 
 // Non-temporal stores
 def MOVNTPSmr : PSI<0x2B, MRMDestMem, (ops i128mem:$dst, VR128:$src),



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


Re: [llvm-commits] Function aliases

2007-04-19 Thread Dan Gohman
> GCC doesn't allow variable aliases and I don't know
> how they should look (and work!). That's why I'm focusing on function
> aliases only.

Actually, GCC does accept variable aliases, at least on i686-pc-linux-gnu
and several other targets.

This code compiles and has two symbols in the output:

int x = 2;
extern int y __attribute__((alias("x")));

Dan

-- 
Dan Gohman, Cray Inc.
___
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/TargetData.h

2007-04-26 Thread Dan Gohman


Changes in directory llvm/include/llvm/Target:

TargetData.h updated: 1.59 -> 1.60
---
Log message:

Fix a typo in a comment.


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

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


Index: llvm/include/llvm/Target/TargetData.h
diff -u llvm/include/llvm/Target/TargetData.h:1.59 
llvm/include/llvm/Target/TargetData.h:1.60
--- llvm/include/llvm/Target/TargetData.h:1.59  Mon Mar 19 09:25:02 2007
+++ llvm/include/llvm/Target/TargetData.h   Thu Apr 26 14:39:32 2007
@@ -179,7 +179,7 @@
   ///
   const Type *getIntPtrType() const;
 
-  /// getIndexOffset - return the offset from the beginning of the type for the
+  /// getIndexedOffset - return the offset from the beginning of the type for 
the
   /// specified indices.  This is used to implement getelementptr.
   ///
   uint64_t getIndexedOffset(const Type *Ty,



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


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

2007-04-26 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAGRRList.cpp updated: 1.29 -> 1.30
---
Log message:

Fix a typo in a comment.


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

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


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.29 
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.30
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.29Wed Mar 14 
17:43:40 2007
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Thu Apr 26 14:40:56 2007
@@ -634,7 +634,7 @@
   if (LPriority > RPriority)
 return true;
   else if (LPriority == RPriority) {
-// Try schedule def + use closer whne Sethi-Ullman numbers are the same.
+// Try schedule def + use closer when Sethi-Ullman numbers are the same.
 // e.g.
 // t1 = op t2, c1
 // t3 = op t4, c2



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


[llvm-commits] CVS: llvm/utils/TableGen/CodeGenIntrinsics.h

2007-04-26 Thread Dan Gohman


Changes in directory llvm/utils/TableGen:

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

Update a comment to reflect recent changes in the type system.


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

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


Index: llvm/utils/TableGen/CodeGenIntrinsics.h
diff -u llvm/utils/TableGen/CodeGenIntrinsics.h:1.12 
llvm/utils/TableGen/CodeGenIntrinsics.h:1.13
--- llvm/utils/TableGen/CodeGenIntrinsics.h:1.12Sun Apr  1 02:20:01 2007
+++ llvm/utils/TableGen/CodeGenIntrinsics.h Thu Apr 26 14:43:14 2007
@@ -31,7 +31,7 @@
 std::string TargetPrefix;  // Target prefix, e.g. "ppc" for t-s intrinsics.
 
 /// ArgTypes - The type primitive enum value for the return value and all
-/// of the arguments.  These are things like Type::Int32TyID.
+/// of the arguments.  These are things like Type::IntegerTyID.
 std::vector ArgTypes;
 
 /// ArgVTs - The MVT::ValueType for each argument type.  Note that this 
list



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


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

2007-04-26 Thread Dan Gohman


Changes in directory llvm/test/CodeGen/X86:

dollar-name.ll added (r1.1)
---
Log message:

testcase for PR1339: http://llvm.org/PR1339 : http://llvm.org/PR1339: 
http://llvm.org/PR1339 


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

 dollar-name.ll |   17 +
 1 files changed, 17 insertions(+)


Index: llvm/test/CodeGen/X86/dollar-name.ll
diff -c /dev/null llvm/test/CodeGen/X86/dollar-name.ll:1.1
*** /dev/null   Thu Apr 26 16:04:49 2007
--- llvm/test/CodeGen/X86/dollar-name.llThu Apr 26 16:04:39 2007
***
*** 0 
--- 1,17 
+ ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=att | grep (\$bar) | wc 
-l | grep 1
+ ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=att | grep (\$qux) | wc 
-l | grep 1
+ ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=att | grep (\$hen) | wc 
-l | grep 1
+ ; PR1339
+ 
+ @"$bar" = global i32 zeroinitializer
+ @"$qux" = external global i32
+ 
+ define i32 @"$foo"() {
+   %m = load i32* @"$bar"
+   %n = load i32* @"$qux"
+   %t = add i32 %m, %n
+   %u = call i32 @"$hen"(i32 %t)
+   ret i32 %u
+ }
+ 
+ declare i32 @"$hen"(i32 %a)



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

2007-04-26 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.102 -> 1.103
---
Log message:

Fix PR1339: http://llvm.org/PR1339  and CodeGen/X86/dollar-name.ll


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

 X86ATTAsmPrinter.cpp |   35 ---
 1 files changed, 32 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.102 
llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.103
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.102  Sun Apr 22 17:50:52 2007
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppThu Apr 26 16:07:05 2007
@@ -272,16 +272,24 @@
   case MachineOperand::MO_GlobalAddress: {
 bool isCallOp = Modifier && !strcmp(Modifier, "call");
 bool isMemOp  = Modifier && !strcmp(Modifier, "mem");
+bool needCloseParen = false;
 
 GlobalValue *GV = MO.getGlobal();
 GlobalVariable *GVar = dyn_cast(GV);
 bool isThreadLocal = GVar && GVar->isThreadLocal();
 
-if (!isMemOp && !isCallOp) O << '$';
-
 std::string Name = Mang->getValueName(GV);
 X86SharedAsmPrinter::decorateName(Name, GV);
 
+if (!isMemOp && !isCallOp)
+  O << '$';
+else if (Name[0] == '$') {
+  // The name begins with a dollar-sign. In order to avoid having it look
+  // like an integer immediate to the assembler, enclose it in parens.
+  O << '(';
+  needCloseParen = true;
+}
+
 if (printStub(TM, Subtarget)) {
   // Link-once, External, or Weakly-linked global variables need
   // non-lazily-resolved stubs
@@ -352,6 +360,12 @@
  GV->hasLinkOnceLinkage()) &&
 TM.getRelocationModel() != Reloc::Static)
   O << "@GOTPCREL";
+
+if (needCloseParen) {
+  needCloseParen = false;
+  O << ')';
+}
+
 // Use rip when possible to reduce code size, except when
 // index or base register are also part of the address. e.g.
 // foo(%rip)(%rcx,%rax,4) is not legal
@@ -359,10 +373,14 @@
   }
 }
 
+if (needCloseParen)
+  O << ')';
+
 return;
   }
   case MachineOperand::MO_ExternalSymbol: {
 bool isCallOp = Modifier && !strcmp(Modifier, "call");
+bool needCloseParen = false;
 std::string Name(TAI->getGlobalPrefix());
 Name += MO.getSymbolName();
 if (isCallOp && printStub(TM, Subtarget)) {
@@ -370,7 +388,15 @@
   O << TAI->getPrivateGlobalPrefix() << Name << "$stub";
   return;
 }
-if (!isCallOp) O << '$';
+if (!isCallOp)
+  O << '$';
+else if (Name[0] == '$') {
+  // The name begins with a dollar-sign. In order to avoid having it look
+  // like an integer immediate to the assembler, enclose it in parens.
+  O << '(';
+  needCloseParen = true;
+}
+
 O << Name;
 
 if (printGOT(TM, Subtarget)) {
@@ -391,6 +417,9 @@
 O << "@PLT";
 }
 
+if (needCloseParen)
+  O << ')';
+
 if (!isCallOp && Subtarget->isPICStyleRIPRel())
   O << "(%rip)";
 



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


[llvm-commits] ELF sections in X86AsmTargetAsm.cpp

2007-05-01 Thread Dan Gohman
The attached patch sets the section names for fixed-size constants for
ELF on x86 to match what GCC uses, and it uses the mergeable flag so
that duplicate constants can be merged.

This works for me with GAS; are there other assemblers (or linkers?)
being used with LLVM on x86 ELF targets that don't support this?
It looks like nasm/yasm wouldn't accept some of the other things
that LLVM currently emits anyway..

Dan

-- 
Dan Gohman, Cray Inc.
Index: lib/Target/X86/X86TargetAsmInfo.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/Target/X86/X86TargetAsmInfo.cpp,v
retrieving revision 1.38
diff -u -r1.38 X86TargetAsmInfo.cpp
--- lib/Target/X86/X86TargetAsmInfo.cpp
+++ lib/Target/X86/X86TargetAsmInfo.cpp
@@ -106,6 +106,11 @@
 // HasDotFile - True if target asm supports .file directives.
 // bool HasDotFile; // Defaults to false.
 ReadOnlySection = "\t.section\t.rodata\n";
+FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
+EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8";
+SixteenByteConstantSection =
+ "\t.section\t.rodata.cst16,\"aM\",@progbits,16";
+CStringSection = "\t.section\t.rodata.str1.1,\"aMS\",@progbits,1";
 PrivateGlobalPrefix = ".L";
 WeakRefDirective = "\t.weak\t";
 SetDirective = "\t.set\t";
___
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/X86TargetAsmInfo.cpp

2007-05-03 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86TargetAsmInfo.cpp updated: 1.39 -> 1.40
---
Log message:

Sets the section names for fixed-size constants and use the mergeable
flag for ELF on x86 so that duplicate constants can be eliminated by
the linker. This matches what GCC does with its -fmerge-constants
option, which is enabled at most -O levels.


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

 X86TargetAsmInfo.cpp |5 +
 1 files changed, 5 insertions(+)


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.39 
llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.40
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.39   Tue May  1 17:23:12 2007
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cppThu May  3 11:38:57 2007
@@ -107,6 +107,11 @@
 // HasDotFile - True if target asm supports .file directives.
 // bool HasDotFile; // Defaults to false.
 ReadOnlySection = "\t.section\t.rodata\n";
+FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
+EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8";
+SixteenByteConstantSection =
+ "\t.section\t.rodata.cst16,\"aM\",@progbits,16";
+CStringSection = "\t.section\t.rodata.str1.1,\"aMS\",@progbits,1";
 PrivateGlobalPrefix = ".L";
 WeakRefDirective = "\t.weak\t";
 SetDirective = "\t.set\t";



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


[llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolution.h

2007-05-03 Thread Dan Gohman


Changes in directory llvm/include/llvm/Analysis:

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

Use the explicit keyword for the SCEV class' constructor.


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

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


Index: llvm/include/llvm/Analysis/ScalarEvolution.h
diff -u llvm/include/llvm/Analysis/ScalarEvolution.h:1.19 
llvm/include/llvm/Analysis/ScalarEvolution.h:1.20
--- llvm/include/llvm/Analysis/ScalarEvolution.h:1.19   Wed May  2 20:11:53 2007
+++ llvm/include/llvm/Analysis/ScalarEvolution.hThu May  3 13:45:06 2007
@@ -54,7 +54,7 @@
   protected:
 virtual ~SCEV();
   public:
-SCEV(unsigned SCEVTy) : SCEVType(SCEVTy), RefCount(0) {}
+explicit SCEV(unsigned SCEVTy) : SCEVType(SCEVTy), RefCount(0) {}
 
 /// getNegativeSCEV - Return the SCEV object corresponding to -V.
 ///



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


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

2007-05-03 Thread Dan Gohman


Changes in directory llvm/lib/Target:

TargetAsmInfo.cpp updated: 1.25 -> 1.26
---
Log message:

Indent the .text, .data, and .bss directives in assembly output, so that
they are consistent with the other directives.


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

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


Index: llvm/lib/Target/TargetAsmInfo.cpp
diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.25 
llvm/lib/Target/TargetAsmInfo.cpp:1.26
--- llvm/lib/Target/TargetAsmInfo.cpp:1.25  Tue May  1 17:23:12 2007
+++ llvm/lib/Target/TargetAsmInfo.cpp   Thu May  3 13:46:30 2007
@@ -19,9 +19,9 @@
 using namespace llvm;
 
 TargetAsmInfo::TargetAsmInfo() :
-  TextSection(".text"),
-  DataSection(".data"),
-  BSSSection(".bss"),
+  TextSection("\t.text"),
+  DataSection("\t.data"),
+  BSSSection("\t.bss"),
   TLSDataSection("\t.section .tdata,\"awT\",@progbits"),
   TLSBSSSection("\t.section .tbss,\"awT\",@nobits"),
   ZeroFillDirective(0),



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

2007-05-03 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.134 -> 1.135
---
Log message:

Allow strength reduction to make use of addressing modes for the
address operand in a prefetch intrinsic.


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

 LoopStrengthReduce.cpp |   11 ++-
 1 files changed, 10 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.134 
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.135
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.134 Wed May  2 
20:11:54 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp   Thu May  3 18:20:33 2007
@@ -19,6 +19,7 @@
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Constants.h"
 #include "llvm/Instructions.h"
+#include "llvm/Intrinsics.h"
 #include "llvm/Type.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Analysis/Dominators.h"
@@ -1039,9 +1040,17 @@
   // Addressing modes can be folded into loads and stores.  Be careful that
   // the store is through the expression, not of the expression though.
   bool isAddress = isa(UsersToProcess[i].Inst);
-  if (StoreInst *SI = dyn_cast(UsersToProcess[i].Inst))
+  if (StoreInst *SI = dyn_cast(UsersToProcess[i].Inst)) {
 if (SI->getOperand(1) == UsersToProcess[i].OperandValToReplace)
   isAddress = true;
+  } else if (CallInst *CI = dyn_cast(UsersToProcess[i].Inst)) {
+// Addressing modes can also be folded into prefetches.
+Function *CalledFunc = CI->getCalledFunction();
+if (CalledFunc != NULL &&
+CalledFunc->getIntrinsicID() == Intrinsic::prefetch &&
+CI->getOperand(1) == UsersToProcess[i].OperandValToReplace)
+  isAddress = true;
+  }
   
   MoveImmediateValues(TLI, UsersToProcess[i].Inst, UsersToProcess[i].Base,
   UsersToProcess[i].Imm, isAddress, L);



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

2007-05-04 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.135 -> 1.136
---
Log message:

Use IntrinsicInst to test for prefetch instructions, which is ever so
slightly nicer than using CallInst with an extra check; thanks Chris.


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

 LoopStrengthReduce.cpp |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.135 
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.136
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.135 Thu May  3 
18:20:33 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp   Fri May  4 09:59:09 2007
@@ -19,7 +19,7 @@
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Constants.h"
 #include "llvm/Instructions.h"
-#include "llvm/Intrinsics.h"
+#include "llvm/IntrinsicInst.h"
 #include "llvm/Type.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Analysis/Dominators.h"
@@ -1043,12 +1043,11 @@
   if (StoreInst *SI = dyn_cast(UsersToProcess[i].Inst)) {
 if (SI->getOperand(1) == UsersToProcess[i].OperandValToReplace)
   isAddress = true;
-  } else if (CallInst *CI = dyn_cast(UsersToProcess[i].Inst)) {
+  } else if (IntrinsicInst *II =
+   dyn_cast(UsersToProcess[i].Inst)) {
 // Addressing modes can also be folded into prefetches.
-Function *CalledFunc = CI->getCalledFunction();
-if (CalledFunc != NULL &&
-CalledFunc->getIntrinsicID() == Intrinsic::prefetch &&
-CI->getOperand(1) == UsersToProcess[i].OperandValToReplace)
+if (II->getIntrinsicID() == Intrinsic::prefetch &&
+II->getOperand(1) == UsersToProcess[i].OperandValToReplace)
   isAddress = true;
   }
   



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

2007-05-08 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

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

Correct the comment for ApproximateLoopSize to reflect what it actually does.


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

 LoopUnroll.cpp |3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.44 
llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.45
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.44  Sat May  5 13:49:57 2007
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp   Tue May  8 10:14:19 2007
@@ -72,8 +72,7 @@
 
 LoopPass *llvm::createLoopUnrollPass() { return new LoopUnroll(); }
 
-/// ApproximateLoopSize - Approximate the size of the loop after it has been
-/// unrolled.
+/// ApproximateLoopSize - Approximate the size of the loop.
 static unsigned ApproximateLoopSize(const Loop *L) {
   unsigned Size = 0;
   for (unsigned i = 0, e = L->getBlocks().size(); i != e; ++i) {



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

2007-05-08 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

LoopUnroll.cpp updated: 1.45 -> 1.46
---
Log message:

Fix various whitespace inconsistencies.


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

 LoopUnroll.cpp |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.45 
llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.46
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.45  Tue May  8 10:14:19 2007
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp   Tue May  8 10:19:19 2007
@@ -50,10 +50,10 @@
 LoopInfo *LI;  // The current loop information
   public:
 static char ID; // Pass ID, replacement for typeid
-LoopUnroll()  : LoopPass((intptr_t)&ID) {}
+LoopUnroll() : LoopPass((intptr_t)&ID) {}
 
 bool runOnLoop(Loop *L, LPPassManager &LPM);
-BasicBlock* FoldBlockIntoPredecessor(BasicBlock* BB);
+BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB);
 
 /// This transformation requires natural loop information & requires that
 /// loop preheaders be inserted into the CFG...
@@ -114,7 +114,7 @@
 // FoldBlockIntoPredecessor - Folds a basic block into its predecessor if it
 // only has one predecessor, and that predecessor only has one successor.
 // Returns the new combined block.
-BasicBlock* LoopUnroll::FoldBlockIntoPredecessor(BasicBlock* BB) {
+BasicBlock *LoopUnroll::FoldBlockIntoPredecessor(BasicBlock *BB) {
   // Merge basic blocks into their predecessor if there is only one distinct
   // pred, and if there is only one distinct successor of the predecessor, and
   // if there are no PHI nodes.
@@ -165,8 +165,8 @@
   bool Changed = false;
   LI = &getAnalysis();
 
-  BasicBlock* Header = L->getHeader();
-  BasicBlock* LatchBlock = L->getLoopLatch();
+  BasicBlock *Header = L->getHeader();
+  BasicBlock *LatchBlock = L->getLoopLatch();
 
   BranchInst *BI = dyn_cast(LatchBlock->getTerminator());
   if (BI == 0) return Changed;  // Must end in a conditional branch
@@ -262,10 +262,10 @@
   if (*BB != LatchBlock)
 for (Value::use_iterator UI = (*BB)->use_begin(), UE = 
(*BB)->use_end();
  UI != UE; ++UI) {
-  Instruction* UseInst = cast(*UI);
+  Instruction *UseInst = cast(*UI);
   if (isa(UseInst) && !L->contains(UseInst->getParent())) {
-PHINode* phi = cast(UseInst);
-Value* Incoming = phi->getIncomingValueForBlock(*BB);
+PHINode *phi = cast(UseInst);
+Value *Incoming = phi->getIncomingValueForBlock(*BB);
 if (isa(Incoming))
   Incoming = LastValueMap[Incoming];
   
@@ -298,7 +298,7 @@
 SmallPtrSet Users;
 for (Value::use_iterator UI = LatchBlock->use_begin(),
  UE = LatchBlock->use_end(); UI != UE; ++UI)
-  if (PHINode* phi = dyn_cast(*UI))
+  if (PHINode *phi = dyn_cast(*UI))
 Users.insert(phi);
 
 BasicBlock *LastIterationBB = cast(LastValueMap[LatchBlock]);
@@ -328,7 +328,7 @@
   //  Insert the branches that link the different iterations together
   for (unsigned i = 0; i < Latches.size()-1; ++i) {
 new BranchInst(Headers[i+1], Latches[i]);
-if(BasicBlock* Fold = FoldBlockIntoPredecessor(Headers[i+1])) {
+if (BasicBlock *Fold = FoldBlockIntoPredecessor(Headers[i+1])) {
   std::replace(Latches.begin(), Latches.end(), Headers[i+1], Fold);
   std::replace(Headers.begin(), Headers.end(), Headers[i+1], Fold);
 }



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


[llvm-commits] beginning unroll improvements

2007-05-09 Thread Dan Gohman
This patch extends the LoopUnroll pass to be able to unroll loops
with unknown trip counts. This is left off by default, and a
command-line option enables it. It also begins to separate loop
unrolling into a utility routine; eventually it might be made usable
from other passes.

It currently works by inserting conditional branches between each
unrolled iteration, unless it proves that the trip count is a
multiple of a constant integer > 1, which it currently only does in
the rare case that the trip count expression is a Mul operator with
a ConstantInt operand. Eventually this information might be provided
by other sources, for example by a pass that peels/splits the loop
for this purpose.

Dan

-- 
Dan Gohman, Cray Inc.
Index: test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
===
RCS file: test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
diff -N test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
--- /dev/null
+++ test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -loop-unroll -unroll-count=3 | llvm-dis | grep bb72.2
+
+define void @foo(i32 %trips) {
+entry:
+   br label %cond_true.outer
+
+cond_true.outer:
+   %indvar1.ph = phi i32 [ 0, %entry ], [ %indvar.next2, %bb72 ]
+   br label %bb72
+
+bb72:
+   %indvar.next2 = add i32 %indvar1.ph, 1
+   %exitcond3 = icmp eq i32 %indvar.next2, %trips
+   br i1 %exitcond3, label %cond_true138, label %cond_true.outer
+
+cond_true138:
+   ret void
+}
Index: lib/Transforms/Scalar/LoopUnroll.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LoopUnroll.cpp,v
retrieving revision 1.46
diff -u -d -r1.46 LoopUnroll.cpp
--- lib/Transforms/Scalar/LoopUnroll.cpp
+++ lib/Transforms/Scalar/LoopUnroll.cpp
@@ -31,6 +31,7 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/MathExtras.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -39,12 +40,19 @@
 #include 
 using namespace llvm;
 
-STATISTIC(NumUnrolled, "Number of loops completely unrolled");
+STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
+STATISTIC(NumUnrolled,   "Number of loops unrolled (completely or 
otherwise)");
 
 namespace {
   cl::opt
-  UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden,
-  cl::desc("The cut-off point for loop unrolling"));
+  UnrollThreshold
+("unroll-threshold", cl::init(100), cl::Hidden,
+ cl::desc("The cut-off point for automatic loop unrolling"));
+
+  cl::opt
+  UnrollCount
+("unroll-count", cl::init(0), cl::Hidden,
+ cl::desc("Use this unroll count for all loops, for testing purposes"));
 
   class VISIBILITY_HIDDEN LoopUnroll : public LoopPass {
 LoopInfo *LI;  // The current loop information
@@ -52,7 +60,13 @@
 static char ID; // Pass ID, replacement for typeid
 LoopUnroll() : LoopPass((intptr_t)&ID) {}
 
+/// A magic value for use with the Threshold parameter to indicate
+/// that the loop unroll should be performed regardless of how much
+/// code expansion would result.
+static const unsigned NoThreshold = UINT_MAX;
+
 bool runOnLoop(Loop *L, LPPassManager &LPM);
+bool unrollLoop(Loop *L, unsigned Count, unsigned Threshold);
 BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB);
 
 /// This transformation requires natural loop information & requires that
@@ -162,43 +176,137 @@
 }
 
 bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
-  bool Changed = false;
   LI = &getAnalysis();
 
+  // Unroll the loop.
+  if (!unrollLoop(L, UnrollCount, UnrollThreshold))
+return false;
+
+  // Update the loop information for this loop.
+  // If we completely unrolled the loop, remove it from the parent.
+  if (L->getNumBackEdges() == 0)
+LPM.deleteLoopFromQueue(L);
+
+  return true;
+}
+
+/// Unroll the given loop by UnrollCount, or by a heuristically-determined
+/// value if Count is zero. If Threshold is non-NULL, it points to
+/// a Threshold value to limit code size expansion. If the loop size would
+/// expand beyond the threshold value, unrolling is suppressed. The return
+/// value is false if no transformations are performed.
+///
+bool LoopUnroll::unrollLoop(Loop *L, unsigned Count, unsigned Threshold) {
+  assert(L->isLCSSAForm());
+
   BasicBlock *Header = L->getHeader();
   BasicBlock *LatchBlock = L->getLoopLatch();
-
   BranchInst *BI = dyn_cast(LatchBlock->getTerminator());
-  if (BI == 0) return Changed;  // Must end in a conditional branch
 
-  ConstantInt *TripCountC = dyn_cast_o

Re: [llvm-commits] beginning unroll improvements

2007-05-11 Thread Dan Gohman
Devang Patel wrote:
> This looks good. Have you run any llvm-test
> benchmarks or any other benchmarks ?

I'm not currently planning to make loop-unroll unroll anything
more by default than what it currently does, so I don't expect
llvm-test to be affected.

Dan

-- 
Dan Gohman, Cray Inc.
___
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/LoopUnroll.cpp

2007-05-11 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

LoopUnroll.cpp updated: 1.46 -> 1.47
---
Log message:

This patch extends the LoopUnroll pass to be able to unroll loops
with unknown trip counts. This is left off by default, and a
command-line option enables it. It also begins to separate loop
unrolling into a utility routine; eventually it might be made usable
from other passes.

It currently works by inserting conditional branches between each
unrolled iteration, unless it proves that the trip count is a
multiple of a constant integer > 1, which it currently only does in
the rare case that the trip count expression is a Mul operator with
a ConstantInt operand. Eventually this information might be provided
by other sources, for example by a pass that peels/splits the loop
for this purpose.


---
Diffs of the changes:  (+193 -58)

 LoopUnroll.cpp |  251 +++--
 1 files changed, 193 insertions(+), 58 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.46 
llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.47
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.46  Tue May  8 10:19:19 2007
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp   Fri May 11 15:53:41 2007
@@ -31,6 +31,7 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/MathExtras.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -39,12 +40,19 @@
 #include 
 using namespace llvm;
 
-STATISTIC(NumUnrolled, "Number of loops completely unrolled");
+STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
+STATISTIC(NumUnrolled,   "Number of loops unrolled (completely or 
otherwise)");
 
 namespace {
   cl::opt
-  UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden,
-  cl::desc("The cut-off point for loop unrolling"));
+  UnrollThreshold
+("unroll-threshold", cl::init(100), cl::Hidden,
+ cl::desc("The cut-off point for automatic loop unrolling"));
+
+  cl::opt
+  UnrollCount
+("unroll-count", cl::init(0), cl::Hidden,
+ cl::desc("Use this unroll count for all loops, for testing purposes"));
 
   class VISIBILITY_HIDDEN LoopUnroll : public LoopPass {
 LoopInfo *LI;  // The current loop information
@@ -52,7 +60,13 @@
 static char ID; // Pass ID, replacement for typeid
 LoopUnroll() : LoopPass((intptr_t)&ID) {}
 
+/// A magic value for use with the Threshold parameter to indicate
+/// that the loop unroll should be performed regardless of how much
+/// code expansion would result.
+static const unsigned NoThreshold = UINT_MAX;
+
 bool runOnLoop(Loop *L, LPPassManager &LPM);
+bool unrollLoop(Loop *L, unsigned Count, unsigned Threshold);
 BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB);
 
 /// This transformation requires natural loop information & requires that
@@ -162,43 +176,137 @@
 }
 
 bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
-  bool Changed = false;
   LI = &getAnalysis();
 
+  // Unroll the loop.
+  if (!unrollLoop(L, UnrollCount, UnrollThreshold))
+return false;
+
+  // Update the loop information for this loop.
+  // If we completely unrolled the loop, remove it from the parent.
+  if (L->getNumBackEdges() == 0)
+LPM.deleteLoopFromQueue(L);
+
+  return true;
+}
+
+/// Unroll the given loop by UnrollCount, or by a heuristically-determined
+/// value if Count is zero. If Threshold is non-NULL, it points to
+/// a Threshold value to limit code size expansion. If the loop size would
+/// expand beyond the threshold value, unrolling is suppressed. The return
+/// value is false if no transformations are performed.
+///
+bool LoopUnroll::unrollLoop(Loop *L, unsigned Count, unsigned Threshold) {
+  assert(L->isLCSSAForm());
+
   BasicBlock *Header = L->getHeader();
   BasicBlock *LatchBlock = L->getLoopLatch();
-
   BranchInst *BI = dyn_cast(LatchBlock->getTerminator());
-  if (BI == 0) return Changed;  // Must end in a conditional branch
 
-  ConstantInt *TripCountC = dyn_cast_or_null(L->getTripCount());
-  if (!TripCountC) return Changed;  // Must have constant trip count!
+  DOUT << "Loop Unroll: F[" << Header->getParent()->getName()
+   << "] Loop %" << Header->getName() << "\n";
 
-  // Guard against huge trip counts. This also guards against assertions in
-  // APInt from the use of getZExtValue, below.
-  if (TripCountC->getValue().getActiveBits() > 32)
-return Changed; // More than 2^32 iterations???
+  if (!BI || BI->isUnconditional()) {
+// The loop-rorate pass can be helpful to avoid this in many cases.
+DOUT << "  Can't unroll; loop not terminated by a conditional branch.\n";
+return false;
+  }
 
-  uint64_t TripCountFull = TripCountC->getZExtValue();
-  if (TripCountFull == 0)
-return Changed; // Zero iteraitons?
+  // Determine the trip c

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

2007-05-11 Thread Dan Gohman


Changes in directory llvm/include/llvm:

Instructions.h updated: 1.73 -> 1.74
---
Log message:

Simplify BranchInst::getSuccessor, avoiding a conditional operator.


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

 Instructions.h |3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.73 
llvm/include/llvm/Instructions.h:1.74
--- llvm/include/llvm/Instructions.h:1.73   Fri Apr 27 15:35:56 2007
+++ llvm/include/llvm/Instructions.hFri May 11 15:59:29 2007
@@ -1323,8 +1323,7 @@
 
   BasicBlock *getSuccessor(unsigned i) const {
 assert(i < getNumSuccessors() && "Successor # out of range for Branch!");
-return (i == 0) ? cast(getOperand(0)) :
-  cast(getOperand(1));
+return cast(getOperand(i));
   }
 
   void setSuccessor(unsigned idx, BasicBlock *NewSucc) {



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


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

2007-05-11 Thread Dan Gohman


Changes in directory llvm/include/llvm:

Pass.h updated: 1.90 -> 1.91
---
Log message:

Add explicit keywords to several constructors that now have one argument.


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

 Pass.h |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/include/llvm/Pass.h
diff -u llvm/include/llvm/Pass.h:1.90 llvm/include/llvm/Pass.h:1.91
--- llvm/include/llvm/Pass.h:1.90   Thu May  3 17:09:21 2007
+++ llvm/include/llvm/Pass.hFri May 11 16:04:48 2007
@@ -86,7 +86,7 @@
   void operator=(const Pass&);  // DO NOT IMPLEMENT
   Pass(const Pass &);   // DO NOT IMPLEMENT
 public:
-  Pass(intptr_t pid) : Resolver(0), PassID(pid) {}
+  explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {}
   virtual ~Pass();
 
   /// getPassName - Return a nice clean name for a pass.  This usually
@@ -231,7 +231,7 @@
 return PMT_ModulePassManager;
   }
 
-  ModulePass(intptr_t pid) : Pass(pid) {}
+  explicit ModulePass(intptr_t pid) : Pass(pid) {}
   // Force out-of-line virtual method.
   virtual ~ModulePass();
 };
@@ -256,7 +256,7 @@
   ///
   virtual bool runOnModule(Module &M) { return false; }
 
-  ImmutablePass(intptr_t pid) : ModulePass(pid) {}
+  explicit ImmutablePass(intptr_t pid) : ModulePass(pid) {}
   // Force out-of-line virtual method.
   virtual ~ImmutablePass();
 };
@@ -272,7 +272,7 @@
 ///
 class FunctionPass : public Pass {
 public:
-  FunctionPass(intptr_t pid) : Pass(pid) {}
+  explicit FunctionPass(intptr_t pid) : Pass(pid) {}
 
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.
@@ -323,7 +323,7 @@
 ///
 class BasicBlockPass : public Pass {
 public:
-  BasicBlockPass(intptr_t pid) : Pass(pid) {}
+  explicit BasicBlockPass(intptr_t pid) : Pass(pid) {}
 
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.



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


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

2007-05-11 Thread Dan Gohman


Changes in directory llvm/include/llvm:

Pass.h updated: 1.91 -> 1.92
PassManager.h updated: 1.39 -> 1.40
---
Log message:

Remove forward-declarations for classes that don't exist.


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

 Pass.h|2 --
 PassManager.h |1 -
 2 files changed, 3 deletions(-)


Index: llvm/include/llvm/Pass.h
diff -u llvm/include/llvm/Pass.h:1.91 llvm/include/llvm/Pass.h:1.92
--- llvm/include/llvm/Pass.h:1.91   Fri May 11 16:04:48 2007
+++ llvm/include/llvm/Pass.hFri May 11 16:05:57 2007
@@ -45,8 +45,6 @@
 class AnalysisUsage;
 class PassInfo;
 class ImmutablePass;
-class BasicBlockPassManager;
-class ModulePassManager;
 class PMStack;
 class AnalysisResolver;
 class PMDataManager;


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.39 
llvm/include/llvm/PassManager.h:1.40
--- llvm/include/llvm/PassManager.h:1.39Fri Mar 23 13:44:11 2007
+++ llvm/include/llvm/PassManager.h Fri May 11 16:05:57 2007
@@ -26,7 +26,6 @@
 class Module;
 class ModuleProvider;
 
-class ModulePassManager;
 class PassManagerImpl;
 class FunctionPassManagerImpl;
 



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

2007-05-11 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.764 -> 1.765
LoopRotation.cpp updated: 1.13 -> 1.14
---
Log message:

Fix typos.


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

 InstructionCombining.cpp |2 +-
 LoopRotation.cpp |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.764 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.765
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.764   Fri May 11 
11:58:45 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri May 11 16:10:54 2007
@@ -6373,7 +6373,7 @@
   if (isa(Src))   // cast undef -> undef
 return ReplaceInstUsesWith(CI, UndefValue::get(CI.getType()));
 
-  // Many cases of "cast of a cast" are eliminable. If its eliminable we just
+  // Many cases of "cast of a cast" are eliminable. If it's eliminable we just
   // eliminate it now.
   if (CastInst *CSrc = dyn_cast(Src)) {   // A->B->C cast
 if (Instruction::CastOps opc = 


Index: llvm/lib/Transforms/Scalar/LoopRotation.cpp
diff -u llvm/lib/Transforms/Scalar/LoopRotation.cpp:1.13 
llvm/lib/Transforms/Scalar/LoopRotation.cpp:1.14
--- llvm/lib/Transforms/Scalar/LoopRotation.cpp:1.13Wed May  2 20:11:54 2007
+++ llvm/lib/Transforms/Scalar/LoopRotation.cpp Fri May 11 16:10:54 2007
@@ -116,7 +116,7 @@
   return RotatedOneLoop;
 }
 
-/// Rotate loop LP. Return true if it loop is rotated.
+/// Rotate loop LP. Return true if the loop is rotated.
 bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
 
   L = Lp;
@@ -130,7 +130,7 @@
 return false;
 
   assert (OrigHeader && OrigLatch && OrigPreHeader &&
-  "Loop is not in cannocial form");
+  "Loop is not in canonical form");
 
   // If loop header is not one of the loop exit block then
   // either this loop is already rotated or it 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/Utils/LCSSA.cpp

2007-05-11 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Utils:

LCSSA.cpp updated: 1.42 -> 1.43
---
Log message:

Fix typos.


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

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


Index: llvm/lib/Transforms/Utils/LCSSA.cpp
diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.42 
llvm/lib/Transforms/Utils/LCSSA.cpp:1.43
--- llvm/lib/Transforms/Utils/LCSSA.cpp:1.42Sun May  6 08:37:16 2007
+++ llvm/lib/Transforms/Utils/LCSSA.cpp Fri May 11 16:10:54 2007
@@ -12,7 +12,7 @@
 // the left into the right code:
 // 
 // for (...)for (...)
-//   if (c)   if(c)
+//   if (c)   if (c)
 // X1 = ... X1 = ...
 //   else else
 // X2 = ... X2 = ...



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


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

2007-05-11 Thread Dan Gohman


Changes in directory llvm/lib/VMCore:

Instructions.cpp updated: 1.91 -> 1.92
---
Log message:

Update comments to say "vector" instead of "packed".


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

 Instructions.cpp |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.91 
llvm/lib/VMCore/Instructions.cpp:1.92
--- llvm/lib/VMCore/Instructions.cpp:1.91   Fri Apr 27 15:35:56 2007
+++ llvm/lib/VMCore/Instructions.cppFri May 11 16:43:24 2007
@@ -1189,7 +1189,7 @@
 return false;   // First operand of insertelement must be vector type.
   
   if (Elt->getType() != cast(Vec->getType())->getElementType())
-return false;// Second operand of insertelement must be packed element 
type.
+return false;// Second operand of insertelement must be vector element 
type.
 
   if (Index->getType() != Type::Int32Ty)
 return false;  // Third operand of insertelement must be uint.
@@ -1500,7 +1500,7 @@
 /// example, the following are all no-op casts:
 /// # bitcast uint %X, int
 /// # bitcast uint* %x, sbyte*
-/// # bitcast packed< 2 x int > %x, packed< 4 x short> 
+/// # bitcast vector< 2 x int > %x, vector< 4 x short> 
 /// # ptrtoint uint* %x, uint ; on 32-bit plaforms only
 /// @brief Determine if a cast is a no-op.
 bool CastInst::isNoopCast(const Type *IntPtrTy) const {
@@ -1867,8 +1867,8 @@
   const Value *Src, bool SrcIsSigned, const Type *DestTy, bool DestIsSigned) {
   // Get the bit sizes, we'll need these
   const Type *SrcTy = Src->getType();
-  unsigned SrcBits = SrcTy->getPrimitiveSizeInBits();   // 0 for ptr/packed
-  unsigned DestBits = DestTy->getPrimitiveSizeInBits(); // 0 for ptr/packed
+  unsigned SrcBits = SrcTy->getPrimitiveSizeInBits();   // 0 for ptr/vector
+  unsigned DestBits = DestTy->getPrimitiveSizeInBits(); // 0 for ptr/vector
 
   // Run through the possibilities ...
   if (DestTy->isInteger()) {   // Casting to integral
@@ -1890,7 +1890,7 @@
 return FPToUI;  // FP -> uint 
 } else if (const VectorType *PTy = dyn_cast(SrcTy)) {
   assert(DestBits == PTy->getBitWidth() &&
-   "Casting packed to integer of different width");
+   "Casting vector to integer of different width");
   return BitCast; // Same size, no-op cast
 } else {
   assert(isa(SrcTy) &&
@@ -1913,7 +1913,7 @@
   }
 } else if (const VectorType *PTy = dyn_cast(SrcTy)) {
   assert(DestBits == PTy->getBitWidth() &&
- "Casting packed to floating point of different width");
+ "Casting vector to floating point of different width");
 return BitCast; // same size, no-op cast
 } else {
   assert(0 && "Casting pointer or non-first class to float");
@@ -1921,12 +1921,12 @@
   } else if (const VectorType *DestPTy = dyn_cast(DestTy)) {
 if (const VectorType *SrcPTy = dyn_cast(SrcTy)) {
   assert(DestPTy->getBitWidth() == SrcPTy->getBitWidth() &&
- "Casting packed to packed of different widths");
-  return BitCast; // packed -> packed
+ "Casting vector to vector of different widths");
+  return BitCast; // vector -> vector
 } else if (DestPTy->getBitWidth() == SrcBits) {
-  return BitCast;   // float/int -> packed
+  return BitCast;   // float/int -> vector
 } else {
-  assert(!"Illegal cast to packed (wrong type or size)");
+  assert(!"Illegal cast to vector (wrong type or size)");
 }
   } else if (isa(DestTy)) {
 if (isa(SrcTy)) {



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


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

2007-05-14 Thread Dan Gohman


Changes in directory llvm/include/llvm:

PassAnalysisSupport.h updated: 1.30 -> 1.31
---
Log message:

Add a addRequiredTransitiveID member function, which is to
addRequiredTransitive as addRequiredID is to addRequired.


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

 PassAnalysisSupport.h |   14 --
 1 files changed, 8 insertions(+), 6 deletions(-)


Index: llvm/include/llvm/PassAnalysisSupport.h
diff -u llvm/include/llvm/PassAnalysisSupport.h:1.30 
llvm/include/llvm/PassAnalysisSupport.h:1.31
--- llvm/include/llvm/PassAnalysisSupport.h:1.30Mon Apr 16 15:56:24 2007
+++ llvm/include/llvm/PassAnalysisSupport.h Mon May 14 09:21:46 2007
@@ -44,24 +44,26 @@
   // for a pass.
   //
   AnalysisUsage &addRequiredID(AnalysisID ID) {
+assert(ID && "Pass class not registered!");
 Required.push_back(ID);
 return *this;
   }
   template
   AnalysisUsage &addRequired() {
-assert(Pass::getClassPassInfo() && "Pass class not 
registered!");
-Required.push_back(Pass::getClassPassInfo());
-return *this;
+return addRequiredID(Pass::getClassPassInfo());
   }
 
-  template
-  AnalysisUsage &addRequiredTransitive() {
-AnalysisID ID = Pass::getClassPassInfo();
+  AnalysisUsage &addRequiredTransitiveID(AnalysisID ID) {
 assert(ID && "Pass class not registered!");
 Required.push_back(ID);
 RequiredTransitive.push_back(ID);
 return *this;
   }
+  template
+  AnalysisUsage &addRequiredTransitive() {
+AnalysisID ID = Pass::getClassPassInfo();
+return addRequiredTransitiveID(ID);
+  }
 
   // addPreserved - Add the specified ID to the set of analyses preserved by
   // this pass



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


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

2007-05-14 Thread Dan Gohman


Changes in directory llvm/include/llvm/Support:

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

Use templates for the GraphType for DefaultDOTGraphTraits' members instead
of just using void*. This allows it to be used with graph adapters like
Inverse.


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

 DOTGraphTraits.h |   19 ---
 1 files changed, 12 insertions(+), 7 deletions(-)


Index: llvm/include/llvm/Support/DOTGraphTraits.h
diff -u llvm/include/llvm/Support/DOTGraphTraits.h:1.15 
llvm/include/llvm/Support/DOTGraphTraits.h:1.16
--- llvm/include/llvm/Support/DOTGraphTraits.h:1.15 Mon Oct  2 07:26:53 2006
+++ llvm/include/llvm/Support/DOTGraphTraits.h  Mon May 14 09:23:27 2007
@@ -30,12 +30,14 @@
   /// getGraphName - Return the label for the graph as a whole.  Printed at the
   /// top of the graph.
   ///
-  static std::string getGraphName(const void *Graph) { return ""; }
+  template
+  static std::string getGraphName(GraphType Graph) { return ""; }
 
   /// getGraphProperties - Return any custom properties that should be included
   /// in the top level graph structure for dot.
   ///
-  static std::string getGraphProperties(const void *Graph) {
+  template
+  static std::string getGraphProperties(GraphType Graph) {
 return "";
   }
 
@@ -48,19 +50,22 @@
 
   /// getNodeLabel - Given a node and a pointer to the top level graph, return
   /// the label to print in the node.
-  static std::string getNodeLabel(const void *Node, const void *Graph) {
+  template
+  static std::string getNodeLabel(const void *Node, GraphType Graph) {
 return "";
   }
   
   /// hasNodeAddressLabel - If this method returns true, the address of the 
node
   /// is added to the label of the node.
-  static bool hasNodeAddressLabel(const void *Node, const void *Graph) {
+  template
+  static bool hasNodeAddressLabel(const void *Node, GraphType Graph) {
 return false;
   }
 
   /// If you want to specify custom node attributes, this is the place to do so
   ///
-  static std::string getNodeAttributes(const void *Node, const void *Graph) {
+  template
+  static std::string getNodeAttributes(const void *Node, GraphType Graph) {
 return "";
   }
 
@@ -100,8 +105,8 @@
   /// GraphType is passed in as an argument.  You may call arbitrary methods on
   /// it to add things to the output graph.
   ///
-  template
-  static void addCustomGraphFeatures(const void *Graph, GraphWriter &GW) {}
+  template
+  static void addCustomGraphFeatures(GraphType Graph, GraphWriter &GW) {}
 };
 
 



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


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

2007-05-14 Thread Dan Gohman


Changes in directory llvm/lib/Analysis:

CFGPrinter.cpp updated: 1.26 -> 1.27
---
Log message:

Add passes -view-cfg and -view-cfg-only that are like -print-cfg and
-print-cfg-only except they use the ViewCFG function, which displays the
CFG rendered with graphviz with gv.


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

 CFGPrinter.cpp |   42 ++
 1 files changed, 42 insertions(+)


Index: llvm/lib/Analysis/CFGPrinter.cpp
diff -u llvm/lib/Analysis/CFGPrinter.cpp:1.26 
llvm/lib/Analysis/CFGPrinter.cpp:1.27
--- llvm/lib/Analysis/CFGPrinter.cpp:1.26   Sun May  6 08:37:16 2007
+++ llvm/lib/Analysis/CFGPrinter.cppMon May 14 09:25:08 2007
@@ -90,6 +90,48 @@
 }
 
 namespace {
+  struct VISIBILITY_HIDDEN CFGViewer : public FunctionPass {
+static char ID; // Pass identifcation, replacement for typeid
+CFGViewer() : FunctionPass((intptr_t)&ID) {}
+
+virtual bool runOnFunction(Function &F) {
+  F.viewCFG();
+  return false;
+}
+
+void print(std::ostream &OS, const Module* = 0) const {}
+
+virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+  AU.setPreservesAll();
+}
+  };
+
+  char CFGViewer::ID = 0;
+  RegisterPass V0("view-cfg",
+ "View CFG of function");
+
+  struct VISIBILITY_HIDDEN CFGOnlyViewer : public FunctionPass {
+static char ID; // Pass identifcation, replacement for typeid
+CFGOnlyViewer() : FunctionPass((intptr_t)&ID) {}
+
+virtual bool runOnFunction(Function &F) {
+  CFGOnly = true;
+  F.viewCFG();
+  CFGOnly = false;
+  return false;
+}
+
+void print(std::ostream &OS, const Module* = 0) const {}
+
+virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+  AU.setPreservesAll();
+}
+  };
+
+  char CFGOnlyViewer::ID = 0;
+  RegisterPass V1("view-cfg-only",
+ "View CFG of function (with no function 
bodies)");
+
   struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass {
 static char ID; // Pass identification, replacement for typeid
 CFGPrinter() : FunctionPass((intptr_t)&ID) {}



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

2007-05-14 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

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

Correct a few comments.


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

 LoopUnroll.cpp |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.47 
llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.48
--- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.47  Fri May 11 15:53:41 2007
+++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp   Mon May 14 09:31:17 2007
@@ -168,7 +168,7 @@
   LI->removeBlock(BB);
   BB->eraseFromParent();
 
-  // Inherit predecessors name if it exists...
+  // Inherit predecessor's name if it exists...
   if (!OldName.empty() && !OnlyPred->hasName())
 OnlyPred->setName(OldName);
 
@@ -191,10 +191,10 @@
 }
 
 /// Unroll the given loop by UnrollCount, or by a heuristically-determined
-/// value if Count is zero. If Threshold is non-NULL, it points to
-/// a Threshold value to limit code size expansion. If the loop size would
-/// expand beyond the threshold value, unrolling is suppressed. The return
-/// value is false if no transformations are performed.
+/// value if Count is zero. If Threshold is not NoThreshold, it is a value
+/// to limit code size expansion. If the loop size would expand beyond the
+/// threshold value, unrolling is suppressed. The return value is true if
+/// any transformations are performed.
 ///
 bool LoopUnroll::unrollLoop(Loop *L, unsigned Count, unsigned Threshold) {
   assert(L->isLCSSAForm());



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

2007-05-14 Thread Dan Gohman


Changes in directory llvm/include/llvm/CodeGen:

SelectionDAGNodes.h updated: 1.189 -> 1.190
---
Log message:

Correct a comment.


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

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


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.189 
llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.190
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.189 Sun Apr 22 18:15:29 2007
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h   Mon May 14 19:20:13 2007
@@ -302,7 +302,7 @@
 /// Simple abstract vector operators.  Unlike the integer and floating 
point
 /// binary operators, these nodes also take two additional operands:
 /// a constant element count, and a value type node indicating the type of
-/// the elements.  The order is count, type, op0, op1.  All vector opcodes,
+/// the elements.  The order is op0, op1, count, type.  All vector opcodes,
 /// including VLOAD and VConstant must currently have count and type as
 /// their last two operands.
 VADD, VSUB, VMUL, VSDIV, VUDIV,



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


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

2007-05-17 Thread Dan Gohman


Changes in directory llvm/include/llvm/ADT:

SmallVector.h updated: 1.28 -> 1.29
---
Log message:

Fix some sporadic segfaults that are triggered when SmallVector's heap
storage lands near the end of the available address space. In the expression
Begin+N > Capacity, the Begin+N was overflowing. Fix this by replacing it
by with an expression that doesn't involve computation of an address
beyond the end of allocated memory.


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

 SmallVector.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/ADT/SmallVector.h
diff -u llvm/include/llvm/ADT/SmallVector.h:1.28 
llvm/include/llvm/ADT/SmallVector.h:1.29
--- llvm/include/llvm/ADT/SmallVector.h:1.28Wed Apr 18 21:04:09 2007
+++ llvm/include/llvm/ADT/SmallVector.h Thu May 17 13:29:01 2007
@@ -147,7 +147,7 @@
   destroy_range(Begin+N, End);
   End = Begin+N;
 } else if (N > size()) {
-  if (Begin+N > Capacity)
+  if (Capacity-Begin < N)
 grow(N);
   construct_range(End, Begin+N, T());
   End = Begin+N;
@@ -159,7 +159,7 @@
   destroy_range(Begin+N, End);
   End = Begin+N;
 } else if (N > size()) {
-  if (Begin+N > Capacity)
+  if (Capacity-Begin < N)
 grow(N);
   construct_range(End, Begin+N, NV);
   End = Begin+N;
@@ -189,7 +189,7 @@
   
   void assign(unsigned NumElts, const T &Elt) {
 clear();
-if (Begin+NumElts > Capacity)
+if (Capacity-Begin < NumElts)
   grow(NumElts);
 End = Begin+NumElts;
 construct_range(Begin, End, Elt);



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


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

2007-05-17 Thread Dan Gohman


Changes in directory llvm/include/llvm:

Type.h updated: 1.107 -> 1.108
---
Log message:

Correct a name in a comment.


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

 Type.h |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Type.h
diff -u llvm/include/llvm/Type.h:1.107 llvm/include/llvm/Type.h:1.108
--- llvm/include/llvm/Type.h:1.107  Fri Apr 20 17:33:47 2007
+++ llvm/include/llvm/Type.hThu May 17 16:30:39 2007
@@ -229,9 +229,10 @@
 return !isAbstract() || isSizedDerivedType();
   }
 
-  /// getPrimitiveSize - Return the basic size of this type if it is a 
primitive
-  /// type.  These are fixed by LLVM and are not target dependent.  This will
-  /// return zero if the type does not have a size or is not a primitive type.
+  /// getPrimitiveSizeInBits - Return the basic size of this type if it is a
+  /// primitive type.  These are fixed by LLVM and are not target dependent.
+  /// This will return zero if the type does not have a size or is not a
+  /// primitive type.
   ///
   unsigned getPrimitiveSizeInBits() const;
 



___
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/LegalizeDAG.cpp SelectionDAGISel.cpp SelectionDAGPrinter.cpp TargetLowering.cpp

2007-05-18 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.493 -> 1.494
SelectionDAGISel.cpp updated: 1.451 -> 1.452
SelectionDAGPrinter.cpp updated: 1.45 -> 1.46
TargetLowering.cpp updated: 1.115 -> 1.116
---
Log message:

Qualify several calls to functions in the MVT namespace, for consistency.


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

 LegalizeDAG.cpp |   28 +++-
 SelectionDAGISel.cpp|   14 +++---
 SelectionDAGPrinter.cpp |2 +-
 TargetLowering.cpp  |4 ++--
 4 files changed, 25 insertions(+), 23 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.493 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.494
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.493 Thu May 17 13:15:41 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Fri May 18 12:52:13 2007
@@ -2722,7 +2722,7 @@
 case TargetLowering::Promote: {
   MVT::ValueType OVT = Tmp1.getValueType();
   MVT::ValueType NVT = TLI.getTypeToPromoteTo(Node->getOpcode(), OVT);
-  unsigned DiffBits = getSizeInBits(NVT) - getSizeInBits(OVT);
+  unsigned DiffBits = MVT::getSizeInBits(NVT) - MVT::getSizeInBits(OVT);
 
   Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, NVT, Tmp1);
   Tmp1 = DAG.getNode(ISD::BSWAP, NVT, Tmp1);
@@ -2760,16 +2760,16 @@
   case ISD::CTTZ:
 //if Tmp1 == sizeinbits(NVT) then Tmp1 = sizeinbits(Old VT)
 Tmp2 = DAG.getSetCC(TLI.getSetCCResultTy(), Tmp1,
-DAG.getConstant(getSizeInBits(NVT), NVT),
+DAG.getConstant(MVT::getSizeInBits(NVT), NVT),
 ISD::SETEQ);
 Result = DAG.getNode(ISD::SELECT, NVT, Tmp2,
-   DAG.getConstant(getSizeInBits(OVT),NVT), Tmp1);
+   DAG.getConstant(MVT::getSizeInBits(OVT),NVT), Tmp1);
 break;
   case ISD::CTLZ:
 // Tmp1 = Tmp1 - (sizeinbits(NVT) - sizeinbits(Old VT))
 Result = DAG.getNode(ISD::SUB, NVT, Tmp1,
- DAG.getConstant(getSizeInBits(NVT) -
- getSizeInBits(OVT), NVT));
+ DAG.getConstant(MVT::getSizeInBits(NVT) -
+ MVT::getSizeInBits(OVT), NVT));
 break;
   }
   break;
@@ -3527,7 +3527,8 @@
 Tmp1 = DAG.getNode(ISD::ZERO_EXTEND, NVT, Tmp1);
 Tmp1 = DAG.getNode(ISD::BSWAP, NVT, Tmp1);
 Result = DAG.getNode(ISD::SRL, NVT, Tmp1,
- DAG.getConstant(getSizeInBits(NVT) - 
getSizeInBits(VT),
+ DAG.getConstant(MVT::getSizeInBits(NVT) -
+ MVT::getSizeInBits(VT),
  TLI.getShiftAmountTy()));
 break;
   case ISD::CTPOP:
@@ -3544,15 +3545,16 @@
 case ISD::CTTZ:
   // if Tmp1 == sizeinbits(NVT) then Tmp1 = sizeinbits(Old VT)
   Tmp2 = DAG.getSetCC(TLI.getSetCCResultTy(), Tmp1,
-  DAG.getConstant(getSizeInBits(NVT), NVT), 
ISD::SETEQ);
+  DAG.getConstant(MVT::getSizeInBits(NVT), NVT),
+  ISD::SETEQ);
   Result = DAG.getNode(ISD::SELECT, NVT, Tmp2,
-   DAG.getConstant(getSizeInBits(VT), NVT), Tmp1);
+   DAG.getConstant(MVT::getSizeInBits(VT), NVT), Tmp1);
   break;
 case ISD::CTLZ:
   //Tmp1 = Tmp1 - (sizeinbits(NVT) - sizeinbits(Old VT))
   Result = DAG.getNode(ISD::SUB, NVT, Tmp1,
-   DAG.getConstant(getSizeInBits(NVT) -
-   getSizeInBits(VT), NVT));
+   DAG.getConstant(MVT::getSizeInBits(NVT) -
+   MVT::getSizeInBits(VT), NVT));
   break;
 }
 break;
@@ -4639,7 +4641,7 @@
 };
 MVT::ValueType VT = Op.getValueType();
 MVT::ValueType ShVT = TLI.getShiftAmountTy();
-unsigned len = getSizeInBits(VT);
+unsigned len = MVT::getSizeInBits(VT);
 for (unsigned i = 0; (1U << i) <= (len / 2); ++i) {
   //x = (x & mask[i][len/8]) + (x >> (1 << i) & mask[i][len/8])
   SDOperand Tmp2 = DAG.getConstant(mask[i], VT);
@@ -4662,7 +4664,7 @@
 // but see also: http://www.hackersdelight.org/HDcode/nlz.cc
 MVT::ValueType VT = Op.getValueType();
 MVT::ValueType ShVT = TLI.getShiftAmountTy();
-unsigned len = getSizeInBits(VT);
+unsigned len = MVT::getSizeInBits(VT);
 for (unsigned i = 0; (1U << i) <= (len / 2); ++i) {
   SDOperand Tmp3 = DAG.getConstant(1ULL << i, ShVT);
   Op = DAG.getNode(ISD::OR, VT, Op, DAG.getNode(ISD::SRL, VT, Op, Tmp3));
@@ -4684,7 +4686,7 @@
 if (!TLI.isOperationLegal(ISD::CTPOP, VT) &&
 TLI.isOperationLegal(ISD::CTLZ, VT))
   return DAG.getNode(ISD::SUB, VT,
- DAG.getConstant(getSizeI

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

2007-05-18 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.404 -> 1.405
---
Log message:

Use MVT::FIRST_VECTOR_VALUETYPE and MVT::LAST_VECTOR_VALUETYPE.


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

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


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.404 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.405
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.404   Thu May 17 13:45:50 2007
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri May 18 13:44:07 2007
@@ -309,8 +309,8 @@
 
   // First set operation action for all vector types to expand. Then we
   // will selectively turn on ones that can be effectively codegen'd.
-  for (unsigned VT = (unsigned)MVT::Vector + 1;
-   VT != (unsigned)MVT::LAST_VALUETYPE; VT++) {
+  for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
+   VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) {
 setOperationAction(ISD::ADD , (MVT::ValueType)VT, Expand);
 setOperationAction(ISD::SUB , (MVT::ValueType)VT, Expand);
 setOperationAction(ISD::FADD, (MVT::ValueType)VT, Expand);



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


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

2007-05-18 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.307 -> 1.308
---
Log message:

Qualify calls to getTypeForValueType with MVT:: too.


---
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.307 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.308
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.307 Wed May 16 17:45:30 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Fri May 18 13:41:29 2007
@@ -2689,7 +2689,7 @@
   TLI.isOperationLegal(ISD::LOAD, VT)) {
 LoadSDNode *LN0 = cast(N0);
 unsigned Align = TLI.getTargetMachine().getTargetData()->
-  getABITypeAlignment(getTypeForValueType(VT));
+  getABITypeAlignment(MVT::getTypeForValueType(VT));
 unsigned OrigAlign = LN0->getAlignment();
 if (Align <= OrigAlign) {
   SDOperand Load = DAG.getLoad(VT, LN0->getChain(), LN0->getBasePtr(),
@@ -3569,7 +3569,7 @@
 unsigned Align = ST->getAlignment();
 MVT::ValueType SVT = Value.getOperand(0).getValueType();
 unsigned OrigAlign = TLI.getTargetMachine().getTargetData()->
-  getABITypeAlignment(getTypeForValueType(SVT));
+  getABITypeAlignment(MVT::getTypeForValueType(SVT));
 if (Align <= OrigAlign && TLI.isOperationLegal(ISD::STORE, SVT))
   return DAG.getStore(Chain, Value.getOperand(0), Ptr, ST->getSrcValue(),
   ST->getSrcValueOffset());
@@ -3765,7 +3765,7 @@
 if (VecIn2.Val) {
   Ops[1] = VecIn2;
 } else {
-   // Use an undef vbuild_vector as input for the second operand.
+  // Use an undef vbuild_vector as input for the second operand.
   std::vector UnOps(NumInScalars,
DAG.getNode(ISD::UNDEF, 
cast(EltType)->getVT()));



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


[llvm-commits] Use of MVT::LAST_VECTOR_VALUETYPE in PowerPC target

2007-05-18 Thread Dan Gohman
Hello all,

While doing some experiments with vector ValueTypes, I noticed that
the PowerPC target uses MVT::LAST_VECTOR_VALUETYPE inconsistently with
the way it is declared. I don't have the resources to test PowerPC
changes, so I'm just sending this patch to the list in case anyone
who does is interested in it.

Dan

Index: lib/Target/PowerPC/PPCISelLowering.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/Target/PowerPC/PPCISelLowering.cpp,v
retrieving revision 1.270
diff -u -r1.270 PPCISelLowering.cpp
--- lib/Target/PowerPC/PPCISelLowering.cpp
+++ lib/Target/PowerPC/PPCISelLowering.cpp
@@ -222,7 +222,7 @@
 // First set operation action for all vector types to expand. Then we
 // will selectively turn on ones that can be effectively codegen'd.
 for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
- VT != (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) {
+ VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) {
   // add/sub are legal for all supported vector VT's.
   setOperationAction(ISD::ADD , (MVT::ValueType)VT, Legal);
   setOperationAction(ISD::SUB , (MVT::ValueType)VT, Legal);
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll

2007-05-18 Thread Dan Gohman


Changes in directory llvm/test/Transforms/LoopUnroll:

2007-05-09-UnknownTripCount.ll added (r1.1)
---
Log message:

Add a testcase for unrolling loops with unknown tripcounts.


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

 2007-05-09-UnknownTripCount.ll |   18 ++
 1 files changed, 18 insertions(+)


Index: llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
diff -c /dev/null 
llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll:1.1
*** /dev/null   Fri May 18 14:59:34 2007
--- llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll  Fri May 
18 14:59:23 2007
***
*** 0 
--- 1,18 
+ ; RUN: llvm-as < %s | opt -loop-unroll -unroll-count=3 | llvm-dis | grep 
bb72.2
+ 
+ define void @foo(i32 %trips) {
+ entry:
+   br label %cond_true.outer
+ 
+ cond_true.outer:
+   %indvar1.ph = phi i32 [ 0, %entry ], [ %indvar.next2, %bb72 ]
+   br label %bb72
+ 
+ bb72:
+   %indvar.next2 = add i32 %indvar1.ph, 1
+   %exitcond3 = icmp eq i32 %indvar.next2, %trips
+   br i1 %exitcond3, label %cond_true138, label %cond_true.outer
+ 
+ cond_true138:
+   ret void
+ }



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


Re: [llvm-commits] Use of MVT::LAST_VECTOR_VALUETYPE in PowerPC target

2007-05-18 Thread Dan Gohman
On May 18, 2007, at 3:08 PM, Chris Lattner wrote:
> 
> > Hello all,
> >
> > While doing some experiments with vector ValueTypes, I noticed that
> > the PowerPC target uses MVT::LAST_VECTOR_VALUETYPE inconsistently with
> > the way it is declared. I don't have the resources to test PowerPC
> > changes, so I'm just sending this patch to the list in case anyone
> > who does is interested in it.
> 
> The patch looks safe to me, but how is it semantically different?

It would make the for loop cover v2f64, where it didn't before.

Dan

-- 
Dan Gohman, Cray Inc.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-05-18 Thread Dan Gohman


Changes in directory llvm/lib/Target/PowerPC:

PPCISelLowering.cpp updated: 1.270 -> 1.271
---
Log message:

Apply this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070514/049845.html


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

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


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.270 
llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.271
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.270   Mon May 14 20:31:05 2007
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Fri May 18 18:21:46 2007
@@ -222,7 +222,7 @@
 // First set operation action for all vector types to expand. Then we
 // will selectively turn on ones that can be effectively codegen'd.
 for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
- VT != (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) {
+ VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) {
   // add/sub are legal for all supported vector VT's.
   setOperationAction(ISD::ADD , (MVT::ValueType)VT, Legal);
   setOperationAction(ISD::SUB , (MVT::ValueType)VT, Legal);



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


Re: [llvm-commits] [LLVMdev] Simplifing the handling of pre-legalize vector nodes

2007-05-23 Thread Dan Gohman
Ok, I now have a patch that implements this. It's a work in progress, and
still rough in some areas (some details below), but it works well enough
to allow the LLVM regression tests to pass on x86. I'm posting it now so
that people can see what I'm up to.

On Wed, May 23, 2007 at 12:03:30AM -0700, Chris Lattner wrote:
> On Mon, 21 May 2007, Dan Gohman wrote:
> > It seems that a number of things would be considerably simpler if the
> > pre-legalize nodes could use the same node kinds as post-legalize; the only
> > thing preventing that is that the MVT::ValueType enum isn't able to describe
> > vector types with arbitrarily long vector lengths.
> 
> Yep, I'm sure you know this, but this is to support generic vectors.  For 
> example, if you had an input .ll that operated on 128-wide vectors, we 
> want to be able to split that up to use 4-wide vectors if your target 
> supports them.

Last time I tried this it caused an impressive amount of register pressure;
long-vector loads/stores require special ScheduleDAG dependencies, but LLVM
was forcing long-vector dependencies on all the operators so that operations
on the individual sub-vectors couldn't be scheduled around to reduce register
pressure. But that's a different topic :-).

> Going forward, we will also likely have to do something similar to this 
> for integer types, in order to handle stuff like i47 that gets legalized 
> into 2 x i32 or something.  I am not looking forward to duplicating all of 
> the arithmetic nodes for IADD variants etc (urk, imagine vectors of 
> strange-sized-integers! VIADD??)

urk indeed...

My current patch is specific to vectors, as the table elements for extended
types are std::pairs of vector lengths and element types. Perhaps the thing
to do then is to make it a table of Type*. Then it would be usable for any
machine-illegal type.

> > I'm currently considering ways to make this possible. One idea is to rename
> > the MVT::ValueType enum to something else and make MVT::ValueType a plain
> > integer type. Values beyond the range of the original enum are interpreted
> > as indices into a UniqueVector which holds pairs of vector lengths and
> > element types.
> 
> That is a very interesting idea.  It handles the generality of arbitrary 
> value types, but is nice and fast for the common code that doesn't use the 
> craziness :).  I like it!

One downside is that debuggers no longer print MVT::ValueTypes with enum
names.

> > Before I do much more experimentation with this, I wanted to run the idea by
> > the list to see what feedback it might get. Has anyone thought about doing
> > this before? Are there other approaches that might be better?
> 
> This approach sounds very sensible.  Make sure the SelectionDAG owns the 
> table though.

I wasn't sure if it should go in the SelectionDAG or the TargetLowering.
My current patch just uses a global table because it was easier and allowed
me to get to the LegalizeDAG.cpp changes. But I'll definately clean this up.

> > Another idea is to get rid of the ValueType concept altogether and just use
> > Type* for everything. I don't know how this would work with various
> > tablegen'd pieces of code though.
> 
> I'd suggest sticking with ValueTypes.  Among other things, they can be 
> indexed into arrays and Type*'s can't.  This is important for the various 
> tables in targetlowering that the legalizer consults to find out if a 
> type/operation is valid.

Ok.

Dan

-- 
Dan Gohman, Cray Inc.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-05-24 Thread Dan Gohman


Changes in directory llvm/lib/VMCore:

ValueTypes.cpp updated: 1.17 -> 1.18
---
Log message:

Add cases for v2f32.


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

 ValueTypes.cpp |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/VMCore/ValueTypes.cpp
diff -u llvm/lib/VMCore/ValueTypes.cpp:1.17 llvm/lib/VMCore/ValueTypes.cpp:1.18
--- llvm/lib/VMCore/ValueTypes.cpp:1.17 Sat Apr 28 00:38:52 2007
+++ llvm/lib/VMCore/ValueTypes.cpp  Thu May 24 09:29:12 2007
@@ -43,6 +43,7 @@
   case MVT::v8i16: return "v8i16";
   case MVT::v4i32: return "v4i32";
   case MVT::v2i64: return "v2i64";
+  case MVT::v2f32: return "v2f32";
   case MVT::v4f32: return "v4f32";
   case MVT::v2f64: return "v2f64";
   }
@@ -106,6 +107,7 @@
   case MVT::v8i16: return VectorType::get(Type::Int16Ty, 8);
   case MVT::v4i32: return VectorType::get(Type::Int32Ty, 4);
   case MVT::v2i64: return VectorType::get(Type::Int64Ty, 2);
+  case MVT::v2f32: return VectorType::get(Type::FloatTy, 2);
   case MVT::v4f32: return VectorType::get(Type::FloatTy, 4);
   case MVT::v2f64: return VectorType::get(Type::DoubleTy, 2);
   }



___
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

2007-05-24 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.405 -> 1.406
---
Log message:

Add explicit qualification for namespace MVT members.


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

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


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.405 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.406
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.405   Fri May 18 13:44:07 2007
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu May 24 09:33:05 2007
@@ -2255,7 +2255,7 @@
 ///
 static SDOperand getZeroVector(MVT::ValueType VT, SelectionDAG &DAG) {
   assert(MVT::isVector(VT) && "Expected a vector type");
-  unsigned NumElems = getVectorNumElements(VT);
+  unsigned NumElems = MVT::getVectorNumElements(VT);
   MVT::ValueType EVT = MVT::getVectorBaseType(VT);
   bool isFP = MVT::isFloatingPoint(EVT);
   SDOperand Zero = isFP ? DAG.getConstantFP(0.0, EVT) : DAG.getConstant(0, 
EVT);



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

2007-05-24 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.403 -> 1.404
---
Log message:

Add explicit qualification for namespace MVT members.


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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.403 
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.404
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.403Tue Apr 24 
19:00:45 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp  Thu May 24 09:33:05 2007
@@ -3048,7 +3048,7 @@
 else
   cerr << "getOffset() << ">";
   } else if (const VTSDNode *N = dyn_cast(this)) {
-cerr << ":" << getValueTypeString(N->getVT());
+cerr << ":" << MVT::getValueTypeString(N->getVT());
   } else if (const LoadSDNode *LD = dyn_cast(this)) {
 bool doExt = true;
 switch (LD->getExtensionType()) {



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


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

2007-05-24 Thread Dan Gohman


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.228 -> 1.229
Type.cpp updated: 1.187 -> 1.188
---
Log message:

Minor comment cleanups.


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

 Constants.cpp |   10 +-
 Type.cpp  |2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.228 llvm/lib/VMCore/Constants.cpp:1.229
--- llvm/lib/VMCore/Constants.cpp:1.228 Mon Mar 19 15:39:08 2007
+++ llvm/lib/VMCore/Constants.cpp   Thu May 24 09:36:04 2007
@@ -130,14 +130,14 @@
   return 0;
 }
 
-/// @returns the value for an packed integer constant of the given type that
+/// @returns the value for a vector integer constant of the given type that
 /// has all its bits set to true.
 /// @brief Get the all ones value
 ConstantVector *ConstantVector::getAllOnesValue(const VectorType *Ty) {
   std::vector Elts;
   Elts.resize(Ty->getNumElements(),
   ConstantInt::getAllOnesValue(Ty->getElementType()));
-  assert(Elts[0] && "Not a packed integer type!");
+  assert(Elts[0] && "Not a vector integer type!");
   return cast(ConstantVector::get(Elts));
 }
 
@@ -353,7 +353,7 @@
   assert((C->getType() == T->getElementType() ||
 (T->isAbstract() &&
  C->getType()->getTypeID() == T->getElementType()->getTypeID())) &&
-   "Initializer for packed element doesn't match packed element 
type!");
+   "Initializer for vector element doesn't match vector element 
type!");
 OL->init(C, this);
   }
 }
@@ -1185,7 +1185,7 @@
 
 Constant *ConstantVector::get(const VectorType *Ty,
   const std::vector &V) {
-  // If this is an all-zero packed, return a ConstantAggregateZero object
+  // If this is an all-zero vector, return a ConstantAggregateZero object
   if (!V.empty()) {
 Constant *C = V[0];
 if (!C->isNullValue())
@@ -1209,7 +1209,7 @@
   destroyConstantImpl();
 }
 
-/// This function will return true iff every element in this packed constant
+/// This function will return true iff every element in this vector constant
 /// is set to all ones.
 /// @returns true iff this constant's emements are all set to all ones.
 /// @brief Determine if the value is all ones.


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.187 llvm/lib/VMCore/Type.cpp:1.188
--- llvm/lib/VMCore/Type.cpp:1.187  Thu May  3 22:39:28 2007
+++ llvm/lib/VMCore/Type.cppThu May 24 09:36:04 2007
@@ -1181,7 +1181,7 @@
 
 
 VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) {
-  assert(ElementType && "Can't get packed of null types!");
+  assert(ElementType && "Can't get vector of null types!");
   assert(isPowerOf2_32(NumElements) && "Vector length should be a power of 
2!");
 
   VectorValType PVT(ElementType, NumElements);



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


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

2007-05-24 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Utils:

SimplifyCFG.cpp updated: 1.121 -> 1.122
---
Log message:

Minor comment cleanups.


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

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


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.121 
llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.122
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.121 Tue Apr 17 12:47:54 2007
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp   Thu May 24 09:36:04 2007
@@ -532,7 +532,7 @@
 }
 
 
-// EliminateBlockCases - Given an vector of bb/value pairs, remove any entries
+// EliminateBlockCases - Given a vector of bb/value pairs, remove any entries
 // in the list that match the specified block.
 static void EliminateBlockCases(BasicBlock *BB,
std::vector > &Cases) {



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

2007-05-24 Thread Dan Gohman


Changes in directory llvm/include/llvm/CodeGen:

SelectionDAGNodes.h updated: 1.190 -> 1.191
---
Log message:

Minor comment cleanups.


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

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


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.190 
llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.191
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.190 Mon May 14 19:20:13 2007
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h   Thu May 24 09:36:03 2007
@@ -249,7 +249,7 @@
 
 /// VINSERT_VECTOR_ELT(VECTOR, VAL, IDX,  COUNT,TYPE) - Given a vector
 /// VECTOR, an element ELEMENT, and a (potentially variable) index IDX,
-/// return an vector with the specified element of VECTOR replaced with 
VAL.
+/// return a vector with the specified element of VECTOR replaced with VAL.
 /// COUNT and TYPE specify the type of vector, as is standard for V* nodes.
 VINSERT_VECTOR_ELT,
 



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


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

2007-05-24 Thread Dan Gohman


Changes in directory llvm/include/llvm:

Constants.h updated: 1.146 -> 1.147
---
Log message:

Minor comment cleanups.


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

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


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.146 llvm/include/llvm/Constants.h:1.147
--- llvm/include/llvm/Constants.h:1.146 Fri Apr 13 13:12:09 2007
+++ llvm/include/llvm/Constants.h   Thu May 24 09:36:03 2007
@@ -399,14 +399,14 @@
 return get(std::vector(Vals, Vals+NumVals));
   }
   
-  /// getType - Specialize the getType() method to always return an VectorType,
+  /// getType - Specialize the getType() method to always return a VectorType,
   /// which reduces the amount of casting needed in parts of the compiler.
   ///
   inline const VectorType *getType() const {
 return reinterpret_cast(Value::getType());
   }
 
-  /// @returns the value for an packed integer constant of the given type that
+  /// @returns the value for a vector integer constant of the given type that
   /// has all its bits set to true.
   /// @brief Get the all ones value
   static ConstantVector *getAllOnesValue(const VectorType *Ty);
@@ -416,7 +416,7 @@
   /// created as ConstantAggregateZero objects.
   virtual bool isNullValue() const { return false; }
 
-  /// This function will return true iff every element in this packed constant
+  /// This function will return true iff every element in this vector constant
   /// is set to all ones.
   /// @returns true iff this constant's emements are all set to all ones.
   /// @brief Determine if the value is all ones.
@@ -631,7 +631,7 @@
   static Constant *getShuffleVector(Constant *V1, Constant *V2, Constant 
*Mask);
 
   /// Floating point negation must be implemented with f(x) = -0.0 - x. This
-  /// method returns the negative zero constant for floating point or packed
+  /// method returns the negative zero constant for floating point or vector
   /// floating point types; for all other types, it returns the null value.
   static Constant *getZeroValueForNegationExpr(const Type *Ty);
 



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


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

2007-05-24 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.453 -> 1.454
---
Log message:

Minor comment cleanups.


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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.453 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.454
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.453Wed May 23 
06:08:31 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Thu May 24 09:36:04 2007
@@ -770,7 +770,7 @@
 Ops.push_back(DAG.getCopyFromReg(DAG.getEntryNode(), InReg++, 
  PTyElementVT));
 } else if (PTyElementVT < PTyLegalElementVT) {
-  // If the register was promoted, use TRUNCATE of FP_ROUND as appropriate.
+  // If the register was promoted, use TRUNCATE or FP_ROUND as appropriate.
   for (unsigned i = 0; i != NE; ++i) {
 SDOperand Op = DAG.getCopyFromReg(DAG.getEntryNode(), InReg++, 
   PTyElementVT);



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

2007-06-04 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.404 -> 1.405
---
Log message:

Resolve implicit alignment before computing the FoldingSet information so
that the CSE map always contains explicit alignment information. This allows
more loads to be CSE'd when there is a mix of explicit-alignment loads and
implicit-alignment loads.

Also, in SelectionDAG::FindModifiedNodeSlot, add the operands to the
FoldingSetNodeID before the load/store information instead of after, so
that it matches what is done elsewhere.


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

 SelectionDAG.cpp |   99 +++
 1 files changed, 49 insertions(+), 50 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.404 
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.405
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.404Thu May 24 
09:33:05 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp  Mon Jun  4 10:49:41 2007
@@ -597,7 +597,7 @@
   return 0;   // Never CSE anything that produces a flag.
   
   FoldingSetNodeID ID;
-  AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), 0, 0);
+  AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops, NumOps);
   
   if (const LoadSDNode *LD = dyn_cast(N)) {
 ID.AddInteger(LD->getAddressingMode());
@@ -617,7 +617,6 @@
 ID.AddInteger(ST->isVolatile());
   }
   
-  AddNodeIDOperands(ID, Ops, NumOps);
   return CSEMap.FindNodeOrInsertPos(ID, InsertPos);
 }
 
@@ -1548,6 +1547,18 @@
 SDOperand Chain, SDOperand Ptr,
 const Value *SV, int SVOffset,
 bool isVolatile, unsigned Alignment) {
+  if (Alignment == 0) { // Ensure that codegen never sees alignment 0
+const Type *Ty = 0;
+if (VT != MVT::Vector && VT != MVT::iPTR) {
+  Ty = MVT::getTypeForValueType(VT);
+} else if (SV) {
+  const PointerType *PT = dyn_cast(SV->getType());
+  assert(PT && "Value for load must be a pointer");
+  Ty = PT->getElementType();
+}  
+assert(Ty && "Could not get type information for load");
+Alignment = TLI.getTargetData()->getABITypeAlignment(Ty);
+  }
   SDVTList VTs = getVTList(VT, MVT::Other);
   SDOperand Undef = getNode(ISD::UNDEF, Ptr.getValueType());
   SDOperand Ops[] = { Chain, Ptr, Undef };
@@ -1563,18 +1574,6 @@
   void *IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
 return SDOperand(E, 0);
-  if (Alignment == 0) { // Ensure that codegen never sees alignment 0
-const Type *Ty = 0;
-if (VT != MVT::Vector && VT != MVT::iPTR) {
-  Ty = MVT::getTypeForValueType(VT);
-} else if (SV) {
-  const PointerType *PT = dyn_cast(SV->getType());
-  assert(PT && "Value for load must be a pointer");
-  Ty = PT->getElementType();
-}  
-assert(Ty && "Could not get type information for load");
-Alignment = TLI.getTargetData()->getABITypeAlignment(Ty);
-  }
   SDNode *N = new LoadSDNode(Ops, VTs, ISD::UNINDEXED,
  ISD::NON_EXTLOAD, VT, SV, SVOffset, Alignment,
  isVolatile);
@@ -1602,6 +1601,18 @@
   assert(MVT::isInteger(VT) == MVT::isInteger(EVT) &&
  "Cannot convert from FP to Int or Int -> FP!");
 
+  if (Alignment == 0) { // Ensure that codegen never sees alignment 0
+const Type *Ty = 0;
+if (VT != MVT::Vector && VT != MVT::iPTR) {
+  Ty = MVT::getTypeForValueType(VT);
+} else if (SV) {
+  const PointerType *PT = dyn_cast(SV->getType());
+  assert(PT && "Value for load must be a pointer");
+  Ty = PT->getElementType();
+}  
+assert(Ty && "Could not get type information for load");
+Alignment = TLI.getTargetData()->getABITypeAlignment(Ty);
+  }
   SDVTList VTs = getVTList(VT, MVT::Other);
   SDOperand Undef = getNode(ISD::UNDEF, Ptr.getValueType());
   SDOperand Ops[] = { Chain, Ptr, Undef };
@@ -1617,18 +1628,6 @@
   void *IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
 return SDOperand(E, 0);
-  if (Alignment == 0) { // Ensure that codegen never sees alignment 0
-const Type *Ty = 0;
-if (VT != MVT::Vector && VT != MVT::iPTR) {
-  Ty = MVT::getTypeForValueType(VT);
-} else if (SV) {
-  const PointerType *PT = dyn_cast(SV->getType());
-  assert(PT && "Value for load must be a pointer");
-  Ty = PT->getElementType();
-}  
-assert(Ty && "Could not get type information for load");
-Alignment = TLI.getTargetData()->getABITypeAlignment(Ty);
-  }
   SDNode *N = new LoadSDNode(Ops, VTs, ISD::UNINDEXED, ExtType, EVT,
  SV, SVOffset, Alignment, isVolatile);
   CSEMap.InsertNode(N, IP);
@@ -1679,6 +1678,18 @@
  bool isVolatile, unsigned Alignment) {
   MVT::ValueType VT = Val.getValueType();
 
+  if (Alignment == 0) { // Ensure that codegen never sees align

[llvm-commits] CVS: llvm/utils/TableGen/CodeGenTarget.cpp CodeGenTarget.h RegisterInfoEmitter.cpp

2007-06-04 Thread Dan Gohman


Changes in directory llvm/utils/TableGen:

CodeGenTarget.cpp updated: 1.89 -> 1.90
CodeGenTarget.h updated: 1.29 -> 1.30
RegisterInfoEmitter.cpp updated: 1.54 -> 1.55
---
Log message:

Remove the operator<< for MVT::ValueType in preparation for MVT::ValueType
being changed from an enum to an integer type, which can't have a custom
operator<< overload.


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

 CodeGenTarget.cpp   |5 -
 CodeGenTarget.h |1 -
 RegisterInfoEmitter.cpp |2 +-
 3 files changed, 1 insertion(+), 7 deletions(-)


Index: llvm/utils/TableGen/CodeGenTarget.cpp
diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.89 
llvm/utils/TableGen/CodeGenTarget.cpp:1.90
--- llvm/utils/TableGen/CodeGenTarget.cpp:1.89  Wed May 16 15:45:24 2007
+++ llvm/utils/TableGen/CodeGenTarget.cpp   Mon Jun  4 11:11:03 2007
@@ -99,11 +99,6 @@
 }
 
 
-std::ostream &llvm::operator<<(std::ostream &OS, MVT::ValueType T) {
-  return OS << getName(T);
-}
-
-
 /// getTarget - Return the current instance of the Target class.
 ///
 CodeGenTarget::CodeGenTarget() {


Index: llvm/utils/TableGen/CodeGenTarget.h
diff -u llvm/utils/TableGen/CodeGenTarget.h:1.29 
llvm/utils/TableGen/CodeGenTarget.h:1.30
--- llvm/utils/TableGen/CodeGenTarget.h:1.29Wed Oct 11 16:02:01 2006
+++ llvm/utils/TableGen/CodeGenTarget.h Mon Jun  4 11:11:03 2007
@@ -37,7 +37,6 @@
 /// corresponds to.
 MVT::ValueType getValueType(Record *Rec, const CodeGenTarget *CGT = 0);
 
-std::ostream &operator<<(std::ostream &OS, MVT::ValueType T);
 std::string getName(MVT::ValueType T);
 std::string getEnumName(MVT::ValueType T);
 


Index: llvm/utils/TableGen/RegisterInfoEmitter.cpp
diff -u llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.54 
llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.55
--- llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.54Tue May  1 01:08:36 2007
+++ llvm/utils/TableGen/RegisterInfoEmitter.cpp Mon Jun  4 11:11:03 2007
@@ -209,7 +209,7 @@
<< "  static const MVT::ValueType " << Name
<< "[] = {\n";
 for (unsigned i = 0, e = RC.VTs.size(); i != e; ++i)
-  OS << RC.VTs[i] << ", ";
+  OS << getName(RC.VTs[i]) << ", ";
 OS << "MVT::Other\n  };\n\n";
   }
   OS << "}  // end anonymous namespace\n\n";



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

2007-06-04 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.494 -> 1.495
---
Log message:

Pass the DAG to SDNode::dump to let it do more detailed dumps in some cases.


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

 LegalizeDAG.cpp |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.494 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.495
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.494 Fri May 18 12:52:13 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Mon Jun  4 11:17:33 2007
@@ -648,7 +648,7 @@
 }
 // Otherwise this is an unhandled builtin node.  splat.
 #ifndef NDEBUG
-cerr << "NODE: "; Node->dump(); cerr << "\n";
+cerr << "NODE: "; Node->dump(&DAG); cerr << "\n";
 #endif
 assert(0 && "Do not know how to legalize this operator!");
 abort();
@@ -3181,7 +3181,7 @@
 assert(0 && "CopyFromReg must be legal!");
   default:
 #ifndef NDEBUG
-cerr << "NODE: "; Node->dump(); cerr << "\n";
+cerr << "NODE: "; Node->dump(&DAG); cerr << "\n";
 #endif
 assert(0 && "Do not know how to promote this operator!");
 abort();
@@ -4721,7 +4721,7 @@
 assert(0 && "CopyFromReg must be legal!");
   default:
 #ifndef NDEBUG
-cerr << "NODE: "; Node->dump(); cerr << "\n";
+cerr << "NODE: "; Node->dump(&DAG); cerr << "\n";
 #endif
 assert(0 && "Do not know how to expand this operator!");
 abort();
@@ -5484,7 +5484,7 @@
   switch (Node->getOpcode()) {
   default: 
 #ifndef NDEBUG
-Node->dump();
+Node->dump(&DAG);
 #endif
 assert(0 && "Unhandled operation in SplitVectorOp!");
   case ISD::VBUILD_VECTOR: {
@@ -5606,7 +5606,7 @@
   switch (Node->getOpcode()) {
   default: 
 #ifndef NDEBUG
-Node->dump(); cerr << "\n";
+Node->dump(&DAG); cerr << "\n";
 #endif
 assert(0 && "Unknown vector operation in PackVectorOp!");
   case ISD::VADD:



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

2007-06-05 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

LICM.cpp updated: 1.104 -> 1.105
---
Log message:

Allow insertelement, extractelement, and shufflevector to be hoisted/sunk
by LICM.


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

 LICM.cpp |4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.104 
llvm/lib/Transforms/Scalar/LICM.cpp:1.105
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.104   Sun Jun  3 19:32:21 2007
+++ llvm/lib/Transforms/Scalar/LICM.cpp Tue Jun  5 11:05:55 2007
@@ -389,7 +389,9 @@
 
   // Otherwise these instructions are hoistable/sinkable
   return isa(I) || isa(I) ||
- isa(I) || isa(I) || isa(I);
+ isa(I) || isa(I) || isa(I) ||
+ isa(I) || isa(I) ||
+ isa(I);
 }
 
 /// isNotUsedInLoop - Return true if the only users of this instruction are



___
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/LegalizeDAG.cpp SelectionDAG.cpp SelectionDAGISel.cpp

2007-06-13 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.495 -> 1.496
SelectionDAG.cpp updated: 1.405 -> 1.406
SelectionDAGISel.cpp updated: 1.460 -> 1.461
---
Log message:

Introduce new SelectionDAG node opcodes VEXTRACT_SUBVECTOR and
VCONCAT_VECTORS. Use these for CopyToReg and CopyFromReg legalizing in
the case that the full register is to be split into subvectors instead
of scalars. This replaces uses of VBIT_CONVERT to present values as
vector-of-vector types in order to make whole subvectors accessible via
BUILD_VECTOR and EXTRACT_VECTOR_ELT.

This is in preparation for adding extended ValueType values, where
having vector-of-vector types is undesirable.


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

 LegalizeDAG.cpp  |   63 +++
 SelectionDAG.cpp |2 +
 SelectionDAGISel.cpp |   39 ++-
 3 files changed, 83 insertions(+), 21 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.495 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.496
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.495 Mon Jun  4 11:17:33 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Wed Jun 13 10:12:02 2007
@@ -225,6 +225,7 @@
 SDOperand &Lo, SDOperand &Hi);
 
   SDOperand LowerVEXTRACT_VECTOR_ELT(SDOperand Op);
+  SDOperand LowerVEXTRACT_SUBVECTOR(SDOperand Op);
   SDOperand ExpandEXTRACT_VECTOR_ELT(SDOperand Op);
   
   SDOperand getIntPtrConstant(uint64_t Val) {
@@ -1178,6 +1179,10 @@
 Result = LegalizeOp(LowerVEXTRACT_VECTOR_ELT(Op));
 break;
 
+  case ISD::VEXTRACT_SUBVECTOR: 
+Result = LegalizeOp(LowerVEXTRACT_SUBVECTOR(Op));
+break;
+
   case ISD::CALLSEQ_START: {
 SDNode *CallEnd = FindCallEndFromCallStart(Node);
 
@@ -3561,6 +3566,9 @@
   case ISD::VEXTRACT_VECTOR_ELT:
 Result = PromoteOp(LowerVEXTRACT_VECTOR_ELT(Op));
 break;
+  case ISD::VEXTRACT_SUBVECTOR:
+Result = PromoteOp(LowerVEXTRACT_SUBVECTOR(Op));
+break;
   case ISD::EXTRACT_VECTOR_ELT:
 Result = PromoteOp(ExpandEXTRACT_VECTOR_ELT(Op));
 break;
@@ -3622,6 +3630,37 @@
   }
 }
 
+/// LowerVEXTRACT_SUBVECTOR - Lower a VEXTRACT_SUBVECTOR operation.  For now
+/// we assume the operation can be split if it is not already legal.
+SDOperand SelectionDAGLegalize::LowerVEXTRACT_SUBVECTOR(SDOperand Op) {
+  // We know that operand #0 is the Vec vector.  For now we assume the index
+  // is a constant and that the extracted result is a supported hardware type.
+  SDOperand Vec = Op.getOperand(0);
+  SDOperand Idx = LegalizeOp(Op.getOperand(1));
+  
+  SDNode *InVal = Vec.Val;
+  unsigned NumElems = cast(*(InVal->op_end()-2))->getValue();
+  
+  if (NumElems == MVT::getVectorNumElements(Op.getValueType())) {
+// This must be an access of the desired vector length.  Return it.
+return PackVectorOp(Vec, Op.getValueType());
+  }
+
+  ConstantSDNode *CIdx = cast(Idx);
+  SDOperand Lo, Hi;
+  SplitVectorOp(Vec, Lo, Hi);
+  if (CIdx->getValue() < NumElems/2) {
+Vec = Lo;
+  } else {
+Vec = Hi;
+Idx = DAG.getConstant(CIdx->getValue() - NumElems/2, Idx.getValueType());
+  }
+  
+  // It's now an extract from the appropriate high or low part.  Recurse.
+  Op = DAG.UpdateNodeOperands(Op, Vec, Idx);
+  return LowerVEXTRACT_SUBVECTOR(Op);
+}
+
 /// ExpandEXTRACT_VECTOR_ELT - Expand an EXTRACT_VECTOR_ELT operation into
 /// memory traffic.
 SDOperand SelectionDAGLegalize::ExpandEXTRACT_VECTOR_ELT(SDOperand Op) {
@@ -5501,6 +5540,21 @@
 Hi = DAG.getNode(ISD::VBUILD_VECTOR, MVT::Vector, &HiOps[0], HiOps.size());
 break;
   }
+  case ISD::VCONCAT_VECTORS: {
+unsigned NewNumSubvectors = (Node->getNumOperands() - 2) / 2;
+SmallVector LoOps(Node->op_begin(), 
+Node->op_begin()+NewNumSubvectors);
+LoOps.push_back(NewNumEltsNode);
+LoOps.push_back(TypeNode);
+Lo = DAG.getNode(ISD::VCONCAT_VECTORS, MVT::Vector, &LoOps[0], 
LoOps.size());
+
+SmallVector HiOps(Node->op_begin()+NewNumSubvectors, 
+Node->op_end()-2);
+HiOps.push_back(NewNumEltsNode);
+HiOps.push_back(TypeNode);
+Hi = DAG.getNode(ISD::VCONCAT_VECTORS, MVT::Vector, &HiOps[0], 
HiOps.size());
+break;
+  }
   case ISD::VADD:
   case ISD::VSUB:
   case ISD::VMUL:
@@ -5655,6 +5709,11 @@
   }
 }
 break;
+  case ISD::VCONCAT_VECTORS:
+assert(Node->getOperand(0).getValueType() == NewVT &&
+   "Concat of non-legal vectors not yet supported!");
+Result = Node->getOperand(0);
+break;
   case ISD::VINSERT_VECTOR_ELT:
 if (!MVT::isVector(NewVT)) {
   // Returning a scalar?  Must be the inserted element.
@@ -5665,6 +5724,10 @@
Node->getOperand(1), Node->getOperand(2));
 }
 break;
+  case ISD::VEXTRACT_SUBVECTOR:
+Result = PackVectorOp(Node->getOperand(0), NewVT);
+ 

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

2007-06-13 Thread Dan Gohman


Changes in directory llvm/include/llvm/CodeGen:

SelectionDAGNodes.h updated: 1.191 -> 1.192
---
Log message:

Introduce new SelectionDAG node opcodes VEXTRACT_SUBVECTOR and
VCONCAT_VECTORS. Use these for CopyToReg and CopyFromReg legalizing in
the case that the full register is to be split into subvectors instead
of scalars. This replaces uses of VBIT_CONVERT to present values as
vector-of-vector types in order to make whole subvectors accessible via
BUILD_VECTOR and EXTRACT_VECTOR_ELT.

This is in preparation for adding extended ValueType values, where
having vector-of-vector types is undesirable.


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

 SelectionDAGNodes.h |   13 +
 1 files changed, 13 insertions(+)


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.191 
llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.192
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.191 Thu May 24 09:36:03 2007
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h   Wed Jun 13 10:12:02 2007
@@ -267,6 +267,19 @@
 /// element number IDX.
 EXTRACT_VECTOR_ELT,
 
+/// VCONCAT_VECTORS(VECTOR0, VECTOR1, ..., COUNT,TYPE) - Given a number of
+/// values of MVT::Vector type with the same length and element type, this
+/// produces a concatenated MVT::Vector result value, with length equal to
+/// the sum of the input vectors.  This can only be used before
+/// legalization.
+VCONCAT_VECTORS,
+
+/// VEXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an
+/// MVT::Vector value) starting with the (potentially variable)
+/// element number IDX, which must be a multiple of the result vector
+/// length.  This can only be used before legalization.
+VEXTRACT_SUBVECTOR,
+
 /// VVECTOR_SHUFFLE(VEC1, VEC2, SHUFFLEVEC, COUNT,TYPE) - Returns a vector,
 /// of the same type as VEC1/VEC2.  SHUFFLEVEC is a VBUILD_VECTOR of
 /// constant int values that indicate which value each result element will



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


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

2007-06-13 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.459 -> 1.460
---
Log message:

When creating CopyFromReg nodes, always use legal types. And use the
correct types for the result vector, even though it is currently bitcasted
to a different type immediately.


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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.459 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.460
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.459Wed Jun 13 
00:51:31 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Wed Jun 13 09:55:16 2007
@@ -772,7 +772,7 @@
   // If the register was promoted, use TRUNCATE or FP_ROUND as appropriate.
   for (unsigned i = 0; i != NE; ++i) {
 SDOperand Op = DAG.getCopyFromReg(DAG.getEntryNode(), InReg++, 
-  PTyElementVT);
+  PTyLegalElementVT);
 if (MVT::isFloatingPoint(PTyElementVT))
   Op = DAG.getNode(ISD::FP_ROUND, PTyElementVT, Op);
 else
@@ -782,17 +782,17 @@
 } else {
   // If the register was expanded, use BUILD_PAIR.
   assert((NE & 1) == 0 && "Must expand into a multiple of 2 elements!");
-  for (unsigned i = 0; i != NE/2; ++i) {
+  for (unsigned i = 0; i != NE; ++i) {
 SDOperand Op0 = DAG.getCopyFromReg(DAG.getEntryNode(), InReg++, 
-   PTyElementVT);
+   PTyLegalElementVT);
 SDOperand Op1 = DAG.getCopyFromReg(DAG.getEntryNode(), InReg++, 
-   PTyElementVT);
-Ops.push_back(DAG.getNode(ISD::BUILD_PAIR, VT, Op0, Op1));
+   PTyLegalElementVT);
+Ops.push_back(DAG.getNode(ISD::BUILD_PAIR, PTyElementVT, Op0, Op1));
   }
 }
 
 Ops.push_back(DAG.getConstant(NE, MVT::i32));
-Ops.push_back(DAG.getValueType(PTyLegalElementVT));
+Ops.push_back(DAG.getValueType(PTyElementVT));
 N = DAG.getNode(ISD::VBUILD_VECTOR, MVT::Vector, &Ops[0], Ops.size());
 
 // Finally, use a VBIT_CONVERT to make this available as the appropriate



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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.106 -> 1.107
X86AsmPrinter.cpp updated: 1.242 -> 1.243
---
Log message:

Eliminate some redundant newlines in asm output.


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

 X86ATTAsmPrinter.cpp |4 ++--
 X86AsmPrinter.cpp|1 -
 2 files changed, 2 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.106 
llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.107
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.106  Mon Jun  4 13:54:57 2007
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppThu Jun 14 10:00:27 2007
@@ -59,10 +59,10 @@
 if (Subtarget->isTargetDarwin()) {
   return ".section __TEXT,__textcoal_nt,coalesced,pure_instructions";
 } else if (Subtarget->isTargetCygMing()) {
-  return "\t.section\t.text$linkonce." + CurrentFnName + ",\"ax\"\n";
+  return "\t.section\t.text$linkonce." + CurrentFnName + ",\"ax\"";
 } else {
   return "\t.section\t.llvm.linkonce.t." + CurrentFnName +
- ",\"ax\",@progbits\n";
+ ",\"ax\",@progbits";
 }
   }
 }


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.242 
llvm/lib/Target/X86/X86AsmPrinter.cpp:1.243
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.242 Sat May  5 04:04:50 2007
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp   Thu Jun 14 10:00:27 2007
@@ -307,7 +307,6 @@
 ExtWeakSymbols.insert(GV);
 
 EmitGlobalConstant(C);
-O << '\n';
   }
   
   // Output linker support code for dllexported globals



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


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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/lib/Target:

TargetAsmInfo.cpp updated: 1.27 -> 1.28
---
Log message:

Eliminate some redundant newlines in asm output.


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

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


Index: llvm/lib/Target/TargetAsmInfo.cpp
diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.27 
llvm/lib/Target/TargetAsmInfo.cpp:1.28
--- llvm/lib/Target/TargetAsmInfo.cpp:1.27  Sat May  5 04:04:50 2007
+++ llvm/lib/Target/TargetAsmInfo.cpp   Thu Jun 14 10:00:27 2007
@@ -55,8 +55,8 @@
   TextSectionStartSuffix(""),
   DataSectionStartSuffix(""),
   SectionEndDirectiveSuffix(0),
-  ConstantPoolSection("\t.section .rodata\n"),
-  JumpTableDataSection("\t.section .rodata\n"),
+  ConstantPoolSection("\t.section .rodata"),
+  JumpTableDataSection("\t.section .rodata"),
   JumpTableDirective(0),
   CStringSection(0),
   StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),



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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/include/llvm/Target:

TargetAsmInfo.h updated: 1.33 -> 1.34
---
Log message:

Eliminate some redundant newlines in asm output.


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

 TargetAsmInfo.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Target/TargetAsmInfo.h
diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.33 
llvm/include/llvm/Target/TargetAsmInfo.h:1.34
--- llvm/include/llvm/Target/TargetAsmInfo.h:1.33   Sat May  5 04:04:50 2007
+++ llvm/include/llvm/Target/TargetAsmInfo.hThu Jun 14 10:00:27 2007
@@ -178,12 +178,12 @@
 
 /// ConstantPoolSection - This is the section that we SwitchToSection right
 /// before emitting the constant pool for a function.
-const char *ConstantPoolSection;  // Defaults to "\t.section .rodata\n"
+const char *ConstantPoolSection;  // Defaults to "\t.section .rodata"
 
 /// JumpTableDataSection - This is the section that we SwitchToSection 
right
 /// before emitting the jump tables for a function when the relocation 
model
 /// is not PIC.
-const char *JumpTableDataSection; // Defaults to "\t.section .rodata\n"
+const char *JumpTableDataSection; // Defaults to "\t.section .rodata"
 
 /// JumpTableDirective - if non-null, the directive to emit before a jump
 /// table.



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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.246 -> 1.247
VirtRegMap.cpp updated: 1.111 -> 1.112
---
Log message:

Add a target hook to allow loads from constant pools to be rematerialized, and 
an
implementation for x86.


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

 LiveIntervalAnalysis.cpp |6 --
 VirtRegMap.cpp   |3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.246 
llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.247
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.246 Fri Jun  8 12:18:56 2007
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp   Thu Jun 14 15:50:44 2007
@@ -336,12 +336,14 @@
   // time we see a vreg.
   if (interval.empty()) {
 // Remember if the definition can be rematerialized. All load's from fixed
-// stack slots are re-materializable.
+// stack slots are re-materializable. The target may permit other loads to
+// be re-materialized as well.
 int FrameIdx = 0;
 if (vi.DefInst &&
 (tii_->isReMaterializable(vi.DefInst->getOpcode()) ||
  (tii_->isLoadFromStackSlot(vi.DefInst, FrameIdx) &&
-  mf_->getFrameInfo()->isFixedObjectIndex(FrameIdx
+  mf_->getFrameInfo()->isFixedObjectIndex(FrameIdx)) ||
+ tii_->isOtherReMaterializableLoad(vi.DefInst)))
   interval.remat = vi.DefInst;
 
 // Get the Idx of the defining instructions.


Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.111 
llvm/lib/CodeGen/VirtRegMap.cpp:1.112
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.111   Thu Apr 26 13:59:33 2007
+++ llvm/lib/CodeGen/VirtRegMap.cpp Thu Jun 14 15:50:44 2007
@@ -664,7 +664,8 @@
 // If this instruction is being rematerialized, just remove it!
 int FrameIdx;
 if ((TID->Flags & M_REMATERIALIZIBLE) ||
-TII->isLoadFromStackSlot(&MI, FrameIdx)) {
+TII->isLoadFromStackSlot(&MI, FrameIdx) ||
+TII->isOtherReMaterializableLoad(&MI)) {
   bool Remove = true;
   for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
 MachineOperand &MO = MI.getOperand(i);



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


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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/include/llvm/Target:

TargetInstrInfo.h updated: 1.127 -> 1.128
---
Log message:

Add a target hook to allow loads from constant pools to be rematerialized, and 
an
implementation for x86.


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

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


Index: llvm/include/llvm/Target/TargetInstrInfo.h
diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.127 
llvm/include/llvm/Target/TargetInstrInfo.h:1.128
--- llvm/include/llvm/Target/TargetInstrInfo.h:1.127Fri Jun  8 16:59:04 2007
+++ llvm/include/llvm/Target/TargetInstrInfo.h  Thu Jun 14 15:50:44 2007
@@ -298,6 +298,16 @@
 return 0;
   }
 
+  /// isOtherReMaterializableLoad - If the specified machine instruction is a
+  /// direct load that is trivially rematerializable, not counting loads from
+  /// stack slots, return true. If not, return false.  This predicate must
+  /// return false if the instruction has any side effects other than
+  /// producing the value from the load, or if it requres any address
+  /// registers that are not always available.
+  virtual bool isOtherReMaterializableLoad(MachineInstr *MI) const {
+return false;
+  }
+
   /// convertToThreeAddress - This method must be implemented by targets that
   /// set the M_CONVERTIBLE_TO_3_ADDR flag.  When this flag is set, the target
   /// may be able to convert a two-address instruction into one or moretrue



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


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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86InstrInfo.cpp updated: 1.89 -> 1.90
X86InstrInfo.h updated: 1.64 -> 1.65
---
Log message:

Add a target hook to allow loads from constant pools to be rematerialized, and 
an
implementation for x86.


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

 X86InstrInfo.cpp |   25 +
 X86InstrInfo.h   |1 +
 2 files changed, 26 insertions(+)


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.89 
llvm/lib/Target/X86/X86InstrInfo.cpp:1.90
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.89   Wed Jun 13 12:59:52 2007
+++ llvm/lib/Target/X86/X86InstrInfo.cppThu Jun 14 15:50:44 2007
@@ -112,6 +112,31 @@
 }
 
 
+bool X86InstrInfo::isOtherReMaterializableLoad(MachineInstr *MI) const {
+  switch (MI->getOpcode()) {
+  default: break;
+  case X86::MOV8rm:
+  case X86::MOV16rm:
+  case X86::MOV16_rm:
+  case X86::MOV32rm:
+  case X86::MOV32_rm:
+  case X86::MOV64rm:
+  case X86::FpLD64m:
+  case X86::MOVSSrm:
+  case X86::MOVSDrm:
+  case X86::MOVAPSrm:
+  case X86::MOVAPDrm:
+  case X86::MMX_MOVD64rm:
+  case X86::MMX_MOVQ64rm:
+return MI->getOperand(1).isRegister() && MI->getOperand(2).isImmediate() &&
+   MI->getOperand(3).isRegister() && 
MI->getOperand(4).isConstantPoolIndex() &&
+   MI->getOperand(1).getReg() == 0 &&
+   MI->getOperand(2).getImmedValue() == 1 &&
+   MI->getOperand(3).getReg() == 0;
+  }
+  return false;
+}
+
 /// convertToThreeAddress - This method must be implemented by targets that
 /// set the M_CONVERTIBLE_TO_3_ADDR flag.  When this flag is set, the target
 /// may be able to convert a two-address instruction into a true


Index: llvm/lib/Target/X86/X86InstrInfo.h
diff -u llvm/lib/Target/X86/X86InstrInfo.h:1.64 
llvm/lib/Target/X86/X86InstrInfo.h:1.65
--- llvm/lib/Target/X86/X86InstrInfo.h:1.64 Thu May 17 19:17:09 2007
+++ llvm/lib/Target/X86/X86InstrInfo.h  Thu Jun 14 15:50:44 2007
@@ -239,6 +239,7 @@
unsigned& destReg) const;
   unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
   unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
+  bool isOtherReMaterializableLoad(MachineInstr *MI) const;
   
   /// convertToThreeAddress - This method must be implemented by targets that
   /// set the M_CONVERTIBLE_TO_3_ADDR flag.  When this flag is set, the target



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


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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/lib/Target/PowerPC:

PPCISelLowering.cpp updated: 1.271 -> 1.272
---
Log message:

Rename MVT::getVectorBaseType to MVT::getVectorElementType.


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

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


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.271 
llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.272
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.271   Fri May 18 18:21:46 2007
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Jun 14 17:58:02 2007
@@ -2257,7 +2257,7 @@
   MVT::ValueType CanonicalVT = VTys[SplatSize-1];
   
   // Build a canonical splat for this value.
-  SDOperand Elt = DAG.getConstant(Val, MVT::getVectorBaseType(CanonicalVT));
+  SDOperand Elt = DAG.getConstant(Val, MVT::getVectorElementType(CanonicalVT));
   SmallVector Ops;
   Ops.assign(MVT::getVectorNumElements(CanonicalVT), Elt);
   SDOperand Res = DAG.getNode(ISD::BUILD_VECTOR, CanonicalVT,
@@ -2647,7 +2647,7 @@
   
   // The SHUFFLE_VECTOR mask is almost exactly what we want for vperm, except
   // that it is in input element units, not in bytes.  Convert now.
-  MVT::ValueType EltVT = MVT::getVectorBaseType(V1.getValueType());
+  MVT::ValueType EltVT = MVT::getVectorElementType(V1.getValueType());
   unsigned BytesPerElement = MVT::getSizeInBits(EltVT)/8;
   
   SmallVector ResultMask;



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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/include/llvm/CodeGen:

ValueTypes.h updated: 1.34 -> 1.35
---
Log message:

Rename MVT::getVectorBaseType to MVT::getVectorElementType.


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

 ValueTypes.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/CodeGen/ValueTypes.h
diff -u llvm/include/llvm/CodeGen/ValueTypes.h:1.34 
llvm/include/llvm/CodeGen/ValueTypes.h:1.35
--- llvm/include/llvm/CodeGen/ValueTypes.h:1.34 Sat Apr 28 00:38:52 2007
+++ llvm/include/llvm/CodeGen/ValueTypes.h  Thu Jun 14 17:58:02 2007
@@ -129,9 +129,9 @@
   ///
   ValueType getVectorType(ValueType VT, unsigned NumElements);
 
-  /// MVT::getVectorBaseType - Given a packed vector type, return the type of
+  /// MVT::getVectorElementType - Given a packed vector type, return the type 
of
   /// each element.
-  static inline ValueType getVectorBaseType(ValueType VT) {
+  static inline ValueType getVectorElementType(ValueType VT) {
 switch (VT) {
 default: assert(0 && "Invalid vector type!");
 case v8i8 :



___
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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.408 -> 1.409
---
Log message:

Rename MVT::getVectorBaseType to MVT::getVectorElementType.


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

 X86ISelLowering.cpp |   44 ++--
 1 files changed, 22 insertions(+), 22 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.408 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.409
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.408   Sat Jun  9 00:08:10 2007
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Jun 14 17:58:02 2007
@@ -2106,7 +2106,7 @@
   SelectionDAG &DAG) {
   MVT::ValueType VT = Op.getValueType();
   MVT::ValueType MaskVT = Mask.getValueType();
-  MVT::ValueType EltVT = MVT::getVectorBaseType(MaskVT);
+  MVT::ValueType EltVT = MVT::getVectorElementType(MaskVT);
   unsigned NumElems = Mask.getNumOperands();
   SmallVector MaskVec;
 
@@ -2265,7 +2265,7 @@
 static SDOperand getZeroVector(MVT::ValueType VT, SelectionDAG &DAG) {
   assert(MVT::isVector(VT) && "Expected a vector type");
   unsigned NumElems = MVT::getVectorNumElements(VT);
-  MVT::ValueType EVT = MVT::getVectorBaseType(VT);
+  MVT::ValueType EVT = MVT::getVectorElementType(VT);
   bool isFP = MVT::isFloatingPoint(EVT);
   SDOperand Zero = isFP ? DAG.getConstantFP(0.0, EVT) : DAG.getConstant(0, 
EVT);
   SmallVector ZeroVec(NumElems, Zero);
@@ -2302,7 +2302,7 @@
 /// operation of specified width.
 static SDOperand getMOVLMask(unsigned NumElems, SelectionDAG &DAG) {
   MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(NumElems);
-  MVT::ValueType BaseVT = MVT::getVectorBaseType(MaskVT);
+  MVT::ValueType BaseVT = MVT::getVectorElementType(MaskVT);
 
   SmallVector MaskVec;
   MaskVec.push_back(DAG.getConstant(NumElems, BaseVT));
@@ -2315,7 +2315,7 @@
 /// of specified width.
 static SDOperand getUnpacklMask(unsigned NumElems, SelectionDAG &DAG) {
   MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(NumElems);
-  MVT::ValueType BaseVT = MVT::getVectorBaseType(MaskVT);
+  MVT::ValueType BaseVT = MVT::getVectorElementType(MaskVT);
   SmallVector MaskVec;
   for (unsigned i = 0, e = NumElems/2; i != e; ++i) {
 MaskVec.push_back(DAG.getConstant(i,BaseVT));
@@ -2328,7 +2328,7 @@
 /// of specified width.
 static SDOperand getUnpackhMask(unsigned NumElems, SelectionDAG &DAG) {
   MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(NumElems);
-  MVT::ValueType BaseVT = MVT::getVectorBaseType(MaskVT);
+  MVT::ValueType BaseVT = MVT::getVectorElementType(MaskVT);
   unsigned Half = NumElems/2;
   SmallVector MaskVec;
   for (unsigned i = 0; i != Half; ++i) {
@@ -2366,7 +2366,7 @@
  bool isZero, SelectionDAG &DAG) {
   SDOperand V1 = isZero ? getZeroVector(VT, DAG) : DAG.getNode(ISD::UNDEF, VT);
   MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(NumElems);
-  MVT::ValueType EVT = MVT::getVectorBaseType(MaskVT);
+  MVT::ValueType EVT = MVT::getVectorElementType(MaskVT);
   SDOperand Zero = DAG.getConstant(0, EVT);
   SmallVector MaskVec(NumElems, Zero);
   MaskVec[Idx] = DAG.getConstant(NumElems, EVT);
@@ -2458,7 +2458,7 @@
 return Op;
 
   MVT::ValueType VT = Op.getValueType();
-  MVT::ValueType EVT = MVT::getVectorBaseType(VT);
+  MVT::ValueType EVT = MVT::getVectorElementType(VT);
   unsigned EVTBits = MVT::getSizeInBits(EVT);
 
   unsigned NumElems = Op.getNumOperands();
@@ -2502,7 +2502,7 @@
   Item = getShuffleVectorZeroOrUndef(Item, VT, NumElems, 0, NumZero > 0,
  DAG);
   MVT::ValueType MaskVT  = MVT::getIntVectorWithNumElements(NumElems);
-  MVT::ValueType MaskEVT = MVT::getVectorBaseType(MaskVT);
+  MVT::ValueType MaskEVT = MVT::getVectorElementType(MaskVT);
   SmallVector MaskVec;
   for (unsigned i = 0; i < NumElems; i++)
 MaskVec.push_back(DAG.getConstant((i == Idx) ? 0 : 1, MaskEVT));
@@ -2571,7 +2571,7 @@
 if (MVT::isInteger(EVT) && (NonZeros & (0x3 << 2)) == 0)
   return V[0];
 MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(NumElems);
-MVT::ValueType EVT = MVT::getVectorBaseType(MaskVT);
+MVT::ValueType EVT = MVT::getVectorElementType(MaskVT);
 SmallVector MaskVec;
 bool Reverse = (NonZeros & 0x3) == 2;
 for (unsigned i = 0; i < 2; ++i)
@@ -2728,7 +2728,7 @@
 // Handle v8i16 shuffle high / low shuffle node pair.
 if (VT == MVT::v8i16 && isPSHUFHW_PSHUFLWMask(PermMask.Val)) {
   MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(NumElems);
-  MVT::ValueType BaseVT = MVT::getVectorBaseType(MaskVT);
+  MVT::ValueType BaseVT = MVT::getVectorElementType(MaskVT);
   SmallVector MaskVec;
   for (unsigned i = 0; i != 4; ++i)
 MaskVec.push_back(PermMask.getOperand(i));
@@ -2763,7 +2763,7 @@
   // Don't do this for MMX.
   MVT::getSizeInBits(VT) != 64

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

2007-06-14 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.311 -> 1.312
LegalizeDAG.cpp updated: 1.496 -> 1.497
SelectionDAG.cpp updated: 1.406 -> 1.407
SelectionDAGISel.cpp updated: 1.462 -> 1.463
---
Log message:

Rename MVT::getVectorBaseType to MVT::getVectorElementType.


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

 DAGCombiner.cpp  |2 +-
 LegalizeDAG.cpp  |   10 +-
 SelectionDAG.cpp |4 ++--
 SelectionDAGISel.cpp |4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.311 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.312
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.311 Thu May 24 21:19:06 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Thu Jun 14 17:58:02 2007
@@ -1809,7 +1809,7 @@
   return DAG.getConstant(0, VT);
 } else if (!AfterLegalize || TLI.isOperationLegal(ISD::BUILD_VECTOR, VT)) {
   // Produce a vector of zeros.
-  SDOperand El = DAG.getConstant(0, MVT::getVectorBaseType(VT));
+  SDOperand El = DAG.getConstant(0, MVT::getVectorElementType(VT));
   std::vector Ops(MVT::getVectorNumElements(VT), El);
   return DAG.getNode(ISD::BUILD_VECTOR, VT, &Ops[0], Ops.size());
 }


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.496 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.497
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.496 Wed Jun 13 10:12:02 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Thu Jun 14 17:58:02 2007
@@ -1014,7 +1014,7 @@
 
 unsigned NumElts = MVT::getVectorNumElements(Tmp1.getValueType());
 MVT::ValueType ShufMaskVT = MVT::getIntVectorWithNumElements(NumElts);
-MVT::ValueType ShufMaskEltVT = MVT::getVectorBaseType(ShufMaskVT);
+MVT::ValueType ShufMaskEltVT = MVT::getVectorElementType(ShufMaskVT);
 
 // We generate a shuffle of InVec and ScVec, so the shuffle mask should
 // be 0,1,2,3,4,5... with the appropriate element replaced with elt 0 
of
@@ -1110,7 +1110,7 @@
   // FALLTHROUGH
 case TargetLowering::Expand: {
   MVT::ValueType VT = Node->getValueType(0);
-  MVT::ValueType EltVT = MVT::getVectorBaseType(VT);
+  MVT::ValueType EltVT = MVT::getVectorElementType(VT);
   MVT::ValueType PtrVT = TLI.getPointerTy();
   SDOperand Mask = Node->getOperand(2);
   unsigned NumElems = Mask.getNumOperands();
@@ -2386,7 +2386,7 @@
  "Cannot expand this binary operator!");
   // Expand the operation into a bunch of nasty scalar code.
   SmallVector Ops;
-  MVT::ValueType EltVT = MVT::getVectorBaseType(Node->getValueType(0));
+  MVT::ValueType EltVT = MVT::getVectorElementType(Node->getValueType(0));
   MVT::ValueType PtrVT = TLI.getPointerTy();
   for (unsigned i = 0, e = 
MVT::getVectorNumElements(Node->getValueType(0));
i != e; ++i) {
@@ -4006,7 +4006,7 @@
 // Build the shuffle constant vector: <0, 0, 0, 0>
 MVT::ValueType MaskVT = 
   MVT::getIntVectorWithNumElements(NumElems);
-SDOperand Zero = DAG.getConstant(0, MVT::getVectorBaseType(MaskVT));
+SDOperand Zero = DAG.getConstant(0, MVT::getVectorElementType(MaskVT));
 std::vector ZeroVec(NumElems, Zero);
 SDOperand SplatMask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT,
   &ZeroVec[0], ZeroVec.size());
@@ -4036,7 +4036,7 @@
E = Values.end(); I != E; ++I) {
   for (std::vector::iterator II = I->second.begin(),
  EE = I->second.end(); II != EE; ++II)
-MaskVec[*II] = DAG.getConstant(i, MVT::getVectorBaseType(MaskVT));
+MaskVec[*II] = DAG.getConstant(i, MVT::getVectorElementType(MaskVT));
   i += NumElems;
 }
 SDOperand ShuffleMask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT,


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.406 
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.407
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.406Wed Jun 13 
10:12:02 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp  Thu Jun 14 17:58:02 2007
@@ -1114,7 +1114,7 @@
 break;
   case ISD::SCALAR_TO_VECTOR:
 assert(MVT::isVector(VT) && !MVT::isVector(Operand.getValueType()) &&
-   MVT::getVectorBaseType(VT) == Operand.getValueType() &&
+   MVT::getVectorElementType(VT) == Operand.getValueType() &&
"Illegal SCALAR_TO_VECTOR node!");
 break;
   case ISD::FNEG:
@@ -1593,7 +1593,7 @@
 ExtType = ISD::NON_EXTLOAD;
 
   if (MVT::isVector(VT))
-assert(EVT == MVT::getVectorBaseType(VT) && "Invalid vector extload!");
+assert(EVT == MVT::getVectorElementType(VT) && "Invalid vector extload!");
   else
 assert(EVT < VT && "Should only be an extending load, not truncating!");
   assert((ExtT

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

2007-06-15 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

IndVarSimplify.cpp updated: 1.120 -> 1.121
LoopStrengthReduce.cpp updated: 1.140 -> 1.141
---
Log message:

Add a SCEV class and supporting code for sign-extend expressions.

This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.


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

 IndVarSimplify.cpp |   13 +++--
 LoopStrengthReduce.cpp |   28 
 2 files changed, 23 insertions(+), 18 deletions(-)


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.120 
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.121
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.120 Tue Jun  5 22:51:56 2007
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp   Fri Jun 15 09:38:12 2007
@@ -277,8 +277,7 @@
 
   // Expand the code for the iteration count into the preheader of the loop.
   BasicBlock *Preheader = L->getLoopPreheader();
-  Value *ExitCnt = RW.expandCodeFor(TripCount, Preheader->getTerminator(),
-IndVar->getType());
+  Value *ExitCnt = RW.expandCodeFor(TripCount, Preheader->getTerminator());
 
   // Insert a new icmp_ne or icmp_eq instruction before the branch.
   ICmpInst::Predicate Opcode;
@@ -383,7 +382,7 @@
 // just reuse it.
 Value *&ExitVal = ExitValues[Inst];
 if (!ExitVal)
-  ExitVal = Rewriter.expandCodeFor(ExitValue, 
InsertPt,Inst->getType());
+  ExitVal = Rewriter.expandCodeFor(ExitValue, InsertPt);
 
 DOUT << "INDVARS: RLEV: AfterLoopVal = " << *ExitVal
  << "  LoopVal = " << *Inst << "\n";
@@ -519,9 +518,12 @@
   Changed = true;
   DOUT << "INDVARS: New CanIV: " << *IndVar;
 
-  if (!isa(IterationCount))
+  if (!isa(IterationCount)) {
+if (IterationCount->getType() != LargestType)
+  IterationCount = SCEVZeroExtendExpr::get(IterationCount, LargestType);
 if (Instruction *DI = LinearFunctionTestReplace(L, 
IterationCount,Rewriter))
   DeadInsts.insert(DI);
+  }
 
   // Now that we have a canonical induction variable, we can rewrite any
   // recurrences in terms of the induction variable.  Start with the auxillary
@@ -555,8 +557,7 @@
   std::map InsertedSizes;
   while (!IndVars.empty()) {
 PHINode *PN = IndVars.back().first;
-Value *NewVal = Rewriter.expandCodeFor(IndVars.back().second, InsertPt,
-   PN->getType());
+Value *NewVal = Rewriter.expandCodeFor(IndVars.back().second, InsertPt);
 DOUT << "INDVARS: Rewrote IV '" << *IndVars.back().second << "' " << *PN
  << "   into = " << *NewVal << "\n";
 NewVal->takeName(PN);


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.140 
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.141
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.140 Thu Jun  7 
16:42:15 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp   Fri Jun 15 09:38:12 2007
@@ -555,8 +555,7 @@
   // If there is no immediate value, skip the next part.
   if (SCEVConstant *SC = dyn_cast(Imm))
 if (SC->getValue()->isZero())
-  return Rewriter.expandCodeFor(NewBase, BaseInsertPt,
-OperandValToReplace->getType());
+  return Rewriter.expandCodeFor(NewBase, BaseInsertPt);
 
   Value *Base = Rewriter.expandCodeFor(NewBase, BaseInsertPt);
 
@@ -567,8 +566,7 @@
   
   // Always emit the immediate (if non-zero) into the same block as the user.
   SCEVHandle NewValSCEV = SCEVAddExpr::get(SCEVUnknown::get(Base), Imm);
-  return Rewriter.expandCodeFor(NewValSCEV, IP,
-OperandValToReplace->getType());
+  return Rewriter.expandCodeFor(NewValSCEV, IP);
   
 }
 
@@ -598,6 +596,11 @@
   }
 }
 Value *NewVal = InsertCodeForBaseAtPosition(NewBase, Rewriter, InsertPt, 
L);
+// Adjust the type back to match the Inst.
+if (isa(OperandValToReplace->getType())) {
+  NewVal = new IntToPtrInst(NewVal, OperandValToReplace->getType(), "cast",
+InsertPt);
+}
 // Replace the use of the operand Value with the new Phi we just created.
 Inst->replaceUsesOfWith(OperandValToReplace, NewVal);
 DOUT << "CHANGED: IMM =" << *Imm;
@@ -644,6 +647,11 @@
 // Insert the code into the end of the predecessor block.
 Instruction *InsertPt = PN->getIncomingBlock(i)->getTerminator();
 Code = InsertCodeForBaseAtPosition(NewBase, Rewriter, InsertPt, L);
+
+// Adjust the type back to match the PHI.
+if (isa(PN->getType())) {
+  Code = new IntToPtrInst(

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

2007-06-15 Thread Dan Gohman


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.118 -> 1.119
ScalarEvolutionExpander.cpp updated: 1.17 -> 1.18
---
Log message:

Add a SCEV class and supporting code for sign-extend expressions.

This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.


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

 ScalarEvolution.cpp |   47 
 ScalarEvolutionExpander.cpp |   13 +---
 2 files changed, 53 insertions(+), 7 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.118 
llvm/lib/Analysis/ScalarEvolution.cpp:1.119
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.118 Wed Jun  6 06:26:20 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Fri Jun 15 09:38:12 2007
@@ -245,6 +245,32 @@
   OS << "(zeroextend " << *Op << " to " << *Ty << ")";
 }
 
+// SCEVSignExtends - Only allow the creation of one SCEVSignExtendExpr for any
+// particular input.  Don't use a SCEVHandle here, or else the object will 
never
+// be deleted!
+static ManagedStatic,
+ SCEVSignExtendExpr*> > SCEVSignExtends;
+
+SCEVSignExtendExpr::SCEVSignExtendExpr(const SCEVHandle &op, const Type *ty)
+  : SCEV(scSignExtend), Op(op), Ty(ty) {
+  assert(Op->getType()->isInteger() && Ty->isInteger() &&
+ "Cannot sign extend non-integer value!");
+  assert(Op->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()
+ && "This is not an extending conversion!");
+}
+
+SCEVSignExtendExpr::~SCEVSignExtendExpr() {
+  SCEVSignExtends->erase(std::make_pair(Op, Ty));
+}
+
+ConstantRange SCEVSignExtendExpr::getValueRange() const {
+  return getOperand()->getValueRange().signExtend(getBitWidth());
+}
+
+void SCEVSignExtendExpr::print(std::ostream &OS) const {
+  OS << "(signextend " << *Op << " to " << *Ty << ")";
+}
+
 // SCEVCommExprs - Only allow the creation of one SCEVCommutativeExpr for any
 // particular input.  Don't use a SCEVHandle here, or else the object will 
never
 // be deleted!
@@ -588,6 +614,21 @@
   return Result;
 }
 
+SCEVHandle SCEVSignExtendExpr::get(const SCEVHandle &Op, const Type *Ty) {
+  if (SCEVConstant *SC = dyn_cast(Op))
+return SCEVUnknown::get(
+ConstantExpr::getSExt(SC->getValue(), Ty));
+
+  // FIXME: If the input value is a chrec scev, and we can prove that the value
+  // did not overflow the old, smaller, value, we can sign extend all of the
+  // operands (often constants).  This would allow analysis of something like
+  // this:  for (signed char X = 0; X < 100; ++X) { int Y = X; }
+
+  SCEVSignExtendExpr *&Result = (*SCEVSignExtends)[std::make_pair(Op, Ty)];
+  if (Result == 0) Result = new SCEVSignExtendExpr(Op, Ty);
+  return Result;
+}
+
 // get - Get a canonical add expression, or something simpler if possible.
 SCEVHandle SCEVAddExpr::get(std::vector &Ops) {
   assert(!Ops.empty() && "Cannot get empty add!");
@@ -1370,6 +1411,9 @@
   if (SCEVZeroExtendExpr *E = dyn_cast(S))
 return GetConstantFactor(E->getOperand()).zext(
cast(E->getType())->getBitWidth());
+  if (SCEVSignExtendExpr *E = dyn_cast(S))
+return GetConstantFactor(E->getOperand()).sext(
+   cast(E->getType())->getBitWidth());
   
   if (SCEVAddExpr *A = dyn_cast(S)) {
 // The result is the min of all operands.
@@ -1470,6 +1514,9 @@
 case Instruction::ZExt:
   return SCEVZeroExtendExpr::get(getSCEV(I->getOperand(0)), I->getType());
 
+case Instruction::SExt:
+  return SCEVSignExtendExpr::get(getSCEV(I->getOperand(0)), I->getType());
+
 case Instruction::BitCast:
   // BitCasts are no-op casts so we just eliminate the cast.
   if (I->getType()->isInteger() &&


Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.17 
llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.18
--- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.17  Tue Apr 17 18:43:50 2007
+++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp   Fri Jun 15 09:38:12 2007
@@ -93,18 +93,17 @@
 }
 
 Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) {
-  const Type *Ty = S->getType();
   int FirstOp = 0;  // Set if we should emit a subtract.
   if (SCEVConstant *SC = dyn_cast(S->getOperand(0)))
 if (SC->getValue()->isAllOnesValue())
   FirstOp = 1;
 
   int i = S->getNumOperands()-2;
-  Value *V = expandInTy(S->getOperand(i+1), Ty);
+  Value *V = expand(S->getOperand(i+1));
 
   // Emit a bunch of multiply instructions
   for (; i >= FirstOp; --i)
-V = InsertBinop(Instruction::Mul, V, expandInTy(S->getOperand(i), Ty),
+V = InsertBinop(Instruction::Mul, V, expand(S->getO

[llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h ScalarEvolutionExpressions.h

2007-06-15 Thread Dan Gohman


Changes in directory llvm/include/llvm/Analysis:

ScalarEvolutionExpander.h updated: 1.16 -> 1.17
ScalarEvolutionExpressions.h updated: 1.11 -> 1.12
---
Log message:

Add a SCEV class and supporting code for sign-extend expressions.

This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.


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

 ScalarEvolutionExpander.h|   43 +-
 ScalarEvolutionExpressions.h |   53 +--
 2 files changed, 63 insertions(+), 33 deletions(-)


Index: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.16 
llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.17
--- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.16   Tue Jun  5 
20:22:09 2007
+++ llvm/include/llvm/Analysis/ScalarEvolutionExpander.hFri Jun 15 
09:38:12 2007
@@ -78,13 +78,10 @@
 /// expandCodeFor - Insert code to directly compute the specified SCEV
 /// expression into the program.  The inserted code is inserted into the
 /// specified block.
-///
-/// If a particular value sign is required, a type may be specified for the
-/// result.
-Value *expandCodeFor(SCEVHandle SH, Instruction *IP, const Type *Ty = 0) {
+Value *expandCodeFor(SCEVHandle SH, Instruction *IP) {
   // Expand the code for this SCEV.
   this->InsertPt = IP;
-  return expandInTy(SH, Ty);
+  return expand(SH);
 }
 
 /// InsertCastOfTo - Insert a cast of V to the specified type, doing what
@@ -107,25 +104,6 @@
   return V;
 }
 
-Value *expandInTy(SCEV *S, const Type *Ty) {
-  Value *V = expand(S);
-  if (Ty && V->getType() != Ty) {
-if (isa(Ty) && V->getType()->isInteger())
-  return InsertCastOfTo(Instruction::IntToPtr, V, Ty);
-else if (Ty->isInteger() && isa(V->getType()))
-  return InsertCastOfTo(Instruction::PtrToInt, V, Ty);
-else if (Ty->getPrimitiveSizeInBits() == 
- V->getType()->getPrimitiveSizeInBits())
-  return InsertCastOfTo(Instruction::BitCast, V, Ty);
-else if (Ty->getPrimitiveSizeInBits() > 
- V->getType()->getPrimitiveSizeInBits())
-  return InsertCastOfTo(Instruction::ZExt, V, Ty);
-else
-  return InsertCastOfTo(Instruction::Trunc, V, Ty);
-  }
-  return V;
-}
-
 Value *visitConstant(SCEVConstant *S) {
   return S->getValue();
 }
@@ -136,17 +114,21 @@
 }
 
 Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
-  Value *V = expandInTy(S->getOperand(), S->getType());
+  Value *V = expand(S->getOperand());
   return CastInst::createZExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
 }
 
+Value *visitSignExtendExpr(SCEVSignExtendExpr *S) {
+  Value *V = expand(S->getOperand());
+  return CastInst::createSExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
+}
+
 Value *visitAddExpr(SCEVAddExpr *S) {
-  const Type *Ty = S->getType();
-  Value *V = expandInTy(S->getOperand(S->getNumOperands()-1), Ty);
+  Value *V = expand(S->getOperand(S->getNumOperands()-1));
 
   // Emit a bunch of add instructions
   for (int i = S->getNumOperands()-2; i >= 0; --i)
-V = InsertBinop(Instruction::Add, V, expandInTy(S->getOperand(i), Ty),
+V = InsertBinop(Instruction::Add, V, expand(S->getOperand(i)),
 InsertPt);
   return V;
 }
@@ -154,9 +136,8 @@
 Value *visitMulExpr(SCEVMulExpr *S);
 
 Value *visitSDivExpr(SCEVSDivExpr *S) {
-  const Type *Ty = S->getType();
-  Value *LHS = expandInTy(S->getLHS(), Ty);
-  Value *RHS = expandInTy(S->getRHS(), Ty);
+  Value *LHS = expand(S->getLHS());
+  Value *RHS = expand(S->getRHS());
   return InsertBinop(Instruction::SDiv, LHS, RHS, InsertPt);
 }
 


Index: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.11 
llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.12
--- llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.11Thu Mar 
 1 16:28:51 2007
+++ llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h Fri Jun 15 
09:38:12 2007
@@ -24,8 +24,8 @@
   enum SCEVTypes {
 // These should be ordered in terms of increasing complexity to make the
 // folders simpler.
-scConstant, scTruncate, scZeroExtend, scAddExpr, scMulExpr, scSDivExpr,
-scAddRecExpr, scUnknown, scCouldNotCompute
+scConstant, scTruncate, scZeroExtend, scSignExtend, scAddExpr, scMulExpr,
+scSDivExpr, scAddRecExpr, scUnknown, scCouldNotCompute
   };
 
 

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

2007-06-15 Thread Dan Gohman


Changes in directory llvm/lib/Transforms/Scalar:

IndVarSimplify.cpp updated: 1.121 -> 1.122
---
Log message:

Use SCEVConstant::get instead of SCEVUnknown::get to create an
integer constant SCEV.


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

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


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.121 
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.122
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.121 Fri Jun 15 09:38:12 2007
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp   Fri Jun 15 13:00:55 2007
@@ -264,8 +264,8 @@
 // The IterationCount expression contains the number of times that the
 // backedge actually branches to the loop header.  This is one less than 
the
 // number of times the loop executes, so add one to it.
-Constant *OneC = ConstantInt::get(IterationCount->getType(), 1);
-TripCount = SCEVAddExpr::get(IterationCount, SCEVUnknown::get(OneC));
+ConstantInt *OneC = ConstantInt::get(IterationCount->getType(), 1);
+TripCount = SCEVAddExpr::get(IterationCount, SCEVConstant::get(OneC));
 IndVar = L->getCanonicalInductionVariableIncrement();
   } else {
 // We have to use the preincremented value...



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


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

2007-06-15 Thread Dan Gohman


Changes in directory llvm/lib/Analysis:

ScalarEvolutionExpander.cpp updated: 1.18 -> 1.19
---
Log message:

Fold a binary operator with constant operands when expanding code for a SCEV.


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

 ScalarEvolutionExpander.cpp |5 +
 1 files changed, 5 insertions(+)


Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.18 
llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.19
--- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.18  Fri Jun 15 09:38:12 2007
+++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp   Fri Jun 15 14:21:55 2007
@@ -72,6 +72,11 @@
 /// of work to avoid inserting an obviously redundant operation.
 Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
  Value *RHS, Instruction *&InsertPt) {
+  // Fold a binop with constant operands.
+  if (Constant *CLHS = dyn_cast(LHS))
+if (Constant *CRHS = dyn_cast(RHS))
+  return ConstantExpr::get(Opcode, CLHS, CRHS);
+
   // Do a quick scan to see if we have this binop nearby.  If so, reuse it.
   unsigned ScanLimit = 6;
   for (BasicBlock::iterator IP = InsertPt, E = InsertPt->getParent()->begin();



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

2007-06-18 Thread Dan Gohman


Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.222 -> 1.223
---
Log message:

Add keyword explicit.


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

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


Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.222 
llvm/include/llvm/CodeGen/MachineInstr.h:1.223
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.222  Fri Jun 15 14:05:13 2007
+++ llvm/include/llvm/CodeGen/MachineInstr.hMon Jun 18 09:11:31 2007
@@ -344,7 +344,7 @@
   /// MachineInstr ctor - This constructor create a MachineInstr and add the
   /// implicit operands. It reserves space for number of operands specified by
   /// TargetInstrDescriptor.
-  MachineInstr(const TargetInstrDescriptor &TID);
+  explicit MachineInstr(const TargetInstrDescriptor &TID);
 
   /// MachineInstr ctor - Work exactly the same as the ctor above, except that
   /// the MachineInstr is created and added to the end of the specified basic



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

2007-06-18 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86InstrX86-64.td updated: 1.16 -> 1.17
---
Log message:

Define the pushq instruction for x86-64.


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

 X86InstrX86-64.td |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/Target/X86/X86InstrX86-64.td
diff -u llvm/lib/Target/X86/X86InstrX86-64.td:1.16 
llvm/lib/Target/X86/X86InstrX86-64.td:1.17
--- llvm/lib/Target/X86/X86InstrX86-64.td:1.16  Thu May 17 01:35:11 2007
+++ llvm/lib/Target/X86/X86InstrX86-64.td   Mon Jun 18 09:12:56 2007
@@ -141,6 +141,8 @@
  (ops), "leave", []>, Imp<[RBP,RSP],[RBP,RSP]>;
 def POP64r   : I<0x58, AddRegFrm,
  (ops GR64:$reg), "pop{q} $reg", []>, Imp<[RSP],[RSP]>;
+def PUSH64r  : I<0x50, AddRegFrm,
+ (ops GR64:$reg), "push{q} $reg", []>, Imp<[RSP],[RSP]>;
 
 def LEA64_32r : I<0x8D, MRMSrcMem,
   (ops GR32:$dst, lea64_32mem:$src),



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


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

2007-06-18 Thread Dan Gohman
> Is this necessary? ARM is already doing this by marking trivially re-
> materializable instructions with let isReMaterializable = 1.

It's not necessary, but it seems cleaner :-).

In the ARM target, other than instructions that are always trivially
rematerialiable, there's only LDR, with a ReMaterializable clone named LDRcp.
x86 has a variety of load instructions, so in order to work the way ARM does
x86 would need a varity of clones, and then the clones wouldn't be able to
use the automatic instruction selection, so there would still need to be some
new custom logic for picking which clone to use for each constant.

Dan

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


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

2007-06-18 Thread Dan Gohman
> Nifty.  Have you done any performance analysis of this?  What cases
> is it beneficial for?  If this helps LSR, for example, can you please
> add a testcase to verify this doesn't break in the future?

It doesn't actually help LSR much. At this point, a signextend isn't
much less opaque than an unknown, though hasComputableLoopEvolution 
works.

Dan

-- 
Dan Gohman, Cray Inc.
___
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/SelectionDAGPrinter.cpp

2007-06-18 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGPrinter.cpp updated: 1.46 -> 1.47
---
Log message:

Make chain dependencies blue, in addition to being dashed.


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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.46 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.47
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.46  Fri May 18 
12:52:13 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp   Mon Jun 18 
10:30:16 2007
@@ -51,7 +51,7 @@
   if (VT == MVT::Flag)
 return "color=red,style=bold";
   else if (VT == MVT::Other)
-return "style=dashed";
+return "color=blue,style=dashed";
   return "";
 }
 



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


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

2007-06-18 Thread Dan Gohman


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.119 -> 1.120
---
Log message:

In SCEVAddExpr::get, skip over any cast operands before looking for nested
add operands after constant operands. The recent change to recognize
sign-extend expressions caused this to be exposed more often.


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

 ScalarEvolution.cpp |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.119 
llvm/lib/Analysis/ScalarEvolution.cpp:1.120
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.119 Fri Jun 15 09:38:12 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Mon Jun 18 14:30:09 2007
@@ -685,8 +685,11 @@
   return SCEVAddExpr::get(Ops);
 }
 
-  // Okay, now we know the first non-constant operand.  If there are add
-  // operands they would be next.
+  // Now we know the first non-constant operand.  Skip past any cast SCEVs.
+  while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddExpr)
+++Idx;
+
+  // If there are add operands they would be next.
   if (Idx < Ops.size()) {
 bool DeletedAdd = false;
 while (SCEVAddExpr *Add = dyn_cast(Ops[Idx])) {



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


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

2007-06-18 Thread Dan Gohman
> > +  // Now we know the first non-constant operand.  Skip past any  
> > cast SCEVs.
> > +  while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddExpr)
> > +++Idx;
> 
> Can you please introduce a predicate for this?  Comparing against  
> scAddExpr is not obvious :)

I think if you read the whole body of SCEVAddExpr::get instead of just what's
in this diff, it'll be more more obvious. The operands of theSCEVAddExpr are
sorted by their getSCEVType() value, and the code is walking through them
expecting to deal with each kind in that order.

Dan

-- 
Dan Gohman, Cray Inc.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-06-18 Thread Dan Gohman
> We can eliminate LDRcp, that's fine.
> 
> However, I still don't like the separate hook and targetinstrinfo  
> bit. Dan, can you have just a single isTriviallyReMaterializable hook  
> that encompass all these?

What do you think about the attached patch? It's not tested yet, but it
shows what I think you're asking for. I left LDRcp in, but that can be fixed.

Dan

-- 
Dan Gohman, Cray Inc.
Index: include/llvm/Target/TargetInstrInfo.h
===
RCS file: /var/cvs/llvm/llvm/include/llvm/Target/TargetInstrInfo.h,v
retrieving revision 1.130
diff -u -r1.130 TargetInstrInfo.h
--- include/llvm/Target/TargetInstrInfo.h   15 Jun 2007 21:13:54 -  
1.130
+++ include/llvm/Target/TargetInstrInfo.h   18 Jun 2007 21:17:17 -
@@ -78,10 +78,6 @@
 // controls execution. It may be set to 'always'.
 const unsigned M_PREDICABLE = 1 << 12;
 
-// M_REMATERIALIZIBLE - Set if this instruction can be trivally re-materialized
-// at any time, e.g. constant generation, load from constant pool.
-const unsigned M_REMATERIALIZIBLE = 1 << 13;
-
 // M_CLOBBERS_PRED - Set if this instruction may clobbers the condition code
 // register and / or registers that are used to predicate instructions.
 const unsigned M_CLOBBERS_PRED = 1 << 14;
@@ -217,9 +213,6 @@
   bool clobbersPredicate(MachineOpCode Opcode) const {
 return get(Opcode).Flags & M_CLOBBERS_PRED;
   }
-  bool isReMaterializable(MachineOpCode Opcode) const {
-return get(Opcode).Flags & M_REMATERIALIZIBLE;
-  }
   bool isCommutableInstr(MachineOpCode Opcode) const {
 return get(Opcode).Flags & M_COMMUTABLE;
   }
@@ -298,13 +291,13 @@
 return 0;
   }
 
-  /// isOtherReMaterializableLoad - If the specified machine instruction is a
-  /// direct load that is trivially rematerializable, not counting loads from
-  /// stack slots, return true. If not, return false.  This predicate must
+  /// isTriviallyReMaterializable - If the specified machine instruction can
+  /// be trivally re-materialized  at any time, e.g. constant generation or
+  /// loads from constant pools. If not, return false.  This predicate must
   /// return false if the instruction has any side effects other than
   /// producing the value from the load, or if it requres any address
   /// registers that are not always available.
-  virtual bool isOtherReMaterializableLoad(MachineInstr *MI) const {
+  virtual bool isTriviallyReMaterializable(MachineInstr *MI) const {
 return false;
   }
 
Index: lib/CodeGen/LiveIntervalAnalysis.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp,v
retrieving revision 1.247
diff -u -r1.247 LiveIntervalAnalysis.cpp
--- lib/CodeGen/LiveIntervalAnalysis.cpp14 Jun 2007 20:50:44 -  
1.247
+++ lib/CodeGen/LiveIntervalAnalysis.cpp18 Jun 2007 21:17:17 -
@@ -336,14 +336,13 @@
   // time we see a vreg.
   if (interval.empty()) {
 // Remember if the definition can be rematerialized. All load's from fixed
-// stack slots are re-materializable. The target may permit other loads to
-// be re-materialized as well.
+// stack slots are re-materializable. The target may permit other
+// instructions to be re-materialized as well.
 int FrameIdx = 0;
 if (vi.DefInst &&
-(tii_->isReMaterializable(vi.DefInst->getOpcode()) ||
+(tii_->isTriviallyReMaterializable(vi.DefInst) ||
  (tii_->isLoadFromStackSlot(vi.DefInst, FrameIdx) &&
-  mf_->getFrameInfo()->isFixedObjectIndex(FrameIdx)) ||
- tii_->isOtherReMaterializableLoad(vi.DefInst)))
+  mf_->getFrameInfo()->isFixedObjectIndex(FrameIdx
   interval.remat = vi.DefInst;
 
 // Get the Idx of the defining instructions.
Index: lib/CodeGen/VirtRegMap.cpp
===
RCS file: /var/cvs/llvm/llvm/lib/CodeGen/VirtRegMap.cpp,v
retrieving revision 1.112
diff -u -r1.112 VirtRegMap.cpp
--- lib/CodeGen/VirtRegMap.cpp  14 Jun 2007 20:50:44 -  1.112
+++ lib/CodeGen/VirtRegMap.cpp  18 Jun 2007 21:17:17 -
@@ -663,9 +663,8 @@
 
 // If this instruction is being rematerialized, just remove it!
 int FrameIdx;
-if ((TID->Flags & M_REMATERIALIZIBLE) ||
-TII->isLoadFromStackSlot(&MI, FrameIdx) ||
-TII->isOtherReMaterializableLoad(&MI)) {
+if (TII->isTriviallyReMaterializable(&MI) ||
+TII->isLoadFromStackSlot(&MI, FrameIdx)) {
   bool Remove = true;
   for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
 MachineOperand &MO = MI.getOperand(i);
Index: lib/Target/Target.td
===
RCS file: /var/cvs/llvm/llvm/lib/Target/Target.td,v
retrievin

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

2007-06-18 Thread Dan Gohman


Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.247 -> 1.248
VirtRegMap.cpp updated: 1.112 -> 1.113
---
Log message:

Replace M_REMATERIALIZIBLE and the newly-added isOtherReMaterializableLoad
with a general target hook to identify rematerializable instructions. Some
instructions are only rematerializable with specific operands, such as loads
from constant pools, while others are always rematerializable. This hook
allows both to be identified as being rematerializable with the same
mechanism.


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

 LiveIntervalAnalysis.cpp |9 -
 VirtRegMap.cpp   |5 ++---
 2 files changed, 6 insertions(+), 8 deletions(-)


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.247 
llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.248
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.247 Thu Jun 14 15:50:44 2007
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp   Mon Jun 18 20:48:04 2007
@@ -336,14 +336,13 @@
   // time we see a vreg.
   if (interval.empty()) {
 // Remember if the definition can be rematerialized. All load's from fixed
-// stack slots are re-materializable. The target may permit other loads to
-// be re-materialized as well.
+// stack slots are re-materializable. The target may permit other
+// instructions to be re-materialized as well.
 int FrameIdx = 0;
 if (vi.DefInst &&
-(tii_->isReMaterializable(vi.DefInst->getOpcode()) ||
+(tii_->isTriviallyReMaterializable(vi.DefInst) ||
  (tii_->isLoadFromStackSlot(vi.DefInst, FrameIdx) &&
-  mf_->getFrameInfo()->isFixedObjectIndex(FrameIdx)) ||
- tii_->isOtherReMaterializableLoad(vi.DefInst)))
+  mf_->getFrameInfo()->isFixedObjectIndex(FrameIdx
   interval.remat = vi.DefInst;
 
 // Get the Idx of the defining instructions.


Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.112 
llvm/lib/CodeGen/VirtRegMap.cpp:1.113
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.112   Thu Jun 14 15:50:44 2007
+++ llvm/lib/CodeGen/VirtRegMap.cpp Mon Jun 18 20:48:04 2007
@@ -663,9 +663,8 @@
 
 // If this instruction is being rematerialized, just remove it!
 int FrameIdx;
-if ((TID->Flags & M_REMATERIALIZIBLE) ||
-TII->isLoadFromStackSlot(&MI, FrameIdx) ||
-TII->isOtherReMaterializableLoad(&MI)) {
+if (TII->isTriviallyReMaterializable(&MI) ||
+TII->isLoadFromStackSlot(&MI, FrameIdx)) {
   bool Remove = true;
   for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
 MachineOperand &MO = MI.getOperand(i);



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


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

2007-06-18 Thread Dan Gohman


Changes in directory llvm/lib/Target/ARM:

ARMInstrInfo.cpp updated: 1.38 -> 1.39
ARMInstrInfo.h updated: 1.15 -> 1.16
ARMInstrInfo.td updated: 1.111 -> 1.112
ARMInstrThumb.td updated: 1.31 -> 1.32
---
Log message:

Replace M_REMATERIALIZIBLE and the newly-added isOtherReMaterializableLoad
with a general target hook to identify rematerializable instructions. Some
instructions are only rematerializable with specific operands, such as loads
from constant pools, while others are always rematerializable. This hook
allows both to be identified as being rematerializable with the same
mechanism.


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

 ARMInstrInfo.cpp |   14 ++
 ARMInstrInfo.h   |1 +
 ARMInstrInfo.td  |4 
 ARMInstrThumb.td |1 -
 4 files changed, 15 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/ARM/ARMInstrInfo.cpp
diff -u llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.38 
llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.39
--- llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.38   Mon Jun 18 20:25:30 2007
+++ llvm/lib/Target/ARM/ARMInstrInfo.cppMon Jun 18 20:48:04 2007
@@ -130,6 +130,20 @@
   return 0;
 }
 
+bool ARMInstrInfo::isTriviallyReMaterializable(MachineInstr *MI) const {
+  switch (MI->getOpcode()) {
+  default: break;
+  case ARM::LDRcp:
+  case ARM::MOVi:
+  case ARM::MVNi:
+  case ARM::MOVi2pieces:
+  case ARM::tLDRcp:
+// These instructions are always trivially rematerializable.
+return true;
+  }
+  return false;
+}
+
 static unsigned getUnindexedOpcode(unsigned Opc) {
   switch (Opc) {
   default: break;


Index: llvm/lib/Target/ARM/ARMInstrInfo.h
diff -u llvm/lib/Target/ARM/ARMInstrInfo.h:1.15 
llvm/lib/Target/ARM/ARMInstrInfo.h:1.16
--- llvm/lib/Target/ARM/ARMInstrInfo.h:1.15 Mon Jun 18 20:25:30 2007
+++ llvm/lib/Target/ARM/ARMInstrInfo.h  Mon Jun 18 20:48:04 2007
@@ -87,6 +87,7 @@
unsigned &SrcReg, unsigned &DstReg) const;
   virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) 
const;
   virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
+  virtual bool isTriviallyReMaterializable(MachineInstr *MI) const;
   
   virtual MachineInstr *convertToThreeAddress(MachineFunction::iterator &MFI,
   MachineBasicBlock::iterator 
&MBBI,


Index: llvm/lib/Target/ARM/ARMInstrInfo.td
diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.111 
llvm/lib/Target/ARM/ARMInstrInfo.td:1.112
--- llvm/lib/Target/ARM/ARMInstrInfo.td:1.111   Mon Jun 18 20:25:30 2007
+++ llvm/lib/Target/ARM/ARMInstrInfo.td Mon Jun 18 20:48:04 2007
@@ -670,7 +670,6 @@
[(set GPR:$dst, (load addrmode2:$addr))]>;
 
 // Special LDR for loads from non-pc-relative constpools.
-let isReMaterializable = 1 in
 def LDRcp : AI2<(ops GPR:$dst, addrmode2:$addr),
  "ldr", " $dst, $addr", []>;
 
@@ -804,7 +803,6 @@
 def MOVs : AI1<(ops GPR:$dst, so_reg:$src),
 "mov", " $dst, $src", [(set GPR:$dst, so_reg:$src)]>;
 
-let isReMaterializable = 1 in
 def MOVi : AI1<(ops GPR:$dst, so_imm:$src),
 "mov", " $dst, $src", [(set GPR:$dst, so_imm:$src)]>;
 
@@ -912,7 +910,6 @@
 "mvn", " $dst, $src", [(set GPR:$dst, (not GPR:$src))]>;
 def  MVNs  : AI<(ops GPR:$dst, so_reg:$src),
 "mvn", " $dst, $src", [(set GPR:$dst, (not so_reg:$src))]>;
-let isReMaterializable = 1 in
 def  MVNi  : AI<(ops GPR:$dst, so_imm:$imm),
 "mvn", " $dst, $imm", [(set GPR:$dst, so_imm_not:$imm)]>;
 
@@ -1183,7 +1180,6 @@
 // Large immediate handling.
 
 // Two piece so_imms.
-let isReMaterializable = 1 in
 def MOVi2pieces : AI1x2<(ops GPR:$dst, so_imm2part:$src),
  "mov", " $dst, $src",
  [(set GPR:$dst, so_imm2part:$src)]>;


Index: llvm/lib/Target/ARM/ARMInstrThumb.td
diff -u llvm/lib/Target/ARM/ARMInstrThumb.td:1.31 
llvm/lib/Target/ARM/ARMInstrThumb.td:1.32
--- llvm/lib/Target/ARM/ARMInstrThumb.td:1.31   Mon Jun 18 20:25:30 2007
+++ llvm/lib/Target/ARM/ARMInstrThumb.tdMon Jun 18 20:48:04 2007
@@ -267,7 +267,6 @@
   [(set GPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>;
 
 // Special LDR for loads from non-pc-relative constpools.
-let isReMaterializable = 1 in
 def tLDRcp  : TIs<(ops GPR:$dst, i32imm:$addr),
   "ldr $dst, $addr", []>;
 } // isLoad



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


[llvm-commits] CVS: llvm/utils/TableGen/CodeGenInstruction.h CodeGenTarget.cpp InstrInfoEmitter.cpp

2007-06-18 Thread Dan Gohman


Changes in directory llvm/utils/TableGen:

CodeGenInstruction.h updated: 1.29 -> 1.30
CodeGenTarget.cpp updated: 1.93 -> 1.94
InstrInfoEmitter.cpp updated: 1.61 -> 1.62
---
Log message:

Replace M_REMATERIALIZIBLE and the newly-added isOtherReMaterializableLoad
with a general target hook to identify rematerializable instructions. Some
instructions are only rematerializable with specific operands, such as loads
from constant pools, while others are always rematerializable. This hook
allows both to be identified as being rematerializable with the same
mechanism.


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

 CodeGenInstruction.h |1 -
 CodeGenTarget.cpp|1 -
 InstrInfoEmitter.cpp |1 -
 3 files changed, 3 deletions(-)


Index: llvm/utils/TableGen/CodeGenInstruction.h
diff -u llvm/utils/TableGen/CodeGenInstruction.h:1.29 
llvm/utils/TableGen/CodeGenInstruction.h:1.30
--- llvm/utils/TableGen/CodeGenInstruction.h:1.29   Mon Jun 18 20:26:51 2007
+++ llvm/utils/TableGen/CodeGenInstruction.hMon Jun 18 20:48:05 2007
@@ -91,7 +91,6 @@
 bool isConvertibleToThreeAddress;
 bool isCommutable;
 bool isTerminator;
-bool isReMaterializable;
 bool hasDelaySlot;
 bool usesCustomDAGSchedInserter;
 bool hasVariableNumberOfOperands;


Index: llvm/utils/TableGen/CodeGenTarget.cpp
diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.93 
llvm/utils/TableGen/CodeGenTarget.cpp:1.94
--- llvm/utils/TableGen/CodeGenTarget.cpp:1.93  Mon Jun 18 20:26:51 2007
+++ llvm/utils/TableGen/CodeGenTarget.cpp   Mon Jun 18 20:48:05 2007
@@ -365,7 +365,6 @@
   isConvertibleToThreeAddress = 
R->getValueAsBit("isConvertibleToThreeAddress");
   isCommutable = R->getValueAsBit("isCommutable");
   isTerminator = R->getValueAsBit("isTerminator");
-  isReMaterializable = R->getValueAsBit("isReMaterializable");
   hasDelaySlot = R->getValueAsBit("hasDelaySlot");
   usesCustomDAGSchedInserter = R->getValueAsBit("usesCustomDAGSchedInserter");
   hasCtrlDep   = R->getValueAsBit("hasCtrlDep");


Index: llvm/utils/TableGen/InstrInfoEmitter.cpp
diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.61 
llvm/utils/TableGen/InstrInfoEmitter.cpp:1.62
--- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.61   Mon Jun 18 20:26:51 2007
+++ llvm/utils/TableGen/InstrInfoEmitter.cppMon Jun 18 20:48:05 2007
@@ -240,7 +240,6 @@
   if (Inst.isConvertibleToThreeAddress) OS << "|M_CONVERTIBLE_TO_3_ADDR";
   if (Inst.isCommutable) OS << "|M_COMMUTABLE";
   if (Inst.isTerminator) OS << "|M_TERMINATOR_FLAG";
-  if (Inst.isReMaterializable) OS << "|M_REMATERIALIZIBLE";
   if (Inst.clobbersPred) OS << "|M_CLOBBERS_PRED";
   if (Inst.isNotDuplicable) OS << "|M_NOT_DUPLICABLE";
   if (Inst.usesCustomDAGSchedInserter)



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

2007-06-18 Thread Dan Gohman


Changes in directory llvm/lib/Target/X86:

X86InstrFPStack.td updated: 1.9 -> 1.10
X86InstrInfo.cpp updated: 1.91 -> 1.92
X86InstrInfo.h updated: 1.66 -> 1.67
X86InstrInfo.td updated: 1.307 -> 1.308
X86InstrMMX.td updated: 1.32 -> 1.33
X86InstrSSE.td updated: 1.183 -> 1.184
---
Log message:

Replace M_REMATERIALIZIBLE and the newly-added isOtherReMaterializableLoad
with a general target hook to identify rematerializable instructions. Some
instructions are only rematerializable with specific operands, such as loads
from constant pools, while others are always rematerializable. This hook
allows both to be identified as being rematerializable with the same
mechanism.


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

 X86InstrFPStack.td |2 --
 X86InstrInfo.cpp   |   14 +-
 X86InstrInfo.h |2 +-
 X86InstrInfo.td|2 --
 X86InstrMMX.td |   14 ++
 X86InstrSSE.td |8 +++-
 6 files changed, 23 insertions(+), 19 deletions(-)


Index: llvm/lib/Target/X86/X86InstrFPStack.td
diff -u llvm/lib/Target/X86/X86InstrFPStack.td:1.9 
llvm/lib/Target/X86/X86InstrFPStack.td:1.10
--- llvm/lib/Target/X86/X86InstrFPStack.td:1.9  Tue Mar 20 19:16:56 2007
+++ llvm/lib/Target/X86/X86InstrFPStack.td  Mon Jun 18 20:48:04 2007
@@ -413,12 +413,10 @@
 def FXCH: FPI<0xC8, AddRegFrm, (ops RST:$op), "fxch $op">, D9;
 
 // Floating point constant loads.
-let isReMaterializable = 1 in {
 def FpLD0 : FpI<(ops RFP:$dst), ZeroArgFP,
 [(set RFP:$dst, fp64imm0)]>;
 def FpLD1 : FpI<(ops RFP:$dst), ZeroArgFP,
 [(set RFP:$dst, fp64imm1)]>;
-}
 
 def FLD0 : FPI<0xEE, RawFrm, (ops), "fldz">, D9;
 def FLD1 : FPI<0xE8, RawFrm, (ops), "fld1">, D9;


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.91 
llvm/lib/Target/X86/X86InstrInfo.cpp:1.92
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.91   Thu Jun 14 17:03:45 2007
+++ llvm/lib/Target/X86/X86InstrInfo.cppMon Jun 18 20:48:04 2007
@@ -112,9 +112,20 @@
 }
 
 
-bool X86InstrInfo::isOtherReMaterializableLoad(MachineInstr *MI) const {
+bool X86InstrInfo::isTriviallyReMaterializable(MachineInstr *MI) const {
   switch (MI->getOpcode()) {
   default: break;
+  case X86::FpLD0:
+  case X86::FpLD1:
+  case X86::MOV8ri:
+  case X86::MOV16ri:
+  case X86::MOV32ri:
+  case X86::MMX_V_SET0:
+  case X86::MMX_V_SETALLONES:
+  case X86::V_SET0:
+  case X86::V_SETALLONES:
+// These instructions are always trivially rematerializable.
+return true;
   case X86::MOV8rm:
   case X86::MOV16rm:
   case X86::MOV16_rm:
@@ -128,6 +139,7 @@
   case X86::MOVAPDrm:
   case X86::MMX_MOVD64rm:
   case X86::MMX_MOVQ64rm:
+// Loads from constant pools are trivially rematerializable.
 return MI->getOperand(1).isRegister() && MI->getOperand(2).isImmediate() &&
MI->getOperand(3).isRegister() && 
MI->getOperand(4).isConstantPoolIndex() &&
MI->getOperand(1).getReg() == 0 &&


Index: llvm/lib/Target/X86/X86InstrInfo.h
diff -u llvm/lib/Target/X86/X86InstrInfo.h:1.66 
llvm/lib/Target/X86/X86InstrInfo.h:1.67
--- llvm/lib/Target/X86/X86InstrInfo.h:1.66 Thu Jun 14 17:03:45 2007
+++ llvm/lib/Target/X86/X86InstrInfo.h  Mon Jun 18 20:48:04 2007
@@ -239,7 +239,7 @@
unsigned& destReg) const;
   unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
   unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
-  bool isOtherReMaterializableLoad(MachineInstr *MI) const;
+  bool isTriviallyReMaterializable(MachineInstr *MI) const;
   
   /// convertToThreeAddress - This method must be implemented by targets that
   /// set the M_CONVERTIBLE_TO_3_ADDR flag.  When this flag is set, the target


Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.307 
llvm/lib/Target/X86/X86InstrInfo.td:1.308
--- llvm/lib/Target/X86/X86InstrInfo.td:1.307   Sat May  5 23:00:55 2007
+++ llvm/lib/Target/X86/X86InstrInfo.td Mon Jun 18 20:48:04 2007
@@ -617,7 +617,6 @@
 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
 def MOV32rr : I<0x89, MRMDestReg, (ops GR32:$dst, GR32:$src),
 "mov{l} {$src, $dst|$dst, $src}", []>;
-let isReMaterializable = 1 in {
 def MOV8ri  : Ii8 <0xB0, AddRegFrm, (ops GR8 :$dst, i8imm :$src),
"mov{b} {$src, $dst|$dst, $src}",
[(set GR8:$dst, imm:$src)]>;
@@ -627,7 +626,6 @@
 def MOV32ri : Ii32<0xB8, AddRegFrm, (ops GR32:$dst, i32imm:$src),
"mov{l} {$src, $dst|$dst, $src}",
[(set GR32:$dst, imm:$src)]>;
-}
 def MOV8mi  : Ii8 <0xC6, MRM0m, (ops i8mem :$dst, i8imm :$src),
"mov{b} {$src, $dst|$dst, $src}",
[(store (i8 imm:$src), addr:$dst)]>;


Index: llvm/lib/Target/X86/X86InstrMMX.td
diff -u llvm/lib/Target/X86/X86InstrMMX.td:1.32 
llvm/lib/Target/X86/X86InstrMMX.td:1.33
--- llvm/lib/Target/X86/X86InstrMMX.td:1.32 Wed May 16 01:08:17 2007
+++ llvm/l

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

2007-06-18 Thread Dan Gohman


Changes in directory llvm/lib/Target:

Target.td updated: 1.104 -> 1.105
---
Log message:

Replace M_REMATERIALIZIBLE and the newly-added isOtherReMaterializableLoad
with a general target hook to identify rematerializable instructions. Some
instructions are only rematerializable with specific operands, such as loads
from constant pools, while others are always rematerializable. This hook
allows both to be identified as being rematerializable with the same
mechanism.


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

 Target.td |1 -
 1 files changed, 1 deletion(-)


Index: llvm/lib/Target/Target.td
diff -u llvm/lib/Target/Target.td:1.104 llvm/lib/Target/Target.td:1.105
--- llvm/lib/Target/Target.td:1.104 Mon Jun 18 20:25:30 2007
+++ llvm/lib/Target/Target.td   Mon Jun 18 20:48:04 2007
@@ -186,7 +186,6 @@
   bit isConvertibleToThreeAddress = 0;  // Can this 2-addr instruction promote?
   bit isCommutable = 0; // Is this 3 operand instruction commutable?
   bit isTerminator = 0; // Is this part of the terminator for a basic 
block?
-  bit isReMaterializable = 0; // Is this instruction re-materializable?
   bit isPredicable = 0; // Is this instruction predicable?
   bit hasDelaySlot = 0; // Does this instruction have an delay slot?
   bit usesCustomDAGSchedInserter = 0; // Pseudo instr needing special help.



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

2007-06-18 Thread Dan Gohman


Changes in directory llvm/include/llvm/Target:

TargetInstrInfo.h updated: 1.131 -> 1.132
---
Log message:

Replace M_REMATERIALIZIBLE and the newly-added isOtherReMaterializableLoad
with a general target hook to identify rematerializable instructions. Some
instructions are only rematerializable with specific operands, such as loads
from constant pools, while others are always rematerializable. This hook
allows both to be identified as being rematerializable with the same
mechanism.


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

 TargetInstrInfo.h |   16 
 1 files changed, 4 insertions(+), 12 deletions(-)


Index: llvm/include/llvm/Target/TargetInstrInfo.h
diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.131 
llvm/include/llvm/Target/TargetInstrInfo.h:1.132
--- llvm/include/llvm/Target/TargetInstrInfo.h:1.131Mon Jun 18 20:21:41 2007
+++ llvm/include/llvm/Target/TargetInstrInfo.h  Mon Jun 18 20:48:04 2007
@@ -78,10 +78,6 @@
 // controls execution. It may be set to 'always'.
 const unsigned M_PREDICABLE = 1 << 12;
 
-// M_REMATERIALIZIBLE - Set if this instruction can be trivally re-materialized
-// at any time, e.g. constant generation, load from constant pool.
-const unsigned M_REMATERIALIZIBLE = 1 << 13;
-
 // M_CLOBBERS_PRED - Set if this instruction may clobbers the condition code
 // register and / or registers that are used to predicate instructions.
 const unsigned M_CLOBBERS_PRED = 1 << 14;
@@ -264,10 +260,6 @@
 return get(Opcode).Flags & M_PREDICABLE;
   }
 
-  bool isReMaterializable(MachineOpCode Opcode) const {
-return get(Opcode).Flags & M_REMATERIALIZIBLE;
-  }
-
   bool clobbersPredicate(MachineOpCode Opcode) const {
 return get(Opcode).Flags & M_CLOBBERS_PRED;
   }
@@ -309,13 +301,13 @@
 return 0;
   }
 
-  /// isOtherReMaterializableLoad - If the specified machine instruction is a
-  /// direct load that is trivially rematerializable, not counting loads from
-  /// stack slots, return true. If not, return false.  This predicate must
+  /// isTriviallyReMaterializable - If the specified machine instruction can
+  /// be trivally re-materialized  at any time, e.g. constant generation or
+  /// loads from constant pools. If not, return false.  This predicate must
   /// return false if the instruction has any side effects other than
   /// producing the value from the load, or if it requres any address
   /// registers that are not always available.
-  virtual bool isOtherReMaterializableLoad(MachineInstr *MI) const {
+  virtual bool isTriviallyReMaterializable(MachineInstr *MI) const {
 return false;
   }
 



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


  1   2   3   4   5   >