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