#ifndef GOOSE_CIR_GETTEMPORARY_H
#define GOOSE_CIR_GETTEMPORARY_H
namespace goose::cir
{
class GetTemporary
{
public:
template< typename T >
GetTemporary( T&& type, uint32_t index ) :
m_type( forward< T >( type ) ),
m_index( index )
{}
const auto& type() const { return m_type; }
const auto& index() const { return m_index; }
bool canBeExecuted() const { return true; }
bool canBeEagerlyEvaluated() const { return true; }
bool operator<( const GetTemporary& rhs ) const
{
if( m_index != rhs.m_index )
return m_index < rhs.m_index;
return m_type < rhs.m_type;
}
friend ostream& operator<<( ostream& out, const GetTemporary& ins )
{
return out << "GETTEMP(" << ins.m_index << ", " << ins.m_type << ')';
}
private:
eir::Term m_type;
uint32_t m_index = 0;
};
}
#endif