1 //===- SparcV9TmpInstr.cpp - SparcV9 Intermediate Value class -------------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Methods of class for temporary intermediate values used within the current
13 //===----------------------------------------------------------------------===//
15 #include "SparcV9TmpInstr.h"
16 #include "llvm/Type.h"
17 #include "llvm/Support/LeakDetector.h"
20 TmpInstruction::TmpInstruction(const TmpInstruction &TI)
21 : Instruction(TI.getType(), TI.getOpcode(), Ops, TI.getNumOperands()) {
22 if (TI.getNumOperands()) {
23 Ops[0].init(TI.Ops[0], this);
24 if (TI.getNumOperands() == 2)
25 Ops[1].init(TI.Ops[1], this);
27 assert(0 && "Bad # operands to TmpInstruction!");
31 TmpInstruction::TmpInstruction(Value *s1, Value *s2, const std::string &name)
32 : Instruction(s1->getType(), Instruction::UserOp1, Ops, 1+(s2 != 0), name) {
33 Ops[0].init(s1, this); // s1 must be non-null
35 Ops[1].init(s2, this);
37 // TmpInstructions should not be garbage checked.
38 LeakDetector::removeGarbageObject(this);
41 TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
42 Value *s1, Value *s2, const std::string &name)
43 : Instruction(s1->getType(), Instruction::UserOp1, Ops, 1+(s2 != 0), name) {
46 Ops[0].init(s1, this); // s1 must be non-null
48 Ops[1].init(s2, this);
50 // TmpInstructions should not be garbage checked.
51 LeakDetector::removeGarbageObject(this);
54 // Constructor that requires the type of the temporary to be specified.
55 // Both S1 and S2 may be NULL.
56 TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
57 const Type *Ty, Value *s1, Value* s2,
58 const std::string &name)
59 : Instruction(Ty, Instruction::UserOp1, Ops, (s1 != 0)+(s2 != 0), name) {
62 assert((s1 != 0 || s2 == 0) &&
63 "s2 cannot be non-null if s1 is non-null!");
65 Ops[0].init(s1, this);
67 Ops[1].init(s2, this);
70 // TmpInstructions should not be garbage checked.
71 LeakDetector::removeGarbageObject(this);