LLVM API Documentation
00001 //===-- SparcV9TmpInstr.h ---------------------------------------*- C++ -*-===// 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 // Definition of class for temporary intermediate values used within the current 00011 // SparcV9 backend. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef SPARCV9TMPINSTR_H 00016 #define SPARCV9TMPINSTR_H 00017 00018 #include "llvm/Instruction.h" 00019 #include "MachineCodeForInstruction.h" 00020 00021 namespace llvm { 00022 00023 /// TmpInstruction - This class represents temporary intermediate 00024 /// values used within the SparcV9 machine code for an LLVM instruction. 00025 /// 00026 class TmpInstruction : public Instruction { 00027 TmpInstruction(const TmpInstruction &TI) 00028 : Instruction(TI.getType(), TI.getOpcode()) { 00029 if (!TI.Operands.empty()) { 00030 Operands.push_back(Use(TI.Operands[0], this)); 00031 if (TI.Operands.size() == 2) 00032 Operands.push_back(Use(TI.Operands[1], this)); 00033 else 00034 assert(0 && "Bad # operands to TmpInstruction!"); 00035 } 00036 } 00037 public: 00038 // Constructor that uses the type of S1 as the type of the temporary. 00039 // s1 must be a valid value. s2 may be NULL. 00040 TmpInstruction(MachineCodeForInstruction &mcfi, 00041 Value *s1, Value *s2 = 0, const std::string &name = ""); 00042 00043 // Constructor that uses the type of S1 as the type of the temporary, 00044 // but does not require a MachineCodeForInstruction. 00045 // s1 must be a valid value. s2 may be NULL. 00046 TmpInstruction(Value *s1, Value *s2 = 0, const std::string &name = ""); 00047 00048 // Constructor that requires the type of the temporary to be specified. 00049 // Both S1 and S2 may be NULL. 00050 TmpInstruction(MachineCodeForInstruction& mcfi, 00051 const Type *Ty, Value *s1 = 0, Value* s2 = 0, 00052 const std::string &name = ""); 00053 00054 virtual Instruction *clone() const { 00055 assert(0 && "Cannot clone TmpInstructions!"); 00056 return 0; 00057 } 00058 virtual const char *getOpcodeName() const { return "TmpInstruction"; } 00059 00060 // Methods for support type inquiry through isa, cast, and dyn_cast: 00061 static inline bool classof(const TmpInstruction *) { return true; } 00062 static inline bool classof(const Instruction *I) { 00063 return (I->getOpcode() == Instruction::UserOp1); 00064 } 00065 static inline bool classof(const Value *V) { 00066 return isa<Instruction>(V) && classof(cast<Instruction>(V)); 00067 } 00068 }; 00069 00070 } // End llvm namespace 00071 00072 #endif