r600g/compute: Fixing a typo and some indentation

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
r600g/compute: Adding checks for NULL after CALLOC

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
r600g/compute: Add more NULL checks

In this case, NULL checks are added to compute_memory_grow_pool,
so it returns -1 when it fails. This makes necesary
to handle such cases in compute_memory_finalize_pending
when it is needed to grow the pool

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
r600g/compute: Tidy a bit compute_memory_finalize_pending

Explanation of the changes, as requested by Tom Stellard:

Let's take need after is calculated as
item->size_in_dw+2048 - (pool->size_in_dw - allocated)

BEFORE:
If need is positive or 0:
    we calculate need += 1024 - (need % 1024), which is like
        cealing to the nearest multiple of 1024, for example
        0 goes to 1024, 512 goes to 1024 as well, 1025 goes
        to 2048 and so on. So now need is always possitive,
        we do compute_memory_grow_pool, check its output
        and continue.

If need is negative:
    we calculate need += 1024 - (need % 1024), in this case
        we will have negative numbers, and if need is
        [-1024:-1] 0, so now we take the else, recalculate
        need as need = pool->size_in_dw / 10 and
        need += 1024 - (need % 1024), we do
        compute_memory_grow_pool, check its output and continue.

AFTER:
If need is positive or 0:
    we jump the if, calculate need += 1024 - (need % 1024)
        compute_memory_grow_pool, check its output and continue.

If need is negative:
    we enter the if, and need is now pool->size_in_dw / 10.
        Now we calculate need += 1024 - (need % 1024)
        compute_memory_grow_pool, check its output and continue.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
r600g/compute: Cleanup of compute_memory_pool.h

Removed compute_memory_defrag declaration because it seems
to be unimplemented.

I think that this function would have been the one that solves
the problem with fragmentation that compute_memory_finalize_pending has.

Also removed comments that are already at compute_memory_pool.c

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
r600g/compute: align items correctly

Now, items whose size is a multiple of 1024 dw won't leave
1024 dw between itself and the following item

The rest of the cases is left as it was

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
r600g/compute: Use %u as the unsigned format

This fixes an issue when running cl-program-bitcoin-phatk
piglit test where some of the inputs have negative values

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
glsl: Move definition of exec_node member functions out of the struct.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Move definition of exec_list member functions out of the struct.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Add C API for exec_node.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Add C API for exec_list.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Make exec_node members just wrap the C API.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Make exec_list members just wrap the C API.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Make foreach macros usable from C by adding struct keyword.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Add an exec_node_init() function, usable from C.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Replace open-coded linked list with exec_list.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Remove unused includes in link_uniform_init.

Found with IWYU, confirmed with grepping for "hash" and "symbol".
No negative effects on compilation.

IWYU also reported core.h and linker.h could be removed,
but I'm unsure if those are false positives.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Thomas Helland <thomashelland90@gmail.com>
glsl: Remove unused includes in link_uniform_block_active_visitor.h

Found with IWYU, compile-tested on my Ivy-bridge system.
This is not used in the header, and is included in the source.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Thomas Helland <thomashelland90@gmail.com>
glsl: Remove unused include in ast_to_hir.cpp

Found with IWYU. Comment says it's for struct gl_extensions.
Grepping for gl_extensions shows no uses.
Tested by compiling on my Ivy-bridge system.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Thomas Helland <thomashelland90@gmail.com>
glsl: Remove unused include from builtin_variables.cpp

Found with IWYU. Compile-tested on my Ivy-bridge system.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Thomas Helland <thomashelland90@gmail.com>