DDGraph.xcc

Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechin@st.com).

Copyright 2002 - 2007 STMicroelectronics. Copyright 1995 - 1998 Commissariat a l'Energie Atomique.

This program is free software; you can redistribute it and/or modify it under the terms of either (at your option): the GNU General Public License (GPL) version 2; the GNU Lesser General Public License (LGPL) version 2.1; any later version of these licences as published by the Free Software Foundation.

DDGraph_PROCESSING— If non-zero, use PROCESSING times in DDGraphArc latencies.
//#define DDGraph_PROCESSING 0
#ifndef DDGraph_PROCESSING
extern int DDGraph_PROCESSING;
#endif//DDGraph_PROCESSING
DDGraphArc_pretty— Pretty-print this DDGraphArc.
bool
DDGraphArc_pretty(DDGraphArc this, FILE *file);
DDGraphNode_index— This DDGraphNode index in the DDGraph.
static inline uint32_t
DDGraphNode_index(struct DDGraphNode_ *this)
{
  return DDGraphNode_INDEX(this);
}
DDGraphNode_FORENTER_DDGraphArc— Iterate over the entering DDGraphArcs.
#define DDGraphNode_FORENTER_DDGraphArc(this, arc) \
  DGraphNode_FORENTER(this, DDGraphArc_, arc) {
#define DDGraphNode_ENDENTER_DDGraphArc \
  } DGraphNode_ENDENTER;
DDGraphNode_FORLEAVE_DDGraphArc— Iterate over the leaving DDGraphArcs.
#define DDGraphNode_FORLEAVE_DDGraphArc(this, arc) \
  DGraphNode_FORLEAVE(this, DDGraphArc_, arc) {
#define DDGraphNode_ENDLEAVE_DDGraphArc \
  } DGraphNode_ENDLEAVE;
DDGraphNode_pretty— Pretty-print this DDGraphNode.
bool
DDGraphNode_pretty(DDGraphNode this, FILE *file);
DDGraphNode_name— Display this DDGraphNode name for Integer Programming formulations.
const char *
DDGraphNode_name(DDGraphNode this);
DDGraphKind— enumerates the DDGraph kinds.
typedef enum {
  DDGraphKind_Early,    // Early dates DDGraph.
  DDGraphKind_Late,     // Late dates DDGraph.
  DDGraphKind_MCRL,     // MCRL dates DDGraph.
  DDGraphKind__
} enum_DDGraphKind;
typedef uint8_t DDGraphKind;
extern const char *
DDGraphKind_name_(DDGraphKind this);
DDGraphFlag— Enumerates the DDGraph flags.
typedef enum {
  DDGraphFlag_Forward = 0x0,    // DDGraph is forward.
  DDGraphFlag_Backward = 0x1,   // DDGraph is backward.
  DDGraphFlag_Lifetime = 0x2,   // DDGraph minimizes lifetimes.
  DDGraphFlag_Duplicate = 0x4,  // DDGraph is a duplicate.
} enum_DDGraphFlag;
typedef uint8_t DDGraphFlags;
DDGraph— Data Dependence graph.

The DDGraph always contains a ROOT node, whose OPERATION is NULL. It also contains the FIRST, LAST, START, STOP nodes, which are connected as follows:

The purpose of this LAST to FIRST arc is to limit the amount of software pipelining. When non software pipelining, OVERLAP is zero. In most cases, FIRST and START are the same node, and STOP and LAST are the same node. In such cases the sequential connection means no arc at all. When two nodes in these pairs differ, for instance FIRST and START, then sequential connection means that all nodes whose KEY is between FIRST KEY and START KEY inclusive are connected to the next in increasing KEY order. This feature is used in cases Operations such as hardware-loop pseudos must remain a some fixed place in the resulting schedule, such as before or after the real Operations.

struct DDGraph_ {
  //@args       Memory memory, DDGraphKind kind, DDGraphFlags flags,
  //@args       Processor processor, int32_t maxNodes, int16_t *_lambda
  //@access ROOT        (DDGraphNode)Network_ROOTNODE(DDGraph_NETWORK(this))
  //@access MEMORY      Network_MEMORY(DDGraph_NETWORK(this))
  Network_ NETWORK[1];          // Base Network_: must be first in struct DDGraph_.
  //@access DGRAPH      Network_DGRAPH(DDGraph_NETWORK(this))
  //@access CRITICAL    Network_CRITICAL(DDGraph_NETWORK(this))
  //@mutate CRITICAL    Network__CRITICAL(DDGraph_NETWORK(this))
  PtrSeq_ CARRIED_;             // Stack of loop-carried DDGraphArc(s).
  //@access CARRIED     DDGraph__CARRIED_(this)
  DDGraphNode FIRST;            // First DDGraphNode of this DDGraph.
  //@access FIRSTINDEX  DDGraphNode_INDEX(DDGraph_FIRST(this))
  DDGraphNode START;            // Start DDGraphNode of this DDGraph.
  //@access STARTINDEX  DDGraphNode_INDEX(DDGraph_START(this))
  DDGraphNode STOP;             // Stop DDGraphNode of this DDGraph.
  //@access STOPINDEX   DDGraphNode_INDEX(DDGraph_STOP(this))
  DDGraphNode LAST;             // Last DDGraphNode of this DDGraph.
  //@access LASTINDEX   DDGraphNode_INDEX(DDGraph_LAST(this))
  DDGraphKind KIND;     // This DDGraph DDGraphKind.
  DDGraphFlags FLAGS;   // This DDGraph DDGraphFlags.
  //@access isForward   ((DDGraph_flags(this) & DDGraphFlag_Backward) == 0)
  //@access isBackward  ((DDGraph_flags(this) & DDGraphFlag_Backward) != 0)
  //@access isLifetime  ((DDGraph_flags(this) & DDGraphFlag_Lifetime) != 0)
  //@access isDuplicate ((DDGraph_flags(this) & DDGraphFlag_Duplicate) != 0)
  Processor PROCESSOR;
  int8_t BAROMEGA;              // This DDGraph maximum OMEGA.
  int16_t *_LAMBDA;             // This DDGraph current LAMBDA.
  //@access LAMBDA      (*DDGraph__LAMBDA(this))
};
DDGraph_dgraph— This DDGraph DGraph.
static inline DGraph
DDGraph_dgraph(DDGraph this)
{
  return DDGraph_DGRAPH(this);
}
DDGraph_FOREACH_DDGraphNode— Iterate over this DDGraph DDGraphNode(s).
#define DDGraph_FOREACH_DDGraphNode(this, node) { \
  DGraph DDGraph_DGRAPH = DDGraph_dgraph(this); \
  DGraph_FOREACH(DDGraph_DGRAPH, DDGraphNode_, node)
#define DDGraph_ENDEACH_DDGraphNode \
  DGraph_ENDEACH \
}
DDGraph_nodes— This DDGraph DDGraphNode array.
static inline DDGraphNode *
DDGraph_nodes(DDGraph this)
{
  return (DDGraphNode *)DGraph_nodes(DDGraph_DGRAPH(this));
}
DDGraph_nodeCount— Count of DDGraph_nodes.
static inline int32_t
DDGraph_nodeCount(DDGraph this)
{
  return DGraph_count(DDGraph_DGRAPH(this));
}
DDGraph_lastIndex— Index of the LAST DDGraphNode.

Used to count nodes excluding the ROOT and lifetime nodes.

static inline int32_t
DDGraph_lastIndex(DDGraph this)
{
  return DDGraph_LASTINDEX(this);
}
DDGraph_access— Access a DDGraphNode of this DDGraph by index.
static inline DDGraphNode
DDGraph_access(DDGraph this, int32_t index)
{
  return (DDGraphNode)DGraph_access(DDGraph_DGRAPH(this), index);
}
DDGraph_flags— This DDGraph flags.
static inline DDGraphFlags
DDGraph_flags(DDGraph this)
{
  return DDGraph_FLAGS(this);
}
DDGraph_network— This DDGraph Network.
static inline Network
DDGraph_network(DDGraph this)
{
  return DDGraph_NETWORK(this);
}
DDGraph_carried— This DDGraph CARRIED PtrSeq.
static inline PtrSeq
DDGraph_carried(DDGraph this)
{
  return DDGraph_CARRIED(this);
}
DDGraph_FORCARRIED_DDGraphArc— Iterate over this DDGraph CARRIED arcs.
#define DDGraph_FORCARRIED_DDGraphArc(this, arc) { \
  PtrSeq DDGraph_CARRIED = DDGraph_carried(this); \
  PtrSeq_FOREACH(DDGraph_CARRIED, DDGraphArc, arc) {
#define DDGraph_ENDCARRIED_DDGraphArc \
  } PtrSeq_ENDEACH \
}
DDGraph_pretty— Pretty-print this DDGraph.
bool
DDGraph_pretty(DDGraph this, FILE *file);
DDGraph_makeNode— Make a DDGraphNode in this DDGraph.
DDGraphNode
DDGraph_makeNode(DDGraph this, Operation operation);
DDGraph_makeArc— Make a DDGraphArc in this DDGraph.
DDGraphArc
DDGraph_makeArc(DDGraph this, DDGraphNode tail_node, DDGraphNode head_node,
                int theta, int omega, DependenceKind kind, Temporary temporary);
DDGraph_sortLeaveArcs— Sort the leaving arcs of this DDGraph.
void
DDGraph_sortLeaveArcs(DDGraph this);
DDGraph_complete— Complete the DDGraph with the auxiliary nodes and arcs.
void
DDGraph_complete(DDGraph this, int overlap, int32_t serialize, Processor processor);
DDGraph_enterNodes— Enter the nodes in this DDGraph.
void
DDGraph_enterNodes(DDGraph this, BlockTrace blockTrace);
DDGraph_enterArcs— Enter the arcs in this DDGraph.
void
DDGraph_enterArcs(DDGraph this, BlockTrace blockTrace);
DDGraph_copyArcs— Enter the schedule arcs into this DDGraph from that DDGraph.
void
DDGraph_copyArcs(DDGraph this, DDGraph that);
DDGraph_synchronize— Synchronize the underlying Network for a new LAMBDA.

Network primal feasibility (correct flows) is maintained. Network dual feasibility is likely to be destroyed because the arcs that are not on the spanning tree may end up with a positive reduced delay.

void
DDGraph_synchronize(DDGraph this);
DDGraph_Critical— Critical cycle call-back for the Simplex Label Correcting.
bool
DDGraph_Critical(Network network);
DDGraph_initializeFlows— Solve the initial network flow problem.
void
DDGraph_initializeFlows(DDGraph this, bool lifetime);
DDGraph_increaseLambda— Increase LAMBDA just enough to satisfy dependences.
void
DDGraph_increaseLambda(DDGraph this);
DDGraph_optimizeFlows— Optimize the network flow problem.
void
DDGraph_optimizeFlows(DDGraph this, bool refill);
DDGraph_freezeNode— Freeze node at the supplied values of theta and omega from the root node.

Freezing a node is achieved by setting the opposite parametric lengths on the pair of arcs between the root node and the frozen node. We call Network_updateDelay in order to maintain consistency of the Network flows.

void
DDGraph_freezeNode(DDGraph this, DDGraphNode node, int theta, int omega);
DDGraph_unfreeze— Undo the freeze of all this DDGraph nodes.
void
DDGraph_unfreeze(DDGraph this);