#ifndef GOOSE_CIR_TEMPADDR_H
#define GOOSE_CIR_TEMPADDR_H
namespace goose::cir
{
class TempAddr
{
public:
template< typename T >
TempAddr( uint32_t i, T&& init ) :
m_initValue( forward< T >( init ) ),
m_tempIndex( i )
{}
const auto& initValue() const
{
return m_initValue;
}
uint32_t tempIndex() const
{
return m_tempIndex;
}
bool canBeExecuted() const { return true; }
bool canBeEagerlyEvaluated() const { return false; }
bool operator<( const TempAddr& rhs ) const
{
if( m_tempIndex != rhs.m_tempIndex )
return m_tempIndex < rhs.m_tempIndex;
return m_initValue < rhs.m_initValue;
}
friend ostream& operator<<( ostream& out, const TempAddr& ins )
{
return out << "TEMPADDR(" << ins.m_tempIndex << ", " << ins.m_initValue << ')';
}
private:
eir::Value m_initValue;
uint32_t m_tempIndex = 0;
};
}
#endif