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

Always insert instantiation statement at the end of the local statement list #3962

Merged
merged 1 commit into from
Apr 10, 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
6 changes: 2 additions & 4 deletions frontends/p4/directCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
namespace P4 {

const IR::Node *DoInstantiateCalls::postorder(IR::P4Parser *parser) {
insert.append(parser->parserLocals);
parser->parserLocals = insert;
parser->parserLocals.append(insert);
insert.clear();
return parser;
}

const IR::Node *DoInstantiateCalls::postorder(IR::P4Control *control) {
insert.append(control->controlLocals);
control->controlLocals = insert;
control->controlLocals.append(insert);
insert.clear();
return control;
}
Expand Down
1 change: 0 additions & 1 deletion testdata/p4_16_errors_outputs/list-error.p4
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ control c() {
control C();
package top(C _c);
top(c()) main;

3 changes: 0 additions & 3 deletions testdata/p4_16_errors_outputs/psa-meter2.p4
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,5 @@ control MyED(packet_out buffer, out EMPTY a, out EMPTY b, inout EMPTY c, in EMPT
}

IngressPipeline(MyIP(), MyIC(), MyID()) ip;

EgressPipeline(MyEP(), MyEC(), MyED()) ep;

PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main;

37 changes: 37 additions & 0 deletions testdata/p4_16_samples/extern-inst-as-param.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <core.p4>

extern MyCounter<I> {
MyCounter(bit<32> size);
void count(in I index);
}

typedef bit<10> my_counter_index_t;
typedef MyCounter<my_counter_index_t> my_counter_t;

control Inner(my_counter_t counter_set) {
action count(my_counter_index_t index) {
counter_set.count(index);
}

table counter_table {
actions = {
count;
}
}

apply {
counter_table.apply();
}
}

control Test() {
my_counter_t(1024) counter_set;

apply {
Inner.apply(counter_set);
}
}

control C();
package P(C _c);
P(Test()) main;
6 changes: 3 additions & 3 deletions testdata/p4_16_samples_outputs/dash/dash-pipeline-first.p4
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ control acl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_
}

control outbound(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) {
@name("acl") acl() acl_inst;
action route_vnet(bit<16> dst_vnet_id) {
meta.dst_vnet_id = dst_vnet_id;
}
Expand Down Expand Up @@ -488,6 +487,7 @@ control outbound(inout headers_t hdr, inout metadata_t meta, inout standard_meta
}
default_action = NoAction();
}
@name("acl") acl() acl_inst;
apply {
if (meta.conntrack_data.allow_out) {
;
Expand Down Expand Up @@ -560,8 +560,6 @@ control dash_compute_checksum(inout headers_t hdr, inout metadata_t meta) {
}

control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) {
@name("outbound") outbound() outbound_inst;
@name("inbound") inbound() inbound_inst;
action drop_action() {
mark_to_drop(standard_metadata);
}
Expand Down Expand Up @@ -730,6 +728,8 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_
}
default_action = NoAction();
}
@name("outbound") outbound() outbound_inst;
@name("inbound") inbound() inbound_inst;
apply {
standard_metadata.egress_spec = standard_metadata.ingress_port;
if (vip.apply().hit) {
Expand Down
488 changes: 244 additions & 244 deletions testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4

Large diffs are not rendered by default.

488 changes: 244 additions & 244 deletions testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4

Large diffs are not rendered by default.

Loading