@@ -821,14 +821,14 @@ def SwitchOp : CIR_Op<"switch",
821821 operation in the `cir.switch` operation easily.
822822
823823 The `cir.case` operations doesn't have to be in the region of `cir.switch`
824- directly. However, when all the `cir.case` operations lives in the region
825- of `cir.switch` directly and there is no other operations except the ending
826- `cir.yield` operation in the region of `cir.switch` directly, we call the
824+ directly. However, when all the `cir.case` operations live in the region
825+ of `cir.switch` directly and there are no other operations except the ending
826+ `cir.yield` operation in the region of `cir.switch` directly, we say the
827827 `cir.switch` operation is in a simple form. Users can use
828828 `bool isSimpleForm(llvm::SmallVector<CaseOp> &cases)` member function to
829829 detect if the `cir.switch` operation is in a simple form. The simple form
830- makes analysis easier to handle the `cir.switch` operation
831- and makes the boundary to give up pretty clear.
830+ makes it easier for analyses to handle the `cir.switch` operation
831+ and makes the boundary to give up clear.
832832
833833 To make the simple form as common as possible, CIR code generation attaches
834834 operations corresponding to the statements that lives between top level
@@ -840,9 +840,8 @@ def SwitchOp : CIR_Op<"switch",
840840 switch(int cond) {
841841 case 4:
842842 a++;
843-
844- b++;
845- case 5;
843+ b++;
844+ case 5:
846845 c++;
847846
848847 ...
@@ -877,7 +876,7 @@ def SwitchOp : CIR_Op<"switch",
877876 switch(int cond) {
878877 case 4:
879878 default;
880- case 5;
879+ case 5:
881880 a++;
882881 ...
883882 }
@@ -901,13 +900,13 @@ def SwitchOp : CIR_Op<"switch",
901900 }
902901 ```
903902
904- The cir.switch might not be considered "simple" if any of the following is
903+ The cir.switch is not be considered "simple" if any of the following is
905904 true:
906- - There are case statements of the switch statement lives in other scopes
905+ - There are case statements of the switch statement that are scope
907906 other than the top level compound statement scope. Note that a case
908907 statement itself doesn't form a scope.
909908 - The sub-statement of the switch statement is not a compound statement.
910- - There are codes before the first case statement. For example,
909+ - There is any code before the first case statement. For example,
911910
912911 ```
913912 switch(int cond) {
@@ -949,7 +948,7 @@ def SwitchOp : CIR_Op<"switch",
949948 let skipDefaultBuilders = 1;
950949 let builders = [
951950 OpBuilder<(ins "mlir::Value":$condition,
952- "llvm::function_ref<void(mlir::OpBuilder &, mlir::Location, mlir::OperationState &)> ":$switchBuilder)>
951+ "BuilderOpStateCallbackRef ":$switchBuilder)>
953952 ];
954953
955954 let assemblyFormat = [{
@@ -961,12 +960,12 @@ def SwitchOp : CIR_Op<"switch",
961960
962961 let extraClassDeclaration = [{
963962 // Collect cases in the switch.
964- void collectCases(llvm::SmallVector <CaseOp> &cases);
963+ void collectCases(llvm::SmallVectorImpl <CaseOp> &cases);
965964
966965 // Check if the switch is in a simple form.
967966 // If yes, collect the cases to \param cases.
968967 // This is an expensive and need to be used with caution.
969- bool isSimpleForm(llvm::SmallVector <CaseOp> &cases);
968+ bool isSimpleForm(llvm::SmallVectorImpl <CaseOp> &cases);
970969 }];
971970}
972971
0 commit comments