forked from OSchip/llvm-project
Added emulation of shifts to the IR interpreter.
<rdar://problem/12978619> llvm-svn: 172013
This commit is contained in:
parent
95b604b276
commit
087f437b60
|
@ -277,6 +277,8 @@ private:
|
|||
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);
|
||||
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);
|
||||
|
|
|
@ -1717,6 +1717,22 @@ lldb_private::operator^ (const Scalar& lhs, const Scalar& rhs)
|
|||
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
|
||||
|
|
|
@ -1042,17 +1042,23 @@ IRInterpreter::supportsFunction (Function &llvm_function,
|
|||
}
|
||||
}
|
||||
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 @@ IRInterpreter::runOnFunction (lldb::ClangExpressionVariableSP &result,
|
|||
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 @@ IRInterpreter::runOnFunction (lldb::ClangExpressionVariableSP &result,
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue