blob: a2f883cec661e34c054f6d565722c4b1e0a31f43 [file] [log] [blame]
Brian Gaekeb3e3c532004-08-04 07:29:04 +00001//===-- 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"
Chris Lattner9fb30a42004-08-16 21:55:02 +000019#include "MachineCodeForInstruction.h"
Brian Gaekeb3e3c532004-08-04 07:29:04 +000020
21namespace llvm {
22
23/// TmpInstruction - This class represents temporary intermediate
24/// values used within the SparcV9 machine code for an LLVM instruction.
25///
26class TmpInstruction : public Instruction {
Chris Lattner3479f9c2005-01-29 00:36:59 +000027 Use Ops[2];
28 TmpInstruction(const TmpInstruction &TI);
Brian Gaekeb3e3c532004-08-04 07:29:04 +000029public:
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