Add generic folding function and use in CCP
authorSteven Perron <stevenperron@google.com>
Tue, 9 Jan 2018 17:45:46 +0000 (12:45 -0500)
committerSteven Perron <stevenperron@google.com>
Mon, 22 Jan 2018 19:26:49 +0000 (14:26 -0500)
commit6c409e30a2e4410d5b8c7223aeda790284b160b8
tree5513efe67e1ea577aeb4d32c8c1cfa349d1d8965
parent3b780db7f8fe81fc0f7446f32f4f604f3cf2485d
Add generic folding function and use in CCP

The current folding routines have a very cumbersome interface, make them
harder to use, and not a obvious how to extend.

This change is to create a new interface for the folding routines, and
show how it can be used by calling it from CCP.

This does not make a significant change to the behaviour of CCP.  In
general it should produce the same code as before; however it is
possible that an instruction that takes 32-bit integers as inputs and
the result is not a 32-bit integer or bool will not be folded as before.

It seems like andriod has a problem with INT32_MAX and the like.  I'll
explicitly define those if the are not already defined.
source/opt/constants.h
source/opt/fold.cpp
source/opt/fold.h
test/opt/CMakeLists.txt
test/opt/fold_test.cpp [new file with mode: 0644]