These changes are the raw update to qemu-2.6.
[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-2016, 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 import tracetool.vcpu
19
20
21 def generate(events, backend):
22     events = [e for e in events
23               if "disable" not in e.properties]
24
25     out('/* This file is autogenerated by tracetool, do not edit. */',
26         '',
27         )
28
29     for e in events:
30         if "tcg-exec" not in e.properties:
31             continue
32
33         # TCG helper proxy declaration
34         fmt = "DEF_HELPER_FLAGS_%(argc)d(%(name)s, %(flags)svoid%(types)s)"
35         e_args = tracetool.vcpu.transform_args("tcg_helper_c", e.original, "header")
36         args = e_args.transform(HOST_2_TCG_COMPAT, HOST_2_TCG,
37                                 TCG_2_TCG_HELPER_DECL)
38         types = ", ".join(args.types())
39         if types != "":
40             types = ", " + types
41
42         flags = "TCG_CALL_NO_RWG, "
43
44         out(fmt,
45             flags=flags,
46             argc=len(args),
47             name=e.api() + "_proxy",
48             types=types,
49             )