Goose  Artifact [5a711e3669]

Artifact 5a711e366931a97a4d6bbb30bafc3ea819248a2636d5bc1303b3a4c839e8b4f9:

  • File bs/cir/instruction.h — part of check-in [8ffbc35112] at 2024-08-31 14:05:17 on branch cir-ssa-refactor — Refactor Instruction to be just a variant instead of a class containing a variant and a clownshoes bunch of constructors (user: achavasse size: 1372)

#ifndef GOOSE_CIR_INSTRUCTION_H
#define GOOSE_CIR_INSTRUCTION_H

namespace goose::cir
{
    class CFG;


    template< typename T >
    concept Op = requires
    {
        Omlkps(declval< T >());
    };


    using Instruction = variant
    <
        monostate,

        Call,
        InlineCall,
        CallCheck,

        VarAddr,
        TempAddr,
        Select,

        PushConstant,
        CreateTemporary,
        GetTemporary,
        AllocVar,
        Load,
        Store,
        Phi,

        Not,
        And,
        Or,
        Xor,

        Shl,
        LShr,
        AShr,

        Add,
        Sub,
        Mul,
        UDiv,
        SDiv,
        URem,
        SRem,

        Eq,
        Neq,
        UGT,
        UGE,
        ULT,
        ULE,
        SGT,
        SGE,
        SLT,
        SLE,

        Assert,
        GhostCall,
        PHOverrideSet,
        PHOverrideClear,
        Placeholder,

        ForAllSetup,
        ForAll,

        Implies,
        IsPrefixOf,

        PushType,
        PushStringId
    >;

    class InstrSeq : public list< Instruction > {};

    extern bool CanBeExecuted( const Instruction& instr );
    extern bool CanBeEagerlyEvaluated( const Instruction& instr );
    extern bool HaveSideEffects( const Instruction& instr );

    extern ostream& operator<<( ostream& out, const Instruction& instr );
}

#endif