-
- Downloads
[RISCV] Unify the arch string parsing logic to to RISCVISAInfo.
How many place you need to modify when implementing a new extension for RISC-V? At least 7 places as I know: - Add new SubtargetFeature at RISCV.td - -march parser in RISCV.cpp - RISCVTargetInfo::initFeatureMap@RISCV.cpp for handling feature vector. - RISCVTargetInfo::getTargetDefines@RISCV.cpp for pre-define marco. - Arch string parser for ELF attribute in RISCVAsmParser.cpp - ELF attribute emittion in RISCVAsmParser.cpp, and make sure it's in canonical order... - ELF attribute emittion in RISCVTargetStreamer.cpp, and again, must in canonical order... And now, this patch provide an unified infrastructure for handling (almost) everything of RISC-V arch string. After this patch, you only need to update 2 places for implement an extension for RISC-V: - Add new SubtargetFeature at RISCV.td, hmmm, it's hard to avoid. - Add new entry to RISCVSupportedExtension@RISCVISAInfo.cpp or SupportedExperimentalExtensions@RISCVISAInfo.cpp . Most codes are come from existing -march parser, but with few new feature/bug fixes: - Accept version for -march, e.g. -march=rv32i2p0. - Reject version info with `p` but without minor version number like `rv32i2p`. Differential Revision: https://reviews.llvm.org/D105168
Showing
- clang/include/clang/Basic/DiagnosticCommonKinds.td 2 additions, 0 deletionsclang/include/clang/Basic/DiagnosticCommonKinds.td
- clang/lib/Basic/Targets/RISCV.cpp 43 additions, 120 deletionsclang/lib/Basic/Targets/RISCV.cpp
- clang/lib/Basic/Targets/RISCV.h 4 additions, 22 deletionsclang/lib/Basic/Targets/RISCV.h
- clang/lib/Driver/ToolChains/Arch/RISCV.cpp 36 additions, 439 deletionsclang/lib/Driver/ToolChains/Arch/RISCV.cpp
- clang/test/Driver/riscv-abi.c 2 additions, 2 deletionsclang/test/Driver/riscv-abi.c
- clang/test/Driver/riscv-arch.c 7 additions, 13 deletionsclang/test/Driver/riscv-arch.c
- clang/test/Driver/riscv-features.c 4 additions, 0 deletionsclang/test/Driver/riscv-features.c
- llvm/include/llvm/Support/RISCVISAInfo.h 90 additions, 0 deletionsllvm/include/llvm/Support/RISCVISAInfo.h
- llvm/lib/Support/CMakeLists.txt 1 addition, 0 deletionsllvm/lib/Support/CMakeLists.txt
- llvm/lib/Support/RISCVISAInfo.cpp 716 additions, 0 deletionsllvm/lib/Support/RISCVISAInfo.cpp
- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp 50 additions, 144 deletionsllvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp 14 additions, 0 deletionsllvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h 4 additions, 0 deletionsllvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
- llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp 15 additions, 47 deletionsllvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
- llvm/test/MC/RISCV/attribute-arch.s 2 additions, 5 deletionsllvm/test/MC/RISCV/attribute-arch.s
- llvm/test/MC/RISCV/attribute-with-insts.s 1 addition, 1 deletionllvm/test/MC/RISCV/attribute-with-insts.s
- llvm/test/MC/RISCV/invalid-attribute.s 2 additions, 2 deletionsllvm/test/MC/RISCV/invalid-attribute.s
Loading