[LLD][COFF] Emit tail merge pdata for delay load thunks on ARM64EC (#116810)
[llvm-project.git] / bolt / utils / dot2html / dot2html.py
blob0b70fd18585ca23bf4d3adf87c96ea7118efaf26
1 #!/usr/bin/env python3
2 import argparse
3 import os
4 import sys
6 BASE_PATH = os.path.dirname(os.path.abspath(__file__))
7 HTML_TEMPLATE_NAME = "d3-graphviz-template.html"
8 HTML_TEMPLATE_PATH = os.path.join(BASE_PATH, HTML_TEMPLATE_NAME)
11 def main():
12 parser = argparse.ArgumentParser()
13 parser.add_argument(
14 "dotfile",
15 nargs="?",
16 type=argparse.FileType("r"),
17 default=sys.stdin,
18 help="Input .dot file, reads from stdin if not set",
20 parser.add_argument(
21 "htmlfile",
22 nargs="?",
23 type=argparse.FileType("w"),
24 default=sys.stdout,
25 help="Output .html file, writes to stdout if not set",
27 args = parser.parse_args()
29 template = open(HTML_TEMPLATE_PATH, "r")
31 for line in template:
32 if "<INSERT_DOT>" in line:
33 print(args.dotfile.read(), file=args.htmlfile, end="")
34 else:
35 print(line, file=args.htmlfile, end="")
38 if __name__ == "__main__":
39 main()