From 61fe623a201dd2409a8b5df4d52bcaf323672c60 Mon Sep 17 00:00:00 2001 From: erjuan Date: Mon, 11 Nov 2024 16:51:32 +0800 Subject: [PATCH] [Backport][RUST] Add accessors for MCSubtargetInfo CPU and Feature tables Add accessors for MCSubtargetInfo CPU and Feature tables This is needed for -C target-cpu=help and -C target-feature=help in rustc Reference: https://github.com/rust-lang/llvm-project/commit/a8f170c5611585510033764926b0c40a6901d001 Signed-off-by: fengting --- llvm/include/llvm/MC/MCSubtargetInfo.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/llvm/include/llvm/MC/MCSubtargetInfo.h b/llvm/include/llvm/MC/MCSubtargetInfo.h index e1f0a86141e3..1e529bf4fb31 100644 --- a/llvm/include/llvm/MC/MCSubtargetInfo.h +++ b/llvm/include/llvm/MC/MCSubtargetInfo.h @@ -230,6 +230,14 @@ public: return Found != ProcDesc.end() && StringRef(Found->Key) == CPU; } + ArrayRef getCPUTable() const { + return ProcDesc; + } + + ArrayRef getFeatureTable() const { + return ProcFeatures; + } + virtual unsigned getHwMode() const { return 0; } /// Return the cache size in bytes for the given level of cache. -- Gitee