#if ENABLE(DFG_JIT)
#include "DFGCommon.h"
+#include "FPRInfo.h"
+#include "GPRInfo.h"
namespace JSC { namespace DFG {
// returns -1 (InvalidGPRReg or InvalidFPRReg).
RegID tryAllocate()
{
- VirtualRegister ignored;
+ VirtualRegister ignored = VirtualRegister();
for (uint32_t i = 0; i < NUM_REGS; ++i) {
- if (!m_data[i].lockCount && m_data[i].name == InvalidVirtualRegister)
+ if (!m_data[i].lockCount && !m_data[i].name.isValid())
return allocateInternal(i, ignored);
}
++m_data[index].lockCount;
VirtualRegister name = nameAtIndex(index);
- if (name != InvalidVirtualRegister)
+ if (name.isValid())
releaseAtIndex(index);
return name;
ASSERT(index < NUM_REGS);
ASSERT(m_data[index].lockCount);
// 'index' should not currently be named, the new name must be valid.
- ASSERT(m_data[index].name == InvalidVirtualRegister);
- ASSERT(name != InvalidVirtualRegister);
+ ASSERT(!m_data[index].name.isValid());
+ ASSERT(name.isValid());
// 'index' should not currently have a spillOrder.
ASSERT(m_data[index].spillOrder == SpillHintInvalid);
}
// Get the name (VirtualRegister) associated with the
- // given register (or InvalidVirtualRegister for none).
+ // given register (or default VirtualRegister() for none).
VirtualRegister name(RegID reg) const
{
return nameAtIndex(BankInfo::toIndex(reg));
bool isInUse(RegID reg) const
{
- return isLocked(reg) || name(reg) != InvalidVirtualRegister;
+ return isLocked(reg) || name(reg).isValid();
}
-#ifndef NDEBUG
void dump()
{
// For each register, print the VirtualRegister 'name'.
for (uint32_t i =0; i < NUM_REGS; ++i) {
- if (m_data[i].name != InvalidVirtualRegister)
- dataLogF("[%02d]", m_data[i].name);
+ if (m_data[i].name.isValid())
+ dataLogF("[%02d]", m_data[i].name.offset());
else
dataLogF("[--]");
}
dataLogF("\n");
}
-#endif
class iterator {
friend class RegisterBank<BankInfo>;
// 'index' must be a valid register.
ASSERT(index < NUM_REGS);
// 'index' should currently be named.
- ASSERT(m_data[index].name != InvalidVirtualRegister);
+ ASSERT(m_data[index].name.isValid());
// 'index' should currently have a valid spill order.
ASSERT(m_data[index].spillOrder != SpillHintInvalid);
- m_data[index].name = InvalidVirtualRegister;
+ m_data[index].name = VirtualRegister();
m_data[index].spillOrder = SpillHintInvalid;
}
ASSERT(i < NUM_REGS && !m_data[i].lockCount);
// Return the VirtualRegister of the named value currently stored in
- // the register being returned - or InvalidVirtualRegister if none.
+ // the register being returned - or default VirtualRegister() if none.
spillMe = m_data[i].name;
// Clear any name/spillOrder currently associated with the register,
// count, name and spillOrder hint.
struct MapEntry {
MapEntry()
- : name(InvalidVirtualRegister)
+ : name(VirtualRegister())
, spillOrder(SpillHintInvalid)
, lockCount(0)
{
MapEntry m_data[NUM_REGS];
};
+typedef RegisterBank<GPRInfo>::iterator gpr_iterator;
+typedef RegisterBank<FPRInfo>::iterator fpr_iterator;
+
} } // namespace JSC::DFG
#endif