aboutsummaryrefslogtreecommitdiff
path: root/gcc/range-op-float.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2023-06-09 12:58:57 -0400
committerAndrew MacLeod <amacleod@redhat.com>2023-06-09 20:33:02 -0400
commit07767389fb390814d9b6142e9d0341b7b9fd1cc2 (patch)
tree1cfca91555a3c616d1c1cc012281866d039980f8 /gcc/range-op-float.cc
parenta2c019e27d77283f8711da7cef6340dac7c2d0f9 (diff)
downloadgcc-07767389fb390814d9b6142e9d0341b7b9fd1cc2.zip
gcc-07767389fb390814d9b6142e9d0341b7b9fd1cc2.tar.gz
gcc-07767389fb390814d9b6142e9d0341b7b9fd1cc2.tar.bz2
Provide a unified range-op table.
Create a table to prepare for unifying all operations into a single table. Move any operators which only occur in one table to the approriate initialization routine. Provide a mixed header file for range-ops with multiple categories. * range-op-float.cc (class float_table): Move to header. (float_table::float_table): Move float only operators to... (range_op_table::initialize_float_ops): Here. * range-op-mixed.h: New. * range-op.cc (integral_tree_table, pointer_tree_table): Moved to top of file. (float_tree_table): Moved from range-op-float.cc. (unified_tree_table): New. (unified_table::unified_table): New. Call initialize routines. (get_op_handler): Check unified table first. (range_op_handler::range_op_handler): Handle no type constructor. (integral_table::integral_table): Move integral only operators to... (range_op_table::initialize_integral_ops): Here. (pointer_table::pointer_table): Move pointer only operators to... (range_op_table::initialize_pointer_ops): Here. * range-op.h (enum bool_range_state): Move to range-op-mixed.h. (get_bool_state): Ditto. (empty_range_varying): Ditto. (relop_early_resolve): Ditto. (class range_op_table): Add new init methods for range types. (class integral_table): Move declaration to here. (class pointer_table): Move declaration to here. (class float_table): Move declaration to here.
Diffstat (limited to 'gcc/range-op-float.cc')
-rw-r--r--gcc/range-op-float.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index bb10acc..8659217 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see
#include "wide-int.h"
#include "value-relation.h"
#include "range-op.h"
+#include "range-op-mixed.h"
// Default definitions for floating point operators.
@@ -2807,15 +2808,6 @@ private:
}
} fop_div;
-// Instantiate a range_op_table for floating point operations.
-class float_table : public range_op_table
-{
- public:
- float_table ();
-} global_floating_table;
-
-// Pointer to the float table so the dispatch code can access it.
-range_op_table *floating_tree_table = &global_floating_table;
float_table::float_table ()
{
@@ -2833,6 +2825,19 @@ float_table::float_table ()
set (LE_EXPR, fop_le);
set (GT_EXPR, fop_gt);
set (GE_EXPR, fop_ge);
+
+ set (ABS_EXPR, fop_abs);
+ set (NEGATE_EXPR, fop_negate);
+ set (PLUS_EXPR, fop_plus);
+ set (MINUS_EXPR, fop_minus);
+ set (MULT_EXPR, fop_mult);
+}
+
+// Initialize any pointer operators to the primary table
+
+void
+range_op_table::initialize_float_ops ()
+{
set (UNLE_EXPR, fop_unordered_le);
set (UNLT_EXPR, fop_unordered_lt);
set (UNGE_EXPR, fop_unordered_ge);
@@ -2841,12 +2846,6 @@ float_table::float_table ()
set (ORDERED_EXPR, fop_ordered);
set (UNORDERED_EXPR, fop_unordered);
set (LTGT_EXPR, fop_ltgt);
-
- set (ABS_EXPR, fop_abs);
- set (NEGATE_EXPR, fop_negate);
- set (PLUS_EXPR, fop_plus);
- set (MINUS_EXPR, fop_minus);
- set (MULT_EXPR, fop_mult);
set (RDIV_EXPR, fop_div);
}