Add completely untested support for mtcrf/mfcrf encoding
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9TmpInstr.h
1 //===-- SparcV9TmpInstr.h ---------------------------------------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
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.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // Definition of class for temporary intermediate values used within the current
11 // SparcV9 backend.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef SPARCV9TMPINSTR_H
16 #define SPARCV9TMPINSTR_H
17
18 #include "llvm/Instruction.h"
19 #include "MachineCodeForInstruction.h"
20
21 namespace llvm {
22
23 /// TmpInstruction - This class represents temporary intermediate
24 /// values used within the SparcV9 machine code for an LLVM instruction.
25 /// 
26 class TmpInstruction : public Instruction {
27   Use Ops[2];
28   TmpInstruction(const TmpInstruction &TI);
29 public:
30   // Constructor that uses the type of S1 as the type of the temporary.
31   // s1 must be a valid value.  s2 may be NULL.
32   TmpInstruction(MachineCodeForInstruction &mcfi,
33                  Value *s1, Value *s2 = 0, const std::string &name = "");
34                  
35   // Constructor that uses the type of S1 as the type of the temporary,
36   // but does not require a MachineCodeForInstruction.
37   // s1 must be a valid value.  s2 may be NULL.
38   TmpInstruction(Value *s1, Value *s2 = 0, const std::string &name = "");
39
40   // Constructor that requires the type of the temporary to be specified.
41   // Both S1 and S2 may be NULL.
42   TmpInstruction(MachineCodeForInstruction& mcfi,
43                  const Type *Ty, Value *s1 = 0, Value* s2 = 0,
44                  const std::string &name = "");
45   
46   virtual Instruction *clone() const {
47     assert(0 && "Cannot clone TmpInstructions!");
48     return 0;
49   }
50   virtual const char *getOpcodeName() const { return "TmpInstruction"; }
51   
52   // Methods for support type inquiry through isa, cast, and dyn_cast:
53   static inline bool classof(const TmpInstruction *) { return true; }
54   static inline bool classof(const Instruction *I) {
55     return (I->getOpcode() == Instruction::UserOp1);
56   }
57   static inline bool classof(const Value *V) {
58     return isa<Instruction>(V) && classof(cast<Instruction>(V));
59   }
60 };
61
62 } // End llvm namespace
63
64 #endif