moved firmext code into the backend dir
[libfirm] / ir / be / grgen / matchplan.c
1
2 /*
3  * Project:     libFIRM/extension module/GRS-matcher
4  * File name:   ext/grs/plan.h
5  * Purpose:     provides an interface for search planers planing
6  *                              the matching process with respect to information
7  *                              provided by appropriate analyzers
8  * Author:      Veit Batz
9  * Modified by: Andreas Schoesser
10  * Created:             16. August 2005
11  * CVS-ID:      $Id$
12  * Copyright:   (c) 2005 Universität Karlsruhe
13  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
14  */
15
16
17
18 #include "matchplan_t.h"
19
20
21 /**dump a search plans to stdout */
22 void ext_grs_dump_match_plan(ext_grs_match_plan_t *plan) {
23         int i, j;
24
25         printf("\nA plan for action %s: \n", plan->action->name);
26
27         for(j = 0; j < plan->num_progs; j++)
28         {
29                 if(j == 0)
30                         printf("Positive plan:\n");
31                 else
32                         printf("NAC plan %d:\n", j - 1);
33
34                 for (i = 0; i < plan->length[j]; i++) {
35                         ext_grs_match_op_t *mop;
36                         mop = & plan->progs[j][i];
37                         switch(mop->kind)
38                         {
39                         case ext_grs_k_mop_node:
40                                 printf("  node(%s)\n", mop->node->name);
41                                 break;
42                         case ext_grs_k_mop_edge:
43                                 printf("  edge(%s, %s)\n", mop->node->name, mop->edge->name);
44                                 break;
45                         case ext_grs_k_mop_condition:
46                                 printf("  condition\n");
47                                 break;
48                         case ext_grs_k_mop_preset:
49                                 printf("  preset_node(%s)\n", mop->node->name);
50                                 break;
51                         case ext_grs_k_mop_preset_edge:
52                                 printf("  preset_edge(%s, %s)\n", mop->node->name, mop->edge->name);
53                                 break;
54                         default:
55                                 printf("  invalid matcher op\n");
56                                 break;
57                         }
58                 }
59         }
60 }
61
62 /** initialize a planer */
63 void ext_grs_init_planer(ext_grs_planer_t *planer, ext_grs_analyzer_t *alz) {
64         planer->init(planer, alz);
65 }
66
67 /** compute a match plan */
68 ext_grs_match_plan_t *ext_grs_compute_plan(
69         ext_grs_planer_t *planer, ir_graph *irg, ext_grs_action_t *act)
70 {
71         return planer->compute_plan(planer, irg, act);
72 }