<div dir="ltr">Hi Sagar,<div><br></div><div>I don't really happy with merging a big change to the release branch at the last moment (after RC3) especially as this commit caused several issues in the past and I don't think we tested it extensively enough to be sure it is works as intended at the moment.</div><div><br></div><div>Is there any reason you really want this change in LLDB 3.7 considering that we won't create a binary with the release as far as I know?</div><div><br></div><div>Thanks,</div><div>Tamas</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 21, 2015 at 10:20 AM via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Hans,<br>
<br>
Could you please merge r245547 to the release branch ?<br>
<br>
Thanks,<br>
Sagar<br>
<br>
On Thursday 20 August 2015 02:42 PM, Sagar Thakur via lldb-commits wrote:<br>
> Author: slthakur<br>
> Date: Thu Aug 20 04:12:46 2015<br>
> New Revision: 245547<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=245547&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=245547&view=rev</a><br>
> Log:<br>
> [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue<br>
><br>
> Eliminated ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp and use llvm::APInt and llvm::APFloat for all integer and floating point types. Also used Scalar in RegisterValue.cpp<br>
><br>
> Reviewers: tberghammer, ovyalov, clayborg, labath<br>
> Subscribers: lldb-commits, nitesh.jain, jaydeep<br>
> Differential: <a href="http://reviews.llvm.org/D12100" rel="noreferrer" target="_blank">http://reviews.llvm.org/D12100</a><br>
><br>
> Modified:<br>
> lldb/trunk/include/lldb/Core/RegisterValue.h<br>
> lldb/trunk/include/lldb/Core/Scalar.h<br>
> lldb/trunk/include/lldb/Core/Value.h<br>
> lldb/trunk/include/lldb/lldb-private-types.h<br>
> lldb/trunk/source/Core/RegisterValue.cpp<br>
> lldb/trunk/source/Core/Scalar.cpp<br>
> lldb/trunk/source/Core/ValueObject.cpp<br>
><br>
> Modified: lldb/trunk/include/lldb/Core/RegisterValue.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RegisterValue.h?rev=245547&r1=245546&r2=245547&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RegisterValue.h?rev=245547&r1=245546&r2=245547&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/Core/RegisterValue.h (original)<br>
> +++ lldb/trunk/include/lldb/Core/RegisterValue.h Thu Aug 20 04:12:46 2015<br>
> @@ -19,8 +19,9 @@<br>
> #include "lldb/lldb-public.h"<br>
> #include "lldb/lldb-private.h"<br>
> #include "lldb/Host/Endian.h"<br>
> +#include "llvm/ADT/APInt.h"<br>
> +#include "lldb/Core/Scalar.h"<br>
><br>
> -//#define ENABLE_128_BIT_SUPPORT 1<br>
> namespace lldb_private {<br>
><br>
> class RegisterValue<br>
> @@ -37,9 +38,7 @@ namespace lldb_private {<br>
> eTypeUInt16,<br>
> eTypeUInt32,<br>
> eTypeUInt64,<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> eTypeUInt128,<br>
> -#endif<br>
> eTypeFloat,<br>
> eTypeDouble,<br>
> eTypeLongDouble,<br>
> @@ -47,7 +46,8 @@ namespace lldb_private {<br>
> };<br>
><br>
> RegisterValue () :<br>
> - m_type (eTypeInvalid)<br>
> + m_type (eTypeInvalid),<br>
> + m_scalar ((unsigned long)0)<br>
> {<br>
> }<br>
><br>
> @@ -55,57 +55,55 @@ namespace lldb_private {<br>
> RegisterValue (uint8_t inst) :<br>
> m_type (eTypeUInt8)<br>
> {<br>
> - m_data.uint8 = inst;<br>
> + m_scalar = inst;<br>
> }<br>
><br>
> explicit<br>
> RegisterValue (uint16_t inst) :<br>
> m_type (eTypeUInt16)<br>
> {<br>
> - m_data.uint16 = inst;<br>
> + m_scalar = inst;<br>
> }<br>
><br>
> explicit<br>
> RegisterValue (uint32_t inst) :<br>
> m_type (eTypeUInt32)<br>
> {<br>
> - m_data.uint32 = inst;<br>
> + m_scalar = inst;<br>
> }<br>
><br>
> explicit<br>
> RegisterValue (uint64_t inst) :<br>
> m_type (eTypeUInt64)<br>
> {<br>
> - m_data.uint64 = inst;<br>
> + m_scalar = inst;<br>
> }<br>
><br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> explicit<br>
> - RegisterValue (__uint128_t inst) :<br>
> + RegisterValue (llvm::APInt inst) :<br>
> m_type (eTypeUInt128)<br>
> {<br>
> - m_data.uint128 = inst;<br>
> + m_scalar = llvm::APInt(inst);<br>
> }<br>
> -#endif<br>
> explicit<br>
> RegisterValue (float value) :<br>
> m_type (eTypeFloat)<br>
> {<br>
> - m_data.ieee_float = value;<br>
> + m_scalar = value;<br>
> }<br>
><br>
> explicit<br>
> RegisterValue (double value) :<br>
> m_type (eTypeDouble)<br>
> {<br>
> - m_data.ieee_double = value;<br>
> + m_scalar = value;<br>
> }<br>
><br>
> explicit<br>
> RegisterValue (long double value) :<br>
> m_type (eTypeLongDouble)<br>
> {<br>
> - m_data.ieee_long_double = value;<br>
> + m_scalar = value;<br>
> }<br>
><br>
> explicit<br>
> @@ -167,7 +165,7 @@ namespace lldb_private {<br>
> {<br>
> if (success_ptr)<br>
> *success_ptr = true;<br>
> - return m_data.uint8;<br>
> + return m_scalar.UChar(fail_value);<br>
> }<br>
> if (success_ptr)<br>
> *success_ptr = true;<br>
> @@ -183,10 +181,8 @@ namespace lldb_private {<br>
> uint64_t<br>
> GetAsUInt64 (uint64_t fail_value = UINT64_MAX, bool *success_ptr = NULL) const;<br>
><br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - __uint128_t<br>
> - GetAsUInt128 (__uint128_t fail_value = ~((__uint128_t)0), bool *success_ptr = NULL) const;<br>
> -#endif<br>
> + llvm::APInt<br>
> + GetAsUInt128 (const llvm::APInt& fail_value, bool *success_ptr = NULL) const;<br>
><br>
> float<br>
> GetAsFloat (float fail_value = 0.0f, bool *success_ptr = NULL) const;<br>
> @@ -219,95 +215,92 @@ namespace lldb_private {<br>
> operator = (uint8_t uint)<br>
> {<br>
> m_type = eTypeUInt8;<br>
> - m_data.uint8 = uint;<br>
> + m_scalar = uint;<br>
> }<br>
><br>
> void<br>
> operator = (uint16_t uint)<br>
> {<br>
> m_type = eTypeUInt16;<br>
> - m_data.uint16 = uint;<br>
> + m_scalar = uint;<br>
> }<br>
><br>
> void<br>
> operator = (uint32_t uint)<br>
> {<br>
> m_type = eTypeUInt32;<br>
> - m_data.uint32 = uint;<br>
> + m_scalar = uint;<br>
> }<br>
><br>
> void<br>
> operator = (uint64_t uint)<br>
> {<br>
> m_type = eTypeUInt64;<br>
> - m_data.uint64 = uint;<br>
> + m_scalar = uint;<br>
> }<br>
><br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> void<br>
> - operator = (__uint128_t uint)<br>
> + operator = (llvm::APInt uint)<br>
> {<br>
> m_type = eTypeUInt128;<br>
> - m_data.uint128 = uint;<br>
> + m_scalar = llvm::APInt(uint);<br>
> }<br>
> -#endif<br>
> +<br>
> void<br>
> operator = (float f)<br>
> {<br>
> m_type = eTypeFloat;<br>
> - m_data.ieee_float = f;<br>
> + m_scalar = f;<br>
> }<br>
><br>
> void<br>
> operator = (double f)<br>
> {<br>
> m_type = eTypeDouble;<br>
> - m_data.ieee_double = f;<br>
> + m_scalar = f;<br>
> }<br>
><br>
> void<br>
> operator = (long double f)<br>
> {<br>
> m_type = eTypeLongDouble;<br>
> - m_data.ieee_long_double = f;<br>
> + m_scalar = f;<br>
> }<br>
><br>
> void<br>
> SetUInt8 (uint8_t uint)<br>
> {<br>
> m_type = eTypeUInt8;<br>
> - m_data.uint8 = uint;<br>
> + m_scalar = uint;<br>
> }<br>
><br>
> void<br>
> SetUInt16 (uint16_t uint)<br>
> {<br>
> m_type = eTypeUInt16;<br>
> - m_data.uint16 = uint;<br>
> + m_scalar = uint;<br>
> }<br>
><br>
> void<br>
> SetUInt32 (uint32_t uint, Type t = eTypeUInt32)<br>
> {<br>
> m_type = t;<br>
> - m_data.uint32 = uint;<br>
> + m_scalar = uint;<br>
> }<br>
><br>
> void<br>
> SetUInt64 (uint64_t uint, Type t = eTypeUInt64)<br>
> {<br>
> m_type = t;<br>
> - m_data.uint64 = uint;<br>
> + m_scalar = uint;<br>
> }<br>
><br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> void<br>
> - SetUInt128 (__uint128_t uint)<br>
> + SetUInt128 (llvm::APInt uint)<br>
> {<br>
> m_type = eTypeUInt128;<br>
> - m_data.uint128 = uint;<br>
> + m_scalar = llvm::APInt(uint);<br>
> }<br>
> -#endif<br>
> bool<br>
> SetUInt (uint64_t uint, uint32_t byte_size);<br>
><br>
> @@ -315,21 +308,21 @@ namespace lldb_private {<br>
> SetFloat (float f)<br>
> {<br>
> m_type = eTypeFloat;<br>
> - m_data.ieee_float = f;<br>
> + m_scalar = f;<br>
> }<br>
><br>
> void<br>
> SetDouble (double f)<br>
> {<br>
> m_type = eTypeDouble;<br>
> - m_data.ieee_double = f;<br>
> + m_scalar = f;<br>
> }<br>
><br>
> void<br>
> SetLongDouble (long double f)<br>
> {<br>
> m_type = eTypeLongDouble;<br>
> - m_data.ieee_long_double = f;<br>
> + m_scalar = f;<br>
> }<br>
><br>
> void<br>
> @@ -367,7 +360,7 @@ namespace lldb_private {<br>
> GetByteOrder () const<br>
> {<br>
> if (m_type == eTypeBytes)<br>
> - return m_data.buffer.byte_order;<br>
> + return buffer.byte_order;<br>
> return lldb::endian::InlHostByteOrder();<br>
> }<br>
><br>
> @@ -386,25 +379,13 @@ namespace lldb_private {<br>
> protected:<br>
><br>
> RegisterValue::Type m_type;<br>
> - union<br>
> + Scalar m_scalar;<br>
> + struct<br>
> {<br>
> - uint8_t uint8;<br>
> - uint16_t uint16;<br>
> - uint32_t uint32;<br>
> - uint64_t uint64;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - __uint128_t uint128;<br>
> -#endif<br>
> - float ieee_float;<br>
> - double ieee_double;<br>
> - long double ieee_long_double;<br>
> - struct<br>
> - {<br>
> - uint8_t bytes[kMaxRegisterByteSize]; // This must be big enough to hold any register for any supported target.<br>
> - uint8_t length;<br>
> - lldb::ByteOrder byte_order;<br>
> - } buffer;<br>
> - } m_data;<br>
> + uint8_t bytes[kMaxRegisterByteSize]; // This must be big enough to hold any register for any supported target.<br>
> + uint8_t length;<br>
> + lldb::ByteOrder byte_order;<br>
> + } buffer;<br>
> };<br>
><br>
> } // namespace lldb_private<br>
><br>
> Modified: lldb/trunk/include/lldb/Core/Scalar.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Scalar.h?rev=245547&r1=245546&r2=245547&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Scalar.h?rev=245547&r1=245546&r2=245547&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/Core/Scalar.h (original)<br>
> +++ lldb/trunk/include/lldb/Core/Scalar.h Thu Aug 20 04:12:46 2015<br>
> @@ -11,6 +11,11 @@<br>
> #define liblldb_Scalar_h_<br>
><br>
> #include "lldb/lldb-private.h"<br>
> +#include "llvm/ADT/APInt.h"<br>
> +#include "llvm/ADT/APFloat.h"<br>
> +<br>
> +#define NUM_OF_WORDS_INT128 2<br>
> +#define BITWIDTH_INT128 128<br>
><br>
> namespace lldb_private {<br>
><br>
> @@ -34,22 +39,60 @@ public:<br>
> e_ulonglong,<br>
> e_float,<br>
> e_double,<br>
> - e_long_double<br>
> + e_long_double,<br>
> + e_uint128,<br>
> + e_sint128<br>
> };<br>
><br>
> //------------------------------------------------------------------<br>
> // Constructors and Destructors<br>
> //------------------------------------------------------------------<br>
> Scalar();<br>
> - Scalar(int v) : m_type(e_sint), m_data() { m_data.sint = v; }<br>
> - Scalar(unsigned int v) : m_type(e_uint), m_data() { m_data.uint = v; }<br>
> - Scalar(long v) : m_type(e_slong), m_data() { m_data.slong = v; }<br>
> - Scalar(unsigned long v) : m_type(e_ulong), m_data() { m_data.ulong = v; }<br>
> - Scalar(long long v) : m_type(e_slonglong), m_data() { m_data.slonglong = v; }<br>
> - Scalar(unsigned long long v): m_type(e_ulonglong), m_data() { m_data.ulonglong = v; }<br>
> - Scalar(float v) : m_type(e_float), m_data() { m_data.flt = v; }<br>
> - Scalar(double v) : m_type(e_double), m_data() { m_data.dbl = v; }<br>
> - Scalar(long double v) : m_type(e_long_double), m_data() { m_data.ldbl = v; }<br>
> + Scalar(int v) : m_type(e_sint), m_float((float)0) { m_integer = llvm::APInt(sizeof(int) * 8, v, true);}<br>
> + Scalar(unsigned int v) : m_type(e_uint), m_float((float)0) { m_integer = llvm::APInt(sizeof(int) * 8, v);}<br>
> + Scalar(long v) : m_type(e_slong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long) * 8, v, true);}<br>
> + Scalar(unsigned long v) : m_type(e_ulong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long) * 8, v);}<br>
> + Scalar(long long v) : m_type(e_slonglong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long long) * 8, v, true);}<br>
> + Scalar(unsigned long long v): m_type(e_ulonglong), m_float((float)0) { m_integer = llvm::APInt(sizeof(long long) * 8, v);}<br>
> + Scalar(float v) : m_type(e_float), m_float(v) { m_float = llvm::APFloat(v); }<br>
> + Scalar(double v) : m_type(e_double), m_float(v) { m_float = llvm::APFloat(v); }<br>
> + Scalar(long double v, bool ieee_quad)<br>
> + : m_type(e_long_double), m_float((float)0), m_ieee_quad(ieee_quad)<br>
> + {<br>
> + if(ieee_quad)<br>
> + m_float = llvm::APFloat(llvm::APFloat::IEEEquad, llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, ((type128 *)&v)->x));<br>
> + else<br>
> + m_float = llvm::APFloat(llvm::APFloat::x87DoubleExtended, llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, ((type128 *)&v)->x));<br>
> + }<br>
> + Scalar(llvm::APInt v) :<br>
> + m_type(),<br>
> + m_float((float)0)<br>
> + {<br>
> + m_integer = llvm::APInt(v);<br>
> + switch(m_integer.getBitWidth())<br>
> + {<br>
> + case 8:<br>
> + case 16:<br>
> + case 32:<br>
> + if(m_integer.isSignedIntN(sizeof(sint_t) * 8))<br>
> + m_type = e_sint;<br>
> + else<br>
> + m_type = e_uint;<br>
> + break;<br>
> + case 64:<br>
> + if(m_integer.isSignedIntN(sizeof(slonglong_t) * 8))<br>
> + m_type = e_slonglong;<br>
> + else<br>
> + m_type = e_ulonglong;<br>
> + break;<br>
> + case 128:<br>
> + if(m_integer.isSignedIntN(BITWIDTH_INT128))<br>
> + m_type = e_sint128;<br>
> + else<br>
> + m_type = e_uint128;<br>
> + break;<br>
> + }<br>
> + }<br>
> Scalar(const Scalar& rhs);<br>
> //Scalar(const RegisterValue& reg_value);<br>
> virtual ~Scalar();<br>
> @@ -61,15 +104,18 @@ public:<br>
> ExtractBitfield (uint32_t bit_size,<br>
> uint32_t bit_offset);<br>
><br>
> + bool<br>
> + SetBit(uint32_t bit);<br>
> +<br>
> + bool<br>
> + ClearBit(uint32_t bit);<br>
> +<br>
> + void *<br>
> + GetBytes() const;<br>
> +<br>
> size_t<br>
> GetByteSize() const;<br>
><br>
> - static size_t<br>
> - GetMaxByteSize()<br>
> - {<br>
> - return sizeof(ValueData);<br>
> - }<br>
> -<br>
> bool<br>
> GetData (DataExtractor &data, size_t limit_byte_size = UINT32_MAX) const;<br>
><br>
> @@ -83,7 +129,7 @@ public:<br>
> IsZero() const;<br>
><br>
> void<br>
> - Clear() { m_type = e_void; m_data.ulonglong = 0; }<br>
> + Clear() { m_type = e_void; m_integer.clearAllBits(); }<br>
><br>
> const char *<br>
> GetTypeAsCString() const;<br>
> @@ -133,6 +179,7 @@ public:<br>
> Scalar& operator= (float v);<br>
> Scalar& operator= (double v);<br>
> Scalar& operator= (long double v);<br>
> + Scalar& operator= (llvm::APInt v);<br>
> Scalar& operator= (const Scalar& rhs); // Assignment operator<br>
> Scalar& operator+= (const Scalar& rhs);<br>
> Scalar& operator<<= (const Scalar& rhs); // Shift left<br>
> @@ -174,6 +221,9 @@ public:<br>
> Scalar::Type<br>
> GetType() const { return m_type; }<br>
><br>
> + void<br>
> + SetType(const RegisterInfo*);<br>
> +<br>
> //----------------------------------------------------------------------<br>
> // Returns a casted value of the current contained data without<br>
> // modifying the current value. FAIL_VALUE will be returned if the type<br>
> @@ -194,6 +244,18 @@ public:<br>
> unsigned long long<br>
> RawULongLong () const;<br>
><br>
> + unsigned char<br>
> + UChar(unsigned char fail_value = 0) const;<br>
> +<br>
> + char<br>
> + SChar(char fail_value = 0) const;<br>
> +<br>
> + unsigned short<br>
> + UShort(unsigned short fail_value = 0) const;<br>
> +<br>
> + short<br>
> + SShort(short fail_value = 0) const;<br>
> +<br>
> unsigned int<br>
> UInt(unsigned int fail_value = 0) const;<br>
><br>
> @@ -209,6 +271,12 @@ public:<br>
> unsigned long long<br>
> ULongLong(unsigned long long fail_value = 0) const;<br>
><br>
> + llvm::APInt<br>
> + SInt128(llvm::APInt& fail_value) const;<br>
> +<br>
> + llvm::APInt<br>
> + UInt128(const llvm::APInt& fail_value) const;<br>
> +<br>
> float<br>
> Float(float fail_value = 0.0f) const;<br>
><br>
> @@ -255,6 +323,10 @@ public:<br>
> }<br>
><br>
> protected:<br>
> + typedef char schar_t;<br>
> + typedef unsigned char uchar_t;<br>
> + typedef short sshort_t;<br>
> + typedef unsigned short ushort_t;<br>
> typedef int sint_t;<br>
> typedef unsigned int uint_t;<br>
> typedef long slong_t;<br>
> @@ -265,24 +337,13 @@ protected:<br>
> typedef double double_t;<br>
> typedef long double long_double_t;<br>
><br>
> - union ValueData<br>
> - {<br>
> - int sint;<br>
> - unsigned int uint;<br>
> - long slong;<br>
> - unsigned long ulong;<br>
> - long long slonglong;<br>
> - unsigned long long ulonglong;<br>
> - float flt;<br>
> - double dbl;<br>
> - long double ldbl;<br>
> - };<br>
> -<br>
> //------------------------------------------------------------------<br>
> // Classes that inherit from Scalar can see and modify these<br>
> //------------------------------------------------------------------<br>
> Scalar::Type m_type;<br>
> - ValueData m_data;<br>
> + llvm::APInt m_integer;<br>
> + llvm::APFloat m_float;<br>
> + bool m_ieee_quad = false;<br>
><br>
> private:<br>
> friend const Scalar operator+ (const Scalar& lhs, const Scalar& rhs);<br>
><br>
> Modified: lldb/trunk/include/lldb/Core/Value.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Value.h?rev=245547&r1=245546&r2=245547&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Value.h?rev=245547&r1=245546&r2=245547&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/Core/Value.h (original)<br>
> +++ lldb/trunk/include/lldb/Core/Value.h Thu Aug 20 04:12:46 2015<br>
> @@ -101,6 +101,7 @@ public:<br>
> // Casts a vector, if valid, to an unsigned int of matching or largest supported size.<br>
> // Truncates to the beginning of the vector if required.<br>
> // Returns a default constructed Scalar if the Vector data is internally inconsistent.<br>
> + llvm::APInt rhs = llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, ((type128 *)bytes)->x);<br>
> Scalar<br>
> GetAsScalar() const<br>
> {<br>
> @@ -111,11 +112,7 @@ public:<br>
> else if (length == 2) scalar = *(const uint16_t *)bytes;<br>
> else if (length == 4) scalar = *(const uint32_t *)bytes;<br>
> else if (length == 8) scalar = *(const uint64_t *)bytes;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - else if (length >= 16) scalar = *(const __uint128_t *)bytes;<br>
> -#else<br>
> - else if (length >= 16) scalar = *(const uint64_t *)bytes;<br>
> -#endif<br>
> + else if (length >= 16) scalar = rhs;<br>
> }<br>
> return scalar;<br>
> }<br>
><br>
> Modified: lldb/trunk/include/lldb/lldb-private-types.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-types.h?rev=245547&r1=245546&r2=245547&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-types.h?rev=245547&r1=245546&r2=245547&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/lldb-private-types.h (original)<br>
> +++ lldb/trunk/include/lldb/lldb-private-types.h Thu Aug 20 04:12:46 2015<br>
> @@ -102,6 +102,8 @@ namespace lldb_private<br>
> // pass it.<br>
> };<br>
><br>
> + typedef struct type128 { uint64_t x[2]; } type128;<br>
> +<br>
> } // namespace lldb_private<br>
><br>
> #endif // #if defined(__cplusplus)<br>
><br>
> Modified: lldb/trunk/source/Core/RegisterValue.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegisterValue.cpp?rev=245547&r1=245546&r2=245547&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegisterValue.cpp?rev=245547&r1=245546&r2=245547&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Core/RegisterValue.cpp (original)<br>
> +++ lldb/trunk/source/Core/RegisterValue.cpp Thu Aug 20 04:12:46 2015<br>
> @@ -215,10 +215,10 @@ RegisterValue::SetFromMemoryData (const<br>
> }<br>
> else if (value_type == eTypeBytes)<br>
> {<br>
> - m_data.buffer.byte_order = src_byte_order;<br>
> + buffer.byte_order = src_byte_order;<br>
> // Make sure to set the buffer length of the destination buffer to avoid<br>
> - // problems due to uninitialized variables.<br>
> - m_data.buffer.length = src_len;<br>
> + // problems due to uninitalized variables.<br>
> + buffer.length = src_len;<br>
> }<br>
><br>
> const uint32_t bytes_copied = src_data.CopyByteOrderedData (0, // src offset<br>
> @@ -240,25 +240,23 @@ RegisterValue::GetScalarValue (Scalar &s<br>
> case eTypeInvalid: break;<br>
> case eTypeBytes:<br>
> {<br>
> - switch (m_data.buffer.length)<br>
> + switch (buffer.length)<br>
> {<br>
> default: break;<br>
> - case 1: scalar = m_data.uint8; return true;<br>
> - case 2: scalar = m_data.uint16; return true;<br>
> - case 4: scalar = m_data.uint32; return true;<br>
> - case 8: scalar = m_data.uint64; return true;<br>
> + case 1: scalar = *(const uint8_t *)buffer.bytes; return true;<br>
> + case 2: scalar = *(const uint16_t *)buffer.bytes; return true;<br>
> + case 4: scalar = *(const uint32_t *)buffer.bytes; return true;<br>
> + case 8: scalar = *(const uint64_t *)buffer.bytes; return true;<br>
> }<br>
> }<br>
> - case eTypeUInt8: scalar = m_data.uint8; return true;<br>
> - case eTypeUInt16: scalar = m_data.uint16; return true;<br>
> - case eTypeUInt32: scalar = m_data.uint32; return true;<br>
> - case eTypeUInt64: scalar = m_data.uint64; return true;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - case eTypeUInt128: break;<br>
> -#endif<br>
> - case eTypeFloat: scalar = m_data.ieee_float; return true;<br>
> - case eTypeDouble: scalar = m_data.ieee_double; return true;<br>
> - case eTypeLongDouble: scalar = m_data.ieee_long_double; return true;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16:<br>
> + case eTypeUInt32:<br>
> + case eTypeUInt64:<br>
> + case eTypeUInt128:<br>
> + case eTypeFloat:<br>
> + case eTypeDouble:<br>
> + case eTypeLongDouble: scalar = m_scalar; return true;<br>
> }<br>
> return false;<br>
> }<br>
> @@ -289,10 +287,8 @@ RegisterValue::SetType (const RegisterIn<br>
> m_type = eTypeUInt32;<br>
> else if (byte_size <= 8)<br>
> m_type = eTypeUInt64;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> else if (byte_size <= 16)<br>
> m_type = eTypeUInt128;<br>
> -#endif<br>
> break;<br>
><br>
> case eEncodingIEEE754:<br>
> @@ -308,6 +304,7 @@ RegisterValue::SetType (const RegisterIn<br>
> m_type = eTypeBytes;<br>
> break;<br>
> }<br>
> + m_scalar.SetType(reg_info);<br>
> return m_type;<br>
> }<br>
><br>
> @@ -342,8 +339,9 @@ RegisterValue::SetValueFromData (const R<br>
> src_len = reg_info->byte_size;<br>
><br>
> // Zero out the value in case we get partial data...<br>
> - memset (m_data.buffer.bytes, 0, sizeof (m_data.buffer.bytes));<br>
> -<br>
> + memset (buffer.bytes, 0, sizeof (buffer.bytes));<br>
> +<br>
> + type128 int128;<br>
> switch (SetType (reg_info))<br>
> {<br>
> case eTypeInvalid:<br>
> @@ -353,33 +351,38 @@ RegisterValue::SetValueFromData (const R<br>
> case eTypeUInt16: SetUInt16 (src.GetMaxU32 (&src_offset, src_len)); break;<br>
> case eTypeUInt32: SetUInt32 (src.GetMaxU32 (&src_offset, src_len)); break;<br>
> case eTypeUInt64: SetUInt64 (src.GetMaxU64 (&src_offset, src_len)); break;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> case eTypeUInt128:<br>
> {<br>
> - __uint128_t data1 = src.GetU64 (&src_offset);<br>
> - __uint128_t data2 = src.GetU64 (&src_offset);<br>
> + uint64_t data1 = src.GetU64 (&src_offset);<br>
> + uint64_t data2 = src.GetU64 (&src_offset);<br>
> if (src.GetByteSize() == eByteOrderBig)<br>
> - SetUInt128 (data1 << 64 + data2);<br>
> + {<br>
> + int128.x[0] = data1;<br>
> + int128.x[1] = data2;<br>
> + }<br>
> else<br>
> - SetUInt128 (data2 << 64 + data1);<br>
> + {<br>
> + int128.x[0] = data2;<br>
> + int128.x[1] = data1;<br>
> + }<br>
> + SetUInt128 (llvm::APInt(128, 2, int128.x));<br>
> }<br>
> break;<br>
> -#endif<br>
> case eTypeFloat: SetFloat (src.GetFloat (&src_offset)); break;<br>
> case eTypeDouble: SetDouble(src.GetDouble (&src_offset)); break;<br>
> case eTypeLongDouble: SetFloat (src.GetLongDouble (&src_offset)); break;<br>
> case eTypeBytes:<br>
> {<br>
> - m_data.buffer.length = reg_info->byte_size;<br>
> - m_data.buffer.byte_order = src.GetByteOrder();<br>
> - assert (m_data.buffer.length <= kMaxRegisterByteSize);<br>
> - if (m_data.buffer.length > kMaxRegisterByteSize)<br>
> - m_data.buffer.length = kMaxRegisterByteSize;<br>
> + buffer.length = reg_info->byte_size;<br>
> + buffer.byte_order = src.GetByteOrder();<br>
> + assert (buffer.length <= kMaxRegisterByteSize);<br>
> + if (buffer.length > kMaxRegisterByteSize)<br>
> + buffer.length = kMaxRegisterByteSize;<br>
> if (src.CopyByteOrderedData (src_offset, // offset within "src" to start extracting data<br>
> src_len, // src length<br>
> - m_data.buffer.bytes, // dst buffer<br>
> - m_data.buffer.length, // dst length<br>
> - m_data.buffer.byte_order) == 0)// dst byte order<br>
> + buffer.bytes, // dst buffer<br>
> + buffer.length, // dst length<br>
> + buffer.byte_order) == 0)// dst byte order<br>
> {<br>
> error.SetErrorString ("data copy failed data.");<br>
> return error;<br>
> @@ -459,6 +462,9 @@ RegisterValue::SetValueFromCString (cons<br>
> }<br>
> bool success = false;<br>
> const uint32_t byte_size = reg_info->byte_size;<br>
> + static float flt_val;<br>
> + static double dbl_val;<br>
> + static long double ldbl_val;<br>
> switch (reg_info->encoding)<br>
> {<br>
> case eEncodingInvalid:<br>
> @@ -510,22 +516,31 @@ RegisterValue::SetValueFromCString (cons<br>
> case eEncodingIEEE754:<br>
> if (byte_size == sizeof (float))<br>
> {<br>
> - if (::sscanf (value_str, "%f", &m_data.ieee_float) == 1)<br>
> + if (::sscanf (value_str, "%f", &flt_val) == 1)<br>
> + {<br>
> + m_scalar = flt_val;<br>
> m_type = eTypeFloat;<br>
> + }<br>
> else<br>
> error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str);<br>
> }<br>
> else if (byte_size == sizeof (double))<br>
> {<br>
> - if (::sscanf (value_str, "%lf", &m_data.ieee_double) == 1)<br>
> + if (::sscanf (value_str, "%lf", &dbl_val) == 1)<br>
> + {<br>
> + m_scalar = dbl_val;<br>
> m_type = eTypeDouble;<br>
> + }<br>
> else<br>
> error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str);<br>
> }<br>
> else if (byte_size == sizeof (long double))<br>
> {<br>
> - if (::sscanf (value_str, "%Lf", &m_data.ieee_long_double) == 1)<br>
> + if (::sscanf (value_str, "%Lf", &ldbl_val) == 1)<br>
> + {<br>
> + m_scalar = ldbl_val;<br>
> m_type = eTypeLongDouble;<br>
> + }<br>
> else<br>
> error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str);<br>
> }<br>
> @@ -557,81 +572,11 @@ RegisterValue::SignExtend (uint32_t sign<br>
> break;<br>
><br>
> case eTypeUInt8:<br>
> - if (sign_bitpos == (8-1))<br>
> - return true;<br>
> - else if (sign_bitpos < (8-1))<br>
> - {<br>
> - uint8_t sign_bit = 1u << sign_bitpos;<br>
> - if (m_data.uint8 & sign_bit)<br>
> - {<br>
> - const uint8_t mask = ~(sign_bit) + 1u;<br>
> - m_data.uint8 |= mask;<br>
> - }<br>
> - return true;<br>
> - }<br>
> - break;<br>
> -<br>
> case eTypeUInt16:<br>
> - if (sign_bitpos == (16-1))<br>
> - return true;<br>
> - else if (sign_bitpos < (16-1))<br>
> - {<br>
> - uint16_t sign_bit = 1u << sign_bitpos;<br>
> - if (m_data.uint16 & sign_bit)<br>
> - {<br>
> - const uint16_t mask = ~(sign_bit) + 1u;<br>
> - m_data.uint16 |= mask;<br>
> - }<br>
> - return true;<br>
> - }<br>
> - break;<br>
> -<br>
> case eTypeUInt32:<br>
> - if (sign_bitpos == (32-1))<br>
> - return true;<br>
> - else if (sign_bitpos < (32-1))<br>
> - {<br>
> - uint32_t sign_bit = 1u << sign_bitpos;<br>
> - if (m_data.uint32 & sign_bit)<br>
> - {<br>
> - const uint32_t mask = ~(sign_bit) + 1u;<br>
> - m_data.uint32 |= mask;<br>
> - }<br>
> - return true;<br>
> - }<br>
> - break;<br>
> -<br>
> case eTypeUInt64:<br>
> - if (sign_bitpos == (64-1))<br>
> - return true;<br>
> - else if (sign_bitpos < (64-1))<br>
> - {<br>
> - uint64_t sign_bit = 1ull << sign_bitpos;<br>
> - if (m_data.uint64 & sign_bit)<br>
> - {<br>
> - const uint64_t mask = ~(sign_bit) + 1ull;<br>
> - m_data.uint64 |= mask;<br>
> - }<br>
> - return true;<br>
> - }<br>
> - break;<br>
> -<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> case eTypeUInt128:<br>
> - if (sign_bitpos == (128-1))<br>
> - return true;<br>
> - else if (sign_bitpos < (128-1))<br>
> - {<br>
> - __uint128_t sign_bit = (__uint128_t)1u << sign_bitpos;<br>
> - if (m_data.uint128 & sign_bit)<br>
> - {<br>
> - const uint128_t mask = ~(sign_bit) + 1u;<br>
> - m_data.uint128 |= mask;<br>
> - }<br>
> - return true;<br>
> - }<br>
> - break;<br>
> -#endif<br>
> + return m_scalar.SignExtend(sign_bitpos);<br>
> case eTypeFloat:<br>
> case eTypeDouble:<br>
> case eTypeLongDouble:<br>
> @@ -649,21 +594,19 @@ RegisterValue::CopyValue (const Register<br>
> {<br>
> case eTypeInvalid:<br>
> return false;<br>
> - case eTypeUInt8: m_data.uint8 = rhs.m_data.uint8; break;<br>
> - case eTypeUInt16: m_data.uint16 = rhs.m_data.uint16; break;<br>
> - case eTypeUInt32: m_data.uint32 = rhs.m_data.uint32; break;<br>
> - case eTypeUInt64: m_data.uint64 = rhs.m_data.uint64; break;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - case eTypeUInt128: m_data.uint128 = rhs.m_data.uint128; break;<br>
> -#endif<br>
> - case eTypeFloat: m_data.ieee_float = rhs.m_data.ieee_float; break;<br>
> - case eTypeDouble: m_data.ieee_double = rhs.m_data.ieee_double; break;<br>
> - case eTypeLongDouble: m_data.ieee_long_double = rhs.m_data.ieee_long_double; break;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16:<br>
> + case eTypeUInt32:<br>
> + case eTypeUInt64:<br>
> + case eTypeUInt128:<br>
> + case eTypeFloat:<br>
> + case eTypeDouble:<br>
> + case eTypeLongDouble: m_scalar = rhs.m_scalar; break;<br>
> case eTypeBytes:<br>
> - assert (rhs.m_data.buffer.length <= kMaxRegisterByteSize);<br>
> - ::memcpy (m_data.buffer.bytes, rhs.m_data.buffer.bytes, kMaxRegisterByteSize);<br>
> - m_data.buffer.length = rhs.m_data.buffer.length;<br>
> - m_data.buffer.byte_order = rhs.m_data.buffer.byte_order;<br>
> + assert (rhs.buffer.length <= kMaxRegisterByteSize);<br>
> + ::memcpy (buffer.bytes, rhs.buffer.bytes, kMaxRegisterByteSize);<br>
> + buffer.length = rhs.buffer.length;<br>
> + buffer.byte_order = rhs.buffer.byte_order;<br>
> break;<br>
> }<br>
> return true;<br>
> @@ -678,15 +621,15 @@ RegisterValue::GetAsUInt16 (uint16_t fai<br>
> switch (m_type)<br>
> {<br>
> default: break;<br>
> - case eTypeUInt8: return m_data.uint8;<br>
> - case eTypeUInt16: return m_data.uint16;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16: return m_scalar.UShort(fail_value);<br>
> case eTypeBytes:<br>
> {<br>
> - switch (m_data.buffer.length)<br>
> + switch (buffer.length)<br>
> {<br>
> default: break;<br>
> - case 1: return m_data.uint8;<br>
> - case 2: return m_data.uint16;<br>
> + case 1:<br>
> + case 2: return *(const uint16_t *)buffer.bytes;<br>
> }<br>
> }<br>
> break;<br>
> @@ -704,29 +647,20 @@ RegisterValue::GetAsUInt32 (uint32_t fai<br>
> switch (m_type)<br>
> {<br>
> default: break;<br>
> - case eTypeUInt8: return m_data.uint8;<br>
> - case eTypeUInt16: return m_data.uint16;<br>
> - case eTypeUInt32: return m_data.uint32;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16:<br>
> + case eTypeUInt32:<br>
> case eTypeFloat:<br>
> - if (sizeof(float) == sizeof(uint32_t))<br>
> - return m_data.uint32;<br>
> - break;<br>
> case eTypeDouble:<br>
> - if (sizeof(double) == sizeof(uint32_t))<br>
> - return m_data.uint32;<br>
> - break;<br>
> - case eTypeLongDouble:<br>
> - if (sizeof(long double) == sizeof(uint32_t))<br>
> - return m_data.uint32;<br>
> - break;<br>
> + case eTypeLongDouble: return m_scalar.UInt(fail_value);<br>
> case eTypeBytes:<br>
> {<br>
> - switch (m_data.buffer.length)<br>
> + switch (buffer.length)<br>
> {<br>
> default: break;<br>
> - case 1: return m_data.uint8;<br>
> - case 2: return m_data.uint16;<br>
> - case 4: return m_data.uint32;<br>
> + case 1:<br>
> + case 2:<br>
> + case 4: return *(const uint32_t *)buffer.bytes;<br>
> }<br>
> }<br>
> break;<br>
> @@ -744,31 +678,22 @@ RegisterValue::GetAsUInt64 (uint64_t fai<br>
> switch (m_type)<br>
> {<br>
> default: break;<br>
> - case eTypeUInt8: return m_data.uint8;<br>
> - case eTypeUInt16: return m_data.uint16;<br>
> - case eTypeUInt32: return m_data.uint32;<br>
> - case eTypeUInt64: return m_data.uint64;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16:<br>
> + case eTypeUInt32:<br>
> + case eTypeUInt64:<br>
> case eTypeFloat:<br>
> - if (sizeof(float) == sizeof(uint64_t))<br>
> - return m_data.uint64;<br>
> - break;<br>
> case eTypeDouble:<br>
> - if (sizeof(double) == sizeof(uint64_t))<br>
> - return m_data.uint64;<br>
> - break;<br>
> - case eTypeLongDouble:<br>
> - if (sizeof(long double) == sizeof(uint64_t))<br>
> - return m_data.uint64;<br>
> - break;<br>
> + case eTypeLongDouble: return m_scalar.ULongLong(fail_value);<br>
> case eTypeBytes:<br>
> {<br>
> - switch (m_data.buffer.length)<br>
> + switch (buffer.length)<br>
> {<br>
> default: break;<br>
> - case 1: return m_data.uint8;<br>
> - case 2: return m_data.uint16;<br>
> - case 4: return m_data.uint32;<br>
> - case 8: return m_data.uint64;<br>
> + case 1:<br>
> + case 2:<br>
> + case 4:<br>
> + case 8: return *(const uint64_t *)buffer.bytes;<br>
> }<br>
> }<br>
> break;<br>
> @@ -778,43 +703,36 @@ RegisterValue::GetAsUInt64 (uint64_t fai<br>
> return fail_value;<br>
> }<br>
><br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> -__uint128_t<br>
> -RegisterValue::GetAsUInt128 (__uint128_t fail_value, bool *success_ptr) const<br>
> +llvm::APInt<br>
> +RegisterValue::GetAsUInt128 (const llvm::APInt& fail_value, bool *success_ptr) const<br>
> {<br>
> if (success_ptr)<br>
> *success_ptr = true;<br>
> switch (m_type)<br>
> {<br>
> default: break;<br>
> - case eTypeUInt8: return m_data.uint8;<br>
> - case eTypeUInt16: return m_data.uint16;<br>
> - case eTypeUInt32: return m_data.uint32;<br>
> - case eTypeUInt64: return m_data.uint64;<br>
> - case eTypeUInt128: return m_data.uint128;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16:<br>
> + case eTypeUInt32:<br>
> + case eTypeUInt64:<br>
> + case eTypeUInt128:<br>
> case eTypeFloat:<br>
> - if (sizeof(float) == sizeof(__uint128_t))<br>
> - return m_data.uint128;<br>
> - break;<br>
> case eTypeDouble:<br>
> - if (sizeof(double) == sizeof(__uint128_t))<br>
> - return m_data.uint128;<br>
> - break;<br>
> - case eTypeLongDouble:<br>
> - if (sizeof(long double) == sizeof(__uint128_t))<br>
> - return m_data.uint128;<br>
> - break;<br>
> + case eTypeLongDouble: return m_scalar.UInt128(fail_value);<br>
> case eTypeBytes:<br>
> {<br>
> - switch (m_data.buffer.length)<br>
> + switch (buffer.length)<br>
> {<br>
> - default:<br>
> - break;<br>
> - case 1: return m_data.uint8;<br>
> - case 2: return m_data.uint16;<br>
> - case 4: return m_data.uint32;<br>
> - case 8: return m_data.uint64;<br>
> - case 16: return m_data.uint128;<br>
> + default:<br>
> + break;<br>
> + case 1:<br>
> + case 2:<br>
> + case 4:<br>
> + case 8:<br>
> + case 16:<br>
> + {<br>
> + return llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, ((const type128 *)buffer.bytes)->x);<br>
> + }<br>
> }<br>
> }<br>
> break;<br>
> @@ -823,7 +741,7 @@ RegisterValue::GetAsUInt128 (__uint128_t<br>
> *success_ptr = false;<br>
> return fail_value;<br>
> }<br>
> -#endif<br>
> +<br>
> float<br>
> RegisterValue::GetAsFloat (float fail_value, bool *success_ptr) const<br>
> {<br>
> @@ -833,28 +751,12 @@ RegisterValue::GetAsFloat (float fail_va<br>
> {<br>
> default: break;<br>
> case eTypeUInt32:<br>
> - if (sizeof(float) == sizeof(m_data.uint32))<br>
> - return m_data.ieee_float;<br>
> - break;<br>
> case eTypeUInt64:<br>
> - if (sizeof(float) == sizeof(m_data.uint64))<br>
> - return m_data.ieee_float;<br>
> - break;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> case eTypeUInt128:<br>
> - if (sizeof(float) == sizeof(m_data.uint128))<br>
> - return m_data.ieee_float;<br>
> - break;<br>
> -#endif<br>
> - case eTypeFloat: return m_data.ieee_float;<br>
> + case eTypeFloat:<br>
> case eTypeDouble:<br>
> - if (sizeof(float) == sizeof(double))<br>
> - return m_data.ieee_float;<br>
> - break;<br>
> case eTypeLongDouble:<br>
> - if (sizeof(float) == sizeof(long double))<br>
> - return m_data.ieee_float;<br>
> - break;<br>
> + return m_scalar.Float(fail_value);<br>
> }<br>
> if (success_ptr)<br>
> *success_ptr = false;<br>
> @@ -872,27 +774,12 @@ RegisterValue::GetAsDouble (double fail_<br>
> break;<br>
><br>
> case eTypeUInt32:<br>
> - if (sizeof(double) == sizeof(m_data.uint32))<br>
> - return m_data.ieee_double;<br>
> - break;<br>
> -<br>
> case eTypeUInt64:<br>
> - if (sizeof(double) == sizeof(m_data.uint64))<br>
> - return m_data.ieee_double;<br>
> - break;<br>
> -<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> case eTypeUInt128:<br>
> - if (sizeof(double) == sizeof(m_data.uint128))<br>
> - return m_data.ieee_double;<br>
> -#endif<br>
> - case eTypeFloat: return m_data.ieee_float;<br>
> - case eTypeDouble: return m_data.ieee_double;<br>
> -<br>
> + case eTypeFloat:<br>
> + case eTypeDouble:<br>
> case eTypeLongDouble:<br>
> - if (sizeof(double) == sizeof(long double))<br>
> - return m_data.ieee_double;<br>
> - break;<br>
> + return m_scalar.Double(fail_value);<br>
> }<br>
> if (success_ptr)<br>
> *success_ptr = false;<br>
> @@ -910,24 +797,12 @@ RegisterValue::GetAsLongDouble (long dou<br>
> break;<br>
><br>
> case eTypeUInt32:<br>
> - if (sizeof(long double) == sizeof(m_data.uint32))<br>
> - return m_data.ieee_long_double;<br>
> - break;<br>
> -<br>
> case eTypeUInt64:<br>
> - if (sizeof(long double) == sizeof(m_data.uint64))<br>
> - return m_data.ieee_long_double;<br>
> - break;<br>
> -<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> case eTypeUInt128:<br>
> - if (sizeof(long double) == sizeof(m_data.uint128))<br>
> - return m_data.ieee_long_double;<br>
> -#endif<br>
> - case eTypeFloat: return m_data.ieee_float;<br>
> - case eTypeDouble: return m_data.ieee_double;<br>
> - case eTypeLongDouble: return m_data.ieee_long_double;<br>
> - break;<br>
> + case eTypeFloat:<br>
> + case eTypeDouble:<br>
> + case eTypeLongDouble:<br>
> + return m_scalar.LongDouble();<br>
> }<br>
> if (success_ptr)<br>
> *success_ptr = false;<br>
> @@ -940,17 +815,15 @@ RegisterValue::GetBytes () const<br>
> switch (m_type)<br>
> {<br>
> case eTypeInvalid: break;<br>
> - case eTypeUInt8: return &m_data.uint8;<br>
> - case eTypeUInt16: return &m_data.uint16;<br>
> - case eTypeUInt32: return &m_data.uint32;<br>
> - case eTypeUInt64: return &m_data.uint64;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - case eTypeUInt128: return &m_data.uint128;<br>
> -#endif<br>
> - case eTypeFloat: return &m_data.ieee_float;<br>
> - case eTypeDouble: return &m_data.ieee_double;<br>
> - case eTypeLongDouble: return &m_data.ieee_long_double;<br>
> - case eTypeBytes: return m_data.buffer.bytes;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16:<br>
> + case eTypeUInt32:<br>
> + case eTypeUInt64:<br>
> + case eTypeUInt128:<br>
> + case eTypeFloat:<br>
> + case eTypeDouble:<br>
> + case eTypeLongDouble: return m_scalar.GetBytes();<br>
> + case eTypeBytes: return buffer.bytes;<br>
> }<br>
> return NULL;<br>
> }<br>
> @@ -961,17 +834,15 @@ RegisterValue::GetBytes ()<br>
> switch (m_type)<br>
> {<br>
> case eTypeInvalid: break;<br>
> - case eTypeUInt8: return &m_data.uint8;<br>
> - case eTypeUInt16: return &m_data.uint16;<br>
> - case eTypeUInt32: return &m_data.uint32;<br>
> - case eTypeUInt64: return &m_data.uint64;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - case eTypeUInt128: return &m_data.uint128;<br>
> -#endif<br>
> - case eTypeFloat: return &m_data.ieee_float;<br>
> - case eTypeDouble: return &m_data.ieee_double;<br>
> - case eTypeLongDouble: return &m_data.ieee_long_double;<br>
> - case eTypeBytes: return m_data.buffer.bytes;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16:<br>
> + case eTypeUInt32:<br>
> + case eTypeUInt64:<br>
> + case eTypeUInt128:<br>
> + case eTypeFloat:<br>
> + case eTypeDouble:<br>
> + case eTypeLongDouble: return m_scalar.GetBytes();<br>
> + case eTypeBytes: return buffer.bytes;<br>
> }<br>
> return NULL;<br>
> }<br>
> @@ -982,17 +853,15 @@ RegisterValue::GetByteSize () const<br>
> switch (m_type)<br>
> {<br>
> case eTypeInvalid: break;<br>
> - case eTypeUInt8: return sizeof(m_data.uint8);<br>
> - case eTypeUInt16: return sizeof(m_data.uint16);<br>
> - case eTypeUInt32: return sizeof(m_data.uint32);<br>
> - case eTypeUInt64: return sizeof(m_data.uint64);<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - case eTypeUInt128: return sizeof(m_data.uint128);<br>
> -#endif<br>
> - case eTypeFloat: return sizeof(m_data.ieee_float);<br>
> - case eTypeDouble: return sizeof(m_data.ieee_double);<br>
> - case eTypeLongDouble: return sizeof(m_data.ieee_long_double);<br>
> - case eTypeBytes: return m_data.buffer.length;<br>
> + case eTypeUInt8: return 1;<br>
> + case eTypeUInt16: return 2;<br>
> + case eTypeUInt32:<br>
> + case eTypeUInt64:<br>
> + case eTypeUInt128:<br>
> + case eTypeFloat:<br>
> + case eTypeDouble:<br>
> + case eTypeLongDouble: return m_scalar.GetByteSize();<br>
> + case eTypeBytes: return buffer.length;<br>
> }<br>
> return 0;<br>
> }<br>
> @@ -1021,12 +890,10 @@ RegisterValue::SetUInt (uint64_t uint, u<br>
> {<br>
> SetUInt64 (uint);<br>
> }<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> else if (byte_size <= 16)<br>
> {<br>
> - SetUInt128 (uint);<br>
> + SetUInt128 (llvm::APInt(64, uint));<br>
> }<br>
> -#endif<br>
> else<br>
> return false;<br>
> return true;<br>
> @@ -1036,21 +903,21 @@ void<br>
> RegisterValue::SetBytes (const void *bytes, size_t length, lldb::ByteOrder byte_order)<br>
> {<br>
> // If this assertion fires off we need to increase the size of<br>
> - // m_data.buffer.bytes, or make it something that is allocated on<br>
> + // buffer.bytes, or make it something that is allocated on<br>
> // the heap. Since the data buffer is in a union, we can't make it<br>
> // a collection class like SmallVector...<br>
> if (bytes && length > 0)<br>
> {<br>
> - assert (length <= sizeof (m_data.buffer.bytes) && "Storing too many bytes in a RegisterValue.");<br>
> + assert (length <= sizeof (buffer.bytes) && "Storing too many bytes in a RegisterValue.");<br>
> m_type = eTypeBytes;<br>
> - m_data.buffer.length = length;<br>
> - memcpy (m_data.buffer.bytes, bytes, length);<br>
> - m_data.buffer.byte_order = byte_order;<br>
> + buffer.length = length;<br>
> + memcpy (buffer.bytes, bytes, length);<br>
> + buffer.byte_order = byte_order;<br>
> }<br>
> else<br>
> {<br>
> m_type = eTypeInvalid;<br>
> - m_data.buffer.length = 0;<br>
> + buffer.length = 0;<br>
> }<br>
> }<br>
><br>
> @@ -1063,25 +930,23 @@ RegisterValue::operator == (const Regist<br>
> switch (m_type)<br>
> {<br>
> case eTypeInvalid: return true;<br>
> - case eTypeUInt8: return m_data.uint8 == rhs.m_data.uint8;<br>
> - case eTypeUInt16: return m_data.uint16 == rhs.m_data.uint16;<br>
> - case eTypeUInt32: return m_data.uint32 == rhs.m_data.uint32;<br>
> - case eTypeUInt64: return m_data.uint64 == rhs.m_data.uint64;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - case eTypeUInt128: return m_data.uint128 == rhs.m_data.uint128;<br>
> -#endif<br>
> - case eTypeFloat: return m_data.ieee_float == rhs.m_data.ieee_float;<br>
> - case eTypeDouble: return m_data.ieee_double == rhs.m_data.ieee_double;<br>
> - case eTypeLongDouble: return m_data.ieee_long_double == rhs.m_data.ieee_long_double;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16:<br>
> + case eTypeUInt32:<br>
> + case eTypeUInt64:<br>
> + case eTypeUInt128:<br>
> + case eTypeFloat:<br>
> + case eTypeDouble:<br>
> + case eTypeLongDouble: return m_scalar == rhs.m_scalar;<br>
> case eTypeBytes:<br>
> - if (m_data.buffer.length != rhs.m_data.buffer.length)<br>
> + if (buffer.length != rhs.buffer.length)<br>
> return false;<br>
> else<br>
> {<br>
> - uint8_t length = m_data.buffer.length;<br>
> + uint8_t length = buffer.length;<br>
> if (length > kMaxRegisterByteSize)<br>
> length = kMaxRegisterByteSize;<br>
> - return memcmp (m_data.buffer.bytes, rhs.m_data.buffer.bytes, length) == 0;<br>
> + return memcmp (buffer.bytes, rhs.buffer.bytes, length) == 0;<br>
> }<br>
> break;<br>
> }<br>
> @@ -1097,27 +962,25 @@ RegisterValue::operator != (const Regist<br>
> switch (m_type)<br>
> {<br>
> case eTypeInvalid: return false;<br>
> - case eTypeUInt8: return m_data.uint8 != rhs.m_data.uint8;<br>
> - case eTypeUInt16: return m_data.uint16 != rhs.m_data.uint16;<br>
> - case eTypeUInt32: return m_data.uint32 != rhs.m_data.uint32;<br>
> - case eTypeUInt64: return m_data.uint64 != rhs.m_data.uint64;<br>
> -#if defined (ENABLE_128_BIT_SUPPORT)<br>
> - case eTypeUInt128: return m_data.uint128 != rhs.m_data.uint128;<br>
> -#endif<br>
> - case eTypeFloat: return m_data.ieee_float != rhs.m_data.ieee_float;<br>
> - case eTypeDouble: return m_data.ieee_double != rhs.m_data.ieee_double;<br>
> - case eTypeLongDouble: return m_data.ieee_long_double != rhs.m_data.ieee_long_double;<br>
> + case eTypeUInt8:<br>
> + case eTypeUInt16:<br>
> + case eTypeUInt32:<br>
> + case eTypeUInt64:<br>
> + case eTypeUInt128:<br>
> + case eTypeFloat:<br>
> + case eTypeDouble:<br>
> + case eTypeLongDouble: return m_scalar != rhs.m_scalar;<br>
> case eTypeBytes:<br>
> - if (m_data.buffer.length != rhs.m_data.buffer.length)<br>
> + if (buffer.length != rhs.buffer.length)<br>
> {<br>
> return true;<br>
> }<br>
> else<br>
> {<br>
> - uint8_t length = m_data.buffer.length;<br>
> + uint8_t length = buffer.length;<br>
> if (length > kMaxRegisterByteSize)<br>
> length = kMaxRegisterByteSize;<br>
> - return memcmp (m_data.buffer.bytes, rhs.m_data.buffer.bytes, length) != 0;<br>
> + return memcmp (buffer.bytes, rhs.buffer.bytes, length) != 0;<br>
> }<br>
> break;<br>
> }<br>
> @@ -1132,63 +995,35 @@ RegisterValue::ClearBit (uint32_t bit)<br>
> case eTypeInvalid:<br>
> break;<br>
><br>
> - case eTypeUInt8:<br>
> - if (bit < 8)<br>
> - {<br>
</blockquote></div>