2
0

tcg_helper_h.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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-2014, 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. def generate(events, backend):
  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. # tracetool.generate always transforms types to host
  23. e_args = e.original.args
  24. # TCG helper proxy declaration
  25. fmt = "DEF_HELPER_FLAGS_%(argc)d(%(name)s, %(flags)svoid%(types)s)"
  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. )