/// Constructs a TargetData from a string of the following format:
/// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8"
/// The above string is considered the default, and any values not specified
- /// in the string will be assumed to be as above.
+ /// in the string will be assumed to be as above, with the caveat that unspecified
+ /// values are always assumed to be smaller than the size of a pointer.
TargetData(const std::string &TargetDescription) {
init(TargetDescription);
}
LittleEndian = false;
PointerMemSize = 8;
PointerABIAlignment = 8;
- DoubleABIAlignment = 8;
+ DoubleABIAlignment = 0;
FloatABIAlignment = 4;
- LongABIAlignment = 8;
+ LongABIAlignment = 0;
IntABIAlignment = 4;
ShortABIAlignment = 2;
ByteABIAlignment = 1;
BytePrefAlignment = ByteABIAlignment;
ShortPrefAlignment = ShortABIAlignment;
IntPrefAlignment = IntABIAlignment;
- LongPrefAlignment = LongABIAlignment;
+ LongPrefAlignment = 8;
FloatPrefAlignment = FloatABIAlignment;
- DoublePrefAlignment = DoubleABIAlignment;
+ DoublePrefAlignment = 8;
PointerPrefAlignment = PointerABIAlignment;
AggMinPrefAlignment = 0;
break;
}
}
+
+ // Unless explicitly specified, the alignments for longs and doubles is capped by
+ // pointer size.
+ if (LongABIAlignment == 0)
+ LongABIAlignment = LongPrefAlignment = PointerMemSize;
+ if (DoubleABIAlignment == 0)
+ DoubleABIAlignment = DoublePrefAlignment = PointerMemSize;
}
TargetData::TargetData(const Module *M) {