diff options
author | Sean Callanan <scallanan@apple.com> | 2013-10-11 19:45:00 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2013-10-11 19:45:00 +0000 |
commit | 8c46baca65347ec1334bde704a15242e2738d937 (patch) | |
tree | d07ea17323177a3021e05b4abb1f7bc8504acc90 /lldb/source/Expression/IRInterpreter.cpp | |
parent | 00dec20f7d8aed5cb2d136b22ccfc2f6702d9310 (diff) | |
download | bcm5719-llvm-8c46baca65347ec1334bde704a15242e2738d937.tar.gz bcm5719-llvm-8c46baca65347ec1334bde704a15242e2738d937.zip |
Implemented TruncInst in the IRInterpreter.
<rdar://problem/15188389>
llvm-svn: 192489
Diffstat (limited to 'lldb/source/Expression/IRInterpreter.cpp')
-rw-r--r-- | lldb/source/Expression/IRInterpreter.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index c8da6a68c6a..71ef8d6457b 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -524,6 +524,7 @@ IRInterpreter::CanInterpret (llvm::Module &module, case Instruction::SRem: case Instruction::Store: case Instruction::Sub: + case Instruction::Trunc: case Instruction::UDiv: case Instruction::URem: case Instruction::Xor: @@ -1169,6 +1170,42 @@ IRInterpreter::Interpret (llvm::Module &module, } } break; + case Instruction::Trunc: + { + const TruncInst *trunc_inst = dyn_cast<TruncInst>(inst); + + if (!trunc_inst) + { + if (log) + log->Printf("getOpcode() returns Trunc, but instruction is not a TruncInst"); + error.SetErrorToGenericError(); + error.SetErrorString(interpreter_internal_error); + return false; + } + + Value *src_operand = trunc_inst->getOperand(0); + + lldb_private::Scalar I; + + if (!frame.EvaluateValue(I, src_operand, module)) + { + if (log) + log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str()); + error.SetErrorToGenericError(); + error.SetErrorString(bad_value_error); + return false; + } + + frame.AssignValue(inst, I, module); + + if (log) + { + log->Printf("Interpreted a Trunc"); + log->Printf(" Src : %s", frame.SummarizeValue(src_operand).c_str()); + log->Printf(" = : %s", frame.SummarizeValue(inst).c_str()); + } + } + break; case Instruction::Load: { const LoadInst *load_inst = dyn_cast<LoadInst>(inst); |