aboutsummaryrefslogtreecommitdiff
path: root/source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'source/Core')
-rw-r--r--source/Core/ArchSpec.cpp45
-rw-r--r--source/Core/RegisterValue.cpp57
2 files changed, 70 insertions, 32 deletions
diff --git a/source/Core/ArchSpec.cpp b/source/Core/ArchSpec.cpp
index 24aba81350a6..efdbf11d93e3 100644
--- a/source/Core/ArchSpec.cpp
+++ b/source/Core/ArchSpec.cpp
@@ -519,11 +519,46 @@ ArchSpec::IsMIPS() const
return false;
}
-std::string
-ArchSpec::GetClangTargetCPU ()
-{
- std::string cpu;
- const llvm::Triple::ArchType machine = GetMachine();
+
+std::string ArchSpec::GetTargetABI() const {
+
+ std::string abi;
+
+ if (IsMIPS()) {
+ switch (GetFlags() & ArchSpec::eMIPSABI_mask) {
+ case ArchSpec::eMIPSABI_N64:
+ abi = "n64";
+ return abi;
+ case ArchSpec::eMIPSABI_N32:
+ abi = "n32";
+ return abi;
+ case ArchSpec::eMIPSABI_O32:
+ abi = "o32";
+ return abi;
+ default:
+ return abi;
+ }
+ }
+ return abi;
+}
+
+void ArchSpec::SetFlags(std::string elf_abi) {
+
+ uint32_t flag = GetFlags();
+ if (IsMIPS()) {
+ if (elf_abi == "n64")
+ flag |= ArchSpec::eMIPSABI_N64;
+ else if (elf_abi == "n32")
+ flag |= ArchSpec::eMIPSABI_N32;
+ else if (elf_abi == "o32")
+ flag |= ArchSpec::eMIPSABI_O32;
+ }
+ SetFlags(flag);
+}
+
+std::string ArchSpec::GetClangTargetCPU() {
+ std::string cpu;
+ const llvm::Triple::ArchType machine = GetMachine();
if (machine == llvm::Triple::mips ||
machine == llvm::Triple::mipsel ||
diff --git a/source/Core/RegisterValue.cpp b/source/Core/RegisterValue.cpp
index d9085d7f0bae..d739dd6b5902 100644
--- a/source/Core/RegisterValue.cpp
+++ b/source/Core/RegisterValue.cpp
@@ -652,34 +652,37 @@ RegisterValue::GetAsUInt32 (uint32_t fail_value, bool *success_ptr) const
uint64_t
RegisterValue::GetAsUInt64 (uint64_t fail_value, bool *success_ptr) const
{
- if (success_ptr)
- *success_ptr = true;
- switch (m_type)
- {
- default: break;
- case eTypeUInt8:
- case eTypeUInt16:
- case eTypeUInt32:
- case eTypeUInt64:
- case eTypeFloat:
- case eTypeDouble:
- case eTypeLongDouble: return m_scalar.ULongLong(fail_value);
- case eTypeBytes:
- {
- switch (buffer.length)
- {
- default: break;
- case 1:
- case 2:
- case 4:
- case 8: return *(const uint64_t *)buffer.bytes;
- }
- }
- break;
+ if (success_ptr)
+ *success_ptr = true;
+ switch (m_type) {
+ default:
+ break;
+ case eTypeUInt8:
+ case eTypeUInt16:
+ case eTypeUInt32:
+ case eTypeUInt64:
+ case eTypeFloat:
+ case eTypeDouble:
+ case eTypeLongDouble:
+ return m_scalar.ULongLong(fail_value);
+ case eTypeBytes: {
+ switch (buffer.length) {
+ default:
+ break;
+ case 1:
+ return *(const uint8_t *)buffer.bytes;
+ case 2:
+ return *(const uint16_t *)buffer.bytes;
+ case 4:
+ return *(const uint32_t *)buffer.bytes;
+ case 8:
+ return *(const uint64_t *)buffer.bytes;
}
- if (success_ptr)
- *success_ptr = false;
- return fail_value;
+ } break;
+ }
+ if (success_ptr)
+ *success_ptr = false;
+ return fail_value;
}
llvm::APInt