[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 34/43] tcg: Add tcg-constr.c.inc
From: |
Richard Henderson |
Subject: |
[PATCH 34/43] tcg: Add tcg-constr.c.inc |
Date: |
Tue, 8 Sep 2020 17:16:38 -0700 |
Begin conversion of constraints to pre-validated, read-only entities.
To begin, create a simple method by which sets of TCGTargetOpDef
structures may be declared and used. This simplifies each host's
tcg_target_op_def function and ensures that we have a collected
set of constraints.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/tcg-constr.c.inc | 108 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
create mode 100644 tcg/tcg-constr.c.inc
diff --git a/tcg/tcg-constr.c.inc b/tcg/tcg-constr.c.inc
new file mode 100644
index 0000000000..f7490a096e
--- /dev/null
+++ b/tcg/tcg-constr.c.inc
@@ -0,0 +1,108 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * TCG backend data: operand constaints.
+ * Copyright (c) 2020 Linaro
+ */
+
+/*
+ * Define structures for each set of constraints.
+ */
+
+#define C_PFX1(P, A) P##A
+#define C_PFX2(P, A, B) P##A##_##B
+#define C_PFX3(P, A, B, C) P##A##_##B##_##C
+#define C_PFX4(P, A, B, C, D) P##A##_##B##_##C##_##D
+#define C_PFX5(P, A, B, C, D, E) P##A##_##B##_##C##_##D##_##E
+#define C_PFX6(P, A, B, C, D, E, F) P##A##_##B##_##C##_##D##_##E##_##F
+
+#define C_O0_I1(I1) \
+ static const TCGTargetOpDef C_PFX1(c_o0_i1_, I1) \
+ = { .args_ct_str = { #I1 } };
+
+#define C_O0_I2(I1, I2) \
+ static const TCGTargetOpDef C_PFX2(c_o0_i2_, I1, I2) \
+ = { .args_ct_str = { #I1, #I2 } };
+
+#define C_O0_I3(I1, I2, I3) \
+ static const TCGTargetOpDef C_PFX3(c_o0_i3_, I1, I2, I3) \
+ = { .args_ct_str = { #I1, #I2, #I3 } };
+
+#define C_O0_I4(I1, I2, I3, I4) \
+ static const TCGTargetOpDef C_PFX4(c_o0_i4_, I1, I2, I3, I4) \
+ = { .args_ct_str = { #I1, #I2, #I3, #I4 } };
+
+#define C_O1_I1(O1, I1) \
+ static const TCGTargetOpDef C_PFX2(c_o1_i1_, O1, I1) \
+ = { .args_ct_str = { #O1, #I1 } };
+
+#define C_O1_I2(O1, I1, I2) \
+ static const TCGTargetOpDef C_PFX3(c_o1_i2_, O1, I1, I2) \
+ = { .args_ct_str = { #O1, #I1, #I2 } };
+
+#define C_O1_I3(O1, I1, I2, I3) \
+ static const TCGTargetOpDef C_PFX4(c_o1_i3_, O1, I1, I2, I3) \
+ = { .args_ct_str = { #O1, #I1, #I2, #I3 } };
+
+#define C_O1_I4(O1, I1, I2, I3, I4) \
+ static const TCGTargetOpDef C_PFX5(c_o1_i4_, O1, I1, I2, I3, I4) \
+ = { .args_ct_str = { #O1, #I1, #I2, #I3, #I4 } };
+
+#define C_N1_I2(O1, I1, I2) \
+ static const TCGTargetOpDef C_PFX3(c_n1_i2_, O1, I1, I2) \
+ = { .args_ct_str = { "&" #O1, #I1, #I2 } };
+
+#define C_O2_I1(O1, O2, I1) \
+ static const TCGTargetOpDef C_PFX3(c_o2_i1_, O1, O2, I1) \
+ = { .args_ct_str = { #O1, #O2, #I1 } };
+
+#define C_O2_I2(O1, O2, I1, I2) \
+ static const TCGTargetOpDef C_PFX4(c_o2_i2_, O1, O2, I1, I2) \
+ = { .args_ct_str = { #O1, #O2, #I1, #I2 } };
+
+#define C_O2_I3(O1, O2, I1, I2, I3) \
+ static const TCGTargetOpDef C_PFX5(c_o2_i3_, O1, O2, I1, I2, I3) \
+ = { .args_ct_str = { #O1, #O2, #I1, #I2, #I3 } };
+
+#define C_O2_I4(O1, O2, I1, I2, I3, I4) \
+ static const TCGTargetOpDef C_PFX6(c_o2_i4_, O1, O2, I1, I2, I3, I4) \
+ = { .args_ct_str = { #O1, #O2, #I1, #I2, #I3, #I4 } };
+
+#include "tcg-target-constr.h"
+
+
+/*
+ * Redefine the macros so that they now reference those structures.
+ * These values should be returned from tcg_target_op_def().
+ */
+
+#undef C_O0_I1
+#undef C_O0_I2
+#undef C_O0_I3
+#undef C_O0_I4
+#undef C_O1_I1
+#undef C_O1_I2
+#undef C_O1_I3
+#undef C_O1_I4
+#undef C_N1_I2
+#undef C_O2_I1
+#undef C_O2_I2
+#undef C_O2_I3
+#undef C_O2_I4
+
+#define C_O0_I1(I1) &C_PFX1(c_o0_i1_, I1)
+#define C_O0_I2(I1, I2) &C_PFX2(c_o0_i2_, I1, I2)
+#define C_O0_I3(I1, I2, I3) &C_PFX3(c_o0_i3_, I1, I2, I3)
+#define C_O0_I4(I1, I2, I3, I4) &C_PFX4(c_o0_i4_, I1, I2, I3, I4)
+
+#define C_O1_I1(O1, I1) &C_PFX2(c_o1_i1_, O1, I1)
+#define C_O1_I2(O1, I1, I2) &C_PFX3(c_o1_i2_, O1, I1, I2)
+#define C_O1_I3(O1, I1, I2, I3) &C_PFX4(c_o1_i3_, O1, I1, I2, I3)
+#define C_O1_I4(O1, I1, I2, I3, I4) &C_PFX5(c_o1_i4_, O1, I1, I2, I3, I4)
+
+#define C_N1_I2(O1, I1, I2) &C_PFX3(c_n1_i2_, O1, I1, I2)
+
+#define C_O2_I1(O1, O2, I1) &C_PFX3(c_o2_i1_, O1, O2, I1)
+#define C_O2_I2(O1, O2, I1, I2) &C_PFX4(c_o2_i2_, O1, O2, I1, I2)
+#define C_O2_I3(O1, O2, I1, I2, I3) &C_PFX5(c_o2_i3_, O1, O2, I1, I2, I3)
+#define C_O2_I4(O1, O2, I1, I2, I3, I4) \
+ &C_PFX6(c_o2_i4_, O1, O2, I1, I2, I3, I4)
--
2.25.1
- [PATCH 20/43] tcg/optimize: Adjust TempOptInfo allocation, (continued)
- [PATCH 20/43] tcg/optimize: Adjust TempOptInfo allocation, Richard Henderson, 2020/09/08
- [PATCH 23/43] tcg: Use tcg_constant_i32 with icount expander, Richard Henderson, 2020/09/08
- [PATCH 22/43] tcg: Convert tcg_gen_dupi_vec to TCG_CONST, Richard Henderson, 2020/09/08
- [PATCH 24/43] tcg: Use tcg_constant_{i32,i64} with tcg int expanders, Richard Henderson, 2020/09/08
- [PATCH 25/43] tcg: Use tcg_constant_{i32,i64} with tcg plugins, Richard Henderson, 2020/09/08
- [PATCH 26/43] tcg: Use tcg_constant_{i32, i64, vec} with gvec expanders, Richard Henderson, 2020/09/08
- [PATCH 27/43] tcg/tci: Add special tci_movi_{i32,i64} opcodes, Richard Henderson, 2020/09/08
- [PATCH 28/43] tcg: Remove movi and dupi opcodes, Richard Henderson, 2020/09/08
- [PATCH 29/43] tcg: Add tcg_reg_alloc_dup2, Richard Henderson, 2020/09/08
- [PATCH 31/43] tcg: Remove tcg_gen_dup{8,16,32,64}i_vec, Richard Henderson, 2020/09/08
- [PATCH 34/43] tcg: Add tcg-constr.c.inc,
Richard Henderson <=
- [PATCH 30/43] tcg/i386: Use tcg_constant_vec with tcg vec expanders, Richard Henderson, 2020/09/08
- [PATCH 32/43] tcg/ppc: Use tcg_constant_vec with tcg vec expanders, Richard Henderson, 2020/09/08
- [PATCH 33/43] tcg/aarch64: Use tcg_constant_vec with tcg vec expanders, Richard Henderson, 2020/09/08
- [PATCH 35/43] tcg/i386: Convert to tcg-constr.c.inc, Richard Henderson, 2020/09/08
- [PATCH 36/43] tcg/aarch64: Convert to tcg-constr.c.inc, Richard Henderson, 2020/09/08
- [PATCH 37/43] tcg/arm: Convert to tcg-constr.c.inc, Richard Henderson, 2020/09/08
- [PATCH 38/43] tcg/mips: Convert to tcg-constr.c.inc, Richard Henderson, 2020/09/08
- [PATCH 39/43] tcg/ppc: Convert to tcg-constr.c.inc, Richard Henderson, 2020/09/08
- [PATCH 40/43] tcg/riscv: Convert to tcg-constr.c.inc, Richard Henderson, 2020/09/08
- [PATCH 41/43] tcg/s390: Convert to tcg-constr.c.inc, Richard Henderson, 2020/09/08