mesa: Add and use foreach_in_list_use_after.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
@@ -592,6 +592,11 @@ inline void exec_node::insert_before(exec_list *before)
|
|||||||
__next != NULL; \
|
__next != NULL; \
|
||||||
__node = __next, __next = (__type *)__next->next)
|
__node = __next, __next = (__type *)__next->next)
|
||||||
|
|
||||||
|
#define foreach_in_list_use_after(__type, __inst, __list) \
|
||||||
|
__type *(__inst); \
|
||||||
|
for ((__inst) = (__type *)(__list)->head; \
|
||||||
|
!(__inst)->is_tail_sentinel(); \
|
||||||
|
(__inst) = (__type *)(__inst)->next)
|
||||||
/**
|
/**
|
||||||
* Iterate through two lists at once. Stops at the end of the shorter list.
|
* Iterate through two lists at once. Stops at the end of the shorter list.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -183,10 +183,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
|
|||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
aeb_entry *entry;
|
foreach_in_list_use_after(aeb_entry, entry, aeb) {
|
||||||
foreach_list(entry_node, aeb) {
|
|
||||||
entry = (aeb_entry *) entry_node;
|
|
||||||
|
|
||||||
/* Match current instruction's expression against those in AEB. */
|
/* Match current instruction's expression against those in AEB. */
|
||||||
if (instructions_match(inst, entry->generator)) {
|
if (instructions_match(inst, entry->generator)) {
|
||||||
found = true;
|
found = true;
|
||||||
|
|||||||
@@ -2660,11 +2660,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir)
|
|||||||
function_entry *
|
function_entry *
|
||||||
glsl_to_tgsi_visitor::get_function_signature(ir_function_signature *sig)
|
glsl_to_tgsi_visitor::get_function_signature(ir_function_signature *sig)
|
||||||
{
|
{
|
||||||
function_entry *entry;
|
foreach_in_list_use_after(function_entry, entry, &this->function_signatures) {
|
||||||
|
|
||||||
foreach_list(node, &this->function_signatures) {
|
|
||||||
entry = (function_entry *) node;
|
|
||||||
|
|
||||||
if (entry->sig == sig)
|
if (entry->sig == sig)
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user