[PATCH] D137517: [TargetParser] Generate the defs for RISCV CPUs using llvm-tblgen.

Francesco Petrogalli via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 21 13:03:09 PST 2022


fpetrogalli marked an inline comment as done.
fpetrogalli added inline comments.


================
Comment at: llvm/lib/TargetParser/CMakeLists.txt:29
+# LLVMTargetParser. See https://stackoverflow.com/a/25681179
+target_include_directories(LLVMTargetParser PUBLIC $<BUILD_INTERFACE:${LLVM_LIBRARY_DIR}/TargetParser/>)
----------------
barannikov88 wrote:
> Will it work if RISC-V target is not compiled-in?
> This does not strictly add a cyclic dependency, but it would still be nice to avoid dependency on higher-level components.
> Is it possible / reasonable to extract the part of the RISCV.td that relates to this component and put it separate td file in this directory? Or is it tightly coupled with the rest of the target description?
> 
> Will it work if RISC-V target is not compiled-in?

This line worked, so yes

```
cmake ../llvm-project/llvm -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -GNinja -DLLVM_TARGETS_TO_BUILD="AArch64;AMDGPU;ARM;AVR;BPF;Hexagon;Lanai;Mips;MSP430;NVPTX;PowerPC;Sparc;SystemZ;VE;WebAssembly;X86;XCore"
```


> This does not strictly add a cyclic dependency, but it would still be nice to avoid dependency on higher-level components.
> Is it possible / reasonable to extract the part of the RISCV.td that relates to this component and put it separate td file in this directory? Or is it tightly coupled with the rest of the target description?
> 

Hum - the content of RISCV.td is central in `llvm/lib/Target/RISCV/`. The only way I can see we can put a td file in this folder is by duplicating the content that we use from `RISCV.td`... That however would mean missing the point of this patch though, as the idea is to have centralised unique source of information.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137517



More information about the cfe-commits mailing list