from . import types as types
from ._utils import _HasMetadata
from .values import (
    AttributeSet as AttributeSet,
    Block as Block,
    Constant as Constant,
    Function as Function,
    MetaDataArgument as MetaDataArgument,
    MetaDataString as MetaDataString,
    NamedValue as NamedValue,
    Undefined as Undefined,
    Value as Value,
)
from typing import Any, Optional

class Instruction(NamedValue, _HasMetadata):
    opname: Any = ...
    operands: Any = ...
    flags: Any = ...
    metadata: Any = ...
    def __init__(
        self,
        parent: Any,
        typ: Any,
        opname: Any,
        operands: Any,
        name: str = ...,
        flags: Any = ...,
    ) -> None: ...
    @property
    def function(self): ...
    @property
    def module(self): ...
    def descr(self, buf: Any) -> None: ...
    def replace_usage(self, old: Any, new: Any) -> None: ...

class CallInstrAttributes(AttributeSet): ...
class FastMathFlags(AttributeSet): ...

class CallInstr(Instruction):
    cconv: Any = ...
    tail: Any = ...
    fastmath: Any = ...
    attributes: Any = ...
    def __init__(
        self,
        parent: Any,
        func: Any,
        args: Any,
        name: str = ...,
        cconv: Optional[Any] = ...,
        tail: bool = ...,
        fastmath: Any = ...,
    ) -> None: ...
    @property
    def callee(self): ...
    @callee.setter
    def callee(self, newcallee: Any) -> None: ...
    @property
    def args(self): ...
    def replace_callee(self, newfunc: Any) -> None: ...
    @property
    def called_function(self): ...
    def descr(self, buf: Any) -> None: ...

class InvokeInstr(CallInstr):
    opname: str = ...
    normal_to: Any = ...
    unwind_to: Any = ...
    def __init__(
        self,
        parent: Any,
        func: Any,
        args: Any,
        normal_to: Any,
        unwind_to: Any,
        name: str = ...,
        cconv: Optional[Any] = ...,
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class Terminator(Instruction):
    def __init__(self, parent: Any, opname: Any, operands: Any) -> None: ...
    def descr(self, buf: Any) -> None: ...

class PredictableInstr(Instruction):
    def set_weights(self, weights: Any) -> None: ...

class Ret(Terminator):
    def __init__(
        self, parent: Any, opname: Any, return_value: Optional[Any] = ...
    ) -> None: ...
    @property
    def return_value(self): ...
    def descr(self, buf: Any) -> None: ...

class Branch(Terminator): ...
class ConditionalBranch(PredictableInstr, Terminator): ...

class IndirectBranch(PredictableInstr, Terminator):
    destinations: Any = ...
    def __init__(self, parent: Any, opname: Any, addr: Any) -> None: ...
    @property
    def address(self): ...
    def add_destination(self, block: Any) -> None: ...
    def descr(self, buf: Any) -> None: ...

class SwitchInstr(PredictableInstr, Terminator):
    default: Any = ...
    cases: Any = ...
    def __init__(self, parent: Any, opname: Any, val: Any, default: Any) -> None: ...
    @property
    def value(self): ...
    def add_case(self, val: Any, block: Any) -> None: ...
    def descr(self, buf: Any) -> None: ...

class Resume(Terminator): ...

class SelectInstr(Instruction):
    def __init__(
        self, parent: Any, cond: Any, lhs: Any, rhs: Any, name: str = ...
    ) -> None: ...
    @property
    def cond(self): ...
    @property
    def lhs(self): ...
    @property
    def rhs(self): ...
    def descr(self, buf: Any) -> None: ...

class CompareInstr(Instruction):
    OPNAME: str = ...
    VALID_OP: Any = ...
    op: Any = ...
    def __init__(
        self,
        parent: Any,
        op: Any,
        lhs: Any,
        rhs: Any,
        name: str = ...,
        flags: Any = ...,
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class ICMPInstr(CompareInstr):
    OPNAME: str = ...
    VALID_OP: Any = ...
    VALID_FLAG: Any = ...

class FCMPInstr(CompareInstr):
    OPNAME: str = ...
    VALID_OP: Any = ...
    VALID_FLAG: Any = ...

class CastInstr(Instruction):
    def __init__(
        self, parent: Any, op: Any, val: Any, typ: Any, name: str = ...
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class LoadInstr(Instruction):
    align: Any = ...
    def __init__(self, parent: Any, ptr: Any, name: str = ...) -> None: ...
    def descr(self, buf: Any) -> None: ...

class StoreInstr(Instruction):
    def __init__(self, parent: Any, val: Any, ptr: Any) -> None: ...
    def descr(self, buf: Any) -> None: ...

class LoadAtomicInstr(Instruction):
    ordering: Any = ...
    align: Any = ...
    def __init__(
        self, parent: Any, ptr: Any, ordering: Any, align: Any, name: str = ...
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class StoreAtomicInstr(Instruction):
    ordering: Any = ...
    align: Any = ...
    def __init__(
        self, parent: Any, val: Any, ptr: Any, ordering: Any, align: Any
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class AllocaInstr(Instruction):
    align: Any = ...
    def __init__(self, parent: Any, typ: Any, count: Any, name: Any) -> None: ...
    def descr(self, buf: Any) -> None: ...

class GEPInstr(Instruction):
    pointer: Any = ...
    indices: Any = ...
    inbounds: Any = ...
    def __init__(
        self, parent: Any, ptr: Any, indices: Any, inbounds: Any, name: Any
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class PhiInstr(Instruction):
    incomings: Any = ...
    def __init__(self, parent: Any, typ: Any, name: Any) -> None: ...
    def descr(self, buf: Any) -> None: ...
    def add_incoming(self, value: Any, block: Any) -> None: ...
    def replace_usage(self, old: Any, new: Any) -> None: ...

class ExtractElement(Instruction):
    def __init__(
        self, parent: Any, vector: Any, index: Any, name: str = ...
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class InsertElement(Instruction):
    def __init__(
        self, parent: Any, vector: Any, value: Any, index: Any, name: str = ...
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class ShuffleVector(Instruction):
    def __init__(
        self, parent: Any, vector1: Any, vector2: Any, mask: Any, name: str = ...
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class ExtractValue(Instruction):
    aggregate: Any = ...
    indices: Any = ...
    def __init__(
        self, parent: Any, agg: Any, indices: Any, name: str = ...
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class InsertValue(Instruction):
    aggregate: Any = ...
    value: Any = ...
    indices: Any = ...
    def __init__(
        self, parent: Any, agg: Any, elem: Any, indices: Any, name: str = ...
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class Unreachable(Instruction):
    def __init__(self, parent: Any) -> None: ...
    def descr(self, buf: Any) -> None: ...

class InlineAsm:
    type: Any = ...
    function_type: Any = ...
    asm: Any = ...
    constraint: Any = ...
    side_effect: Any = ...
    def __init__(
        self, ftype: Any, asm: Any, constraint: Any, side_effect: bool = ...
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...
    def get_reference(self): ...

class AtomicRMW(Instruction):
    operation: Any = ...
    ordering: Any = ...
    def __init__(
        self, parent: Any, op: Any, ptr: Any, val: Any, ordering: Any, name: Any
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class CmpXchg(Instruction):
    ordering: Any = ...
    failordering: Any = ...
    def __init__(
        self,
        parent: Any,
        ptr: Any,
        cmp: Any,
        val: Any,
        ordering: Any,
        failordering: Any,
        name: Any,
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...

class _LandingPadClause:
    value: Any = ...
    def __init__(self, value: Any) -> None: ...

class CatchClause(_LandingPadClause):
    kind: str = ...

class FilterClause(_LandingPadClause):
    kind: str = ...
    def __init__(self, value: Any) -> None: ...

class LandingPadInstr(Instruction):
    cleanup: Any = ...
    clauses: Any = ...
    def __init__(
        self, parent: Any, typ: Any, name: str = ..., cleanup: bool = ...
    ) -> None: ...
    def add_clause(self, clause: Any) -> None: ...
    def descr(self, buf: Any) -> None: ...

class Fence(Instruction):
    VALID_FENCE_ORDERINGS: Any = ...
    ordering: Any = ...
    targetscope: Any = ...
    def __init__(
        self,
        parent: Any,
        ordering: Any,
        targetscope: Optional[Any] = ...,
        name: str = ...,
    ) -> None: ...
    def descr(self, buf: Any) -> None: ...
