summaryrefslogtreecommitdiff
path: root/ir_function_inlining.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-04-22 17:52:59 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-04-23 16:12:44 -0700
commite8e97487223aa71ced5d519c15ca0d21e8d28da5 (patch)
tree90886496dd56f526e2f6d33f1c20991042916049 /ir_function_inlining.cpp
parentec9e73870cc150adbb3e76762a26c7f51d8aceb4 (diff)
ir_function_inlining: Implement inlining in many more cases.
We still don't inline for control flow in the inlined function, and we don't have any limits on what we will inline.
Diffstat (limited to 'ir_function_inlining.cpp')
-rw-r--r--ir_function_inlining.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/ir_function_inlining.cpp b/ir_function_inlining.cpp
index 025124ae2b..ba556a8499 100644
--- a/ir_function_inlining.cpp
+++ b/ir_function_inlining.cpp
@@ -122,6 +122,9 @@ ir_function_cloning_visitor::visit(ir_variable *ir)
void
ir_function_cloning_visitor::visit(ir_loop *ir)
{
+ /* FINISHME: Implement loop cloning. */
+ assert(0);
+
(void)ir;
this->result = NULL;
}
@@ -129,6 +132,9 @@ ir_function_cloning_visitor::visit(ir_loop *ir)
void
ir_function_cloning_visitor::visit(ir_loop_jump *ir)
{
+ /* FINISHME: Implement loop cloning. */
+ assert(0);
+
(void) ir;
this->result = NULL;
}
@@ -137,6 +143,7 @@ ir_function_cloning_visitor::visit(ir_loop_jump *ir)
void
ir_function_cloning_visitor::visit(ir_function_signature *ir)
{
+ assert(0);
(void)ir;
this->result = NULL;
}
@@ -145,6 +152,7 @@ ir_function_cloning_visitor::visit(ir_function_signature *ir)
void
ir_function_cloning_visitor::visit(ir_function *ir)
{
+ assert(0);
(void) ir;
this->result = NULL;
}
@@ -274,32 +282,14 @@ ir_function_cloning_visitor::visit(ir_return *ir)
void
ir_function_cloning_visitor::visit(ir_if *ir)
{
+ /* FINISHME: Implement if cloning. */
+ assert(0);
+
(void) ir;
result = NULL;
}
bool
-can_inline(ir_call *call)
-{
- bool found_return = false;
-
- /* FINISHME: Right now we only allow a single statement that is a return.
- */
- foreach_iter(exec_list_iterator, iter, call->get_callee()->body) {
- ir_instruction *ir = (ir_instruction *)iter.get();
- if (ir->get_next()->get_next() != NULL)
- return false;
-
- if (!ir->as_return())
- return false;
-
- found_return = true;
- }
-
- return found_return;
-}
-
-bool
automatic_inlining_predicate(ir_instruction *ir)
{
ir_call *call = ir->as_call();