Add qemu 2.4.0
[kvmfornfv.git] / qemu / scripts / tracetool / format / tcg_h.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 """
5 Generate .h file for TCG code generation.
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
18
19 def generate(events, backend):
20     out('/* This file is autogenerated by tracetool, do not edit. */',
21         '/* You must include this file after the inclusion of helper.h */',
22         '',
23         '#ifndef TRACE__GENERATED_TCG_TRACERS_H',
24         '#define TRACE__GENERATED_TCG_TRACERS_H',
25         '',
26         '#include <stdint.h>',
27         '',
28         '#include "trace.h"',
29         '#include "exec/helper-proto.h"',
30         '',
31         )
32
33     for e in events:
34         # just keep one of them
35         if "tcg-trans" not in e.properties:
36             continue
37
38         # get the original event definition
39         e = e.original.original
40
41         out('static inline void %(name_tcg)s(%(args)s)',
42             '{',
43             name_tcg=e.api(e.QEMU_TRACE_TCG),
44             args=e.args)
45
46         if "disable" not in e.properties:
47             out('    %(name_trans)s(%(argnames_trans)s);',
48                 '    gen_helper_%(name_exec)s(%(argnames_exec)s);',
49                 name_trans=e.event_trans.api(e.QEMU_TRACE),
50                 name_exec=e.event_exec.api(e.QEMU_TRACE),
51                 argnames_trans=", ".join(e.event_trans.args.names()),
52                 argnames_exec=", ".join(e.event_exec.args.names()))
53
54         out('}')
55
56     out('',
57         '#endif /* TRACE__GENERATED_TCG_TRACERS_H */')