mirror of
https://git.wuffs.org/MWCC
synced 2025-12-18 09:25:28 +00:00
move lots of source files around to match their actual placement in the original tree
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#include "compiler/CPrepTokenizer.h"
|
||||
#include "compiler/Coloring.h"
|
||||
#include "compiler/CompilerTools.h"
|
||||
#include "compiler/uDump.h"
|
||||
#include "compiler/DumpIR.h"
|
||||
#include "compiler/Exceptions.h"
|
||||
#include "compiler/InlineAsmPPC.h"
|
||||
#include "compiler/Intrinsics.h"
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "compiler/CodeGen.h"
|
||||
#include "compiler/Coloring.h"
|
||||
#include "compiler/CompilerTools.h"
|
||||
#include "compiler/uDump.h"
|
||||
#include "compiler/DumpIR.h"
|
||||
#include "compiler/InlineAsmPPC.h"
|
||||
#include "compiler/InlineAsmRegisters.h"
|
||||
#include "compiler/ObjGenMachO.h"
|
||||
@@ -1,22 +1,22 @@
|
||||
#include "cmdline.h"
|
||||
#include "parser.h"
|
||||
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-common.h"
|
||||
#include "ParserGlue-mach-ppc-common.h"
|
||||
|
||||
static Boolean useDefaultIncludes = 1;
|
||||
static Boolean useDefaultLibraries = 1;
|
||||
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsCmdLine.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsCmdLineCompiler.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsCmdLineLinker.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsFrontEndC.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsDebugging.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsOptimizer.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsWarningC.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsBackEnd.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsProject.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsLinker.opt"
|
||||
#include "compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Lib/mac-ppc-cc/OptsDumper.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsCmdLine.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsCmdLineCompiler.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsCmdLineLinker.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsFrontEndC.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsDebugging.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsOptimizer.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsWarningC.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsBackEnd.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsProject.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsLinker.opt"
|
||||
#include "../../../Lib/mac-ppc-cc/OptsDumper.opt"
|
||||
|
||||
char *prefs[] = {
|
||||
"PPC CodeGen Mach-O",
|
||||
|
||||
@@ -139,7 +139,7 @@ int RegisterStaticLibImporterPlugin(void) {
|
||||
return RegisterStaticCompilerLinkerPlugin(&machlibimport_cb, &machlibimport_cl_cb);
|
||||
}
|
||||
|
||||
#include "compiler_and_linker/Plugin_Tools/MacOS_PPC/Lib_Importer_Mach/Resources/Errors.r"
|
||||
#include "../../../../../Plugin_Tools/MacOS_PPC/Lib_Importer_Mach/Resources/Errors.r"
|
||||
|
||||
int RegisterLibImporterResources(void) {
|
||||
return RegisterResource("Mach-O Lib Importer Errors", 911, STR911);
|
||||
|
||||
@@ -46,9 +46,9 @@ static CExprReplaceCB cexpr_rsearch_callback;
|
||||
static Type *cexpr_left_conversion_type;
|
||||
static Type *cexpr_right_conversion_type;
|
||||
|
||||
static FuncArg mon_arg = {NULL, NULL, NULL, NULL, 0, 0, 0, 0};
|
||||
static FuncArg diadic_arg2 = {NULL, NULL, NULL, NULL, 0, 0, 0, 0};
|
||||
static FuncArg diadic_arg1 = {&diadic_arg1, NULL, NULL, NULL, 0, 0, 0, 0};
|
||||
static FuncArg mon_arg = {NULL, NULL, NULL, NULL, 0, 0, 0};
|
||||
static FuncArg diadic_arg2 = {NULL, NULL, NULL, NULL, 0, 0, 0};
|
||||
static FuncArg diadic_arg1 = {&diadic_arg1, NULL, NULL, NULL, 0, 0, 0};
|
||||
|
||||
static void CExpr_RecSearchExprTree(ENode *expr) {
|
||||
ENodeList *list;
|
||||
@@ -20,8 +20,8 @@
|
||||
#include "compiler/CTemplateTools.h"
|
||||
#include "compiler/CodeGen.h"
|
||||
#include "compiler/CompilerTools.h"
|
||||
#include "compiler/IrOptimizer.h"
|
||||
#include "compiler/IroPointerAnalysis.h"
|
||||
#include "../Optimizer/IrOptimizer.h"
|
||||
#include "../Optimizer/IroPointerAnalysis.h"
|
||||
#include "compiler/ObjGenMachO.h"
|
||||
#include "compiler/objects.h"
|
||||
#include "compiler/scopes.h"
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "compiler/CodeGen.h"
|
||||
#include "compiler/CompilerTools.h"
|
||||
#include "compiler/FuncLevelAsmPPC.h"
|
||||
#include "compiler/IroPointerAnalysis.h"
|
||||
#include "../Optimizer/IroPointerAnalysis.h"
|
||||
#include "compiler/ObjGenMachO.h"
|
||||
#include "compiler/objects.h"
|
||||
#include "compiler/scopes.h"
|
||||
|
||||
@@ -138,7 +138,6 @@ static FuncArg SOMIDT_arg1 = {
|
||||
TYPE(&void_ptr),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "compiler/CodeGen.h"
|
||||
#include "compiler/Switch.h"
|
||||
#include "compiler/Exceptions.h"
|
||||
#include "compiler/IrOptimizer.h"
|
||||
#include "../Optimizer/IrOptimizer.h"
|
||||
#include "cos.h"
|
||||
|
||||
COptBlock *basicblocks;
|
||||
36
compiler_and_linker/FrontEnd/Optimizer/BitVector.h
Normal file
36
compiler_and_linker/FrontEnd/Optimizer/BitVector.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#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
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "compiler/IROUseDef.h"
|
||||
#include "compiler/IRODump.h"
|
||||
#include "compiler/IROVars.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroMalloc.h"
|
||||
#include "compiler/IroPointerAnalysis.h"
|
||||
#include "compiler/IroTransform.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "IROUseDef.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroVars.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroMalloc.h"
|
||||
#include "IroPointerAnalysis.h"
|
||||
#include "IroTransform.h"
|
||||
#include "IroUtil.h"
|
||||
#include "compiler/CompilerTools.h"
|
||||
#include "compiler/CError.h"
|
||||
#include "compiler/CFunc.h"
|
||||
48
compiler_and_linker/FrontEnd/Optimizer/IROUseDef.h
Normal file
48
compiler_and_linker/FrontEnd/Optimizer/IROUseDef.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef COMPILER_IROUSEDEF_H
|
||||
#define COMPILER_IROUSEDEF_H
|
||||
|
||||
#include "IrOptimizer.h"
|
||||
#include "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
|
||||
@@ -1,26 +1,26 @@
|
||||
#include "compiler/IrOptimizer.h"
|
||||
#include "IrOptimizer.h"
|
||||
#include "compiler/CError.h"
|
||||
#include "compiler/CParser.h"
|
||||
#include "compiler/InlineAsmPPC.h"
|
||||
#include "compiler/IroCSE.h"
|
||||
#include "compiler/IroDump.h"
|
||||
#include "compiler/IroEval.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroSubable.h"
|
||||
#include "compiler/IroTransform.h"
|
||||
#include "compiler/IROUseDef.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "IroCSE.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroEval.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroSubable.h"
|
||||
#include "IroTransform.h"
|
||||
#include "IROUseDef.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/objects.h"
|
||||
#include "compiler/IroPropagate.h"
|
||||
#include "compiler/IroPointerAnalysis.h"
|
||||
#include "compiler/IroJump.h"
|
||||
#include "compiler/IroRangePropagation.h"
|
||||
#include "compiler/IroEmptyLoop.h"
|
||||
#include "compiler/IroUnrollLoop.h"
|
||||
#include "compiler/IroLoop.h"
|
||||
#include "compiler/IroExprRegeneration.h"
|
||||
#include "IroPropagate.h"
|
||||
#include "IroPointerAnalysis.h"
|
||||
#include "IroJump.h"
|
||||
#include "IroRangePropagation.h"
|
||||
#include "IroEmptyLoop.h"
|
||||
#include "IroUnrollLoop.h"
|
||||
#include "IroLoop.h"
|
||||
#include "IroExprRegeneration.h"
|
||||
|
||||
Boolean DoScalarize;
|
||||
Boolean DoLinearize;
|
||||
30
compiler_and_linker/FrontEnd/Optimizer/IrOptimizer.h
Normal file
30
compiler_and_linker/FrontEnd/Optimizer/IrOptimizer.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#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
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "compiler/BitVector.h"
|
||||
#include "BitVector.h"
|
||||
#include "compiler/CompilerTools.h"
|
||||
|
||||
void Bv_AllocVector(BitVector **bv, UInt32 size) {
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "compiler/IroCSE.h"
|
||||
#include "compiler/IroDump.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroMalloc.h"
|
||||
#include "compiler/IroPointerAnalysis.h"
|
||||
#include "compiler/IroSubable.h"
|
||||
#include "compiler/IROUseDef.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "IroCSE.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroMalloc.h"
|
||||
#include "IroPointerAnalysis.h"
|
||||
#include "IroSubable.h"
|
||||
#include "IROUseDef.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/CError.h"
|
||||
#include "compiler/CExpr.h"
|
||||
#include "compiler/CInt64.h"
|
||||
45
compiler_and_linker/FrontEnd/Optimizer/IroCSE.h
Normal file
45
compiler_and_linker/FrontEnd/Optimizer/IroCSE.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef COMPILER_IROCSE_H
|
||||
#define COMPILER_IROCSE_H
|
||||
|
||||
#include "IrOptimizer.h"
|
||||
#include "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
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "compiler/IroDump.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroPropagate.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroCSE.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroPropagate.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/CFunc.h"
|
||||
#include "compiler/CInt64.h"
|
||||
#include "compiler/CParser.h"
|
||||
#include "compiler/objects.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "compiler/IroCSE.h"
|
||||
|
||||
static FILE *DumpFile;
|
||||
static char *nodenames[MAXEXPR];
|
||||
27
compiler_and_linker/FrontEnd/Optimizer/IroDump.h
Normal file
27
compiler_and_linker/FrontEnd/Optimizer/IroDump.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef COMPILER_IRODUMP_H
|
||||
#define COMPILER_IRODUMP_H
|
||||
|
||||
#include "IrOptimizer.h"
|
||||
#include "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
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "compiler/IroEmptyLoop.h"
|
||||
#include "compiler/IroDump.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroLoop.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "IroEmptyLoop.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroLoop.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/CInt64.h"
|
||||
|
||||
// forward decls
|
||||
8
compiler_and_linker/FrontEnd/Optimizer/IroEmptyLoop.h
Normal file
8
compiler_and_linker/FrontEnd/Optimizer/IroEmptyLoop.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef COMPILER_IROEMPTYLOOP_H
|
||||
#define COMPILER_IROEMPTYLOOP_H
|
||||
|
||||
#include "IrOptimizer.h"
|
||||
|
||||
extern void IRO_FindEmptyLoops(void);
|
||||
|
||||
#endif
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "compiler/IroEval.h"
|
||||
#include "IroEval.h"
|
||||
#include "compiler/CInt64.h"
|
||||
#include "compiler/CMachine.h"
|
||||
#include "compiler/CParser.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroMalloc.h"
|
||||
#include "compiler/IroPointerAnalysis.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroMalloc.h"
|
||||
#include "IroPointerAnalysis.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/enode.h"
|
||||
#include "compiler/objects.h"
|
||||
#include "compiler/types.h"
|
||||
14
compiler_and_linker/FrontEnd/Optimizer/IroEval.h
Normal file
14
compiler_and_linker/FrontEnd/Optimizer/IroEval.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef COMPILER_IROEVAL_H
|
||||
#define COMPILER_IROEVAL_H
|
||||
|
||||
#include "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
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "compiler/IroExprRegeneration.h"
|
||||
#include "compiler/IroCSE.h"
|
||||
#include "compiler/IroDump.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroSubable.h"
|
||||
#include "compiler/IroTransform.h"
|
||||
#include "compiler/IROUseDef.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "IroExprRegeneration.h"
|
||||
#include "IroCSE.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroSubable.h"
|
||||
#include "IroTransform.h"
|
||||
#include "IROUseDef.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/CDecl.h"
|
||||
#include "compiler/CExpr.h"
|
||||
#include "compiler/CFunc.h"
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef COMPILER_IROEXPRREGENERATION_H
|
||||
#define COMPILER_IROEXPRREGENERATION_H
|
||||
|
||||
#include "IrOptimizer.h"
|
||||
|
||||
extern void IRO_RegenerateExpressions(void);
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroCSE.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroPropagate.h"
|
||||
#include "compiler/IROUseDef.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroCSE.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroPropagate.h"
|
||||
#include "IROUseDef.h"
|
||||
#include "IroUtil.h"
|
||||
#include "compiler/CError.h"
|
||||
#include "compiler/CFunc.h"
|
||||
#include "compiler/CompilerTools.h"
|
||||
97
compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.h
Normal file
97
compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.h
Normal file
@@ -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
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "compiler/IroJump.h"
|
||||
#include "compiler/IroDump.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "IroJump.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroUtil.h"
|
||||
#include "compiler/CFunc.h"
|
||||
#include "compiler/Exceptions.h"
|
||||
|
||||
12
compiler_and_linker/FrontEnd/Optimizer/IroJump.h
Normal file
12
compiler_and_linker/FrontEnd/Optimizer/IroJump.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef COMPILER_IROJUMP_H
|
||||
#define COMPILER_IROJUMP_H
|
||||
|
||||
#include "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
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroDump.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/CError.h"
|
||||
#include "compiler/CExpr.h"
|
||||
#include "compiler/CFunc.h"
|
||||
165
compiler_and_linker/FrontEnd/Optimizer/IroLinearForm.h
Normal file
165
compiler_and_linker/FrontEnd/Optimizer/IroLinearForm.h
Normal file
@@ -0,0 +1,165 @@
|
||||
#ifndef COMPILER_IROLINEARFORM_H
|
||||
#define COMPILER_IROLINEARFORM_H
|
||||
|
||||
#include "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
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "compiler/IroLoop.h"
|
||||
#include "compiler/IroCSE.h"
|
||||
#include "compiler/IroDump.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroPropagate.h"
|
||||
#include "compiler/IroSubable.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "IroLoop.h"
|
||||
#include "IroCSE.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroPropagate.h"
|
||||
#include "IroSubable.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/CFunc.h"
|
||||
#include "compiler/CInt64.h"
|
||||
#include "compiler/CMachine.h"
|
||||
111
compiler_and_linker/FrontEnd/Optimizer/IroLoop.h
Normal file
111
compiler_and_linker/FrontEnd/Optimizer/IroLoop.h
Normal file
@@ -0,0 +1,111 @@
|
||||
#ifndef COMPILER_IROLOOP_H
|
||||
#define COMPILER_IROLOOP_H
|
||||
|
||||
#include "IrOptimizer.h"
|
||||
#include "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
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "compiler/IroMalloc.h"
|
||||
#include "IroMalloc.h"
|
||||
#include "compiler/CompilerTools.h"
|
||||
|
||||
#define FLAGMASK 0xF
|
||||
15
compiler_and_linker/FrontEnd/Optimizer/IroMalloc.h
Normal file
15
compiler_and_linker/FrontEnd/Optimizer/IroMalloc.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef COMPILER_IROMALLOC_H
|
||||
#define COMPILER_IROMALLOC_H
|
||||
|
||||
#include "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
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "compiler/IroPointerAnalysis.h"
|
||||
#include "compiler/IroEval.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IroMalloc.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "IroPointerAnalysis.h"
|
||||
#include "IroEval.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IroMalloc.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/CDecl.h"
|
||||
#include "compiler/CExpr.h"
|
||||
#include "compiler/CFunc.h"
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "compiler/CompilerTools.h"
|
||||
#include "compiler/objects.h"
|
||||
#include "compiler/scopes.h"
|
||||
#include "compiler_and_linker/unsorted/IroPointerAnalysisADTs.c"
|
||||
#include "IroPointerAnalysisADTs.c"
|
||||
|
||||
// forward decls
|
||||
static Object *GetLocalObject(PALocalVar *local, Object *proc, Boolean flag);
|
||||
25
compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysis.h
Normal file
25
compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysis.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef COMPILER_IROPOINTERANALYSIS_H
|
||||
#define COMPILER_IROPOINTERANALYSIS_H
|
||||
|
||||
#include "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
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "compiler/IroPointerAnalysis.h"
|
||||
#include "compiler/IroMalloc.h"
|
||||
#include "IroPointerAnalysis.h"
|
||||
#include "IroMalloc.h"
|
||||
#include "compiler/CError.h"
|
||||
#include "compiler/CInt64.h"
|
||||
#include "compiler/CParser.h"
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "compiler/IroPropagate.h"
|
||||
#include "compiler/IroCSE.h"
|
||||
#include "compiler/IroDump.h"
|
||||
#include "compiler/IroEval.h"
|
||||
#include "compiler/IroFlowgraph.h"
|
||||
#include "compiler/IroLinearForm.h"
|
||||
#include "compiler/IROUseDef.h"
|
||||
#include "compiler/IroUtil.h"
|
||||
#include "compiler/IroVars.h"
|
||||
#include "IroPropagate.h"
|
||||
#include "IroCSE.h"
|
||||
#include "IroDump.h"
|
||||
#include "IroEval.h"
|
||||
#include "IroFlowgraph.h"
|
||||
#include "IroLinearForm.h"
|
||||
#include "IROUseDef.h"
|
||||
#include "IroUtil.h"
|
||||
#include "IroVars.h"
|
||||
#include "compiler/objects.h"
|
||||
#include "compiler/CExpr.h"
|
||||
#include "compiler/CompilerTools.h"
|
||||
35
compiler_and_linker/FrontEnd/Optimizer/IroPropagate.h
Normal file
35
compiler_and_linker/FrontEnd/Optimizer/IroPropagate.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef COMPILER_IROPROPAGATE_H
|
||||
#define COMPILER_IROPROPAGATE_H
|
||||
|
||||
#include "IrOptimizer.h"
|
||||
#include "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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user