*/
/*@{*/
virtual class ir_variable * as_variable() { return NULL; }
+ virtual class ir_function * as_function() { return NULL; }
virtual class ir_dereference * as_dereference() { return NULL; }
virtual class ir_rvalue * as_rvalue() { return NULL; }
virtual class ir_label * as_label() { return NULL; }
public:
ir_function(const char *name);
+ virtual ir_function *as_function()
+ {
+ return this;
+ }
+
virtual void accept(ir_visitor *v)
{
v->visit(this);
*/
/*@{*/
virtual void visit(ir_variable *);
- virtual void visit(ir_label *);
virtual void visit(ir_loop *);
virtual void visit(ir_loop_jump *);
virtual void visit(ir_function_signature *);
}
-void
-ir_dead_code_visitor::visit(ir_label *ir)
-{
- ir->signature->accept(this);
-}
-
void
ir_dead_code_visitor::visit(ir_loop *ir)
{
foreach_iter(exec_list_iterator, iter, *instructions) {
ir_instruction *ir = (ir_instruction *)iter.get();
- ir_label *label = ir->as_label();
- if (label) {
- if (do_dead_code(&label->signature->body))
- progress = true;
+ ir_function *f = ir->as_function();
+ if (f) {
+ foreach_iter(exec_list_iterator, sigiter, *f) {
+ ir_function_signature *sig =
+ (ir_function_signature *) sigiter.get();
+ if (do_dead_code(&sig->body))
+ progress = true;
+ }
}
}