4 /*******************************************************************************
5 * The software programs comprising "CGRA-ME" and the documentation provided
6 * with them are copyright by its authors and the University of Toronto. Only
7 * non-commercial, not-for-profit use of this software is permitted without ex-
8 * plicit permission. This software is provided "as is" with no warranties or
9 * guarantees of support. See the LICENCE for more details. You should have re-
10 * ceived a copy of the full licence along with this software. If not, see
11 * <http://cgra-me.ece.utoronto.ca/license/>.
12 ******************************************************************************/
22 dir = os.path.dirname(os.path.realpath(
"__file__"))
23 input_src_path = os.path.join(dir, input_source)
24 output_src_path = os.path.join(dir, output_source)
25 output_tag_path = os.path.join(dir, output_tag)
27 input_src_f = open(input_src_path,
'r')
28 output_src_f = open(output_src_path,
'w')
29 output_tag_f = open(output_tag_path,
'w')
31 tag_string =
"//DFGLoop:"
34 output_src_f.write(
"__attribute__((noinline)) void DFGLOOP_TAG(int index);\n")
36 for line
in input_src_f:
37 tag_loc = line.find(tag_string)
39 tag_name = line[tag_loc + len(tag_string) : -1].strip()
40 output_tag_f.write(str(tag_count) +
' ' + tag_name +
'\n')
41 output_src_f.write(
"DFGLOOP_TAG(" + str(tag_count) +
");\n")
44 output_src_f.write(line)
51 if __name__ ==
"__main__":