forked from OSchip/llvm-project
Minor fixes for ARM/iOS targets:
- 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. llvm-svn: 158236
This commit is contained in:
parent
5a98841673
commit
e3333d69db
|
@ -301,6 +301,9 @@ ClangExpressionParser::ClangExpressionParser (ExecutionContextScope *exe_scope,
|
||||||
m_compiler->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple();
|
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.
|
// 3. Set up various important bits of infrastructure.
|
||||||
m_compiler->createDiagnostics(0, 0);
|
m_compiler->createDiagnostics(0, 0);
|
||||||
|
|
||||||
|
|
|
@ -1551,6 +1551,12 @@ IRForTarget::MaterializeInternalVariable (GlobalVariable *global_variable)
|
||||||
llvm::Type *initializer_type = initializer->getType();
|
llvm::Type *initializer_type = initializer->getType();
|
||||||
|
|
||||||
size_t size = m_target_data->getTypeAllocSize(initializer_type);
|
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');
|
lldb_private::DataBufferHeap data(size, '\0');
|
||||||
|
|
||||||
|
@ -2060,6 +2066,7 @@ IRForTarget::ReplaceStaticLiterals (llvm::BasicBlock &basic_block)
|
||||||
llvm::Instruction *inst = *user_iter;
|
llvm::Instruction *inst = *user_iter;
|
||||||
|
|
||||||
ConstantFP *operand_constant_fp = dyn_cast<ConstantFP>(operand_val);
|
ConstantFP *operand_constant_fp = dyn_cast<ConstantFP>(operand_val);
|
||||||
|
Type *operand_type = operand_constant_fp->getType();
|
||||||
|
|
||||||
if (operand_constant_fp)
|
if (operand_constant_fp)
|
||||||
{
|
{
|
||||||
|
@ -2105,6 +2112,13 @@ IRForTarget::ReplaceStaticLiterals (llvm::BasicBlock &basic_block)
|
||||||
|
|
||||||
uint64_t offset = m_data_allocator->GetStream().GetSize();
|
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);
|
m_data_allocator->GetStream().Write(data.GetBytes(), operand_data_size);
|
||||||
|
|
||||||
llvm::Type *fp_ptr_ty = operand_constant_fp->getType()->getPointerTo();
|
llvm::Type *fp_ptr_ty = operand_constant_fp->getType()->getPointerTo();
|
||||||
|
|
Loading…
Reference in New Issue