/* Define partial schedule structures and functions for modulo sched. Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef GCC_MODULO_PS_H #define GCC_MODULO_PS_H typedef struct partial_schedule *partial_schedule_ptr; typedef struct ps_insn *ps_insn_ptr; /* The minimum (absolute) cycle that a node of ps was scheduled in. */ #define PS_MIN_CYCLE(ps) (((partial_schedule_ptr)(ps))->min_cycle) /* The maximum (absolute) cycle that a node of ps was scheduled in. */ #define PS_MAX_CYCLE(ps) (((partial_schedule_ptr)(ps))->max_cycle) /* Perform signed modulo, always returning a non-negative value. */ #define SMODULO(x,y) ((x)%(y) < 0 ? ((x)%(y) + (y)) : (x)%(y)) /* The number of different iterations the nodes in ps span, assuming the stage boundaries are placed efficiently. */ #define PS_STAGE_COUNT(ps) ((PS_MAX_CYCLE (ps) - PS_MIN_CYCLE (ps) \ + 1 + (ps)->ii - 1) / (ps)->ii) /* A single instruction in the partial schedule. */ struct ps_insn { /* The corresponding DDG_NODE. */ ddg_node_ptr node; /* The (absolute) cycle in which the PS instruction is scheduled. Same as SCHED_TIME (node). */ int cycle; /* The next/prev PS_INSN in the same row. */ ps_insn_ptr next_in_row, prev_in_row; /* The number of nodes in the same row that come after this node. */ int row_rest_count; }; /* Holds the partial schedule as an array of II rows. Each entry of the array points to a linked list of PS_INSNs, which represents the instructions that are scheduled for that row. */ struct partial_schedule { int ii; int history; /* Threshold for conflict checking using DFA. */ ps_insn_ptr *rows; int min_cycle; int max_cycle; ddg_ptr g; }; extern int issue_rate; partial_schedule_ptr create_partial_schedule (int ii, ddg_ptr, int history); void free_partial_schedule (partial_schedule_ptr); void reset_partial_schedule (partial_schedule_ptr, int new_ii); void print_partial_schedule (partial_schedule_ptr, FILE *); ps_insn_ptr ps_add_node_check_conflicts (partial_schedule_ptr, ddg_node_ptr node, int cycle); void rotate_partial_schedule (partial_schedule_ptr, int); void set_row_column_for_ps (partial_schedule_ptr); #endif /* GCC_MODULO_PS_H */