Files
TransPyC/lib/constants/config.py
T
TermiNexus 5680592f37 feat(tpc): 新增 --func-hotspot 函数热点统计,Ctrl+C 时落盘
启用后为每个函数定义生成 internal i64 计数器并在入口递增;各模块 Ctrl+C 处理器以追加方式写最终文件(含 main 的模块启动时清空一次),经 llvm.global_ctors 自注册;未传参数时零影响。
2026-09-13 17:50:01 +08:00

46 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 常量定义
from __future__ import annotations
DEFAULT_INPUT_FILE: str = 'test.vp'
DEFAULT_OUTPUT_FILE: str = 'test.ll'
SLICE_THRESHOLD: int = 50
SLICE_LEVEL_DEFAULT: int = 3
SLICE_LEVELS: dict[int | str, str] = {
0: 'no_optimize',
1: 'conservative',
2: 'moderate',
3: 'aggressive',
's': 'size',
}
DEFAULT_COMPILE_COMMAND: str = 'gcc'
DEFAULT_COMPILE_FLAGS: str = ''
DEFAULT_METADATA: dict[str, str] = {
'PROJECT_NAME': 'TransPyC Project',
'AUTHOR': 'TransPyC Team',
'VERSION': '1.0.0',
'DESCRIPTION': 'Auto-generated LLVM IR file',
'COPYRIGHT_YEAR': '2026',
'COPYRIGHT_HOLDER': 'Galactic Vorpal Software Development Studio (e.g. GVSDS Inc.)'
}
ERROR_MESSAGES: dict[str, str] = {
'MISSING_ARGS': 'Missing required arguments -f and/or -o',
'UNKNOWN_ARG': 'Unknown argument',
'UNSUPPORTED_TYPE': 'Unsupported file type',
'FAILED_PARSE': 'Failed to parse file',
'COMPILE_FAILED': 'Compilation or execution failed'
}
HELP_MESSAGE: str = '''
Usage: python TransPyC.py -f InputFile -o OutputFile [-wh header_files] [-debug DebugFile]
[-cc compile_command] [-cflags CompileFlags] [-run] [-args RunArgs] [-h HelperFiles]
[-func-hotspot HotFile]
-h: Specify helper files (C or Python) to help identify structs, functions, variables, and ptrs
-func-hotspot: 统计各函数调用次数,Ctrl+C 退出时写入 HotFile(每行 "函数名 计数")
'''
mode: str = "strict"