summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/IRInterpreter.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-12-01 00:09:34 +0000
committerSean Callanan <scallanan@apple.com>2012-12-01 00:09:34 +0000
commit2abffe0530f156f6cde7a04f73e1bcdb6f71a127 (patch)
tree15ce9d107d033c6cfc2d667f4083e877364e5431 /lldb/source/Expression/IRInterpreter.cpp
parent70385081c91c9de927e3f0e5708097c0951cc080 (diff)
downloadbcm5719-llvm-2abffe0530f156f6cde7a04f73e1bcdb6f71a127.tar.gz
bcm5719-llvm-2abffe0530f156f6cde7a04f73e1bcdb6f71a127.zip
Added support for PtrToInt to the IR
interpreter. <rdar://problem/12657742> llvm-svn: 169063
Diffstat (limited to 'lldb/source/Expression/IRInterpreter.cpp')
-rw-r--r--lldb/source/Expression/IRInterpreter.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp
index b30b066a137..64d5dc6a634 100644
--- a/lldb/source/Expression/IRInterpreter.cpp
+++ b/lldb/source/Expression/IRInterpreter.cpp
@@ -558,6 +558,7 @@ public:
default:
return false;
case Instruction::IntToPtr:
+ case Instruction::PtrToInt:
case Instruction::BitCast:
return ResolveConstantValue(value, constant_expr->getOperand(0));
case Instruction::GetElementPtr:
@@ -991,6 +992,7 @@ IRInterpreter::supportsFunction (Function &llvm_function,
}
break;
case Instruction::IntToPtr:
+ case Instruction::PtrToInt:
case Instruction::Load:
case Instruction::Mul:
case Instruction::Ret:
@@ -1506,6 +1508,42 @@ IRInterpreter::runOnFunction (lldb::ClangExpressionVariableSP &result,
}
}
break;
+ case Instruction::PtrToInt:
+ {
+ const PtrToIntInst *ptr_to_int_inst = dyn_cast<PtrToIntInst>(inst);
+
+ if (!ptr_to_int_inst)
+ {
+ if (log)
+ log->Printf("getOpcode() returns PtrToInt, but instruction is not an PtrToIntInst");
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
+ return false;
+ }
+
+ Value *src_operand = ptr_to_int_inst->getOperand(0);
+
+ lldb_private::Scalar I;
+
+ if (!frame.EvaluateValue(I, src_operand, llvm_module))
+ {
+ if (log)
+ log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
+ return false;
+ }
+
+ frame.AssignValue(inst, I, llvm_module);
+
+ if (log)
+ {
+ log->Printf("Interpreted a PtrToInt");
+ 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);
OpenPOWER on IntegriCloud