aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/cil32/cil-stmt.c
diff options
context:
space:
mode:
authorAndrea Ornstein <andrea.ornstein@st.com>2009-02-18 13:14:25 +0000
committerAndrea Ornstein <andrea.ornstein@st.com>2009-02-18 13:14:25 +0000
commit55696a394999c0e6d9df66e1de694e493bc18355 (patch)
treec4610e8115f95381f647248a31acc8480a1ff92c /gcc/config/cil32/cil-stmt.c
parent9c2921a9653dbb5afe44e60c5997c7434a380ef2 (diff)
New Snapshot from STMicroelectronics 2009-02-18 (rev 1349)st/cli
Changes from Gabriele Svelto and Andrea C. Ornstein - Added support for pointers in min/max builtins - Implemented address generation of imaginary numbers parts. - Reworked the code used for splitting switches. When splitting a switch with more than 8192 cases the default case label was set incorrectly causing an ICE during CFG creation, fixed. - Define shift instructions in the .md file, fixes a problem when the loop optimizer tries to calculate an instruction cost. - Fixed a bug which caused the cil_name attribute to be ignored during CIL emission. - Remove more redundant conversions. - Fixed a bug which caused an ICE when a NEGATE_EXPR had a pointer argument. - Optimized bit-field initializers when endianness is selected. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/st/cli@144262 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/cil32/cil-stmt.c')
-rw-r--r--gcc/config/cil32/cil-stmt.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/config/cil32/cil-stmt.c b/gcc/config/cil32/cil-stmt.c
index 0480ce38d53..70fdcf0c4a9 100644
--- a/gcc/config/cil32/cil-stmt.c
+++ b/gcc/config/cil32/cil-stmt.c
@@ -266,6 +266,41 @@ cil_call_nargs_base (const_cil_stmt stmt)
}
}
+/* Return the low value of the I-th case of CIL switch statement as an
+ HOST_WIDE_INT instead of a tree. */
+
+HOST_WIDE_INT
+cil_switch_case_low (const_cil_stmt stmt, size_t i)
+{
+ tree value;
+
+ gcc_assert (stmt->opcode == CIL_SWITCH);
+ gcc_assert (i < stmt->arg.labels->ncases);
+
+ value = CASE_LOW (stmt->arg.labels->cases[i]);
+ return tree_low_cst (value, TYPE_UNSIGNED (TREE_TYPE (value)));
+}
+
+/* Return the high value of the I-th case of CIL switch statement as an
+ HOST_WIDE_INT instead of a tree. If the case doesn't represent a range then
+ this function will return the case value (i.e. the low value). */
+
+HOST_WIDE_INT
+cil_switch_case_high (const_cil_stmt stmt, size_t i)
+{
+ tree value;
+
+ gcc_assert (stmt->opcode == CIL_SWITCH);
+ gcc_assert (i < stmt->arg.labels->ncases);
+
+ if (CASE_HIGH (stmt->arg.labels->cases[i]))
+ value = CASE_HIGH (stmt->arg.labels->cases[i]);
+ else
+ value = CASE_LOW (stmt->arg.labels->cases[i]);
+
+ return tree_low_cst (value, TYPE_UNSIGNED (TREE_TYPE (value)));
+}
+
/* Create a deep copy of the CIL statement pointed by STMT and return it. */
cil_stmt