summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2016-05-20 13:07:16 +0000
committerTamas Berghammer <tberghammer@google.com>2016-05-20 13:07:16 +0000
commit216963a723b45f88723863796a6255a4868d4ff9 (patch)
tree9cec4879536f3f453c668757f523a7ee7de3c1a4
parent57b8b1f75f9b39076ddd74a6a28a83055ff498ca (diff)
downloadbcm5719-llvm-216963a723b45f88723863796a6255a4868d4ff9.tar.gz
bcm5719-llvm-216963a723b45f88723863796a6255a4868d4ff9.zip
Revert rL270207: "[LLDB][MIPS] Fix floating point handling in case of thread step-out"
The CL causes a build breakage on platforms where sizeof(double) == sizeof(long double) and it incorrectly assumes that sizeof(double) and sizeof(long double) is the same on the host and the target. llvm-svn: 270214
-rw-r--r--lldb/include/lldb/Core/ArchSpec.h14
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp121
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h3
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp90
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h3
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp36
6 files changed, 38 insertions, 229 deletions
diff --git a/lldb/include/lldb/Core/ArchSpec.h b/lldb/include/lldb/Core/ArchSpec.h
index be760637c03..012372de2a4 100644
--- a/lldb/include/lldb/Core/ArchSpec.h
+++ b/lldb/include/lldb/Core/ArchSpec.h
@@ -75,20 +75,6 @@ public:
eMIPSABI_mask = 0x000ff000
};
- // MIPS Floating point ABI Values
- enum MIPS_ABI_FP
- {
- eMIPS_ABI_FP_ANY = 0x00000000,
- eMIPS_ABI_FP_DOUBLE = 0x00100000, // hard float / -mdouble-float
- eMIPS_ABI_FP_SINGLE = 0x00200000, // hard float / -msingle-float
- eMIPS_ABI_FP_SOFT = 0x00300000, // soft float
- eMIPS_ABI_FP_OLD_64 = 0x00400000, // -mips32r2 -mfp64
- eMIPS_ABI_FP_XX = 0x00500000, // -mfpxx
- eMIPS_ABI_FP_64 = 0x00600000, // -mips32r2 -mfp64
- eMIPS_ABI_FP_64A = 0x00700000, // -mips32r2 -mfp64 -mno-odd-spreg
- eMIPS_ABI_FP_mask = 0x00700000
- };
-
// ARM specific e_flags
enum ARMeflags
{
diff --git a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
index 52df7d97117..86d70641008 100644
--- a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
+++ b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
@@ -397,11 +397,7 @@ ABISysV_mips::GetReturnValueObjectImpl (Thread &thread, CompilerType &return_com
if (exe_ctx.GetTargetPtr() == nullptr || exe_ctx.GetProcessPtr() == nullptr)
return return_valobj_sp;
- Target *target = exe_ctx.GetTargetPtr();
- const ArchSpec target_arch = target->GetArchitecture();
- ByteOrder target_byte_order = target_arch.GetByteOrder();
value.SetCompilerType(return_compiler_type);
- uint32_t fp_flag = target_arch.GetFlags() & lldb_private::ArchSpec::eMIPS_ABI_FP_mask;
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
if (!reg_ctx)
@@ -413,7 +409,8 @@ ABISysV_mips::GetReturnValueObjectImpl (Thread &thread, CompilerType &return_com
// In MIPS register "r2" (v0) holds the integer function return values
const RegisterInfo *r2_reg_info = reg_ctx->GetRegisterInfoByName("r2", 0);
- size_t bit_width = return_compiler_type.GetBitSize(&thread);
+ size_t bit_width = return_compiler_type.GetBitSize(&thread);
+
if (return_compiler_type.IsIntegerType (is_signed))
{
switch (bit_width)
@@ -470,107 +467,37 @@ ABISysV_mips::GetReturnValueObjectImpl (Thread &thread, CompilerType &return_com
}
else if (return_compiler_type.IsFloatingPointType (count, is_complex))
{
- if (IsSoftFloat (fp_flag))
+ const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
+ const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
+
+ if (count == 1 && !is_complex)
{
- uint64_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r2_reg_info, 0);
- if (count != 1 && is_complex)
- return return_valobj_sp;
switch (bit_width)
{
default:
return return_valobj_sp;
- case 32:
- static_assert(sizeof(float) == sizeof(uint32_t), "");
- value.GetScalar() = *((float *)(&raw_value));
- break;
case 64:
+ {
static_assert(sizeof(double) == sizeof(uint64_t), "");
- const RegisterInfo *r3_reg_info = reg_ctx->GetRegisterInfoByName("r3", 0);
- if (target_byte_order == eByteOrderLittle)
- raw_value = ((reg_ctx->ReadRegisterAsUnsigned(r3_reg_info, 0)) << 32) | raw_value;
- else
- raw_value = (raw_value << 32) | reg_ctx->ReadRegisterAsUnsigned(r3_reg_info, 0);
- value.GetScalar() = *((double *)(&raw_value));
+ uint64_t raw_value;
+ raw_value = reg_ctx->ReadRegisterAsUnsigned(f0_info, 0) & UINT32_MAX;
+ raw_value |= ((uint64_t)(reg_ctx->ReadRegisterAsUnsigned(f1_info, 0) & UINT32_MAX)) << 32;
+ value.GetScalar() = *reinterpret_cast<double*>(&raw_value);
break;
+ }
+ case 32:
+ {
+ static_assert(sizeof(float) == sizeof(uint32_t), "");
+ uint32_t raw_value = reg_ctx->ReadRegisterAsUnsigned(f0_info, 0) & UINT32_MAX;
+ value.GetScalar() = *reinterpret_cast<float*>(&raw_value);
+ break;
+ }
}
}
-
else
{
- const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
- RegisterValue f0_value;
- DataExtractor f0_data;
- reg_ctx->ReadRegister (f0_info, f0_value);
- f0_value.GetData(f0_data);
- lldb::offset_t offset = 0;
-
- if (count == 1 && !is_complex)
- {
- switch (bit_width)
- {
- default:
- return return_valobj_sp;
- case 64:
- {
- static_assert(sizeof(double) == sizeof(uint64_t), "");
- const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
- RegisterValue f1_value;
- DataExtractor f1_data;
- reg_ctx->ReadRegister (f1_info, f1_value);
- DataExtractor *copy_from_extractor = nullptr;
- DataBufferSP data_sp (new DataBufferHeap(8, 0));
- DataExtractor return_ext (data_sp,
- target_byte_order,
- target->GetArchitecture().GetAddressByteSize());
-
- if (target_byte_order == eByteOrderLittle)
- {
- copy_from_extractor = &f0_data;
- copy_from_extractor->CopyByteOrderedData (offset,
- 4,
- data_sp->GetBytes(),
- 4,
- target_byte_order);
- f1_value.GetData(f1_data);
- copy_from_extractor = &f1_data;
- copy_from_extractor->CopyByteOrderedData (offset,
- 4,
- data_sp->GetBytes() + 4,
- 4,
- target_byte_order);
- }
- else
- {
- copy_from_extractor = &f0_data;
- copy_from_extractor->CopyByteOrderedData (offset,
- 4,
- data_sp->GetBytes() + 4,
- 4,
- target_byte_order);
- f1_value.GetData(f1_data);
- copy_from_extractor = &f1_data;
- copy_from_extractor->CopyByteOrderedData (offset,
- 4,
- data_sp->GetBytes(),
- 4,
- target_byte_order);
- }
- value.GetScalar() = (double) return_ext.GetDouble(&offset);
- break;
- }
- case 32:
- {
- static_assert(sizeof(float) == sizeof(uint32_t), "");
- value.GetScalar() = (float) f0_data.GetFloat(&offset);
- break;
- }
- }
- }
- else
- {
- // not handled yet
- return return_valobj_sp;
- }
+ // not handled yet
+ return return_valobj_sp;
}
}
else
@@ -636,12 +563,6 @@ ABISysV_mips::RegisterIsVolatile (const RegisterInfo *reg_info)
}
bool
-ABISysV_mips::IsSoftFloat(uint32_t fp_flags) const
-{
- return (fp_flags == lldb_private::ArchSpec::eMIPS_ABI_FP_SOFT);
-}
-
-bool
ABISysV_mips::RegisterIsCalleeSaved (const RegisterInfo *reg_info)
{
if (reg_info)
diff --git a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
index 388009d0fa0..709c3bfe3ad 100644
--- a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
+++ b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
@@ -54,9 +54,6 @@ public:
RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
bool
- IsSoftFloat(uint32_t fp_flag) const;
-
- bool
CallFrameAddressIsValid(lldb::addr_t cfa) override
{
// Make sure the stack call frame addresses are 8 byte aligned
diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
index 81601b348d0..707467143b4 100644
--- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
@@ -372,11 +372,9 @@ ABISysV_mips64::GetReturnValueObjectImpl (Thread &thread, CompilerType &return_c
return return_valobj_sp;
Target *target = exe_ctx.GetTargetPtr();
- const ArchSpec target_arch = target->GetArchitecture();
- ByteOrder target_byte_order = target_arch.GetByteOrder();
+ ByteOrder target_byte_order = target->GetArchitecture().GetByteOrder();
const size_t byte_size = return_compiler_type.GetByteSize(nullptr);
const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr);
- uint32_t fp_flag = target_arch.GetFlags () & lldb_private::ArchSpec::eMIPS_ABI_FP_mask;
const RegisterInfo *r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
const RegisterInfo *r3_info = reg_ctx->GetRegisterInfoByName("r3", 0);
@@ -440,52 +438,20 @@ ABISysV_mips64::GetReturnValueObjectImpl (Thread &thread, CompilerType &return_c
{
// Don't handle complex yet.
}
- else if (IsSoftFloat(fp_flag))
- {
- uint64_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r2_info, 0);
- switch (byte_size)
- {
- case sizeof(float):
- value.GetScalar() = *((float *)(&raw_value));
- success = true;
- break;
- case sizeof(double):
- value.GetScalar() = *((double *)(&raw_value));
- success = true;
- break;
- case sizeof(long double):
- uint64_t result[2];
- if (target_byte_order == eByteOrderLittle)
- {
- result[0] = raw_value;
- result[1] = reg_ctx->ReadRegisterAsUnsigned(r3_info, 0);
- value.GetScalar() = *((long double *)(result));
- }
- else
- {
- result[0] = reg_ctx->ReadRegisterAsUnsigned(r3_info, 0);
- result[1] = raw_value;
- value.GetScalar() = *((long double *)(result));
- }
- success = true;
- break;
- }
-
- }
else
{
if (byte_size <= sizeof(long double))
{
const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
-
- RegisterValue f0_value;
- DataExtractor f0_data;
+ const RegisterInfo *f2_info = reg_ctx->GetRegisterInfoByName("f2", 0);
+ RegisterValue f0_value, f2_value;
+ DataExtractor f0_data, f2_data;
reg_ctx->ReadRegister (f0_info, f0_value);
-
+ reg_ctx->ReadRegister (f2_info, f2_value);
f0_value.GetData(f0_data);
-
+ f2_value.GetData(f2_data);
lldb::offset_t offset = 0;
if (byte_size == sizeof(float))
@@ -500,10 +466,6 @@ ABISysV_mips64::GetReturnValueObjectImpl (Thread &thread, CompilerType &return_c
}
else if (byte_size == sizeof(long double))
{
- const RegisterInfo *f2_info = reg_ctx->GetRegisterInfoByName("f2", 0);
- RegisterValue f2_value;
- DataExtractor f2_data;
- reg_ctx->ReadRegister (f2_info, f2_value);
DataExtractor *copy_from_extractor = nullptr;
DataBufferSP data_sp (new DataBufferHeap(16, 0));
DataExtractor return_ext (data_sp,
@@ -512,37 +474,21 @@ ABISysV_mips64::GetReturnValueObjectImpl (Thread &thread, CompilerType &return_c
if (target_byte_order == eByteOrderLittle)
{
+ f0_data.Append(f2_data);
copy_from_extractor = &f0_data;
- copy_from_extractor->CopyByteOrderedData (0,
- 8,
- data_sp->GetBytes(),
- byte_size - 8,
- target_byte_order);
- f2_value.GetData(f2_data);
- copy_from_extractor = &f2_data;
- copy_from_extractor->CopyByteOrderedData (0,
- 8,
- data_sp->GetBytes() + 8,
- byte_size - 8,
- target_byte_order);
}
else
{
- copy_from_extractor = &f0_data;
- copy_from_extractor->CopyByteOrderedData (0,
- 8,
- data_sp->GetBytes() + 8,
- byte_size - 8,
- target_byte_order);
- f2_value.GetData(f2_data);
- copy_from_extractor = &f2_data;
- copy_from_extractor->CopyByteOrderedData (0,
- 8,
- data_sp->GetBytes(),
- byte_size - 8,
- target_byte_order);
+ f2_data.Append(f0_data);
+ copy_from_extractor = &f2_data;
}
+ copy_from_extractor->CopyByteOrderedData (0,
+ byte_size,
+ data_sp->GetBytes(),
+ byte_size,
+ target_byte_order);
+
return_valobj_sp = ValueObjectConstResult::Create (&thread,
return_compiler_type,
ConstString(""),
@@ -834,12 +780,6 @@ ABISysV_mips64::RegisterIsVolatile (const RegisterInfo *reg_info)
}
bool
-ABISysV_mips64::IsSoftFloat (uint32_t fp_flag) const
-{
- return (fp_flag == lldb_private::ArchSpec::eMIPS_ABI_FP_SOFT);
-}
-
-bool
ABISysV_mips64::RegisterIsCalleeSaved (const RegisterInfo *reg_info)
{
if (reg_info)
diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
index 9f1ea0922db..3290331e05a 100644
--- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
+++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
@@ -53,9 +53,6 @@ public:
bool
RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
- bool
- IsSoftFloat(uint32_t fp_flag) const;
-
// The SysV mips ABI requires that stack frames be 16 byte aligned.
// When there is a trap handler on the stack, e.g. _sigtramp in userland
// code, we've seen that the stack pointer is often not aligned properly
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 383cbb1bfe7..7f963c9f3f9 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -33,7 +33,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/MathExtras.h"
-#include "llvm/Support/MipsABIFlags.h"
#define CASE_AND_STREAM(s, def, width) \
case def: s->Printf("%-*s", width, #def); break;
@@ -1707,39 +1706,8 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
if (section_size && (set_data (data, sheader.sh_offset, section_size) == section_size))
{
- // MIPS ASE Mask is at offset 12 in MIPS.abiflags section
- lldb::offset_t offset = 12; // MIPS ABI Flags Version: 0
- arch_flags |= data.GetU32 (&offset);
-
- // The floating point ABI is at offset 7
- offset = 7;
- switch (data.GetU8 (&offset))
- {
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_ANY :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_ANY;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_DOUBLE :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_DOUBLE;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_SINGLE :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_SINGLE;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_SOFT :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_SOFT;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_OLD_64 :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_OLD_64;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_XX :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_XX;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_64 :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_64;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_64A :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_64A;
- break;
- }
+ lldb::offset_t ase_offset = 12; // MIPS ABI Flags Version: 0
+ arch_flags |= data.GetU32 (&ase_offset);
}
}
// Settings appropriate ArchSpec ABI Flags
OpenPOWER on IntegriCloud