-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Language grammar changes to add for loop * IR classes for For and ForInStatements * For statement namespace fixes * Recognize "for" token * Support for for-loops in toP4 * forloop initial test for parsing * Add support for break / continue in loops. No sema checks * Add semantic checks for continue and break statements * Minimize stderr diffs - due to ';' now being no longer part of the declaration, one character difference in a bunch of stderr traces * sideEffects support for For statements - keep a PathExpression of the var in ForInStatements, so that the symbol can be moved to the top level (from Anton Korobeynikov <[email protected]>) * loop fixes to get through midend/p4test - allow ForIn to refer to decl in the enclosing scope - ensure valid P4 code output for loops in toP4 - fix testcase to no deadcode elim everything * def_use for loops * Split loop visit_children to separate source file * loop support in ControlFlowVisitor * loop support for LocalCopyprop * loop support for midend ComputeDefUse * Fix local_copyprop to not copyprop illegally into loops * Disable ActionSynthesis for statments in for init/update - Some hacks here to figure out which child is which for a ForStatement - Should be part of ActionSynthesis policy somehow? * loop support in FindUninitialized * Allow annotations on for statements * clang-format * Added testcases * Minor typos fixes for loops - 'for' instead of 'foreach' in comments/error messages - fix constant in loop-visitor * Redo loop flow analysis -- fix def_use and ControlFlowVisitor - flow state after loop needs to be union of state after the condition check (not bottom of loop) and all break states. - condition of for..in is before setting index var * Fix toP4 for break/continue + more tests * Unsupported error for loops in BMV2 * Comment typos/improvements * Insert break; when removing return/exit from loop * initial UnrollLoops pass - only handles simple for v in k1..k2 loops; general for TBD * GlobalCopyprop support for loops * UnrollLoops for ForStatement * Repeat UnrollLoops + constfold + copyprop to fixed point. * Fix and generalize ForStatement unrolling - allow more patterns of tests and increments - deal properly with updates in the presence of break&continue - single test to skip rest of loop after break rather than rechecking the flag every time. - remove redundant inits of flags * UnrollLoops fix for break after continue * Testcases for expected errors and nested loops with return * Typecheck/inference into ForIn loop ranges --------- Co-authored-by: Andy Fingerhut <[email protected]> Co-authored-by: Anton Korobeynikov <[email protected]>
- Loading branch information
1 parent
6343eab
commit b51b341
Showing
135 changed files
with
5,563 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
Copyright 2013-present Barefoot Networks, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#ifndef BACKENDS_BMV2_COMMON_CHECK_UNSUPPORTED_H_ | ||
#define BACKENDS_BMV2_COMMON_CHECK_UNSUPPORTED_H_ | ||
|
||
#include "frontends/common/options.h" | ||
#include "ir/ir.h" | ||
#include "lower.h" | ||
#include "midend/convertEnums.h" | ||
|
||
namespace BMV2 { | ||
|
||
class CheckUnsupported : public Inspector { | ||
bool preorder(const IR::ForStatement *fs) override { | ||
error(ErrorType::ERR_UNSUPPORTED, "%sBMV2 does not support loops", fs->srcInfo); | ||
return false; | ||
} | ||
bool preorder(const IR::ForInStatement *fs) override { | ||
error(ErrorType::ERR_UNSUPPORTED, "%sBMV2 does not support loops", fs->srcInfo); | ||
return false; | ||
} | ||
}; | ||
|
||
} // namespace BMV2 | ||
|
||
#endif /* BACKENDS_BMV2_COMMON_CHECK_UNSUPPORTED_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.