diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-30 20:54:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-30 20:54:36 +0000 |
commit | 4d0e1f96f495439c1e244e9714484b3d4b60826d (patch) | |
tree | 9c81ae0ca7309e27673cb83dd4fe6372f3d0de29 /lib/ExecutionEngine | |
parent | 2b2e5b360e9509c97e312224c94077609e12d157 (diff) | |
download | external_llvm-4d0e1f96f495439c1e244e9714484b3d4b60826d.zip external_llvm-4d0e1f96f495439c1e244e9714484b3d4b60826d.tar.gz external_llvm-4d0e1f96f495439c1e244e9714484b3d4b60826d.tar.bz2 |
Implement xor operator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r-- | lib/ExecutionEngine/Interpreter/Execution.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index d7a60c7..069f2f2 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -332,6 +332,26 @@ static GenericValue executeRemInst(GenericValue Src1, GenericValue Src2, return Dest; } +static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2, + const Type *Ty, ExecutionContext &SF) { + GenericValue Dest; + switch (Ty->getPrimitiveID()) { + IMPLEMENT_BINARY_OPERATOR(^, UByte); + IMPLEMENT_BINARY_OPERATOR(^, SByte); + IMPLEMENT_BINARY_OPERATOR(^, UShort); + IMPLEMENT_BINARY_OPERATOR(^, Short); + IMPLEMENT_BINARY_OPERATOR(^, UInt); + IMPLEMENT_BINARY_OPERATOR(^, Int); + IMPLEMENT_BINARY_OPERATOR(^, ULong); + IMPLEMENT_BINARY_OPERATOR(^, Long); + IMPLEMENT_BINARY_OPERATOR(^, Pointer); + default: + cout << "Unhandled type for Xor instruction: " << Ty << endl; + } + return Dest; +} + + #define IMPLEMENT_SETCC(OP, TY) \ case Type::TY##TyID: Dest.BoolVal = Src1.TY##Val OP Src2.TY##Val; break @@ -473,6 +493,7 @@ static void executeBinaryInst(BinaryOperator *I, ExecutionContext &SF) { case Instruction::Mul: R = executeMulInst (Src1, Src2, Ty, SF); break; case Instruction::Div: R = executeDivInst (Src1, Src2, Ty, SF); break; case Instruction::Rem: R = executeRemInst (Src1, Src2, Ty, SF); break; + case Instruction::Xor: R = executeXorInst (Src1, Src2, Ty, SF); break; case Instruction::SetEQ: R = executeSetEQInst(Src1, Src2, Ty, SF); break; case Instruction::SetNE: R = executeSetNEInst(Src1, Src2, Ty, SF); break; case Instruction::SetLE: R = executeSetLEInst(Src1, Src2, Ty, SF); break; @@ -481,6 +502,7 @@ static void executeBinaryInst(BinaryOperator *I, ExecutionContext &SF) { case Instruction::SetGT: R = executeSetGTInst(Src1, Src2, Ty, SF); break; default: cout << "Don't know how to handle this binary operator!\n-->" << I; + R = Src1; } SetValue(I, R, SF); |