Factor CodeGen_Posix memory allocation into helpers

This is important for overloading the allocation functionality
in more subtle ways for e.g. the GPU backends. It also paves 
the way for completely dropping the CodeGen_Posix class from 
the hierarchy, since these functions are ~all it does.