[CIR] New assembly format for function type return #1391
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.
Change the assembly format for
cir::FuncType
fromto
This change (1) is easier to parse because it doesn't require lookahead, (2) is consistent with the format of ClangIR
FuncOp
assembly, and (3) is consistent with function types in other MLIR dialects.Change all the tests to use or to expect the new format for function types.
The contents and the semantics of
cir::FuncType
are unchanged. Only the assembly format is being changed. Functions that returnvoid
in C or C++ are still represented in MLIR as having no return type.Most of the changes are in
parseFuncType
andprintFuncType
and the functions they call inCIRTypes.cpp
.A
FuncType::verify
function was added to check that an explicit return type is notcir::VoidType
.FuncType::isVoid()
was renamed toFuncType::hasVoidReturn()
Some comments for
FuncType
were improved.An
llvm_unreachable
was added toStructType::getKindAsStr
to suppress a compiler warning and to catch a memory error that corrupts theRecordKind
field. (This was a drive-by fix and has nothing to do with the rest of this change.)