Add qemu 2.4.0
[kvmfornfv.git] / qemu / scripts / tracetool / format / tcg_helper_h.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 """
5 Generate trace/generated-helpers.h.
6 """
7
8 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
9 __copyright__  = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
10 __license__    = "GPL version 2 or (at your option) any later version"
11
12 __maintainer__ = "Stefan Hajnoczi"
13 __email__      = "stefanha@linux.vnet.ibm.com"
14
15
16 from tracetool import out
17 from tracetool.transform import *
18
19
20 def generate(events, backend):
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         # tracetool.generate always transforms types to host
33         e_args = e.original.args
34
35         # TCG helper proxy declaration
36         fmt = "DEF_HELPER_FLAGS_%(argc)d(%(name)s, %(flags)svoid%(types)s)"
37         args = e_args.transform(HOST_2_TCG_COMPAT, HOST_2_TCG,
38                                 TCG_2_TCG_HELPER_DECL)
39         types = ", ".join(args.types())
40         if types != "":
41             types = ", " + types
42
43         flags = "TCG_CALL_NO_RWG, "
44
45         out(fmt,
46             flags=flags,
47             argc=len(args),
48             name=e.api() + "_proxy",
49             types=types,
50             )