Index: include/lldb/Core/RegisterValue.h =================================================================== --- include/lldb/Core/RegisterValue.h +++ include/lldb/Core/RegisterValue.h @@ -19,8 +19,8 @@ #include "lldb/lldb-public.h" #include "lldb/lldb-private.h" #include "lldb/Host/Endian.h" +#include "llvm/ADT/APInt.h" -//#define ENABLE_128_BIT_SUPPORT 1 namespace lldb_private { class RegisterValue @@ -37,9 +37,7 @@ eTypeUInt16, eTypeUInt32, eTypeUInt64, -#if defined (ENABLE_128_BIT_SUPPORT) eTypeUInt128, -#endif eTypeFloat, eTypeDouble, eTypeLongDouble, @@ -79,14 +77,12 @@ m_data.uint64 = inst; } -#if defined (ENABLE_128_BIT_SUPPORT) explicit - RegisterValue (__uint128_t inst) : + RegisterValue (llvm::APInt inst) : m_type (eTypeUInt128) { - m_data.uint128 = inst; + m_data.uint128 = new llvm::APInt(inst); } -#endif explicit RegisterValue (float value) : m_type (eTypeFloat) @@ -183,10 +179,8 @@ uint64_t GetAsUInt64 (uint64_t fail_value = UINT64_MAX, bool *success_ptr = NULL) const; -#if defined (ENABLE_128_BIT_SUPPORT) - __uint128_t - GetAsUInt128 (__uint128_t fail_value = ~((__uint128_t)0), bool *success_ptr = NULL) const; -#endif + llvm::APInt * + GetAsUInt128 (llvm::APInt * fail_value = new llvm::APInt(128, 2, ~(0)), bool *success_ptr = NULL) const; float GetAsFloat (float fail_value = 0.0f, bool *success_ptr = NULL) const; @@ -243,14 +237,13 @@ m_data.uint64 = uint; } -#if defined (ENABLE_128_BIT_SUPPORT) void - operator = (__uint128_t uint) + operator = (llvm::APInt uint) { m_type = eTypeUInt128; - m_data.uint128 = uint; + m_data.uint128 = new llvm::APInt(uint); } -#endif + void operator = (float f) { @@ -300,14 +293,12 @@ m_data.uint64 = uint; } -#if defined (ENABLE_128_BIT_SUPPORT) void - SetUInt128 (__uint128_t uint) + SetUInt128 (llvm::APInt uint) { m_type = eTypeUInt128; - m_data.uint128 = uint; + m_data.uint128 = new llvm::APInt(uint); } -#endif bool SetUInt (uint64_t uint, uint32_t byte_size); @@ -392,9 +383,7 @@ uint16_t uint16; uint32_t uint32; uint64_t uint64; -#if defined (ENABLE_128_BIT_SUPPORT) - __uint128_t uint128; -#endif + llvm::APInt * uint128; float ieee_float; double ieee_double; long double ieee_long_double; Index: include/lldb/Core/Scalar.h =================================================================== --- include/lldb/Core/Scalar.h +++ include/lldb/Core/Scalar.h @@ -11,6 +11,11 @@ #define liblldb_Scalar_h_ #include "lldb/lldb-private.h" +#include "llvm/ADT/APInt.h" +#include "llvm/ADT/APFloat.h" + +#define NUM_OF_WORDS_INT128 2 +#define BITWIDTH_INT128 128 namespace lldb_private { @@ -34,22 +39,54 @@ e_ulonglong, e_float, e_double, - e_long_double + e_long_double, + e_uint128, + e_sint128 }; //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ Scalar(); - Scalar(int v) : m_type(e_sint), m_data() { m_data.sint = v; } - Scalar(unsigned int v) : m_type(e_uint), m_data() { m_data.uint = v; } - Scalar(long v) : m_type(e_slong), m_data() { m_data.slong = v; } - Scalar(unsigned long v) : m_type(e_ulong), m_data() { m_data.ulong = v; } - Scalar(long long v) : m_type(e_slonglong), m_data() { m_data.slonglong = v; } - Scalar(unsigned long long v): m_type(e_ulonglong), m_data() { m_data.ulonglong = v; } - Scalar(float v) : m_type(e_float), m_data() { m_data.flt = v; } - Scalar(double v) : m_type(e_double), m_data() { m_data.dbl = v; } - Scalar(long double v) : m_type(e_long_double), m_data() { m_data.ldbl = v; } + Scalar(int v) : m_type(e_sint), m_float((float)0) { m_integer = llvm::APInt(sizeof(int) * 8, v, true);} + Scalar(unsigned int v) : m_type(e_uint), m_float((float)0) { m_integer = llvm::APInt(sizeof(int) * 8, v);} + Scalar(long v) : m_type(e_slong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long) * 8, v, true);} + Scalar(unsigned long v) : m_type(e_ulong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long) * 8, v);} + Scalar(long long v) : m_type(e_slonglong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long long) * 8, v, true);} + Scalar(unsigned long long v): m_type(e_ulonglong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long long) * 8, v);} + Scalar(float v) : m_type(e_float), m_float(v) { m_float = llvm::APFloat(v); } + Scalar(double v) : m_type(e_double), m_float(v) { m_float = llvm::APFloat(v); } + Scalar(long double v) : m_type(e_long_double), m_float((float)0) { m_long_double = v; } + Scalar(llvm::APInt v) : + m_type(), + m_float((float)0) + { + m_integer = llvm::APInt(v); + switch(m_integer.getBitWidth()) + { + case 8: + case 16: + m_integer = m_integer.sext(sizeof(sint_t) * 8); + case 32: + if(m_integer.isSignedIntN(sizeof(sint_t) * 8)) + m_type = e_sint; + else + m_type = e_uint; + break; + case 64: + if(m_integer.isSignedIntN(sizeof(slonglong_t) * 8)) + m_type = e_slonglong; + else + m_type = e_ulonglong; + break; + case 128: + if(m_integer.isSignedIntN(BITWIDTH_INT128)) + m_type = e_sint128; + else + m_type = e_uint128; + break; + } + } Scalar(const Scalar& rhs); //Scalar(const RegisterValue& reg_value); virtual ~Scalar(); @@ -67,7 +104,7 @@ static size_t GetMaxByteSize() { - return sizeof(ValueData); + return BITWIDTH_INT128 / 8; } bool @@ -83,7 +120,7 @@ IsZero() const; void - Clear() { m_type = e_void; m_data.ulonglong = 0; } + Clear() { m_type = e_void; m_integer.clearAllBits(); } const char * GetTypeAsCString() const; @@ -133,6 +170,7 @@ Scalar& operator= (float v); Scalar& operator= (double v); Scalar& operator= (long double v); + Scalar& operator= (llvm::APInt v); Scalar& operator= (const Scalar& rhs); // Assignment operator Scalar& operator+= (const Scalar& rhs); Scalar& operator<<= (const Scalar& rhs); // Shift left @@ -265,24 +303,13 @@ typedef double double_t; typedef long double long_double_t; - union ValueData - { - int sint; - unsigned int uint; - long slong; - unsigned long ulong; - long long slonglong; - unsigned long long ulonglong; - float flt; - double dbl; - long double ldbl; - }; - //------------------------------------------------------------------ // Classes that inherit from Scalar can see and modify these //------------------------------------------------------------------ Scalar::Type m_type; - ValueData m_data; + llvm::APInt m_integer; + llvm::APFloat m_float; + long_double_t m_long_double; private: friend const Scalar operator+ (const Scalar& lhs, const Scalar& rhs); Index: include/lldb/Core/Value.h =================================================================== --- include/lldb/Core/Value.h +++ include/lldb/Core/Value.h @@ -101,6 +101,7 @@ // Casts a vector, if valid, to an unsigned int of matching or largest supported size. // Truncates to the beginning of the vector if required. // Returns a default constructed Scalar if the Vector data is internally inconsistent. + llvm::APInt rhs = llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, ((type128 *)bytes)->x); Scalar GetAsScalar() const { @@ -111,11 +112,7 @@ else if (length == 2) scalar = *(const uint16_t *)bytes; else if (length == 4) scalar = *(const uint32_t *)bytes; else if (length == 8) scalar = *(const uint64_t *)bytes; -#if defined (ENABLE_128_BIT_SUPPORT) - else if (length >= 16) scalar = *(const __uint128_t *)bytes; -#else - else if (length >= 16) scalar = *(const uint64_t *)bytes; -#endif + else if (length >= 16) scalar = rhs; } return scalar; } Index: include/lldb/lldb-private-types.h =================================================================== --- include/lldb/lldb-private-types.h +++ include/lldb/lldb-private-types.h @@ -102,6 +102,8 @@ // pass it. }; + typedef struct type128 { uint64_t x[2]; } type128; + } // namespace lldb_private #endif // #if defined(__cplusplus) Index: source/Core/RegisterValue.cpp =================================================================== --- source/Core/RegisterValue.cpp +++ source/Core/RegisterValue.cpp @@ -253,9 +253,7 @@ case eTypeUInt16: scalar = m_data.uint16; return true; case eTypeUInt32: scalar = m_data.uint32; return true; case eTypeUInt64: scalar = m_data.uint64; return true; -#if defined (ENABLE_128_BIT_SUPPORT) - case eTypeUInt128: break; -#endif + case eTypeUInt128: scalar = *m_data.uint128; return true; case eTypeFloat: scalar = m_data.ieee_float; return true; case eTypeDouble: scalar = m_data.ieee_double; return true; case eTypeLongDouble: scalar = m_data.ieee_long_double; return true; @@ -289,10 +287,8 @@ m_type = eTypeUInt32; else if (byte_size <= 8) m_type = eTypeUInt64; -#if defined (ENABLE_128_BIT_SUPPORT) else if (byte_size <= 16) m_type = eTypeUInt128; -#endif break; case eEncodingIEEE754: @@ -343,7 +339,8 @@ // Zero out the value in case we get partial data... memset (m_data.buffer.bytes, 0, sizeof (m_data.buffer.bytes)); - + + type128 int128; switch (SetType (reg_info)) { case eTypeInvalid: @@ -353,18 +350,21 @@ case eTypeUInt16: SetUInt16 (src.GetMaxU32 (&src_offset, src_len)); break; case eTypeUInt32: SetUInt32 (src.GetMaxU32 (&src_offset, src_len)); break; case eTypeUInt64: SetUInt64 (src.GetMaxU64 (&src_offset, src_len)); break; -#if defined (ENABLE_128_BIT_SUPPORT) case eTypeUInt128: { - __uint128_t data1 = src.GetU64 (&src_offset); - __uint128_t data2 = src.GetU64 (&src_offset); if (src.GetByteSize() == eByteOrderBig) - SetUInt128 (data1 << 64 + data2); + { + int128.x[1] = src.GetU64 (&src_offset); + int128.x[0] = src.GetU64 (&src_offset); + } else - SetUInt128 (data2 << 64 + data1); + { + int128.x[0] = src.GetU64 (&src_offset); + int128.x[1] = src.GetU64 (&src_offset); + } + SetUInt128 (llvm::APInt(128, 2, int128.x)); } break; -#endif case eTypeFloat: SetFloat (src.GetFloat (&src_offset)); break; case eTypeDouble: SetDouble(src.GetDouble (&src_offset)); break; case eTypeLongDouble: SetFloat (src.GetLongDouble (&src_offset)); break; @@ -616,22 +616,21 @@ } break; -#if defined (ENABLE_128_BIT_SUPPORT) case eTypeUInt128: if (sign_bitpos == (128-1)) return true; else if (sign_bitpos < (128-1)) { - __uint128_t sign_bit = (__uint128_t)1u << sign_bitpos; - if (m_data.uint128 & sign_bit) + llvm::APInt sign_bit = llvm::APInt::getSignBit(sign_bitpos + 1); + llvm::APInt bitwize_and = *(m_data.uint128) & sign_bit; + if (bitwize_and.getBoolValue()) { - const uint128_t mask = ~(sign_bit) + 1u; - m_data.uint128 |= mask; + const llvm::APInt mask = ~(sign_bit) + llvm::APInt(128, 1); + *(m_data.uint128) |= mask; } return true; } break; -#endif case eTypeFloat: case eTypeDouble: case eTypeLongDouble: @@ -653,9 +652,7 @@ case eTypeUInt16: m_data.uint16 = rhs.m_data.uint16; break; case eTypeUInt32: m_data.uint32 = rhs.m_data.uint32; break; case eTypeUInt64: m_data.uint64 = rhs.m_data.uint64; break; -#if defined (ENABLE_128_BIT_SUPPORT) - case eTypeUInt128: m_data.uint128 = rhs.m_data.uint128; break; -#endif + case eTypeUInt128: *(m_data.uint128) = *(rhs.m_data.uint128); break; case eTypeFloat: m_data.ieee_float = rhs.m_data.ieee_float; break; case eTypeDouble: m_data.ieee_double = rhs.m_data.ieee_double; break; case eTypeLongDouble: m_data.ieee_long_double = rhs.m_data.ieee_long_double; break; @@ -778,30 +775,29 @@ return fail_value; } -#if defined (ENABLE_128_BIT_SUPPORT) -__uint128_t -RegisterValue::GetAsUInt128 (__uint128_t fail_value, bool *success_ptr) const +llvm::APInt * +RegisterValue::GetAsUInt128 (llvm::APInt * fail_value, bool *success_ptr) const { if (success_ptr) *success_ptr = true; switch (m_type) { default: break; - case eTypeUInt8: return m_data.uint8; - case eTypeUInt16: return m_data.uint16; - case eTypeUInt32: return m_data.uint32; - case eTypeUInt64: return m_data.uint64; + case eTypeUInt8: return new llvm::APInt(8, m_data.uint8); + case eTypeUInt16: return new llvm::APInt(16, m_data.uint16); + case eTypeUInt32: return new llvm::APInt(32, m_data.uint32); + case eTypeUInt64: return new llvm::APInt(64, m_data.uint64); case eTypeUInt128: return m_data.uint128; case eTypeFloat: - if (sizeof(float) == sizeof(__uint128_t)) + if (sizeof(float) == ((m_data.uint128)->getBitWidth() / 8)) return m_data.uint128; break; case eTypeDouble: - if (sizeof(double) == sizeof(__uint128_t)) + if (sizeof(double) == ((m_data.uint128)->getBitWidth() / 8)) return m_data.uint128; break; case eTypeLongDouble: - if (sizeof(long double) == sizeof(__uint128_t)) + if (sizeof(long double) == ((m_data.uint128)->getBitWidth() / 8)) return m_data.uint128; break; case eTypeBytes: @@ -810,10 +806,10 @@ { default: break; - case 1: return m_data.uint8; - case 2: return m_data.uint16; - case 4: return m_data.uint32; - case 8: return m_data.uint64; + case 1: return new llvm::APInt(8, m_data.uint8); + case 2: return new llvm::APInt(16, m_data.uint16); + case 4: return new llvm::APInt(32, m_data.uint32); + case 8: return new llvm::APInt(64, m_data.uint64); case 16: return m_data.uint128; } } @@ -823,7 +819,7 @@ *success_ptr = false; return fail_value; } -#endif + float RegisterValue::GetAsFloat (float fail_value, bool *success_ptr) const { @@ -840,12 +836,10 @@ if (sizeof(float) == sizeof(m_data.uint64)) return m_data.ieee_float; break; -#if defined (ENABLE_128_BIT_SUPPORT) case eTypeUInt128: - if (sizeof(float) == sizeof(m_data.uint128)) + if (sizeof(float) == ((m_data.uint128)->getBitWidth() / 8)) return m_data.ieee_float; break; -#endif case eTypeFloat: return m_data.ieee_float; case eTypeDouble: if (sizeof(float) == sizeof(double)) @@ -881,11 +875,9 @@ return m_data.ieee_double; break; -#if defined (ENABLE_128_BIT_SUPPORT) case eTypeUInt128: - if (sizeof(double) == sizeof(m_data.uint128)) + if (sizeof(double) == ((m_data.uint128)->getBitWidth() / 8)) return m_data.ieee_double; -#endif case eTypeFloat: return m_data.ieee_float; case eTypeDouble: return m_data.ieee_double; @@ -919,11 +911,9 @@ return m_data.ieee_long_double; break; -#if defined (ENABLE_128_BIT_SUPPORT) case eTypeUInt128: - if (sizeof(long double) == sizeof(m_data.uint128)) + if (sizeof(long double) == ((m_data.uint128)->getBitWidth() / 8)) return m_data.ieee_long_double; -#endif case eTypeFloat: return m_data.ieee_float; case eTypeDouble: return m_data.ieee_double; case eTypeLongDouble: return m_data.ieee_long_double; @@ -944,9 +934,7 @@ case eTypeUInt16: return &m_data.uint16; case eTypeUInt32: return &m_data.uint32; case eTypeUInt64: return &m_data.uint64; -#if defined (ENABLE_128_BIT_SUPPORT) - case eTypeUInt128: return &m_data.uint128; -#endif + case eTypeUInt128: return (const void *)m_data.uint128->getRawData(); case eTypeFloat: return &m_data.ieee_float; case eTypeDouble: return &m_data.ieee_double; case eTypeLongDouble: return &m_data.ieee_long_double; @@ -965,9 +953,7 @@ case eTypeUInt16: return &m_data.uint16; case eTypeUInt32: return &m_data.uint32; case eTypeUInt64: return &m_data.uint64; -#if defined (ENABLE_128_BIT_SUPPORT) - case eTypeUInt128: return &m_data.uint128; -#endif + case eTypeUInt128: return (void *)m_data.uint128->getRawData(); case eTypeFloat: return &m_data.ieee_float; case eTypeDouble: return &m_data.ieee_double; case eTypeLongDouble: return &m_data.ieee_long_double; @@ -986,9 +972,7 @@ case eTypeUInt16: return sizeof(m_data.uint16); case eTypeUInt32: return sizeof(m_data.uint32); case eTypeUInt64: return sizeof(m_data.uint64); -#if defined (ENABLE_128_BIT_SUPPORT) - case eTypeUInt128: return sizeof(m_data.uint128); -#endif + case eTypeUInt128: return ((m_data.uint128)->getBitWidth() / 8); case eTypeFloat: return sizeof(m_data.ieee_float); case eTypeDouble: return sizeof(m_data.ieee_double); case eTypeLongDouble: return sizeof(m_data.ieee_long_double); @@ -1021,12 +1005,10 @@ { SetUInt64 (uint); } -#if defined (ENABLE_128_BIT_SUPPORT) else if (byte_size <= 16) { - SetUInt128 (uint); + SetUInt128 (llvm::APInt(64, uint)); } -#endif else return false; return true; @@ -1067,9 +1049,7 @@ case eTypeUInt16: return m_data.uint16 == rhs.m_data.uint16; case eTypeUInt32: return m_data.uint32 == rhs.m_data.uint32; case eTypeUInt64: return m_data.uint64 == rhs.m_data.uint64; -#if defined (ENABLE_128_BIT_SUPPORT) - case eTypeUInt128: return m_data.uint128 == rhs.m_data.uint128; -#endif + case eTypeUInt128: return *(m_data.uint128) == *(rhs.m_data.uint128); case eTypeFloat: return m_data.ieee_float == rhs.m_data.ieee_float; case eTypeDouble: return m_data.ieee_double == rhs.m_data.ieee_double; case eTypeLongDouble: return m_data.ieee_long_double == rhs.m_data.ieee_long_double; @@ -1101,9 +1081,7 @@ case eTypeUInt16: return m_data.uint16 != rhs.m_data.uint16; case eTypeUInt32: return m_data.uint32 != rhs.m_data.uint32; case eTypeUInt64: return m_data.uint64 != rhs.m_data.uint64; -#if defined (ENABLE_128_BIT_SUPPORT) - case eTypeUInt128: return m_data.uint128 != rhs.m_data.uint128; -#endif + case eTypeUInt128: return *(m_data.uint128) != *(rhs.m_data.uint128); case eTypeFloat: return m_data.ieee_float != rhs.m_data.ieee_float; case eTypeDouble: return m_data.ieee_double != rhs.m_data.ieee_double; case eTypeLongDouble: return m_data.ieee_long_double != rhs.m_data.ieee_long_double; @@ -1163,14 +1141,13 @@ return true; } break; -#if defined (ENABLE_128_BIT_SUPPORT) + case eTypeUInt128: - if (bit < 64) + if (bit < 128) { - m_data.uint128 &= ~((__uint128_t)1ull << (__uint128_t)bit); + m_data.uint128->clearBit(bit); return true; } -#endif case eTypeFloat: case eTypeDouble: case eTypeLongDouble: @@ -1237,14 +1214,14 @@ return true; } break; -#if defined (ENABLE_128_BIT_SUPPORT) + case eTypeUInt128: - if (bit < 64) + if (bit < 128) { - m_data.uint128 |= ((__uint128_t)1ull << (__uint128_t)bit); + m_data.uint128->setBit(bit); return true; } -#endif + case eTypeFloat: case eTypeDouble: case eTypeLongDouble: Index: source/Core/Scalar.cpp =================================================================== --- source/Core/Scalar.cpp +++ source/Core/Scalar.cpp @@ -11,6 +11,7 @@ #include #include +#include #include "lldb/Interpreter/Args.h" #include "lldb/Core/Error.h" @@ -77,7 +78,7 @@ //---------------------------------------------------------------------- Scalar::Scalar() : m_type(e_void), - m_data() + m_float((float)0) { } @@ -86,7 +87,8 @@ //---------------------------------------------------------------------- Scalar::Scalar(const Scalar& rhs) : m_type(rhs.m_type), - m_data(rhs.m_data) // TODO: verify that for C++ this will correctly copy the union?? + m_integer(rhs.m_integer), + m_float(rhs.m_float) { } @@ -135,6 +137,8 @@ Scalar::GetData (DataExtractor &data, size_t limit_byte_size) const { size_t byte_size = GetByteSize(); + float f_val; + double d_val; if (byte_size > 0) { if (limit_byte_size < byte_size) @@ -144,20 +148,92 @@ // On little endian systems if we want fewer bytes from the // current type we just specify fewer bytes since the LSByte // is first... - data.SetData((uint8_t*)&m_data, limit_byte_size, lldb::endian::InlHostByteOrder()); + switch(m_type) + { + case e_void: break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + data.SetData((const uint8_t *)m_integer.getRawData(), limit_byte_size, lldb::endian::InlHostByteOrder()); + break; + case e_float: + f_val = m_float.convertToFloat(); + data.SetData((uint8_t *)&f_val, limit_byte_size, lldb::endian::InlHostByteOrder()); + break; + case e_double: + d_val = m_float.convertToDouble(); + data.SetData((uint8_t *)&d_val, limit_byte_size, lldb::endian::InlHostByteOrder()); + break; + case e_long_double: + data.SetData((const uint8_t *)&m_long_double, limit_byte_size, lldb::endian::InlHostByteOrder()); + break; + } } else if (lldb::endian::InlHostByteOrder() == eByteOrderBig) { // On big endian systems if we want fewer bytes from the // current type have to advance our initial byte pointer and // trim down the number of bytes since the MSByte is first - data.SetData(((uint8_t*)&m_data) + byte_size - limit_byte_size, limit_byte_size, lldb::endian::InlHostByteOrder()); + switch(m_type) + { + case e_void: break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + data.SetData((const uint8_t *)m_integer.getRawData() + byte_size - limit_byte_size, limit_byte_size, lldb::endian::InlHostByteOrder()); + break; + case e_float: + f_val = m_float.convertToFloat(); + data.SetData((uint8_t *)&f_val + byte_size - limit_byte_size, limit_byte_size, lldb::endian::InlHostByteOrder()); + break; + case e_double: + d_val = m_float.convertToDouble(); + data.SetData((uint8_t *)&d_val + byte_size - limit_byte_size, limit_byte_size, lldb::endian::InlHostByteOrder()); + break; + case e_long_double: + data.SetData((const uint8_t *)&m_long_double + byte_size - limit_byte_size, limit_byte_size, lldb::endian::InlHostByteOrder()); + break; + } } } else { // We want all of the data - data.SetData((uint8_t*)&m_data, byte_size, lldb::endian::InlHostByteOrder()); + switch(m_type) + { + case e_void: break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + data.SetData((const uint8_t *)m_integer.getRawData(), byte_size, lldb::endian::InlHostByteOrder()); + break; + case e_float: + f_val = m_float.convertToFloat(); + data.SetData((uint8_t *)&f_val, byte_size, lldb::endian::InlHostByteOrder()); + break; + case e_double: + d_val = m_float.convertToDouble(); + data.SetData((uint8_t *)&d_val, byte_size, lldb::endian::InlHostByteOrder()); + break; + case e_long_double: + data.SetData((const uint8_t *)&m_long_double, byte_size, lldb::endian::InlHostByteOrder()); + break; + } } return true; } @@ -172,15 +248,17 @@ { case e_void: break; - case e_sint: return sizeof(m_data.sint); - case e_uint: return sizeof(m_data.uint); - case e_slong: return sizeof(m_data.slong); - case e_ulong: return sizeof(m_data.ulong); - case e_slonglong: return sizeof(m_data.slonglong); - case e_ulonglong: return sizeof(m_data.ulonglong); - case e_float: return sizeof(m_data.flt); - case e_double: return sizeof(m_data.dbl); - case e_long_double: return sizeof(m_data.ldbl); + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: return (m_integer.getBitWidth() / 8); + case e_float: return sizeof(float_t); + case e_double: return sizeof(double_t); + case e_long_double: return sizeof(long_double_t); } return 0; } @@ -188,19 +266,25 @@ bool Scalar::IsZero() const { + llvm::APInt zero_int = llvm::APInt::getAllOnesValue(m_integer.getBitWidth() / 8); switch (m_type) { case e_void: break; - case e_sint: return m_data.sint == 0; - case e_uint: return m_data.uint == 0; - case e_slong: return m_data.slong == 0; - case e_ulong: return m_data.ulong == 0; - case e_slonglong: return m_data.slonglong == 0; - case e_ulonglong: return m_data.ulonglong == 0; - case e_float: return m_data.flt == 0.0f; - case e_double: return m_data.dbl == 0.0; - case e_long_double: return m_data.ldbl == 0.0; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return llvm::APInt::isSameValue(zero_int, m_integer); + case e_float: + case e_double: + return m_float.isZero(); + case e_long_double: + return m_long_double == 0.0; } return false; } @@ -208,6 +292,7 @@ void Scalar::GetValue (Stream *s, bool show_type) const { + const uint64_t *src; if (show_type) s->Printf("(%s) ", GetTypeAsCString()); @@ -215,15 +300,23 @@ { case e_void: break; - case e_sint: s->Printf("%i", m_data.sint); break; - case e_uint: s->Printf("0x%8.8x", m_data.uint); break; - case e_slong: s->Printf("%li", m_data.slong); break; - case e_ulong: s->Printf("0x%8.8lx", m_data.ulong); break; - case e_slonglong: s->Printf("%lli", m_data.slonglong); break; - case e_ulonglong: s->Printf("0x%16.16llx", m_data.ulonglong); break; - case e_float: s->Printf("%f", m_data.flt); break; - case e_double: s->Printf("%g", m_data.dbl); break; - case e_long_double: s->Printf("%Lg", m_data.ldbl); break; + case e_sint: s->Printf("%i", *(const sint_t *) m_integer.getRawData()); break; + case e_uint: s->Printf("0x%8.8x", *(const uint_t *) m_integer.getRawData()); break; + case e_slong: s->Printf("%li", *(const slong_t *) m_integer.getRawData()); break; + case e_ulong: s->Printf("0x%8.8lx", *(const ulong_t *) m_integer.getRawData()); break; + case e_slonglong: s->Printf("%lli", *(const slonglong_t *) m_integer.getRawData()); break; + case e_ulonglong: s->Printf("0x%16.16llx", *(const ulonglong_t *) m_integer.getRawData()); break; + case e_sint128: + src = m_integer.getRawData(); + s->Printf("%lli%lli", *(const slonglong_t *)src, *(const slonglong_t *)(src + 1)); + break; + case e_uint128: + src = m_integer.getRawData(); + s->Printf("0x%16.16llx%16.16llx", *(const ulonglong_t *)src, *(const ulonglong_t *)(src + 1)); + break; + case e_float: s->Printf("%f", m_float.convertToFloat()); break; + case e_double: s->Printf("%g", m_float.convertToDouble()); break; + case e_long_double: s->Printf("%Lg", m_long_double); break; } } @@ -239,6 +332,8 @@ case e_ulong: return "unsigned long"; case e_slonglong: return "long long"; case e_ulonglong: return "unsigned long long"; + case e_sint128: return "int128_t"; + case e_uint128: return "unsigned int128_t"; case e_float: return "float"; case e_double: return "double"; case e_long_double: return "long double"; @@ -257,7 +352,9 @@ if (this != &rhs) { m_type = rhs.m_type; - ::memcpy (&m_data, &rhs.m_data, sizeof(m_data)); + m_integer = llvm::APInt(rhs.m_integer); + m_float = rhs.m_float; + m_long_double = rhs.m_long_double; } return *this; } @@ -266,7 +363,7 @@ Scalar::operator= (const int v) { m_type = e_sint; - m_data.sint = v; + m_integer = llvm::APInt(sizeof(int) * 8, v, true); return *this; } @@ -275,7 +372,7 @@ Scalar::operator= (unsigned int v) { m_type = e_uint; - m_data.uint = v; + m_integer = llvm::APInt(sizeof(int) * 8, v); return *this; } @@ -283,7 +380,7 @@ Scalar::operator= (long v) { m_type = e_slong; - m_data.slong = v; + m_integer = llvm::APInt(sizeof(long) * 8, v, true); return *this; } @@ -291,7 +388,7 @@ Scalar::operator= (unsigned long v) { m_type = e_ulong; - m_data.ulong = v; + m_integer = llvm::APInt(sizeof(long) * 8, v); return *this; } @@ -299,7 +396,7 @@ Scalar::operator= (long long v) { m_type = e_slonglong; - m_data.slonglong = v; + m_integer = llvm::APInt(sizeof(long) * 8, v, true); return *this; } @@ -307,7 +404,7 @@ Scalar::operator= (unsigned long long v) { m_type = e_ulonglong; - m_data.ulonglong = v; + m_integer = llvm::APInt(sizeof(long long) * 8, v); return *this; } @@ -315,7 +412,7 @@ Scalar::operator= (float v) { m_type = e_float; - m_data.flt = v; + m_float = llvm::APFloat(v); return *this; } @@ -323,7 +420,7 @@ Scalar::operator= (double v) { m_type = e_double; - m_data.dbl = v; + m_float = llvm::APFloat(v); return *this; } @@ -331,7 +428,38 @@ Scalar::operator= (long double v) { m_type = e_long_double; - m_data.ldbl = v; + m_long_double = v; + return *this; +} + +Scalar& +Scalar::operator= (llvm::APInt rhs) +{ + m_integer = llvm::APInt(rhs); + switch(m_integer.getBitWidth()) + { + case 8: + case 16: + m_integer = m_integer.sext(sizeof(sint_t) * 8); + case 32: + if(m_integer.isSignedIntN(sizeof(sint_t) * 8)) + m_type = e_sint; + else + m_type = e_uint; + break; + case 64: + if(m_integer.isSignedIntN(sizeof(slonglong_t) * 8)) + m_type = e_slonglong; + else + m_type = e_ulonglong; + break; + case 128: + if(m_integer.isSignedIntN(BITWIDTH_INT128)) + m_type = e_sint128; + else + m_type = e_uint128; + break; + } return *this; } @@ -354,128 +482,455 @@ case e_sint: switch (type) { - case e_void: break; - case e_sint: success = true; break; - case e_uint: m_data.uint = m_data.sint; success = true; break; - case e_slong: m_data.slong = m_data.sint; success = true; break; - case e_ulong: m_data.ulong = m_data.sint; success = true; break; - case e_slonglong: m_data.slonglong = m_data.sint; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.sint; success = true; break; - case e_float: m_data.flt = m_data.sint; success = true; break; - case e_double: m_data.dbl = m_data.sint; success = true; break; - case e_long_double: m_data.ldbl = m_data.sint; success = true; break; + case e_void: break; + case e_sint: success = true; break; + case e_uint: + { + m_integer = llvm::APInt(sizeof(uint_t) * 8, *(uint_t *)m_integer.getRawData(), false); + success = true; + break; + } + case e_slong: + { + m_integer = m_integer.sext(sizeof(slong_t) * 8); + success = true; + break; + } + case e_ulong: + { + m_integer = m_integer.zext(sizeof(slong_t) * 8); + success = true; + break; + } + case e_slonglong: + { + m_integer = m_integer.sext(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_ulonglong: + { + m_integer = m_integer.zext(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_sint128: + { + m_integer = m_integer.sext(BITWIDTH_INT128); + success = true; + break; + } + case e_uint128: + { + m_integer = m_integer.zext(BITWIDTH_INT128); + success = true; + break; + } + case e_float: + { + m_float = llvm::APFloat(m_integer.bitsToFloat()); + success = true; + break; + } + case e_double: + { + m_float = llvm::APFloat(m_integer.bitsToDouble()); + success = true; + break; + } + case e_long_double: + { + m_long_double = *(const long_double_t *)m_integer.getRawData(); + success = true; + break; + } } break; case e_uint: switch (type) { - case e_void: - case e_sint: break; - case e_uint: success = true; break; - case e_slong: m_data.slong = m_data.uint; success = true; break; - case e_ulong: m_data.ulong = m_data.uint; success = true; break; - case e_slonglong: m_data.slonglong = m_data.uint; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.uint; success = true; break; - case e_float: m_data.flt = m_data.uint; success = true; break; - case e_double: m_data.dbl = m_data.uint; success = true; break; - case e_long_double: m_data.ldbl = m_data.uint; success = true; break; + case e_void: + case e_sint: break; + case e_uint: success = true; break; + case e_slong: + { + m_integer = m_integer.sext(sizeof(slong_t) * 8); + success = true; + break; + } + case e_ulong: + { + m_integer = m_integer.zext(sizeof(slong_t) * 8); + success = true; + break; + } + case e_slonglong: + { + m_integer = m_integer.sext(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_ulonglong: + { + m_integer = m_integer.zext(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_sint128: + { + m_integer = m_integer.sext(BITWIDTH_INT128); + success = true; + break; + } + case e_uint128: + { + m_integer = m_integer.zext(BITWIDTH_INT128); + success = true; + break; + } + case e_float: + { + m_float = llvm::APFloat(m_integer.bitsToFloat()); + success = true; + break; + } + case e_double: + { + m_float = llvm::APFloat(m_integer.bitsToDouble()); + success = true; + break; + } + case e_long_double: + { + m_long_double = *(const long_double_t *)m_integer.getRawData(); + success = true; + break; + } } break; case e_slong: switch (type) { - case e_void: - case e_sint: - case e_uint: break; - case e_slong: success = true; break; - case e_ulong: m_data.ulong = m_data.slong; success = true; break; - case e_slonglong: m_data.slonglong = m_data.slong; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.slong; success = true; break; - case e_float: m_data.flt = m_data.slong; success = true; break; - case e_double: m_data.dbl = m_data.slong; success = true; break; - case e_long_double: m_data.ldbl = m_data.slong; success = true; break; + case e_void: + case e_sint: + case e_uint: break; + case e_slong: success = true; break; + case e_ulong: + { + m_integer = llvm::APInt(sizeof(ulong_t) * 8, *(ulong_t *)m_integer.getRawData(), false); + success = true; + break; + } + case e_slonglong: + { + m_integer = m_integer.sext(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_ulonglong: + { + m_integer = m_integer.zext(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_sint128: + { + m_integer = m_integer.sext(BITWIDTH_INT128); + success = true; + break; + } + case e_uint128: + { + m_integer = m_integer.zext(BITWIDTH_INT128); + success = true; + break; + } + case e_float: + { + m_float = llvm::APFloat(m_integer.bitsToFloat()); + success = true; + break; + } + case e_double: + { + m_float = llvm::APFloat(m_integer.bitsToDouble()); + success = true; + break; + } + case e_long_double: + { + m_long_double = *(const long_double_t *)m_integer.getRawData(); + success = true; + break; + } } break; case e_ulong: switch (type) { - case e_void: - case e_sint: - case e_uint: - case e_slong: break; - case e_ulong: success = true; break; - case e_slonglong: m_data.slonglong = m_data.ulong; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.ulong; success = true; break; - case e_float: m_data.flt = m_data.ulong; success = true; break; - case e_double: m_data.dbl = m_data.ulong; success = true; break; - case e_long_double: m_data.ldbl = m_data.ulong; success = true; break; + case e_void: + case e_sint: + case e_uint: + case e_slong: break; + case e_ulong: success = true; break; + case e_slonglong: + { + m_integer = m_integer.sext(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_ulonglong: + { + m_integer = m_integer.zext(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_sint128: + { + m_integer = m_integer.sext(BITWIDTH_INT128); + success = true; + break; + } + case e_uint128: + { + m_integer = m_integer.zext(BITWIDTH_INT128); + success = true; + break; + } + case e_float: + { + m_float = llvm::APFloat(m_integer.bitsToFloat()); + success = true; + break; + } + case e_double: + { + m_float = llvm::APFloat(m_integer.bitsToDouble()); + success = true; + break; + } + case e_long_double: + { + m_long_double = *(const long_double_t *)m_integer.getRawData(); + success = true; + break; + } } break; case e_slonglong: switch (type) { - case e_void: - case e_sint: - case e_uint: - case e_slong: - case e_ulong: break; - case e_slonglong: success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.slonglong; success = true; break; - case e_float: m_data.flt = m_data.slonglong; success = true; break; - case e_double: m_data.dbl = m_data.slonglong; success = true; break; - case e_long_double: m_data.ldbl = m_data.slonglong; success = true; break; + case e_void: + case e_sint: + case e_uint: + case e_slong: + case e_ulong: break; + case e_slonglong: success = true; break; + case e_ulonglong: + { + m_integer = llvm::APInt(sizeof(ulonglong_t) * 8, *(ulonglong_t *)m_integer.getRawData(), false); + success = true; + break; + } + case e_sint128: + { + m_integer = m_integer.sext(BITWIDTH_INT128); + success = true; + break; + } + case e_uint128: + { + m_integer = m_integer.zext(BITWIDTH_INT128); + success = true; + break; + } + case e_float: + { + m_float = llvm::APFloat(m_integer.bitsToFloat()); + success = true; + break; + } + case e_double: + { + m_float = llvm::APFloat(m_integer.bitsToDouble()); + success = true; + break; + } + case e_long_double: + { + m_long_double = *(const long_double_t *)m_integer.getRawData(); + success = true; + break; + } } break; case e_ulonglong: switch (type) { - case e_void: - case e_sint: - case e_uint: - case e_slong: - case e_ulong: - case e_slonglong: break; - case e_ulonglong: success = true; break; - case e_float: m_data.flt = m_data.ulonglong; success = true; break; - case e_double: m_data.dbl = m_data.ulonglong; success = true; break; - case e_long_double: m_data.ldbl = m_data.ulonglong; success = true; break; + case e_void: + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: break; + case e_ulonglong: success = true; break; + case e_sint128: + { + m_integer = m_integer.sext(BITWIDTH_INT128); + success = true; + break; + } + case e_uint128: + { + m_integer = m_integer.zext(BITWIDTH_INT128); + success = true; + break; + } + case e_float: + { + m_float = llvm::APFloat(m_integer.bitsToFloat()); + success = true; + break; + } + case e_double: + { + m_float = llvm::APFloat(m_integer.bitsToDouble()); + success = true; + break; + } + case e_long_double: + { + m_long_double = *(const long_double_t *)m_integer.getRawData(); + success = true; + break; + } + } + break; + + case e_sint128: + switch (type) + { + case e_void: + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: break; + case e_sint128: success = true; break; + case e_uint128: + { + m_integer = m_integer.zext(BITWIDTH_INT128); + success = true; + break; + } + case e_float: + { + m_float = llvm::APFloat(m_integer.bitsToFloat()); + success = true; + break; + } + case e_double: + { + m_float = llvm::APFloat(m_integer.bitsToDouble()); + success = true; + break; + } + case e_long_double: + { + m_long_double = *(const long_double_t *)m_integer.getRawData(); + success = true; + break; + } + } + break; + + case e_uint128: + switch (type) + { + case e_void: + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: break; + case e_uint128: success = true; break; + case e_float: + { + m_float = llvm::APFloat(m_integer.bitsToFloat()); + success = true; + break; + } + case e_double: + { + m_float = llvm::APFloat(m_integer.bitsToDouble()); + success = true; + break; + } + case e_long_double: + { + m_long_double = *(const long_double_t *)m_integer.getRawData(); + success = true; + break; + } } break; case e_float: switch (type) { - case e_void: - case e_sint: - case e_uint: - case e_slong: - case e_ulong: - case e_slonglong: - case e_ulonglong: break; - case e_float: success = true; break; - case e_double: m_data.dbl = m_data.flt; success = true; break; - case e_long_double: m_data.ldbl = m_data.ulonglong; success = true; break; + case e_void: + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: break; + case e_float: success = true; break; + case e_double: + { + m_float = llvm::APFloat((float_t)m_float.convertToFloat()); + success = true; + break; + } + case e_long_double: + { + m_long_double = (long_double_t)m_float.convertToFloat(); + success = true; + break; + } } break; case e_double: switch (type) { - case e_void: - case e_sint: - case e_uint: - case e_slong: - case e_ulong: - case e_slonglong: - case e_ulonglong: - case e_float: break; - case e_double: success = true; break; - case e_long_double: m_data.ldbl = m_data.dbl; success = true; break; + case e_void: + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + case e_float: break; + case e_double: success = true; break; + case e_long_double: + { + m_long_double = (long_double_t)m_float.convertToDouble(); + success = true; + break; + } } break; @@ -489,6 +944,8 @@ case e_ulong: case e_slonglong: case e_ulonglong: + case e_sint128: + case e_uint128: case e_float: case e_double: break; case e_long_double: success = true; break; @@ -516,6 +973,8 @@ case e_float: return "float"; case e_double: return "double"; case e_long_double: return "long double"; + case e_sint128: return "int128_t"; + case e_uint128: return "uint128_t"; } return "???"; } @@ -567,145 +1026,163 @@ break; case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: switch (type) { - case e_void: break; - case e_sint: success = true; break; - case e_uint: m_data.uint = m_data.sint; success = true; break; - case e_slong: m_data.slong = m_data.sint; success = true; break; - case e_ulong: m_data.ulong = m_data.sint; success = true; break; - case e_slonglong: m_data.slonglong = m_data.sint; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.sint; success = true; break; - case e_float: m_data.flt = m_data.sint; success = true; break; - case e_double: m_data.dbl = m_data.sint; success = true; break; - case e_long_double: m_data.ldbl = m_data.sint; success = true; break; + case e_void: break; + case e_sint: + { + m_integer = m_integer.sextOrTrunc(sizeof(sint_t) * 8); + success = true; + break; + } + case e_uint: + { + m_integer = m_integer.zextOrTrunc(sizeof(sint_t) * 8); + success = true; + break; + } + case e_slong: + { + m_integer = m_integer.sextOrTrunc(sizeof(slong_t) * 8); + success = true; + break; + } + case e_ulong: + { + m_integer = m_integer.zextOrTrunc(sizeof(slong_t) * 8); + success = true; + break; + } + case e_slonglong: + { + m_integer = m_integer.sextOrTrunc(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_ulonglong: + { + m_integer = m_integer.zextOrTrunc(sizeof(slonglong_t) * 8); + success = true; + break; + } + case e_sint128: + { + m_integer = m_integer.sextOrTrunc(BITWIDTH_INT128); + success = true; + break; + } + case e_uint128: + { + m_integer = m_integer.zextOrTrunc(BITWIDTH_INT128); + success = true; + break; + } + case e_float: + { + m_float = llvm::APFloat(m_integer.bitsToFloat()); + success = true; + break; + } + case e_double: + { + m_float = llvm::APFloat(m_integer.bitsToDouble()); + success = true; + break; + } + case e_long_double: + { + m_long_double = *(const long_double_t *) m_integer.getRawData(); + success = true; + break; + } } break; - case e_uint: + case e_float: switch (type) { - case e_void: - case e_sint: m_data.sint = m_data.uint; success = true; break; - case e_uint: success = true; break; - case e_slong: m_data.slong = m_data.uint; success = true; break; - case e_ulong: m_data.ulong = m_data.uint; success = true; break; - case e_slonglong: m_data.slonglong = m_data.uint; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.uint; success = true; break; - case e_float: m_data.flt = m_data.uint; success = true; break; - case e_double: m_data.dbl = m_data.uint; success = true; break; - case e_long_double: m_data.ldbl = m_data.uint; success = true; break; + case e_void: break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: m_integer = m_float.bitcastToAPInt(); success = true; break; + case e_float: m_float = llvm::APFloat(m_float.convertToFloat()); success = true; break; + case e_double: m_float = llvm::APFloat(m_float.convertToFloat()); success = true; break; + case e_long_double: m_long_double = (long_double_t)m_float.convertToFloat(); success = true; break; } break; - case e_slong: + case e_double: switch (type) { - case e_void: - case e_sint: m_data.sint = (sint_t)m_data.slong; success = true; break; - case e_uint: m_data.uint = (uint_t)m_data.slong; success = true; break; - case e_slong: success = true; break; - case e_ulong: m_data.ulong = m_data.slong; success = true; break; - case e_slonglong: m_data.slonglong = m_data.slong; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.slong; success = true; break; - case e_float: m_data.flt = m_data.slong; success = true; break; - case e_double: m_data.dbl = m_data.slong; success = true; break; - case e_long_double: m_data.ldbl = m_data.slong; success = true; break; + case e_void: break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: m_integer = m_float.bitcastToAPInt(); success = true; break; + case e_float: m_float = llvm::APFloat(m_float.convertToDouble()); success = true; break; + case e_double: m_float = llvm::APFloat(m_float.convertToDouble()); success = true; break; + case e_long_double: m_long_double = (long_double_t)m_float.convertToDouble(); success = true; break; } break; - case e_ulong: + case e_long_double: switch (type) { case e_void: - case e_sint: m_data.sint = (sint_t)m_data.ulong; success = true; break; - case e_uint: m_data.uint = (uint_t)m_data.ulong; success = true; break; - case e_slong: m_data.slong = m_data.ulong; success = true; break; - case e_ulong: success = true; break; - case e_slonglong: m_data.slonglong = m_data.ulong; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.ulong; success = true; break; - case e_float: m_data.flt = m_data.ulong; success = true; break; - case e_double: m_data.dbl = m_data.ulong; success = true; break; - case e_long_double: m_data.ldbl = m_data.ulong; success = true; break; + case e_sint: + { + m_integer = llvm::APInt(sizeof(sint_t) * 8, (uint64_t)m_long_double, true); + success = true; + break; } - break; - - case e_slonglong: - switch (type) + case e_uint: { - case e_void: - case e_sint: m_data.sint = (sint_t)m_data.slonglong; success = true; break; - case e_uint: m_data.uint = (uint_t)m_data.slonglong; success = true; break; - case e_slong: m_data.slong = m_data.slonglong; success = true; break; - case e_ulong: m_data.ulong = m_data.slonglong; success = true; break; - case e_slonglong: success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.slonglong; success = true; break; - case e_float: m_data.flt = m_data.slonglong; success = true; break; - case e_double: m_data.dbl = m_data.slonglong; success = true; break; - case e_long_double: m_data.ldbl = m_data.slonglong; success = true; break; + m_integer = llvm::APInt(sizeof(uint_t) * 8, (uint64_t)m_long_double, false); + success = true; + break; } - break; - - case e_ulonglong: - switch (type) + case e_slong: { - case e_void: - case e_sint: m_data.sint = (sint_t)m_data.ulonglong; success = true; break; - case e_uint: m_data.uint = (uint_t)m_data.ulonglong; success = true; break; - case e_slong: m_data.slong = m_data.ulonglong; success = true; break; - case e_ulong: m_data.ulong = m_data.ulonglong; success = true; break; - case e_slonglong: m_data.slonglong = m_data.ulonglong; success = true; break; - case e_ulonglong: success = true; break; - case e_float: m_data.flt = m_data.ulonglong; success = true; break; - case e_double: m_data.dbl = m_data.ulonglong; success = true; break; - case e_long_double: m_data.ldbl = m_data.ulonglong; success = true; break; + m_integer = llvm::APInt(sizeof(slong_t) * 8, (uint64_t)m_long_double, true); + success = true; + break; } - break; - - case e_float: - switch (type) + case e_ulong: { - case e_void: - case e_sint: m_data.sint = (sint_t)m_data.flt; success = true; break; - case e_uint: m_data.uint = (uint_t)m_data.flt; success = true; break; - case e_slong: m_data.slong = (slong_t)m_data.flt; success = true; break; - case e_ulong: m_data.ulong = (ulong_t)m_data.flt; success = true; break; - case e_slonglong: m_data.slonglong = (slonglong_t)m_data.flt; success = true; break; - case e_ulonglong: m_data.ulonglong = (ulonglong_t)m_data.flt; success = true; break; - case e_float: success = true; break; - case e_double: m_data.dbl = m_data.flt; success = true; break; - case e_long_double: m_data.ldbl = m_data.flt; success = true; break; + m_integer = llvm::APInt(sizeof(ulong_t) * 8, (uint64_t)m_long_double, false); + success = true; + break; } - break; - - case e_double: - switch (type) + case e_slonglong: { - case e_void: - case e_sint: m_data.sint = (sint_t)m_data.dbl; success = true; break; - case e_uint: m_data.uint = (uint_t)m_data.dbl; success = true; break; - case e_slong: m_data.slong = (slong_t)m_data.dbl; success = true; break; - case e_ulong: m_data.ulong = (ulong_t)m_data.dbl; success = true; break; - case e_slonglong: m_data.slonglong = (slonglong_t)m_data.dbl; success = true; break; - case e_ulonglong: m_data.ulonglong = (ulonglong_t)m_data.dbl; success = true; break; - case e_float: m_data.flt = (float_t)m_data.dbl; success = true; break; - case e_double: success = true; break; - case e_long_double: m_data.ldbl = m_data.dbl; success = true; break; + m_integer = llvm::APInt(sizeof(slonglong_t) * 8, (uint64_t)m_long_double, true); + success = true; + break; } - break; - - case e_long_double: - switch (type) + case e_ulonglong: { - case e_void: - case e_sint: m_data.sint = (sint_t)m_data.ldbl; success = true; break; - case e_uint: m_data.uint = (uint_t)m_data.ldbl; success = true; break; - case e_slong: m_data.slong = (slong_t)m_data.ldbl; success = true; break; - case e_ulong: m_data.ulong = (ulong_t)m_data.ldbl; success = true; break; - case e_slonglong: m_data.slonglong = (slonglong_t)m_data.ldbl; success = true; break; - case e_ulonglong: m_data.ulonglong = (ulonglong_t)m_data.ldbl; success = true; break; - case e_float: m_data.flt = (float_t)m_data.ldbl; success = true; break; - case e_double: m_data.dbl = (double_t)m_data.ldbl; success = true; break; + m_integer = llvm::APInt(sizeof(ulonglong_t) * 8, (uint64_t)m_long_double, false); + success = true; + break; + } + case e_float: m_float = llvm::APFloat((float_t)m_long_double); success = true; break; + case e_double: m_float = llvm::APFloat((double_t)m_long_double); success = true; break; case e_long_double: success = true; break; } break; @@ -730,6 +1207,8 @@ case e_ulong: m_type = e_slong; success = true; break; case e_slonglong: success = true; break; case e_ulonglong: m_type = e_slonglong; success = true; break; + case e_sint128: success = true; break; + case e_uint128: m_type = e_sint; success = true; break; case e_float: success = true; break; case e_double: success = true; break; case e_long_double: success = true; break; @@ -744,15 +1223,21 @@ switch (m_type) { case e_void: break; - case e_sint: return m_data.sint; - case e_uint: return (int)m_data.uint; - case e_slong: return (int)m_data.slong; - case e_ulong: return (int)m_data.ulong; - case e_slonglong: return (int)m_data.slonglong; - case e_ulonglong: return (int)m_data.ulonglong; - case e_float: return (int)m_data.flt; - case e_double: return (int)m_data.dbl; - case e_long_double: return (int)m_data.ldbl; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return *(const sint_t *)m_integer.getRawData(); + case e_float: + return (sint_t)m_float.convertToFloat(); + case e_double: + return (sint_t)m_float.convertToDouble(); + case e_long_double: + return (sint_t)m_long_double; } return fail_value; } @@ -763,15 +1248,21 @@ switch (m_type) { case e_void: break; - case e_sint: return (unsigned int)m_data.sint; - case e_uint: return (unsigned int)m_data.uint; - case e_slong: return (unsigned int)m_data.slong; - case e_ulong: return (unsigned int)m_data.ulong; - case e_slonglong: return (unsigned int)m_data.slonglong; - case e_ulonglong: return (unsigned int)m_data.ulonglong; - case e_float: return (unsigned int)m_data.flt; - case e_double: return (unsigned int)m_data.dbl; - case e_long_double: return (unsigned int)m_data.ldbl; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return *(const uint_t *)m_integer.getRawData(); + case e_float: + return (uint_t)m_float.convertToFloat(); + case e_double: + return (uint_t)m_float.convertToDouble(); + case e_long_double: + return (uint_t)m_long_double; } return fail_value; } @@ -783,15 +1274,21 @@ switch (m_type) { case e_void: break; - case e_sint: return (long)m_data.sint; - case e_uint: return (long)m_data.uint; - case e_slong: return (long)m_data.slong; - case e_ulong: return (long)m_data.ulong; - case e_slonglong: return (long)m_data.slonglong; - case e_ulonglong: return (long)m_data.ulonglong; - case e_float: return (long)m_data.flt; - case e_double: return (long)m_data.dbl; - case e_long_double: return (long)m_data.ldbl; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return *(const slong_t *)m_integer.getRawData(); + case e_float: + return (slong_t)m_float.convertToFloat(); + case e_double: + return (slong_t)m_float.convertToDouble(); + case e_long_double: + return (slong_t)m_long_double; } return fail_value; } @@ -804,15 +1301,21 @@ switch (m_type) { case e_void: break; - case e_sint: return (unsigned long)m_data.sint; - case e_uint: return (unsigned long)m_data.uint; - case e_slong: return (unsigned long)m_data.slong; - case e_ulong: return (unsigned long)m_data.ulong; - case e_slonglong: return (unsigned long)m_data.slonglong; - case e_ulonglong: return (unsigned long)m_data.ulonglong; - case e_float: return (unsigned long)m_data.flt; - case e_double: return (unsigned long)m_data.dbl; - case e_long_double: return (unsigned long)m_data.ldbl; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return *(const ulong_t *)m_integer.getRawData(); + case e_float: + return (ulong_t)m_float.convertToFloat(); + case e_double: + return (ulong_t)m_float.convertToDouble(); + case e_long_double: + return (ulong_t)m_long_double; } return fail_value; } @@ -827,42 +1330,18 @@ case e_sint: case e_uint: - return m_data.uint; - case e_slong: case e_ulong: - return m_data.ulong; - case e_slonglong: case e_ulonglong: - return m_data.ulonglong; - + case e_sint128: + case e_uint128: + return *m_integer.getRawData(); case e_float: - if (sizeof(m_data.flt) == sizeof(m_data.uint)) - return m_data.uint; - else if (sizeof(m_data.flt) == sizeof(m_data.ulong)) - return m_data.ulong; - else if (sizeof(m_data.flt) == sizeof(m_data.ulonglong)) - return m_data.ulonglong; - break; - case e_double: - if (sizeof(m_data.dbl) == sizeof(m_data.uint)) - return m_data.uint; - else if (sizeof(m_data.dbl) == sizeof(m_data.ulong)) - return m_data.ulong; - else if (sizeof(m_data.dbl) == sizeof(m_data.ulonglong)) - return m_data.ulonglong; - break; - + return (uint64_t)m_float.convertToDouble(); case e_long_double: - if (sizeof(m_data.ldbl) == sizeof(m_data.uint)) - return m_data.uint; - else if (sizeof(m_data.ldbl) == sizeof(m_data.ulong)) - return m_data.ulong; - else if (sizeof(m_data.ldbl) == sizeof(m_data.ulonglong)) - return m_data.ulonglong; - break; + return (uint64_t)m_long_double; } return fail_value; } @@ -875,15 +1354,21 @@ switch (m_type) { case e_void: break; - case e_sint: return (long long)m_data.sint; - case e_uint: return (long long)m_data.uint; - case e_slong: return (long long)m_data.slong; - case e_ulong: return (long long)m_data.ulong; - case e_slonglong: return (long long)m_data.slonglong; - case e_ulonglong: return (long long)m_data.ulonglong; - case e_float: return (long long)m_data.flt; - case e_double: return (long long)m_data.dbl; - case e_long_double: return (long long)m_data.ldbl; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return *(const slonglong_t *)m_integer.getRawData(); + case e_float: + return (slonglong_t)m_float.convertToFloat(); + case e_double: + return (slonglong_t)m_float.convertToDouble(); + case e_long_double: + return (slonglong_t)m_long_double; } return fail_value; } @@ -895,15 +1380,21 @@ switch (m_type) { case e_void: break; - case e_sint: return (unsigned long long)m_data.sint; - case e_uint: return (unsigned long long)m_data.uint; - case e_slong: return (unsigned long long)m_data.slong; - case e_ulong: return (unsigned long long)m_data.ulong; - case e_slonglong: return (unsigned long long)m_data.slonglong; - case e_ulonglong: return (unsigned long long)m_data.ulonglong; - case e_float: return (unsigned long long)m_data.flt; - case e_double: return (unsigned long long)m_data.dbl; - case e_long_double: return (unsigned long long)m_data.ldbl; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return *(const ulonglong_t *)m_integer.getRawData(); + case e_float: + return (ulonglong_t)m_float.convertToFloat(); + case e_double: + return (ulonglong_t)m_float.convertToDouble(); + case e_long_double: + return (ulonglong_t)m_long_double; } return fail_value; } @@ -915,15 +1406,21 @@ switch (m_type) { case e_void: break; - case e_sint: return (float)m_data.sint; - case e_uint: return (float)m_data.uint; - case e_slong: return (float)m_data.slong; - case e_ulong: return (float)m_data.ulong; - case e_slonglong: return (float)m_data.slonglong; - case e_ulonglong: return (float)m_data.ulonglong; - case e_float: return (float)m_data.flt; - case e_double: return (float)m_data.dbl; - case e_long_double: return (float)m_data.ldbl; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return m_integer.bitsToFloat(); + case e_float: + return m_float.convertToFloat(); + case e_double: + return (float_t)m_float.convertToDouble(); + case e_long_double: + return (float_t)m_long_double; } return fail_value; } @@ -935,15 +1432,21 @@ switch (m_type) { case e_void: break; - case e_sint: return (double)m_data.sint; - case e_uint: return (double)m_data.uint; - case e_slong: return (double)m_data.slong; - case e_ulong: return (double)m_data.ulong; - case e_slonglong: return (double)m_data.slonglong; - case e_ulonglong: return (double)m_data.ulonglong; - case e_float: return (double)m_data.flt; - case e_double: return (double)m_data.dbl; - case e_long_double: return (double)m_data.ldbl; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return m_integer.bitsToDouble(); + case e_float: + return (double_t)m_float.convertToFloat(); + case e_double: + return m_float.convertToDouble(); + case e_long_double: + return (double_t)m_long_double; } return fail_value; } @@ -955,15 +1458,21 @@ switch (m_type) { case e_void: break; - case e_sint: return (long double)m_data.sint; - case e_uint: return (long double)m_data.uint; - case e_slong: return (long double)m_data.slong; - case e_ulong: return (long double)m_data.ulong; - case e_slonglong: return (long double)m_data.slonglong; - case e_ulonglong: return (long double)m_data.ulonglong; - case e_float: return (long double)m_data.flt; - case e_double: return (long double)m_data.dbl; - case e_long_double: return (long double)m_data.ldbl; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + return (long_double_t)m_integer.bitsToDouble(); + case e_float: + return (long_double_t)m_float.convertToFloat(); + case e_double: + return (long_double_t)m_float.convertToDouble(); + case e_long_double: + return m_long_double; } return fail_value; } @@ -978,17 +1487,31 @@ if ((m_type = PromoteToMaxType(*this, rhs, temp_value, a, b)) != Scalar::e_void) { switch (m_type) - { - case e_void: break; - case e_sint: m_data.sint = a->m_data.sint + b->m_data.sint; break; - case e_uint: m_data.uint = a->m_data.uint + b->m_data.uint; break; - case e_slong: m_data.slong = a->m_data.slong + b->m_data.slong; break; - case e_ulong: m_data.ulong = a->m_data.ulong + b->m_data.ulong; break; - case e_slonglong: m_data.slonglong = a->m_data.slonglong + b->m_data.slonglong; break; - case e_ulonglong: m_data.ulonglong = a->m_data.ulonglong + b->m_data.ulonglong; break; - case e_float: m_data.flt = a->m_data.flt + b->m_data.flt; break; - case e_double: m_data.dbl = a->m_data.dbl + b->m_data.dbl; break; - case e_long_double: m_data.ldbl = a->m_data.ldbl + b->m_data.ldbl; break; + { + case e_void: break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + { + m_integer = a->m_integer + b->m_integer; + break; + } + case e_float: + case e_double: + { + m_float = a->m_float + b->m_float; + break; + } + case e_long_double: + { + m_long_double = a->m_long_double + b->m_long_double; + break; + } } } return *this; @@ -1007,109 +1530,33 @@ break; case e_sint: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.sint <<= rhs.m_data.sint; break; - case e_uint: m_data.sint <<= rhs.m_data.uint; break; - case e_slong: m_data.sint <<= rhs.m_data.slong; break; - case e_ulong: m_data.sint <<= rhs.m_data.ulong; break; - case e_slonglong: m_data.sint <<= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.sint <<= rhs.m_data.ulonglong; break; - } - break; - case e_uint: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.uint <<= rhs.m_data.sint; break; - case e_uint: m_data.uint <<= rhs.m_data.uint; break; - case e_slong: m_data.uint <<= rhs.m_data.slong; break; - case e_ulong: m_data.uint <<= rhs.m_data.ulong; break; - case e_slonglong: m_data.uint <<= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.uint <<= rhs.m_data.ulonglong; break; - } - break; - case e_slong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.slong <<= rhs.m_data.sint; break; - case e_uint: m_data.slong <<= rhs.m_data.uint; break; - case e_slong: m_data.slong <<= rhs.m_data.slong; break; - case e_ulong: m_data.slong <<= rhs.m_data.ulong; break; - case e_slonglong: m_data.slong <<= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.slong <<= rhs.m_data.ulonglong; break; - } - break; - case e_ulong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.ulong <<= rhs.m_data.sint; break; - case e_uint: m_data.ulong <<= rhs.m_data.uint; break; - case e_slong: m_data.ulong <<= rhs.m_data.slong; break; - case e_ulong: m_data.ulong <<= rhs.m_data.ulong; break; - case e_slonglong: m_data.ulong <<= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.ulong <<= rhs.m_data.ulonglong; break; - } - break; case e_slonglong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.slonglong <<= rhs.m_data.sint; break; - case e_uint: m_data.slonglong <<= rhs.m_data.uint; break; - case e_slong: m_data.slonglong <<= rhs.m_data.slong; break; - case e_ulong: m_data.slonglong <<= rhs.m_data.ulong; break; - case e_slonglong: m_data.slonglong <<= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.slonglong <<= rhs.m_data.ulonglong; break; - } - break; - case e_ulonglong: + case e_sint128: + case e_uint128: switch (rhs.m_type) { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.ulonglong <<= rhs.m_data.sint; break; - case e_uint: m_data.ulonglong <<= rhs.m_data.uint; break; - case e_slong: m_data.ulonglong <<= rhs.m_data.slong; break; - case e_ulong: m_data.ulonglong <<= rhs.m_data.ulong; break; - case e_slonglong: m_data.ulonglong <<= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.ulonglong <<= rhs.m_data.ulonglong; break; + case e_void: + case e_float: + case e_double: + case e_long_double: + m_type = e_void; + break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + { + m_integer <<= *rhs.m_integer.getRawData(); + break; + } } break; } @@ -1127,152 +1574,15 @@ case e_long_double: m_type = e_void; break; - - case e_sint: - case e_uint: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.uint >>= rhs.m_data.sint; break; - case e_uint: m_data.uint >>= rhs.m_data.uint; break; - case e_slong: m_data.uint >>= rhs.m_data.slong; break; - case e_ulong: m_data.uint >>= rhs.m_data.ulong; break; - case e_slonglong: m_data.uint >>= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.uint >>= rhs.m_data.ulonglong; break; - } - break; - - case e_slong: - case e_ulong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.ulong >>= rhs.m_data.sint; break; - case e_uint: m_data.ulong >>= rhs.m_data.uint; break; - case e_slong: m_data.ulong >>= rhs.m_data.slong; break; - case e_ulong: m_data.ulong >>= rhs.m_data.ulong; break; - case e_slonglong: m_data.ulong >>= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.ulong >>= rhs.m_data.ulonglong; break; - } - break; - - case e_slonglong: - case e_ulonglong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.ulonglong >>= rhs.m_data.sint; break; - case e_uint: m_data.ulonglong >>= rhs.m_data.uint; break; - case e_slong: m_data.ulonglong >>= rhs.m_data.slong; break; - case e_ulong: m_data.ulonglong >>= rhs.m_data.ulong; break; - case e_slonglong: m_data.ulonglong >>= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.ulonglong >>= rhs.m_data.ulonglong; break; - } - break; - } - return m_type != e_void; -} - - -Scalar& -Scalar::operator>>= (const Scalar& rhs) -{ - switch (m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - - case e_sint: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.sint >>= rhs.m_data.sint; break; - case e_uint: m_data.sint >>= rhs.m_data.uint; break; - case e_slong: m_data.sint >>= rhs.m_data.slong; break; - case e_ulong: m_data.sint >>= rhs.m_data.ulong; break; - case e_slonglong: m_data.sint >>= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.sint >>= rhs.m_data.ulonglong; break; - } - break; - - case e_uint: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.uint >>= rhs.m_data.sint; break; - case e_uint: m_data.uint >>= rhs.m_data.uint; break; - case e_slong: m_data.uint >>= rhs.m_data.slong; break; - case e_ulong: m_data.uint >>= rhs.m_data.ulong; break; - case e_slonglong: m_data.uint >>= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.uint >>= rhs.m_data.ulonglong; break; - } - break; - - case e_slong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.slong >>= rhs.m_data.sint; break; - case e_uint: m_data.slong >>= rhs.m_data.uint; break; - case e_slong: m_data.slong >>= rhs.m_data.slong; break; - case e_ulong: m_data.slong >>= rhs.m_data.ulong; break; - case e_slonglong: m_data.slong >>= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.slong >>= rhs.m_data.ulonglong; break; - } - break; - - case e_ulong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.ulong >>= rhs.m_data.sint; break; - case e_uint: m_data.ulong >>= rhs.m_data.uint; break; - case e_slong: m_data.ulong >>= rhs.m_data.slong; break; - case e_ulong: m_data.ulong >>= rhs.m_data.ulong; break; - case e_slonglong: m_data.ulong >>= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.ulong >>= rhs.m_data.ulonglong; break; - } - break; + + case e_sint: + case e_uint: + case e_slong: + case e_ulong: case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: switch (rhs.m_type) { case e_void: @@ -1281,16 +1591,42 @@ case e_long_double: m_type = e_void; break; - case e_sint: m_data.slonglong >>= rhs.m_data.sint; break; - case e_uint: m_data.slonglong >>= rhs.m_data.uint; break; - case e_slong: m_data.slonglong >>= rhs.m_data.slong; break; - case e_ulong: m_data.slonglong >>= rhs.m_data.ulong; break; - case e_slonglong: m_data.slonglong >>= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.slonglong >>= rhs.m_data.ulonglong; break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + m_integer = m_integer.lshr(*(const uint_t *) rhs.m_integer.getRawData()); break; } break; + } + return m_type != e_void; +} + + +Scalar& +Scalar::operator>>= (const Scalar& rhs) +{ + switch (m_type) + { + case e_void: + case e_float: + case e_double: + case e_long_double: + m_type = e_void; + break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: case e_ulonglong: + case e_sint128: + case e_uint128: switch (rhs.m_type) { case e_void: @@ -1299,12 +1635,18 @@ case e_long_double: m_type = e_void; break; - case e_sint: m_data.ulonglong >>= rhs.m_data.sint; break; - case e_uint: m_data.ulonglong >>= rhs.m_data.uint; break; - case e_slong: m_data.ulonglong >>= rhs.m_data.slong; break; - case e_ulong: m_data.ulonglong >>= rhs.m_data.ulong; break; - case e_slonglong: m_data.ulonglong >>= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.ulonglong >>= rhs.m_data.ulonglong; break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + { + m_integer >> *rhs.m_integer.getRawData(); + break; + } } break; } @@ -1325,95 +1667,13 @@ break; case e_sint: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.sint &= rhs.m_data.sint; break; - case e_uint: m_data.sint &= rhs.m_data.uint; break; - case e_slong: m_data.sint &= rhs.m_data.slong; break; - case e_ulong: m_data.sint &= rhs.m_data.ulong; break; - case e_slonglong: m_data.sint &= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.sint &= rhs.m_data.ulonglong; break; - } - break; - case e_uint: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.uint &= rhs.m_data.sint; break; - case e_uint: m_data.uint &= rhs.m_data.uint; break; - case e_slong: m_data.uint &= rhs.m_data.slong; break; - case e_ulong: m_data.uint &= rhs.m_data.ulong; break; - case e_slonglong: m_data.uint &= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.uint &= rhs.m_data.ulonglong; break; - } - break; - case e_slong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.slong &= rhs.m_data.sint; break; - case e_uint: m_data.slong &= rhs.m_data.uint; break; - case e_slong: m_data.slong &= rhs.m_data.slong; break; - case e_ulong: m_data.slong &= rhs.m_data.ulong; break; - case e_slonglong: m_data.slong &= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.slong &= rhs.m_data.ulonglong; break; - } - break; - case e_ulong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.ulong &= rhs.m_data.sint; break; - case e_uint: m_data.ulong &= rhs.m_data.uint; break; - case e_slong: m_data.ulong &= rhs.m_data.slong; break; - case e_ulong: m_data.ulong &= rhs.m_data.ulong; break; - case e_slonglong: m_data.ulong &= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.ulong &= rhs.m_data.ulonglong; break; - } - break; case e_slonglong: - switch (rhs.m_type) - { - case e_void: - case e_float: - case e_double: - case e_long_double: - m_type = e_void; - break; - case e_sint: m_data.slonglong &= rhs.m_data.sint; break; - case e_uint: m_data.slonglong &= rhs.m_data.uint; break; - case e_slong: m_data.slonglong &= rhs.m_data.slong; break; - case e_ulong: m_data.slonglong &= rhs.m_data.ulong; break; - case e_slonglong: m_data.slonglong &= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.slonglong &= rhs.m_data.ulonglong; break; - } - break; - case e_ulonglong: + case e_sint128: + case e_uint128: switch (rhs.m_type) { case e_void: @@ -1422,12 +1682,18 @@ case e_long_double: m_type = e_void; break; - case e_sint: m_data.ulonglong &= rhs.m_data.sint; break; - case e_uint: m_data.ulonglong &= rhs.m_data.uint; break; - case e_slong: m_data.ulonglong &= rhs.m_data.slong; break; - case e_ulong: m_data.ulonglong &= rhs.m_data.ulong; break; - case e_slonglong: m_data.ulonglong &= rhs.m_data.slonglong; break; - case e_ulonglong: m_data.ulonglong &= rhs.m_data.ulonglong; break; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + { + m_integer &= rhs.m_integer; + break; + } } break; } @@ -1445,26 +1711,20 @@ break; case e_sint: - if (m_data.sint < 0) - m_data.sint = -m_data.sint; - return true; - case e_slong: - if (m_data.slong < 0) - m_data.slong = -m_data.slong; - return true; - case e_slonglong: - if (m_data.slonglong < 0) - m_data.slonglong = -m_data.slonglong; + case e_sint128: + if (m_integer.isNegative()) + m_integer = -m_integer; return true; case e_uint: case e_ulong: case e_ulonglong: return true; - case e_float: m_data.flt = fabsf(m_data.flt); return true; - case e_double: m_data.dbl = fabs(m_data.dbl); return true; - case e_long_double: m_data.ldbl = fabsl(m_data.ldbl); return true; + case e_uint128: + case e_float: m_float = llvm::APFloat(fabsf(m_float.convertToFloat())); return true; + case e_double: m_float = llvm::APFloat(fabs(m_float.convertToDouble())); return true; + case e_long_double: m_long_double = fabsl(m_long_double); return true; } return false; } @@ -1476,15 +1736,21 @@ switch (m_type) { case e_void: break; - case e_sint: m_data.sint = -m_data.sint; return true; - case e_uint: m_data.uint = -m_data.uint; return true; - case e_slong: m_data.slong = -m_data.slong; return true; - case e_ulong: m_data.ulong = -m_data.ulong; return true; - case e_slonglong: m_data.slonglong = -m_data.slonglong; return true; - case e_ulonglong: m_data.ulonglong = -m_data.ulonglong; return true; - case e_float: m_data.flt = -m_data.flt; return true; - case e_double: m_data.dbl = -m_data.dbl; return true; - case e_long_double: m_data.ldbl = -m_data.ldbl; return true; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + m_integer = -m_integer; return true; + case e_float: + m_float = llvm::APFloat(-(m_float.convertToFloat())); + case e_double: + m_float = llvm::APFloat(-(m_float.convertToDouble())); + case e_long_double: + m_long_double = -m_long_double; return true; } return false; } @@ -1494,12 +1760,15 @@ { switch (m_type) { - case e_sint: m_data.sint = ~m_data.sint; return true; - case e_uint: m_data.uint = ~m_data.uint; return true; - case e_slong: m_data.slong = ~m_data.slong; return true; - case e_ulong: m_data.ulong = ~m_data.ulong; return true; - case e_slonglong: m_data.slonglong = ~m_data.slonglong; return true; - case e_ulonglong: m_data.ulonglong = ~m_data.ulonglong; return true; + case e_sint: + case e_uint: + case e_slong: + case e_ulong: + case e_slonglong: + case e_ulonglong: + case e_sint128: + case e_uint128: + m_integer = ~m_integer; return true; case e_void: case e_float: @@ -1523,15 +1792,20 @@ switch (result.m_type) { case Scalar::e_void: break; - case Scalar::e_sint: result.m_data.sint = a->m_data.sint + b->m_data.sint; break; - case Scalar::e_uint: result.m_data.uint = a->m_data.uint + b->m_data.uint; break; - case Scalar::e_slong: result.m_data.slong = a->m_data.slong + b->m_data.slong; break; - case Scalar::e_ulong: result.m_data.ulong = a->m_data.ulong + b->m_data.ulong; break; - case Scalar::e_slonglong: result.m_data.slonglong = a->m_data.slonglong + b->m_data.slonglong; break; - case Scalar::e_ulonglong: result.m_data.ulonglong = a->m_data.ulonglong + b->m_data.ulonglong; break; - case Scalar::e_float: result.m_data.flt = a->m_data.flt + b->m_data.flt; break; - case Scalar::e_double: result.m_data.dbl = a->m_data.dbl + b->m_data.dbl; break; - case Scalar::e_long_double: result.m_data.ldbl = a->m_data.ldbl + b->m_data.ldbl; break; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + result.m_integer = a->m_integer + b->m_integer; break; + case Scalar::e_float: + case Scalar::e_double: + result.m_float = a->m_float + b->m_float; break; + case Scalar::e_long_double: + result.m_long_double = a->m_long_double + b->m_long_double; break; } } return result; @@ -1550,15 +1824,20 @@ switch (result.m_type) { case Scalar::e_void: break; - case Scalar::e_sint: result.m_data.sint = a->m_data.sint - b->m_data.sint; break; - case Scalar::e_uint: result.m_data.uint = a->m_data.uint - b->m_data.uint; break; - case Scalar::e_slong: result.m_data.slong = a->m_data.slong - b->m_data.slong; break; - case Scalar::e_ulong: result.m_data.ulong = a->m_data.ulong - b->m_data.ulong; break; - case Scalar::e_slonglong: result.m_data.slonglong = a->m_data.slonglong - b->m_data.slonglong; break; - case Scalar::e_ulonglong: result.m_data.ulonglong = a->m_data.ulonglong - b->m_data.ulonglong; break; - case Scalar::e_float: result.m_data.flt = a->m_data.flt - b->m_data.flt; break; - case Scalar::e_double: result.m_data.dbl = a->m_data.dbl - b->m_data.dbl; break; - case Scalar::e_long_double: result.m_data.ldbl = a->m_data.ldbl - b->m_data.ldbl; break; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + result.m_integer = a->m_integer - b->m_integer; break; + case Scalar::e_float: + case Scalar::e_double: + result.m_float = a->m_float - b->m_float; break; + case Scalar::e_long_double: + result.m_long_double = a->m_long_double - b->m_long_double; break; } } return result; @@ -1577,15 +1856,43 @@ { case Scalar::e_void: break; - case Scalar::e_sint: if (b->m_data.sint != 0) { result.m_data.sint = a->m_data.sint/ b->m_data.sint; return result; } break; - case Scalar::e_uint: if (b->m_data.uint != 0) { result.m_data.uint = a->m_data.uint / b->m_data.uint; return result; } break; - case Scalar::e_slong: if (b->m_data.slong != 0) { result.m_data.slong = a->m_data.slong / b->m_data.slong; return result; } break; - case Scalar::e_ulong: if (b->m_data.ulong != 0) { result.m_data.ulong = a->m_data.ulong / b->m_data.ulong; return result; } break; - case Scalar::e_slonglong: if (b->m_data.slonglong != 0) { result.m_data.slonglong = a->m_data.slonglong / b->m_data.slonglong; return result; } break; - case Scalar::e_ulonglong: if (b->m_data.ulonglong != 0) { result.m_data.ulonglong = a->m_data.ulonglong / b->m_data.ulonglong; return result; } break; - case Scalar::e_float: if (b->m_data.flt != 0.0f) { result.m_data.flt = a->m_data.flt / b->m_data.flt; return result; } break; - case Scalar::e_double: if (b->m_data.dbl != 0.0) { result.m_data.dbl = a->m_data.dbl / b->m_data.dbl; return result; } break; - case Scalar::e_long_double: if (b->m_data.ldbl != 0.0) { result.m_data.ldbl = a->m_data.ldbl / b->m_data.ldbl; return result; } break; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + { + if (b->m_integer != 0) + { + result.m_integer = *a->m_integer.getRawData() / *b->m_integer.getRawData(); + return result; + } + break; + } + case Scalar::e_float: + if (b->m_float.convertToFloat() != 0.0) + { + result.m_float = a->m_float / b->m_float; + return result; + } + break; + case Scalar::e_double: + if (b->m_float.convertToDouble() != 0.0) + { + result.m_float = a->m_float / b->m_float; + return result; + } + break; + case Scalar::e_long_double: + if (b->m_long_double != 0.0) + { + result.m_long_double = a->m_long_double / b->m_long_double; + return result; + } + break; } } // For division only, the only way it should make it here is if a promotion failed, @@ -1606,15 +1913,20 @@ switch (result.m_type) { case Scalar::e_void: break; - case Scalar::e_sint: result.m_data.sint = a->m_data.sint * b->m_data.sint; break; - case Scalar::e_uint: result.m_data.uint = a->m_data.uint * b->m_data.uint; break; - case Scalar::e_slong: result.m_data.slong = a->m_data.slong * b->m_data.slong; break; - case Scalar::e_ulong: result.m_data.ulong = a->m_data.ulong * b->m_data.ulong; break; - case Scalar::e_slonglong: result.m_data.slonglong = a->m_data.slonglong * b->m_data.slonglong; break; - case Scalar::e_ulonglong: result.m_data.ulonglong = a->m_data.ulonglong * b->m_data.ulonglong; break; - case Scalar::e_float: result.m_data.flt = a->m_data.flt * b->m_data.flt; break; - case Scalar::e_double: result.m_data.dbl = a->m_data.dbl * b->m_data.dbl; break; - case Scalar::e_long_double: result.m_data.ldbl = a->m_data.ldbl * b->m_data.ldbl; break; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + result.m_integer = a->m_integer * b->m_integer; break; + case Scalar::e_float: + case Scalar::e_double: + result.m_float = a->m_float * b->m_float; break; + case Scalar::e_long_double: + result.m_long_double = a->m_long_double * b->m_long_double; break; } } return result; @@ -1631,13 +1943,15 @@ { switch (result.m_type) { - case Scalar::e_sint: result.m_data.sint = a->m_data.sint & b->m_data.sint; break; - case Scalar::e_uint: result.m_data.uint = a->m_data.uint & b->m_data.uint; break; - case Scalar::e_slong: result.m_data.slong = a->m_data.slong & b->m_data.slong; break; - case Scalar::e_ulong: result.m_data.ulong = a->m_data.ulong & b->m_data.ulong; break; - case Scalar::e_slonglong: result.m_data.slonglong = a->m_data.slonglong & b->m_data.slonglong; break; - case Scalar::e_ulonglong: result.m_data.ulonglong = a->m_data.ulonglong & b->m_data.ulonglong; break; - + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + result.m_integer = a->m_integer & b->m_integer; break; case Scalar::e_void: case Scalar::e_float: case Scalar::e_double: @@ -1661,12 +1975,15 @@ { switch (result.m_type) { - case Scalar::e_sint: result.m_data.sint = a->m_data.sint | b->m_data.sint; break; - case Scalar::e_uint: result.m_data.uint = a->m_data.uint | b->m_data.uint; break; - case Scalar::e_slong: result.m_data.slong = a->m_data.slong | b->m_data.slong; break; - case Scalar::e_ulong: result.m_data.ulong = a->m_data.ulong | b->m_data.ulong; break; - case Scalar::e_slonglong: result.m_data.slonglong = a->m_data.slonglong | b->m_data.slonglong; break; - case Scalar::e_ulonglong: result.m_data.ulonglong = a->m_data.ulonglong | b->m_data.ulonglong; break; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + result.m_integer = a->m_integer | b->m_integer; break; case Scalar::e_void: case Scalar::e_float: @@ -1692,12 +2009,23 @@ switch (result.m_type) { default: break; - case Scalar::e_sint: if (b->m_data.sint != 0) { result.m_data.sint = a->m_data.sint % b->m_data.sint; return result; } break; - case Scalar::e_uint: if (b->m_data.uint != 0) { result.m_data.uint = a->m_data.uint % b->m_data.uint; return result; } break; - case Scalar::e_slong: if (b->m_data.slong != 0) { result.m_data.slong = a->m_data.slong % b->m_data.slong; return result; } break; - case Scalar::e_ulong: if (b->m_data.ulong != 0) { result.m_data.ulong = a->m_data.ulong % b->m_data.ulong; return result; } break; - case Scalar::e_slonglong: if (b->m_data.slonglong != 0) { result.m_data.slonglong = a->m_data.slonglong % b->m_data.slonglong; return result; } break; - case Scalar::e_ulonglong: if (b->m_data.ulonglong != 0) { result.m_data.ulonglong = a->m_data.ulonglong % b->m_data.ulonglong; return result; } break; + case Scalar::e_void: break; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + { + if (b->m_integer != 0) + { + result.m_integer = *a->m_integer.getRawData() % *b->m_integer.getRawData(); + return result; + } + break; + } } } result.m_type = Scalar::e_void; @@ -1715,12 +2043,15 @@ { switch (result.m_type) { - case Scalar::e_sint: result.m_data.sint = a->m_data.sint ^ b->m_data.sint; break; - case Scalar::e_uint: result.m_data.uint = a->m_data.uint ^ b->m_data.uint; break; - case Scalar::e_slong: result.m_data.slong = a->m_data.slong ^ b->m_data.slong; break; - case Scalar::e_ulong: result.m_data.ulong = a->m_data.ulong ^ b->m_data.ulong; break; - case Scalar::e_slonglong: result.m_data.slonglong = a->m_data.slonglong ^ b->m_data.slonglong; break; - case Scalar::e_ulonglong: result.m_data.ulonglong = a->m_data.ulonglong ^ b->m_data.ulonglong; break; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + result.m_integer = a->m_integer ^ b->m_integer; break; case Scalar::e_void: case Scalar::e_float: @@ -1754,21 +2085,21 @@ unsigned int Scalar::RawUInt () const { - return m_data.uint; + return *(const uint_t *) m_integer.getRawData(); } // Return the raw unsigned long without any casting or conversion unsigned long Scalar::RawULong () const { - return m_data.ulong; + return *(const ulong_t *) m_integer.getRawData(); } // Return the raw unsigned long long without any casting or conversion unsigned long long Scalar::RawULongLong () const { - return m_data.ulonglong; + return *(const ulonglong_t *) m_integer.getRawData(); } @@ -1801,9 +2132,9 @@ m_type = Scalar::GetValueTypeForUnsignedIntegerWithByteSize (byte_size); switch (m_type) { - case e_uint: m_data.uint = (uint_t)uval64; break; - case e_ulong: m_data.ulong = (ulong_t)uval64; break; - case e_ulonglong: m_data.ulonglong = (ulonglong_t)uval64; break; + case e_uint: m_integer = llvm::APInt(sizeof(uint_t), uval64, false); break; + case e_ulong: m_integer = llvm::APInt(sizeof(ulong_t), uval64, false); break; + case e_ulonglong: m_integer = llvm::APInt(sizeof(ulonglong_t), uval64, false); break; default: error.SetErrorStringWithFormat("unsupported unsigned integer byte size: %" PRIu64 "", (uint64_t)byte_size); break; @@ -1830,9 +2161,9 @@ m_type = Scalar::GetValueTypeForSignedIntegerWithByteSize (byte_size); switch (m_type) { - case e_sint: m_data.sint = (sint_t)sval64; break; - case e_slong: m_data.slong = (slong_t)sval64; break; - case e_slonglong: m_data.slonglong = (slonglong_t)sval64; break; + case e_sint: m_integer = llvm::APInt(sizeof(sint_t), sval64, true); break; + case e_slong: m_integer = llvm::APInt(sizeof(slong_t), sval64, true); break; + case e_slonglong: m_integer = llvm::APInt(sizeof(slonglong_t), sval64, true); break; default: error.SetErrorStringWithFormat("unsupported signed integer byte size: %" PRIu64 "", (uint64_t)byte_size); break; @@ -1847,23 +2178,27 @@ break; case eEncodingIEEE754: + float f_val; + double d_val; if (byte_size == sizeof (float)) { - if (::sscanf (value_str, "%f", &m_data.flt) == 1) + f_val = m_float.convertToFloat(); + if (::sscanf (value_str, "%f", &f_val) == 1) m_type = e_float; else error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str); } else if (byte_size == sizeof (double)) { - if (::sscanf (value_str, "%lf", &m_data.dbl) == 1) + d_val = m_float.convertToDouble(); + if (::sscanf (value_str, "%lf", &d_val) == 1) m_type = e_double; else error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str); } else if (byte_size == sizeof (long double)) { - if (::sscanf (value_str, "%Lf", &m_data.ldbl) == 1) + if (::sscanf (value_str, "%Lf", &m_long_double) == 1) m_type = e_long_double; else error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str); @@ -1966,47 +2301,22 @@ case Scalar::e_sint: case Scalar::e_uint: - if (max_bit_pos == sign_bit_pos) - return true; - else if (sign_bit_pos < (max_bit_pos-1)) - { - unsigned int sign_bit = 1u << sign_bit_pos; - if (m_data.uint & sign_bit) - { - const unsigned int mask = ~(sign_bit) + 1u; - m_data.uint |= mask; - } - return true; - } - break; - case Scalar::e_slong: case Scalar::e_ulong: - if (max_bit_pos == sign_bit_pos) - return true; - else if (sign_bit_pos < (max_bit_pos-1)) - { - unsigned long sign_bit = 1ul << sign_bit_pos; - if (m_data.ulong & sign_bit) - { - const unsigned long mask = ~(sign_bit) + 1ul; - m_data.ulong |= mask; - } - return true; - } - break; - case Scalar::e_slonglong: case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: if (max_bit_pos == sign_bit_pos) return true; else if (sign_bit_pos < (max_bit_pos-1)) { - unsigned long long sign_bit = 1ull << sign_bit_pos; - if (m_data.ulonglong & sign_bit) + llvm::APInt sign_bit = llvm::APInt::getSignBit(sign_bit_pos + 1); + llvm::APInt bitwize_and = m_integer & sign_bit; + if (bitwize_and.getBoolValue()) { - const unsigned long long mask = ~(sign_bit) + 1ull; - m_data.ulonglong |= mask; + const llvm::APInt mask = ~(sign_bit) + llvm::APInt(m_integer.getBitWidth(), 1); + m_integer |= mask; } return true; } @@ -2053,66 +2363,34 @@ uint32_t msbit = bit_offset + bit_size - 1; uint32_t lsbit = bit_offset; + uint64_t result; switch (m_type) { case Scalar::e_void: break; case e_float: - if (sizeof(m_data.flt) == sizeof(sint_t)) - m_data.sint = (sint_t)SignedBits (m_data.sint, msbit, lsbit); - else if (sizeof(m_data.flt) == sizeof(ulong_t)) - m_data.slong = (slong_t)SignedBits (m_data.slong, msbit, lsbit); - else if (sizeof(m_data.flt) == sizeof(ulonglong_t)) - m_data.slonglong = (slonglong_t)SignedBits (m_data.slonglong, msbit, lsbit); - else - return false; + result = SignedBits ((uint64_t )m_float.convertToFloat(), msbit, lsbit); + m_float = llvm::APFloat((float_t)result); return true; - case e_double: - if (sizeof(m_data.dbl) == sizeof(sint_t)) - m_data.sint = SignedBits (m_data.sint, msbit, lsbit); - else if (sizeof(m_data.dbl) == sizeof(ulong_t)) - m_data.slong = SignedBits (m_data.slong, msbit, lsbit); - else if (sizeof(m_data.dbl) == sizeof(ulonglong_t)) - m_data.slonglong = SignedBits (m_data.slonglong, msbit, lsbit); - else - return false; - return true; - + result = SignedBits ((uint64_t )m_float.convertToDouble(), msbit, lsbit); + m_float = llvm::APFloat((double_t)result); case e_long_double: - if (sizeof(m_data.ldbl) == sizeof(sint_t)) - m_data.sint = SignedBits (m_data.sint, msbit, lsbit); - else if (sizeof(m_data.ldbl) == sizeof(ulong_t)) - m_data.slong = SignedBits (m_data.slong, msbit, lsbit); - else if (sizeof(m_data.ldbl) == sizeof(ulonglong_t)) - m_data.slonglong = SignedBits (m_data.slonglong, msbit, lsbit); - else - return false; + m_long_double = SignedBits (m_long_double, msbit, lsbit); return true; case Scalar::e_sint: - m_data.sint = (sint_t)SignedBits (m_data.sint, msbit, lsbit); - return true; - - case Scalar::e_uint: - m_data.uint = (uint_t)UnsignedBits (m_data.uint, msbit, lsbit); - return true; - case Scalar::e_slong: - m_data.slong = (slong_t)SignedBits (m_data.slong, msbit, lsbit); - return true; - - case Scalar::e_ulong: - m_data.ulong = (ulong_t)UnsignedBits (m_data.ulong, msbit, lsbit); - return true; - case Scalar::e_slonglong: - m_data.slonglong = (slonglong_t)SignedBits (m_data.slonglong, msbit, lsbit); + case Scalar::e_sint128: + m_integer = SignedBits (*m_integer.getRawData(), msbit, lsbit); return true; - + case Scalar::e_uint: + case Scalar::e_ulong: case Scalar::e_ulonglong: - m_data.ulonglong = (ulonglong_t)UnsignedBits (m_data.ulonglong, msbit, lsbit); + case Scalar::e_uint128: + m_integer = UnsignedBits (*m_integer.getRawData(), msbit, lsbit); return true; } return false; @@ -2132,18 +2410,26 @@ Scalar temp_value; const Scalar* a; const Scalar* b; + llvm::APFloat::cmpResult result; switch (PromoteToMaxType(lhs, rhs, temp_value, a, b)) { case Scalar::e_void: break; - case Scalar::e_sint: return a->m_data.sint == b->m_data.sint; - case Scalar::e_uint: return a->m_data.uint == b->m_data.uint; - case Scalar::e_slong: return a->m_data.slong == b->m_data.slong; - case Scalar::e_ulong: return a->m_data.ulong == b->m_data.ulong; - case Scalar::e_slonglong: return a->m_data.slonglong == b->m_data.slonglong; - case Scalar::e_ulonglong: return a->m_data.ulonglong == b->m_data.ulonglong; - case Scalar::e_float: return a->m_data.flt == b->m_data.flt; - case Scalar::e_double: return a->m_data.dbl == b->m_data.dbl; - case Scalar::e_long_double: return a->m_data.ldbl == b->m_data.ldbl; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + return a->m_integer == b->m_integer; + case Scalar::e_float: + case Scalar::e_double: + result = a->m_float.compare(b->m_float); + if(result == llvm::APFloat::cmpEqual) + return true; + case Scalar::e_long_double: + return a->m_long_double == b->m_long_double; } return false; } @@ -2158,18 +2444,26 @@ Scalar temp_value; // A temp value that might get a copy of either promoted value const Scalar* a; const Scalar* b; + llvm::APFloat::cmpResult result; switch (PromoteToMaxType(lhs, rhs, temp_value, a, b)) { case Scalar::e_void: break; - case Scalar::e_sint: return a->m_data.sint != b->m_data.sint; - case Scalar::e_uint: return a->m_data.uint != b->m_data.uint; - case Scalar::e_slong: return a->m_data.slong != b->m_data.slong; - case Scalar::e_ulong: return a->m_data.ulong != b->m_data.ulong; - case Scalar::e_slonglong: return a->m_data.slonglong != b->m_data.slonglong; - case Scalar::e_ulonglong: return a->m_data.ulonglong != b->m_data.ulonglong; - case Scalar::e_float: return a->m_data.flt != b->m_data.flt; - case Scalar::e_double: return a->m_data.dbl != b->m_data.dbl; - case Scalar::e_long_double: return a->m_data.ldbl != b->m_data.ldbl; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + return a->m_integer != b->m_integer; + case Scalar::e_float: + case Scalar::e_double: + result = a->m_float.compare(b->m_float); + if(result != llvm::APFloat::cmpEqual) + return true; + case Scalar::e_long_double: + return a->m_long_double != b->m_long_double; } return true; } @@ -2183,18 +2477,26 @@ Scalar temp_value; const Scalar* a; const Scalar* b; + llvm::APFloat::cmpResult result; switch (PromoteToMaxType(lhs, rhs, temp_value, a, b)) { case Scalar::e_void: break; - case Scalar::e_sint: return a->m_data.sint < b->m_data.sint; - case Scalar::e_uint: return a->m_data.uint < b->m_data.uint; - case Scalar::e_slong: return a->m_data.slong < b->m_data.slong; - case Scalar::e_ulong: return a->m_data.ulong < b->m_data.ulong; - case Scalar::e_slonglong: return a->m_data.slonglong < b->m_data.slonglong; - case Scalar::e_ulonglong: return a->m_data.ulonglong < b->m_data.ulonglong; - case Scalar::e_float: return a->m_data.flt < b->m_data.flt; - case Scalar::e_double: return a->m_data.dbl < b->m_data.dbl; - case Scalar::e_long_double: return a->m_data.ldbl < b->m_data.ldbl; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + return a->m_integer < b->m_integer; + case Scalar::e_float: + case Scalar::e_double: + result = a->m_float.compare(b->m_float); + if(result == llvm::APFloat::cmpLessThan) + return true; + case Scalar::e_long_double: + return a->m_long_double < b->m_long_double; } return false; } @@ -2208,18 +2510,26 @@ Scalar temp_value; const Scalar* a; const Scalar* b; + llvm::APFloat::cmpResult result; switch (PromoteToMaxType(lhs, rhs, temp_value, a, b)) { case Scalar::e_void: break; - case Scalar::e_sint: return a->m_data.sint <= b->m_data.sint; - case Scalar::e_uint: return a->m_data.uint <= b->m_data.uint; - case Scalar::e_slong: return a->m_data.slong <= b->m_data.slong; - case Scalar::e_ulong: return a->m_data.ulong <= b->m_data.ulong; - case Scalar::e_slonglong: return a->m_data.slonglong <= b->m_data.slonglong; - case Scalar::e_ulonglong: return a->m_data.ulonglong <= b->m_data.ulonglong; - case Scalar::e_float: return a->m_data.flt <= b->m_data.flt; - case Scalar::e_double: return a->m_data.dbl <= b->m_data.dbl; - case Scalar::e_long_double: return a->m_data.ldbl <= b->m_data.ldbl; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + return a->m_integer <= b->m_integer; + case Scalar::e_float: + case Scalar::e_double: + result = a->m_float.compare(b->m_float); + if(result == llvm::APFloat::cmpLessThan || result == llvm::APFloat::cmpEqual) + return true; + case Scalar::e_long_double: + return a->m_long_double <= b->m_long_double; } return false; } @@ -2234,18 +2544,25 @@ Scalar temp_value; const Scalar* a; const Scalar* b; + llvm::APFloat::cmpResult result; switch (PromoteToMaxType(lhs, rhs, temp_value, a, b)) { - case Scalar::e_void: break; - case Scalar::e_sint: return a->m_data.sint > b->m_data.sint; - case Scalar::e_uint: return a->m_data.uint > b->m_data.uint; - case Scalar::e_slong: return a->m_data.slong > b->m_data.slong; - case Scalar::e_ulong: return a->m_data.ulong > b->m_data.ulong; - case Scalar::e_slonglong: return a->m_data.slonglong > b->m_data.slonglong; - case Scalar::e_ulonglong: return a->m_data.ulonglong > b->m_data.ulonglong; - case Scalar::e_float: return a->m_data.flt > b->m_data.flt; - case Scalar::e_double: return a->m_data.dbl > b->m_data.dbl; - case Scalar::e_long_double: return a->m_data.ldbl > b->m_data.ldbl; + case Scalar::e_void: break; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + case Scalar::e_float: + case Scalar::e_double: + result = a->m_float.compare(b->m_float); + if(result == llvm::APFloat::cmpGreaterThan) + return true; + case Scalar::e_long_double: + return a->m_long_double < b->m_long_double; } return false; } @@ -2259,22 +2576,26 @@ Scalar temp_value; const Scalar* a; const Scalar* b; + llvm::APFloat::cmpResult result; switch (PromoteToMaxType(lhs, rhs, temp_value, a, b)) { - case Scalar::e_void: break; - case Scalar::e_sint: return a->m_data.sint >= b->m_data.sint; - case Scalar::e_uint: return a->m_data.uint >= b->m_data.uint; - case Scalar::e_slong: return a->m_data.slong >= b->m_data.slong; - case Scalar::e_ulong: return a->m_data.ulong >= b->m_data.ulong; - case Scalar::e_slonglong: return a->m_data.slonglong >= b->m_data.slonglong; - case Scalar::e_ulonglong: return a->m_data.ulonglong >= b->m_data.ulonglong; - case Scalar::e_float: return a->m_data.flt >= b->m_data.flt; - case Scalar::e_double: return a->m_data.dbl >= b->m_data.dbl; - case Scalar::e_long_double: return a->m_data.ldbl >= b->m_data.ldbl; + case Scalar::e_void: break; + case Scalar::e_sint: + case Scalar::e_uint: + case Scalar::e_slong: + case Scalar::e_ulong: + case Scalar::e_slonglong: + case Scalar::e_ulonglong: + case Scalar::e_sint128: + case Scalar::e_uint128: + return a->m_integer <= b->m_integer; + case Scalar::e_float: + case Scalar::e_double: + result = a->m_float.compare(b->m_float); + if(result == llvm::APFloat::cmpGreaterThan || result == llvm::APFloat::cmpEqual) + return true; + case Scalar::e_long_double: + return a->m_long_double <= b->m_long_double; } return false; } - - - - Index: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp =================================================================== --- source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -33,7 +33,7 @@ #include "llvm/ADT/STLExtras.h" #include "Plugins/Process/Utility/InstructionUtils.h" -#include "Plugins/Process/Utility/RegisterContext_mips64.h" //mips32 has same registers nos as mips64 +#include "Plugins/Process/Utility/RegisterContext_mips.h" //mips32 has same registers nos as mips64 using namespace lldb; using namespace lldb_private; @@ -302,38 +302,38 @@ case gcc_dwarf_bad_mips: return "bad"; case gcc_dwarf_cause_mips: return "cause"; case gcc_dwarf_pc_mips: return "pc"; - case gcc_dwarf_f0_mips: return "fp_reg[0]"; - case gcc_dwarf_f1_mips: return "fp_reg[1]"; - case gcc_dwarf_f2_mips: return "fp_reg[2]"; - case gcc_dwarf_f3_mips: return "fp_reg[3]"; - case gcc_dwarf_f4_mips: return "fp_reg[4]"; - case gcc_dwarf_f5_mips: return "fp_reg[5]"; - case gcc_dwarf_f6_mips: return "fp_reg[6]"; - case gcc_dwarf_f7_mips: return "fp_reg[7]"; - case gcc_dwarf_f8_mips: return "fp_reg[8]"; - case gcc_dwarf_f9_mips: return "fp_reg[9]"; - case gcc_dwarf_f10_mips: return "fp_reg[10]"; - case gcc_dwarf_f11_mips: return "fp_reg[11]"; - case gcc_dwarf_f12_mips: return "fp_reg[12]"; - case gcc_dwarf_f13_mips: return "fp_reg[13]"; - case gcc_dwarf_f14_mips: return "fp_reg[14]"; - case gcc_dwarf_f15_mips: return "fp_reg[15]"; - case gcc_dwarf_f16_mips: return "fp_reg[16]"; - case gcc_dwarf_f17_mips: return "fp_reg[17]"; - case gcc_dwarf_f18_mips: return "fp_reg[18]"; - case gcc_dwarf_f19_mips: return "fp_reg[19]"; - case gcc_dwarf_f20_mips: return "fp_reg[20]"; - case gcc_dwarf_f21_mips: return "fp_reg[21]"; - case gcc_dwarf_f22_mips: return "fp_reg[22]"; - case gcc_dwarf_f23_mips: return "fp_reg[23]"; - case gcc_dwarf_f24_mips: return "fp_reg[24]"; - case gcc_dwarf_f25_mips: return "fp_reg[25]"; - case gcc_dwarf_f26_mips: return "fp_reg[26]"; - case gcc_dwarf_f27_mips: return "fp_reg[27]"; - case gcc_dwarf_f28_mips: return "fp_reg[28]"; - case gcc_dwarf_f29_mips: return "fp_reg[29]"; - case gcc_dwarf_f30_mips: return "fp_reg[30]"; - case gcc_dwarf_f31_mips: return "fp_reg[31]"; + case gcc_dwarf_f0_mips: return "f0"; + case gcc_dwarf_f1_mips: return "f1"; + case gcc_dwarf_f2_mips: return "f2"; + case gcc_dwarf_f3_mips: return "f3"; + case gcc_dwarf_f4_mips: return "f4"; + case gcc_dwarf_f5_mips: return "f5"; + case gcc_dwarf_f6_mips: return "f6"; + case gcc_dwarf_f7_mips: return "f7"; + case gcc_dwarf_f8_mips: return "f8"; + case gcc_dwarf_f9_mips: return "f9"; + case gcc_dwarf_f10_mips: return "f10"; + case gcc_dwarf_f11_mips: return "f11"; + case gcc_dwarf_f12_mips: return "f12"; + case gcc_dwarf_f13_mips: return "f13"; + case gcc_dwarf_f14_mips: return "f14"; + case gcc_dwarf_f15_mips: return "f15"; + case gcc_dwarf_f16_mips: return "f16"; + case gcc_dwarf_f17_mips: return "f17"; + case gcc_dwarf_f18_mips: return "f18"; + case gcc_dwarf_f19_mips: return "f19"; + case gcc_dwarf_f20_mips: return "f20"; + case gcc_dwarf_f21_mips: return "f21"; + case gcc_dwarf_f22_mips: return "f22"; + case gcc_dwarf_f23_mips: return "f23"; + case gcc_dwarf_f24_mips: return "f24"; + case gcc_dwarf_f25_mips: return "f25"; + case gcc_dwarf_f26_mips: return "f26"; + case gcc_dwarf_f27_mips: return "f27"; + case gcc_dwarf_f28_mips: return "f28"; + case gcc_dwarf_f29_mips: return "f29"; + case gcc_dwarf_f30_mips: return "f30"; + case gcc_dwarf_f31_mips: return "f31"; case gcc_dwarf_fcsr_mips: return "fcsr"; case gcc_dwarf_fir_mips: return "fir"; } Index: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp =================================================================== --- source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -33,7 +33,7 @@ #include "llvm/ADT/STLExtras.h" #include "Plugins/Process/Utility/InstructionUtils.h" -#include "Plugins/Process/Utility/RegisterContext_mips64.h" +#include "Plugins/Process/Utility/RegisterContext_mips.h" using namespace lldb; using namespace lldb_private; @@ -302,38 +302,38 @@ case gcc_dwarf_bad_mips64: return "bad"; case gcc_dwarf_cause_mips64: return "cause"; case gcc_dwarf_pc_mips64: return "pc"; - case gcc_dwarf_f0_mips64: return "fp_reg[0]"; - case gcc_dwarf_f1_mips64: return "fp_reg[1]"; - case gcc_dwarf_f2_mips64: return "fp_reg[2]"; - case gcc_dwarf_f3_mips64: return "fp_reg[3]"; - case gcc_dwarf_f4_mips64: return "fp_reg[4]"; - case gcc_dwarf_f5_mips64: return "fp_reg[5]"; - case gcc_dwarf_f6_mips64: return "fp_reg[6]"; - case gcc_dwarf_f7_mips64: return "fp_reg[7]"; - case gcc_dwarf_f8_mips64: return "fp_reg[8]"; - case gcc_dwarf_f9_mips64: return "fp_reg[9]"; - case gcc_dwarf_f10_mips64: return "fp_reg[10]"; - case gcc_dwarf_f11_mips64: return "fp_reg[11]"; - case gcc_dwarf_f12_mips64: return "fp_reg[12]"; - case gcc_dwarf_f13_mips64: return "fp_reg[13]"; - case gcc_dwarf_f14_mips64: return "fp_reg[14]"; - case gcc_dwarf_f15_mips64: return "fp_reg[15]"; - case gcc_dwarf_f16_mips64: return "fp_reg[16]"; - case gcc_dwarf_f17_mips64: return "fp_reg[17]"; - case gcc_dwarf_f18_mips64: return "fp_reg[18]"; - case gcc_dwarf_f19_mips64: return "fp_reg[19]"; - case gcc_dwarf_f20_mips64: return "fp_reg[20]"; - case gcc_dwarf_f21_mips64: return "fp_reg[21]"; - case gcc_dwarf_f22_mips64: return "fp_reg[22]"; - case gcc_dwarf_f23_mips64: return "fp_reg[23]"; - case gcc_dwarf_f24_mips64: return "fp_reg[24]"; - case gcc_dwarf_f25_mips64: return "fp_reg[25]"; - case gcc_dwarf_f26_mips64: return "fp_reg[26]"; - case gcc_dwarf_f27_mips64: return "fp_reg[27]"; - case gcc_dwarf_f28_mips64: return "fp_reg[28]"; - case gcc_dwarf_f29_mips64: return "fp_reg[29]"; - case gcc_dwarf_f30_mips64: return "fp_reg[30]"; - case gcc_dwarf_f31_mips64: return "fp_reg[31]"; + case gcc_dwarf_f0_mips64: return "f0"; + case gcc_dwarf_f1_mips64: return "f1"; + case gcc_dwarf_f2_mips64: return "f2"; + case gcc_dwarf_f3_mips64: return "f3"; + case gcc_dwarf_f4_mips64: return "f4"; + case gcc_dwarf_f5_mips64: return "f5"; + case gcc_dwarf_f6_mips64: return "f6"; + case gcc_dwarf_f7_mips64: return "f7"; + case gcc_dwarf_f8_mips64: return "f8"; + case gcc_dwarf_f9_mips64: return "f9"; + case gcc_dwarf_f10_mips64: return "f10"; + case gcc_dwarf_f11_mips64: return "f11"; + case gcc_dwarf_f12_mips64: return "f12"; + case gcc_dwarf_f13_mips64: return "f13"; + case gcc_dwarf_f14_mips64: return "f14"; + case gcc_dwarf_f15_mips64: return "f15"; + case gcc_dwarf_f16_mips64: return "f16"; + case gcc_dwarf_f17_mips64: return "f17"; + case gcc_dwarf_f18_mips64: return "f18"; + case gcc_dwarf_f19_mips64: return "f19"; + case gcc_dwarf_f20_mips64: return "f20"; + case gcc_dwarf_f21_mips64: return "f21"; + case gcc_dwarf_f22_mips64: return "f22"; + case gcc_dwarf_f23_mips64: return "f23"; + case gcc_dwarf_f24_mips64: return "f24"; + case gcc_dwarf_f25_mips64: return "f25"; + case gcc_dwarf_f26_mips64: return "f26"; + case gcc_dwarf_f27_mips64: return "f27"; + case gcc_dwarf_f28_mips64: return "f28"; + case gcc_dwarf_f29_mips64: return "f29"; + case gcc_dwarf_f30_mips64: return "f30"; + case gcc_dwarf_f31_mips64: return "f31"; case gcc_dwarf_fcsr_mips64: return "fcsr"; case gcc_dwarf_fir_mips64: return "fir"; } Index: source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp =================================================================== --- source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp +++ source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp @@ -164,7 +164,7 @@ void* buf = GetFPRBuffer(); if (!buf) - return Error("GPR buffer is NULL"); + return Error("FPR buffer is NULL"); size_t buf_size = GetFPRSize(); NativeProcessLinux* process_p = static_cast(process_sp.get()); @@ -180,7 +180,7 @@ void* buf = GetFPRBuffer(); if (!buf) - return Error("GPR buffer is NULL"); + return Error("FPR buffer is NULL"); size_t buf_size = GetFPRSize(); NativeProcessLinux* process_p = static_cast(process_sp.get()); Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h =================================================================== --- source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h +++ source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h @@ -13,8 +13,8 @@ #define lldb_NativeRegisterContextLinux_mips64_h #include "Plugins/Process/Linux/NativeRegisterContextLinux.h" -#include "Plugins/Process/Utility/RegisterContext_mips64.h" -#include "Plugins/Process/Utility/lldb-mips64-register-enums.h" +#include "Plugins/Process/Utility/RegisterContext_mips.h" +#include "Plugins/Process/Utility/lldb-mips-linux-register-enums.h" #define MAX_NUM_WP 8 @@ -52,10 +52,10 @@ WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) override; Error - ReadFPR() override; + ReadCP1(); Error - WriteFPR() override; + WriteCP1(); Error IsWatchpointHit (uint32_t wp_index, bool &is_hit) override; @@ -108,16 +108,25 @@ IsFR0(); bool + IsFRE(); + + bool IsFPR(uint32_t reg_index) const; + bool + IsMSA(uint32_t reg_index) const; + + bool + IsMSAAvailable(); + void* - GetGPRBuffer() override { return &m_gpr_mips64; } + GetGPRBuffer() override { return &m_gpr; } void* GetFPRBuffer() override { return &m_fpr; } size_t - GetFPRSize() override { return sizeof(FPR_mips); } + GetFPRSize() override { return sizeof(FPR_linux_mips); } private: // Info about register ranges. @@ -130,15 +139,21 @@ uint32_t last_gpr; uint32_t first_fpr; uint32_t last_fpr; + uint32_t first_msa; + uint32_t last_msa; }; RegInfo m_reg_info; - uint64_t m_gpr_mips64[k_num_gpr_registers_mips64]; + GPR_linux_mips m_gpr; - FPR_mips m_fpr; + FPR_linux_mips m_fpr; + + MSA_linux_mips m_msa; lldb::addr_t hw_addr_map[MAX_NUM_WP]; + + IOVEC_mips m_iovec; }; } // namespace process_linux Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp =================================================================== --- source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -25,6 +25,10 @@ #include "Plugins/Process/Linux/Procfs.h" #include "Plugins/Process/Utility/RegisterContextLinux_mips64.h" #include "Plugins/Process/Utility/RegisterContextLinux_mips.h" +#define NT_MIPS_MSA 0x600 +#define CONFIG5_FRE (1 << 8) +#define SR_FR (1 << 26) +#define NUM_REGISTERS 32 #include #include @@ -118,12 +122,13 @@ gpr_sp_mips, gpr_r30_mips, gpr_ra_mips, + gpr_sr_mips, gpr_mullo_mips, gpr_mulhi_mips, - gpr_pc_mips, gpr_badvaddr_mips, - gpr_sr_mips, gpr_cause_mips, + gpr_pc_mips, + gpr_config5_mips, LLDB_INVALID_REGNUM // register sets need to end with this flag }; @@ -168,12 +173,60 @@ fpr_f31_mips, fpr_fcsr_mips, fpr_fir_mips, + fpr_config5_mips, LLDB_INVALID_REGNUM // register sets need to end with this flag }; static_assert((sizeof(g_fp_regnums_mips) / sizeof(g_fp_regnums_mips[0])) - 1 == k_num_fpr_registers_mips, "g_fp_regnums_mips has wrong number of register infos"); + // mips MSA registers. + const uint32_t + g_msa_regnums_mips[] = + { + msa_w0_mips, + msa_w1_mips, + msa_w2_mips, + msa_w3_mips, + msa_w4_mips, + msa_w5_mips, + msa_w6_mips, + msa_w7_mips, + msa_w8_mips, + msa_w9_mips, + msa_w10_mips, + msa_w11_mips, + msa_w12_mips, + msa_w13_mips, + msa_w14_mips, + msa_w15_mips, + msa_w16_mips, + msa_w17_mips, + msa_w18_mips, + msa_w19_mips, + msa_w20_mips, + msa_w21_mips, + msa_w22_mips, + msa_w23_mips, + msa_w24_mips, + msa_w25_mips, + msa_w26_mips, + msa_w27_mips, + msa_w28_mips, + msa_w29_mips, + msa_w30_mips, + msa_w31_mips, + msa_fcsr_mips, + msa_fir_mips, + msa_mcsr_mips, + msa_mir_mips, + msa_config5_mips, + LLDB_INVALID_REGNUM // register sets need to end with this flag + }; + + static_assert((sizeof(g_msa_regnums_mips) / sizeof(g_msa_regnums_mips[0])) - 1 == k_num_msa_registers_mips, + "g_msa_regnums_mips has wrong number of register infos"); + // mips64 general purpose registers. const uint32_t g_gp_regnums_mips64[] = @@ -210,14 +263,13 @@ gpr_sp_mips64, gpr_r30_mips64, gpr_ra_mips64, + gpr_sr_mips64, gpr_mullo_mips64, gpr_mulhi_mips64, - gpr_pc_mips64, gpr_badvaddr_mips64, - gpr_sr_mips64, gpr_cause_mips64, - gpr_ic_mips64, - gpr_dummy_mips64, + gpr_pc_mips64, + gpr_config5_mips64, LLDB_INVALID_REGNUM // register sets need to end with this flag }; @@ -262,16 +314,64 @@ fpr_f31_mips64, fpr_fcsr_mips64, fpr_fir_mips64, + fpr_config5_mips64, LLDB_INVALID_REGNUM // register sets need to end with this flag }; static_assert((sizeof(g_fp_regnums_mips64) / sizeof(g_fp_regnums_mips64[0])) - 1 == k_num_fpr_registers_mips64, "g_fp_regnums_mips64 has wrong number of register infos"); + // mips64 MSA registers. + const uint32_t + g_msa_regnums_mips64[] = + { + msa_w0_mips64, + msa_w1_mips64, + msa_w2_mips64, + msa_w3_mips64, + msa_w4_mips64, + msa_w5_mips64, + msa_w6_mips64, + msa_w7_mips64, + msa_w8_mips64, + msa_w9_mips64, + msa_w10_mips64, + msa_w11_mips64, + msa_w12_mips64, + msa_w13_mips64, + msa_w14_mips64, + msa_w15_mips64, + msa_w16_mips64, + msa_w17_mips64, + msa_w18_mips64, + msa_w19_mips64, + msa_w20_mips64, + msa_w21_mips64, + msa_w22_mips64, + msa_w23_mips64, + msa_w24_mips64, + msa_w25_mips64, + msa_w26_mips64, + msa_w27_mips64, + msa_w28_mips64, + msa_w29_mips64, + msa_w30_mips64, + msa_w31_mips64, + msa_fcsr_mips64, + msa_fir_mips64, + msa_mcsr_mips64, + msa_mir_mips64, + msa_config5_mips64, + LLDB_INVALID_REGNUM // register sets need to end with this flag + }; + + static_assert((sizeof(g_msa_regnums_mips64) / sizeof(g_msa_regnums_mips64[0])) - 1 == k_num_msa_registers_mips64, + "g_msa_regnums_mips64 has wrong number of register infos"); + // Number of register sets provided by this context. enum { - k_num_register_sets = 2 + k_num_register_sets = 3 }; // Register sets for mips. @@ -279,7 +379,8 @@ g_reg_sets_mips[k_num_register_sets] = { { "General Purpose Registers", "gpr", k_num_gpr_registers_mips, g_gp_regnums_mips }, - { "Floating Point Registers", "fpu", k_num_fpr_registers_mips, g_fp_regnums_mips } + { "Floating Point Registers", "fpu", k_num_fpr_registers_mips, g_fp_regnums_mips }, + { "MSA Registers", "msa", k_num_msa_registers_mips, g_msa_regnums_mips } }; // Register sets for mips64. @@ -287,7 +388,8 @@ g_reg_sets_mips64[k_num_register_sets] = { { "General Purpose Registers", "gpr", k_num_gpr_registers_mips64, g_gp_regnums_mips64 }, - { "Floating Point Registers", "fpu", k_num_fpr_registers_mips64, g_fp_regnums_mips64 } + { "Floating Point Registers", "fpu", k_num_fpr_registers_mips64, g_fp_regnums_mips64 }, + { "MSA Registers", "msa", k_num_msa_registers_mips64, g_msa_regnums_mips64 }, }; } // end of anonymous namespace @@ -300,7 +402,7 @@ return new NativeRegisterContextLinux_mips64(target_arch, native_thread, concrete_frame_idx); } -#define REG_CONTEXT_SIZE (GetRegisterInfoInterface ().GetGPRSize () + sizeof(FPR_mips)) +#define REG_CONTEXT_SIZE (GetRegisterInfoInterface ().GetGPRSize () + sizeof(FPR_linux_mips) + sizeof(MSA_linux_mips)) // ---------------------------------------------------------------------------- // NativeRegisterContextLinux_mips64 members. @@ -338,6 +440,8 @@ m_reg_info.last_gpr = k_last_gpr_mips; m_reg_info.first_fpr = k_first_fpr_mips; m_reg_info.last_fpr = k_last_fpr_mips; + m_reg_info.first_msa = k_first_msa_mips; + m_reg_info.last_msa = k_last_msa_mips; break; case llvm::Triple::mips64: case llvm::Triple::mips64el: @@ -347,18 +451,27 @@ m_reg_info.last_gpr = k_last_gpr_mips64; m_reg_info.first_fpr = k_first_fpr_mips64; m_reg_info.last_fpr = k_last_fpr_mips64; + m_reg_info.first_msa = k_first_msa_mips64; + m_reg_info.last_msa = k_last_msa_mips64; break; default: assert(false && "Unhandled target architecture."); break; } - // Clear out the FPR state. - ::memset(&m_fpr, 0, sizeof(FPR_mips)); + // Initialize m_iovec to point to the buffer and buffer size + // using the conventions of Berkeley style UIO structures, as required + // by PTRACE extensions. + m_iovec.iov_base = &m_msa; + m_iovec.iov_len = sizeof(MSA_linux_mips); // init h/w watchpoint addr map for (int index = 0;index <= MAX_NUM_WP; index++) hw_addr_map[index] = LLDB_INVALID_ADDRESS; + + ::memset(&m_gpr, 0, sizeof(GPR_linux_mips)); + ::memset(&m_fpr, 0, sizeof(FPR_linux_mips)); + ::memset(&m_msa, 0, sizeof(MSA_linux_mips)); } uint32_t @@ -460,16 +573,38 @@ return error; } - if (IsFPR(reg)) + if (IsMSA(reg) && !IsMSAAvailable()) + { + error.SetErrorString ("MSA not available on this processor"); + return error; + } + + if (IsMSA(reg) || IsFPR(reg)) { - error = ReadFPR(); + uint8_t *src; + type128 int128; + + error = ReadCP1(); + if (!error.Success()) { - error.SetErrorString ("failed to read floating point register"); + error.SetErrorString ("failed to read co-processor 1 register"); return error; } - assert (reg_info->byte_offset < sizeof(FPR_mips)); - uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset; + + if (IsFPR(reg)) + { + assert (reg_info->byte_offset < sizeof(UserArea)); + src = (uint8_t *)&m_fpr + reg_info->byte_offset - (sizeof(m_gpr)); + } + else + { + assert (reg_info->byte_offset < sizeof(UserArea)); + src = (uint8_t *)&m_msa + reg_info->byte_offset - (sizeof(m_gpr) + sizeof(m_fpr)); + } + int128.x[0] = *(uint64_t *)src; + int128.x[1] = *(uint64_t *)(src + 8); + llvm::APInt rhs = llvm::APInt(128, 2, int128.x); switch (reg_info->byte_size) { case 4: @@ -478,6 +613,9 @@ case 8: reg_value.SetUInt64(*(uint64_t *)src); break; + case 16: + reg_value.SetUInt128(rhs); + break; default: assert(false && "Unhandled data size."); error.SetErrorStringWithFormat ("unhandled byte size: %" PRIu32, reg_info->byte_size); @@ -511,10 +649,31 @@ if (reg_index == LLDB_INVALID_REGNUM) return Error ("no lldb regnum for %s", reg_info && reg_info->name ? reg_info->name : ""); - if (IsFPR(reg_index)) + if (IsMSA(reg_index) && !IsMSAAvailable()) + { + error.SetErrorString ("MSA not available on this processor"); + return error; + } + + if (IsFPR(reg_index) || IsMSA(reg_index)) { - assert (reg_info->byte_offset < sizeof(FPR_mips)); - uint8_t *dst = (uint8_t *)&m_fpr + reg_info->byte_offset; + uint8_t *dst; + const uint64_t *src; + + // Initialise the FP and MSA buffers by reading all co-processor 1 registers + ReadCP1(); + + if (IsFPR(reg_index)) + { + assert (reg_info->byte_offset < sizeof(UserArea)); + dst = (uint8_t *)&m_fpr + reg_info->byte_offset - (sizeof(m_gpr)); + } + else + { + assert (reg_info->byte_offset < sizeof(UserArea)); + dst = (uint8_t *)&m_msa + reg_info->byte_offset - (sizeof(m_gpr) + sizeof(m_fpr)); + } + llvm::APInt * lhs; switch (reg_info->byte_size) { case 4: @@ -523,15 +682,21 @@ case 8: *(uint64_t *)dst = reg_value.GetAsUInt64(); break; + case 16: + lhs = reg_value.GetAsUInt128(); + src = lhs->getRawData(); + *(uint64_t *)dst = *src; + *(uint64_t *)(dst + 8) = *(src + 1); + break; default: assert(false && "Unhandled data size."); error.SetErrorStringWithFormat ("unhandled byte size: %" PRIu32, reg_info->byte_size); break; } - error = WriteFPR(); + error = WriteCP1(); if (!error.Success()) { - error.SetErrorString ("failed to write floating point register"); + error.SetErrorString ("failed to write co-processor 1 register"); return error; } } @@ -562,10 +727,10 @@ return error; } - error = ReadFPR(); + error = ReadCP1(); if (!error.Success()) { - error.SetErrorString ("ReadFPR() failed"); + error.SetErrorString ("ReadCP1() failed"); return error; } @@ -576,10 +741,13 @@ return error; } - ::memcpy (dst, &m_gpr_mips64, GetRegisterInfoInterface ().GetGPRSize ()); + ::memcpy (dst, &m_gpr, GetRegisterInfoInterface ().GetGPRSize ()); dst += GetRegisterInfoInterface ().GetGPRSize (); - ::memcpy (dst, &m_fpr, sizeof(FPR_mips)); + ::memcpy (dst, &m_fpr, GetFPRSize ()); + dst += GetFPRSize (); + + ::memcpy (dst, &m_msa, sizeof(MSA_linux_mips)); return error; } @@ -608,10 +776,14 @@ error.SetErrorStringWithFormat ("NativeRegisterContextLinux_mips64::%s DataBuffer::GetBytes() returned a null pointer", __FUNCTION__); return error; } - ::memcpy (&m_gpr_mips64, src, GetRegisterInfoInterface ().GetGPRSize ()); + + ::memcpy (&m_gpr, src, GetRegisterInfoInterface ().GetGPRSize ()); src += GetRegisterInfoInterface ().GetGPRSize (); - ::memcpy (&m_fpr, src, sizeof(FPR_mips)); + ::memcpy (&m_fpr, src, GetFPRSize ()); + src += GetFPRSize (); + + ::memcpy (&m_msa, src, sizeof(MSA_linux_mips)); error = WriteGPR(); if (!error.Success()) @@ -620,10 +792,10 @@ return error; } - error = WriteFPR(); + error = WriteCP1(); if (!error.Success()) { - error.SetErrorStringWithFormat ("NativeRegisterContextLinux_mips64::%s WriteFPR() failed", __FUNCTION__); + error.SetErrorStringWithFormat ("NativeRegisterContextLinux_mips64::%s WriteCP1() failed", __FUNCTION__); return error; } @@ -631,22 +803,47 @@ } Error -NativeRegisterContextLinux_mips64::ReadFPR() +NativeRegisterContextLinux_mips64::ReadCP1() { - void* buf = GetFPRBuffer(); - if (!buf) - return Error("FPR buffer is NULL"); + Error error; - Error error = NativeRegisterContextLinux::ReadFPR(); + uint8_t *src, *dst; - if (IsFR0()) + lldb::ByteOrder byte_order = GetByteOrder(); + + uint32_t IsBigEndian = (byte_order == lldb::eByteOrderBig); + + if (IsMSAAvailable()) + { + error = NativeRegisterContextLinux::ReadRegisterSet(&m_iovec, sizeof(MSA_linux_mips), NT_MIPS_MSA); + src = (uint8_t *)&m_msa + (IsBigEndian * 8); + dst = (uint8_t *)&m_fpr; + for ( int i = 0; i < NUM_REGISTERS; i++) + { + // Copy fp values from msa buffer fetched via ptrace + *(uint64_t *) dst = *(uint64_t *) src; + src = src + 16; + dst = dst + 8; + } + m_fpr.fir = m_msa.fir; + m_fpr.fcsr = m_msa.fcsr; + m_fpr.config5 = m_msa.config5; + } + else { - for (int i = 0; i < 16; i++) + error = NativeRegisterContextLinux::ReadFPR(); + } + + if (IsFR0() || IsFRE()) + { + src = (uint8_t *)&m_fpr + 4 + (IsBigEndian * 4); + dst = (uint8_t *)&m_fpr + 8 + (IsBigEndian * 4); + for (int i = 0; i < (NUM_REGISTERS / 2); i++) { // copy odd single from top of neighbouring even double - uint8_t * src = (uint8_t *)buf + 4 + (i * 16); - uint8_t * dst = (uint8_t *)buf + 8 + (i * 16); *(uint32_t *) dst = *(uint32_t *) src; + src = src + 16; + dst = dst + 16; } } @@ -654,37 +851,77 @@ } Error -NativeRegisterContextLinux_mips64::WriteFPR() +NativeRegisterContextLinux_mips64::WriteCP1() { - void* buf = GetFPRBuffer(); - if (!buf) - return Error("FPR buffer is NULL"); + Error error; + + uint8_t *src, *dst; + + lldb::ByteOrder byte_order = GetByteOrder(); - if (IsFR0()) + uint32_t IsBigEndian = (byte_order == lldb::eByteOrderBig); + + if (IsFR0() || IsFRE()) { - for (int i = 0; i < 16; i++) - { + src = (uint8_t *)&m_fpr + 8 + (IsBigEndian * 4); + dst = (uint8_t *)&m_fpr + 4 + (IsBigEndian * 4); + for (int i = 0; i < (NUM_REGISTERS / 2); i++) + { // copy odd single to top of neighbouring even double - uint8_t * src = (uint8_t *)buf + 8 + (i * 16); - uint8_t * dst = (uint8_t *)buf + 4 + (i * 16); *(uint32_t *) dst = *(uint32_t *) src; - } + src = src + 16; + dst = dst + 16; + } + } + + if (IsMSAAvailable()) + { + dst = (uint8_t *)&m_msa + (IsBigEndian * 8); + src = (uint8_t *)&m_fpr; + for (int i = 0; i < NUM_REGISTERS; i++) + { + // Copy fp values to msa buffer for ptrace + *(uint64_t *) dst = *(uint64_t *) src; + dst = dst + 16; + src = src + 8; + } + m_msa.fir = m_fpr.fir; + m_msa.fcsr = m_fpr.fcsr; + m_msa.config5 = m_fpr.config5; + error = NativeRegisterContextLinux::WriteRegisterSet(&m_iovec, sizeof(MSA_linux_mips), NT_MIPS_MSA); + } + else + { + error = NativeRegisterContextLinux::WriteFPR(); } - return NativeRegisterContextLinux::WriteFPR(); + return error; } bool NativeRegisterContextLinux_mips64::IsFR0() { - const RegisterInfo *const reg_info_p = GetRegisterInfoAtIndex (36); // Status Register is at index 36 of the register array + const RegisterInfo *const reg_info_p = GetRegisterInfoAtIndex (gpr_sr_mips64); RegisterValue reg_value; ReadRegister (reg_info_p, reg_value); uint64_t value = reg_value.GetAsUInt64(); - return (!(value & 0x4000000)); + return (!(value & SR_FR)); +} + +bool +NativeRegisterContextLinux_mips64::IsFRE() +{ + const RegisterInfo *const reg_info_p = GetRegisterInfoAtIndex (gpr_config5_mips64); + + RegisterValue reg_value; + ReadRegister (reg_info_p, reg_value); + + uint64_t config5 = reg_value.GetAsUInt64(); + + return (config5 & CONFIG5_FRE); } bool @@ -869,6 +1106,25 @@ return 0; } +bool +NativeRegisterContextLinux_mips64::IsMSA(uint32_t reg_index) const +{ + return (m_reg_info.first_msa <= reg_index && reg_index <= m_reg_info.last_msa); +} + +bool +NativeRegisterContextLinux_mips64::IsMSAAvailable() +{ + Error error = NativeRegisterContextLinux::ReadRegisterSet(&m_msa, sizeof(MSA_linux_mips), NT_MIPS_MSA); + + if (error.Success() && m_msa.mir) + { + return true; + } + + return true; +} + Error NativeRegisterContextLinux_mips64::IsWatchpointHit (uint32_t wp_index, bool &is_hit) { @@ -1060,13 +1316,14 @@ uint32_t size, RegisterValue &value) { - elf_gregset_t regs; + GPR_linux_mips regs; + ::memset(®s, 0, sizeof(GPR_linux_mips)); Error error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGS, m_thread.GetID(), NULL, ®s, sizeof regs); if (error.Success()) { lldb_private::ArchSpec arch; if (m_thread.GetProcess()->GetArchitecture(arch)) - value.SetBytes((void *)(((unsigned char *)(regs)) + offset), 8, arch.GetByteOrder()); + value.SetBytes((void *)(((unsigned char *)(®s)) + offset), 8, arch.GetByteOrder()); else error.SetErrorString("failed to get architecture"); } Index: source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp +++ source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp @@ -57,7 +57,7 @@ uint64_t pc; uint64_t ic; uint64_t dummy; -} GPR; +} GPR_freebsd_mips; //--------------------------------------------------------------------------- // Include RegisterInfos_mips64 to declare our g_register_infos_mips64 structure. @@ -74,7 +74,7 @@ size_t RegisterContextFreeBSD_mips64::GetGPRSize() const { - return sizeof(GPR); + return sizeof(GPR_freebsd_mips); } const RegisterInfo * Index: source/Plugins/Process/Utility/RegisterContextLinux_mips.h =================================================================== --- source/Plugins/Process/Utility/RegisterContextLinux_mips.h +++ source/Plugins/Process/Utility/RegisterContextLinux_mips.h @@ -27,6 +27,9 @@ uint32_t GetRegisterCount () const override; + + uint32_t + GetUserRegisterCount () const override; }; #endif Index: source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp +++ source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp @@ -10,59 +10,17 @@ #include #include -// For GDB, GCC and DWARF Register numbers #include "RegisterContextLinux_mips.h" // Internal codes for mips registers -#include "lldb-mips64-register-enums.h" -#include "RegisterContext_mips64.h" +#include "lldb-mips-linux-register-enums.h" + +// For GP and FP buffers +#include "RegisterContext_mips.h" using namespace lldb_private; using namespace lldb; -// GP registers -typedef struct _GPR -{ - uint32_t zero; - uint32_t r1; - uint32_t r2; - uint32_t r3; - uint32_t r4; - uint32_t r5; - uint32_t r6; - uint32_t r7; - uint32_t r8; - uint32_t r9; - uint32_t r10; - uint32_t r11; - uint32_t r12; - uint32_t r13; - uint32_t r14; - uint32_t r15; - uint32_t r16; - uint32_t r17; - uint32_t r18; - uint32_t r19; - uint32_t r20; - uint32_t r21; - uint32_t r22; - uint32_t r23; - uint32_t r24; - uint32_t r25; - uint32_t r26; - uint32_t r27; - uint32_t gp; - uint32_t sp; - uint32_t r30; - uint32_t ra; - uint32_t mullo; - uint32_t mulhi; - uint32_t pc; - uint32_t badvaddr; - uint32_t sr; - uint32_t cause; -} GPR; - //--------------------------------------------------------------------------- // Include RegisterInfos_mips to declare our g_register_infos_mips structure. //--------------------------------------------------------------------------- @@ -78,7 +36,7 @@ size_t RegisterContextLinux_mips::GetGPRSize() const { - return sizeof(GPR); + return sizeof(GPR_linux_mips); } const RegisterInfo * @@ -100,3 +58,9 @@ { return static_cast (sizeof (g_register_infos_mips) / sizeof (g_register_infos_mips [0])); } + +uint32_t +RegisterContextLinux_mips::GetUserRegisterCount () const +{ + return static_cast (k_num_user_registers_mips); +} Index: source/Plugins/Process/Utility/RegisterContextLinux_mips64.h =================================================================== --- source/Plugins/Process/Utility/RegisterContextLinux_mips64.h +++ source/Plugins/Process/Utility/RegisterContextLinux_mips64.h @@ -30,9 +30,13 @@ uint32_t GetRegisterCount () const override; + uint32_t + GetUserRegisterCount () const override; + private: const lldb_private::RegisterInfo *m_register_info_p; uint32_t m_register_info_count; + uint32_t m_user_register_count; }; #endif Index: source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp +++ source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp @@ -12,66 +12,24 @@ #include #include -// For GDB, GCC and DWARF Register numbers #include "RegisterContextLinux_mips64.h" -// Internal codes for all mips64 registers -#include "lldb-mips64-register-enums.h" -#include "RegisterContext_mips64.h" +// For GP and FP buffers +#include "RegisterContext_mips.h" + +// Internal codes for all mips32 and mips64 registers +#include "lldb-mips-linux-register-enums.h" using namespace lldb; using namespace lldb_private; -// GP registers -typedef struct _GPR -{ - uint64_t zero; - uint64_t r1; - uint64_t r2; - uint64_t r3; - uint64_t r4; - uint64_t r5; - uint64_t r6; - uint64_t r7; - uint64_t r8; - uint64_t r9; - uint64_t r10; - uint64_t r11; - uint64_t r12; - uint64_t r13; - uint64_t r14; - uint64_t r15; - uint64_t r16; - uint64_t r17; - uint64_t r18; - uint64_t r19; - uint64_t r20; - uint64_t r21; - uint64_t r22; - uint64_t r23; - uint64_t r24; - uint64_t r25; - uint64_t r26; - uint64_t r27; - uint64_t gp; - uint64_t sp; - uint64_t r30; - uint64_t ra; - uint64_t mullo; - uint64_t mulhi; - uint64_t pc; - uint64_t badvaddr; - uint64_t sr; - uint64_t cause; - uint64_t ic; - uint64_t dummy; -} GPR; - //--------------------------------------------------------------------------- // Include RegisterInfos_mips64 to declare our g_register_infos_mips64 structure. //--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_MIPS64_STRUCT +#define LINUX_MIPS64 #include "RegisterInfos_mips64.h" +#undef LINUX_MIPS64 #undef DECLARE_REGISTER_INFOS_MIPS64_STRUCT //--------------------------------------------------------------------------- @@ -115,17 +73,35 @@ } } +uint32_t +GetUserRegisterInfoCount (const ArchSpec &target_arch) +{ + switch (target_arch.GetMachine()) + { + case llvm::Triple::mips: + case llvm::Triple::mipsel: + return static_cast (k_num_user_registers_mips); + case llvm::Triple::mips64el: + case llvm::Triple::mips64: + return static_cast (k_num_user_registers_mips64); + default: + assert(false && "Unhandled target architecture."); + return 0; + } +} + RegisterContextLinux_mips64::RegisterContextLinux_mips64(const ArchSpec &target_arch) : lldb_private::RegisterInfoInterface(target_arch), m_register_info_p (GetRegisterInfoPtr (target_arch)), - m_register_info_count (GetRegisterInfoCount (target_arch)) + m_register_info_count (GetRegisterInfoCount (target_arch)), + m_user_register_count (GetUserRegisterInfoCount (target_arch)) { } size_t RegisterContextLinux_mips64::GetGPRSize() const { - return sizeof(GPR); + return sizeof(GPR_linux_mips); } const RegisterInfo * @@ -140,4 +116,10 @@ return m_register_info_count; } +uint32_t +RegisterContextLinux_mips64::GetUserRegisterCount () const +{ + return m_user_register_count; +} + #endif Index: source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h =================================================================== --- source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h +++ source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h @@ -12,8 +12,8 @@ #include "lldb/Core/Log.h" #include "RegisterContextPOSIX.h" -#include "RegisterContext_mips64.h" -#include "lldb-mips64-register-enums.h" +#include "RegisterContext_mips.h" +#include "lldb-mips-freebsd-register-enums.h" using namespace lldb_private; Index: source/Plugins/Process/Utility/RegisterContext_mips.h =================================================================== --- /dev/null +++ source/Plugins/Process/Utility/RegisterContext_mips.h @@ -0,0 +1,614 @@ +//===-- RegisterContext_mips.h --------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_RegisterContext_mips64_H_ +#define liblldb_RegisterContext_mips64_H_ + +#if defined(__mips64) + #define ENABLE_128_BIT_SUPPORT 1 +#endif + +// GCC and DWARF Register numbers (eRegisterKindGCC & eRegisterKindDWARF) +enum +{ + // GP Registers + gcc_dwarf_zero_mips = 0, + gcc_dwarf_r1_mips, + gcc_dwarf_r2_mips, + gcc_dwarf_r3_mips, + gcc_dwarf_r4_mips, + gcc_dwarf_r5_mips, + gcc_dwarf_r6_mips, + gcc_dwarf_r7_mips, + gcc_dwarf_r8_mips, + gcc_dwarf_r9_mips, + gcc_dwarf_r10_mips, + gcc_dwarf_r11_mips, + gcc_dwarf_r12_mips, + gcc_dwarf_r13_mips, + gcc_dwarf_r14_mips, + gcc_dwarf_r15_mips, + gcc_dwarf_r16_mips, + gcc_dwarf_r17_mips, + gcc_dwarf_r18_mips, + gcc_dwarf_r19_mips, + gcc_dwarf_r20_mips, + gcc_dwarf_r21_mips, + gcc_dwarf_r22_mips, + gcc_dwarf_r23_mips, + gcc_dwarf_r24_mips, + gcc_dwarf_r25_mips, + gcc_dwarf_r26_mips, + gcc_dwarf_r27_mips, + gcc_dwarf_gp_mips, + gcc_dwarf_sp_mips, + gcc_dwarf_r30_mips, + gcc_dwarf_ra_mips, + gcc_dwarf_sr_mips, + gcc_dwarf_lo_mips, + gcc_dwarf_hi_mips, + gcc_dwarf_bad_mips, + gcc_dwarf_cause_mips, + gcc_dwarf_pc_mips, + gcc_dwarf_f0_mips, + gcc_dwarf_f1_mips, + gcc_dwarf_f2_mips, + gcc_dwarf_f3_mips, + gcc_dwarf_f4_mips, + gcc_dwarf_f5_mips, + gcc_dwarf_f6_mips, + gcc_dwarf_f7_mips, + gcc_dwarf_f8_mips, + gcc_dwarf_f9_mips, + gcc_dwarf_f10_mips, + gcc_dwarf_f11_mips, + gcc_dwarf_f12_mips, + gcc_dwarf_f13_mips, + gcc_dwarf_f14_mips, + gcc_dwarf_f15_mips, + gcc_dwarf_f16_mips, + gcc_dwarf_f17_mips, + gcc_dwarf_f18_mips, + gcc_dwarf_f19_mips, + gcc_dwarf_f20_mips, + gcc_dwarf_f21_mips, + gcc_dwarf_f22_mips, + gcc_dwarf_f23_mips, + gcc_dwarf_f24_mips, + gcc_dwarf_f25_mips, + gcc_dwarf_f26_mips, + gcc_dwarf_f27_mips, + gcc_dwarf_f28_mips, + gcc_dwarf_f29_mips, + gcc_dwarf_f30_mips, + gcc_dwarf_f31_mips, + gcc_dwarf_fcsr_mips, + gcc_dwarf_fir_mips, + gcc_dwarf_w0_mips, + gcc_dwarf_w1_mips, + gcc_dwarf_w2_mips, + gcc_dwarf_w3_mips, + gcc_dwarf_w4_mips, + gcc_dwarf_w5_mips, + gcc_dwarf_w6_mips, + gcc_dwarf_w7_mips, + gcc_dwarf_w8_mips, + gcc_dwarf_w9_mips, + gcc_dwarf_w10_mips, + gcc_dwarf_w11_mips, + gcc_dwarf_w12_mips, + gcc_dwarf_w13_mips, + gcc_dwarf_w14_mips, + gcc_dwarf_w15_mips, + gcc_dwarf_w16_mips, + gcc_dwarf_w17_mips, + gcc_dwarf_w18_mips, + gcc_dwarf_w19_mips, + gcc_dwarf_w20_mips, + gcc_dwarf_w21_mips, + gcc_dwarf_w22_mips, + gcc_dwarf_w23_mips, + gcc_dwarf_w24_mips, + gcc_dwarf_w25_mips, + gcc_dwarf_w26_mips, + gcc_dwarf_w27_mips, + gcc_dwarf_w28_mips, + gcc_dwarf_w29_mips, + gcc_dwarf_w30_mips, + gcc_dwarf_w31_mips, + gcc_dwarf_mcsr_mips, + gcc_dwarf_mir_mips, + gcc_dwarf_config5_mips, + gcc_dwarf_ic_mips, + gcc_dwarf_dummy_mips +}; + +enum +{ + gcc_dwarf_zero_mips64 = 0, + gcc_dwarf_r1_mips64, + gcc_dwarf_r2_mips64, + gcc_dwarf_r3_mips64, + gcc_dwarf_r4_mips64, + gcc_dwarf_r5_mips64, + gcc_dwarf_r6_mips64, + gcc_dwarf_r7_mips64, + gcc_dwarf_r8_mips64, + gcc_dwarf_r9_mips64, + gcc_dwarf_r10_mips64, + gcc_dwarf_r11_mips64, + gcc_dwarf_r12_mips64, + gcc_dwarf_r13_mips64, + gcc_dwarf_r14_mips64, + gcc_dwarf_r15_mips64, + gcc_dwarf_r16_mips64, + gcc_dwarf_r17_mips64, + gcc_dwarf_r18_mips64, + gcc_dwarf_r19_mips64, + gcc_dwarf_r20_mips64, + gcc_dwarf_r21_mips64, + gcc_dwarf_r22_mips64, + gcc_dwarf_r23_mips64, + gcc_dwarf_r24_mips64, + gcc_dwarf_r25_mips64, + gcc_dwarf_r26_mips64, + gcc_dwarf_r27_mips64, + gcc_dwarf_gp_mips64, + gcc_dwarf_sp_mips64, + gcc_dwarf_r30_mips64, + gcc_dwarf_ra_mips64, + gcc_dwarf_sr_mips64, + gcc_dwarf_lo_mips64, + gcc_dwarf_hi_mips64, + gcc_dwarf_bad_mips64, + gcc_dwarf_cause_mips64, + gcc_dwarf_pc_mips64, + gcc_dwarf_f0_mips64, + gcc_dwarf_f1_mips64, + gcc_dwarf_f2_mips64, + gcc_dwarf_f3_mips64, + gcc_dwarf_f4_mips64, + gcc_dwarf_f5_mips64, + gcc_dwarf_f6_mips64, + gcc_dwarf_f7_mips64, + gcc_dwarf_f8_mips64, + gcc_dwarf_f9_mips64, + gcc_dwarf_f10_mips64, + gcc_dwarf_f11_mips64, + gcc_dwarf_f12_mips64, + gcc_dwarf_f13_mips64, + gcc_dwarf_f14_mips64, + gcc_dwarf_f15_mips64, + gcc_dwarf_f16_mips64, + gcc_dwarf_f17_mips64, + gcc_dwarf_f18_mips64, + gcc_dwarf_f19_mips64, + gcc_dwarf_f20_mips64, + gcc_dwarf_f21_mips64, + gcc_dwarf_f22_mips64, + gcc_dwarf_f23_mips64, + gcc_dwarf_f24_mips64, + gcc_dwarf_f25_mips64, + gcc_dwarf_f26_mips64, + gcc_dwarf_f27_mips64, + gcc_dwarf_f28_mips64, + gcc_dwarf_f29_mips64, + gcc_dwarf_f30_mips64, + gcc_dwarf_f31_mips64, + gcc_dwarf_fcsr_mips64, + gcc_dwarf_fir_mips64, + gcc_dwarf_ic_mips64, + gcc_dwarf_dummy_mips64, + gcc_dwarf_w0_mips64, + gcc_dwarf_w1_mips64, + gcc_dwarf_w2_mips64, + gcc_dwarf_w3_mips64, + gcc_dwarf_w4_mips64, + gcc_dwarf_w5_mips64, + gcc_dwarf_w6_mips64, + gcc_dwarf_w7_mips64, + gcc_dwarf_w8_mips64, + gcc_dwarf_w9_mips64, + gcc_dwarf_w10_mips64, + gcc_dwarf_w11_mips64, + gcc_dwarf_w12_mips64, + gcc_dwarf_w13_mips64, + gcc_dwarf_w14_mips64, + gcc_dwarf_w15_mips64, + gcc_dwarf_w16_mips64, + gcc_dwarf_w17_mips64, + gcc_dwarf_w18_mips64, + gcc_dwarf_w19_mips64, + gcc_dwarf_w20_mips64, + gcc_dwarf_w21_mips64, + gcc_dwarf_w22_mips64, + gcc_dwarf_w23_mips64, + gcc_dwarf_w24_mips64, + gcc_dwarf_w25_mips64, + gcc_dwarf_w26_mips64, + gcc_dwarf_w27_mips64, + gcc_dwarf_w28_mips64, + gcc_dwarf_w29_mips64, + gcc_dwarf_w30_mips64, + gcc_dwarf_w31_mips64, + gcc_dwarf_mcsr_mips64, + gcc_dwarf_mir_mips64, + gcc_dwarf_config5_mips64, +}; + +// GDB Register numbers (eRegisterKindGDB) +enum +{ + gdb_zero_mips = 0, + gdb_r1_mips, + gdb_r2_mips, + gdb_r3_mips, + gdb_r4_mips, + gdb_r5_mips, + gdb_r6_mips, + gdb_r7_mips, + gdb_r8_mips, + gdb_r9_mips, + gdb_r10_mips, + gdb_r11_mips, + gdb_r12_mips, + gdb_r13_mips, + gdb_r14_mips, + gdb_r15_mips, + gdb_r16_mips, + gdb_r17_mips, + gdb_r18_mips, + gdb_r19_mips, + gdb_r20_mips, + gdb_r21_mips, + gdb_r22_mips, + gdb_r23_mips, + gdb_r24_mips, + gdb_r25_mips, + gdb_r26_mips, + gdb_r27_mips, + gdb_gp_mips, + gdb_sp_mips, + gdb_r30_mips, + gdb_ra_mips, + gdb_sr_mips, + gdb_lo_mips, + gdb_hi_mips, + gdb_bad_mips, + gdb_cause_mips, + gdb_pc_mips, + gdb_f0_mips, + gdb_f1_mips, + gdb_f2_mips, + gdb_f3_mips, + gdb_f4_mips, + gdb_f5_mips, + gdb_f6_mips, + gdb_f7_mips, + gdb_f8_mips, + gdb_f9_mips, + gdb_f10_mips, + gdb_f11_mips, + gdb_f12_mips, + gdb_f13_mips, + gdb_f14_mips, + gdb_f15_mips, + gdb_f16_mips, + gdb_f17_mips, + gdb_f18_mips, + gdb_f19_mips, + gdb_f20_mips, + gdb_f21_mips, + gdb_f22_mips, + gdb_f23_mips, + gdb_f24_mips, + gdb_f25_mips, + gdb_f26_mips, + gdb_f27_mips, + gdb_f28_mips, + gdb_f29_mips, + gdb_f30_mips, + gdb_f31_mips, + gdb_fcsr_mips, + gdb_fir_mips, + gdb_w0_mips, + gdb_w1_mips, + gdb_w2_mips, + gdb_w3_mips, + gdb_w4_mips, + gdb_w5_mips, + gdb_w6_mips, + gdb_w7_mips, + gdb_w8_mips, + gdb_w9_mips, + gdb_w10_mips, + gdb_w11_mips, + gdb_w12_mips, + gdb_w13_mips, + gdb_w14_mips, + gdb_w15_mips, + gdb_w16_mips, + gdb_w17_mips, + gdb_w18_mips, + gdb_w19_mips, + gdb_w20_mips, + gdb_w21_mips, + gdb_w22_mips, + gdb_w23_mips, + gdb_w24_mips, + gdb_w25_mips, + gdb_w26_mips, + gdb_w27_mips, + gdb_w28_mips, + gdb_w29_mips, + gdb_w30_mips, + gdb_w31_mips, + gdb_mcsr_mips, + gdb_mir_mips, + gdb_config5_mips, + gdb_ic_mips, + gdb_dummy_mips +}; + +enum +{ + gdb_zero_mips64 = 0, + gdb_r1_mips64, + gdb_r2_mips64, + gdb_r3_mips64, + gdb_r4_mips64, + gdb_r5_mips64, + gdb_r6_mips64, + gdb_r7_mips64, + gdb_r8_mips64, + gdb_r9_mips64, + gdb_r10_mips64, + gdb_r11_mips64, + gdb_r12_mips64, + gdb_r13_mips64, + gdb_r14_mips64, + gdb_r15_mips64, + gdb_r16_mips64, + gdb_r17_mips64, + gdb_r18_mips64, + gdb_r19_mips64, + gdb_r20_mips64, + gdb_r21_mips64, + gdb_r22_mips64, + gdb_r23_mips64, + gdb_r24_mips64, + gdb_r25_mips64, + gdb_r26_mips64, + gdb_r27_mips64, + gdb_gp_mips64, + gdb_sp_mips64, + gdb_r30_mips64, + gdb_ra_mips64, + gdb_sr_mips64, + gdb_lo_mips64, + gdb_hi_mips64, + gdb_bad_mips64, + gdb_cause_mips64, + gdb_pc_mips64, + gdb_f0_mips64, + gdb_f1_mips64, + gdb_f2_mips64, + gdb_f3_mips64, + gdb_f4_mips64, + gdb_f5_mips64, + gdb_f6_mips64, + gdb_f7_mips64, + gdb_f8_mips64, + gdb_f9_mips64, + gdb_f10_mips64, + gdb_f11_mips64, + gdb_f12_mips64, + gdb_f13_mips64, + gdb_f14_mips64, + gdb_f15_mips64, + gdb_f16_mips64, + gdb_f17_mips64, + gdb_f18_mips64, + gdb_f19_mips64, + gdb_f20_mips64, + gdb_f21_mips64, + gdb_f22_mips64, + gdb_f23_mips64, + gdb_f24_mips64, + gdb_f25_mips64, + gdb_f26_mips64, + gdb_f27_mips64, + gdb_f28_mips64, + gdb_f29_mips64, + gdb_f30_mips64, + gdb_f31_mips64, + gdb_fcsr_mips64, + gdb_fir_mips64, + gdb_ic_mips64, + gdb_dummy_mips64, + gdb_w0_mips64, + gdb_w1_mips64, + gdb_w2_mips64, + gdb_w3_mips64, + gdb_w4_mips64, + gdb_w5_mips64, + gdb_w6_mips64, + gdb_w7_mips64, + gdb_w8_mips64, + gdb_w9_mips64, + gdb_w10_mips64, + gdb_w11_mips64, + gdb_w12_mips64, + gdb_w13_mips64, + gdb_w14_mips64, + gdb_w15_mips64, + gdb_w16_mips64, + gdb_w17_mips64, + gdb_w18_mips64, + gdb_w19_mips64, + gdb_w20_mips64, + gdb_w21_mips64, + gdb_w22_mips64, + gdb_w23_mips64, + gdb_w24_mips64, + gdb_w25_mips64, + gdb_w26_mips64, + gdb_w27_mips64, + gdb_w28_mips64, + gdb_w29_mips64, + gdb_w30_mips64, + gdb_w31_mips64, + gdb_mcsr_mips64, + gdb_mir_mips64, + gdb_config5_mips64, +}; + +struct IOVEC_mips +{ + void *iov_base; + size_t iov_len; +}; + +// GP registers +struct GPR_linux_mips +{ + uint64_t zero; + uint64_t r1; + uint64_t r2; + uint64_t r3; + uint64_t r4; + uint64_t r5; + uint64_t r6; + uint64_t r7; + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + uint64_t r16; + uint64_t r17; + uint64_t r18; + uint64_t r19; + uint64_t r20; + uint64_t r21; + uint64_t r22; + uint64_t r23; + uint64_t r24; + uint64_t r25; + uint64_t r26; + uint64_t r27; + uint64_t gp; + uint64_t sp; + uint64_t r30; + uint64_t ra; + uint64_t mullo; + uint64_t mulhi; + uint64_t pc; + uint64_t badvaddr; + uint64_t sr; + uint64_t cause; + uint64_t config5; +}; + +struct FPR_linux_mips +{ + uint64_t f0; + uint64_t f1; + uint64_t f2; + uint64_t f3; + uint64_t f4; + uint64_t f5; + uint64_t f6; + uint64_t f7; + uint64_t f8; + uint64_t f9; + uint64_t f10; + uint64_t f11; + uint64_t f12; + uint64_t f13; + uint64_t f14; + uint64_t f15; + uint64_t f16; + uint64_t f17; + uint64_t f18; + uint64_t f19; + uint64_t f20; + uint64_t f21; + uint64_t f22; + uint64_t f23; + uint64_t f24; + uint64_t f25; + uint64_t f26; + uint64_t f27; + uint64_t f28; + uint64_t f29; + uint64_t f30; + uint64_t f31; + uint32_t fcsr; + uint32_t fir; + uint32_t config5; +}; + +struct MSAReg +{ + uint8_t byte[16]; +}; + +struct MSA_linux_mips +{ + MSAReg w0; + MSAReg w1; + MSAReg w2; + MSAReg w3; + MSAReg w4; + MSAReg w5; + MSAReg w6; + MSAReg w7; + MSAReg w8; + MSAReg w9; + MSAReg w10; + MSAReg w11; + MSAReg w12; + MSAReg w13; + MSAReg w14; + MSAReg w15; + MSAReg w16; + MSAReg w17; + MSAReg w18; + MSAReg w19; + MSAReg w20; + MSAReg w21; + MSAReg w22; + MSAReg w23; + MSAReg w24; + MSAReg w25; + MSAReg w26; + MSAReg w27; + MSAReg w28; + MSAReg w29; + MSAReg w30; + MSAReg w31; + uint32_t fcsr; /* FPU control status register */ + uint32_t fir; /* FPU implementaion revision */ + uint32_t mcsr; /* MSA control status register */ + uint32_t mir; /* MSA implementation revision */ + uint32_t config5; /* Config5 register */ +}; + +struct UserArea +{ + GPR_linux_mips gpr; // General purpose registers. + FPR_linux_mips fpr; // Floating point registers. + MSA_linux_mips msa; // MSA registers. +}; + +#endif // liblldb_RegisterContext_mips64_H_ Index: source/Plugins/Process/Utility/RegisterContext_mips64.h =================================================================== --- source/Plugins/Process/Utility/RegisterContext_mips64.h +++ /dev/null @@ -1,336 +0,0 @@ -//===-- RegisterContext_mips64.h --------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_RegisterContext_mips64_H_ -#define liblldb_RegisterContext_mips64_H_ - -// GCC and DWARF Register numbers (eRegisterKindGCC & eRegisterKindDWARF) -enum -{ - // GP Registers - gcc_dwarf_zero_mips = 0, - gcc_dwarf_r1_mips, - gcc_dwarf_r2_mips, - gcc_dwarf_r3_mips, - gcc_dwarf_r4_mips, - gcc_dwarf_r5_mips, - gcc_dwarf_r6_mips, - gcc_dwarf_r7_mips, - gcc_dwarf_r8_mips, - gcc_dwarf_r9_mips, - gcc_dwarf_r10_mips, - gcc_dwarf_r11_mips, - gcc_dwarf_r12_mips, - gcc_dwarf_r13_mips, - gcc_dwarf_r14_mips, - gcc_dwarf_r15_mips, - gcc_dwarf_r16_mips, - gcc_dwarf_r17_mips, - gcc_dwarf_r18_mips, - gcc_dwarf_r19_mips, - gcc_dwarf_r20_mips, - gcc_dwarf_r21_mips, - gcc_dwarf_r22_mips, - gcc_dwarf_r23_mips, - gcc_dwarf_r24_mips, - gcc_dwarf_r25_mips, - gcc_dwarf_r26_mips, - gcc_dwarf_r27_mips, - gcc_dwarf_gp_mips, - gcc_dwarf_sp_mips, - gcc_dwarf_r30_mips, - gcc_dwarf_ra_mips, - gcc_dwarf_lo_mips, - gcc_dwarf_hi_mips, - gcc_dwarf_pc_mips, - gcc_dwarf_bad_mips, - gcc_dwarf_sr_mips, - gcc_dwarf_cause_mips, - gcc_dwarf_f0_mips, - gcc_dwarf_f1_mips, - gcc_dwarf_f2_mips, - gcc_dwarf_f3_mips, - gcc_dwarf_f4_mips, - gcc_dwarf_f5_mips, - gcc_dwarf_f6_mips, - gcc_dwarf_f7_mips, - gcc_dwarf_f8_mips, - gcc_dwarf_f9_mips, - gcc_dwarf_f10_mips, - gcc_dwarf_f11_mips, - gcc_dwarf_f12_mips, - gcc_dwarf_f13_mips, - gcc_dwarf_f14_mips, - gcc_dwarf_f15_mips, - gcc_dwarf_f16_mips, - gcc_dwarf_f17_mips, - gcc_dwarf_f18_mips, - gcc_dwarf_f19_mips, - gcc_dwarf_f20_mips, - gcc_dwarf_f21_mips, - gcc_dwarf_f22_mips, - gcc_dwarf_f23_mips, - gcc_dwarf_f24_mips, - gcc_dwarf_f25_mips, - gcc_dwarf_f26_mips, - gcc_dwarf_f27_mips, - gcc_dwarf_f28_mips, - gcc_dwarf_f29_mips, - gcc_dwarf_f30_mips, - gcc_dwarf_f31_mips, - gcc_dwarf_fcsr_mips, - gcc_dwarf_fir_mips, - gcc_dwarf_ic_mips, - gcc_dwarf_dummy_mips -}; - -enum -{ - gcc_dwarf_zero_mips64 = 0, - gcc_dwarf_r1_mips64, - gcc_dwarf_r2_mips64, - gcc_dwarf_r3_mips64, - gcc_dwarf_r4_mips64, - gcc_dwarf_r5_mips64, - gcc_dwarf_r6_mips64, - gcc_dwarf_r7_mips64, - gcc_dwarf_r8_mips64, - gcc_dwarf_r9_mips64, - gcc_dwarf_r10_mips64, - gcc_dwarf_r11_mips64, - gcc_dwarf_r12_mips64, - gcc_dwarf_r13_mips64, - gcc_dwarf_r14_mips64, - gcc_dwarf_r15_mips64, - gcc_dwarf_r16_mips64, - gcc_dwarf_r17_mips64, - gcc_dwarf_r18_mips64, - gcc_dwarf_r19_mips64, - gcc_dwarf_r20_mips64, - gcc_dwarf_r21_mips64, - gcc_dwarf_r22_mips64, - gcc_dwarf_r23_mips64, - gcc_dwarf_r24_mips64, - gcc_dwarf_r25_mips64, - gcc_dwarf_r26_mips64, - gcc_dwarf_r27_mips64, - gcc_dwarf_gp_mips64, - gcc_dwarf_sp_mips64, - gcc_dwarf_r30_mips64, - gcc_dwarf_ra_mips64, - gcc_dwarf_sr_mips64, - gcc_dwarf_lo_mips64, - gcc_dwarf_hi_mips64, - gcc_dwarf_bad_mips64, - gcc_dwarf_cause_mips64, - gcc_dwarf_pc_mips64, - gcc_dwarf_f0_mips64, - gcc_dwarf_f1_mips64, - gcc_dwarf_f2_mips64, - gcc_dwarf_f3_mips64, - gcc_dwarf_f4_mips64, - gcc_dwarf_f5_mips64, - gcc_dwarf_f6_mips64, - gcc_dwarf_f7_mips64, - gcc_dwarf_f8_mips64, - gcc_dwarf_f9_mips64, - gcc_dwarf_f10_mips64, - gcc_dwarf_f11_mips64, - gcc_dwarf_f12_mips64, - gcc_dwarf_f13_mips64, - gcc_dwarf_f14_mips64, - gcc_dwarf_f15_mips64, - gcc_dwarf_f16_mips64, - gcc_dwarf_f17_mips64, - gcc_dwarf_f18_mips64, - gcc_dwarf_f19_mips64, - gcc_dwarf_f20_mips64, - gcc_dwarf_f21_mips64, - gcc_dwarf_f22_mips64, - gcc_dwarf_f23_mips64, - gcc_dwarf_f24_mips64, - gcc_dwarf_f25_mips64, - gcc_dwarf_f26_mips64, - gcc_dwarf_f27_mips64, - gcc_dwarf_f28_mips64, - gcc_dwarf_f29_mips64, - gcc_dwarf_f30_mips64, - gcc_dwarf_f31_mips64, - gcc_dwarf_fcsr_mips64, - gcc_dwarf_fir_mips64, - gcc_dwarf_ic_mips64, - gcc_dwarf_dummy_mips64 -}; - -// GDB Register numbers (eRegisterKindGDB) -enum -{ - gdb_zero_mips = 0, - gdb_r1_mips, - gdb_r2_mips, - gdb_r3_mips, - gdb_r4_mips, - gdb_r5_mips, - gdb_r6_mips, - gdb_r7_mips, - gdb_r8_mips, - gdb_r9_mips, - gdb_r10_mips, - gdb_r11_mips, - gdb_r12_mips, - gdb_r13_mips, - gdb_r14_mips, - gdb_r15_mips, - gdb_r16_mips, - gdb_r17_mips, - gdb_r18_mips, - gdb_r19_mips, - gdb_r20_mips, - gdb_r21_mips, - gdb_r22_mips, - gdb_r23_mips, - gdb_r24_mips, - gdb_r25_mips, - gdb_r26_mips, - gdb_r27_mips, - gdb_gp_mips, - gdb_sp_mips, - gdb_r30_mips, - gdb_ra_mips, - gdb_lo_mips, - gdb_hi_mips, - gdb_pc_mips, - gdb_bad_mips, - gdb_sr_mips, - gdb_cause_mips, - gdb_f0_mips, - gdb_f1_mips, - gdb_f2_mips, - gdb_f3_mips, - gdb_f4_mips, - gdb_f5_mips, - gdb_f6_mips, - gdb_f7_mips, - gdb_f8_mips, - gdb_f9_mips, - gdb_f10_mips, - gdb_f11_mips, - gdb_f12_mips, - gdb_f13_mips, - gdb_f14_mips, - gdb_f15_mips, - gdb_f16_mips, - gdb_f17_mips, - gdb_f18_mips, - gdb_f19_mips, - gdb_f20_mips, - gdb_f21_mips, - gdb_f22_mips, - gdb_f23_mips, - gdb_f24_mips, - gdb_f25_mips, - gdb_f26_mips, - gdb_f27_mips, - gdb_f28_mips, - gdb_f29_mips, - gdb_f30_mips, - gdb_f31_mips, - gdb_fcsr_mips, - gdb_fir_mips, - gdb_ic_mips, - gdb_dummy_mips -}; - -enum -{ - gdb_zero_mips64 = 0, - gdb_r1_mips64, - gdb_r2_mips64, - gdb_r3_mips64, - gdb_r4_mips64, - gdb_r5_mips64, - gdb_r6_mips64, - gdb_r7_mips64, - gdb_r8_mips64, - gdb_r9_mips64, - gdb_r10_mips64, - gdb_r11_mips64, - gdb_r12_mips64, - gdb_r13_mips64, - gdb_r14_mips64, - gdb_r15_mips64, - gdb_r16_mips64, - gdb_r17_mips64, - gdb_r18_mips64, - gdb_r19_mips64, - gdb_r20_mips64, - gdb_r21_mips64, - gdb_r22_mips64, - gdb_r23_mips64, - gdb_r24_mips64, - gdb_r25_mips64, - gdb_r26_mips64, - gdb_r27_mips64, - gdb_gp_mips64, - gdb_sp_mips64, - gdb_r30_mips64, - gdb_ra_mips64, - gdb_sr_mips64, - gdb_lo_mips64, - gdb_hi_mips64, - gdb_bad_mips64, - gdb_cause_mips64, - gdb_pc_mips64, - gdb_f0_mips64, - gdb_f1_mips64, - gdb_f2_mips64, - gdb_f3_mips64, - gdb_f4_mips64, - gdb_f5_mips64, - gdb_f6_mips64, - gdb_f7_mips64, - gdb_f8_mips64, - gdb_f9_mips64, - gdb_f10_mips64, - gdb_f11_mips64, - gdb_f12_mips64, - gdb_f13_mips64, - gdb_f14_mips64, - gdb_f15_mips64, - gdb_f16_mips64, - gdb_f17_mips64, - gdb_f18_mips64, - gdb_f19_mips64, - gdb_f20_mips64, - gdb_f21_mips64, - gdb_f22_mips64, - gdb_f23_mips64, - gdb_f24_mips64, - gdb_f25_mips64, - gdb_f26_mips64, - gdb_f27_mips64, - gdb_f28_mips64, - gdb_f29_mips64, - gdb_f30_mips64, - gdb_f31_mips64, - gdb_fcsr_mips64, - gdb_fir_mips64, - gdb_ic_mips64, - gdb_dummy_mips64 -}; - -// FP registers -struct FPR_mips -{ - uint64_t fp_reg[32]; - uint32_t fcsr; /* FPU status register */ - uint32_t fir; /* FPU control register */ -}; - -#endif // liblldb_RegisterContext_mips64_H_ Index: source/Plugins/Process/Utility/RegisterInfos_mips.h =================================================================== --- source/Plugins/Process/Utility/RegisterInfos_mips.h +++ source/Plugins/Process/Utility/RegisterInfos_mips.h @@ -14,24 +14,35 @@ // Computes the offset of the given GPR in the user data area. #define GPR_OFFSET(regname) \ - (LLVM_EXTENSION offsetof(GPR, regname)) + (LLVM_EXTENSION offsetof(UserArea, gpr) + \ + LLVM_EXTENSION offsetof(GPR_linux_mips, regname)) // Computes the offset of the given FPR in the extended data area. #define FPR_OFFSET(regname) \ - (LLVM_EXTENSION offsetof(FPR_mips, regname)) + (LLVM_EXTENSION offsetof(UserArea, fpr) + \ + LLVM_EXTENSION offsetof(FPR_linux_mips, regname)) + +// Computes the offset of the given MSA in the extended data area. +#define MSA_OFFSET(regname) \ + (LLVM_EXTENSION offsetof(UserArea, msa) + \ + LLVM_EXTENSION offsetof(MSA_linux_mips, regname)) // Note that the size and offset will be updated by platform-specific classes. #define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \ - { #reg, alt, sizeof(((GPR*)NULL)->reg), GPR_OFFSET(reg), eEncodingUint, \ + { #reg, alt, sizeof(((GPR_linux_mips*)NULL)->reg) / 2, GPR_OFFSET(reg), eEncodingUint, \ eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg##_mips }, NULL, NULL } -#define DEFINE_FPR(member, reg, alt, kind1, kind2, kind3, kind4) \ - { #reg, alt, sizeof(((FPR_mips*)NULL)->member) / 2, FPR_OFFSET(member), eEncodingUint, \ +#define DEFINE_FPR(reg, alt, kind1, kind2, kind3, kind4) \ + { #reg, alt, sizeof(((FPR_linux_mips*)NULL)->reg), FPR_OFFSET(reg), eEncodingUint, \ eFormatHex, { kind1, kind2, kind3, kind4, fpr_##reg##_mips }, NULL, NULL } -#define DEFINE_FPR_INFO(member, reg, alt, kind1, kind2, kind3, kind4) \ - { #reg, alt, sizeof(((FPR_mips*)NULL)->member), FPR_OFFSET(member), eEncodingUint, \ - eFormatHex, { kind1, kind2, kind3, kind4, fpr_##reg##_mips }, NULL, NULL } +#define DEFINE_MSA(reg, alt, kind1, kind2, kind3, kind4) \ + { #reg, alt, sizeof(((MSA_linux_mips*)0)->reg), MSA_OFFSET(reg), eEncodingVector, \ + eFormatVectorOfUInt8, { kind1, kind2, kind3, kind4, msa_##reg##_mips }, NULL, NULL } + +#define DEFINE_MSA_INFO(reg, alt, kind1, kind2, kind3, kind4) \ + { #reg, alt, sizeof(((MSA_linux_mips*)0)->reg), MSA_OFFSET(reg), eEncodingUint, \ + eFormatHex, { kind1, kind2, kind3, kind4, msa_##reg##_mips }, NULL, NULL } // RegisterKind: GCC, DWARF, Generic, GDB, LLDB @@ -70,53 +81,95 @@ DEFINE_GPR (sp, "sp", gcc_dwarf_sp_mips, gcc_dwarf_sp_mips, LLDB_REGNUM_GENERIC_SP, gdb_sp_mips), DEFINE_GPR (r30, "fp", gcc_dwarf_r30_mips, gcc_dwarf_r30_mips, LLDB_REGNUM_GENERIC_FP, gdb_r30_mips), DEFINE_GPR (ra, "ra", gcc_dwarf_ra_mips, gcc_dwarf_ra_mips, LLDB_REGNUM_GENERIC_RA, gdb_ra_mips), + DEFINE_GPR (sr, "status", gcc_dwarf_sr_mips, gcc_dwarf_sr_mips, LLDB_REGNUM_GENERIC_FLAGS, LLDB_INVALID_REGNUM), DEFINE_GPR (mullo, NULL, gcc_dwarf_lo_mips, gcc_dwarf_lo_mips, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), DEFINE_GPR (mulhi, NULL, gcc_dwarf_hi_mips, gcc_dwarf_hi_mips, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), - DEFINE_GPR (pc, NULL, gcc_dwarf_pc_mips, gcc_dwarf_pc_mips, LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM), DEFINE_GPR (badvaddr, NULL, gcc_dwarf_bad_mips, gcc_dwarf_bad_mips, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), - DEFINE_GPR (sr, "status", gcc_dwarf_sr_mips, gcc_dwarf_sr_mips, LLDB_REGNUM_GENERIC_FLAGS, LLDB_INVALID_REGNUM), DEFINE_GPR (cause, NULL, gcc_dwarf_cause_mips, gcc_dwarf_cause_mips, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), - DEFINE_FPR (fp_reg[0], f0, NULL, gcc_dwarf_f0_mips, gcc_dwarf_f0_mips, LLDB_INVALID_REGNUM, gdb_f0_mips), - DEFINE_FPR (fp_reg[1], f1, NULL, gcc_dwarf_f1_mips, gcc_dwarf_f1_mips, LLDB_INVALID_REGNUM, gdb_f1_mips), - DEFINE_FPR (fp_reg[2], f2, NULL, gcc_dwarf_f2_mips, gcc_dwarf_f2_mips, LLDB_INVALID_REGNUM, gdb_f2_mips), - DEFINE_FPR (fp_reg[3], f3, NULL, gcc_dwarf_f3_mips, gcc_dwarf_f3_mips, LLDB_INVALID_REGNUM, gdb_f3_mips), - DEFINE_FPR (fp_reg[4], f4, NULL, gcc_dwarf_f4_mips, gcc_dwarf_f4_mips, LLDB_INVALID_REGNUM, gdb_f4_mips), - DEFINE_FPR (fp_reg[5], f5, NULL, gcc_dwarf_f5_mips, gcc_dwarf_f5_mips, LLDB_INVALID_REGNUM, gdb_f5_mips), - DEFINE_FPR (fp_reg[6], f6, NULL, gcc_dwarf_f6_mips, gcc_dwarf_f6_mips, LLDB_INVALID_REGNUM, gdb_f6_mips), - DEFINE_FPR (fp_reg[7], f7, NULL, gcc_dwarf_f7_mips, gcc_dwarf_f7_mips, LLDB_INVALID_REGNUM, gdb_f7_mips), - DEFINE_FPR (fp_reg[8], f8, NULL, gcc_dwarf_f8_mips, gcc_dwarf_f8_mips, LLDB_INVALID_REGNUM, gdb_f8_mips), - DEFINE_FPR (fp_reg[9], f9, NULL, gcc_dwarf_f9_mips, gcc_dwarf_f9_mips, LLDB_INVALID_REGNUM, gdb_f9_mips), - DEFINE_FPR (fp_reg[10], f10, NULL, gcc_dwarf_f10_mips, gcc_dwarf_f10_mips, LLDB_INVALID_REGNUM, gdb_f10_mips), - DEFINE_FPR (fp_reg[11], f11, NULL, gcc_dwarf_f11_mips, gcc_dwarf_f11_mips, LLDB_INVALID_REGNUM, gdb_f11_mips), - DEFINE_FPR (fp_reg[12], f12, NULL, gcc_dwarf_f12_mips, gcc_dwarf_f12_mips, LLDB_INVALID_REGNUM, gdb_f12_mips), - DEFINE_FPR (fp_reg[13], f13, NULL, gcc_dwarf_f13_mips, gcc_dwarf_f13_mips, LLDB_INVALID_REGNUM, gdb_f13_mips), - DEFINE_FPR (fp_reg[14], f14, NULL, gcc_dwarf_f14_mips, gcc_dwarf_f14_mips, LLDB_INVALID_REGNUM, gdb_f14_mips), - DEFINE_FPR (fp_reg[15], f15, NULL, gcc_dwarf_f15_mips, gcc_dwarf_f15_mips, LLDB_INVALID_REGNUM, gdb_f15_mips), - DEFINE_FPR (fp_reg[16], f16, NULL, gcc_dwarf_f16_mips, gcc_dwarf_f16_mips, LLDB_INVALID_REGNUM, gdb_f16_mips), - DEFINE_FPR (fp_reg[17], f17, NULL, gcc_dwarf_f17_mips, gcc_dwarf_f17_mips, LLDB_INVALID_REGNUM, gdb_f17_mips), - DEFINE_FPR (fp_reg[18], f18, NULL, gcc_dwarf_f18_mips, gcc_dwarf_f18_mips, LLDB_INVALID_REGNUM, gdb_f18_mips), - DEFINE_FPR (fp_reg[19], f19, NULL, gcc_dwarf_f19_mips, gcc_dwarf_f19_mips, LLDB_INVALID_REGNUM, gdb_f19_mips), - DEFINE_FPR (fp_reg[20], f20, NULL, gcc_dwarf_f20_mips, gcc_dwarf_f20_mips, LLDB_INVALID_REGNUM, gdb_f20_mips), - DEFINE_FPR (fp_reg[21], f21, NULL, gcc_dwarf_f21_mips, gcc_dwarf_f21_mips, LLDB_INVALID_REGNUM, gdb_f21_mips), - DEFINE_FPR (fp_reg[22], f22, NULL, gcc_dwarf_f22_mips, gcc_dwarf_f22_mips, LLDB_INVALID_REGNUM, gdb_f22_mips), - DEFINE_FPR (fp_reg[23], f23, NULL, gcc_dwarf_f23_mips, gcc_dwarf_f23_mips, LLDB_INVALID_REGNUM, gdb_f23_mips), - DEFINE_FPR (fp_reg[24], f24, NULL, gcc_dwarf_f24_mips, gcc_dwarf_f24_mips, LLDB_INVALID_REGNUM, gdb_f24_mips), - DEFINE_FPR (fp_reg[25], f25, NULL, gcc_dwarf_f25_mips, gcc_dwarf_f25_mips, LLDB_INVALID_REGNUM, gdb_f25_mips), - DEFINE_FPR (fp_reg[26], f26, NULL, gcc_dwarf_f26_mips, gcc_dwarf_f26_mips, LLDB_INVALID_REGNUM, gdb_f26_mips), - DEFINE_FPR (fp_reg[27], f27, NULL, gcc_dwarf_f27_mips, gcc_dwarf_f27_mips, LLDB_INVALID_REGNUM, gdb_f27_mips), - DEFINE_FPR (fp_reg[28], f28, NULL, gcc_dwarf_f28_mips, gcc_dwarf_f28_mips, LLDB_INVALID_REGNUM, gdb_f28_mips), - DEFINE_FPR (fp_reg[29], f29, NULL, gcc_dwarf_f29_mips, gcc_dwarf_f29_mips, LLDB_INVALID_REGNUM, gdb_f29_mips), - DEFINE_FPR (fp_reg[30], f30, NULL, gcc_dwarf_f30_mips, gcc_dwarf_f30_mips, LLDB_INVALID_REGNUM, gdb_f30_mips), - DEFINE_FPR (fp_reg[31], f31, NULL, gcc_dwarf_f31_mips, gcc_dwarf_f31_mips, LLDB_INVALID_REGNUM, gdb_f31_mips), - DEFINE_FPR_INFO (fcsr, fcsr, NULL, gcc_dwarf_fcsr_mips, gcc_dwarf_fcsr_mips, LLDB_INVALID_REGNUM, gdb_fcsr_mips), - DEFINE_FPR_INFO (fir, fir, NULL, gcc_dwarf_fir_mips, gcc_dwarf_fir_mips, LLDB_INVALID_REGNUM, gdb_fir_mips) + DEFINE_GPR (pc, NULL, gcc_dwarf_pc_mips, gcc_dwarf_pc_mips, LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM), + DEFINE_GPR (config5, NULL, gcc_dwarf_config5_mips, gcc_dwarf_config5_mips, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), + DEFINE_FPR (f0, NULL, gcc_dwarf_f0_mips, gcc_dwarf_f0_mips, LLDB_INVALID_REGNUM, gdb_f0_mips), + DEFINE_FPR (f1, NULL, gcc_dwarf_f1_mips, gcc_dwarf_f1_mips, LLDB_INVALID_REGNUM, gdb_f1_mips), + DEFINE_FPR (f2, NULL, gcc_dwarf_f2_mips, gcc_dwarf_f2_mips, LLDB_INVALID_REGNUM, gdb_f2_mips), + DEFINE_FPR (f3, NULL, gcc_dwarf_f3_mips, gcc_dwarf_f3_mips, LLDB_INVALID_REGNUM, gdb_f3_mips), + DEFINE_FPR (f4, NULL, gcc_dwarf_f4_mips, gcc_dwarf_f4_mips, LLDB_INVALID_REGNUM, gdb_f4_mips), + DEFINE_FPR (f5, NULL, gcc_dwarf_f5_mips, gcc_dwarf_f5_mips, LLDB_INVALID_REGNUM, gdb_f5_mips), + DEFINE_FPR (f6, NULL, gcc_dwarf_f6_mips, gcc_dwarf_f6_mips, LLDB_INVALID_REGNUM, gdb_f6_mips), + DEFINE_FPR (f7, NULL, gcc_dwarf_f7_mips, gcc_dwarf_f7_mips, LLDB_INVALID_REGNUM, gdb_f7_mips), + DEFINE_FPR (f8, NULL, gcc_dwarf_f8_mips, gcc_dwarf_f8_mips, LLDB_INVALID_REGNUM, gdb_f8_mips), + DEFINE_FPR (f9, NULL, gcc_dwarf_f9_mips, gcc_dwarf_f9_mips, LLDB_INVALID_REGNUM, gdb_f9_mips), + DEFINE_FPR (f10, NULL, gcc_dwarf_f10_mips, gcc_dwarf_f10_mips, LLDB_INVALID_REGNUM, gdb_f10_mips), + DEFINE_FPR (f11, NULL, gcc_dwarf_f11_mips, gcc_dwarf_f11_mips, LLDB_INVALID_REGNUM, gdb_f11_mips), + DEFINE_FPR (f12, NULL, gcc_dwarf_f12_mips, gcc_dwarf_f12_mips, LLDB_INVALID_REGNUM, gdb_f12_mips), + DEFINE_FPR (f13, NULL, gcc_dwarf_f13_mips, gcc_dwarf_f13_mips, LLDB_INVALID_REGNUM, gdb_f13_mips), + DEFINE_FPR (f14, NULL, gcc_dwarf_f14_mips, gcc_dwarf_f14_mips, LLDB_INVALID_REGNUM, gdb_f14_mips), + DEFINE_FPR (f15, NULL, gcc_dwarf_f15_mips, gcc_dwarf_f15_mips, LLDB_INVALID_REGNUM, gdb_f15_mips), + DEFINE_FPR (f16, NULL, gcc_dwarf_f16_mips, gcc_dwarf_f16_mips, LLDB_INVALID_REGNUM, gdb_f16_mips), + DEFINE_FPR (f17, NULL, gcc_dwarf_f17_mips, gcc_dwarf_f17_mips, LLDB_INVALID_REGNUM, gdb_f17_mips), + DEFINE_FPR (f18, NULL, gcc_dwarf_f18_mips, gcc_dwarf_f18_mips, LLDB_INVALID_REGNUM, gdb_f18_mips), + DEFINE_FPR (f19, NULL, gcc_dwarf_f19_mips, gcc_dwarf_f19_mips, LLDB_INVALID_REGNUM, gdb_f19_mips), + DEFINE_FPR (f20, NULL, gcc_dwarf_f20_mips, gcc_dwarf_f20_mips, LLDB_INVALID_REGNUM, gdb_f20_mips), + DEFINE_FPR (f21, NULL, gcc_dwarf_f21_mips, gcc_dwarf_f21_mips, LLDB_INVALID_REGNUM, gdb_f21_mips), + DEFINE_FPR (f22, NULL, gcc_dwarf_f22_mips, gcc_dwarf_f22_mips, LLDB_INVALID_REGNUM, gdb_f22_mips), + DEFINE_FPR (f23, NULL, gcc_dwarf_f23_mips, gcc_dwarf_f23_mips, LLDB_INVALID_REGNUM, gdb_f23_mips), + DEFINE_FPR (f24, NULL, gcc_dwarf_f24_mips, gcc_dwarf_f24_mips, LLDB_INVALID_REGNUM, gdb_f24_mips), + DEFINE_FPR (f25, NULL, gcc_dwarf_f25_mips, gcc_dwarf_f25_mips, LLDB_INVALID_REGNUM, gdb_f25_mips), + DEFINE_FPR (f26, NULL, gcc_dwarf_f26_mips, gcc_dwarf_f26_mips, LLDB_INVALID_REGNUM, gdb_f26_mips), + DEFINE_FPR (f27, NULL, gcc_dwarf_f27_mips, gcc_dwarf_f27_mips, LLDB_INVALID_REGNUM, gdb_f27_mips), + DEFINE_FPR (f28, NULL, gcc_dwarf_f28_mips, gcc_dwarf_f28_mips, LLDB_INVALID_REGNUM, gdb_f28_mips), + DEFINE_FPR (f29, NULL, gcc_dwarf_f29_mips, gcc_dwarf_f29_mips, LLDB_INVALID_REGNUM, gdb_f29_mips), + DEFINE_FPR (f30, NULL, gcc_dwarf_f30_mips, gcc_dwarf_f30_mips, LLDB_INVALID_REGNUM, gdb_f30_mips), + DEFINE_FPR (f31, NULL, gcc_dwarf_f31_mips, gcc_dwarf_f31_mips, LLDB_INVALID_REGNUM, gdb_f31_mips), + DEFINE_FPR (fcsr, NULL, gcc_dwarf_fcsr_mips, gcc_dwarf_fcsr_mips, LLDB_INVALID_REGNUM, gdb_fcsr_mips), + DEFINE_FPR (fir, NULL, gcc_dwarf_fir_mips, gcc_dwarf_fir_mips, LLDB_INVALID_REGNUM, gdb_fir_mips), + DEFINE_FPR (config5, NULL, gcc_dwarf_config5_mips, gcc_dwarf_config5_mips, LLDB_INVALID_REGNUM, gdb_config5_mips), + DEFINE_MSA (w0, NULL, gcc_dwarf_w0_mips, gcc_dwarf_w0_mips, LLDB_INVALID_REGNUM, gdb_w0_mips), + DEFINE_MSA (w1, NULL, gcc_dwarf_w1_mips, gcc_dwarf_w1_mips, LLDB_INVALID_REGNUM, gdb_w1_mips), + DEFINE_MSA (w2, NULL, gcc_dwarf_w2_mips, gcc_dwarf_w2_mips, LLDB_INVALID_REGNUM, gdb_w2_mips), + DEFINE_MSA (w3, NULL, gcc_dwarf_w3_mips, gcc_dwarf_w3_mips, LLDB_INVALID_REGNUM, gdb_w3_mips), + DEFINE_MSA (w4, NULL, gcc_dwarf_w4_mips, gcc_dwarf_w4_mips, LLDB_INVALID_REGNUM, gdb_w4_mips), + DEFINE_MSA (w5, NULL, gcc_dwarf_w5_mips, gcc_dwarf_w5_mips, LLDB_INVALID_REGNUM, gdb_w5_mips), + DEFINE_MSA (w6, NULL, gcc_dwarf_w6_mips, gcc_dwarf_w6_mips, LLDB_INVALID_REGNUM, gdb_w6_mips), + DEFINE_MSA (w7, NULL, gcc_dwarf_w7_mips, gcc_dwarf_w7_mips, LLDB_INVALID_REGNUM, gdb_w7_mips), + DEFINE_MSA (w8, NULL, gcc_dwarf_w8_mips, gcc_dwarf_w8_mips, LLDB_INVALID_REGNUM, gdb_w8_mips), + DEFINE_MSA (w9, NULL, gcc_dwarf_w9_mips, gcc_dwarf_w9_mips, LLDB_INVALID_REGNUM, gdb_w9_mips), + DEFINE_MSA (w10, NULL, gcc_dwarf_w10_mips, gcc_dwarf_w10_mips, LLDB_INVALID_REGNUM, gdb_w10_mips), + DEFINE_MSA (w11, NULL, gcc_dwarf_w11_mips, gcc_dwarf_w11_mips, LLDB_INVALID_REGNUM, gdb_w11_mips), + DEFINE_MSA (w12, NULL, gcc_dwarf_w12_mips, gcc_dwarf_w12_mips, LLDB_INVALID_REGNUM, gdb_w12_mips), + DEFINE_MSA (w13, NULL, gcc_dwarf_w13_mips, gcc_dwarf_w13_mips, LLDB_INVALID_REGNUM, gdb_w13_mips), + DEFINE_MSA (w14, NULL, gcc_dwarf_w14_mips, gcc_dwarf_w14_mips, LLDB_INVALID_REGNUM, gdb_w14_mips), + DEFINE_MSA (w15, NULL, gcc_dwarf_w15_mips, gcc_dwarf_w15_mips, LLDB_INVALID_REGNUM, gdb_w15_mips), + DEFINE_MSA (w16, NULL, gcc_dwarf_w16_mips, gcc_dwarf_w16_mips, LLDB_INVALID_REGNUM, gdb_w16_mips), + DEFINE_MSA (w17, NULL, gcc_dwarf_w17_mips, gcc_dwarf_w17_mips, LLDB_INVALID_REGNUM, gdb_w17_mips), + DEFINE_MSA (w18, NULL, gcc_dwarf_w18_mips, gcc_dwarf_w18_mips, LLDB_INVALID_REGNUM, gdb_w18_mips), + DEFINE_MSA (w19, NULL, gcc_dwarf_w19_mips, gcc_dwarf_w19_mips, LLDB_INVALID_REGNUM, gdb_w19_mips), + DEFINE_MSA (w20, NULL, gcc_dwarf_w10_mips, gcc_dwarf_w20_mips, LLDB_INVALID_REGNUM, gdb_w20_mips), + DEFINE_MSA (w21, NULL, gcc_dwarf_w21_mips, gcc_dwarf_w21_mips, LLDB_INVALID_REGNUM, gdb_w21_mips), + DEFINE_MSA (w22, NULL, gcc_dwarf_w22_mips, gcc_dwarf_w22_mips, LLDB_INVALID_REGNUM, gdb_w22_mips), + DEFINE_MSA (w23, NULL, gcc_dwarf_w23_mips, gcc_dwarf_w23_mips, LLDB_INVALID_REGNUM, gdb_w23_mips), + DEFINE_MSA (w24, NULL, gcc_dwarf_w24_mips, gcc_dwarf_w24_mips, LLDB_INVALID_REGNUM, gdb_w24_mips), + DEFINE_MSA (w25, NULL, gcc_dwarf_w25_mips, gcc_dwarf_w25_mips, LLDB_INVALID_REGNUM, gdb_w25_mips), + DEFINE_MSA (w26, NULL, gcc_dwarf_w26_mips, gcc_dwarf_w26_mips, LLDB_INVALID_REGNUM, gdb_w26_mips), + DEFINE_MSA (w27, NULL, gcc_dwarf_w27_mips, gcc_dwarf_w27_mips, LLDB_INVALID_REGNUM, gdb_w27_mips), + DEFINE_MSA (w28, NULL, gcc_dwarf_w28_mips, gcc_dwarf_w28_mips, LLDB_INVALID_REGNUM, gdb_w28_mips), + DEFINE_MSA (w29, NULL, gcc_dwarf_w29_mips, gcc_dwarf_w29_mips, LLDB_INVALID_REGNUM, gdb_w29_mips), + DEFINE_MSA (w30, NULL, gcc_dwarf_w30_mips, gcc_dwarf_w30_mips, LLDB_INVALID_REGNUM, gdb_w30_mips), + DEFINE_MSA (w31, NULL, gcc_dwarf_w31_mips, gcc_dwarf_w31_mips, LLDB_INVALID_REGNUM, gdb_w31_mips), + DEFINE_MSA_INFO (mcsr, NULL, gcc_dwarf_mcsr_mips, gcc_dwarf_mcsr_mips, LLDB_INVALID_REGNUM, gdb_mcsr_mips), + DEFINE_MSA_INFO (mir, NULL, gcc_dwarf_mir_mips, gcc_dwarf_mir_mips, LLDB_INVALID_REGNUM, gdb_mir_mips), + DEFINE_MSA_INFO (fcsr, NULL, gcc_dwarf_fcsr_mips, gcc_dwarf_fcsr_mips, LLDB_INVALID_REGNUM, gdb_fcsr_mips), + DEFINE_MSA_INFO (fir, NULL, gcc_dwarf_fir_mips, gcc_dwarf_fir_mips, LLDB_INVALID_REGNUM, gdb_fir_mips), + DEFINE_MSA_INFO (config5, NULL, gcc_dwarf_config5_mips, gcc_dwarf_config5_mips, LLDB_INVALID_REGNUM, gdb_config5_mips) }; static_assert((sizeof(g_register_infos_mips) / sizeof(g_register_infos_mips[0])) == k_num_registers_mips, "g_register_infos_mips has wrong number of register infos"); #undef GPR_OFFSET #undef FPR_OFFSET +#undef MSA_OFFSET #undef DEFINE_GPR #undef DEFINE_FPR +#undef DEFINE_MSA +#undef DEFINE_MSA_INFO #endif // DECLARE_REGISTER_INFOS_MIPS_STRUCT Index: source/Plugins/Process/Utility/RegisterInfos_mips64.h =================================================================== --- source/Plugins/Process/Utility/RegisterInfos_mips64.h +++ source/Plugins/Process/Utility/RegisterInfos_mips64.h @@ -13,28 +13,59 @@ #ifdef DECLARE_REGISTER_INFOS_MIPS64_STRUCT // Computes the offset of the given GPR in the user data area. -#define GPR_OFFSET(regname) \ - (LLVM_EXTENSION offsetof(GPR, regname)) +#ifdef LINUX_MIPS64 + #define GPR_OFFSET(regname) \ + (LLVM_EXTENSION offsetof(UserArea, gpr) + \ + LLVM_EXTENSION offsetof(GPR_linux_mips, regname)) +#else + #define GPR_OFFSET(regname) \ + (LLVM_EXTENSION offsetof(GPR_freebsd_mips, regname)) +#endif // Computes the offset of the given FPR in the extended data area. #define FPR_OFFSET(regname) \ - LLVM_EXTENSION offsetof(FPR_mips, regname) \ + (LLVM_EXTENSION offsetof(UserArea, fpr) + \ + LLVM_EXTENSION offsetof(FPR_linux_mips, regname)) + +// Computes the offset of the given MSA in the extended data area. +#define MSA_OFFSET(regname) \ + (LLVM_EXTENSION offsetof(UserArea, msa) + \ + LLVM_EXTENSION offsetof(MSA_linux_mips, regname)) // RegisterKind: GCC, DWARF, Generic, GDB, LLDB // Note that the size and offset will be updated by platform-specific classes. -#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \ - { #reg, alt, sizeof(((GPR*)0)->reg), GPR_OFFSET(reg), eEncodingUint, \ +#ifdef LINUX_MIPS64 + #define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \ + { #reg, alt, sizeof(((GPR_linux_mips*)0)->reg), GPR_OFFSET(reg), eEncodingUint, \ + eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg##_mips64 }, NULL, NULL } +#else + #define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \ + { #reg, alt, sizeof(((GPR_freebsd_mips*)0)->reg), GPR_OFFSET(reg), eEncodingUint, \ + eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg##_mips64 }, NULL, NULL } +#endif + +#define DEFINE_GPR_INFO(reg, alt, kind1, kind2, kind3, kind4) \ + { #reg, alt, sizeof(((GPR_linux_mips*)0)->reg) / 2, GPR_OFFSET(reg), eEncodingUint, \ eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg##_mips64 }, NULL, NULL } -#define DEFINE_FPR(member, reg, alt, kind1, kind2, kind3, kind4) \ - { #reg, alt, sizeof(((FPR_mips*)0)->member), FPR_OFFSET(member), eEncodingUint, \ +#define DEFINE_FPR(reg, alt, kind1, kind2, kind3, kind4) \ + { #reg, alt, sizeof(((FPR_linux_mips*)0)->reg), FPR_OFFSET(reg), eEncodingUint, \ eFormatHex, { kind1, kind2, kind3, kind4, fpr_##reg##_mips64 }, NULL, NULL } +#define DEFINE_MSA(reg, alt, kind1, kind2, kind3, kind4) \ + { #reg, alt, sizeof(((MSA_linux_mips*)0)->reg), MSA_OFFSET(reg), eEncodingVector, \ + eFormatVectorOfUInt8, { kind1, kind2, kind3, kind4, msa_##reg##_mips64 }, NULL, NULL } + +#define DEFINE_MSA_INFO(reg, alt, kind1, kind2, kind3, kind4) \ + { #reg, alt, sizeof(((MSA_linux_mips*)0)->reg), MSA_OFFSET(reg), eEncodingUint, \ + eFormatHex, { kind1, kind2, kind3, kind4, msa_##reg##_mips64 }, NULL, NULL } + static RegisterInfo g_register_infos_mips64[] = { // General purpose registers. GCC, DWARF, Generic, GDB +#ifndef LINUX_MIPS64 DEFINE_GPR(zero, "r0", gcc_dwarf_zero_mips64, gcc_dwarf_zero_mips64, LLDB_INVALID_REGNUM, gdb_zero_mips64), DEFINE_GPR(r1, NULL, gcc_dwarf_r1_mips64, gcc_dwarf_r1_mips64, LLDB_INVALID_REGNUM, gdb_r1_mips64), DEFINE_GPR(r2, NULL, gcc_dwarf_r2_mips64, gcc_dwarf_r2_mips64, LLDB_INVALID_REGNUM, gdb_r2_mips64), @@ -67,56 +98,140 @@ DEFINE_GPR(sp, "r29", gcc_dwarf_sp_mips64, gcc_dwarf_sp_mips64, LLDB_REGNUM_GENERIC_SP, gdb_sp_mips64), DEFINE_GPR(r30, NULL, gcc_dwarf_r30_mips64, gcc_dwarf_r30_mips64, LLDB_REGNUM_GENERIC_FP, gdb_r30_mips64), DEFINE_GPR(ra, "r31", gcc_dwarf_ra_mips64, gcc_dwarf_ra_mips64, LLDB_REGNUM_GENERIC_RA, gdb_ra_mips64), + DEFINE_GPR(sr, NULL, gcc_dwarf_sr_mips64, gcc_dwarf_sr_mips64, LLDB_REGNUM_GENERIC_FLAGS, LLDB_INVALID_REGNUM), DEFINE_GPR(mullo, NULL, gcc_dwarf_lo_mips64, gcc_dwarf_lo_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), DEFINE_GPR(mulhi, NULL, gcc_dwarf_hi_mips64, gcc_dwarf_hi_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), - DEFINE_GPR(pc, "pc", gcc_dwarf_pc_mips64, gcc_dwarf_pc_mips64, LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM), DEFINE_GPR(badvaddr, NULL, gcc_dwarf_bad_mips64, gcc_dwarf_bad_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), - DEFINE_GPR(sr, NULL, gcc_dwarf_sr_mips64, gcc_dwarf_sr_mips64, LLDB_REGNUM_GENERIC_FLAGS, LLDB_INVALID_REGNUM), DEFINE_GPR(cause, NULL, gcc_dwarf_cause_mips64, gcc_dwarf_cause_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), + DEFINE_GPR(pc, "pc", gcc_dwarf_pc_mips64, gcc_dwarf_pc_mips64, LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM), DEFINE_GPR(ic, NULL, gcc_dwarf_ic_mips64, gcc_dwarf_ic_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), DEFINE_GPR(dummy, NULL, gcc_dwarf_dummy_mips64, gcc_dwarf_dummy_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), +#else - DEFINE_FPR (fp_reg[0], f0, NULL, gcc_dwarf_f0_mips64, gcc_dwarf_f0_mips64, LLDB_INVALID_REGNUM, gdb_f0_mips64), - DEFINE_FPR (fp_reg[1], f1, NULL, gcc_dwarf_f1_mips64, gcc_dwarf_f1_mips64, LLDB_INVALID_REGNUM, gdb_f1_mips64), - DEFINE_FPR (fp_reg[2], f2, NULL, gcc_dwarf_f2_mips64, gcc_dwarf_f2_mips64, LLDB_INVALID_REGNUM, gdb_f2_mips64), - DEFINE_FPR (fp_reg[3], f3, NULL, gcc_dwarf_f3_mips64, gcc_dwarf_f3_mips64, LLDB_INVALID_REGNUM, gdb_f3_mips64), - DEFINE_FPR (fp_reg[4], f4, NULL, gcc_dwarf_f4_mips64, gcc_dwarf_f4_mips64, LLDB_INVALID_REGNUM, gdb_f4_mips64), - DEFINE_FPR (fp_reg[5], f5, NULL, gcc_dwarf_f5_mips64, gcc_dwarf_f5_mips64, LLDB_INVALID_REGNUM, gdb_f5_mips64), - DEFINE_FPR (fp_reg[6], f6, NULL, gcc_dwarf_f6_mips64, gcc_dwarf_f6_mips64, LLDB_INVALID_REGNUM, gdb_f6_mips64), - DEFINE_FPR (fp_reg[7], f7, NULL, gcc_dwarf_f7_mips64, gcc_dwarf_f7_mips64, LLDB_INVALID_REGNUM, gdb_f7_mips64), - DEFINE_FPR (fp_reg[8], f8, NULL, gcc_dwarf_f8_mips64, gcc_dwarf_f8_mips64, LLDB_INVALID_REGNUM, gdb_f8_mips64), - DEFINE_FPR (fp_reg[9], f9, NULL, gcc_dwarf_f9_mips64, gcc_dwarf_f9_mips64, LLDB_INVALID_REGNUM, gdb_f9_mips64), - DEFINE_FPR (fp_reg[10], f10, NULL, gcc_dwarf_f10_mips64, gcc_dwarf_f10_mips64, LLDB_INVALID_REGNUM, gdb_f10_mips64), - DEFINE_FPR (fp_reg[11], f11, NULL, gcc_dwarf_f11_mips64, gcc_dwarf_f11_mips64, LLDB_INVALID_REGNUM, gdb_f11_mips64), - DEFINE_FPR (fp_reg[12], f12, NULL, gcc_dwarf_f12_mips64, gcc_dwarf_f12_mips64, LLDB_INVALID_REGNUM, gdb_f12_mips64), - DEFINE_FPR (fp_reg[13], f13, NULL, gcc_dwarf_f13_mips64, gcc_dwarf_f13_mips64, LLDB_INVALID_REGNUM, gdb_f13_mips64), - DEFINE_FPR (fp_reg[14], f14, NULL, gcc_dwarf_f14_mips64, gcc_dwarf_f14_mips64, LLDB_INVALID_REGNUM, gdb_f14_mips64), - DEFINE_FPR (fp_reg[15], f15, NULL, gcc_dwarf_f15_mips64, gcc_dwarf_f15_mips64, LLDB_INVALID_REGNUM, gdb_f15_mips64), - DEFINE_FPR (fp_reg[16], f16, NULL, gcc_dwarf_f16_mips64, gcc_dwarf_f16_mips64, LLDB_INVALID_REGNUM, gdb_f16_mips64), - DEFINE_FPR (fp_reg[17], f17, NULL, gcc_dwarf_f17_mips64, gcc_dwarf_f17_mips64, LLDB_INVALID_REGNUM, gdb_f17_mips64), - DEFINE_FPR (fp_reg[18], f18, NULL, gcc_dwarf_f18_mips64, gcc_dwarf_f18_mips64, LLDB_INVALID_REGNUM, gdb_f18_mips64), - DEFINE_FPR (fp_reg[19], f19, NULL, gcc_dwarf_f19_mips64, gcc_dwarf_f19_mips64, LLDB_INVALID_REGNUM, gdb_f19_mips64), - DEFINE_FPR (fp_reg[20], f20, NULL, gcc_dwarf_f20_mips64, gcc_dwarf_f20_mips64, LLDB_INVALID_REGNUM, gdb_f20_mips64), - DEFINE_FPR (fp_reg[21], f21, NULL, gcc_dwarf_f21_mips64, gcc_dwarf_f21_mips64, LLDB_INVALID_REGNUM, gdb_f21_mips64), - DEFINE_FPR (fp_reg[22], f22, NULL, gcc_dwarf_f22_mips64, gcc_dwarf_f22_mips64, LLDB_INVALID_REGNUM, gdb_f22_mips64), - DEFINE_FPR (fp_reg[23], f23, NULL, gcc_dwarf_f23_mips64, gcc_dwarf_f23_mips64, LLDB_INVALID_REGNUM, gdb_f23_mips64), - DEFINE_FPR (fp_reg[24], f24, NULL, gcc_dwarf_f24_mips64, gcc_dwarf_f24_mips64, LLDB_INVALID_REGNUM, gdb_f24_mips64), - DEFINE_FPR (fp_reg[25], f25, NULL, gcc_dwarf_f25_mips64, gcc_dwarf_f25_mips64, LLDB_INVALID_REGNUM, gdb_f25_mips64), - DEFINE_FPR (fp_reg[26], f26, NULL, gcc_dwarf_f26_mips64, gcc_dwarf_f26_mips64, LLDB_INVALID_REGNUM, gdb_f26_mips64), - DEFINE_FPR (fp_reg[27], f27, NULL, gcc_dwarf_f27_mips64, gcc_dwarf_f27_mips64, LLDB_INVALID_REGNUM, gdb_f27_mips64), - DEFINE_FPR (fp_reg[28], f28, NULL, gcc_dwarf_f28_mips64, gcc_dwarf_f28_mips64, LLDB_INVALID_REGNUM, gdb_f28_mips64), - DEFINE_FPR (fp_reg[29], f29, NULL, gcc_dwarf_f29_mips64, gcc_dwarf_f29_mips64, LLDB_INVALID_REGNUM, gdb_f29_mips64), - DEFINE_FPR (fp_reg[30], f30, NULL, gcc_dwarf_f30_mips64, gcc_dwarf_f30_mips64, LLDB_INVALID_REGNUM, gdb_f30_mips64), - DEFINE_FPR (fp_reg[31], f31, NULL, gcc_dwarf_f31_mips64, gcc_dwarf_f31_mips64, LLDB_INVALID_REGNUM, gdb_f31_mips64), - DEFINE_FPR (fcsr, fcsr, NULL, gcc_dwarf_fcsr_mips64, gcc_dwarf_fcsr_mips64, LLDB_INVALID_REGNUM, gdb_fcsr_mips64), - DEFINE_FPR (fir, fir, NULL, gcc_dwarf_fir_mips64, gcc_dwarf_fir_mips64, LLDB_INVALID_REGNUM, gdb_fir_mips64) + DEFINE_GPR(zero, "r0", gcc_dwarf_zero_mips64, gcc_dwarf_zero_mips64, LLDB_INVALID_REGNUM, gdb_zero_mips64), + DEFINE_GPR(r1, NULL, gcc_dwarf_r1_mips64, gcc_dwarf_r1_mips64, LLDB_INVALID_REGNUM, gdb_r1_mips64), + DEFINE_GPR(r2, NULL, gcc_dwarf_r2_mips64, gcc_dwarf_r2_mips64, LLDB_INVALID_REGNUM, gdb_r2_mips64), + DEFINE_GPR(r3, NULL, gcc_dwarf_r3_mips64, gcc_dwarf_r3_mips64, LLDB_INVALID_REGNUM, gdb_r3_mips64), + DEFINE_GPR(r4, NULL, gcc_dwarf_r4_mips64, gcc_dwarf_r4_mips64, LLDB_REGNUM_GENERIC_ARG1, gdb_r4_mips64), + DEFINE_GPR(r5, NULL, gcc_dwarf_r5_mips64, gcc_dwarf_r5_mips64, LLDB_REGNUM_GENERIC_ARG2, gdb_r5_mips64), + DEFINE_GPR(r6, NULL, gcc_dwarf_r6_mips64, gcc_dwarf_r6_mips64, LLDB_REGNUM_GENERIC_ARG3, gdb_r6_mips64), + DEFINE_GPR(r7, NULL, gcc_dwarf_r7_mips64, gcc_dwarf_r7_mips64, LLDB_REGNUM_GENERIC_ARG4, gdb_r7_mips64), + DEFINE_GPR(r8, NULL, gcc_dwarf_r8_mips64, gcc_dwarf_r8_mips64, LLDB_REGNUM_GENERIC_ARG5, gdb_r8_mips64), + DEFINE_GPR(r9, NULL, gcc_dwarf_r9_mips64, gcc_dwarf_r9_mips64, LLDB_REGNUM_GENERIC_ARG6, gdb_r9_mips64), + DEFINE_GPR(r10, NULL, gcc_dwarf_r10_mips64, gcc_dwarf_r10_mips64, LLDB_REGNUM_GENERIC_ARG7, gdb_r10_mips64), + DEFINE_GPR(r11, NULL, gcc_dwarf_r11_mips64, gcc_dwarf_r11_mips64, LLDB_REGNUM_GENERIC_ARG8, gdb_r11_mips64), + DEFINE_GPR(r12, NULL, gcc_dwarf_r12_mips64, gcc_dwarf_r12_mips64, LLDB_INVALID_REGNUM, gdb_r12_mips64), + DEFINE_GPR(r13, NULL, gcc_dwarf_r13_mips64, gcc_dwarf_r13_mips64, LLDB_INVALID_REGNUM, gdb_r13_mips64), + DEFINE_GPR(r14, NULL, gcc_dwarf_r14_mips64, gcc_dwarf_r14_mips64, LLDB_INVALID_REGNUM, gdb_r14_mips64), + DEFINE_GPR(r15, NULL, gcc_dwarf_r15_mips64, gcc_dwarf_r15_mips64, LLDB_INVALID_REGNUM, gdb_r15_mips64), + DEFINE_GPR(r16, NULL, gcc_dwarf_r16_mips64, gcc_dwarf_r16_mips64, LLDB_INVALID_REGNUM, gdb_r16_mips64), + DEFINE_GPR(r17, NULL, gcc_dwarf_r17_mips64, gcc_dwarf_r17_mips64, LLDB_INVALID_REGNUM, gdb_r17_mips64), + DEFINE_GPR(r18, NULL, gcc_dwarf_r18_mips64, gcc_dwarf_r18_mips64, LLDB_INVALID_REGNUM, gdb_r18_mips64), + DEFINE_GPR(r19, NULL, gcc_dwarf_r19_mips64, gcc_dwarf_r19_mips64, LLDB_INVALID_REGNUM, gdb_r19_mips64), + DEFINE_GPR(r20, NULL, gcc_dwarf_r20_mips64, gcc_dwarf_r20_mips64, LLDB_INVALID_REGNUM, gdb_r20_mips64), + DEFINE_GPR(r21, NULL, gcc_dwarf_r21_mips64, gcc_dwarf_r21_mips64, LLDB_INVALID_REGNUM, gdb_r21_mips64), + DEFINE_GPR(r22, NULL, gcc_dwarf_r22_mips64, gcc_dwarf_r22_mips64, LLDB_INVALID_REGNUM, gdb_r22_mips64), + DEFINE_GPR(r23, NULL, gcc_dwarf_r23_mips64, gcc_dwarf_r23_mips64, LLDB_INVALID_REGNUM, gdb_r23_mips64), + DEFINE_GPR(r24, NULL, gcc_dwarf_r24_mips64, gcc_dwarf_r24_mips64, LLDB_INVALID_REGNUM, gdb_r24_mips64), + DEFINE_GPR(r25, NULL, gcc_dwarf_r25_mips64, gcc_dwarf_r25_mips64, LLDB_INVALID_REGNUM, gdb_r25_mips64), + DEFINE_GPR(r26, NULL, gcc_dwarf_r26_mips64, gcc_dwarf_r26_mips64, LLDB_INVALID_REGNUM, gdb_r26_mips64), + DEFINE_GPR(r27, NULL, gcc_dwarf_r27_mips64, gcc_dwarf_r27_mips64, LLDB_INVALID_REGNUM, gdb_r27_mips64), + DEFINE_GPR(gp, "r28", gcc_dwarf_gp_mips64, gcc_dwarf_gp_mips64, LLDB_INVALID_REGNUM, gdb_gp_mips64), + DEFINE_GPR(sp, "r29", gcc_dwarf_sp_mips64, gcc_dwarf_sp_mips64, LLDB_REGNUM_GENERIC_SP, gdb_sp_mips64), + DEFINE_GPR(r30, NULL, gcc_dwarf_r30_mips64, gcc_dwarf_r30_mips64, LLDB_REGNUM_GENERIC_FP, gdb_r30_mips64), + DEFINE_GPR(ra, "r31", gcc_dwarf_ra_mips64, gcc_dwarf_ra_mips64, LLDB_REGNUM_GENERIC_RA, gdb_ra_mips64), + DEFINE_GPR_INFO(sr, NULL, gcc_dwarf_sr_mips64, gcc_dwarf_sr_mips64, LLDB_REGNUM_GENERIC_FLAGS, LLDB_INVALID_REGNUM), + DEFINE_GPR(mullo, NULL, gcc_dwarf_lo_mips64, gcc_dwarf_lo_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), + DEFINE_GPR(mulhi, NULL, gcc_dwarf_hi_mips64, gcc_dwarf_hi_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), + DEFINE_GPR(badvaddr, NULL, gcc_dwarf_bad_mips64, gcc_dwarf_bad_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), + DEFINE_GPR_INFO(cause, NULL, gcc_dwarf_cause_mips64, gcc_dwarf_cause_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), + DEFINE_GPR(pc, "pc", gcc_dwarf_pc_mips64, gcc_dwarf_pc_mips64, LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM), + DEFINE_GPR_INFO(config5, NULL, gcc_dwarf_config5_mips64, gcc_dwarf_config5_mips64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM), + DEFINE_FPR (f0, NULL, gcc_dwarf_f0_mips64, gcc_dwarf_f0_mips64, LLDB_INVALID_REGNUM, gdb_f0_mips64), + DEFINE_FPR (f1, NULL, gcc_dwarf_f1_mips64, gcc_dwarf_f1_mips64, LLDB_INVALID_REGNUM, gdb_f1_mips64), + DEFINE_FPR (f2, NULL, gcc_dwarf_f2_mips64, gcc_dwarf_f2_mips64, LLDB_INVALID_REGNUM, gdb_f2_mips64), + DEFINE_FPR (f3, NULL, gcc_dwarf_f3_mips64, gcc_dwarf_f3_mips64, LLDB_INVALID_REGNUM, gdb_f3_mips64), + DEFINE_FPR (f4, NULL, gcc_dwarf_f4_mips64, gcc_dwarf_f4_mips64, LLDB_INVALID_REGNUM, gdb_f4_mips64), + DEFINE_FPR (f5, NULL, gcc_dwarf_f5_mips64, gcc_dwarf_f5_mips64, LLDB_INVALID_REGNUM, gdb_f5_mips64), + DEFINE_FPR (f6, NULL, gcc_dwarf_f6_mips64, gcc_dwarf_f6_mips64, LLDB_INVALID_REGNUM, gdb_f6_mips64), + DEFINE_FPR (f7, NULL, gcc_dwarf_f7_mips64, gcc_dwarf_f7_mips64, LLDB_INVALID_REGNUM, gdb_f7_mips64), + DEFINE_FPR (f8, NULL, gcc_dwarf_f8_mips64, gcc_dwarf_f8_mips64, LLDB_INVALID_REGNUM, gdb_f8_mips64), + DEFINE_FPR (f9, NULL, gcc_dwarf_f9_mips64, gcc_dwarf_f9_mips64, LLDB_INVALID_REGNUM, gdb_f9_mips64), + DEFINE_FPR (f10, NULL, gcc_dwarf_f10_mips64, gcc_dwarf_f10_mips64, LLDB_INVALID_REGNUM, gdb_f10_mips64), + DEFINE_FPR (f11, NULL, gcc_dwarf_f11_mips64, gcc_dwarf_f11_mips64, LLDB_INVALID_REGNUM, gdb_f11_mips64), + DEFINE_FPR (f12, NULL, gcc_dwarf_f12_mips64, gcc_dwarf_f12_mips64, LLDB_INVALID_REGNUM, gdb_f12_mips64), + DEFINE_FPR (f13, NULL, gcc_dwarf_f13_mips64, gcc_dwarf_f13_mips64, LLDB_INVALID_REGNUM, gdb_f13_mips64), + DEFINE_FPR (f14, NULL, gcc_dwarf_f14_mips64, gcc_dwarf_f14_mips64, LLDB_INVALID_REGNUM, gdb_f14_mips64), + DEFINE_FPR (f15, NULL, gcc_dwarf_f15_mips64, gcc_dwarf_f15_mips64, LLDB_INVALID_REGNUM, gdb_f15_mips64), + DEFINE_FPR (f16, NULL, gcc_dwarf_f16_mips64, gcc_dwarf_f16_mips64, LLDB_INVALID_REGNUM, gdb_f16_mips64), + DEFINE_FPR (f17, NULL, gcc_dwarf_f17_mips64, gcc_dwarf_f17_mips64, LLDB_INVALID_REGNUM, gdb_f17_mips64), + DEFINE_FPR (f18, NULL, gcc_dwarf_f18_mips64, gcc_dwarf_f18_mips64, LLDB_INVALID_REGNUM, gdb_f18_mips64), + DEFINE_FPR (f19, NULL, gcc_dwarf_f19_mips64, gcc_dwarf_f19_mips64, LLDB_INVALID_REGNUM, gdb_f19_mips64), + DEFINE_FPR (f20, NULL, gcc_dwarf_f20_mips64, gcc_dwarf_f20_mips64, LLDB_INVALID_REGNUM, gdb_f20_mips64), + DEFINE_FPR (f21, NULL, gcc_dwarf_f21_mips64, gcc_dwarf_f21_mips64, LLDB_INVALID_REGNUM, gdb_f21_mips64), + DEFINE_FPR (f22, NULL, gcc_dwarf_f22_mips64, gcc_dwarf_f22_mips64, LLDB_INVALID_REGNUM, gdb_f22_mips64), + DEFINE_FPR (f23, NULL, gcc_dwarf_f23_mips64, gcc_dwarf_f23_mips64, LLDB_INVALID_REGNUM, gdb_f23_mips64), + DEFINE_FPR (f24, NULL, gcc_dwarf_f24_mips64, gcc_dwarf_f24_mips64, LLDB_INVALID_REGNUM, gdb_f24_mips64), + DEFINE_FPR (f25, NULL, gcc_dwarf_f25_mips64, gcc_dwarf_f25_mips64, LLDB_INVALID_REGNUM, gdb_f25_mips64), + DEFINE_FPR (f26, NULL, gcc_dwarf_f26_mips64, gcc_dwarf_f26_mips64, LLDB_INVALID_REGNUM, gdb_f26_mips64), + DEFINE_FPR (f27, NULL, gcc_dwarf_f27_mips64, gcc_dwarf_f27_mips64, LLDB_INVALID_REGNUM, gdb_f27_mips64), + DEFINE_FPR (f28, NULL, gcc_dwarf_f28_mips64, gcc_dwarf_f28_mips64, LLDB_INVALID_REGNUM, gdb_f28_mips64), + DEFINE_FPR (f29, NULL, gcc_dwarf_f29_mips64, gcc_dwarf_f29_mips64, LLDB_INVALID_REGNUM, gdb_f29_mips64), + DEFINE_FPR (f30, NULL, gcc_dwarf_f30_mips64, gcc_dwarf_f30_mips64, LLDB_INVALID_REGNUM, gdb_f30_mips64), + DEFINE_FPR (f31, NULL, gcc_dwarf_f31_mips64, gcc_dwarf_f31_mips64, LLDB_INVALID_REGNUM, gdb_f31_mips64), + DEFINE_FPR (fcsr, NULL, gcc_dwarf_fcsr_mips64, gcc_dwarf_fcsr_mips64, LLDB_INVALID_REGNUM, gdb_fcsr_mips64), + DEFINE_FPR (fir, NULL, gcc_dwarf_fir_mips64, gcc_dwarf_fir_mips64, LLDB_INVALID_REGNUM, gdb_fir_mips64), + DEFINE_FPR (config5, NULL, gcc_dwarf_config5_mips64, gcc_dwarf_config5_mips64, LLDB_INVALID_REGNUM, gdb_config5_mips64), + DEFINE_MSA (w0, NULL, gcc_dwarf_w0_mips64, gcc_dwarf_w0_mips64, LLDB_INVALID_REGNUM, gdb_w0_mips64), + DEFINE_MSA (w1, NULL, gcc_dwarf_w1_mips64, gcc_dwarf_w1_mips64, LLDB_INVALID_REGNUM, gdb_w1_mips64), + DEFINE_MSA (w2, NULL, gcc_dwarf_w2_mips64, gcc_dwarf_w2_mips64, LLDB_INVALID_REGNUM, gdb_w2_mips64), + DEFINE_MSA (w3, NULL, gcc_dwarf_w3_mips64, gcc_dwarf_w3_mips64, LLDB_INVALID_REGNUM, gdb_w3_mips64), + DEFINE_MSA (w4, NULL, gcc_dwarf_w4_mips64, gcc_dwarf_w4_mips64, LLDB_INVALID_REGNUM, gdb_w4_mips64), + DEFINE_MSA (w5, NULL, gcc_dwarf_w5_mips64, gcc_dwarf_w5_mips64, LLDB_INVALID_REGNUM, gdb_w5_mips64), + DEFINE_MSA (w6, NULL, gcc_dwarf_w6_mips64, gcc_dwarf_w6_mips64, LLDB_INVALID_REGNUM, gdb_w6_mips64), + DEFINE_MSA (w7, NULL, gcc_dwarf_w7_mips64, gcc_dwarf_w7_mips64, LLDB_INVALID_REGNUM, gdb_w7_mips64), + DEFINE_MSA (w8, NULL, gcc_dwarf_w8_mips64, gcc_dwarf_w8_mips64, LLDB_INVALID_REGNUM, gdb_w8_mips64), + DEFINE_MSA (w9, NULL, gcc_dwarf_w9_mips64, gcc_dwarf_w9_mips64, LLDB_INVALID_REGNUM, gdb_w9_mips64), + DEFINE_MSA (w10, NULL, gcc_dwarf_w10_mips64, gcc_dwarf_w10_mips64, LLDB_INVALID_REGNUM, gdb_w10_mips64), + DEFINE_MSA (w11, NULL, gcc_dwarf_w11_mips64, gcc_dwarf_w11_mips64, LLDB_INVALID_REGNUM, gdb_w11_mips64), + DEFINE_MSA (w12, NULL, gcc_dwarf_w12_mips64, gcc_dwarf_w12_mips64, LLDB_INVALID_REGNUM, gdb_w12_mips64), + DEFINE_MSA (w13, NULL, gcc_dwarf_w13_mips64, gcc_dwarf_w13_mips64, LLDB_INVALID_REGNUM, gdb_w13_mips64), + DEFINE_MSA (w14, NULL, gcc_dwarf_w14_mips64, gcc_dwarf_w14_mips64, LLDB_INVALID_REGNUM, gdb_w14_mips64), + DEFINE_MSA (w15, NULL, gcc_dwarf_w15_mips64, gcc_dwarf_w15_mips64, LLDB_INVALID_REGNUM, gdb_w15_mips64), + DEFINE_MSA (w16, NULL, gcc_dwarf_w16_mips64, gcc_dwarf_w16_mips64, LLDB_INVALID_REGNUM, gdb_w16_mips64), + DEFINE_MSA (w17, NULL, gcc_dwarf_w17_mips64, gcc_dwarf_w17_mips64, LLDB_INVALID_REGNUM, gdb_w17_mips64), + DEFINE_MSA (w18, NULL, gcc_dwarf_w18_mips64, gcc_dwarf_w18_mips64, LLDB_INVALID_REGNUM, gdb_w18_mips64), + DEFINE_MSA (w19, NULL, gcc_dwarf_w19_mips64, gcc_dwarf_w19_mips64, LLDB_INVALID_REGNUM, gdb_w19_mips64), + DEFINE_MSA (w20, NULL, gcc_dwarf_w10_mips64, gcc_dwarf_w20_mips64, LLDB_INVALID_REGNUM, gdb_w20_mips64), + DEFINE_MSA (w21, NULL, gcc_dwarf_w21_mips64, gcc_dwarf_w21_mips64, LLDB_INVALID_REGNUM, gdb_w21_mips64), + DEFINE_MSA (w22, NULL, gcc_dwarf_w22_mips64, gcc_dwarf_w22_mips64, LLDB_INVALID_REGNUM, gdb_w22_mips64), + DEFINE_MSA (w23, NULL, gcc_dwarf_w23_mips64, gcc_dwarf_w23_mips64, LLDB_INVALID_REGNUM, gdb_w23_mips64), + DEFINE_MSA (w24, NULL, gcc_dwarf_w24_mips64, gcc_dwarf_w24_mips64, LLDB_INVALID_REGNUM, gdb_w24_mips64), + DEFINE_MSA (w25, NULL, gcc_dwarf_w25_mips64, gcc_dwarf_w25_mips64, LLDB_INVALID_REGNUM, gdb_w25_mips64), + DEFINE_MSA (w26, NULL, gcc_dwarf_w26_mips64, gcc_dwarf_w26_mips64, LLDB_INVALID_REGNUM, gdb_w26_mips64), + DEFINE_MSA (w27, NULL, gcc_dwarf_w27_mips64, gcc_dwarf_w27_mips64, LLDB_INVALID_REGNUM, gdb_w27_mips64), + DEFINE_MSA (w28, NULL, gcc_dwarf_w28_mips64, gcc_dwarf_w28_mips64, LLDB_INVALID_REGNUM, gdb_w28_mips64), + DEFINE_MSA (w29, NULL, gcc_dwarf_w29_mips64, gcc_dwarf_w29_mips64, LLDB_INVALID_REGNUM, gdb_w29_mips64), + DEFINE_MSA (w30, NULL, gcc_dwarf_w30_mips64, gcc_dwarf_w30_mips64, LLDB_INVALID_REGNUM, gdb_w30_mips64), + DEFINE_MSA (w31, NULL, gcc_dwarf_w31_mips64, gcc_dwarf_w31_mips64, LLDB_INVALID_REGNUM, gdb_w31_mips64), + DEFINE_MSA_INFO (mcsr, NULL, gcc_dwarf_mcsr_mips64, gcc_dwarf_mcsr_mips64, LLDB_INVALID_REGNUM, gdb_mcsr_mips64), + DEFINE_MSA_INFO (mir, NULL, gcc_dwarf_mir_mips64, gcc_dwarf_mir_mips64, LLDB_INVALID_REGNUM, gdb_mir_mips64), + DEFINE_MSA_INFO (fcsr, NULL, gcc_dwarf_fcsr_mips64, gcc_dwarf_fcsr_mips64, LLDB_INVALID_REGNUM, gdb_fcsr_mips64), + DEFINE_MSA_INFO (fir, NULL, gcc_dwarf_fir_mips64, gcc_dwarf_fir_mips64, LLDB_INVALID_REGNUM, gdb_fir_mips64), + DEFINE_MSA_INFO (config5, NULL, gcc_dwarf_config5_mips64, gcc_dwarf_config5_mips64, LLDB_INVALID_REGNUM, gdb_config5_mips64) +#endif }; + static_assert((sizeof(g_register_infos_mips64) / sizeof(g_register_infos_mips64[0])) == k_num_registers_mips64, "g_register_infos_mips64 has wrong number of register infos"); #undef DEFINE_GPR +#undef DEFINE_GPR_INFO #undef DEFINE_FPR +#undef DEFINE_MSA +#undef DEFINE_MSA_INFO #undef GPR_OFFSET #undef FPR_OFFSET +#undef MSA_OFFSET #endif // DECLARE_REGISTER_INFOS_MIPS64_STRUCT Index: source/Plugins/Process/Utility/lldb-mips-freebsd-register-enums.h =================================================================== --- /dev/null +++ source/Plugins/Process/Utility/lldb-mips-freebsd-register-enums.h @@ -0,0 +1,70 @@ +//===-- lldb-mips-frebsd-register-enums.h -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_mips_freebsd_register_enums_h +#define lldb_mips_freebsd_register_enums_h + +namespace lldb_private +{ + // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) + + //--------------------------------------------------------------------------- + // Internal codes for all mips registers. + //--------------------------------------------------------------------------- + enum + { + k_first_gpr_mips64, + gpr_zero_mips64 = k_first_gpr_mips64, + gpr_r1_mips64, + gpr_r2_mips64, + gpr_r3_mips64, + gpr_r4_mips64, + gpr_r5_mips64, + gpr_r6_mips64, + gpr_r7_mips64, + gpr_r8_mips64, + gpr_r9_mips64, + gpr_r10_mips64, + gpr_r11_mips64, + gpr_r12_mips64, + gpr_r13_mips64, + gpr_r14_mips64, + gpr_r15_mips64, + gpr_r16_mips64, + gpr_r17_mips64, + gpr_r18_mips64, + gpr_r19_mips64, + gpr_r20_mips64, + gpr_r21_mips64, + gpr_r22_mips64, + gpr_r23_mips64, + gpr_r24_mips64, + gpr_r25_mips64, + gpr_r26_mips64, + gpr_r27_mips64, + gpr_gp_mips64, + gpr_sp_mips64, + gpr_r30_mips64, + gpr_ra_mips64, + gpr_sr_mips64, + gpr_mullo_mips64, + gpr_mulhi_mips64, + gpr_badvaddr_mips64, + gpr_cause_mips64, + gpr_pc_mips64, + gpr_ic_mips64, + gpr_dummy_mips64, + k_last_gpr_mips64 = gpr_dummy_mips64, + + k_num_registers_mips64, + + k_num_gpr_registers_mips64 = k_last_gpr_mips64 - k_first_gpr_mips64 + 1 + }; +} +#endif // #ifndef lldb_mips_freebsd_register_enums_h Index: source/Plugins/Process/Utility/lldb-mips-linux-register-enums.h =================================================================== --- /dev/null +++ source/Plugins/Process/Utility/lldb-mips-linux-register-enums.h @@ -0,0 +1,285 @@ +//===-- lldb-mips-linux-register-enums.h -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_mips_linux_register_enums_h +#define lldb_mips_linux_register_enums_h + +namespace lldb_private +{ + // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) + + //--------------------------------------------------------------------------- + // Internal codes for all mips registers. + //--------------------------------------------------------------------------- + enum + { + k_first_gpr_mips, + gpr_zero_mips = k_first_gpr_mips, + gpr_r1_mips, + gpr_r2_mips, + gpr_r3_mips, + gpr_r4_mips, + gpr_r5_mips, + gpr_r6_mips, + gpr_r7_mips, + gpr_r8_mips, + gpr_r9_mips, + gpr_r10_mips, + gpr_r11_mips, + gpr_r12_mips, + gpr_r13_mips, + gpr_r14_mips, + gpr_r15_mips, + gpr_r16_mips, + gpr_r17_mips, + gpr_r18_mips, + gpr_r19_mips, + gpr_r20_mips, + gpr_r21_mips, + gpr_r22_mips, + gpr_r23_mips, + gpr_r24_mips, + gpr_r25_mips, + gpr_r26_mips, + gpr_r27_mips, + gpr_gp_mips, + gpr_sp_mips, + gpr_r30_mips, + gpr_ra_mips, + gpr_sr_mips, + gpr_mullo_mips, + gpr_mulhi_mips, + gpr_badvaddr_mips, + gpr_cause_mips, + gpr_pc_mips, + gpr_config5_mips, + + k_last_gpr_mips = gpr_config5_mips, + + k_first_fpr_mips, + fpr_f0_mips = k_first_fpr_mips, + fpr_f1_mips, + fpr_f2_mips, + fpr_f3_mips, + fpr_f4_mips, + fpr_f5_mips, + fpr_f6_mips, + fpr_f7_mips, + fpr_f8_mips, + fpr_f9_mips, + fpr_f10_mips, + fpr_f11_mips, + fpr_f12_mips, + fpr_f13_mips, + fpr_f14_mips, + fpr_f15_mips, + fpr_f16_mips, + fpr_f17_mips, + fpr_f18_mips, + fpr_f19_mips, + fpr_f20_mips, + fpr_f21_mips, + fpr_f22_mips, + fpr_f23_mips, + fpr_f24_mips, + fpr_f25_mips, + fpr_f26_mips, + fpr_f27_mips, + fpr_f28_mips, + fpr_f29_mips, + fpr_f30_mips, + fpr_f31_mips, + fpr_fcsr_mips, + fpr_fir_mips, + fpr_config5_mips, + k_last_fpr_mips = fpr_config5_mips, + + k_first_msa_mips, + msa_w0_mips = k_first_msa_mips, + msa_w1_mips, + msa_w2_mips, + msa_w3_mips, + msa_w4_mips, + msa_w5_mips, + msa_w6_mips, + msa_w7_mips, + msa_w8_mips, + msa_w9_mips, + msa_w10_mips, + msa_w11_mips, + msa_w12_mips, + msa_w13_mips, + msa_w14_mips, + msa_w15_mips, + msa_w16_mips, + msa_w17_mips, + msa_w18_mips, + msa_w19_mips, + msa_w20_mips, + msa_w21_mips, + msa_w22_mips, + msa_w23_mips, + msa_w24_mips, + msa_w25_mips, + msa_w26_mips, + msa_w27_mips, + msa_w28_mips, + msa_w29_mips, + msa_w30_mips, + msa_w31_mips, + msa_fcsr_mips, + msa_fir_mips, + msa_mcsr_mips, + msa_mir_mips, + msa_config5_mips, + k_last_msa_mips = msa_config5_mips, + + k_num_registers_mips, + + k_num_gpr_registers_mips = k_last_gpr_mips - k_first_gpr_mips + 1, + k_num_fpr_registers_mips = k_last_fpr_mips - k_first_fpr_mips + 1, + k_num_msa_registers_mips = k_last_msa_mips - k_first_msa_mips + 1, + k_num_user_registers_mips = k_num_gpr_registers_mips + k_num_fpr_registers_mips + k_num_msa_registers_mips + }; + + //--------------------------------------------------------------------------- + // Internal codes for all mips64 registers. + //--------------------------------------------------------------------------- + enum + { + k_first_gpr_mips64, + gpr_zero_mips64 = k_first_gpr_mips64, + gpr_r1_mips64, + gpr_r2_mips64, + gpr_r3_mips64, + gpr_r4_mips64, + gpr_r5_mips64, + gpr_r6_mips64, + gpr_r7_mips64, + gpr_r8_mips64, + gpr_r9_mips64, + gpr_r10_mips64, + gpr_r11_mips64, + gpr_r12_mips64, + gpr_r13_mips64, + gpr_r14_mips64, + gpr_r15_mips64, + gpr_r16_mips64, + gpr_r17_mips64, + gpr_r18_mips64, + gpr_r19_mips64, + gpr_r20_mips64, + gpr_r21_mips64, + gpr_r22_mips64, + gpr_r23_mips64, + gpr_r24_mips64, + gpr_r25_mips64, + gpr_r26_mips64, + gpr_r27_mips64, + gpr_gp_mips64, + gpr_sp_mips64, + gpr_r30_mips64, + gpr_ra_mips64, + gpr_sr_mips64, + gpr_mullo_mips64, + gpr_mulhi_mips64, + gpr_badvaddr_mips64, + gpr_cause_mips64, + gpr_pc_mips64, + gpr_config5_mips64, + k_last_gpr_mips64 = gpr_config5_mips64, + + k_first_fpr_mips64, + fpr_f0_mips64 = k_first_fpr_mips64, + fpr_f1_mips64, + fpr_f2_mips64, + fpr_f3_mips64, + fpr_f4_mips64, + fpr_f5_mips64, + fpr_f6_mips64, + fpr_f7_mips64, + fpr_f8_mips64, + fpr_f9_mips64, + fpr_f10_mips64, + fpr_f11_mips64, + fpr_f12_mips64, + fpr_f13_mips64, + fpr_f14_mips64, + fpr_f15_mips64, + fpr_f16_mips64, + fpr_f17_mips64, + fpr_f18_mips64, + fpr_f19_mips64, + fpr_f20_mips64, + fpr_f21_mips64, + fpr_f22_mips64, + fpr_f23_mips64, + fpr_f24_mips64, + fpr_f25_mips64, + fpr_f26_mips64, + fpr_f27_mips64, + fpr_f28_mips64, + fpr_f29_mips64, + fpr_f30_mips64, + fpr_f31_mips64, + fpr_fcsr_mips64, + fpr_fir_mips64, + fpr_config5_mips64, + k_last_fpr_mips64 = fpr_config5_mips64, + + k_first_msa_mips64, + msa_w0_mips64 = k_first_msa_mips64, + msa_w1_mips64, + msa_w2_mips64, + msa_w3_mips64, + msa_w4_mips64, + msa_w5_mips64, + msa_w6_mips64, + msa_w7_mips64, + msa_w8_mips64, + msa_w9_mips64, + msa_w10_mips64, + msa_w11_mips64, + msa_w12_mips64, + msa_w13_mips64, + msa_w14_mips64, + msa_w15_mips64, + msa_w16_mips64, + msa_w17_mips64, + msa_w18_mips64, + msa_w19_mips64, + msa_w20_mips64, + msa_w21_mips64, + msa_w22_mips64, + msa_w23_mips64, + msa_w24_mips64, + msa_w25_mips64, + msa_w26_mips64, + msa_w27_mips64, + msa_w28_mips64, + msa_w29_mips64, + msa_w30_mips64, + msa_w31_mips64, + msa_fcsr_mips64, + msa_fir_mips64, + msa_mcsr_mips64, + msa_mir_mips64, + msa_config5_mips64, + k_last_msa_mips64 = msa_config5_mips64, + + k_num_registers_mips64, + + k_num_gpr_registers_mips64 = k_last_gpr_mips64 - k_first_gpr_mips64 + 1, + k_num_fpr_registers_mips64 = k_last_fpr_mips64 - k_first_fpr_mips64 + 1, + k_num_msa_registers_mips64 = k_last_msa_mips64 - k_first_msa_mips64 + 1, + k_num_user_registers_mips64 = k_num_gpr_registers_mips64 + k_num_fpr_registers_mips64 + k_num_msa_registers_mips64 + }; +} + +#endif // #ifndef lldb_mips_linux_register_enums_h Index: source/Plugins/Process/Utility/lldb-mips64-register-enums.h =================================================================== --- source/Plugins/Process/Utility/lldb-mips64-register-enums.h +++ /dev/null @@ -1,199 +0,0 @@ -//===-- lldb-mips64-register-enums.h -------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_mips64_register_enums_h -#define lldb_mips64_register_enums_h - -namespace lldb_private -{ - // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) - - //--------------------------------------------------------------------------- - // Internal codes for all mips registers. - //--------------------------------------------------------------------------- - enum - { - k_first_gpr_mips, - gpr_zero_mips = k_first_gpr_mips, - gpr_r1_mips, - gpr_r2_mips, - gpr_r3_mips, - gpr_r4_mips, - gpr_r5_mips, - gpr_r6_mips, - gpr_r7_mips, - gpr_r8_mips, - gpr_r9_mips, - gpr_r10_mips, - gpr_r11_mips, - gpr_r12_mips, - gpr_r13_mips, - gpr_r14_mips, - gpr_r15_mips, - gpr_r16_mips, - gpr_r17_mips, - gpr_r18_mips, - gpr_r19_mips, - gpr_r20_mips, - gpr_r21_mips, - gpr_r22_mips, - gpr_r23_mips, - gpr_r24_mips, - gpr_r25_mips, - gpr_r26_mips, - gpr_r27_mips, - gpr_gp_mips, - gpr_sp_mips, - gpr_r30_mips, - gpr_ra_mips, - gpr_mullo_mips, - gpr_mulhi_mips, - gpr_pc_mips, - gpr_badvaddr_mips, - gpr_sr_mips, - gpr_cause_mips, - - k_last_gpr_mips = gpr_cause_mips, - - k_first_fpr_mips, - fpr_f0_mips = k_first_fpr_mips, - fpr_f1_mips, - fpr_f2_mips, - fpr_f3_mips, - fpr_f4_mips, - fpr_f5_mips, - fpr_f6_mips, - fpr_f7_mips, - fpr_f8_mips, - fpr_f9_mips, - fpr_f10_mips, - fpr_f11_mips, - fpr_f12_mips, - fpr_f13_mips, - fpr_f14_mips, - fpr_f15_mips, - fpr_f16_mips, - fpr_f17_mips, - fpr_f18_mips, - fpr_f19_mips, - fpr_f20_mips, - fpr_f21_mips, - fpr_f22_mips, - fpr_f23_mips, - fpr_f24_mips, - fpr_f25_mips, - fpr_f26_mips, - fpr_f27_mips, - fpr_f28_mips, - fpr_f29_mips, - fpr_f30_mips, - fpr_f31_mips, - fpr_fcsr_mips, - fpr_fir_mips, - k_last_fpr_mips = fpr_fir_mips, - - k_num_registers_mips, - k_num_gpr_registers_mips = k_last_gpr_mips - k_first_gpr_mips + 1, - k_num_fpr_registers_mips = k_last_fpr_mips - k_first_fpr_mips + 1, - k_num_user_registers_mips = k_num_gpr_registers_mips + k_num_fpr_registers_mips, - }; - - //--------------------------------------------------------------------------- - // Internal codes for all mips64 registers. - //--------------------------------------------------------------------------- - enum - { - k_first_gpr_mips64, - gpr_zero_mips64 = k_first_gpr_mips64, - gpr_r1_mips64, - gpr_r2_mips64, - gpr_r3_mips64, - gpr_r4_mips64, - gpr_r5_mips64, - gpr_r6_mips64, - gpr_r7_mips64, - gpr_r8_mips64, - gpr_r9_mips64, - gpr_r10_mips64, - gpr_r11_mips64, - gpr_r12_mips64, - gpr_r13_mips64, - gpr_r14_mips64, - gpr_r15_mips64, - gpr_r16_mips64, - gpr_r17_mips64, - gpr_r18_mips64, - gpr_r19_mips64, - gpr_r20_mips64, - gpr_r21_mips64, - gpr_r22_mips64, - gpr_r23_mips64, - gpr_r24_mips64, - gpr_r25_mips64, - gpr_r26_mips64, - gpr_r27_mips64, - gpr_gp_mips64, - gpr_sp_mips64, - gpr_r30_mips64, - gpr_ra_mips64, - gpr_mullo_mips64, - gpr_mulhi_mips64, - gpr_pc_mips64, - gpr_badvaddr_mips64, - gpr_sr_mips64, - gpr_cause_mips64, - gpr_ic_mips64, - gpr_dummy_mips64, - - k_last_gpr_mips64 = gpr_dummy_mips64, - - k_first_fpr_mips64, - fpr_f0_mips64 = k_first_fpr_mips64, - fpr_f1_mips64, - fpr_f2_mips64, - fpr_f3_mips64, - fpr_f4_mips64, - fpr_f5_mips64, - fpr_f6_mips64, - fpr_f7_mips64, - fpr_f8_mips64, - fpr_f9_mips64, - fpr_f10_mips64, - fpr_f11_mips64, - fpr_f12_mips64, - fpr_f13_mips64, - fpr_f14_mips64, - fpr_f15_mips64, - fpr_f16_mips64, - fpr_f17_mips64, - fpr_f18_mips64, - fpr_f19_mips64, - fpr_f20_mips64, - fpr_f21_mips64, - fpr_f22_mips64, - fpr_f23_mips64, - fpr_f24_mips64, - fpr_f25_mips64, - fpr_f26_mips64, - fpr_f27_mips64, - fpr_f28_mips64, - fpr_f29_mips64, - fpr_f30_mips64, - fpr_f31_mips64, - fpr_fcsr_mips64, - fpr_fir_mips64, - k_last_fpr_mips64 = fpr_fir_mips64, - - k_num_registers_mips64, - k_num_gpr_registers_mips64 = k_last_gpr_mips64 - k_first_gpr_mips64 + 1, - k_num_fpr_registers_mips64 = k_last_fpr_mips64 - k_first_fpr_mips64 + 1, - }; -} - -#endif // #ifndef fpr_mips64_register_enums_h