OSDN Git Service

Have constant folding be more flexible.
authorRoland Levillain <rpl@google.com>
Wed, 5 Aug 2015 09:21:34 +0000 (10:21 +0100)
committerRoland Levillain <rpl@google.com>
Wed, 5 Aug 2015 10:01:53 +0000 (11:01 +0100)
commit9867bc722f7c41e07a95397bc08b790cd21dc758
tree6bad203433f24a5556fe98e6480326ed30956c75
parentc90bc7c07f9bd24b5424cfb1e3f064fbae5334d6
Have constant folding be more flexible.

- Have Evaluate methods take as argument(s) and return value
  instances of HConstant (instead of built-in 32- or 64-bit
  integer values), to let the evaluated instruction choose
  the type of the statically evaluated node; for instance,
  art::HEqual::Evaluate shall return a HIntConstant
  node (as implementation of a Boolean constant) whatever
  the type of its inputs (a pair of HIntConstant or a pair
  of HLongConstant).
- Split the evaluation job from the operation logic: the
  former is addressed by Evaluate methods, while the latter
  is done by a generic Compute method.
- Adress valid BinOp(int, long) and BinOp(long, int) cases.
- Add a constructor to art::HIntConstant to build an integer
  constant from a `bool` value.

Change-Id: If84b6fe8406bb94ddb1aa8b02e36628dff526db3
compiler/optimizing/nodes.cc
compiler/optimizing/nodes.h
test/442-checker-constant-folding/src/Main.java