summaryrefslogtreecommitdiff
path: root/compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.h')
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.h b/compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.h
new file mode 100644
index 0000000..13ddce9
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.h
@@ -0,0 +1,97 @@
+#ifndef COMPILER_IROFLOWGRAPH_H
+#define COMPILER_IROFLOWGRAPH_H
+
+#include "IrOptimizer.h"
+#include "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);
+
+CW_INLINE void IROFlowgraph_sub_4C2140(IRONodes *nodes) {
+ nodes->indices = oalloc(sizeof(UInt16) * IRO_NumNodes);
+ nodes->num = 0;
+ nodes->base = 0;
+}
+
+CW_INLINE void IROFlowgraph_sub_4C20E0(IRONodes *nodes) {
+}
+
+CW_INLINE UInt16 IROFlowgraph_sub_4C2040(IRONodes *nodes) {
+ return nodes->num;
+}
+
+CW_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;
+}
+
+CW_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 {
+ CError_FATAL(93);
+ }
+}
+
+#endif