dead_code_elimination.h revision 72bceff11a98cc1ecdb64a6fae16c521f99ec6a7
172bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain/*
272bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * Copyright (C) 2014 The Android Open Source Project
372bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain *
472bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * Licensed under the Apache License, Version 2.0 (the "License");
572bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * you may not use this file except in compliance with the License.
672bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * You may obtain a copy of the License at
772bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain *
872bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain *      http://www.apache.org/licenses/LICENSE-2.0
972bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain *
1072bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * Unless required by applicable law or agreed to in writing, software
1172bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * distributed under the License is distributed on an "AS IS" BASIS,
1272bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1372bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * See the License for the specific language governing permissions and
1472bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * limitations under the License.
1572bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain */
1672bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain
1772bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain#ifndef ART_COMPILER_OPTIMIZING_DEAD_CODE_ELIMINATION_H_
1872bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain#define ART_COMPILER_OPTIMIZING_DEAD_CODE_ELIMINATION_H_
1972bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain
2072bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain#include "nodes.h"
2172bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain
2272bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillainnamespace art {
2372bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain
2472bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain/**
2572bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * Optimization pass performing dead code elimination (removal of
2672bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain * unused variables/instructions) on the SSA form.
2772bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain */
2872bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillainclass DeadCodeElimination : public ValueObject {
2972bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain public:
3072bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain  explicit DeadCodeElimination(HGraph* graph)
3172bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain      : graph_(graph) {}
3272bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain
3372bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain  void Run();
3472bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain
3572bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain private:
3672bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain  HGraph* const graph_;
3772bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain
3872bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain  DISALLOW_COPY_AND_ASSIGN(DeadCodeElimination);
3972bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain};
4072bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain
4172bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain}  // namespace art
4272bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain
4372bceff11a98cc1ecdb64a6fae16c521f99ec6a7Roland Levillain#endif  // ART_COMPILER_OPTIMIZING_DEAD_CODE_ELIMINATION_H_
44