-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes for for loops #4562
Merged
Merged
Changes for for loops #4562
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
f57cc76
Language grammar changes to add for loop
jafingerhut 6f1b541
IR classes for For and ForInStatements
ChrisDodd b634543
For statement namespace fixes
ChrisDodd b9a81a5
Recognize "for" token
ChrisDodd 56bddee
Support for for-loops in toP4
ChrisDodd 0baa792
forloop initial test for parsing
ChrisDodd 1340065
Add support for break / continue in loops. No sema checks
asl 67a3164
Add semantic checks for continue and break statements
asl dc8ec27
Minimize stderr diffs
ChrisDodd 504ced7
sideEffects support for For statements
ChrisDodd c44bcd4
loop fixes to get through midend/p4test
ChrisDodd c57c8bc
def_use for loops
ChrisDodd dee293a
Split loop visit_children to separate source file
ChrisDodd b94f709
loop support in ControlFlowVisitor
ChrisDodd 947e3c2
loop support for LocalCopyprop
ChrisDodd 3812583
loop support for midend ComputeDefUse
ChrisDodd 3cd991e
Fix local_copyprop to not copyprop illegally into loops
ChrisDodd 91cafbe
Disable ActionSynthesis for statments in for init/update
ChrisDodd 24bf566
loop support in FindUninitialized
ChrisDodd aef6e2c
Allow annotations on for statements
ChrisDodd a6ddd32
clang-format
ChrisDodd 8a9a7b7
Added testcases
ChrisDodd 3181420
Minor typos fixes for loops
ChrisDodd 6586842
Redo loop flow analysis -- fix def_use and ControlFlowVisitor
ChrisDodd ff9bc6d
Fix toP4 for break/continue + more tests
ChrisDodd de2b041
Unsupported error for loops in BMV2
ChrisDodd 341e0a8
Comment typos/improvements
ChrisDodd 8e94b99
Insert break; when removing return/exit from loop
ChrisDodd 47b5b9e
initial UnrollLoops pass
ChrisDodd 0b064a5
GlobalCopyprop support for loops
ChrisDodd 42afec6
UnrollLoops for ForStatement
ChrisDodd 14d9b70
Repeat UnrollLoops + constfold + copyprop to fixed point.
ChrisDodd 873fdb2
Fix and generalize ForStatement unrolling
ChrisDodd 67f174f
UnrollLoops fix for break after continue
ChrisDodd a6c4854
Testcases for expected errors and nested loops with return
ChrisDodd fa3380d
Typecheck/inference into ForIn loop ranges
ChrisDodd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @ChrisDodd. I was wondering what compiler you've used to compile the examples you provided (e.g., ./testdata/p4_16_samples/forloop1.p4) since it's apparent that ”BMV2 does not support loops” (so I assume that p4c-bm2-psa and p4c-bm2-ss won’t work). Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The p4test compiler compiles these loops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying!