p->pop();
}
+ BVAR(OCL_OUTPUT_REG_ALLOC, false);
BVAR(OCL_OUTPUT_ASM, false);
bool GenContext::emitCode(void) {
GenKernel *genKernel = static_cast<GenKernel*>(this->kernel);
if (UNLIKELY(ra->allocate(*this->sel) == false))
return false;
schedulePostRegAllocation(*this, *this->sel);
+ if (OCL_OUTPUT_REG_ALLOC)
+ ra->outputAllocation();
this->emitStackPointer();
this->emitInstructionStream();
this->patchBranches();
bool allocate(Selection &selection);
/*! Return the Gen register from the selection register */
GenRegister genReg(const GenRegister ®);
+ /*! Output the register allocation */
+ void outputAllocation(void);
private:
/*! Expire one GRF interval. Return true if one was successfully expired */
bool expireGRF(const GenRegInterval &limit);
return this->allocateGRFs(selection);
}
+ INLINE void GenRegAllocator::Opaque::outputAllocation(void) {
+ std::cout << "## register allocation ##" << std::endl;
+ for(auto &i : RA) {
+ int vReg = (int)i.first;
+ int offst = (int)i.second / sizeof(float);
+ int reg = offst / 8;
+ int subreg = offst % 8;
+ std::cout << "%" << vReg << " g" << reg << "." << subreg << "D" << std::endl;
+ }
+ std::cout << std::endl;
+ }
+
INLINE GenRegister setGenReg(const GenRegister &src, uint32_t grfOffset) {
GenRegister dst;
dst = src;
return this->opaque->genReg(reg);
}
+ void GenRegAllocator::outputAllocation(void) {
+ this->opaque->outputAllocation();
+ }
+
} /* namespace gbe */
bool allocate(Selection &selection);
/*! Virtual to physical translation */
GenRegister genReg(const GenRegister ®);
+ /*! Output the register allocation */
+ void outputAllocation(void);
private:
/*! Actual implementation of the register allocator (use Pimpl) */
class Opaque;