Lluís Vilanova | 707c8a9 | 2014-05-30 14:11:50 +0200 | [diff] [blame] | 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>" |
Lluís Vilanova | 3d211d9 | 2016-02-25 17:43:38 +0100 | [diff] [blame] | 9 | __copyright__ = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>" |
Lluís Vilanova | 707c8a9 | 2014-05-30 14:11:50 +0200 | [diff] [blame] | 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 * |
Lluís Vilanova | 3d211d9 | 2016-02-25 17:43:38 +0100 | [diff] [blame] | 18 | import tracetool.vcpu |
Lluís Vilanova | 707c8a9 | 2014-05-30 14:11:50 +0200 | [diff] [blame] | 19 | |
| 20 | |
Daniel P. Berrange | 80dd5c4 | 2016-10-04 14:35:59 +0100 | [diff] [blame] | 21 | def generate(events, backend, group): |
Lluís Vilanova | 707c8a9 | 2014-05-30 14:11:50 +0200 | [diff] [blame] | 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 | |
Lluís Vilanova | 707c8a9 | 2014-05-30 14:11:50 +0200 | [diff] [blame] | 33 | # TCG helper proxy declaration |
| 34 | fmt = "DEF_HELPER_FLAGS_%(argc)d(%(name)s, %(flags)svoid%(types)s)" |
Lluís Vilanova | 3d211d9 | 2016-02-25 17:43:38 +0100 | [diff] [blame] | 35 | e_args = tracetool.vcpu.transform_args("tcg_helper_c", e.original, "header") |
Lluís Vilanova | 707c8a9 | 2014-05-30 14:11:50 +0200 | [diff] [blame] | 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 | ) |