2
0

tcg_helper_h.py 1.3 KB

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