Skip to content

Commit 378531b

Browse files
committed
fixup! Infer 32-bit Xlen from '32bit' feature.
1 parent 815a63b commit 378531b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

llvm/utils/TableGen/RISCVTargetDefEmitter.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static void printMArch(raw_ostream &OS, const Record &Rec) {
2727
std::map<std::string, std::pair<unsigned, unsigned>,
2828
RISCVISAInfo::ExtensionComparator>
2929
Extensions;
30-
unsigned XLen = 32;
30+
unsigned XLen = 0;
3131

3232
// Convert features to FeatureVector.
3333
for (auto *Feature : Rec.getValueAsListOfDefs("Features")) {
@@ -36,10 +36,17 @@ static void printMArch(raw_ostream &OS, const Record &Rec) {
3636
unsigned Major = Feature->getValueAsInt("MajorVersion");
3737
unsigned Minor = Feature->getValueAsInt("MinorVersion");
3838
Extensions.try_emplace(FeatureName.str(), Major, Minor);
39-
} else if (FeatureName == "64bit")
39+
} else if (FeatureName == "64bit") {
40+
assert(XLen == 0 && "Already determined XLen");
4041
XLen = 64;
42+
} else if (FeatureName == "32bit") {
43+
assert(XLen == 0 && "Already determined XLen");
44+
XLen = 32;
45+
}
4146
}
4247

48+
assert(XLen != 0 && "Unable to determine XLen");
49+
4350
OS << "rv" << XLen;
4451

4552
ListSeparator LS("_");

0 commit comments

Comments
 (0)