[CIR] Implement CGM.getIntrinsic
for LLVMCallIntrinsicOp
#1710
+1,109
−277
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.
Related: #1692
The current implementation supports non overloaded intrinsics for now...
Couple of nits so far and limitations I've found as compared to CodeGen. Would like to get some guidance based on what I've done so far:
How should we handle intrinsic-specific module operations in CIR/MLIR that LLVM normally provides (naming, uniquing, lookups)? specifically since
LLVM::Module
implements:getOrInsertFunction
. Given that codegen represents these as functions and we have a dedicated op for intrinsics, how would the global -> intrinsic conversion work?Given the fact that we need to give signedness to integer types in CIR, the facilities designated to hold intrinsic metadata(
IITDescriptor
) dont contain any signedness. One approach I've taken is hardcoding and determining signedness based on the Intrinsic ID, however that could potentially be a burden to mantain.There's also some code duplication, specially in sections that handle with
IITDescriptors