[llvm-branch-commits] [lldb] r287641 - Merging r283729:

Nitesh Jain via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 22 06:23:14 PST 2016


Author: nitesh.jain
Date: Tue Nov 22 08:23:14 2016
New Revision: 287641

URL: http://llvm.org/viewvc/llvm-project?rev=287641&view=rev
Log:
Merging r283729:
------------------------------------------------------------------------
r283729 | nitesh.jain | 2016-10-10 14:46:20 +0530 (Mon, 10 Oct 2016) | 7 lines

[LLDB][MIPS] Fix TestReturnValue failure for MIPS

Reviewers: clayborg, labath, bhushan

Subscribers: jaydeep, slthakur, llvm-commits

Differential Revision: https://reviews.llvm.org/D24498
------------------------------------------------------------------------

Modified:
    lldb/branches/release_39/   (props changed)
    lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp

Propchange: lldb/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 22 08:23:14 2016
@@ -1,3 +1,3 @@
 /lldb/branches/apple/python-GIL:156467-162159
 /lldb/branches/iohandler:198360-200250
-/lldb/trunk:277343,277426,277997,277999,278001,283728
+/lldb/trunk:277343,277426,277997,277999,278001,283728-283729

Modified: lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp?rev=287641&r1=287640&r2=287641&view=diff
==============================================================================
--- lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp (original)
+++ lldb/branches/release_39/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp Tue Nov 22 08:23:14 2016
@@ -565,109 +565,137 @@ ABISysV_mips64::GetReturnValueObjectImpl
         // Any structure of up to 16 bytes in size is returned in the registers.
         if (byte_size <= 16)
         {
-            DataBufferSP data_sp (new DataBufferHeap(16, 0));
-            DataExtractor return_ext (data_sp, 
-                                      target_byte_order, 
-                                      target->GetArchitecture().GetAddressByteSize());
+            DataBufferSP data_sp(new DataBufferHeap(16, 0));
+            DataExtractor return_ext(data_sp, target_byte_order,
+                                     target->GetArchitecture().GetAddressByteSize());
 
             RegisterValue r2_value, r3_value, f0_value, f1_value, f2_value;
+            // Tracks how much bytes of r2 and r3 registers we've consumed so far
+            uint32_t integer_bytes = 0;
 
-            uint32_t integer_bytes = 0;         // Tracks how much bytes of r2 and r3 registers we've consumed so far
-            bool use_fp_regs = 0;               // True if return values are in FP return registers.
-            bool found_non_fp_field = 0;        // True if we found any non floating point field in structure.
-            bool use_r2 = 0;                    // True if return values are in r2 register.
-            bool use_r3 = 0;                    // True if return values are in r3 register.
-            bool sucess = 0;                    // True if the result is copied into our data buffer
-            std::string name;
-            bool is_complex;
-            uint32_t count;
-            const uint32_t num_children = return_compiler_type.GetNumFields ();
-
-            // A structure consisting of one or two FP values (and nothing else) will be
-            // returned in the two FP return-value registers i.e fp0 and fp2.
-            if (num_children <= 2)
-            {
-                uint64_t field_bit_offset = 0;
-
-                // Check if this structure contains only floating point fields
-                for (uint32_t idx = 0; idx < num_children; idx++)
-                {
-                    CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(idx, name, &field_bit_offset, nullptr, nullptr);
-                    
-                    if (field_compiler_type.IsFloatingPointType (count, is_complex))
-                        use_fp_regs = 1;
-                    else
-                        found_non_fp_field = 1;
-                }
-
-                if (use_fp_regs && !found_non_fp_field)
-                {
-                    // We have one or two FP-only values in this structure. Get it from f0/f2 registers.
-                    DataExtractor f0_data, f1_data, f2_data;
-                    const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
-                    const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
-                    const RegisterInfo *f2_info = reg_ctx->GetRegisterInfoByName("f2", 0);
-
-                    reg_ctx->ReadRegister (f0_info, f0_value);
-                    reg_ctx->ReadRegister (f2_info, f2_value);
-
-                    f0_value.GetData(f0_data);
-                    f2_value.GetData(f2_data);
-
-                    for (uint32_t idx = 0; idx < num_children; idx++)
-                    {
-                        CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(idx, name, &field_bit_offset, nullptr, nullptr);
-                        const size_t field_byte_width = field_compiler_type.GetByteSize(nullptr);
-
-                        DataExtractor *copy_from_extractor = nullptr;
-
-                        if (idx == 0)
-                        {
-                            if (field_byte_width == 16)                 // This case is for long double type.
-                            {
-                                // If structure contains long double type, then it is returned in fp0/fp1 registers.
-                                reg_ctx->ReadRegister (f1_info, f1_value);
-                                f1_value.GetData(f1_data);
-                                
-                                if (target_byte_order == eByteOrderLittle)
-                                {
-                                    f0_data.Append(f1_data);
-                                    copy_from_extractor = &f0_data;
-                                }
-                                else
-                                {
-                                    f1_data.Append(f0_data);
-                                    copy_from_extractor = &f1_data;
-                                }
-                            }
-                            else
-                                copy_from_extractor = &f0_data;        // This is in f0, copy from register to our result structure
-                        }
-                        else
-                            copy_from_extractor = &f2_data;        // This is in f2, copy from register to our result structure
-
-                        // Sanity check to avoid crash
-                        if (!copy_from_extractor || field_byte_width > copy_from_extractor->GetByteSize())
-                            return return_valobj_sp;
-
-                        // copy the register contents into our data buffer
-                        copy_from_extractor->CopyByteOrderedData (0,
-                                                                  field_byte_width, 
-                                                                  data_sp->GetBytes() + (field_bit_offset/8),
-                                                                  field_byte_width, 
-                                                                  target_byte_order);
-                    }
-
-                    // The result is in our data buffer.  Create a variable object out of it
-                    return_valobj_sp = ValueObjectConstResult::Create (&thread, 
-                                                                       return_compiler_type,
-                                                                       ConstString(""),
-                                                                       return_ext);
-
-                    return return_valobj_sp;
-                }
-            }
-
+           // True if return values are in FP return registers.
+           bool use_fp_regs = 0;
+           // True if we found any non floating point field in structure.
+           bool found_non_fp_field = 0;
+           // True if return values are in r2 register.
+           bool use_r2 = 0;
+           // True if return values are in r3 register.
+           bool use_r3 = 0;
+           // True if the result is copied into our data buffer
+           bool sucess = 0;
+           std::string name;
+           bool is_complex;
+           uint32_t count;
+           const uint32_t num_children = return_compiler_type.GetNumFields();
+
+           // A structure consisting of one or two FP values (and nothing else) will
+           // be returned in the two FP return-value registers i.e fp0 and fp2.
+
+           if (num_children <= 2)
+           {
+               uint64_t field_bit_offset = 0;
+
+               // Check if this structure contains only floating point fields
+               for (uint32_t idx = 0; idx < num_children; idx++)
+               {
+                   CompilerType field_compiler_type =
+                   return_compiler_type.GetFieldAtIndex(idx, name, &field_bit_offset,
+                                                        nullptr, nullptr);
+
+                   if (field_compiler_type.IsFloatingPointType(count, is_complex))
+                   use_fp_regs = 1;
+                   else
+                   found_non_fp_field = 1;
+               }
+
+               if (use_fp_regs && !found_non_fp_field)
+               {
+                   // We have one or two FP-only values in this structure. Get it from
+                   // f0/f2 registers.
+                   DataExtractor f0_data, f1_data, f2_data;
+                   const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
+                   const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
+                   const RegisterInfo *f2_info = reg_ctx->GetRegisterInfoByName("f2", 0);
+
+                   reg_ctx->ReadRegister(f0_info, f0_value);
+                   reg_ctx->ReadRegister(f2_info, f2_value);
+
+                   f0_value.GetData(f0_data);
+
+
+                   for (uint32_t idx = 0; idx < num_children; idx++)
+                   {
+                       CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(idx, name,
+                                                                                               &field_bit_offset,
+                                                                                                nullptr, nullptr);
+                       const size_t field_byte_width = field_compiler_type.GetByteSize(nullptr);
+
+                       DataExtractor *copy_from_extractor = nullptr;
+                       uint64_t return_value[2];
+                       offset_t offset = 0;
+
+                       if (idx == 0)
+                       {
+                           // This case is for long double type.
+                           if (field_byte_width == 16)
+                           {
+
+                               // If structure contains long double type, then it is returned
+                               // in fp0/fp1 registers.
+
+
+
+                               if (target_byte_order == eByteOrderLittle)
+                               {
+                                   return_value[0] = f0_data.GetU64(&offset);
+                                   reg_ctx->ReadRegister(f1_info, f1_value);
+                                   f1_value.GetData(f1_data);
+                                   offset = 0;
+                                   return_value[1] = f1_data.GetU64(&offset);
+                               }
+                               else 
+                               {
+                                   return_value[1] = f0_data.GetU64(&offset);
+                                   reg_ctx->ReadRegister(f1_info, f1_value);
+                                   f1_value.GetData(f1_data);
+                                   offset = 0;
+                                   return_value[0] = f1_data.GetU64(&offset);
+                               }
+
+                               f0_data.SetData(return_value, field_byte_width,
+                                               target_byte_order);
+                           }
+                           copy_from_extractor = &f0_data; // This is in f0, copy from
+
+                                              // register to our result
+                                              // structure
+                       }
+                       else
+                       {
+                           f2_value.GetData(f2_data);
+                           // This is in f2, copy from register to our result structure
+                           copy_from_extractor = &f2_data;
+                       }
+
+                       // Sanity check to avoid crash
+                       if (!copy_from_extractor || field_byte_width > copy_from_extractor->GetByteSize())
+                           return return_valobj_sp;
+
+                       // copy the register contents into our data buffer
+                       copy_from_extractor->CopyByteOrderedData(0, field_byte_width,data_sp->GetBytes() + (field_bit_offset / 8),
+                                                               field_byte_width, target_byte_order);
+                   }
+
+                   // The result is in our data buffer.  Create a variable object out of
+                   // it
+                   return_valobj_sp = ValueObjectConstResult::Create(&thread, return_compiler_type, ConstString(""),
+                                                                     return_ext);
+
+                   return return_valobj_sp;
+               }
+           }
+    
+        
             // If we reach here, it means this structure either contains more than two fields or 
             // it contains at least one non floating point type.
             // In that case, all fields are returned in GP return registers.




More information about the llvm-branch-commits mailing list