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

Chris Lattner lattner at cs.uiuc.edu
Fri Jan 28 16:35:46 PST 2005



Changes in directory llvm/lib/VMCore:

Function.cpp updated: 1.84 -> 1.85
Globals.cpp updated: 1.7 -> 1.8
Instruction.cpp updated: 1.41 -> 1.42
---
Log message:

Adjust to changes in User class.


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

 Function.cpp    |    2 +-
 Globals.cpp     |   13 ++++++++-----
 Instruction.cpp |   19 ++++++++-----------
 3 files changed, 17 insertions(+), 17 deletions(-)


Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.84 llvm/lib/VMCore/Function.cpp:1.85
--- llvm/lib/VMCore/Function.cpp:1.84	Fri Jan  7 01:40:32 2005
+++ llvm/lib/VMCore/Function.cpp	Fri Jan 28 18:35:33 2005
@@ -87,7 +87,7 @@
 
 Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
                    const std::string &name, Module *ParentModule)
-  : GlobalValue(PointerType::get(Ty), Value::FunctionVal, Linkage, name) {
+  : GlobalValue(PointerType::get(Ty), Value::FunctionVal, 0, 0, Linkage, name) {
   BasicBlocks.setItemParent(this);
   BasicBlocks.setParent(this);
   ArgumentList.setItemParent(this);


Index: llvm/lib/VMCore/Globals.cpp
diff -u llvm/lib/VMCore/Globals.cpp:1.7 llvm/lib/VMCore/Globals.cpp:1.8
--- llvm/lib/VMCore/Globals.cpp:1.7	Mon Oct 11 17:21:39 2004
+++ llvm/lib/VMCore/Globals.cpp	Fri Jan 28 18:35:33 2005
@@ -72,14 +72,17 @@
 //===----------------------------------------------------------------------===//
 
 GlobalVariable::GlobalVariable(const Type *Ty, bool constant, LinkageTypes Link,
-                               Constant *Initializer,
+                               Constant *InitVal,
                                const std::string &Name, Module *ParentModule)
-  : GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, Link, Name),
+  : GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal,
+                &Initializer, InitVal != 0, Link, Name),
     isConstantGlobal(constant) {
-  if (Initializer) {
-    assert(Initializer->getType() == Ty &&
+  if (InitVal) {
+    assert(InitVal->getType() == Ty &&
            "Initializer should be the same type as the GlobalVariable!");
-    Operands.push_back(Use((Value*)Initializer, this));
+    Initializer.init(InitVal, this);
+  } else {
+    Initializer.init(0, this);
   }
 
   LeakDetector::addGarbageObject(this);


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.41 llvm/lib/VMCore/Instruction.cpp:1.42
--- llvm/lib/VMCore/Instruction.cpp:1.41	Mon Nov 29 20:51:53 2004
+++ llvm/lib/VMCore/Instruction.cpp	Fri Jan 28 18:35:33 2005
@@ -18,15 +18,11 @@
 #include "llvm/Support/LeakDetector.h"
 using namespace llvm;
 
-void Instruction::init() {
+Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
+                         const std::string &Name, Instruction *InsertBefore)
+  : User(ty, Value::InstructionVal + it, Ops, NumOps, Name), Parent(0) {
   // Make sure that we get added to a basicblock
   LeakDetector::addGarbageObject(this);
-}
-
-Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name,
-                         Instruction *InsertBefore)
-  : User(ty, Value::InstructionVal + it, Name), Parent(0) {
-  init();
 
   // If requested, insert this instruction into a basic block...
   if (InsertBefore) {
@@ -36,10 +32,11 @@
   }
 }
 
-Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name,
-                         BasicBlock *InsertAtEnd)
-  : User(ty, Value::InstructionVal + it, Name), Parent(0) {
-  init();
+Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
+                         const std::string &Name, BasicBlock *InsertAtEnd)
+  : User(ty, Value::InstructionVal + it, Ops, NumOps, Name), 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!");






More information about the llvm-commits mailing list