must be a multiple of 8-bits. If omitted, the natural stack
alignment defaults to "unspecified", which does not prevent any
alignment promotions.
+``P<address space>``
+ Specifies the address space that corresponds to program memory.
+ Harvard architectures can use this to specify what space LLVM
+ should place things such as functions into. If omitted, the
+ program memory space defaults to the default address space of 0,
+ which corresponds to a Von Neumann architecture that has code
+ and data in the same space.
``A<address space>``
- Specifies the address space of objects created by '``alloca``'.
+ Specifies the address space of objects created by '``alloca``'.
Defaults to the default address space of 0.
``p[n]:<size>:<abi>:<pref>:<idx>``
This specifies the *size* of a pointer and its ``<abi>`` and
unsigned AllocaAddrSpace;
unsigned StackNaturalAlign;
+ unsigned ProgramAddrSpace;
enum ManglingModeT {
MM_None,
BigEndian = DL.isBigEndian();
AllocaAddrSpace = DL.AllocaAddrSpace;
StackNaturalAlign = DL.StackNaturalAlign;
+ ProgramAddrSpace = DL.ProgramAddrSpace;
ManglingMode = DL.ManglingMode;
LegalIntWidths = DL.LegalIntWidths;
Alignments = DL.Alignments;
unsigned getStackAlignment() const { return StackNaturalAlign; }
unsigned getAllocaAddrSpace() const { return AllocaAddrSpace; }
+ unsigned getProgramAddressSpace() const { return ProgramAddrSpace; }
+
bool hasMicrosoftFastStdCallMangling() const {
return ManglingMode == MM_WinCOFFX86;
}
BigEndian = false;
AllocaAddrSpace = 0;
StackNaturalAlign = 0;
+ ProgramAddrSpace = 0;
ManglingMode = MM_None;
NonIntegralAddressSpaces.clear();
return Bits / 8;
}
+static unsigned getAddrSpace(StringRef R) {
+ unsigned AddrSpace = getInt(R);
+ if (!isUInt<24>(AddrSpace))
+ report_fatal_error("Invalid address space, must be a 24-bit integer");
+ return AddrSpace;
+}
+
void DataLayout::parseSpecifier(StringRef Desc) {
StringRepresentation = Desc;
while (!Desc.empty()) {
StackNaturalAlign = inBytes(getInt(Tok));
break;
}
+ case 'P': { // Function address space.
+ ProgramAddrSpace = getAddrSpace(Tok);
+ break;
+ }
case 'A': { // Default stack/alloca address space.
- AllocaAddrSpace = getInt(Tok);
- if (!isUInt<24>(AllocaAddrSpace))
- report_fatal_error("Invalid address space, must be a 24bit integer");
+ AllocaAddrSpace = getAddrSpace(Tok);
break;
}
case 'm':
bool Ret = BigEndian == Other.BigEndian &&
AllocaAddrSpace == Other.AllocaAddrSpace &&
StackNaturalAlign == Other.StackNaturalAlign &&
+ ProgramAddrSpace == Other.ProgramAddrSpace &&
ManglingMode == Other.ManglingMode &&
LegalIntWidths == Other.LegalIntWidths &&
Alignments == Other.Alignments && Pointers == Other.Pointers;
--- /dev/null
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+; CHECK: target datalayout = "P1"
+target datalayout = "P1"
+
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
target datalayout = "A16777216"
-; CHECK: Invalid address space, must be a 24bit integer
+; CHECK: Invalid address space, must be a 24-bit integer
--- /dev/null
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+
+; CHECK: Invalid address space, must be a 24-bit integer
+target datalayout = "P16777216"