[Conversion] Add comprehensive CombToLLVM conversion pass with func.func-only scope #9105
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.
This PR adds a complete implementation of the
ConvertCombToLLVM
pass that converts Comb and related dialect operations to LLVM IR. The pass is designed to only convert operations insidefunc.func
operations, leaving all other operations (such ashw.module
) unconverted.Previously, the CombToLLVM conversion infrastructure only provided pattern population functions (
populateCombToLLVMConversionPatterns
) but no complete pass implementation.This PR adds:
func.func
operations, allowing mixed representations where:Example Input:
Output after
--convert-comb-to-llvm
:Implementation detail:
The pass applies conversion patterns in a specific order to ensure correct lowering:
This change complements the existing conversion infrastructure:
CombToArith
: Converts most Comb operations to Arith dialect (used by this pass)HWToLLVM
: Provides type conversions for HW types (used by this pass)ArithToLLVM
: Converts Arith operations to LLVM dialect (used by this pass)FuncToLLVM
: Converts Func operations to LLVM dialect (used by this pass)SCFToControlFlow
: Converts SCF to ControlFlow dialect (used by this pass)The CombToLLVM pass orchestrates all these conversions into a single, complete lowering pipeline, but only applies them to
func.func
operations.Note: This PR has been developed with help from Calude Sonnet 4.5