Make the Basic pipeline more portable

This change makes the Basic pipeline compile better with different
compilers. One change is this: the type parameter for a v1model meter
instance cannot be a programmer-defined enum. This is because in P4_16,
enums don't necessarily have underlying bitstring types and the
language doesn't specify that enum members should be assigned a
numerical value in any given way.

Change-Id: Id2b758eb2b6e76aa708c2e03e7a001667efddb3d
diff --git a/core/net/src/test/java/org/onosproject/net/pi/impl/PiTranslatorServiceTest.java b/core/net/src/test/java/org/onosproject/net/pi/impl/PiTranslatorServiceTest.java
index e55ec25..9faeaba 100644
--- a/core/net/src/test/java/org/onosproject/net/pi/impl/PiTranslatorServiceTest.java
+++ b/core/net/src/test/java/org/onosproject/net/pi/impl/PiTranslatorServiceTest.java
@@ -68,7 +68,7 @@
 import static org.onosproject.net.group.GroupDescription.Type.SELECT;
 import static org.onosproject.pipelines.basic.BasicConstants.ACT_PRF_WCMP_SELECTOR_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.ACT_PRM_PORT_ID;
-import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_ID;
+import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_WCMP_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_DST_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_SRC_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_TYPE_ID;
@@ -222,7 +222,7 @@
     private static GroupBucket outputBucket(int portNum) {
         ImmutableByteSequence paramVal = copyFrom(portNum);
         PiActionParam param = new PiActionParam(ACT_PRM_PORT_ID, paramVal);
-        PiTableAction action = PiAction.builder().withId(ACT_SET_EGRESS_PORT_ID).withParameter(param).build();
+        PiTableAction action = PiAction.builder().withId(ACT_SET_EGRESS_PORT_WCMP_ID).withParameter(param).build();
         TrafficTreatment treatment = DefaultTrafficTreatment.builder()
                 .add(Instructions.piTableAction(action))
                 .build();
@@ -233,7 +233,7 @@
             throws ImmutableByteSequence.ByteSequenceTrimException {
         PiActionParam param = new PiActionParam(ACT_PRM_PORT_ID, copyFrom(portNum).fit(PORT_BITWIDTH));
         PiAction piAction = PiAction.builder()
-                .withId(ACT_SET_EGRESS_PORT_ID)
+                .withId(ACT_SET_EGRESS_PORT_WCMP_ID)
                 .withParameter(param).build();
         return PiActionGroupMember.builder()
                 .withAction(piAction)
diff --git a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java
index 6182e18..0a4e7d9 100644
--- a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java
+++ b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java
@@ -81,12 +81,14 @@
             PiActionId.of("NoAction");
     public static final PiActionId ACT_DROP_ID =
             PiActionId.of("_drop");
-    public static final PiActionId ACT_SET_EGRESS_PORT_ID =
-            PiActionId.of("set_egress_port");
+    public static final PiActionId ACT_SET_EGRESS_PORT_TABLE0_ID =
+            PiActionId.of(TABLE0_CTRL + DOT + "set_egress_port");
+    public static final PiActionId ACT_SET_EGRESS_PORT_WCMP_ID =
+            PiActionId.of(WCMP_CTRL + DOT + "set_egress_port");
     public static final PiActionId ACT_SET_NEXT_HOP_ID =
             PiActionId.of(TABLE0_CTRL + DOT + "set_next_hop_id");
     public static final PiActionId ACT_SEND_TO_CPU_ID =
-            PiActionId.of("send_to_cpu");
+            PiActionId.of(TABLE0_CTRL + DOT + "send_to_cpu");
     // Action Param IDs
     public static final PiActionParamId ACT_PRM_PORT_ID =
             PiActionParamId.of("port");
diff --git a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicInterpreterImpl.java b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicInterpreterImpl.java
index d5e917b..15474f4 100644
--- a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicInterpreterImpl.java
+++ b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicInterpreterImpl.java
@@ -35,6 +35,7 @@
 import org.onosproject.net.pi.model.PiMatchFieldId;
 import org.onosproject.net.pi.model.PiPipelineInterpreter;
 import org.onosproject.net.pi.model.PiTableId;
+import org.onosproject.net.pi.model.PiActionId;
 import org.onosproject.net.pi.runtime.PiAction;
 import org.onosproject.net.pi.runtime.PiActionParam;
 import org.onosproject.net.pi.runtime.PiControlMetadata;
@@ -57,7 +58,8 @@
 import static org.onosproject.pipelines.basic.BasicConstants.ACT_NOACTION_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.ACT_PRM_PORT_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.ACT_SEND_TO_CPU_ID;
-import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_ID;
+import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_TABLE0_ID;
+import static org.onosproject.pipelines.basic.BasicConstants.ACT_SET_EGRESS_PORT_WCMP_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_DST_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_SRC_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.HDR_ETH_TYPE_ID;
@@ -68,6 +70,7 @@
 import static org.onosproject.pipelines.basic.BasicConstants.PKT_META_INGRESS_PORT_ID;
 import static org.onosproject.pipelines.basic.BasicConstants.PORT_BITWIDTH;
 import static org.onosproject.pipelines.basic.BasicConstants.TBL_TABLE0_ID;
+import static org.onosproject.pipelines.basic.BasicConstants.TBL_WCMP_TABLE_ID;
 
 /**
  * Interpreter implementation for basic.p4.
@@ -104,7 +107,14 @@
         Instruction instruction = treatment.allInstructions().get(0);
         switch (instruction.type()) {
             case OUTPUT:
-                return outputPiAction((OutputInstruction) instruction);
+                if (piTableId == TBL_TABLE0_ID) {
+                    return outputPiAction((OutputInstruction) instruction, ACT_SET_EGRESS_PORT_TABLE0_ID);
+                } else if (piTableId == TBL_WCMP_TABLE_ID) {
+                    return outputPiAction((OutputInstruction) instruction, ACT_SET_EGRESS_PORT_WCMP_ID);
+                } else {
+                    throw new PiInterpreterException(
+                            "Output instruction not supported in table " + piTableId);
+                }
             case NOACTION:
                 return PiAction.builder().withId(ACT_NOACTION_ID).build();
             default:
@@ -113,13 +123,13 @@
         }
     }
 
-    private PiAction outputPiAction(OutputInstruction outInstruction)
+    private PiAction outputPiAction(OutputInstruction outInstruction, PiActionId piActionId)
             throws PiInterpreterException {
         PortNumber port = outInstruction.port();
         if (!port.isLogical()) {
             try {
                 return PiAction.builder()
-                        .withId(ACT_SET_EGRESS_PORT_ID)
+                        .withId(piActionId)
                         .withParameter(new PiActionParam(ACT_PRM_PORT_ID,
                                                          copyFrom(port.toLong()).fit(PORT_BITWIDTH)))
                         .build();
diff --git a/pipelines/basic/src/main/resources/include/actions.p4 b/pipelines/basic/src/main/resources/include/actions.p4
index d1f83b8..9504879 100644
--- a/pipelines/basic/src/main/resources/include/actions.p4
+++ b/pipelines/basic/src/main/resources/include/actions.p4
@@ -20,14 +20,6 @@
 #include "headers.p4"
 #include "defines.p4"
 
-action send_to_cpu(inout standard_metadata_t standard_metadata) {
-    standard_metadata.egress_spec = CPU_PORT;
-}
-
-action set_egress_port(inout standard_metadata_t standard_metadata, port_t port) {
-    standard_metadata.egress_spec = port;
-}
-
 action _drop() {
     mark_to_drop();
 }
diff --git a/pipelines/basic/src/main/resources/include/custom_headers.p4 b/pipelines/basic/src/main/resources/include/custom_headers.p4
index a57b076..9928412 100644
--- a/pipelines/basic/src/main/resources/include/custom_headers.p4
+++ b/pipelines/basic/src/main/resources/include/custom_headers.p4
@@ -29,7 +29,6 @@
     bit<16>       l4_src_port;
     bit<16>       l4_dst_port;
     next_hop_id_t next_hop_id;
-    bit<32>       meter_tag;
 }
 
 #endif
diff --git a/pipelines/basic/src/main/resources/include/defines.p4 b/pipelines/basic/src/main/resources/include/defines.p4
index d9ec28d..ba5952e 100644
--- a/pipelines/basic/src/main/resources/include/defines.p4
+++ b/pipelines/basic/src/main/resources/include/defines.p4
@@ -27,5 +27,8 @@
 
 const port_t CPU_PORT = 255;
 
-enum MeterColor_t {GREEN, YELLOW, RED};
+typedef bit<8> MeterColor;
+const MeterColor MeterColor_GREEN = 8w0;
+const MeterColor MeterColor_YELLOW = 8w1;
+const MeterColor MeterColor_RED = 8w2;
 #endif
diff --git a/pipelines/basic/src/main/resources/include/headers.p4 b/pipelines/basic/src/main/resources/include/headers.p4
index e45c915..1676646 100644
--- a/pipelines/basic/src/main/resources/include/headers.p4
+++ b/pipelines/basic/src/main/resources/include/headers.p4
@@ -22,11 +22,13 @@
 @controller_header("packet_in")
 header packet_in_header_t {
     bit<9> ingress_port;
+    bit<7> _padding;
 }
 
 @controller_header("packet_out")
 header packet_out_header_t {
     bit<9> egress_port;
+    bit<7> _padding;
 }
 
 header ethernet_t {
diff --git a/pipelines/basic/src/main/resources/include/host_meter_table.p4 b/pipelines/basic/src/main/resources/include/host_meter_table.p4
index 6f581e1..9aa2dfc 100644
--- a/pipelines/basic/src/main/resources/include/host_meter_table.p4
+++ b/pipelines/basic/src/main/resources/include/host_meter_table.p4
@@ -23,11 +23,11 @@
 control host_meter_control(inout headers_t hdr,
                            inout local_metadata_t local_metadata,
                            inout standard_metadata_t standard_metadata) {
-
-    direct_meter<bit<32>>(MeterType.bytes) host_meter;
+    MeterColor meter_tag = MeterColor_GREEN;
+    direct_meter<MeterColor>(MeterType.bytes) host_meter;
 
     action read_meter() {
-        host_meter.read(local_metadata.meter_tag);
+        host_meter.read(meter_tag);
     }
 
     table host_meter_table {
@@ -43,7 +43,8 @@
     }
 
     apply {
-        if (host_meter_table.apply().hit && local_metadata.meter_tag == 2) {
+        host_meter_table.apply();
+        if (meter_tag == MeterColor_RED) {
             mark_to_drop();
         }
      }
diff --git a/pipelines/basic/src/main/resources/include/port_meters.p4 b/pipelines/basic/src/main/resources/include/port_meters.p4
index 710d19a..b9cb2db 100644
--- a/pipelines/basic/src/main/resources/include/port_meters.p4
+++ b/pipelines/basic/src/main/resources/include/port_meters.p4
@@ -21,11 +21,11 @@
 control port_meters_ingress(inout headers_t hdr,
                             inout standard_metadata_t standard_metadata) {
     meter(MAX_PORTS, MeterType.bytes) ingress_port_meter;
-    MeterColor_t ingress_color = MeterColor_t.GREEN;
+    MeterColor ingress_color = MeterColor_GREEN;
 
     apply {
-        ingress_port_meter.execute_meter<MeterColor_t>((bit<32>)standard_metadata.ingress_port, ingress_color);
-        if (ingress_color == MeterColor_t.RED) {
+        ingress_port_meter.execute_meter<MeterColor>((bit<32>)standard_metadata.ingress_port, ingress_color);
+        if (ingress_color == MeterColor_RED) {
             mark_to_drop();
         } 
     }
@@ -35,11 +35,11 @@
                            inout standard_metadata_t standard_metadata) {
 
     meter(MAX_PORTS, MeterType.bytes) egress_port_meter;
-    MeterColor_t egress_color = MeterColor_t.GREEN;
+    MeterColor egress_color = MeterColor_GREEN;
 
     apply {
-        egress_port_meter.execute_meter<MeterColor_t>((bit<32>)standard_metadata.egress_port, egress_color);
-        if (egress_color == MeterColor_t.RED) {
+        egress_port_meter.execute_meter<MeterColor>((bit<32>)standard_metadata.egress_port, egress_color);
+        if (egress_color == MeterColor_RED) {
             mark_to_drop();
         } 
     }
diff --git a/pipelines/basic/src/main/resources/include/table0.p4 b/pipelines/basic/src/main/resources/include/table0.p4
index a004fbb..27e1f8a 100644
--- a/pipelines/basic/src/main/resources/include/table0.p4
+++ b/pipelines/basic/src/main/resources/include/table0.p4
@@ -30,6 +30,14 @@
         local_metadata.next_hop_id = next_hop_id;
     }
 
+    action send_to_cpu() {
+        standard_metadata.egress_spec = CPU_PORT;
+    }
+
+    action set_egress_port(port_t port) {
+        standard_metadata.egress_spec = port;
+    }
+
     table table0 {
         key = {
             standard_metadata.ingress_port : ternary;
@@ -43,10 +51,10 @@
             local_metadata.l4_dst_port     : ternary;
         }
         actions = {
-            set_egress_port(standard_metadata);
-            send_to_cpu(standard_metadata);
-            set_next_hop_id();
-            _drop();
+            set_egress_port;
+            send_to_cpu;
+            set_next_hop_id;
+            _drop;
         }
         const default_action = _drop();
         counters = table0_counter;
diff --git a/pipelines/basic/src/main/resources/include/wcmp.p4 b/pipelines/basic/src/main/resources/include/wcmp.p4
index 9d6e00f..7bc5332 100644
--- a/pipelines/basic/src/main/resources/include/wcmp.p4
+++ b/pipelines/basic/src/main/resources/include/wcmp.p4
@@ -27,6 +27,10 @@
     direct_counter(CounterType.packets_and_bytes) wcmp_table_counter;
     action_selector(HashAlgorithm.crc16, 32w64, 32w16) wcmp_selector;
 
+    action set_egress_port(port_t port) {
+        standard_metadata.egress_spec = port;
+    }
+
     table wcmp_table {
         support_timeout = false;
         key = {
@@ -38,7 +42,7 @@
             local_metadata.l4_dst_port : selector;
         }
         actions = {
-            set_egress_port(standard_metadata);
+            set_egress_port;
         }
         implementation = wcmp_selector;
         counters = wcmp_table_counter;
diff --git a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json
index e9378ef..ad8843a 100644
--- a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json
+++ b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json
@@ -11,17 +11,14 @@
       "fields" : [
         ["tmp", 32, false],
         ["tmp_0", 32, false],
-        ["port_meters_ingress_ingress_color_0", 32, false],
-        ["host_meter_control_tmp_1", 1, false],
-        ["host_meter_control_tmp_2", 1, false],
+        ["port_meters_ingress_ingress_color_0", 8, false],
+        ["host_meter_control_meter_tag_0", 8, false],
         ["tmp_1", 32, false],
         ["tmp_2", 32, false],
-        ["port_meters_egress_egress_color_0", 32, false],
+        ["port_meters_egress_egress_color_0", 8, false],
         ["local_metadata_t.l4_src_port", 16, false],
         ["local_metadata_t.l4_dst_port", 16, false],
-        ["local_metadata_t.next_hop_id", 16, false],
-        ["local_metadata_t.meter_tag", 32, false],
-        ["_padding_2", 6, false]
+        ["local_metadata_t.next_hop_id", 16, false]
       ]
     },
     {
@@ -37,7 +34,7 @@
       "id" : 2,
       "fields" : [
         ["ingress_port", 9, false],
-        ["_padding_0", 7, false]
+        ["_padding", 7, false]
       ]
     },
     {
@@ -119,7 +116,7 @@
         ["egress_rid", 16, false],
         ["checksum_error", 1, false],
         ["recirculate_flag", 32, false],
-        ["_padding_1", 5, false]
+        ["_padding_0", 5, false]
       ]
     }
   ],
@@ -194,16 +191,7 @@
     ["HeaderTooShort", 5],
     ["ParserTimeout", 6]
   ],
-  "enums" : [
-    {
-      "name" : "MeterColor_t",
-      "entries" : [
-        ["GREEN", 0],
-        ["RED", 2],
-        ["YELLOW", 1]
-      ]
-    }
-  ],
+  "enums" : [],
   "parsers" : [
     {
       "name" : "parser",
@@ -467,7 +455,7 @@
       "source_info" : {
         "filename" : "include/host_meter_table.p4",
         "line" : 27,
-        "column" : 43,
+        "column" : 46,
         "source_fragment" : "host_meter"
       },
       "is_direct" : true,
@@ -475,7 +463,7 @@
       "type" : "bytes",
       "size" : 1024,
       "binding" : "ingress.host_meter_control.host_meter_table",
-      "result_target" : ["scalars", "local_metadata_t.meter_tag"]
+      "result_target" : ["scalars", "host_meter_control_meter_tag_0"]
     },
     {
       "name" : "egress.port_meters_egress.egress_port_meter",
@@ -535,96 +523,8 @@
   "learn_lists" : [],
   "actions" : [
     {
-      "name" : "set_egress_port",
-      "id" : 0,
-      "runtime_data" : [
-        {
-          "name" : "port",
-          "bitwidth" : 9
-        }
-      ],
-      "primitives" : [
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["standard_metadata", "egress_spec"]
-            },
-            {
-              "type" : "runtime_data",
-              "value" : 0
-            }
-          ],
-          "source_info" : {
-            "filename" : "include/actions.p4",
-            "line" : 28,
-            "column" : 36,
-            "source_fragment" : "port; ..."
-          }
-        }
-      ]
-    },
-    {
-      "name" : "set_egress_port",
-      "id" : 1,
-      "runtime_data" : [
-        {
-          "name" : "port",
-          "bitwidth" : 9
-        }
-      ],
-      "primitives" : [
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["standard_metadata", "egress_spec"]
-            },
-            {
-              "type" : "runtime_data",
-              "value" : 0
-            }
-          ],
-          "source_info" : {
-            "filename" : "include/actions.p4",
-            "line" : 28,
-            "column" : 36,
-            "source_fragment" : "port; ..."
-          }
-        }
-      ]
-    },
-    {
-      "name" : "send_to_cpu",
-      "id" : 2,
-      "runtime_data" : [],
-      "primitives" : [
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["standard_metadata", "egress_spec"]
-            },
-            {
-              "type" : "hexstr",
-              "value" : "0x00ff"
-            }
-          ],
-          "source_info" : {
-            "filename" : "include/defines.p4",
-            "line" : 28,
-            "column" : 24,
-            "source_fragment" : "255; ..."
-          }
-        }
-      ]
-    },
-    {
       "name" : "_drop",
-      "id" : 3,
+      "id" : 0,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -632,7 +532,7 @@
           "parameters" : [],
           "source_info" : {
             "filename" : "include/actions.p4",
-            "line" : 32,
+            "line" : 24,
             "column" : 4,
             "source_fragment" : "mark_to_drop()"
           }
@@ -641,19 +541,19 @@
     },
     {
       "name" : "NoAction",
-      "id" : 4,
+      "id" : 1,
       "runtime_data" : [],
       "primitives" : []
     },
     {
       "name" : "NoAction",
-      "id" : 5,
+      "id" : 2,
       "runtime_data" : [],
       "primitives" : []
     },
     {
       "name" : "ingress.table0_control.set_next_hop_id",
-      "id" : 6,
+      "id" : 3,
       "runtime_data" : [
         {
           "name" : "next_hop_id",
@@ -683,12 +583,100 @@
       ]
     },
     {
+      "name" : "ingress.table0_control.send_to_cpu",
+      "id" : 4,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["standard_metadata", "egress_spec"]
+            },
+            {
+              "type" : "hexstr",
+              "value" : "0x00ff"
+            }
+          ],
+          "source_info" : {
+            "filename" : "include/defines.p4",
+            "line" : 28,
+            "column" : 24,
+            "source_fragment" : "255; ..."
+          }
+        }
+      ]
+    },
+    {
+      "name" : "ingress.table0_control.set_egress_port",
+      "id" : 5,
+      "runtime_data" : [
+        {
+          "name" : "port",
+          "bitwidth" : 9
+        }
+      ],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["standard_metadata", "egress_spec"]
+            },
+            {
+              "type" : "runtime_data",
+              "value" : 0
+            }
+          ],
+          "source_info" : {
+            "filename" : "include/table0.p4",
+            "line" : 38,
+            "column" : 8,
+            "source_fragment" : "standard_metadata.egress_spec = port"
+          }
+        }
+      ]
+    },
+    {
       "name" : "ingress.host_meter_control.read_meter",
-      "id" : 7,
+      "id" : 6,
       "runtime_data" : [],
       "primitives" : []
     },
     {
+      "name" : "ingress.wcmp_control.set_egress_port",
+      "id" : 7,
+      "runtime_data" : [
+        {
+          "name" : "port",
+          "bitwidth" : 9
+        }
+      ],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["standard_metadata", "egress_spec"]
+            },
+            {
+              "type" : "runtime_data",
+              "value" : 0
+            }
+          ],
+          "source_info" : {
+            "filename" : "include/wcmp.p4",
+            "line" : 31,
+            "column" : 8,
+            "source_fragment" : "standard_metadata.egress_spec = port"
+          }
+        }
+      ]
+    },
+    {
       "name" : "act",
       "id" : 8,
       "runtime_data" : [],
@@ -801,7 +789,7 @@
             "filename" : "include/port_meters.p4",
             "line" : 27,
             "column" : 8,
-            "source_fragment" : "ingress_port_meter.execute_meter<MeterColor_t>((bit<32>)standard_metadata.ingress_port, ingress_color)"
+            "source_fragment" : "ingress_port_meter.execute_meter<MeterColor>((bit<32>)standard_metadata.ingress_port, ingress_color)"
           }
         }
       ]
@@ -857,23 +845,19 @@
           "parameters" : [
             {
               "type" : "field",
-              "value" : ["scalars", "host_meter_control_tmp_1"]
+              "value" : ["scalars", "host_meter_control_meter_tag_0"]
             },
             {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "b2d",
-                  "left" : null,
-                  "right" : {
-                    "type" : "bool",
-                    "value" : true
-                  }
-                }
-              }
+              "type" : "hexstr",
+              "value" : "0x00"
             }
-          ]
+          ],
+          "source_info" : {
+            "filename" : "include/defines.p4",
+            "line" : 31,
+            "column" : 36,
+            "source_fragment" : "8w0; ..."
+          }
         }
       ]
     },
@@ -883,123 +867,11 @@
       "runtime_data" : [],
       "primitives" : [
         {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["scalars", "host_meter_control_tmp_1"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "b2d",
-                  "left" : null,
-                  "right" : {
-                    "type" : "bool",
-                    "value" : false
-                  }
-                }
-              }
-            }
-          ]
-        }
-      ]
-    },
-    {
-      "name" : "act_4",
-      "id" : 13,
-      "runtime_data" : [],
-      "primitives" : [
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["scalars", "host_meter_control_tmp_2"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "b2d",
-                  "left" : null,
-                  "right" : {
-                    "type" : "bool",
-                    "value" : false
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "include/host_meter_table.p4",
-            "line" : 46,
-            "column" : 12,
-            "source_fragment" : "host_meter_table.apply().hit && local_metadata.meter_tag == 2"
-          }
-        }
-      ]
-    },
-    {
-      "name" : "act_5",
-      "id" : 14,
-      "runtime_data" : [],
-      "primitives" : [
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["scalars", "host_meter_control_tmp_2"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "b2d",
-                  "left" : null,
-                  "right" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "==",
-                      "left" : {
-                        "type" : "field",
-                        "value" : ["scalars", "local_metadata_t.meter_tag"]
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0x00000002"
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "include/host_meter_table.p4",
-            "line" : 46,
-            "column" : 12,
-            "source_fragment" : "host_meter_table.apply().hit && local_metadata.meter_tag == 2"
-          }
-        }
-      ]
-    },
-    {
-      "name" : "act_6",
-      "id" : 15,
-      "runtime_data" : [],
-      "primitives" : [
-        {
           "op" : "drop",
           "parameters" : [],
           "source_info" : {
             "filename" : "include/host_meter_table.p4",
-            "line" : 47,
+            "line" : 48,
             "column" : 12,
             "source_fragment" : "mark_to_drop()"
           }
@@ -1007,8 +879,8 @@
       ]
     },
     {
-      "name" : "act_7",
-      "id" : 16,
+      "name" : "act_4",
+      "id" : 13,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -1024,8 +896,8 @@
       ]
     },
     {
-      "name" : "act_8",
-      "id" : 17,
+      "name" : "act_5",
+      "id" : 14,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -1119,14 +991,14 @@
             "filename" : "include/port_meters.p4",
             "line" : 41,
             "column" : 8,
-            "source_fragment" : "egress_port_meter.execute_meter<MeterColor_t>((bit<32>)standard_metadata.egress_port, egress_color)"
+            "source_fragment" : "egress_port_meter.execute_meter<MeterColor>((bit<32>)standard_metadata.egress_port, egress_color)"
           }
         }
       ]
     },
     {
-      "name" : "act_9",
-      "id" : 18,
+      "name" : "act_6",
+      "id" : 15,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -1252,7 +1124,7 @@
           "id" : 3,
           "source_info" : {
             "filename" : "include/table0.p4",
-            "line" : 33,
+            "line" : 41,
             "column" : 10,
             "source_fragment" : "table0"
           },
@@ -1318,17 +1190,40 @@
           "with_counters" : true,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [0, 2, 6, 3],
-          "actions" : ["set_egress_port", "send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"],
-          "base_default_next" : "ingress.host_meter_control.host_meter_table",
+          "action_ids" : [5, 4, 3, 0],
+          "actions" : ["ingress.table0_control.set_egress_port", "ingress.table0_control.send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"],
+          "base_default_next" : "tbl_act_2",
           "next_tables" : {
-            "set_egress_port" : "ingress.host_meter_control.host_meter_table",
-            "send_to_cpu" : "ingress.host_meter_control.host_meter_table",
-            "ingress.table0_control.set_next_hop_id" : "ingress.host_meter_control.host_meter_table",
-            "_drop" : "ingress.host_meter_control.host_meter_table"
+            "ingress.table0_control.set_egress_port" : "tbl_act_2",
+            "ingress.table0_control.send_to_cpu" : "tbl_act_2",
+            "ingress.table0_control.set_next_hop_id" : "tbl_act_2",
+            "_drop" : "tbl_act_2"
           },
           "default_entry" : {
-            "action_id" : 3,
+            "action_id" : 0,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
+          "name" : "tbl_act_2",
+          "id" : 4,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [11],
+          "actions" : ["act_2"],
+          "base_default_next" : "ingress.host_meter_control.host_meter_table",
+          "next_tables" : {
+            "act_2" : "ingress.host_meter_control.host_meter_table"
+          },
+          "default_entry" : {
+            "action_id" : 11,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
@@ -1336,7 +1231,7 @@
         },
         {
           "name" : "ingress.host_meter_control.host_meter_table",
-          "id" : 4,
+          "id" : 5,
           "source_info" : {
             "filename" : "include/host_meter_table.p4",
             "line" : 33,
@@ -1357,44 +1252,21 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : "ingress.host_meter_control.host_meter",
-          "action_ids" : [7, 4],
+          "action_ids" : [6, 1],
           "actions" : ["ingress.host_meter_control.read_meter", "NoAction"],
-          "base_default_next" : null,
+          "base_default_next" : "node_10",
           "next_tables" : {
-            "__HIT__" : "tbl_act_2",
-            "__MISS__" : "tbl_act_3"
+            "ingress.host_meter_control.read_meter" : "node_10",
+            "NoAction" : "node_10"
           },
           "default_entry" : {
-            "action_id" : 4,
+            "action_id" : 1,
             "action_const" : false,
             "action_data" : [],
             "action_entry_const" : false
           }
         },
         {
-          "name" : "tbl_act_2",
-          "id" : 5,
-          "key" : [],
-          "match_type" : "exact",
-          "type" : "simple",
-          "max_size" : 1024,
-          "with_counters" : false,
-          "support_timeout" : false,
-          "direct_meters" : null,
-          "action_ids" : [11],
-          "actions" : ["act_2"],
-          "base_default_next" : "node_11",
-          "next_tables" : {
-            "act_2" : "node_11"
-          },
-          "default_entry" : {
-            "action_id" : 11,
-            "action_const" : true,
-            "action_data" : [],
-            "action_entry_const" : true
-          }
-        },
-        {
           "name" : "tbl_act_3",
           "id" : 6,
           "key" : [],
@@ -1406,9 +1278,9 @@
           "direct_meters" : null,
           "action_ids" : [12],
           "actions" : ["act_3"],
-          "base_default_next" : "node_11",
+          "base_default_next" : "node_12",
           "next_tables" : {
-            "act_3" : "node_11"
+            "act_3" : "node_12"
           },
           "default_entry" : {
             "action_id" : 12,
@@ -1418,80 +1290,11 @@
           }
         },
         {
-          "name" : "tbl_act_4",
-          "id" : 7,
-          "key" : [],
-          "match_type" : "exact",
-          "type" : "simple",
-          "max_size" : 1024,
-          "with_counters" : false,
-          "support_timeout" : false,
-          "direct_meters" : null,
-          "action_ids" : [13],
-          "actions" : ["act_4"],
-          "base_default_next" : "node_14",
-          "next_tables" : {
-            "act_4" : "node_14"
-          },
-          "default_entry" : {
-            "action_id" : 13,
-            "action_const" : true,
-            "action_data" : [],
-            "action_entry_const" : true
-          }
-        },
-        {
-          "name" : "tbl_act_5",
-          "id" : 8,
-          "key" : [],
-          "match_type" : "exact",
-          "type" : "simple",
-          "max_size" : 1024,
-          "with_counters" : false,
-          "support_timeout" : false,
-          "direct_meters" : null,
-          "action_ids" : [14],
-          "actions" : ["act_5"],
-          "base_default_next" : "node_14",
-          "next_tables" : {
-            "act_5" : "node_14"
-          },
-          "default_entry" : {
-            "action_id" : 14,
-            "action_const" : true,
-            "action_data" : [],
-            "action_entry_const" : true
-          }
-        },
-        {
-          "name" : "tbl_act_6",
-          "id" : 9,
-          "key" : [],
-          "match_type" : "exact",
-          "type" : "simple",
-          "max_size" : 1024,
-          "with_counters" : false,
-          "support_timeout" : false,
-          "direct_meters" : null,
-          "action_ids" : [15],
-          "actions" : ["act_6"],
-          "base_default_next" : "node_16",
-          "next_tables" : {
-            "act_6" : "node_16"
-          },
-          "default_entry" : {
-            "action_id" : 15,
-            "action_const" : true,
-            "action_data" : [],
-            "action_entry_const" : true
-          }
-        },
-        {
           "name" : "ingress.wcmp_control.wcmp_table",
-          "id" : 10,
+          "id" : 7,
           "source_info" : {
             "filename" : "include/wcmp.p4",
-            "line" : 30,
+            "line" : 34,
             "column" : 10,
             "source_fragment" : "wcmp_table"
           },
@@ -1510,11 +1313,11 @@
           "with_counters" : true,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [1, 5],
-          "actions" : ["set_egress_port", "NoAction"],
+          "action_ids" : [7, 2],
+          "actions" : ["ingress.wcmp_control.set_egress_port", "NoAction"],
           "base_default_next" : null,
           "next_tables" : {
-            "set_egress_port" : null,
+            "ingress.wcmp_control.set_egress_port" : null,
             "NoAction" : null
           }
         }
@@ -1559,7 +1362,7 @@
             "filename" : "include/port_meters.p4",
             "line" : 28,
             "column" : 12,
-            "source_fragment" : "ingress_color == MeterColor_t.RED"
+            "source_fragment" : "ingress_color == MeterColor_RED"
           },
           "expression" : {
             "type" : "expression",
@@ -1571,7 +1374,7 @@
               },
               "right" : {
                 "type" : "hexstr",
-                "value" : "0x00000002"
+                "value" : "0x02"
               }
             }
           },
@@ -1605,52 +1408,37 @@
           "false_next" : "ingress.table0_control.table0"
         },
         {
-          "name" : "node_11",
+          "name" : "node_10",
           "id" : 2,
-          "expression" : {
-            "type" : "expression",
-            "value" : {
-              "op" : "not",
-              "left" : null,
-              "right" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "d2b",
-                  "left" : null,
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["scalars", "host_meter_control_tmp_1"]
-                  }
-                }
-              }
-            }
+          "source_info" : {
+            "filename" : "include/host_meter_table.p4",
+            "line" : 47,
+            "column" : 12,
+            "source_fragment" : "meter_tag == MeterColor_RED"
           },
-          "true_next" : "tbl_act_4",
-          "false_next" : "tbl_act_5"
-        },
-        {
-          "name" : "node_14",
-          "id" : 3,
           "expression" : {
             "type" : "expression",
             "value" : {
-              "op" : "d2b",
-              "left" : null,
-              "right" : {
+              "op" : "==",
+              "left" : {
                 "type" : "field",
-                "value" : ["scalars", "host_meter_control_tmp_2"]
+                "value" : ["scalars", "host_meter_control_meter_tag_0"]
+              },
+              "right" : {
+                "type" : "hexstr",
+                "value" : "0x02"
               }
             }
           },
-          "true_next" : "tbl_act_6",
-          "false_next" : "node_16"
+          "true_next" : "tbl_act_3",
+          "false_next" : "node_12"
         },
         {
-          "name" : "node_16",
-          "id" : 4,
+          "name" : "node_12",
+          "id" : 3,
           "source_info" : {
             "filename" : "include/wcmp.p4",
-            "line" : 48,
+            "line" : 52,
             "column" : 12,
             "source_fragment" : "local_metadata.next_hop_id != 0"
           },
@@ -1682,11 +1470,11 @@
         "column" : 8,
         "source_fragment" : "egress"
       },
-      "init_table" : "tbl_act_7",
+      "init_table" : "tbl_act_4",
       "tables" : [
         {
-          "name" : "tbl_act_7",
-          "id" : 11,
+          "name" : "tbl_act_4",
+          "id" : 8,
           "key" : [],
           "match_type" : "exact",
           "type" : "simple",
@@ -1694,22 +1482,22 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [17],
-          "actions" : ["act_8"],
-          "base_default_next" : "node_21",
+          "action_ids" : [14],
+          "actions" : ["act_5"],
+          "base_default_next" : "node_17",
           "next_tables" : {
-            "act_8" : "node_21"
+            "act_5" : "node_17"
           },
           "default_entry" : {
-            "action_id" : 17,
+            "action_id" : 14,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
           }
         },
         {
-          "name" : "tbl_act_8",
-          "id" : 12,
+          "name" : "tbl_act_5",
+          "id" : 9,
           "key" : [],
           "match_type" : "exact",
           "type" : "simple",
@@ -1717,22 +1505,22 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [16],
-          "actions" : ["act_7"],
-          "base_default_next" : "node_23",
+          "action_ids" : [13],
+          "actions" : ["act_4"],
+          "base_default_next" : "node_19",
           "next_tables" : {
-            "act_7" : "node_23"
+            "act_4" : "node_19"
           },
           "default_entry" : {
-            "action_id" : 16,
+            "action_id" : 13,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
           }
         },
         {
-          "name" : "tbl_act_9",
-          "id" : 13,
+          "name" : "tbl_act_6",
+          "id" : 10,
           "key" : [],
           "match_type" : "exact",
           "type" : "simple",
@@ -1740,14 +1528,14 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [18],
-          "actions" : ["act_9"],
+          "action_ids" : [15],
+          "actions" : ["act_6"],
           "base_default_next" : null,
           "next_tables" : {
-            "act_9" : null
+            "act_6" : null
           },
           "default_entry" : {
-            "action_id" : 18,
+            "action_id" : 15,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
@@ -1757,13 +1545,13 @@
       "action_profiles" : [],
       "conditionals" : [
         {
-          "name" : "node_21",
-          "id" : 5,
+          "name" : "node_17",
+          "id" : 4,
           "source_info" : {
             "filename" : "include/port_meters.p4",
             "line" : 42,
             "column" : 12,
-            "source_fragment" : "egress_color == MeterColor_t.RED"
+            "source_fragment" : "egress_color == MeterColor_RED"
           },
           "expression" : {
             "type" : "expression",
@@ -1775,16 +1563,16 @@
               },
               "right" : {
                 "type" : "hexstr",
-                "value" : "0x00000002"
+                "value" : "0x02"
               }
             }
           },
-          "true_next" : "tbl_act_8",
-          "false_next" : "node_23"
+          "true_next" : "tbl_act_5",
+          "false_next" : "node_19"
         },
         {
-          "name" : "node_23",
-          "id" : 6,
+          "name" : "node_19",
+          "id" : 5,
           "source_info" : {
             "filename" : "include/packet_io.p4",
             "line" : 37,
@@ -1806,7 +1594,7 @@
             }
           },
           "false_next" : null,
-          "true_next" : "tbl_act_9"
+          "true_next" : "tbl_act_6"
         }
       ]
     }
diff --git a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.p4info b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.p4info
index 8d39c13..7c66b73 100644
--- a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.p4info
+++ b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.p4info
@@ -59,10 +59,10 @@
     match_type: TERNARY
   }
   action_refs {
-    id: 16794308
+    id: 16822046
   }
   action_refs {
-    id: 16829080
+    id: 16783057
   }
   action_refs {
     id: 16777316
@@ -108,7 +108,7 @@
     match_type: EXACT
   }
   action_refs {
-    id: 16794308
+    id: 16796092
   }
   action_refs {
     id: 16800567
@@ -120,25 +120,6 @@
 }
 actions {
   preamble {
-    id: 16794308
-    name: "set_egress_port"
-    alias: "set_egress_port"
-  }
-  params {
-    id: 1
-    name: "port"
-    bitwidth: 9
-  }
-}
-actions {
-  preamble {
-    id: 16829080
-    name: "send_to_cpu"
-    alias: "send_to_cpu"
-  }
-}
-actions {
-  preamble {
     id: 16784184
     name: "_drop"
     alias: "_drop"
@@ -165,11 +146,42 @@
 }
 actions {
   preamble {
+    id: 16783057
+    name: "ingress.table0_control.send_to_cpu"
+    alias: "send_to_cpu"
+  }
+}
+actions {
+  preamble {
+    id: 16822046
+    name: "ingress.table0_control.set_egress_port"
+    alias: "table0_control.set_egress_port"
+  }
+  params {
+    id: 1
+    name: "port"
+    bitwidth: 9
+  }
+}
+actions {
+  preamble {
     id: 16823832
     name: "ingress.host_meter_control.read_meter"
     alias: "read_meter"
   }
 }
+actions {
+  preamble {
+    id: 16796092
+    name: "ingress.wcmp_control.set_egress_port"
+    alias: "wcmp_control.set_egress_port"
+  }
+  params {
+    id: 1
+    name: "port"
+    bitwidth: 9
+  }
+}
 action_profiles {
   preamble {
     id: 285253634
@@ -268,6 +280,11 @@
     name: "ingress_port"
     bitwidth: 9
   }
+  metadata {
+    id: 2
+    name: "_padding"
+    bitwidth: 7
+  }
 }
 controller_packet_metadata {
   preamble {
@@ -280,4 +297,9 @@
     name: "egress_port"
     bitwidth: 9
   }
+  metadata {
+    id: 2
+    name: "_padding"
+    bitwidth: 7
+  }
 }
diff --git a/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json b/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json
index 650ea3a..9a67fcb 100644
--- a/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json
+++ b/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json
@@ -18,7 +18,7 @@
         ["local_metadata_t.l4_dst_port", 16, false],
         ["local_metadata_t.next_hop_id", 16, false],
         ["local_metadata_t.selector", 16, false],
-        ["_padding_3", 6, false]
+        ["_padding_2", 6, false]
       ]
     },
     {
@@ -34,7 +34,7 @@
       "id" : 2,
       "fields" : [
         ["ingress_port", 9, false],
-        ["_padding_0", 7, false]
+        ["_padding", 7, false]
       ]
     },
     {
@@ -208,7 +208,7 @@
         ["mirror_id", 8, false],
         ["flow_id", 16, false],
         ["metadata_len", 8, false],
-        ["_padding_1", 6, false]
+        ["_padding_0", 6, false]
       ]
     },
     {
@@ -235,7 +235,7 @@
         ["egress_rid", 16, false],
         ["checksum_error", 1, false],
         ["recirculate_flag", 32, false],
-        ["_padding_2", 5, false]
+        ["_padding_1", 5, false]
       ]
     }
   ],
@@ -1038,65 +1038,8 @@
   "learn_lists" : [],
   "actions" : [
     {
-      "name" : "set_egress_port",
-      "id" : 0,
-      "runtime_data" : [
-        {
-          "name" : "port",
-          "bitwidth" : 9
-        }
-      ],
-      "primitives" : [
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["standard_metadata", "egress_spec"]
-            },
-            {
-              "type" : "runtime_data",
-              "value" : 0
-            }
-          ],
-          "source_info" : {
-            "filename" : "include/actions.p4",
-            "line" : 28,
-            "column" : 36,
-            "source_fragment" : "port; ..."
-          }
-        }
-      ]
-    },
-    {
-      "name" : "send_to_cpu",
-      "id" : 1,
-      "runtime_data" : [],
-      "primitives" : [
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["standard_metadata", "egress_spec"]
-            },
-            {
-              "type" : "hexstr",
-              "value" : "0x00ff"
-            }
-          ],
-          "source_info" : {
-            "filename" : "include/defines.p4",
-            "line" : 28,
-            "column" : 24,
-            "source_fragment" : "255; ..."
-          }
-        }
-      ]
-    },
-    {
       "name" : "_drop",
-      "id" : 2,
+      "id" : 0,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -1104,7 +1047,7 @@
           "parameters" : [],
           "source_info" : {
             "filename" : "include/actions.p4",
-            "line" : 32,
+            "line" : 24,
             "column" : 4,
             "source_fragment" : "mark_to_drop()"
           }
@@ -1113,7 +1056,7 @@
     },
     {
       "name" : "ingress.table0_control.set_next_hop_id",
-      "id" : 3,
+      "id" : 1,
       "runtime_data" : [
         {
           "name" : "next_hop_id",
@@ -1143,6 +1086,63 @@
       ]
     },
     {
+      "name" : "ingress.table0_control.send_to_cpu",
+      "id" : 2,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["standard_metadata", "egress_spec"]
+            },
+            {
+              "type" : "hexstr",
+              "value" : "0x00ff"
+            }
+          ],
+          "source_info" : {
+            "filename" : "include/defines.p4",
+            "line" : 28,
+            "column" : 24,
+            "source_fragment" : "255; ..."
+          }
+        }
+      ]
+    },
+    {
+      "name" : "ingress.table0_control.set_egress_port",
+      "id" : 3,
+      "runtime_data" : [
+        {
+          "name" : "port",
+          "bitwidth" : 9
+        }
+      ],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["standard_metadata", "egress_spec"]
+            },
+            {
+              "type" : "runtime_data",
+              "value" : 0
+            }
+          ],
+          "source_info" : {
+            "filename" : "include/table0.p4",
+            "line" : 38,
+            "column" : 8,
+            "source_fragment" : "standard_metadata.egress_spec = port"
+          }
+        }
+      ]
+    },
+    {
       "name" : "act",
       "id" : 4,
       "runtime_data" : [],
@@ -6076,7 +6076,7 @@
           "id" : 2,
           "source_info" : {
             "filename" : "include/table0.p4",
-            "line" : 33,
+            "line" : 41,
             "column" : 10,
             "source_fragment" : "table0"
           },
@@ -6142,17 +6142,17 @@
           "with_counters" : true,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [0, 1, 3, 2],
-          "actions" : ["set_egress_port", "send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"],
+          "action_ids" : [3, 2, 1, 0],
+          "actions" : ["ingress.table0_control.set_egress_port", "ingress.table0_control.send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"],
           "base_default_next" : null,
           "next_tables" : {
-            "set_egress_port" : null,
-            "send_to_cpu" : null,
+            "ingress.table0_control.set_egress_port" : null,
+            "ingress.table0_control.send_to_cpu" : null,
             "ingress.table0_control.set_next_hop_id" : null,
             "_drop" : null
           },
           "default_entry" : {
-            "action_id" : 2,
+            "action_id" : 0,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
@@ -6613,9 +6613,9 @@
           "direct_meters" : null,
           "action_ids" : [55],
           "actions" : ["act_2"],
-          "base_default_next" : "node_29",
+          "base_default_next" : "node_28",
           "next_tables" : {
-            "act_2" : "node_29"
+            "act_2" : "node_28"
           },
           "default_entry" : {
             "action_id" : 55,
@@ -6871,38 +6871,12 @@
               }
             }
           },
-          "true_next" : "node_25",
-          "false_next" : "tbl_act_1"
-        },
-        {
-          "name" : "node_25",
-          "id" : 8,
-          "source_info" : {
-            "filename" : "include/int_sink.p4",
-            "line" : 51,
-            "column" : 12,
-            "source_fragment" : "local_metadata.int_meta.sink == 1"
-          },
-          "expression" : {
-            "type" : "expression",
-            "value" : {
-              "op" : "==",
-              "left" : {
-                "type" : "field",
-                "value" : ["userMetadata.int_meta", "sink"]
-              },
-              "right" : {
-                "type" : "hexstr",
-                "value" : "0x01"
-              }
-            }
-          },
           "true_next" : "tbl_process_int_sink_restore_header",
           "false_next" : "tbl_act_1"
         },
         {
-          "name" : "node_29",
-          "id" : 9,
+          "name" : "node_28",
+          "id" : 8,
           "source_info" : {
             "filename" : "include/packet_io.p4",
             "line" : 37,
diff --git a/pipelines/basic/src/main/resources/p4c-out/bmv2/int.p4info b/pipelines/basic/src/main/resources/p4c-out/bmv2/int.p4info
index a3d6b85..93a8646 100644
--- a/pipelines/basic/src/main/resources/p4c-out/bmv2/int.p4info
+++ b/pipelines/basic/src/main/resources/p4c-out/bmv2/int.p4info
@@ -59,10 +59,10 @@
     match_type: TERNARY
   }
   action_refs {
-    id: 16794308
+    id: 16822046
   }
   action_refs {
-    id: 16829080
+    id: 16783057
   }
   action_refs {
     id: 16777316
@@ -310,25 +310,6 @@
 }
 actions {
   preamble {
-    id: 16794308
-    name: "set_egress_port"
-    alias: "set_egress_port"
-  }
-  params {
-    id: 1
-    name: "port"
-    bitwidth: 9
-  }
-}
-actions {
-  preamble {
-    id: 16829080
-    name: "send_to_cpu"
-    alias: "send_to_cpu"
-  }
-}
-actions {
-  preamble {
     id: 16784184
     name: "_drop"
     alias: "_drop"
@@ -348,6 +329,25 @@
 }
 actions {
   preamble {
+    id: 16783057
+    name: "ingress.table0_control.send_to_cpu"
+    alias: "send_to_cpu"
+  }
+}
+actions {
+  preamble {
+    id: 16822046
+    name: "ingress.table0_control.set_egress_port"
+    alias: "set_egress_port"
+  }
+  params {
+    id: 1
+    name: "port"
+    bitwidth: 9
+  }
+}
+actions {
+  preamble {
     id: 16800567
     name: "NoAction"
     alias: "NoAction"
@@ -782,6 +782,11 @@
     name: "ingress_port"
     bitwidth: 9
   }
+  metadata {
+    id: 2
+    name: "_padding"
+    bitwidth: 7
+  }
 }
 controller_packet_metadata {
   preamble {
@@ -794,4 +799,9 @@
     name: "egress_port"
     bitwidth: 9
   }
+  metadata {
+    id: 2
+    name: "_padding"
+    bitwidth: 7
+  }
 }