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


import t, c
from stdint import *
import string
import viperlib
import memhub
from linkedlist import GSListNode, GSList
from .__types import LLVMType, TypePrint
from .__values import Value, new_value, SSAValue
from .__function import Function, BasicBlock, block_append_text, function_move_block_to_end, _ll_name_needs_quote

class IRBuilder:
    Pool: memhub.MemBuddy | t.CPtr
    Func: Function | t.CPtr
    CurBlock: BasicBlock | t.CPtr
    Counter: t.CInt

BUILDER_SIZE: t.CDefine = 32

def new_builder(pool: memhub.MemBuddy | t.CPtr, func: Function | t.CPtr) -> IRBuilder | t.CPtr: pass

def position_at_end(builder: IRBuilder | t.CPtr, block: BasicBlock | t.CPtr) -> t.CInt: pass

def _alloc_ssa_name(builder: IRBuilder | t.CPtr) -> t.CChar | t.CPtr: pass

def _type_str(builder: IRBuilder | t.CPtr, ty: LLVMType | t.CPtr) -> t.CChar | t.CPtr: pass

def _emit(builder: IRBuilder | t.CPtr, text: t.CChar | t.CPtr) -> t.CInt: pass

def _mark_terminated(builder: IRBuilder | t.CPtr) -> t.CInt: pass

def builder_cur_block_is_terminated(builder: IRBuilder | t.CPtr) -> t.CInt: pass

def build_alloca(builder: IRBuilder | t.CPtr, ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_load(builder: IRBuilder | t.CPtr, ty: LLVMType | t.CPtr, ptr: Value | t.CPtr) -> Value | t.CPtr: pass

def build_store(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, ptr: Value | t.CPtr) -> t.CInt: pass

def build_add(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_sub(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_mul(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_sdiv(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_udiv(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_srem(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_urem(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_and(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_or(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_xor(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_shl(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_lshr(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_ashr(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_fadd(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_fsub(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_fmul(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_fdiv(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_frem(builder: IRBuilder | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_fneg(builder: IRBuilder | t.CPtr, val: Value | t.CPtr) -> Value | t.CPtr: pass

def _build_binop(builder: IRBuilder | t.CPtr, op: t.CChar | t.CPtr, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass


ICMP_EQ:  t.CDefine = 0
ICMP_NE:  t.CDefine = 1
ICMP_SGT: t.CDefine = 2
ICMP_SGE: t.CDefine = 3
ICMP_SLT: t.CDefine = 4
ICMP_SLE: t.CDefine = 5
ICMP_UGT: t.CDefine = 6
ICMP_UGE: t.CDefine = 7
ICMP_ULT: t.CDefine = 8
ICMP_ULE: t.CDefine = 9
FCMP_FALSE: t.CDefine = 0
FCMP_OEQ:   t.CDefine = 1
FCMP_OGT:   t.CDefine = 2
FCMP_OGE:   t.CDefine = 3
FCMP_OLT:   t.CDefine = 4
FCMP_OLE:   t.CDefine = 5
FCMP_ONE:   t.CDefine = 6
FCMP_ORD:   t.CDefine = 7
FCMP_UNO:   t.CDefine = 8
FCMP_UEQ:   t.CDefine = 9
FCMP_UGT:   t.CDefine = 10
FCMP_UGE:   t.CDefine = 11
FCMP_ULT:   t.CDefine = 12
FCMP_ULE:   t.CDefine = 13
FCMP_UNE:   t.CDefine = 14
FCMP_TRUE:  t.CDefine = 15

def _icmp_pred_str(pred: t.CInt) -> t.CChar | t.CPtr: pass

def _fcmp_pred_str(pred: t.CInt) -> t.CChar | t.CPtr: pass

def build_icmp(builder: IRBuilder | t.CPtr, pred: t.CInt, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_fcmp(builder: IRBuilder | t.CPtr, pred: t.CInt, lhs: Value | t.CPtr, rhs: Value | t.CPtr) -> Value | t.CPtr: pass

def build_br(builder: IRBuilder | t.CPtr, target: BasicBlock | t.CPtr) -> t.CInt: pass

def build_cond_br(builder: IRBuilder | t.CPtr, cond: Value | t.CPtr, then_blk: BasicBlock | t.CPtr, else_blk: BasicBlock | t.CPtr) -> t.CInt: pass

def build_ret(builder: IRBuilder | t.CPtr, val: Value | t.CPtr) -> t.CInt: pass

def build_ret_void(builder: IRBuilder | t.CPtr) -> t.CInt: pass

def build_call(builder: IRBuilder | t.CPtr, callee: t.CChar | t.CPtr, args: Value | t.CPtr, arg_count: t.CInt, ret_ty: LLVMType | t.CPtr, is_variadic: t.CInt) -> Value | t.CPtr: pass

def build_call_indirect(builder: IRBuilder | t.CPtr, callee_val: Value | t.CPtr, args: Value | t.CPtr, arg_count: t.CInt, ret_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_bitcast(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_sext(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_trunc(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_zext(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_ptrtoint(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_inttoptr(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_fpext(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_fptrunc(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_fp2si(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_si2fp(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_fp2ui(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_ui2fp(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, to_ty: LLVMType | t.CPtr) -> Value | t.CPtr: pass

def build_gep(builder: IRBuilder | t.CPtr, elem_ty: LLVMType | t.CPtr, ptr: Value | t.CPtr, idx: Value | t.CPtr) -> Value | t.CPtr: pass

def build_gep_array(builder: IRBuilder | t.CPtr, array_ty: LLVMType | t.CPtr, elem_ty: LLVMType | t.CPtr, ptr: Value | t.CPtr, idx: Value | t.CPtr) -> Value | t.CPtr: pass

def build_gep_struct(builder: IRBuilder | t.CPtr, struct_ty: LLVMType | t.CPtr, field_ty: LLVMType | t.CPtr, ptr: Value | t.CPtr, field_idx: t.CInt) -> Value | t.CPtr: pass


class PhiIncoming(GSListNode[PhiIncoming]):
    Val: Value | t.CPtr
    Block: BasicBlock | t.CPtr

PHIINC_SIZE: t.CDefine = 24

def new_phi_incoming(pool: memhub.MemBuddy | t.CPtr, val: Value | t.CPtr, block: BasicBlock | t.CPtr) -> PhiIncoming | t.CPtr: pass

def build_phi(builder: IRBuilder | t.CPtr, ty: LLVMType | t.CPtr, incoming_head: PhiIncoming | t.CPtr, count: t.CInt) -> Value | t.CPtr: pass


class SwitchCase(GSListNode[SwitchCase]):
    CaseVal: Value | t.CPtr
    Block: BasicBlock | t.CPtr

SWCASE_SIZE: t.CDefine = 24

def new_switch_case(pool: memhub.MemBuddy | t.CPtr, case_val: Value | t.CPtr, block: BasicBlock | t.CPtr) -> SwitchCase | t.CPtr: pass

def build_switch(builder: IRBuilder | t.CPtr, val: Value | t.CPtr, default_blk: BasicBlock | t.CPtr, cases_head: SwitchCase | t.CPtr, case_count: t.CInt) -> t.CInt: pass

def build_select(builder: IRBuilder | t.CPtr, cond: Value | t.CPtr, true_val: Value | t.CPtr, false_val: Value | t.CPtr) -> Value | t.CPtr: pass

def build_unreachable(builder: IRBuilder | t.CPtr) -> t.CInt: pass


ATOMIC_XCHG:  t.CDefine = 0
ATOMIC_ADD:   t.CDefine = 1
ATOMIC_SUB:   t.CDefine = 2
ATOMIC_AND:   t.CDefine = 3
ATOMIC_NAND:  t.CDefine = 4
ATOMIC_OR:    t.CDefine = 5
ATOMIC_XOR:   t.CDefine = 6
ATOMIC_MAX:   t.CDefine = 7
ATOMIC_MIN:   t.CDefine = 8
ATOMIC_UMAX:  t.CDefine = 9
ATOMIC_UMIN:  t.CDefine = 10
ATOMIC_ORDER_NOTATOMIC:  t.CDefine = 0
ATOMIC_ORDER_UNORDERED:  t.CDefine = 1
ATOMIC_ORDER_MONOTONIC:  t.CDefine = 2
ATOMIC_ORDER_ACQUIRE:    t.CDefine = 3
ATOMIC_ORDER_RELEASE:    t.CDefine = 4
ATOMIC_ORDER_ACQ_REL:    t.CDefine = 5
ATOMIC_ORDER_SEQ_CST:    t.CDefine = 6

def _atomic_op_str(op: t.CInt) -> t.CChar | t.CPtr: pass

def _atomic_order_str(ord: t.CInt) -> t.CChar | t.CPtr: pass

def build_atomicrmw(builder: IRBuilder | t.CPtr, op: t.CInt, ptr: Value | t.CPtr, val: Value | t.CPtr, order: t.CInt) -> Value | t.CPtr: pass

def build_cmpxchg(builder: IRBuilder | t.CPtr, ptr: Value | t.CPtr, cmp_val: Value | t.CPtr, new_val: Value | t.CPtr, succ_order: t.CInt, fail_order: t.CInt) -> Value | t.CPtr: pass

def build_inline_asm(builder: IRBuilder | t.CPtr, ret_ty: LLVMType | t.CPtr, asm_text: t.CChar | t.CPtr, constraints: t.CChar | t.CPtr, has_side_effects: t.CInt) -> Value | t.CPtr: pass

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