glsl: remove do_function_inlining()
This no longer has any users. nir based inlining should be used for any new code. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29519>
This commit is contained in:
committed by
Marge Bot
parent
f1ef6517e8
commit
ef21df917f
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file ir_function_can_inline.cpp
|
||||
*
|
||||
* Determines if we can inline a function call using ir_function_inlining.cpp.
|
||||
*
|
||||
* The primary restriction is that we can't return from the function other
|
||||
* than as the last instruction. In lower_jumps.cpp, we can lower return
|
||||
* statements not at the end of the function to other control flow in order to
|
||||
* deal with this restriction.
|
||||
*/
|
||||
|
||||
#include "ir.h"
|
||||
|
||||
class ir_function_can_inline_visitor : public ir_hierarchical_visitor {
|
||||
public:
|
||||
ir_function_can_inline_visitor()
|
||||
{
|
||||
this->num_returns = 0;
|
||||
}
|
||||
|
||||
virtual ir_visitor_status visit_enter(ir_return *);
|
||||
|
||||
int num_returns;
|
||||
};
|
||||
|
||||
ir_visitor_status
|
||||
ir_function_can_inline_visitor::visit_enter(ir_return *ir)
|
||||
{
|
||||
(void) ir;
|
||||
this->num_returns++;
|
||||
return visit_continue;
|
||||
}
|
||||
|
||||
bool
|
||||
can_inline(ir_call *call)
|
||||
{
|
||||
ir_function_can_inline_visitor v;
|
||||
const ir_function_signature *callee = call->callee;
|
||||
if (!callee->is_defined)
|
||||
return false;
|
||||
|
||||
v.run((exec_list *) &callee->body);
|
||||
|
||||
/* If the function is empty (no last instruction) or does not end with a
|
||||
* return statement, we need to count the implicit return.
|
||||
*/
|
||||
ir_instruction *last = (ir_instruction *)callee->body.get_tail();
|
||||
if (last == NULL || !last->as_return())
|
||||
v.num_returns++;
|
||||
|
||||
return v.num_returns == 1;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file ir_function_inlining.h
|
||||
*
|
||||
* Replaces calls to functions with the body of the function.
|
||||
*/
|
||||
|
||||
#ifndef GLSL_IR_FUNCTION_INLINING_H
|
||||
#define GLSL_IR_FUNCTION_INLINING_H
|
||||
|
||||
bool can_inline(ir_call *call);
|
||||
|
||||
#endif /* GLSL_IR_FUNCTION_INLINING_H */
|
||||
@@ -45,7 +45,6 @@ bool do_dead_code(exec_list *instructions);
|
||||
bool do_dead_code_local(exec_list *instructions);
|
||||
bool do_dead_code_unlinked(exec_list *instructions);
|
||||
bool opt_flip_matrices(exec_list *instructions);
|
||||
bool do_function_inlining(exec_list *instructions);
|
||||
bool do_lower_jumps(exec_list *instructions, bool pull_out_jumps = true, bool lower_sub_return = true, bool lower_main_return = false, bool lower_continue = false);
|
||||
bool do_if_simplification(exec_list *instructions);
|
||||
bool opt_flatten_nested_if_blocks(exec_list *instructions);
|
||||
|
||||
@@ -168,9 +168,7 @@ files_libglsl = files(
|
||||
'ir_equals.cpp',
|
||||
'ir_expression_flattening.cpp',
|
||||
'ir_expression_flattening.h',
|
||||
'ir_function_can_inline.cpp',
|
||||
'ir_function_detect_recursion.cpp',
|
||||
'ir_function_inlining.h',
|
||||
'ir_function.cpp',
|
||||
'ir_hierarchical_visitor.cpp',
|
||||
'ir_hierarchical_visitor.h',
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "ir.h"
|
||||
#include "ir_visitor.h"
|
||||
#include "ir_rvalue_visitor.h"
|
||||
#include "ir_function_inlining.h"
|
||||
#include "ir_expression_flattening.h"
|
||||
#include "compiler/glsl_types.h"
|
||||
#include "util/hash_table.h"
|
||||
@@ -42,27 +41,6 @@ do_variable_replacement(exec_list *instructions,
|
||||
|
||||
namespace {
|
||||
|
||||
class ir_function_inlining_visitor : public ir_hierarchical_visitor {
|
||||
public:
|
||||
ir_function_inlining_visitor()
|
||||
{
|
||||
progress = false;
|
||||
}
|
||||
|
||||
virtual ~ir_function_inlining_visitor()
|
||||
{
|
||||
/* empty */
|
||||
}
|
||||
|
||||
virtual ir_visitor_status visit_enter(ir_expression *);
|
||||
virtual ir_visitor_status visit_enter(ir_call *);
|
||||
virtual ir_visitor_status visit_enter(ir_return *);
|
||||
virtual ir_visitor_status visit_enter(ir_texture *);
|
||||
virtual ir_visitor_status visit_enter(ir_swizzle *);
|
||||
|
||||
bool progress;
|
||||
};
|
||||
|
||||
class ir_save_lvalue_visitor : public ir_hierarchical_visitor {
|
||||
public:
|
||||
virtual ir_visitor_status visit_enter(ir_dereference_array *);
|
||||
@@ -70,16 +48,6 @@ public:
|
||||
|
||||
} /* unnamed namespace */
|
||||
|
||||
bool
|
||||
do_function_inlining(exec_list *instructions)
|
||||
{
|
||||
ir_function_inlining_visitor v;
|
||||
|
||||
v.run(instructions);
|
||||
|
||||
return v.progress;
|
||||
}
|
||||
|
||||
static void
|
||||
replace_return_with_assignment(ir_instruction *ir, void *data)
|
||||
{
|
||||
@@ -310,52 +278,6 @@ ir_call::generate_inline(ir_instruction *next_ir)
|
||||
_mesa_hash_table_destroy(ht, NULL);
|
||||
}
|
||||
|
||||
|
||||
ir_visitor_status
|
||||
ir_function_inlining_visitor::visit_enter(ir_expression *ir)
|
||||
{
|
||||
(void) ir;
|
||||
return visit_continue_with_parent;
|
||||
}
|
||||
|
||||
|
||||
ir_visitor_status
|
||||
ir_function_inlining_visitor::visit_enter(ir_return *ir)
|
||||
{
|
||||
(void) ir;
|
||||
return visit_continue_with_parent;
|
||||
}
|
||||
|
||||
|
||||
ir_visitor_status
|
||||
ir_function_inlining_visitor::visit_enter(ir_texture *ir)
|
||||
{
|
||||
(void) ir;
|
||||
return visit_continue_with_parent;
|
||||
}
|
||||
|
||||
|
||||
ir_visitor_status
|
||||
ir_function_inlining_visitor::visit_enter(ir_swizzle *ir)
|
||||
{
|
||||
(void) ir;
|
||||
return visit_continue_with_parent;
|
||||
}
|
||||
|
||||
|
||||
ir_visitor_status
|
||||
ir_function_inlining_visitor::visit_enter(ir_call *ir)
|
||||
{
|
||||
if (can_inline(ir)) {
|
||||
ir->generate_inline(ir);
|
||||
ir->remove();
|
||||
this->progress = true;
|
||||
}
|
||||
|
||||
return visit_continue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Replaces references to the "orig" variable with a clone of "repl."
|
||||
*
|
||||
|
||||
@@ -72,8 +72,6 @@ do_optimization(struct exec_list *ir, const char *optimization,
|
||||
return do_dead_code_local(ir);
|
||||
} else if (strcmp(optimization, "do_dead_code_unlinked") == 0) {
|
||||
return do_dead_code_unlinked(ir);
|
||||
} else if (strcmp(optimization, "do_function_inlining") == 0) {
|
||||
return do_function_inlining(ir);
|
||||
} else if (sscanf(optimization,
|
||||
"do_lower_jumps ( %d , %d , %d , %d ) ",
|
||||
&int_0, &int_1, &int_2, &int_3) == 4) {
|
||||
|
||||
@@ -74,7 +74,7 @@ def main():
|
||||
expected = f.read().splitlines()
|
||||
|
||||
proc= subprocess.run(
|
||||
runner + ['--just-log', '--version', '150', file],
|
||||
runner + ['--just-log', '--version', '150', '--link', file],
|
||||
stdout=subprocess.PIPE
|
||||
)
|
||||
if proc.returncode == 255:
|
||||
|
||||
Reference in New Issue
Block a user