LLVM API Documentation
00001 //===- SparcV9TmpInstr.cpp - SparcV9 Intermediate Value class -------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // Methods of class for temporary intermediate values used within the current 00011 // SparcV9 backend. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #include "SparcV9TmpInstr.h" 00016 #include "llvm/Type.h" 00017 #include "llvm/Support/LeakDetector.h" 00018 using namespace llvm; 00019 00020 TmpInstruction::TmpInstruction(const TmpInstruction &TI) 00021 : Instruction(TI.getType(), TI.getOpcode(), Ops, TI.getNumOperands()) { 00022 if (TI.getNumOperands()) { 00023 Ops[0].init(TI.Ops[0], this); 00024 if (TI.getNumOperands() == 2) 00025 Ops[1].init(TI.Ops[1], this); 00026 else 00027 assert(0 && "Bad # operands to TmpInstruction!"); 00028 } 00029 } 00030 00031 TmpInstruction::TmpInstruction(Value *s1, Value *s2, const std::string &name) 00032 : Instruction(s1->getType(), Instruction::UserOp1, Ops, 1+(s2 != 0), name) { 00033 Ops[0].init(s1, this); // s1 must be non-null 00034 if (s2) 00035 Ops[1].init(s2, this); 00036 00037 // TmpInstructions should not be garbage checked. 00038 LeakDetector::removeGarbageObject(this); 00039 } 00040 00041 TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi, 00042 Value *s1, Value *s2, const std::string &name) 00043 : Instruction(s1->getType(), Instruction::UserOp1, Ops, 1+(s2 != 0), name) { 00044 mcfi.addTemp(this); 00045 00046 Ops[0].init(s1, this); // s1 must be non-null 00047 if (s2) 00048 Ops[1].init(s2, this); 00049 00050 // TmpInstructions should not be garbage checked. 00051 LeakDetector::removeGarbageObject(this); 00052 } 00053 00054 // Constructor that requires the type of the temporary to be specified. 00055 // Both S1 and S2 may be NULL. 00056 TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi, 00057 const Type *Ty, Value *s1, Value* s2, 00058 const std::string &name) 00059 : Instruction(Ty, Instruction::UserOp1, Ops, (s1 != 0)+(s2 != 0), name) { 00060 mcfi.addTemp(this); 00061 00062 assert((s1 != 0 || s2 == 0) && 00063 "s2 cannot be non-null if s1 is non-null!"); 00064 if (s1) { 00065 Ops[0].init(s1, this); 00066 if (s2) 00067 Ops[1].init(s2, this); 00068 } 00069 00070 // TmpInstructions should not be garbage checked. 00071 LeakDetector::removeGarbageObject(this); 00072 }