Skip to content
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

Remove predication pass from p4test #3916

Merged
merged 3 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions backends/p4test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,6 @@ set (P4_XFAIL_TESTS
# This program uses a list of expressions on the 'psa_implementation' property
# which is currently unsupported
testdata/p4_16_samples/psa-action-profile2.p4
# These programs uses conditional execution inside action body which is currently
# unsupported
testdata/p4_16_samples/psa-dpdk-action-jumpOpt.p4
testdata/p4_16_samples/pna-example-tcp-connection-tracking.p4
testdata/p4_16_samples/pna-example-tcp-connection-tracking-err-1.p4
testdata/p4_16_samples/pna-example-tcp-connection-tracking-err.p4
testdata/p4_16_samples/pna-example-pass-2.p4
testdata/p4_16_samples/invalid-hdr-warnings5.p4
testdata/p4_16_samples/invalid-hdr-warnings6.p4
testdata/p4_16_samples/invalid-hdr-warnings7.p4
testdata/p4_16_samples/invalid-hdr-warnings8.p4
testdata/p4_16_samples/pna-dpdk-direct-counter.p4
testdata/p4_16_samples/issue3001-1.p4
testdata/p4_16_samples/issue982.p4
# These tests are added to check mirror_packet extern invocation with non-constant
# arguments and with incorrect number of arguments
testdata/p4_16_samples/pna-example-mirror-packet-error2.p4
Expand Down
2 changes: 0 additions & 2 deletions backends/p4test/midend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ limitations under the License.
#include "midend/nestedStructs.h"
#include "midend/noMatch.h"
#include "midend/parserUnroll.h"
#include "midend/predication.h"
#include "midend/removeAssertAssume.h"
#include "midend/removeExits.h"
#include "midend/removeMiss.h"
Expand Down Expand Up @@ -108,7 +107,6 @@ MidEnd::MidEnd(CompilerOptions &options, std::ostream *outStream) {
new P4::FlattenInterfaceStructs(&refMap, &typeMap),
new P4::EliminateTypedef(&refMap, &typeMap),
new P4::ReplaceSelectRange(&refMap, &typeMap),
new P4::Predication(&refMap),
new P4::MoveDeclarations(), // more may have been introduced
new P4::ConstantFolding(&refMap, &typeMap),
new P4::GlobalCopyPropagation(&refMap, &typeMap),
Expand Down
40 changes: 35 additions & 5 deletions testdata/p4_14_samples_outputs/misc_prim-midend.p4
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout
}

control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name("ingress.tmp") bit<32> tmp;
@name("ingress.tmp_0") bit<32> tmp_0;
@name("ingress.tmp_1") int<32> tmp_1;
@name("ingress.tmp_2") int<32> tmp_2;
@name("ingress.tmp_3") int<32> tmp_3;
@noWarn("unused") @name(".NoAction") action NoAction_1() {
}
@name(".action_0") action action_0() {
Expand All @@ -52,19 +57,44 @@ control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_
hdr.pkt.field_a_32 = ~hdr.pkt.field_d_32;
}
@name(".action_4") action action_4(@name("param0") bit<32> param0_11) {
hdr.pkt.field_a_32 = (hdr.pkt.field_d_32 <= param0_11 ? hdr.pkt.field_d_32 : param0_11);
if (hdr.pkt.field_d_32 <= param0_11) {
tmp = hdr.pkt.field_d_32;
} else {
tmp = param0_11;
}
hdr.pkt.field_a_32 = tmp;
}
@name(".action_5") action action_5(@name("param0") bit<32> param0_12) {
hdr.pkt.field_a_32 = (param0_12 >= hdr.pkt.field_d_32 ? param0_12 : hdr.pkt.field_d_32);
if (param0_12 >= hdr.pkt.field_d_32) {
tmp_0 = param0_12;
} else {
tmp_0 = hdr.pkt.field_d_32;
}
hdr.pkt.field_a_32 = tmp_0;
}
@name(".action_6") action action_6() {
hdr.pkt.field_b_32 = ((int<32>)hdr.pkt.field_d_32 <= 32s7 ? (int<32>)hdr.pkt.field_d_32 : 32s7);
if ((int<32>)hdr.pkt.field_d_32 <= 32s7) {
tmp_1 = (int<32>)hdr.pkt.field_d_32;
} else {
tmp_1 = 32s7;
}
hdr.pkt.field_b_32 = tmp_1;
}
@name(".action_7") action action_7(@name("param0") int<32> param0_13) {
hdr.pkt.field_b_32 = (param0_13 >= (int<32>)hdr.pkt.field_d_32 ? param0_13 : (int<32>)hdr.pkt.field_d_32);
if (param0_13 >= (int<32>)hdr.pkt.field_d_32) {
tmp_2 = param0_13;
} else {
tmp_2 = (int<32>)hdr.pkt.field_d_32;
}
hdr.pkt.field_b_32 = tmp_2;
}
@name(".action_8") action action_8(@name("param0") int<32> param0_14) {
hdr.pkt.field_x_32 = (hdr.pkt.field_x_32 >= param0_14 ? hdr.pkt.field_x_32 : param0_14);
if (hdr.pkt.field_x_32 >= param0_14) {
tmp_3 = hdr.pkt.field_x_32;
} else {
tmp_3 = param0_14;
}
hdr.pkt.field_x_32 = tmp_3;
}
@name(".action_9") action action_9() {
hdr.pkt.field_x_32 = hdr.pkt.field_x_32 >> 7;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ control egress(inout headers hdr, inout metadata meta, inout standard_metadata_t
}

control ingress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name("ingress.tmp") bit<8> tmp;
@noWarn("unused") @name(".NoAction") action NoAction_1() {
}
@name(".table0_actionlist") action table0_actionlist(@name("do_goto_table") bit<1> do_goto_table_1, @name("goto_table_id") bit<8> goto_table_id_1) {
meta._metadata_global_do_goto_table0 = do_goto_table_1;
meta._metadata_global_goto_table_id1 = (do_goto_table_1 != 1w0 ? goto_table_id_1 : meta._metadata_global_goto_table_id1);
if (do_goto_table_1 != 1w0) {
tmp = goto_table_id_1;
} else {
tmp = meta._metadata_global_goto_table_id1;
}
meta._metadata_global_goto_table_id1 = tmp;
}
@name(".table0") table table0_0 {
actions = {
Expand Down
95 changes: 0 additions & 95 deletions testdata/p4_16_errors/issue513.p4

This file was deleted.

70 changes: 0 additions & 70 deletions testdata/p4_16_errors_outputs/issue513-first.p4

This file was deleted.

70 changes: 0 additions & 70 deletions testdata/p4_16_errors_outputs/issue513-frontend.p4

This file was deleted.

Loading