[Lldb-commits] [lldb] r172013 - in /lldb/trunk: include/lldb/Core/Scalar.h source/Core/Scalar.cpp source/Expression/IRInterpreter.cpp
Sean Callanan
scallanan at apple.com
Wed Jan 9 14:44:41 PST 2013
Author: spyffe
Date: Wed Jan 9 16:44:41 2013
New Revision: 172013
URL: http://llvm.org/viewvc/llvm-project?rev=172013&view=rev
Log:
Added emulation of shifts to the IR interpreter.
<rdar://problem/12978619>
Modified:
lldb/trunk/include/lldb/Core/Scalar.h
lldb/trunk/source/Core/Scalar.cpp
lldb/trunk/source/Expression/IRInterpreter.cpp
Modified: lldb/trunk/include/lldb/Core/Scalar.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Scalar.h?rev=172013&r1=172012&r2=172013&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Scalar.h (original)
+++ lldb/trunk/include/lldb/Core/Scalar.h Wed Jan 9 16:44:41 2013
@@ -277,6 +277,8 @@
friend const Scalar operator| (const Scalar& lhs, const Scalar& rhs);
friend const Scalar operator% (const Scalar& lhs, const Scalar& rhs);
friend const Scalar operator^ (const Scalar& lhs, const Scalar& rhs);
+ friend const Scalar operator<< (const Scalar& lhs, const Scalar& rhs);
+ friend const Scalar operator>> (const Scalar& lhs, const Scalar& rhs);
friend bool operator== (const Scalar& lhs, const Scalar& rhs);
friend bool operator!= (const Scalar& lhs, const Scalar& rhs);
friend bool operator< (const Scalar& lhs, const Scalar& rhs);
@@ -309,6 +311,8 @@
const Scalar operator| (const Scalar& lhs, const Scalar& rhs);
const Scalar operator% (const Scalar& lhs, const Scalar& rhs);
const Scalar operator^ (const Scalar& lhs, const Scalar& rhs);
+const Scalar operator<< (const Scalar& lhs, const Scalar& rhs);
+const Scalar operator>> (const Scalar& lhs, const Scalar& rhs);
bool operator== (const Scalar& lhs, const Scalar& rhs);
bool operator!= (const Scalar& lhs, const Scalar& rhs);
bool operator< (const Scalar& lhs, const Scalar& rhs);
Modified: lldb/trunk/source/Core/Scalar.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Scalar.cpp?rev=172013&r1=172012&r2=172013&view=diff
==============================================================================
--- lldb/trunk/source/Core/Scalar.cpp (original)
+++ lldb/trunk/source/Core/Scalar.cpp Wed Jan 9 16:44:41 2013
@@ -1717,6 +1717,22 @@
return result;
}
+const Scalar
+lldb_private::operator<< (const Scalar& lhs, const Scalar &rhs)
+{
+ Scalar result = lhs;
+ result <<= rhs;
+ return result;
+}
+
+const Scalar
+lldb_private::operator>> (const Scalar& lhs, const Scalar &rhs)
+{
+ Scalar result = lhs;
+ result >>= rhs;
+ return result;
+}
+
// Return the raw unsigned integer without any casting or conversion
unsigned int
Scalar::RawUInt () const
Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=172013&r1=172012&r2=172013&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Wed Jan 9 16:44:41 2013
@@ -1042,17 +1042,23 @@
}
}
break;
+ case Instruction::And:
+ case Instruction::AShr:
case Instruction::IntToPtr:
case Instruction::PtrToInt:
case Instruction::Load:
+ case Instruction::LShr:
case Instruction::Mul:
+ case Instruction::Or:
case Instruction::Ret:
case Instruction::SDiv:
+ case Instruction::Shl:
case Instruction::SRem:
case Instruction::Store:
case Instruction::Sub:
case Instruction::UDiv:
case Instruction::URem:
+ case Instruction::Xor:
case Instruction::ZExt:
break;
}
@@ -1139,6 +1145,12 @@
case Instruction::UDiv:
case Instruction::SRem:
case Instruction::URem:
+ case Instruction::Shl:
+ case Instruction::LShr:
+ case Instruction::AShr:
+ case Instruction::And:
+ case Instruction::Or:
+ case Instruction::Xor:
{
const BinaryOperator *bin_op = dyn_cast<BinaryOperator>(inst);
@@ -1202,6 +1214,25 @@
case Instruction::URem:
result = L.GetRawBits64(0) % R.GetRawBits64(1);
break;
+ case Instruction::Shl:
+ result = L << R;
+ break;
+ case Instruction::AShr:
+ result = L >> R;
+ break;
+ case Instruction::LShr:
+ result = L;
+ result.ShiftRightLogical(R);
+ break;
+ case Instruction::And:
+ result = L & R;
+ break;
+ case Instruction::Or:
+ result = L | R;
+ break;
+ case Instruction::Xor:
+ result = L ^ R;
+ break;
}
frame.AssignValue(inst, result, llvm_module);
More information about the lldb-commits
mailing list