diff options
author | Chris Lattner <sabre@nondot.org> | 2001-06-06 20:29:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-06-06 20:29:01 +0000 |
commit | 009505452b713ed2e3a8e99c5545a6e721c65495 (patch) | |
tree | 136a71c5b87bdf534d1f20a67558b49226b5a4d6 /lib/VMCore/iOperators.cpp | |
parent | 8d0afd3d32d1d67f9aa5df250a1d6955aa8f1ac9 (diff) | |
download | external_llvm-009505452b713ed2e3a8e99c5545a6e721c65495.zip external_llvm-009505452b713ed2e3a8e99c5545a6e721c65495.tar.gz external_llvm-009505452b713ed2e3a8e99c5545a6e721c65495.tar.bz2 |
Initial revision
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/iOperators.cpp')
-rw-r--r-- | lib/VMCore/iOperators.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/VMCore/iOperators.cpp b/lib/VMCore/iOperators.cpp new file mode 100644 index 0000000..c754f42 --- /dev/null +++ b/lib/VMCore/iOperators.cpp @@ -0,0 +1,37 @@ +//===-- 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"; + } +} |