Ian Romanick | 8895bae | 2010-05-14 12:39:23 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2010 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | * DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | #define NULL 0 |
| 24 | #include "ir.h" |
| 25 | #include "ir_hierarchical_visitor.h" |
| 26 | |
| 27 | ir_visitor_status |
| 28 | ir_hierarchical_visitor::visit(ir_variable *ir) |
| 29 | { |
| 30 | (void) ir; |
| 31 | return visit_continue; |
| 32 | } |
| 33 | |
| 34 | ir_visitor_status |
| 35 | ir_hierarchical_visitor::visit(ir_constant *ir) |
| 36 | { |
| 37 | (void) ir; |
| 38 | return visit_continue; |
| 39 | } |
| 40 | |
| 41 | ir_visitor_status |
| 42 | ir_hierarchical_visitor::visit(ir_loop_jump *ir) |
| 43 | { |
| 44 | (void) ir; |
| 45 | return visit_continue; |
| 46 | } |
| 47 | |
| 48 | ir_visitor_status |
Ian Romanick | f3a002b | 2010-05-19 12:02:19 +0200 | [diff] [blame^] | 49 | ir_hierarchical_visitor::visit(ir_dereference_variable *ir) |
| 50 | { |
| 51 | (void) ir; |
| 52 | return visit_continue; |
| 53 | } |
| 54 | |
| 55 | ir_visitor_status |
Ian Romanick | 8895bae | 2010-05-14 12:39:23 -0700 | [diff] [blame] | 56 | ir_hierarchical_visitor::visit_enter(ir_loop *ir) |
| 57 | { |
| 58 | (void) ir; |
| 59 | return visit_continue; |
| 60 | } |
| 61 | |
| 62 | ir_visitor_status |
| 63 | ir_hierarchical_visitor::visit_leave(ir_loop *ir) |
| 64 | { |
| 65 | (void) ir; |
| 66 | return visit_continue; |
| 67 | } |
| 68 | |
| 69 | ir_visitor_status |
| 70 | ir_hierarchical_visitor::visit_enter(ir_function_signature *ir) |
| 71 | { |
| 72 | (void) ir; |
| 73 | return visit_continue; |
| 74 | } |
| 75 | |
| 76 | ir_visitor_status |
| 77 | ir_hierarchical_visitor::visit_leave(ir_function_signature *ir) |
| 78 | { |
| 79 | (void) ir; |
| 80 | return visit_continue; |
| 81 | } |
| 82 | |
| 83 | ir_visitor_status |
| 84 | ir_hierarchical_visitor::visit_enter(ir_function *ir) |
| 85 | { |
| 86 | (void) ir; |
| 87 | return visit_continue; |
| 88 | } |
| 89 | |
| 90 | ir_visitor_status |
| 91 | ir_hierarchical_visitor::visit_leave(ir_function *ir) |
| 92 | { |
| 93 | (void) ir; |
| 94 | return visit_continue; |
| 95 | } |
| 96 | |
| 97 | ir_visitor_status |
| 98 | ir_hierarchical_visitor::visit_enter(ir_expression *ir) |
| 99 | { |
| 100 | (void) ir; |
| 101 | return visit_continue; |
| 102 | } |
| 103 | |
| 104 | ir_visitor_status |
| 105 | ir_hierarchical_visitor::visit_leave(ir_expression *ir) |
| 106 | { |
| 107 | (void) ir; |
| 108 | return visit_continue; |
| 109 | } |
| 110 | |
| 111 | ir_visitor_status |
| 112 | ir_hierarchical_visitor::visit_enter(ir_swizzle *ir) |
| 113 | { |
| 114 | (void) ir; |
| 115 | return visit_continue; |
| 116 | } |
| 117 | |
| 118 | ir_visitor_status |
| 119 | ir_hierarchical_visitor::visit_leave(ir_swizzle *ir) |
| 120 | { |
| 121 | (void) ir; |
| 122 | return visit_continue; |
| 123 | } |
| 124 | |
| 125 | ir_visitor_status |
Ian Romanick | f3a002b | 2010-05-19 12:02:19 +0200 | [diff] [blame^] | 126 | ir_hierarchical_visitor::visit_enter(ir_dereference_array *ir) |
Ian Romanick | 8895bae | 2010-05-14 12:39:23 -0700 | [diff] [blame] | 127 | { |
| 128 | (void) ir; |
| 129 | return visit_continue; |
| 130 | } |
| 131 | |
| 132 | ir_visitor_status |
Ian Romanick | f3a002b | 2010-05-19 12:02:19 +0200 | [diff] [blame^] | 133 | ir_hierarchical_visitor::visit_leave(ir_dereference_array *ir) |
| 134 | { |
| 135 | (void) ir; |
| 136 | return visit_continue; |
| 137 | } |
| 138 | |
| 139 | ir_visitor_status |
| 140 | ir_hierarchical_visitor::visit_enter(ir_dereference_record *ir) |
| 141 | { |
| 142 | (void) ir; |
| 143 | return visit_continue; |
| 144 | } |
| 145 | |
| 146 | ir_visitor_status |
| 147 | ir_hierarchical_visitor::visit_leave(ir_dereference_record *ir) |
Ian Romanick | 8895bae | 2010-05-14 12:39:23 -0700 | [diff] [blame] | 148 | { |
| 149 | (void) ir; |
| 150 | return visit_continue; |
| 151 | } |
| 152 | |
| 153 | ir_visitor_status |
| 154 | ir_hierarchical_visitor::visit_enter(ir_assignment *ir) |
| 155 | { |
| 156 | (void) ir; |
| 157 | return visit_continue; |
| 158 | } |
| 159 | |
| 160 | ir_visitor_status |
| 161 | ir_hierarchical_visitor::visit_leave(ir_assignment *ir) |
| 162 | { |
| 163 | (void) ir; |
| 164 | return visit_continue; |
| 165 | } |
| 166 | |
| 167 | ir_visitor_status |
| 168 | ir_hierarchical_visitor::visit_enter(ir_call *ir) |
| 169 | { |
| 170 | (void) ir; |
| 171 | return visit_continue; |
| 172 | } |
| 173 | |
| 174 | ir_visitor_status |
| 175 | ir_hierarchical_visitor::visit_leave(ir_call *ir) |
| 176 | { |
| 177 | (void) ir; |
| 178 | return visit_continue; |
| 179 | } |
| 180 | |
| 181 | ir_visitor_status |
| 182 | ir_hierarchical_visitor::visit_enter(ir_return *ir) |
| 183 | { |
| 184 | (void) ir; |
| 185 | return visit_continue; |
| 186 | } |
| 187 | |
| 188 | ir_visitor_status |
| 189 | ir_hierarchical_visitor::visit_leave(ir_return *ir) |
| 190 | { |
| 191 | (void) ir; |
| 192 | return visit_continue; |
| 193 | } |
| 194 | |
| 195 | ir_visitor_status |
| 196 | ir_hierarchical_visitor::visit_enter(ir_if *ir) |
| 197 | { |
| 198 | (void) ir; |
| 199 | return visit_continue; |
| 200 | } |
| 201 | |
| 202 | ir_visitor_status |
| 203 | ir_hierarchical_visitor::visit_leave(ir_if *ir) |
| 204 | { |
| 205 | (void) ir; |
| 206 | return visit_continue; |
| 207 | } |
| 208 | |
| 209 | void |
| 210 | ir_hierarchical_visitor::run(exec_list *instructions) |
| 211 | { |
| 212 | foreach_list(n, instructions) { |
| 213 | ir_instruction *ir = (ir_instruction *) n; |
| 214 | |
| 215 | if (ir->accept(this) != visit_continue) |
| 216 | break; |
| 217 | } |
| 218 | } |