diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
commit | 94994d372d014ce4c8758b9605d63fae651bd8aa (patch) | |
tree | 51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /source/Expression/IRInterpreter.cpp | |
parent | 39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff) |
Notes
Diffstat (limited to 'source/Expression/IRInterpreter.cpp')
-rw-r--r-- | source/Expression/IRInterpreter.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/source/Expression/IRInterpreter.cpp b/source/Expression/IRInterpreter.cpp index abf86b739f07..457eaef46dd3 100644 --- a/source/Expression/IRInterpreter.cpp +++ b/source/Expression/IRInterpreter.cpp @@ -10,7 +10,6 @@ #include "lldb/Expression/IRInterpreter.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" -#include "lldb/Core/Scalar.h" #include "lldb/Core/ValueObject.h" #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/IRExecutionUnit.h" @@ -19,6 +18,7 @@ #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -152,17 +152,13 @@ public: Type *type) { size_t type_size = m_target_data.getTypeStoreSize(type); - switch (type_size) { - case 1: - case 2: - case 4: - case 8: - scalar = llvm::APInt(type_size*8, u64value); - break; - default: + if (type_size > 8) return false; - } + if (type_size != 1) + type_size = PowerOf2Ceil(type_size); + + scalar = llvm::APInt(type_size*8, u64value); return true; } @@ -192,8 +188,7 @@ public: return false; lldb::offset_t offset = 0; - if (value_size == 1 || value_size == 2 || value_size == 4 || - value_size == 8) { + if (value_size <= 8) { uint64_t u64value = value_extractor.GetMaxU64(&offset, value_size); return AssignToMatchType(scalar, u64value, value->getType()); } @@ -618,6 +613,18 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function, } } + // The IR interpreter currently doesn't know about + // 128-bit integers. As they're not that frequent, + // we can just fall back to the JIT rather than + // choking. + if (operand_type->getPrimitiveSizeInBits() > 64) { + if (log) + log->Printf("Unsupported operand type: %s", + PrintType(operand_type).c_str()); + error.SetErrorString(unsupported_operand_error); + return false; + } + if (Constant *constant = llvm::dyn_cast<Constant>(operand)) { if (!CanResolveConstant(constant)) { if (log) @@ -1585,9 +1592,6 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, // Check if this is a string literal or constant string pointer if (arg_ty->isPointerTy()) { - // Pointer to just one type - assert(arg_ty->getNumContainedTypes() == 1); - lldb::addr_t addr = tmp_op.ULongLong(); size_t dataSize = 0; |