diff options
Diffstat (limited to 'includes/compiler/IroLoop.h')
-rw-r--r-- | includes/compiler/IroLoop.h | 107 |
1 files changed, 106 insertions, 1 deletions
diff --git a/includes/compiler/IroLoop.h b/includes/compiler/IroLoop.h index 10bc36a..8357830 100644 --- a/includes/compiler/IroLoop.h +++ b/includes/compiler/IroLoop.h @@ -1,6 +1,111 @@ #ifndef COMPILER_IROLOOP_H #define COMPILER_IROLOOP_H -#include "compiler/common.h" +#include "compiler/IrOptimizer.h" +#include "compiler/BitVector.h" + +typedef enum IROLoopIndFlags { + LoopInd_1 = 1, + LoopInd_2 = 2, + LoopInd_4 = 4, + LoopInd_8 = 8 +} IROLoopIndFlags; + +typedef enum IROLoopFlags { + LoopFlags_1 = 1, + LP_LOOP_HAS_CALLS = 2, + LP_LOOP_HAS_CNTRLFLOW = 4, + LoopFlags_8 = 8, + LP_INDUCTION_NOT_FOUND = 0x10, + LP_IFEXPR_NON_CANONICAL = 0x20, + LP_HAS_MULTIPLE_INDUCTIONS = 0x40, + LP_LOOP_HDR_HAS_SIDEEFFECTS = 0x80, + LoopFlags_100 = 0x100, + LoopFlags_200 = 0x200, + LP_LOOP_STEP_ISPOS = 0x400, + LoopFlags_800 = 0x800, + LoopFlags_1000 = 0x1000, + LoopFlags_2000 = 0x2000, + LP_LOOP_STEP_ISNEG = 0x4000, + LP_LOOP_HAS_ASM = 0x8000, + LoopFlags_10000 = 0x10000, + LoopFlags_20000 = 0x20000, + LoopFlags_40000 = 0x40000 +} 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; + int xC; + int x10; + IROLinear *nd14; // assignment expression that sets the initial value of induction + IROLinear *nd18; + 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 |