llvm-6502/lib/VMCore/iOperators.cpp
Chris Lattner 009505452b Initial revision
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2 91177308-0d34-0410-b5e6-96231b3b80d8
2001-06-06 20:29:01 +00:00

38 lines
1.2 KiB
C++

//===-- iBinaryOperators.cpp - Implement the BinaryOperators -----*- C++ -*--=//
//
// This file implements the nontrivial binary operator instructions.
//
//===----------------------------------------------------------------------===//
#include "llvm/iBinary.h"
#include "llvm/Type.h"
//===----------------------------------------------------------------------===//
// SetCondInst Class
//===----------------------------------------------------------------------===//
SetCondInst::SetCondInst(BinaryOps opType, Value *S1, Value *S2,
const string &Name)
: BinaryOperator(opType, S1, S2, Name) {
OpType = opType;
setType(Type::BoolTy); // setcc instructions always return bool type.
// Make sure it's a valid type...
assert(getOpcode() != "Invalid opcode type to SetCondInst class!");
}
string SetCondInst::getOpcode() const {
switch (OpType) {
case SetLE: return "setle";
case SetGE: return "setge";
case SetLT: return "setlt";
case SetGT: return "setgt";
case SetEQ: return "seteq";
case SetNE: return "setne";
default:
assert(0 && "Invalid opcode type to SetCondInst class!");
return "invalid opcode type to SetCondInst";
}
}