- PointerABIAlignment = 8;
- DoubleABIAlignment = 0;
- FloatABIAlignment = 4;
- LongABIAlignment = 0;
- IntABIAlignment = 4;
- ShortABIAlignment = 2;
- ByteABIAlignment = 1;
- BoolABIAlignment = 1;
- BoolPrefAlignment = BoolABIAlignment;
- BytePrefAlignment = ByteABIAlignment;
- ShortPrefAlignment = ShortABIAlignment;
- IntPrefAlignment = IntABIAlignment;
- LongPrefAlignment = 8;
- FloatPrefAlignment = FloatABIAlignment;
- DoublePrefAlignment = 8;
- PointerPrefAlignment = PointerABIAlignment;
- AggMinPrefAlignment = 0;
-
- while (!temp.empty()) {
- std::string token = getToken(temp, "-");
-
- char signal = getToken(token, ":")[0];
-
- switch(signal) {
+ PointerABIAlign = 8;
+ PointerPrefAlign = PointerABIAlign;
+
+ // Default alignments
+ setAlignment(INTEGER_ALIGN, 1, 1, 1); // i1
+ setAlignment(INTEGER_ALIGN, 1, 1, 8); // i8
+ setAlignment(INTEGER_ALIGN, 2, 2, 16); // i16
+ setAlignment(INTEGER_ALIGN, 4, 4, 32); // i32
+ setAlignment(INTEGER_ALIGN, 4, 8, 64); // i64
+ setAlignment(FLOAT_ALIGN, 4, 4, 32); // float
+ setAlignment(FLOAT_ALIGN, 8, 8, 64); // double
+ setAlignment(VECTOR_ALIGN, 8, 8, 64); // v2i32, v1i64, ...
+ setAlignment(VECTOR_ALIGN, 16, 16, 128); // v16i8, v8i16, v4i32, ...
+ setAlignment(AGGREGATE_ALIGN, 0, 8, 0); // struct
+
+ while (!Desc.empty()) {
+ std::pair<StringRef, StringRef> Split = Desc.split('-');
+ StringRef Token = Split.first;
+ Desc = Split.second;
+
+ if (Token.empty())
+ continue;
+
+ Split = Token.split(':');
+ StringRef Specifier = Split.first;
+ Token = Split.second;
+
+ assert(!Specifier.empty() && "Can't be empty here");
+
+ switch (Specifier[0]) {