diff options
author | Michael Platings <michael.platings@arm.com> | 2019-03-08 10:44:06 +0000 |
---|---|---|
committer | Michael Platings <michael.platings@arm.com> | 2019-03-08 10:44:06 +0000 |
commit | 308e82ecebeef1342004637db9fdf11567a299b3 (patch) | |
tree | e1e40cd61cad2e514bc88d888424644ec1aac891 /llvm/lib/IR/DataLayout.cpp | |
parent | 93110c2fe46c080bb016f5d9e8d9554b2d787ad7 (diff) | |
download | bcm5719-llvm-308e82ecebeef1342004637db9fdf11567a299b3.tar.gz bcm5719-llvm-308e82ecebeef1342004637db9fdf11567a299b3.zip |
[IR][ARM] Add function pointer alignment to datalayout
Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.
Differential Revision: https://reviews.llvm.org/D57335
llvm-svn: 355685
Diffstat (limited to 'llvm/lib/IR/DataLayout.cpp')
-rw-r--r-- | llvm/lib/IR/DataLayout.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index 2644214a49c..943f5381c64 100644 --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -184,6 +184,8 @@ void DataLayout::reset(StringRef Desc) { AllocaAddrSpace = 0; StackNaturalAlign = 0; ProgramAddrSpace = 0; + FunctionPtrAlign = 0; + TheFunctionPtrAlignType = FunctionPtrAlignType::Independent; ManglingMode = MM_None; NonIntegralAddressSpaces.clear(); @@ -379,6 +381,22 @@ void DataLayout::parseSpecifier(StringRef Desc) { StackNaturalAlign = inBytes(getInt(Tok)); break; } + case 'F': { + switch (Tok.front()) { + case 'i': + TheFunctionPtrAlignType = FunctionPtrAlignType::Independent; + break; + case 'n': + TheFunctionPtrAlignType = FunctionPtrAlignType::MultipleOfFunctionAlign; + break; + default: + report_fatal_error("Unknown function pointer alignment type in " + "datalayout string"); + } + Tok = Tok.substr(1); + FunctionPtrAlign = inBytes(getInt(Tok)); + break; + } case 'P': { // Function address space. ProgramAddrSpace = getAddrSpace(Tok); break; @@ -432,6 +450,8 @@ bool DataLayout::operator==(const DataLayout &Other) const { AllocaAddrSpace == Other.AllocaAddrSpace && StackNaturalAlign == Other.StackNaturalAlign && ProgramAddrSpace == Other.ProgramAddrSpace && + FunctionPtrAlign == Other.FunctionPtrAlign && + TheFunctionPtrAlignType == Other.TheFunctionPtrAlignType && ManglingMode == Other.ManglingMode && LegalIntWidths == Other.LegalIntWidths && Alignments == Other.Alignments && Pointers == Other.Pointers; |