Goose  Artifact [7f05a7ff47]

Artifact 7f05a7ff4753e028c07b16037a2f911f103e284f1b9f00da7cc716a0ee051c0c:

  • File bs/llr/instruction.h — part of check-in [443351dafe] at 2019-07-26 18:33:50 on branch trunk — llr, codegen: implemented "load constant" instructions for integers and strings. (user: achavasse size: 993)

#ifndef EMPATHY_LLR_INSTRUCTION_H
#define EMPATHY_LLR_INSTRUCTION_H

namespace empathy::llr
{
    class BasicBlock;

    class Instruction
    {
        public:
            Instruction() {}

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

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

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

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

            using Content = variant
            <
                GetArg,
                Call,
                LoadConstInt,
                LoadConstStr
            >;

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

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

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

#endif