v3d: reduce redundant ldunif
This is a trivial optimization where we try to avoid emitting a new ldunif to load a uniform we have just loaded a few instructions ago. To prevent this from significantly increasing register pressure we have a limit on how far we look back for a previous ldunif of the same uniform, which I tuned using shader-db for best results.
The second patch is just a trivial refactoring that may come in handy in the future.
The last patch fixes our shader-db output to not dump shaders we fail to compile, which is required for proper GAINED/LOST stats, and also to avoid incorrect instruction count regressions from getting new shaders to compile (since failed shaders were dumped with an instruction count of 0).