46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
# LLVM 代码生成器主类
|
||
# 通过 Mixin 模式组合各功能模块,保持向后兼容的导入路径
|
||
#
|
||
# 拆分后的模块位于 lib/core/LLVMCG/ 目录下:
|
||
# - BaseGen.py: __init__、平台解析、名称修饰、函数查找
|
||
# - TypeConvert.py: 类型转换(CType -> LLVM IR)
|
||
# - StructGen.py: 结构体生成(struct/vtable)
|
||
# - MemoryOps.py: 内存操作(alloca/Load/store)
|
||
# - ExprGen.py: 表达式生成(常量、二元运算、返回)
|
||
# - FuncGen.py: 函数处理(参数调整、成员偏移)
|
||
# - VaArg.py: 变长参数处理
|
||
from __future__ import annotations
|
||
|
||
from lib.core.LLVMCG.BaseGen import BaseGenMixin
|
||
from lib.core.LLVMCG.TypeConvert import TypeConvertMixin
|
||
from lib.core.LLVMCG.StructGen import StructGenMixin
|
||
from lib.core.LLVMCG.MemoryOps import MemoryOpsMixin
|
||
from lib.core.LLVMCG.ExprGen import ExprGenMixin
|
||
from lib.core.LLVMCG.FuncGen import FuncGenMixin
|
||
from lib.core.LLVMCG.VaArg import VaArgMixin
|
||
|
||
# from lib.core.Translator.LlvmGenerator import LlvmGeneratorMixin
|
||
|
||
|
||
class LlvmCodeGenerator(
|
||
BaseGenMixin,
|
||
TypeConvertMixin,
|
||
StructGenMixin,
|
||
MemoryOpsMixin,
|
||
ExprGenMixin,
|
||
FuncGenMixin,
|
||
VaArgMixin,
|
||
):
|
||
"""LLVM IR 代码生成器
|
||
|
||
通过 Mixin 模式组合各功能模块。
|
||
实际方法实现分布在 lib/core/LLVMCG/ 下的各模块中。
|
||
"""
|
||
#builder: ir.IRBuilder = None
|
||
#_Trans: LlvmGeneratorMixin = None
|
||
pass
|
||
|
||
|
||
# 向后兼容:重新导出常量和辅助类
|
||
__all__: list[str] = ['LlvmCodeGenerator', 'VaArgInstruction']
|