Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR] Build out AST consumer patterns to reach the entry point into CIRGen #956

Conversation

lanza
Copy link
Member

@lanza lanza commented Oct 9, 2024

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 empty
function. 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.cpp
requires 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 IR
and, 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 cc1
flag doesn't ever do the right thing. Without a driver flag it is
incorrectly ignored and an executable is emitted. With -S a file named
something.s is emitted which actually contains bitcode.

Created using spr 1.3.5
@lanza lanza requested a review from bcardosolopes as a code owner October 9, 2024 18:08
@lanza lanza closed this Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant