GCC Middle and Back End API Reference
case_node Struct Reference
Collaboration diagram for case_node:

Data Fields

struct case_nodeleft
struct case_noderight
struct case_nodeparent
tree low
tree high
tree code_label
int prob
int subtree_prob

Detailed Description

@verbatim 

Expands front end tree to back end RTL for GCC Copyright (C) 1987-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

   This file handles the generation of rtl code from tree structure
   above the level of expressions, using subroutines in exp*.c and emit-rtl.c.
   The functions whose names start with `expand_' are called by the
   expander to generate RTL instructions for various kinds of constructs.  
   Functions and data structures for expanding case statements.  
   Case label structure, used to hold info on labels within case
   statements.  We handle "range" labels; for a single-value label
   as in C, the high and low limits are the same.

   We start with a vector of case nodes sorted in ascending order, and
   the default label as the last element in the vector.  Before expanding
   to RTL, we transform this vector into a list linked via the RIGHT
   fields in the case_node struct.  Nodes with higher case values are
   later in the list.

   Switch statements can be output in three forms.  A branch table is
   used if there are more than a few labels and the labels are dense
   within the range between the smallest and largest case value.  If a
   branch table is used, no further manipulations are done with the case
   node chain.

   The alternative to the use of a branch table is to generate a series
   of compare and jump insns.  When that is done, we use the LEFT, RIGHT,
   and PARENT fields to hold a binary tree.  Initially the tree is
   totally unbalanced, with everything on the right.  We balance the tree
   with nodes on the left having lower case values than the parent
   and nodes on the right having higher values.  We then output the tree
   in order.

   For very small, suitable switch statements, we can generate a series
   of simple bit test and branches instead.  

Field Documentation

tree case_node::code_label

Referenced by node_has_low_bound().

tree case_node::high

Referenced by node_has_low_bound().

struct case_node* case_node::left

Referenced by node_has_low_bound().

tree case_node::low
struct case_node* case_node::parent
int case_node::prob

Referenced by node_has_low_bound().

struct case_node* case_node::right

Referenced by node_has_low_bound().

int case_node::subtree_prob
     Probability of reaching subtree rooted at this node 

Referenced by node_has_low_bound().


The documentation for this struct was generated from the following file: