summaryrefslogtreecommitdiff
path: root/includes/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'includes/compiler')
-rw-r--r--includes/compiler/BitVector.h36
-rw-r--r--includes/compiler/DumpIR.h (renamed from includes/compiler/uDump.h)0
-rw-r--r--includes/compiler/IROUseDef.h48
-rw-r--r--includes/compiler/IrOptimizer.h30
-rw-r--r--includes/compiler/IroCSE.h45
-rw-r--r--includes/compiler/IroDump.h27
-rw-r--r--includes/compiler/IroEmptyLoop.h8
-rw-r--r--includes/compiler/IroEval.h14
-rw-r--r--includes/compiler/IroExprRegeneration.h8
-rw-r--r--includes/compiler/IroFlowgraph.h97
-rw-r--r--includes/compiler/IroJump.h12
-rw-r--r--includes/compiler/IroLinearForm.h165
-rw-r--r--includes/compiler/IroLoop.h111
-rw-r--r--includes/compiler/IroMalloc.h15
-rw-r--r--includes/compiler/IroPointerAnalysis.h25
-rw-r--r--includes/compiler/IroPropagate.h35
-rw-r--r--includes/compiler/IroRangePropagation.h8
-rw-r--r--includes/compiler/IroSubable.h10
-rw-r--r--includes/compiler/IroTransform.h13
-rw-r--r--includes/compiler/IroUnrollLoop.h23
-rw-r--r--includes/compiler/IroUtil.h127
-rw-r--r--includes/compiler/IroVars.h51
-rw-r--r--includes/compiler/LoopDetection.h2
23 files changed, 1 insertions, 909 deletions
diff --git a/includes/compiler/BitVector.h b/includes/compiler/BitVector.h
deleted file mode 100644
index a6830d6..0000000
--- a/includes/compiler/BitVector.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef COMPILER_IROBITVECT_H
-#define COMPILER_IROBITVECT_H
-
-#include "compiler/common.h"
-#include "compiler/CError.h"
-
-typedef struct BitVector {
- UInt32 size;
- UInt32 data[0];
-} BitVector;
-
-extern void Bv_AllocVector(BitVector **bv, UInt32 size);
-extern void Bv_AllocVectorLocal(BitVector **bv, UInt32 size);
-extern void Bv_ClearBit(UInt32 bit, BitVector *bv);
-extern void Bv_And(const BitVector *a, BitVector *b);
-extern void Bv_Or(const BitVector *a, BitVector *b);
-extern Boolean Bv_BitsInCommon(const BitVector *a, const BitVector *b);
-extern Boolean Bv_Compare(const BitVector *a, const BitVector *b);
-extern void Bv_Minus(const BitVector *a, BitVector *b);
-extern void Bv_Copy(const BitVector *src, BitVector *dst);
-extern void Bv_Clear(BitVector *bv);
-extern void Bv_Set(BitVector *bv);
-extern Boolean Bv_IsSubset(const BitVector *a, const BitVector *b);
-extern Boolean Bv_IsEmpty(const BitVector *bv);
-
-CW_INLINE void Bv_SetBit(UInt32 bit, BitVector *bv) {
- if ((bit / 32) < bv->size) {
- bv->data[bit / 32] |= 1 << (bit & 31);
- } else {
- CError_FATAL(56);
- }
-}
-
-#define Bv_IsBitSet(_bit, _bv) ( (((_bit) >> 5) < (_bv)->size) && ((_bv)->data[(_bit) >> 5] & (1 << ((_bit) & 31))) )
-
-#endif
diff --git a/includes/compiler/uDump.h b/includes/compiler/DumpIR.h
index d39513c..d39513c 100644
--- a/includes/compiler/uDump.h
+++ b/includes/compiler/DumpIR.h
diff --git a/includes/compiler/IROUseDef.h b/includes/compiler/IROUseDef.h
deleted file mode 100644
index 829a396..0000000
--- a/includes/compiler/IROUseDef.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef COMPILER_IROUSEDEF_H
-#define COMPILER_IROUSEDEF_H
-
-#include "compiler/IrOptimizer.h"
-#include "compiler/BitVector.h"
-#include "compiler/enode.h"
-
-#ifdef __MWERKS__
-#pragma options align=mac68k
-#endif
-struct IROUse {
- SInt32 index;
- IRONode *node;
- IROLinear *linear;
- VarRecord *var;
- IROUse *globalnext;
- IROUse *varnext;
- BitVector *x18;
- UInt16 x1C;
-};
-struct IRODef {
- SInt32 index;
- IRONode *node;
- IROLinear *linear;
- VarRecord *var;
- IRODef *globalnext;
- IRODef *varnext;
- UInt16 x18;
- Boolean x1A;
- Boolean x1B;
- Boolean x1C;
- Boolean x1D;
-};
-#ifdef __MWERKS__
-#pragma options align=reset
-#endif
-
-extern ENodeType IRO_NonAssignmentOp[MAXEXPR];
-extern IROUse *IRO_FirstVarUse;
-extern IROUse *IRO_LastVarUse;
-
-extern CInt64 IRO_GetSelfAssignmentVal(IROLinear *linear);
-extern void IRO_InitializeNonAssignmentOpArray(void);
-extern void IRO_InitializeAssignmentFoldingFunctionArray(void);
-extern Boolean IRO_UseDef(Boolean optDeadAssignments, Boolean optPropagation);
-extern void IRO_SplitLifetimes(void);
-
-#endif
diff --git a/includes/compiler/IrOptimizer.h b/includes/compiler/IrOptimizer.h
deleted file mode 100644
index 287e279..0000000
--- a/includes/compiler/IrOptimizer.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef COMPILER_IROPTIMIZER_H
-#define COMPILER_IROPTIMIZER_H
-
-#include "compiler/common.h"
-
-typedef struct IROAddrRecord IROAddrRecord;
-typedef struct IROAssign IROAssign;
-typedef struct IRODef IRODef;
-typedef struct IROElmList IROElmList;
-typedef struct IROExpr IROExpr;
-typedef struct IROLinear IROLinear;
-typedef struct IROList IROList;
-typedef struct IROListNode IROListNode;
-typedef struct IROLoop IROLoop;
-typedef struct IRONode IRONode;
-typedef struct IROUse IROUse;
-
-extern Boolean DoScalarize;
-extern Boolean DoLinearize;
-extern Boolean EarlyReturn;
-extern Boolean IRO_CPFirstTime;
-extern Boolean VectorPhaseCalledFromUnroll;
-extern Boolean IRO_Log;
-
-extern Statement *IRO_Optimizer(Object *func, Statement *statements);
-extern void IRO_Setup(void);
-extern void IRO_Cleanup(void);
-extern void CodeGen_UpdateOptimizerOptions(void);
-
-#endif
diff --git a/includes/compiler/IroCSE.h b/includes/compiler/IroCSE.h
deleted file mode 100644
index 4bf127c..0000000
--- a/includes/compiler/IroCSE.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef COMPILER_IROCSE_H
-#define COMPILER_IROCSE_H
-
-#include "compiler/IrOptimizer.h"
-#include "compiler/BitVector.h"
-
-#ifdef __MWERKS__
-#pragma options align=mac68k
-#endif
-struct IROExpr {
- Boolean x0;
- UInt16 index;
- IROLinear *linear;
- Object *x8;
- IRONode *node;
- BitVector *depends;
- IROExpr *x14;
- Boolean couldError;
- Boolean notSubable;
- IROLinear *x1A;
- VarRecord *x1E;
- IROLinear *x22;
- IROExpr *next;
-};
-#ifdef __MWERKS__
-#pragma options align=reset
-#endif
-
-extern BitVector *IRO_Depends;
-extern Boolean IRO_NotSubable;
-extern Boolean IRO_IsVolatile;
-extern Boolean IRO_CouldError;
-extern IROExpr *IRO_FirstExpr;
-extern IROExpr *IRO_LastExpr;
-extern SInt32 IRO_NumExprs;
-
-extern void IRO_FindDepends_NoAlloc(IROLinear *linear);
-extern void IRO_FindDepends(IROLinear *linear);
-extern void IRO_FindExpressions(BitVector *bv, Boolean flag);
-extern void IRO_RemoveExpr(IROExpr *expr);
-extern void IRO_ComputeAvail(void);
-extern void IRO_CommonSubs(void);
-extern void IRO_GenerateTopLevelExprsForSubableOperands(void);
-
-#endif
diff --git a/includes/compiler/IroDump.h b/includes/compiler/IroDump.h
deleted file mode 100644
index 5445280..0000000
--- a/includes/compiler/IroDump.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef COMPILER_IRODUMP_H
-#define COMPILER_IRODUMP_H
-
-#include "compiler/IrOptimizer.h"
-#include "compiler/BitVector.h"
-#include "compiler/enode.h"
-
-extern char *IRO_NodeName(ENodeType nodetype);
-extern void IRO_InitializeNodeNamesArray(void);
-extern void IRO_DumpIntTree(IROLinear *linear);
-extern void IRO_DumpLinearList(IROLinear *linear);
-extern void IRO_DumpBits(char *name, BitVector *bv);
-extern void IRO_DumpAfterPhase(char *str, Boolean flag);
-extern void IRO_LogForFunction(char *name);
-extern void IRO_DumpFlowgraph(void);
-extern void IRO_DumpNode(IRONode *node);
-extern void IRO_DumpAssignments(void);
-extern void IRO_DumpVars(void);
-extern void IRO_DumpDf(void);
-extern void IRO_DumpExprs(void);
-extern void IRO_SetupDump(void);
-extern void IRO_CleanupDump(void);
-extern void IRO_Dump(char *format, ...);
-extern void IRO_DumpAddr(IROAddrRecord *rec);
-extern void IRO_SpellType(Type *type, char *buf);
-
-#endif
diff --git a/includes/compiler/IroEmptyLoop.h b/includes/compiler/IroEmptyLoop.h
deleted file mode 100644
index 5268f18..0000000
--- a/includes/compiler/IroEmptyLoop.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef COMPILER_IROEMPTYLOOP_H
-#define COMPILER_IROEMPTYLOOP_H
-
-#include "compiler/IrOptimizer.h"
-
-extern void IRO_FindEmptyLoops(void);
-
-#endif
diff --git a/includes/compiler/IroEval.h b/includes/compiler/IroEval.h
deleted file mode 100644
index a011a47..0000000
--- a/includes/compiler/IroEval.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef COMPILER_IROEVAL_H
-#define COMPILER_IROEVAL_H
-
-#include "compiler/IrOptimizer.h"
-
-extern void IRO_InitializeIsAssociativeENodeTypeArray(void);
-extern void IRO_TruncateValueToType(CInt64 *val, Type *type);
-extern void IRO_TruncateBitfieldValueToType(CInt64 *val, Type *type, Type *type2);
-extern void IRO_ConstantFolding(void);
-extern Boolean IRO_EvaluateConditionals(void);
-extern int IRO_SimplifyConditionals(void);
-extern Boolean IRO_EvaluateDefinitePointers(Object *func);
-
-#endif
diff --git a/includes/compiler/IroExprRegeneration.h b/includes/compiler/IroExprRegeneration.h
deleted file mode 100644
index aa43501..0000000
--- a/includes/compiler/IroExprRegeneration.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef COMPILER_IROEXPRREGENERATION_H
-#define COMPILER_IROEXPRREGENERATION_H
-
-#include "compiler/IrOptimizer.h"
-
-extern void IRO_RegenerateExpressions(void);
-
-#endif
diff --git a/includes/compiler/IroFlowgraph.h b/includes/compiler/IroFlowgraph.h
deleted file mode 100644
index 90e696c..0000000
--- a/includes/compiler/IroFlowgraph.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef COMPILER_IROFLOWGRAPH_H
-#define COMPILER_IROFLOWGRAPH_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);
-
-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
diff --git a/includes/compiler/IroJump.h b/includes/compiler/IroJump.h
deleted file mode 100644
index bbb5594..0000000
--- a/includes/compiler/IroJump.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef COMPILER_IROJUMP_H
-#define COMPILER_IROJUMP_H
-
-#include "compiler/IrOptimizer.h"
-
-extern Boolean IRO_DoJumpChaining(void);
-extern void IRO_MakeReachable(IRONode *node);
-extern Boolean IRO_RemoveUnreachable(void);
-extern Boolean IRO_RemoveRedundantJumps(void);
-extern Boolean IRO_RemoveLabels(void);
-
-#endif
diff --git a/includes/compiler/IroLinearForm.h b/includes/compiler/IroLinearForm.h
deleted file mode 100644
index 1e7df4f..0000000
--- a/includes/compiler/IroLinearForm.h
+++ /dev/null
@@ -1,165 +0,0 @@
-#ifndef COMPILER_IROLINEARFORM_H
-#define COMPILER_IROLINEARFORM_H
-
-#include "compiler/IrOptimizer.h"
-#include "compiler/Switch.h"
-#include "compiler/enode.h"
-
-#ifdef __MWERKS__
-#pragma options align=mac68k
-#endif
-
-typedef struct IROLinearIRSave {
- IROLinear *firstLinear;
- IROLinear *lastLinear;
- UInt32 numLinear;
- Statement *curStat;
- Boolean disableDueToAsm;
- Boolean isLeafFunction;
- Boolean functionHasReturn;
- void *nullCheckList;
- Statement *currStmt;
- Statement *prevStmt;
-} IROLinearIRSave;
-
-typedef enum IROLinearType {
- IROLinearNop,
- IROLinearOperand,
- IROLinearOp1Arg,
- IROLinearOp2Arg,
- IROLinearGoto,
- IROLinearIf,
- IROLinearIfNot,
- IROLinearReturn,
- IROLinearLabel,
- IROLinearSwitch,
- IROLinearOp3Arg,
- IROLinearFunccall,
- IROLinearEntry,
- IROLinearExit,
- IROLinearBeginCatch,
- IROLinearEndCatch,
- IROLinearEndCatchDtor,
- IROLinearAsm,
- IROLinear18,
- IROLinear19,
- IROLinearEnd
-} IROLinearType;
-
-enum {
- IROLF_1 = 0x1,
- IROLF_Reffed = 0x2,
- IROLF_Assigned = 0x4,
- IROLF_8 = 0x8,
- IROLF_Used = 0x10,
- IROLF_Ind = 0x20,
- IROLF_Subs = 0x40,
- IROLF_80 = 0x80,
- IROLF_LoopInvariant = 0x100,
- IROLF_BeginLoop = 0x200,
- IROLF_EndLoop = 0x400,
- IROLF_Ris = 0x800,
- IROLF_Immind = 0x1000,
- IROLF_VecOp = 0x2000,
- IROLF_4000 = 0x4000,
- IROLF_8000 = 0x8000,
- IROLF_VecOpBase = 0x10000,
- IROLF_20000 = 0x20000,
- IROLF_CounterLoop = 0x40000,
- IROLF_BitfieldIndirect = 0x80000,
- IROLF_CouldError = 0x100000
-};
-
-// actual name is LinearNode as per mwccppc v8
-struct IROLinear {
- IROLinearType type;
- ENodeType nodetype;
- SInt32 flags;
- UInt16 nodeflags;
- unsigned short index;
- Statement *stmt;
- Type *rtype;
- IROExpr *expr;
- struct ERange *x16;
- PointsToFunction *pointsToFunction;
- Boolean x1E;
- union {
- struct {
- void *data1;
- void *data2;
- void *data3;
- void *data4;
- void *data5;
- } idk;
- // Operand
- ENode *node;
- // Op1Arg
- IROLinear *monadic;
- // Op2Arg
- struct {
- IROLinear *left;
- IROLinear *right;
- } diadic;
- // Op3Arg
- struct {
- IROLinear *a;
- IROLinear *b;
- IROLinear *c;
- } args3;
- // Funccall
- struct {
- char ispascal;
- short argCount;
- IROLinear **args;
- IROLinear *linear8; // funcref
- TypeFunc *functype;
- struct LocationSetSet *returnedLocs;
- } funccall;
- // Asm
- Statement *asm_stmt;
- // If, IfNot, Goto, Label
- struct {
- CLabel *label;
- IROLinear *x4; // if,ifnot only??
- } label;
- struct {
- SwitchInfo *info;
- IROLinear *x4;
- } swtch;
- // BeginCatch, EndCatch, EndCatchDtor
- struct {
- IROLinear *linear;
- int x4;
- int x8;
- } ctch;
- } u;
- IROLinear *next;
-};
-
-#ifdef __MWERKS__
-#pragma options align=reset
-#endif
-
-extern IROLinear *IRO_FirstLinear;
-extern IROLinear *IRO_LastLinear;
-extern UInt32 IRO_NumLinear;
-extern Statement *CurStat;
-
-extern IROLinear *IRO_NewLinear(IROLinearType type);
-extern void IRO_PreLinearize(Statement *stmt);
-extern void IRO_Linearize(Statement *stmt);
-extern ENode *IRO_NewENode(ENodeType nodetype);
-extern Statement *IRO_Delinearize(IRONode *node, IROLinear *linear);
-extern void IRO_RenumberInts(void);
-extern void IRO_UpdateFlagsOnInts(void);
-extern void IRO_SaveLinearIR(IROLinearIRSave *save);
-extern void IRO_RestoreLinearIR(IROLinearIRSave *save);
-
-#define IS_LINEAR_ENODE(_linear, _nodetype) ( ((_linear)->type == IROLinearOperand) && ((_linear)->u.node->type) == (_nodetype) )
-#define IS_LINEAR_MONADIC(_linear, _nodetype) ( ((_linear)->type == IROLinearOp1Arg) && ((_linear)->nodetype) == (_nodetype) )
-#define IS_LINEAR_MONADIC_2(_linear, _nodetype1, _nodetype2) ( ((_linear)->type == IROLinearOp1Arg) && (((_linear)->nodetype) == (_nodetype1) || ((_linear)->nodetype) == (_nodetype2)) )
-#define IS_LINEAR_DIADIC(_linear, _nodetype) ( ((_linear)->type == IROLinearOp2Arg) && ((_linear)->nodetype) == (_nodetype) )
-#define IS_LINEAR_DIADIC_2(_linear, _nodetype1, _nodetype2) ( ((_linear)->type == IROLinearOp2Arg) && (((_linear)->nodetype) == (_nodetype1) || ((_linear)->nodetype) == (_nodetype2)) )
-#define IS_LINEAR_DIADIC_3(_linear, _nodetype1, _nodetype2, _nodetype3) ( ((_linear)->type == IROLinearOp2Arg) && (((_linear)->nodetype) == (_nodetype1) || ((_linear)->nodetype) == (_nodetype2) || ((_linear)->nodetype) == (_nodetype3)) )
-
-#endif
diff --git a/includes/compiler/IroLoop.h b/includes/compiler/IroLoop.h
deleted file mode 100644
index 0c60589..0000000
--- a/includes/compiler/IroLoop.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef COMPILER_IROLOOP_H
-#define COMPILER_IROLOOP_H
-
-#include "compiler/IrOptimizer.h"
-#include "compiler/BitVector.h"
-
-typedef enum IROLoopIndFlags {
- LoopInd_HasMod = 1,
- LoopInd_HasDiv = 2,
- LoopInd_4 = 4,
- LoopInd_8 = 8
-} IROLoopIndFlags;
-
-typedef enum IROLoopFlags {
- LoopFlags_1 = 1, // LP_INDUCTION_AT_LEFT
- LP_LOOP_HAS_CALLS = 2,
- LP_LOOP_HAS_CNTRLFLOW = 4,
- LoopFlags_8 = 8, // LP_HAS_NONASSIGN
- LP_INDUCTION_NOT_FOUND = 0x10,
- LP_IFEXPR_NON_CANONICAL = 0x20,
- LP_HAS_MULTIPLE_INDUCTIONS = 0x40,
- LP_LOOP_HDR_HAS_SIDEEFFECTS = 0x80,
- LP_LOOP_STEP_ISADD = 0x100,
- LoopFlags_200 = 0x200, // LP_HEADER_FOLLOWS_UPDATE?
- LP_LOOP_STEP_ISPOS = 0x400,
- LoopFlags_800 = 0x800, // LP_IND_USED_IN_LOOP
- LoopFlags_1000 = 0x1000, // LP_HAS_MULTIPLE_EXITS
- LoopFlags_2000 = 0x2000, // inverse of LP_LOOP_STEP_ISADD?
- LP_LOOP_STEP_ISNEG = 0x4000,
- LP_LOOP_HAS_ASM = 0x8000,
- LoopFlags_10000 = 0x10000, // LP_WHILE_LOOP
- LoopFlags_20000 = 0x20000, // maybe LP_RECURSIVE_LOOP?
- LoopFlags_40000 = 0x40000 // LP_IS_REDUCTION_CAND
-} IROLoopFlags;
-
-#ifdef __MWERKS__
-#pragma options align=mac68k
-#endif
-typedef struct IROLoopInd {
- IROLoopIndFlags flags;
- VarRecord *var;
- IRONode *fnode;
- IROLinear *nd;
- SInt32 addConst;
- IROLinear *addNode;
- struct IROLoopInd *next;
-} IROLoopInd;
-
-struct IROLoop {
- SInt32 flags;
- IRONode *fnode;
- int x8;
- IRONode *xC;
- IRONode *x10;
- IROLinear *nd14; // assignment expression that sets the initial value of induction
- IROLinear *nd18; // ifexpr?
- IROLoopInd *induction;
- int index20;
- int index24;
- CInt64 x28;
- CInt64 x30;
- int sizeBySomeMeasurement;
-};
-
-typedef enum IROLoopMemRefFlags {
- LoopMemRef_1 = 1,
- LoopMemRef_2 = 2,
- LoopMemRef_4 = 4,
- LoopMemRef_8 = 8,
- LoopMemRef_10 = 0x10
-} IROLoopMemRefFlags;
-
-typedef struct IROLoopMemRef {
- IROLoopMemRefFlags flags;
- IROLinear *nd;
- IROElmList *list;
- IROAddrRecord *rec;
- struct IROLoopMemRef *next;
-} IROLoopMemRef;
-#ifdef __MWERKS__
-#pragma options align=reset
-#endif
-
-extern IRONode *LoopNode;
-extern Boolean ConditionalHeaderAtBottom;
-extern IROLoopInd *FirstInd;
-extern BitVector *InLoop;
-extern IROList IRO_InitLList;
-extern BitVector *InLoop_Exits;
-extern BitVector *InLoop_Tails;
-extern UInt32 LoopExitNumber;
-extern UInt32 LoopTailNum;
-extern IRONode *LoopExitSuccessor;
-extern IRONode *LoopTail;
-extern IROLoopMemRef *IRO_LoopMemRefFirst;
-extern IROLoopMemRef *IRO_LoopMemRefCurrent;
-
-extern void FindMustReach(void);
-extern void FindMustReach1(IRONode *checkfnode);
-extern void AddPreds(IRONode *fnode);
-extern void IncLoopDepth(void);
-extern void IRO_SetLoopDepth(void);
-extern void IRO_FindLoops(void);
-extern void ComputeLoopKills(void);
-extern void ComputeLoopInvariance(void);
-extern void ComputeLoopInduction(void);
-extern void FindAssignmenttoInductionVar(IROLoop *loop, IRONode *fnode);
-extern IROLoop *ExtractLoopInfo(IRONode *fnode);
-extern CLabel *BuildLabel(IROList *list);
-
-#endif
diff --git a/includes/compiler/IroMalloc.h b/includes/compiler/IroMalloc.h
deleted file mode 100644
index f203a3d..0000000
--- a/includes/compiler/IroMalloc.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef COMPILER_IROMALLOC_H
-#define COMPILER_IROMALLOC_H
-
-#include "compiler/IrOptimizer.h"
-
-extern size_t IRO_msize(void *buf);
-extern void *IRO_malloc(size_t size);
-extern void IRO_free(void *buf);
-extern void *IRO_realloc(void *buf, size_t newsize);
-extern void *IRO_calloc(size_t a, size_t b);
-extern void IRO_pool_free_all(void);
-extern void IRO_InitializeAllocator(void);
-extern void IRO_TerminateAllocator(void);
-
-#endif
diff --git a/includes/compiler/IroPointerAnalysis.h b/includes/compiler/IroPointerAnalysis.h
deleted file mode 100644
index a6ed2c2..0000000
--- a/includes/compiler/IroPointerAnalysis.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef COMPILER_IROPOINTERANALYSIS_H
-#define COMPILER_IROPOINTERANALYSIS_H
-
-#include "compiler/IrOptimizer.h"
-
-extern void PointerAnalysis_Setup(void);
-extern void PointerAnalysis_Cleanup(void);
-extern void IRO_AnalyzePointers(Object *function);
-extern Boolean PointerAnalysis_TwoLinearNodePointerExprsMightAlias(Object *proc, IROLinear *nd1, IROLinear *nd2);
-extern Boolean PointerAnalysis_TwoENodePointerExprsMightAlias(Object *proc, ENode *nd1, ENode *nd2);
-extern Boolean PointerAnalysis_IsLinearNodePointerExprDefinite(Object *proc, IROLinear *nd);
-extern Boolean PointerAnalysis_IsENodePointerExprDefinite(Object *proc, ENode *nd);
-extern Boolean PointerAnalysis_IsVariableValueDefinite(Object *proc, VarRecord *var, PointsToFunction *pointsTo);
-extern void PointerAnalysis_LookupLinearNodePointerExpr(Object *proc, IROLinear *indirect, IROListNode **list);
-extern void PointerAnalysis_LookupENodePointerExpr(Object *proc, ENode *indirect, ENodeList **list);
-extern void PointerAnalysis_LookupVariableIntoLinearNodeExprs(Object *proc, VarRecord *var, PointsToFunction *pointsTo, IROListNode **list);
-extern void PointerAnalysis_LookupVariableIntoENodeExprs(Object *proc, VarRecord *var, PointsToFunction *pointsTo, ENodeList **list);
-extern void PointerAnalysis_GetFunctionKills(Object *proc, IROLinear *funccall, ObjectList **list);
-extern void PointerAnalysis_GetFunctionDependencies(Object *proc, IROLinear *funccall, ObjectList **list);
-extern void PointerAnalysis_PragmaMode(void);
-extern void PointerAnalysis_ParseEntryPointsToSpecifier(DeclInfo *di);
-extern void PointerAnalysis_ParseExitPointsToSpecifier(DeclInfo *di);
-extern void PointerAnalysis_ParseFunctionModifiesSpecifier(DeclInfo *di);
-
-#endif
diff --git a/includes/compiler/IroPropagate.h b/includes/compiler/IroPropagate.h
deleted file mode 100644
index a61e526..0000000
--- a/includes/compiler/IroPropagate.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef COMPILER_IROPROPAGATE_H
-#define COMPILER_IROPROPAGATE_H
-
-#include "compiler/IrOptimizer.h"
-#include "compiler/BitVector.h"
-
-#ifdef __MWERKS__
-#pragma options align=mac68k
-#endif
-struct IROAssign {
- IROLinear *linear;
- UInt16 index;
- UInt16 varIndex;
- IROLinear *linear2;
- BitVector *depends;
- Object *varObj;
- VarRecord *var;
- IROAssign *next;
- IROAssign *prev;
- UInt16 x20;
- IRONode *node;
-};
-#ifdef __MWERKS__
-#pragma options align=reset
-#endif
-
-extern IROAssign *IRO_FirstAssign;
-extern IROAssign *IRO_LastAssign;
-extern SInt32 IRO_NumAssign;
-
-extern int IRO_IsRegable(Object *obj);
-extern Boolean IRO_CopyAndConstantPropagation(void);
-extern void IRO_ExpressionPropagation(void);
-
-#endif
diff --git a/includes/compiler/IroRangePropagation.h b/includes/compiler/IroRangePropagation.h
deleted file mode 100644
index fea6542..0000000
--- a/includes/compiler/IroRangePropagation.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef COMPILER_IRORANGEPROPAGATION_H
-#define COMPILER_IRORANGEPROPAGATION_H
-
-#include "compiler/IrOptimizer.h"
-
-extern Boolean IRO_RangePropagateInFNode(void);
-
-#endif
diff --git a/includes/compiler/IroSubable.h b/includes/compiler/IroSubable.h
deleted file mode 100644
index 7a3c344..0000000
--- a/includes/compiler/IroSubable.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef COMPILER_IROSUBABLE_H
-#define COMPILER_IROSUBABLE_H
-
-#include "compiler/IrOptimizer.h"
-
-extern void IRO_InitializeIsSubableOpArray(void);
-extern Boolean IRO_IsSubableExpression(IROLinear *nd);
-extern Boolean IRO_IsVectorTempCandidate(IROLinear *nd);
-
-#endif
diff --git a/includes/compiler/IroTransform.h b/includes/compiler/IroTransform.h
deleted file mode 100644
index 90bcf30..0000000
--- a/includes/compiler/IroTransform.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef COMPILER_IROTRANSFORM_H
-#define COMPILER_IROTRANSFORM_H
-
-#include "compiler/IrOptimizer.h"
-
-extern void IRO_InitializeAssignmentOpArray(void);
-extern void IRO_InitializeComplementaryOpArray(void);
-extern void IRO_InitializeComplementaryOpLogicalArray(void);
-extern void IRO_DoTransformations(void);
-extern Boolean IRO_TransformSelfAssignmentToAssignment(IROLinear *nd);
-extern void IRO_TransformTree(Statement *statements);
-
-#endif
diff --git a/includes/compiler/IroUnrollLoop.h b/includes/compiler/IroUnrollLoop.h
deleted file mode 100644
index 8a51a9b..0000000
--- a/includes/compiler/IroUnrollLoop.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef COMPILER_IROUNROLLLOOP_H
-#define COMPILER_IROUNROLLLOOP_H
-
-#include "compiler/IrOptimizer.h"
-#include "compiler/IroLinearForm.h"
-
-extern void IRO_LoopUnroller(void);
-extern void IRO_IterateForLoopBody(IRONode *start, IRONode *end, IROLoop *loop, IROLinear *destnode, SInt32 addConst, CInt64 *val, Boolean funkyFlag);
-extern void IRO_LinearizeForLoopPostLoop(IRONode *fnode1, IRONode *fnode2, IROLoop *loop, IRONode *fnode3, UInt32 unrollFactor);
-extern IROLinear *BuildEarlyLoopExitTest(IROLinearType type, IROList *list);
-extern IROLinear *BuildLoopExitTest(IROLinearType type, IROList *list);
-extern int IsIterationCountConstant(IROLoop *loop, CInt64 *pval);
-extern void NoOpBlock(IRONode *fnode);
-extern void IRO_TestConstantIterationCount(IROLoop *loop, CInt64 *iterCount, SInt32 vectorStride, UInt32 *unrollFactor, SInt32 *leftOver, UInt32 *needOrigLoop, UInt32 *needUnrollBodyTest, UInt32 *resetUnrolledFinalValue);
-extern IROLinear *BuildOrigIterationCount(IROList *list, IROLoop *loop);
-extern IROLinear *BuildNewFinalvalue(IROLinear *iterCount, UInt32 unrollFactor, IROList *list, IROLoop *loop);
-extern void BuildUnrolledBodyEntryTest(IROList *list, IROLinear *iterCount, UInt32 unrollFactor, CLabel *label);
-extern void ChangeInductionReference(IROLinear *first, IROLinear *last, CInt64 val, IROLoop *loop);
-extern IROLinear *UpdateInductionIncrement(IROLoop *loop, SInt32 value, IROLinear *before);
-extern void GenInitialAssignment(IROLoop *loop, Object *var, IROList *list);
-extern void GenNewInduction(void);
-
-#endif
diff --git a/includes/compiler/IroUtil.h b/includes/compiler/IroUtil.h
deleted file mode 100644
index a757025..0000000
--- a/includes/compiler/IroUtil.h
+++ /dev/null
@@ -1,127 +0,0 @@
-#ifndef COMPILER_IROUTIL_H
-#define COMPILER_IROUTIL_H
-
-#include "compiler/IrOptimizer.h"
-#include "compiler/CInt64.h"
-#include "compiler/CParser.h"
-
-#ifdef __MWERKS__
-#pragma options align=mac68k
-#endif
-struct IROList {
- IROLinear *head;
- IROLinear *tail;
-};
-
-struct IROListNode {
- IROList list;
- IROListNode *nextList;
-};
-
-struct IROElmList {
- void *element;
- IROElmList *next;
-};
-
-struct IROAddrRecord {
- IROLinear *linear;
- unsigned short numObjRefs;
- IROElmList *objRefs;
- unsigned short numMisc;
- IROElmList *misc;
- unsigned short numInts;
- IROElmList *ints;
- int x16;
-};
-#ifdef __MWERKS__
-#pragma options align=reset
-#endif
-
-extern Object *FunctionName;
-extern Boolean IRO_IsLeafFunction;
-extern Boolean IRO_FunctionHasReturn;
-extern Boolean DisableDueToAsm;
-extern Boolean LoopOptimizerRun;
-
-extern Object *IRO_IsVariable(IROLinear *linear);
-extern Boolean IRO_IsConstant(IROLinear *linear);
-extern Boolean IRO_IsPow2(IROLinear *linear, SInt32 *powvalue);
-extern Boolean IRO_IsIntConstant(IROLinear *linear);
-extern Boolean IRO_IsFloatConstant(IROLinear *linear);
-extern Boolean IRO_IsVector128Constant(IROLinear *linear);
-extern Boolean IRO_IsAssignment(IROLinear *linear);
-extern Boolean IRO_TypesEqual(Type *a, Type *b);
-extern Type *IRO_UnsignedType(Type *type);
-extern Type *IRO_SignedType(Type *type);
-extern Boolean IRO_is_CPtypeequal(Type *a, Type *b);
-extern Boolean IRO_ExprsSame(IROLinear *a, IROLinear *b);
-extern CLabel *IRO_NewLabel(void);
-extern Boolean IRO_ExprsSameSemantically(IROLinear *a, IROLinear *b);
-extern IROLinear *IRO_FindPrecedAfter(IROLinear *a, IROLinear *iter);
-extern IROLinear *IRO_FindPreced(IROLinear *a);
-extern IROLinear *IRO_FindFirst(IROLinear *linear);
-extern void IRO_CutAndPasteAfter(IROLinear *a, IROLinear *b, IROLinear *c);
-extern Boolean IRO_IsConstantZero(IROLinear *linear);
-extern Boolean IRO_IsConstantOne(IROLinear *linear);
-extern Boolean IRO_IsConstantNegativeOne(IROLinear *linear);
-extern void IRO_NopOut(IROLinear *linear);
-extern void IRO_NopNonSideEffects(IROLinear *linear, SInt32 level);
-extern void IRO_BuildList(IROLinear *linear, Boolean isEntry);
-typedef void (*IROWalkTreeFunc)(IROLinear *linear, Boolean isEntry);
-extern void IRO_WalkTree(IROLinear *linear, IROWalkTreeFunc func);
-extern void IRO_WalkTreeToPropagateFlags(IROLinear *linear, IROWalkTreeFunc func);
-extern void IRO_WalkInts(IROLinear *a, IROLinear *b, IROWalkTreeFunc func);
-extern void IRO_Cut(IROLinear *a, IROLinear *b);
-extern void IRO_Paste(IROLinear *a, IROLinear *b, IROLinear *c);
-extern void IRO_PasteAfter(IROLinear *a, IROLinear *b, IROLinear *c);
-extern void IRO_ClipExpr(IROExpr *expr);
-extern void IRO_ClipExprTree(IROLinear *linear);
-extern void IRO_MoveExpression(IROExpr *expr, IROLinear *linear);
-extern void IRO_InitList(IROList *list);
-extern void IRO_AddToList(IROLinear *linear, IROList *list);
-extern IROLinear *IRO_FindLabelNode(CLabel *label, IROLinear *linear);
-extern void IRO_DuplicateExprRange(IROLinear *start, IROLinear *end, IROList *list);
-extern IROLinear *IRO_DuplicateExpr(IROLinear *linear, IROList *list);
-extern IROLinear *IRO_TempReference(Object *obj, IROList *list);
-extern IROLinear *IRO_LocateFather(IROLinear *linear);
-extern IROLinear *IRO_LocateFather_Cut_And_Paste(IROLinear *a, IROLinear *b);
-extern IROLinear *IRO_LocateFather_Cut_And_Paste_Without_Nopping(IROLinear *a, IROLinear *b);
-extern void IRO_ReplaceReference(IROLinear *a, Object *obj, IROLinear *b);
-extern void IRO_ReplaceReferenceWithNode(IROLinear *a, IROLinear *b);
-extern VarRecord *IRO_GetTemp(IROExpr *expr);
-extern IROLinear *IRO_AssignToTemp(IROExpr *expr);
-extern IROLinear *IRO_FindStart(IROLinear *linear);
-extern void IRO_DeleteCommaNode(IROLinear *linear, IROExpr *expr);
-extern void IRO_RemoveCommaNodeFromIR(void);
-extern IROAddrRecord *IRO_InitAddrRecordPointer(IROLinear *linear);
-extern IROLinear *IRO_HasSideEffect(IROLinear *linear);
-extern IROLinear *IRO_CheckSideEffect(IROLinear *linear);
-typedef void (*WalkObjFunc)(Object *obj);
-extern void IRO_WalkExcActions(ExceptionAction *action, WalkObjFunc func);
-extern Boolean IRO_FunctionCallMightThrowException(IROLinear *linear);
-extern IROLinear *IRO_NewIntConst(CInt64 val, Type *type);
-extern IROLinear *IRO_NewFloatConst(const Float val, Type *type);
-extern Boolean IRO_IsAddressMultiply(IROLinear *linear);
-extern void IRO_SetupForUserBreakChecking(void);
-extern void IRO_CheckForUserBreak(void);
-
-// TODO is this elsewhere?
-CW_INLINE Boolean IRO_IsUnsignedType(Type *type) {
- return is_unsigned(type);
-}
-
-// 4B4D40
-CW_INLINE CInt64 IRO_MakeULong(UInt32 i) {
- CInt64 val;
- CInt64_SetULong(&val, i);
- return val;
-}
-
-// 4BAAA0
-CW_INLINE CInt64 IRO_MakeLong(SInt32 i) {
- CInt64 val;
- CInt64_SetLong(&val, i);
- return val;
-}
-
-#endif
diff --git a/includes/compiler/IroVars.h b/includes/compiler/IroVars.h
deleted file mode 100644
index 9df9ae5..0000000
--- a/includes/compiler/IroVars.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef COMPILER_IROVARS_H
-#define COMPILER_IROVARS_H
-
-#include "compiler/IrOptimizer.h"
-#include "compiler/enode.h"
-
-#ifdef __MWERKS__
-#pragma options align=mac68k
-#endif
-struct VarRecord {
- UInt16 index;
- Object *object;
- int x6;
- Boolean xA;
- Boolean xB;
- Boolean xC;
- VarRecord *next;
- IRODef *defs;
- IROUse *uses;
- Type *x1A; // bitfield-related
- IROLinear *x1E;
-};
-#ifdef __MWERKS__
-#pragma options align=reset
-#endif
-
-extern VarRecord *IRO_FirstVar;
-extern VarRecord *IRO_LastVar;
-extern SInt32 IRO_NumVars;
-extern Boolean IRO_IsBitField;
-extern SInt32 IRO_BaseTerms;
-extern SInt32 IRO_VarTerms;
-extern Boolean IRO_IsModifyOp[MAXEXPR];
-extern Boolean IRO_IsAssignOp[MAXEXPR];
-
-extern void IRO_InitializeIRO_IsModifyOpArray(void);
-extern void IRO_InitializeIRO_IsAssignOpArray(void);
-extern VarRecord *IRO_FindVar(Object *object, Boolean flag1, Boolean flag2);
-extern void IRO_FindAllVars(void);
-extern void IRO_ZapVarPtrs(void);
-extern void IRO_UpdateVars(void);
-extern void IRO_AddElmToList(IROLinear *linear, IROElmList **list);
-extern void IRO_DecomposeAddressExpression(IROLinear *linear, IROAddrRecord *rec);
-extern void IRO_DecomposeAddressExpression_Cheap(IROLinear *linear);
-extern VarRecord *IRO_FindAssigned(IROLinear *linear);
-extern void IRO_GetKills(IROLinear *linear);
-extern void IRO_CheckInit(void);
-extern void IRO_RewriteBitFieldTemps(void);
-extern void IRO_ScalarizeClassDataMembers(void);
-
-#endif
diff --git a/includes/compiler/LoopDetection.h b/includes/compiler/LoopDetection.h
index 5d9a729..42447be 100644
--- a/includes/compiler/LoopDetection.h
+++ b/includes/compiler/LoopDetection.h
@@ -2,7 +2,7 @@
#define COMPILER_LOOPDETECTION_H
#include "compiler/common.h"
-#include "compiler/BitVector.h"
+#include "../../compiler_and_linker/FrontEnd/Optimizer/BitVector.h"
#ifdef __MWERKS__
#pragma options align=mac68k