[CIR] Build out AST consumer patterns to reach the entry point into CIRGen #956
+440
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Build out the necessary infrastructure for the main entry point into
ClangIR generation -- CIRGenModule. A set of boilerplate classes exist
to facilitate this -- CIRGenerator, CIRGenAction, EmitCIRAction and
CIRGenConsumer. These all mirror the corresponding types from LLVM
generation by Clang's CodeGen.
The main entry point to CIR generation is
CIRGenModule::buildTopLevelDecl
. It is currently just an emptyfunction. We've added a test to ensure that the pipeline reaches this
point and doesn't fail, but does nothing else. This will be removed in
one of the subsequent patches that'll add basic
cir.func
emission.This patch also re-adds
-emit-cir
to the driver. lib/Driver/Driver.cpprequires that a driver flag exists to facilirate the selection of the
right actions for the driver to create. Without a driver flag you get
the standard behaviors of
-S
,-c
, etc. If we want to emit CIR IRand, eventually, bytecode we'll need a driver flag to force this. This
is why
-emit-llvm
is a driver flag. Notably,-emit-llvm-bc
as a cc1flag doesn't ever do the right thing. Without a driver flag it is
incorrectly ignored and an executable is emitted. With
-S
a file namedsomething.s
is emitted which actually contains bitcode.