Goose  Artifact [3a5c06efb9]

Artifact 3a5c06efb98560844fbb55b62f7a25a80e80754db1b8dc5110021478c69d94e6:

  • File bs/llr/instruction.h — part of check-in [9a6ae2acd0] at 2019-08-02 22:28:09 on branch trunk —
    • Implemented an "inline cfg" llr instruction that transfer execution control to another CFG.
    • Used the above in the logic or operator, which now works.
    (user: achavasse size: 1630)

#ifndef EMPATHY_LLR_INSTRUCTION_H
#define EMPATHY_LLR_INSTRUCTION_H

namespace empathy::llr
{
    class CFG;

    class Instruction
    {
        public:
            Instruction() {}

            Instruction( Call&& c ) :
                m_content( move( c ) )
            {}

            Instruction( ptr< CFG >&& ic ) :
                m_content( move( ic ) )
            {}

            Instruction( GetArg&& gv ) :
                m_content( move( gv ) )
            {}

            Instruction( CreateTemporary&& ct ) :
                m_content( move( ct ) )
            {}

            Instruction( GetTemporary&& gt ) :
                m_content( move( gt ) )
            {}

            Instruction( Phi&& p ) :
                m_content( move( p ) )
            {}

            Instruction( LoadConstInt&& lci ) :
                m_content( move( lci ) )
            {}

            Instruction( LoadConstStr&& lcs ) :
                m_content( move( lcs ) )
            {}

            Instruction( Xor&& x ) :
                m_content( move( x ) )
            {}

            using Content = variant
            <
                ptr< CFG >, // CFG inlining
                GetArg,
                Call,
                CreateTemporary,
                GetTemporary,
                Phi,
                LoadConstInt,
                LoadConstStr,

                Xor
            >;

            const auto& content() const { return m_content; }

            bool canBeExecuted() const;
            bool canBeEagerlyEvaluated() const;

        private:
            Content m_content = GetArg( 0 );
    };
}

#endif