diff options
Diffstat (limited to 'includes/compiler/IroFlowgraph.h')
-rw-r--r-- | includes/compiler/IroFlowgraph.h | 94 |
1 files changed, 93 insertions, 1 deletions
diff --git a/includes/compiler/IroFlowgraph.h b/includes/compiler/IroFlowgraph.h index 1faf2d9..3a76df0 100644 --- a/includes/compiler/IroFlowgraph.h +++ b/includes/compiler/IroFlowgraph.h @@ -1,6 +1,98 @@ #ifndef COMPILER_IROFLOWGRAPH_H #define COMPILER_IROFLOWGRAPH_H -#include "compiler/common.h" +#include "compiler/IrOptimizer.h" +#include "compiler/BitVector.h" +#include "compiler/CError.h" +#include "compiler/CompilerTools.h" + +#ifdef __MWERKS__ +#pragma options align=mac68k +#endif + +struct IRONode { + UInt16 index; + UInt16 numsucc; + UInt16 *succ; + UInt16 numpred; + UInt16 *pred; + IROLinear *first; + IROLinear *last; + BitVector *x16; // In + BitVector *x1A; // Out + BitVector *x1E; // Gen + BitVector *x22; // Kill + UInt32 x26; + BitVector *x2A; // AA + BitVector *dom; + IRONode *nextnode; + Boolean x36; + Boolean x37; + Boolean mustreach; + Boolean x39; + UInt16 loopdepth; + Boolean x3C; + struct ObjectSet *addressed; + Boolean mustreach1; +}; + +typedef struct IRONodes { + UInt16 *indices; + UInt16 num; + UInt16 base; +} IRONodes; + +#ifdef __MWERKS__ +#pragma options align=reset +#endif + +extern UInt16 IRO_NumNodes; +extern IRONode *IRO_FirstNode; +extern IRONode *IRO_LastNode; +extern IRONode *IRO_EndNode; +extern IRONode **IRO_NodeTable; +extern BitVector *IRO_VarKills; +extern BitVector *IRO_Avail; +extern BitVector *IRO_FuncKills; +extern BitVector *IRO_ExprKills; + +extern void IRO_ComputeSuccPred(void); +extern void IRO_ComputeDom(void); +extern void IRO_BuildFlowgraph(IROLinear *linear); +extern IRONode *IRO_NewFlowGraphNode(void); +extern IRONode *IRO_MergeFlowGraphNodes(IRONode *a, IRONode *b); + +inline void IROFlowgraph_sub_4C2140(IRONodes *nodes) { + nodes->indices = oalloc(sizeof(UInt16) * IRO_NumNodes); + nodes->num = 0; + nodes->base = 0; +} + +inline void IROFlowgraph_sub_4C20E0(IRONodes *nodes) { +} + +inline UInt16 IROFlowgraph_sub_4C2040(IRONodes *nodes) { + return nodes->num; +} + +inline UInt16 IROFlowgraph_sub_4C2100(IRONodes *nodes) { + UInt16 result = -1; + if (nodes->num) { + result = nodes->indices[nodes->base]; + nodes->base = (nodes->base + 1) % IRO_NumNodes; + nodes->num--; + } + return result; +} + +inline void IROFlowgraph_sub_4C3880(IRONodes *nodes, UInt16 index) { + if (nodes->num < IRO_NumNodes) { + nodes->indices[(nodes->base + nodes->num) % IRO_NumNodes] = index; + nodes->num++; + } else { +#line 93 + CError_FATAL(); + } +} #endif |