Builtin functions have been handled until now as special cases in gimple-range-fold.cc. This set of patches makes the changes required to create a range_operator for those functions.  This allows them to behave like a normal unary/binary operation through out the ranger ecosystem.  In particular, it will enable us to make GORI aware of them as we can now provide op1_range and op2_range routines, as well as registering an relations as needed.  None of these enhanced functions are provided yet, this is strictly a conversion.  This enables us to do this for any operation with 1 or 2 operands.

There are 17 patches, some are bug fixes, some are infrastructure, a couple are just missing functionality, but most are them are conversions of the builtins.  I did each builtin as a separate patch so if a regression triggers, we can pinpoint it faster.

Of note:

Patch 2 : Modifies the range_op_handler class to store an integer handler and a float handler rather than the old tree-code and type.  By looking up the handler immediately and storing the pointer, this opens up the possibility of processing handlers which are not in a tree-code table.

Patch 3 : Range-ops is suppose to be IL independent, designed to work in RTL land as well.  A little bit of gimple had crept in, and I needed a layer that is gimple aware.  This patch introduces a gimple_range_op_handler which inherits from range_op_handler, and acts as the connector between the gimple IL and range-ops. Some of that code was in range-ops, and a lot more was located in the GORI file.  All those bits and pieces have been moved into the new class.

Patch 7 : This patch adjusts gimple_range_op_handler constructor to also check if a builtin function call might have a range_operator object available, and if so, return that.  This initial conversion also adds CFN_BUILT_IN_CONSTANT_P as the first builtin, removing it from the big switch in gimple-range-fold.cc.

Patch 8-16 :  Moves SIGNBIT, TOUPPER/LOWER, POPCOUNT, CLZ, CTZ, CLRSB, UBSAN*, STRLEN, and GOACC to range-ops.

patch 17: Finally, moves CFA_BUILT_IN_PARITY to range-ops, and removes the builtin-function code checks from range_of_call in gimple_range-fold.cc

These patches all bootstrap on x86_64-pc-linux-gnu with no regressions.   Performance wise, it all ends up as approximately a wash. (VRP a hair slower, threading a hair faster)

Pushed.

Andrew

Reply via email to