tcg_helper_h.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # -*- coding: utf-8 -*-
  2. """
  3. Generate trace/generated-helpers.h.
  4. """
  5. __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
  6. __copyright__ = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
  7. __license__ = "GPL version 2 or (at your option) any later version"
  8. __maintainer__ = "Stefan Hajnoczi"
  9. __email__ = "stefanha@redhat.com"
  10. from tracetool import out
  11. from tracetool.transform import *
  12. import tracetool.vcpu
  13. def generate(events, backend, group):
  14. events = [e for e in events
  15. if "disable" not in e.properties]
  16. out('/* This file is autogenerated by tracetool, do not edit. */',
  17. '',
  18. )
  19. for e in events:
  20. if "tcg-exec" not in e.properties:
  21. continue
  22. # TCG helper proxy declaration
  23. fmt = "DEF_HELPER_FLAGS_%(argc)d(%(name)s, %(flags)svoid%(types)s)"
  24. e_args = tracetool.vcpu.transform_args("tcg_helper_c", e.original, "header")
  25. args = e_args.transform(HOST_2_TCG_COMPAT, HOST_2_TCG,
  26. TCG_2_TCG_HELPER_DECL)
  27. types = ", ".join(args.types())
  28. if types != "":
  29. types = ", " + types
  30. flags = "TCG_CALL_NO_RWG, "
  31. out(fmt,
  32. flags=flags,
  33. argc=len(args),
  34. name=e.api() + "_proxy",
  35. types=types,
  36. )