mirror of https://git.wuffs.org/MWCC
add a bunch of code and a ton of stub files for later
This commit is contained in:
parent
9a46dd0e2e
commit
9d2728a560
240
CMakeLists.txt
240
CMakeLists.txt
|
@ -8,85 +8,205 @@ include_directories(includes)
|
||||||
include_directories(sdk_hdrs)
|
include_directories(sdk_hdrs)
|
||||||
|
|
||||||
add_executable(mwcc
|
add_executable(mwcc
|
||||||
command_line/CmdLine/Src/Callbacks/CLCompilerLinkerDropin_V10.cpp
|
|
||||||
command_line/CmdLine/Src/Callbacks/CLDropinCallbacks_V10.cpp
|
|
||||||
command_line/CmdLine/Src/Callbacks/CLParserCallbacks_v1.cpp
|
|
||||||
command_line/CmdLine/Src/Clients/ClientGlue.c
|
|
||||||
command_line/CmdLine/Src/Clients/CLStaticMain.c
|
command_line/CmdLine/Src/Clients/CLStaticMain.c
|
||||||
command_line/CmdLine/Src/Envir/CLErrors.c
|
command_line/CmdLine/Src/Clients/ClientGlue.c
|
||||||
command_line/CmdLine/Src/Envir/CLIO.c
|
command_line/CmdLine/Src/CLMain.c
|
||||||
command_line/CmdLine/Src/MacEmul/ErrMgr.c
|
|
||||||
command_line/CmdLine/Src/MacEmul/Files.c
|
|
||||||
command_line/CmdLine/Src/MacEmul/LowMem.c
|
|
||||||
command_line/CmdLine/Src/MacEmul/Memory.c
|
|
||||||
command_line/CmdLine/Src/MacEmul/Resources.c
|
command_line/CmdLine/Src/MacEmul/Resources.c
|
||||||
|
command_line/CmdLine/Src/Envir/CLErrors.c
|
||||||
command_line/CmdLine/Src/MacEmul/ResourceStrings.c
|
command_line/CmdLine/Src/MacEmul/ResourceStrings.c
|
||||||
command_line/CmdLine/Src/MacEmul/TextUtils.c
|
command_line/CmdLine/Src/Plugins/CLPlugins.c
|
||||||
command_line/CmdLine/Src/OSLib/FileHandles.c
|
command_line/CmdLine/Src/Callbacks/CLParserCallbacks_v1.cpp
|
||||||
command_line/CmdLine/Src/OSLib/Generic.c
|
command_line/CmdLine/Src/Envir/CLIO.c
|
||||||
command_line/CmdLine/Src/OSLib/MacFileTypes.c
|
command_line/CmdLine/Src/CLToolExec.c
|
||||||
command_line/CmdLine/Src/OSLib/MacSpecs.c
|
|
||||||
command_line/CmdLine/Src/OSLib/MemUtils.c
|
|
||||||
command_line/CmdLine/Src/OSLib/Posix.c
|
command_line/CmdLine/Src/OSLib/Posix.c
|
||||||
command_line/CmdLine/Src/OSLib/StringExtras.c
|
command_line/CmdLine/Src/OSLib/StringExtras.c
|
||||||
command_line/CmdLine/Src/OSLib/StringUtils.c
|
command_line/CmdLine/Src/OSLib/Generic.c
|
||||||
command_line/CmdLine/Src/Plugins/CLPlugins.c
|
|
||||||
command_line/CmdLine/Src/Project/CLAccessPaths.c
|
|
||||||
command_line/CmdLine/Src/Project/CLFiles.c
|
|
||||||
command_line/CmdLine/Src/Project/CLOverlays.c
|
|
||||||
command_line/CmdLine/Src/Project/CLProj.c
|
command_line/CmdLine/Src/Project/CLProj.c
|
||||||
command_line/CmdLine/Src/Project/CLSegs.c
|
|
||||||
command_line/CmdLine/Src/CLBrowser.c
|
|
||||||
command_line/CmdLine/Src/CLDependencies.c
|
|
||||||
command_line/CmdLine/Src/CLFileOps.c
|
|
||||||
command_line/CmdLine/Src/CLIncludeFileCache.c
|
|
||||||
command_line/CmdLine/Src/CLLicenses.c
|
command_line/CmdLine/Src/CLLicenses.c
|
||||||
command_line/CmdLine/Src/CLLoadAndCache.c
|
command_line/CmdLine/Src/OSLib/MemUtils.c
|
||||||
command_line/CmdLine/Src/CLMain.c
|
command_line/CmdLine/Src/CLPluginRequests.cpp
|
||||||
|
command_line/CmdLine/Src/MacEmul/LowMem.c
|
||||||
|
command_line/CmdLine/Src/CLFileOps.c
|
||||||
command_line/CmdLine/Src/CLPrefs.c
|
command_line/CmdLine/Src/CLPrefs.c
|
||||||
command_line/CmdLine/Src/CLTarg.c
|
command_line/CmdLine/Src/CLTarg.c
|
||||||
command_line/CmdLine/Src/CLToolExec.c
|
command_line/CmdLine/Src/Project/CLAccessPaths.c
|
||||||
|
command_line/CmdLine/Src/OSLib/MacSpecs.c
|
||||||
|
command_line/CmdLine/Src/OSLib/StringUtils.c
|
||||||
|
command_line/CmdLine/Src/MacEmul/Memory.c
|
||||||
|
command_line/CmdLine/Src/MacEmul/Files.c
|
||||||
|
command_line/CmdLine/Src/MacEmul/TextUtils.c
|
||||||
|
command_line/CmdLine/Src/uFileTypeMappings.c
|
||||||
|
command_line/CmdLine/Src/Project/CLFiles.c
|
||||||
|
command_line/CmdLine/Src/Project/CLOverlays.c
|
||||||
|
command_line/CmdLine/Src/Project/CLSegs.c
|
||||||
|
command_line/CmdLine/Src/Callbacks/CLDropinCallbacks_V10.cpp
|
||||||
|
command_line/CmdLine/Src/OSLib/MacFileTypes.c
|
||||||
|
command_line/CmdLine/Src/OSLib/FileHandles.c
|
||||||
|
command_line/CmdLine/Src/Callbacks/CLCompilerLinkerDropin_V10.cpp
|
||||||
|
command_line/CmdLine/Src/CLDependencies.c
|
||||||
command_line/CmdLine/Src/CLWriteObjectFile.c
|
command_line/CmdLine/Src/CLWriteObjectFile.c
|
||||||
unsorted/ParserFace.c
|
command_line/CmdLine/Src/CLBrowser.c
|
||||||
unsorted/uContext1.cpp
|
command_line/CmdLine/Src/CLIncludeFileCache.c
|
||||||
unsorted/uContextCL.cpp
|
command_line/CmdLine/Src/CLLoadAndCache.c
|
||||||
unsorted/uContextParser.cpp
|
command_line/CmdLine/Src/MacEmul/ErrMgr.c
|
||||||
unsorted/uContextSecret.cpp
|
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Static/cc-mach-ppc-mw.c
|
||||||
|
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c
|
||||||
|
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/cc-mach-ppc.c
|
||||||
|
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c
|
||||||
|
unsorted/TargetOptimizer-ppc-mach.c
|
||||||
|
unsorted/OptimizerHelpers.c
|
||||||
|
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetWarningHelpers-ppc-cc.c
|
||||||
|
command_line/C++_Parser/Src/Library/WarningHelpers.c
|
||||||
|
|
||||||
|
compiler_and_linker/unsorted/CCompiler.c
|
||||||
|
compiler_and_linker/unsorted/CParser.c
|
||||||
|
compiler_and_linker/FrontEnd/Common/CompilerTools.c
|
||||||
|
compiler_and_linker/unsorted/CodeGenOptPPC.c
|
||||||
|
compiler_and_linker/unsorted/IrOptimizer.c
|
||||||
|
compiler_and_linker/unsorted/CodeGen.c
|
||||||
|
compiler_and_linker/FrontEnd/C/CPrep.c
|
||||||
|
compiler_and_linker/FrontEnd/C/CScope.c
|
||||||
|
compiler_and_linker/unsorted/CMachine.c
|
||||||
|
compiler_and_linker/unsorted/CExpr.c
|
||||||
|
compiler_and_linker/unsorted/CFunc.c
|
||||||
|
compiler_and_linker/unsorted/CTemplateNew.c
|
||||||
|
compiler_and_linker/unsorted/CError.c
|
||||||
|
compiler_and_linker/unsorted/ObjGenMachO.c
|
||||||
|
compiler_and_linker/unsorted/CDecl.c
|
||||||
|
compiler_and_linker/unsorted/CMangler.c
|
||||||
|
compiler_and_linker/unsorted/CSOM.c
|
||||||
|
compiler_and_linker/unsorted/CABI.c
|
||||||
|
compiler_and_linker/unsorted/CInit.c
|
||||||
|
compiler_and_linker/unsorted/CClass.c
|
||||||
|
compiler_and_linker/unsorted/CIRTransform.c
|
||||||
|
compiler_and_linker/unsorted/CObjC.c
|
||||||
|
compiler_and_linker/unsorted/CInline.c
|
||||||
|
compiler_and_linker/FrontEnd/C/CPrepTokenizer.c
|
||||||
|
compiler_and_linker/unsorted/CTemplateTools.c
|
||||||
|
compiler_and_linker/unsorted/IroPointerAnalysis.c
|
||||||
|
compiler_and_linker/unsorted/InstrSelection.c
|
||||||
|
compiler_and_linker/unsorted/IroFlowgraph.c
|
||||||
|
compiler_and_linker/unsorted/IroLinearForm.c
|
||||||
|
compiler_and_linker/unsorted/IroUtil.c
|
||||||
|
compiler_and_linker/unsorted/IroCSE.c
|
||||||
|
compiler_and_linker/unsorted/IroPropagate.c
|
||||||
|
compiler_and_linker/unsorted/IROUseDef.c
|
||||||
|
compiler_and_linker/unsorted/InlineAsmPPC.c
|
||||||
|
compiler_and_linker/unsorted/IroDump.c
|
||||||
|
compiler_and_linker/unsorted/IroTransform.c
|
||||||
|
compiler_and_linker/unsorted/IroVars.c
|
||||||
|
compiler_and_linker/unsorted/IroEval.c
|
||||||
|
compiler_and_linker/unsorted/IroJump.c
|
||||||
|
compiler_and_linker/unsorted/IroRangePropagation.c
|
||||||
|
compiler_and_linker/unsorted/IroEmptyLoop.c
|
||||||
|
compiler_and_linker/unsorted/IroUnrollLoop.c
|
||||||
|
compiler_and_linker/unsorted/IroLoop.c
|
||||||
|
compiler_and_linker/unsorted/IroExprRegeneration.c
|
||||||
|
compiler_and_linker/unsorted/IroSubable.c
|
||||||
|
compiler_and_linker/unsorted/RegisterInfo.c
|
||||||
|
compiler_and_linker/unsorted/TOC.c
|
||||||
|
compiler_and_linker/unsorted/StackFrame.c
|
||||||
|
compiler_and_linker/unsorted/Registers.c
|
||||||
|
compiler_and_linker/unsorted/PCode.c
|
||||||
|
compiler_and_linker/unsorted/Switch.c
|
||||||
|
compiler_and_linker/unsorted/ValueNumbering.c
|
||||||
|
compiler_and_linker/unsorted/PCodeUtilities.c
|
||||||
|
compiler_and_linker/unsorted/Operands.c
|
||||||
|
compiler_and_linker/unsorted/Exceptions.c
|
||||||
|
|
||||||
|
compiler_and_linker/unsorted/COptimizer.c
|
||||||
|
compiler_and_linker/unsorted/GlobalOptimizer.c
|
||||||
|
compiler_and_linker/unsorted/PCodeListing.c
|
||||||
|
compiler_and_linker/unsorted/Peephole.c
|
||||||
|
compiler_and_linker/unsorted/Scheduler.c
|
||||||
|
compiler_and_linker/unsorted/Coloring.c
|
||||||
|
compiler_and_linker/unsorted/PCodeAssembly.c
|
||||||
|
compiler_and_linker/unsorted/Intrinsics.c
|
||||||
|
compiler_and_linker/unsorted/PPCError.c
|
||||||
|
compiler_and_linker/unsorted/CExpr2.c
|
||||||
|
compiler_and_linker/unsorted/CInt64.c
|
||||||
|
compiler_and_linker/unsorted/CPrec.c
|
||||||
|
compiler_and_linker/unsorted/CBrowse.c
|
||||||
|
compiler_and_linker/unsorted/CPreprocess.c
|
||||||
|
compiler_and_linker/unsorted/FuncLevelAsmPPC.c
|
||||||
|
compiler_and_linker/unsorted/CException.c
|
||||||
|
compiler_and_linker/unsorted/CTemplateClass.c
|
||||||
|
|
||||||
|
compiler_and_linker/unsorted/CRTTI.c
|
||||||
|
compiler_and_linker/unsorted/CObjCModern.c
|
||||||
|
compiler_and_linker/unsorted/InlineAsm.c
|
||||||
|
compiler_and_linker/unsorted/Unmangle.c
|
||||||
|
compiler_and_linker/unsorted/MachO.c
|
||||||
|
compiler_and_linker/unsorted/GenStabs.c
|
||||||
|
compiler_and_linker/unsorted/CTemplateFunc.c
|
||||||
|
compiler_and_linker/unsorted/IroMalloc.c
|
||||||
|
compiler_and_linker/unsorted/PCodeInfo.c
|
||||||
|
compiler_and_linker/unsorted/StructMoves.c
|
||||||
|
compiler_and_linker/unsorted/FunctionCalls.c
|
||||||
|
compiler_and_linker/unsorted/IroBitVect.c
|
||||||
|
compiler_and_linker/unsorted/InlineAsmRegistersPPC.c
|
||||||
|
compiler_and_linker/unsorted/InlineAsmMnemonicsPPC.c
|
||||||
|
compiler_and_linker/unsorted/InlineAsmRegisters.c
|
||||||
|
compiler_and_linker/unsorted/Alias.c
|
||||||
|
compiler_and_linker/unsorted/LoopDetection.c
|
||||||
|
compiler_and_linker/unsorted/CopyPropagation.c
|
||||||
|
compiler_and_linker/unsorted/CodeMotion.c
|
||||||
|
compiler_and_linker/unsorted/StrengthReduction.c
|
||||||
|
compiler_and_linker/unsorted/LoopOptimization.c
|
||||||
|
compiler_and_linker/unsorted/ConstantPropagation.c
|
||||||
|
compiler_and_linker/unsorted/AddPropagation.c
|
||||||
|
compiler_and_linker/unsorted/UseDefChains.c
|
||||||
|
compiler_and_linker/unsorted/LoadDeletion.c
|
||||||
|
compiler_and_linker/unsorted/VectorArraysToRegs.c
|
||||||
|
|
||||||
|
compiler_and_linker/unsorted/InterferenceGraph.c
|
||||||
|
compiler_and_linker/unsorted/SpillCode.c
|
||||||
|
compiler_and_linker/unsorted/GCCInlineAsm.c
|
||||||
|
compiler_and_linker/unsorted/BitVectors.c
|
||||||
|
|
||||||
unsorted/StaticParserGlue.c
|
unsorted/StaticParserGlue.c
|
||||||
|
unsorted/ParserFace.c
|
||||||
unsorted/ParserHelpers.c
|
unsorted/ParserHelpers.c
|
||||||
unsorted/ToolHelpers.c
|
unsorted/ToolHelpers.c
|
||||||
unsorted/ParserHelpers-cc.c
|
unsorted/ParserHelpers-cc.c
|
||||||
|
unsorted/Arguments.c
|
||||||
unsorted/ToolHelpers-cc.c
|
unsorted/ToolHelpers-cc.c
|
||||||
unsorted/IO.c
|
unsorted/IO.c
|
||||||
unsorted/Projects.c
|
unsorted/Projects.c
|
||||||
unsorted/Targets.c
|
unsorted/Targets.c
|
||||||
|
unsorted/Option.c
|
||||||
unsorted/ParserErrors.c
|
unsorted/ParserErrors.c
|
||||||
unsorted/Utils.c
|
unsorted/Utils.c
|
||||||
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Static/cc-mach-ppc-mw.c
|
|
||||||
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/cc-mach-ppc.c
|
|
||||||
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c
|
|
||||||
command_line/C++_Parser/Src/Library/WarningHelpers.c
|
|
||||||
unsorted/uLibImporter.c
|
|
||||||
command_line/CmdLine/Src/CLPluginRequests.cpp
|
|
||||||
unsorted/uCOS.c
|
|
||||||
command_line/CmdLine/Src/uFileTypeMappings.c
|
|
||||||
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c
|
|
||||||
unsorted/Arguments.c
|
|
||||||
unsorted/Help.c
|
|
||||||
unsorted/Option.c
|
|
||||||
unsorted/Parameter.c
|
unsorted/Parameter.c
|
||||||
unsorted/TargetOptimizer-ppc-mach.c
|
unsorted/Help.c
|
||||||
unsorted/OptimizerHelpers.c
|
unsorted/uContext1.cpp
|
||||||
compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetWarningHelpers-ppc-cc.c
|
unsorted/uContextCL.cpp
|
||||||
compiler_and_linker/unsorted/CCompiler.c
|
unsorted/uContextSecret.cpp
|
||||||
|
unsorted/uCOS.c
|
||||||
|
unsorted/uContextParser.cpp
|
||||||
|
unsorted/uLibImporter.c
|
||||||
unsorted/CmdLineBuildDate.c
|
unsorted/CmdLineBuildDate.c
|
||||||
compiler_and_linker/FrontEnd/C/CScope.c
|
|
||||||
compiler_and_linker/unsorted/CPrec.c
|
includes/compiler/RegisterInfo.h
|
||||||
compiler_and_linker/unsorted/CError.c
|
includes/compiler/Registers.h
|
||||||
compiler_and_linker/unsorted/CInt64.c
|
includes/compiler/InstrSelection.h
|
||||||
compiler_and_linker/unsorted/CMachine.c
|
includes/compiler/CCompiler.h
|
||||||
compiler_and_linker/FrontEnd/C/CPrepTokenizer.c
|
includes/compiler/CABI.h
|
||||||
compiler_and_linker/FrontEnd/C/CPrep.c
|
includes/compiler/CMachine.h
|
||||||
compiler_and_linker/unsorted/PCode.c
|
includes/compiler/CMangler.h
|
||||||
compiler_and_linker/unsorted/PCodeInfo.c
|
includes/compiler/CScope.h
|
||||||
compiler_and_linker/unsorted/RegisterInfo.c compiler_and_linker/unsorted/Registers.c compiler_and_linker/unsorted/CMangler.c compiler_and_linker/unsorted/CodeGen.c includes/compiler/Operands.h compiler_and_linker/unsorted/Operands.c includes/compiler/PCodeUtilities.h compiler_and_linker/unsorted/PCodeUtilities.c compiler_and_linker/unsorted/TOC.c compiler_and_linker/unsorted/StackFrame.c includes/compiler/StackFrame.h includes/compiler/TOC.h includes/compiler/CInit.h compiler_and_linker/unsorted/CInit.c compiler_and_linker/unsorted/CExpr.c includes/compiler/CExpr.h compiler_and_linker/unsorted/CExpr2.c includes/compiler/CParser.h compiler_and_linker/unsorted/CParser.c compiler_and_linker/unsorted/CDecl.c includes/compiler/CDecl.h compiler_and_linker/unsorted/CABI.c includes/compiler/CABI.h includes/compiler/CMachine.h includes/compiler/CMangler.h includes/compiler/CScope.h includes/compiler/CPrep.h includes/compiler/CPrepTokenizer.h includes/compiler/CodeGen.h includes/compiler/CClass.h compiler_and_linker/unsorted/CClass.c compiler_and_linker/unsorted/CFunc.c includes/compiler/CFunc.h includes/compiler/CInline.h compiler_and_linker/unsorted/CInline.c)
|
includes/compiler/CPrep.h
|
||||||
|
includes/compiler/CPrepTokenizer.h
|
||||||
|
includes/compiler/CodeGen.h
|
||||||
|
includes/compiler/CClass.h
|
||||||
|
includes/compiler/CFunc.h
|
||||||
|
includes/compiler/CInline.h
|
||||||
|
includes/compiler/Operands.h
|
||||||
|
includes/compiler/PCodeUtilities.h
|
||||||
|
includes/compiler/StackFrame.h
|
||||||
|
includes/compiler/TOC.h
|
||||||
|
includes/compiler/CInit.h
|
||||||
|
includes/compiler/CExpr.h
|
||||||
|
includes/compiler/CParser.h
|
||||||
|
includes/compiler/CDecl.h
|
||||||
|
)
|
||||||
|
|
|
@ -46,15 +46,6 @@ static void gotonexttoken();
|
||||||
extern SInt16 *CLT_filesp;
|
extern SInt16 *CLT_filesp;
|
||||||
extern CPrepFileInfo **CLT_filestack;
|
extern CPrepFileInfo **CLT_filestack;
|
||||||
|
|
||||||
//#define OPT_OFFSET(optname) ((short) (((char *) (&copts.optname)) - ((char *) &copts)))
|
|
||||||
#define OPT_OFFSET(optname) ((short) ( &((COpts *)0)->optname ))
|
|
||||||
enum {
|
|
||||||
OPT_OFFSET_MASK = 0x1FFF,
|
|
||||||
OPT_FLAG_2000 = 0x2000,
|
|
||||||
OPT_FLAG_4000 = 0x4000,
|
|
||||||
OPT_FLAG_8000 = 0x8000
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CompilerOption {
|
struct CompilerOption {
|
||||||
char *name;
|
char *name;
|
||||||
short bits;
|
short bits;
|
||||||
|
|
|
@ -9,7 +9,7 @@ static void *cabi_pathcur; // TODO type
|
||||||
static TypeClass *cabi_loop_class;
|
static TypeClass *cabi_loop_class;
|
||||||
static Boolean cabi_loop_construct;
|
static Boolean cabi_loop_construct;
|
||||||
|
|
||||||
short CABI_GetStructResultArgumentIndex(void) {
|
short CABI_GetStructResultArgumentIndex(TypeFunc *tfunc) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
#include "compiler/CClass.h"
|
#include "compiler/CClass.h"
|
||||||
|
#include "compiler/CError.h"
|
||||||
|
#include "compiler/CInline.h"
|
||||||
|
#include "compiler/CMangler.h"
|
||||||
|
#include "compiler/CParser.h"
|
||||||
|
#include "compiler/CompilerTools.h"
|
||||||
|
#include "compiler/CodeGen.h"
|
||||||
|
#include "compiler/objects.h"
|
||||||
|
|
||||||
typedef struct OVClassBase {
|
typedef struct OVClassBase {
|
||||||
struct OVClassBase *next;
|
struct OVClassBase *next;
|
||||||
|
@ -23,8 +30,17 @@ typedef struct OVClass {
|
||||||
Boolean alloced_vtable;
|
Boolean alloced_vtable;
|
||||||
} OVClass;
|
} OVClass;
|
||||||
|
|
||||||
|
typedef struct ThunkList {
|
||||||
|
struct ThunkList *next;
|
||||||
|
Object *thunkobj;
|
||||||
|
Object *obj;
|
||||||
|
SInt32 a;
|
||||||
|
SInt32 b;
|
||||||
|
SInt32 c;
|
||||||
|
} ThunkList;
|
||||||
|
|
||||||
static TypeClass *main_class;
|
static TypeClass *main_class;
|
||||||
static void *cclass_thunklist; // TODO type
|
static ThunkList *cclass_thunklist;
|
||||||
static TypeClass *cclass_isbase_mostderived;
|
static TypeClass *cclass_isbase_mostderived;
|
||||||
static void *cclass_isbase_foundoffset; // TODO type
|
static void *cclass_isbase_foundoffset; // TODO type
|
||||||
static Boolean cclass_isambigbase;
|
static Boolean cclass_isambigbase;
|
||||||
|
@ -45,8 +61,45 @@ static SInt32 cclass_dominator_ooffset;
|
||||||
static Object *cclass_dominator_eobject;
|
static Object *cclass_dominator_eobject;
|
||||||
|
|
||||||
void CClass_Init(void) {}
|
void CClass_Init(void) {}
|
||||||
void CClass_GenThunks(void) {}
|
|
||||||
static Object *CClass_ThunkObject(Object *obj, SInt32 a, SInt32 b, SInt32 c) {}
|
void CClass_GenThunks(void) {
|
||||||
|
ThunkList *list;
|
||||||
|
|
||||||
|
for (list = cclass_thunklist; list; list = list->next) {
|
||||||
|
list->obj->flags |= OBJECT_FLAGS_4;
|
||||||
|
CodeGen_GenVDispatchThunk(list->thunkobj, list->obj, list->a, list->b, list->c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Object *CClass_ThunkObject(Object *obj, SInt32 a, SInt32 b, SInt32 c) {
|
||||||
|
Object *thunkobj;
|
||||||
|
ThunkList *list;
|
||||||
|
|
||||||
|
CInline_ObjectAddrRef(obj);
|
||||||
|
for (list = cclass_thunklist; list; list = list->next) {
|
||||||
|
if (obj == list->obj && a == list->a && b == list->b && c == list->c)
|
||||||
|
return list->thunkobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
thunkobj = CParser_NewCompilerDefFunctionObject();
|
||||||
|
thunkobj->name = CMangler_ThunkName(obj, a, b, c);
|
||||||
|
thunkobj->type = TYPE(&rt_func);
|
||||||
|
thunkobj->sclass = TK_EXTERN;
|
||||||
|
thunkobj->qual = Q_20000;
|
||||||
|
thunkobj->u.func.linkname = thunkobj->name;
|
||||||
|
|
||||||
|
list = galloc(sizeof(ThunkList));
|
||||||
|
list->thunkobj = thunkobj;
|
||||||
|
list->obj = obj;
|
||||||
|
list->a = a;
|
||||||
|
list->b = b;
|
||||||
|
list->c = c;
|
||||||
|
list->next = cclass_thunklist;
|
||||||
|
cclass_thunklist = list;
|
||||||
|
|
||||||
|
return thunkobj;
|
||||||
|
}
|
||||||
|
|
||||||
static Boolean CClass_IsZeroOffsetClass(TypeClass *a, TypeClass *b) {}
|
static Boolean CClass_IsZeroOffsetClass(TypeClass *a, TypeClass *b) {}
|
||||||
static UInt8 CClass_IsCovariantResult(Type *a, UInt32 qualA, Type *b, UInt32 qualB) {}
|
static UInt8 CClass_IsCovariantResult(Type *a, UInt32 qualA, Type *b, UInt32 qualB) {}
|
||||||
UInt8 CClass_GetOverrideKind(TypeFunc *a, TypeFunc *b, Boolean errorflag) {}
|
UInt8 CClass_GetOverrideKind(TypeFunc *a, TypeFunc *b, Boolean errorflag) {}
|
||||||
|
@ -58,7 +111,7 @@ ENode *CClass_DefaultConstructorCall(TypeClass *a, TypeClass *b, ENode *expr, SI
|
||||||
Object *CClass_AssignmentOperator(TypeClass *tclass) {}
|
Object *CClass_AssignmentOperator(TypeClass *tclass) {}
|
||||||
Object *CClass_CopyConstructor(TypeClass *tclass) {}
|
Object *CClass_CopyConstructor(TypeClass *tclass) {}
|
||||||
NameSpaceObjectList *CClass_MemberObject(TypeClass *tclass, HashNameNode *name) {}
|
NameSpaceObjectList *CClass_MemberObject(TypeClass *tclass, HashNameNode *name) {}
|
||||||
Object *CClass_Constructor(TypeClass *tclass) {}
|
NameSpaceObjectList *CClass_Constructor(TypeClass *tclass) {}
|
||||||
Object *CClass_Destructor(TypeClass *tclass) {}
|
Object *CClass_Destructor(TypeClass *tclass) {}
|
||||||
Boolean CClass_IsConstructor(Object *obj) {}
|
Boolean CClass_IsConstructor(Object *obj) {}
|
||||||
Boolean CClass_IsDestructor(Object *obj) {}
|
Boolean CClass_IsDestructor(Object *obj) {}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#include "compiler/common.h"
|
#include "compiler/CCompiler.h"
|
||||||
#include "compiler.h"
|
#include "compiler/CParser.h"
|
||||||
|
#include "compiler/CPrep.h"
|
||||||
|
#include "compiler/CompilerTools.h"
|
||||||
|
#include "compiler/CodeGen.h"
|
||||||
#include "compiler/types.h"
|
#include "compiler/types.h"
|
||||||
#include "pref_structs.h"
|
#include "pref_structs.h"
|
||||||
#include "compiler/CompilerTools.h"
|
|
||||||
#include "compiler/CPrep.h"
|
|
||||||
|
|
||||||
Boolean systemHandles;
|
Boolean systemHandles;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -84,7 +84,7 @@ static void CInline_ForceReverseSearch(ENode *) {}
|
||||||
static ENode *CInline_ForceReverseEvaluation(ENode *expr) {}
|
static ENode *CInline_ForceReverseEvaluation(ENode *expr) {}
|
||||||
static void CInline_ExportCheck(ENode *expr) {}
|
static void CInline_ExportCheck(ENode *expr) {}
|
||||||
static void CInline_Expand(Statement *stmt) {}
|
static void CInline_Expand(Statement *stmt) {}
|
||||||
SInt32 CInline_GetStatementNumber(Statement *first, Statement *stmt) {}
|
SInt16 CInline_GetStatementNumber(Statement *first, Statement *stmt) {}
|
||||||
static CI_Switch *CInline_PackSwitch(Statement *s1, Statement *s2) {}
|
static CI_Switch *CInline_PackSwitch(Statement *s1, Statement *s2) {}
|
||||||
static Boolean CInline_CanInline(Object *obj, Statement *stmt) {}
|
static Boolean CInline_CanInline(Object *obj, Statement *stmt) {}
|
||||||
static ExceptionAction *CInline_PackActions(Statement *s1, Statement *s2) {}
|
static ExceptionAction *CInline_PackActions(Statement *s1, Statement *s2) {}
|
||||||
|
|
|
@ -1337,7 +1337,7 @@ Boolean CMach_PassResultInHiddenArg(Type *type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *CMach_GetCPU() {
|
char *CMach_GetCPU() {
|
||||||
switch (copts.cpu) {
|
switch (copts.cpu) {
|
||||||
case CPU_PPC401: return "__PPC401__";
|
case CPU_PPC401: return "__PPC401__";
|
||||||
case CPU_PPC403: return "__PPC403__";
|
case CPU_PPC403: return "__PPC403__";
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,17 @@
|
||||||
|
#include "compiler/CodeGenOptPPC.h"
|
||||||
|
#include "compiler/InstrSelection.h"
|
||||||
|
|
||||||
|
void CodeGen_InitCompiler(void) {
|
||||||
|
init_cgdispatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeGen_TermCompiler(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeGen_InitBackEndOptions(void) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void Test_Version_Numbers(void) {
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#include "compiler/FuncLevelAsmPPC.h"
|
||||||
|
|
||||||
|
void setup_assembly_argument(Object *obj, short i) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void assign_local_addresses() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FuncAsm_PreScanDirectives() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FuncAsm_AddEntryPoint() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Assembler() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupAssembler() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CleanupAssembler() {
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
#include "compiler/GCCInlineAsm.h"
|
||||||
|
|
||||||
|
Statement *first_ST_ASM;
|
||||||
|
|
||||||
|
void InlineAsm_SkipComment() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gcc_parse_attribute() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gcc_parse_name() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gcc_parse_expression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gcc_parse_input() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gcc_parse_output() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gcc_parse_killed() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gcc_replace_arg_st_asm() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gcc_replace_arg() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_gcc_parse(void) {
|
||||||
|
}
|
|
@ -0,0 +1,681 @@
|
||||||
|
#include "compiler/InlineAsm.h"
|
||||||
|
#include "compiler/InlineAsmPPC.h"
|
||||||
|
#include "compiler/GCCInlineAsm.h"
|
||||||
|
#include "compiler/CompilerTools.h"
|
||||||
|
#include "compiler/CError.h"
|
||||||
|
#include "compiler/CExpr.h"
|
||||||
|
#include "compiler/CFunc.h"
|
||||||
|
#include "compiler/CInit.h"
|
||||||
|
#include "compiler/CInline.h"
|
||||||
|
#include "compiler/CInt64.h"
|
||||||
|
#include "compiler/CMachine.h"
|
||||||
|
#include "compiler/COptimizer.h"
|
||||||
|
#include "compiler/CParser.h"
|
||||||
|
#include "compiler/CPrep.h"
|
||||||
|
#include "compiler/CPrepTokenizer.h"
|
||||||
|
#include "compiler/CScope.h"
|
||||||
|
#include "compiler/PCode.h"
|
||||||
|
#include "compiler/Registers.h"
|
||||||
|
#include "compiler/objects.h"
|
||||||
|
#include "compiler/scopes.h"
|
||||||
|
#include "compiler/types.h"
|
||||||
|
|
||||||
|
int allow_array_expressions = 1;
|
||||||
|
|
||||||
|
int backtracking;
|
||||||
|
jmp_buf backtrack;
|
||||||
|
jmp_buf InlineAsm_assemblererror;
|
||||||
|
static int ASMstmtnb;
|
||||||
|
|
||||||
|
void AssemblerError(void) {
|
||||||
|
longjmp(InlineAsm_assemblererror, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_SyntaxError(short code) {
|
||||||
|
if (backtracking)
|
||||||
|
longjmp(backtrack, 1);
|
||||||
|
|
||||||
|
if (tk == TK_NEG7 || tk == ';')
|
||||||
|
code = CErrorStr112;
|
||||||
|
CError_Error(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
CLabel *InlineAsm_LookupLabel(HashNameNode *name) {
|
||||||
|
CLabel *label;
|
||||||
|
|
||||||
|
for (label = Labels; label; label = label->next) {
|
||||||
|
if (name == label->name)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLabel *InlineAsm_DeclareLabel(HashNameNode *name) {
|
||||||
|
CLabel *label = newlabel();
|
||||||
|
label->name = name;
|
||||||
|
label->next = Labels;
|
||||||
|
Labels = label;
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void InlineAsm_DefineLabel(HashNameNode *name) {
|
||||||
|
CLabel *label;
|
||||||
|
Statement *stmt;
|
||||||
|
|
||||||
|
label = InlineAsm_LookupLabel(name);
|
||||||
|
if (!label) {
|
||||||
|
label = InlineAsm_DeclareLabel(name);
|
||||||
|
} else {
|
||||||
|
if (label->stmt)
|
||||||
|
CError_Error(CErrorStr171, name->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
stmt = CFunc_AppendStatement(ST_LABEL);
|
||||||
|
stmt->label = label;
|
||||||
|
label->stmt = stmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean InlineAsm_LookupSymbolOrTag(HashNameNode *name, IALookupResult *result, Boolean allow_tag) {
|
||||||
|
ObjBase *obj;
|
||||||
|
NameSpace *nspace;
|
||||||
|
NameSpaceObjectList *list;
|
||||||
|
|
||||||
|
result->name = name;
|
||||||
|
result->object = NULL;
|
||||||
|
result->label = NULL;
|
||||||
|
result->type = NULL;
|
||||||
|
result->has_value = 0;
|
||||||
|
|
||||||
|
if ((result->label = InlineAsm_LookupLabel(name)))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
for (nspace = cscope_current; nspace; nspace = nspace->parent) {
|
||||||
|
if ((list = CScope_FindName(nspace, name))) {
|
||||||
|
obj = list->object;
|
||||||
|
switch (obj->otype) {
|
||||||
|
case OT_ENUMCONST:
|
||||||
|
result->has_value = 1;
|
||||||
|
result->value = OBJ_ENUM_CONST(list->object)->val.lo;
|
||||||
|
return 1;
|
||||||
|
case OT_OBJECT:
|
||||||
|
if (OBJECT(obj)->datatype == DABSOLUTE) {
|
||||||
|
result->has_value = 1;
|
||||||
|
result->value = OBJECT(obj)->u.address;
|
||||||
|
} else {
|
||||||
|
if (OBJECT(obj)->datatype == DDATA && (OBJECT(obj)->qual & Q_10000))
|
||||||
|
CInit_ExportConst(OBJECT(obj));
|
||||||
|
result->object = OBJECT(obj);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
case OT_TYPE:
|
||||||
|
result->type = OBJ_TYPE(obj)->type;
|
||||||
|
return 1;
|
||||||
|
case OT_TYPETAG:
|
||||||
|
if (allow_tag) {
|
||||||
|
result->type = OBJ_TYPE_TAG(obj)->type;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
case OT_NAMESPACE:
|
||||||
|
case OT_MEMBERVAR:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
#line 245
|
||||||
|
CError_FATAL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean InlineAsm_LookupSymbol(HashNameNode *name, IALookupResult *result) {
|
||||||
|
return InlineAsm_LookupSymbolOrTag(name, result, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ObjMemberVar *isclassmember(TypeClass *tclass, HashNameNode *name) {
|
||||||
|
NameSpaceObjectList *list;
|
||||||
|
|
||||||
|
list = CScope_FindName(tclass->nspace, name);
|
||||||
|
return (list && list->object->otype == OT_MEMBERVAR) ? OBJ_MEMBER_VAR(list->object) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SInt32 InlineAsm_StructMemberOffset(Type *type) {
|
||||||
|
StructMember *member;
|
||||||
|
ObjMemberVar *ivar;
|
||||||
|
SInt32 offset = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (IS_TYPE_STRUCT(type)) {
|
||||||
|
tk = lex();
|
||||||
|
if (tk != TK_IDENTIFIER)
|
||||||
|
InlineAsm_SyntaxError(CErrorStr107);
|
||||||
|
member = ismember(TYPE_STRUCT(type), tkidentifier);
|
||||||
|
if (!member)
|
||||||
|
CError_Error(CErrorStr150, tkidentifier->name);
|
||||||
|
offset += member->offset;
|
||||||
|
type = member->type;
|
||||||
|
tk = lex();
|
||||||
|
} else if (IS_TYPE_CLASS(type)) {
|
||||||
|
tk = lex();
|
||||||
|
if (tk != TK_IDENTIFIER)
|
||||||
|
InlineAsm_SyntaxError(CErrorStr107);
|
||||||
|
ivar = isclassmember(TYPE_CLASS(type), tkidentifier);
|
||||||
|
if (!ivar)
|
||||||
|
CError_Error(CErrorStr150, tkidentifier->name);
|
||||||
|
offset += ivar->offset;
|
||||||
|
type = ivar->type;
|
||||||
|
tk = lex();
|
||||||
|
} else {
|
||||||
|
CError_Error(CErrorStr149);
|
||||||
|
}
|
||||||
|
} while (tk == '.');
|
||||||
|
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
SInt32 InlineAsm_StructArrayMemberOffset(Type *type) {
|
||||||
|
StructMember *member;
|
||||||
|
ObjMemberVar *ivar;
|
||||||
|
SInt32 offset = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (tk == '.') {
|
||||||
|
if (IS_TYPE_STRUCT(type)) {
|
||||||
|
tk = lex();
|
||||||
|
if (tk != TK_IDENTIFIER)
|
||||||
|
InlineAsm_SyntaxError(CErrorStr107);
|
||||||
|
member = ismember(TYPE_STRUCT(type), tkidentifier);
|
||||||
|
if (!member)
|
||||||
|
CError_Error(CErrorStr150, tkidentifier->name);
|
||||||
|
offset += member->offset;
|
||||||
|
type = member->type;
|
||||||
|
tk = lex();
|
||||||
|
} else if (IS_TYPE_CLASS(type)) {
|
||||||
|
tk = lex();
|
||||||
|
if (tk != TK_IDENTIFIER)
|
||||||
|
InlineAsm_SyntaxError(CErrorStr107);
|
||||||
|
ivar = isclassmember(TYPE_CLASS(type), tkidentifier);
|
||||||
|
if (!ivar)
|
||||||
|
CError_Error(CErrorStr150, tkidentifier->name);
|
||||||
|
offset += ivar->offset;
|
||||||
|
type = ivar->type;
|
||||||
|
tk = lex();
|
||||||
|
} else {
|
||||||
|
CError_Error(CErrorStr149);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (IS_TYPE_ARRAY(type)) {
|
||||||
|
type = TPTR_TARGET(type);
|
||||||
|
tk = lex();
|
||||||
|
offset += type->size * InlineAsm_ConstantExpression();
|
||||||
|
if (tk != ']')
|
||||||
|
InlineAsm_SyntaxError(125);
|
||||||
|
tk = lex();
|
||||||
|
} else {
|
||||||
|
CError_Error(CErrorStr148);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (tk == '.' || tk == '[');
|
||||||
|
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
SInt32 InlineAsm_StructPointerMemberOffset(Type *type) {
|
||||||
|
StructMember *member;
|
||||||
|
ObjMemberVar *ivar;
|
||||||
|
SInt32 offset;
|
||||||
|
|
||||||
|
tk = lex();
|
||||||
|
if (tk != TK_IDENTIFIER)
|
||||||
|
InlineAsm_SyntaxError(107);
|
||||||
|
|
||||||
|
if (IS_TYPE_STRUCT(type)) {
|
||||||
|
member = ismember(TYPE_STRUCT(type), tkidentifier);
|
||||||
|
if (!member)
|
||||||
|
CError_Error(CErrorStr150, tkidentifier->name);
|
||||||
|
offset = member->offset;
|
||||||
|
type = member->type;
|
||||||
|
} else {
|
||||||
|
ivar = isclassmember(TYPE_CLASS(type), tkidentifier);
|
||||||
|
if (!ivar)
|
||||||
|
CError_Error(CErrorStr150, tkidentifier->name);
|
||||||
|
offset = ivar->offset;
|
||||||
|
type = ivar->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
tk = lex();
|
||||||
|
if (tk == '.' || tk == '[')
|
||||||
|
offset += InlineAsm_StructArrayMemberOffset(type);
|
||||||
|
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SInt32 DiadicOperator(SInt32 left, short op, SInt32 right) {
|
||||||
|
CInt64 left64;
|
||||||
|
CInt64 right64;
|
||||||
|
CInt64_SetLong(&left64, left);
|
||||||
|
CInt64_SetLong(&right64, right);
|
||||||
|
right64 = CMach_CalcIntDiadic(TYPE(&stsignedint), left64, op, right64);
|
||||||
|
return CInt64_GetULong(&right64);
|
||||||
|
}
|
||||||
|
|
||||||
|
static SInt32 PrimaryExpression(void) {
|
||||||
|
IALookupResult result;
|
||||||
|
SInt32 value;
|
||||||
|
|
||||||
|
switch (tk) {
|
||||||
|
case TK_IDENTIFIER:
|
||||||
|
if (InlineAsm_LookupSymbol(tkidentifier, &result)) {
|
||||||
|
if (result.has_value) {
|
||||||
|
tk = lex();
|
||||||
|
return result.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.type && (IS_TYPE_STRUCT(result.type) || IS_TYPE_CLASS(result.type))) {
|
||||||
|
tk = lex();
|
||||||
|
if (tk != '.')
|
||||||
|
InlineAsm_SyntaxError(120);
|
||||||
|
if (allow_array_expressions)
|
||||||
|
return InlineAsm_StructArrayMemberOffset(result.type);
|
||||||
|
else
|
||||||
|
return InlineAsm_StructMemberOffset(result.type);
|
||||||
|
} else {
|
||||||
|
InlineAsm_SyntaxError(124);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
InlineAsm_SyntaxError(124);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TK_INTCONST:
|
||||||
|
value = tkintconst.lo;
|
||||||
|
tk = lex();
|
||||||
|
return value;
|
||||||
|
case TK_SIZEOF:
|
||||||
|
return scansizeof();
|
||||||
|
case '+':
|
||||||
|
tk = lex();
|
||||||
|
return PrimaryExpression();
|
||||||
|
case '-':
|
||||||
|
tk = lex();
|
||||||
|
return -PrimaryExpression();
|
||||||
|
case '!':
|
||||||
|
tk = lex();
|
||||||
|
return PrimaryExpression() == 0;
|
||||||
|
case '~':
|
||||||
|
tk = lex();
|
||||||
|
return ~PrimaryExpression();
|
||||||
|
case '(':
|
||||||
|
tk = lex();
|
||||||
|
value = InlineAsm_ConstantExpression();
|
||||||
|
if (tk != ')')
|
||||||
|
InlineAsm_SyntaxError(115);
|
||||||
|
tk = lex();
|
||||||
|
return value;
|
||||||
|
default:
|
||||||
|
InlineAsm_SyntaxError(120);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SInt32 ConstantExpressionTail(SInt32 value) {
|
||||||
|
SInt32 right;
|
||||||
|
short left_token;
|
||||||
|
short right_prec;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
left_token = tk;
|
||||||
|
tk = lex();
|
||||||
|
right = PrimaryExpression();
|
||||||
|
|
||||||
|
right_prec = GetPrec(tk);
|
||||||
|
if (right_prec == 0)
|
||||||
|
return DiadicOperator(value, left_token, right);
|
||||||
|
|
||||||
|
if (GetPrec(left_token) >= right_prec) {
|
||||||
|
value = DiadicOperator(value, left_token, right);
|
||||||
|
} else {
|
||||||
|
value = DiadicOperator(value, left_token, ConstantExpressionTail(right));
|
||||||
|
if (GetPrec(tk) == 0)
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SInt32 InlineAsm_ConstantExpression(void) {
|
||||||
|
SInt32 value = PrimaryExpression();
|
||||||
|
|
||||||
|
if (GetPrec(tk) == 0)
|
||||||
|
return value;
|
||||||
|
else
|
||||||
|
return ConstantExpressionTail(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
HashNameNode *MakeLocalLabel(CInt64 num) {
|
||||||
|
char buf[80];
|
||||||
|
sprintf(buf, "@%i_%i", ASMstmtnb, CInt64_GetULong(&num));
|
||||||
|
return GetHashNameNodeExport(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ScanOptionalLabel() {
|
||||||
|
if (tk == TK_INTCONST) {
|
||||||
|
if (lookahead() == ':') {
|
||||||
|
InlineAsm_DefineLabel(MakeLocalLabel(tkintconst));
|
||||||
|
tk = lex();
|
||||||
|
tk = lex();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tkidentifier->name[0] == '@') {
|
||||||
|
InlineAsm_DefineLabel(tkidentifier);
|
||||||
|
tk = lex();
|
||||||
|
if (tk == ':')
|
||||||
|
tk = lex();
|
||||||
|
} else {
|
||||||
|
HashNameNode *name = tkidentifier;
|
||||||
|
short t = lookahead();
|
||||||
|
tkidentifier = name;
|
||||||
|
if (t == ':') {
|
||||||
|
InlineAsm_DefineLabel(name);
|
||||||
|
tk = lex();
|
||||||
|
tk = lex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ScanStatements(volatile short endToken, UInt8 mode) {
|
||||||
|
if (setjmp(InlineAsm_assemblererror)) {
|
||||||
|
while (tk != TK_NEG7 && tk != endToken && tk != '}' && tk)
|
||||||
|
tk = lex();
|
||||||
|
if (tk == ';' || tk == TK_NEG7)
|
||||||
|
tk = lex();
|
||||||
|
} else {
|
||||||
|
InlineAsm_Initialize(mode);
|
||||||
|
InlineAsm_gccmode = 0;
|
||||||
|
if (setjmp(InlineAsm_assemblererror)) {
|
||||||
|
while (tk != ';' && tk != TK_NEG7 && tk != endToken && tk != '}' && tk)
|
||||||
|
tk = lex();
|
||||||
|
if (tk == ';' || tk == TK_NEG7)
|
||||||
|
tk = lex();
|
||||||
|
}
|
||||||
|
|
||||||
|
while (tk && tk != endToken) {
|
||||||
|
backtracking = 0;
|
||||||
|
sourceoffset = CPrep_GetFileOffsetInfo(&cparser_fileoffset);
|
||||||
|
if (tk == '"') {
|
||||||
|
if (InlineAsm_gccmode) {
|
||||||
|
tk = lex();
|
||||||
|
InlineAsm_gcc_parse();
|
||||||
|
} else {
|
||||||
|
InlineAsm_gccmode = 1;
|
||||||
|
copts.cplusplus = 0;
|
||||||
|
copts.asmpoundcomment = 1;
|
||||||
|
tk = lex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tk == '.') {
|
||||||
|
InlineAsm_ScanAssemblyDirective();
|
||||||
|
} else if (tk == TK_IDENTIFIER) {
|
||||||
|
ScanOptionalLabel();
|
||||||
|
if (tk == TK_IDENTIFIER)
|
||||||
|
InlineAsm_ScanAssemblyInstruction();
|
||||||
|
} else if (tk == TK_INTCONST) {
|
||||||
|
ScanOptionalLabel();
|
||||||
|
if (tk == TK_IDENTIFIER)
|
||||||
|
InlineAsm_ScanAssemblyInstruction();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (InlineAsm_gccmode && tk == '"') {
|
||||||
|
tk = lex();
|
||||||
|
InlineAsm_gcc_parse();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tk == ';' || tk == TK_NEG7) {
|
||||||
|
CPrep_TokenStreamFlush();
|
||||||
|
tk = lex();
|
||||||
|
} else if (tk != endToken) {
|
||||||
|
if (endToken == ')')
|
||||||
|
CError_Error(CErrorStr115);
|
||||||
|
else
|
||||||
|
CError_Error(CErrorStr113);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_ScanStatements(volatile short endToken) {
|
||||||
|
ScanStatements(endToken, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_ScanFunction(volatile short endToken) {
|
||||||
|
ScanStatements(endToken, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_Assemble(void) {
|
||||||
|
short token = (tk == '(') ? ')' : '}';
|
||||||
|
char save_pc = copts.asmpoundcomment;
|
||||||
|
char save_cpp = copts.cplusplus;
|
||||||
|
|
||||||
|
cprep_nostring = 1;
|
||||||
|
CFunc_AppendStatement(ST_NOP);
|
||||||
|
first_ST_ASM = curstmt;
|
||||||
|
ASMstmtnb++;
|
||||||
|
|
||||||
|
cprep_eoltokens = 1;
|
||||||
|
in_assembler = 1;
|
||||||
|
tk = lex();
|
||||||
|
InlineAsm_ScanStatements(token);
|
||||||
|
in_assembler = 0;
|
||||||
|
cprep_eoltokens = 0;
|
||||||
|
cprep_nostring = 0;
|
||||||
|
|
||||||
|
copts.asmpoundcomment = save_pc;
|
||||||
|
copts.cplusplus = save_cpp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_PackAsmStatement(Statement *stmt, Statement *first, void **output, SInt32 *outsize) {
|
||||||
|
InlineAsm *src;
|
||||||
|
InlineAsm *dest;
|
||||||
|
IAOperand *op;
|
||||||
|
SInt32 i;
|
||||||
|
SInt32 size;
|
||||||
|
|
||||||
|
src = (InlineAsm *) stmt->expr;
|
||||||
|
size = sizeof(InlineAsm) + sizeof(IAOperand) * src->argcount;
|
||||||
|
dest = galloc(size);
|
||||||
|
memcpy(dest, src, size);
|
||||||
|
|
||||||
|
for (i = 0, op = dest->args; i < dest->argcount; i++, op++) {
|
||||||
|
switch (op->type) {
|
||||||
|
case IAOpnd_0:
|
||||||
|
break;
|
||||||
|
case IAOpnd_Reg:
|
||||||
|
case IAOpnd_4:
|
||||||
|
op->u.reg.object = (Object *) CInline_GetLocalID(op->u.reg.object);
|
||||||
|
break;
|
||||||
|
case IAOpnd_Lab:
|
||||||
|
op->u.lab.label = (CLabel *) CInline_GetStatementNumber(first, op->u.lab.label->stmt);
|
||||||
|
break;
|
||||||
|
case IAOpnd_LabDiff:
|
||||||
|
op->u.labdiff.label1 = (CLabel *) CInline_GetStatementNumber(first, op->u.labdiff.label1->stmt);
|
||||||
|
op->u.labdiff.label2 = (CLabel *) CInline_GetStatementNumber(first, op->u.labdiff.label2->stmt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*output = dest;
|
||||||
|
*outsize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_UnpackAsmStatement(Statement *stmt, CLabel **labelArray, Boolean flag, void *data, SInt32 size) {
|
||||||
|
InlineAsm *ia;
|
||||||
|
IAOperand *op;
|
||||||
|
SInt32 i;
|
||||||
|
|
||||||
|
ia = galloc(size);
|
||||||
|
memcpy(ia, data, size);
|
||||||
|
|
||||||
|
for (i = 0, op = ia->args; i < ia->argcount; i++, op++) {
|
||||||
|
switch (op->type) {
|
||||||
|
case IAOpnd_0:
|
||||||
|
break;
|
||||||
|
case IAOpnd_Reg:
|
||||||
|
case IAOpnd_4:
|
||||||
|
op->u.reg.object = CInline_GetLocalObj((SInt32) op->u.reg.object, flag);
|
||||||
|
break;
|
||||||
|
case IAOpnd_Lab:
|
||||||
|
op->u.lab.label = labelArray[(SInt16) op->u.lab.label];
|
||||||
|
break;
|
||||||
|
case IAOpnd_LabDiff:
|
||||||
|
op->u.labdiff.label1 = labelArray[(SInt16) op->u.labdiff.label1];
|
||||||
|
op->u.labdiff.label2 = labelArray[(SInt16) op->u.labdiff.label2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stmt->expr = (ENode *) ia;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_CheckLocalUsage(Statement *stmt) {
|
||||||
|
InlineAsm *ia = (InlineAsm *) stmt->expr;
|
||||||
|
IAOperand *op;
|
||||||
|
SInt32 i;
|
||||||
|
|
||||||
|
for (i = 0, op = ia->args; i < ia->argcount; i++, op++) {
|
||||||
|
switch (op->type) {
|
||||||
|
case IAOpnd_Reg:
|
||||||
|
if (op->u.reg.object)
|
||||||
|
SetVarUsage(op->u.reg.object, 0);
|
||||||
|
break;
|
||||||
|
case IAOpnd_4:
|
||||||
|
SetVarUsage(op->u.obj.obj, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CLabel *InlineAsm_GetReferencedLabel(Statement *stmt) {
|
||||||
|
InlineAsm *ia = (InlineAsm *) stmt->expr;
|
||||||
|
IAOperand *op;
|
||||||
|
SInt32 i;
|
||||||
|
|
||||||
|
for (i = 0, op = ia->args; i < ia->argcount; i++, op++) {
|
||||||
|
if (op->type == IAOpnd_Lab)
|
||||||
|
return op->u.lab.label;
|
||||||
|
if (op->type == IAOpnd_LabDiff)
|
||||||
|
return op->u.labdiff.label1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLabel *InlineAsm_GetReferencedLabel2(Statement *stmt) {
|
||||||
|
InlineAsm *ia = (InlineAsm *) stmt->expr;
|
||||||
|
IAOperand *op;
|
||||||
|
SInt32 i;
|
||||||
|
|
||||||
|
for (i = 0, op = ia->args; i < ia->argcount; i++, op++) {
|
||||||
|
if (op->type == IAOpnd_LabDiff)
|
||||||
|
return op->u.labdiff.label2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object *InlineAsm_GetObjectOffset(InlineAsm *ia, SInt32 index, SInt32 *offset) {
|
||||||
|
IAOperand *op;
|
||||||
|
SInt32 i;
|
||||||
|
SInt32 counter;
|
||||||
|
|
||||||
|
for (i = 0, counter = 0, op = ia->args; i < ia->argcount; i++, op++) {
|
||||||
|
if (op->type == IAOpnd_3) {
|
||||||
|
if (counter++ == index) {
|
||||||
|
*offset = ((SInt32) &op->u.obj.obj) - ((SInt32) ia);
|
||||||
|
return op->u.obj.obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *InlineAsm_DumpStatement(Statement *stmt) {
|
||||||
|
static char buffer[1024];
|
||||||
|
InlineAsm *ia;
|
||||||
|
IAOperand *arg;
|
||||||
|
int i;
|
||||||
|
char ch;
|
||||||
|
SInt32 offset;
|
||||||
|
|
||||||
|
ia = (InlineAsm *) stmt->expr;
|
||||||
|
|
||||||
|
strcpy(buffer, "\"");
|
||||||
|
strcat(buffer, InlineAsm_GetMnemonic(ia));
|
||||||
|
strcat(buffer, "\"");
|
||||||
|
|
||||||
|
for (i = 0, arg = ia->args; i < ia->argcount; i++, arg++) {
|
||||||
|
char argbuf[1024];
|
||||||
|
|
||||||
|
switch (arg->type) {
|
||||||
|
case IAOpnd_Imm:
|
||||||
|
sprintf(argbuf, " imm(%ld)", arg->u.imm.value);
|
||||||
|
break;
|
||||||
|
case IAOpnd_Reg:
|
||||||
|
ch = ' ';
|
||||||
|
if (arg->u.reg.effect & EffectWrite) {
|
||||||
|
if (arg->u.reg.effect & EffectRead)
|
||||||
|
ch = '+';
|
||||||
|
else
|
||||||
|
ch = '=';
|
||||||
|
} else {
|
||||||
|
if (!(arg->u.reg.effect & EffectRead))
|
||||||
|
ch = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg->u.reg.object) {
|
||||||
|
sprintf(argbuf,
|
||||||
|
"%creg(%s)",
|
||||||
|
ch,
|
||||||
|
arg->u.reg.object->name->name);
|
||||||
|
} else {
|
||||||
|
sprintf(argbuf,
|
||||||
|
"%creg(%s%d)",
|
||||||
|
ch,
|
||||||
|
register_class_name[arg->u.reg.rclass],
|
||||||
|
arg->u.reg.num);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IAOpnd_3:
|
||||||
|
case IAOpnd_4:
|
||||||
|
if (arg->u.obj.offset > 0)
|
||||||
|
sprintf(argbuf, " obj(%s+%ld)", arg->u.obj.obj->name->name, arg->u.obj.offset);
|
||||||
|
else if (arg->u.obj.offset < 0)
|
||||||
|
sprintf(argbuf, " obj(%s-%ld)", arg->u.obj.obj->name->name, -arg->u.obj.offset);
|
||||||
|
else
|
||||||
|
sprintf(argbuf, " obj(%s)", arg->u.obj.obj->name->name);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IAOpnd_Lab:
|
||||||
|
sprintf(argbuf, " lab(%s)", arg->u.lab.label->uniquename->name);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IAOpnd_LabDiff:
|
||||||
|
offset = !arg->negated ? 0 : arg->u.labdiff.offset;
|
||||||
|
sprintf(argbuf,
|
||||||
|
" labdiff(%s-%s%c%d)",
|
||||||
|
arg->u.labdiff.label1->uniquename->name,
|
||||||
|
arg->u.labdiff.label2->uniquename->name,
|
||||||
|
(arg->negated == 1) ? '-' : '+',
|
||||||
|
offset
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcat(buffer, argbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,50 @@
|
||||||
|
#include "compiler/InlineAsmRegisters.h"
|
||||||
|
#include "compiler/CompilerTools.h"
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
#pragma options align=mac68k
|
||||||
|
#endif
|
||||||
|
typedef struct HashedRegister {
|
||||||
|
struct HashedRegister *next;
|
||||||
|
IARegister reg;
|
||||||
|
} HashedRegister;
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
#pragma options align=reset
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static HashedRegister *hashedregisters[64];
|
||||||
|
|
||||||
|
void InlineAsm_InitializeRegisters() {
|
||||||
|
SInt32 i;
|
||||||
|
|
||||||
|
for (i = 0; i < 64; i++)
|
||||||
|
hashedregisters[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_InsertRegister(char *name, char rclass, short num, Object *object) {
|
||||||
|
HashedRegister **ptr;
|
||||||
|
HashedRegister *hr;
|
||||||
|
|
||||||
|
ptr = hashedregisters + (CHash(name) & 63);
|
||||||
|
hr = lalloc(sizeof(HashedRegister));
|
||||||
|
hr->reg.name = name;
|
||||||
|
hr->reg.rclass = rclass;
|
||||||
|
hr->reg.num = num;
|
||||||
|
hr->reg.object = object;
|
||||||
|
|
||||||
|
hr->next = *ptr;
|
||||||
|
*ptr = hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
IARegister *InlineAsm_LookupRegister(char *name) {
|
||||||
|
HashedRegister *scan;
|
||||||
|
IARegister *reg;
|
||||||
|
|
||||||
|
for (scan = hashedregisters[CHash(name) & 63]; scan; scan = scan->next) {
|
||||||
|
reg = &scan->reg;
|
||||||
|
if (!strcmp(scan->reg.name, name))
|
||||||
|
return reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
|
@ -0,0 +1,854 @@
|
||||||
|
#include "compiler/InlineAsmRegistersPPC.h"
|
||||||
|
#include "compiler/InlineAsm.h"
|
||||||
|
#include "compiler/InlineAsmRegisters.h"
|
||||||
|
#include "compiler/CompilerTools.h"
|
||||||
|
#include "compiler/RegisterInfo.h"
|
||||||
|
#include "compiler/objects.h"
|
||||||
|
#include "compiler/types.h"
|
||||||
|
#include "compiler/InlineAsmPPC.h"
|
||||||
|
#include "compiler/CParser.h"
|
||||||
|
#include "compiler/PPCError.h"
|
||||||
|
#include "compiler/CFunc.h"
|
||||||
|
|
||||||
|
#pragma pool_strings on
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
#pragma options align=mac68k
|
||||||
|
#endif
|
||||||
|
typedef struct RegInfo {
|
||||||
|
struct RegInfo *next;
|
||||||
|
UInt32 b;
|
||||||
|
IARegister reg;
|
||||||
|
} RegInfo;
|
||||||
|
|
||||||
|
typedef struct AsmRegister {
|
||||||
|
char *name;
|
||||||
|
char rclass;
|
||||||
|
SInt32 num;
|
||||||
|
} AsmRegister;
|
||||||
|
|
||||||
|
typedef struct AsmSpr {
|
||||||
|
char *name;
|
||||||
|
SInt32 num;
|
||||||
|
UInt32 mask;
|
||||||
|
} AsmSpr;
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
#pragma options align=reset
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static RegInfo *hashedsprs[64];
|
||||||
|
static RegInfo *hasheddcrs[64];
|
||||||
|
|
||||||
|
static AsmRegister asm_registers[] = {
|
||||||
|
"r0", RegClass_GPR, 0,
|
||||||
|
"r1", RegClass_GPR, 1,
|
||||||
|
"r2", RegClass_GPR, 2,
|
||||||
|
"r3", RegClass_GPR, 3,
|
||||||
|
"r4", RegClass_GPR, 4,
|
||||||
|
"r5", RegClass_GPR, 5,
|
||||||
|
"r6", RegClass_GPR, 6,
|
||||||
|
"r7", RegClass_GPR, 7,
|
||||||
|
"r8", RegClass_GPR, 8,
|
||||||
|
"r9", RegClass_GPR, 9,
|
||||||
|
"r10", RegClass_GPR, 10,
|
||||||
|
"r11", RegClass_GPR, 11,
|
||||||
|
"r12", RegClass_GPR, 12,
|
||||||
|
"r13", RegClass_GPR, 13,
|
||||||
|
"r14", RegClass_GPR, 14,
|
||||||
|
"r15", RegClass_GPR, 15,
|
||||||
|
"r16", RegClass_GPR, 16,
|
||||||
|
"r17", RegClass_GPR, 17,
|
||||||
|
"r18", RegClass_GPR, 18,
|
||||||
|
"r19", RegClass_GPR, 19,
|
||||||
|
"r20", RegClass_GPR, 20,
|
||||||
|
"r21", RegClass_GPR, 21,
|
||||||
|
"r22", RegClass_GPR, 22,
|
||||||
|
"r23", RegClass_GPR, 23,
|
||||||
|
"r24", RegClass_GPR, 24,
|
||||||
|
"r25", RegClass_GPR, 25,
|
||||||
|
"r26", RegClass_GPR, 26,
|
||||||
|
"r27", RegClass_GPR, 27,
|
||||||
|
"r28", RegClass_GPR, 28,
|
||||||
|
"r29", RegClass_GPR, 29,
|
||||||
|
"r30", RegClass_GPR, 30,
|
||||||
|
"r31", RegClass_GPR, 31,
|
||||||
|
"gpr0", RegClass_GPR, 0,
|
||||||
|
"gpr1", RegClass_GPR, 1,
|
||||||
|
"gpr2", RegClass_GPR, 2,
|
||||||
|
"gpr3", RegClass_GPR, 3,
|
||||||
|
"gpr4", RegClass_GPR, 4,
|
||||||
|
"gpr5", RegClass_GPR, 5,
|
||||||
|
"gpr6", RegClass_GPR, 6,
|
||||||
|
"gpr7", RegClass_GPR, 7,
|
||||||
|
"gpr8", RegClass_GPR, 8,
|
||||||
|
"gpr9", RegClass_GPR, 9,
|
||||||
|
"gpr10", RegClass_GPR, 10,
|
||||||
|
"gpr11", RegClass_GPR, 11,
|
||||||
|
"gpr12", RegClass_GPR, 12,
|
||||||
|
"gpr13", RegClass_GPR, 13,
|
||||||
|
"gpr14", RegClass_GPR, 14,
|
||||||
|
"gpr15", RegClass_GPR, 15,
|
||||||
|
"gpr16", RegClass_GPR, 16,
|
||||||
|
"gpr17", RegClass_GPR, 17,
|
||||||
|
"gpr18", RegClass_GPR, 18,
|
||||||
|
"gpr19", RegClass_GPR, 19,
|
||||||
|
"gpr20", RegClass_GPR, 20,
|
||||||
|
"gpr21", RegClass_GPR, 21,
|
||||||
|
"gpr22", RegClass_GPR, 22,
|
||||||
|
"gpr23", RegClass_GPR, 23,
|
||||||
|
"gpr24", RegClass_GPR, 24,
|
||||||
|
"gpr25", RegClass_GPR, 25,
|
||||||
|
"gpr26", RegClass_GPR, 26,
|
||||||
|
"gpr27", RegClass_GPR, 27,
|
||||||
|
"gpr28", RegClass_GPR, 28,
|
||||||
|
"gpr29", RegClass_GPR, 29,
|
||||||
|
"gpr30", RegClass_GPR, 30,
|
||||||
|
"gpr31", RegClass_GPR, 31,
|
||||||
|
"rtoc", RegClass_GPR, 2,
|
||||||
|
"RTOC", RegClass_GPR, 2,
|
||||||
|
"sp", RegClass_GPR, 1,
|
||||||
|
"SP", RegClass_GPR, 1,
|
||||||
|
"rsp", RegClass_GPR, 1,
|
||||||
|
"RSP", RegClass_GPR, 1,
|
||||||
|
"RPIC", RegClass_GPR, -2,
|
||||||
|
"rpic", RegClass_GPR, -2,
|
||||||
|
"f0", RegClass_FPR, 0,
|
||||||
|
"f1", RegClass_FPR, 1,
|
||||||
|
"f2", RegClass_FPR, 2,
|
||||||
|
"f3", RegClass_FPR, 3,
|
||||||
|
"f4", RegClass_FPR, 4,
|
||||||
|
"f5", RegClass_FPR, 5,
|
||||||
|
"f6", RegClass_FPR, 6,
|
||||||
|
"f7", RegClass_FPR, 7,
|
||||||
|
"f8", RegClass_FPR, 8,
|
||||||
|
"f9", RegClass_FPR, 9,
|
||||||
|
"f10", RegClass_FPR, 10,
|
||||||
|
"f11", RegClass_FPR, 11,
|
||||||
|
"f12", RegClass_FPR, 12,
|
||||||
|
"f13", RegClass_FPR, 13,
|
||||||
|
"f14", RegClass_FPR, 14,
|
||||||
|
"f15", RegClass_FPR, 15,
|
||||||
|
"f16", RegClass_FPR, 16,
|
||||||
|
"f17", RegClass_FPR, 17,
|
||||||
|
"f18", RegClass_FPR, 18,
|
||||||
|
"f19", RegClass_FPR, 19,
|
||||||
|
"f20", RegClass_FPR, 20,
|
||||||
|
"f21", RegClass_FPR, 21,
|
||||||
|
"f22", RegClass_FPR, 22,
|
||||||
|
"f23", RegClass_FPR, 23,
|
||||||
|
"f24", RegClass_FPR, 24,
|
||||||
|
"f25", RegClass_FPR, 25,
|
||||||
|
"f26", RegClass_FPR, 26,
|
||||||
|
"f27", RegClass_FPR, 27,
|
||||||
|
"f28", RegClass_FPR, 28,
|
||||||
|
"f29", RegClass_FPR, 29,
|
||||||
|
"f30", RegClass_FPR, 30,
|
||||||
|
"f31", RegClass_FPR, 31,
|
||||||
|
"fp0", RegClass_FPR, 0,
|
||||||
|
"fp1", RegClass_FPR, 1,
|
||||||
|
"fp2", RegClass_FPR, 2,
|
||||||
|
"fp3", RegClass_FPR, 3,
|
||||||
|
"fp4", RegClass_FPR, 4,
|
||||||
|
"fp5", RegClass_FPR, 5,
|
||||||
|
"fp6", RegClass_FPR, 6,
|
||||||
|
"fp7", RegClass_FPR, 7,
|
||||||
|
"fp8", RegClass_FPR, 8,
|
||||||
|
"fp9", RegClass_FPR, 9,
|
||||||
|
"fp10", RegClass_FPR, 10,
|
||||||
|
"fp11", RegClass_FPR, 11,
|
||||||
|
"fp12", RegClass_FPR, 12,
|
||||||
|
"fp13", RegClass_FPR, 13,
|
||||||
|
"fp14", RegClass_FPR, 14,
|
||||||
|
"fp15", RegClass_FPR, 15,
|
||||||
|
"fp16", RegClass_FPR, 16,
|
||||||
|
"fp17", RegClass_FPR, 17,
|
||||||
|
"fp18", RegClass_FPR, 18,
|
||||||
|
"fp19", RegClass_FPR, 19,
|
||||||
|
"fp20", RegClass_FPR, 20,
|
||||||
|
"fp21", RegClass_FPR, 21,
|
||||||
|
"fp22", RegClass_FPR, 22,
|
||||||
|
"fp23", RegClass_FPR, 23,
|
||||||
|
"fp24", RegClass_FPR, 24,
|
||||||
|
"fp25", RegClass_FPR, 25,
|
||||||
|
"fp26", RegClass_FPR, 26,
|
||||||
|
"fp27", RegClass_FPR, 27,
|
||||||
|
"fp28", RegClass_FPR, 28,
|
||||||
|
"fp29", RegClass_FPR, 29,
|
||||||
|
"fp30", RegClass_FPR, 30,
|
||||||
|
"fp31", RegClass_FPR, 31,
|
||||||
|
"v0", RegClass_VR, 0,
|
||||||
|
"v1", RegClass_VR, 1,
|
||||||
|
"v2", RegClass_VR, 2,
|
||||||
|
"v3", RegClass_VR, 3,
|
||||||
|
"v4", RegClass_VR, 4,
|
||||||
|
"v5", RegClass_VR, 5,
|
||||||
|
"v6", RegClass_VR, 6,
|
||||||
|
"v7", RegClass_VR, 7,
|
||||||
|
"v8", RegClass_VR, 8,
|
||||||
|
"v9", RegClass_VR, 9,
|
||||||
|
"v10", RegClass_VR, 10,
|
||||||
|
"v11", RegClass_VR, 11,
|
||||||
|
"v12", RegClass_VR, 12,
|
||||||
|
"v13", RegClass_VR, 13,
|
||||||
|
"v14", RegClass_VR, 14,
|
||||||
|
"v15", RegClass_VR, 15,
|
||||||
|
"v16", RegClass_VR, 16,
|
||||||
|
"v17", RegClass_VR, 17,
|
||||||
|
"v18", RegClass_VR, 18,
|
||||||
|
"v19", RegClass_VR, 19,
|
||||||
|
"v20", RegClass_VR, 20,
|
||||||
|
"v21", RegClass_VR, 21,
|
||||||
|
"v22", RegClass_VR, 22,
|
||||||
|
"v23", RegClass_VR, 23,
|
||||||
|
"v24", RegClass_VR, 24,
|
||||||
|
"v25", RegClass_VR, 25,
|
||||||
|
"v26", RegClass_VR, 26,
|
||||||
|
"v27", RegClass_VR, 27,
|
||||||
|
"v28", RegClass_VR, 28,
|
||||||
|
"v29", RegClass_VR, 29,
|
||||||
|
"v30", RegClass_VR, 30,
|
||||||
|
"v31", RegClass_VR, 31,
|
||||||
|
"vr0", RegClass_VR, 0,
|
||||||
|
"vr1", RegClass_VR, 1,
|
||||||
|
"vr2", RegClass_VR, 2,
|
||||||
|
"vr3", RegClass_VR, 3,
|
||||||
|
"vr4", RegClass_VR, 4,
|
||||||
|
"vr5", RegClass_VR, 5,
|
||||||
|
"vr6", RegClass_VR, 6,
|
||||||
|
"vr7", RegClass_VR, 7,
|
||||||
|
"vr8", RegClass_VR, 8,
|
||||||
|
"vr9", RegClass_VR, 9,
|
||||||
|
"vr10", RegClass_VR, 10,
|
||||||
|
"vr11", RegClass_VR, 11,
|
||||||
|
"vr12", RegClass_VR, 12,
|
||||||
|
"vr13", RegClass_VR, 13,
|
||||||
|
"vr14", RegClass_VR, 14,
|
||||||
|
"vr15", RegClass_VR, 15,
|
||||||
|
"vr16", RegClass_VR, 16,
|
||||||
|
"vr17", RegClass_VR, 17,
|
||||||
|
"vr18", RegClass_VR, 18,
|
||||||
|
"vr19", RegClass_VR, 19,
|
||||||
|
"vr20", RegClass_VR, 20,
|
||||||
|
"vr21", RegClass_VR, 21,
|
||||||
|
"vr22", RegClass_VR, 22,
|
||||||
|
"vr23", RegClass_VR, 23,
|
||||||
|
"vr24", RegClass_VR, 24,
|
||||||
|
"vr25", RegClass_VR, 25,
|
||||||
|
"vr26", RegClass_VR, 26,
|
||||||
|
"vr27", RegClass_VR, 27,
|
||||||
|
"vr28", RegClass_VR, 28,
|
||||||
|
"vr29", RegClass_VR, 29,
|
||||||
|
"vr30", RegClass_VR, 30,
|
||||||
|
"vr31", RegClass_VR, 31,
|
||||||
|
"cr0", RegClass_CRFIELD, 0,
|
||||||
|
"cr1", RegClass_CRFIELD, 1,
|
||||||
|
"cr2", RegClass_CRFIELD, 2,
|
||||||
|
"cr3", RegClass_CRFIELD, 3,
|
||||||
|
"cr4", RegClass_CRFIELD, 4,
|
||||||
|
"cr5", RegClass_CRFIELD, 5,
|
||||||
|
"cr6", RegClass_CRFIELD, 6,
|
||||||
|
"cr7", RegClass_CRFIELD, 7,
|
||||||
|
"crf0", RegClass_CRFIELD, 0,
|
||||||
|
"crf1", RegClass_CRFIELD, 1,
|
||||||
|
"crf2", RegClass_CRFIELD, 2,
|
||||||
|
"crf3", RegClass_CRFIELD, 3,
|
||||||
|
"crf4", RegClass_CRFIELD, 4,
|
||||||
|
"crf5", RegClass_CRFIELD, 5,
|
||||||
|
"crf6", RegClass_CRFIELD, 6,
|
||||||
|
"crf7", RegClass_CRFIELD, 7,
|
||||||
|
"lt", RegClass_6, 0,
|
||||||
|
"gt", RegClass_6, 1,
|
||||||
|
"eq", RegClass_6, 2,
|
||||||
|
"so", RegClass_6, 3,
|
||||||
|
"un", RegClass_6, 3,
|
||||||
|
"LT", RegClass_6, 0,
|
||||||
|
"GT", RegClass_6, 1,
|
||||||
|
"EQ", RegClass_6, 2,
|
||||||
|
"SO", RegClass_6, 3,
|
||||||
|
"UN", RegClass_6, 3,
|
||||||
|
NULL, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static AsmSpr asm_sprs[] = {
|
||||||
|
"xer", 1, 0xFFFFF,
|
||||||
|
"lr", 8, 0xFFFFF,
|
||||||
|
"ctr", 9, 0xFFFFF,
|
||||||
|
"mq", 0, 1,
|
||||||
|
"rtcu", 4, 1,
|
||||||
|
"rtcl", 5, 1,
|
||||||
|
"dsisr", 0x12, 0xFF83F,
|
||||||
|
"dar", 0x13, 0xFF83F,
|
||||||
|
"dec", 0x16, 0xFF83F,
|
||||||
|
"sdr1", 0x19, 0xFE00F,
|
||||||
|
"srr0", 0x1A, 0xFFFFF,
|
||||||
|
"srr1", 0x1B, 0xFFFFF,
|
||||||
|
"eie", 0x50, 0x1830,
|
||||||
|
"eid", 0x51, 0x1830,
|
||||||
|
"nri", 0x52, 0x1830,
|
||||||
|
"cmpa", 0x90, 0x1830,
|
||||||
|
"cmpb", 0x91, 0x1830,
|
||||||
|
"cmpc", 0x92, 0x1830,
|
||||||
|
"cmpd", 0x93, 0x1830,
|
||||||
|
"icr", 0x94, 0x30,
|
||||||
|
"ecr", 0x94, 0x1800,
|
||||||
|
"der", 0x95, 0x1830,
|
||||||
|
"counta", 0x96, 0x1830,
|
||||||
|
"countb", 0x97, 0x1830,
|
||||||
|
"cmpe", 0x98, 0x1830,
|
||||||
|
"cmpf", 0x99, 0x1830,
|
||||||
|
"cmpg", 0x9A, 0x1830,
|
||||||
|
"cmph", 0x9B, 0x1830,
|
||||||
|
"lctrl1", 0x9C, 0x1830,
|
||||||
|
"lctrl2", 0x9D, 0x1830,
|
||||||
|
"ictrl", 0x9E, 0x1830,
|
||||||
|
"bar", 0x9F, 0x1830,
|
||||||
|
"vrsave", 0x100, 0x40000000,
|
||||||
|
"sprg0", 0x110, 0xFFFFF,
|
||||||
|
"sprg1", 0x111, 0xFFFFF,
|
||||||
|
"sprg2", 0x112, 0xFFFFF,
|
||||||
|
"sprg3", 0x113, 0xFFFFF,
|
||||||
|
"ear", 0x11A, 0xFE7CF,
|
||||||
|
"tbl", 0x11C, 0xFF83F,
|
||||||
|
"tbu", 0x11D, 0xFF83F,
|
||||||
|
"tbl_write", 0x11C, 0xFF83F,
|
||||||
|
"tbu_write", 0x11D, 0xFF83F,
|
||||||
|
"pvr", 0x11F, 0xFFFFF,
|
||||||
|
"ibat0u", 0x210, 0xFE7CF,
|
||||||
|
"mi_gra", 0x210, 0x1000,
|
||||||
|
"ibat0l", 0x211, 0xFE7CF,
|
||||||
|
"ibat1u", 0x212, 0xFE7CF,
|
||||||
|
"ibat1l", 0x213, 0xFE7CF,
|
||||||
|
"ibat2u", 0x214, 0xFE7CF,
|
||||||
|
"ibat2l", 0x215, 0xFE7CF,
|
||||||
|
"ibat3u", 0x216, 0xFE7CF,
|
||||||
|
"ibat3l", 0x217, 0xFE7CF,
|
||||||
|
"dbat0u", 0x218, 0xFE7CE,
|
||||||
|
"l2u_gra", 0x218, 0x1000,
|
||||||
|
"dbat0l", 0x219, 0xFE7CE,
|
||||||
|
"dbat1u", 0x21A, 0xFE7CE,
|
||||||
|
"dbat1l", 0x21B, 0xFE7CE,
|
||||||
|
"dbat2u", 0x21C, 0xFE7CE,
|
||||||
|
"dbat2l", 0x21D, 0xFE7CE,
|
||||||
|
"dbat3u", 0x21E, 0xFE7CE,
|
||||||
|
"dbat3l", 0x21F, 0xFE7CE,
|
||||||
|
"ic_cst", 0x230, 0x30,
|
||||||
|
"iccst", 0x230, 0x800,
|
||||||
|
"bbcmcr", 0x230, 0x1000,
|
||||||
|
"ic_adr", 0x231, 0x30,
|
||||||
|
"icadr", 0x231, 0x800,
|
||||||
|
"ic_dat", 0x232, 0x30,
|
||||||
|
"icdat", 0x232, 0x800,
|
||||||
|
"dc_cst", 0x238, 0x30,
|
||||||
|
"l2u_mcr", 0x238, 0x1000,
|
||||||
|
"dc_adr", 0x239, 0x30,
|
||||||
|
"dc_dat", 0x23A, 0x30,
|
||||||
|
"dpdr", 0x276, 0x1830,
|
||||||
|
"dpir", 0x277, 0x30,
|
||||||
|
"immr", 0x27E, 0x30,
|
||||||
|
"mi_ctr", 0x310, 0x30,
|
||||||
|
"mi_rba0", 0x310, 0x1000,
|
||||||
|
"mi_rba1", 0x311, 0x1000,
|
||||||
|
"mi_rba2", 0x312, 0x1000,
|
||||||
|
"mi_ap", 0x312, 0x30,
|
||||||
|
"mi_epn", 0x313, 0x30,
|
||||||
|
"mi_rba3", 0x313, 0x1000,
|
||||||
|
"mi_twc", 0x315, 0x30,
|
||||||
|
"mi_l1dl2p", 0x315, 0x30,
|
||||||
|
"mi_rpn", 0x316, 0x30,
|
||||||
|
"md_ctr", 0x318, 0x30,
|
||||||
|
"l2u_rba0", 0x318, 0x1000,
|
||||||
|
"l2u_rba1", 0x319, 0x1000,
|
||||||
|
"m_casid", 0x319, 0x30,
|
||||||
|
"md_ap", 0x31A, 0x30,
|
||||||
|
"l2u_rba2", 0x31A, 0x1000,
|
||||||
|
"l2u_rba3", 0x31B, 0x1000,
|
||||||
|
"md_epn", 0x31B, 0x30,
|
||||||
|
"m_twb", 0x31C, 0x30,
|
||||||
|
"md_l1p", 0x31C, 0x30,
|
||||||
|
"md_twc", 0x31D, 0x30,
|
||||||
|
"md_l1dl2p", 0x31D, 0x30,
|
||||||
|
"md_rpn", 0x31E, 0x30,
|
||||||
|
"m_tw", 0x31F, 0x30,
|
||||||
|
"m_save", 0x31F, 0x30,
|
||||||
|
"mi_dbcam", 0x330, 0x10,
|
||||||
|
"mi_cam", 0x330, 0x20,
|
||||||
|
"mi_ra0", 0x330, 0x1000,
|
||||||
|
"mi_ra1", 0x331, 0x1000,
|
||||||
|
"mi_dbram0", 0x331, 0x10,
|
||||||
|
"mi_ram0", 0x331, 0x20,
|
||||||
|
"mi_dbram1", 0x332, 0x10,
|
||||||
|
"mi_ram1", 0x332, 0x20,
|
||||||
|
"mi_ra2", 0x332, 0x1000,
|
||||||
|
"mi_ra3", 0x333, 0x1000,
|
||||||
|
"md_dbcam", 0x338, 0x10,
|
||||||
|
"md_cam", 0x338, 0x20,
|
||||||
|
"l2u_ra0", 0x338, 0x1000,
|
||||||
|
"l2u_ra1", 0x339, 0x1000,
|
||||||
|
"md_dbram0", 0x339, 0x10,
|
||||||
|
"md_ram0", 0x339, 0x20,
|
||||||
|
"md_dbram1", 0x33A, 0x10,
|
||||||
|
"md_ram1", 0x33A, 0x20,
|
||||||
|
"l2u_ra2", 0x33A, 0x1000,
|
||||||
|
"l2u_ra3", 0x33B, 0x1000,
|
||||||
|
"ummcr2", 0x3A0, 0x4000,
|
||||||
|
"ubamr", 0x3A7, 0x4000,
|
||||||
|
"ummcr0", 0x3A8, 0xE000,
|
||||||
|
"upmc1", 0x3A9, 0xE000,
|
||||||
|
"upmc2", 0x3AA, 0xE000,
|
||||||
|
"usia", 0x3AB, 0x2000,
|
||||||
|
"usiar", 0x3AB, 0x4000,
|
||||||
|
"ummcr1", 0x3AC, 0xE000,
|
||||||
|
"upmc3", 0x3AD, 0xE000,
|
||||||
|
"upmc4", 0x3AE, 0xE000,
|
||||||
|
"zpr", 0x3B0, 0x200,
|
||||||
|
"mmcr2", 0x3B0, 0x4000,
|
||||||
|
"pid", 0x3B1, 0x200,
|
||||||
|
"bamr", 0x3B7, 0x4000,
|
||||||
|
"mmcr0", 0x3B8, 0xE008,
|
||||||
|
"pmc1", 0x3B9, 0xE008,
|
||||||
|
"sgr", 0x3B9, 0x240,
|
||||||
|
"pmc2", 0x3BA, 0xE008,
|
||||||
|
"dcwr", 0x3BA, 0x240,
|
||||||
|
"sia", 0x3BB, 0xE008,
|
||||||
|
"siar", 0x3BB, 0x4000,
|
||||||
|
"sler", 0x3BB, 0x40,
|
||||||
|
"mmcr1", 0x3BC, 0xE000,
|
||||||
|
"pmc3", 0x3BD, 0xE000,
|
||||||
|
"pmc4", 0x3BE, 0xE000,
|
||||||
|
"sda", 0x3BF, 8,
|
||||||
|
"tbhu", 0x3CC, 0x240,
|
||||||
|
"tblu", 0x3CD, 0x240,
|
||||||
|
"dmiss", 0x3D0, 0x10006,
|
||||||
|
"dcmp", 0x3D1, 0x10006,
|
||||||
|
"hash1", 0x3D2, 0x10006,
|
||||||
|
"hash2", 0x3D3, 0x10006,
|
||||||
|
"icdbdr", 0x3D3, 0x7C0,
|
||||||
|
"imiss", 0x3D4, 0x10006,
|
||||||
|
"esr", 0x3D4, 0x7C0,
|
||||||
|
"icmp", 0x3D5, 0x10006,
|
||||||
|
"dear", 0x3D5, 0x7C0,
|
||||||
|
"rpa", 0x3D6, 0x10006,
|
||||||
|
"evpr", 0x3D6, 0x7C0,
|
||||||
|
"cdbcr", 0x3D7, 0x7C0,
|
||||||
|
"tsr", 0x3D8, 0x7C0,
|
||||||
|
"tcr", 0x3D8, 2,
|
||||||
|
"tcr", 0x3DA, 0x7C0,
|
||||||
|
"ibr", 0x3DA, 2,
|
||||||
|
"pit", 0x3DB, 0x7C0,
|
||||||
|
"esasrr", 0x3DB, 2,
|
||||||
|
"tbhi", 0x3DC, 0x7C0,
|
||||||
|
"tblo", 0x3DD, 0x7C0,
|
||||||
|
"srr2", 0x3DE, 0x7C0,
|
||||||
|
"sebr", 0x3DE, 2,
|
||||||
|
"srr3", 0x3DF, 0x7C0,
|
||||||
|
"ser", 0x3DF, 2,
|
||||||
|
"mid0", 0x3F0, 0x1E00F,
|
||||||
|
"dbsr", 0x3F0, 0x80,
|
||||||
|
"hid1", 0x3F1, 0x1E007,
|
||||||
|
"hid2", 0x3F2, 1,
|
||||||
|
"iabr", 0x3F2, 0x1E00F,
|
||||||
|
"dbcr", 0x3F2, 0x7C0,
|
||||||
|
"hid2", 0x3F3, 0x10000,
|
||||||
|
"iac1", 0x3F4, 0x80,
|
||||||
|
"iac", 0x3F4, 0x40,
|
||||||
|
"dabr", 0x3F5, 0xE009,
|
||||||
|
"iac2", 0x3F5, 0x80,
|
||||||
|
"hid5", 0x3F5, 1,
|
||||||
|
"dac1", 0x3F6, 0x80,
|
||||||
|
"dac", 0x3F6, 0x40,
|
||||||
|
"msscr0", 0x3F6, 0x4000,
|
||||||
|
"dac2", 0x3F7, 0x80,
|
||||||
|
"l2cr", 0x3F9, 0xE000,
|
||||||
|
"dccr", 0x3FA, 0x7C0,
|
||||||
|
"iccr", 0x3FB, 0x7C0,
|
||||||
|
"ictc", 0x3FB, 0xE000,
|
||||||
|
"pbl1", 0x3FC, 0x80,
|
||||||
|
"thrm1", 0x3FC, 0xE000,
|
||||||
|
"pbu1", 0x3FD, 0x80,
|
||||||
|
"thrm2", 0x3FD, 0xE000,
|
||||||
|
"fpecr", 0x3FE, 0x1800,
|
||||||
|
"pbl2", 0x3FE, 0x80,
|
||||||
|
"thrm3", 0x3FE, 0xE000,
|
||||||
|
"pir", 0x3FF, 0x4008,
|
||||||
|
"hid15", 0x3FF, 1,
|
||||||
|
"pbu2", 0x3FF, 0x80,
|
||||||
|
NULL, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
UInt32 spr_cpus[1024] = {
|
||||||
|
1, 0xFFFFF, 0, 0, 1, 1, 0, 0,
|
||||||
|
0xFFFFF, 0xFFFFF, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0xFF83F, 0xFF83F, 0, 0, 0xFF83F, 0,
|
||||||
|
0, 0xFE00F, 0xFFFFF, 0xFFFFF, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0x1830, 0x1830, 0x1830, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0x1830, 0x1830, 0x1830, 0x1830, 0x1830, 0x1830, 0x1830, 0x1830,
|
||||||
|
0x1830, 0x1830, 0x1830, 0x1830, 0x1830, 0x1830, 0x1830, 0x1830,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0x40000000, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0xFFFFF, 0xFFFFF, 0xFFFFF, 0xFFFFF, 0, 0, 0, 0,
|
||||||
|
0, 0, 0xFE7CF, 0, 0xFF83F, 0xFF83F, 0, 0xFFFFF,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0xFF7CF, 0xFE7CF, 0xFE7CF, 0xFE7CF, 0xFE7CF, 0xFE7CF, 0xFE7CF, 0xFE7CF,
|
||||||
|
0xFF7CE, 0xFE7CE, 0xFE7CE, 0xFE7CE, 0xFE7CE, 0xFE7CE, 0xFE7CE, 0xFE7CE,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0x1830, 0x1830, 0x1830, 0, 0, 0, 0, 0,
|
||||||
|
0x1030, 0x30, 0x30, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0x1830, 0x30,
|
||||||
|
0, 0, 0, 0, 0, 0, 0x30, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0x1030, 0x1000, 0x1030, 0x1030, 0, 0x30, 0x30, 0,
|
||||||
|
0x1030, 0x1030, 0x1030, 0x1030, 0x30, 0x30, 0x30, 0x30,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0x1030, 0x1030, 0x1030, 0x1000, 0, 0, 0, 0,
|
||||||
|
0x1030, 0x1030, 0x1030, 0x1000, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0x20000000, 0x20000000, 0x20000000, 0x20000000, 0x20000000, 0x20000000, 0x20000000, 0x20000000,
|
||||||
|
0x20000000, 0x20000000, 0x20000000, 0x20000000, 0, 0, 0, 0,
|
||||||
|
0x4000, 0, 0, 0, 0, 0, 0, 0x4000,
|
||||||
|
0xE000, 0xE000, 0xE000, 0xE000, 0xE000, 0xE000, 0xE000, 0,
|
||||||
|
0x4200, 0x200, 0, 0, 0, 0, 0, 0x4000,
|
||||||
|
0xE008, 0xE248, 0xE248, 0xE048, 0xE000, 0xE000, 0xE000, 8,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0x240, 0x240, 0, 0,
|
||||||
|
0x10006, 0x10006, 0x10006, 0x107C6, 0x107C6, 0x107C6, 0x107C6, 0x7C0,
|
||||||
|
0x7C2, 0, 0x7C2, 0x7C2, 0x7C0, 0x7C0, 0x7C2, 0x7C2,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0x1E08F, 0x1E007, 0x1E7CF, 0x10000, 0xC0, 0xE089, 0x40C0, 0x80,
|
||||||
|
0, 0xE000, 0x7C0, 0xE7C0, 0xE080, 0xE080, 0xF880, 0xE089
|
||||||
|
};
|
||||||
|
|
||||||
|
static void InlineAsm_InsertSPR(char *name, short num, UInt32 b) {
|
||||||
|
RegInfo **ptr;
|
||||||
|
RegInfo *info;
|
||||||
|
|
||||||
|
ptr = hashedsprs + (CHash(name) & 63);
|
||||||
|
info = lalloc(sizeof(RegInfo));
|
||||||
|
info->b = b;
|
||||||
|
info->reg.name = name;
|
||||||
|
info->reg.rclass = RegClass_SPR;
|
||||||
|
info->reg.num = num;
|
||||||
|
info->reg.object = NULL;
|
||||||
|
|
||||||
|
info->next = *ptr;
|
||||||
|
*ptr = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void InlineAsm_InsertRegisterDCR(char *name, UInt32 b, short num) {
|
||||||
|
RegInfo **ptr;
|
||||||
|
RegInfo *info;
|
||||||
|
|
||||||
|
ptr = hasheddcrs + (CHash(name) & 63);
|
||||||
|
info = lalloc(sizeof(RegInfo));
|
||||||
|
info->b = b;
|
||||||
|
info->reg.name = name;
|
||||||
|
info->reg.rclass = RegClass_DCR;
|
||||||
|
info->reg.num = num;
|
||||||
|
info->reg.object = NULL;
|
||||||
|
|
||||||
|
info->next = *ptr;
|
||||||
|
*ptr = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
IARegister *InlineAsm_LookupRegisterPPCName(HashNameNode *name) {
|
||||||
|
IALookupResult result;
|
||||||
|
IARegister *reg;
|
||||||
|
Type *type;
|
||||||
|
|
||||||
|
if (InlineAsm_LookupSymbol(name, &result) && result.object && is_register_object(result.object)) {
|
||||||
|
type = result.object->type;
|
||||||
|
if ((reg = InlineAsm_LookupRegisterPPC(name->name)) && reg->object == result.object)
|
||||||
|
return reg;
|
||||||
|
|
||||||
|
if (IS_TYPE_FLOAT(type)) {
|
||||||
|
InlineAsm_InsertRegister(name->name, RegClass_FPR, 0, result.object);
|
||||||
|
} else if (IS_TYPE_VECTOR(type)) {
|
||||||
|
InlineAsm_InsertRegister(name->name, RegClass_VR, 0, result.object);
|
||||||
|
} else {
|
||||||
|
InlineAsm_InsertRegister(name->name, RegClass_GPR, 0, result.object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return InlineAsm_LookupRegisterPPC(name->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
IARegister *InlineAsm_LookupRegisterPPC(char *name) {
|
||||||
|
RegInfo *scan;
|
||||||
|
IARegister *reg;
|
||||||
|
IARegister *check;
|
||||||
|
char buf[40];
|
||||||
|
|
||||||
|
if ((check = InlineAsm_LookupRegister(name)))
|
||||||
|
return check;
|
||||||
|
|
||||||
|
reg = NULL;
|
||||||
|
if (strlen(name) < 40)
|
||||||
|
CToLowercase(name, buf);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (scan = hashedsprs[CHash(buf) & 63]; scan; scan = scan->next) {
|
||||||
|
check = &scan->reg;
|
||||||
|
if (!strcmp(scan->reg.name, buf)) {
|
||||||
|
if (cpu == CPUMask_Generic) {
|
||||||
|
if ((cpu & CPUFLAG_LOW_MASK) == ((cpu & CPUFLAG_LOW_MASK) & scan->b))
|
||||||
|
return check;
|
||||||
|
} else {
|
||||||
|
if (scan->b & cpu)
|
||||||
|
return check;
|
||||||
|
}
|
||||||
|
reg = check;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reg) {
|
||||||
|
if (copts.warn_possunwant)
|
||||||
|
PPCError_Warning(117, name);
|
||||||
|
return reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strncmp("spr", buf, 3)) {
|
||||||
|
static IARegister thespr;
|
||||||
|
UInt32 result;
|
||||||
|
Boolean overflow;
|
||||||
|
ScanDec(buf + 3, &result, &overflow);
|
||||||
|
if (overflow || result > 1024) {
|
||||||
|
PPCError_Error(117, name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
thespr.name = NULL;
|
||||||
|
thespr.rclass = RegClass_SPR;
|
||||||
|
thespr.num = result;
|
||||||
|
thespr.object = NULL;
|
||||||
|
|
||||||
|
if (copts.warn_possunwant) {
|
||||||
|
if (cpu == CPUMask_Generic) {
|
||||||
|
if ((cpu & CPUFLAG_LOW_MASK) != ((cpu & CPUFLAG_LOW_MASK) & spr_cpus[result]))
|
||||||
|
PPCError_Warning(117, name);
|
||||||
|
} else {
|
||||||
|
if (!(cpu & spr_cpus[result]))
|
||||||
|
PPCError_Warning(117, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &thespr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IARegister *InlineAsm_LookupDCRRegister(char *name) {
|
||||||
|
RegInfo *scan;
|
||||||
|
IARegister *check;
|
||||||
|
IARegister *reg;
|
||||||
|
char buf[40];
|
||||||
|
|
||||||
|
if (strlen(name) < 40)
|
||||||
|
CToLowercase(name, buf);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
reg = NULL;
|
||||||
|
for (scan = hasheddcrs[CHash(buf) & 63]; scan; scan = scan->next) {
|
||||||
|
check = &scan->reg;
|
||||||
|
if (!strcmp(scan->reg.name, buf)) {
|
||||||
|
if (cpu == CPUMask_Generic) {
|
||||||
|
if ((cpu & CPUFLAG_LOW_MASK) == ((cpu & CPUFLAG_LOW_MASK) & scan->b))
|
||||||
|
return check;
|
||||||
|
} else {
|
||||||
|
if (scan->b & cpu)
|
||||||
|
return check;
|
||||||
|
}
|
||||||
|
reg = check;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reg) {
|
||||||
|
if (copts.warn_possunwant)
|
||||||
|
PPCError_Warning(117, name);
|
||||||
|
return reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strncmp("dcr", buf, 3)) {
|
||||||
|
static IARegister thespr;
|
||||||
|
UInt32 result;
|
||||||
|
Boolean overflow;
|
||||||
|
ScanDec(buf + 3, &result, &overflow);
|
||||||
|
if (overflow || result > 1024) {
|
||||||
|
PPCError_Error(117, name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
thespr.name = NULL;
|
||||||
|
thespr.rclass = RegClass_DCR;
|
||||||
|
thespr.num = result;
|
||||||
|
thespr.object = NULL;
|
||||||
|
return &thespr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineAsm_InitializeRegistersPPC(void) {
|
||||||
|
AsmRegister *asmreg;
|
||||||
|
AsmSpr *asmspr;
|
||||||
|
HashNameNode *name;
|
||||||
|
Object *obj;
|
||||||
|
ObjectList *list;
|
||||||
|
char buf[16];
|
||||||
|
SInt32 i;
|
||||||
|
|
||||||
|
setup_diagnostic_reg_strings();
|
||||||
|
|
||||||
|
for (i = 0; i < 64; i++)
|
||||||
|
hashedsprs[i] = NULL;
|
||||||
|
for (i = 0; i < 64; i++)
|
||||||
|
hasheddcrs[i] = NULL;
|
||||||
|
|
||||||
|
for (asmreg = asm_registers; asmreg->name; asmreg++) {
|
||||||
|
name = GetHashNameNodeExport(asmreg->name);
|
||||||
|
for (list = arguments; list; list = list->next) {
|
||||||
|
obj = list->object;
|
||||||
|
if (obj && obj->name == name) {
|
||||||
|
switch (asmreg->rclass) {
|
||||||
|
case RegClass_SPR:
|
||||||
|
case RegClass_CRFIELD:
|
||||||
|
case RegClass_VR:
|
||||||
|
case RegClass_FPR:
|
||||||
|
case RegClass_GPR:
|
||||||
|
sprintf(buf, register_class_format[asmreg->rclass], asmreg->num);
|
||||||
|
break;
|
||||||
|
case RegClass_6:
|
||||||
|
sprintf(buf, "crbit_%ld", asmreg->num);
|
||||||
|
break;
|
||||||
|
case RegClass_DCR:
|
||||||
|
sprintf(buf, "DCR%ld", asmreg->num);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sprintf(buf, "{?}%ld", asmreg->num);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
PPCError_Warning(100, obj->name->name, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (list = locals; list; list = list->next) {
|
||||||
|
obj = list->object;
|
||||||
|
if (obj && obj->name == name) {
|
||||||
|
switch (asmreg->rclass) {
|
||||||
|
case RegClass_SPR:
|
||||||
|
case RegClass_CRFIELD:
|
||||||
|
case RegClass_VR:
|
||||||
|
case RegClass_FPR:
|
||||||
|
case RegClass_GPR:
|
||||||
|
sprintf(buf, register_class_format[asmreg->rclass], asmreg->num);
|
||||||
|
break;
|
||||||
|
case RegClass_6:
|
||||||
|
sprintf(buf, "crbit_%ld", asmreg->num);
|
||||||
|
break;
|
||||||
|
case RegClass_DCR:
|
||||||
|
sprintf(buf, "DCR%ld", asmreg->num);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sprintf(buf, "{?}%ld", asmreg->num);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
PPCError_Warning(100, obj->name->name, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InlineAsm_InsertRegister(asmreg->name, asmreg->rclass, asmreg->num, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (asmspr = asm_sprs; asmspr->name; asmspr++) {
|
||||||
|
InlineAsm_InsertSPR(asmspr->name, asmspr->num, asmspr->mask);
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,114 @@
|
||||||
|
#include "compiler/IroBitVect.h"
|
||||||
|
#include "compiler/CompilerTools.h"
|
||||||
|
|
||||||
|
void Bv_AllocVector(BitVector **bv, UInt32 size) {
|
||||||
|
UInt32 long_size = (size / 32) + 1;
|
||||||
|
*bv = oalloc(sizeof(BitVector) + sizeof(UInt32) * long_size);
|
||||||
|
(*bv)->size = long_size;
|
||||||
|
Bv_Clear(*bv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bv_AllocVectorLocal(BitVector **bv, UInt32 size) {
|
||||||
|
UInt32 long_size = (size / 32) + 1;
|
||||||
|
*bv = lalloc(sizeof(BitVector) + sizeof(UInt32) * long_size);
|
||||||
|
(*bv)->size = long_size;
|
||||||
|
Bv_Clear(*bv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bv_ClearBit(UInt32 bit, BitVector *bv) {
|
||||||
|
if ((bit / 32) < bv->size) {
|
||||||
|
bv->data[bit / 32] &= ~(1 << (bit & 31));
|
||||||
|
} else {
|
||||||
|
#line 73
|
||||||
|
CError_FATAL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bv_And(const BitVector *a, BitVector *b) {
|
||||||
|
UInt32 i;
|
||||||
|
for (i = 0; i < b->size; i++)
|
||||||
|
b->data[i] &= a->data[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bv_Or(const BitVector *a, BitVector *b) {
|
||||||
|
UInt32 i, len;
|
||||||
|
|
||||||
|
len = a->size;
|
||||||
|
if (b->size < len)
|
||||||
|
len = b->size;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
b->data[i] |= a->data[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean Bv_BitsInCommon(const BitVector *a, const BitVector *b) {
|
||||||
|
UInt32 len;
|
||||||
|
UInt32 i;
|
||||||
|
|
||||||
|
len = a->size;
|
||||||
|
if (b->size < len)
|
||||||
|
len = b->size;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
if (a->data[i] & b->data[i])
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean Bv_Compare(const BitVector *a, const BitVector *b) {
|
||||||
|
UInt32 i;
|
||||||
|
for (i = 0; i < a->size; i++) {
|
||||||
|
if (a->data[i] != b->data[i])
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bv_Minus(const BitVector *a, BitVector *b) {
|
||||||
|
UInt32 i;
|
||||||
|
for (i = 0; i < b->size; i++)
|
||||||
|
b->data[i] &= ~a->data[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bv_Copy(const BitVector *src, BitVector *dst) {
|
||||||
|
memcpy(dst->data, src->data, sizeof(UInt32) * dst->size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bv_Clear(BitVector *bv) {
|
||||||
|
memset(bv->data, 0, sizeof(UInt32) * bv->size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bv_Set(BitVector *bv) {
|
||||||
|
memset(bv->data, 0xFF, sizeof(UInt32) * bv->size);
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean Bv_IsSubset(const BitVector *a, const BitVector *b) {
|
||||||
|
UInt32 i;
|
||||||
|
|
||||||
|
for (i = 0; i < a->size; i++) {
|
||||||
|
if (b->size < i) {
|
||||||
|
if (a->data[i])
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
if (a->data[i] & ~(b->data[i]))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean Bv_IsEmpty(const BitVector *bv) {
|
||||||
|
UInt32 i;
|
||||||
|
|
||||||
|
for (i = 0; i < bv->size; i++) {
|
||||||
|
if (bv->data[i])
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -75,12 +75,12 @@ void indirect(Operand *op, ENode *expr) {
|
||||||
set_op_flags(op, expr);
|
set_op_flags(op, expr);
|
||||||
break;
|
break;
|
||||||
case OpndType_Absolute:
|
case OpndType_Absolute:
|
||||||
if (FITS_IN_SHORT(op->abs_address)) {
|
if (FITS_IN_SHORT(op->immediate)) {
|
||||||
op->reg = 0;
|
op->reg = 0;
|
||||||
op->immOffset = op->abs_address;
|
op->immOffset = op->immediate;
|
||||||
} else {
|
} else {
|
||||||
emitpcode(PC_LIS, op->reg = used_virtual_registers[RegClass_GPR]++, 0, (short) HIGH_PART(op->abs_address));
|
emitpcode(PC_LIS, op->reg = used_virtual_registers[RegClass_GPR]++, 0, (short) HIGH_PART(op->immediate));
|
||||||
op->immOffset = LOW_PART(op->abs_address);
|
op->immOffset = LOW_PART(op->immediate);
|
||||||
}
|
}
|
||||||
op->object = NULL;
|
op->object = NULL;
|
||||||
op->optype = OpndType_IndirectGPR_ImmOffset;
|
op->optype = OpndType_IndirectGPR_ImmOffset;
|
||||||
|
@ -201,27 +201,27 @@ void combine(Operand *opA, Operand *opB, short output_reg, Operand *opOut) {
|
||||||
opOut->reg = opB->reg;
|
opOut->reg = opB->reg;
|
||||||
opOut->immOffset = opB->immOffset;
|
opOut->immOffset = opB->immOffset;
|
||||||
opOut->object = opB->object;
|
opOut->object = opB->object;
|
||||||
if (FITS_IN_SHORT(opOut->immOffset + opA->abs_address)) {
|
if (FITS_IN_SHORT(opOut->immOffset + opA->immediate)) {
|
||||||
opOut->immOffset += opA->abs_address;
|
opOut->immOffset += opA->immediate;
|
||||||
} else {
|
} else {
|
||||||
opOut->reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
opOut->reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
||||||
if (!HIGH_PART(opA->abs_address)) {
|
if (!HIGH_PART(opA->immediate)) {
|
||||||
emitpcode(PC_ADDI, opOut->reg, opB->reg, 0, LOW_PART(opA->abs_address));
|
emitpcode(PC_ADDI, opOut->reg, opB->reg, 0, LOW_PART(opA->immediate));
|
||||||
} else {
|
} else {
|
||||||
emitpcode(PC_ADDIS, opOut->reg, opB->reg, 0, (short) HIGH_PART(opA->abs_address));
|
emitpcode(PC_ADDIS, opOut->reg, opB->reg, 0, (short) HIGH_PART(opA->immediate));
|
||||||
if (FITS_IN_SHORT(opOut->immOffset + LOW_PART(opA->abs_address))) {
|
if (FITS_IN_SHORT(opOut->immOffset + LOW_PART(opA->immediate))) {
|
||||||
opOut->immOffset += LOW_PART(opA->abs_address);
|
opOut->immOffset += LOW_PART(opA->immediate);
|
||||||
} else {
|
} else {
|
||||||
emitpcode(PC_ADDI, opOut->reg, opOut->reg, 0, LOW_PART(opA->abs_address));
|
emitpcode(PC_ADDI, opOut->reg, opOut->reg, 0, LOW_PART(opA->immediate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else if (opB->object->datatype == DLOCAL && can_add_displ_to_local(opB->object, opB->immOffset + opA->abs_address)) {
|
} else if (opB->object->datatype == DLOCAL && can_add_displ_to_local(opB->object, opB->immOffset + opA->immediate)) {
|
||||||
opOut->optype = OpndType_GPR_ImmOffset;
|
opOut->optype = OpndType_GPR_ImmOffset;
|
||||||
opOut->object = opB->object;
|
opOut->object = opB->object;
|
||||||
opOut->reg = opB->reg;
|
opOut->reg = opB->reg;
|
||||||
opOut->immOffset = LOW_PART(opB->immOffset + opA->abs_address);
|
opOut->immOffset = LOW_PART(opB->immOffset + opA->immediate);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
opOut->reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
opOut->reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
||||||
|
@ -237,14 +237,14 @@ void combine(Operand *opA, Operand *opB, short output_reg, Operand *opOut) {
|
||||||
opA = opB;
|
opA = opB;
|
||||||
opB = tmp_op;
|
opB = tmp_op;
|
||||||
case COMBO_OP(OpndType_Absolute, OpndType_GPR):
|
case COMBO_OP(OpndType_Absolute, OpndType_GPR):
|
||||||
opOut->optype = (opA->abs_address != 0) ? OpndType_GPR_ImmOffset : OpndType_GPR;
|
opOut->optype = (opA->immediate != 0) ? OpndType_GPR_ImmOffset : OpndType_GPR;
|
||||||
opOut->immOffset = LOW_PART(opA->abs_address);
|
opOut->immOffset = LOW_PART(opA->immediate);
|
||||||
opOut->object = NULL;
|
opOut->object = NULL;
|
||||||
if (FITS_IN_SHORT(opA->abs_address)) {
|
if (FITS_IN_SHORT(opA->immediate)) {
|
||||||
opOut->reg = opB->reg;
|
opOut->reg = opB->reg;
|
||||||
} else {
|
} else {
|
||||||
opOut->reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
opOut->reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
||||||
emitpcode(PC_ADDIS, opOut->reg, opB->reg, 0, (short) HIGH_PART(opA->abs_address));
|
emitpcode(PC_ADDIS, opOut->reg, opB->reg, 0, (short) HIGH_PART(opA->immediate));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case COMBO_OP(OpndType_GPR_Indexed, OpndType_Absolute):
|
case COMBO_OP(OpndType_GPR_Indexed, OpndType_Absolute):
|
||||||
|
@ -255,17 +255,17 @@ void combine(Operand *opA, Operand *opB, short output_reg, Operand *opOut) {
|
||||||
opOut->optype = OpndType_GPR_Indexed;
|
opOut->optype = OpndType_GPR_Indexed;
|
||||||
opOut->reg = opB->reg;
|
opOut->reg = opB->reg;
|
||||||
opOut->regOffset = (output_reg && (output_reg != opB->reg)) ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
opOut->regOffset = (output_reg && (output_reg != opB->reg)) ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
||||||
if (!HIGH_PART(opA->abs_address)) {
|
if (!HIGH_PART(opA->immediate)) {
|
||||||
emitpcode(PC_ADDI, opOut->regOffset, opB->regOffset, 0, LOW_PART(opA->abs_address));
|
emitpcode(PC_ADDI, opOut->regOffset, opB->regOffset, 0, LOW_PART(opA->immediate));
|
||||||
} else {
|
} else {
|
||||||
emitpcode(PC_ADDIS, opOut->regOffset, opB->regOffset, 0, (short) HIGH_PART(opA->abs_address));
|
emitpcode(PC_ADDIS, opOut->regOffset, opB->regOffset, 0, (short) HIGH_PART(opA->immediate));
|
||||||
if (opA->abs_address != 0)
|
if (opA->immediate != 0)
|
||||||
emitpcode(PC_ADDI, opOut->regOffset, opOut->regOffset, 0, LOW_PART(opA->abs_address));
|
emitpcode(PC_ADDI, opOut->regOffset, opOut->regOffset, 0, LOW_PART(opA->immediate));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case COMBO_OP(OpndType_Absolute, OpndType_Absolute):
|
case COMBO_OP(OpndType_Absolute, OpndType_Absolute):
|
||||||
opOut->optype = OpndType_Absolute;
|
opOut->optype = OpndType_Absolute;
|
||||||
opOut->abs_address = opA->abs_address + opB->abs_address;
|
opOut->immediate = opA->immediate + opB->immediate;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#line 415
|
#line 415
|
||||||
|
@ -344,7 +344,6 @@ void coerce_to_addressable(Operand *op) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Coerce_to_register(Operand *op, Type *type, short output_reg) {
|
|
||||||
SInt32 offset;
|
SInt32 offset;
|
||||||
short opcode;
|
short opcode;
|
||||||
short reg;
|
short reg;
|
||||||
|
@ -375,7 +374,7 @@ void Coerce_to_register(Operand *op, Type *type, short output_reg) {
|
||||||
break;
|
break;
|
||||||
case OpndType_Absolute:
|
case OpndType_Absolute:
|
||||||
reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
||||||
offset = op->abs_address;
|
offset = op->immediate;
|
||||||
if (FITS_IN_SHORT(offset)) {
|
if (FITS_IN_SHORT(offset)) {
|
||||||
emitpcode(PC_LI, reg, offset);
|
emitpcode(PC_LI, reg, offset);
|
||||||
} else {
|
} else {
|
||||||
|
@ -534,7 +533,7 @@ void coerce_to_register_pair(Operand *op, Type *type, short output_reg, short ou
|
||||||
break;
|
break;
|
||||||
case OpndType_Absolute:
|
case OpndType_Absolute:
|
||||||
reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
reg = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++;
|
||||||
offset = op->abs_address;
|
offset = op->immediate;
|
||||||
if (FITS_IN_SHORT(offset)) {
|
if (FITS_IN_SHORT(offset)) {
|
||||||
emitpcode(PC_LI, reg, offset);
|
emitpcode(PC_LI, reg, offset);
|
||||||
} else {
|
} else {
|
||||||
|
@ -648,19 +647,19 @@ void Coerce_to_v_register(Operand *op, TypeStruct *tstruct, short output_reg) {
|
||||||
case STRUCT_TYPE_4:
|
case STRUCT_TYPE_4:
|
||||||
case STRUCT_TYPE_5:
|
case STRUCT_TYPE_5:
|
||||||
case STRUCT_TYPE_6:
|
case STRUCT_TYPE_6:
|
||||||
emitpcode(PC_VSPLTISB, reg, op->abs_address);
|
emitpcode(PC_VSPLTISB, reg, op->immediate);
|
||||||
break;
|
break;
|
||||||
case STRUCT_TYPE_7:
|
case STRUCT_TYPE_7:
|
||||||
case STRUCT_TYPE_8:
|
case STRUCT_TYPE_8:
|
||||||
case STRUCT_TYPE_9:
|
case STRUCT_TYPE_9:
|
||||||
case STRUCT_TYPE_E:
|
case STRUCT_TYPE_E:
|
||||||
emitpcode(PC_VSPLTISH, reg, op->abs_address);
|
emitpcode(PC_VSPLTISH, reg, op->immediate);
|
||||||
break;
|
break;
|
||||||
case STRUCT_TYPE_A:
|
case STRUCT_TYPE_A:
|
||||||
case STRUCT_TYPE_B:
|
case STRUCT_TYPE_B:
|
||||||
case STRUCT_TYPE_C:
|
case STRUCT_TYPE_C:
|
||||||
case STRUCT_TYPE_D:
|
case STRUCT_TYPE_D:
|
||||||
emitpcode(PC_VSPLTISW, reg, op->abs_address);
|
emitpcode(PC_VSPLTISW, reg, op->immediate);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#line 1049
|
#line 1049
|
||||||
|
@ -754,7 +753,7 @@ void store_pair(short reg, short regHi, Operand *op, Type *type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void store_fp(short reg, Operand *op, TypeIntegral *tint) {
|
void store_fp(short reg, Operand *op, Type *tint) {
|
||||||
coerce_to_addressable(op);
|
coerce_to_addressable(op);
|
||||||
switch (op->optype) {
|
switch (op->optype) {
|
||||||
case OpndType_IndirectGPR_ImmOffset:
|
case OpndType_IndirectGPR_ImmOffset:
|
||||||
|
@ -771,7 +770,7 @@ void store_fp(short reg, Operand *op, TypeIntegral *tint) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void store_v(short reg, Operand *op, TypeStruct *tstruct) {
|
void store_v(short reg, Operand *op, Type *tstruct) {
|
||||||
coerce_to_addressable(op);
|
coerce_to_addressable(op);
|
||||||
switch (op->optype) {
|
switch (op->optype) {
|
||||||
case OpndType_IndirectGPR_ImmOffset:
|
case OpndType_IndirectGPR_ImmOffset:
|
||||||
|
@ -880,7 +879,7 @@ void extend64(Operand *op, Type *type, short output_reg, short output_regHi) {
|
||||||
op->regHi = regHi;
|
op->regHi = regHi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_floating_constant(short reg, TypeIntegral *type, double *data) {
|
void load_floating_constant(short reg, Type *type, double *data) {
|
||||||
// do me AFTER
|
// do me AFTER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
#include "compiler.h"
|
|
||||||
#include "compiler/CompilerTools.h"
|
#include "compiler/CompilerTools.h"
|
||||||
|
#include "compiler/CFunc.h"
|
||||||
|
#include "compiler/CodeGen.h"
|
||||||
#include "compiler/PCode.h"
|
#include "compiler/PCode.h"
|
||||||
#include "compiler/PCodeInfo.h"
|
#include "compiler/PCodeInfo.h"
|
||||||
|
|
||||||
|
// TODO: move me
|
||||||
|
extern void initialize_aliases();
|
||||||
|
|
||||||
PCodeBlock *pcbasicblocks;
|
PCodeBlock *pcbasicblocks;
|
||||||
PCodeBlock *pclastblock;
|
PCodeBlock *pclastblock;
|
||||||
void *prologue;
|
PCodeBlock *prologue;
|
||||||
void *epilogue;
|
PCodeBlock *epilogue;
|
||||||
PCodeBlock **depthfirstordering;
|
PCodeBlock **depthfirstordering;
|
||||||
int pcblockcount;
|
int pcblockcount;
|
||||||
int pcloopweight;
|
int pcloopweight;
|
||||||
static unsigned short pclabelcount;
|
static unsigned short pclabelcount;
|
||||||
|
|
||||||
void initpcode() {
|
void initpcode(void) {
|
||||||
pclastblock = 0;
|
pclastblock = 0;
|
||||||
pcbasicblocks = 0;
|
pcbasicblocks = 0;
|
||||||
pcblockcount = 0;
|
pcblockcount = 0;
|
||||||
|
@ -21,7 +25,7 @@ void initpcode() {
|
||||||
initialize_aliases();
|
initialize_aliases();
|
||||||
}
|
}
|
||||||
|
|
||||||
PCode *makepcode(short op, ...) {
|
PCode *makepcode(Opcode op, ...) {
|
||||||
PCode *pcode;
|
PCode *pcode;
|
||||||
va_list list;
|
va_list list;
|
||||||
|
|
||||||
|
@ -31,7 +35,7 @@ PCode *makepcode(short op, ...) {
|
||||||
return pcode;
|
return pcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void emitpcode(short op, ...) {
|
void emitpcode(Opcode op, ...) {
|
||||||
PCode *pcode;
|
PCode *pcode;
|
||||||
va_list list;
|
va_list list;
|
||||||
|
|
||||||
|
@ -67,7 +71,7 @@ PCode *copypcode(PCode *pcode) {
|
||||||
return newpc;
|
return newpc;
|
||||||
}
|
}
|
||||||
|
|
||||||
PCodeLabel *makepclabel() {
|
PCodeLabel *makepclabel(void) {
|
||||||
PCodeLabel *label;
|
PCodeLabel *label;
|
||||||
|
|
||||||
label = (PCodeLabel *) lalloc(sizeof(PCodeLabel));
|
label = (PCodeLabel *) lalloc(sizeof(PCodeLabel));
|
||||||
|
@ -76,7 +80,7 @@ PCodeLabel *makepclabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
PCodeBlock *makepcblock() {
|
PCodeBlock *makepcblock(void) {
|
||||||
PCodeBlock *block;
|
PCodeBlock *block;
|
||||||
|
|
||||||
block = (PCodeBlock *) lalloc(sizeof(PCodeBlock));
|
block = (PCodeBlock *) lalloc(sizeof(PCodeBlock));
|
||||||
|
@ -123,7 +127,7 @@ void pcbranch(PCodeBlock *block, PCodeLabel *label) {
|
||||||
block->successors = link;
|
block->successors = link;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pccomputepredecessors() {
|
void pccomputepredecessors(void) {
|
||||||
PCodeBlock *block;
|
PCodeBlock *block;
|
||||||
PCLink *succ;
|
PCLink *succ;
|
||||||
PCLink *pred;
|
PCLink *pred;
|
||||||
|
@ -147,7 +151,7 @@ void deleteblock(PCodeBlock *block) {
|
||||||
block->flags |= fPCBlockFlag20;
|
block->flags |= fPCBlockFlag20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteunreachableblocks() {
|
void deleteunreachableblocks(void) {
|
||||||
PCodeBlock *block;
|
PCodeBlock *block;
|
||||||
|
|
||||||
computedepthfirstordering();
|
computedepthfirstordering();
|
||||||
|
@ -238,7 +242,7 @@ void clearpcodeflags(int flags) {
|
||||||
pclastblock->lastPCode->flags &= ~flags;
|
pclastblock->lastPCode->flags &= ~flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pccomputeoffsets() {
|
int pccomputeoffsets(void) {
|
||||||
int offset;
|
int offset;
|
||||||
PCodeBlock *block;
|
PCodeBlock *block;
|
||||||
|
|
||||||
|
@ -258,7 +262,7 @@ typedef struct _DFO {
|
||||||
|
|
||||||
static int depthfirstorder;
|
static int depthfirstorder;
|
||||||
|
|
||||||
void computedepthfirstordering() {
|
void computedepthfirstordering(void) {
|
||||||
PCodeBlock *block;
|
PCodeBlock *block;
|
||||||
PCLink *link;
|
PCLink *link;
|
||||||
DFO *dfo;
|
DFO *dfo;
|
||||||
|
|
|
@ -90,7 +90,7 @@ int pcode_check_imm_bits(SInt32 value, int bits, char typechar) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pcode_const_from_format(const char *format, int *pResult) {
|
int pcode_const_from_format(const char *format, SInt32 *pResult) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
#include "compiler/PPCError.h"
|
||||||
|
#include "compiler/CError.h"
|
||||||
|
#include "compiler/CParser.h"
|
||||||
|
#include "compiler/InlineAsm.h"
|
||||||
|
#include "cos.h"
|
||||||
|
|
||||||
|
static void PPCError_GetErrorString(char *str, short code) {
|
||||||
|
short scode;
|
||||||
|
|
||||||
|
scode = (short) code;
|
||||||
|
#line 40
|
||||||
|
CError_ASSERT(scode >= 100 && scode < 212);
|
||||||
|
|
||||||
|
COS_GetString(str, 10001, scode - 99);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PPCError_VAErrorMessage(int code, va_list list, Boolean flag1, Boolean flag2) {
|
||||||
|
char format[256];
|
||||||
|
PPCError_GetErrorString(format, code);
|
||||||
|
CError_ErrorMessageVA(code + 10001, format, list, flag1, flag2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PPCError_Error(int code, ...) {
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
if (trychain)
|
||||||
|
longjmp(trychain->jmpbuf, 1);
|
||||||
|
|
||||||
|
va_start(list, code);
|
||||||
|
PPCError_VAErrorMessage(code, list, 0, 0);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
if (in_assembler)
|
||||||
|
AssemblerError();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PPCError_Warning(int code, ...) {
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
if (!trychain) {
|
||||||
|
va_start(list, code);
|
||||||
|
PPCError_VAErrorMessage(code, list, 0, 1);
|
||||||
|
va_end(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PPCError_Message(char *format, ...) {
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
if (!trychain) {
|
||||||
|
va_start(list, format);
|
||||||
|
CError_ErrorMessageVA(10213, format, list, 0, 1);
|
||||||
|
va_end(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PPCError_ErrorTerm(short code, ...) {
|
||||||
|
va_list list;
|
||||||
|
|
||||||
|
if (trychain)
|
||||||
|
longjmp(trychain->jmpbuf, 1);
|
||||||
|
|
||||||
|
va_start(list, code);
|
||||||
|
PPCError_VAErrorMessage(code, list, 1, 0);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
if (in_assembler)
|
||||||
|
AssemblerError();
|
||||||
|
|
||||||
|
longjmp(errorreturn, 1);
|
||||||
|
}
|
|
@ -1,7 +1,11 @@
|
||||||
#include "compiler.h"
|
#include "compiler/RegisterInfo.h"
|
||||||
|
#include "compiler/CodeGen.h"
|
||||||
#include "compiler/CError.h"
|
#include "compiler/CError.h"
|
||||||
#include "compiler/objects.h"
|
#include "compiler/CParser.h"
|
||||||
#include "compiler/PCode.h"
|
#include "compiler/PCode.h"
|
||||||
|
#include "compiler/CompilerTools.h"
|
||||||
|
#include "compiler/objects.h"
|
||||||
|
#include "compiler/types.h"
|
||||||
|
|
||||||
short last_exception_register[RegClassMax];
|
short last_exception_register[RegClassMax];
|
||||||
short first_fe_temporary_register[RegClassMax];
|
short first_fe_temporary_register[RegClassMax];
|
||||||
|
@ -12,8 +16,6 @@ char *special_register_names[RegClassMax][RegisterMax];
|
||||||
static short used_regs_before_coloring;
|
static short used_regs_before_coloring;
|
||||||
static UInt8 save_state[RegisterMax];
|
static UInt8 save_state[RegisterMax];
|
||||||
|
|
||||||
char *XXspecial_register_names[RegClassMax * RegisterMax];
|
|
||||||
|
|
||||||
short spr_to_sysreg[4] = {1, 8, 9, 0x100};
|
short spr_to_sysreg[4] = {1, 8, 9, 0x100};
|
||||||
|
|
||||||
void asm_used_register(char rclass, short reg) {
|
void asm_used_register(char rclass, short reg) {
|
||||||
|
@ -104,7 +106,7 @@ static int first_nonvolatile_reg(char rclass) {
|
||||||
return GetABIFirstNonVolatile(rclass);
|
return GetABIFirstNonVolatile(rclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_diagnostic_reg_strings() {
|
void setup_diagnostic_reg_strings(void) {
|
||||||
register_class_name[RegClass_SPR] = "SPR";
|
register_class_name[RegClass_SPR] = "SPR";
|
||||||
register_class_format[RegClass_SPR] = "spr%ld";
|
register_class_format[RegClass_SPR] = "spr%ld";
|
||||||
register_class_name[RegClass_CRFIELD] = "CRFIELD";
|
register_class_name[RegClass_CRFIELD] = "CRFIELD";
|
||||||
|
@ -117,7 +119,7 @@ void setup_diagnostic_reg_strings() {
|
||||||
register_class_format[RegClass_GPR] = "r%ld";
|
register_class_format[RegClass_GPR] = "r%ld";
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_target_registers() {
|
void init_target_registers(void) {
|
||||||
char rclass;
|
char rclass;
|
||||||
int reg;
|
int reg;
|
||||||
int end;
|
int end;
|
||||||
|
@ -244,7 +246,7 @@ void assign_GPR_pair(Object *obj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_fe_temp_registers() {
|
void open_fe_temp_registers(void) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = used_virtual_registers[RegClass_GPR];
|
r = used_virtual_registers[RegClass_GPR];
|
||||||
|
@ -258,13 +260,13 @@ void open_fe_temp_registers() {
|
||||||
//first_fe_temporary_register[RegClass_VR] = last_temporary_register[RegClass_VR] = used_virtual_registers[RegClass_VR];
|
//first_fe_temporary_register[RegClass_VR] = last_temporary_register[RegClass_VR] = used_virtual_registers[RegClass_VR];
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_last_exception_registers() {
|
void set_last_exception_registers(void) {
|
||||||
last_exception_register[RegClass_GPR] = used_virtual_registers[RegClass_GPR] - 1;
|
last_exception_register[RegClass_GPR] = used_virtual_registers[RegClass_GPR] - 1;
|
||||||
last_exception_register[RegClass_FPR] = used_virtual_registers[RegClass_FPR] - 1;
|
last_exception_register[RegClass_FPR] = used_virtual_registers[RegClass_FPR] - 1;
|
||||||
last_exception_register[RegClass_VR] = used_virtual_registers[RegClass_VR] - 1;
|
last_exception_register[RegClass_VR] = used_virtual_registers[RegClass_VR] - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VarInfo *Registers_GetNewVarInfo() {
|
static VarInfo *Registers_GetNewVarInfo(void) {
|
||||||
VarInfo *vi = galloc(sizeof(VarInfo));
|
VarInfo *vi = galloc(sizeof(VarInfo));
|
||||||
memclrw(vi, sizeof(VarInfo));
|
memclrw(vi, sizeof(VarInfo));
|
||||||
return vi;
|
return vi;
|
||||||
|
@ -302,7 +304,7 @@ VarInfo *Registers_GetVarInfo(Object *obj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int used_vrstate_VRs() {
|
int used_vrstate_VRs(void) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < RegisterMax; i++) {
|
for (i = 0; i < RegisterMax; i++) {
|
||||||
|
@ -318,9 +320,9 @@ UInt32 colored_vrs_as_vrsave(PCodeBlock *block) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
mask = 0;
|
mask = 0;
|
||||||
if (copts.x1B == 2)
|
if (copts.altivec_vrsave == 2)
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
if (copts.x1B == 0)
|
if (copts.altivec_vrsave == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (block) {
|
while (block) {
|
||||||
|
@ -359,7 +361,7 @@ int is_nonvolatile_register(char rclass, int reg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_endian() {
|
void init_endian(void) {
|
||||||
if (copts.little_endian) {
|
if (copts.little_endian) {
|
||||||
high_offset = 4;
|
high_offset = 4;
|
||||||
low_offset = 0;
|
low_offset = 0;
|
||||||
|
@ -377,7 +379,7 @@ void init_endian() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_asm_nonvolatile_registers() {
|
void update_asm_nonvolatile_registers(void) {
|
||||||
char rclass;
|
char rclass;
|
||||||
int r31;
|
int r31;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#include "compiler.h"
|
#include "compiler/Registers.h"
|
||||||
#include "compiler/objects.h"
|
#include "compiler/RegisterInfo.h"
|
||||||
|
#include "compiler/CParser.h"
|
||||||
#include "compiler/PCode.h"
|
#include "compiler/PCode.h"
|
||||||
|
#include "compiler/CompilerTools.h"
|
||||||
|
#include "compiler/objects.h"
|
||||||
|
|
||||||
// haven't checked this object file for .data stuff yet
|
// haven't checked this object file for .data stuff yet
|
||||||
|
|
||||||
|
@ -30,7 +33,7 @@ typedef struct ModifiedRegisters {
|
||||||
} ModifiedRegisters;
|
} ModifiedRegisters;
|
||||||
static ModifiedRegisters *mod_regs_table[128];
|
static ModifiedRegisters *mod_regs_table[128];
|
||||||
|
|
||||||
void init_registers() {
|
void init_registers(void) {
|
||||||
char rclass;
|
char rclass;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
@ -117,7 +120,7 @@ short obtain_nonvolatile_register(char rclass) {
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_temp_registers() {
|
void open_temp_registers(void) {
|
||||||
int rclass;
|
int rclass;
|
||||||
|
|
||||||
for (rclass = 0; (char)rclass < RegClassMax; rclass++) {
|
for (rclass = 0; (char)rclass < RegClassMax; rclass++) {
|
||||||
|
@ -135,7 +138,7 @@ void open_temp_registers() {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_temp_registers() {
|
void check_temp_registers(void) {
|
||||||
char rclass;
|
char rclass;
|
||||||
|
|
||||||
if (!optimizing) {
|
if (!optimizing) {
|
||||||
|
@ -148,7 +151,7 @@ void check_temp_registers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void close_temp_registers() {
|
void close_temp_registers(void) {
|
||||||
char rclass;
|
char rclass;
|
||||||
|
|
||||||
for (rclass = 0; rclass < RegClassMax; rclass++) {
|
for (rclass = 0; rclass < RegClassMax; rclass++) {
|
||||||
|
@ -159,7 +162,7 @@ void close_temp_registers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int count_scratch_registers() {
|
int count_scratch_registers(void) {
|
||||||
int rclass;
|
int rclass;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
|
@ -169,7 +172,7 @@ int count_scratch_registers() {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_modified_registers() {
|
void init_modified_registers(void) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (i = 0; i < 128; i++)
|
for (i = 0; i < 128; i++)
|
||||||
|
|
|
@ -64,7 +64,7 @@ static void save_nonvolatile_GPRs(int reg, SInt32 offset);
|
||||||
static void restore_nonvolatile_GPRs(int reg, SInt32 offset);
|
static void restore_nonvolatile_GPRs(int reg, SInt32 offset);
|
||||||
static void do_allocate_dynamic_stack_space(Boolean flag1, int reg1, int reg2, SInt32 size);
|
static void do_allocate_dynamic_stack_space(Boolean flag1, int reg1, int reg2, SInt32 size);
|
||||||
|
|
||||||
void init_stack_globals(void) {
|
void init_stack_globals(Object *funcobj) {
|
||||||
char rclass;
|
char rclass;
|
||||||
UInt8 oclass;
|
UInt8 oclass;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ void init_stack_globals(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_frame_sizes(void) {
|
void init_frame_sizes(Boolean has_varargs) {
|
||||||
ObjectList *scan;
|
ObjectList *scan;
|
||||||
Object *obj;
|
Object *obj;
|
||||||
SInt32 r30;
|
SInt32 r30;
|
||||||
|
@ -326,7 +326,7 @@ static void allocate_new_frame(int reg1, int reg2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_prologue(PCodeBlock *block) {
|
void generate_prologue(PCodeBlock *block, Boolean has_varargs) {
|
||||||
PCodeBlock *save_block;
|
PCodeBlock *save_block;
|
||||||
Boolean needs_lr;
|
Boolean needs_lr;
|
||||||
Statement *save_statement;
|
Statement *save_statement;
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
#include "compiler/Switch.h"
|
||||||
|
#include "compiler/CError.h"
|
||||||
|
#include "compiler/CFunc.h"
|
||||||
|
#include "compiler/CInt64.h"
|
||||||
|
#include "compiler/objects.h"
|
||||||
|
#include "compiler/CParser.h"
|
||||||
|
#include "compiler/PCode.h"
|
||||||
|
|
||||||
|
ObjectList *switchtables;
|
||||||
|
static void *caselabels;
|
||||||
|
static void *caseranges;
|
||||||
|
static SInt32 ncases;
|
||||||
|
static SInt32 nranges_minus1;
|
||||||
|
static CInt64 min;
|
||||||
|
static CInt64 max;
|
||||||
|
static CInt64 first;
|
||||||
|
static short selector_gpr;
|
||||||
|
static short selector_gprHi;
|
||||||
|
static Type *selector_type;
|
||||||
|
static PCodeLabel *defaultlabel;
|
||||||
|
static CInt64 range;
|
||||||
|
|
||||||
|
static void compare_cases() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void build_case_ranges(Type *type, SwitchCase *cases, CLabel *label) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void treecompare() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I8_treecompare() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void generate_tree(ENode *expr) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void create_switch_table() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void generate_table(ENode *expr, SwitchInfo *info) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void switchstatement(ENode *expr, SwitchInfo *info) {
|
||||||
|
Boolean use_table;
|
||||||
|
SwitchCase *swcase;
|
||||||
|
|
||||||
|
use_table = copts.switch_tables;
|
||||||
|
|
||||||
|
ncases = 0;
|
||||||
|
for (swcase = info->cases; swcase; swcase = swcase->next) {
|
||||||
|
if (!swcase->label->pclabel)
|
||||||
|
swcase->label->pclabel = makepclabel();
|
||||||
|
ncases++;
|
||||||
|
}
|
||||||
|
|
||||||
|
#line 656
|
||||||
|
CError_ASSERT(ncases >= 0 && ncases <= 0x3333332);
|
||||||
|
|
||||||
|
if (!info->defaultlabel->pclabel)
|
||||||
|
info->defaultlabel->pclabel = makepclabel();
|
||||||
|
defaultlabel = info->defaultlabel->pclabel;
|
||||||
|
|
||||||
|
build_case_ranges(expr->rtype, info->cases, info->defaultlabel);
|
||||||
|
|
||||||
|
if (TYPE_IS_8BYTES(expr->rtype)) {
|
||||||
|
generate_tree(expr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!use_table || nranges_minus1 < 8 || (nranges_minus1 * 2) < ((range.lo / 1) + 4))
|
||||||
|
generate_tree(expr);
|
||||||
|
else
|
||||||
|
generate_table(expr, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dumpswitchtables(Object *funcobj) {
|
||||||
|
}
|
|
@ -1,15 +1,21 @@
|
||||||
#include "cos.h"
|
#include "cos.h"
|
||||||
#include "compiler/TOC.h"
|
#include "compiler/TOC.h"
|
||||||
|
#include "compiler/CDecl.h"
|
||||||
#include "compiler/CError.h"
|
#include "compiler/CError.h"
|
||||||
#include "compiler/CInt64.h"
|
#include "compiler/CInt64.h"
|
||||||
|
#include "compiler/CFunc.h"
|
||||||
|
#include "compiler/CMachine.h"
|
||||||
|
#include "compiler/CMangler.h"
|
||||||
|
#include "compiler/CParser.h"
|
||||||
|
#include "compiler/CodeGen.h"
|
||||||
#include "compiler/Operands.h"
|
#include "compiler/Operands.h"
|
||||||
#include "compiler/PCode.h"
|
#include "compiler/PCode.h"
|
||||||
#include "compiler/PCodeInfo.h"
|
#include "compiler/PCodeInfo.h"
|
||||||
#include "compiler/StackFrame.h"
|
#include "compiler/StackFrame.h"
|
||||||
|
#include "compiler/CompilerTools.h"
|
||||||
#include "compiler/enode.h"
|
#include "compiler/enode.h"
|
||||||
#include "compiler/objects.h"
|
#include "compiler/objects.h"
|
||||||
#include "compiler/types.h"
|
#include "compiler/types.h"
|
||||||
#include "compiler.h"
|
|
||||||
|
|
||||||
ObjectList *toclist;
|
ObjectList *toclist;
|
||||||
ObjectList *exceptionlist;
|
ObjectList *exceptionlist;
|
||||||
|
|
|
@ -32,113 +32,6 @@ struct InlineXRef {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum ExceptionActionType {
|
|
||||||
EAT_NOP,
|
|
||||||
EAT_DESTROYLOCAL,
|
|
||||||
EAT_DESTROYLOCALCOND,
|
|
||||||
EAT_DESTROYLOCALOFFSET,
|
|
||||||
EAT_DESTROYLOCALPOINTER,
|
|
||||||
EAT_DESTROYLOCALARRAY,
|
|
||||||
EAT_DESTROYPARTIALARRAY,
|
|
||||||
EAT_DESTROYMEMBER,
|
|
||||||
EAT_DESTROYMEMBERCOND,
|
|
||||||
EAT_DESTROYMEMBERARRAY,
|
|
||||||
EAT_DELETEPOINTER,
|
|
||||||
EAT_DELETELOCALPOINTER,
|
|
||||||
EAT_DELETEPOINTERCOND,
|
|
||||||
EAT_CATCHBLOCK,
|
|
||||||
EAT_ACTIVECATCHBLOCK,
|
|
||||||
EAT_SPECIFICATION,
|
|
||||||
EAT_TERMINATE,
|
|
||||||
EAT_DESTROYBASE,
|
|
||||||
EAT_NACTIONS
|
|
||||||
} ExceptionActionType;
|
|
||||||
|
|
||||||
struct ExceptionAction {
|
|
||||||
ExceptionAction *prev;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
Object *local;
|
|
||||||
Object *dtor;
|
|
||||||
} destroy_local;
|
|
||||||
struct {
|
|
||||||
Object *local;
|
|
||||||
Object *cond;
|
|
||||||
Object *dtor;
|
|
||||||
} destroy_local_cond;
|
|
||||||
struct {
|
|
||||||
Object *local;
|
|
||||||
Object *dtor;
|
|
||||||
SInt32 offset;
|
|
||||||
} destroy_local_offset;
|
|
||||||
struct {
|
|
||||||
Object *pointer;
|
|
||||||
Object *dtor;
|
|
||||||
} destroy_local_pointer;
|
|
||||||
struct {
|
|
||||||
Object *localarray;
|
|
||||||
Object *dtor;
|
|
||||||
SInt32 elements;
|
|
||||||
SInt32 element_size;
|
|
||||||
} destroy_local_array;
|
|
||||||
struct {
|
|
||||||
Object *arraypointer;
|
|
||||||
Object *arraycounter;
|
|
||||||
Object *dtor;
|
|
||||||
Object *element_size;
|
|
||||||
} destroy_partial_array;
|
|
||||||
struct {
|
|
||||||
Object *objectptr;
|
|
||||||
Object *dtor;
|
|
||||||
SInt32 offset;
|
|
||||||
} destroy_member;
|
|
||||||
struct {
|
|
||||||
Object *objectptr;
|
|
||||||
Object *cond;
|
|
||||||
Object *dtor;
|
|
||||||
SInt32 offset;
|
|
||||||
} destroy_member_cond;
|
|
||||||
struct {
|
|
||||||
Object *objectptr;
|
|
||||||
Object *dtor;
|
|
||||||
SInt32 offset;
|
|
||||||
SInt32 elements;
|
|
||||||
SInt32 element_size;
|
|
||||||
} destroy_member_array;
|
|
||||||
struct {
|
|
||||||
Object *pointerobject;
|
|
||||||
Object *deletefunc;
|
|
||||||
} delete_pointer;
|
|
||||||
struct {
|
|
||||||
Object *pointerobject;
|
|
||||||
Object *deletefunc;
|
|
||||||
Object *cond;
|
|
||||||
} delete_pointer_cond;
|
|
||||||
struct {
|
|
||||||
Object *catch_object;
|
|
||||||
Object *catch_info_object;
|
|
||||||
CLabel *catch_label;
|
|
||||||
Object *catch_typeid;
|
|
||||||
Type *catch_type;
|
|
||||||
UInt32 catch_qual;
|
|
||||||
} catch_block;
|
|
||||||
struct {
|
|
||||||
Object *catch_info_object;
|
|
||||||
Boolean call_dtor;
|
|
||||||
} active_catch_block;
|
|
||||||
struct {
|
|
||||||
SInt32 unexp_ids;
|
|
||||||
Object **unexp_id;
|
|
||||||
CLabel *unexp_label;
|
|
||||||
Object *unexp_info_object;
|
|
||||||
} specification;
|
|
||||||
struct {
|
|
||||||
Object *object;
|
|
||||||
Boolean is_dep;
|
|
||||||
} local;
|
|
||||||
} data;
|
|
||||||
ExceptionActionType type;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MemInitializer {
|
struct MemInitializer {
|
||||||
MemInitializer *next;
|
MemInitializer *next;
|
||||||
|
@ -211,89 +104,8 @@ typedef struct Substitution {
|
||||||
} Substitution;
|
} Substitution;
|
||||||
|
|
||||||
// Registers.c
|
// Registers.c
|
||||||
enum {
|
|
||||||
RegisterMax = 32
|
|
||||||
};
|
|
||||||
const char RegClass_SPR = 0;
|
|
||||||
const char RegClass_CRFIELD = 1;
|
|
||||||
const char RegClass_VR = 2;
|
|
||||||
const char RegClass_FPR = 3;
|
|
||||||
const char RegClass_GPR = 4;
|
|
||||||
const char RegClassMax = 5;
|
|
||||||
/*enum RegClass {
|
|
||||||
RegClass_SPR,
|
|
||||||
RegClass_CRFIELD,
|
|
||||||
RegClass_VR,
|
|
||||||
RegClass_FPR,
|
|
||||||
RegClass_GPR,
|
|
||||||
RegClassMax
|
|
||||||
};*/
|
|
||||||
|
|
||||||
enum {
|
|
||||||
RegState0 = 0,
|
|
||||||
RegState1 = 1,
|
|
||||||
RegState2 = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
extern int used_virtual_registers[RegClassMax];
|
|
||||||
extern int used_nonvolatile_registers[RegClassMax];
|
|
||||||
extern int assignable_registers[RegClassMax];
|
|
||||||
extern int n_real_registers[RegClassMax];
|
|
||||||
extern int n_scratch_registers[RegClassMax];
|
|
||||||
extern int scratch_registers[RegClassMax][RegisterMax];
|
|
||||||
extern int n_nonvolatile_registers[RegClassMax];
|
|
||||||
extern int nonvolatile_registers[RegClassMax][RegisterMax];
|
|
||||||
extern UInt8 reg_state[RegClassMax][RegisterMax];
|
|
||||||
extern int first_temporary_register[RegClassMax];
|
|
||||||
extern int last_temporary_register[RegClassMax];
|
|
||||||
extern char *register_class_name[RegClassMax];
|
|
||||||
extern char *register_class_format[RegClassMax];
|
|
||||||
extern int coloring;
|
|
||||||
extern int optimizing;
|
|
||||||
|
|
||||||
extern void init_registers();
|
|
||||||
extern void assign_register_to_variable(Object *obj, char rclass);
|
|
||||||
extern void retain_register_for_argument(Object *obj, char rclass, short reg);
|
|
||||||
extern int available_registers(char rclass);
|
|
||||||
extern UInt32 volatile_registers(char rclass);
|
|
||||||
extern short obtain_nonvolatile_register(char rclass);
|
|
||||||
extern void open_temp_registers();
|
|
||||||
extern void check_temp_registers();
|
|
||||||
extern void close_temp_registers();
|
|
||||||
extern int count_scratch_registers();
|
|
||||||
extern void init_modified_registers();
|
|
||||||
extern void note_modified_registers(Object *obj);
|
|
||||||
extern void find_modified_registers(Object *obj, UInt32 *masks);
|
|
||||||
|
|
||||||
// RegisterInfo.c
|
// RegisterInfo.c
|
||||||
extern short last_exception_register[RegClassMax];
|
|
||||||
extern short first_fe_temporary_register[RegClassMax];
|
|
||||||
extern short last_argument_register[RegClassMax];
|
|
||||||
extern short _FP_;
|
|
||||||
extern short _CALLER_SP_;
|
|
||||||
extern char *special_register_names[RegClassMax][RegisterMax];
|
|
||||||
extern short spr_to_sysreg[4];
|
|
||||||
|
|
||||||
extern void asm_used_register(char rclass, short reg);
|
|
||||||
extern void retain_register(Object *obj, char rclass, short reg);
|
|
||||||
extern void retain_GPR_pair(Object *obj, short reg, short regHi);
|
|
||||||
extern int is_register_object(Object *obj);
|
|
||||||
extern int GetABIFirstNonVolatile(char rclass);
|
|
||||||
extern char GetRegisterClassName(char rclass);
|
|
||||||
extern void setup_diagnostic_reg_strings();
|
|
||||||
extern void init_target_registers();
|
|
||||||
extern void assign_register_by_type(Object *obj);
|
|
||||||
extern void assign_GPR_pair(Object *obj);
|
|
||||||
extern void open_fe_temp_registers();
|
|
||||||
extern void set_last_exception_registers();
|
|
||||||
extern VarInfo *Registers_GetVarInfo(Object *obj);
|
|
||||||
extern int used_vrstate_VRs();
|
|
||||||
extern UInt32 colored_vrs_as_vrsave(PCodeBlock *block);
|
|
||||||
extern void save_before_coloring_nonvolatile_registers(char rclass);
|
|
||||||
extern void reset_nonvolatile_registers(char rclass);
|
|
||||||
extern int is_nonvolatile_register(char rclass, int reg);
|
|
||||||
extern void init_endian();
|
|
||||||
extern void update_asm_nonvolatile_registers();
|
|
||||||
|
|
||||||
// LOOSE DECLS
|
// LOOSE DECLS
|
||||||
extern short high_offset;
|
extern short high_offset;
|
||||||
|
@ -453,42 +265,8 @@ enum {
|
||||||
INTRINSIC_36 = 36
|
INTRINSIC_36 = 36
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
CPU_PPC401,
|
|
||||||
CPU_PPC403,
|
|
||||||
CPU_PPC505,
|
|
||||||
CPU_PPC509,
|
|
||||||
CPU_PPC555,
|
|
||||||
CPU_PPC601,
|
|
||||||
CPU_PPC602,
|
|
||||||
CPU_PPC603,
|
|
||||||
CPU_PPC603e,
|
|
||||||
CPU_PPC604,
|
|
||||||
CPU_PPC604e,
|
|
||||||
CPU_PPC740,
|
|
||||||
CPU_PPC750,
|
|
||||||
CPU_PPC801,
|
|
||||||
CPU_PPC821,
|
|
||||||
CPU_PPC823,
|
|
||||||
CPU_PPC850,
|
|
||||||
CPU_PPC860,
|
|
||||||
CPU_PPC8240,
|
|
||||||
CPU_PPC8260,
|
|
||||||
CPU_PPC7400 = 0x15,
|
|
||||||
CPU_PPCGEKKO,
|
|
||||||
CPU_PPCELF,
|
|
||||||
CPU_PPC7450,
|
|
||||||
CPU_PPC556,
|
|
||||||
CPU_PPC565
|
|
||||||
};
|
|
||||||
|
|
||||||
extern char *ScanFloat(char *input, double *output, Boolean *fail);
|
extern char *ScanFloat(char *input, double *output, Boolean *fail);
|
||||||
|
|
||||||
#define FITS_IN_SHORT(value) ( (value) == ((short) (value)) )
|
|
||||||
// should HIGH_PART have (short) around it?
|
|
||||||
#define HIGH_PART(value) ( (((value) >> 16) + (((value) & 0x8000) >> 15)) )
|
|
||||||
#define LOW_PART(value) ( (short) (value) )
|
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
#pragma options align=reset
|
#pragma options align=reset
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef COMPILER_ADDPROPAGATION_H
|
||||||
|
#define COMPILER_ADDPROPAGATION_H
|
||||||
|
|
||||||
|
#include "compiler/common.h"
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef COMPILER_ALIAS_H
|
||||||
|
#define COMPILER_ALIAS_H
|
||||||
|
|
||||||
|
#include "compiler/common.h"
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef COMPILER_BITVECTORS_H
|
||||||
|
#define COMPILER_BITVECTORS_H
|
||||||
|
|
||||||
|
#include "compiler/common.h"
|
||||||
|
|
||||||
|
#endif
|
|
@ -8,7 +8,7 @@
|
||||||
#pragma options align=mac68k
|
#pragma options align=mac68k
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern short CABI_GetStructResultArgumentIndex(void);
|
extern short CABI_GetStructResultArgumentIndex(TypeFunc *tfunc);
|
||||||
extern Type *CABI_GetSizeTType(void);
|
extern Type *CABI_GetSizeTType(void);
|
||||||
extern Type *CABI_GetPtrDiffTType(void);
|
extern Type *CABI_GetPtrDiffTType(void);
|
||||||
extern SInt16 CABI_StructSizeAlignValue(Type *type, SInt32 size);
|
extern SInt16 CABI_StructSizeAlignValue(Type *type, SInt32 size);
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef COMPILER_CBROWSE_H
|
||||||
|
#define COMPILER_CBROWSE_H
|
||||||
|
|
||||||
|
#include "compiler/common.h"
|
||||||
|
|
||||||
|
#endif
|
|
@ -25,7 +25,7 @@ extern ENode *CClass_DefaultConstructorCall(TypeClass *a, TypeClass *b, ENode *e
|
||||||
extern Object *CClass_AssignmentOperator(TypeClass *tclass);
|
extern Object *CClass_AssignmentOperator(TypeClass *tclass);
|
||||||
extern Object *CClass_CopyConstructor(TypeClass *tclass);
|
extern Object *CClass_CopyConstructor(TypeClass *tclass);
|
||||||
extern NameSpaceObjectList *CClass_MemberObject(TypeClass *tclass, HashNameNode *name);
|
extern NameSpaceObjectList *CClass_MemberObject(TypeClass *tclass, HashNameNode *name);
|
||||||
extern Object *CClass_Constructor(TypeClass *tclass);
|
extern NameSpaceObjectList *CClass_Constructor(TypeClass *tclass);
|
||||||
extern Object *CClass_Destructor(TypeClass *tclass);
|
extern Object *CClass_Destructor(TypeClass *tclass);
|
||||||
extern Boolean CClass_IsConstructor(Object *obj);
|
extern Boolean CClass_IsConstructor(Object *obj);
|
||||||
extern Boolean CClass_IsDestructor(Object *obj);
|
extern Boolean CClass_IsDestructor(Object *obj);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef COMPILER_CCOMPILER_H
|
||||||
|
#define COMPILER_CCOMPILER_H
|
||||||
|
|
||||||
|
#include "compiler/common.h"
|
||||||
|
|
||||||
|
extern Boolean systemHandles;
|
||||||
|
extern Boolean crippled;
|
||||||
|
extern SInt32 license_cookie;
|
||||||
|
extern CParams cparams;
|
||||||
|
|
||||||
|
extern CWPLUGIN_ENTRY(MWC_main)(CWPluginContext context);
|
||||||
|
extern void PrintProgressFunction(const char *str);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef COMPILER_CEXCEPTION_H
|
||||||
|
#define COMPILER_CEXCEPTION_H
|
||||||
|
|
||||||
|
#include "compiler/common.h"
|
||||||
|
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue