1 # -*- coding: utf-8 -*-
4 Generate trace/generated-helpers-wrappers.h.
7 __author__
= "Lluís Vilanova <vilanova@ac.upc.edu>"
8 __copyright__
= "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
9 __license__
= "GPL version 2 or (at your option) any later version"
11 __maintainer__
= "Stefan Hajnoczi"
12 __email__
= "stefanha@redhat.com"
15 from tracetool
import out
16 from tracetool
.transform
import *
20 def generate(events
, backend
, group
):
21 events
= [e
for e
in events
22 if "disable" not in e
.properties
]
24 out('/* This file is autogenerated by tracetool, do not edit. */',
26 '#define tcg_temp_new_nop(v) (v)',
27 '#define tcg_temp_free_nop(v)',
32 if "tcg-exec" not in e
.properties
:
35 # tracetool.generate always transforms types to host
36 e_args
= tracetool
.vcpu
.transform_args("tcg_helper_c", e
.original
, "wrapper")
38 # mixed-type to TCG helper bridge
39 args_tcg_compat
= e_args
.transform(HOST_2_TCG_COMPAT
)
42 "%(tcg_type)s __%(name)s = %(tcg_func)s(%(name)s);" %
43 {"tcg_type": transform_type(type_
, HOST_2_TCG
),
44 "tcg_func": transform_type(type_
, HOST_2_TCG_TMP_NEW
),
46 for (type_
, name
) in args_tcg_compat
50 "%(tcg_func)s(__%(name)s);" %
51 {"tcg_func": transform_type(type_
, HOST_2_TCG_TMP_FREE
),
53 for (type_
, name
) in args_tcg_compat
56 gen_name
= "gen_helper_" + e
.api()
58 out('static inline void %(name)s(%(args)s)',
61 ' %(proxy_name)s(%(tmp_names)s);',
66 proxy_name
=gen_name
+ "_proxy",
67 code_new
="\n ".join(code_new
),
68 code_free
="\n ".join(code_free
),
69 tmp_names
=", ".join(["__%s" % name
for _
, name
in e_args
]),