1 //===-- llvm/iOperators.h - Binary Operator node definitions ----*- C++ -*-===//
3 // This file contains the declarations of the Binary Operator classes.
5 //===----------------------------------------------------------------------===//
7 #ifndef LLVM_IOPERATORS_H
8 #define LLVM_IOPERATORS_H
10 #include "llvm/InstrTypes.h"
12 /// SetCondInst class - Represent a setCC operator, where CC is eq, ne, lt, gt,
15 class SetCondInst : public BinaryOperator {
18 SetCondInst(BinaryOps Opcode, Value *LHS, Value *RHS,
19 const std::string &Name = "", Instruction *InsertBefore = 0);
21 /// getInverseCondition - Return the inverse of the current condition opcode.
22 /// For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
24 BinaryOps getInverseCondition() const {
25 return getInverseCondition(getOpcode());
28 /// getInverseCondition - Static version that you can use without an
29 /// instruction available.
31 static BinaryOps getInverseCondition(BinaryOps Opcode);
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.
37 BinaryOps getSwappedCondition() const {
38 return getSwappedCondition(getOpcode());
41 /// getSwappedCondition - Static version that you can use without an
42 /// instruction available.
44 static BinaryOps getSwappedCondition(BinaryOps Opcode);
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;
54 static inline bool classof(const Value *V) {
55 return isa<Instruction>(V) && classof(cast<Instruction>(V));