Merge remote-tracking branch 'remotes/elmarco/tags/slirp-pull-request' into staging
[qemu.git] / scripts / tracetool / format / tcg_helper_h.py
1 # -*- coding: utf-8 -*-
2
3 """
4 Generate trace/generated-helpers.h.
5 """
6
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"
10
11 __maintainer__ = "Stefan Hajnoczi"
12 __email__ = "stefanha@linux.vnet.ibm.com"
13
14
15 from tracetool import out
16 from tracetool.transform import *
17 import tracetool.vcpu
18
19
20 def generate(events, backend, group):
21 events = [e for e in events
22 if "disable" not in e.properties]
23
24 out('/* This file is autogenerated by tracetool, do not edit. */',
25 '',
26 )
27
28 for e in events:
29 if "tcg-exec" not in e.properties:
30 continue
31
32 # TCG helper proxy declaration
33 fmt = "DEF_HELPER_FLAGS_%(argc)d(%(name)s, %(flags)svoid%(types)s)"
34 e_args = tracetool.vcpu.transform_args("tcg_helper_c", e.original, "header")
35 args = e_args.transform(HOST_2_TCG_COMPAT, HOST_2_TCG,
36 TCG_2_TCG_HELPER_DECL)
37 types = ", ".join(args.types())
38 if types != "":
39 types = ", " + types
40
41 flags = "TCG_CALL_NO_RWG, "
42
43 out(fmt,
44 flags=flags,
45 argc=len(args),
46 name=e.api() + "_proxy",
47 types=types,
48 )