コード例 #1
0
    def test_passes(self):
        """Dump passes in different FlowControllerLinear"""
        passmanager = PassManager()
        passmanager.log_passes = True
        passmanager.append(PassC_TP_RA_PA())
        passmanager.append(PassB_TP_RA_PA())

        self.assertPassLog(
            passmanager,
            ['PassA_TP_NR_NP', 'PassC_TP_RA_PA', 'PassB_TP_RA_PA'])
コード例 #2
0
 def test_control_flow_plugin(self):
     """ Dump passes in a custom flow controller. """
     passmanager = PassManager()
     FlowController.add_flow_controller('do_x_times', DoXTimesController)
     passmanager.append(
         [PassB_TP_RA_PA(), PassC_TP_RA_PA()], do_x_times=lambda x: 3)
     passmanager.log_passes = True
     self.assertPassLog(passmanager, [
         'PassA_TP_NR_NP', 'PassB_TP_RA_PA', 'PassC_TP_RA_PA',
         'PassB_TP_RA_PA', 'PassC_TP_RA_PA', 'PassB_TP_RA_PA',
         'PassC_TP_RA_PA'
     ])
コード例 #3
0
    def test_passes_in_linear(self):
        """Dump passes in the same FlowControllerLinear"""
        passmanager = PassManager(passes=[
            PassC_TP_RA_PA(),
            PassB_TP_RA_PA(),
            PassD_TP_NR_NP(argument1=[1, 2]),
            PassB_TP_RA_PA()
        ])
        passmanager.log_passes = True

        self.assertPassLog(passmanager, [
            'PassA_TP_NR_NP', 'PassC_TP_RA_PA', 'PassB_TP_RA_PA',
            'PassD_TP_NR_NP', 'PassA_TP_NR_NP', 'PassB_TP_RA_PA'
        ])
コード例 #4
0
 def test_conditional_and_loop(self):
     """ Dump passes with a conditional and a loop"""
     passmanager = PassManager()
     passmanager.append(PassE_AP_NR_NP(True))
     passmanager.append([
         PassK_check_fixed_point_property(),
         PassA_TP_NR_NP(),
         PassF_reduce_dag_property()
     ],
                        do_while=lambda property_set: not property_set[
                            'property_fixed_point'],
                        condition=lambda property_set: property_set[
                            'property_fixed_point'])
     passmanager.log_passes = True
     self.assertPassLog(passmanager, ['PassE_AP_NR_NP'])