templatize cpp_generator::print_method_{decl,impl}
There is quite a bit of duplication between the logic
for printing method declarations and method implementations.
In order not to exacerbate this situation in the upcoming support
for automatically converting long arguments to isl::val,
the shared logic will be implemented in a method template.
This method will be called from a print_method_variants method template,
which needs to be able to call print_method_decl or print_method_impl
depending on the template parameter.
Turn these methods into (specialized) template methods for this purpose.
Signed-off-by: Sven Verdoolaege <sven@cerebras.net>