diff options
author | Roland Levillain <rpl@google.com> | 2014-09-18 15:25:07 +0100 |
---|---|---|
committer | Roland Levillain <rpl@google.com> | 2014-09-18 15:25:07 +0100 |
commit | 556c3d193134f6461f3e1fe17c032b087c5931a0 (patch) | |
tree | 436660c7155d0864c37f8aeabbc0f52e889a0cc2 /compiler/optimizing/constant_propagation.h | |
parent | 6aa606c9284ac31961f4c5b20c3645ac78acfaad (diff) | |
download | art-556c3d193134f6461f3e1fe17c032b087c5931a0.tar.gz art-556c3d193134f6461f3e1fe17c032b087c5931a0.tar.bz2 art-556c3d193134f6461f3e1fe17c032b087c5931a0.zip |
Initiate a constant propagation pass in the optimizing compiler.
- Perform constant folding on int and long additions and subtractions in
the optimizing compiler.
- Apply constant folding to conditions and comparisons.
Change-Id: Ic88783a3c975fda777c74c531e257fa777be42eb
Diffstat (limited to 'compiler/optimizing/constant_propagation.h')
-rw-r--r-- | compiler/optimizing/constant_propagation.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/compiler/optimizing/constant_propagation.h b/compiler/optimizing/constant_propagation.h new file mode 100644 index 0000000000..0729881888 --- /dev/null +++ b/compiler/optimizing/constant_propagation.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ART_COMPILER_OPTIMIZING_CONSTANT_PROPAGATION_H_ +#define ART_COMPILER_OPTIMIZING_CONSTANT_PROPAGATION_H_ + +#include "nodes.h" + +namespace art { + +/** + * Optimization pass performing a simple constant propagation on the + * SSA form. + */ +class ConstantPropagation : public ValueObject { + public: + explicit ConstantPropagation(HGraph* graph) + : graph_(graph) {} + + void Run(); + + private: + HGraph* const graph_; + + DISALLOW_COPY_AND_ASSIGN(ConstantPropagation); +}; + +} // namespace art + +#endif // ART_COMPILER_OPTIMIZING_CONSTANT_PROPAGATION_H_ |