eclipse / omr

Eclipse OMR™ Cross platform components for building reliable, high performance language runtimes
http://www.eclipse.org/omr
Other
934 stars 392 forks source link

Refactor SIMPLIFY_BRANCH_ARITHMETIC Macro #7307

Open jmesyou opened 2 months ago

jmesyou commented 2 months ago

This commit removes the SIMPLIFY_BRANCH_ARITHMETIC and replaces it with a templated instantiation that seeks to emulate a closure. The templated class is provided with the mutators and accessors for nodes so tha tthe notation of passing in getter names through the macro is no longer needed

The logic from the original macro to check whether a node is a viable candidate for simplification and which optimization to perform is simplified.

The old macro also contained side effects which modified the local variables at the call site and this has been removed and replaced with equivalent semantics.