So that there is no cyclic dependency if we want to use it in
tablegen.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
@pcwang-thead - could you please explain the cycling dependency you are mentioning, in the commit message? I am missing where the cyclic dependency is.
Francesco
There would be a cyclic dependency if RISCVISAInfo.cpp is used in RISCVTargetDefEmitter.cpp as suggested in a recent comment from @pcwang-thead
@craig.topper Thanks!
If we want to use RISCVISAInfo in RISCVTargetDefEmitter.cpp, we need to add TargetParser component to llvm/utils/TableGen/CMakeLists.txt:
diff --git a/llvm/utils/TableGen/CMakeLists.txt b/llvm/utils/TableGen/CMakeLists.txt index aa16e7e894ac..987b955655e3 100644 --- a/llvm/utils/TableGen/CMakeLists.txt +++ b/llvm/utils/TableGen/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(GlobalISel) -set(LLVM_LINK_COMPONENTS Support) +set(LLVM_LINK_COMPONENTS Support TargetParser) add_tablegen(llvm-tblgen LLVM DESTINATION "${LLVM_TOOLS_INSTALL_DIR}"
This causes CMake errors like:
[cmake] CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle): [cmake] "llvm-tblgen" of type EXECUTABLE [cmake] depends on "LLVMTargetParser" (weak) [cmake] "RISCVTargetParserTableGen" of type UTILITY [cmake] depends on "llvm-tblgen" (strong) [cmake] "LLVMTargetParser" of type STATIC_LIBRARY [cmake] depends on "RISCVTargetParserTableGen" (strong) [cmake] At least one of these targets is not a STATIC_LIBRARY. Cyclic dependencies are allowed only among static libraries.
So I move RISCVISAInfo.cpp back to Support component to avoid this cyclic dependency.
@fpetrogalli
From my PoV (which no longer relates to RISC-V in particular), I do not wish for TargetParser to be a dependency of TableGen, specifically because I want to be able to table-generate parts of TargetParser. If this means that I was wrong to move RISCVISAInfo into the TargetParser library (very likely), then by all means move it back.