1 //===-- SparcV9TmpInstr.h ---------------------------------------*- C++ -*-===//
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 // Definition of class for temporary intermediate values used within the current
13 //===----------------------------------------------------------------------===//
15 #ifndef SPARCV9TMPINSTR_H
16 #define SPARCV9TMPINSTR_H
18 #include "llvm/Instruction.h"
19 #include "llvm/CodeGen/MachineCodeForInstruction.h"
23 /// TmpInstruction - This class represents temporary intermediate
24 /// values used within the SparcV9 machine code for an LLVM instruction.
26 class TmpInstruction : public Instruction {
27 TmpInstruction(const TmpInstruction &TI)
28 : Instruction(TI.getType(), TI.getOpcode()) {
29 if (!TI.Operands.empty()) {
30 Operands.push_back(Use(TI.Operands[0], this));
31 if (TI.Operands.size() == 2)
32 Operands.push_back(Use(TI.Operands[1], this));
34 assert(0 && "Bad # operands to TmpInstruction!");
38 // Constructor that uses the type of S1 as the type of the temporary.
39 // s1 must be a valid value. s2 may be NULL.
40 TmpInstruction(MachineCodeForInstruction &mcfi,
41 Value *s1, Value *s2 = 0, const std::string &name = "");
43 // Constructor that uses the type of S1 as the type of the temporary,
44 // but does not require a MachineCodeForInstruction.
45 // s1 must be a valid value. s2 may be NULL.
46 TmpInstruction(Value *s1, Value *s2 = 0, const std::string &name = "");
48 // Constructor that requires the type of the temporary to be specified.
49 // Both S1 and S2 may be NULL.
50 TmpInstruction(MachineCodeForInstruction& mcfi,
51 const Type *Ty, Value *s1 = 0, Value* s2 = 0,
52 const std::string &name = "");
54 virtual Instruction *clone() const {
55 assert(0 && "Cannot clone TmpInstructions!");
58 virtual const char *getOpcodeName() const { return "TmpInstruction"; }
60 // Methods for support type inquiry through isa, cast, and dyn_cast:
61 static inline bool classof(const TmpInstruction *) { return true; }
62 static inline bool classof(const Instruction *I) {
63 return (I->getOpcode() == Instruction::UserOp1);
65 static inline bool classof(const Value *V) {
66 return isa<Instruction>(V) && classof(cast<Instruction>(V));
70 } // End llvm namespace