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

Add codegen policy #702

Merged
merged 15 commits into from
Aug 29, 2024
Merged

Add codegen policy #702

merged 15 commits into from
Aug 29, 2024

Conversation

PappasBrent
Copy link
Collaborator

@PappasBrent PappasBrent commented Aug 14, 2024

  • Combines the driver options emit_strict_function_return and missing_return_policy into a single virtual class, policy_base, with methods for obtaining these values on a per-functiondecl basis.
  • Replaces all uses of the policy options with the new policy class.
  • Adds a new policy option, skip_function_body, for controlling whether to emit the body of a given function decl.
  • Adds a new policy option, skip_global_initializer, for controlling whether to emit the body of a given var decl.
  • Adds a default_policy class to provide default policy options. It accepts a vast::cc::action_options & instance in its constructor and defaults to returning the options' settings for all function decls.

Addresses the first two checkboxes of #462

Add a policy class to bundle together various translation options such
as how to handle missing return statements and whether to skip
translating function bodies
Add a default codegen policy that returns the options supplied in a
given `vast:cc::action_options` instance, regardless of the function
decl passed to its method calls.
Add logic to skip emtting a function's body depending on the function
generator's policy for it.
- Replace policy fields with policy class.
- Add the function mk_policy() to create a shared pointer to a default
  policy instance.
Add comment explaining why if we skip emitting a function body, we must
set that function's visibility to private. The reason is because the
verifier would fail to verify the function otherwise.
Add default policy that does not skip global initializers.
@xlauko xlauko force-pushed the add-codegen-policy branch from c4cc3bb to ac82431 Compare August 29, 2024 13:26
Copy link
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format reports: 2 file(s) not formatted
  • include/vast/CodeGen/CodeGenPolicy.hpp
  • include/vast/CodeGen/DefaultCodeGenPolicy.hpp

Have any feedback or feature suggestions? Share it here.

@xlauko xlauko merged commit 00640d1 into master Aug 29, 2024
8 checks passed
@xlauko xlauko deleted the add-codegen-policy branch August 29, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants