InterfGraph.xcc
Christophe Guillon (Christophe.Guillon@st.com).
Copyright 2002 - 2007 STMicroelectronics.
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.
Get the index (unique) of a node. It simply gets the field IDENTITY of the related temporary. \param interfNode The interference node. \return The index (unique) of a node.
// extern uint32_t InterfNode_index(InterfNode interfNode);
The structure of the interference graph. The adjacency matrix is redundant, because the graph is undirected. So if the arc (a,b) is in the graph, so is (b,a). The adjacency edge (a,a) is used to know if the node 'a' is in the graph. Indices are between 0 and (size - 1).
// struct InterfGraph_ { //@args Memory memory Memory MEMORY; //!< Memory for allocation uint32_t SIZE; //!< Maximum number of nodes present in this graph. BitSet ADJSET; //!< Adjacency matrix. InterfNode *NODES; };
To know if two nodes are neighbors in the interference graph. \param interfGraph The interference graph. \param interfNode1 The first interference node. \param interfNode2 The second interference node. \return \e true if these two nodes are neighbors, else \e false.
// extern bool InterfGraph_isAdjacent(InterfGraph interfGraph, InterfNode interfNode1, InterfNode interfNode2 );
This helper is in fact a gathering of piece of code used in GraphColoring.xcc to construct interference graph with affinities
struct InterfGraphBuilder_ { //@args Memory memory, CodeRegion codeRegion, RegFile regFile, //@args bool clobbersDoNotInterfer, bool newHandlingOfNegAff, //@args bool addMoveInterference, bool noMoveAffinity, bool isSSA Memory MEMORY; bool CLOBBERSDONOTINTERFER; bool NEWHANDLINGOFNEGAFF; bool ADDMOVEINTERFERENCE; bool NOMOVEAFFINITY; bool ISSSA; CodeRegion CODEREGION; //@access CONVENTION CodeRegion_convention(InterfGraphBuilder_CODEREGION(this)) RegFile REGFILE; IDList_ NODES_; //@access NODES InterfGraphBuilder__NODES_(this) IDList_ MOVES_; //@access MOVES InterfGraphBuilder__MOVES_(this) InterfGraph_ INTERFGRAPH_; //@access INTERFGRAPH InterfGraphBuilder__INTERFGRAPH_(this) TemporaryTable_ TEMPORARIES_; //@access TEMPORARIES InterfGraphBuilder__TEMPORARIES_(this) Liveness LIVENESS; IDList_ SPECIALNODES_; //@access SPECIALNODES InterfGraphBuilder__SPECIALNODES_(this) };
Display mapping between index and identity for all nodes (temporaries)
void InterfGraphBuilder_displayMapping(InterfGraphBuilder this, FILE* file);
File format is the following: NbNodes NbColors Interferences Edges: I J -1\n Affinities Edges: I J W\n
void InterfGraphBuilder_exportGraph(InterfGraphBuilder this, FILE* file, bool dispInterferenceOnSame, bool dispAffinitiesOnInterference, bool dispInterferenceOnDedicated);