Added class MachineOptInfo as interface to target-specific
[oota-llvm.git] / include / llvm / iOperators.h
1 //===-- llvm/iOperators.h - Binary Operator node definitions ----*- C++ -*-===//
2 //
3 // This file contains the declarations of the Binary Operator classes.
4 //
5 //===----------------------------------------------------------------------===//
6
7 #ifndef LLVM_IOPERATORS_H
8 #define LLVM_IOPERATORS_H
9
10 #include "llvm/InstrTypes.h"
11
12 /// SetCondInst class - Represent a setCC operator, where CC is eq, ne, lt, gt,
13 /// le, or ge.
14 ///
15 class SetCondInst : public BinaryOperator {
16   BinaryOps OpType;
17 public:
18   SetCondInst(BinaryOps Opcode, Value *LHS, Value *RHS,
19               const std::string &Name = "", Instruction *InsertBefore = 0);
20
21   /// getInverseCondition - Return the inverse of the current condition opcode.
22   /// For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
23   ///
24   BinaryOps getInverseCondition() const {
25     return getInverseCondition(getOpcode());
26   }
27
28   /// getInverseCondition - Static version that you can use without an
29   /// instruction available.
30   ///
31   static BinaryOps getInverseCondition(BinaryOps Opcode);
32
33   /// getSwappedCondition - Return the condition opcode that would be the result
34   /// of exchanging the two operands of the setcc instruction without changing
35   /// the result produced.  Thus, seteq->seteq, setle->setge, setlt->setgt, etc.
36   ///
37   BinaryOps getSwappedCondition() const {
38     return getSwappedCondition(getOpcode());
39   }
40
41   /// getSwappedCondition - Static version that you can use without an
42   /// instruction available.
43   ///
44   static BinaryOps getSwappedCondition(BinaryOps Opcode);
45
46
47   // Methods for support type inquiry through isa, cast, and dyn_cast:
48   static inline bool classof(const SetCondInst *) { return true; }
49   static inline bool classof(const Instruction *I) {
50     return I->getOpcode() == SetEQ || I->getOpcode() == SetNE ||
51            I->getOpcode() == SetLE || I->getOpcode() == SetGE ||
52            I->getOpcode() == SetLT || I->getOpcode() == SetGT;
53   }
54   static inline bool classof(const Value *V) {
55     return isa<Instruction>(V) && classof(cast<Instruction>(V));
56   }
57 };
58
59 #endif