[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

Francesco Petrogalli via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 16 07:31:58 PST 2023


fpetrogalli added a comment.

In D141581#4056464 <https://reviews.llvm.org/D141581#4056464>, @lebedev.ri wrote:

> Why is it not sufficient to link to `RISCVTargetParserTableGen`, but is sufficient to link to `LLVMTargetParser`?

This is because  the sources of clangBasic and clangDriver might be compiled before LLVMTargetParser is ready. In this case, compilation would fail because both libraries include the header file `llvm/TargetParser/RISCVTargetParser.h`, which needs the `inc` file generated by `RISCVTargetParserTableGen`.

  // quoting code from llvm/TargetParser/RISCVTargetParser.h
  enum CPUKind : unsigned {
  #define PROC(ENUM, NAME, FEATURES, DEFAULT_MARCH) CK_##ENUM,
  #define TUNE_PROC(ENUM, NAME) CK_##ENUM,
  #include "llvm/TargetParser/RISCVTargetParserDef.inc"
  };



> Does `RISCVTargetParserTableGen` itself not link to `LLVMTargetParser`?

Nope, there is no "linking" between these two components. It is just that `LLVMTargetParser` requires `RISCVTargetParserTableGen`. Therefore, if we say that `clangDriver` and `clangBasic` depend on `LLVMTargetParser` we make sure that the inclusion of the tablegen-generated file resolves correctly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141581



More information about the cfe-commits mailing list