blob: 6b184b641b565d66e1f48ed2fbe9cafa2e689e72 [file] [log] [blame]
Lluís Vilanova707c8a92014-05-30 14:11:50 +02001#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""
5Generate trace/generated-helpers.h.
6"""
7
8__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
Lluís Vilanova3d211d92016-02-25 17:43:38 +01009__copyright__ = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
Lluís Vilanova707c8a92014-05-30 14:11:50 +020010__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
16from tracetool import out
17from tracetool.transform import *
Lluís Vilanova3d211d92016-02-25 17:43:38 +010018import tracetool.vcpu
Lluís Vilanova707c8a92014-05-30 14:11:50 +020019
20
Daniel P. Berrange80dd5c42016-10-04 14:35:59 +010021def generate(events, backend, group):
Lluís Vilanova707c8a92014-05-30 14:11:50 +020022 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
Lluís Vilanova707c8a92014-05-30 14:11:50 +020033 # TCG helper proxy declaration
34 fmt = "DEF_HELPER_FLAGS_%(argc)d(%(name)s, %(flags)svoid%(types)s)"
Lluís Vilanova3d211d92016-02-25 17:43:38 +010035 e_args = tracetool.vcpu.transform_args("tcg_helper_c", e.original, "header")
Lluís Vilanova707c8a92014-05-30 14:11:50 +020036 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 )