summaryrefslogtreecommitdiff
path: root/compiler_and_linker
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-26 11:30:47 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-26 11:30:47 +0000
commit094b96ca1df4a035b5f93c351f773306c0241f3f (patch)
tree95ce05e3ebe816c7ee7996206bb37ea17d8ca33c /compiler_and_linker
parentfc0c4c0df7b583b55a08317cf1ef6a71d27c0440 (diff)
downloadMWCC-094b96ca1df4a035b5f93c351f773306c0241f3f.tar.gz
MWCC-094b96ca1df4a035b5f93c351f773306c0241f3f.zip
move lots of source files around to match their actual placement in the original treemain
Diffstat (limited to 'compiler_and_linker')
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CMachine.c (renamed from compiler_and_linker/unsorted/CMachine.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/CodeGen.c (renamed from compiler_and_linker/unsorted/CodeGen.c)2
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Exceptions.c (renamed from compiler_and_linker/unsorted/Exceptions.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/FunctionCalls.c (renamed from compiler_and_linker/unsorted/FunctionCalls.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/InstrSelection.c (renamed from compiler_and_linker/unsorted/InstrSelection.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Intrinsics.c (renamed from compiler_and_linker/unsorted/Intrinsics.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Operands.c (renamed from compiler_and_linker/unsorted/Operands.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/PCodeAssembly.c (renamed from compiler_and_linker/unsorted/PCodeAssembly.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/PCodeListing.c (renamed from compiler_and_linker/unsorted/PCodeListing.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/PCodeUtilities.c (renamed from compiler_and_linker/unsorted/PCodeUtilities.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Peephole.c (renamed from compiler_and_linker/unsorted/Peephole.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/StackFrame.c (renamed from compiler_and_linker/unsorted/StackFrame.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/StructMoves.c (renamed from compiler_and_linker/unsorted/StructMoves.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Switch.c (renamed from compiler_and_linker/unsorted/Switch.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/CodeGenerator/TOC.c (renamed from compiler_and_linker/unsorted/TOC.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/Alias.c (renamed from compiler_and_linker/unsorted/Alias.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/CodeMotion.c (renamed from compiler_and_linker/unsorted/CodeMotion.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/ConstantPropagation.c (renamed from compiler_and_linker/unsorted/ConstantPropagation.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/LoopDetection.c (renamed from compiler_and_linker/unsorted/LoopDetection.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/LoopOptimization.c (renamed from compiler_and_linker/unsorted/LoopOptimization.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/StrengthReduction.c (renamed from compiler_and_linker/unsorted/StrengthReduction.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/ValueNumbering.c (renamed from compiler_and_linker/unsorted/ValueNumbering.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/VectorArraysToRegs.c (renamed from compiler_and_linker/unsorted/VectorArraysToRegs.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/InlineAssembler/FuncLevelAsmPPC.c (renamed from compiler_and_linker/unsorted/FuncLevelAsmPPC.c)2
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/InlineAssembler/GCCInlineAsm.c (renamed from compiler_and_linker/unsorted/GCCInlineAsm.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/InlineAssembler/InlineAsm.c (renamed from compiler_and_linker/unsorted/InlineAsm.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/InlineAssembler/InlineAsmPPC.c (renamed from compiler_and_linker/unsorted/InlineAsmPPC.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/PCode/PCodeInfo.c (renamed from compiler_and_linker/unsorted/PCodeInfo.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/PPCError.c (renamed from compiler_and_linker/unsorted/PPCError.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/Coloring.c (renamed from compiler_and_linker/unsorted/Coloring.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/InterferenceGraph.c (renamed from compiler_and_linker/unsorted/InterferenceGraph.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/RegisterInfo.c (renamed from compiler_and_linker/unsorted/RegisterInfo.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/SpillCode.c (renamed from compiler_and_linker/unsorted/SpillCode.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation601.c (renamed from compiler_and_linker/unsorted/MachineSimulation601.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation603.c (renamed from compiler_and_linker/unsorted/MachineSimulation603.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation603e.c (renamed from compiler_and_linker/unsorted/MachineSimulation603e.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation604.c (renamed from compiler_and_linker/unsorted/MachineSimulation604.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation7400.c (renamed from compiler_and_linker/unsorted/MachineSimulation7400.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation750.c (renamed from compiler_and_linker/unsorted/MachineSimulation750.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation821.c (renamed from compiler_and_linker/unsorted/MachineSimulation821.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulationAltiVec.c (renamed from compiler_and_linker/unsorted/MachineSimulationAltiVec.c)0
-rw-r--r--compiler_and_linker/BackEnd/PowerPC/Scheduler/Scheduler.c (renamed from compiler_and_linker/unsorted/Scheduler.c)0
-rw-r--r--compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c24
-rw-r--r--compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c2
-rw-r--r--compiler_and_linker/FrontEnd/C/CABI.c (renamed from compiler_and_linker/unsorted/CABI.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CBrowse.c (renamed from compiler_and_linker/unsorted/CBrowse.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CClass.c (renamed from compiler_and_linker/unsorted/CClass.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CDecl.c (renamed from compiler_and_linker/unsorted/CDecl.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CError.c (renamed from compiler_and_linker/unsorted/CError.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CException.c (renamed from compiler_and_linker/unsorted/CException.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CExpr.c (renamed from compiler_and_linker/unsorted/CExpr.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CExpr2.c (renamed from compiler_and_linker/unsorted/CExpr2.c)6
-rw-r--r--compiler_and_linker/FrontEnd/C/CExprConvMatch.c (renamed from compiler_and_linker/unsorted/CExprConvMatch.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CFunc.c (renamed from compiler_and_linker/unsorted/CFunc.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CInit.c (renamed from compiler_and_linker/unsorted/CInit.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CInline.c (renamed from compiler_and_linker/unsorted/CInline.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CMangler.c (renamed from compiler_and_linker/unsorted/CMangler.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CParser.c (renamed from compiler_and_linker/unsorted/CParser.c)4
-rw-r--r--compiler_and_linker/FrontEnd/C/CPrec.c (renamed from compiler_and_linker/unsorted/CPrec.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CPrep.c2
-rw-r--r--compiler_and_linker/FrontEnd/C/CPreprocess.c (renamed from compiler_and_linker/unsorted/CPreprocess.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CRTTI.c (renamed from compiler_and_linker/unsorted/CRTTI.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CSOM.c (renamed from compiler_and_linker/unsorted/CSOM.c)1
-rw-r--r--compiler_and_linker/FrontEnd/C/CTemplateClass.c (renamed from compiler_and_linker/unsorted/CTemplateClass.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CTemplateFunc.c (renamed from compiler_and_linker/unsorted/CTemplateFunc.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CTemplateNew.c (renamed from compiler_and_linker/unsorted/CTemplateNew.c)0
-rw-r--r--compiler_and_linker/FrontEnd/C/CTemplateTools.c (renamed from compiler_and_linker/unsorted/CTemplateTools.c)0
-rw-r--r--compiler_and_linker/FrontEnd/Common/CIRTransform.c (renamed from compiler_and_linker/unsorted/CIRTransform.c)0
-rw-r--r--compiler_and_linker/FrontEnd/Common/COptimizer.c (renamed from compiler_and_linker/unsorted/COptimizer.c)2
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/BitVector.h36
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IROUseDef.c (renamed from compiler_and_linker/unsorted/IROUseDef.c)18
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IROUseDef.h48
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IrOptimizer.c (renamed from compiler_and_linker/unsorted/IrOptimizer.c)38
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IrOptimizer.h30
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroBitVect.c (renamed from compiler_and_linker/unsorted/IroBitVect.c)2
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroCSE.c (renamed from compiler_and_linker/unsorted/IroCSE.c)20
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroCSE.h45
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroDump.c (renamed from compiler_and_linker/unsorted/IroDump.c)14
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroDump.h27
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroEmptyLoop.c (renamed from compiler_and_linker/unsorted/IroEmptyLoop.c)14
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroEmptyLoop.h8
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroEval.c (renamed from compiler_and_linker/unsorted/IroEval.c)14
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroEval.h14
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroExprRegeneration.c (renamed from compiler_and_linker/unsorted/IroExprRegeneration.c)20
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroExprRegeneration.h8
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.c (renamed from compiler_and_linker/unsorted/IroFlowgraph.c)12
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.h97
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroJump.c (renamed from compiler_and_linker/unsorted/IroJump.c)10
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroJump.h12
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroLinearForm.c (renamed from compiler_and_linker/unsorted/IroLinearForm.c)10
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroLinearForm.h165
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroLoop.c (renamed from compiler_and_linker/unsorted/IroLoop.c)18
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroLoop.h111
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroMalloc.c (renamed from compiler_and_linker/unsorted/IroMalloc.c)2
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroMalloc.h15
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysis.c (renamed from compiler_and_linker/unsorted/IroPointerAnalysis.c)16
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysis.h25
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysisADTs.c (renamed from compiler_and_linker/unsorted/IroPointerAnalysisADTs.c)4
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroPropagate.c (renamed from compiler_and_linker/unsorted/IroPropagate.c)18
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroPropagate.h35
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroRangePropagation.c (renamed from compiler_and_linker/unsorted/IroRangePropagation.c)16
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroRangePropagation.h8
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroSubable.c (renamed from compiler_and_linker/unsorted/IroSubable.c)8
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroSubable.h10
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroTransform.c (renamed from compiler_and_linker/unsorted/IroTransform.c)16
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroTransform.h13
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroUnrollLoop.c (renamed from compiler_and_linker/unsorted/IroUnrollLoop.c)14
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroUnrollLoop.h23
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroUtil.c (renamed from compiler_and_linker/unsorted/IroUtil.c)14
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroUtil.h127
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroVars.c (renamed from compiler_and_linker/unsorted/IroVars.c)20
-rw-r--r--compiler_and_linker/FrontEnd/Optimizer/IroVars.h51
-rw-r--r--compiler_and_linker/unsorted/CCompiler.c2
-rw-r--r--compiler_and_linker/unsorted/DumpIR.c (renamed from compiler_and_linker/unsorted/uDump.c)2
-rw-r--r--compiler_and_linker/unsorted/ObjGenMachO.c4
115 files changed, 1093 insertions, 186 deletions
diff --git a/compiler_and_linker/unsorted/CMachine.c b/compiler_and_linker/BackEnd/PowerPC/CMachine.c
index bfa7023..bfa7023 100644
--- a/compiler_and_linker/unsorted/CMachine.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CMachine.c
diff --git a/compiler_and_linker/unsorted/CodeGen.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/CodeGen.c
index 986bddc..d3bac77 100644
--- a/compiler_and_linker/unsorted/CodeGen.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/CodeGen.c
@@ -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"
diff --git a/compiler_and_linker/unsorted/Exceptions.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Exceptions.c
index 14627cf..14627cf 100644
--- a/compiler_and_linker/unsorted/Exceptions.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Exceptions.c
diff --git a/compiler_and_linker/unsorted/FunctionCalls.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/FunctionCalls.c
index 67d7443..67d7443 100644
--- a/compiler_and_linker/unsorted/FunctionCalls.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/FunctionCalls.c
diff --git a/compiler_and_linker/unsorted/InstrSelection.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/InstrSelection.c
index 359c980..359c980 100644
--- a/compiler_and_linker/unsorted/InstrSelection.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/InstrSelection.c
diff --git a/compiler_and_linker/unsorted/Intrinsics.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Intrinsics.c
index 49334b8..49334b8 100644
--- a/compiler_and_linker/unsorted/Intrinsics.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Intrinsics.c
diff --git a/compiler_and_linker/unsorted/Operands.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Operands.c
index c5da285..c5da285 100644
--- a/compiler_and_linker/unsorted/Operands.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Operands.c
diff --git a/compiler_and_linker/unsorted/PCodeAssembly.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/PCodeAssembly.c
index 368f8c5..368f8c5 100644
--- a/compiler_and_linker/unsorted/PCodeAssembly.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/PCodeAssembly.c
diff --git a/compiler_and_linker/unsorted/PCodeListing.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/PCodeListing.c
index 7a9fa13..7a9fa13 100644
--- a/compiler_and_linker/unsorted/PCodeListing.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/PCodeListing.c
diff --git a/compiler_and_linker/unsorted/PCodeUtilities.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/PCodeUtilities.c
index b1f8ffb..b1f8ffb 100644
--- a/compiler_and_linker/unsorted/PCodeUtilities.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/PCodeUtilities.c
diff --git a/compiler_and_linker/unsorted/Peephole.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Peephole.c
index 151e448..151e448 100644
--- a/compiler_and_linker/unsorted/Peephole.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Peephole.c
diff --git a/compiler_and_linker/unsorted/StackFrame.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/StackFrame.c
index 6fa4524..6fa4524 100644
--- a/compiler_and_linker/unsorted/StackFrame.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/StackFrame.c
diff --git a/compiler_and_linker/unsorted/StructMoves.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/StructMoves.c
index 7c28b88..7c28b88 100644
--- a/compiler_and_linker/unsorted/StructMoves.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/StructMoves.c
diff --git a/compiler_and_linker/unsorted/Switch.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Switch.c
index 4bbd82e..4bbd82e 100644
--- a/compiler_and_linker/unsorted/Switch.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/Switch.c
diff --git a/compiler_and_linker/unsorted/TOC.c b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/TOC.c
index 7af09e3..7af09e3 100644
--- a/compiler_and_linker/unsorted/TOC.c
+++ b/compiler_and_linker/BackEnd/PowerPC/CodeGenerator/TOC.c
diff --git a/compiler_and_linker/unsorted/Alias.c b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/Alias.c
index 8223bf4..8223bf4 100644
--- a/compiler_and_linker/unsorted/Alias.c
+++ b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/Alias.c
diff --git a/compiler_and_linker/unsorted/CodeMotion.c b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/CodeMotion.c
index 8ce2962..8ce2962 100644
--- a/compiler_and_linker/unsorted/CodeMotion.c
+++ b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/CodeMotion.c
diff --git a/compiler_and_linker/unsorted/ConstantPropagation.c b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/ConstantPropagation.c
index 2b40453..2b40453 100644
--- a/compiler_and_linker/unsorted/ConstantPropagation.c
+++ b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/ConstantPropagation.c
diff --git a/compiler_and_linker/unsorted/LoopDetection.c b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/LoopDetection.c
index 6bb2d51..6bb2d51 100644
--- a/compiler_and_linker/unsorted/LoopDetection.c
+++ b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/LoopDetection.c
diff --git a/compiler_and_linker/unsorted/LoopOptimization.c b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/LoopOptimization.c
index b2aef1e..b2aef1e 100644
--- a/compiler_and_linker/unsorted/LoopOptimization.c
+++ b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/LoopOptimization.c
diff --git a/compiler_and_linker/unsorted/StrengthReduction.c b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/StrengthReduction.c
index 2b68dca..2b68dca 100644
--- a/compiler_and_linker/unsorted/StrengthReduction.c
+++ b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/StrengthReduction.c
diff --git a/compiler_and_linker/unsorted/ValueNumbering.c b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/ValueNumbering.c
index 0907fa1..0907fa1 100644
--- a/compiler_and_linker/unsorted/ValueNumbering.c
+++ b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/ValueNumbering.c
diff --git a/compiler_and_linker/unsorted/VectorArraysToRegs.c b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/VectorArraysToRegs.c
index fde27f1..fde27f1 100644
--- a/compiler_and_linker/unsorted/VectorArraysToRegs.c
+++ b/compiler_and_linker/BackEnd/PowerPC/GlobalOptimizer/VectorArraysToRegs.c
diff --git a/compiler_and_linker/unsorted/FuncLevelAsmPPC.c b/compiler_and_linker/BackEnd/PowerPC/InlineAssembler/FuncLevelAsmPPC.c
index 27528b8..340a54b 100644
--- a/compiler_and_linker/unsorted/FuncLevelAsmPPC.c
+++ b/compiler_and_linker/BackEnd/PowerPC/InlineAssembler/FuncLevelAsmPPC.c
@@ -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"
diff --git a/compiler_and_linker/unsorted/GCCInlineAsm.c b/compiler_and_linker/BackEnd/PowerPC/InlineAssembler/GCCInlineAsm.c
index 897df9b..897df9b 100644
--- a/compiler_and_linker/unsorted/GCCInlineAsm.c
+++ b/compiler_and_linker/BackEnd/PowerPC/InlineAssembler/GCCInlineAsm.c
diff --git a/compiler_and_linker/unsorted/InlineAsm.c b/compiler_and_linker/BackEnd/PowerPC/InlineAssembler/InlineAsm.c
index 46a95d2..46a95d2 100644
--- a/compiler_and_linker/unsorted/InlineAsm.c
+++ b/compiler_and_linker/BackEnd/PowerPC/InlineAssembler/InlineAsm.c
diff --git a/compiler_and_linker/unsorted/InlineAsmPPC.c b/compiler_and_linker/BackEnd/PowerPC/InlineAssembler/InlineAsmPPC.c
index 464f9f9..464f9f9 100644
--- a/compiler_and_linker/unsorted/InlineAsmPPC.c
+++ b/compiler_and_linker/BackEnd/PowerPC/InlineAssembler/InlineAsmPPC.c
diff --git a/compiler_and_linker/unsorted/PCodeInfo.c b/compiler_and_linker/BackEnd/PowerPC/PCode/PCodeInfo.c
index b2e2385..b2e2385 100644
--- a/compiler_and_linker/unsorted/PCodeInfo.c
+++ b/compiler_and_linker/BackEnd/PowerPC/PCode/PCodeInfo.c
diff --git a/compiler_and_linker/unsorted/PPCError.c b/compiler_and_linker/BackEnd/PowerPC/PPCError.c
index 2d4c469..2d4c469 100644
--- a/compiler_and_linker/unsorted/PPCError.c
+++ b/compiler_and_linker/BackEnd/PowerPC/PPCError.c
diff --git a/compiler_and_linker/unsorted/Coloring.c b/compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/Coloring.c
index 8036435..8036435 100644
--- a/compiler_and_linker/unsorted/Coloring.c
+++ b/compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/Coloring.c
diff --git a/compiler_and_linker/unsorted/InterferenceGraph.c b/compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/InterferenceGraph.c
index d589502..d589502 100644
--- a/compiler_and_linker/unsorted/InterferenceGraph.c
+++ b/compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/InterferenceGraph.c
diff --git a/compiler_and_linker/unsorted/RegisterInfo.c b/compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/RegisterInfo.c
index 177c2e0..177c2e0 100644
--- a/compiler_and_linker/unsorted/RegisterInfo.c
+++ b/compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/RegisterInfo.c
diff --git a/compiler_and_linker/unsorted/SpillCode.c b/compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/SpillCode.c
index 69e7e43..69e7e43 100644
--- a/compiler_and_linker/unsorted/SpillCode.c
+++ b/compiler_and_linker/BackEnd/PowerPC/RegisterAllocator/SpillCode.c
diff --git a/compiler_and_linker/unsorted/MachineSimulation601.c b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation601.c
index 2d54678..2d54678 100644
--- a/compiler_and_linker/unsorted/MachineSimulation601.c
+++ b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation601.c
diff --git a/compiler_and_linker/unsorted/MachineSimulation603.c b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation603.c
index 49d1ea0..49d1ea0 100644
--- a/compiler_and_linker/unsorted/MachineSimulation603.c
+++ b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation603.c
diff --git a/compiler_and_linker/unsorted/MachineSimulation603e.c b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation603e.c
index d3e1e47..d3e1e47 100644
--- a/compiler_and_linker/unsorted/MachineSimulation603e.c
+++ b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation603e.c
diff --git a/compiler_and_linker/unsorted/MachineSimulation604.c b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation604.c
index 9775c9e..9775c9e 100644
--- a/compiler_and_linker/unsorted/MachineSimulation604.c
+++ b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation604.c
diff --git a/compiler_and_linker/unsorted/MachineSimulation7400.c b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation7400.c
index 56b375c..56b375c 100644
--- a/compiler_and_linker/unsorted/MachineSimulation7400.c
+++ b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation7400.c
diff --git a/compiler_and_linker/unsorted/MachineSimulation750.c b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation750.c
index d412df3..d412df3 100644
--- a/compiler_and_linker/unsorted/MachineSimulation750.c
+++ b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation750.c
diff --git a/compiler_and_linker/unsorted/MachineSimulation821.c b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation821.c
index bbf0509..bbf0509 100644
--- a/compiler_and_linker/unsorted/MachineSimulation821.c
+++ b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulation821.c
diff --git a/compiler_and_linker/unsorted/MachineSimulationAltiVec.c b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulationAltiVec.c
index d261ee9..d261ee9 100644
--- a/compiler_and_linker/unsorted/MachineSimulationAltiVec.c
+++ b/compiler_and_linker/BackEnd/PowerPC/Scheduler/MachineSimulationAltiVec.c
diff --git a/compiler_and_linker/unsorted/Scheduler.c b/compiler_and_linker/BackEnd/PowerPC/Scheduler/Scheduler.c
index 23b580f..23b580f 100644
--- a/compiler_and_linker/unsorted/Scheduler.c
+++ b/compiler_and_linker/BackEnd/PowerPC/Scheduler/Scheduler.c
diff --git a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c
index ba38b17..1a2cdb1 100644
--- a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c
+++ b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c
@@ -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",
diff --git a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c
index 4eb55d5..fab0f00 100644
--- a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c
+++ b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c
@@ -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);
diff --git a/compiler_and_linker/unsorted/CABI.c b/compiler_and_linker/FrontEnd/C/CABI.c
index 2a88de1..2a88de1 100644
--- a/compiler_and_linker/unsorted/CABI.c
+++ b/compiler_and_linker/FrontEnd/C/CABI.c
diff --git a/compiler_and_linker/unsorted/CBrowse.c b/compiler_and_linker/FrontEnd/C/CBrowse.c
index 12ea4c8..12ea4c8 100644
--- a/compiler_and_linker/unsorted/CBrowse.c
+++ b/compiler_and_linker/FrontEnd/C/CBrowse.c
diff --git a/compiler_and_linker/unsorted/CClass.c b/compiler_and_linker/FrontEnd/C/CClass.c
index fad276e..fad276e 100644
--- a/compiler_and_linker/unsorted/CClass.c
+++ b/compiler_and_linker/FrontEnd/C/CClass.c
diff --git a/compiler_and_linker/unsorted/CDecl.c b/compiler_and_linker/FrontEnd/C/CDecl.c
index 43ca92e..43ca92e 100644
--- a/compiler_and_linker/unsorted/CDecl.c
+++ b/compiler_and_linker/FrontEnd/C/CDecl.c
diff --git a/compiler_and_linker/unsorted/CError.c b/compiler_and_linker/FrontEnd/C/CError.c
index 02265c3..02265c3 100644
--- a/compiler_and_linker/unsorted/CError.c
+++ b/compiler_and_linker/FrontEnd/C/CError.c
diff --git a/compiler_and_linker/unsorted/CException.c b/compiler_and_linker/FrontEnd/C/CException.c
index d68ce13..d68ce13 100644
--- a/compiler_and_linker/unsorted/CException.c
+++ b/compiler_and_linker/FrontEnd/C/CException.c
diff --git a/compiler_and_linker/unsorted/CExpr.c b/compiler_and_linker/FrontEnd/C/CExpr.c
index 484f56d..484f56d 100644
--- a/compiler_and_linker/unsorted/CExpr.c
+++ b/compiler_and_linker/FrontEnd/C/CExpr.c
diff --git a/compiler_and_linker/unsorted/CExpr2.c b/compiler_and_linker/FrontEnd/C/CExpr2.c
index e5c662a..fc26c7e 100644
--- a/compiler_and_linker/unsorted/CExpr2.c
+++ b/compiler_and_linker/FrontEnd/C/CExpr2.c
@@ -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;
diff --git a/compiler_and_linker/unsorted/CExprConvMatch.c b/compiler_and_linker/FrontEnd/C/CExprConvMatch.c
index 5cc145f..5cc145f 100644
--- a/compiler_and_linker/unsorted/CExprConvMatch.c
+++ b/compiler_and_linker/FrontEnd/C/CExprConvMatch.c
diff --git a/compiler_and_linker/unsorted/CFunc.c b/compiler_and_linker/FrontEnd/C/CFunc.c
index 38cfab3..38cfab3 100644
--- a/compiler_and_linker/unsorted/CFunc.c
+++ b/compiler_and_linker/FrontEnd/C/CFunc.c
diff --git a/compiler_and_linker/unsorted/CInit.c b/compiler_and_linker/FrontEnd/C/CInit.c
index c2d2299..c2d2299 100644
--- a/compiler_and_linker/unsorted/CInit.c
+++ b/compiler_and_linker/FrontEnd/C/CInit.c
diff --git a/compiler_and_linker/unsorted/CInline.c b/compiler_and_linker/FrontEnd/C/CInline.c
index de51ab7..de51ab7 100644
--- a/compiler_and_linker/unsorted/CInline.c
+++ b/compiler_and_linker/FrontEnd/C/CInline.c
diff --git a/compiler_and_linker/unsorted/CMangler.c b/compiler_and_linker/FrontEnd/C/CMangler.c
index 615abf5..615abf5 100644
--- a/compiler_and_linker/unsorted/CMangler.c
+++ b/compiler_and_linker/FrontEnd/C/CMangler.c
diff --git a/compiler_and_linker/unsorted/CParser.c b/compiler_and_linker/FrontEnd/C/CParser.c
index e53b0bf..b089e47 100644
--- a/compiler_and_linker/unsorted/CParser.c
+++ b/compiler_and_linker/FrontEnd/C/CParser.c
@@ -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"
diff --git a/compiler_and_linker/unsorted/CPrec.c b/compiler_and_linker/FrontEnd/C/CPrec.c
index e61b96e..e61b96e 100644
--- a/compiler_and_linker/unsorted/CPrec.c
+++ b/compiler_and_linker/FrontEnd/C/CPrec.c
diff --git a/compiler_and_linker/FrontEnd/C/CPrep.c b/compiler_and_linker/FrontEnd/C/CPrep.c
index a2ac9e2..904e72a 100644
--- a/compiler_and_linker/FrontEnd/C/CPrep.c
+++ b/compiler_and_linker/FrontEnd/C/CPrep.c
@@ -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"
diff --git a/compiler_and_linker/unsorted/CPreprocess.c b/compiler_and_linker/FrontEnd/C/CPreprocess.c
index 4e6b3c0..4e6b3c0 100644
--- a/compiler_and_linker/unsorted/CPreprocess.c
+++ b/compiler_and_linker/FrontEnd/C/CPreprocess.c
diff --git a/compiler_and_linker/unsorted/CRTTI.c b/compiler_and_linker/FrontEnd/C/CRTTI.c
index 3881153..3881153 100644
--- a/compiler_and_linker/unsorted/CRTTI.c
+++ b/compiler_and_linker/FrontEnd/C/CRTTI.c
diff --git a/compiler_and_linker/unsorted/CSOM.c b/compiler_and_linker/FrontEnd/C/CSOM.c
index afd68a3..7e80e32 100644
--- a/compiler_and_linker/unsorted/CSOM.c
+++ b/compiler_and_linker/FrontEnd/C/CSOM.c
@@ -138,7 +138,6 @@ static FuncArg SOMIDT_arg1 = {
TYPE(&void_ptr),
0,
0,
- 0,
0
};
diff --git a/compiler_and_linker/unsorted/CTemplateClass.c b/compiler_and_linker/FrontEnd/C/CTemplateClass.c
index 8b3b889..8b3b889 100644
--- a/compiler_and_linker/unsorted/CTemplateClass.c
+++ b/compiler_and_linker/FrontEnd/C/CTemplateClass.c
diff --git a/compiler_and_linker/unsorted/CTemplateFunc.c b/compiler_and_linker/FrontEnd/C/CTemplateFunc.c
index 3c5de98..3c5de98 100644
--- a/compiler_and_linker/unsorted/CTemplateFunc.c
+++ b/compiler_and_linker/FrontEnd/C/CTemplateFunc.c
diff --git a/compiler_and_linker/unsorted/CTemplateNew.c b/compiler_and_linker/FrontEnd/C/CTemplateNew.c
index c33534a..c33534a 100644
--- a/compiler_and_linker/unsorted/CTemplateNew.c
+++ b/compiler_and_linker/FrontEnd/C/CTemplateNew.c
diff --git a/compiler_and_linker/unsorted/CTemplateTools.c b/compiler_and_linker/FrontEnd/C/CTemplateTools.c
index 0e77e74..0e77e74 100644
--- a/compiler_and_linker/unsorted/CTemplateTools.c
+++ b/compiler_and_linker/FrontEnd/C/CTemplateTools.c
diff --git a/compiler_and_linker/unsorted/CIRTransform.c b/compiler_and_linker/FrontEnd/Common/CIRTransform.c
index b91f6af..b91f6af 100644
--- a/compiler_and_linker/unsorted/CIRTransform.c
+++ b/compiler_and_linker/FrontEnd/Common/CIRTransform.c
diff --git a/compiler_and_linker/unsorted/COptimizer.c b/compiler_and_linker/FrontEnd/Common/COptimizer.c
index 9833a2b..3c83ae6 100644
--- a/compiler_and_linker/unsorted/COptimizer.c
+++ b/compiler_and_linker/FrontEnd/Common/COptimizer.c
@@ -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;
diff --git a/compiler_and_linker/FrontEnd/Optimizer/BitVector.h b/compiler_and_linker/FrontEnd/Optimizer/BitVector.h
new file mode 100644
index 0000000..a6830d6
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/BitVector.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IROUseDef.c b/compiler_and_linker/FrontEnd/Optimizer/IROUseDef.c
index 19d39ff..ba3f817 100644
--- a/compiler_and_linker/unsorted/IROUseDef.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IROUseDef.c
@@ -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"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IROUseDef.h b/compiler_and_linker/FrontEnd/Optimizer/IROUseDef.h
new file mode 100644
index 0000000..03d3f9b
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IROUseDef.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IrOptimizer.c b/compiler_and_linker/FrontEnd/Optimizer/IrOptimizer.c
index c9544a2..59bb368 100644
--- a/compiler_and_linker/unsorted/IrOptimizer.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IrOptimizer.c
@@ -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;
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IrOptimizer.h b/compiler_and_linker/FrontEnd/Optimizer/IrOptimizer.h
new file mode 100644
index 0000000..287e279
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IrOptimizer.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroBitVect.c b/compiler_and_linker/FrontEnd/Optimizer/IroBitVect.c
index 29bc28a..873b1ca 100644
--- a/compiler_and_linker/unsorted/IroBitVect.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroBitVect.c
@@ -1,4 +1,4 @@
-#include "compiler/BitVector.h"
+#include "BitVector.h"
#include "compiler/CompilerTools.h"
void Bv_AllocVector(BitVector **bv, UInt32 size) {
diff --git a/compiler_and_linker/unsorted/IroCSE.c b/compiler_and_linker/FrontEnd/Optimizer/IroCSE.c
index 5fa9849..7bc4866 100644
--- a/compiler_and_linker/unsorted/IroCSE.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroCSE.c
@@ -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"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroCSE.h b/compiler_and_linker/FrontEnd/Optimizer/IroCSE.h
new file mode 100644
index 0000000..c1e166c
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroCSE.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroDump.c b/compiler_and_linker/FrontEnd/Optimizer/IroDump.c
index e7ca940..d21496f 100644
--- a/compiler_and_linker/unsorted/IroDump.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroDump.c
@@ -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];
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroDump.h b/compiler_and_linker/FrontEnd/Optimizer/IroDump.h
new file mode 100644
index 0000000..ad8c039
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroDump.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroEmptyLoop.c b/compiler_and_linker/FrontEnd/Optimizer/IroEmptyLoop.c
index 1e319ab..23d5d4a 100644
--- a/compiler_and_linker/unsorted/IroEmptyLoop.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroEmptyLoop.c
@@ -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
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroEmptyLoop.h b/compiler_and_linker/FrontEnd/Optimizer/IroEmptyLoop.h
new file mode 100644
index 0000000..c5597e6
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroEmptyLoop.h
@@ -0,0 +1,8 @@
+#ifndef COMPILER_IROEMPTYLOOP_H
+#define COMPILER_IROEMPTYLOOP_H
+
+#include "IrOptimizer.h"
+
+extern void IRO_FindEmptyLoops(void);
+
+#endif
diff --git a/compiler_and_linker/unsorted/IroEval.c b/compiler_and_linker/FrontEnd/Optimizer/IroEval.c
index adf74b8..aba64e1 100644
--- a/compiler_and_linker/unsorted/IroEval.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroEval.c
@@ -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"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroEval.h b/compiler_and_linker/FrontEnd/Optimizer/IroEval.h
new file mode 100644
index 0000000..3b91f21
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroEval.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroExprRegeneration.c b/compiler_and_linker/FrontEnd/Optimizer/IroExprRegeneration.c
index f63622a..c56beae 100644
--- a/compiler_and_linker/unsorted/IroExprRegeneration.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroExprRegeneration.c
@@ -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"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroExprRegeneration.h b/compiler_and_linker/FrontEnd/Optimizer/IroExprRegeneration.h
new file mode 100644
index 0000000..c74f95f
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroExprRegeneration.h
@@ -0,0 +1,8 @@
+#ifndef COMPILER_IROEXPRREGENERATION_H
+#define COMPILER_IROEXPRREGENERATION_H
+
+#include "IrOptimizer.h"
+
+extern void IRO_RegenerateExpressions(void);
+
+#endif
diff --git a/compiler_and_linker/unsorted/IroFlowgraph.c b/compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.c
index 5c9c840..2fa9875 100644
--- a/compiler_and_linker/unsorted/IroFlowgraph.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroFlowgraph.c
@@ -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"
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
diff --git a/compiler_and_linker/unsorted/IroJump.c b/compiler_and_linker/FrontEnd/Optimizer/IroJump.c
index e39e3f0..9af248e 100644
--- a/compiler_and_linker/unsorted/IroJump.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroJump.c
@@ -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"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroJump.h b/compiler_and_linker/FrontEnd/Optimizer/IroJump.h
new file mode 100644
index 0000000..62b7be6
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroJump.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroLinearForm.c b/compiler_and_linker/FrontEnd/Optimizer/IroLinearForm.c
index 4941587..8c5b0d8 100644
--- a/compiler_and_linker/unsorted/IroLinearForm.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroLinearForm.c
@@ -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"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroLinearForm.h b/compiler_and_linker/FrontEnd/Optimizer/IroLinearForm.h
new file mode 100644
index 0000000..c0b2d17
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroLinearForm.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroLoop.c b/compiler_and_linker/FrontEnd/Optimizer/IroLoop.c
index d6ec5f0..850146d 100644
--- a/compiler_and_linker/unsorted/IroLoop.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroLoop.c
@@ -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"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroLoop.h b/compiler_and_linker/FrontEnd/Optimizer/IroLoop.h
new file mode 100644
index 0000000..2d968ad
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroLoop.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroMalloc.c b/compiler_and_linker/FrontEnd/Optimizer/IroMalloc.c
index 8928ba9..1f15cad 100644
--- a/compiler_and_linker/unsorted/IroMalloc.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroMalloc.c
@@ -1,4 +1,4 @@
-#include "compiler/IroMalloc.h"
+#include "IroMalloc.h"
#include "compiler/CompilerTools.h"
#define FLAGMASK 0xF
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroMalloc.h b/compiler_and_linker/FrontEnd/Optimizer/IroMalloc.h
new file mode 100644
index 0000000..7700280
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroMalloc.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroPointerAnalysis.c b/compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysis.c
index 4fcb8d3..3f8989f 100644
--- a/compiler_and_linker/unsorted/IroPointerAnalysis.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysis.c
@@ -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);
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysis.h b/compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysis.h
new file mode 100644
index 0000000..ec50eba
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysis.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroPointerAnalysisADTs.c b/compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysisADTs.c
index 6e24e6f..dad9501 100644
--- a/compiler_and_linker/unsorted/IroPointerAnalysisADTs.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroPointerAnalysisADTs.c
@@ -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"
diff --git a/compiler_and_linker/unsorted/IroPropagate.c b/compiler_and_linker/FrontEnd/Optimizer/IroPropagate.c
index 401250c..c5ad708 100644
--- a/compiler_and_linker/unsorted/IroPropagate.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroPropagate.c
@@ -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"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroPropagate.h b/compiler_and_linker/FrontEnd/Optimizer/IroPropagate.h
new file mode 100644
index 0000000..ff9fadb
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroPropagate.h
@@ -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
diff --git a/compiler_and_linker/unsorted/IroRangePropagation.c b/compiler_and_linker/FrontEnd/Optimizer/IroRangePropagation.c
index d15ef86..737035f 100644
--- a/compiler_and_linker/unsorted/IroRangePropagation.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroRangePropagation.c
@@ -1,11 +1,11 @@
-#include "compiler/IroRangePropagation.h"
-#include "compiler/IroDump.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 "IroRangePropagation.h"
+#include "IroDump.h"
+#include "IroFlowgraph.h"
+#include "IroLinearForm.h"
+#include "IroMalloc.h"
+#include "IroPointerAnalysis.h"
+#include "IroUtil.h"
+#include "IroVars.h"
#include "compiler/CInt64.h"
#include "compiler/objects.h"
#include "compiler/types.h"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroRangePropagation.h b/compiler_and_linker/FrontEnd/Optimizer/IroRangePropagation.h
new file mode 100644
index 0000000..96888ac
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroRangePropagation.h
@@ -0,0 +1,8 @@
+#ifndef COMPILER_IRORANGEPROPAGATION_H
+#define COMPILER_IRORANGEPROPAGATION_H
+
+#include "IrOptimizer.h"
+
+extern Boolean IRO_RangePropagateInFNode(void);
+
+#endif
diff --git a/compiler_and_linker/unsorted/IroSubable.c b/compiler_and_linker/FrontEnd/Optimizer/IroSubable.c
index 6b8daf0..513ac6c 100644
--- a/compiler_and_linker/unsorted/IroSubable.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroSubable.c
@@ -1,7 +1,7 @@
-#include "compiler/IroSubable.h"
-#include "compiler/IroLinearForm.h"
-#include "compiler/IroPropagate.h"
-#include "compiler/IroUtil.h"
+#include "IroSubable.h"
+#include "IroLinearForm.h"
+#include "IroPropagate.h"
+#include "IroUtil.h"
#include "compiler/enode.h"
#include "compiler/objects.h"
#include "compiler/types.h"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroSubable.h b/compiler_and_linker/FrontEnd/Optimizer/IroSubable.h
new file mode 100644
index 0000000..db5f860
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroSubable.h
@@ -0,0 +1,10 @@
+#ifndef COMPILER_IROSUBABLE_H
+#define COMPILER_IROSUBABLE_H
+
+#include "IrOptimizer.h"
+
+extern void IRO_InitializeIsSubableOpArray(void);
+extern Boolean IRO_IsSubableExpression(IROLinear *nd);
+extern Boolean IRO_IsVectorTempCandidate(IROLinear *nd);
+
+#endif
diff --git a/compiler_and_linker/unsorted/IroTransform.c b/compiler_and_linker/FrontEnd/Optimizer/IroTransform.c
index 54f3302..8a4af16 100644
--- a/compiler_and_linker/unsorted/IroTransform.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroTransform.c
@@ -1,4 +1,4 @@
-#include "compiler/IroTransform.h"
+#include "IroTransform.h"
#include "compiler/CError.h"
#include "compiler/CFunc.h"
#include "compiler/CInt64.h"
@@ -6,13 +6,13 @@
#include "compiler/CMachine.h"
#include "compiler/CPrep.h"
#include "compiler/CompilerTools.h"
-#include "compiler/IroDump.h"
-#include "compiler/IroLinearForm.h"
-#include "compiler/IroMalloc.h"
-#include "compiler/IroPointerAnalysis.h"
-#include "compiler/IROUseDef.h"
-#include "compiler/IroUtil.h"
-#include "compiler/IroVars.h"
+#include "IroDump.h"
+#include "IroLinearForm.h"
+#include "IroMalloc.h"
+#include "IroPointerAnalysis.h"
+#include "IROUseDef.h"
+#include "IroUtil.h"
+#include "IroVars.h"
#include "compiler/enode.h"
#include "compiler/types.h"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroTransform.h b/compiler_and_linker/FrontEnd/Optimizer/IroTransform.h
new file mode 100644
index 0000000..104657f
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroTransform.h
@@ -0,0 +1,13 @@
+#ifndef COMPILER_IROTRANSFORM_H
+#define COMPILER_IROTRANSFORM_H
+
+#include "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/compiler_and_linker/unsorted/IroUnrollLoop.c b/compiler_and_linker/FrontEnd/Optimizer/IroUnrollLoop.c
index 45b774e..cf3f1bf 100644
--- a/compiler_and_linker/unsorted/IroUnrollLoop.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroUnrollLoop.c
@@ -1,12 +1,12 @@
-#include "compiler/IroUnrollLoop.h"
+#include "IroUnrollLoop.h"
#include "compiler/CError.h"
-#include "compiler/IroFlowgraph.h"
-#include "compiler/IroLinearForm.h"
-#include "compiler/IroUtil.h"
+#include "IroFlowgraph.h"
+#include "IroLinearForm.h"
+#include "IroUtil.h"
#include "compiler/LoopDetection.h"
-#include "compiler/IroLoop.h"
-#include "compiler/IroDump.h"
-#include "compiler/IroVars.h"
+#include "IroLoop.h"
+#include "IroDump.h"
+#include "IroVars.h"
#include "compiler/CFunc.h"
#include "compiler/CMachine.h"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroUnrollLoop.h b/compiler_and_linker/FrontEnd/Optimizer/IroUnrollLoop.h
new file mode 100644
index 0000000..fd4972b
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroUnrollLoop.h
@@ -0,0 +1,23 @@
+#ifndef COMPILER_IROUNROLLLOOP_H
+#define COMPILER_IROUNROLLLOOP_H
+
+#include "IrOptimizer.h"
+#include "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/compiler_and_linker/unsorted/IroUtil.c b/compiler_and_linker/FrontEnd/Optimizer/IroUtil.c
index 4ade9b1..7e6321d 100644
--- a/compiler_and_linker/unsorted/IroUtil.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroUtil.c
@@ -1,10 +1,10 @@
-#include "compiler/IroUtil.h"
-#include "compiler/IroCSE.h"
-#include "compiler/IroDump.h"
-#include "compiler/IroFlowgraph.h"
-#include "compiler/IroLinearForm.h"
-#include "compiler/IroLoop.h"
-#include "compiler/IroVars.h"
+#include "IroUtil.h"
+#include "IroCSE.h"
+#include "IroDump.h"
+#include "IroFlowgraph.h"
+#include "IroLinearForm.h"
+#include "IroLoop.h"
+#include "IroVars.h"
#include "compiler/InlineAsmPPC.h"
#include "compiler/CompilerTools.h"
#include "compiler/CCompiler.h"
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroUtil.h b/compiler_and_linker/FrontEnd/Optimizer/IroUtil.h
new file mode 100644
index 0000000..2661985
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroUtil.h
@@ -0,0 +1,127 @@
+#ifndef COMPILER_IROUTIL_H
+#define COMPILER_IROUTIL_H
+
+#include "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/compiler_and_linker/unsorted/IroVars.c b/compiler_and_linker/FrontEnd/Optimizer/IroVars.c
index 6bb3d02..b72ba89 100644
--- a/compiler_and_linker/unsorted/IroVars.c
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroVars.c
@@ -1,12 +1,12 @@
-#include "compiler/IroVars.h"
-#include "compiler/IroDump.h"
-#include "compiler/IroFlowgraph.h"
-#include "compiler/IroJump.h"
-#include "compiler/IroLinearForm.h"
-#include "compiler/IroMalloc.h"
-#include "compiler/IroPointerAnalysis.h"
-#include "compiler/IroUtil.h"
-#include "compiler/IROUseDef.h"
+#include "IroVars.h"
+#include "IroDump.h"
+#include "IroFlowgraph.h"
+#include "IroJump.h"
+#include "IroLinearForm.h"
+#include "IroMalloc.h"
+#include "IroPointerAnalysis.h"
+#include "IroUtil.h"
+#include "IROUseDef.h"
#include "compiler/CClass.h"
#include "compiler/CError.h"
#include "compiler/CExpr.h"
@@ -17,7 +17,7 @@
#include "compiler/objects.h"
#include "compiler/InlineAsm.h"
#include "compiler/InlineAsmPPC.h"
-#include "compiler/BitVector.h"
+#include "BitVector.h"
#ifdef __MWERKS__
#pragma options align=mac68k
diff --git a/compiler_and_linker/FrontEnd/Optimizer/IroVars.h b/compiler_and_linker/FrontEnd/Optimizer/IroVars.h
new file mode 100644
index 0000000..2af5b4d
--- /dev/null
+++ b/compiler_and_linker/FrontEnd/Optimizer/IroVars.h
@@ -0,0 +1,51 @@
+#ifndef COMPILER_IROVARS_H
+#define COMPILER_IROVARS_H
+
+#include "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/compiler_and_linker/unsorted/CCompiler.c b/compiler_and_linker/unsorted/CCompiler.c
index 1eb6cd0..ed57c25 100644
--- a/compiler_and_linker/unsorted/CCompiler.c
+++ b/compiler_and_linker/unsorted/CCompiler.c
@@ -4,7 +4,7 @@
#include "compiler/CompilerTools.h"
#include "compiler/CodeGen.h"
#include "compiler/CodeGenOptPPC.h"
-#include "compiler/IrOptimizer.h"
+#include "../FrontEnd/Optimizer/IrOptimizer.h"
#include "compiler/types.h"
#include "pref_structs.h"
diff --git a/compiler_and_linker/unsorted/uDump.c b/compiler_and_linker/unsorted/DumpIR.c
index 89574a5..5f6eea4 100644
--- a/compiler_and_linker/unsorted/uDump.c
+++ b/compiler_and_linker/unsorted/DumpIR.c
@@ -1,4 +1,4 @@
-#include "compiler/uDump.h"
+#include "compiler/DumpIR.h"
#include "compiler/CFunc.h"
#include "compiler/CInt64.h"
#include "compiler/CMachine.h"
diff --git a/compiler_and_linker/unsorted/ObjGenMachO.c b/compiler_and_linker/unsorted/ObjGenMachO.c
index 072824a..f6f6216 100644
--- a/compiler_and_linker/unsorted/ObjGenMachO.c
+++ b/compiler_and_linker/unsorted/ObjGenMachO.c
@@ -7,9 +7,9 @@
#include "compiler/CParser.h"
#include "compiler/CodeGen.h"
#include "compiler/CompilerTools.h"
-#include "compiler/uDump.h"
+#include "compiler/DumpIR.h"
#include "compiler/GenStabs.h"
-#include "compiler/IrOptimizer.h"
+#include "../FrontEnd/Optimizer/IrOptimizer.h"
#include "compiler/MachO.h"
#include "compiler/PCodeListing.h"
#include "compiler/TOC.h"