INSERT_REG(numgroup1, GROUP_NUM_Y)
INSERT_REG(numgroup2, GROUP_NUM_Z)
INSERT_REG(stackptr, STACK_POINTER)
+ INSERT_REG(printfbptr, PRINTF_BUF_POINTER);
+ INSERT_REG(printfiptr, PRINTF_INDEX_POINTER);
do {} while(0);
}
});
GBE_CURBE_WORK_DIM,
GBE_CURBE_IMAGE_INFO,
GBE_CURBE_STACK_POINTER,
+ GBE_CURBE_PRINTF_BUF_POINTER,
+ GBE_CURBE_PRINTF_INDEX_POINTER,
GBE_CURBE_KERNEL_ARGUMENT,
GBE_CURBE_EXTRA_ARGUMENT,
GBE_CURBE_BLOCK_IP,
"block_ip",
"barrier_id", "thread_number", "work_dimension",
"zero", "one",
- "retVal", "slm_offset"
+ "retVal", "slm_offset",
+ "printf_buffer_pointer", "printf_index_buffer_pointer"
};
#if GBE_DEBUG
DECL_NEW_REG(FAMILY_DWORD, one, 1);
DECL_NEW_REG(FAMILY_WORD, retVal, 1);
DECL_NEW_REG(FAMILY_WORD, slmoffset, 1);
+ DECL_NEW_REG(FAMILY_DWORD, printfbptr, 1);
+ DECL_NEW_REG(FAMILY_DWORD, printfiptr, 1);
}
#undef DECL_NEW_REG
static const Register one = Register(25); // scalar register holds one.
static const Register retVal = Register(26); // helper register to do data flow analysis.
static const Register slmoffset = Register(27); // Group's SLM offset in total 64K SLM
- static const uint32_t regNum = 28; // number of special registers
+ static const Register printfbptr = Register(28); // printf buffer address .
+ static const Register printfiptr = Register(29); // printf index buffer address.
+ static const uint32_t regNum = 30; // number of special registers
extern const char *specialRegMean[]; // special register name.
} /* namespace ocl */
regTranslator.newScalarProxy(ir::ocl::goffset2, dst); break;
case GEN_OCL_GET_WORK_DIM:
regTranslator.newScalarProxy(ir::ocl::workdim, dst); break;
+ case GEN_OCL_PRINTF_BUF_ADDR:
+ regTranslator.newScalarProxy(ir::ocl::printfbptr, dst); break;
+ case GEN_OCL_PRINTF_INDEX_BUF_ADDR:
+ regTranslator.newScalarProxy(ir::ocl::printfiptr, dst); break;
case GEN_OCL_FBH:
case GEN_OCL_FBL:
case GEN_OCL_COS:
case GEN_OCL_SIMD_ALL:
this->newRegister(&I);
break;
+ case GEN_OCL_PRINTF:
+ break;
default:
GBE_ASSERTM(false, "Function call are not supported yet");
};
ctx.F32TO16(ir::TYPE_U16, ir::TYPE_FLOAT, getRegister(&I), getRegister(I.getOperand(0)));
break;
#undef DEF
+
+ case GEN_OCL_PRINTF:
+ break;
+ case GEN_OCL_PRINTF_BUF_ADDR:
+ case GEN_OCL_PRINTF_INDEX_BUF_ADDR:
default: break;
}
}
// SIMD level function for internal usage
DECL_LLVM_GEN_FUNCTION(SIMD_ANY, __gen_ocl_simd_any)
DECL_LLVM_GEN_FUNCTION(SIMD_ALL, __gen_ocl_simd_all)
+
+// printf function
+DECL_LLVM_GEN_FUNCTION(PRINTF, __gen_ocl_printf)
+DECL_LLVM_GEN_FUNCTION(PRINTF_BUF_ADDR, __gen_ocl_printf_get_buf_addr)
+DECL_LLVM_GEN_FUNCTION(PRINTF_INDEX_BUF_ADDR, __gen_ocl_printf_get_index_buf_addr)
#undef CONST
#undef OVERLOADABLE
#undef INLINE
+
+/* The printf function. */
+int __gen_ocl_printf_stub(const char * format, ...);
+#define printf __gen_ocl_printf_stub
+
#endif /* __GEN_OCL_STDLIB_H__ */