aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-29 00:36:59 +0000
committerChris Lattner <sabre@nondot.org>2005-01-29 00:36:59 +0000
commit23ba420550499a071f70af7022847479d1165c68 (patch)
treec08147a41704ca0242424754ef81c39a445f2df1
parent3d80f9039414fe15d4e9cd4e36aced3dd228ba70 (diff)
Finegrainify namespacification.
Adjust TmpInstruction to work with the new User model. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19896 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/SparcV9/SparcV9TmpInstr.cpp39
-rw-r--r--lib/Target/SparcV9/SparcV9TmpInstr.h12
2 files changed, 27 insertions, 24 deletions
diff --git a/lib/Target/SparcV9/SparcV9TmpInstr.cpp b/lib/Target/SparcV9/SparcV9TmpInstr.cpp
index 6e53cbc3c3..e257787054 100644
--- a/lib/Target/SparcV9/SparcV9TmpInstr.cpp
+++ b/lib/Target/SparcV9/SparcV9TmpInstr.cpp
@@ -14,14 +14,24 @@
#include "SparcV9TmpInstr.h"
#include "llvm/Support/LeakDetector.h"
+using namespace llvm;
-namespace llvm {
+TmpInstruction::TmpInstruction(const TmpInstruction &TI)
+ : Instruction(TI.getType(), TI.getOpcode(), Ops, TI.getNumOperands()) {
+ if (TI.getNumOperands()) {
+ Ops[0].init(TI.Ops[0], this);
+ if (TI.getNumOperands() == 2)
+ Ops[1].init(TI.Ops[1], this);
+ else
+ assert(0 && "Bad # operands to TmpInstruction!");
+ }
+}
TmpInstruction::TmpInstruction(Value *s1, Value *s2, const std::string &name)
- : Instruction(s1->getType(), Instruction::UserOp1, name) {
- Operands.push_back(Use(s1, this)); // s1 must be non-null
+ : Instruction(s1->getType(), Instruction::UserOp1, Ops, 1+(s2 != 0), name) {
+ Ops[0].init(s1, this); // s1 must be non-null
if (s2)
- Operands.push_back(Use(s2, this));
+ Ops[1].init(s2, this);
// TmpInstructions should not be garbage checked.
LeakDetector::removeGarbageObject(this);
@@ -29,12 +39,12 @@ TmpInstruction::TmpInstruction(Value *s1, Value *s2, const std::string &name)
TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
Value *s1, Value *s2, const std::string &name)
- : Instruction(s1->getType(), Instruction::UserOp1, name) {
+ : Instruction(s1->getType(), Instruction::UserOp1, Ops, 1+(s2 != 0), name) {
mcfi.addTemp(this);
- Operands.push_back(Use(s1, this)); // s1 must be non-null
+ Ops[0].init(s1, this); // s1 must be non-null
if (s2)
- Operands.push_back(Use(s2, this));
+ Ops[1].init(s2, this);
// TmpInstructions should not be garbage checked.
LeakDetector::removeGarbageObject(this);
@@ -45,16 +55,17 @@ TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
const Type *Ty, Value *s1, Value* s2,
const std::string &name)
- : Instruction(Ty, Instruction::UserOp1, name) {
+ : Instruction(Ty, Instruction::UserOp1, Ops, (s1 != 0)+(s2 != 0), name) {
mcfi.addTemp(this);
- if (s1)
- Operands.push_back(Use(s1, this));
- if (s2)
- Operands.push_back(Use(s2, this));
+ assert((s1 != 0 || s2 == 0) &&
+ "s2 cannot be non-null if s1 is non-null!");
+ if (s1) {
+ Ops[0].init(s1, this);
+ if (s2)
+ Ops[1].init(s2, this);
+ }
// TmpInstructions should not be garbage checked.
LeakDetector::removeGarbageObject(this);
}
-
-} // end namespace llvm
diff --git a/lib/Target/SparcV9/SparcV9TmpInstr.h b/lib/Target/SparcV9/SparcV9TmpInstr.h
index fa71865662..a2f883cec6 100644
--- a/lib/Target/SparcV9/SparcV9TmpInstr.h
+++ b/lib/Target/SparcV9/SparcV9TmpInstr.h
@@ -24,16 +24,8 @@ namespace llvm {
/// values used within the SparcV9 machine code for an LLVM instruction.
///
class TmpInstruction : public Instruction {
- TmpInstruction(const TmpInstruction &TI)
- : Instruction(TI.getType(), TI.getOpcode()) {
- if (!TI.Operands.empty()) {
- Operands.push_back(Use(TI.Operands[0], this));
- if (TI.Operands.size() == 2)
- Operands.push_back(Use(TI.Operands[1], this));
- else
- assert(0 && "Bad # operands to TmpInstruction!");
- }
- }
+ Use Ops[2];
+ TmpInstruction(const TmpInstruction &TI);
public:
// Constructor that uses the type of S1 as the type of the temporary.
// s1 must be a valid value. s2 may be NULL.