Skip to content

Commit 89e231c

Browse files
committed
[CHERIoT] Make XCheriot imply the other features it depends on.
1 parent 5254e71 commit 89e231c

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,9 @@ def NotPureCapABI
13841384
: Predicate<"!RISCVABI::isCheriPureCapABI(Subtarget->getTargetABI())">;
13851385

13861386
def FeatureVendorXCheriot
1387-
: RISCVExtension<1, 0, "Implements XCheriot extension">;
1387+
: RISCVExtension<1, 0, "Implements XCheriot extension",
1388+
[FeatureVendorXCheri, FeatureVendorXCheriPureCap,
1389+
FeatureStdExtC, FeatureStdExtE, FeatureStdExtM]>;
13881390

13891391
def HasCheriot
13901392
: Predicate<"Subtarget->hasVendorXCheriot()">,

llvm/lib/TargetParser/RISCVISAInfo.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -802,19 +802,6 @@ static bool operator<(StringRef LHS, const ImpliedExtsEntry &RHS) {
802802
#include "llvm/TargetParser/RISCVTargetParserDef.inc"
803803

804804
void RISCVISAInfo::updateImplication() {
805-
bool HasE = Exts.count("e") != 0;
806-
bool HasI = Exts.count("i") != 0;
807-
808-
// If not in e extension and i extension does not exist, i extension is
809-
// implied
810-
if (!HasE && !HasI) {
811-
auto Version = findDefaultVersion("i");
812-
Exts["i"] = *Version;
813-
}
814-
815-
if (HasE && HasI)
816-
Exts.erase("i");
817-
818805
assert(llvm::is_sorted(ImpliedExts) && "Table not sorted by Name");
819806

820807
// This loop may execute over 1 iteration since implication can be layered
@@ -844,6 +831,19 @@ void RISCVISAInfo::updateImplication() {
844831
auto Version = findDefaultVersion("zcf");
845832
Exts["zcf"] = *Version;
846833
}
834+
835+
bool HasE = Exts.count("e") != 0;
836+
bool HasI = Exts.count("i") != 0;
837+
838+
// If not in e extension and i extension does not exist, i extension is
839+
// implied
840+
if (!HasE && !HasI) {
841+
auto Version = findDefaultVersion("i");
842+
Exts["i"] = *Version;
843+
}
844+
845+
if (HasE && HasI)
846+
Exts.erase("i");
847847
}
848848

849849
static constexpr StringLiteral CombineIntoExts[] = {

0 commit comments

Comments
 (0)