summaryrefslogtreecommitdiffstats
path: root/ir_dead_code.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-04-16 16:43:47 -0700
committerEric Anholt <[email protected]>2010-04-19 15:33:52 -0700
commit7d21104a8b92c139051e9a224c5d863802a8ade6 (patch)
tree9fbd9d256c6bd64063439c0adfbd95ec5561a64d /ir_dead_code.h
parent71df19f5ef6e78beb5160801f81468184b75447e (diff)
Remove dead code assignments and variable declarations.
This pass only works on assignments where the variable is never referenced. There is no code flow analysis, so it can't do a better job of avoiding redundant assignments. For now, the optimizer only does do_dead_code_unlinked(), so it won't trim the builtin variable list or initializers outside of the scope of functions. This is because we don't have the visibility into other functions that might get linked in in order to eliminate work on global variables.
Diffstat (limited to 'ir_dead_code.h')
-rw-r--r--ir_dead_code.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/ir_dead_code.h b/ir_dead_code.h
new file mode 100644
index 00000000000..25bf6f6256c
--- /dev/null
+++ b/ir_dead_code.h
@@ -0,0 +1,32 @@
+/*
+ * 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_dead_code.h
+ *
+ * Eliminates dead assignments and variable declarations from the code.
+ */
+
+bool do_dead_code(exec_list *instructions);
+bool do_dead_code_unlinked(exec_list *instructions);