"""
Auto-generated Python stub file from llvmlite.__module.py
Module: llvmlite.__module
"""


import t, c
from stdint import *
import string
import stdio
import viperlib
import memhub
from linkedlist import GSList, GSListNode
from .__types import LLVMType, TypePrint, Array, PrintStructDefinition, get_struct_name, Struct
from .__function import Function, FunctionPrint, _ll_name_needs_quote, Param

@t.NoVTable
class GlobalVariable(GSListNode[GlobalVariable]):
    Name: t.CChar | t.CPtr
    Ty: LLVMType | t.CPtr
    Initializer: t.CVoid | t.CPtr
    IsConstant: t.CInt
    Linkage: t.CChar | t.CPtr
    Section: t.CChar | t.CPtr
    UnnamedAddr: t.CInt
@t.NoVTable
class NamedTypeNode(GSListNode[NamedTypeNode]):
    Ty: LLVMType | t.CPtr
@t.NoVTable
class LLVMModule:
    Name: t.CChar | t.CPtr
    FuncHead: Function | t.CPtr
    FuncTail: Function | t.CPtr
    FuncCount: t.CSizeT
    GlobalHead: GlobalVariable | t.CPtr
    GlobalTail: GlobalVariable | t.CPtr
    GlobalCount: t.CSizeT
    TargetTriple: t.CChar | t.CPtr
    DataLayout: t.CChar | t.CPtr
    NamedTypeHead: NamedTypeNode | t.CPtr
    NamedTypeTail: NamedTypeNode | t.CPtr
    NamedTypeCount: t.CSizeT

def new_module(pool: memhub.MemBuddy | t.CPtr, name: t.CChar | t.CPtr) -> LLVMModule | t.CPtr: pass


GV_SIZE: t.CDefine = 64
NAMED_TYPE_NODE_SIZE: t.CDefine = 16

def new_global_variable(pool: memhub.MemBuddy | t.CPtr, name: t.CChar | t.CPtr, ty: LLVMType | t.CPtr) -> GlobalVariable | t.CPtr: pass

def module_add_function(mod: LLVMModule | t.CPtr, func: Function | t.CPtr) -> t.CInt: pass

def module_add_global(mod: LLVMModule | t.CPtr, gv: GlobalVariable | t.CPtr) -> t.CInt: pass

def module_set_target(mod: LLVMModule | t.CPtr, triple: t.CChar | t.CPtr) -> t.CInt: pass

def module_set_datalayout(mod: LLVMModule | t.CPtr, layout: t.CChar | t.CPtr) -> t.CInt: pass

def module_add_named_type(mod: LLVMModule | t.CPtr, pool: memhub.MemBuddy | t.CPtr, ty: LLVMType | t.CPtr) -> t.CInt: pass

def _is_type_defined_in_module(mod: LLVMModule | t.CPtr, name: t.CChar | t.CPtr) -> int: pass

def _scan_type_for_cross_module_refs(pool: memhub.MemBuddy | t.CPtr, mod: LLVMModule | t.CPtr, ty: LLVMType | t.CPtr) -> t.CInt: pass

def module_ensure_opaque_for_type(mod: LLVMModule | t.CPtr, pool: memhub.MemBuddy | t.CPtr, ty: LLVMType | t.CPtr) -> t.CInt: pass

def global_set_constant(gv: GlobalVariable | t.CPtr, is_const: t.CInt) -> t.CInt: pass

def global_set_linkage(gv: GlobalVariable | t.CPtr, linkage: t.CChar | t.CPtr) -> t.CInt: pass

def global_set_unnamed_addr(gv: GlobalVariable | t.CPtr, level: t.CInt) -> t.CInt: pass

def global_set_section(gv: GlobalVariable | t.CPtr, section: t.CChar | t.CPtr) -> t.CInt: pass


OUTPUT_FULL: t.CDefine = 0   # 完整 IR（stub + text）
OUTPUT_STUB: t.CDefine = 1   # 仅声明（header + 类型定义 + declare + external global）
OUTPUT_TEXT: t.CDefine = 2   # 仅代码（define + global 带初值）

def LLVMModulePrint(buf: t.CChar | t.CPtr, size: t.CSizeT, mod: LLVMModule | t.CPtr, pool: memhub.MemBuddy | t.CPtr, mode: t.CInt) -> t.CInt: pass

def _print_global(buf: t.CChar | t.CPtr, size: t.CSizeT, gv: GlobalVariable | t.CPtr, pool: memhub.MemBuddy | t.CPtr) -> t.CInt: pass

def _print_global_stub(buf: t.CChar | t.CPtr, size: t.CSizeT, gv: GlobalVariable | t.CPtr, pool: memhub.MemBuddy | t.CPtr) -> t.CInt: pass

def _append_cstr(dst: t.CChar | t.CPtr, dst_size: t.CSizeT, src: t.CChar | t.CPtr) -> t.CInt: pass
