[PATCH] D151730: [RISCV] Support target attribute for function

Piyou Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 3 00:12:42 PDT 2023


BeMg added inline comments.


================
Comment at: clang/lib/Basic/Targets/RISCV.cpp:370
+                                 std::vector<std::string> &Features) {
+  Features.push_back("__RISCV_TargetAttrNeedOverride");
+  auto RII = llvm::RISCVISAInfo::parseArchString(
----------------
craig.topper wrote:
> Why do we need "__RISCV_TargetAttrNeedOverride"?
My idea is using `__RISCV_TargetAttrNeedOverride` to distinguish the module-level feature and target attribute feature.

The module-level feature will merge with target attribute feature in https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/ASTContext.cpp#L13481. And be used/refine inside RISCVTargetInfo::initFeatureMap.

After merge, It could find the target attribute feature start point by analyzing FeatureVec, but I prefer use the `__RISCV_TargetAttrNeedOverride` to do this job.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151730/new/

https://reviews.llvm.org/D151730



More information about the cfe-commits mailing list