The patch essentially ports the existing non-hostcall printf support in OpenCL to HIP (to be controlled via new option "-fdelayed-printf"), with following changes
- Code refactoring -> we now use API's "getConstantStringInfo()" to extract constant string contents at compile time.
- Support to print non-const null terminated strings, required in HIP context. This is achieved as follows
- calculate string size using a function "getStrlenWithNull()" and reserve the space in printf buffer using __printf_alloc() (as was the case in OpenCL, but number of bytes allocated could be dynamic now)
- copy the string contents to buffer using previously calculated size and the pointer to string (a memcpy intrinsic is generated here)