1d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray/*
2d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray * Copyright (C) 2014 The Android Open Source Project
3d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray *
4d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray * Licensed under the Apache License, Version 2.0 (the "License");
5d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray * you may not use this file except in compliance with the License.
6d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray * You may obtain a copy of the License at
7d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray *
8d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray *      http://www.apache.org/licenses/LICENSE-2.0
9d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray *
10d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray * Unless required by applicable law or agreed to in writing, software
11d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray * distributed under the License is distributed on an "AS IS" BASIS,
12d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray * See the License for the specific language governing permissions and
14d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray * limitations under the License.
15d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray */
16d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray
17d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray#ifndef ART_COMPILER_OPTIMIZING_GVN_H_
18d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray#define ART_COMPILER_OPTIMIZING_GVN_H_
19d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray
20d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray#include "nodes.h"
215e6916cea259897baaca019c5c7a5d05746306edNicolas Geoffray#include "optimization.h"
22d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray
23d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffraynamespace art {
24d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray
25827eedbfa882496407375f22b08243a38a5bd53bNicolas Geoffrayclass SideEffectsAnalysis;
26d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray
273159674c0863f53cfbc1913d493550221ac47f02Nicolas Geoffrayclass GVNOptimization : public HOptimization {
283159674c0863f53cfbc1913d493550221ac47f02Nicolas Geoffray public:
2944b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames  GVNOptimization(HGraph* graph,
3044b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames                  const SideEffectsAnalysis& side_effects,
3144b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames                  const char* pass_name = kGlobalValueNumberingPassName)
3244b9cf937836bb33139123e15ca8b586b5853268Alexandre Rames      : HOptimization(graph, pass_name), side_effects_(side_effects) {}
333159674c0863f53cfbc1913d493550221ac47f02Nicolas Geoffray
34827eedbfa882496407375f22b08243a38a5bd53bNicolas Geoffray  void Run() OVERRIDE;
353159674c0863f53cfbc1913d493550221ac47f02Nicolas Geoffray
367c3952f423b8213083d60596a5f0bf4237ca3f7bAndreas Gampe  static constexpr const char* kGlobalValueNumberingPassName = "GVN";
377c3952f423b8213083d60596a5f0bf4237ca3f7bAndreas Gampe
383159674c0863f53cfbc1913d493550221ac47f02Nicolas Geoffray private:
3986dde1658a1951c251dd5c6ff21ecc5c281879a6Nicolas Geoffray  const SideEffectsAnalysis& side_effects_;
4086dde1658a1951c251dd5c6ff21ecc5c281879a6Nicolas Geoffray
413159674c0863f53cfbc1913d493550221ac47f02Nicolas Geoffray  DISALLOW_COPY_AND_ASSIGN(GVNOptimization);
423159674c0863f53cfbc1913d493550221ac47f02Nicolas Geoffray};
433159674c0863f53cfbc1913d493550221ac47f02Nicolas Geoffray
44d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray}  // namespace art
45d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray
46d31cf3d55a0847c018c4eaa2b349b8eea509de64Nicolas Geoffray#endif  // ART_COMPILER_OPTIMIZING_GVN_H_
47