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

2007-02-23 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.69 - 1.70
Instructions.cpp updated: 1.77 - 1.78
---
Log message:

Refactor the setName stuff, moving it down the inheritance hierarchy, to
solve a crash in -instcombine -debug that was hit while investigating PR1217: 
http://llvm.org/PR1217 


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

 Instruction.cpp  |   33 --
 Instructions.cpp |  264 +--
 2 files changed, 199 insertions(+), 98 deletions(-)


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.69 
llvm/lib/VMCore/Instruction.cpp:1.70
--- llvm/lib/VMCore/Instruction.cpp:1.69Mon Feb 19 13:46:17 2007
+++ llvm/lib/VMCore/Instruction.cpp Fri Feb 23 18:55:48 2007
@@ -19,7 +19,7 @@
 using namespace llvm;
 
 Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned 
NumOps,
- const std::string Name, Instruction *InsertBefore)
+ Instruction *InsertBefore)
   : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
   // Make sure that we get added to a basicblock
   LeakDetector::addGarbageObject(this);
@@ -30,11 +30,10 @@
Instruction to insert before is not in a basic block!);
 InsertBefore-getParent()-getInstList().insert(InsertBefore, this);
   }
-  setName(Name);
 }
 
 Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned 
NumOps,
- const std::string Name, BasicBlock *InsertAtEnd)
+ BasicBlock *InsertAtEnd)
   : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
   // Make sure that we get added to a basicblock
   LeakDetector::addGarbageObject(this);
@@ -42,34 +41,6 @@
   // append this instruction into the basic block
   assert(InsertAtEnd  Basic block to append to may not be NULL!);
   InsertAtEnd-getInstList().push_back(this);
-  setName(Name);
-}
-
-Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned 
NumOps,
- const char *Name, Instruction *InsertBefore)
-  : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
-  // Make sure that we get added to a basicblock
-  LeakDetector::addGarbageObject(this);
-
-  // If requested, insert this instruction into a basic block...
-  if (InsertBefore) {
-assert(InsertBefore-getParent() 
-   Instruction to insert before is not in a basic block!);
-InsertBefore-getParent()-getInstList().insert(InsertBefore, this);
-  }
-  if (Name  *Name) setName(Name);
-}
-
-Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned 
NumOps,
- const char *Name, BasicBlock *InsertAtEnd)
-  : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
-  // Make sure that we get added to a basicblock
-  LeakDetector::addGarbageObject(this);
-
-  // append this instruction into the basic block
-  assert(InsertAtEnd  Basic block to append to may not be NULL!);
-  InsertAtEnd-getInstList().push_back(this);
-  if (Name  *Name) setName(Name);
 }
 
 


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.77 
llvm/lib/VMCore/Instructions.cpp:1.78
--- llvm/lib/VMCore/Instructions.cpp:1.77   Wed Feb 14 21:39:18 2007
+++ llvm/lib/VMCore/Instructions.cppFri Feb 23 18:55:48 2007
@@ -40,16 +40,6 @@
 //TerminatorInst Class
 
//===--===//
 
-TerminatorInst::TerminatorInst(Instruction::TermOps iType,
-   Use *Ops, unsigned NumOps, Instruction *IB)
-  : Instruction(Type::VoidTy, iType, Ops, NumOps, , IB) {
-}
-
-TerminatorInst::TerminatorInst(Instruction::TermOps iType,
-   Use *Ops, unsigned NumOps, BasicBlock *IAE)
-  : Instruction(Type::VoidTy, iType, Ops, NumOps, , IAE) {
-}
-
 // Out of line virtual method, so the vtable, etc has a home.
 TerminatorInst::~TerminatorInst() {
 }
@@ -272,63 +262,71 @@
const std::string Name, BasicBlock *InsertAtEnd)
   : Instruction(castFunctionType(castPointerType(Func-getType())
  -getElementType())-getReturnType(),
-Instruction::Call, 0, 0, Name, InsertAtEnd) {
+Instruction::Call, 0, 0, InsertAtEnd) {
   init(Func, Args, NumArgs);
+  setName(Name);
 }
 CallInst::CallInst(Value *Func, Value* const *Args, unsigned NumArgs,
const std::string Name, Instruction *InsertBefore)
 : Instruction(castFunctionType(castPointerType(Func-getType())
  -getElementType())-getReturnType(),
-  Instruction::Call, 0, 0, Name, InsertBefore) {
+  Instruction::Call, 0, 0, InsertBefore) {
   init(Func, Args, NumArgs);
+  setName(Name);
 }
 
 CallInst::CallInst(Value *Func, Value *Actual1, Value *Actual2,
const std::string Name, Instruction  

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

2007-02-19 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.67 - 1.68
---
Log message:

Add a FIXME for unwritten code.


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

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


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.67 
llvm/lib/VMCore/Instruction.cpp:1.68
--- llvm/lib/VMCore/Instruction.cpp:1.67Thu Feb 15 20:25:55 2007
+++ llvm/lib/VMCore/Instruction.cpp Mon Feb 19 13:00:29 2007
@@ -239,6 +239,8 @@
   case Instruction::Call:
 if (const IntrinsicInst *II = dyn_castIntrinsicInst(this)) {
   // If the intrinsic doesn't write memory, it is safe.
+  // FIXME: this is obviously supposed to determine which  intrinsics 
+  // don't write to memory, but hasn't been implemented yet.
 }
 return true;
   case Instruction::Load:



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


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

2007-02-19 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.68 - 1.69
---
Log message:

remove warning


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

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


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.68 
llvm/lib/VMCore/Instruction.cpp:1.69
--- llvm/lib/VMCore/Instruction.cpp:1.68Mon Feb 19 13:00:29 2007
+++ llvm/lib/VMCore/Instruction.cpp Mon Feb 19 13:46:17 2007
@@ -237,11 +237,11 @@
   case Instruction::VAArg:
 return true;
   case Instruction::Call:
-if (const IntrinsicInst *II = dyn_castIntrinsicInst(this)) {
+//if (const IntrinsicInst *II = dyn_castIntrinsicInst(this)) {
   // If the intrinsic doesn't write memory, it is safe.
   // FIXME: this is obviously supposed to determine which  intrinsics 
   // don't write to memory, but hasn't been implemented yet.
-}
+//}
 return true;
   case Instruction::Load:
 return castLoadInst(this)-isVolatile();



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


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

2007-02-15 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

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

make mayWriteToMemory a non-virtual function


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

 Instruction.cpp |   19 +++
 1 files changed, 19 insertions(+)


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.65 
llvm/lib/VMCore/Instruction.cpp:1.66
--- llvm/lib/VMCore/Instruction.cpp:1.65Tue Feb 13 01:54:42 2007
+++ llvm/lib/VMCore/Instruction.cpp Thu Feb 15 17:15:00 2007
@@ -225,6 +225,25 @@
   return true;
 }
 
+/// mayWriteToMemory - Return true if this instruction may modify memory.
+///
+bool Instruction::mayWriteToMemory() const {
+  switch (getOpcode()) {
+  default: return false;
+  case Instruction::Free:
+  case Instruction::Store:
+  case Instruction::Invoke:
+  case Instruction::VAArg:
+return true;
+  case Instruction::Call:
+if (const IntrinsicInst *II = dyn_castIntrinsicInst(this)) {
+  // If the intrinsic doesn't write memory, it is safe.
+}
+return true;
+  case Instruction::Load:
+return castLoadInst(this)-isVolatile();
+  }
+}
 
 /// isAssociative - Return true if the instruction is associative:
 ///



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


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

2007-02-15 Thread Andrew Lenharth


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.66 - 1.67
---
Log message:

fix build

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

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


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.66 
llvm/lib/VMCore/Instruction.cpp:1.67
--- llvm/lib/VMCore/Instruction.cpp:1.66Thu Feb 15 17:15:00 2007
+++ llvm/lib/VMCore/Instruction.cpp Thu Feb 15 20:25:55 2007
@@ -13,6 +13,7 @@
 
 #include llvm/Type.h
 #include llvm/Instructions.h
+#include llvm/IntrinsicInst.h
 #include llvm/Function.h
 #include llvm/Support/LeakDetector.h
 using namespace llvm;



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


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

2007-02-12 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.64 - 1.65
Instructions.cpp updated: 1.74 - 1.75
---
Log message:

Switch UnaryOperators to default to passing names up by const char* when 
possible.
This speeds up bcreading by 1.5%.


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

 Instruction.cpp  |   28 
 Instructions.cpp |   54 ++
 2 files changed, 74 insertions(+), 8 deletions(-)


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.64 
llvm/lib/VMCore/Instruction.cpp:1.65
--- llvm/lib/VMCore/Instruction.cpp:1.64Sun Feb 11 23:18:08 2007
+++ llvm/lib/VMCore/Instruction.cpp Tue Feb 13 01:54:42 2007
@@ -44,6 +44,34 @@
   setName(Name);
 }
 
+Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned 
NumOps,
+ const char *Name, Instruction *InsertBefore)
+  : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
+  // Make sure that we get added to a basicblock
+  LeakDetector::addGarbageObject(this);
+
+  // If requested, insert this instruction into a basic block...
+  if (InsertBefore) {
+assert(InsertBefore-getParent() 
+   Instruction to insert before is not in a basic block!);
+InsertBefore-getParent()-getInstList().insert(InsertBefore, this);
+  }
+  if (Name  *Name) setName(Name);
+}
+
+Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned 
NumOps,
+ const char *Name, BasicBlock *InsertAtEnd)
+  : User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
+  // Make sure that we get added to a basicblock
+  LeakDetector::addGarbageObject(this);
+
+  // append this instruction into the basic block
+  assert(InsertAtEnd  Basic block to append to may not be NULL!);
+  InsertAtEnd-getInstList().push_back(this);
+  if (Name  *Name) setName(Name);
+}
+
+
 // Out of line virtual method, so the vtable, etc has a home.
 Instruction::~Instruction() {
   assert(Parent == 0  Instruction still linked in the program!);


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.74 
llvm/lib/VMCore/Instructions.cpp:1.75
--- llvm/lib/VMCore/Instructions.cpp:1.74   Tue Feb 13 00:22:32 2007
+++ llvm/lib/VMCore/Instructions.cppTue Feb 13 01:54:42 2007
@@ -531,18 +531,20 @@
unsigned Align, const std::string Name,
Instruction *InsertBefore)
   : UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize),
- Name, InsertBefore), Alignment(Align) {
+ 0, InsertBefore), Alignment(Align) {
   assert((Align  (Align-1)) == 0  Alignment is not a power of 2!);
   assert(Ty != Type::VoidTy  Cannot allocate void!);
+  setName(Name);
 }
 
 AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
unsigned Align, const std::string Name,
BasicBlock *InsertAtEnd)
   : UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize),
- Name, InsertAtEnd), Alignment(Align) {
+ 0, InsertAtEnd), Alignment(Align) {
   assert((Align  (Align-1)) == 0  Alignment is not a power of 2!);
   assert(Ty != Type::VoidTy  Cannot allocate void!);
+  setName(Name);
 }
 
 // Out of line virtual method, so the vtable, etc has a home.
@@ -579,12 +581,12 @@
 }
 
 FreeInst::FreeInst(Value *Ptr, Instruction *InsertBefore)
-  : UnaryInstruction(Type::VoidTy, Free, Ptr, , InsertBefore) {
+  : UnaryInstruction(Type::VoidTy, Free, Ptr, 0, InsertBefore) {
   AssertOK();
 }
 
 FreeInst::FreeInst(Value *Ptr, BasicBlock *InsertAtEnd)
-  : UnaryInstruction(Type::VoidTy, Free, Ptr, , InsertAtEnd) {
+  : UnaryInstruction(Type::VoidTy, Free, Ptr, 0, InsertAtEnd) {
   AssertOK();
 }
 
@@ -600,30 +602,66 @@
 
 LoadInst::LoadInst(Value *Ptr, const std::string Name, Instruction *InsertBef)
   : UnaryInstruction(castPointerType(Ptr-getType())-getElementType(),
- Load, Ptr, Name, InsertBef) {
+ Load, Ptr, 0, InsertBef) {
   setVolatile(false);
   AssertOK();
+  setName(Name);
 }
 
 LoadInst::LoadInst(Value *Ptr, const std::string Name, BasicBlock *InsertAE)
   : UnaryInstruction(castPointerType(Ptr-getType())-getElementType(),
- Load, Ptr, Name, InsertAE) {
+ Load, Ptr, 0, InsertAE) {
   setVolatile(false);
   AssertOK();
+  setName(Name);
 }
 
 LoadInst::LoadInst(Value *Ptr, const std::string Name, bool isVolatile,
Instruction *InsertBef)
   : UnaryInstruction(castPointerType(Ptr-getType())-getElementType(),
- Load, Ptr, Name, InsertBef) {
+ Load, Ptr, 0, InsertBef) {
   setVolatile(isVolatile);
   AssertOK();
+  setName(Name);
 }
 
 LoadInst::LoadInst(Value *Ptr, const std::string Name, bool isVolatile,
BasicBlock 

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

2007-01-03 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.61 - 1.62
---
Log message:

Now that setcondinst has been eliminated, we can mark Value::SubclassID
const and remove the ugly mutator methods.


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

 Instruction.cpp |4 
 1 files changed, 4 deletions(-)


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.61 
llvm/lib/VMCore/Instruction.cpp:1.62
--- llvm/lib/VMCore/Instruction.cpp:1.61Sat Dec 23 00:05:41 2006
+++ llvm/lib/VMCore/Instruction.cpp Wed Jan  3 20:15:37 2007
@@ -49,10 +49,6 @@
 }
 
 
-void Instruction::setOpcode(unsigned opc) {
-  setValueType(Value::InstructionVal + opc);
-}
-
 void Instruction::setParent(BasicBlock *P) {
   if (getParent()) {
 if (!P) LeakDetector::addGarbageObject(this);



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


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

2006-11-19 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.57 - 1.58
Instructions.cpp updated: 1.46 - 1.47
Verifier.cpp updated: 1.165 - 1.166
---
Log message:

For PR950: http://llvm.org/PR950 :
First in a series of patches to convert SetCondInst into ICmpInst and 
FCmpInst using only two opcodes and having the instructions contain their
predicate value. Nothing uses these classes yet. More patches to follow.


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

 Instruction.cpp  |2 
 Instructions.cpp |  196 +++
 Verifier.cpp |   29 
 3 files changed, 226 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.57 
llvm/lib/VMCore/Instruction.cpp:1.58
--- llvm/lib/VMCore/Instruction.cpp:1.57Wed Nov  8 00:47:33 2006
+++ llvm/lib/VMCore/Instruction.cpp Sun Nov 19 19:22:35 2006
@@ -11,10 +11,10 @@
 //
 
//===--===//
 
+#include llvm/Type.h
 #include llvm/Instructions.h
 #include llvm/Function.h
 #include llvm/SymbolTable.h
-#include llvm/Type.h
 #include llvm/Support/LeakDetector.h
 using namespace llvm;
 


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.46 
llvm/lib/VMCore/Instructions.cpp:1.47
--- llvm/lib/VMCore/Instructions.cpp:1.46   Wed Nov  8 00:47:33 2006
+++ llvm/lib/VMCore/Instructions.cppSun Nov 19 19:22:35 2006
@@ -1290,6 +1290,197 @@
   }
 }
 
+
+//===--===//
+//   CmpInst Classes
+//===--===//
+
+CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
+ const std::string Name, Instruction *InsertBefore)
+  : Instruction(Type::BoolTy, op, Ops, 2, Name, InsertBefore) {
+Ops[0].init(LHS, this);
+Ops[1].init(RHS, this);
+  SubclassData = predicate;
+  if (op == Instruction::ICmp) {
+assert(predicate = ICmpInst::FIRST_ICMP_PREDICATE 
+   predicate = ICmpInst::LAST_ICMP_PREDICATE 
+   Invalid ICmp predicate value);
+const Type* Op0Ty = getOperand(0)-getType();
+const Type* Op1Ty = getOperand(1)-getType();
+assert(Op0Ty == Op1Ty 
+   Both operands to ICmp instruction are not of the same type!);
+// Check that the operands are the right type
+assert(Op0Ty-isIntegral() || Op0Ty-getTypeID() == Type::PointerTyID ||
+   (isaPackedType(Op0Ty)  
+castPackedType(Op0Ty)-getElementType()-isIntegral()) 
+   Invalid operand types for ICmp instruction);
+return;
+  }
+  assert(op == Instruction::FCmp  Invalid CmpInst opcode);
+  assert(predicate = FCmpInst::LAST_FCMP_PREDICATE 
+ Invalid FCmp predicate value);
+  const Type* Op0Ty = getOperand(0)-getType();
+  const Type* Op1Ty = getOperand(1)-getType();
+  assert(Op0Ty == Op1Ty 
+ Both operands to FCmp instruction are not of the same type!);
+  // Check that the operands are the right type
+  assert(Op0Ty-isFloatingPoint() || (isaPackedType(Op0Ty) 
+ castPackedType(Op0Ty)-getElementType()-isFloatingPoint()) 
+ Invalid operand types for FCmp instruction);
+}
+  
+CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
+ const std::string Name, BasicBlock *InsertAtEnd)
+  : Instruction(Type::BoolTy, op, Ops, 2, Name, InsertAtEnd) {
+  Ops[0].init(LHS, this);
+  Ops[1].init(RHS, this);
+  SubclassData = predicate;
+  if (op == Instruction::ICmp) {
+assert(predicate = ICmpInst::FIRST_ICMP_PREDICATE 
+   predicate = ICmpInst::LAST_ICMP_PREDICATE 
+   Invalid ICmp predicate value);
+
+const Type* Op0Ty = getOperand(0)-getType();
+const Type* Op1Ty = getOperand(1)-getType();
+assert(Op0Ty == Op1Ty 
+  Both operands to ICmp instruction are not of the same type!);
+// Check that the operands are the right type
+assert(Op0Ty-isIntegral() || Op0Ty-getTypeID() == Type::PointerTyID ||
+   (isaPackedType(Op0Ty)  
+castPackedType(Op0Ty)-getElementType()-isIntegral()) 
+   Invalid operand types for ICmp instruction);
+return;
+  }
+  assert(op == Instruction::FCmp  Invalid CmpInst opcode);
+  assert(predicate = FCmpInst::LAST_FCMP_PREDICATE 
+ Invalid FCmp predicate value);
+  const Type* Op0Ty = getOperand(0)-getType();
+  const Type* Op1Ty = getOperand(1)-getType();
+  assert(Op0Ty == Op1Ty 
+  Both operands to FCmp instruction are not of the same type!);
+  // Check that the operands are the right type
+  assert(Op0Ty-isFloatingPoint() || (isaPackedType(Op0Ty) 
+ castPackedType(Op0Ty)-getElementType()-isFloatingPoint()) 
+Invalid operand types for FCmp instruction);
+}
+
+CmpInst *
+CmpInst::create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2, 
+   

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

2006-10-26 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.54 - 1.55
---
Log message:

Fix Transforms/InstCombine/2006-10-26-VectorReassoc.ll


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

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


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.54 
llvm/lib/VMCore/Instruction.cpp:1.55
--- llvm/lib/VMCore/Instruction.cpp:1.54Thu Oct 26 01:15:43 2006
+++ llvm/lib/VMCore/Instruction.cpp Thu Oct 26 13:27:26 2006
@@ -172,11 +172,12 @@
 /// applied to floating point types.
 ///
 bool Instruction::isAssociative(unsigned Opcode, const Type *Ty) {
-  if (Opcode == Add || Opcode == Mul ||
-  Opcode == And || Opcode == Or || Opcode == Xor) {
-// Floating point operations do not associate!
-return !Ty-isFloatingPoint();
-  }
+  if (Opcode == And || Opcode == Or || Opcode == Xor)
+return true;
+
+  // Add/Mul reassociate unless they are FP or FP vectors.
+  if (Opcode == Add || Opcode == Mul)
+return !Ty-isFPOrFPVector();
   return 0;
 }
 



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


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

2006-06-21 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.51 - 1.52
Instructions.cpp updated: 1.38 - 1.39
---
Log message:

Add some out-of-line virtual dtors so that the class has a home, preventing
vtables for (e.g.) Instruction from being emitted into every .o file.


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

 Instruction.cpp  |6 ++
 Instructions.cpp |   13 +
 2 files changed, 19 insertions(+)


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.51 
llvm/lib/VMCore/Instruction.cpp:1.52
--- llvm/lib/VMCore/Instruction.cpp:1.51Fri Apr  7 20:18:18 2006
+++ llvm/lib/VMCore/Instruction.cpp Wed Jun 21 11:53:47 2006
@@ -43,6 +43,12 @@
   InsertAtEnd-getInstList().push_back(this);
 }
 
+// Out of line virtual method, so the vtable, etc has a home.
+Instruction::~Instruction() {
+  assert(Parent == 0  Instruction still linked in the program!);
+}
+
+
 void Instruction::setOpcode(unsigned opc) {
   setValueType(Value::InstructionVal + opc);
 }


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.38 
llvm/lib/VMCore/Instructions.cpp:1.39
--- llvm/lib/VMCore/Instructions.cpp:1.38   Sun May 14 13:34:36 2006
+++ llvm/lib/VMCore/Instructions.cppWed Jun 21 11:53:47 2006
@@ -34,6 +34,8 @@
 }
 
 
+
+
 
//===--===//
 //TerminatorInst Class
 
//===--===//
@@ -48,6 +50,13 @@
   : Instruction(Type::VoidTy, iType, Ops, NumOps, , IAE) {
 }
 
+// Out of line virtual method, so the vtable, etc has a home.
+TerminatorInst::~TerminatorInst() {
+}
+
+// Out of line virtual method, so the vtable, etc has a home.
+UnaryInstruction::~UnaryInstruction() {
+}
 
 
 
//===--===//
@@ -532,6 +541,10 @@
   assert(Ty != Type::VoidTy  Cannot allocate void!);
 }
 
+// Out of line virtual method, so the vtable, etc has a home.
+AllocationInst::~AllocationInst() {
+}
+
 bool AllocationInst::isArrayAllocation() const {
   if (ConstantUInt *CUI = dyn_castConstantUInt(getOperand(0)))
 return CUI-getValue() != 1;



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