summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/IR/DataLayout.h
diff options
context:
space:
mode:
authorMichael Platings <michael.platings@arm.com>2019-03-06 17:24:11 +0000
committerMichael Platings <michael.platings@arm.com>2019-03-06 17:24:11 +0000
commit2391bfca97290181ae65796ea6da135d1b6d037b (patch)
treec6d06bb3c64c5eddaf4aac60e06932443cd0ce99 /llvm/include/llvm/IR/DataLayout.h
parent930007ba761badbcd7fe9abf20e3a36b696f98d6 (diff)
downloadbcm5719-llvm-2391bfca97290181ae65796ea6da135d1b6d037b.tar.gz
bcm5719-llvm-2391bfca97290181ae65796ea6da135d1b6d037b.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: 355522
Diffstat (limited to 'llvm/include/llvm/IR/DataLayout.h')
-rw-r--r--llvm/include/llvm/IR/DataLayout.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h
index 869b27b1fda..05c72f10d30 100644
--- a/llvm/include/llvm/IR/DataLayout.h
+++ b/llvm/include/llvm/IR/DataLayout.h
@@ -108,6 +108,13 @@ struct PointerAlignElem {
/// generating LLVM IR is required to generate the right target data for the
/// target being codegen'd to.
class DataLayout {
+public:
+ enum class FunctionPtrAlignType {
+ /// The function pointer alignment is independent of the function alignment.
+ Independent,
+ /// The function pointer alignment is a multiple of the function alignment.
+ MultipleOfFunctionAlign,
+ };
private:
/// Defaults to false.
bool BigEndian;
@@ -116,6 +123,9 @@ private:
unsigned StackNaturalAlign;
unsigned ProgramAddrSpace;
+ unsigned FunctionPtrAlign;
+ FunctionPtrAlignType TheFunctionPtrAlignType;
+
enum ManglingModeT {
MM_None,
MM_ELF,
@@ -199,6 +209,8 @@ public:
BigEndian = DL.isBigEndian();
AllocaAddrSpace = DL.AllocaAddrSpace;
StackNaturalAlign = DL.StackNaturalAlign;
+ FunctionPtrAlign = DL.FunctionPtrAlign;
+ TheFunctionPtrAlignType = DL.TheFunctionPtrAlignType;
ProgramAddrSpace = DL.ProgramAddrSpace;
ManglingMode = DL.ManglingMode;
LegalIntWidths = DL.LegalIntWidths;
@@ -256,6 +268,17 @@ public:
unsigned getStackAlignment() const { return StackNaturalAlign; }
unsigned getAllocaAddrSpace() const { return AllocaAddrSpace; }
+ /// Returns the alignment of function pointers, which may or may not be
+ /// related to the alignment of functions.
+ /// \see getFunctionPtrAlignType
+ unsigned getFunctionPtrAlign() const { return FunctionPtrAlign; }
+
+ /// Return the type of function pointer alignment.
+ /// \see getFunctionPtrAlign
+ FunctionPtrAlignType getFunctionPtrAlignType() const {
+ return TheFunctionPtrAlignType;
+ }
+
unsigned getProgramAddressSpace() const { return ProgramAddrSpace; }
bool hasMicrosoftFastStdCallMangling() const {
OpenPOWER on IntegriCloud