summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/IR/DataLayout.h
diff options
context:
space:
mode:
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