[Lldb-commits] [lldb] r158848 - in /lldb/branches/apple/igneous/source/Expression: ClangExpressionParser.cpp IRForTarget.cpp

Sean Callanan scallanan at apple.com
Wed Jun 20 13:49:26 PDT 2012


Author: spyffe
Date: Wed Jun 20 15:49:26 2012
New Revision: 158848

URL: http://llvm.org/viewvc/llvm-project?rev=158848&view=rev
Log:
Cherry-picked r158236 from trunk, fixing some
ARM/iOS related problems:

- On iOS, we select the "apcs-gnu" ABI to match
  what libraries expect.

- Literals are now allocated at their preferred
  alignment, eliminating many alignment crashes.

Modified:
    lldb/branches/apple/igneous/source/Expression/ClangExpressionParser.cpp
    lldb/branches/apple/igneous/source/Expression/IRForTarget.cpp

Modified: lldb/branches/apple/igneous/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/igneous/source/Expression/ClangExpressionParser.cpp?rev=158848&r1=158847&r2=158848&view=diff
==============================================================================
--- lldb/branches/apple/igneous/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/branches/apple/igneous/source/Expression/ClangExpressionParser.cpp Wed Jun 20 15:49:26 2012
@@ -300,6 +300,9 @@
     {
         m_compiler->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple();
     }
+    
+    if (m_compiler->getTargetOpts().Triple.find("ios") != std::string::npos)
+        m_compiler->getTargetOpts().ABI = "apcs-gnu";
         
     // 3. Set up various important bits of infrastructure.
     m_compiler->createDiagnostics(0, 0);

Modified: lldb/branches/apple/igneous/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/igneous/source/Expression/IRForTarget.cpp?rev=158848&r1=158847&r2=158848&view=diff
==============================================================================
--- lldb/branches/apple/igneous/source/Expression/IRForTarget.cpp (original)
+++ lldb/branches/apple/igneous/source/Expression/IRForTarget.cpp Wed Jun 20 15:49:26 2012
@@ -1551,6 +1551,12 @@
     llvm::Type *initializer_type = initializer->getType();
     
     size_t size = m_target_data->getTypeAllocSize(initializer_type);
+    size_t align = m_target_data->getPrefTypeAlignment(initializer_type);
+    
+    const size_t mask = (align - 1);
+    uint64_t aligned_offset = (offset + mask) & ~mask;
+    m_data_allocator->GetStream().PutNHex8(aligned_offset - offset, 0);
+    offset = aligned_offset;
     
     lldb_private::DataBufferHeap data(size, '\0');
     
@@ -2060,6 +2066,7 @@
         llvm::Instruction *inst = *user_iter;
 
         ConstantFP *operand_constant_fp = dyn_cast<ConstantFP>(operand_val);
+        Type *operand_type = operand_constant_fp->getType();
         
         if (operand_constant_fp)
         {
@@ -2105,6 +2112,13 @@
             
             uint64_t offset = m_data_allocator->GetStream().GetSize();
             
+            size_t align = m_target_data->getPrefTypeAlignment(operand_type);
+            
+            const size_t mask = (align - 1);
+            uint64_t aligned_offset = (offset + mask) & ~mask;
+            m_data_allocator->GetStream().PutNHex8(aligned_offset - offset, 0);
+            offset = aligned_offset;
+            
             m_data_allocator->GetStream().Write(data.GetBytes(), operand_data_size);
             
             llvm::Type *fp_ptr_ty = operand_constant_fp->getType()->getPointerTo();





More information about the lldb-commits mailing list