Skip to content

Commit 5e7d714

Browse files
arichardsonresistor
authored andcommitted
[CHERI RISC-V] Use RISCVISAInfo::parseFeatures() instead of manual parsing
No functional change intended.
1 parent a0006a3 commit 5e7d714

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/lib/Target/RISCV/RISCVTargetMachine.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ static std::string computeDataLayout(const Triple &TT, StringRef FS,
167167

168168
StringRef CapTypes = "";
169169
StringRef PurecapOptions = "";
170-
if (llvm::is_contained(llvm::split(FS, ','), "+xcheri")) {
170+
unsigned XLen = TT.isArch64Bit() ? 64 : 32;
171+
std::vector<std::string> Features;
172+
if (!FS.empty())
173+
llvm::append_range(Features, llvm::split(FS, ','));
174+
auto ISAInfo = cantFail(llvm::RISCVISAInfo::parseFeatures(XLen, Features));
175+
if (ISAInfo->hasExtension("xcheri")) {
171176
if (TT.isArch64Bit())
172177
CapTypes = "-pf200:128:128:128:64";
173178
else

0 commit comments

Comments
 (0)