getting closer

This commit is contained in:
Ash Wolf 2023-01-11 22:29:53 +00:00
parent aec1b8dddc
commit 0bec4f557a
133 changed files with 10146 additions and 3285 deletions

View File

@ -145,6 +145,7 @@ add_executable(mwcc
compiler_and_linker/unsorted/StructMoves.c compiler_and_linker/unsorted/StructMoves.c
compiler_and_linker/unsorted/FunctionCalls.c compiler_and_linker/unsorted/FunctionCalls.c
compiler_and_linker/unsorted/IroBitVect.c compiler_and_linker/unsorted/IroBitVect.c
compiler_and_linker/unsorted/OpcodeInfo.c
compiler_and_linker/unsorted/InlineAsmRegistersPPC.c compiler_and_linker/unsorted/InlineAsmRegistersPPC.c
compiler_and_linker/unsorted/InlineAsmMnemonicsPPC.c compiler_and_linker/unsorted/InlineAsmMnemonicsPPC.c
compiler_and_linker/unsorted/InlineAsmRegisters.c compiler_and_linker/unsorted/InlineAsmRegisters.c
@ -159,8 +160,15 @@ add_executable(mwcc
compiler_and_linker/unsorted/UseDefChains.c compiler_and_linker/unsorted/UseDefChains.c
compiler_and_linker/unsorted/LoadDeletion.c compiler_and_linker/unsorted/LoadDeletion.c
compiler_and_linker/unsorted/VectorArraysToRegs.c compiler_and_linker/unsorted/VectorArraysToRegs.c
compiler_and_linker/unsorted/LiveInfo.c compiler_and_linker/unsorted/LiveVariables.c
compiler_and_linker/unsorted/MachineSimulation604.c
compiler_and_linker/unsorted/MachineSimulation603.c
compiler_and_linker/unsorted/MachineSimulationAltiVec.c
compiler_and_linker/unsorted/MachineSimulation7400.c
compiler_and_linker/unsorted/MachineSimulation603e.c
compiler_and_linker/unsorted/MachineSimulation750.c
compiler_and_linker/unsorted/MachineSimulation601.c
compiler_and_linker/unsorted/MachineSimulation821.c
compiler_and_linker/unsorted/InterferenceGraph.c compiler_and_linker/unsorted/InterferenceGraph.c
compiler_and_linker/unsorted/SpillCode.c compiler_and_linker/unsorted/SpillCode.c
compiler_and_linker/unsorted/GCCInlineAsm.c compiler_and_linker/unsorted/GCCInlineAsm.c

View File

@ -55,7 +55,7 @@ int SetWarningFlags(const char *opt, void *str, const char *, int flags) {
return 1; return 1;
} }
int DisplayWarningOptions() { int DisplayWarningOptions(const char *, void *, const char *, int) {
Handle h; Handle h;
h = NewHandle(0); h = NewHandle(0);

View File

@ -273,11 +273,11 @@ int Deps_ChangeSpecialAccessPath(OSSpec *srcfss, Boolean initialize) {
return 1; return 1;
} }
Path *Deps_GetSpecialAccessPath() { Path *Deps_GetSpecialAccessPath(void) {
return specialAccessPath; return specialAccessPath;
} }
static void SetSpecialAccessPathFromIncludeStackTOS() { static void SetSpecialAccessPathFromIncludeStackTOS(void) {
// does not match, some registers are in the wrong order // does not match, some registers are in the wrong order
OSSpec spec; OSSpec spec;
SInt16 index; SInt16 index;

View File

@ -460,7 +460,7 @@ static int CompileEntry(File *file, Boolean *compiled) {
return 1; return 1;
} }
static void DumpFileAndPathInfo() { static void DumpFileAndPathInfo(void) {
int i; int i;
int n; int n;
@ -583,7 +583,7 @@ static void DumpFileAndPathInfo() {
} }
} }
int CompileFilesInProject() { int CompileFilesInProject(void) {
struct BuildInfo *tinfo; struct BuildInfo *tinfo;
SInt32 index; SInt32 index;
SInt32 startTime; SInt32 startTime;
@ -679,7 +679,7 @@ int CompileFilesInProject() {
return CheckForUserBreak() ? Result_Cancelled : Result_Success; return CheckForUserBreak() ? Result_Cancelled : Result_Success;
} }
static int PostLinkFilesInProject() { static int PostLinkFilesInProject(void) {
SInt32 index; SInt32 index;
SInt32 startTime; SInt32 startTime;
SInt32 endTime; SInt32 endTime;
@ -709,7 +709,7 @@ static int PostLinkFilesInProject() {
return CheckForUserBreak() ? Result_Cancelled : Result_Success; return CheckForUserBreak() ? Result_Cancelled : Result_Success;
} }
int LinkProject() { int LinkProject(void) {
SInt32 startTime; SInt32 startTime;
SInt32 endTime; SInt32 endTime;

View File

@ -19,7 +19,7 @@ static CacheEntry *cachelist;
static CacheEntry *freelist; static CacheEntry *freelist;
static UInt32 availablecache; static UInt32 availablecache;
static CacheEntry *makecacheentry() { static CacheEntry *makecacheentry(void) {
CacheEntry *c = freelist; CacheEntry *c = freelist;
if (c) { if (c) {
freelist = c->next; freelist = c->next;
@ -46,13 +46,13 @@ static void deletecacheentry(CacheEntry *c) {
cachelist = c->next; cachelist = c->next;
} }
void InitializeIncludeCache() { void InitializeIncludeCache(void) {
freelist = NULL; freelist = NULL;
cachelist = NULL; cachelist = NULL;
availablecache = CACHE_SIZE; availablecache = CACHE_SIZE;
} }
void CleanupIncludeCache() { void CleanupIncludeCache(void) {
CacheEntry *c; CacheEntry *c;
CacheEntry *c1; CacheEntry *c1;

View File

@ -1,23 +1,22 @@
#include "cmdline.h" #include "cmdline.h"
void License_Initialize() { void License_Initialize(void) {
} }
void License_Terminate() { void License_Terminate(void) {
} }
SInt32 License_Checkout() { SInt32 License_Checkout(void) {
return 0xD0AD0A; return 0xD0AD0A;
} }
void License_Refresh() { void License_Refresh() {
// unknown args
} }
void License_Checkin() { void License_Checkin() {
// unknown args
} }
void License_AutoCheckin() { void License_AutoCheckin(void) {
} }

View File

@ -117,13 +117,13 @@ static BasePluginCallbacks clcb = {
CLT_GetFileTypeMappings CLT_GetFileTypeMappings
}; };
static int RegisterStaticCmdLinePlugin() { static int RegisterStaticCmdLinePlugin(void) {
return RegisterStaticPlugin(&clcb); return RegisterStaticPlugin(&clcb);
} }
#include "command_line/CmdLine/Project/Resources/CLErrors.r" #include "command_line/CmdLine/Project/Resources/CLErrors.r"
static int RegisterCmdLineResources() { static int RegisterCmdLineResources(void) {
return RegisterResource("Command-line strings", 12000, STR12000); return RegisterResource("Command-line strings", 12000, STR12000);
} }
@ -278,7 +278,7 @@ int Main_Terminate(int exitcode) {
return exitcode; return exitcode;
} }
static int Main_ParseCommandLine() { static int Main_ParseCommandLine(void) {
Plugin *parser; Plugin *parser;
CWCommandLineArgs myargs; CWCommandLineArgs myargs;
int x, y; int x, y;
@ -337,7 +337,7 @@ static int Main_ParseCommandLine() {
return Result_Success; return Result_Success;
} }
static int Main_SetupParamBlock() { static int Main_SetupParamBlock(void) {
PrefPanelsChangedCallback(0); PrefPanelsChangedCallback(0);
if (optsCompiler.outMakefile[0]) { if (optsCompiler.outMakefile[0]) {
@ -362,7 +362,7 @@ static int Main_SetupParamBlock() {
return 0; return 0;
} }
static int Main_ResolveProject() { static int Main_ResolveProject(void) {
SInt32 startTime; SInt32 startTime;
SInt32 endTime; SInt32 endTime;
int err; int err;
@ -562,7 +562,7 @@ static int UpdatePrefPanels(const char *name) {
return 1; return 1;
} }
static int SetupCmdLinePrefPanels() { static int SetupCmdLinePrefPanels(void) {
int ret; int ret;
PrefPanelsChangedCallback = UpdatePrefPanels; PrefPanelsChangedCallback = UpdatePrefPanels;
@ -578,7 +578,7 @@ static int SetupCmdLinePrefPanels() {
return ret; return ret;
} }
static int Main_SetupContext() { static int Main_SetupContext(void) {
gTarg = Target_New("default", clState.cpu, clState.os, clState.language); gTarg = Target_New("default", clState.cpu, clState.os, clState.language);
Target_Add(&gProj->targets, gTarg); Target_Add(&gProj->targets, gTarg);
@ -622,7 +622,7 @@ static int Main_SetupContext() {
return 1; return 1;
} }
int Main_Driver() { int Main_Driver(void) {
volatile int result; volatile int result;
result = setjmp(exit_program); result = setjmp(exit_program);

View File

@ -78,11 +78,11 @@ int PrefPanel_PutHandle(PrefPanel *panel, Handle data) {
return 1; return 1;
} }
void Prefs_Initialize() { void Prefs_Initialize(void) {
panellist = NULL; panellist = NULL;
} }
void Prefs_Terminate() { void Prefs_Terminate(void) {
PrefPanel *scan; PrefPanel *scan;
PrefPanel *next; PrefPanel *next;

View File

@ -100,7 +100,7 @@ static int SetupLinkerCommandLine(SInt32 dropinflags, File *file, CWCommandLineA
return 1; return 1;
} }
int SetupTemporaries() { int SetupTemporaries(void) {
SInt32 idx; SInt32 idx;
File *file; File *file;
@ -117,7 +117,7 @@ int SetupTemporaries() {
return 1; return 1;
} }
int DeleteTemporaries() { int DeleteTemporaries(void) {
SInt32 idx; SInt32 idx;
File *file; File *file;

View File

@ -48,7 +48,7 @@ int CmdLine_Initialize(int argc, char **argv, const char *builddate, const char
return Main_Initialize(argc, argv); return Main_Initialize(argc, argv);
} }
int CmdLine_Driver() { int CmdLine_Driver(void) {
return Main_Driver(); return Main_Driver();
} }

View File

@ -24,7 +24,7 @@ static void catchinterrupt() {
clState.userBreak = 1; clState.userBreak = 1;
} }
static void SetupConsoleInfo() { static void SetupConsoleInfo(void) {
struct winsize ws; struct winsize ws;
struct stat st; struct stat st;
@ -57,11 +57,11 @@ static void Crash() {
*((unsigned char *) NULL) = 0; *((unsigned char *) NULL) = 0;
} }
void SetupDebuggingTraps() { void SetupDebuggingTraps(void) {
signal(SIGABRT, Crash); signal(SIGABRT, Crash);
} }
Boolean IO_Initialize() { Boolean IO_Initialize(void) {
ioPiping = 0; ioPiping = 0;
ioInHelp = 0; ioInHelp = 0;
ioLineNum = 0; ioLineNum = 0;
@ -79,19 +79,19 @@ Boolean IO_Initialize() {
return 1; return 1;
} }
Boolean IO_Terminate() { Boolean IO_Terminate(void) {
if (ioInHelp) if (ioInHelp)
IO_HelpTerminate(); IO_HelpTerminate();
TermWorking(); TermWorking();
return 1; return 1;
} }
Boolean IO_HelpInitialize() { Boolean IO_HelpInitialize(void) {
ioInHelp = 1; ioInHelp = 1;
return 1; return 1;
} }
Boolean IO_HelpTerminate() { Boolean IO_HelpTerminate(void) {
ioInHelp = 0; ioInHelp = 0;
return 1; return 1;
} }
@ -229,13 +229,13 @@ Boolean AppendHandleToFile(OSSpec *spec, Handle text, UInt32 size, CWDataType ma
return 1; return 1;
} }
void InitWorking() { void InitWorking(void) {
} }
void ShowWorking(int x) { void ShowWorking(int x) {
} }
void TermWorking() { void TermWorking(void) {
} }
static void ProgressFunction(const char *functionname) { static void ProgressFunction(const char *functionname) {
@ -243,7 +243,7 @@ static void ProgressFunction(const char *functionname) {
CLReport(7, functionname); CLReport(7, functionname);
} }
Boolean CheckForUserBreak() { Boolean CheckForUserBreak(void) {
ShowWorking(4); ShowWorking(4);
return clState.userBreak; return clState.userBreak;
} }

View File

@ -2,15 +2,15 @@
static OSErr memErr; static OSErr memErr;
UInt32 LMGetTicks() { UInt32 LMGetTicks(void) {
return (OS_GetMilliseconds() * 60) / 1000; return (OS_GetMilliseconds() * 60) / 1000;
} }
UInt32 LMGetTime() { UInt32 LMGetTime(void) {
return OS_GetMilliseconds() / 1000; return OS_GetMilliseconds() / 1000;
} }
OSErr LMGetMemErr() { OSErr LMGetMemErr(void) {
return memErr; return memErr;
} }

View File

@ -49,7 +49,7 @@ void OS_DestroyMacHandle(Handle h, OSHandle *ret) {
free(h); free(h);
} }
OSErr MemError() { OSErr MemError(void) {
return memError; return memError;
} }
@ -257,10 +257,10 @@ void DebugStr(ConstStringPtr str) {
fprintf(stderr, "%*.*s", str[0], str[0], &str[1]); fprintf(stderr, "%*.*s", str[0], str[0], &str[1]);
} }
struct Zone *HandleZone() { struct Zone *HandleZone(void) {
return 0; return NULL;
} }
struct Zone *ApplicationZone() { struct Zone *ApplicationZone(void) {
return 0; return NULL;
} }

View File

@ -8,7 +8,7 @@ typedef struct {
static Res rlist[16]; static Res rlist[16];
void Res_Initialize() { void Res_Initialize(void) {
memset(rlist, 0, sizeof(rlist)); memset(rlist, 0, sizeof(rlist));
} }
@ -64,5 +64,5 @@ const char *Res_GetResource(SInt16 rsrcid, SInt16 index) {
return 0; return 0;
} }
void Res_Cleanup() { void Res_Cleanup(void) {
} }

View File

@ -105,7 +105,7 @@ static Boolean UseResourceForkInfo;
// Forward declarations // Forward declarations
static void ReadResourceFork(SInt16 ref, SInt8 permission, void *file_data, SInt32 file_size); static void ReadResourceFork(SInt16 ref, SInt8 permission, void *file_data, SInt32 file_size);
Boolean OS_UsingMacResourceForkInfo() { Boolean OS_UsingMacResourceForkInfo(void) {
return UseResourceForkInfo; return UseResourceForkInfo;
} }
@ -1186,7 +1186,7 @@ OSErr HOpenRF(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName, SInt8 permi
} }
} }
OSErr InitResources() { OSErr InitResources(void) {
MemRsrcMap *map; MemRsrcMap *map;
map = maplist; map = maplist;
@ -1201,7 +1201,7 @@ OSErr InitResources() {
return 0; return 0;
} }
OSErr ResError() { OSErr ResError(void) {
return resError; return resError;
} }
@ -1289,7 +1289,7 @@ OSErr HOpenResFile(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName, SInt8
return FSpOpenResFile(&fss, permission); return FSpOpenResFile(&fss, permission);
} }
SInt16 CurResFile() { SInt16 CurResFile(void) {
return cur_res_file; return cur_res_file;
} }
@ -1570,7 +1570,7 @@ Handle Get1IndResource(OSType theType, SInt16 index) {
} }
} }
SInt16 Count1Types() { SInt16 Count1Types(void) {
MemRsrcMap *rm; MemRsrcMap *rm;
MemRsrcTypeList *rtl; MemRsrcTypeList *rtl;
SInt16 count; SInt16 count;
@ -1667,6 +1667,6 @@ SInt16 GetResFileAttrs(SInt16) {
} }
} }
Boolean LMGetResLoad() { Boolean LMGetResLoad(void) {
return 1; return 1;
} }

View File

@ -22,7 +22,7 @@ SInt16 CharacterByteType(Ptr textBuf, SInt16 textOffset, ScriptCode script) {
return 0; return 0;
} }
SInt16 CharByte() { SInt16 CharByte(void) {
return 0; return 0;
} }

View File

@ -48,7 +48,7 @@ int OS_InitProgram(int *pArgc, char ***pArgv) {
return 0; return 0;
} }
int OS_TermProgram() { int OS_TermProgram(void) {
return 0; return 0;
} }
@ -767,7 +767,7 @@ int OS_CloseDir(OSOpenedDir *ref) {
return 0; return 0;
} }
UInt32 OS_GetMilliseconds() { UInt32 OS_GetMilliseconds(void) {
struct tms tms; struct tms tms;
return times(&tms) * 1000 / CLOCKS_PER_SEC; return times(&tms) * 1000 / CLOCKS_PER_SEC;
} }

View File

@ -5,11 +5,11 @@ static ToolVersionInfo toolVersionInfo;
static VersionInfo toolVersion; static VersionInfo toolVersion;
static Boolean useToolVersion; static Boolean useToolVersion;
static void GetToolVersionInfo() { static void GetToolVersionInfo(void) {
useToolVersion = 0; useToolVersion = 0;
} }
const ToolVersionInfo *Plugin_GetToolVersionInfo() { const ToolVersionInfo *Plugin_GetToolVersionInfo(void) {
return useToolVersion ? &toolVersionInfo : 0; return useToolVersion ? &toolVersionInfo : 0;
} }
@ -480,12 +480,12 @@ Boolean Plugin_VerifyPanels(Plugin *pl) {
} }
} }
void Plugins_Init() { void Plugins_Init(void) {
pluginlist = NULL; pluginlist = NULL;
GetToolVersionInfo(); GetToolVersionInfo();
} }
void Plugins_Term() { void Plugins_Term(void) {
Plugin *scan; Plugin *scan;
Plugin *next; Plugin *next;

View File

@ -451,7 +451,7 @@ int Frameworks_AddFramework(const char *name, const char *version, Boolean hidde
return 0; return 0;
} }
void Framework_GetEnvInfo() { void Framework_GetEnvInfo(void) {
char path[256]; char path[256];
char *env; char *env;
char *ptr; char *ptr;
@ -513,7 +513,7 @@ void Framework_GetEnvInfo() {
} }
} }
int Frameworks_GetCount() { int Frameworks_GetCount(void) {
return FrameworkInfo.fwsCount; return FrameworkInfo.fwsCount;
} }

View File

@ -1,6 +1,6 @@
#include "cmdline.h" #include "cmdline.h"
File *File_New() { File *File_New(void) {
File *file; File *file;
file = xmalloc(NULL, sizeof(File)); file = xmalloc(NULL, sizeof(File));
if (!file) { if (!file) {

View File

@ -21,16 +21,16 @@ int TargetSetWarningFlags(short val, Boolean set) {
case 'Uv': pWarningC.warn_unusedvar = set; break; case 'Uv': pWarningC.warn_unusedvar = set; break;
case 'Ua': pWarningC.warn_unusedarg = set; break; case 'Ua': pWarningC.warn_unusedarg = set; break;
case 'Ec': pWarningC.warn_extracomma = set; break; case 'Ec': pWarningC.warn_extracomma = set; break;
case 'Pe': pWarningC.pedantic = set; break; case 'Pd': pWarningC.pedantic = set; break;
case 'Hv': pWarningC.warn_hidevirtual = set; break; case 'Hv': pWarningC.warn_hidevirtual = set; break;
case 'Ic': pWarningC.warn_implicitconv = set; break; case 'Ic': pWarningC.warn_implicitconv = set; break;
case 'Ni': pWarningC.warn_notinlined = set; break; case 'Ni': pWarningC.warn_notinlined = set; break;
case 'Sc': pWarningC.warn_structclass = set; break; case 'Sc': pWarningC.warn_structclass = set; break;
case 'Pa': pExtraWarningC.warn_padding = set ? 1 : 2; break; case 'Pa': pExtraWarningC.warn_padding = set ? PR_ON : PR_OFF; break;
case 'Nu': pExtraWarningC.warn_resultnotused = set ? 1 : 2; break; case 'Nu': pExtraWarningC.warn_resultnotused = set ? PR_ON : PR_OFF; break;
case 'Se': pExtraWarningC.warn_no_side_effect = set ? 1 : 2; break; case 'Se': pExtraWarningC.warn_no_side_effect = set ? PR_ON : PR_OFF; break;
case 'PI': pExtraWarningC.warn_ptr_int_conv = set ? 1 : 2; break; case 'PI': pExtraWarningC.warn_ptr_int_conv = set ? PR_ON : PR_OFF; break;
case 'La': pExtraWarningC.warn_largeargs = set ? 1 : 2; break; case 'La': pExtraWarningC.warn_largeargs = set ? PR_ON : PR_OFF; break;
case 'We': pWarningC.warningerrors = set; break; case 'We': pWarningC.warningerrors = set; break;
case 'Cp': pFrontEndC.checkprotos = set; break; case 'Cp': pFrontEndC.checkprotos = set; break;
default: return 0; default: return 0;
@ -64,15 +64,15 @@ void TargetDisplayWarningOptions(Handle txt) {
HPrintF(txt, "\t- 'inline' not performed\n"); HPrintF(txt, "\t- 'inline' not performed\n");
if (pWarningC.warn_structclass) if (pWarningC.warn_structclass)
HPrintF(txt, "\t- struct/class conflict\n"); HPrintF(txt, "\t- struct/class conflict\n");
if (pExtraWarningC.warn_largeargs) if (pExtraWarningC.warn_largeargs == 1)
HPrintF(txt, "\t- large args passed to unprototyped functions\n"); HPrintF(txt, "\t- large args passed to unprototyped functions\n");
if (pExtraWarningC.warn_padding) if (pExtraWarningC.warn_padding == 1)
HPrintF(txt, "\t- padding added between struct members\n"); HPrintF(txt, "\t- padding added between struct members\n");
if (pExtraWarningC.warn_resultnotused) if (pExtraWarningC.warn_resultnotused == 1)
HPrintF(txt, "\t- result of non-void function call not used\n"); HPrintF(txt, "\t- result of non-void function call not used\n");
if (pExtraWarningC.warn_no_side_effect) if (pExtraWarningC.warn_no_side_effect == 1)
HPrintF(txt, "\t- use of expressions as statements without side effects\n"); HPrintF(txt, "\t- use of expressions as statements without side effects\n");
if (pExtraWarningC.warn_ptr_int_conv) if (pExtraWarningC.warn_ptr_int_conv == 1)
HPrintF(txt, "\t- implicit integer/pointer conversions\n"); HPrintF(txt, "\t- implicit integer/pointer conversions\n");
if (pFrontEndC.checkprotos) if (pFrontEndC.checkprotos)
HPrintF(txt, "\t- checking prototypes\n"); HPrintF(txt, "\t- checking prototypes\n");

View File

@ -85,7 +85,7 @@ CWPLUGIN_ENTRY (CWPlugin_GetPanelList)(const CWPanelList **panelList) {
} }
static CWPLUGIN_ENTRY (CmdLine_GetObjectFlags)(const CWObjectFlags **objectFlags) { static CWPLUGIN_ENTRY (CmdLine_GetObjectFlags)(const CWObjectFlags **objectFlags) {
static const CWObjectFlags sFlags = { static const CWObjectFlags myFlags = {
2, 2,
0x80000000, 0x80000000,
".o", ".o",
@ -101,7 +101,7 @@ static CWPLUGIN_ENTRY (CmdLine_GetObjectFlags)(const CWObjectFlags **objectFlags
CWFOURCHAR('C','W','I','E'), CWFOURCHAR('T','E','X','T') CWFOURCHAR('C','W','I','E'), CWFOURCHAR('T','E','X','T')
}; };
*objectFlags = &sFlags; *objectFlags = &myFlags;
return 0; return 0;
} }
@ -361,8 +361,7 @@ static const char *STR10000[] = {
"possible unwanted ';'", "possible unwanted ';'",
"possible unwanted assignment", "possible unwanted assignment",
"possible unwanted compare", "possible unwanted compare",
"illegal implicit conversion from '%t' to", "illegal implicit conversion from '%t' to\n'%t'",
"'%t'",
"local data >32k", "local data >32k",
"illegal jump past initializer", "illegal jump past initializer",
"illegal ctor initializer", "illegal ctor initializer",
@ -370,12 +369,10 @@ static const char *STR10000[] = {
"cannot construct %t's direct member '%u'", "cannot construct %t's direct member '%u'",
"#if nesting overflow", "#if nesting overflow",
"illegal empty declaration", "illegal empty declaration",
"illegal implicit enum conversion from '%t' to", "illegal implicit enum conversion from '%t' to\n'%t'",
"'%t'",
"illegal use of #pragma parameter", "illegal use of #pragma parameter",
"virtual functions cannot be pascal functions", "virtual functions cannot be pascal functions",
"illegal implicit const/volatile pointer conversion from '%t' to", "illegal implicit const/volatile pointer conversion from '%t' to\n'%t'",
"'%t'",
"illegal use of non-static member", "illegal use of non-static member",
"illegal precompiled header version", "illegal precompiled header version",
"illegal precompiled header compiler flags or target", "illegal precompiled header compiler flags or target",
@ -399,23 +396,14 @@ static const char *STR10000[] = {
"illegal constructor/destructor declaration", "illegal constructor/destructor declaration",
"'catch' expected", "'catch' expected",
"#include nesting overflow", "#include nesting overflow",
"cannot convert", "cannot convert\n'%t' to\n'%t'",
"'%t' to", "type mismatch\n'%t' and\n'%t'",
"'%t'",
"type mismatch",
"'%t' and",
"'%t'",
"class type expected", "class type expected",
"illegal explicit conversion from '%t' to", "illegal explicit conversion from '%t' to\n'%t'",
"'%t'",
"function call '*' does not match", "function call '*' does not match",
"identifier '%u' redeclared", "identifier '%u' redeclared\nwas declared as: '%t'\nnow declared as: '%t'",
"was declared as: '%t'",
"now declared as: '%t'",
"cannot throw class with ambiguous base class ('%u')", "cannot throw class with ambiguous base class ('%u')",
"class '%t': '%o' has more than one final overrider:", "class '%t': '%o' has more than one final overrider:\n'%o'\nand '%o'",
"'%o'",
"and '%o'",
"exception handling option is disabled", "exception handling option is disabled",
"cannot delete pointer to const", "cannot delete pointer to const",
"cannot destroy const object", "cannot destroy const object",
@ -469,9 +457,7 @@ static const char *STR10000[] = {
"illegal use of 'super'", "illegal use of 'super'",
"illegal message receiver", "illegal message receiver",
"receiver cannot handle this message", "receiver cannot handle this message",
"ambiguous message selector", "ambiguous message selector\nused: '%m'\nalso had: '%m'",
"used: '%m'",
"also had: '%m'",
"unknown message selector", "unknown message selector",
"illegal use of Objective-C object", "illegal use of Objective-C object",
"protocol '%u' redefined", "protocol '%u' redefined",

View File

@ -94,7 +94,7 @@ static CWPLUGIN_ENTRY (PPCLibImport_GetFileTypeMappings)(const OSFileTypeMapping
} }
static CWPLUGIN_ENTRY (PPCLibImport_GetObjectFlags)(const CWObjectFlags **objectFlags) { static CWPLUGIN_ENTRY (PPCLibImport_GetObjectFlags)(const CWObjectFlags **objectFlags) {
static const CWObjectFlags sFlags = { static const CWObjectFlags myFlags = {
2, 2,
0, 0,
NULL, NULL,
@ -110,7 +110,7 @@ static CWPLUGIN_ENTRY (PPCLibImport_GetObjectFlags)(const CWObjectFlags **object
0, 0 0, 0
}; };
*objectFlags = &sFlags; *objectFlags = &myFlags;
return 0; return 0;
} }

File diff suppressed because it is too large Load Diff

View File

@ -91,7 +91,7 @@ loop:
for (;;) { for (;;) {
if (!(c = *(p++))) { if (!(c = *(p++))) {
if (tokenstacklevel > 0 || p >= (StringPtr) prep_file_end) { if (tokenstacklevel > 0 || p >= (StringPtr) prep_file_end) {
CPrep_Error(103); CPrep_Error(CErrorStr103);
nextcharpos = (char *) p - 1; nextcharpos = (char *) p - 1;
return c; return c;
} }
@ -235,7 +235,7 @@ loop:
if (!(c = *(p++))) { if (!(c = *(p++))) {
if (tokenstacklevel > 0 || p >= (StringPtr) prep_file_end) { if (tokenstacklevel > 0 || p >= (StringPtr) prep_file_end) {
pos = (char *) p - 1; pos = (char *) p - 1;
CPrep_Error(103); CPrep_Error(CErrorStr103);
return c; return c;
} }
p[-1] = ' '; p[-1] = ' ';
@ -411,12 +411,12 @@ void CPrep_MatchChar(char ch, Boolean flag) {
loop: loop:
if (!(c = *(p++))) { if (!(c = *(p++))) {
if (tokenstacklevel > 0 || p >= prep_file_end) if (tokenstacklevel > 0 || p >= prep_file_end)
CPrep_Error(102); CPrep_Error(CErrorStr102);
else if (ch == '"') else if (ch == '"')
CPrep_Error(101); CPrep_Error(CErrorStr101);
else if (ch == '\'') else if (ch == '\'')
CPrep_Error(100); CPrep_Error(CErrorStr100);
CPrep_Error(117); CPrep_Error(CErrorStr117);
pos = p - 1; pos = p - 1;
return; return;
} }
@ -427,7 +427,7 @@ loop:
foundnl(); foundnl();
if (*p == '\n') if (*p == '\n')
p++; p++;
CPrep_Error(112); CPrep_Error(CErrorStr112);
pos = p; pos = p;
return; return;
} }
@ -487,12 +487,12 @@ char *CPrep_MatchChar2(char *start, char ch, Boolean flag) {
loop: loop:
if (!(c = *(p++))) { if (!(c = *(p++))) {
if (tokenstacklevel > 0 || p >= prep_file_end) if (tokenstacklevel > 0 || p >= prep_file_end)
CPrep_Error(102); CPrep_Error(CErrorStr102);
else if (ch == '"') else if (ch == '"')
CPrep_Error(101); CPrep_Error(CErrorStr101);
else if (ch == '\'') else if (ch == '\'')
CPrep_Error(100); CPrep_Error(CErrorStr100);
CPrep_Error(117); CPrep_Error(CErrorStr117);
return p - 1; return p - 1;
} }
@ -502,7 +502,7 @@ loop:
foundnl(); foundnl();
if (*p == '\n') if (*p == '\n')
p++; p++;
CPrep_Error(112); CPrep_Error(CErrorStr112);
return p; return p;
} }
haveBackslash = 0; haveBackslash = 0;
@ -700,7 +700,7 @@ static short intsuffix(short token, Boolean flag) {
} }
if ((t >= 'a' && t <= 'z') || (t >= 'A' && t <= 'Z') || (t == '_') || (t >= '0' && t <= '9')) if ((t >= 'a' && t <= 'z') || (t >= 'A' && t <= 'Z') || (t == '_') || (t >= '0' && t <= '9'))
CPrep_Error(105); CPrep_Error(CErrorStr105);
if (!is_longlong && !is_long) { if (!is_longlong && !is_long) {
if (!is_unsigned && CInt64_IsInRange(tkintconst, stsignedint.size)) if (!is_unsigned && CInt64_IsInRange(tkintconst, stsignedint.size))
@ -720,7 +720,7 @@ static short intsuffix(short token, Boolean flag) {
if (CInt64_IsInURange(tkintconst, stsignedlonglong.size)) if (CInt64_IsInURange(tkintconst, stsignedlonglong.size))
return IT_ULONGLONG; return IT_ULONGLONG;
} }
CError_Error(154); CError_Error(CErrorStr154);
tkintconst = cint64_zero; tkintconst = cint64_zero;
return IT_INT; return IT_INT;
} }
@ -766,7 +766,7 @@ static short floatsuffix(short token) {
} }
if ((token >= 'a' && token <= 'z') || (token >= 'A' && token <= 'Z') || (token == '_') || (token >= '0' && token <= '9')) { if ((token >= 'a' && token <= 'z') || (token >= 'A' && token <= 'Z') || (token == '_') || (token >= '0' && token <= '9')) {
CPrep_Error(105); CPrep_Error(CErrorStr105);
whichtype = IT_DOUBLE; whichtype = IT_DOUBLE;
} }
@ -819,7 +819,7 @@ static SInt32 nextchar(StringPtr str) {
case 'x': case 'x':
chr = tohex(prepnextstringchar(str, 1)); chr = tohex(prepnextstringchar(str, 1));
if (chr == -1) { if (chr == -1) {
CPrep_Error(100); CPrep_Error(CErrorStr100);
return ' '; return ' ';
} }
out_of_bounds = 0; out_of_bounds = 0;
@ -830,7 +830,7 @@ static SInt32 nextchar(StringPtr str) {
out_of_bounds = 1; out_of_bounds = 1;
} }
if (out_of_bounds) if (out_of_bounds)
CError_Error(100); CError_Error(CErrorStr100);
break; break;
default: default:
if (t >= '0' && t <= '7') { if (t >= '0' && t <= '7') {
@ -845,7 +845,7 @@ static SInt32 nextchar(StringPtr str) {
i++; i++;
} }
if (out_of_bounds) if (out_of_bounds)
CError_Error(100); CError_Error(CErrorStr100);
} else { } else {
chr = t; chr = t;
} }
@ -1018,7 +1018,7 @@ void skipendofline(void) {
if ((ch = *(p++)) == 0) { if ((ch = *(p++)) == 0) {
if (tokenstacklevel > 0 || p >= (StringPtr) prep_file_end) { if (tokenstacklevel > 0 || p >= (StringPtr) prep_file_end) {
pos = (char *) p - 1; pos = (char *) p - 1;
CPrep_Error(103); CPrep_Error(CErrorStr103);
return; return;
} }
p[-1] = ' '; p[-1] = ' ';
@ -1084,12 +1084,12 @@ void CPrep_SkipAsmComment(void) {
macrocheck = save_macrocheck; macrocheck = save_macrocheck;
} }
static short tille(void) { return TK_NEG6; } static short tille(void) { return TK_ILLEGAL; }
static short tcret(void) { static short tcret(void) {
newline(); newline();
if (cprep_eoltokens) if (cprep_eoltokens)
return TK_NEG7; return TK_EOL;
else else
return 0; return 0;
} }
@ -1107,7 +1107,7 @@ static short tapos(short _t) {
start = (StringPtr) pos; start = (StringPtr) pos;
t = nextchar((StringPtr) pos); t = nextchar((StringPtr) pos);
if ((t == '\'' || t == 0 || t == '\r') && !was_escchar) { if ((t == '\'' || t == 0 || t == '\r') && !was_escchar) {
CPrep_Error(100); CPrep_Error(CErrorStr100);
tkintconst = cint64_zero; tkintconst = cint64_zero;
tksize = IT_INT; tksize = IT_INT;
return TK_INTCONST; return TK_INTCONST;
@ -1170,7 +1170,7 @@ static short tapos(short _t) {
while (1) { while (1) {
if ((t2 == 0 || t2 == '\r') && !was_escchar) { if ((t2 == 0 || t2 == '\r') && !was_escchar) {
CPrep_Error(100); CPrep_Error(CErrorStr100);
break; break;
} }
@ -1183,7 +1183,7 @@ static short tapos(short _t) {
break; break;
if (i >= stunsignedlonglong.size) { if (i >= stunsignedlonglong.size) {
CPrep_Error(100); CPrep_Error(CErrorStr100);
break; break;
} }
} }
@ -1237,9 +1237,9 @@ static short tquot(short t) {
c = nextchar(start_pos); c = nextchar(start_pos);
if ((c == '"' || c == '\r' || c == 0) && !was_escchar) { if ((c == '"' || c == '\r' || c == 0) && !was_escchar) {
if (c == 0 && (tokenstacklevel > 0 || pos >= prep_file_end)) if (c == 0 && (tokenstacklevel > 0 || pos >= prep_file_end))
CPrep_Error(102); CPrep_Error(CErrorStr102);
else if (c != '"') else if (c != '"')
CPrep_Error(101); CPrep_Error(CErrorStr101);
break; break;
} }
if ((size + type->size) >= maxstringsize) { if ((size + type->size) >= maxstringsize) {
@ -1262,7 +1262,7 @@ static short tquot(short t) {
if (ispascalstring) { if (ispascalstring) {
if (size > 255 && type->size == 1) { if (size > 255 && type->size == 1) {
CPrep_Error(106); CPrep_Error(CErrorStr106);
size = 255; size = 255;
} }
CInt64_SetLong(&ch64, size / type->size); CInt64_SetLong(&ch64, size / type->size);
@ -1571,7 +1571,7 @@ static short tzero(short t) {
case 'e': case 'e':
pos = CMach_FloatScan(p, &tkfloatconst, &floatFailed); pos = CMach_FloatScan(p, &tkfloatconst, &floatFailed);
if (floatFailed) if (floatFailed)
CPrep_Error(154); CPrep_Error(CErrorStr154);
tksize = floatsuffix(prepcurchar()); tksize = floatsuffix(prepcurchar());
return TK_FLOATCONST; return TK_FLOATCONST;
} }
@ -1580,7 +1580,7 @@ static short tzero(short t) {
} }
if (failed) { if (failed) {
CPrep_Error(154); CPrep_Error(CErrorStr154);
tkintconst = cint64_zero; tkintconst = cint64_zero;
} }
@ -1601,7 +1601,7 @@ static short tpoin(void) {
if (ch >= '0' && ch <= '9') { if (ch >= '0' && ch <= '9') {
pos = CMach_FloatScan(p, &tkfloatconst, &failed); pos = CMach_FloatScan(p, &tkfloatconst, &failed);
if (failed) if (failed)
CPrep_Error(154); CPrep_Error(CErrorStr154);
tksize = floatsuffix(prepcurchar()); tksize = floatsuffix(prepcurchar());
return TK_FLOATCONST; return TK_FLOATCONST;
} }
@ -1631,13 +1631,13 @@ static short tnumb(short t) {
if (ch == '.' || ch == 'e' || ch == 'E') { if (ch == '.' || ch == 'e' || ch == 'E') {
pos = CMach_FloatScan(p, &tkfloatconst, &floatFailed); pos = CMach_FloatScan(p, &tkfloatconst, &floatFailed);
if (floatFailed) if (floatFailed)
CPrep_Error(154); CPrep_Error(CErrorStr154);
tksize = floatsuffix(prepcurchar()); tksize = floatsuffix(prepcurchar());
return TK_FLOATCONST; return TK_FLOATCONST;
} }
if (failed) { if (failed) {
CPrep_Error(154); CPrep_Error(CErrorStr154);
tkintconst = cint64_zero; tkintconst = cint64_zero;
} }
@ -1744,12 +1744,12 @@ static short tchrc(void) {
if (copts.cplusplus) { if (copts.cplusplus) {
if (!strcmp("const_cast", tkidentifier->name)) { if (!strcmp("const_cast", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_CONST_CAST; return TK_CONST_CAST;
} }
if (!strcmp("catch", tkidentifier->name)) { if (!strcmp("catch", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_CATCH; return TK_CATCH;
} }
if (!strcmp("class", tkidentifier->name)) if (!strcmp("class", tkidentifier->name))
@ -1778,7 +1778,7 @@ static short tchrd(void) {
return TK_DELETE; return TK_DELETE;
if (!strcmp("dynamic_cast", tkidentifier->name)) { if (!strcmp("dynamic_cast", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_DYNAMIC_CAST; return TK_DYNAMIC_CAST;
} }
} }
@ -1875,7 +1875,7 @@ static short tchrm(void) {
return 0; return 0;
if (copts.cplusplus && !strcmp("mutable", tkidentifier->name)) { if (copts.cplusplus && !strcmp("mutable", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_MUTABLE; return TK_MUTABLE;
} }
return TK_IDENTIFIER; return TK_IDENTIFIER;
@ -1891,7 +1891,7 @@ static short tchrn(short t) {
return TK_NEW; return TK_NEW;
if (!strcmp("namespace", tkidentifier->name)) { if (!strcmp("namespace", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_NAMESPACE; return TK_NAMESPACE;
} }
if (!in_assembler && !preprocessing_only) { if (!in_assembler && !preprocessing_only) {
@ -1957,7 +1957,7 @@ static short tchrr(void) {
return TK_RETURN; return TK_RETURN;
if (copts.cplusplus && !strcmp("reinterpret_cast", tkidentifier->name)) { if (copts.cplusplus && !strcmp("reinterpret_cast", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_REINTERPRET_CAST; return TK_REINTERPRET_CAST;
} }
if (copts.c9x && !strcmp("restrict", tkidentifier->name)) if (copts.c9x && !strcmp("restrict", tkidentifier->name))
@ -1984,7 +1984,7 @@ static short tchrs(void) {
return TK_SWITCH; return TK_SWITCH;
if (copts.cplusplus && !strcmp("static_cast", tkidentifier->name)) { if (copts.cplusplus && !strcmp("static_cast", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_STATIC_CAST; return TK_STATIC_CAST;
} }
return TK_IDENTIFIER; return TK_IDENTIFIER;
@ -2006,27 +2006,27 @@ static short tchrt(void) {
return TK_TRUE; return TK_TRUE;
if (!strcmp("template", tkidentifier->name)) { if (!strcmp("template", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_TEMPLATE; return TK_TEMPLATE;
} }
if (!strcmp("try", tkidentifier->name)) { if (!strcmp("try", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_TRY; return TK_TRY;
} }
if (!strcmp("throw", tkidentifier->name)) { if (!strcmp("throw", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_THROW; return TK_THROW;
} }
if (!strcmp("typeid", tkidentifier->name)) { if (!strcmp("typeid", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_TYPEID; return TK_TYPEID;
} }
if (!strcmp("typename", tkidentifier->name)) { if (!strcmp("typename", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_TYPENAME; return TK_TYPENAME;
} }
} }
@ -2044,7 +2044,7 @@ static short tchru(void) {
return TK_UNSIGNED; return TK_UNSIGNED;
if (copts.cplusplus && !strcmp("using", tkidentifier->name)) { if (copts.cplusplus && !strcmp("using", tkidentifier->name)) {
if (copts.ecplusplus) if (copts.ecplusplus)
CPrep_Warning(339); CPrep_Warning(CErrorStr339);
return TK_USING; return TK_USING;
} }
return TK_IDENTIFIER; return TK_IDENTIFIER;
@ -2151,7 +2151,7 @@ static short tdoll(short t) {
static short tisid(void) { static short tisid(void) {
if (!tokenstacklevel) if (!tokenstacklevel)
CError_Error(105); CError_Error(CErrorStr105);
return 0; return 0;
} }
@ -2161,7 +2161,7 @@ static short tnull(short t) {
return t; return t;
} else { } else {
pos[-1] = -64; pos[-1] = -64;
return TK_NEG6; return TK_ILLEGAL;
} }
} }
@ -2169,7 +2169,7 @@ static short t0x1a(void) {
if (*pos == 0) if (*pos == 0)
return 0; return 0;
else else
return TK_NEG6; return TK_ILLEGAL;
} }
typedef short (*TokenizePtr)(short); typedef short (*TokenizePtr)(short);
@ -2228,7 +2228,7 @@ short lookahead_noeol(void) {
CPrep_TokenStreamGetState(&state); CPrep_TokenStreamGetState(&state);
do { do {
t = lex(); t = lex();
} while (t == TK_NEG7); } while (t == TK_EOL);
CPrep_TokenStreamSetState(&state); CPrep_TokenStreamSetState(&state);
return t; return t;
@ -2303,7 +2303,7 @@ static void CPrep_StringConCat(Boolean flag) {
ch = lex(); ch = lex();
elem = --ts_current; elem = --ts_current;
memmove(elem, elem + 1, sizeof(TStreamElement) * ts_preread_elements); memmove(elem, elem + 1, sizeof(TStreamElement) * ts_preread_elements);
} while (ch == TK_NEG7); } while (ch == TK_EOL);
chunk = lalloc(sizeof(StringChunk)); chunk = lalloc(sizeof(StringChunk));
chunk->next = chunks; chunk->next = chunks;
@ -2330,7 +2330,7 @@ short lex(void) {
short t; short t;
while (1) { while (1) {
if (ts_preread_elements > 0) if (ts_preread_elements <= 0)
break; break;
t = ts_current->tokentype; t = ts_current->tokentype;
@ -2353,7 +2353,7 @@ short lex(void) {
tksize = ts_current->data.tkstring.size; tksize = ts_current->data.tkstring.size;
ispascalstring = ts_current->subtype; ispascalstring = ts_current->subtype;
break; break;
case TK_NEG7: case TK_EOL:
nlflag = 1; nlflag = 1;
if (!cprep_eoltokens) { if (!cprep_eoltokens) {
ts_current++; ts_current++;
@ -2414,7 +2414,7 @@ short lex(void) {
return t; return t;
} }
break; break;
case TK_NEG6: case TK_ILLEGAL:
ts_current++; ts_current++;
CError_Error(CErrorStr105); CError_Error(CErrorStr105);
ts_current--; ts_current--;

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,7 @@ unsigned char *CTool_CtoPstr(char *cstr) {
return (unsigned char *) cstr; return (unsigned char *) cstr;
} }
static void GListError() { static void GListError(void) {
if (GListErrorProc) if (GListErrorProc)
GListErrorProc(); GListErrorProc();
} }
@ -465,7 +465,7 @@ HashNameNode *GetHashNameNodeByID(SInt32 id) {
return NULL; return NULL;
} }
void NameHashExportReset() { void NameHashExportReset(void) {
HashNameNode *node; HashNameNode *node;
short i; short i;
@ -540,13 +540,13 @@ void NameHashWriteTargetEndianNameTable(GList *glist) {
AppendGListByte(glist, 0); AppendGListByte(glist, 0);
} }
void InitNameHash() { void InitNameHash(void) {
name_hash_nodes = galloc(2048 * sizeof(HashNameNode *)); name_hash_nodes = galloc(2048 * sizeof(HashNameNode *));
memclrw(name_hash_nodes, 2048 * sizeof(HashNameNode *)); memclrw(name_hash_nodes, 2048 * sizeof(HashNameNode *));
hash_name_id = 1; hash_name_id = 1;
} }
SInt32 CTool_TotalHeapSize() { SInt32 CTool_TotalHeapSize(void) {
HeapBlock *blockp; HeapBlock *blockp;
SInt32 size = 0; SInt32 size = 0;
@ -718,7 +718,7 @@ short initgheap(heaperror_t heaperrorproc) {
return 0; return 0;
} }
heaperror_t getheaperror() { heaperror_t getheaperror(void) {
return heaperror; return heaperror;
} }
@ -740,7 +740,7 @@ static void relheap(HeapMem *heapp) {
memclrw(heapp, sizeof(HeapMem)); memclrw(heapp, sizeof(HeapMem));
} }
void releaseheaps() { void releaseheaps(void) {
relheap(&gheap); relheap(&gheap);
relheap(&lheap); relheap(&lheap);
relheap(&aheap); relheap(&aheap);
@ -748,11 +748,11 @@ void releaseheaps() {
relheap(&bheap); relheap(&bheap);
} }
void releasegheap() { void releasegheap(void) {
relheap(&gheap); relheap(&gheap);
} }
void releaseoheap() { void releaseoheap(void) {
relheap(&gheap); relheap(&gheap);
oheap.allocsize = 0x40000; oheap.allocsize = 0x40000;
MoreHeapSpace(&oheap, 0); MoreHeapSpace(&oheap, 0);
@ -823,17 +823,16 @@ void *balloc(SInt32 s) {
return cp; return cp;
} }
void locklheap() { void locklheap(void) {
lheaplockcount++; lheaplockcount++;
} }
void unlocklheap() { void unlocklheap(void) {
if (lheaplockcount > 0) if (lheaplockcount > 0)
--lheaplockcount; --lheaplockcount;
} }
void freelheap() { void freelheap(void) {
// possible inline or macro?
HeapBlock *blockp; HeapBlock *blockp;
if (lheaplockcount == 0) { if (lheaplockcount == 0) {
@ -849,7 +848,7 @@ void freelheap() {
} }
} }
void freeaheap() { void freeaheap(void) {
HeapBlock *blockp; HeapBlock *blockp;
blockp = aheap.blocks; blockp = aheap.blocks;
@ -863,7 +862,7 @@ void freeaheap() {
} }
} }
void freeoheap() { void freeoheap(void) {
HeapBlock *blockp; HeapBlock *blockp;
blockp = oheap.blocks; blockp = oheap.blocks;
@ -877,7 +876,7 @@ void freeoheap() {
} }
} }
void freebheap() { void freebheap(void) {
HeapBlock *blockp; HeapBlock *blockp;
blockp = bheap.blocks; blockp = bheap.blocks;

View File

@ -51,8 +51,8 @@ static int addpropagatestouse(int candidateID, int useID) {
return 0; return 0;
} }
if (useInstr->flags & (fPCodeFlag2 | fPCodeFlag4)) { if (useInstr->flags & (fIsRead | fIsWrite)) {
if (PCODE_FLAG_SET_F(useInstr) & fPCodeFlag2000000) if (PCODE_FLAG_SET_F(useInstr) & fUpdatesPtr)
return 0; return 0;
} else if (useInstr->op == PC_ADDI) { } else if (useInstr->op == PC_ADDI) {
if (useInstr->args[2].kind != PCOp_IMMEDIATE) if (useInstr->args[2].kind != PCOp_IMMEDIATE)
@ -124,7 +124,7 @@ static int addpropagatestouse(int candidateID, int useID) {
} }
if ( if (
(useInstr->flags & fPCodeFlag4) && (useInstr->flags & fIsWrite) &&
useInstr->args[0].kind == PCOp_REGISTER && useInstr->args[0].kind == PCOp_REGISTER &&
useInstr->args[0].arg == RegClass_GPR && useInstr->args[0].arg == RegClass_GPR &&
useInstr->args[0].data.reg.reg == reg1 useInstr->args[0].data.reg.reg == reg1
@ -168,7 +168,7 @@ static int addpropagatestouse(int candidateID, int useID) {
} }
} }
if ((useInstr->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) && object) if ((useInstr->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000)) && object)
useInstr->alias = make_alias(object, offset, nbytes_loaded_or_stored_by(useInstr)); useInstr->alias = make_alias(object, offset, nbytes_loaded_or_stored_by(useInstr));
return 1; return 1;
@ -190,10 +190,10 @@ static void propagateandremoveadd(int id) {
useInstr = Uses[list->id].pcode; useInstr = Uses[list->id].pcode;
if (instr->op == PC_ADD) { if (instr->op == PC_ADD) {
if (useInstr->flags & (fPCodeFlag2 | fPCodeFlag4)) { if (useInstr->flags & (fIsRead | fIsWrite)) {
if (useInstr->args[2].kind != PCOp_REGISTER) { if (useInstr->args[2].kind != PCOp_REGISTER) {
useInstr->op += 2; useInstr->op += 2;
useInstr->flags |= fPCodeFlag20; useInstr->flags |= fIsPtrOp;
} }
useInstr->args[1] = instr->args[1]; useInstr->args[1] = instr->args[1];
useInstr->args[2] = instr->args[2]; useInstr->args[2] = instr->args[2];
@ -227,13 +227,13 @@ static void propagateandremoveadd(int id) {
SInt32 newValue = useInstr->args[2].data.imm.value + instr->args[2].data.imm.value; SInt32 newValue = useInstr->args[2].data.imm.value + instr->args[2].data.imm.value;
useInstr->args[2] = instr->args[2]; useInstr->args[2] = instr->args[2];
useInstr->args[2].data.imm.value = newValue; useInstr->args[2].data.imm.value = newValue;
useInstr->flags |= fPCodeFlag20; useInstr->flags |= fIsPtrOp;
} else if (instr->args[2].kind == PCOp_MEMORY) { } else if (instr->args[2].kind == PCOp_MEMORY) {
SInt32 newValue = useInstr->args[2].data.imm.value + instr->args[2].data.mem.offset; SInt32 newValue = useInstr->args[2].data.imm.value + instr->args[2].data.mem.offset;
useInstr->args[2] = instr->args[2]; useInstr->args[2] = instr->args[2];
useInstr->args[2].data.mem.offset = newValue; useInstr->args[2].data.mem.offset = newValue;
useInstr->flags &= ~fPCodeFlag20; useInstr->flags &= ~fIsPtrOp;
if (useInstr->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) if (useInstr->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000))
useInstr->alias = make_alias( useInstr->alias = make_alias(
useInstr->args[2].data.mem.obj, useInstr->args[2].data.mem.obj,
useInstr->args[2].data.mem.offset, useInstr->args[2].data.mem.offset,

View File

@ -257,7 +257,7 @@ static int addresspropagatestouse(int candidateID, int useID) {
CError_ASSERT(478, object->otype == OT_OBJECT); CError_ASSERT(478, object->otype == OT_OBJECT);
if ((candidate_pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) && (candidate_pcode->flags & fPCodeFlag2000000)) { if ((candidate_pcode->flags & (fIsRead | fIsWrite)) && (candidate_pcode->flags & fUpdatesPtr)) {
reg = candidate_pcode->args[1].data.reg.reg; reg = candidate_pcode->args[1].data.reg.reg;
offset = 0; offset = 0;
flag24 = 1; flag24 = 1;
@ -282,7 +282,7 @@ static int addresspropagatestouse(int candidateID, int useID) {
} }
if ( if (
!(use_pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) && !(use_pcode->flags & (fIsRead | fIsWrite)) &&
use_pcode->op != PC_ADDI && use_pcode->op != PC_ADDI &&
use_pcode->op != PC_ADD && use_pcode->op != PC_ADD &&
use_pcode->op != PC_ADDIS use_pcode->op != PC_ADDIS
@ -293,7 +293,7 @@ static int addresspropagatestouse(int candidateID, int useID) {
} }
if ( if (
(use_pcode->flags & (fPCodeFlag4 | fPCodeFlag40000)) && (use_pcode->flags & (fIsWrite | fPCodeFlag40000)) &&
use_pcode->args[0].kind == PCOp_REGISTER && use_pcode->args[0].kind == PCOp_REGISTER &&
use_pcode->args[0].arg == RegClass_GPR && use_pcode->args[0].arg == RegClass_GPR &&
use_pcode->args[0].data.reg.reg == reg && use_pcode->args[0].data.reg.reg == reg &&
@ -363,7 +363,7 @@ static int addresspropagatestouse(int candidateID, int useID) {
add_alias_member(worst_case, make_alias(object, 0, 0)); add_alias_member(worst_case, make_alias(object, 0, 0));
} }
if (use_pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) if (use_pcode->flags & (fIsRead | fIsWrite))
size = nbytes_loaded_or_stored_by(use_pcode); size = nbytes_loaded_or_stored_by(use_pcode);
if (use_pcode->args[2].kind == PCOp_REGISTER) { if (use_pcode->args[2].kind == PCOp_REGISTER) {
@ -435,7 +435,7 @@ static int addresspropagatestouse(int candidateID, int useID) {
use_pcode->op == PC_ADDI || use_pcode->op == PC_ADDI ||
use_pcode->op == PC_ADD || use_pcode->op == PC_ADD ||
use_pcode->op == PC_ADDIS || use_pcode->op == PC_ADDIS ||
((candidate_pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) && (candidate_pcode->flags & fPCodeFlag2000000)) ((candidate_pcode->flags & (fIsRead | fIsWrite)) && (candidate_pcode->flags & fUpdatesPtr))
) )
recursive_propagation = 1; recursive_propagation = 1;
} }
@ -454,7 +454,7 @@ static int addresspropagatestouse(int candidateID, int useID) {
use_pcode->op == PC_ADDI || use_pcode->op == PC_ADDI ||
use_pcode->op == PC_ADD || use_pcode->op == PC_ADD ||
use_pcode->op == PC_ADDIS || use_pcode->op == PC_ADDIS ||
((use_pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) && (use_pcode->flags & fPCodeFlag2000000)) ((use_pcode->flags & (fIsRead | fIsWrite)) && (use_pcode->flags & fUpdatesPtr))
) { ) {
if (alias->type == AliasType2) if (alias->type == AliasType2)
add_alias_member(worst_case, alias); add_alias_member(worst_case, alias);
@ -519,15 +519,15 @@ void gather_alias_info(void) {
bitvectorcopy(myvec, usedefinfo[block->blockIndex].defvec8, number_of_Defs); bitvectorcopy(myvec, usedefinfo[block->blockIndex].defvec8, number_of_Defs);
for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) { for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) {
if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) { if (pcode->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000)) {
if (!pcode->alias) { if (!pcode->alias) {
pcode->alias = worst_case; pcode->alias = worst_case;
} else { } else {
if ((pcode->alias->type == AliasType0 || pcode->alias->type == AliasType1) && if ((pcode->alias->type == AliasType0 || pcode->alias->type == AliasType1) &&
pcode->alias->size == nbytes_loaded_or_stored_by(pcode)) { pcode->alias->size == nbytes_loaded_or_stored_by(pcode)) {
pcode->flags &= ~fPCodeFlag20; pcode->flags &= ~fIsPtrOp;
} else { } else {
pcode->flags |= fPCodeFlag20; pcode->flags |= fIsPtrOp;
} }
if (pcode->alias != worst_case) { if (pcode->alias != worst_case) {
@ -536,7 +536,7 @@ void gather_alias_info(void) {
op = pcode->args; op = pcode->args;
for (i = 0; i < pcode->argCount; i++, op++) { for (i = 0; i < pcode->argCount; i++, op++) {
if ( if (
(!(pcode->flags & (fPCodeFlag4 | fPCodeFlag40000)) || op != pcode->args) && (!(pcode->flags & (fIsWrite | fPCodeFlag40000)) || op != pcode->args) &&
op->kind == PCOp_REGISTER && op->kind == PCOp_REGISTER &&
(RegClass) op->arg == RegClass_GPR && (RegClass) op->arg == RegClass_GPR &&
(op->data.reg.effect & EffectRead) (op->data.reg.effect & EffectRead)
@ -576,7 +576,7 @@ void gather_alias_info(void) {
} }
if (alias_choice == worst_case) { if (alias_choice == worst_case) {
pcode->flags |= fPCodeFlag20; pcode->flags |= fIsPtrOp;
if (pcode->alias->type == AliasType2) if (pcode->alias->type == AliasType2)
add_alias_member(worst_case, pcode->alias); add_alias_member(worst_case, pcode->alias);
else else
@ -589,7 +589,7 @@ void gather_alias_info(void) {
} }
} }
} else { } else {
if ((pcode->flags & fPCodeFlag8) && !pcode->alias) if ((pcode->flags & fIsCall) && !pcode->alias)
pcode->alias = worst_case; pcode->alias = worst_case;
} }
@ -607,7 +607,7 @@ void gather_alias_info(void) {
} else { } else {
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) { for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) {
if ((pcode->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag8 | fPCodeFlag20000 | fPCodeFlag40000)) && !pcode->alias) if ((pcode->flags & (fIsRead | fIsWrite | fIsCall | fPCodeFlag20000 | fPCodeFlag40000)) && !pcode->alias)
pcode->alias = worst_case; pcode->alias = worst_case;
} }
} }

View File

@ -2013,7 +2013,7 @@ ENode *CABI_DestroyObject(Object *dtor, ENode *objexpr, CABIDestroyMode mode, Bo
if (flag1) if (flag1)
expr->data.funccall.funcref->flags |= ENODE_FLAG_80; expr->data.funccall.funcref->flags |= ENODE_FLAG_80;
expr->data.funccall.functype = TYPE_FUNC(dtor->type); expr->data.funccall.functype = TYPE_FUNC(dtor->type);
dtor->flags |= OBJECT_FLAGS_UNUSED; dtor->flags |= OBJECT_FLAGS_1;
list = lalloc(sizeof(ENodeList)); list = lalloc(sizeof(ENodeList));
list->node = objexpr; list->node = objexpr;

View File

@ -1273,7 +1273,7 @@ static Object *CClass_FindCovariantFunction(Object *func, Type *type) {
nsol = CScope_FindName( nsol = CScope_FindName(
TYPE_METHOD(func->type)->theclass->nspace, TYPE_METHOD(func->type)->theclass->nspace,
CMangler_GetCovariantFunctionName(func, type)); CMangler_GetCovariantFunctionName(func, TYPE_CLASS(type)));
CError_ASSERT(1754, nsol && !nsol->next && nsol->object->otype == OT_OBJECT); CError_ASSERT(1754, nsol && !nsol->next && nsol->object->otype == OT_OBJECT);
@ -1287,7 +1287,7 @@ static ObjectList *CClass_DeclareCovariantFuncs(ObjectList *list, Object *func,
ObjectList *newlist; ObjectList *newlist;
for (types = CClass_GetCoVariantClassList(NULL, tclass, func, 1); types; types = types->next) { for (types = CClass_GetCoVariantClassList(NULL, tclass, func, 1); types; types = types->next) {
name = CMangler_GetCovariantFunctionName(func, types->type); name = CMangler_GetCovariantFunctionName(func, TYPE_CLASS(types->type));
newfunc = galloc(sizeof(Object)); newfunc = galloc(sizeof(Object));
memclrw(newfunc, sizeof(Object)); memclrw(newfunc, sizeof(Object));

View File

@ -3,6 +3,8 @@
#include "compiler/CPrep.h" #include "compiler/CPrep.h"
#include "compiler/CompilerTools.h" #include "compiler/CompilerTools.h"
#include "compiler/CodeGen.h" #include "compiler/CodeGen.h"
#include "compiler/CodeGenOptPPC.h"
#include "compiler/IrOptimizer.h"
#include "compiler/types.h" #include "compiler/types.h"
#include "pref_structs.h" #include "pref_structs.h"
@ -72,7 +74,7 @@ static int setup_param_block(CWPluginContext context) {
return CWGetTargetName(context, target_name, sizeof(target_name)) == cwNoErr; return CWGetTargetName(context, target_name, sizeof(target_name)) == cwNoErr;
} }
static short store_compile_results() { static short store_compile_results(void) {
CWResult result; CWResult result;
if (cparams.objectDataHandle) if (cparams.objectDataHandle)
@ -181,7 +183,7 @@ static void initialize_compiler_options(CParams *params) {
copts.text = CWFOURCHAR('T','E','X','T'); copts.text = CWFOURCHAR('T','E','X','T');
} }
static void GetLicense() { static void GetLicense(void) {
if (!license_cookie) { if (!license_cookie) {
crippled = 1; crippled = 1;
CWCheckoutLicense(cparams.context, "MacOS_Plugins_MacOS_Unlimited", "7", 2, NULL, &license_cookie); CWCheckoutLicense(cparams.context, "MacOS_Plugins_MacOS_Unlimited", "7", 2, NULL, &license_cookie);
@ -195,7 +197,7 @@ static void GetLicense() {
} }
} }
static void ReleaseLicense() { static void ReleaseLicense(void) {
if (license_cookie && using_license_manager) if (license_cookie && using_license_manager)
CWCheckinLicense(cparams.context, license_cookie); CWCheckinLicense(cparams.context, license_cookie);
using_license_manager = 0; using_license_manager = 0;

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ char cerror_synchdata[32];
short cerror_synchoffset; short cerror_synchoffset;
int CError_BreakPointcount; int CError_BreakPointcount;
void CError_Init() { void CError_Init(void) {
cerror_errorcount = 0; cerror_errorcount = 0;
cerror_lasterrorline = -1; cerror_lasterrorline = -1;
cerror_token = 0; cerror_token = 0;
@ -38,7 +38,7 @@ void CError_SetErrorToken(TStreamElement *token) {
cerror_token = token; cerror_token = token;
} }
void CError_SetNullErrorToken() { void CError_SetNullErrorToken(void) {
cerror_token = (TStreamElement *) -1; cerror_token = (TStreamElement *) -1;
} }
@ -52,7 +52,7 @@ void CError_UnlockErrorPos(TStreamElement **saved) {
cerror_locktoken = *saved; cerror_locktoken = *saved;
} }
void CError_ResetErrorSkip() { void CError_ResetErrorSkip(void) {
cerror_lasterrorline = -1; cerror_lasterrorline = -1;
} }
@ -925,7 +925,7 @@ void CError_OverloadedFunctionError2(Object *obj, ObjectList *olst, ENodeList *a
} }
current->next = NULL; current->next = NULL;
CError_ErrorFuncCall(392, &first, argNodes); CError_ErrorFuncCall(CErrorStr392, &first, argNodes);
} }
void CError_OverloadedFunctionError(Object *obj, ObjectList *olst) { void CError_OverloadedFunctionError(Object *obj, ObjectList *olst) {
@ -936,7 +936,7 @@ void CError_OverloadedFunctionError(Object *obj, ObjectList *olst) {
if (trychain) if (trychain)
longjmp(trychain->jmpbuf, 1); longjmp(trychain->jmpbuf, 1);
CError_GetErrorString(string, 199); CError_GetErrorString(string, CErrorStr199);
CError_BufferInit(&eb, buf, sizeof(buf)); CError_BufferInit(&eb, buf, sizeof(buf));
CError_BufferAppendString(&eb, string); CError_BufferAppendString(&eb, string);
@ -960,9 +960,9 @@ void CError_OverloadedFunctionError(Object *obj, ObjectList *olst) {
void CError_AbstractClassError(TypeClass *tclass) { void CError_AbstractClassError(TypeClass *tclass) {
Object *result = CClass_CheckPures(tclass); Object *result = CClass_CheckPures(tclass);
if (!result) if (!result)
CError_Error(372, tclass, 0); CError_Error(CErrorStr372, tclass, 0);
else else
CError_Error(194, result); CError_Error(CErrorStr194, result);
} }
void CError_Warning(int code, ...) { void CError_Warning(int code, ...) {
@ -989,23 +989,23 @@ void CError_Internal(char *filename, int line) {
CError_BreakPoint(0, 0); CError_BreakPoint(0, 0);
} }
void CError_ExpressionTooComplex() { void CError_ExpressionTooComplex(void) {
CompilerGetCString(6, string); CompilerGetCString(6, string);
CError_ErrorMessage(10002, string, 1, 0); CError_ErrorMessage(10002, string, 1, 0);
longjmp(errorreturn, 1); longjmp(errorreturn, 1);
} }
void CError_NoMem() { void CError_NoMem(void) {
cprep_nomem_exit = 1; cprep_nomem_exit = 1;
longjmp(errorreturn, 1); longjmp(errorreturn, 1);
} }
void CError_UserBreak() { void CError_UserBreak(void) {
CompilerGetCString(8, string); CompilerGetCString(8, string);
longjmp(errorreturn, 1); longjmp(errorreturn, 1);
} }
void CError_CannotOpen() { void CError_CannotOpen(void) {
CompilerGetCString(9, string); CompilerGetCString(9, string);
CWReportMessage(cparamblkptr->context, NULL, string, NULL, messagetypeError, 0); CWReportMessage(cparamblkptr->context, NULL, string, NULL, messagetypeError, 0);
longjmp(errorreturn, 1); longjmp(errorreturn, 1);

File diff suppressed because it is too large Load Diff

View File

@ -389,7 +389,7 @@ ENode *stringconstnode(char *str) {
ENode *forceintegral(ENode *expr) { ENode *forceintegral(ENode *expr) {
if (!IS_TYPE_ENUM(expr->rtype)) { if (!IS_TYPE_ENUM(expr->rtype)) {
CError_Error(144); CError_Error(CErrorStr144);
return nullnode(); return nullnode();
} else { } else {
expr->rtype = TYPE_ENUM(expr->rtype)->enumtype; expr->rtype = TYPE_ENUM(expr->rtype)->enumtype;
@ -631,7 +631,7 @@ void CExpr_ArithmeticConversion(ENode **left, ENode **right) {
(*left)->rtype = TYPE_ENUM((*left)->rtype)->enumtype; (*left)->rtype = TYPE_ENUM((*left)->rtype)->enumtype;
break; break;
default: default:
CError_Error(144); CError_Error(CErrorStr144);
(*left) = nullnode(); (*left) = nullnode();
} }
@ -643,7 +643,7 @@ void CExpr_ArithmeticConversion(ENode **left, ENode **right) {
(*right)->rtype = TYPE_ENUM((*right)->rtype)->enumtype; (*right)->rtype = TYPE_ENUM((*right)->rtype)->enumtype;
break; break;
default: default:
CError_Error(144); CError_Error(CErrorStr144);
(*right) = nullnode(); (*right) = nullnode();
} }
@ -741,7 +741,7 @@ ENode *CExpr_TempModifyExpr(ENode *expr) {
tempnode = CExpr_NewETEMPNode(type, 1); tempnode = CExpr_NewETEMPNode(type, 1);
eanode = CExpr_GetEA(expr); eanode = CExpr_GetEA(expr);
if (!eanode) { if (!eanode) {
CError_Error(142); CError_Error(CErrorStr142);
return expr; return expr;
} }
@ -840,7 +840,7 @@ loop:
case EINDIRECT: case EINDIRECT:
if (flag2) { if (flag2) {
if (!CExpr_IsLValue(expr)) if (!CExpr_IsLValue(expr))
CError_Warning(142); CError_Warning(CErrorStr142);
if ( if (
ENODE_IS(expr->data.monadic, EOBJREF) && ENODE_IS(expr->data.monadic, EOBJREF) &&
@ -848,11 +848,11 @@ loop:
cscope_currentfunc && cscope_currentfunc &&
cscope_currentclass && cscope_currentclass &&
expr->data.monadic->data.objref == CClass_ThisSelfObject()) expr->data.monadic->data.objref == CClass_ThisSelfObject())
CError_Error(189); CError_Error(CErrorStr189);
} }
if (flag1) { if (flag1) {
if (CParser_IsConst(expr->rtype, expr->flags & ENODE_FLAG_QUALS)) if (CParser_IsConst(expr->rtype, expr->flags & ENODE_FLAG_QUALS))
CError_Error(179); CError_Error(CErrorStr179);
} }
return expr; return expr;
case EPREINC: case EPREINC:
@ -877,7 +877,7 @@ loop:
tmpnode->rtype = expr->rtype; tmpnode->rtype = expr->rtype;
return tmpnode; return tmpnode;
} }
CError_Error(190); CError_Error(CErrorStr190);
return expr; return expr;
} }
break; break;
@ -904,7 +904,7 @@ loop:
} }
if (flag2) if (flag2)
CError_Error(142); CError_Error(CErrorStr142);
return expr; return expr;
} }
@ -912,7 +912,7 @@ ENode *CExpr_MakeObjRefNode(Object *obj, Boolean flag) {
ENode *expr; ENode *expr;
if (obj->sclass == TK_TYPEDEF) { if (obj->sclass == TK_TYPEDEF) {
CError_Error(141); CError_Error(CErrorStr141);
return intconstnode((Type *) &void_ptr, 0); return intconstnode((Type *) &void_ptr, 0);
} }
@ -925,7 +925,7 @@ ENode *CExpr_MakeObjRefNode(Object *obj, Boolean flag) {
if (!IS_TYPE_FUNC(obj->type)) if (!IS_TYPE_FUNC(obj->type))
expr->flags = obj->qual & ENODE_FLAG_QUALS; expr->flags = obj->qual & ENODE_FLAG_QUALS;
if (flag) if (flag)
obj->flags |= OBJECT_FLAGS_UNUSED; obj->flags |= OBJECT_FLAGS_1;
return expr; return expr;
} }
@ -995,7 +995,7 @@ ENode *CExpr_AdjustFunctionCall(ENode *expr) {
CDecl_CompleteType(expr->data.funccall.functype->functype); CDecl_CompleteType(expr->data.funccall.functype->functype);
case TYPESTRUCT: case TYPESTRUCT:
if (!expr->data.funccall.functype->functype->size) if (!expr->data.funccall.functype->functype->size)
CError_Error(136, expr->data.funccall.functype->functype, 0); CError_Error(CErrorStr136, expr->data.funccall.functype->functype, 0);
} }
if (CMach_GetFunctionResultClass(expr->data.funccall.functype)) { if (CMach_GetFunctionResultClass(expr->data.funccall.functype)) {
@ -1429,7 +1429,7 @@ static short std_assign_check_overload(NameSpaceObjectList *list, TemplArg *temp
assign_node = expr; assign_node = expr;
expr->rtype = CDecl_NewPointerType(used_obj->type); expr->rtype = CDecl_NewPointerType(used_obj->type);
expr->flags = obj->qual & ENODE_FLAG_QUALS; expr->flags = obj->qual & ENODE_FLAG_QUALS;
used_obj->flags |= OBJECT_FLAGS_UNUSED; used_obj->flags |= OBJECT_FLAGS_1;
if (used_obj->datatype == DINLINEFUNC) if (used_obj->datatype == DINLINEFUNC)
CError_Error(CErrorStr175); CError_Error(CErrorStr175);
} }
@ -1957,7 +1957,7 @@ short user_assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boo
r13 = TYPE_METHOD(r26->type); r13 = TYPE_METHOD(r26->type);
CError_ASSERT(2537, r13->flags & FUNC_FLAGS_METHOD); CError_ASSERT(2537, r13->flags & FUNC_FLAGS_METHOD);
r15b = create_objectrefnode(r26); r15b = create_objectrefnode(r26);
r26->flags |= OBJECT_FLAGS_UNUSED; r26->flags |= OBJECT_FLAGS_1;
r14d = lalloc(sizeof(ENodeList)); r14d = lalloc(sizeof(ENodeList));
r14d->next = NULL; r14d->next = NULL;
expr = getnodeaddress(expr, 0); expr = getnodeaddress(expr, 0);
@ -2023,7 +2023,7 @@ ENode *CExpr_ConvertToCondition(ENode *expr) {
case TYPECLASS: case TYPECLASS:
return CExpr_Convert(expr, TYPE(&stbool), 0, 0, 1); return CExpr_Convert(expr, TYPE(&stbool), 0, 0, 1);
default: default:
CError_Error(376, expr->rtype, expr->flags & ENODE_FLAG_QUALS); CError_Error(CErrorStr376, expr->rtype, expr->flags & ENODE_FLAG_QUALS);
return nullnode(); return nullnode();
} }
} }
@ -2457,7 +2457,7 @@ static ENode *CExpr_GenericCall(ENode *funcexpr, ENodeList *argexprs, TypeFunc *
callexpr->data.funccall.funcref->rtype = CDecl_NewPointerType(TYPE(tfunc)); callexpr->data.funccall.funcref->rtype = CDecl_NewPointerType(TYPE(tfunc));
callexpr->data.funccall.args = argexprs; callexpr->data.funccall.args = argexprs;
callexpr->data.funccall.functype = tfunc; callexpr->data.funccall.functype = tfunc;
funcexpr->data.objref->flags |= OBJECT_FLAGS_UNUSED; funcexpr->data.objref->flags |= OBJECT_FLAGS_1;
return CExpr_AdjustFunctionCall(callexpr); return CExpr_AdjustFunctionCall(callexpr);
} }
@ -3413,7 +3413,7 @@ ENode *CExpr_ConstructObject(TypeClass *tclass, ENode *addr_expr, ENodeList *arg
CExpr_AssignmentPromotion(args->node, TYPE(tclass), 0, 1), CExpr_AssignmentPromotion(args->node, TYPE(tclass), 0, 1),
EASS); EASS);
} }
CError_Error(174); CError_Error(CErrorStr174);
} }
return addr_expr; return addr_expr;
} }
@ -3430,7 +3430,7 @@ static ENode *CExpr_DeleteFuncCall(Object *obj, ENode *arg, Type *type, Boolean
expr->rtype = &stvoid; expr->rtype = &stvoid;
expr->data.funccall.funcref = create_objectrefnode(obj); expr->data.funccall.funcref = create_objectrefnode(obj);
expr->data.funccall.functype = TYPE_FUNC(obj->type); expr->data.funccall.functype = TYPE_FUNC(obj->type);
obj->flags |= OBJECT_FLAGS_UNUSED; obj->flags |= OBJECT_FLAGS_1;
list = lalloc(sizeof(ENodeList)); list = lalloc(sizeof(ENodeList));
list->node = arg; list->node = arg;
@ -3504,7 +3504,7 @@ static ENode *CExpr_PlacementDeleteCall(Type *type, ENode *expr, Object *obj, Bo
result->rtype = &stvoid; result->rtype = &stvoid;
result->data.funccall.funcref = create_objectrefnode(funcobj); result->data.funccall.funcref = create_objectrefnode(funcobj);
result->data.funccall.functype = TYPE_FUNC(funcobj->type); result->data.funccall.functype = TYPE_FUNC(funcobj->type);
funcobj->flags |= OBJECT_FLAGS_UNUSED; funcobj->flags |= OBJECT_FLAGS_1;
list = lalloc(sizeof(ENodeList)); list = lalloc(sizeof(ENodeList));
list->node = create_objectnode(obj); list->node = create_objectnode(obj);
@ -3784,7 +3784,7 @@ static ENode *CExpr_NewArray(Type *type, UInt32 qual, ENodeList *nodelist, Boole
if (CClass_Constructor(TYPE_CLASS(innertype))) { if (CClass_Constructor(TYPE_CLASS(innertype))) {
ctor = CClass_DefaultConstructor(TYPE_CLASS(innertype)); ctor = CClass_DefaultConstructor(TYPE_CLASS(innertype));
if (ctor) { if (ctor) {
ctor->flags |= OBJECT_FLAGS_UNUSED; ctor->flags |= OBJECT_FLAGS_1;
} else { } else {
ctor = CClass_DummyDefaultConstructor(TYPE_CLASS(innertype)); ctor = CClass_DummyDefaultConstructor(TYPE_CLASS(innertype));
if (!ctor) if (!ctor)
@ -4187,7 +4187,7 @@ ENode *scandelete(Boolean flag) {
result_expr = CABI_DestroyObject(dtor, expr, 2, 0, 0); result_expr = CABI_DestroyObject(dtor, expr, 2, 0, 0);
result_expr->rtype = TYPE(&void_ptr); result_expr->rtype = TYPE(&void_ptr);
result_expr = funccallexpr(obj, result_expr, NULL, NULL, NULL); result_expr = funccallexpr(obj, result_expr, NULL, NULL, NULL);
obj->flags |= OBJECT_FLAGS_UNUSED; obj->flags |= OBJECT_FLAGS_1;
} }
if (is_virtual) { if (is_virtual) {

View File

@ -567,7 +567,7 @@ static Boolean CExpr_OverloadFuncMatch(NameSpaceObjectList *list, TemplArg *temp
*outExpr = expr; *outExpr = expr;
expr->rtype = CDecl_NewPointerType(object26->type); expr->rtype = CDecl_NewPointerType(object26->type);
expr->flags = object->qual & ENODE_FLAG_QUALS; expr->flags = object->qual & ENODE_FLAG_QUALS;
object26->flags |= OBJECT_FLAGS_UNUSED; object26->flags |= OBJECT_FLAGS_1;
if (object26->datatype == DINLINEFUNC) if (object26->datatype == DINLINEFUNC)
CError_Error(CErrorStr175); CError_Error(CErrorStr175);
} }
@ -1086,7 +1086,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli
CError_ASSERT(1416, IS_TYPEFUNC_METHOD(tfunc23)); CError_ASSERT(1416, IS_TYPEFUNC_METHOD(tfunc23));
funcref = create_objectrefnode(object28); funcref = create_objectrefnode(object28);
object28->flags |= OBJECT_FLAGS_UNUSED; object28->flags |= OBJECT_FLAGS_1;
arglist = lalloc(sizeof(ENodeList)); arglist = lalloc(sizeof(ENodeList));
arglist->next = NULL; arglist->next = NULL;

View File

@ -601,7 +601,7 @@ void CFunc_WarnUnused(void) {
ObjectList *list; ObjectList *list;
for (list = locals; list; list = list->next) { for (list = locals; list; list = list->next) {
if ( if (
!(list->object->flags & OBJECT_FLAGS_UNUSED) && !(list->object->flags & OBJECT_FLAGS_1) &&
!IsTempName(list->object->name) && !IsTempName(list->object->name) &&
!(list->object->qual & Q_10000) !(list->object->qual & Q_10000)
) )
@ -616,7 +616,7 @@ void CFunc_WarnUnused(void) {
ObjectList *list; ObjectList *list;
for (list = arguments; list; list = list->next) { for (list = arguments; list; list = list->next) {
if ( if (
!(list->object->flags & OBJECT_FLAGS_UNUSED) && !(list->object->flags & OBJECT_FLAGS_1) &&
!IsTempName(list->object->name) && !IsTempName(list->object->name) &&
list->object->name != this_name_node && list->object->name != this_name_node &&
list->object->name != self_name_node list->object->name != self_name_node
@ -3035,11 +3035,11 @@ void CFunc_ParseFuncDef(Object *func, DeclInfo *di, TypeClass *tclass, Boolean i
CheckCLabels(); CheckCLabels();
if (nameobj_func && (nameobj_func->flags & OBJECT_FLAGS_UNUSED)) if (nameobj_func && (nameobj_func->flags & OBJECT_FLAGS_1))
CInit_DeclareData(nameobj_func->u.alias.object, func->name->name, NULL, strlen(func->name->name) + 1); CInit_DeclareData(nameobj_func->u.alias.object, func->name->name, NULL, strlen(func->name->name) + 1);
if (nameobj_FUNCTION && (nameobj_FUNCTION->flags & OBJECT_FLAGS_UNUSED)) if (nameobj_FUNCTION && (nameobj_FUNCTION->flags & OBJECT_FLAGS_1))
CInit_DeclareData(nameobj_FUNCTION->u.alias.object, func->name->name, NULL, strlen(func->name->name) + 1); CInit_DeclareData(nameobj_FUNCTION->u.alias.object, func->name->name, NULL, strlen(func->name->name) + 1);
if (nameobj_pretty && (nameobj_pretty->flags & OBJECT_FLAGS_UNUSED)) if (nameobj_pretty && (nameobj_pretty->flags & OBJECT_FLAGS_1))
CInit_DeclareData(nameobj_pretty->u.alias.object, prettyname, NULL, strlen(prettyname) + 1); CInit_DeclareData(nameobj_pretty->u.alias.object, prettyname, NULL, strlen(prettyname) + 1);
if (!fatalerrors) { if (!fatalerrors) {

View File

@ -180,7 +180,7 @@ static CInit_Initializer *CInit_ParseInitializerList(void) {
return r30; return r30;
if (tk != ',') { if (tk != ',') {
CError_Error(116); CError_Error(CErrorStr116);
return r30; return r30;
} }
} while ((tk = lex()) != '}'); } while ((tk = lex()) != '}');
@ -271,12 +271,12 @@ static Stage CInit_ParseNextInit(CInit_Stuff2 *s) {
if (tk == ')') if (tk == ')')
tk = lex(); tk = lex();
else else
CError_Error(115); CError_Error(CErrorStr115);
if (tk == '(') if (tk == '(')
tk = lex(); tk = lex();
else else
CError_Error(114); CError_Error(CErrorStr114);
s->x24++; s->x24++;
t = lookahead(); t = lookahead();
if (t == TK_UU_VECTOR || (t == TK_IDENTIFIER && !strcmp("vector", tkidentifier->name))) if (t == TK_UU_VECTOR || (t == TK_IDENTIFIER && !strcmp("vector", tkidentifier->name)))
@ -305,7 +305,7 @@ static Stage CInit_ParseNextInit(CInit_Stuff2 *s) {
} }
if (s->x24) { if (s->x24) {
if (tk != ')') if (tk != ')')
CError_Error(174); CError_Error(CErrorStr174);
if (s->x24 > 1) { if (s->x24 > 1) {
s->x24--; s->x24--;
tk = lex(); tk = lex();
@ -313,7 +313,7 @@ static Stage CInit_ParseNextInit(CInit_Stuff2 *s) {
} }
} else { } else {
if (tk != '}') if (tk != '}')
CError_Error(174); CError_Error(CErrorStr174);
} }
s->stage = Stage3; s->stage = Stage3;
return Stage3; return Stage3;
@ -357,7 +357,7 @@ static void CInit_CloseInitList(void) {
tk = lex(); tk = lex();
if (tk != '}') if (tk != '}')
CError_ErrorSkip(130); CError_ErrorSkip(CErrorStr130);
else else
tk = lex(); tk = lex();
} }
@ -434,7 +434,7 @@ static Object *CInit_CreateStaticDataObject(Type *type, UInt32 qual, HashNameNod
return obj; return obj;
} }
static Type *CInit_GetRegMemType() { static Type *CInit_GetRegMemType(void) {
return CDecl_NewStructType(void_ptr.size * 3, CMach_GetTypeAlign((Type *) &void_ptr)); return CDecl_NewStructType(void_ptr.size * 3, CMach_GetTypeAlign((Type *) &void_ptr));
} }
@ -470,7 +470,7 @@ static void CInit_InitNonConst(CInit_Stuff *s, Type *type, ENode *expr) {
s->x4->x1C = entry; s->x4->x1C = entry;
} }
} else { } else {
CError_Error(124); CError_Error(CErrorStr124);
} }
} }
@ -577,7 +577,7 @@ static void CInit_InitTypePointer(CInit_Stuff *s, ENode *expr, TypePointer *tptr
CInit_InitNonConst(s, TYPE(tptr), expr); CInit_InitNonConst(s, TYPE(tptr), expr);
} }
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} }
@ -592,7 +592,7 @@ static void CInit_InitTypeInt(CInit_Stuff *s, ENode *expr, TypeIntegral *tint, U
CInit_InitNonConst(s, TYPE(tint), expr); CInit_InitNonConst(s, TYPE(tint), expr);
} }
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} }
@ -605,7 +605,7 @@ static void CInit_InitTypeFloat(CInit_Stuff *s, ENode *expr, TypeIntegral *tint,
CInit_InitNonConst(s, TYPE(tint), expr); CInit_InitNonConst(s, TYPE(tint), expr);
} }
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} }
@ -618,7 +618,7 @@ static void CInit_InitTypeEnum(CInit_Stuff *s, ENode *expr, TypeEnum *tenum, UIn
CInit_InitNonConst(s, TYPE(tenum), expr); CInit_InitNonConst(s, TYPE(tenum), expr);
} }
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} }
@ -671,7 +671,7 @@ static void CInit_InitTypeBitfield(CInit_Stuff *s, ENode *expr, TypeBitfield *tb
CInit_InitNonConst(s, TYPE(tbitfield), expr); CInit_InitNonConst(s, TYPE(tbitfield), expr);
} }
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} }
@ -689,7 +689,7 @@ static void CInit_InitTypeArray(CInit_Stuff *s, CInit_Stuff2 *s2, TypePointer *t
is_zero_size = tptr->size == 0; is_zero_size = tptr->size == 0;
targetsize = tptr->target->size; targetsize = tptr->target->size;
if (!targetsize) { if (!targetsize) {
CError_Error(145); CError_Error(CErrorStr145);
return; return;
} }
@ -700,7 +700,7 @@ static void CInit_InitTypeArray(CInit_Stuff *s, CInit_Stuff2 *s2, TypePointer *t
flag = 1; flag = 1;
if (CInit_ParseNextInit(s2) == Stage3) { if (CInit_ParseNextInit(s2) == Stage3) {
if (is_zero_size) if (is_zero_size)
CError_Error(174); CError_Error(CErrorStr174);
tk = lex(); tk = lex();
return; return;
} }
@ -714,7 +714,7 @@ static void CInit_InitTypeArray(CInit_Stuff *s, CInit_Stuff2 *s2, TypePointer *t
case Stage2: case Stage2:
break; break;
default: default:
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
@ -723,7 +723,7 @@ static void CInit_InitTypeArray(CInit_Stuff *s, CInit_Stuff2 *s2, TypePointer *t
if (s2->stage == Stage2 && ENODE_IS(s2->expr, ESTRINGCONST) && (is_char_ptr || is_wchar_ptr)) { if (s2->stage == Stage2 && ENODE_IS(s2->expr, ESTRINGCONST) && (is_char_ptr || is_wchar_ptr)) {
if (IS_TYPE_POINTER_ONLY(s2->expr->rtype) && tptr->target->size != TYPE_POINTER(s2->expr->rtype)->target->size) if (IS_TYPE_POINTER_ONLY(s2->expr->rtype) && tptr->target->size != TYPE_POINTER(s2->expr->rtype)->target->size)
CError_Warning(174); CError_Warning(CErrorStr174);
size = tmp = s2->expr->data.string.size; size = tmp = s2->expr->data.string.size;
if (is_zero_size) { if (is_zero_size) {
tptr->size = s2->expr->data.string.size; tptr->size = s2->expr->data.string.size;
@ -734,7 +734,7 @@ static void CInit_InitTypeArray(CInit_Stuff *s, CInit_Stuff2 *s2, TypePointer *t
} else { } else {
if (s2->expr->data.string.size > tptr->size) { if (s2->expr->data.string.size > tptr->size) {
if (copts.cplusplus || (s2->expr->data.string.size - 1) > tptr->size) if (copts.cplusplus || (s2->expr->data.string.size - 1) > tptr->size)
CError_Error(147); CError_Error(CErrorStr147);
s2->expr->data.string.size = tptr->size; s2->expr->data.string.size = tptr->size;
size = tptr->size; size = tptr->size;
} }
@ -742,7 +742,7 @@ static void CInit_InitTypeArray(CInit_Stuff *s, CInit_Stuff2 *s2, TypePointer *t
} }
} else { } else {
if (!flag && errorflag) { if (!flag && errorflag) {
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
@ -760,7 +760,7 @@ static void CInit_InitTypeArray(CInit_Stuff *s, CInit_Stuff2 *s2, TypePointer *t
} else { } else {
if (tptr->size <= i * targetsize) { if (tptr->size <= i * targetsize) {
i--; i--;
CError_Error(147); CError_Error(CErrorStr147);
} }
s->size = start + i * targetsize; s->size = start + i * targetsize;
CInit_InitType(s, s2, tptr->target, qual, 0); CInit_InitType(s, s2, tptr->target, qual, 0);
@ -777,7 +777,7 @@ static void CInit_InitTypeArray(CInit_Stuff *s, CInit_Stuff2 *s2, TypePointer *t
tk = lex(); tk = lex();
return; return;
default: default:
CError_Error(130); CError_Error(CErrorStr130);
return; return;
} }
@ -791,10 +791,10 @@ static void CInit_InitTypeArray(CInit_Stuff *s, CInit_Stuff2 *s2, TypePointer *t
tk = lex(); tk = lex();
return; return;
case Stage2: case Stage2:
CError_Error(147); CError_Error(CErrorStr147);
return; return;
default: default:
CError_Error(130); CError_Error(CErrorStr130);
} }
} }
} }
@ -813,7 +813,7 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr
tstruct = TYPE_STRUCT(s2->type); tstruct = TYPE_STRUCT(s2->type);
if (!(member = tstruct->members)) { if (!(member = tstruct->members)) {
CError_Error(145); CError_Error(CErrorStr145);
return; return;
} }
@ -835,7 +835,7 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr
case Stage2: case Stage2:
break; break;
default: default:
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
@ -851,7 +851,7 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr
s->size = start + member->offset; s->size = start + member->offset;
if (!member->type->size) { if (!member->type->size) {
if (!errorflag || !IS_TYPE_ARRAY(member->type)) { if (!errorflag || !IS_TYPE_ARRAY(member->type)) {
CError_Error(147); CError_Error(CErrorStr147);
if (!IS_TYPE_ARRAY(member->type)) if (!IS_TYPE_ARRAY(member->type))
return; return;
} }
@ -882,10 +882,10 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr
tk = lex(); tk = lex();
return; return;
case Stage2: case Stage2:
CError_Error(147); CError_Error(CErrorStr147);
return; return;
default: default:
CError_Error(130); CError_Error(CErrorStr130);
return; return;
} }
} }
@ -911,7 +911,7 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr
for (i = 1; i < 16; i++) for (i = 1; i < 16; i++)
p[i] = val; p[i] = val;
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} }
break; break;
@ -927,7 +927,7 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr
for (i = 1; i < 8; i++) for (i = 1; i < 8; i++)
p[i] = val; p[i] = val;
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} }
break; break;
@ -943,7 +943,7 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr
for (i = 1; i < 4; i++) for (i = 1; i < 4; i++)
p[i] = val; p[i] = val;
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} }
break; break;
@ -951,7 +951,7 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr
} }
return; return;
default: default:
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
} }
@ -981,7 +981,7 @@ static void CInit_InitTypeClass(CInit_Stuff *s, CInit_Stuff2 *s2, TypeClass *tcl
TypePointer arraytype; TypePointer arraytype;
if (tclass->bases || tclass->vtable) { if (tclass->bases || tclass->vtable) {
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
@ -1003,7 +1003,7 @@ static void CInit_InitTypeClass(CInit_Stuff *s, CInit_Stuff2 *s2, TypeClass *tcl
case Stage2: case Stage2:
break; break;
default: default:
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
@ -1016,13 +1016,13 @@ static void CInit_InitTypeClass(CInit_Stuff *s, CInit_Stuff2 *s2, TypeClass *tcl
for (ivar = tclass->ivars; ivar; ivar = ivar->next) { for (ivar = tclass->ivars; ivar; ivar = ivar->next) {
if (ivar->access != ACCESSPUBLIC) { if (ivar->access != ACCESSPUBLIC) {
CError_Error(174); CError_Error(CErrorStr174);
break; break;
} }
} }
if (!(ivar = tclass->ivars)) { if (!(ivar = tclass->ivars)) {
CError_Error(147); CError_Error(CErrorStr147);
return; return;
} }
start = s->size; start = s->size;
@ -1030,7 +1030,7 @@ static void CInit_InitTypeClass(CInit_Stuff *s, CInit_Stuff2 *s2, TypeClass *tcl
s->size = start + ivar->offset; s->size = start + ivar->offset;
if (!ivar->type->size) { if (!ivar->type->size) {
if (!errorflag || !IS_TYPE_ARRAY(ivar->type)) { if (!errorflag || !IS_TYPE_ARRAY(ivar->type)) {
CError_Error(147); CError_Error(CErrorStr147);
if (!IS_TYPE_ARRAY(ivar->type)) if (!IS_TYPE_ARRAY(ivar->type))
return; return;
} }
@ -1050,10 +1050,10 @@ static void CInit_InitTypeClass(CInit_Stuff *s, CInit_Stuff2 *s2, TypeClass *tcl
tk = lex(); tk = lex();
return; return;
case Stage2: case Stage2:
CError_Error(147); CError_Error(CErrorStr147);
return; return;
default: default:
CError_Error(130); CError_Error(CErrorStr130);
return; return;
} }
} }
@ -1068,7 +1068,7 @@ static void CInit_InitTypeClass(CInit_Stuff *s, CInit_Stuff2 *s2, TypeClass *tcl
tk = lex(); tk = lex();
break; break;
default: default:
CError_Error(174); CError_Error(CErrorStr174);
} }
return; return;
} }
@ -1080,7 +1080,7 @@ static void CInit_InitType(CInit_Stuff *s, CInit_Stuff2 *s2, Type *type, UInt32
switch (type->type) { switch (type->type) {
case TYPEVOID: case TYPEVOID:
CError_Error(174); CError_Error(CErrorStr174);
break; break;
case TYPEINT: case TYPEINT:
case TYPEFLOAT: case TYPEFLOAT:
@ -1098,7 +1098,7 @@ static void CInit_InitType(CInit_Stuff *s, CInit_Stuff2 *s2, Type *type, UInt32
break; break;
} }
if (s2->stage != Stage2) { if (s2->stage != Stage2) {
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
@ -1131,10 +1131,10 @@ static void CInit_InitType(CInit_Stuff *s, CInit_Stuff2 *s2, Type *type, UInt32
tk = lex(); tk = lex();
break; break;
case Stage2: case Stage2:
CError_Error(147); CError_Error(CErrorStr147);
break; break;
default: default:
CError_Error(130); CError_Error(CErrorStr130);
} }
} }
break; break;
@ -1165,7 +1165,7 @@ static void CInit_InitData(CInit_Stuff *s, Type *type, UInt32 qual, Boolean flag
if (IS_TYPE_ARRAY(type)) if (IS_TYPE_ARRAY(type))
s->bufferSize = 16 * TYPE_POINTER(type)->target->size; s->bufferSize = 16 * TYPE_POINTER(type)->target->size;
else else
CError_Error(145); CError_Error(CErrorStr145);
} else { } else {
s->bufferSize = type->size; s->bufferSize = type->size;
} }
@ -1199,7 +1199,7 @@ static void CInit_InitData(CInit_Stuff *s, Type *type, UInt32 qual, Boolean flag
s->buffer = buffer; s->buffer = buffer;
} }
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
s->size = size; s->size = size;
@ -1282,7 +1282,7 @@ static Boolean CInit_ConstructGlobalObject(Object *obj, TypeClass *tclass, ENode
if (tk == ')') if (tk == ')')
tk = lex(); tk = lex();
else else
CError_Error(115); CError_Error(CErrorStr115);
} else if (valueexpr) { } else if (valueexpr) {
list = lalloc(sizeof(ENodeList)); list = lalloc(sizeof(ENodeList));
list->node = valueexpr; list->node = valueexpr;
@ -1300,7 +1300,7 @@ static Boolean CInit_ConstructGlobalObject(Object *obj, TypeClass *tclass, ENode
if (tk == '=') { if (tk == '=') {
ctorflag = 0; ctorflag = 0;
if (list) if (list)
CError_Error(174); CError_Error(CErrorStr174);
list = lalloc(sizeof(ENodeList)); list = lalloc(sizeof(ENodeList));
list->next = NULL; list->next = NULL;
@ -1310,12 +1310,12 @@ static Boolean CInit_ConstructGlobalObject(Object *obj, TypeClass *tclass, ENode
expr = CExpr_ConstructObject(tclass, expr, list, 0, 1, 0, 1, ctorflag); expr = CExpr_ConstructObject(tclass, expr, list, 0, 1, 0, 1, ctorflag);
if (expr->rtype->type != TYPEPOINTER) { if (expr->rtype->type != TYPEPOINTER) {
CError_Error(174); CError_Error(CErrorStr174);
return 1; return 1;
} }
} else { } else {
if (list) if (list)
CError_Error(174); CError_Error(CErrorStr174);
} }
if (dtor) if (dtor)
@ -1353,7 +1353,7 @@ static Boolean CInit_ConstructAutoObject(TypeClass *tclass, ENode *expr, SInt32
if (tk == ')') if (tk == ')')
tk = lex(); tk = lex();
else else
CError_Error(115); CError_Error(CErrorStr115);
} else if (expr) { } else if (expr) {
r30 = lalloc(sizeof(ENodeList)); r30 = lalloc(sizeof(ENodeList));
r30->node = expr; r30->node = expr;
@ -1366,7 +1366,7 @@ static Boolean CInit_ConstructAutoObject(TypeClass *tclass, ENode *expr, SInt32
r24 = 1; r24 = 1;
if (tk == '=') { if (tk == '=') {
if (r30) if (r30)
CError_Error(174); CError_Error(CErrorStr174);
r30 = lalloc(sizeof(ENodeList)); r30 = lalloc(sizeof(ENodeList));
r30->next = NULL; r30->next = NULL;
tk = lex(); tk = lex();
@ -1384,7 +1384,7 @@ static Boolean CInit_ConstructAutoObject(TypeClass *tclass, ENode *expr, SInt32
r29 = CExpr_ConstructObject(tclass, r29, r30, 0, 1, 0, 1, r24); r29 = CExpr_ConstructObject(tclass, r29, r30, 0, 1, 0, 1, r24);
if (!IS_TYPE_POINTER_ONLY(r29->rtype)) { if (!IS_TYPE_POINTER_ONLY(r29->rtype)) {
CError_Error(174); CError_Error(CErrorStr174);
return 1; return 1;
} }
r29 = makemonadicnode(r29, EINDIRECT); r29 = makemonadicnode(r29, EINDIRECT);
@ -1392,7 +1392,7 @@ static Boolean CInit_ConstructAutoObject(TypeClass *tclass, ENode *expr, SInt32
cinit_initinfo->insert_expr_cb(r29); cinit_initinfo->insert_expr_cb(r29);
} else { } else {
if (r30) if (r30)
CError_Error(174); CError_Error(CErrorStr174);
if (dtor) if (dtor)
r29 = cinit_initinfo->register_object_cb(TYPE(tclass), cinit_initinfo->obj1C, offset, 0); r29 = cinit_initinfo->register_object_cb(TYPE(tclass), cinit_initinfo->obj1C, offset, 0);
cinit_initinfo->insert_expr_cb(r29); cinit_initinfo->insert_expr_cb(r29);
@ -1421,7 +1421,7 @@ static void CInit_ExprPointer(TypePointer *tptr, ENode *expr) {
cinit_initinfo->expr_cb(TYPE(tptr), expr, 0); cinit_initinfo->expr_cb(TYPE(tptr), expr, 0);
cinit_initinfo->expr_cb_called = 1; cinit_initinfo->expr_cb_called = 1;
} else { } else {
CError_Error(124); CError_Error(CErrorStr124);
} }
cinit_initinfo->expr_offset += 4; cinit_initinfo->expr_offset += 4;
@ -1436,7 +1436,7 @@ static void CInit_ExprInt(TypeIntegral *tint, ENode *expr) {
cinit_initinfo->expr_cb(TYPE(tint), expr, 0); cinit_initinfo->expr_cb(TYPE(tint), expr, 0);
cinit_initinfo->expr_cb_called = 1; cinit_initinfo->expr_cb_called = 1;
} else { } else {
CError_Error(124); CError_Error(CErrorStr124);
} }
cinit_initinfo->expr_offset += tint->size; cinit_initinfo->expr_offset += tint->size;
@ -1449,7 +1449,7 @@ static void CInit_ExprFloat(TypeIntegral *tint, ENode *expr) {
cinit_initinfo->expr_cb(TYPE(tint), expr, 0); cinit_initinfo->expr_cb(TYPE(tint), expr, 0);
cinit_initinfo->expr_cb_called = 1; cinit_initinfo->expr_cb_called = 1;
} else { } else {
CError_Error(124); CError_Error(CErrorStr124);
} }
cinit_initinfo->expr_offset += tint->size; cinit_initinfo->expr_offset += tint->size;
@ -1462,7 +1462,7 @@ static void CInit_ExprEnum(TypeEnum *tenum, ENode *expr) {
cinit_initinfo->expr_cb(TYPE(tenum), expr, 0); cinit_initinfo->expr_cb(TYPE(tenum), expr, 0);
cinit_initinfo->expr_cb_called = 1; cinit_initinfo->expr_cb_called = 1;
} else { } else {
CError_Error(124); CError_Error(CErrorStr124);
} }
cinit_initinfo->expr_offset += tenum->size; cinit_initinfo->expr_offset += tenum->size;
@ -1475,7 +1475,7 @@ static void CInit_ExprMemberPointer(TypeMemberPointer *tmptr, ENode *expr) {
cinit_initinfo->expr_cb(TYPE(tmptr), expr, 0); cinit_initinfo->expr_cb(TYPE(tmptr), expr, 0);
cinit_initinfo->expr_cb_called = 1; cinit_initinfo->expr_cb_called = 1;
} else { } else {
CError_Error(124); CError_Error(CErrorStr124);
} }
cinit_initinfo->expr_offset += tmptr->size; cinit_initinfo->expr_offset += tmptr->size;
@ -1504,11 +1504,11 @@ static void CInit_TypeExpr(Type *type, ENode *expr) {
cinit_initinfo->expr_cb(type, expr, 0); cinit_initinfo->expr_cb(type, expr, 0);
cinit_initinfo->expr_cb_called = 1; cinit_initinfo->expr_cb_called = 1;
} else { } else {
CError_Error(124); CError_Error(CErrorStr124);
} }
break; break;
case TYPEARRAY: case TYPEARRAY:
CError_Error(174); CError_Error(CErrorStr174);
break; break;
default: default:
CError_FATAL(2082); CError_FATAL(2082);
@ -1533,7 +1533,7 @@ static void CInit_Bitfield(TypeBitfield *tbitfield) {
if (ENODE_IS(expr, EINTCONST)) if (ENODE_IS(expr, EINTCONST))
CInit_SetBitfield(tbitfield, (UInt8 *) cinit_initinfo->buffer + cinit_initinfo->expr_offset, expr->data.intval); CInit_SetBitfield(tbitfield, (UInt8 *) cinit_initinfo->buffer + cinit_initinfo->expr_offset, expr->data.intval);
else else
CError_Error(124); CError_Error(CErrorStr124);
if (r30) if (r30)
CInit_CloseInitList(); CInit_CloseInitList();
@ -1553,13 +1553,13 @@ static void CInit_Array(TypePointer *tptr, UInt32 qual, Boolean flag) {
targetsize2 = tptr->target->size; targetsize2 = tptr->target->size;
if (!tptr->target->size) { if (!tptr->target->size) {
if (!IS_TYPE_ARRAY(tptr->target)) { if (!IS_TYPE_ARRAY(tptr->target)) {
CError_Error(145); CError_Error(CErrorStr145);
return; return;
} }
targetsize1 = tptr->target->size; targetsize1 = tptr->target->size;
targetsize2 = tptr->target->size; targetsize2 = tptr->target->size;
if (!tptr->target->size) { if (!tptr->target->size) {
CError_Error(145); CError_Error(CErrorStr145);
return; return;
} }
} }
@ -1570,7 +1570,7 @@ static void CInit_Array(TypePointer *tptr, UInt32 qual, Boolean flag) {
in_block = 1; in_block = 1;
if (flag && !(tk == TK_STRING && is_char_ptr) && !(tk == TK_STRING_WIDE && is_wchar_ptr)) { if (flag && !(tk == TK_STRING && is_char_ptr) && !(tk == TK_STRING_WIDE && is_wchar_ptr)) {
if (tk != '{') { if (tk != '{') {
CError_ErrorSkip(135); CError_ErrorSkip(CErrorStr135);
return; return;
} }
tk = lex(); tk = lex();
@ -1585,7 +1585,7 @@ static void CInit_Array(TypePointer *tptr, UInt32 qual, Boolean flag) {
if (tptr->size) { if (tptr->size) {
if (tksize > tptr->size) { if (tksize > tptr->size) {
if (copts.cplusplus || (tksize - (is_wchar_ptr ? stwchar.size : 1)) > tptr->size) if (copts.cplusplus || (tksize - (is_wchar_ptr ? stwchar.size : 1)) > tptr->size)
CError_Error(147); CError_Error(CErrorStr147);
tksize = tptr->size; tksize = tptr->size;
} }
memcpy(cinit_initinfo->buffer + cinit_initinfo->expr_offset, tkstring, tksize); memcpy(cinit_initinfo->buffer + cinit_initinfo->expr_offset, tkstring, tksize);
@ -1618,7 +1618,7 @@ static void CInit_Array(TypePointer *tptr, UInt32 qual, Boolean flag) {
cinit_initinfo->expr_cb(tptr->target, NULL, 1); cinit_initinfo->expr_cb(tptr->target, NULL, 1);
cinit_initinfo->expr_cb_called = 1; cinit_initinfo->expr_cb_called = 1;
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
i++; i++;
} }
@ -1640,7 +1640,7 @@ static void CInit_Array(TypePointer *tptr, UInt32 qual, Boolean flag) {
cinit_initinfo->expr_cb(tptr->target, conv_assignment_expression(), 1); cinit_initinfo->expr_cb(tptr->target, conv_assignment_expression(), 1);
cinit_initinfo->expr_cb_called = 1; cinit_initinfo->expr_cb_called = 1;
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} else { } else {
CInit_Type(tptr->target, qual, 0); CInit_Type(tptr->target, qual, 0);
@ -1648,7 +1648,7 @@ static void CInit_Array(TypePointer *tptr, UInt32 qual, Boolean flag) {
} else { } else {
if (tptr->size <= i * targetsize1) { if (tptr->size <= i * targetsize1) {
i--; i--;
CError_Error(147); CError_Error(CErrorStr147);
} }
cinit_initinfo->expr_offset = start + i * targetsize2; cinit_initinfo->expr_offset = start + i * targetsize2;
@ -1657,7 +1657,7 @@ static void CInit_Array(TypePointer *tptr, UInt32 qual, Boolean flag) {
cinit_initinfo->expr_cb(tptr->target, conv_assignment_expression(), 1); cinit_initinfo->expr_cb(tptr->target, conv_assignment_expression(), 1);
cinit_initinfo->expr_cb_called = 1; cinit_initinfo->expr_cb_called = 1;
} else { } else {
CError_Error(174); CError_Error(CErrorStr174);
} }
} else { } else {
CInit_Type(tptr->target, qual, 0); CInit_Type(tptr->target, qual, 0);
@ -1671,7 +1671,7 @@ static void CInit_Array(TypePointer *tptr, UInt32 qual, Boolean flag) {
if (tk != '}') { if (tk != '}') {
if (tk != ',') { if (tk != ',') {
CError_ErrorSkip(121); CError_ErrorSkip(CErrorStr121);
in_block = 0; in_block = 0;
i++; i++;
goto innerloop; goto innerloop;
@ -1688,7 +1688,7 @@ static void CInit_Struct(TypeStruct *tstruct, Boolean flag) {
Boolean in_block; Boolean in_block;
if (!(member = tstruct->members)) { if (!(member = tstruct->members)) {
CError_Error(145); CError_Error(CErrorStr145);
return; return;
} }
@ -1711,7 +1711,7 @@ static void CInit_Struct(TypeStruct *tstruct, Boolean flag) {
if (tk != '{') { if (tk != '{') {
if (flag) if (flag)
CError_ErrorSkip(135); CError_ErrorSkip(CErrorStr135);
in_block = 0; in_block = 0;
} else { } else {
in_block = 1; in_block = 1;
@ -1725,7 +1725,7 @@ static void CInit_Struct(TypeStruct *tstruct, Boolean flag) {
cinit_initinfo->expr_offset = start + member->offset; cinit_initinfo->expr_offset = start + member->offset;
if (!member->type->size && IS_TYPE_ARRAY(member->type)) { if (!member->type->size && IS_TYPE_ARRAY(member->type)) {
CError_Error(147); CError_Error(CErrorStr147);
break; break;
} }
@ -1734,7 +1734,7 @@ static void CInit_Struct(TypeStruct *tstruct, Boolean flag) {
break; break;
if (tk != ',') { if (tk != ',') {
CError_Error(121); CError_Error(CErrorStr121);
break; break;
} }
@ -1746,7 +1746,7 @@ static void CInit_Struct(TypeStruct *tstruct, Boolean flag) {
if (!in_block) if (!in_block)
break; break;
if ((tk = lex()) != '}') { if ((tk = lex()) != '}') {
CError_Error(147); CError_Error(CErrorStr147);
break; break;
} }
} else { } else {
@ -1772,7 +1772,7 @@ static void CInit_Class(TypeClass *tclass, Boolean flag) {
} }
if (tclass->bases || tclass->vtable) { if (tclass->bases || tclass->vtable) {
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
@ -1789,7 +1789,7 @@ static void CInit_Class(TypeClass *tclass, Boolean flag) {
break; break;
if (!ivar->type->size && IS_TYPE_ARRAY(ivar->type)) { if (!ivar->type->size && IS_TYPE_ARRAY(ivar->type)) {
CError_Error(147); CError_Error(CErrorStr147);
break; break;
} }
@ -1800,7 +1800,7 @@ static void CInit_Class(TypeClass *tclass, Boolean flag) {
break; break;
if (tk != ',') { if (tk != ',') {
CError_Error(121); CError_Error(CErrorStr121);
break; break;
} }
@ -1812,7 +1812,7 @@ static void CInit_Class(TypeClass *tclass, Boolean flag) {
if (!in_block) if (!in_block)
break; break;
if ((tk = lex()) != '}') { if ((tk = lex()) != '}') {
CError_Error(147); CError_Error(CErrorStr147);
break; break;
} }
} else { } else {
@ -1821,11 +1821,11 @@ static void CInit_Class(TypeClass *tclass, Boolean flag) {
} }
} else { } else {
if (in_block && tk != '}') if (in_block && tk != '}')
CError_Error(147); CError_Error(CErrorStr147);
} }
} else { } else {
if (in_block) if (in_block)
CError_Error(174); CError_Error(CErrorStr174);
CInit_TypeExpr(TYPE(tclass), CExpr_AssignmentPromotion(conv_assignment_expression(), TYPE(tclass), 0, 1)); CInit_TypeExpr(TYPE(tclass), CExpr_AssignmentPromotion(conv_assignment_expression(), TYPE(tclass), 0, 1));
} }
@ -1840,7 +1840,7 @@ static void CInit_Type(Type *type, UInt32 qual, Boolean flag) {
switch (type->type) { switch (type->type) {
case TYPEVOID: case TYPEVOID:
CError_Error(174); CError_Error(CErrorStr174);
break; break;
case TYPEINT: case TYPEINT:
case TYPEFLOAT: case TYPEFLOAT:
@ -1885,7 +1885,7 @@ static void CInit_GlobalStaticInit(Type *type, ENode *valueexpr, Boolean flag) {
} else { } else {
expr = create_objectrefnode(cinit_initinfo->obj); expr = create_objectrefnode(cinit_initinfo->obj);
if (!IS_TYPE_POINTER_ONLY(expr->rtype)) { if (!IS_TYPE_POINTER_ONLY(expr->rtype)) {
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
TYPE_POINTER(expr->rtype)->target = type; TYPE_POINTER(expr->rtype)->target = type;
@ -1920,7 +1920,7 @@ static void CInit_AutoInit(Type *type, ENode *valueexpr, Boolean flag) {
} }
expr = create_objectrefnode(cinit_initinfo->obj1C); expr = create_objectrefnode(cinit_initinfo->obj1C);
if (!IS_TYPE_POINTER_ONLY(expr->rtype)) { if (!IS_TYPE_POINTER_ONLY(expr->rtype)) {
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
TYPE_POINTER(expr->rtype)->target = type; TYPE_POINTER(expr->rtype)->target = type;
@ -1932,7 +1932,7 @@ static void CInit_AutoInit(Type *type, ENode *valueexpr, Boolean flag) {
tmp->rtype = type; tmp->rtype = type;
expr = makediadicnode(tmp, valueexpr, EASS); expr = makediadicnode(tmp, valueexpr, EASS);
if (!copts.cplusplus) if (!copts.cplusplus)
CError_Error(124); CError_Error(CErrorStr124);
cinit_initinfo->insert_expr_cb(expr); cinit_initinfo->insert_expr_cb(expr);
} }
} }
@ -1961,11 +1961,11 @@ static ENode *CInit_GenericData(Object *obj, Type *type, UInt32 qual, ExprCB exp
if (tk == '(') { if (tk == '(') {
if (IS_TYPE_ARRAY(type)) if (IS_TYPE_ARRAY(type))
CError_Error(174); CError_Error(CErrorStr174);
tk = lex(); tk = lex();
expr = CExpr_AssignmentPromotion(assignment_expression(), type, qual, 1); expr = CExpr_AssignmentPromotion(assignment_expression(), type, qual, 1);
if (tk != ')') if (tk != ')')
CError_ErrorSkip(115); CError_ErrorSkip(CErrorStr115);
else else
tk = lex(); tk = lex();
goto jump_ahead; goto jump_ahead;
@ -1975,7 +1975,7 @@ static ENode *CInit_GenericData(Object *obj, Type *type, UInt32 qual, ExprCB exp
switch (type->type) { switch (type->type) {
case TYPECLASS: case TYPECLASS:
if (tk == '{' && CClass_Constructor(TYPE_CLASS(type))) if (tk == '{' && CClass_Constructor(TYPE_CLASS(type)))
CError_Error(174); CError_Error(CErrorStr174);
case TYPESTRUCT: case TYPESTRUCT:
if (tk != '{') if (tk != '{')
goto generic_type; goto generic_type;
@ -2195,7 +2195,7 @@ static void CInit_InitializeClassArray(Object *obj, TypeClass *tclass, Boolean f
if (!ctor) { if (!ctor) {
ctor = CClass_DummyDefaultConstructor(tclass); ctor = CClass_DummyDefaultConstructor(tclass);
if (!ctor) { if (!ctor) {
CError_Error(203); CError_Error(CErrorStr203);
return; return;
} }
} }
@ -2314,7 +2314,7 @@ static ENode *CInit_GlobalTempNode(Type *type, Boolean flag) {
node = create_objectrefnode(CInit_CreateStaticData(type)); node = create_objectrefnode(CInit_CreateStaticData(type));
if (IS_TYPE_CLASS(type) && (dtor = CClass_Destructor(TYPE_CLASS(type))) && !copts.no_static_dtors) { if (IS_TYPE_CLASS(type) && (dtor = CClass_Destructor(TYPE_CLASS(type))) && !copts.no_static_dtors) {
if (flag) if (flag)
CError_Error(190); CError_Error(CErrorStr190);
funcnode = galloc(sizeof(ENode)); funcnode = galloc(sizeof(ENode));
funcnode->type = EFUNCCALL; funcnode->type = EFUNCCALL;
@ -2340,7 +2340,7 @@ static void CInit_RefInit(Type *type, ENode *expr, Boolean flag) {
objexpr = create_objectrefnode(cinit_initinfo->obj); objexpr = create_objectrefnode(cinit_initinfo->obj);
if (!IS_TYPE_POINTER_ONLY(objexpr->rtype)) { if (!IS_TYPE_POINTER_ONLY(objexpr->rtype)) {
CError_Error(174); CError_Error(CErrorStr174);
return; return;
} }
TYPE_POINTER(objexpr->rtype)->target = type; TYPE_POINTER(objexpr->rtype)->target = type;
@ -2575,7 +2575,7 @@ void CInit_InitializeAutoData(Object *obj, InsertExprCB insert_cb, RegisterObjec
tk = lex(); tk = lex();
expr = conv_assignment_expression(); expr = conv_assignment_expression();
if (tk != ')') if (tk != ')')
CError_Error(115); CError_Error(CErrorStr115);
tk = lex(); tk = lex();
} else if (tk == '=' && ((tk = lex()) == '{' || IS_TYPE_ARRAY(obj->type))) { } else if (tk == '=' && ((tk = lex()) == '{' || IS_TYPE_ARRAY(obj->type))) {
insert_cb(CInit_AutoObject(obj, obj->type, obj->qual)); insert_cb(CInit_AutoObject(obj, obj->type, obj->qual));
@ -2586,7 +2586,7 @@ void CInit_InitializeAutoData(Object *obj, InsertExprCB insert_cb, RegisterObjec
expr = CExpr_AssignmentPromotion(expr, obj->type, obj->qual & (Q_CONST | Q_VOLATILE), 1); expr = CExpr_AssignmentPromotion(expr, obj->type, obj->qual & (Q_CONST | Q_VOLATILE), 1);
insert_cb(makediadicnode(create_objectnode2(obj), expr, EASS)); insert_cb(makediadicnode(create_objectnode2(obj), expr, EASS));
} else if (copts.cplusplus && is_const_object(obj)) { } else if (copts.cplusplus && is_const_object(obj)) {
CError_Error(224); CError_Error(CErrorStr224);
} }
return; return;
@ -2626,13 +2626,13 @@ void CInit_InitializeAutoData(Object *obj, InsertExprCB insert_cb, RegisterObjec
CFunc_CheckClassCtors(TYPE_CLASS(obj->type)); CFunc_CheckClassCtors(TYPE_CLASS(obj->type));
if ((IS_TYPE_REFERENCE(obj->type) || is_const_object(obj)) && copts.cplusplus) if ((IS_TYPE_REFERENCE(obj->type) || is_const_object(obj)) && copts.cplusplus)
CError_Error(224); CError_Error(CErrorStr224);
} else { } else {
if (obj->type->size || IS_TYPE_ARRAY(obj->type)) { if (obj->type->size || IS_TYPE_ARRAY(obj->type)) {
if ((expr = CInit_GenericData(NULL, obj->type, obj->qual, CInit_AutoInit, 0))) if ((expr = CInit_GenericData(NULL, obj->type, obj->qual, CInit_AutoInit, 0)))
insert_cb(makediadicnode(create_objectnode2(obj), expr, EASS)); insert_cb(makediadicnode(create_objectnode2(obj), expr, EASS));
} else { } else {
CError_Error(145); CError_Error(CErrorStr145);
} }
} }
@ -2675,7 +2675,7 @@ void CInit_InitializeStaticData(Object *obj, InitExprRegisterCB cb) {
} }
} else { } else {
if (copts.cplusplus && is_const_object(obj)) if (copts.cplusplus && is_const_object(obj))
CError_Error(224); CError_Error(CErrorStr224);
if (is_const_object(obj)) if (is_const_object(obj))
CInit_DeclareReadOnlyData(obj, NULL, NULL, obj->type->size); CInit_DeclareReadOnlyData(obj, NULL, NULL, obj->type->size);
@ -2723,13 +2723,13 @@ void CInit_InitializeStaticData(Object *obj, InitExprRegisterCB cb) {
CFunc_CheckClassCtors(TYPE_CLASS(obj->type)); CFunc_CheckClassCtors(TYPE_CLASS(obj->type));
if ((IS_TYPE_REFERENCE(obj->type) || is_const_object(obj)) && copts.cplusplus) if ((IS_TYPE_REFERENCE(obj->type) || is_const_object(obj)) && copts.cplusplus)
CError_Error(224); CError_Error(CErrorStr224);
} else { } else {
if (obj->type->size || IS_TYPE_ARRAY(obj->type)) { if (obj->type->size || IS_TYPE_ARRAY(obj->type)) {
if ((expr = CInit_GenericData(obj, obj->type, obj->qual, CInit_GlobalStaticInit, 1))) if ((expr = CInit_GenericData(obj, obj->type, obj->qual, CInit_GlobalStaticInit, 1)))
cb(makediadicnode(create_objectnode2(obj), expr, EASS)); cb(makediadicnode(create_objectnode2(obj), expr, EASS));
} else { } else {
CError_Error(145); CError_Error(CErrorStr145);
} }
} }
@ -2770,7 +2770,7 @@ void CInit_InitializeData(Object *obj) {
} }
} else { } else {
if (obj->flags & OBJECT_FLAGS_4) if (obj->flags & OBJECT_FLAGS_4)
CError_Error(329, obj); CError_Error(CErrorStr329, obj);
obj->flags |= OBJECT_FLAGS_4; obj->flags |= OBJECT_FLAGS_4;
needs_construction = 0; needs_construction = 0;
@ -2803,7 +2803,7 @@ void CInit_InitializeData(Object *obj) {
if (!needs_construction && copts.cplusplus) { if (!needs_construction && copts.cplusplus) {
if (IS_TYPE_REFERENCE(obj->type) || is_const_object(obj)) if (IS_TYPE_REFERENCE(obj->type) || is_const_object(obj))
CError_Error(224); CError_Error(CErrorStr224);
} }
if (IsCompleteType(obj->type)) if (IsCompleteType(obj->type))
CInit_DeclareData(obj, NULL, NULL, obj->type->size); CInit_DeclareData(obj, NULL, NULL, obj->type->size);
@ -2813,13 +2813,13 @@ void CInit_InitializeData(Object *obj) {
} }
if (obj->flags & OBJECT_FLAGS_4) if (obj->flags & OBJECT_FLAGS_4)
CError_Error(329, obj); CError_Error(CErrorStr329, obj);
if (CInit_IsSimpleStructArrayInit(obj->type)) { if (CInit_IsSimpleStructArrayInit(obj->type)) {
if (tk == '=') if (tk == '=')
tk = lex(); tk = lex();
else else
CError_Error(121); CError_Error(CErrorStr121);
CInit_GlobalObject(obj); CInit_GlobalObject(obj);
return; return;
} }
@ -2838,7 +2838,7 @@ void CInit_InitializeData(Object *obj) {
} }
if (obj->type->size == 0 && !IS_TYPE_ARRAY(obj->type)) { if (obj->type->size == 0 && !IS_TYPE_ARRAY(obj->type)) {
CError_Error(145); CError_Error(CErrorStr145);
CInit_CleanupInitInfo(&initinfo); CInit_CleanupInitInfo(&initinfo);
return; return;
} }
@ -2977,7 +2977,7 @@ void CInit_RewriteString(ENode *expr, Boolean flag) {
Boolean is_wide; Boolean is_wide;
if (cparamblkptr->isPrecompiling == 1) if (cparamblkptr->isPrecompiling == 1)
CError_Error(180); CError_Error(CErrorStr180);
CError_ASSERT(4220, expr->rtype->type == TYPEPOINTER); CError_ASSERT(4220, expr->rtype->type == TYPEPOINTER);

View File

@ -3458,7 +3458,7 @@ void CInline_AddDefaultFunctionAction(Object *object) {
cinline_actionlist = action; cinline_actionlist = action;
} }
void CInline_AddInlineFunctionAction(Object *object, TypeClass *tclass, FileOffsetInfo *fileoffset, TStream *stream, Boolean flag) { void CInline_AddInlineFunctionAction(Object *object, TypeClass *tclass, FileOffsetInfo *fileoffset, TokenStream *stream, Boolean flag) {
CI_Action *action; CI_Action *action;
for (action = flag ? cinline_tactionlist : cinline_actionlist; action; action = action->next) { for (action = flag ? cinline_tactionlist : cinline_actionlist; action; action = action->next) {

View File

@ -8,7 +8,7 @@ const CInt64 cint64_min = {0x80000000, 0};
#define SHIFT_LEFT_ONE(a, b) do { a <<= 1; if (b & 0x80000000) { a |= 1; } b <<= 1; } while(0) #define SHIFT_LEFT_ONE(a, b) do { a <<= 1; if (b & 0x80000000) { a |= 1; } b <<= 1; } while(0)
void CInt64_Init() { void CInt64_Init(void) {
} }
CInt64 CInt64_Not(CInt64 input) { CInt64 CInt64_Not(CInt64 input) {

View File

@ -6,6 +6,7 @@
#include "compiler/CPrep.h" #include "compiler/CPrep.h"
#include "compiler/CPrepTokenizer.h" #include "compiler/CPrepTokenizer.h"
#include "compiler/CompilerTools.h" #include "compiler/CompilerTools.h"
#include "compiler/ScanFloat.h"
#include "compiler/objects.h" #include "compiler/objects.h"
#include "compiler/types.h" #include "compiler/types.h"
@ -126,7 +127,7 @@ static short cmach_packsize[] = {
static SInt16 CMach_GetQualifiedTypeAlign(Type *type, Boolean flag); static SInt16 CMach_GetQualifiedTypeAlign(Type *type, Boolean flag);
static SInt16 CMach_GetMemberAlignment(Type *type, SInt32 align, Boolean flag); static SInt16 CMach_GetMemberAlignment(Type *type, SInt32 align, Boolean flag);
void CMach_Configure() { void CMach_Configure(void) {
} }
SInt32 CMach_GetQUALalign(UInt32 qual) { SInt32 CMach_GetQUALalign(UInt32 qual) {
@ -170,8 +171,7 @@ SInt32 CMach_GetQUALalign(UInt32 qual) {
} }
SInt32 CMach_ArgumentAlignment(Type *type) { SInt32 CMach_ArgumentAlignment(Type *type) {
// does not match - registers char save_align_mode;
UInt8 save_align_mode;
UInt8 save_oldalignment; UInt8 save_oldalignment;
SInt32 align; SInt32 align;
@ -252,13 +252,13 @@ CInt64 CMach_CalcIntDiadic(Type *type, CInt64 left, short op, CInt64 right) {
break; break;
case '/': case '/':
if (CInt64_IsZero(&right)) if (CInt64_IsZero(&right))
CError_Warning(139); CError_Warning(CErrorStr139);
else else
left = CInt64_DivU(left, right); left = CInt64_DivU(left, right);
break; break;
case '%': case '%':
if (CInt64_IsZero(&right)) if (CInt64_IsZero(&right))
CError_Warning(139); CError_Warning(CErrorStr139);
else else
left = CInt64_ModU(left, right); left = CInt64_ModU(left, right);
break; break;
@ -302,13 +302,13 @@ CInt64 CMach_CalcIntDiadic(Type *type, CInt64 left, short op, CInt64 right) {
left = CInt64_Or(left, right); left = CInt64_Or(left, right);
break; break;
case TK_LOGICAL_AND: case TK_LOGICAL_AND:
CInt64_SetLong(&left, (CInt64_IsZero(&left) == 0 && CInt64_IsZero(&right) == 0)); CInt64_SetLong(&left, (!CInt64_IsZero(&left) && !CInt64_IsZero(&right)));
break; break;
case TK_LOGICAL_OR: case TK_LOGICAL_OR:
CInt64_SetLong(&left, (CInt64_IsZero(&left) == 0 || CInt64_IsZero(&right) == 0)); CInt64_SetLong(&left, (!CInt64_IsZero(&left) || !CInt64_IsZero(&right)));
break; break;
default: default:
CError_Error(120); CError_Error(CErrorStr120);
} }
switch (type->size) { switch (type->size) {
@ -350,13 +350,13 @@ CInt64 CMach_CalcIntDiadic(Type *type, CInt64 left, short op, CInt64 right) {
break; break;
case '/': case '/':
if (CInt64_IsZero(&right)) if (CInt64_IsZero(&right))
CError_Warning(139); CError_Warning(CErrorStr139);
else else
left = CInt64_Div(left, right); left = CInt64_Div(left, right);
break; break;
case '%': case '%':
if (CInt64_IsZero(&right)) if (CInt64_IsZero(&right))
CError_Warning(139); CError_Warning(CErrorStr139);
else else
left = CInt64_Mod(left, right); left = CInt64_Mod(left, right);
break; break;
@ -400,13 +400,13 @@ CInt64 CMach_CalcIntDiadic(Type *type, CInt64 left, short op, CInt64 right) {
left = CInt64_Or(left, right); left = CInt64_Or(left, right);
break; break;
case TK_LOGICAL_AND: case TK_LOGICAL_AND:
CInt64_SetLong(&left, (CInt64_IsZero(&left) == 0 && CInt64_IsZero(&right) == 0)); CInt64_SetLong(&left, (!CInt64_IsZero(&left) && !CInt64_IsZero(&right)));
break; break;
case TK_LOGICAL_OR: case TK_LOGICAL_OR:
CInt64_SetLong(&left, (CInt64_IsZero(&left) == 0 || CInt64_IsZero(&right) == 0)); CInt64_SetLong(&left, (!CInt64_IsZero(&left) || !CInt64_IsZero(&right)));
break; break;
default: default:
CError_Error(120); CError_Error(CErrorStr120);
} }
switch (type->size) { switch (type->size) {
@ -456,7 +456,7 @@ CInt64 CMach_CalcIntMonadic(Type *type, short op, CInt64 val) {
val = CInt64_Not(val); val = CInt64_Not(val);
break; break;
default: default:
CError_Error(120); CError_Error(CErrorStr120);
} }
switch (type->size) { switch (type->size) {
@ -500,7 +500,7 @@ CInt64 CMach_CalcIntMonadic(Type *type, short op, CInt64 val) {
val = CInt64_Not(val); val = CInt64_Not(val);
break; break;
default: default:
CError_Error(120); CError_Error(CErrorStr120);
} }
switch (type->size) { switch (type->size) {
@ -683,7 +683,7 @@ char *CMach_FloatScan(char *input, Float *result, Boolean *fail) {
char *outpos; char *outpos;
if (!(outpos = ScanFloat(input, &resultval, fail))) if (!(outpos = ScanFloat(input, &resultval, fail)))
CError_ErrorTerm(154); CError_ErrorTerm(CErrorStr154);
if (*fail) if (*fail)
result->value = 0.0; result->value = 0.0;
@ -768,9 +768,9 @@ void CMach_PrintFloat(char *buf, Float val) {
sprintf(buf, "%g", f); sprintf(buf, "%g", f);
} }
void CMach_PragmaParams() { void CMach_PragmaParams(void) {
if (copts.warn_illpragma) if (copts.warn_illpragma)
CError_Warning(186, 0); CError_Warning(CErrorStr186, 0);
while (notendofline()) while (notendofline())
lex(); lex();
@ -835,16 +835,14 @@ static SInt32 CMach_GetPPCTypeAlign(Type *type, Boolean flag1, Boolean flag2) {
return align; return align;
} }
static SInt16 CMach_GetQualifiedStructAlign(TypeStruct *tstruct, Boolean flag) { static SInt16 CMach_GetQualifiedStructAlign(const TypeStruct *tstruct, Boolean flag) {
StructMember *member; StructMember *member;
SInt32 best; SInt32 best;
SInt32 align; SInt32 align;
Boolean isFirst; Boolean isFirst;
// very close to matching but tstruct->stype gets cached when it should not be if (tstruct->stype >= STRUCT_TYPE_4 && tstruct->stype <= STRUCT_TYPE_E)
if (tstruct->stype >= STRUCT_TYPE_4 && tstruct->stype <= STRUCT_TYPE_E) {
return 16; return 16;
} else {
switch (copts.align_mode) { switch (copts.align_mode) {
case AlignMode3_1Byte: case AlignMode3_1Byte:
@ -858,6 +856,7 @@ static SInt16 CMach_GetQualifiedStructAlign(TypeStruct *tstruct, Boolean flag) {
if (tstruct->size <= 1) if (tstruct->size <= 1)
return 1; return 1;
best = 1; best = 1;
switch (copts.align_mode) { switch (copts.align_mode) {
default: default:
@ -889,7 +888,7 @@ static SInt16 CMach_GetQualifiedStructAlign(TypeStruct *tstruct, Boolean flag) {
best = align; best = align;
} }
} }
} else if (tstruct->stype == STRUCT_TYPE_UNION) { } else if (TYPE_STRUCT(tstruct)->stype == STRUCT_TYPE_UNION) {
for (member = tstruct->members; member; member = member->next) { for (member = tstruct->members; member; member = member->next) {
align = CMach_GetPPCTypeAlign(member->type, 1, flag); align = CMach_GetPPCTypeAlign(member->type, 1, flag);
if (align > best) if (align > best)
@ -917,7 +916,6 @@ static SInt16 CMach_GetQualifiedStructAlign(TypeStruct *tstruct, Boolean flag) {
return best; return best;
} }
} }
}
SInt16 CMach_GetStructAlign(TypeStruct *tstruct) { SInt16 CMach_GetStructAlign(TypeStruct *tstruct) {
return CMach_GetQualifiedStructAlign(tstruct, 1); return CMach_GetQualifiedStructAlign(tstruct, 1);
@ -1029,7 +1027,7 @@ static SInt16 CMach_GetWinMinimizeAlign(SInt16 align) {
} }
static SInt16 CMach_GetQualifiedTypeAlign(Type *type, Boolean flag) { static SInt16 CMach_GetQualifiedTypeAlign(Type *type, Boolean flag) {
Boolean r31; Boolean isWin;
SInt16 align; SInt16 align;
if (type->type == TYPESTRUCT && TYPE_STRUCT(type)->stype >= STRUCT_TYPE_4 && TYPE_STRUCT(type)->stype <= STRUCT_TYPE_E) if (type->type == TYPESTRUCT && TYPE_STRUCT(type)->stype >= STRUCT_TYPE_4 && TYPE_STRUCT(type)->stype <= STRUCT_TYPE_E)
@ -1043,10 +1041,10 @@ static SInt16 CMach_GetQualifiedTypeAlign(Type *type, Boolean flag) {
case AlignMode5_4Byte: case AlignMode5_4Byte:
case AlignMode6_8Byte: case AlignMode6_8Byte:
case AlignMode7_16Byte: case AlignMode7_16Byte:
r31 = 1; isWin = 1;
break; break;
default: default:
r31 = 0; isWin = 0;
break; break;
} }
@ -1059,7 +1057,7 @@ restart:
case TYPEENUM: case TYPEENUM:
type = TYPE_ENUM(type)->enumtype; type = TYPE_ENUM(type)->enumtype;
case TYPEINT: case TYPEINT:
if (r31) if (isWin)
return CMach_GetWinTypeAlign(type); return CMach_GetWinTypeAlign(type);
if (type->size == 1) if (type->size == 1)
return 1; return 1;
@ -1069,7 +1067,7 @@ restart:
return 4; return 4;
return 2; return 2;
case TYPEFLOAT: case TYPEFLOAT:
if (r31) if (isWin)
return CMach_GetWinTypeAlign(type); return CMach_GetWinTypeAlign(type);
switch (copts.align_mode) { switch (copts.align_mode) {
case AlignMode0_Mac68k: case AlignMode0_Mac68k:
@ -1085,7 +1083,7 @@ restart:
} }
case TYPEMEMBERPOINTER: case TYPEMEMBERPOINTER:
case TYPEPOINTER: case TYPEPOINTER:
if (r31) if (isWin)
return CMach_GetWinTypeAlign(type); return CMach_GetWinTypeAlign(type);
if (copts.align_mode == AlignMode0_Mac68k) if (copts.align_mode == AlignMode0_Mac68k)
return 2; return 2;
@ -1093,7 +1091,7 @@ restart:
return 4; return 4;
case TYPEARRAY: case TYPEARRAY:
if (copts.align_array_members) { if (copts.align_array_members) {
if (r31) if (isWin)
return CMach_GetWinTypeAlign(type); return CMach_GetWinTypeAlign(type);
if (type->size == 1) if (type->size == 1)
return 1; return 1;
@ -1115,7 +1113,7 @@ restart:
align = TYPE_STRUCT(type)->align; align = TYPE_STRUCT(type)->align;
else else
align = CMach_GetQualifiedStructAlign(TYPE_STRUCT(type), flag); align = CMach_GetQualifiedStructAlign(TYPE_STRUCT(type), flag);
if (r31) if (isWin)
return CMach_GetWinMinimizeAlign(align); return CMach_GetWinMinimizeAlign(align);
else else
return align; return align;
@ -1124,7 +1122,7 @@ restart:
align = TYPE_CLASS(type)->align; align = TYPE_CLASS(type)->align;
else else
align = CMach_GetQualifiedClassAlign(TYPE_CLASS(type), flag); align = CMach_GetQualifiedClassAlign(TYPE_CLASS(type), flag);
if (r31) if (isWin)
return CMach_GetWinMinimizeAlign(align); return CMach_GetWinMinimizeAlign(align);
else else
return align; return align;
@ -1150,7 +1148,7 @@ static SInt16 CMach_GetMemberAlignment(Type *type, SInt32 var, Boolean flag) {
if (align < 1) if (align < 1)
align = 1; align = 1;
if (type->type == TYPESTRUCT && TYPE_STRUCT(type)->stype >= STRUCT_TYPE_4 && TYPE_STRUCT(type)->stype <= STRUCT_TYPE_E && align < 16) if (IS_TYPE_VECTOR(type) && align < 16)
align = 16; align = 16;
switch (copts.align_mode) { switch (copts.align_mode) {
@ -1197,7 +1195,7 @@ void CMach_StructLayoutInitOffset(SInt32 offset) {
cmach_curbfsize = 0; cmach_curbfsize = 0;
} }
SInt32 CMach_StructLayoutGetCurSize() { SInt32 CMach_StructLayoutGetCurSize(void) {
return cmach_structoffset; return cmach_structoffset;
} }
@ -1323,7 +1321,7 @@ Boolean CMach_PassResultInHiddenArg(Type *type) {
} }
} }
char *CMach_GetCPU() { char *CMach_GetCPU(void) {
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__";
@ -1379,7 +1377,7 @@ SInt32 CMach_RoundedSizeOf(Object *object) {
return (size + align) & ~align; return (size + align) & ~align;
} }
void CMach_ReInitRuntimeObjects() { void CMach_ReInitRuntimeObjects(void) {
HashNameNode *e0 = GetHashNameNodeExport("[0]"); HashNameNode *e0 = GetHashNameNodeExport("[0]");
HashNameNode *e1 = GetHashNameNodeExport("[1]"); HashNameNode *e1 = GetHashNameNodeExport("[1]");
HashNameNode *e2 = GetHashNameNodeExport("[2]"); HashNameNode *e2 = GetHashNameNodeExport("[2]");

View File

@ -459,7 +459,7 @@ Boolean CParser_ParseOperatorName(short *token, Boolean flag1, Boolean flag2) {
if (lookahead() == '[') { if (lookahead() == '[') {
lex(); lex();
if (lex() != ']') if (lex() != ']')
CError_Error(125); CError_Error(CErrorStr125);
//if (tk == TK_NEW) //if (tk == TK_NEW)
// tk = TK_NEW_ARRAY; // tk = TK_NEW_ARRAY;
//else //else
@ -469,14 +469,14 @@ Boolean CParser_ParseOperatorName(short *token, Boolean flag1, Boolean flag2) {
break; break;
case '(': case '(':
if ((tk = lex()) != ')') { if ((tk = lex()) != ')') {
CError_Error(204); CError_Error(CErrorStr204);
return 0; return 0;
} }
tk = '('; tk = '(';
break; break;
case '[': case '[':
if ((tk = lex()) != ']') { if ((tk = lex()) != ']') {
CError_Error(204); CError_Error(CErrorStr204);
return 0; return 0;
} }
tk = '['; tk = '[';
@ -502,7 +502,7 @@ Boolean CParser_ParseOperatorName(short *token, Boolean flag1, Boolean flag2) {
*token = 0; *token = 0;
return 1; return 1;
} else { } else {
CError_Error(204); CError_Error(CErrorStr204);
return 0; return 0;
} }
} }
@ -906,7 +906,7 @@ Object *CParser_FindDeallocationObject(Type *type, FuncArg *args, Boolean flag1,
} }
if (list) if (list)
CError_Warning(375, type, 0); CError_Warning(CErrorStr375, type, 0);
list = (retry_flag && copts.array_new_delete) ? &dela_fobj->first : &delp_fobj->first; list = (retry_flag && copts.array_new_delete) ? &dela_fobj->first : &delp_fobj->first;
first_time = 0; first_time = 0;
@ -1823,7 +1823,7 @@ static Type *getthetype(short token, short size, short signedness) {
case TK_VOID: case TK_VOID:
return TYPE(&stvoid); return TYPE(&stvoid);
default: default:
CError_Error(121); CError_Error(CErrorStr121);
return TYPE(&stvoid); return TYPE(&stvoid);
} }
} }
@ -1863,7 +1863,7 @@ static void CParser_ParseAttributeFunctionSummary(DeclInfo *declinfo) {
Boolean flag; Boolean flag;
if ((tk = lex()) != '(') { if ((tk = lex()) != '(') {
CError_Error(114); CError_Error(CErrorStr114);
return; return;
} }
@ -1880,7 +1880,7 @@ static void CParser_ParseAttributeFunctionSummary(DeclInfo *declinfo) {
flag = 0; flag = 0;
} else { } else {
lex(); lex();
CError_Error(121); CError_Error(CErrorStr121);
return; return;
} }
@ -1893,7 +1893,7 @@ static void CParser_ParseAttributeFunctionSummary(DeclInfo *declinfo) {
lex(); lex();
if (tk != ')') if (tk != ')')
CError_Error(121); CError_Error(CErrorStr121);
} }
void CParser_ParseAttribute(Type *type, DeclInfo *declinfo) { void CParser_ParseAttribute(Type *type, DeclInfo *declinfo) {
@ -1902,21 +1902,21 @@ void CParser_ParseAttribute(Type *type, DeclInfo *declinfo) {
do { do {
if ((tk = lex()) != '(') { if ((tk = lex()) != '(') {
CError_Error(121); CError_Error(CErrorStr121);
return; return;
} }
if ((tk = lex()) != '(') { if ((tk = lex()) != '(') {
CError_Error(121); CError_Error(CErrorStr121);
return; return;
} }
if ((tk = lex()) != TK_IDENTIFIER && tk != TK_CONST) { if ((tk = lex()) != TK_IDENTIFIER && tk != TK_CONST) {
CError_Error(121); CError_Error(CErrorStr121);
return; return;
} }
if (!strcmp(tkidentifier->name, "aligned") || !strcmp(tkidentifier->name, "__aligned__")) { if (!strcmp(tkidentifier->name, "aligned") || !strcmp(tkidentifier->name, "__aligned__")) {
if ((tk = lex()) != '(') { if ((tk = lex()) != '(') {
CError_Error(121); CError_Error(CErrorStr121);
return; return;
} }
@ -1939,7 +1939,7 @@ void CParser_ParseAttribute(Type *type, DeclInfo *declinfo) {
case 0x2000: case 0x2000:
break; break;
default: default:
CError_Error(124); CError_Error(CErrorStr124);
return; return;
} }
if (type) { if (type) {
@ -1954,7 +1954,7 @@ void CParser_ParseAttribute(Type *type, DeclInfo *declinfo) {
type->size += CABI_StructSizeAlignValue(type, type->size); type->size += CABI_StructSizeAlignValue(type, type->size);
} }
} else { } else {
CError_Error(149); CError_Error(CErrorStr149);
} }
} else if (declinfo) { } else if (declinfo) {
declinfo->qual &= ~Q_ALIGNED_MASK; declinfo->qual &= ~Q_ALIGNED_MASK;
@ -2006,67 +2006,67 @@ void CParser_ParseAttribute(Type *type, DeclInfo *declinfo) {
break; break;
} }
} else { } else {
CError_Error(359); CError_Error(CErrorStr359);
} }
if (tk != ')') { if (tk != ')') {
CError_Error(121); CError_Error(CErrorStr121);
return; return;
} }
} else if (!strcmp(tkidentifier->name, "nothrow") || !strcmp(tkidentifier->name, "__nothrow__")) { } else if (!strcmp(tkidentifier->name, "nothrow") || !strcmp(tkidentifier->name, "__nothrow__")) {
if (declinfo && declinfo->thetype && IS_TYPE_FUNC(declinfo->thetype)) if (declinfo && declinfo->thetype && IS_TYPE_FUNC(declinfo->thetype))
TYPE_FUNC(declinfo->thetype)->flags |= FUNC_FLAGS_NOTHROW; TYPE_FUNC(declinfo->thetype)->flags |= FUNC_FLAGS_NOTHROW;
else else
CError_Error(359); CError_Error(CErrorStr359);
} else if (!strcmp("function_summary", tkidentifier->name)) { } else if (!strcmp("function_summary", tkidentifier->name)) {
CParser_ParseAttributeFunctionSummary(declinfo); CParser_ParseAttributeFunctionSummary(declinfo);
} else if (!strcmp(tkidentifier->name, "packed") || !strcmp(tkidentifier->name, "__packed__")) { } else if (!strcmp(tkidentifier->name, "packed") || !strcmp(tkidentifier->name, "__packed__")) {
CError_Error(359); CError_Error(CErrorStr359);
} else if (!strcmp(tkidentifier->name, "unused") || !strcmp(tkidentifier->name, "__unused__")) { } else if (!strcmp(tkidentifier->name, "unused") || !strcmp(tkidentifier->name, "__unused__")) {
} else if (!strcmp(tkidentifier->name, "noreturn") || !strcmp(tkidentifier->name, "__noreturn__")) { } else if (!strcmp(tkidentifier->name, "noreturn") || !strcmp(tkidentifier->name, "__noreturn__")) {
} else if (tk == TK_CONST || !strcmp(tkidentifier->name, "__const__")) { } else if (tk == TK_CONST || !strcmp(tkidentifier->name, "__const__")) {
} else if (!strcmp(tkidentifier->name, "format") || !strcmp(tkidentifier->name, "__format__")) { } else if (!strcmp(tkidentifier->name, "format") || !strcmp(tkidentifier->name, "__format__")) {
CError_Warning(359); CError_Warning(CErrorStr359);
if ((tk = lex()) != '(') { if ((tk = lex()) != '(') {
CError_Warning(114); CError_Warning(CErrorStr114);
return; return;
} }
tk = lex(); tk = lex();
if ((tk = lex()) != ',') { if ((tk = lex()) != ',') {
CError_Warning(116); CError_Warning(CErrorStr116);
return; return;
} }
tk = lex(); tk = lex();
if ((tk = lex()) != ',') { if ((tk = lex()) != ',') {
CError_Warning(116); CError_Warning(CErrorStr116);
return; return;
} }
tk = lex(); tk = lex();
if ((tk = lex()) != ')') { if ((tk = lex()) != ')') {
CError_Warning(115); CError_Warning(CErrorStr115);
return; return;
} }
} else if (!strcmp(tkidentifier->name, "mode") || !strcmp(tkidentifier->name, "__mode__")) { } else if (!strcmp(tkidentifier->name, "mode") || !strcmp(tkidentifier->name, "__mode__")) {
CError_Warning(359); CError_Warning(CErrorStr359);
if ((tk = lex()) != '(') { if ((tk = lex()) != '(') {
CError_Warning(114); CError_Warning(CErrorStr114);
return; return;
} }
tk = lex(); tk = lex();
if ((tk = lex()) != ')') { if ((tk = lex()) != ')') {
CError_Warning(115); CError_Warning(CErrorStr115);
return; return;
} }
} else { } else {
CError_Error(359); CError_Error(CErrorStr359);
} }
if ((tk = lex()) != ')') { if ((tk = lex()) != ')') {
CError_Error(121); CError_Error(CErrorStr121);
return; return;
} }
if ((tk = lex()) != ')') { if ((tk = lex()) != ')') {
CError_Error(121); CError_Error(CErrorStr121);
return; return;
} }
tk = lex(); tk = lex();
@ -2084,10 +2084,10 @@ static void CParser_ParseTypeOf(DeclInfo *declinfo) {
CParser_GetDeclSpecs(&subdi, 0); CParser_GetDeclSpecs(&subdi, 0);
scandeclarator(&subdi); scandeclarator(&subdi);
if (subdi.name) if (subdi.name)
CError_Error(121); CError_Error(CErrorStr121);
if (tk != ')') if (tk != ')')
CError_ErrorSkip(115); CError_ErrorSkip(CErrorStr115);
else else
tk = lex(); tk = lex();
@ -2095,7 +2095,7 @@ static void CParser_ParseTypeOf(DeclInfo *declinfo) {
} else { } else {
expr = unary_expression(); expr = unary_expression();
if (ENODE_IS(expr, EINDIRECT) && ENODE_IS(expr->data.monadic, EBITFIELD)) if (ENODE_IS(expr, EINDIRECT) && ENODE_IS(expr->data.monadic, EBITFIELD))
CError_Error(144); CError_Error(CErrorStr144);
TypedefDeclInfo(declinfo, expr->rtype, expr->flags & ENODE_FLAG_QUALS); TypedefDeclInfo(declinfo, expr->rtype, expr->flags & ENODE_FLAG_QUALS);
} }
} }
@ -2103,7 +2103,7 @@ static void CParser_ParseTypeOf(DeclInfo *declinfo) {
void CParser_ParseDeclSpec(DeclInfo *declinfo, Boolean flag) { void CParser_ParseDeclSpec(DeclInfo *declinfo, Boolean flag) {
if ((tk = lex()) != TK_IDENTIFIER) { if ((tk = lex()) != TK_IDENTIFIER) {
if (tk != TK_EXPORT) if (tk != TK_EXPORT)
CError_Error(107); CError_Error(CErrorStr107);
else else
declinfo->exportflags |= EXPORT_FLAGS_EXPORT; declinfo->exportflags |= EXPORT_FLAGS_EXPORT;
} else if (!strcmp("internal", tkidentifier->name)) { } else if (!strcmp("internal", tkidentifier->name)) {
@ -2146,7 +2146,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
return 1; return 1;
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_SIGNED: case TK_SIGNED:
@ -2184,7 +2184,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
return 1; return 1;
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_UNSIGNED: case TK_UNSIGNED:
@ -2222,7 +2222,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
return 1; return 1;
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_BOOL: case TK_BOOL:
@ -2260,7 +2260,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
return 1; return 1;
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_SHORT: case TK_SHORT:
@ -2310,7 +2310,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
return 1; return 1;
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_IDENTIFIER: case TK_IDENTIFIER:
@ -2322,7 +2322,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
return 1; return 1;
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_LONG: case TK_LONG:
@ -2368,7 +2368,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
return 1; return 1;
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_IDENTIFIER: case TK_IDENTIFIER:
@ -2380,7 +2380,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
return 1; return 1;
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_INT: case TK_INT:
@ -2453,7 +2453,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
return 1; return 1;
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_LONG: case TK_LONG:
@ -2496,7 +2496,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
} }
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
break; break;
case TK_FLOAT: case TK_FLOAT:
@ -2546,7 +2546,7 @@ static int CParser_GetVectorDeclSpec(Type **type) {
} }
} }
default: default:
CError_Error(121); CError_Error(CErrorStr121);
} }
return 0; return 0;
@ -2560,7 +2560,7 @@ Boolean CParser_CheckTemplateClassUsage(TemplClass *tmclass, Boolean flag) {
while (1) { while (1) {
if (!nspace) { if (!nspace) {
if (flag) if (flag)
CError_Error(230); CError_Error(CErrorStr230);
return 0; return 0;
} }
if (nspace->theclass == TYPE_CLASS(tmclass)) if (nspace->theclass == TYPE_CLASS(tmclass))
@ -2623,7 +2623,7 @@ restart:
case TK_TYPEDEF: case TK_TYPEDEF:
case TK_MUTABLE: case TK_MUTABLE:
if (di->storageclass) if (di->storageclass)
CError_Error(121); CError_Error(CErrorStr121);
di->storageclass = tk; di->storageclass = tk;
break; break;
case TK_CONST: case TK_CONST:
@ -2701,10 +2701,10 @@ restart:
break; break;
case TK_UU_DECLSPEC: case TK_UU_DECLSPEC:
if ((tk = lex()) != '(') if ((tk = lex()) != '(')
CError_Error(114); CError_Error(CErrorStr114);
CParser_ParseDeclSpec(di, 0); CParser_ParseDeclSpec(di, 0);
if ((tk = lex()) != ')') if ((tk = lex()) != ')')
CError_Error(115); CError_Error(CErrorStr115);
break; break;
case TK_ASM: case TK_ASM:
if (di->qual & Q_ASM) if (di->qual & Q_ASM)
@ -2718,74 +2718,74 @@ restart:
break; break;
case TK_SHORT: case TK_SHORT:
if (typesize || (typetoken && typetoken != TK_INT && typetoken != TK_DOUBLE)) if (typesize || (typetoken && typetoken != TK_INT && typetoken != TK_DOUBLE))
CError_Error(121); CError_Error(CErrorStr121);
typesize = 1; typesize = 1;
break; break;
case TK_LONG: case TK_LONG:
if (copts.longlong) { if (copts.longlong) {
if (typetoken && typetoken != TK_INT && typetoken != TK_DOUBLE) if (typetoken && typetoken != TK_INT && typetoken != TK_DOUBLE)
CError_Error(121); CError_Error(CErrorStr121);
if (typesize) { if (typesize) {
if (typesize != 2 || typetoken == TK_DOUBLE) if (typesize != 2 || typetoken == TK_DOUBLE)
CError_Error(121); CError_Error(CErrorStr121);
typesize = 3; typesize = 3;
} else { } else {
typesize = 2; typesize = 2;
} }
} else { } else {
if (typesize || (typetoken && typetoken != TK_INT && typetoken != TK_DOUBLE)) if (typesize || (typetoken && typetoken != TK_INT && typetoken != TK_DOUBLE))
CError_Error(121); CError_Error(CErrorStr121);
typesize = 2; typesize = 2;
} }
break; break;
case TK_SIGNED: case TK_SIGNED:
if (signedness || (typetoken && typetoken != TK_INT && typetoken != TK_CHAR)) if (signedness || (typetoken && typetoken != TK_INT && typetoken != TK_CHAR))
CError_Error(121); CError_Error(CErrorStr121);
signedness = -1; signedness = -1;
break; break;
case TK_UNSIGNED: case TK_UNSIGNED:
if (signedness || (typetoken && typetoken != TK_INT && typetoken != TK_CHAR)) if (signedness || (typetoken && typetoken != TK_INT && typetoken != TK_CHAR))
CError_Error(121); CError_Error(CErrorStr121);
signedness = 1; signedness = 1;
break; break;
case TK_VOID: case TK_VOID:
if (typetoken || typesize || signedness) if (typetoken || typesize || signedness)
CError_Error(121); CError_Error(CErrorStr121);
typetoken = TK_VOID; typetoken = TK_VOID;
break; break;
case TK_FLOAT: case TK_FLOAT:
if (typetoken || typesize || signedness) if (typetoken || typesize || signedness)
CError_Error(121); CError_Error(CErrorStr121);
typetoken = TK_FLOAT; typetoken = TK_FLOAT;
break; break;
case TK_BOOL: case TK_BOOL:
if (typetoken || typesize) if (typetoken || typesize)
CError_Error(121); CError_Error(CErrorStr121);
typetoken = TK_BOOL; typetoken = TK_BOOL;
break; break;
case TK_CHAR: case TK_CHAR:
if (typetoken || typesize) if (typetoken || typesize)
CError_Error(121); CError_Error(CErrorStr121);
typetoken = TK_CHAR; typetoken = TK_CHAR;
break; break;
case TK_WCHAR_T: case TK_WCHAR_T:
if (typetoken || typesize || signedness) if (typetoken || typesize || signedness)
CError_Error(121); CError_Error(CErrorStr121);
typetoken = TK_WCHAR_T; typetoken = TK_WCHAR_T;
break; break;
case TK_INT: case TK_INT:
if (typetoken) if (typetoken)
CError_Error(121); CError_Error(CErrorStr121);
typetoken = TK_INT; typetoken = TK_INT;
break; break;
case TK_DOUBLE: case TK_DOUBLE:
if (typetoken || signedness) if (typetoken || signedness)
CError_Error(121); CError_Error(CErrorStr121);
typetoken = TK_DOUBLE; typetoken = TK_DOUBLE;
break; break;
case TK_STRUCT: case TK_STRUCT:
if (typetoken || signedness || typesize) if (typetoken || signedness || typesize)
CError_Error(121); CError_Error(CErrorStr121);
tk = lex(); tk = lex();
scanstruct(di, STRUCT_TYPE_STRUCT); scanstruct(di, STRUCT_TYPE_STRUCT);
if (tk == TK_UU_ATTRIBUTE_UU) if (tk == TK_UU_ATTRIBUTE_UU)
@ -2797,7 +2797,7 @@ restart:
return; return;
case TK_CLASS: case TK_CLASS:
if (typetoken || signedness || typesize) if (typetoken || signedness || typesize)
CError_Error(121); CError_Error(CErrorStr121);
tk = lex(); tk = lex();
CDecl_ParseClass(di, CLASS_MODE_2, 1, 0); CDecl_ParseClass(di, CLASS_MODE_2, 1, 0);
if (tk == TK_UU_ATTRIBUTE_UU) if (tk == TK_UU_ATTRIBUTE_UU)
@ -2809,7 +2809,7 @@ restart:
return; return;
case TK_UNION: case TK_UNION:
if (typetoken || signedness || typesize) if (typetoken || signedness || typesize)
CError_Error(121); CError_Error(CErrorStr121);
tk = lex(); tk = lex();
scanstruct(di, STRUCT_TYPE_UNION); scanstruct(di, STRUCT_TYPE_UNION);
if (tk == TK_UU_ATTRIBUTE_UU) if (tk == TK_UU_ATTRIBUTE_UU)
@ -2821,7 +2821,7 @@ restart:
return; return;
case TK_ENUM: case TK_ENUM:
if (typetoken || signedness || typesize) if (typetoken || signedness || typesize)
CError_Error(121); CError_Error(CErrorStr121);
tk = lex(); tk = lex();
scanenum(di); scanenum(di);
if (tk == TK_UU_ATTRIBUTE_UU) if (tk == TK_UU_ATTRIBUTE_UU)
@ -2833,11 +2833,11 @@ restart:
return; return;
case TK_TYPENAME: case TK_TYPENAME:
if (typetoken || signedness || typesize || di->x53) if (typetoken || signedness || typesize || di->x53)
CError_Error(121); CError_Error(CErrorStr121);
di->x53 = 1; di->x53 = 1;
tk = lex(); tk = lex();
if (tk != TK_COLON_COLON && tk != TK_IDENTIFIER) { if (tk != TK_COLON_COLON && tk != TK_IDENTIFIER) {
CError_Error(121); CError_Error(CErrorStr121);
break; break;
} }
goto some_shared_label; goto some_shared_label;
@ -2847,7 +2847,7 @@ restart:
goto some_shared_label; goto some_shared_label;
case TK_UU_VECTOR: case TK_UU_VECTOR:
if (typetoken || signedness || typesize) if (typetoken || signedness || typesize)
CError_Error(121); CError_Error(CErrorStr121);
handle_vector: handle_vector:
if (CParser_GetVectorDeclSpec(&di->thetype)) { if (CParser_GetVectorDeclSpec(&di->thetype)) {
if (tk == TK_CONST) { if (tk == TK_CONST) {
@ -2855,7 +2855,7 @@ restart:
di->qual |= Q_CONST; di->qual |= Q_CONST;
tk = lex(); tk = lex();
} else { } else {
CError_Error(121); CError_Error(CErrorStr121);
} }
} }
if (tk == TK_VOLATILE) { if (tk == TK_VOLATILE) {
@ -2863,7 +2863,7 @@ restart:
di->qual |= Q_VOLATILE; di->qual |= Q_VOLATILE;
tk = lex(); tk = lex();
} else { } else {
CError_Error(121); CError_Error(CErrorStr121);
} }
} }
return; return;
@ -2871,7 +2871,7 @@ restart:
break; break;
case TK_UU_TYPEOF_UU: case TK_UU_TYPEOF_UU:
if (typetoken || signedness || typesize) if (typetoken || signedness || typesize)
CError_Error(121); CError_Error(CErrorStr121);
CParser_ParseTypeOf(di); CParser_ParseTypeOf(di);
typetoken = -1; typetoken = -1;
goto bailOut; goto bailOut;
@ -2897,11 +2897,11 @@ restart:
case TPT_TYPE: case TPT_TYPE:
break; break;
case TPT_NONTYPE: case TPT_NONTYPE:
CError_Error(348); CError_Error(CErrorStr348);
pr.x8 = TYPE(&stsignedint); pr.x8 = TYPE(&stsignedint);
break; break;
case TPT_TEMPLATE: case TPT_TEMPLATE:
CError_Error(230); CError_Error(CErrorStr230);
pr.x8 = TYPE(&stsignedint); pr.x8 = TYPE(&stsignedint);
break; break;
default: default:
@ -2910,7 +2910,7 @@ restart:
break; break;
case TEMPLDEP_QUALNAME: case TEMPLDEP_QUALNAME:
if (!di->x53 && !pr.x20 && di->x55) if (!di->x53 && !pr.x20 && di->x55)
CError_Error(355); CError_Error(CErrorStr355);
break; break;
case TEMPLDEP_TEMPLATE: case TEMPLDEP_TEMPLATE:
case TEMPLDEP_ARRAY: case TEMPLDEP_ARRAY:
@ -2926,13 +2926,13 @@ restart:
if (!CParser_CheckTemplateClassUsage(TEMPL_CLASS(pr.x8), 0)) { if (!CParser_CheckTemplateClassUsage(TEMPL_CLASS(pr.x8), 0)) {
if (di->x56) { if (di->x56) {
if (di->qual) if (di->qual)
CError_Error(121); CError_Error(CErrorStr121);
di->thetype = pr.x8; di->thetype = pr.x8;
di->x57 = 1; di->x57 = 1;
tk = lex(); tk = lex();
return; return;
} else { } else {
CError_Error(230); CError_Error(CErrorStr230);
pr.x8 = TYPE(&stsignedint); pr.x8 = TYPE(&stsignedint);
} }
} }
@ -2952,7 +2952,7 @@ restart:
if (IS_TYPE_FUNC(OBJECT(di->x14->object)->type) && ((TYPE_FUNC(OBJECT(di->x14->object)->type)->flags & FUNC_FLAGS_1000) | FUNC_FLAGS_2000)) if (IS_TYPE_FUNC(OBJECT(di->x14->object)->type) && ((TYPE_FUNC(OBJECT(di->x14->object)->type)->flags & FUNC_FLAGS_1000) | FUNC_FLAGS_2000))
r23 = 0; r23 = 0;
} else { } else {
CError_Error(121); CError_Error(CErrorStr121);
} }
} }
} else if (pr.obj_10) { } else if (pr.obj_10) {
@ -2964,20 +2964,20 @@ restart:
if (IS_TYPE_FUNC(di->x10->type) && ((TYPE_FUNC(di->x10->type)->flags & FUNC_FLAGS_1000) | FUNC_FLAGS_2000)) if (IS_TYPE_FUNC(di->x10->type) && ((TYPE_FUNC(di->x10->type)->flags & FUNC_FLAGS_1000) | FUNC_FLAGS_2000))
r23 = 0; r23 = 0;
} else { } else {
CError_Error(121); CError_Error(CErrorStr121);
} }
} }
break; break;
case OT_ENUMCONST: case OT_ENUMCONST:
case OT_MEMBERVAR: case OT_MEMBERVAR:
CError_Error(121); CError_Error(CErrorStr121);
break; break;
default: default:
CError_FATAL(4217); CError_FATAL(4217);
} }
} else if (pr.name_4) { } else if (pr.name_4) {
if (copts.cplusplus) if (copts.cplusplus)
CError_Error(121); CError_Error(CErrorStr121);
} else if (pr.x21) { } else if (pr.x21) {
CPrep_TokenStreamSetState(&state); CPrep_TokenStreamSetState(&state);
CPrep_UnLex(); CPrep_UnLex();
@ -2994,9 +2994,9 @@ restart:
di->x4A = 1; di->x4A = 1;
if (r23) { if (r23) {
if (!di->storageclass && !di->qual && !di->exportflags) if (!di->storageclass && !di->qual && !di->exportflags)
CError_Error(121); CError_Error(CErrorStr121);
else else
CError_Warning(349); CError_Warning(CErrorStr349);
} }
} }
if (typetoken >= 0) if (typetoken >= 0)
@ -3008,7 +3008,7 @@ restart:
return; return;
case ';': case ';':
if (!typetoken && !signedness && !typesize && copts.warn_emptydecl) if (!typetoken && !signedness && !typesize && copts.warn_emptydecl)
CError_Warning(216); CError_Warning(CErrorStr216);
if (typetoken >= 0) if (typetoken >= 0)
di->thetype = getthetype(typetoken, typesize, signedness); di->thetype = getthetype(typetoken, typesize, signedness);
return; return;
@ -3116,13 +3116,13 @@ void CParser_CheckAnonymousUnion(DeclInfo *di, Boolean flag) {
if (!di->storageclass && !di->qual) if (!di->storageclass && !di->qual)
return; return;
} }
CError_Warning(216); CError_Warning(CErrorStr216);
} }
return; return;
} }
if (!flag && di->storageclass != TK_STATIC) if (!flag && di->storageclass != TK_STATIC)
CError_Error(177); CError_Error(CErrorStr177);
if (flag && di->storageclass != TK_STATIC) { if (flag && di->storageclass != TK_STATIC) {
obj = CParser_NewLocalDataObject(di, 1); obj = CParser_NewLocalDataObject(di, 1);
@ -3210,7 +3210,7 @@ Object *CParser_ParseObject(void) {
return OBJECT(list->object); return OBJECT(list->object);
obj = OBJECT(list->object); obj = OBJECT(list->object);
CError_Error(249, CError_GetObjectName(obj), obj->type, obj->qual, di.thetype, di.qual); CError_Error(CErrorStr249, CError_GetObjectName(obj), obj->type, obj->qual, di.thetype, di.qual);
} }
} }
@ -3228,7 +3228,7 @@ void CParser_ParseGlobalDeclaration(void) {
memclrw(&di, sizeof(DeclInfo)); memclrw(&di, sizeof(DeclInfo));
CParser_GetDeclSpecs(&di, 1); CParser_GetDeclSpecs(&di, 1);
if (di.storageclass == TK_REGISTER || di.storageclass == TK_AUTO) { if (di.storageclass == TK_REGISTER || di.storageclass == TK_AUTO) {
CError_Error(177); CError_Error(CErrorStr177);
di.storageclass = 0; di.storageclass = 0;
} }
@ -3239,7 +3239,7 @@ void CParser_ParseGlobalDeclaration(void) {
tk = lex(); tk = lex();
} else { } else {
CError_Error(102); CError_Error(CErrorStr102);
} }
} }
@ -3257,7 +3257,7 @@ static void CParser_ParseLinkageSpecification(DeclInfo *di) {
r29 = 8; r29 = 8;
r28 = 1; r28 = 1;
} else { } else {
CError_Error(121); CError_Error(CErrorStr121);
r29 = 0; r29 = 0;
r28 = 1; r28 = 1;
} }
@ -3265,7 +3265,7 @@ static void CParser_ParseLinkageSpecification(DeclInfo *di) {
if ((tk = lex()) == '{') { if ((tk = lex()) == '{') {
while (1) { while (1) {
if ((tk = lex()) == 0) { if ((tk = lex()) == 0) {
CError_Error(130); CError_Error(CErrorStr130);
return; return;
} }
@ -3292,7 +3292,7 @@ static void CParser_ParseLinkageSpecification(DeclInfo *di) {
if (di->storageclass != TK_TYPEDEF) { if (di->storageclass != TK_TYPEDEF) {
if (di->storageclass && copts.pedantic) if (di->storageclass && copts.pedantic)
CError_Warning(177); CError_Warning(CErrorStr177);
if (!di->storageclass) if (!di->storageclass)
di->storageclass = TK_EXTERN; di->storageclass = TK_EXTERN;
} }
@ -3321,7 +3321,7 @@ static void CParser_ParseNameSpace(DeclInfo *di) {
} }
} else { } else {
if (tk != '{') { if (tk != '{') {
CError_Error(107); CError_Error(CErrorStr107);
return; return;
} }
name = CParser_GetUnnamedNameSpaceName(); name = CParser_GetUnnamedNameSpaceName();
@ -3352,20 +3352,20 @@ static void CParser_ParseNameSpace(DeclInfo *di) {
CScope_AddObject(cscope_current, name, OBJ_BASE(objns)); CScope_AddObject(cscope_current, name, OBJ_BASE(objns));
} else { } else {
if (list->object->otype != OT_NAMESPACE) if (list->object->otype != OT_NAMESPACE)
CError_Error(320); CError_Error(CErrorStr320);
else else
nspace = OBJ_NAMESPACE(list->object)->nspace; nspace = OBJ_NAMESPACE(list->object)->nspace;
} }
if (tk != '{') { if (tk != '{') {
CError_Error(135); CError_Error(CErrorStr135);
return; return;
} }
CScope_SetNameSpaceScope(nspace, &save); CScope_SetNameSpaceScope(nspace, &save);
while (1) { while (1) {
if ((tk = lex()) == 0) { if ((tk = lex()) == 0) {
CError_Error(130); CError_Error(CErrorStr130);
break; break;
} }
@ -3400,9 +3400,9 @@ static void CParser_ParseDeclaration(DeclInfo *di) {
CParser_ParseNameSpace(di); CParser_ParseNameSpace(di);
break; break;
case TK_EXPORT: case TK_EXPORT:
CError_Error(190); CError_Error(CErrorStr190);
if ((tk = lex()) != TK_TEMPLATE) { if ((tk = lex()) != TK_TEMPLATE) {
CError_Error(121); CError_Error(CErrorStr121);
return; return;
} }
case TK_TEMPLATE: case TK_TEMPLATE:
@ -3427,7 +3427,7 @@ static void CParser_ParseDeclaration(DeclInfo *di) {
default: default:
CParser_GetDeclSpecs(di, 1); CParser_GetDeclSpecs(di, 1);
if ((di->storageclass == TK_REGISTER || di->storageclass == TK_AUTO) != 0) { if ((di->storageclass == TK_REGISTER || di->storageclass == TK_AUTO) != 0) {
CError_Error(177); CError_Error(CErrorStr177);
di->storageclass = 0; di->storageclass = 0;
} }
if (tk != ';') if (tk != ';')
@ -3442,7 +3442,7 @@ void cparser(void) {
DeclInfo di; DeclInfo di;
if (copts.crippled && copts.optimizationlevel > 1) { if (copts.crippled && copts.optimizationlevel > 1) {
CError_Warning(385); CError_Warning(CErrorStr385);
copts.optimizationlevel = 1; copts.optimizationlevel = 1;
CodeGen_UpdateOptimizerOptions(); CodeGen_UpdateOptimizerOptions();
CodeGen_UpdateBackEndOptions(); CodeGen_UpdateBackEndOptions();
@ -3459,7 +3459,7 @@ void cparser(void) {
} while (tk && (tk = lex())); } while (tk && (tk = lex()));
} else { } else {
if (!copts.cplusplus && copts.ANSI_strict) if (!copts.cplusplus && copts.ANSI_strict)
CError_Error(102); CError_Error(CErrorStr102);
} }
CInit_DefineTentativeData(); CInit_DefineTentativeData();

View File

@ -172,7 +172,7 @@ static TemplArg *CPrec_GetTemplateArgPatch(TemplArg *arg);
static NameSpaceObjectList *CPrec_GetNameSpaceObjectListPatch(NameSpaceObjectList *nsol); static NameSpaceObjectList *CPrec_GetNameSpaceObjectListPatch(NameSpaceObjectList *nsol);
static OSErr CPrec_FlushBufferCheck(void); static OSErr CPrec_FlushBufferCheck(void);
void SetupPrecompiler(void) { void SetupPrecompiler(Boolean isPrecompiling) {
cprec_refnum = 0; cprec_refnum = 0;
cprec_glist.data = NULL; cprec_glist.data = NULL;
cprec_header = NULL; cprec_header = NULL;
@ -1455,7 +1455,7 @@ static TStreamElement *CPrec_GetTStreamPatch(TStreamElement *tokens, SInt32 coun
case TK_STRING_WIDE: case TK_STRING_WIDE:
CPrec_RawMemPatch(&current->data.tkstring.data, tokens->data.tkstring.data, tokens->data.tkstring.size); CPrec_RawMemPatch(&current->data.tkstring.data, tokens->data.tkstring.data, tokens->data.tkstring.size);
break; break;
case TK_NEG7: case TK_EOL:
break; break;
default: default:
if (tokens->tokentype < 0) if (tokens->tokentype < 0)

View File

@ -255,7 +255,7 @@ TemplClassInst *CTemplClass_GetInstance(TemplClass *tmclass, TemplArg *inst_args
return CTemplClass_NewInstance(tmclass, inst_args, oargs); return CTemplClass_NewInstance(tmclass, inst_args, oargs);
} }
TemplateMember *CTemplClass_DefineMember(TemplClass *tmclass, Object *object, FileOffsetInfo *foi, TStream *stream) { TemplateMember *CTemplClass_DefineMember(TemplClass *tmclass, Object *object, FileOffsetInfo *foi, TokenStream *stream) {
TemplateMember *member; TemplateMember *member;
for (member = tmclass->members; member; member = member->next) { for (member = tmclass->members; member; member = member->next) {

View File

@ -787,7 +787,7 @@ static void *CTempl_ParseMemberFunction(int unk1, int unk2, int unk3, Object *fu
static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo *di, SInt32 *startOffset) { static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo *di, SInt32 *startOffset) {
Object *object; Object *object;
NameSpaceObjectList *nsol; NameSpaceObjectList *nsol;
TStream stream; TokenStream stream;
CPrepFileInfo *file; CPrepFileInfo *file;
SInt32 offset; SInt32 offset;
Boolean saveForceLoc; Boolean saveForceLoc;

View File

@ -1005,7 +1005,7 @@ static TemplClassInst *CTemplTool_FindNestedClassInstance(TemplClass *a, TemplCl
break; break;
if ((inst->theclass.flags & (CLASS_FLAGS_2 | CLASS_FLAGS_800)) == CLASS_FLAGS_800) if ((inst->theclass.flags & (CLASS_FLAGS_2 | CLASS_FLAGS_800)) == CLASS_FLAGS_800)
CTempl_InstantiateTemplateClass(inst); CTempl_InstantiateTemplateClass(TYPE_CLASS(inst));
} }
return inst; return inst;

View File

@ -873,7 +873,7 @@ void CodeGen_Generator(Statement *statements, Object *func, UInt8 mysteryFlag, B
} }
if (cparamblkptr->isPrecompiling == 1) if (cparamblkptr->isPrecompiling == 1)
CError_Error(180); CError_Error(CErrorStr180);
if (!func) { if (!func) {
func = createstaticinitobject(); func = createstaticinitobject();
@ -919,7 +919,7 @@ void CodeGen_Generator(Statement *statements, Object *func, UInt8 mysteryFlag, B
initpcode(); initpcode();
pclabel(prologue = makepcblock(), makepclabel()); pclabel(prologue = makepcblock(), makepclabel());
prologue->flags |= fPCBlockFlag1; prologue->flags |= fIsProlog;
pclabel(tmp = makepcblock(), makepclabel()); pclabel(tmp = makepcblock(), makepclabel());
pcbranch(prologue, tmp->labels); pcbranch(prologue, tmp->labels);
@ -1019,7 +1019,7 @@ void CodeGen_Generator(Statement *statements, Object *func, UInt8 mysteryFlag, B
current_statement = NULL; current_statement = NULL;
epilogue = pclastblock; epilogue = pclastblock;
pclastblock->flags |= fPCBlockFlag2; pclastblock->flags |= fIsEpilogue;
pccomputepredecessors(); pccomputepredecessors();
deleteunreachableblocks(); deleteunreachableblocks();
@ -1278,18 +1278,18 @@ void CodeGen_ParseDeclSpec(HashNameNode *identifier, DeclInfo *declinfo) {
declinfo->storageclass = TK_EXTERN; declinfo->storageclass = TK_EXTERN;
declinfo->exportflags = EXPORT_FLAGS_INTERNAL; declinfo->exportflags = EXPORT_FLAGS_INTERNAL;
} else { } else {
CError_Error(176); CError_Error(CErrorStr176);
} }
} }
static void CodeGen_EOLCheck(void) { static void CodeGen_EOLCheck(void) {
short t; short t;
if (plex() != TK_NEG7) { if (plex() != TK_EOL) {
CPrep_Error(113); CPrep_Error(CErrorStr113);
do { do {
t = plex(); t = plex();
} while (t != TK_NEG7 && t != 0); } while (t != TK_EOL && t != 0);
} }
} }
@ -1346,7 +1346,7 @@ static void pragma_scheduling(void) {
PPCError_Error(115); PPCError_Error(115);
return; return;
} }
CPrep_Error(186); CPrep_Error(CErrorStr186);
return; return;
} }
@ -1382,7 +1382,7 @@ static void pragma_scheduling(void) {
cpu = 9; cpu = 9;
break; break;
default: default:
CPrep_Error(186); CPrep_Error(CErrorStr186);
return; return;
} }
schedule_for(cpu); schedule_for(cpu);
@ -1390,7 +1390,7 @@ static void pragma_scheduling(void) {
} }
if (copts.warn_illpragma) if (copts.warn_illpragma)
CPrep_Warning(186); CPrep_Warning(CErrorStr186);
} }
static SInt32 CodeGen_ParseLongIntegerORonORoff(void) { static SInt32 CodeGen_ParseLongIntegerORonORoff(void) {
@ -1403,7 +1403,7 @@ static SInt32 CodeGen_ParseLongIntegerORonORoff(void) {
if (!tkintconst.hi) if (!tkintconst.hi)
result = CInt64_GetULong(&tkintconst); result = CInt64_GetULong(&tkintconst);
else else
CPrep_Error(154); CPrep_Error(CErrorStr154);
CodeGen_EOLCheck(); CodeGen_EOLCheck();
} else if (t == TK_IDENTIFIER) { } else if (t == TK_IDENTIFIER) {
if (!strcmp(tkidentifier->name, "on")) { if (!strcmp(tkidentifier->name, "on")) {
@ -1415,11 +1415,11 @@ static SInt32 CodeGen_ParseLongIntegerORonORoff(void) {
return 0; return 0;
} }
if (copts.warn_illpragma) if (copts.warn_illpragma)
CPrep_Warning(186); CPrep_Warning(CErrorStr186);
return 0; return 0;
} else { } else {
if (copts.warn_illpragma) if (copts.warn_illpragma)
CPrep_Warning(186); CPrep_Warning(CErrorStr186);
} }
return result; return result;
@ -1443,7 +1443,7 @@ void CodeGen_ParsePragma(HashNameNode *name) {
copts.report_heap_info = CInt64_GetULong(&tkintconst); copts.report_heap_info = CInt64_GetULong(&tkintconst);
if (copts.report_heap_info < 0) { if (copts.report_heap_info < 0) {
copts.report_heap_info = 0; copts.report_heap_info = 0;
CError_Error(186); CError_Error(CErrorStr186);
} }
} else if (t == TK_IDENTIFIER) { } else if (t == TK_IDENTIFIER) {
if (!strcmp(tkidentifier->name, "off")) { if (!strcmp(tkidentifier->name, "off")) {
@ -1451,11 +1451,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) { } else if (!strcmp(tkidentifier->name, "on")) {
copts.report_heap_info = 1; copts.report_heap_info = 1;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
return; return;
@ -1474,11 +1474,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) { } else if (!strcmp(tkidentifier->name, "on")) {
copts.ppc_unroll_speculative = 1; copts.ppc_unroll_speculative = 1;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
return; return;
@ -1490,7 +1490,7 @@ void CodeGen_ParsePragma(HashNameNode *name) {
copts.ppc_unroll_instructions_limit = CInt64_GetULong(&tkintconst); copts.ppc_unroll_instructions_limit = CInt64_GetULong(&tkintconst);
if (copts.ppc_unroll_instructions_limit < 0) { if (copts.ppc_unroll_instructions_limit < 0) {
copts.ppc_unroll_instructions_limit = 0; copts.ppc_unroll_instructions_limit = 0;
CError_Error(186); CError_Error(CErrorStr186);
} }
} else if (t == TK_IDENTIFIER) { } else if (t == TK_IDENTIFIER) {
if (!strcmp(tkidentifier->name, "off")) { if (!strcmp(tkidentifier->name, "off")) {
@ -1498,11 +1498,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) { } else if (!strcmp(tkidentifier->name, "on")) {
copts.ppc_unroll_instructions_limit = 70; copts.ppc_unroll_instructions_limit = 70;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
return; return;
@ -1514,10 +1514,10 @@ void CodeGen_ParsePragma(HashNameNode *name) {
value = CInt64_GetULong(&tkintconst); value = CInt64_GetULong(&tkintconst);
if (value < 0) { if (value < 0) {
copts.gen_fsel = 0; copts.gen_fsel = 0;
CError_Error(186); CError_Error(CErrorStr186);
} else if (value > 255) { } else if (value > 255) {
copts.gen_fsel = 255; copts.gen_fsel = 255;
CError_Error(186); CError_Error(CErrorStr186);
} else { } else {
copts.gen_fsel = value; copts.gen_fsel = value;
} }
@ -1529,11 +1529,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "always")) { } else if (!strcmp(tkidentifier->name, "always")) {
copts.gen_fsel = 255; copts.gen_fsel = 255;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
return; return;
@ -1545,7 +1545,7 @@ void CodeGen_ParsePragma(HashNameNode *name) {
copts.ppc_unroll_factor_limit = CInt64_GetULong(&tkintconst); copts.ppc_unroll_factor_limit = CInt64_GetULong(&tkintconst);
if (copts.ppc_unroll_factor_limit < 0) { if (copts.ppc_unroll_factor_limit < 0) {
copts.ppc_unroll_factor_limit = 0; copts.ppc_unroll_factor_limit = 0;
CError_Error(186); CError_Error(CErrorStr186);
} }
} else if (t == TK_IDENTIFIER) { } else if (t == TK_IDENTIFIER) {
if (!strcmp(tkidentifier->name, "off")) { if (!strcmp(tkidentifier->name, "off")) {
@ -1553,11 +1553,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) { } else if (!strcmp(tkidentifier->name, "on")) {
copts.ppc_unroll_factor_limit = 10; copts.ppc_unroll_factor_limit = 10;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
return; return;
@ -1570,11 +1570,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) { } else if (!strcmp(tkidentifier->name, "on")) {
copts.altivec_model = 1; copts.altivec_model = 1;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
return; return;
@ -1591,11 +1591,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "reset")) { } else if (!strcmp(tkidentifier->name, "reset")) {
CPrep_PopOption(OPT_OFFSET(altivec_vrsave)); CPrep_PopOption(OPT_OFFSET(altivec_vrsave));
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
return; return;
@ -1768,11 +1768,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) { } else if (!strcmp(tkidentifier->name, "on")) {
no_descriptors = 0; no_descriptors = 0;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
@ -1787,11 +1787,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) { } else if (!strcmp(tkidentifier->name, "on")) {
copts.codegen_dynamic = 1; copts.codegen_dynamic = 1;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
@ -1809,11 +1809,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
copts.codegen_pic = 0; copts.codegen_pic = 0;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
@ -1827,11 +1827,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) { } else if (!strcmp(tkidentifier->name, "on")) {
copts.no_implicit_templates = 0; copts.no_implicit_templates = 0;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
@ -1845,11 +1845,11 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} else if (!strcmp(tkidentifier->name, "on")) { } else if (!strcmp(tkidentifier->name, "on")) {
copts.no_common = 0; copts.no_common = 0;
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
return; return;
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
@ -1866,7 +1866,7 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} }
} }
} else { } else {
CError_Error(186); CError_Error(CErrorStr186);
} }
CodeGen_EOLCheck(); CodeGen_EOLCheck();
@ -1874,12 +1874,12 @@ void CodeGen_ParsePragma(HashNameNode *name) {
} }
if (copts.warn_illpragma) if (copts.warn_illpragma)
CPrep_Warning(186); CPrep_Warning(CErrorStr186);
if (plex() != TK_NEG7) { if (plex() != TK_EOL) {
do { do {
t = plex(); t = plex();
} while (t != TK_NEG7 && t != 0); } while (t != TK_EOL && t != 0);
} }
} }

View File

@ -16,12 +16,12 @@ static int isloopinvariant(PCode *pcode, Loop *loop, UInt32 *vec, int flag1, int
RegUseOrDef *list; RegUseOrDef *list;
int i; int i;
if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) { if (pcode->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000)) {
if (pcode->alias) { if (pcode->alias) {
if (pcode->alias->type == AliasType2 || (pcode->flags & (fIsVolatile | fSideEffects))) if (pcode->alias->type == AliasType2 || (pcode->flags & (fIsVolatile | fSideEffects)))
return 0; return 0;
if (pcode->flags & fPCodeFlag2) { if (pcode->flags & fIsRead) {
for (list = findobjectusedef(pcode->alias->object)->defs; list; list = list->next) { for (list = findobjectusedef(pcode->alias->object)->defs; list; list = list->next) {
if ( if (
may_alias(pcode, Defs[list->id].pcode) && may_alias(pcode, Defs[list->id].pcode) &&
@ -32,7 +32,7 @@ static int isloopinvariant(PCode *pcode, Loop *loop, UInt32 *vec, int flag1, int
} }
} }
if (pcode->flags & fPCodeFlag4) { if (pcode->flags & fIsWrite) {
for (list = findobjectusedef(pcode->alias->object)->uses; list; list = list->next) { for (list = findobjectusedef(pcode->alias->object)->uses; list; list = list->next) {
if ( if (
may_alias(pcode, Uses[list->id].pcode) && may_alias(pcode, Uses[list->id].pcode) &&
@ -46,7 +46,7 @@ static int isloopinvariant(PCode *pcode, Loop *loop, UInt32 *vec, int flag1, int
} }
} }
if ((pcode->flags & fPCodeFlag4) && !bitvectorgetbit(pcode->block->blockIndex, loop->vec2C)) if ((pcode->flags & fIsWrite) && !bitvectorgetbit(pcode->block->blockIndex, loop->vec2C))
return 0; return 0;
op = pcode->args; op = pcode->args;
@ -54,7 +54,7 @@ static int isloopinvariant(PCode *pcode, Loop *loop, UInt32 *vec, int flag1, int
while (i--) { while (i--) {
switch (op->kind) { switch (op->kind) {
case PCOp_MEMORY: case PCOp_MEMORY:
if ((pcode->flags & fPCodeFlag2) && ((pcode->flags == 0) & 0x40)) { if ((pcode->flags & fIsRead) && ((pcode->flags == 0) & 0x40)) {
for (list = findobjectusedef(op->data.mem.obj)->defs; list; list = list->next) { for (list = findobjectusedef(op->data.mem.obj)->defs; list; list = list->next) {
if ( if (
may_alias(pcode, Defs[list->id].pcode) && may_alias(pcode, Defs[list->id].pcode) &&
@ -64,7 +64,7 @@ static int isloopinvariant(PCode *pcode, Loop *loop, UInt32 *vec, int flag1, int
return 0; return 0;
} }
} }
if (pcode->flags & fPCodeFlag4) { if (pcode->flags & fIsWrite) {
for (list = findobjectusedef(op->data.mem.obj)->uses; list; list = list->next) { for (list = findobjectusedef(op->data.mem.obj)->uses; list; list = list->next) {
if ( if (
may_alias(pcode, Uses[list->id].pcode) && may_alias(pcode, Uses[list->id].pcode) &&
@ -390,8 +390,8 @@ static int srawi_addze_isloopinvariant(PCode *pcode, Loop *loop, UInt32 *vec) {
nextInstr->op == PC_ADDZE && nextInstr->op == PC_ADDZE &&
pcode->args[0].data.reg.reg == nextInstr->args[0].data.reg.reg && pcode->args[0].data.reg.reg == nextInstr->args[0].data.reg.reg &&
nextInstr->args[0].data.reg.reg == nextInstr->args[1].data.reg.reg && nextInstr->args[0].data.reg.reg == nextInstr->args[1].data.reg.reg &&
!(pcode->flags & (fPCodeFlag8 | fPCodeFlag20 | fIsVolatile | fSideEffects)) && !(pcode->flags & (fIsCall | fIsPtrOp | fIsVolatile | fSideEffects)) &&
!(nextInstr->flags & (fPCodeFlag8 | fPCodeFlag20 | fIsVolatile | fSideEffects)) && !(nextInstr->flags & (fIsCall | fIsPtrOp | fIsVolatile | fSideEffects)) &&
isloopinvariant(pcode, loop, vec, 1, 0) && isloopinvariant(pcode, loop, vec, 1, 0) &&
srawi_addze_maymove(pcode, loop) srawi_addze_maymove(pcode, loop)
) { ) {
@ -469,7 +469,7 @@ static void movecmptopreheader(Loop *loop, PCodeBlock *block, PCode *pc1, PCode
PCode *pc3; PCode *pc3;
preheader = loop->preheader; preheader = loop->preheader;
if (PCODE_FLAG_SET_F(pc1) & fPCodeFlag20000000) { if (PCODE_FLAG_SET_F(pc1) & fRecordBit) {
moveinvariantcomputation(pc1, loop); moveinvariantcomputation(pc1, loop);
} else { } else {
deletepcode(pc1); deletepcode(pc1);
@ -651,7 +651,7 @@ static void simpleunswitchloop(Loop *loop) {
myvec = oalloc(4 * ((number_of_Defs + 31) >> 5)); myvec = oalloc(4 * ((number_of_Defs + 31) >> 5));
bitvectorcopy(myvec, usedefinfo[block26->blockIndex].defvec8, number_of_Defs); bitvectorcopy(myvec, usedefinfo[block26->blockIndex].defvec8, number_of_Defs);
for (pc25 = loop->preheader->nextBlock->firstPCode; pc25; pc25 = pc25->nextPCode) { for (pc25 = loop->preheader->nextBlock->firstPCode; pc25; pc25 = pc25->nextPCode) {
if (!(PCODE_FLAG_SET_F(pc25) & (fPCodeFlag8 | fPCodeFlag20 | fIsVolatile | fSideEffects | fPCodeFlag20000000))) { if (!(PCODE_FLAG_SET_F(pc25) & (fIsCall | fIsPtrOp | fIsVolatile | fSideEffects | fRecordBit))) {
if (isloopinvariant(pc25, loop, myvec, 0, 1)) if (isloopinvariant(pc25, loop, myvec, 0, 1))
break; break;
} }
@ -670,7 +670,7 @@ static void simpleunswitchloop(Loop *loop) {
pc29 = pc25->block->lastPCode; pc29 = pc25->block->lastPCode;
if ( if (
!pc29 || !pc29 ||
!(pc29->flags & fPCodeFlag1) || !(pc29->flags & fIsBranch) ||
pc29->args[0].kind != PCOp_REGISTER || pc29->args[0].kind != PCOp_REGISTER ||
pc29->args[0].arg != RegClass_CRFIELD pc29->args[0].arg != RegClass_CRFIELD
) )
@ -850,9 +850,9 @@ static void moveinvariantsfromloop(Loop *loop) {
bitvectorcopy(myvec, usedefinfo[block->blockIndex].defvec8, number_of_Defs); bitvectorcopy(myvec, usedefinfo[block->blockIndex].defvec8, number_of_Defs);
for (instr = block->firstPCode; instr; instr = nextInstr) { for (instr = block->firstPCode; instr; instr = nextInstr) {
nextInstr = instr->nextPCode; nextInstr = instr->nextPCode;
if (!(instr->flags & fPCodeFlag1) && instr->argCount) { if (!(instr->flags & fIsBranch) && instr->argCount) {
if ( if (
!(instr->flags & (fPCodeFlag8 | fPCodeFlag20 | fIsVolatile | fSideEffects)) && !(instr->flags & (fIsCall | fIsPtrOp | fIsVolatile | fSideEffects)) &&
isloopinvariant(instr, loop, myvec, 0, 0) && isloopinvariant(instr, loop, myvec, 0, 0) &&
maymove(instr, loop) maymove(instr, loop)
) { ) {

View File

@ -197,7 +197,7 @@ static void rewritepcode(void) {
} }
if ( if (
(instr->flags & fPCodeFlag10) && (instr->flags & fIsMove) &&
(instr->args[1].arg == coloring_class) && (instr->args[1].arg == coloring_class) &&
instr->args[1].data.reg.reg == instr->args[0].data.reg.reg instr->args[1].data.reg.reg == instr->args[0].data.reg.reg
) )

View File

@ -128,7 +128,7 @@ static int isunsignedloadoperand(PCodeArg *op) {
PCode *instr; PCode *instr;
if ((instr = defininginstruction[op->data.reg.reg])) { if ((instr = defininginstruction[op->data.reg.reg])) {
if (instr->flags & fPCodeFlag2) { if (instr->flags & fIsRead) {
if (instr->op >= PC_LHZ && instr->op <= PC_LHZUX) if (instr->op >= PC_LHZ && instr->op <= PC_LHZUX)
return 2; return 2;
if (instr->op >= PC_LBZ && instr->op <= PC_LBZUX) if (instr->op >= PC_LBZ && instr->op <= PC_LBZUX)
@ -173,7 +173,7 @@ static int issignedloadoperand(PCodeArg *op) {
PCode *instr; PCode *instr;
if ((instr = defininginstruction[op->data.reg.reg])) { if ((instr = defininginstruction[op->data.reg.reg])) {
if (instr->flags & fPCodeFlag2) { if (instr->flags & fIsRead) {
if (instr->op >= PC_LHA && instr->op <= PC_LHAUX) if (instr->op >= PC_LHA && instr->op <= PC_LHAUX)
return 2; return 2;
} else if (instr->op == PC_EXTSB) { } else if (instr->op == PC_EXTSB) {
@ -223,7 +223,7 @@ static void propagateconstantstoblock(PCodeBlock *block) {
break; break;
case PC_RLWINM: case PC_RLWINM:
if ( if (
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
instr->args[2].data.imm.value == 0 && instr->args[2].data.imm.value == 0 &&
instr->args[4].data.imm.value == 31 instr->args[4].data.imm.value == 31
) )
@ -279,7 +279,7 @@ static void propagateconstantstoblock(PCodeBlock *block) {
break; break;
case PC_EXTSH: case PC_EXTSH:
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
break; break;
if (isconstantoperand(&instr->args[1], &value1)) { if (isconstantoperand(&instr->args[1], &value1)) {
@ -303,7 +303,7 @@ static void propagateconstantstoblock(PCodeBlock *block) {
break; break;
case PC_EXTSB: case PC_EXTSB:
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
break; break;
if ( if (
@ -332,7 +332,7 @@ static void propagateconstantstoblock(PCodeBlock *block) {
break; break;
case PC_ADDI: case PC_ADDI:
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
break; break;
immAddend = instr->args[2].data.imm.value; immAddend = instr->args[2].data.imm.value;
@ -352,7 +352,7 @@ static void propagateconstantstoblock(PCodeBlock *block) {
break; break;
case PC_ADD: case PC_ADD:
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
break; break;
if (isconstantoperand(&instr->args[2], &value1)) { if (isconstantoperand(&instr->args[2], &value1)) {
@ -418,7 +418,7 @@ static void propagateconstantstoblock(PCodeBlock *block) {
instr->args[1] = stackInstr->args[1]; instr->args[1] = stackInstr->args[1];
instr->args[2] = stackInstr->args[2]; instr->args[2] = stackInstr->args[2];
instr->args[2].data.imm.value = value1 + addend; instr->args[2].data.imm.value = value1 + addend;
if (instr->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) if (instr->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000))
instr->alias = make_alias(instr->args[2].data.imm.obj, instr->args[2].data.imm.value, 1); instr->alias = make_alias(instr->args[2].data.imm.obj, instr->args[2].data.imm.value, 1);
propagatedconstants = 1; propagatedconstants = 1;
changed = 1; changed = 1;
@ -428,7 +428,7 @@ static void propagateconstantstoblock(PCodeBlock *block) {
break; break;
case PC_OR: case PC_OR:
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
break; break;
value1 = 0; value1 = 0;
@ -494,7 +494,7 @@ static void propagateconstantstoblock(PCodeBlock *block) {
break; break;
case PC_SUBF: case PC_SUBF:
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
break; break;
if (isconstantoperand(&instr->args[1], &value1) && FITS_IN_SHORT(-value1)) { if (isconstantoperand(&instr->args[1], &value1) && FITS_IN_SHORT(-value1)) {
@ -559,7 +559,7 @@ static void propagateconstantstoblock(PCodeBlock *block) {
instr->args[1] = stackInstr->args[1]; instr->args[1] = stackInstr->args[1];
instr->args[2] = stackInstr->args[2]; instr->args[2] = stackInstr->args[2];
instr->args[2].data.imm.value = value1 + addend; instr->args[2].data.imm.value = value1 + addend;
if (instr->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) if (instr->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000))
instr->alias = make_alias(instr->args[2].data.imm.obj, instr->args[2].data.imm.value, instr->alias = make_alias(instr->args[2].data.imm.obj, instr->args[2].data.imm.value,
nbytes_loaded_or_stored_by(instr)); nbytes_loaded_or_stored_by(instr));
propagatedconstants = 1; propagatedconstants = 1;

View File

@ -65,7 +65,7 @@ static void computecandidatelist(void) {
bitvectorcopy(vec, usedefinfo[block->blockIndex].usevec1C, number_of_Uses); bitvectorcopy(vec, usedefinfo[block->blockIndex].usevec1C, number_of_Uses);
candidate = &Candidates[firstcandidateinblock[block->blockIndex] + ncandidatesinblock[block->blockIndex] - 1]; candidate = &Candidates[firstcandidateinblock[block->blockIndex] + ncandidatesinblock[block->blockIndex] - 1];
for (pcode = block->lastPCode; pcode; pcode = pcode->prevPCode) { for (pcode = block->lastPCode; pcode; pcode = pcode->prevPCode) {
if (!(pcode->flags & fPCodeFlag1) && pcode->argCount) { if (!(pcode->flags & fIsBranch) && pcode->argCount) {
if (is_candidate(pcode)) { if (is_candidate(pcode)) {
reg = pcode->args[0].data.reg.reg; reg = pcode->args[0].data.reg.reg;
candidate->pcode = pcode; candidate->pcode = pcode;
@ -80,7 +80,7 @@ static void computecandidatelist(void) {
} }
} }
if ((pcode->flags & fPCodeFlag2 | fPCodeFlag4) && (pcode->flags & fPCodeFlag2000000)) { if ((pcode->flags & fIsRead | fIsWrite) && (pcode->flags & fUpdatesPtr)) {
for (list = reg_Uses[pcode->args[1].arg][pcode->args[1].data.reg.reg]; list; list = list->next) { for (list = reg_Uses[pcode->args[1].arg][pcode->args[1].data.reg.reg]; list; list = list->next) {
if (bitvectorgetbit(list->id, vec)) { if (bitvectorgetbit(list->id, vec)) {
newlist = oalloc(sizeof(RegUseOrDef)); newlist = oalloc(sizeof(RegUseOrDef));
@ -147,7 +147,7 @@ static void computelocalpropinfo(Boolean flag) {
if (flag) { if (flag) {
for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) { for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) {
if (!(pcode->flags & fPCodeFlag1) && pcode->argCount) { if (!(pcode->flags & fIsBranch) && pcode->argCount) {
i = pcode->argCount; i = pcode->argCount;
op = pcode->args; op = pcode->args;
while (i--) { while (i--) {
@ -176,7 +176,7 @@ static void computelocalpropinfo(Boolean flag) {
} }
} else { } else {
for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) { for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) {
if (!(pcode->flags & fPCodeFlag1) && pcode->argCount) { if (!(pcode->flags & fIsBranch) && pcode->argCount) {
i = pcode->argCount; i = pcode->argCount;
op = pcode->args; op = pcode->args;
while (i--) { while (i--) {
@ -286,7 +286,7 @@ int precedes(PCode *a, PCode *b) {
static int canidatepropagatestoalluses(int id) { static int canidatepropagatestoalluses(int id) {
RegUseOrDef *list; RegUseOrDef *list;
if (PCODE_FLAG_SET_F(Candidates[id].pcode) & (fPCodeFlag20000000 | fSideEffects)) if (PCODE_FLAG_SET_F(Candidates[id].pcode) & (fRecordBit | fSideEffects))
return 0; return 0;
for (list = Candidates[id].list; list; list = list->next) { for (list = Candidates[id].list; list; list = list->next) {
@ -349,7 +349,7 @@ void propagateinstructions(Object *proc, Propagation *config, int passCount, Boo
} }
static int is_copy(PCode *pcode) { static int is_copy(PCode *pcode) {
return (pcode->flags & fPCodeFlag10) && (pcode->args[0].data.reg.reg >= n_real_registers[pcode->args[0].arg]); return (pcode->flags & fIsMove) && (pcode->args[0].data.reg.reg >= n_real_registers[pcode->args[0].arg]);
} }
static int copypropagatestouse(int candidateID, int useID) { static int copypropagatestouse(int candidateID, int useID) {
@ -368,7 +368,7 @@ static int copypropagatestouse(int candidateID, int useID) {
reg1 = pcode->args[0].data.reg.reg; reg1 = pcode->args[0].data.reg.reg;
reg2 = pcode->args[1].data.reg.reg; reg2 = pcode->args[1].data.reg.reg;
if (use->pcode->flags & fPCodeFlag10) if (use->pcode->flags & fIsMove)
return 0; return 0;
if (rclass == RegClass_GPR && use->pcode->op == PC_RLWIMI && use->pcode->args[0].data.reg.reg == reg1) if (rclass == RegClass_GPR && use->pcode->op == PC_RLWIMI && use->pcode->args[0].data.reg.reg == reg1)

View File

@ -756,7 +756,7 @@ static int mergeexceptionactions(void) {
return 0; return 0;
for (pca = pc_actions; pca; pca = pca->next) { for (pca = pc_actions; pca; pca = pca->next) {
if (pca->firstInstr->block->flags & fPCBlockFlag20) if (pca->firstInstr->block->flags & fDeleted)
deleteexceptionaction(pca); deleteexceptionaction(pca);
} }

View File

@ -85,7 +85,7 @@ void assign_local_addresses(void) {
for (list = locals; list; list = list->next) { for (list = locals; list; list = list->next) {
vi = CodeGen_GetNewVarInfo(); vi = CodeGen_GetNewVarInfo();
list->object->u.var.info = vi; list->object->u.var.info = vi;
list->object->flags |= OBJECT_FLAGS_UNUSED; list->object->flags |= OBJECT_FLAGS_1;
vi->used = 1; vi->used = 1;
} }
@ -122,7 +122,7 @@ static void FuncAsm_PreScanDirectives(void) {
while (tk == TK_IDENTIFIER && (directive = InlineAsm_IsDirective(AssemblerType_0))) { while (tk == TK_IDENTIFIER && (directive = InlineAsm_IsDirective(AssemblerType_0))) {
InlineAsm_ProcessDirective(directive); InlineAsm_ProcessDirective(directive);
if (tk == ';' || tk == TK_NEG7) { if (tk == ';' || tk == TK_EOL) {
CPrep_TokenStreamFlush(); CPrep_TokenStreamFlush();
tk = lex(); tk = lex();
} else { } else {
@ -274,7 +274,7 @@ void Assembler(Object *func) {
branch_label(makepclabel()); branch_label(makepclabel());
epilogue = pclastblock; epilogue = pclastblock;
pclastblock->flags |= fPCBlockFlag2; pclastblock->flags |= fIsEpilogue;
CheckCLabels(); CheckCLabels();
if (fatalerrors) if (fatalerrors)
@ -325,7 +325,7 @@ void Assembler(Object *func) {
branch_label(makepclabel()); branch_label(makepclabel());
epilogue = pclastblock; epilogue = pclastblock;
pclastblock->flags |= fPCBlockFlag2; pclastblock->flags |= fIsEpilogue;
pccomputepredecessors(); pccomputepredecessors();
if (copts.debuglisting) if (copts.debuglisting)

View File

@ -31,7 +31,7 @@ void InlineAsm_SkipComment(void) {
static char gcc_parse_attribute(void) { static char gcc_parse_attribute(void) {
char ch; char ch;
while (tk == TK_NEG7) while (tk == TK_EOL)
tk = lex(); tk = lex();
if (tk != '"') if (tk != '"')
@ -57,7 +57,7 @@ static void gcc_parse_name(Boolean flag, char attribute) {
ENode *tempexpr; ENode *tempexpr;
Statement *stmt; Statement *stmt;
while (tk == TK_NEG7) while (tk == TK_EOL)
tk = lex(); tk = lex();
if (tk != '(') if (tk != '(')
@ -220,7 +220,7 @@ void InlineAsm_gcc_parse(void) {
gcc_name_list_index = -1; gcc_name_list_index = -1;
cprep_eoltokens = 0; cprep_eoltokens = 0;
if (tk == TK_NEG7) if (tk == TK_EOL)
tk = lex(); tk = lex();
gcc_parse_output(); gcc_parse_output();

View File

@ -709,7 +709,7 @@ static int StabTypeID(Type *type) {
id = local_enum(type); id = local_enum(type);
break; break;
case TYPESTRUCT: case TYPESTRUCT:
if (IS_TYPESTRUCT_VECTOR(type)) { if (IS_TYPESTRUCT_VECTOR(TYPE_STRUCT(type))) {
switch (TYPE_STRUCT(type)->stype) { switch (TYPE_STRUCT(type)->stype) {
case STRUCT_TYPE_4: return StabType_VectorUChar; case STRUCT_TYPE_4: return StabType_VectorUChar;
case STRUCT_TYPE_5: return StabType_VectorSChar; case STRUCT_TYPE_5: return StabType_VectorSChar;

View File

@ -35,7 +35,7 @@ void InlineAsm_SyntaxError(short code) {
if (backtracking) if (backtracking)
longjmp(backtrack, 1); longjmp(backtrack, 1);
if (tk == TK_NEG7 || tk == ';') if (tk == TK_EOL || tk == ';')
code = CErrorStr112; code = CErrorStr112;
CError_Error(code); CError_Error(code);
} }
@ -357,7 +357,7 @@ HashNameNode *MakeLocalLabel(CInt64 num) {
return GetHashNameNodeExport(buf); return GetHashNameNodeExport(buf);
} }
static void ScanOptionalLabel() { static void ScanOptionalLabel(void) {
if (tk == TK_INTCONST) { if (tk == TK_INTCONST) {
if (lookahead() == ':') { if (lookahead() == ':') {
InlineAsm_DefineLabel(MakeLocalLabel(tkintconst)); InlineAsm_DefineLabel(MakeLocalLabel(tkintconst));
@ -385,17 +385,17 @@ static void ScanOptionalLabel() {
static void ScanStatements(volatile short endToken, UInt8 mode) { static void ScanStatements(volatile short endToken, UInt8 mode) {
if (setjmp(InlineAsm_assemblererror)) { if (setjmp(InlineAsm_assemblererror)) {
while (tk != TK_NEG7 && tk != endToken && tk != '}' && tk) while (tk != TK_EOL && tk != endToken && tk != '}' && tk)
tk = lex(); tk = lex();
if (tk == ';' || tk == TK_NEG7) if (tk == ';' || tk == TK_EOL)
tk = lex(); tk = lex();
} else { } else {
InlineAsm_Initialize(mode); InlineAsm_Initialize(mode);
InlineAsm_gccmode = 0; InlineAsm_gccmode = 0;
if (setjmp(InlineAsm_assemblererror)) { if (setjmp(InlineAsm_assemblererror)) {
while (tk != ';' && tk != TK_NEG7 && tk != endToken && tk != '}' && tk) while (tk != ';' && tk != TK_EOL && tk != endToken && tk != '}' && tk)
tk = lex(); tk = lex();
if (tk == ';' || tk == TK_NEG7) if (tk == ';' || tk == TK_EOL)
tk = lex(); tk = lex();
} }
@ -431,7 +431,7 @@ static void ScanStatements(volatile short endToken, UInt8 mode) {
InlineAsm_gcc_parse(); InlineAsm_gcc_parse();
} }
if (tk == ';' || tk == TK_NEG7) { if (tk == ';' || tk == TK_EOL) {
CPrep_TokenStreamFlush(); CPrep_TokenStreamFlush();
tk = lex(); tk = lex();
} else if (tk != endToken) { } else if (tk != endToken) {

View File

@ -630,7 +630,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
CError_Error(CErrorStr155); CError_Error(CErrorStr155);
} }
expr.object->flags |= OBJECT_FLAGS_UNUSED; expr.object->flags |= OBJECT_FLAGS_1;
return; return;
} }
@ -679,7 +679,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
op[0].u.obj.obj = expr.xC; op[0].u.obj.obj = expr.xC;
op[0].u.obj.offset = expr.value; op[0].u.obj.offset = expr.value;
expr.xC->flags |= OBJECT_FLAGS_UNUSED; expr.xC->flags |= OBJECT_FLAGS_1;
return; return;
} }
@ -732,7 +732,7 @@ static void registeroperand(IAOperand *op, char rclass, short effect) {
op->u.reg.num = num; op->u.reg.num = num;
op->u.reg.effect = effect; op->u.reg.effect = effect;
if (obj) { if (obj) {
reg->object->flags |= OBJECT_FLAGS_UNUSED; reg->object->flags |= OBJECT_FLAGS_1;
Registers_GetVarInfo(obj)->flags |= VarInfoFlag40; Registers_GetVarInfo(obj)->flags |= VarInfoFlag40;
} }
} else if (rclass == RegClass_CRFIELD) { } else if (rclass == RegClass_CRFIELD) {
@ -994,11 +994,11 @@ static InlineAsm *InlineAsm_ScanAssemblyOperands(IAMnemonic *mnemonic) {
info = &opcodeinfo[mnemonic->x4]; info = &opcodeinfo[mnemonic->x4];
argcount = info->x8; argcount = info->x8;
if (PCODE_FLAG_SET_F(info) & fPCodeFlag8000000) if (PCODE_FLAG_SET_F(info) & fCanSetRecordBit)
argcount++; argcount++;
if (!(PCODE_FLAG_SET_F(info) & fPCodeFlag10000000) && (PCODE_FLAG_SET_F(info) & fPCodeFlag4000000)) if (!(PCODE_FLAG_SET_F(info) & fSetsCarry) && (PCODE_FLAG_SET_F(info) & fCanSetCarry))
argcount++; argcount++;
if (PCODE_FLAG_SET_T(info) & fPCodeFlag2000000) if (PCODE_FLAG_SET_T(info) & fCanLink)
argcount++; argcount++;
buffersize = sizeof(InlineAsm) + sizeof(IAOperand) * argcount; buffersize = sizeof(InlineAsm) + sizeof(IAOperand) * argcount;
@ -1669,7 +1669,7 @@ void InlineAsm_ProcessDirective(SInt32 directive) {
CError_Error(CErrorStr166); CError_Error(CErrorStr166);
tk = lex(); tk = lex();
if (tk != TK_NEG7 && tk != ';') if (tk != TK_EOL && tk != ';')
fralloc_parameter_area_size = getimmediateoperand(0x20, 0x7FFE); fralloc_parameter_area_size = getimmediateoperand(0x20, 0x7FFE);
requires_frame = 1; requires_frame = 1;
@ -1832,9 +1832,9 @@ void InlineAsm_ScanAssemblyInstruction(void) {
CError_Error(CErrorStr261); CError_Error(CErrorStr261);
info = &opcodeinfo[mnemonic->x4]; info = &opcodeinfo[mnemonic->x4];
flag3 = (FLAG_SET_F(info->flags) & fPCodeFlag4000000) && (mnemonic->x10 & 0x400); flag3 = (FLAG_SET_F(info->flags) & fCanSetCarry) && (mnemonic->x10 & 0x400);
flag4 = (FLAG_SET_T(info->flags) & fPCodeFlag20000000) && (mnemonic->x10 & 2); flag4 = (FLAG_SET_T(info->flags) & fCanBeAbsolute) && (mnemonic->x10 & 2);
flag5 = (FLAG_SET_T(info->flags) & fPCodeFlag2000000) && (mnemonic->x10 & 1); flag5 = (FLAG_SET_T(info->flags) & fCanLink) && (mnemonic->x10 & 1);
if ((cpu == CPUMask_Generic) && (cpu & CPUFLAG_LOW_MASK) != ((cpu & mnemonic->cpu) & CPUFLAG_LOW_MASK)) { if ((cpu == CPUMask_Generic) && (cpu & CPUFLAG_LOW_MASK) != ((cpu & mnemonic->cpu) & CPUFLAG_LOW_MASK)) {
CError_Error(CErrorStr152); CError_Error(CErrorStr152);
@ -1912,10 +1912,10 @@ static PCode *InlineAsm_TranslateIRtoPCodePPC(InlineAsm *ia, int argcount, Assem
extra_args = 0; extra_args = 0;
reg = 0; reg = 0;
if ((PCODE_FLAG_SET_F(info) & fPCodeFlag8000000) && !(PCODE_FLAG_SET_F(info) & fPCodeFlag20000000)) if ((PCODE_FLAG_SET_F(info) & fCanSetRecordBit) && !(PCODE_FLAG_SET_F(info) & fRecordBit))
extra_args++; extra_args++;
if (!(PCODE_FLAG_SET_F(info) & fPCodeFlag10000000) && (PCODE_FLAG_SET_F(info) & fPCodeFlag4000000)) if (!(PCODE_FLAG_SET_F(info) & fSetsCarry) && (PCODE_FLAG_SET_F(info) & fCanSetCarry))
extra_args++; extra_args++;
if (argcount < ia->argcount) { if (argcount < ia->argcount) {
@ -1976,8 +1976,8 @@ static PCode *InlineAsm_TranslateIRtoPCodePPC(InlineAsm *ia, int argcount, Assem
case IAOpnd_Imm: case IAOpnd_Imm:
dest->kind = PCOp_IMMEDIATE; dest->kind = PCOp_IMMEDIATE;
dest->data.imm.value = src->u.imm.value; dest->data.imm.value = src->u.imm.value;
if (pc->flags & (fPCodeFlag2 | fPCodeFlag4)) if (pc->flags & (fIsRead | fIsWrite))
pc->flags |= fPCodeFlag20; pc->flags |= fIsPtrOp;
dest->data.imm.obj = NULL; dest->data.imm.obj = NULL;
break; break;
@ -2062,7 +2062,7 @@ static PCode *InlineAsm_TranslateIRtoPCodePPC(InlineAsm *ia, int argcount, Assem
dest->arg = src->u.obj.unk; dest->arg = src->u.obj.unk;
dest->data.mem.obj = src->u.obj.obj; dest->data.mem.obj = src->u.obj.obj;
dest->data.mem.offset = src->u.obj.offset; dest->data.mem.offset = src->u.obj.offset;
if (pc->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) { if (pc->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000)) {
pc->alias = make_alias(dest->data.mem.obj, dest->data.mem.offset, nbytes_loaded_or_stored_by(pc)); pc->alias = make_alias(dest->data.mem.obj, dest->data.mem.offset, nbytes_loaded_or_stored_by(pc));
if (is_volatile_object(dest->data.mem.obj)) if (is_volatile_object(dest->data.mem.obj))
pc->flags |= fIsVolatile; pc->flags |= fIsVolatile;
@ -2076,8 +2076,8 @@ static PCode *InlineAsm_TranslateIRtoPCodePPC(InlineAsm *ia, int argcount, Assem
src->u.labdiff.label1->pclabel = makepclabel(); src->u.labdiff.label1->pclabel = makepclabel();
if (src->u.labdiff.label2->pclabel == NULL) if (src->u.labdiff.label2->pclabel == NULL)
src->u.labdiff.label2->pclabel = makepclabel(); src->u.labdiff.label2->pclabel = makepclabel();
if (pc->flags & (fPCodeFlag2 | fPCodeFlag4)) if (pc->flags & (fIsRead | fIsWrite))
pc->flags |= fPCodeFlag20; pc->flags |= fIsPtrOp;
dest->kind = PCOp_LABELDIFF; dest->kind = PCOp_LABELDIFF;
dest->data.labeldiff.labelA = src->u.labdiff.label1->pclabel; dest->data.labeldiff.labelA = src->u.labdiff.label1->pclabel;
dest->data.labeldiff.labelB = src->u.labdiff.label2->pclabel; dest->data.labeldiff.labelB = src->u.labdiff.label2->pclabel;
@ -2127,21 +2127,21 @@ void InlineAsm_TranslateIRtoPCode(Statement *stmt) {
setpcodeflags(fSideEffects); setpcodeflags(fSideEffects);
if (ia->flags2 & IAFlagsB_1) { if (ia->flags2 & IAFlagsB_1) {
if (PCODE_FLAG_SET_F(pc) & fPCodeFlag8000000) if (PCODE_FLAG_SET_F(pc) & fCanSetRecordBit)
pcsetrecordbit(pclastblock->lastPCode); pcsetrecordbit(pclastblock->lastPCode);
else else
CError_Error(CErrorStr261); CError_Error(CErrorStr261);
} }
if (ia->flags2 & IAFlagsB_2) { if (ia->flags2 & IAFlagsB_2) {
if (PCODE_FLAG_SET_F(pc) & fPCodeFlag4000000) if (PCODE_FLAG_SET_F(pc) & fCanSetCarry)
setpcodeflags(fOverflow); // idk? setpcodeflags(fOverflow); // idk?
else else
CError_Error(CErrorStr261); CError_Error(CErrorStr261);
} }
if (ia->flags2 & IAFlagsB_4) { if (ia->flags2 & IAFlagsB_4) {
if (PCODE_FLAG_SET_T(pc) & fPCodeFlag20000000) { if (PCODE_FLAG_SET_T(pc) & fCanBeAbsolute) {
int i; int i;
for (i = 0; i < pc->argCount; i++) { for (i = 0; i < pc->argCount; i++) {
if (pc->args[i].kind == PCOp_LABEL || pc->args[i].kind == PCOp_MEMORY) { if (pc->args[i].kind == PCOp_LABEL || pc->args[i].kind == PCOp_MEMORY) {
@ -2149,18 +2149,18 @@ void InlineAsm_TranslateIRtoPCode(Statement *stmt) {
break; break;
} }
} }
setpcodeflags(fAbsolute); // idk? setpcodeflags(fAbsolute);
} else { } else {
CError_Error(CErrorStr261); CError_Error(CErrorStr261);
} }
} }
if (ia->flags2 & IAFlagsB_8) { if (ia->flags2 & IAFlagsB_8) {
if (PCODE_FLAG_SET_T(pc) & fPCodeFlag2000000) { if (PCODE_FLAG_SET_T(pc) & fCanLink) {
pcsetlinkbit(pclastblock->lastPCode); pcsetlinkbit(pclastblock->lastPCode);
if (!(ia->flags & IAFlag2)) { if (!(ia->flags & IAFlag2)) {
pclastblock->lastPCode->flags &= ~fPCodeFlag8; pclastblock->lastPCode->flags &= ~fIsCall;
pclastblock->lastPCode->flags |= fPCodeFlag1; pclastblock->lastPCode->flags |= fIsBranch;
} }
makes_call = 1; makes_call = 1;
} else { } else {
@ -2169,9 +2169,9 @@ void InlineAsm_TranslateIRtoPCode(Statement *stmt) {
} }
if (ia->flags2 & IAFlagsB_10) if (ia->flags2 & IAFlagsB_10)
setpcodeflags(fPCodeFlag8000000); setpcodeflags(fCanSetRecordBit);
if (ia->flags2 & IAFlagsB_20) if (ia->flags2 & IAFlagsB_20)
setpcodeflags(fPCodeFlag4000000); setpcodeflags(fCanSetCarry);
if (OPCODE_PART_1(opcodeinfo[pc->op].insn) == 16) { if (OPCODE_PART_1(opcodeinfo[pc->op].insn) == 16) {
PCodeLabel *dest = NULL; PCodeLabel *dest = NULL;
@ -2260,7 +2260,7 @@ static void savepicbase(short reg, HashNameNode *name) {
} }
static SInt32 InlineAsm_OpcodeSize(InlineAsm *ia) { static SInt32 InlineAsm_OpcodeSize(InlineAsm *ia) {
if (opcodeinfo[ia->opcode].flags & (fPCodeFlag2 | fPCodeFlag4)) { if (opcodeinfo[ia->opcode].flags & (fIsRead | fIsWrite)) {
switch (ia->opcode) { switch (ia->opcode) {
case PC_LBZ: case PC_LBZ:
case PC_LBZU: case PC_LBZU:
@ -2353,11 +2353,11 @@ static SInt32 InlineAsm_OpcodeSize(InlineAsm *ia) {
CError_FATAL(3924); CError_FATAL(3924);
} }
} else { } else {
if (opcodeinfo[ia->opcode].flags & fPCodeFlag80000000) if (opcodeinfo[ia->opcode].flags & fOpTypeGPR)
return 4; return 4;
if (opcodeinfo[ia->opcode].flags & fPCodeFlag40000000) if (opcodeinfo[ia->opcode].flags & fOpTypeFPR)
return 8; return 8;
if (opcodeinfo[ia->opcode].flags & (fPCodeFlag80000000 | fPCodeFlag40000000)) if (opcodeinfo[ia->opcode].flags & fOpTypeVR)
return 16; return 16;
if (opcodeinfo[ia->opcode].flags & fSideEffects) { if (opcodeinfo[ia->opcode].flags & fSideEffects) {
@ -2395,17 +2395,17 @@ void CodeGen_GetAsmEffects(Statement *stmt, IAEffects *effects) {
effects->x0 = 0; effects->x0 = 0;
effects->x5 = 0; effects->x5 = 0;
if (info->flags & fPCodeFlag20) { if (info->flags & fIsPtrOp) {
if (info->flags & fPCodeFlag2) if (info->flags & fIsRead)
effects->x1 = 1; effects->x1 = 1;
if (info->flags & fPCodeFlag4) if (info->flags & fIsWrite)
effects->x2 = 1; effects->x2 = 1;
} }
if (PCODE_FLAG_SET_T(info) & fPCodeFlag2000000) { if (PCODE_FLAG_SET_T(info) & fCanLink) {
if (ia->flags2 & IAFlagsB_8) if (ia->flags2 & IAFlagsB_8)
effects->x4 = 1; effects->x4 = 1;
else if ((info->flags & fPCodeFlag8) || (info->flags & fPCodeFlag4)) else if ((info->flags & fIsCall) || (info->flags & fIsWrite))
effects->x3 = 1; effects->x3 = 1;
if (ia->opcode == PC_B) { if (ia->opcode == PC_B) {
@ -2450,13 +2450,13 @@ void CodeGen_GetAsmEffects(Statement *stmt, IAEffects *effects) {
case IAOpnd_3: case IAOpnd_3:
case IAOpnd_4: case IAOpnd_4:
if (op->u.obj.obj) { if (op->u.obj.obj) {
if (info->flags & fPCodeFlag2) { if (info->flags & fIsRead) {
effects->operands[effects->numoperands].type = IAEffect_0; effects->operands[effects->numoperands].type = IAEffect_0;
effects->operands[effects->numoperands].object = op->u.obj.obj; effects->operands[effects->numoperands].object = op->u.obj.obj;
effects->operands[effects->numoperands].offset = op->u.obj.offset; effects->operands[effects->numoperands].offset = op->u.obj.offset;
effects->operands[effects->numoperands].size = InlineAsm_OpcodeSize(ia); effects->operands[effects->numoperands].size = InlineAsm_OpcodeSize(ia);
effects->numoperands++; effects->numoperands++;
} else if (!(info->flags & (fPCodeFlag1 | fPCodeFlag8))) { } else if (!(info->flags & (fIsBranch | fIsCall))) {
effects->operands[effects->numoperands].type = IAEffect_3; effects->operands[effects->numoperands].type = IAEffect_3;
effects->operands[effects->numoperands].object = op->u.obj.obj; effects->operands[effects->numoperands].object = op->u.obj.obj;
effects->operands[effects->numoperands].offset = op->u.obj.offset; effects->operands[effects->numoperands].offset = op->u.obj.offset;
@ -2510,7 +2510,7 @@ void CodeGen_GetAsmEffects(Statement *stmt, IAEffects *effects) {
case IAOpnd_3: case IAOpnd_3:
case IAOpnd_4: case IAOpnd_4:
if (op->u.obj.obj) { if (op->u.obj.obj) {
if (info->flags & fPCodeFlag4) { if (info->flags & fIsWrite) {
effects->operands[effects->numoperands].type = IAEffect_1; effects->operands[effects->numoperands].type = IAEffect_1;
effects->operands[effects->numoperands].object = op->u.obj.obj; effects->operands[effects->numoperands].object = op->u.obj.obj;
effects->operands[effects->numoperands].offset = op->u.obj.offset; effects->operands[effects->numoperands].offset = op->u.obj.offset;
@ -2524,7 +2524,7 @@ void CodeGen_GetAsmEffects(Statement *stmt, IAEffects *effects) {
CError_ASSERT(4151, (UInt32) effects->numoperands <= IAMaxOperands); CError_ASSERT(4151, (UInt32) effects->numoperands <= IAMaxOperands);
} }
if ((info->flags & (fPCodeFlag1 | fPCodeFlag8)) && (SInt32)effects->numlabels == 0) if ((info->flags & (fIsBranch | fIsCall)) && (SInt32)effects->numlabels == 0)
effects->x3 = 1; effects->x3 = 1;
} }
@ -2556,7 +2556,7 @@ void CodeGen_PropagateIntoAsm(Statement *stmt, Object *obj, ENode *expr) {
break; break;
case IAOpnd_3: case IAOpnd_3:
case IAOpnd_4: case IAOpnd_4:
if (!(opcodeinfo[ia->opcode].flags & (fPCodeFlag4 | fPCodeFlag40000)) && if (!(opcodeinfo[ia->opcode].flags & (fIsWrite | fPCodeFlag40000)) &&
ia->args[i].u.obj.obj == obj) ia->args[i].u.obj.obj == obj)
ia->args[i].u.obj.obj = newobj; ia->args[i].u.obj.obj = newobj;
break; break;

View File

@ -14,7 +14,7 @@ typedef struct HashedRegister {
static HashedRegister *hashedregisters[64]; static HashedRegister *hashedregisters[64];
void InlineAsm_InitializeRegisters() { void InlineAsm_InitializeRegisters(void) {
SInt32 i; SInt32 i;
for (i = 0; i < 64; i++) for (i = 0; i < 64; i++)

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,7 @@ static void buildinterferencematrix(void) {
for (j = 0; j < regs; j++) { for (j = 0; j < regs; j++) {
if (bitvectorgetbit(j, vec)) { if (bitvectorgetbit(j, vec)) {
if ( if (
(instr->flags & fPCodeFlag10) && (instr->flags & fIsMove) &&
PC_OP_IS_ANY_REGISTER(&instr->args[0], coloring_class) && PC_OP_IS_ANY_REGISTER(&instr->args[0], coloring_class) &&
instr->args[1].data.reg.reg == j instr->args[1].data.reg.reg == j
) )
@ -89,10 +89,10 @@ static void buildinterferencematrix(void) {
} }
if (coloring_class == RegClass_GPR) { if (coloring_class == RegClass_GPR) {
if (PCODE_FLAG_SET_F(instr) & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag40000)) { if (PCODE_FLAG_SET_F(instr) & (fIsRead | fIsWrite | fPCodeFlag40000)) {
if (instr->args[1].data.reg.reg >= n_real_registers[coloring_class]) if (instr->args[1].data.reg.reg >= n_real_registers[coloring_class])
makeinterfere(0, instr->args[1].data.reg.reg); makeinterfere(0, instr->args[1].data.reg.reg);
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag2000000) if (PCODE_FLAG_SET_F(instr) & fUpdatesPtr)
makeinterfere(instr->args[0].data.reg.reg, instr->args[1].data.reg.reg); makeinterfere(instr->args[0].data.reg.reg, instr->args[1].data.reg.reg);
} else { } else {
switch (instr->op) { switch (instr->op) {
@ -119,7 +119,7 @@ static void buildinterferencematrix(void) {
} }
} }
if (coloring_class == RegClass_GPR && (instr->flags & fPCodeFlag8)) { if (coloring_class == RegClass_GPR && (instr->flags & fIsCall)) {
i = branch_count_volatiles(); i = branch_count_volatiles();
op = instr->args; op = instr->args;
CError_ASSERT(219, instr->argCount != 0); CError_ASSERT(219, instr->argCount != 0);
@ -168,8 +168,8 @@ static void coalescenodes(void) {
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
for (instr = block->firstPCode; instr; instr = instr->nextPCode) { for (instr = block->firstPCode; instr; instr = instr->nextPCode) {
if ((instr->flags & fPCodeFlag10) && !(instr->flags & fSideEffects)) { if ((instr->flags & fIsMove) && !(instr->flags & fSideEffects)) {
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) { if (PCODE_FLAG_SET_F(instr) & fRecordBit) {
CError_FATAL(309); CError_FATAL(309);
continue; continue;
} }

View File

@ -566,7 +566,7 @@ void IRO_SpellType(Type *type, char *buf) {
strcat(buf, TYPE_ENUM(type)->enumname->name); strcat(buf, TYPE_ENUM(type)->enumname->name);
break; break;
case TYPESTRUCT: case TYPESTRUCT:
if (IS_TYPESTRUCT_VECTOR(type)) { if (IS_TYPESTRUCT_VECTOR(TYPE_STRUCT(type))) {
switch (TYPE_STRUCT(type)->stype) { switch (TYPE_STRUCT(type)->stype) {
case STRUCT_TYPE_4: case STRUCT_TYPE_4:
strcpy(buf, "vector unsigned char "); strcpy(buf, "vector unsigned char ");

View File

@ -79,10 +79,10 @@ static void MarkAssigned(IROLinear *linear, Boolean flag) {
rec = IRO_InitAddrRecordPointer(inner); rec = IRO_InitAddrRecordPointer(inner);
IRO_DecomposeAddressExpression(inner, rec); IRO_DecomposeAddressExpression(inner, rec);
if (rec->numObjRefs == 1 && IS_LINEAR_ENODE(inner->u.diadic.left, EOBJREF)) { if (rec->numObjRefs == 1 && IS_LINEAR_ENODE(inner->u.diadic.left, EOBJREF)) {
rec->objRefs->element->flags |= IROLF_Assigned; ((IROLinear *) rec->objRefs->element)->flags |= IROLF_Assigned;
if (flag) { if (flag) {
linear->flags |= IROLF_Used; linear->flags |= IROLF_Used;
rec->objRefs->element->flags |= IROLF_Used; ((IROLinear *) rec->objRefs->element)->flags |= IROLF_Used;
} }
} }
} }
@ -116,10 +116,10 @@ static void MarkAssigned(IROLinear *linear, Boolean flag) {
rec = IRO_InitAddrRecordPointer(inner); rec = IRO_InitAddrRecordPointer(inner);
IRO_DecomposeAddressExpression(inner, rec); IRO_DecomposeAddressExpression(inner, rec);
if (rec->numObjRefs == 1 && IS_LINEAR_ENODE(inner->u.diadic.left, EOBJREF)) { if (rec->numObjRefs == 1 && IS_LINEAR_ENODE(inner->u.diadic.left, EOBJREF)) {
rec->objRefs->element->flags |= IROLF_Assigned; ((IROLinear *) rec->objRefs->element)->flags |= IROLF_Assigned;
if (flag) { if (flag) {
linear->flags |= IROLF_Used; linear->flags |= IROLF_Used;
rec->objRefs->element->flags |= IROLF_Used; ((IROLinear *) rec->objRefs->element)->flags |= IROLF_Used;
} }
} }
} }
@ -248,7 +248,7 @@ static void MarkSubs1(IROLinear *linear) {
rec = IRO_InitAddrRecordPointer(linear); rec = IRO_InitAddrRecordPointer(linear);
IRO_DecomposeAddressExpression(linear, rec); IRO_DecomposeAddressExpression(linear, rec);
if (rec->numObjRefs == 1 && IS_LINEAR_ENODE(linear->u.diadic.left, EOBJREF)) if (rec->numObjRefs == 1 && IS_LINEAR_ENODE(linear->u.diadic.left, EOBJREF))
rec->objRefs->element->flags |= IROLF_Ind; ((IROLinear *) rec->objRefs->element)->flags |= IROLF_Ind;
} }
} }

View File

@ -1392,7 +1392,7 @@ inline LocationSet *LocationSet_bitfieldOf(LocationSet *ls) {
return ls->u.unknown.bitfieldOf; return ls->u.unknown.bitfieldOf;
} }
inline LocationSetSet *LocationSetSet_New() { inline LocationSetSet *LocationSetSet_New(void) {
LocationSetSet *lss = IRO_malloc(sizeof(LocationSetSet)); LocationSetSet *lss = IRO_malloc(sizeof(LocationSetSet));
IRO_ASSERT(2356, lss != NULL); IRO_ASSERT(2356, lss != NULL);
@ -2446,7 +2446,7 @@ inline Boolean PointsToFunctions_Match(PointsToFunction *pointsToFunc1, PointsTo
return 1; return 1;
} }
inline PartialTransferFunction *PartialTransferFunction_New() { inline PartialTransferFunction *PartialTransferFunction_New(void) {
PartialTransferFunction *ptf = IRO_malloc(sizeof(PartialTransferFunction)); PartialTransferFunction *ptf = IRO_malloc(sizeof(PartialTransferFunction));
IRO_ASSERT(4110, ptf != NULL); IRO_ASSERT(4110, ptf != NULL);

View File

@ -0,0 +1,157 @@
#include "compiler/LiveInfo.h"
#include "compiler/BitVectors.h"
#include "compiler/Coloring.h"
#include "compiler/CompilerTools.h"
#include "compiler/PCode.h"
#include "compiler/Registers.h"
#include "compiler/objects.h"
#include "compiler/types.h"
#include "compiler/CParser.h"
LiveInfo *liveinfo;
static void allocateliveinfo(void) {
UInt32 regs;
LiveInfo *info;
int i;
regs = used_virtual_registers[coloring_class];
liveinfo = oalloc(sizeof(LiveInfo) * pcblockcount);
for (i = 0, info = liveinfo; i < pcblockcount; i++, info++) {
bitvectorinitialize(info->use = oalloc(4 * ((regs + 31) >> 5)), regs, 0);
bitvectorinitialize(info->def = oalloc(4 * ((regs + 31) >> 5)), regs, 0);
bitvectorinitialize(info->in = oalloc(4 * ((regs + 31) >> 5)), regs, 0);
bitvectorinitialize(info->out = oalloc(4 * ((regs + 31) >> 5)), regs, 0);
}
}
static void computelocalusedef(void) {
LiveInfo *info;
PCodeBlock *block;
PCode *instr;
UInt32 *use;
UInt32 *def;
PCodeArg *op;
int i;
for (block = pcbasicblocks; block; block = block->nextBlock) {
info = &liveinfo[block->blockIndex];
use = info->use;
def = info->def;
for (instr = block->firstPCode; instr; instr = instr->nextPCode) {
op = instr->args;
i = instr->argCount;
while (i--) {
if (PC_OP_IS_READ_ANY_REGISTER(op, coloring_class) && !bitvectorgetbit(op->data.reg.reg, def))
bitvectorsetbit(op->data.reg.reg, use);
op++;
}
op = instr->args;
i = instr->argCount;
while (i--) {
if (PC_OP_IS_WRITE_ANY_REGISTER(op, coloring_class) && !bitvectorgetbit(op->data.reg.reg, use))
bitvectorsetbit(op->data.reg.reg, def);
op++;
}
}
}
}
static void computeglobalinout(void) {
UInt32 regs;
LiveInfo *info;
UInt32 *use;
UInt32 *def;
UInt32 *in;
UInt32 *out;
int bitvecsize;
int blockIndex;
int i;
int flag;
PCodeBlock *block;
PCLink *link;
UInt32 val;
regs = used_virtual_registers[coloring_class];
bitvecsize = (regs + 31) >> 5;
flag = 1;
while (flag) {
flag = 0;
blockIndex = pcblockcount;
while (blockIndex) {
if ((block = depthfirstordering[--blockIndex])) {
info = &liveinfo[block->blockIndex];
if ((link = block->successors)) {
out = info->out;
bitvectorcopy(out, liveinfo[link->block->blockIndex].in, regs);
for (link = link->nextLink; link; link = link->nextLink)
bitvectorunion(out, liveinfo[link->block->blockIndex].in, regs);
}
out = info->out;
in = info->in;
use = info->use;
def = info->def;
for (i = 0; i < bitvecsize; i++) {
val = *use | (*out & ~*def);
if (val != *in) {
*in = val;
flag = 1;
}
in++;
out++;
use++;
def++;
}
}
}
}
}
void computelivevariables(Object *proc) {
Type *returnType;
returnType = TYPE_FUNC(proc->type)->functype;
computedepthfirstordering();
allocateliveinfo();
computelocalusedef();
if (coloring_class == RegClass_GPR && TYPE_FITS_IN_REGISTER(returnType)) {
bitvectorsetbit(3, liveinfo[epilogue->blockIndex].use);
if (TYPE_IS_8BYTES(returnType))
bitvectorsetbit(4, liveinfo[pclastblock->blockIndex].use);
} else if (coloring_class == RegClass_FPR && IS_TYPE_FLOAT(returnType)) {
bitvectorsetbit(1, liveinfo[epilogue->blockIndex].use);
} else if (coloring_class == RegClass_VR && IS_TYPE_VECTOR(returnType)) {
bitvectorsetbit(2, liveinfo[epilogue->blockIndex].use);
}
computeglobalinout();
}
int dead(PCode *instr, RegClass rclass, UInt32 *vec) {
int i;
PCodeArg *op;
if (instr->flags & (fIsBranch | fIsWrite | fIsCall | fIsVolatile | fSideEffects))
return 0;
if (instr->block->flags & (fIsProlog | fIsEpilogue))
return 0;
op = instr->args;
i = instr->argCount;
while (i--) {
if (
op->kind == PCOp_REGISTER &&
(op->data.reg.effect & EffectWrite) &&
(rclass != op->arg || bitvectorgetbit(op->data.reg.reg, vec))
)
return 0;
op++;
}
return copts.optimizationlevel > 0;
}

View File

@ -15,7 +15,7 @@ static BlockList *loopheaders;
static int nloopheaders; static int nloopheaders;
static PCodeBlock **loopstack; static PCodeBlock **loopstack;
BitVector *LoopTemp; BitVector *LoopTemp;
void *LoopList_First; struct LoopList *LoopList_First;
static void computedominators(void) { static void computedominators(void) {
int i; int i;
@ -316,7 +316,7 @@ void insertpreheaderblock(Loop *loop) {
if ( if (
(!block28->nextBlock || !bitvectorgetbit(block28->nextBlock->blockIndex, loop->memberblocks)) && (!block28->nextBlock || !bitvectorgetbit(block28->nextBlock->blockIndex, loop->memberblocks)) &&
block28->lastPCode && block28->lastPCode &&
(block28->lastPCode->flags & fPCodeFlag1) && (block28->lastPCode->flags & fIsBranch) &&
block28->lastPCode->op != PC_BDNZ block28->lastPCode->op != PC_BDNZ
) { ) {
i = block28->lastPCode->argCount; i = block28->lastPCode->argCount;
@ -851,10 +851,10 @@ void analyzeloop(Loop *loop) {
if (pcode->op == PC_BCTRL || pcode->op == PC_BCTR || pcode->op == PC_BCCTR || pcode->op == PC_MTCTR || pcode->op == PC_MFCTR) { if (pcode->op == PC_BCTRL || pcode->op == PC_BCTR || pcode->op == PC_BCCTR || pcode->op == PC_MTCTR || pcode->op == PC_MFCTR) {
loop->x4E = 1; loop->x4E = 1;
} else if (pcode->flags & fPCodeFlag2) { } else if (pcode->flags & fIsRead) {
if (pcode->op == PC_LBZX || pcode->op == PC_LHZX || pcode->op == PC_LHAX || pcode->op == PC_LWZX || pcode->op == PC_LFSX || pcode->op == PC_LFDX) if (pcode->op == PC_LBZX || pcode->op == PC_LHZX || pcode->op == PC_LHAX || pcode->op == PC_LWZX || pcode->op == PC_LFSX || pcode->op == PC_LFDX)
loop->x53 = 1; loop->x53 = 1;
} else if (pcode->flags & fPCodeFlag4) { } else if (pcode->flags & fIsWrite) {
if (pcode->op == PC_STBX || pcode->op == PC_STHX || pcode->op == PC_STWX || pcode->op == PC_STFSX || pcode->op == PC_STFDX) if (pcode->op == PC_STBX || pcode->op == PC_STHX || pcode->op == PC_STWX || pcode->op == PC_STFSX || pcode->op == PC_STFDX)
loop->x54 = 1; loop->x54 = 1;
} else { } else {
@ -883,4 +883,3 @@ void analyzeloopsinflowgraph(void) {
if (loopsinflowgraph) if (loopsinflowgraph)
analyzeloops(loopsinflowgraph); analyzeloops(loopsinflowgraph);
} }

View File

@ -175,7 +175,7 @@ static void skiplooptest(Loop *loop) {
loop->bodySize--; loop->bodySize--;
} }
for (instr = instr->nextPCode; instr && !(instr->flags & fPCodeFlag1); instr = instr->nextPCode) for (instr = instr->nextPCode; instr && !(instr->flags & fIsBranch); instr = instr->nextPCode)
insertpcodebefore(loop->preheader->lastPCode, copypcode(instr)); insertpcodebefore(loop->preheader->lastPCode, copypcode(instr));
} }
@ -206,7 +206,7 @@ static void unrollloop(Loop *loop) {
if (firstInstr->op != PC_CMP && firstInstr->op != PC_CMPL && firstInstr->op != PC_CMPI && firstInstr->op != PC_CMPLI) if (firstInstr->op != PC_CMP && firstInstr->op != PC_CMPL && firstInstr->op != PC_CMPI && firstInstr->op != PC_CMPLI)
CError_FATAL(450); CError_FATAL(450);
for (instr = firstInstr->nextPCode; instr && !(instr->flags & fPCodeFlag1); instr = instr->nextPCode) for (instr = firstInstr->nextPCode; instr && !(instr->flags & fIsBranch); instr = instr->nextPCode)
appendpcode(newBlock, copypcode(instr)); appendpcode(newBlock, copypcode(instr));
for (block = loop->preheader->successors->block; block != loop->body; block = block->successors->block) { for (block = loop->preheader->successors->block; block != loop->body; block = block->successors->block) {
@ -384,7 +384,7 @@ static void unrollloopconditional(Loop *loop) {
for (j = 0; j < inputBlockCount; j++) { for (j = 0; j < inputBlockCount; j++) {
for (instr = blocks[j]->firstPCode; instr; instr = instr->nextPCode) { for (instr = blocks[j]->firstPCode; instr; instr = instr->nextPCode) {
if (instr->flags & fPCodeFlag1) { if (instr->flags & fIsBranch) {
PCodeArg *op; PCodeArg *op;
int opID; int opID;
instrCopy = copypcode(instr); instrCopy = copypcode(instr);
@ -425,7 +425,7 @@ static void unrollloopconditional(Loop *loop) {
if (firstInstr->op != PC_CMP && firstInstr->op != PC_CMPL && firstInstr->op != PC_CMPI && firstInstr->op != PC_CMPLI) if (firstInstr->op != PC_CMP && firstInstr->op != PC_CMPL && firstInstr->op != PC_CMPI && firstInstr->op != PC_CMPLI)
CError_FATAL(764); CError_FATAL(764);
for (instr = firstInstr->nextPCode; instr && !(instr->flags & fPCodeFlag1); instr = instr->nextPCode) for (instr = firstInstr->nextPCode; instr && !(instr->flags & fIsBranch); instr = instr->nextPCode)
appendpcode(blocks2[inputBlockCount - 1], copypcode(instr)); appendpcode(blocks2[inputBlockCount - 1], copypcode(instr));
for (j = 0; j < inputBlockCount; j++) { for (j = 0; j < inputBlockCount; j++) {
@ -465,7 +465,7 @@ static void unrollloopconditional(Loop *loop) {
for (i = 0; i < inputBlockCount; i++) { for (i = 0; i < inputBlockCount; i++) {
for (instr = blocks[i]->firstPCode; instr; instr = instr->nextPCode) { for (instr = blocks[i]->firstPCode; instr; instr = instr->nextPCode) {
if (instr->flags & fPCodeFlag1) { if (instr->flags & fIsBranch) {
PCodeArg *op; PCodeArg *op;
int opID; int opID;
op = NULL; op = NULL;
@ -1293,7 +1293,7 @@ void changearraytoregisters(void) {
if ((arrays = scanforlocalarrays())) { if ((arrays = scanforlocalarrays())) {
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
for (instr = block->firstPCode; instr; instr = instr->nextPCode) { for (instr = block->firstPCode; instr; instr = instr->nextPCode) {
if (!(instr->flags & fPCodeFlag1) && instr->argCount) { if (!(instr->flags & fIsBranch) && instr->argCount) {
op = instr->args; op = instr->args;
i = instr->argCount; i = instr->argCount;
while (i--) { while (i--) {
@ -1304,7 +1304,7 @@ void changearraytoregisters(void) {
!array->invalid !array->invalid
) { ) {
if ( if (
(instr->flags & (fPCodeFlag2 | fPCodeFlag4)) && (instr->flags & (fIsRead | fIsWrite)) &&
(op->data.mem.offset % array->elementSize) == 0 && (op->data.mem.offset % array->elementSize) == 0 &&
op->data.mem.offset < array->arraySize op->data.mem.offset < array->arraySize
) { ) {
@ -1460,9 +1460,9 @@ void changearraytoregisters(void) {
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
for (instr = block->firstPCode; instr; instr = instr->nextPCode) { for (instr = block->firstPCode; instr; instr = instr->nextPCode) {
if ( if (
!(instr->flags & fPCodeFlag1) && !(instr->flags & fIsBranch) &&
instr->argCount && instr->argCount &&
(instr->flags & (fPCodeFlag2 | fPCodeFlag4)) && (instr->flags & (fIsRead | fIsWrite)) &&
instr->args[2].kind == PCOp_MEMORY && instr->args[2].kind == PCOp_MEMORY &&
(PCOpMemoryArg) instr->args[2].arg == PCOpMemory1 && (PCOpMemoryArg) instr->args[2].arg == PCOpMemory1 &&
(array = lookup_array_object(arrays, instr->args[2].data.mem.obj)) && (array = lookup_array_object(arrays, instr->args[2].data.mem.obj)) &&

View File

@ -0,0 +1,552 @@
#include "compiler/Scheduler.h"
#include "compiler/PCode.h"
#include "compiler/PCodeInfo.h"
// https://stuff.mit.edu/afs/sipb/contrib/doc/specs/ic/cpu/powerpc/mpc601.pdf
// https://www.nxp.com/docs/en/user-guide/MPC601UMAD.pdf
typedef enum Stage {
IU, // Integer Unit
FD, // FP Decode
FPM, // FP Multiply
FPA, // FP Add
FWA, // FP Arithmetic Writeback
BPU, // Branch Processing Unit
NumStages,
Serialize, // special form for instructions that use IU but are serialised
Unsupported // instructions not supported by this processor
} Stage;
static struct {
// the instruction currently in this pipeline stage
PCode *instr;
// how many cycles are left for this instruction to finish
int remaining;
} pipeline[NumStages];
static struct {
// the initial stage for this instruction
Stage stage;
// the total amount of cycles required by this instruction
char latency;
// how long it takes to finish each stage
char cycles[4];
} instruction_timing[OPCODE_MAX] = {
BPU, 0, 0, 0, 0, 1, // PC_B
BPU, 0, 0, 0, 0, 1, // PC_BL
BPU, 0, 0, 0, 0, 1, // PC_BC
BPU, 0, 0, 0, 0, 1, // PC_BCLR
BPU, 0, 0, 0, 0, 1, // PC_BCCTR
BPU, 0, 0, 0, 0, 1, // PC_BT
BPU, 0, 0, 0, 0, 1, // PC_BTLR
BPU, 0, 0, 0, 0, 1, // PC_BTCTR
BPU, 0, 0, 0, 0, 1, // PC_BF
BPU, 0, 0, 0, 0, 1, // PC_BFLR
BPU, 0, 0, 0, 0, 1, // PC_BFCTR
BPU, 0, 0, 0, 0, 1, // PC_BDNZ
BPU, 0, 0, 0, 0, 1, // PC_BDNZT
BPU, 0, 0, 0, 0, 1, // PC_BDNZF
BPU, 0, 0, 0, 0, 1, // PC_BDZ
BPU, 0, 0, 0, 0, 1, // PC_BDZT
BPU, 0, 0, 0, 0, 1, // PC_BDZF
BPU, 0, 0, 0, 0, 1, // PC_BLR
BPU, 0, 0, 0, 0, 1, // PC_BCTR
BPU, 0, 0, 0, 0, 1, // PC_BCTRL
BPU, 0, 0, 0, 0, 1, // PC_BLRL
IU, 2, 1, 0, 0, 0, // PC_LBZ
IU, 2, 1, 0, 0, 0, // PC_LBZU
IU, 2, 1, 0, 0, 0, // PC_LBZX
IU, 2, 1, 0, 0, 0, // PC_LBZUX
IU, 2, 1, 0, 0, 0, // PC_LHZ
IU, 2, 1, 0, 0, 0, // PC_LHZU
IU, 2, 1, 0, 0, 0, // PC_LHZX
IU, 2, 1, 0, 0, 0, // PC_LHZUX
IU, 2, 1, 0, 0, 0, // PC_LHA
IU, 2, 1, 0, 0, 0, // PC_LHAU
IU, 2, 1, 0, 0, 0, // PC_LHAX
IU, 2, 1, 0, 0, 0, // PC_LHAUX
IU, 2, 1, 0, 0, 0, // PC_LHBRX
IU, 2, 1, 0, 0, 0, // PC_LWZ
IU, 2, 1, 0, 0, 0, // PC_LWZU
IU, 2, 1, 0, 0, 0, // PC_LWZX
IU, 2, 1, 0, 0, 0, // PC_LWZUX
IU, 2, 1, 0, 0, 0, // PC_LWBRX
IU, 1, 1, 0, 0, 0, // PC_LMW
IU, 1, 1, 0, 0, 0, // PC_STB
IU, 1, 1, 0, 0, 0, // PC_STBU
IU, 1, 1, 0, 0, 0, // PC_STBX
IU, 1, 1, 0, 0, 0, // PC_STBUX
IU, 1, 1, 0, 0, 0, // PC_STH
IU, 1, 1, 0, 0, 0, // PC_STHU
IU, 1, 1, 0, 0, 0, // PC_STHX
IU, 1, 1, 0, 0, 0, // PC_STHUX
IU, 1, 1, 0, 0, 0, // PC_STHBRX
IU, 1, 1, 0, 0, 0, // PC_STW
IU, 1, 1, 0, 0, 0, // PC_STWU
IU, 1, 1, 0, 0, 0, // PC_STWX
IU, 1, 1, 0, 0, 0, // PC_STWUX
IU, 1, 1, 0, 0, 0, // PC_STWBRX
IU, 1, 1, 0, 0, 0, // PC_STMW
IU, 2, 1, 0, 0, 0, // PC_DCBF
IU, 2, 1, 0, 0, 0, // PC_DCBST
IU, 2, 1, 0, 0, 0, // PC_DCBT
IU, 2, 1, 0, 0, 0, // PC_DCBTST
IU, 2, 1, 0, 0, 0, // PC_DCBZ
IU, 1, 1, 0, 0, 0, // PC_ADD
IU, 1, 1, 0, 0, 0, // PC_ADDC
IU, 1, 1, 0, 0, 0, // PC_ADDE
IU, 1, 1, 0, 0, 0, // PC_ADDI
IU, 1, 1, 0, 0, 0, // PC_ADDIC
IU, 1, 1, 0, 0, 0, // PC_ADDICR
IU, 1, 1, 0, 0, 0, // PC_ADDIS
IU, 1, 1, 0, 0, 0, // PC_ADDME
IU, 1, 1, 0, 0, 0, // PC_ADDZE
IU, 36, 36, 0, 0, 0, // PC_DIVW
IU, 36, 36, 0, 0, 0, // PC_DIVWU
IU, 5, 5, 0, 0, 0, // PC_MULHW
IU, 5, 5, 0, 0, 0, // PC_MULHWU
IU, 5, 5, 0, 0, 0, // PC_MULLI
IU, 5, 5, 0, 0, 0, // PC_MULLW
IU, 1, 1, 0, 0, 0, // PC_NEG
IU, 1, 1, 0, 0, 0, // PC_SUBF
IU, 1, 1, 0, 0, 0, // PC_SUBFC
IU, 1, 1, 0, 0, 0, // PC_SUBFE
IU, 1, 1, 0, 0, 0, // PC_SUBFIC
IU, 1, 1, 0, 0, 0, // PC_SUBFME
IU, 1, 1, 0, 0, 0, // PC_SUBFZE
IU, 3, 1, 0, 0, 0, // PC_CMPI
IU, 3, 1, 0, 0, 0, // PC_CMP
IU, 3, 1, 0, 0, 0, // PC_CMPLI
IU, 3, 1, 0, 0, 0, // PC_CMPL
IU, 1, 1, 0, 0, 0, // PC_ANDI
IU, 1, 1, 0, 0, 0, // PC_ANDIS
IU, 1, 1, 0, 0, 0, // PC_ORI
IU, 1, 1, 0, 0, 0, // PC_ORIS
IU, 1, 1, 0, 0, 0, // PC_XORI
IU, 1, 1, 0, 0, 0, // PC_XORIS
IU, 1, 1, 0, 0, 0, // PC_AND
IU, 1, 1, 0, 0, 0, // PC_OR
IU, 1, 1, 0, 0, 0, // PC_XOR
IU, 1, 1, 0, 0, 0, // PC_NAND
IU, 1, 1, 0, 0, 0, // PC_NOR
IU, 1, 1, 0, 0, 0, // PC_EQV
IU, 1, 1, 0, 0, 0, // PC_ANDC
IU, 1, 1, 0, 0, 0, // PC_ORC
IU, 1, 1, 0, 0, 0, // PC_EXTSB
IU, 1, 1, 0, 0, 0, // PC_EXTSH
IU, 1, 1, 0, 0, 0, // PC_CNTLZW
IU, 1, 1, 0, 0, 0, // PC_RLWINM
IU, 1, 1, 0, 0, 0, // PC_RLWNM
IU, 1, 1, 0, 0, 0, // PC_RLWIMI
IU, 1, 1, 0, 0, 0, // PC_SLW
IU, 1, 1, 0, 0, 0, // PC_SRW
IU, 1, 1, 0, 0, 0, // PC_SRAWI
IU, 1, 1, 0, 0, 0, // PC_SRAW
IU, 1, 1, 0, 0, 0, // PC_CRAND
IU, 1, 1, 0, 0, 0, // PC_CRANDC
IU, 1, 1, 0, 0, 0, // PC_CREQV
IU, 1, 1, 0, 0, 0, // PC_CRNAND
IU, 1, 1, 0, 0, 0, // PC_CRNOR
IU, 1, 1, 0, 0, 0, // PC_CROR
IU, 1, 1, 0, 0, 0, // PC_CRORC
IU, 1, 1, 0, 0, 0, // PC_CRXOR
IU, 1, 1, 0, 0, 0, // PC_MCRF
IU, 4, 1, 0, 0, 0, // PC_MTXER
IU, 4, 1, 0, 0, 0, // PC_MTCTR
IU, 4, 1, 0, 0, 0, // PC_MTLR
IU, 2, 1, 0, 0, 0, // PC_MTCRF
IU, 1, 0, 0, 0, 0, // PC_MTMSR
IU, 1, 0, 0, 0, 0, // PC_MTSPR
IU, 1, 0, 0, 0, 0, // PC_MFMSR
IU, 1, 0, 0, 0, 0, // PC_MFSPR
IU, 1, 1, 0, 0, 0, // PC_MFXER
IU, 1, 1, 0, 0, 0, // PC_MFCTR
IU, 1, 1, 0, 0, 0, // PC_MFLR
IU, 1, 1, 0, 0, 0, // PC_MFCR
FD, 4, 1, 1, 1, 1, // PC_MFFS
FD, 4, 1, 1, 1, 1, // PC_MTFSF
Serialize, 1, 1, 0, 0, 1, // PC_EIEIO
Serialize, 1, 1, 0, 0, 1, // PC_ISYNC
Serialize, 1, 1, 0, 0, 1, // PC_SYNC
Serialize, 0, 0, 0, 0, 1, // PC_RFI
IU, 1, 1, 0, 0, 0, // PC_LI
IU, 1, 1, 0, 0, 0, // PC_LIS
IU, 1, 1, 0, 0, 0, // PC_MR
IU, 1, 1, 0, 0, 0, // PC_NOP
IU, 1, 1, 0, 0, 0, // PC_NOT
IU, 3, 1, 0, 0, 0, // PC_LFS
IU, 3, 1, 0, 0, 0, // PC_LFSU
IU, 3, 1, 0, 0, 0, // PC_LFSX
IU, 3, 1, 0, 0, 0, // PC_LFSUX
IU, 3, 1, 0, 0, 0, // PC_LFD
IU, 3, 1, 0, 0, 0, // PC_LFDU
IU, 3, 1, 0, 0, 0, // PC_LFDX
IU, 3, 1, 0, 0, 0, // PC_LFDUX
IU, 1, 1, 0, 0, 0, // PC_STFS
IU, 1, 1, 0, 0, 0, // PC_STFSU
IU, 1, 1, 0, 0, 0, // PC_STFSX
IU, 1, 1, 0, 0, 0, // PC_STFSUX
IU, 1, 1, 0, 0, 0, // PC_STFD
IU, 1, 1, 0, 0, 0, // PC_STFDU
IU, 1, 1, 0, 0, 0, // PC_STFDX
IU, 1, 1, 0, 0, 0, // PC_STFDUX
FD, 4, 1, 1, 1, 1, // PC_FMR
FD, 4, 1, 1, 1, 1, // PC_FABS
FD, 4, 1, 1, 1, 1, // PC_FNEG
FD, 4, 1, 1, 1, 1, // PC_FNABS
FD, 4, 1, 1, 1, 1, // PC_FADD
FD, 4, 1, 1, 1, 1, // PC_FADDS
FD, 4, 1, 1, 1, 1, // PC_FSUB
FD, 4, 1, 1, 1, 1, // PC_FSUBS
FD, 5, 1, 1, 2, 1, // PC_FMUL
FD, 4, 1, 1, 1, 1, // PC_FMULS
FD, 31, 1, 1, 28, 1, // PC_FDIV
FD, 17, 1, 1, 14, 1, // PC_FDIVS
FD, 5, 1, 1, 2, 1, // PC_FMADD
FD, 4, 1, 1, 1, 1, // PC_FMADDS
FD, 5, 1, 1, 2, 1, // PC_FMSUB
FD, 4, 1, 1, 1, 1, // PC_FMSUBS
FD, 5, 1, 1, 2, 1, // PC_FNMADD
FD, 4, 1, 1, 1, 1, // PC_FNMADDS
FD, 5, 1, 1, 2, 1, // PC_FNMSUB
FD, 4, 1, 1, 1, 1, // PC_FNMSUBS
FD, 4, 1, 1, 1, 1, // PC_FRES
FD, 4, 1, 1, 1, 1, // PC_FRSQRTE
FD, 4, 1, 1, 1, 1, // PC_FSEL
FD, 4, 1, 1, 1, 1, // PC_FRSP
FD, 4, 1, 1, 1, 1, // PC_FCTIW
FD, 4, 1, 1, 1, 1, // PC_FCTIWZ
FD, 6, 1, 1, 1, 1, // PC_FCMPU
FD, 6, 1, 1, 1, 1, // PC_FCMPO
IU, 0, 0, 0, 0, 0, // PC_LWARX
IU, 0, 0, 0, 0, 0, // PC_LSWI
IU, 0, 0, 0, 0, 0, // PC_LSWX
IU, 0, 0, 0, 0, 0, // PC_STFIWX
IU, 0, 0, 0, 0, 0, // PC_STSWI
IU, 0, 0, 0, 0, 0, // PC_STSWX
IU, 0, 0, 0, 0, 0, // PC_STWCX
IU, 0, 0, 0, 0, 0, // PC_ECIWX
IU, 0, 0, 0, 0, 0, // PC_ECOWX
IU, 0, 0, 0, 0, 0, // PC_DCBI
IU, 0, 0, 0, 0, 0, // PC_ICBI
IU, 0, 0, 0, 0, 0, // PC_MCRFS
IU, 0, 0, 0, 0, 0, // PC_MCRXR
IU, 0, 0, 0, 0, 0, // PC_MFTB
IU, 0, 0, 0, 0, 0, // PC_MFSR
IU, 0, 0, 0, 0, 0, // PC_MTSR
IU, 0, 0, 0, 0, 0, // PC_MFSRIN
IU, 0, 0, 0, 0, 0, // PC_MTSRIN
IU, 0, 0, 0, 0, 0, // PC_MTFSB0
IU, 0, 0, 0, 0, 0, // PC_MTFSB1
IU, 0, 0, 0, 0, 0, // PC_MTFSFI
Serialize, 0, 0, 0, 0, 0, // PC_SC
IU, 0, 0, 0, 0, 0, // PC_FSQRT
IU, 0, 0, 0, 0, 0, // PC_FSQRTS
IU, 0, 0, 0, 0, 0, // PC_TLBIA
IU, 0, 0, 0, 0, 0, // PC_TLBIE
IU, 0, 0, 0, 0, 0, // PC_TLBLD
IU, 0, 0, 0, 0, 0, // PC_TLBLI
IU, 0, 0, 0, 0, 0, // PC_TLBSYNC
Serialize, 0, 0, 0, 0, 0, // PC_TW
Serialize, 0, 0, 0, 0, 0, // PC_TRAP
Serialize, 0, 0, 0, 0, 0, // PC_TWI
Serialize, 0, 0, 0, 0, 0, // PC_OPWORD
IU, 0, 0, 0, 0, 0, // PC_MFROM
IU, 0, 0, 0, 0, 0, // PC_DSA
IU, 0, 0, 0, 0, 0, // PC_ESA
IU, 0, 0, 0, 0, 0, // PC_DCCCI
IU, 0, 0, 0, 0, 0, // PC_DCREAD
IU, 0, 0, 0, 0, 0, // PC_ICBT
IU, 0, 0, 0, 0, 0, // PC_ICCCI
IU, 0, 0, 0, 0, 0, // PC_ICREAD
IU, 0, 0, 0, 0, 0, // PC_RFCI
IU, 0, 0, 0, 0, 0, // PC_TLBRE
IU, 0, 0, 0, 0, 0, // PC_TLBSX
IU, 0, 0, 0, 0, 0, // PC_TLBWE
IU, 0, 0, 0, 0, 0, // PC_WRTEE
IU, 0, 0, 0, 0, 0, // PC_WRTEEI
IU, 0, 0, 0, 0, 0, // PC_MFDCR
IU, 0, 0, 0, 0, 0, // PC_MTDCR
Unsupported, 0, 0, 0, 0, 0, // PC_DCBA
Unsupported, 0, 0, 0, 0, 0, // PC_DSS
Unsupported, 0, 0, 0, 0, 0, // PC_DSSALL
Unsupported, 0, 0, 0, 0, 0, // PC_DST
Unsupported, 0, 0, 0, 0, 0, // PC_DSTT
Unsupported, 0, 0, 0, 0, 0, // PC_DSTST
Unsupported, 0, 0, 0, 0, 0, // PC_DSTSTT
Unsupported, 0, 0, 0, 0, 0, // PC_LVEBX
Unsupported, 0, 0, 0, 0, 0, // PC_LVEHX
Unsupported, 0, 0, 0, 0, 0, // PC_LVEWX
Unsupported, 0, 0, 0, 0, 0, // PC_LVSL
Unsupported, 0, 0, 0, 0, 0, // PC_LVSR
Unsupported, 0, 0, 0, 0, 0, // PC_LVX
Unsupported, 0, 0, 0, 0, 0, // PC_LVXL
Unsupported, 0, 0, 0, 0, 0, // PC_STVEBX
Unsupported, 0, 0, 0, 0, 0, // PC_STVEHX
Unsupported, 0, 0, 0, 0, 0, // PC_STVEWX
Unsupported, 0, 0, 0, 0, 0, // PC_STVX
Unsupported, 0, 0, 0, 0, 0, // PC_STVXL
Unsupported, 0, 0, 0, 0, 0, // PC_MFVSCR
Unsupported, 0, 0, 0, 0, 0, // PC_MTVSCR
Unsupported, 0, 0, 0, 0, 0, // PC_VADDCUW
Unsupported, 0, 0, 0, 0, 0, // PC_VADDFP
Unsupported, 0, 0, 0, 0, 0, // PC_VADDSBS
Unsupported, 0, 0, 0, 0, 0, // PC_VADDSHS
Unsupported, 0, 0, 0, 0, 0, // PC_VADDSWS
Unsupported, 0, 0, 0, 0, 0, // PC_VADDUBM
Unsupported, 0, 0, 0, 0, 0, // PC_VADDUBS
Unsupported, 0, 0, 0, 0, 0, // PC_VADDUHM
Unsupported, 0, 0, 0, 0, 0, // PC_VADDUHS
Unsupported, 0, 0, 0, 0, 0, // PC_VADDUWM
Unsupported, 0, 0, 0, 0, 0, // PC_VADDUWS
Unsupported, 0, 0, 0, 0, 0, // PC_VAND
Unsupported, 0, 0, 0, 0, 0, // PC_VANDC
Unsupported, 0, 0, 0, 0, 0, // PC_VAVGSB
Unsupported, 0, 0, 0, 0, 0, // PC_VAVGSH
Unsupported, 0, 0, 0, 0, 0, // PC_VAVGSW
Unsupported, 0, 0, 0, 0, 0, // PC_VAVGUB
Unsupported, 0, 0, 0, 0, 0, // PC_VAVGUH
Unsupported, 0, 0, 0, 0, 0, // PC_VAVGUW
Unsupported, 0, 0, 0, 0, 0, // PC_VCFSX
Unsupported, 0, 0, 0, 0, 0, // PC_VCFUX
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPBFP
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPEQFP
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPEQUB
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPEQUH
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPEQUW
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPGEFP
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPGTFP
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPGTSB
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPGTSH
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPGTSW
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPGTUB
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPGTUH
Unsupported, 0, 0, 0, 0, 0, // PC_VCMPGTUW
Unsupported, 0, 0, 0, 0, 0, // PC_VCTSXS
Unsupported, 0, 0, 0, 0, 0, // PC_VCTUXS
Unsupported, 0, 0, 0, 0, 0, // PC_VEXPTEFP
Unsupported, 0, 0, 0, 0, 0, // PC_VLOGEFP
Unsupported, 0, 0, 0, 0, 0, // PC_VMAXFP
Unsupported, 0, 0, 0, 0, 0, // PC_VMAXSB
Unsupported, 0, 0, 0, 0, 0, // PC_VMAXSH
Unsupported, 0, 0, 0, 0, 0, // PC_VMAXSW
Unsupported, 0, 0, 0, 0, 0, // PC_VMAXUB
Unsupported, 0, 0, 0, 0, 0, // PC_VMAXUH
Unsupported, 0, 0, 0, 0, 0, // PC_VMAXUW
Unsupported, 0, 0, 0, 0, 0, // PC_VMINFP
Unsupported, 0, 0, 0, 0, 0, // PC_VMINSB
Unsupported, 0, 0, 0, 0, 0, // PC_VMINSH
Unsupported, 0, 0, 0, 0, 0, // PC_VMINSW
Unsupported, 0, 0, 0, 0, 0, // PC_VMINUB
Unsupported, 0, 0, 0, 0, 0, // PC_VMINUH
Unsupported, 0, 0, 0, 0, 0, // PC_VMINUW
Unsupported, 0, 0, 0, 0, 0, // PC_VMRGHB
Unsupported, 0, 0, 0, 0, 0, // PC_VMRGHH
Unsupported, 0, 0, 0, 0, 0, // PC_VMRGHW
Unsupported, 0, 0, 0, 0, 0, // PC_VMRGLB
Unsupported, 0, 0, 0, 0, 0, // PC_VMRGLH
Unsupported, 0, 0, 0, 0, 0, // PC_VMRGLW
Unsupported, 0, 0, 0, 0, 0, // PC_VMULESB
Unsupported, 0, 0, 0, 0, 0, // PC_VMULESH
Unsupported, 0, 0, 0, 0, 0, // PC_VMULEUB
Unsupported, 0, 0, 0, 0, 0, // PC_VMULEUH
Unsupported, 0, 0, 0, 0, 0, // PC_VMULOSB
Unsupported, 0, 0, 0, 0, 0, // PC_VMULOSH
Unsupported, 0, 0, 0, 0, 0, // PC_VMULOUB
Unsupported, 0, 0, 0, 0, 0, // PC_VMULOUH
Unsupported, 0, 0, 0, 0, 0, // PC_VNOR
Unsupported, 0, 0, 0, 0, 0, // PC_VOR
Unsupported, 0, 0, 0, 0, 0, // PC_VPKPX
Unsupported, 0, 0, 0, 0, 0, // PC_VPKSHSS
Unsupported, 0, 0, 0, 0, 0, // PC_VPKSHUS
Unsupported, 0, 0, 0, 0, 0, // PC_VPKSWSS
Unsupported, 0, 0, 0, 0, 0, // PC_VPKSWUS
Unsupported, 0, 0, 0, 0, 0, // PC_VPKUHUM
Unsupported, 0, 0, 0, 0, 0, // PC_VPKUHUS
Unsupported, 0, 0, 0, 0, 0, // PC_VPKUWUM
Unsupported, 0, 0, 0, 0, 0, // PC_VPKUWUS
Unsupported, 0, 0, 0, 0, 0, // PC_VREFP
Unsupported, 0, 0, 0, 0, 0, // PC_VRFIM
Unsupported, 0, 0, 0, 0, 0, // PC_VRFIN
Unsupported, 0, 0, 0, 0, 0, // PC_VRFIP
Unsupported, 0, 0, 0, 0, 0, // PC_VRFIZ
Unsupported, 0, 0, 0, 0, 0, // PC_VRLB
Unsupported, 0, 0, 0, 0, 0, // PC_VRLH
Unsupported, 0, 0, 0, 0, 0, // PC_VRLW
Unsupported, 0, 0, 0, 0, 0, // PC_VRSQRTEFP
Unsupported, 0, 0, 0, 0, 0, // PC_VSL
Unsupported, 0, 0, 0, 0, 0, // PC_VSLB
Unsupported, 0, 0, 0, 0, 0, // PC_VSLH
Unsupported, 0, 0, 0, 0, 0, // PC_VSLO
Unsupported, 0, 0, 0, 0, 0, // PC_VSLW
Unsupported, 0, 0, 0, 0, 0, // PC_VSPLTB
Unsupported, 0, 0, 0, 0, 0, // PC_VSPLTH
Unsupported, 0, 0, 0, 0, 0, // PC_VSPLTW
Unsupported, 0, 0, 0, 0, 0, // PC_VSPLTISB
Unsupported, 0, 0, 0, 0, 0, // PC_VSPLTISH
Unsupported, 0, 0, 0, 0, 0, // PC_VSPLTISW
Unsupported, 0, 0, 0, 0, 0, // PC_VSR
Unsupported, 0, 0, 0, 0, 0, // PC_VSRAB
Unsupported, 0, 0, 0, 0, 0, // PC_VSRAH
Unsupported, 0, 0, 0, 0, 0, // PC_VSRAW
Unsupported, 0, 0, 0, 0, 0, // PC_VSRB
Unsupported, 0, 0, 0, 0, 0, // PC_VSRH
Unsupported, 0, 0, 0, 0, 0, // PC_VSRO
Unsupported, 0, 0, 0, 0, 0, // PC_VSRW
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBCUW
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBFP
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBSBS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBSHS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBSWS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBUBM
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBUBS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBUHM
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBUHS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBUWM
Unsupported, 0, 0, 0, 0, 0, // PC_VSUBUWS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUMSWS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUFPMSWS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUFWASBS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUFWASHS
Unsupported, 0, 0, 0, 0, 0, // PC_VSUFWAUBS
Unsupported, 0, 0, 0, 0, 0, // PC_VUPKHPX
Unsupported, 0, 0, 0, 0, 0, // PC_VUPKHSB
Unsupported, 0, 0, 0, 0, 0, // PC_VUPKHSH
Unsupported, 0, 0, 0, 0, 0, // PC_VUPKLPX
Unsupported, 0, 0, 0, 0, 0, // PC_VUPKLSB
Unsupported, 0, 0, 0, 0, 0, // PC_VUPKLSH
Unsupported, 0, 0, 0, 0, 0, // PC_VXOR
Unsupported, 0, 0, 0, 0, 0, // PC_VMADDFP
Unsupported, 0, 0, 0, 0, 0, // PC_VMHADDSHS
Unsupported, 0, 0, 0, 0, 0, // PC_VMHRADDSHS
Unsupported, 0, 0, 0, 0, 0, // PC_VMLADDUHM
Unsupported, 0, 0, 0, 0, 0, // PC_VMSUMMBM
Unsupported, 0, 0, 0, 0, 0, // PC_VMSUMSHM
Unsupported, 0, 0, 0, 0, 0, // PC_VMSUMSHS
Unsupported, 0, 0, 0, 0, 0, // PC_VMSUMUBM
Unsupported, 0, 0, 0, 0, 0, // PC_VMSUMUHM
Unsupported, 0, 0, 0, 0, 0, // PC_VMSUMUHS
Unsupported, 0, 0, 0, 0, 0, // PC_VNMSUBFP
Unsupported, 0, 0, 0, 0, 0, // PC_VPERM
Unsupported, 0, 0, 0, 0, 0, // PC_VSEL
Unsupported, 0, 0, 0, 0, 0, // PC_VSLDOI
Unsupported, 0, 0, 0, 0, 0, // PC_VMR
Unsupported, 0, 0, 0, 0, 0, // PC_VMRP
IU, 0, 0, 0, 0, 0, // PC_SLE
IU, 0, 0, 0, 0, 0, // PC_SLEQ
IU, 0, 0, 0, 0, 0, // PC_SLIQ
IU, 0, 0, 0, 0, 0, // PC_SLLIQ
IU, 0, 0, 0, 0, 0, // PC_SLLQ
IU, 0, 0, 0, 0, 0, // PC_SLQ
IU, 0, 0, 0, 0, 0, // PC_SRAIQ
IU, 0, 0, 0, 0, 0, // PC_SRAQ
IU, 0, 0, 0, 0, 0, // PC_SRE
IU, 0, 0, 0, 0, 0, // PC_SREA
IU, 0, 0, 0, 0, 0, // PC_SREQ
IU, 0, 0, 0, 0, 0, // PC_SRIQ
IU, 0, 0, 0, 0, 0, // PC_SRLIQ
IU, 0, 0, 0, 0, 0, // PC_SRLQ
IU, 0, 0, 0, 0, 0, // PC_SRQ
IU, 0, 0, 0, 0, 0, // PC_MASKG
IU, 0, 0, 0, 0, 0, // PC_MASKIR
IU, 0, 0, 0, 0, 0, // PC_LSCBX
IU, 0, 0, 0, 0, 0, // PC_DIV
IU, 0, 0, 0, 0, 0, // PC_DIVS
IU, 0, 0, 0, 0, 0, // PC_DOZ
IU, 0, 0, 0, 0, 0, // PC_MUL
IU, 0, 0, 0, 0, 0, // PC_NABS
IU, 0, 0, 0, 0, 0, // PC_ABS
IU, 0, 0, 0, 0, 0, // PC_CLCS
IU, 0, 0, 0, 0, 0, // PC_DOZI
IU, 0, 0, 0, 0, 0, // PC_RLMI
IU, 0, 0, 0, 0, 0, // PC_RRIB
};
static void advance(int stageCount, int oldStage, int newStage) {
PCode *instr = pipeline[oldStage].instr;
int cycles = instruction_timing[instr->op].cycles[newStage - stageCount];
pipeline[newStage].instr = instr;
pipeline[newStage].remaining = cycles;
pipeline[oldStage].instr = NULL;
}
static void complete_instruction(int stage) {
pipeline[stage].instr = NULL;
}
static int latency(PCode *instr) {
int cycles = instruction_timing[instr->op].latency;
if (PCODE_FLAG_SET_F(instr) & fRecordBit)
cycles += 2;
if (instr->op == PC_LMW || instr->op == PC_STMW)
cycles += instr->argCount - 2;
return cycles;
}
static void initialize(void) {
int stage;
for (stage = 0; stage < NumStages; stage++)
pipeline[stage].instr = NULL;
}
static int can_issue(PCode *instr) {
int stage = instruction_timing[instr->op].stage;
if (stage == Serialize)
stage = IU;
if (pipeline[stage].instr)
return 0;
return 1;
}
static void issue(PCode *instr) {
int stage = instruction_timing[instr->op].stage;
int cycles = instruction_timing[instr->op].cycles[IU];
if (stage == Serialize)
stage = IU;
pipeline[stage].instr = instr;
pipeline[stage].remaining = cycles;
}
static void advance_clock(void) {
int stage;
for (stage = 0; stage < NumStages; stage++) {
if (pipeline[stage].instr && pipeline[stage].remaining)
--pipeline[stage].remaining;
}
if (pipeline[IU].instr && pipeline[IU].remaining == 0)
complete_instruction(IU);
if (pipeline[FWA].instr && pipeline[FWA].remaining == 0)
complete_instruction(FWA);
if (pipeline[BPU].instr && pipeline[BPU].remaining == 0)
complete_instruction(BPU);
if (pipeline[FPA].instr && pipeline[FPA].remaining == 0 && !pipeline[FWA].instr)
advance(1, FPA, FWA);
if (pipeline[FPM].instr && pipeline[FPM].remaining == 0 && !pipeline[FPA].instr)
advance(1, FPM, FPA);
if (pipeline[FD].instr && pipeline[FD].remaining == 0 && !pipeline[FPM].instr)
advance(1, FD, FPM);
}
static int serializes(PCode *instr) {
return instruction_timing[instr->op].stage == Serialize;
}
MachineInfo machine601 = {
2,
0,
0,
&latency,
&initialize,
&can_issue,
&issue,
&advance_clock,
&serializes,
&default_uses_vpermute_unit
};

View File

@ -0,0 +1,626 @@
#include "compiler/Scheduler.h"
#include "compiler/PCode.h"
#include "compiler/PCodeInfo.h"
// this is actually for 603e, but i couldn't find the 603 doc
// https://www.nxp.com/docs/en/reference-manual/MPC603EUM.pdf
typedef enum Stage {
BPU, // Branch Prediction Unit
IU, // Integer Unit
LSU1, // Load/Store Unit
LSU2,
FPU1, // Floating Point Unit
FPU2,
FPU3,
SRU, // System Register Unit
NumStages
} Stage;
static struct {
// the instruction currently in this pipeline stage
PCode *instr;
// how many cycles are left for this instruction to finish
int remaining;
} pipeline[NumStages];
enum {
MaxEntries = 5
};
static struct {
// how many entries remain unused in the queue
unsigned int free;
// how many entries are currently used in the queue
unsigned int used;
// the index of the next instruction that will be retired
unsigned int nextToRetire;
// the index of the next free slot that will be used when an instruction is dispatched
unsigned int nextFreeSlot;
// circular array of entries in the completion queue
struct {
PCode *instr;
int completed;
} entries[MaxEntries];
} completionbuffers;
static struct {
// the initial stage for this instruction
Stage stage;
// the total amount of cycles required by this instruction
char latency;
// how long it takes to finish each stage
char cycles[3];
// does this instruction serialise?
char serializes;
} instruction_timing[OPCODE_MAX] = {
BPU, 0, 0, 0, 0, 1, // PC_B
BPU, 0, 0, 0, 0, 1, // PC_BL
BPU, 0, 0, 0, 0, 1, // PC_BC
BPU, 0, 0, 0, 0, 1, // PC_BCLR
BPU, 0, 0, 0, 0, 1, // PC_BCCTR
BPU, 0, 0, 0, 0, 1, // PC_BT
BPU, 0, 0, 0, 0, 1, // PC_BTLR
BPU, 0, 0, 0, 0, 1, // PC_BTCTR
BPU, 0, 0, 0, 0, 1, // PC_BF
BPU, 0, 0, 0, 0, 1, // PC_BFLR
BPU, 0, 0, 0, 0, 1, // PC_BFCTR
BPU, 0, 0, 0, 0, 1, // PC_BDNZ
BPU, 0, 0, 0, 0, 1, // PC_BDNZT
BPU, 0, 0, 0, 0, 1, // PC_BDNZF
BPU, 0, 0, 0, 0, 1, // PC_BDZ
BPU, 0, 0, 0, 0, 1, // PC_BDZT
BPU, 0, 0, 0, 0, 1, // PC_BDZF
BPU, 0, 0, 0, 0, 1, // PC_BLR
BPU, 0, 0, 0, 0, 1, // PC_BCTR
BPU, 0, 0, 0, 0, 1, // PC_BCTRL
BPU, 0, 0, 0, 0, 1, // PC_BLRL
LSU1, 2, 1, 1, 0, 0, // PC_LBZ
LSU1, 2, 1, 1, 0, 0, // PC_LBZU
LSU1, 2, 1, 1, 0, 0, // PC_LBZX
LSU1, 2, 1, 1, 0, 0, // PC_LBZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHZ
LSU1, 2, 1, 1, 0, 0, // PC_LHZU
LSU1, 2, 1, 1, 0, 0, // PC_LHZX
LSU1, 2, 1, 1, 0, 0, // PC_LHZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHA
LSU1, 2, 1, 1, 0, 0, // PC_LHAU
LSU1, 2, 1, 1, 0, 0, // PC_LHAX
LSU1, 2, 1, 1, 0, 0, // PC_LHAUX
LSU1, 2, 1, 1, 0, 0, // PC_LHBRX
LSU1, 2, 1, 1, 0, 0, // PC_LWZ
LSU1, 2, 1, 1, 0, 0, // PC_LWZU
LSU1, 2, 1, 1, 0, 0, // PC_LWZX
LSU1, 2, 1, 1, 0, 0, // PC_LWZUX
LSU1, 2, 1, 1, 0, 0, // PC_LWBRX
LSU1, 2, 1, 1, 0, 0, // PC_LMW
LSU1, 2, 1, 1, 0, 0, // PC_STB
LSU1, 2, 1, 1, 0, 0, // PC_STBU
LSU1, 2, 1, 1, 0, 0, // PC_STBX
LSU1, 2, 1, 1, 0, 0, // PC_STBUX
LSU1, 2, 1, 1, 0, 0, // PC_STH
LSU1, 2, 1, 1, 0, 0, // PC_STHU
LSU1, 2, 1, 1, 0, 0, // PC_STHX
LSU1, 2, 1, 1, 0, 0, // PC_STHUX
LSU1, 2, 1, 1, 0, 0, // PC_STHBRX
LSU1, 2, 1, 1, 0, 0, // PC_STW
LSU1, 2, 1, 1, 0, 0, // PC_STWU
LSU1, 2, 1, 1, 0, 0, // PC_STWX
LSU1, 2, 1, 1, 0, 0, // PC_STWUX
LSU1, 2, 1, 1, 0, 0, // PC_STWBRX
LSU1, 2, 1, 1, 0, 0, // PC_STMW
LSU1, 2, 1, 1, 0, 0, // PC_DCBF
LSU1, 2, 1, 1, 0, 0, // PC_DCBST
LSU1, 2, 1, 1, 0, 0, // PC_DCBT
LSU1, 2, 1, 1, 0, 0, // PC_DCBTST
LSU1, 2, 1, 1, 0, 0, // PC_DCBZ
IU, 1, 1, 0, 0, 0, // PC_ADD
IU, 1, 1, 0, 0, 0, // PC_ADDC
IU, 1, 1, 0, 0, 0, // PC_ADDE
IU, 1, 1, 0, 0, 0, // PC_ADDI
IU, 1, 1, 0, 0, 0, // PC_ADDIC
IU, 1, 1, 0, 0, 0, // PC_ADDICR
IU, 1, 1, 0, 0, 0, // PC_ADDIS
IU, 1, 1, 0, 0, 0, // PC_ADDME
IU, 1, 1, 0, 0, 0, // PC_ADDZE
IU, 37, 37, 0, 0, 0, // PC_DIVW
IU, 37, 37, 0, 0, 0, // PC_DIVWU
IU, 5, 5, 0, 0, 0, // PC_MULHW
IU, 5, 5, 0, 0, 0, // PC_MULHWU
IU, 3, 3, 0, 0, 0, // PC_MULLI
IU, 5, 5, 0, 0, 0, // PC_MULLW
IU, 1, 1, 0, 0, 0, // PC_NEG
IU, 1, 1, 0, 0, 0, // PC_SUBF
IU, 1, 1, 0, 0, 0, // PC_SUBFC
IU, 1, 1, 0, 0, 0, // PC_SUBFE
IU, 1, 1, 0, 0, 0, // PC_SUBFIC
IU, 1, 1, 0, 0, 0, // PC_SUBFME
IU, 1, 1, 0, 0, 0, // PC_SUBFZE
IU, 3, 1, 0, 0, 0, // PC_CMPI
IU, 3, 1, 0, 0, 0, // PC_CMP
IU, 3, 1, 0, 0, 0, // PC_CMPLI
IU, 3, 1, 0, 0, 0, // PC_CMPL
IU, 1, 1, 0, 0, 0, // PC_ANDI
IU, 1, 1, 0, 0, 0, // PC_ANDIS
IU, 1, 1, 0, 0, 0, // PC_ORI
IU, 1, 1, 0, 0, 0, // PC_ORIS
IU, 1, 1, 0, 0, 0, // PC_XORI
IU, 1, 1, 0, 0, 0, // PC_XORIS
IU, 1, 1, 0, 0, 0, // PC_AND
IU, 1, 1, 0, 0, 0, // PC_OR
IU, 1, 1, 0, 0, 0, // PC_XOR
IU, 1, 1, 0, 0, 0, // PC_NAND
IU, 1, 1, 0, 0, 0, // PC_NOR
IU, 1, 1, 0, 0, 0, // PC_EQV
IU, 1, 1, 0, 0, 0, // PC_ANDC
IU, 1, 1, 0, 0, 0, // PC_ORC
IU, 1, 1, 0, 0, 0, // PC_EXTSB
IU, 1, 1, 0, 0, 0, // PC_EXTSH
IU, 1, 1, 0, 0, 0, // PC_CNTLZW
IU, 1, 1, 0, 0, 0, // PC_RLWINM
IU, 1, 1, 0, 0, 0, // PC_RLWNM
IU, 1, 1, 0, 0, 0, // PC_RLWIMI
IU, 1, 1, 0, 0, 0, // PC_SLW
IU, 1, 1, 0, 0, 0, // PC_SRW
IU, 1, 1, 0, 0, 0, // PC_SRAWI
IU, 1, 1, 0, 0, 0, // PC_SRAW
SRU, 1, 1, 0, 0, 0, // PC_CRAND
SRU, 1, 1, 0, 0, 0, // PC_CRANDC
SRU, 1, 1, 0, 0, 0, // PC_CREQV
SRU, 1, 1, 0, 0, 0, // PC_CRNAND
SRU, 1, 1, 0, 0, 0, // PC_CRNOR
SRU, 1, 1, 0, 0, 0, // PC_CROR
SRU, 1, 1, 0, 0, 0, // PC_CRORC
SRU, 1, 1, 0, 0, 0, // PC_CRXOR
SRU, 1, 1, 0, 0, 0, // PC_MCRF
SRU, 2, 2, 0, 0, 0, // PC_MTXER
SRU, 2, 2, 0, 0, 0, // PC_MTCTR
SRU, 2, 2, 0, 0, 0, // PC_MTLR
SRU, 1, 1, 0, 0, 0, // PC_MTCRF
SRU, 1, 1, 0, 0, 1, // PC_MTMSR
SRU, 1, 1, 0, 0, 1, // PC_MTSPR
SRU, 1, 1, 0, 0, 1, // PC_MFMSR
SRU, 1, 1, 0, 0, 1, // PC_MFSPR
SRU, 1, 1, 0, 0, 0, // PC_MFXER
SRU, 1, 1, 0, 0, 0, // PC_MFCTR
SRU, 1, 1, 0, 0, 0, // PC_MFLR
SRU, 1, 1, 0, 0, 0, // PC_MFCR
FPU1, 3, 1, 1, 1, 0, // PC_MFFS
FPU1, 3, 1, 1, 1, 0, // PC_MTFSF
SRU, 1, 1, 0, 0, 1, // PC_EIEIO
SRU, 1, 1, 0, 0, 1, // PC_ISYNC
SRU, 1, 1, 0, 0, 1, // PC_SYNC
SRU, 1, 1, 0, 0, 1, // PC_RFI
IU, 1, 1, 0, 0, 0, // PC_LI
IU, 1, 1, 0, 0, 0, // PC_LIS
IU, 1, 1, 0, 0, 0, // PC_MR
IU, 1, 1, 0, 0, 0, // PC_NOP
IU, 1, 1, 0, 0, 0, // PC_NOT
LSU1, 2, 1, 1, 0, 0, // PC_LFS
LSU1, 2, 1, 1, 0, 0, // PC_LFSU
LSU1, 2, 1, 1, 0, 0, // PC_LFSX
LSU1, 2, 1, 1, 0, 0, // PC_LFSUX
LSU1, 2, 1, 1, 0, 0, // PC_LFD
LSU1, 2, 1, 1, 0, 0, // PC_LFDU
LSU1, 2, 1, 1, 0, 0, // PC_LFDX
LSU1, 2, 1, 1, 0, 0, // PC_LFDUX
LSU1, 2, 1, 1, 0, 0, // PC_STFS
LSU1, 2, 1, 1, 0, 0, // PC_STFSU
LSU1, 2, 1, 1, 0, 0, // PC_STFSX
LSU1, 2, 1, 1, 0, 0, // PC_STFSUX
LSU1, 2, 1, 1, 0, 0, // PC_STFD
LSU1, 2, 1, 1, 0, 0, // PC_STFDU
LSU1, 2, 1, 1, 0, 0, // PC_STFDX
LSU1, 2, 1, 1, 0, 0, // PC_STFDUX
FPU1, 3, 1, 1, 1, 0, // PC_FMR
FPU1, 3, 1, 1, 1, 0, // PC_FABS
FPU1, 3, 1, 1, 1, 0, // PC_FNEG
FPU1, 3, 1, 1, 1, 0, // PC_FNABS
FPU1, 3, 1, 1, 1, 0, // PC_FADD
FPU1, 3, 1, 1, 1, 0, // PC_FADDS
FPU1, 3, 1, 1, 1, 0, // PC_FSUB
FPU1, 3, 1, 1, 1, 0, // PC_FSUBS
FPU1, 4, 2, 1, 1, 0, // PC_FMUL
FPU1, 3, 1, 1, 1, 0, // PC_FMULS
FPU1, 33, 33, 0, 0, 0, // PC_FDIV
FPU1, 18, 18, 0, 0, 0, // PC_FDIVS
FPU1, 4, 2, 1, 1, 0, // PC_FMADD
FPU1, 3, 1, 1, 1, 0, // PC_FMADDS
FPU1, 4, 2, 1, 1, 0, // PC_FMSUB
FPU1, 3, 1, 1, 1, 0, // PC_FMSUBS
FPU1, 4, 2, 1, 1, 0, // PC_FNMADD
FPU1, 3, 1, 1, 1, 0, // PC_FNMADDS
FPU1, 4, 2, 1, 1, 0, // PC_FNMSUB
FPU1, 3, 1, 1, 1, 0, // PC_FNMSUBS
FPU1, 18, 18, 0, 0, 0, // PC_FRES
FPU1, 3, 1, 1, 1, 0, // PC_FRSQRTE
FPU1, 3, 1, 1, 1, 0, // PC_FSEL
FPU1, 3, 1, 1, 1, 0, // PC_FRSP
FPU1, 3, 1, 1, 1, 0, // PC_FCTIW
FPU1, 3, 1, 1, 1, 0, // PC_FCTIWZ
FPU1, 5, 1, 1, 1, 0, // PC_FCMPU
FPU1, 5, 1, 1, 1, 0, // PC_FCMPO
LSU1, 1, 1, 0, 0, 0, // PC_LWARX
LSU1, 1, 1, 0, 0, 0, // PC_LSWI
LSU1, 1, 1, 0, 0, 0, // PC_LSWX
LSU1, 1, 1, 0, 0, 0, // PC_STFIWX
LSU1, 1, 1, 0, 0, 0, // PC_STSWI
LSU1, 1, 1, 0, 0, 0, // PC_STSWX
LSU1, 1, 1, 0, 0, 0, // PC_STWCX
IU, 1, 1, 0, 0, 1, // PC_ECIWX
IU, 1, 1, 0, 0, 1, // PC_ECOWX
IU, 1, 1, 0, 0, 0, // PC_DCBI
IU, 1, 1, 0, 0, 0, // PC_ICBI
IU, 1, 1, 0, 0, 0, // PC_MCRFS
IU, 1, 1, 0, 0, 0, // PC_MCRXR
IU, 1, 1, 0, 0, 0, // PC_MFTB
IU, 1, 1, 0, 0, 0, // PC_MFSR
IU, 1, 1, 0, 0, 0, // PC_MTSR
IU, 1, 1, 0, 0, 0, // PC_MFSRIN
IU, 1, 1, 0, 0, 0, // PC_MTSRIN
IU, 1, 1, 0, 0, 0, // PC_MTFSB0
IU, 1, 1, 0, 0, 0, // PC_MTFSB1
IU, 1, 1, 0, 0, 0, // PC_MTFSFI
IU, 1, 1, 0, 0, 1, // PC_SC
FPU1, 1, 1, 0, 0, 0, // PC_FSQRT
FPU1, 1, 1, 0, 0, 0, // PC_FSQRTS
IU, 1, 1, 0, 0, 0, // PC_TLBIA
IU, 1, 1, 0, 0, 0, // PC_TLBIE
IU, 1, 1, 0, 0, 0, // PC_TLBLD
IU, 1, 1, 0, 0, 0, // PC_TLBLI
IU, 1, 1, 0, 0, 0, // PC_TLBSYNC
IU, 1, 1, 0, 0, 1, // PC_TW
IU, 1, 1, 0, 0, 1, // PC_TRAP
IU, 1, 1, 0, 0, 1, // PC_TWI
IU, 1, 1, 0, 0, 1, // PC_OPWORD
IU, 1, 1, 0, 0, 0, // PC_MFROM
IU, 1, 1, 0, 0, 1, // PC_DSA
IU, 1, 1, 0, 0, 1, // PC_ESA
IU, 0, 0, 0, 0, 0, // PC_DCCCI
IU, 0, 0, 0, 0, 0, // PC_DCREAD
IU, 0, 0, 0, 0, 0, // PC_ICBT
IU, 0, 0, 0, 0, 0, // PC_ICCCI
IU, 0, 0, 0, 0, 0, // PC_ICREAD
IU, 0, 0, 0, 0, 0, // PC_RFCI
IU, 0, 0, 0, 0, 0, // PC_TLBRE
IU, 0, 0, 0, 0, 0, // PC_TLBSX
IU, 0, 0, 0, 0, 0, // PC_TLBWE
IU, 0, 0, 0, 0, 0, // PC_WRTEE
IU, 0, 0, 0, 0, 0, // PC_WRTEEI
IU, 0, 0, 0, 0, 0, // PC_MFDCR
IU, 0, 0, 0, 0, 0, // PC_MTDCR
IU, 0, 0, 0, 0, 0, // PC_DCBA
BPU, 0, 0, 0, 0, 0, // PC_DSS
BPU, 0, 0, 0, 0, 0, // PC_DSSALL
BPU, 0, 0, 0, 0, 0, // PC_DST
BPU, 0, 0, 0, 0, 0, // PC_DSTT
BPU, 0, 0, 0, 0, 0, // PC_DSTST
BPU, 0, 0, 0, 0, 0, // PC_DSTSTT
BPU, 0, 0, 0, 0, 0, // PC_LVEBX
BPU, 0, 0, 0, 0, 0, // PC_LVEHX
BPU, 0, 0, 0, 0, 0, // PC_LVEWX
BPU, 0, 0, 0, 0, 0, // PC_LVSL
BPU, 0, 0, 0, 0, 0, // PC_LVSR
BPU, 0, 0, 0, 0, 0, // PC_LVX
BPU, 0, 0, 0, 0, 0, // PC_LVXL
BPU, 0, 0, 0, 0, 0, // PC_STVEBX
BPU, 0, 0, 0, 0, 0, // PC_STVEHX
BPU, 0, 0, 0, 0, 0, // PC_STVEWX
BPU, 0, 0, 0, 0, 0, // PC_STVX
BPU, 0, 0, 0, 0, 0, // PC_STVXL
BPU, 0, 0, 0, 0, 0, // PC_MFVSCR
BPU, 0, 0, 0, 0, 0, // PC_MTVSCR
BPU, 0, 0, 0, 0, 0, // PC_VADDCUW
BPU, 0, 0, 0, 0, 0, // PC_VADDFP
BPU, 0, 0, 0, 0, 0, // PC_VADDSBS
BPU, 0, 0, 0, 0, 0, // PC_VADDSHS
BPU, 0, 0, 0, 0, 0, // PC_VADDSWS
BPU, 0, 0, 0, 0, 0, // PC_VADDUBM
BPU, 0, 0, 0, 0, 0, // PC_VADDUBS
BPU, 0, 0, 0, 0, 0, // PC_VADDUHM
BPU, 0, 0, 0, 0, 0, // PC_VADDUHS
BPU, 0, 0, 0, 0, 0, // PC_VADDUWM
BPU, 0, 0, 0, 0, 0, // PC_VADDUWS
BPU, 0, 0, 0, 0, 0, // PC_VAND
BPU, 0, 0, 0, 0, 0, // PC_VANDC
BPU, 0, 0, 0, 0, 0, // PC_VAVGSB
BPU, 0, 0, 0, 0, 0, // PC_VAVGSH
BPU, 0, 0, 0, 0, 0, // PC_VAVGSW
BPU, 0, 0, 0, 0, 0, // PC_VAVGUB
BPU, 0, 0, 0, 0, 0, // PC_VAVGUH
BPU, 0, 0, 0, 0, 0, // PC_VAVGUW
BPU, 0, 0, 0, 0, 0, // PC_VCFSX
BPU, 0, 0, 0, 0, 0, // PC_VCFUX
BPU, 0, 0, 0, 0, 0, // PC_VCMPBFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQUB
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQUH
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQUW
BPU, 0, 0, 0, 0, 0, // PC_VCMPGEFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTSB
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTSH
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTSW
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTUB
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTUH
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTUW
BPU, 0, 0, 0, 0, 0, // PC_VCTSXS
BPU, 0, 0, 0, 0, 0, // PC_VCTUXS
BPU, 0, 0, 0, 0, 0, // PC_VEXPTEFP
BPU, 0, 0, 0, 0, 0, // PC_VLOGEFP
BPU, 0, 0, 0, 0, 0, // PC_VMAXFP
BPU, 0, 0, 0, 0, 0, // PC_VMAXSB
BPU, 0, 0, 0, 0, 0, // PC_VMAXSH
BPU, 0, 0, 0, 0, 0, // PC_VMAXSW
BPU, 0, 0, 0, 0, 0, // PC_VMAXUB
BPU, 0, 0, 0, 0, 0, // PC_VMAXUH
BPU, 0, 0, 0, 0, 0, // PC_VMAXUW
BPU, 0, 0, 0, 0, 0, // PC_VMINFP
BPU, 0, 0, 0, 0, 0, // PC_VMINSB
BPU, 0, 0, 0, 0, 0, // PC_VMINSH
BPU, 0, 0, 0, 0, 0, // PC_VMINSW
BPU, 0, 0, 0, 0, 0, // PC_VMINUB
BPU, 0, 0, 0, 0, 0, // PC_VMINUH
BPU, 0, 0, 0, 0, 0, // PC_VMINUW
BPU, 0, 0, 0, 0, 0, // PC_VMRGHB
BPU, 0, 0, 0, 0, 0, // PC_VMRGHH
BPU, 0, 0, 0, 0, 0, // PC_VMRGHW
BPU, 0, 0, 0, 0, 0, // PC_VMRGLB
BPU, 0, 0, 0, 0, 0, // PC_VMRGLH
BPU, 0, 0, 0, 0, 0, // PC_VMRGLW
BPU, 0, 0, 0, 0, 0, // PC_VMULESB
BPU, 0, 0, 0, 0, 0, // PC_VMULESH
BPU, 0, 0, 0, 0, 0, // PC_VMULEUB
BPU, 0, 0, 0, 0, 0, // PC_VMULEUH
BPU, 0, 0, 0, 0, 0, // PC_VMULOSB
BPU, 0, 0, 0, 0, 0, // PC_VMULOSH
BPU, 0, 0, 0, 0, 0, // PC_VMULOUB
BPU, 0, 0, 0, 0, 0, // PC_VMULOUH
BPU, 0, 0, 0, 0, 0, // PC_VNOR
BPU, 0, 0, 0, 0, 0, // PC_VOR
BPU, 0, 0, 0, 0, 0, // PC_VPKPX
BPU, 0, 0, 0, 0, 0, // PC_VPKSHSS
BPU, 0, 0, 0, 0, 0, // PC_VPKSHUS
BPU, 0, 0, 0, 0, 0, // PC_VPKSWSS
BPU, 0, 0, 0, 0, 0, // PC_VPKSWUS
BPU, 0, 0, 0, 0, 0, // PC_VPKUHUM
BPU, 0, 0, 0, 0, 0, // PC_VPKUHUS
BPU, 0, 0, 0, 0, 0, // PC_VPKUWUM
BPU, 0, 0, 0, 0, 0, // PC_VPKUWUS
BPU, 0, 0, 0, 0, 0, // PC_VREFP
BPU, 0, 0, 0, 0, 0, // PC_VRFIM
BPU, 0, 0, 0, 0, 0, // PC_VRFIN
BPU, 0, 0, 0, 0, 0, // PC_VRFIP
BPU, 0, 0, 0, 0, 0, // PC_VRFIZ
BPU, 0, 0, 0, 0, 0, // PC_VRLB
BPU, 0, 0, 0, 0, 0, // PC_VRLH
BPU, 0, 0, 0, 0, 0, // PC_VRLW
BPU, 0, 0, 0, 0, 0, // PC_VRSQRTEFP
BPU, 0, 0, 0, 0, 0, // PC_VSL
BPU, 0, 0, 0, 0, 0, // PC_VSLB
BPU, 0, 0, 0, 0, 0, // PC_VSLH
BPU, 0, 0, 0, 0, 0, // PC_VSLO
BPU, 0, 0, 0, 0, 0, // PC_VSLW
BPU, 0, 0, 0, 0, 0, // PC_VSPLTB
BPU, 0, 0, 0, 0, 0, // PC_VSPLTH
BPU, 0, 0, 0, 0, 0, // PC_VSPLTW
BPU, 0, 0, 0, 0, 0, // PC_VSPLTISB
BPU, 0, 0, 0, 0, 0, // PC_VSPLTISH
BPU, 0, 0, 0, 0, 0, // PC_VSPLTISW
BPU, 0, 0, 0, 0, 0, // PC_VSR
BPU, 0, 0, 0, 0, 0, // PC_VSRAB
BPU, 0, 0, 0, 0, 0, // PC_VSRAH
BPU, 0, 0, 0, 0, 0, // PC_VSRAW
BPU, 0, 0, 0, 0, 0, // PC_VSRB
BPU, 0, 0, 0, 0, 0, // PC_VSRH
BPU, 0, 0, 0, 0, 0, // PC_VSRO
BPU, 0, 0, 0, 0, 0, // PC_VSRW
BPU, 0, 0, 0, 0, 0, // PC_VSUBCUW
BPU, 0, 0, 0, 0, 0, // PC_VSUBFP
BPU, 0, 0, 0, 0, 0, // PC_VSUBSBS
BPU, 0, 0, 0, 0, 0, // PC_VSUBSHS
BPU, 0, 0, 0, 0, 0, // PC_VSUBSWS
BPU, 0, 0, 0, 0, 0, // PC_VSUBUBM
BPU, 0, 0, 0, 0, 0, // PC_VSUBUBS
BPU, 0, 0, 0, 0, 0, // PC_VSUBUHM
BPU, 0, 0, 0, 0, 0, // PC_VSUBUHS
BPU, 0, 0, 0, 0, 0, // PC_VSUBUWM
BPU, 0, 0, 0, 0, 0, // PC_VSUBUWS
BPU, 0, 0, 0, 0, 0, // PC_VSUMSWS
BPU, 0, 0, 0, 0, 0, // PC_VSUM2SWS
BPU, 0, 0, 0, 0, 0, // PC_VSUM4SBS
BPU, 0, 0, 0, 0, 0, // PC_VSUM4SHS
BPU, 0, 0, 0, 0, 0, // PC_VSUM4UBS
BPU, 0, 0, 0, 0, 0, // PC_VUPKHPX
BPU, 0, 0, 0, 0, 0, // PC_VUPKHSB
BPU, 0, 0, 0, 0, 0, // PC_VUPKHSH
BPU, 0, 0, 0, 0, 0, // PC_VUPKLPX
BPU, 0, 0, 0, 0, 0, // PC_VUPKLSB
BPU, 0, 0, 0, 0, 0, // PC_VUPKLSH
BPU, 0, 0, 0, 0, 0, // PC_VXOR
BPU, 0, 0, 0, 0, 0, // PC_VMADDFP
BPU, 0, 0, 0, 0, 0, // PC_VMHADDSHS
BPU, 0, 0, 0, 0, 0, // PC_VMHRADDSHS
BPU, 0, 0, 0, 0, 0, // PC_VMLADDUHM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMMBM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMSHM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMSHS
BPU, 0, 0, 0, 0, 0, // PC_VMSUMUBM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMUHM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMUHS
BPU, 0, 0, 0, 0, 0, // PC_VNMSUBFP
BPU, 0, 0, 0, 0, 0, // PC_VPERM
BPU, 0, 0, 0, 0, 0, // PC_VSEL
BPU, 0, 0, 0, 0, 0, // PC_VSLDOI
BPU, 0, 0, 0, 0, 0, // PC_VMR
BPU, 0, 0, 0, 0, 0, // PC_VMRP
BPU, 0, 0, 0, 0, 0, // PC_SLE
BPU, 0, 0, 0, 0, 0, // PC_SLEQ
BPU, 0, 0, 0, 0, 0, // PC_SLIQ
BPU, 0, 0, 0, 0, 0, // PC_SLLIQ
BPU, 0, 0, 0, 0, 0, // PC_SLLQ
BPU, 0, 0, 0, 0, 0, // PC_SLQ
BPU, 0, 0, 0, 0, 0, // PC_SRAIQ
BPU, 0, 0, 0, 0, 0, // PC_SRAQ
BPU, 0, 0, 0, 0, 0, // PC_SRE
BPU, 0, 0, 0, 0, 0, // PC_SREA
BPU, 0, 0, 0, 0, 0, // PC_SREQ
BPU, 0, 0, 0, 0, 0, // PC_SRIQ
BPU, 0, 0, 0, 0, 0, // PC_SRLIQ
BPU, 0, 0, 0, 0, 0, // PC_SRLQ
BPU, 0, 0, 0, 0, 0, // PC_SRQ
BPU, 0, 0, 0, 0, 0, // PC_MASKG
BPU, 0, 0, 0, 0, 0, // PC_MASKIR
BPU, 0, 0, 0, 0, 0, // PC_LSCBX
BPU, 0, 0, 0, 0, 0, // PC_DIV
BPU, 0, 0, 0, 0, 0, // PC_DIVS
BPU, 0, 0, 0, 0, 0, // PC_DOZ
BPU, 0, 0, 0, 0, 0, // PC_MUL
BPU, 0, 0, 0, 0, 0, // PC_NABS
BPU, 0, 0, 0, 0, 0, // PC_ABS
BPU, 0, 0, 0, 0, 0, // PC_CLCS
BPU, 0, 0, 0, 0, 0, // PC_DOZI
BPU, 0, 0, 0, 0, 0, // PC_RLMI
BPU, 0, 0, 0, 0, 0, // PC_RRIB
};
static void advance(int firstStage, int oldStage, int newStage) {
PCode *instr = pipeline[oldStage].instr;
int cycles = instruction_timing[instr->op].cycles[newStage - firstStage];
pipeline[newStage].instr = instr;
pipeline[newStage].remaining = cycles;
pipeline[oldStage].instr = NULL;
}
static void assign_completion_buffer(PCode *instr) {
completionbuffers.used++;
completionbuffers.free--;
completionbuffers.entries[completionbuffers.nextFreeSlot].instr = instr;
completionbuffers.entries[completionbuffers.nextFreeSlot].completed = 0;
completionbuffers.nextFreeSlot = (completionbuffers.nextFreeSlot + 1) % MaxEntries;
}
static void complete_instruction(int stage) {
PCode *instr = pipeline[stage].instr;
int buf = 0;
while (buf < MaxEntries && completionbuffers.entries[buf].instr != instr)
buf++;
completionbuffers.entries[buf].completed = 1;
pipeline[stage].instr = NULL;
}
static void retire_instruction(void) {
completionbuffers.entries[completionbuffers.nextToRetire].instr = NULL;
completionbuffers.used--;
completionbuffers.free++;
completionbuffers.nextToRetire = (completionbuffers.nextToRetire + 1) % MaxEntries;
}
static int latency(PCode *instr) {
int cycles = instruction_timing[instr->op].latency;
if (PCODE_FLAG_SET_F(instr) & fRecordBit)
cycles += 2;
if (instr->op == PC_LMW || instr->op == PC_STMW)
cycles += instr->argCount - 2;
return cycles;
}
static void initialize(void) {
int stage;
int i;
for (stage = 0; stage < NumStages; stage++)
pipeline[stage].instr = NULL;
completionbuffers.free = 5;
completionbuffers.used = 0;
completionbuffers.nextToRetire = 0;
completionbuffers.nextFreeSlot = 0;
for (i = 0; i < MaxEntries; i++)
completionbuffers.entries[i].instr = NULL;
}
static int can_issue(PCode *instr) {
if (completionbuffers.free == 0)
return 0;
if (pipeline[instruction_timing[instr->op].stage].instr)
return 0;
if ((instr->flags & fIsWrite) && pipeline[LSU2].instr && (pipeline[LSU2].instr->flags & fIsWrite))
return 0;
return 1;
}
static void issue(PCode *instr) {
int stage = instruction_timing[instr->op].stage;
int cycles = instruction_timing[instr->op].cycles[0];
assign_completion_buffer(instr);
pipeline[stage].instr = instr;
pipeline[stage].remaining = cycles;
}
static void advance_clock(void) {
int stage;
for (stage = 0; stage < NumStages; stage++) {
if (pipeline[stage].instr && pipeline[stage].remaining)
--pipeline[stage].remaining;
}
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
}
}
if (pipeline[IU].instr && pipeline[IU].remaining == 0)
complete_instruction(IU);
if (pipeline[LSU2].instr && pipeline[LSU2].remaining == 0)
complete_instruction(LSU2);
if (pipeline[FPU3].instr && pipeline[FPU3].remaining == 0)
complete_instruction(FPU3);
if (pipeline[SRU].instr && pipeline[SRU].remaining == 0)
complete_instruction(SRU);
if (pipeline[BPU].instr && pipeline[BPU].remaining == 0)
complete_instruction(BPU);
if (
pipeline[FPU1].instr &&
pipeline[FPU1].remaining == 0 &&
(pipeline[FPU1].instr->op == PC_FDIV || pipeline[FPU1].instr->op == PC_FDIVS)
)
complete_instruction(FPU1);
if (pipeline[FPU2].instr && pipeline[FPU2].remaining == 0 && !pipeline[FPU3].instr)
advance(FPU1, FPU2, FPU3);
if (pipeline[FPU1].instr && pipeline[FPU1].remaining == 0 && !pipeline[FPU2].instr)
advance(FPU1, FPU1, FPU2);
if (pipeline[LSU1].instr && pipeline[LSU1].remaining == 0 && !pipeline[LSU2].instr)
advance(LSU1, LSU1, LSU2);
}
static int serializes(PCode *instr) {
return instruction_timing[instr->op].serializes;
}
MachineInfo machine603 = {
2,
1,
0,
&latency,
&initialize,
&can_issue,
&issue,
&advance_clock,
&serializes,
&default_uses_vpermute_unit
};

View File

@ -0,0 +1,650 @@
#include "compiler/Scheduler.h"
#include "compiler/PCode.h"
#include "compiler/PCodeInfo.h"
// https://www.nxp.com/docs/en/reference-manual/MPC603EUM.pdf
typedef enum Stage {
BPU, // Branch Prediction Unit
IU, // Integer Unit
LSU1, // Load/Store Unit
LSU2,
FPU1, // Floating Point Unit
FPU2,
FPU3,
SRU, // System Register Unit
NumStages
} Stage;
static struct {
// the instruction currently in this pipeline stage
PCode *instr;
// how many cycles are left for this instruction to finish
int remaining;
} pipeline[NumStages];
enum {
MaxEntries = 5
};
static struct {
// how many entries remain unused in the queue
unsigned int free;
// how many entries are currently used in the queue
unsigned int used;
// the index of the next instruction that will be retired
unsigned int nextToRetire;
// the index of the next free slot that will be used when an instruction is dispatched
unsigned int nextFreeSlot;
// circular array of entries in the completion queue
struct {
PCode *instr;
int completed;
} entries[MaxEntries];
} completionbuffers;
static struct {
// the initial stage for this instruction
Stage stage;
// the total amount of cycles required by this instruction
char latency;
// how long it takes to finish each stage
char cycles[3];
// does this instruction serialise?
char serializes;
} instruction_timing[OPCODE_MAX] = {
BPU, 0, 0, 0, 0, 1, // PC_B
BPU, 0, 0, 0, 0, 1, // PC_BL
BPU, 0, 0, 0, 0, 1, // PC_BC
BPU, 0, 0, 0, 0, 1, // PC_BCLR
BPU, 0, 0, 0, 0, 1, // PC_BCCTR
BPU, 0, 0, 0, 0, 1, // PC_BT
BPU, 0, 0, 0, 0, 1, // PC_BTLR
BPU, 0, 0, 0, 0, 1, // PC_BTCTR
BPU, 0, 0, 0, 0, 1, // PC_BF
BPU, 0, 0, 0, 0, 1, // PC_BFLR
BPU, 0, 0, 0, 0, 1, // PC_BFCTR
BPU, 0, 0, 0, 0, 1, // PC_BDNZ
BPU, 0, 0, 0, 0, 1, // PC_BDNZT
BPU, 0, 0, 0, 0, 1, // PC_BDNZF
BPU, 0, 0, 0, 0, 1, // PC_BDZ
BPU, 0, 0, 0, 0, 1, // PC_BDZT
BPU, 0, 0, 0, 0, 1, // PC_BDZF
BPU, 0, 0, 0, 0, 1, // PC_BLR
BPU, 0, 0, 0, 0, 1, // PC_BCTR
BPU, 0, 0, 0, 0, 1, // PC_BCTRL
BPU, 0, 0, 0, 0, 1, // PC_BLRL
LSU1, 2, 1, 1, 0, 0, // PC_LBZ
LSU1, 2, 1, 1, 0, 0, // PC_LBZU
LSU1, 2, 1, 1, 0, 0, // PC_LBZX
LSU1, 2, 1, 1, 0, 0, // PC_LBZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHZ
LSU1, 2, 1, 1, 0, 0, // PC_LHZU
LSU1, 2, 1, 1, 0, 0, // PC_LHZX
LSU1, 2, 1, 1, 0, 0, // PC_LHZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHA
LSU1, 2, 1, 1, 0, 0, // PC_LHAU
LSU1, 2, 1, 1, 0, 0, // PC_LHAX
LSU1, 2, 1, 1, 0, 0, // PC_LHAUX
LSU1, 2, 1, 1, 0, 0, // PC_LHBRX
LSU1, 2, 1, 1, 0, 0, // PC_LWZ
LSU1, 2, 1, 1, 0, 0, // PC_LWZU
LSU1, 2, 1, 1, 0, 0, // PC_LWZX
LSU1, 2, 1, 1, 0, 0, // PC_LWZUX
LSU1, 2, 1, 1, 0, 0, // PC_LWBRX
LSU1, 2, 1, 1, 0, 0, // PC_LMW
LSU1, 2, 1, 1, 0, 0, // PC_STB
LSU1, 2, 1, 1, 0, 0, // PC_STBU
LSU1, 2, 1, 1, 0, 0, // PC_STBX
LSU1, 2, 1, 1, 0, 0, // PC_STBUX
LSU1, 2, 1, 1, 0, 0, // PC_STH
LSU1, 2, 1, 1, 0, 0, // PC_STHU
LSU1, 2, 1, 1, 0, 0, // PC_STHX
LSU1, 2, 1, 1, 0, 0, // PC_STHUX
LSU1, 2, 1, 1, 0, 0, // PC_STHBRX
LSU1, 2, 1, 1, 0, 0, // PC_STW
LSU1, 2, 1, 1, 0, 0, // PC_STWU
LSU1, 2, 1, 1, 0, 0, // PC_STWX
LSU1, 2, 1, 1, 0, 0, // PC_STWUX
LSU1, 2, 1, 1, 0, 0, // PC_STWBRX
LSU1, 2, 1, 1, 0, 0, // PC_STMW
LSU1, 2, 1, 1, 0, 0, // PC_DCBF
LSU1, 2, 1, 1, 0, 0, // PC_DCBST
LSU1, 2, 1, 1, 0, 0, // PC_DCBT
LSU1, 2, 1, 1, 0, 0, // PC_DCBTST
LSU1, 2, 1, 1, 0, 0, // PC_DCBZ
IU, 1, 1, 0, 0, 0, // PC_ADD
IU, 1, 1, 0, 0, 0, // PC_ADDC
IU, 1, 1, 0, 0, 0, // PC_ADDE
IU, 1, 1, 0, 0, 0, // PC_ADDI
IU, 1, 1, 0, 0, 0, // PC_ADDIC
IU, 1, 1, 0, 0, 0, // PC_ADDICR
IU, 1, 1, 0, 0, 0, // PC_ADDIS
IU, 1, 1, 0, 0, 0, // PC_ADDME
IU, 1, 1, 0, 0, 0, // PC_ADDZE
IU, 37, 37, 0, 0, 0, // PC_DIVW
IU, 37, 37, 0, 0, 0, // PC_DIVWU
IU, 5, 5, 0, 0, 0, // PC_MULHW
IU, 5, 5, 0, 0, 0, // PC_MULHWU
IU, 3, 3, 0, 0, 0, // PC_MULLI
IU, 5, 5, 0, 0, 0, // PC_MULLW
IU, 1, 1, 0, 0, 0, // PC_NEG
IU, 1, 1, 0, 0, 0, // PC_SUBF
IU, 1, 1, 0, 0, 0, // PC_SUBFC
IU, 1, 1, 0, 0, 0, // PC_SUBFE
IU, 1, 1, 0, 0, 0, // PC_SUBFIC
IU, 1, 1, 0, 0, 0, // PC_SUBFME
IU, 1, 1, 0, 0, 0, // PC_SUBFZE
IU, 3, 1, 0, 0, 0, // PC_CMPI
IU, 3, 1, 0, 0, 0, // PC_CMP
IU, 3, 1, 0, 0, 0, // PC_CMPLI
IU, 3, 1, 0, 0, 0, // PC_CMPL
IU, 1, 1, 0, 0, 0, // PC_ANDI
IU, 1, 1, 0, 0, 0, // PC_ANDIS
IU, 1, 1, 0, 0, 0, // PC_ORI
IU, 1, 1, 0, 0, 0, // PC_ORIS
IU, 1, 1, 0, 0, 0, // PC_XORI
IU, 1, 1, 0, 0, 0, // PC_XORIS
IU, 1, 1, 0, 0, 0, // PC_AND
IU, 1, 1, 0, 0, 0, // PC_OR
IU, 1, 1, 0, 0, 0, // PC_XOR
IU, 1, 1, 0, 0, 0, // PC_NAND
IU, 1, 1, 0, 0, 0, // PC_NOR
IU, 1, 1, 0, 0, 0, // PC_EQV
IU, 1, 1, 0, 0, 0, // PC_ANDC
IU, 1, 1, 0, 0, 0, // PC_ORC
IU, 1, 1, 0, 0, 0, // PC_EXTSB
IU, 1, 1, 0, 0, 0, // PC_EXTSH
IU, 1, 1, 0, 0, 0, // PC_CNTLZW
IU, 1, 1, 0, 0, 0, // PC_RLWINM
IU, 1, 1, 0, 0, 0, // PC_RLWNM
IU, 1, 1, 0, 0, 0, // PC_RLWIMI
IU, 1, 1, 0, 0, 0, // PC_SLW
IU, 1, 1, 0, 0, 0, // PC_SRW
IU, 1, 1, 0, 0, 0, // PC_SRAWI
IU, 1, 1, 0, 0, 0, // PC_SRAW
SRU, 1, 1, 0, 0, 0, // PC_CRAND
SRU, 1, 1, 0, 0, 0, // PC_CRANDC
SRU, 1, 1, 0, 0, 0, // PC_CREQV
SRU, 1, 1, 0, 0, 0, // PC_CRNAND
SRU, 1, 1, 0, 0, 0, // PC_CRNOR
SRU, 1, 1, 0, 0, 0, // PC_CROR
SRU, 1, 1, 0, 0, 0, // PC_CRORC
SRU, 1, 1, 0, 0, 0, // PC_CRXOR
SRU, 1, 1, 0, 0, 0, // PC_MCRF
SRU, 2, 2, 0, 0, 0, // PC_MTXER
SRU, 2, 2, 0, 0, 0, // PC_MTCTR
SRU, 2, 2, 0, 0, 0, // PC_MTLR
SRU, 1, 1, 0, 0, 0, // PC_MTCRF
SRU, 1, 1, 0, 0, 1, // PC_MTMSR
SRU, 1, 1, 0, 0, 1, // PC_MTSPR
SRU, 1, 1, 0, 0, 1, // PC_MFMSR
SRU, 1, 1, 0, 0, 1, // PC_MFSPR
SRU, 1, 1, 0, 0, 0, // PC_MFXER
SRU, 1, 1, 0, 0, 0, // PC_MFCTR
SRU, 1, 1, 0, 0, 0, // PC_MFLR
SRU, 1, 1, 0, 0, 0, // PC_MFCR
FPU1, 3, 1, 1, 1, 0, // PC_MFFS
FPU1, 3, 1, 1, 1, 0, // PC_MTFSF
SRU, 1, 1, 0, 0, 1, // PC_EIEIO
SRU, 1, 1, 0, 0, 1, // PC_ISYNC
SRU, 1, 1, 0, 0, 1, // PC_SYNC
SRU, 1, 1, 0, 0, 1, // PC_RFI
IU, 1, 1, 0, 0, 0, // PC_LI
IU, 1, 1, 0, 0, 0, // PC_LIS
IU, 1, 1, 0, 0, 0, // PC_MR
IU, 1, 1, 0, 0, 0, // PC_NOP
IU, 1, 1, 0, 0, 0, // PC_NOT
LSU1, 2, 1, 1, 0, 0, // PC_LFS
LSU1, 2, 1, 1, 0, 0, // PC_LFSU
LSU1, 2, 1, 1, 0, 0, // PC_LFSX
LSU1, 2, 1, 1, 0, 0, // PC_LFSUX
LSU1, 2, 1, 1, 0, 0, // PC_LFD
LSU1, 2, 1, 1, 0, 0, // PC_LFDU
LSU1, 2, 1, 1, 0, 0, // PC_LFDX
LSU1, 2, 1, 1, 0, 0, // PC_LFDUX
LSU1, 2, 1, 1, 0, 0, // PC_STFS
LSU1, 2, 1, 1, 0, 0, // PC_STFSU
LSU1, 2, 1, 1, 0, 0, // PC_STFSX
LSU1, 2, 1, 1, 0, 0, // PC_STFSUX
LSU1, 2, 1, 1, 0, 0, // PC_STFD
LSU1, 2, 1, 1, 0, 0, // PC_STFDU
LSU1, 2, 1, 1, 0, 0, // PC_STFDX
LSU1, 2, 1, 1, 0, 0, // PC_STFDUX
FPU1, 3, 1, 1, 1, 0, // PC_FMR
FPU1, 3, 1, 1, 1, 0, // PC_FABS
FPU1, 3, 1, 1, 1, 0, // PC_FNEG
FPU1, 3, 1, 1, 1, 0, // PC_FNABS
FPU1, 3, 1, 1, 1, 0, // PC_FADD
FPU1, 3, 1, 1, 1, 0, // PC_FADDS
FPU1, 3, 1, 1, 1, 0, // PC_FSUB
FPU1, 3, 1, 1, 1, 0, // PC_FSUBS
FPU1, 4, 2, 1, 1, 0, // PC_FMUL
FPU1, 3, 1, 1, 1, 0, // PC_FMULS
FPU1, 33, 33, 0, 0, 0, // PC_FDIV
FPU1, 18, 18, 0, 0, 0, // PC_FDIVS
FPU1, 4, 2, 1, 1, 0, // PC_FMADD
FPU1, 3, 1, 1, 1, 0, // PC_FMADDS
FPU1, 4, 2, 1, 1, 0, // PC_FMSUB
FPU1, 3, 1, 1, 1, 0, // PC_FMSUBS
FPU1, 4, 2, 1, 1, 0, // PC_FNMADD
FPU1, 3, 1, 1, 1, 0, // PC_FNMADDS
FPU1, 4, 2, 1, 1, 0, // PC_FNMSUB
FPU1, 3, 1, 1, 1, 0, // PC_FNMSUBS
FPU1, 18, 18, 0, 0, 0, // PC_FRES
FPU1, 3, 1, 1, 1, 0, // PC_FRSQRTE
FPU1, 3, 1, 1, 1, 0, // PC_FSEL
FPU1, 3, 1, 1, 1, 0, // PC_FRSP
FPU1, 3, 1, 1, 1, 0, // PC_FCTIW
FPU1, 3, 1, 1, 1, 0, // PC_FCTIWZ
FPU1, 5, 1, 1, 1, 0, // PC_FCMPU
FPU1, 5, 1, 1, 1, 0, // PC_FCMPO
LSU1, 1, 1, 0, 0, 0, // PC_LWARX
LSU1, 1, 1, 0, 0, 0, // PC_LSWI
LSU1, 1, 1, 0, 0, 0, // PC_LSWX
LSU1, 1, 1, 0, 0, 0, // PC_STFIWX
LSU1, 1, 1, 0, 0, 0, // PC_STSWI
LSU1, 1, 1, 0, 0, 0, // PC_STSWX
LSU1, 1, 1, 0, 0, 0, // PC_STWCX
IU, 1, 1, 0, 0, 1, // PC_ECIWX
IU, 1, 1, 0, 0, 1, // PC_ECOWX
IU, 1, 1, 0, 0, 0, // PC_DCBI
IU, 1, 1, 0, 0, 0, // PC_ICBI
IU, 1, 1, 0, 0, 0, // PC_MCRFS
IU, 1, 1, 0, 0, 0, // PC_MCRXR
IU, 1, 1, 0, 0, 0, // PC_MFTB
IU, 1, 1, 0, 0, 0, // PC_MFSR
IU, 1, 1, 0, 0, 0, // PC_MTSR
IU, 1, 1, 0, 0, 0, // PC_MFSRIN
IU, 1, 1, 0, 0, 0, // PC_MTSRIN
IU, 1, 1, 0, 0, 0, // PC_MTFSB0
IU, 1, 1, 0, 0, 0, // PC_MTFSB1
IU, 1, 1, 0, 0, 0, // PC_MTFSFI
IU, 1, 1, 0, 0, 1, // PC_SC
FPU1, 1, 1, 0, 0, 0, // PC_FSQRT
FPU1, 1, 1, 0, 0, 0, // PC_FSQRTS
IU, 1, 1, 0, 0, 0, // PC_TLBIA
IU, 1, 1, 0, 0, 0, // PC_TLBIE
IU, 1, 1, 0, 0, 0, // PC_TLBLD
IU, 1, 1, 0, 0, 0, // PC_TLBLI
IU, 1, 1, 0, 0, 0, // PC_TLBSYNC
IU, 1, 1, 0, 0, 1, // PC_TW
IU, 1, 1, 0, 0, 1, // PC_TRAP
IU, 1, 1, 0, 0, 1, // PC_TWI
IU, 1, 1, 0, 0, 1, // PC_OPWORD
IU, 1, 1, 0, 0, 0, // PC_MFROM
IU, 1, 1, 0, 0, 1, // PC_DSA
IU, 1, 1, 0, 0, 1, // PC_ESA
IU, 0, 0, 0, 0, 0, // PC_DCCCI
IU, 0, 0, 0, 0, 0, // PC_DCREAD
IU, 0, 0, 0, 0, 0, // PC_ICBT
IU, 0, 0, 0, 0, 0, // PC_ICCCI
IU, 0, 0, 0, 0, 0, // PC_ICREAD
IU, 0, 0, 0, 0, 0, // PC_RFCI
IU, 0, 0, 0, 0, 0, // PC_TLBRE
IU, 0, 0, 0, 0, 0, // PC_TLBSX
IU, 0, 0, 0, 0, 0, // PC_TLBWE
IU, 0, 0, 0, 0, 0, // PC_WRTEE
IU, 0, 0, 0, 0, 0, // PC_WRTEEI
IU, 0, 0, 0, 0, 0, // PC_MFDCR
IU, 0, 0, 0, 0, 0, // PC_MTDCR
IU, 0, 0, 0, 0, 0, // PC_DCBA
BPU, 0, 0, 0, 0, 0, // PC_DSS
BPU, 0, 0, 0, 0, 0, // PC_DSSALL
BPU, 0, 0, 0, 0, 0, // PC_DST
BPU, 0, 0, 0, 0, 0, // PC_DSTT
BPU, 0, 0, 0, 0, 0, // PC_DSTST
BPU, 0, 0, 0, 0, 0, // PC_DSTSTT
BPU, 0, 0, 0, 0, 0, // PC_LVEBX
BPU, 0, 0, 0, 0, 0, // PC_LVEHX
BPU, 0, 0, 0, 0, 0, // PC_LVEWX
BPU, 0, 0, 0, 0, 0, // PC_LVSL
BPU, 0, 0, 0, 0, 0, // PC_LVSR
BPU, 0, 0, 0, 0, 0, // PC_LVX
BPU, 0, 0, 0, 0, 0, // PC_LVXL
BPU, 0, 0, 0, 0, 0, // PC_STVEBX
BPU, 0, 0, 0, 0, 0, // PC_STVEHX
BPU, 0, 0, 0, 0, 0, // PC_STVEWX
BPU, 0, 0, 0, 0, 0, // PC_STVX
BPU, 0, 0, 0, 0, 0, // PC_STVXL
BPU, 0, 0, 0, 0, 0, // PC_MFVSCR
BPU, 0, 0, 0, 0, 0, // PC_MTVSCR
BPU, 0, 0, 0, 0, 0, // PC_VADDCUW
BPU, 0, 0, 0, 0, 0, // PC_VADDFP
BPU, 0, 0, 0, 0, 0, // PC_VADDSBS
BPU, 0, 0, 0, 0, 0, // PC_VADDSHS
BPU, 0, 0, 0, 0, 0, // PC_VADDSWS
BPU, 0, 0, 0, 0, 0, // PC_VADDUBM
BPU, 0, 0, 0, 0, 0, // PC_VADDUBS
BPU, 0, 0, 0, 0, 0, // PC_VADDUHM
BPU, 0, 0, 0, 0, 0, // PC_VADDUHS
BPU, 0, 0, 0, 0, 0, // PC_VADDUWM
BPU, 0, 0, 0, 0, 0, // PC_VADDUWS
BPU, 0, 0, 0, 0, 0, // PC_VAND
BPU, 0, 0, 0, 0, 0, // PC_VANDC
BPU, 0, 0, 0, 0, 0, // PC_VAVGSB
BPU, 0, 0, 0, 0, 0, // PC_VAVGSH
BPU, 0, 0, 0, 0, 0, // PC_VAVGSW
BPU, 0, 0, 0, 0, 0, // PC_VAVGUB
BPU, 0, 0, 0, 0, 0, // PC_VAVGUH
BPU, 0, 0, 0, 0, 0, // PC_VAVGUW
BPU, 0, 0, 0, 0, 0, // PC_VCFSX
BPU, 0, 0, 0, 0, 0, // PC_VCFUX
BPU, 0, 0, 0, 0, 0, // PC_VCMPBFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQUB
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQUH
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQUW
BPU, 0, 0, 0, 0, 0, // PC_VCMPGEFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTSB
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTSH
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTSW
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTUB
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTUH
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTUW
BPU, 0, 0, 0, 0, 0, // PC_VCTSXS
BPU, 0, 0, 0, 0, 0, // PC_VCTUXS
BPU, 0, 0, 0, 0, 0, // PC_VEXPTEFP
BPU, 0, 0, 0, 0, 0, // PC_VLOGEFP
BPU, 0, 0, 0, 0, 0, // PC_VMAXFP
BPU, 0, 0, 0, 0, 0, // PC_VMAXSB
BPU, 0, 0, 0, 0, 0, // PC_VMAXSH
BPU, 0, 0, 0, 0, 0, // PC_VMAXSW
BPU, 0, 0, 0, 0, 0, // PC_VMAXUB
BPU, 0, 0, 0, 0, 0, // PC_VMAXUH
BPU, 0, 0, 0, 0, 0, // PC_VMAXUW
BPU, 0, 0, 0, 0, 0, // PC_VMINFP
BPU, 0, 0, 0, 0, 0, // PC_VMINSB
BPU, 0, 0, 0, 0, 0, // PC_VMINSH
BPU, 0, 0, 0, 0, 0, // PC_VMINSW
BPU, 0, 0, 0, 0, 0, // PC_VMINUB
BPU, 0, 0, 0, 0, 0, // PC_VMINUH
BPU, 0, 0, 0, 0, 0, // PC_VMINUW
BPU, 0, 0, 0, 0, 0, // PC_VMRGHB
BPU, 0, 0, 0, 0, 0, // PC_VMRGHH
BPU, 0, 0, 0, 0, 0, // PC_VMRGHW
BPU, 0, 0, 0, 0, 0, // PC_VMRGLB
BPU, 0, 0, 0, 0, 0, // PC_VMRGLH
BPU, 0, 0, 0, 0, 0, // PC_VMRGLW
BPU, 0, 0, 0, 0, 0, // PC_VMULESB
BPU, 0, 0, 0, 0, 0, // PC_VMULESH
BPU, 0, 0, 0, 0, 0, // PC_VMULEUB
BPU, 0, 0, 0, 0, 0, // PC_VMULEUH
BPU, 0, 0, 0, 0, 0, // PC_VMULOSB
BPU, 0, 0, 0, 0, 0, // PC_VMULOSH
BPU, 0, 0, 0, 0, 0, // PC_VMULOUB
BPU, 0, 0, 0, 0, 0, // PC_VMULOUH
BPU, 0, 0, 0, 0, 0, // PC_VNOR
BPU, 0, 0, 0, 0, 0, // PC_VOR
BPU, 0, 0, 0, 0, 0, // PC_VPKPX
BPU, 0, 0, 0, 0, 0, // PC_VPKSHSS
BPU, 0, 0, 0, 0, 0, // PC_VPKSHUS
BPU, 0, 0, 0, 0, 0, // PC_VPKSWSS
BPU, 0, 0, 0, 0, 0, // PC_VPKSWUS
BPU, 0, 0, 0, 0, 0, // PC_VPKUHUM
BPU, 0, 0, 0, 0, 0, // PC_VPKUHUS
BPU, 0, 0, 0, 0, 0, // PC_VPKUWUM
BPU, 0, 0, 0, 0, 0, // PC_VPKUWUS
BPU, 0, 0, 0, 0, 0, // PC_VREFP
BPU, 0, 0, 0, 0, 0, // PC_VRFIM
BPU, 0, 0, 0, 0, 0, // PC_VRFIN
BPU, 0, 0, 0, 0, 0, // PC_VRFIP
BPU, 0, 0, 0, 0, 0, // PC_VRFIZ
BPU, 0, 0, 0, 0, 0, // PC_VRLB
BPU, 0, 0, 0, 0, 0, // PC_VRLH
BPU, 0, 0, 0, 0, 0, // PC_VRLW
BPU, 0, 0, 0, 0, 0, // PC_VRSQRTEFP
BPU, 0, 0, 0, 0, 0, // PC_VSL
BPU, 0, 0, 0, 0, 0, // PC_VSLB
BPU, 0, 0, 0, 0, 0, // PC_VSLH
BPU, 0, 0, 0, 0, 0, // PC_VSLO
BPU, 0, 0, 0, 0, 0, // PC_VSLW
BPU, 0, 0, 0, 0, 0, // PC_VSPLTB
BPU, 0, 0, 0, 0, 0, // PC_VSPLTH
BPU, 0, 0, 0, 0, 0, // PC_VSPLTW
BPU, 0, 0, 0, 0, 0, // PC_VSPLTISB
BPU, 0, 0, 0, 0, 0, // PC_VSPLTISH
BPU, 0, 0, 0, 0, 0, // PC_VSPLTISW
BPU, 0, 0, 0, 0, 0, // PC_VSR
BPU, 0, 0, 0, 0, 0, // PC_VSRAB
BPU, 0, 0, 0, 0, 0, // PC_VSRAH
BPU, 0, 0, 0, 0, 0, // PC_VSRAW
BPU, 0, 0, 0, 0, 0, // PC_VSRB
BPU, 0, 0, 0, 0, 0, // PC_VSRH
BPU, 0, 0, 0, 0, 0, // PC_VSRO
BPU, 0, 0, 0, 0, 0, // PC_VSRW
BPU, 0, 0, 0, 0, 0, // PC_VSUBCUW
BPU, 0, 0, 0, 0, 0, // PC_VSUBFP
BPU, 0, 0, 0, 0, 0, // PC_VSUBSBS
BPU, 0, 0, 0, 0, 0, // PC_VSUBSHS
BPU, 0, 0, 0, 0, 0, // PC_VSUBSWS
BPU, 0, 0, 0, 0, 0, // PC_VSUBUBM
BPU, 0, 0, 0, 0, 0, // PC_VSUBUBS
BPU, 0, 0, 0, 0, 0, // PC_VSUBUHM
BPU, 0, 0, 0, 0, 0, // PC_VSUBUHS
BPU, 0, 0, 0, 0, 0, // PC_VSUBUWM
BPU, 0, 0, 0, 0, 0, // PC_VSUBUWS
BPU, 0, 0, 0, 0, 0, // PC_VSUMSWS
BPU, 0, 0, 0, 0, 0, // PC_VSUM2SWS
BPU, 0, 0, 0, 0, 0, // PC_VSUM4SBS
BPU, 0, 0, 0, 0, 0, // PC_VSUM4SHS
BPU, 0, 0, 0, 0, 0, // PC_VSUM4UBS
BPU, 0, 0, 0, 0, 0, // PC_VUPKHPX
BPU, 0, 0, 0, 0, 0, // PC_VUPKHSB
BPU, 0, 0, 0, 0, 0, // PC_VUPKHSH
BPU, 0, 0, 0, 0, 0, // PC_VUPKLPX
BPU, 0, 0, 0, 0, 0, // PC_VUPKLSB
BPU, 0, 0, 0, 0, 0, // PC_VUPKLSH
BPU, 0, 0, 0, 0, 0, // PC_VXOR
BPU, 0, 0, 0, 0, 0, // PC_VMADDFP
BPU, 0, 0, 0, 0, 0, // PC_VMHADDSHS
BPU, 0, 0, 0, 0, 0, // PC_VMHRADDSHS
BPU, 0, 0, 0, 0, 0, // PC_VMLADDUHM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMMBM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMSHM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMSHS
BPU, 0, 0, 0, 0, 0, // PC_VMSUMUBM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMUHM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMUHS
BPU, 0, 0, 0, 0, 0, // PC_VNMSUBFP
BPU, 0, 0, 0, 0, 0, // PC_VPERM
BPU, 0, 0, 0, 0, 0, // PC_VSEL
BPU, 0, 0, 0, 0, 0, // PC_VSLDOI
BPU, 0, 0, 0, 0, 0, // PC_VMR
BPU, 0, 0, 0, 0, 0, // PC_VMRP
BPU, 0, 0, 0, 0, 0, // PC_SLE
BPU, 0, 0, 0, 0, 0, // PC_SLEQ
BPU, 0, 0, 0, 0, 0, // PC_SLIQ
BPU, 0, 0, 0, 0, 0, // PC_SLLIQ
BPU, 0, 0, 0, 0, 0, // PC_SLLQ
BPU, 0, 0, 0, 0, 0, // PC_SLQ
BPU, 0, 0, 0, 0, 0, // PC_SRAIQ
BPU, 0, 0, 0, 0, 0, // PC_SRAQ
BPU, 0, 0, 0, 0, 0, // PC_SRE
BPU, 0, 0, 0, 0, 0, // PC_SREA
BPU, 0, 0, 0, 0, 0, // PC_SREQ
BPU, 0, 0, 0, 0, 0, // PC_SRIQ
BPU, 0, 0, 0, 0, 0, // PC_SRLIQ
BPU, 0, 0, 0, 0, 0, // PC_SRLQ
BPU, 0, 0, 0, 0, 0, // PC_SRQ
BPU, 0, 0, 0, 0, 0, // PC_MASKG
BPU, 0, 0, 0, 0, 0, // PC_MASKIR
BPU, 0, 0, 0, 0, 0, // PC_LSCBX
BPU, 0, 0, 0, 0, 0, // PC_DIV
BPU, 0, 0, 0, 0, 0, // PC_DIVS
BPU, 0, 0, 0, 0, 0, // PC_DOZ
BPU, 0, 0, 0, 0, 0, // PC_MUL
BPU, 0, 0, 0, 0, 0, // PC_NABS
BPU, 0, 0, 0, 0, 0, // PC_ABS
BPU, 0, 0, 0, 0, 0, // PC_CLCS
BPU, 0, 0, 0, 0, 0, // PC_DOZI
BPU, 0, 0, 0, 0, 0, // PC_RLMI
BPU, 0, 0, 0, 0, 0, // PC_RRIB
};
static void advance(int firstStage, int oldStage, int newStage) {
PCode *instr = pipeline[oldStage].instr;
int cycles = instruction_timing[instr->op].cycles[newStage - firstStage];
pipeline[newStage].instr = instr;
pipeline[newStage].remaining = cycles;
pipeline[oldStage].instr = NULL;
}
static void assign_completion_buffer(PCode *instr) {
completionbuffers.used++;
completionbuffers.free--;
completionbuffers.entries[completionbuffers.nextFreeSlot].instr = instr;
completionbuffers.entries[completionbuffers.nextFreeSlot].completed = 0;
completionbuffers.nextFreeSlot = (completionbuffers.nextFreeSlot + 1) % MaxEntries;
}
static void complete_instruction(int stage) {
PCode *instr = pipeline[stage].instr;
int buf = 0;
while (buf < MaxEntries && completionbuffers.entries[buf].instr != instr)
buf++;
completionbuffers.entries[buf].completed = 1;
pipeline[stage].instr = NULL;
}
static void retire_instruction(void) {
completionbuffers.entries[completionbuffers.nextToRetire].instr = NULL;
completionbuffers.used--;
completionbuffers.free++;
completionbuffers.nextToRetire = (completionbuffers.nextToRetire + 1) % MaxEntries;
}
static int latency(PCode *instr) {
int cycles = instruction_timing[instr->op].latency;
if (PCODE_FLAG_SET_F(instr) & fRecordBit)
cycles += 2;
if (instr->op == PC_LMW || instr->op == PC_STMW)
cycles += instr->argCount - 2;
return cycles;
}
static void initialize(void) {
int stage;
int i;
for (stage = 0; stage < NumStages; stage++)
pipeline[stage].instr = NULL;
completionbuffers.free = MaxEntries;
completionbuffers.used = 0;
completionbuffers.nextToRetire = 0;
completionbuffers.nextFreeSlot = 0;
for (i = 0; i < MaxEntries; i++)
completionbuffers.entries[i].instr = NULL;
}
static int can_issue(PCode *instr) {
int stage;
if (completionbuffers.free == 0)
return 0;
stage = instruction_timing[instr->op].stage;
if (pipeline[stage].instr) {
if (stage == IU) {
switch (instr->op) {
case PC_ADD:
case PC_ADDC:
case PC_ADDI:
case PC_ADDIS:
case PC_CMPI:
case PC_CMP:
case PC_CMPLI:
case PC_CMPL:
if (is_dependent(instr, pipeline[IU].instr, RegClass_GPR))
return 0;
if (!pipeline[SRU].instr)
return 1;
}
}
return 0;
}
if ((instr->flags & fIsWrite) && pipeline[LSU2].instr && (pipeline[LSU2].instr->flags & fIsWrite))
return 0;
return 1;
}
static void issue(PCode *instr) {
int stage = instruction_timing[instr->op].stage;
int cycles = instruction_timing[instr->op].cycles[0];
if (stage == IU && pipeline[IU].instr)
stage = SRU;
assign_completion_buffer(instr);
pipeline[stage].instr = instr;
pipeline[stage].remaining = cycles;
}
static void advance_clock(void) {
int stage;
for (stage = 0; stage < NumStages; stage++) {
if (pipeline[stage].instr && pipeline[stage].remaining)
--pipeline[stage].remaining;
}
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
}
}
if (pipeline[IU].instr && pipeline[IU].remaining == 0)
complete_instruction(IU);
if (pipeline[LSU2].instr && pipeline[LSU2].remaining == 0)
complete_instruction(LSU2);
if (pipeline[FPU3].instr && pipeline[FPU3].remaining == 0)
complete_instruction(FPU3);
if (pipeline[SRU].instr && pipeline[SRU].remaining == 0)
complete_instruction(SRU);
if (pipeline[BPU].instr && pipeline[BPU].remaining == 0)
complete_instruction(BPU);
if (
pipeline[FPU1].instr &&
pipeline[FPU1].remaining == 0 &&
(pipeline[FPU1].instr->op == PC_FDIV || pipeline[FPU1].instr->op == PC_FDIVS)
)
complete_instruction(FPU1);
if (pipeline[FPU2].instr && pipeline[FPU2].remaining == 0 && !pipeline[FPU3].instr)
advance(FPU1, FPU2, FPU3);
if (pipeline[FPU1].instr && pipeline[FPU1].remaining == 0 && !pipeline[FPU2].instr)
advance(FPU1, FPU1, FPU2);
if (pipeline[LSU1].instr && pipeline[LSU1].remaining == 0 && !pipeline[LSU2].instr)
advance(LSU1, LSU1, LSU2);
}
static int serializes(PCode *instr) {
return instruction_timing[instr->op].serializes;
}
MachineInfo machine603e = {
2,
1,
0,
&latency,
&initialize,
&can_issue,
&issue,
&advance_clock,
&serializes,
&default_uses_vpermute_unit
};

View File

@ -0,0 +1,670 @@
#include "compiler/Scheduler.h"
#include "compiler/PCode.h"
#include "compiler/PCodeInfo.h"
// https://archive.org/details/bitsavers_motorolaPosManualNov94_22719504
typedef enum Stage {
SCIU, // Single-Cycle Integer Unit 1
SCIU2, // Single-Cycle Integer Unit 2
MCIU, // Multiple-Cycle Integer Unit
FPU1, // Floating Point Unit
FPU2,
FPU3,
LSU1, // Load/Store Unit
LSU2,
BPU, // Branch Prediction Unit
NumStages
} Stage;
static struct {
// the instruction currently in this pipeline stage
PCode *instr;
// how many cycles are left for this instruction to finish
int remaining;
} pipeline[NumStages];
enum {
MaxEntries = 16
};
static struct {
// how many entries remain unused in the queue
unsigned int free;
// how many entries are currently used in the queue
unsigned int used;
// the index of the next instruction that will be retired
unsigned int nextToRetire;
// the index of the next free slot that will be used when an instruction is dispatched
unsigned int nextFreeSlot;
// circular array of entries in the completion queue
struct {
PCode *instr;
int completed;
} entries[MaxEntries];
} completionbuffers;
static PCode *sciu_completed_instruction;
static PCode *sciu2_completed_instruction;
static struct {
// the initial stage for this instruction
Stage stage;
// the total amount of cycles required by this instruction
char latency;
// how long it takes to finish each stage
char cycles[3];
// does this instruction serialise?
char serializes;
} instruction_timing[OPCODE_MAX] = {
BPU, 0, 0, 0, 0, 1, // PC_B
BPU, 0, 0, 0, 0, 1, // PC_BL
BPU, 0, 0, 0, 0, 1, // PC_BC
BPU, 0, 0, 0, 0, 1, // PC_BCLR
BPU, 0, 0, 0, 0, 1, // PC_BCCTR
BPU, 0, 0, 0, 0, 1, // PC_BT
BPU, 0, 0, 0, 0, 1, // PC_BTLR
BPU, 0, 0, 0, 0, 1, // PC_BTCTR
BPU, 0, 0, 0, 0, 1, // PC_BF
BPU, 0, 0, 0, 0, 1, // PC_BFLR
BPU, 0, 0, 0, 0, 1, // PC_BFCTR
BPU, 0, 0, 0, 0, 1, // PC_BDNZ
BPU, 0, 0, 0, 0, 1, // PC_BDNZT
BPU, 0, 0, 0, 0, 1, // PC_BDNZF
BPU, 0, 0, 0, 0, 1, // PC_BDZ
BPU, 0, 0, 0, 0, 1, // PC_BDZT
BPU, 0, 0, 0, 0, 1, // PC_BDZF
BPU, 0, 0, 0, 0, 1, // PC_BLR
BPU, 0, 0, 0, 0, 1, // PC_BCTR
BPU, 0, 0, 0, 0, 1, // PC_BCTRL
BPU, 0, 0, 0, 0, 1, // PC_BLRL
LSU1, 2, 1, 1, 0, 0, // PC_LBZ
LSU1, 2, 1, 1, 0, 0, // PC_LBZU
LSU1, 2, 1, 1, 0, 0, // PC_LBZX
LSU1, 2, 1, 1, 0, 0, // PC_LBZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHZ
LSU1, 2, 1, 1, 0, 0, // PC_LHZU
LSU1, 2, 1, 1, 0, 0, // PC_LHZX
LSU1, 2, 1, 1, 0, 0, // PC_LHZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHA
LSU1, 2, 1, 1, 0, 0, // PC_LHAU
LSU1, 2, 1, 1, 0, 0, // PC_LHAX
LSU1, 2, 1, 1, 0, 0, // PC_LHAUX
LSU1, 2, 1, 1, 0, 0, // PC_LHBRX
LSU1, 2, 1, 1, 0, 0, // PC_LWZ
LSU1, 2, 1, 1, 0, 0, // PC_LWZU
LSU1, 2, 1, 1, 0, 0, // PC_LWZX
LSU1, 2, 1, 1, 0, 0, // PC_LWZUX
LSU1, 2, 1, 1, 0, 0, // PC_LWBRX
LSU1, 2, 1, 1, 0, 0, // PC_LMW
LSU1, 3, 1, 1, 0, 0, // PC_STB
LSU1, 3, 1, 1, 0, 0, // PC_STBU
LSU1, 3, 1, 1, 0, 0, // PC_STBX
LSU1, 3, 1, 1, 0, 0, // PC_STBUX
LSU1, 3, 1, 1, 0, 0, // PC_STH
LSU1, 3, 1, 1, 0, 0, // PC_STHU
LSU1, 3, 1, 1, 0, 0, // PC_STHX
LSU1, 3, 1, 1, 0, 0, // PC_STHUX
LSU1, 3, 1, 1, 0, 0, // PC_STHBRX
LSU1, 3, 1, 1, 0, 0, // PC_STW
LSU1, 3, 1, 1, 0, 0, // PC_STWU
LSU1, 3, 1, 1, 0, 0, // PC_STWX
LSU1, 3, 1, 1, 0, 0, // PC_STWUX
LSU1, 3, 1, 1, 0, 0, // PC_STWBRX
LSU1, 2, 1, 1, 0, 0, // PC_STMW
LSU1, 2, 1, 1, 0, 0, // PC_DCBF
LSU1, 2, 1, 1, 0, 0, // PC_DCBST
LSU1, 2, 1, 1, 0, 0, // PC_DCBT
LSU1, 2, 1, 1, 0, 0, // PC_DCBTST
LSU1, 2, 1, 1, 0, 0, // PC_DCBZ
SCIU, 1, 1, 0, 0, 0, // PC_ADD
SCIU, 1, 1, 0, 0, 0, // PC_ADDC
SCIU, 1, 1, 0, 0, 0, // PC_ADDE
SCIU, 1, 1, 0, 0, 0, // PC_ADDI
SCIU, 1, 1, 0, 0, 0, // PC_ADDIC
SCIU, 1, 1, 0, 0, 0, // PC_ADDICR
SCIU, 1, 1, 0, 0, 0, // PC_ADDIS
SCIU, 1, 1, 0, 0, 0, // PC_ADDME
SCIU, 1, 1, 0, 0, 0, // PC_ADDZE
MCIU, 20, 20, 0, 0, 0, // PC_DIVW
MCIU, 20, 20, 0, 0, 0, // PC_DIVWU
MCIU, 4, 4, 0, 0, 0, // PC_MULHW
MCIU, 4, 4, 0, 0, 0, // PC_MULHWU
MCIU, 3, 3, 0, 0, 0, // PC_MULLI
MCIU, 4, 4, 0, 0, 0, // PC_MULLW
SCIU, 1, 1, 0, 0, 0, // PC_NEG
SCIU, 1, 1, 0, 0, 0, // PC_SUBF
SCIU, 1, 1, 0, 0, 0, // PC_SUBFC
SCIU, 1, 1, 0, 0, 0, // PC_SUBFE
SCIU, 1, 1, 0, 0, 0, // PC_SUBFIC
SCIU, 1, 1, 0, 0, 0, // PC_SUBFME
SCIU, 1, 1, 0, 0, 0, // PC_SUBFZE
SCIU, 3, 1, 0, 0, 0, // PC_CMPI
SCIU, 3, 1, 0, 0, 0, // PC_CMP
SCIU, 3, 1, 0, 0, 0, // PC_CMPLI
SCIU, 3, 1, 0, 0, 0, // PC_CMPL
SCIU, 1, 1, 0, 0, 0, // PC_ANDI
SCIU, 1, 1, 0, 0, 0, // PC_ANDIS
SCIU, 1, 1, 0, 0, 0, // PC_ORI
SCIU, 1, 1, 0, 0, 0, // PC_ORIS
SCIU, 1, 1, 0, 0, 0, // PC_XORI
SCIU, 1, 1, 0, 0, 0, // PC_XORIS
SCIU, 1, 1, 0, 0, 0, // PC_AND
SCIU, 1, 1, 0, 0, 0, // PC_OR
SCIU, 1, 1, 0, 0, 0, // PC_XOR
SCIU, 1, 1, 0, 0, 0, // PC_NAND
SCIU, 1, 1, 0, 0, 0, // PC_NOR
SCIU, 1, 1, 0, 0, 0, // PC_EQV
SCIU, 1, 1, 0, 0, 0, // PC_ANDC
SCIU, 1, 1, 0, 0, 0, // PC_ORC
SCIU, 1, 1, 0, 0, 0, // PC_EXTSB
SCIU, 1, 1, 0, 0, 0, // PC_EXTSH
SCIU, 1, 1, 0, 0, 0, // PC_CNTLZW
SCIU, 1, 1, 0, 0, 0, // PC_RLWINM
SCIU, 1, 1, 0, 0, 0, // PC_RLWNM
SCIU, 1, 1, 0, 0, 0, // PC_RLWIMI
SCIU, 1, 1, 0, 0, 0, // PC_SLW
SCIU, 1, 1, 0, 0, 0, // PC_SRW
SCIU, 1, 1, 0, 0, 0, // PC_SRAWI
SCIU, 1, 1, 0, 0, 0, // PC_SRAW
BPU, 1, 1, 0, 0, 0, // PC_CRAND
BPU, 1, 1, 0, 0, 0, // PC_CRANDC
BPU, 1, 1, 0, 0, 0, // PC_CREQV
BPU, 1, 1, 0, 0, 0, // PC_CRNAND
BPU, 1, 1, 0, 0, 0, // PC_CRNOR
BPU, 1, 1, 0, 0, 0, // PC_CROR
BPU, 1, 1, 0, 0, 0, // PC_CRORC
BPU, 1, 1, 0, 0, 0, // PC_CRXOR
BPU, 1, 1, 0, 0, 0, // PC_MCRF
MCIU, 1, 1, 0, 0, 0, // PC_MTXER
MCIU, 1, 1, 0, 0, 0, // PC_MTCTR
MCIU, 1, 1, 0, 0, 0, // PC_MTLR
MCIU, 1, 1, 0, 0, 0, // PC_MTCRF
MCIU, 1, 1, 0, 0, 0, // PC_MTMSR
MCIU, 1, 1, 0, 0, 0, // PC_MTSPR
MCIU, 1, 1, 0, 0, 0, // PC_MFMSR
MCIU, 1, 1, 0, 0, 0, // PC_MFSPR
MCIU, 3, 3, 0, 0, 0, // PC_MFXER
MCIU, 3, 3, 0, 0, 0, // PC_MFCTR
MCIU, 3, 3, 0, 0, 0, // PC_MFLR
MCIU, 3, 3, 0, 0, 0, // PC_MFCR
FPU1, 3, 1, 1, 1, 0, // PC_MFFS
FPU1, 3, 1, 1, 1, 0, // PC_MTFSF
LSU1, 1, 0, 0, 0, 1, // PC_EIEIO
LSU1, 1, 0, 0, 0, 1, // PC_ISYNC
LSU1, 1, 0, 0, 0, 1, // PC_SYNC
LSU1, 1, 1, 0, 0, 1, // PC_RFI
SCIU, 1, 1, 0, 0, 0, // PC_LI
SCIU, 1, 1, 0, 0, 0, // PC_LIS
SCIU, 1, 1, 0, 0, 0, // PC_MR
SCIU, 1, 1, 0, 0, 0, // PC_NOP
SCIU, 1, 1, 0, 0, 0, // PC_NOT
LSU1, 3, 1, 1, 0, 0, // PC_LFS
LSU1, 3, 1, 1, 0, 0, // PC_LFSU
LSU1, 3, 1, 1, 0, 0, // PC_LFSX
LSU1, 3, 1, 1, 0, 0, // PC_LFSUX
LSU1, 3, 1, 1, 0, 0, // PC_LFD
LSU1, 3, 1, 1, 0, 0, // PC_LFDU
LSU1, 3, 1, 1, 0, 0, // PC_LFDX
LSU1, 3, 1, 1, 0, 0, // PC_LFDUX
LSU1, 3, 1, 1, 0, 0, // PC_STFS
LSU1, 3, 1, 1, 0, 0, // PC_STFSU
LSU1, 3, 1, 1, 0, 0, // PC_STFSX
LSU1, 3, 1, 1, 0, 0, // PC_STFSUX
LSU1, 3, 1, 1, 0, 0, // PC_STFD
LSU1, 3, 1, 1, 0, 0, // PC_STFDU
LSU1, 3, 1, 1, 0, 0, // PC_STFDX
LSU1, 3, 1, 1, 0, 0, // PC_STFDUX
FPU1, 3, 1, 1, 1, 0, // PC_FMR
FPU1, 3, 1, 1, 1, 0, // PC_FABS
FPU1, 3, 1, 1, 1, 0, // PC_FNEG
FPU1, 3, 1, 1, 1, 0, // PC_FNABS
FPU1, 3, 1, 1, 1, 0, // PC_FADD
FPU1, 3, 1, 1, 1, 0, // PC_FADDS
FPU1, 3, 1, 1, 1, 0, // PC_FSUB
FPU1, 3, 1, 1, 1, 0, // PC_FSUBS
FPU1, 3, 1, 1, 1, 0, // PC_FMUL
FPU1, 3, 1, 1, 1, 0, // PC_FMULS
FPU1, 32, 32, 0, 0, 0, // PC_FDIV
FPU1, 18, 18, 0, 0, 0, // PC_FDIVS
FPU1, 3, 1, 1, 1, 0, // PC_FMADD
FPU1, 3, 1, 1, 1, 0, // PC_FMADDS
FPU1, 3, 1, 1, 1, 0, // PC_FMSUB
FPU1, 3, 1, 1, 1, 0, // PC_FMSUBS
FPU1, 3, 1, 1, 1, 0, // PC_FNMADD
FPU1, 3, 1, 1, 1, 0, // PC_FNMADDS
FPU1, 3, 1, 1, 1, 0, // PC_FNMSUB
FPU1, 3, 1, 1, 1, 0, // PC_FNMSUBS
FPU1, 18, 18, 0, 0, 0, // PC_FRES
FPU1, 3, 1, 1, 1, 0, // PC_FRSQRTE
FPU1, 3, 1, 1, 1, 0, // PC_FSEL
FPU1, 3, 1, 1, 1, 0, // PC_FRSP
FPU1, 3, 1, 1, 1, 0, // PC_FCTIW
FPU1, 3, 1, 1, 1, 0, // PC_FCTIWZ
FPU1, 5, 1, 1, 1, 0, // PC_FCMPU
FPU1, 5, 1, 1, 1, 0, // PC_FCMPO
LSU1, 1, 1, 0, 0, 0, // PC_LWARX
LSU1, 1, 1, 0, 0, 0, // PC_LSWI
LSU1, 1, 1, 0, 0, 0, // PC_LSWX
LSU1, 1, 1, 0, 0, 0, // PC_STFIWX
LSU1, 1, 1, 0, 0, 0, // PC_STSWI
LSU1, 1, 1, 0, 0, 0, // PC_STSWX
LSU1, 1, 1, 0, 0, 0, // PC_STWCX
MCIU, 1, 1, 0, 0, 1, // PC_ECIWX
MCIU, 1, 1, 0, 0, 1, // PC_ECOWX
MCIU, 1, 1, 0, 0, 0, // PC_DCBI
MCIU, 1, 1, 0, 0, 0, // PC_ICBI
MCIU, 1, 1, 0, 0, 0, // PC_MCRFS
MCIU, 1, 1, 0, 0, 0, // PC_MCRXR
MCIU, 1, 1, 0, 0, 0, // PC_MFTB
MCIU, 1, 1, 0, 0, 0, // PC_MFSR
MCIU, 1, 1, 0, 0, 0, // PC_MTSR
MCIU, 1, 1, 0, 0, 0, // PC_MFSRIN
MCIU, 1, 1, 0, 0, 0, // PC_MTSRIN
MCIU, 1, 1, 0, 0, 0, // PC_MTFSB0
MCIU, 1, 1, 0, 0, 0, // PC_MTFSB1
MCIU, 1, 1, 0, 0, 0, // PC_MTFSFI
MCIU, 1, 1, 0, 0, 1, // PC_SC
FPU1, 1, 1, 0, 0, 0, // PC_FSQRT
FPU1, 1, 1, 0, 0, 0, // PC_FSQRTS
MCIU, 1, 1, 0, 0, 0, // PC_TLBIA
MCIU, 1, 1, 0, 0, 0, // PC_TLBIE
MCIU, 1, 1, 0, 0, 0, // PC_TLBLD
MCIU, 1, 1, 0, 0, 0, // PC_TLBLI
MCIU, 1, 1, 0, 0, 0, // PC_TLBSYNC
MCIU, 1, 1, 0, 0, 1, // PC_TW
MCIU, 1, 1, 0, 0, 1, // PC_TRAP
MCIU, 1, 1, 0, 0, 1, // PC_TWI
MCIU, 1, 1, 0, 0, 1, // PC_OPWORD
MCIU, 1, 1, 0, 0, 0, // PC_MFROM
MCIU, 1, 1, 0, 0, 1, // PC_DSA
MCIU, 1, 1, 0, 0, 1, // PC_ESA
MCIU, 0, 0, 0, 0, 0, // PC_DCCCI
MCIU, 0, 0, 0, 0, 0, // PC_DCREAD
MCIU, 0, 0, 0, 0, 0, // PC_ICBT
MCIU, 0, 0, 0, 0, 0, // PC_ICCCI
MCIU, 0, 0, 0, 0, 0, // PC_ICREAD
MCIU, 0, 0, 0, 0, 0, // PC_RFCI
MCIU, 0, 0, 0, 0, 0, // PC_TLBRE
MCIU, 0, 0, 0, 0, 0, // PC_TLBSX
MCIU, 0, 0, 0, 0, 0, // PC_TLBWE
MCIU, 0, 0, 0, 0, 0, // PC_WRTEE
MCIU, 0, 0, 0, 0, 0, // PC_WRTEEI
MCIU, 0, 0, 0, 0, 0, // PC_MFDCR
MCIU, 0, 0, 0, 0, 0, // PC_MTDCR
MCIU, 0, 0, 0, 0, 0, // PC_DCBA
SCIU, 0, 0, 0, 0, 0, // PC_DSS
SCIU, 0, 0, 0, 0, 0, // PC_DSSALL
SCIU, 0, 0, 0, 0, 0, // PC_DST
SCIU, 0, 0, 0, 0, 0, // PC_DSTT
SCIU, 0, 0, 0, 0, 0, // PC_DSTST
SCIU, 0, 0, 0, 0, 0, // PC_DSTSTT
SCIU, 0, 0, 0, 0, 0, // PC_LVEBX
SCIU, 0, 0, 0, 0, 0, // PC_LVEHX
SCIU, 0, 0, 0, 0, 0, // PC_LVEWX
SCIU, 0, 0, 0, 0, 0, // PC_LVSL
SCIU, 0, 0, 0, 0, 0, // PC_LVSR
SCIU, 0, 0, 0, 0, 0, // PC_LVX
SCIU, 0, 0, 0, 0, 0, // PC_LVXL
SCIU, 0, 0, 0, 0, 0, // PC_STVEBX
SCIU, 0, 0, 0, 0, 0, // PC_STVEHX
SCIU, 0, 0, 0, 0, 0, // PC_STVEWX
SCIU, 0, 0, 0, 0, 0, // PC_STVX
SCIU, 0, 0, 0, 0, 0, // PC_STVXL
SCIU, 0, 0, 0, 0, 0, // PC_MFVSCR
SCIU, 0, 0, 0, 0, 0, // PC_MTVSCR
SCIU, 0, 0, 0, 0, 0, // PC_VADDCUW
SCIU, 0, 0, 0, 0, 0, // PC_VADDFP
SCIU, 0, 0, 0, 0, 0, // PC_VADDSBS
SCIU, 0, 0, 0, 0, 0, // PC_VADDSHS
SCIU, 0, 0, 0, 0, 0, // PC_VADDSWS
SCIU, 0, 0, 0, 0, 0, // PC_VADDUBM
SCIU, 0, 0, 0, 0, 0, // PC_VADDUBS
SCIU, 0, 0, 0, 0, 0, // PC_VADDUHM
SCIU, 0, 0, 0, 0, 0, // PC_VADDUHS
SCIU, 0, 0, 0, 0, 0, // PC_VADDUWM
SCIU, 0, 0, 0, 0, 0, // PC_VADDUWS
SCIU, 0, 0, 0, 0, 0, // PC_VAND
SCIU, 0, 0, 0, 0, 0, // PC_VANDC
SCIU, 0, 0, 0, 0, 0, // PC_VAVGSB
SCIU, 0, 0, 0, 0, 0, // PC_VAVGSH
SCIU, 0, 0, 0, 0, 0, // PC_VAVGSW
SCIU, 0, 0, 0, 0, 0, // PC_VAVGUB
SCIU, 0, 0, 0, 0, 0, // PC_VAVGUH
SCIU, 0, 0, 0, 0, 0, // PC_VAVGUW
SCIU, 0, 0, 0, 0, 0, // PC_VCFSX
SCIU, 0, 0, 0, 0, 0, // PC_VCFUX
SCIU, 0, 0, 0, 0, 0, // PC_VCMPBFP
SCIU, 0, 0, 0, 0, 0, // PC_VCMPEQFP
SCIU, 0, 0, 0, 0, 0, // PC_VCMPEQUB
SCIU, 0, 0, 0, 0, 0, // PC_VCMPEQUH
SCIU, 0, 0, 0, 0, 0, // PC_VCMPEQUW
SCIU, 0, 0, 0, 0, 0, // PC_VCMPGEFP
SCIU, 0, 0, 0, 0, 0, // PC_VCMPGTFP
SCIU, 0, 0, 0, 0, 0, // PC_VCMPGTSB
SCIU, 0, 0, 0, 0, 0, // PC_VCMPGTSH
SCIU, 0, 0, 0, 0, 0, // PC_VCMPGTSW
SCIU, 0, 0, 0, 0, 0, // PC_VCMPGTUB
SCIU, 0, 0, 0, 0, 0, // PC_VCMPGTUH
SCIU, 0, 0, 0, 0, 0, // PC_VCMPGTUW
SCIU, 0, 0, 0, 0, 0, // PC_VCTSXS
SCIU, 0, 0, 0, 0, 0, // PC_VCTUXS
SCIU, 0, 0, 0, 0, 0, // PC_VEXPTEFP
SCIU, 0, 0, 0, 0, 0, // PC_VLOGEFP
SCIU, 0, 0, 0, 0, 0, // PC_VMAXFP
SCIU, 0, 0, 0, 0, 0, // PC_VMAXSB
SCIU, 0, 0, 0, 0, 0, // PC_VMAXSH
SCIU, 0, 0, 0, 0, 0, // PC_VMAXSW
SCIU, 0, 0, 0, 0, 0, // PC_VMAXUB
SCIU, 0, 0, 0, 0, 0, // PC_VMAXUH
SCIU, 0, 0, 0, 0, 0, // PC_VMAXUW
SCIU, 0, 0, 0, 0, 0, // PC_VMINFP
SCIU, 0, 0, 0, 0, 0, // PC_VMINSB
SCIU, 0, 0, 0, 0, 0, // PC_VMINSH
SCIU, 0, 0, 0, 0, 0, // PC_VMINSW
SCIU, 0, 0, 0, 0, 0, // PC_VMINUB
SCIU, 0, 0, 0, 0, 0, // PC_VMINUH
SCIU, 0, 0, 0, 0, 0, // PC_VMINUW
SCIU, 0, 0, 0, 0, 0, // PC_VMRGHB
SCIU, 0, 0, 0, 0, 0, // PC_VMRGHH
SCIU, 0, 0, 0, 0, 0, // PC_VMRGHW
SCIU, 0, 0, 0, 0, 0, // PC_VMRGLB
SCIU, 0, 0, 0, 0, 0, // PC_VMRGLH
SCIU, 0, 0, 0, 0, 0, // PC_VMRGLW
SCIU, 0, 0, 0, 0, 0, // PC_VMULESB
SCIU, 0, 0, 0, 0, 0, // PC_VMULESH
SCIU, 0, 0, 0, 0, 0, // PC_VMULEUB
SCIU, 0, 0, 0, 0, 0, // PC_VMULEUH
SCIU, 0, 0, 0, 0, 0, // PC_VMULOSB
SCIU, 0, 0, 0, 0, 0, // PC_VMULOSH
SCIU, 0, 0, 0, 0, 0, // PC_VMULOUB
SCIU, 0, 0, 0, 0, 0, // PC_VMULOUH
SCIU, 0, 0, 0, 0, 0, // PC_VNOR
SCIU, 0, 0, 0, 0, 0, // PC_VOR
SCIU, 0, 0, 0, 0, 0, // PC_VPKPX
SCIU, 0, 0, 0, 0, 0, // PC_VPKSHSS
SCIU, 0, 0, 0, 0, 0, // PC_VPKSHUS
SCIU, 0, 0, 0, 0, 0, // PC_VPKSWSS
SCIU, 0, 0, 0, 0, 0, // PC_VPKSWUS
SCIU, 0, 0, 0, 0, 0, // PC_VPKUHUM
SCIU, 0, 0, 0, 0, 0, // PC_VPKUHUS
SCIU, 0, 0, 0, 0, 0, // PC_VPKUWUM
SCIU, 0, 0, 0, 0, 0, // PC_VPKUWUS
SCIU, 0, 0, 0, 0, 0, // PC_VREFP
SCIU, 0, 0, 0, 0, 0, // PC_VRFIM
SCIU, 0, 0, 0, 0, 0, // PC_VRFIN
SCIU, 0, 0, 0, 0, 0, // PC_VRFIP
SCIU, 0, 0, 0, 0, 0, // PC_VRFIZ
SCIU, 0, 0, 0, 0, 0, // PC_VRLB
SCIU, 0, 0, 0, 0, 0, // PC_VRLH
SCIU, 0, 0, 0, 0, 0, // PC_VRLW
SCIU, 0, 0, 0, 0, 0, // PC_VRSQRTEFP
SCIU, 0, 0, 0, 0, 0, // PC_VSL
SCIU, 0, 0, 0, 0, 0, // PC_VSLB
SCIU, 0, 0, 0, 0, 0, // PC_VSLH
SCIU, 0, 0, 0, 0, 0, // PC_VSLO
SCIU, 0, 0, 0, 0, 0, // PC_VSLW
SCIU, 0, 0, 0, 0, 0, // PC_VSPLTB
SCIU, 0, 0, 0, 0, 0, // PC_VSPLTH
SCIU, 0, 0, 0, 0, 0, // PC_VSPLTW
SCIU, 0, 0, 0, 0, 0, // PC_VSPLTISB
SCIU, 0, 0, 0, 0, 0, // PC_VSPLTISH
SCIU, 0, 0, 0, 0, 0, // PC_VSPLTISW
SCIU, 0, 0, 0, 0, 0, // PC_VSR
SCIU, 0, 0, 0, 0, 0, // PC_VSRAB
SCIU, 0, 0, 0, 0, 0, // PC_VSRAH
SCIU, 0, 0, 0, 0, 0, // PC_VSRAW
SCIU, 0, 0, 0, 0, 0, // PC_VSRB
SCIU, 0, 0, 0, 0, 0, // PC_VSRH
SCIU, 0, 0, 0, 0, 0, // PC_VSRO
SCIU, 0, 0, 0, 0, 0, // PC_VSRW
SCIU, 0, 0, 0, 0, 0, // PC_VSUBCUW
SCIU, 0, 0, 0, 0, 0, // PC_VSUBFP
SCIU, 0, 0, 0, 0, 0, // PC_VSUBSBS
SCIU, 0, 0, 0, 0, 0, // PC_VSUBSHS
SCIU, 0, 0, 0, 0, 0, // PC_VSUBSWS
SCIU, 0, 0, 0, 0, 0, // PC_VSUBUBM
SCIU, 0, 0, 0, 0, 0, // PC_VSUBUBS
SCIU, 0, 0, 0, 0, 0, // PC_VSUBUHM
SCIU, 0, 0, 0, 0, 0, // PC_VSUBUHS
SCIU, 0, 0, 0, 0, 0, // PC_VSUBUWM
SCIU, 0, 0, 0, 0, 0, // PC_VSUBUWS
SCIU, 0, 0, 0, 0, 0, // PC_VSUMSWS
SCIU, 0, 0, 0, 0, 0, // PC_VSUM2SWS
SCIU, 0, 0, 0, 0, 0, // PC_VSUM4SBS
SCIU, 0, 0, 0, 0, 0, // PC_VSUM4SHS
SCIU, 0, 0, 0, 0, 0, // PC_VSUM4UBS
SCIU, 0, 0, 0, 0, 0, // PC_VUPKHPX
SCIU, 0, 0, 0, 0, 0, // PC_VUPKHSB
SCIU, 0, 0, 0, 0, 0, // PC_VUPKHSH
SCIU, 0, 0, 0, 0, 0, // PC_VUPKLPX
SCIU, 0, 0, 0, 0, 0, // PC_VUPKLSB
SCIU, 0, 0, 0, 0, 0, // PC_VUPKLSH
SCIU, 0, 0, 0, 0, 0, // PC_VXOR
SCIU, 0, 0, 0, 0, 0, // PC_VMADDFP
SCIU, 0, 0, 0, 0, 0, // PC_VMHADDSHS
SCIU, 0, 0, 0, 0, 0, // PC_VMHRADDSHS
SCIU, 0, 0, 0, 0, 0, // PC_VMLADDUHM
SCIU, 0, 0, 0, 0, 0, // PC_VMSUMMBM
SCIU, 0, 0, 0, 0, 0, // PC_VMSUMSHM
SCIU, 0, 0, 0, 0, 0, // PC_VMSUMSHS
SCIU, 0, 0, 0, 0, 0, // PC_VMSUMUBM
SCIU, 0, 0, 0, 0, 0, // PC_VMSUMUHM
SCIU, 0, 0, 0, 0, 0, // PC_VMSUMUHS
SCIU, 0, 0, 0, 0, 0, // PC_VNMSUBFP
SCIU, 0, 0, 0, 0, 0, // PC_VPERM
SCIU, 0, 0, 0, 0, 0, // PC_VSEL
SCIU, 0, 0, 0, 0, 0, // PC_VSLDOI
SCIU, 0, 0, 0, 0, 0, // PC_VMR
SCIU, 0, 0, 0, 0, 0, // PC_VMRP
SCIU, 0, 0, 0, 0, 0, // PC_SLE
SCIU, 0, 0, 0, 0, 0, // PC_SLEQ
SCIU, 0, 0, 0, 0, 0, // PC_SLIQ
SCIU, 0, 0, 0, 0, 0, // PC_SLLIQ
SCIU, 0, 0, 0, 0, 0, // PC_SLLQ
SCIU, 0, 0, 0, 0, 0, // PC_SLQ
SCIU, 0, 0, 0, 0, 0, // PC_SRAIQ
SCIU, 0, 0, 0, 0, 0, // PC_SRAQ
SCIU, 0, 0, 0, 0, 0, // PC_SRE
SCIU, 0, 0, 0, 0, 0, // PC_SREA
SCIU, 0, 0, 0, 0, 0, // PC_SREQ
SCIU, 0, 0, 0, 0, 0, // PC_SRIQ
SCIU, 0, 0, 0, 0, 0, // PC_SRLIQ
SCIU, 0, 0, 0, 0, 0, // PC_SRLQ
SCIU, 0, 0, 0, 0, 0, // PC_SRQ
SCIU, 0, 0, 0, 0, 0, // PC_MASKG
SCIU, 0, 0, 0, 0, 0, // PC_MASKIR
SCIU, 0, 0, 0, 0, 0, // PC_LSCBX
SCIU, 0, 0, 0, 0, 0, // PC_DIV
SCIU, 0, 0, 0, 0, 0, // PC_DIVS
SCIU, 0, 0, 0, 0, 0, // PC_DOZ
SCIU, 0, 0, 0, 0, 0, // PC_MUL
SCIU, 0, 0, 0, 0, 0, // PC_NABS
SCIU, 0, 0, 0, 0, 0, // PC_ABS
SCIU, 0, 0, 0, 0, 0, // PC_CLCS
SCIU, 0, 0, 0, 0, 0, // PC_DOZI
SCIU, 0, 0, 0, 0, 0, // PC_RLMI
SCIU, 0, 0, 0, 0, 0, // PC_RRIB
};
static void advance(int firstStage, int oldStage, int newStage) {
PCode *instr = pipeline[oldStage].instr;
int cycles = instruction_timing[instr->op].cycles[newStage - firstStage];
pipeline[newStage].instr = instr;
pipeline[newStage].remaining = cycles;
pipeline[oldStage].instr = NULL;
}
static void assign_completion_buffer(PCode *instr) {
completionbuffers.used++;
completionbuffers.free--;
completionbuffers.entries[completionbuffers.nextFreeSlot].instr = instr;
completionbuffers.entries[completionbuffers.nextFreeSlot].completed = 0;
completionbuffers.nextFreeSlot = (completionbuffers.nextFreeSlot + 1) % MaxEntries;
}
static void complete_instruction(int stage) {
PCode *instr = pipeline[stage].instr;
int buf = 0;
while (buf < MaxEntries && completionbuffers.entries[buf].instr != instr)
buf++;
completionbuffers.entries[buf].completed = 1;
pipeline[stage].instr = NULL;
if (stage == SCIU)
sciu_completed_instruction = instr;
else if (stage == SCIU2)
sciu2_completed_instruction = instr;
}
static void retire_instruction(void) {
completionbuffers.entries[completionbuffers.nextToRetire].instr = NULL;
completionbuffers.used--;
completionbuffers.free++;
completionbuffers.nextToRetire = (completionbuffers.nextToRetire + 1) % MaxEntries;
}
static int latency(PCode *instr) {
int cycles = instruction_timing[instr->op].latency;
if (PCODE_FLAG_SET_F(instr) & fRecordBit)
cycles += 2;
if (instr->op == PC_LMW || instr->op == PC_STMW)
cycles += instr->argCount - 2;
return cycles;
}
static void initialize(void) {
int stage;
int i;
for (stage = 0; stage < NumStages; stage++)
pipeline[stage].instr = NULL;
completionbuffers.free = MaxEntries;
completionbuffers.used = 0;
completionbuffers.nextToRetire = 0;
completionbuffers.nextFreeSlot = 0;
for (i = 0; i < MaxEntries; i++)
completionbuffers.entries[i].instr = NULL;
sciu_completed_instruction = NULL;
sciu2_completed_instruction = NULL;
}
static int can_issue(PCode *instr) {
PCode *check;
int stage = instruction_timing[instr->op].stage;
if (completionbuffers.free == 0)
return 0;
if (stage == SCIU) {
int isClear1 = !pipeline[SCIU].instr;
int isClear2 = !pipeline[SCIU2].instr;
if (!isClear1 && !isClear2)
return 0;
if (isClear1 && isClear2)
return 1;
if (isClear1)
check = pipeline[SCIU2].instr;
else
check = pipeline[SCIU].instr;
if (is_dependent(instr, check, RegClass_GPR))
return 0;
if (is_dependent(instr, sciu_completed_instruction, RegClass_GPR))
return 0;
if (is_dependent(instr, sciu2_completed_instruction, RegClass_GPR))
return 0;
} else {
if (pipeline[stage].instr)
return 0;
}
return 1;
}
static void issue(PCode *instr) {
int stage = instruction_timing[instr->op].stage;
int cycles = instruction_timing[instr->op].cycles[0];
if (stage == SCIU && pipeline[SCIU].instr)
stage = SCIU2;
assign_completion_buffer(instr);
pipeline[stage].instr = instr;
pipeline[stage].remaining = cycles;
}
static void advance_clock(void) {
int stage;
int i;
sciu_completed_instruction = NULL;
sciu2_completed_instruction = NULL;
for (stage = 0; stage < NumStages; stage++) {
if (pipeline[stage].instr && pipeline[stage].remaining)
--pipeline[stage].remaining;
}
for (i = 0; i < 5; i++) {
if (completionbuffers.used == 0)
break;
if (completionbuffers.entries[completionbuffers.nextToRetire].completed == 0)
break;
retire_instruction();
}
if (pipeline[SCIU].instr && pipeline[SCIU].remaining == 0)
complete_instruction(SCIU);
if (pipeline[SCIU2].instr && pipeline[SCIU2].remaining == 0)
complete_instruction(SCIU2);
if (pipeline[MCIU].instr && pipeline[MCIU].remaining == 0)
complete_instruction(MCIU);
if (pipeline[LSU2].instr && pipeline[LSU2].remaining == 0)
complete_instruction(LSU2);
if (pipeline[FPU3].instr && pipeline[FPU3].remaining == 0)
complete_instruction(FPU3);
if (pipeline[BPU].instr && pipeline[BPU].remaining == 0)
complete_instruction(BPU);
if (
pipeline[FPU1].instr &&
pipeline[FPU1].remaining == 0 &&
(pipeline[FPU1].instr->op == PC_FDIV || pipeline[FPU1].instr->op == PC_FDIVS)
)
complete_instruction(FPU1);
if (pipeline[FPU2].instr && pipeline[FPU2].remaining == 0 && !pipeline[FPU3].instr)
advance(FPU1, FPU2, FPU3);
if (pipeline[FPU1].instr && pipeline[FPU1].remaining == 0 && !pipeline[FPU2].instr)
advance(FPU1, FPU1, FPU2);
if (pipeline[LSU1].instr && pipeline[LSU1].remaining == 0 && !pipeline[LSU2].instr)
advance(LSU1, LSU1, LSU2);
}
static int serializes(PCode *instr) {
return instruction_timing[instr->op].serializes;
}
MachineInfo machine604 = {
4,
1,
0,
&latency,
&initialize,
&can_issue,
&issue,
&advance_clock,
&serializes,
&default_uses_vpermute_unit
};

View File

@ -0,0 +1,744 @@
#include "compiler/Scheduler.h"
#include "compiler/PCode.h"
#include "compiler/PCodeInfo.h"
// https://www.nxp.com/docs/en/reference-manual/MPC7410UM.pdf
typedef enum Stage {
BPU, // Branch Prediction Unit
IU1, // Integer Unit 1
IU2, // Integer Unit 2
LSU1, // Load/Store Unit
LSU2,
FPU1, // Floating Point Unit
FPU2,
FPU3,
SRU, // System Register Unit
VSIU, // Vector Simple Integer Unit
VPU, // AltiVec Permute Unit
VCIU1, // Vector Complex Integer Unit
VCIU2,
VCIU3,
VFPU1, // Vector Floating-Point Unit
VFPU2,
VFPU3,
VFPU4,
NumStages
} Stage;
static struct {
// the instruction currently in this pipeline stage
PCode *instr;
// how many cycles are left for this instruction to finish
int remaining;
} pipeline[NumStages];
static PCode *iu1_completed_instruction;
static PCode *iu2_completed_instruction;
enum {
MaxEntries = 8
};
static struct {
// how many entries remain unused in the queue
unsigned int free;
// how many entries are currently used in the queue
unsigned int used;
// the index of the next instruction that will be retired
unsigned int nextToRetire;
// the index of the next free slot that will be used when an instruction is dispatched
unsigned int nextFreeSlot;
// circular array of entries in the completion queue
struct {
PCode *instr;
int completed;
} entries[MaxEntries];
} completionbuffers;
static struct {
// the initial stage for this instruction
Stage stage;
// the total amount of cycles required by this instruction
char latency;
// how long it takes to finish each stage
char cycles[4];
// does this instruction serialise?
char serializes;
char unused;
} instruction_timing[OPCODE_MAX] = {
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_B
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BL
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BC
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BCLR
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BCCTR
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BT
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BTLR
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BTCTR
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BF
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BFLR
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BFCTR
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDNZ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDNZT
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDNZF
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDZ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDZT
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDZF
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BLR
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BCTR
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BCTRL
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BLRL
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LBZ
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LBZU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LBZX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LBZUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LHZ
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LHZU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LHZX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LHZUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LHA
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LHAU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LHAX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LHAUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LHBRX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LWZ
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LWZU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LWZX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LWZUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LWBRX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LMW
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STB
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STBU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STBX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STBUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STH
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STHU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STHX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STHUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STHBRX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STW
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STWU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STWX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STWUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STWBRX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STMW
LSU1, 3, 1, 2, 0, 0, 0, 0, // PC_DCBF
LSU1, 3, 1, 2, 0, 0, 0, 0, // PC_DCBST
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_DCBT
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_DCBTST
LSU1, 3, 1, 2, 0, 0, 0, 0, // PC_DCBZ
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ADD
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ADDC
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ADDE
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ADDI
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ADDIC
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ADDICR
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ADDIS
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ADDME
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ADDZE
IU1, 19, 19, 0, 0, 0, 0, 0, // PC_DIVW
IU1, 19, 19, 0, 0, 0, 0, 0, // PC_DIVWU
IU1, 5, 5, 0, 0, 0, 0, 0, // PC_MULHW
IU1, 6, 5, 0, 0, 0, 0, 0, // PC_MULHWU
IU1, 3, 3, 0, 0, 0, 0, 0, // PC_MULLI
IU1, 5, 5, 0, 0, 0, 0, 0, // PC_MULLW
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_NEG
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SUBF
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFC
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFE
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFIC
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFME
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFZE
IU2, 3, 1, 0, 0, 0, 0, 0, // PC_CMPI
IU2, 3, 1, 0, 0, 0, 0, 0, // PC_CMP
IU2, 3, 1, 0, 0, 0, 0, 0, // PC_CMPLI
IU2, 3, 1, 0, 0, 0, 0, 0, // PC_CMPL
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ANDI
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ANDIS
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ORI
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ORIS
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_XORI
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_XORIS
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_AND
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_OR
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_XOR
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_NAND
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_NOR
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_EQV
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ANDC
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ORC
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_EXTSB
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_EXTSH
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_CNTLZW
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_RLWINM
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_RLWNM
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_RLWIMI
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SLW
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SRW
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SRAWI
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_SRAW
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_CRAND
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_CRANDC
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_CREQV
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_CRNAND
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_CRNOR
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_CROR
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_CRORC
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_CRXOR
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_MCRF
SRU, 2, 2, 0, 0, 0, 1, 0, // PC_MTXER
SRU, 2, 2, 0, 0, 0, 1, 0, // PC_MTCTR
SRU, 2, 2, 0, 0, 0, 1, 0, // PC_MTLR
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_MTCRF
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_MTMSR
SRU, 2, 2, 0, 0, 0, 1, 0, // PC_MTSPR
SRU, 1, 1, 0, 0, 0, 0, 0, // PC_MFMSR
SRU, 3, 3, 0, 0, 0, 1, 0, // PC_MFSPR
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_MFXER
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_MFCTR
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_MFLR
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_MFCR
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_MFFS
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_MTFSF
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_EIEIO
SRU, 2, 2, 0, 0, 0, 1, 0, // PC_ISYNC
SRU, 3, 3, 0, 0, 0, 1, 0, // PC_SYNC
SRU, 2, 2, 0, 0, 0, 1, 0, // PC_RFI
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_LI
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_LIS
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_MR
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_NOP
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_NOT
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LFS
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LFSU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LFSX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LFSUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LFD
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LFDU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LFDX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LFDUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STFS
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STFSU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STFSX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STFSUX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STFD
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STFDU
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STFDX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STFDUX
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FMR
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FABS
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FNEG
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FNABS
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FADD
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FADDS
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FSUB
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FSUBS
FPU1, 4, 2, 1, 1, 0, 0, 0, // PC_FMUL
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FMULS
FPU1, 31, 31, 0, 0, 0, 0, 0, // PC_FDIV
FPU1, 17, 17, 0, 0, 0, 0, 0, // PC_FDIVS
FPU1, 4, 2, 1, 1, 0, 0, 0, // PC_FMADD
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FMADDS
FPU1, 4, 2, 1, 1, 0, 0, 0, // PC_FMSUB
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FMSUBS
FPU1, 4, 2, 1, 1, 0, 0, 0, // PC_FNMADD
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FNMADDS
FPU1, 4, 2, 1, 1, 0, 0, 0, // PC_FNMSUB
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FNMSUBS
FPU1, 10, 10, 0, 0, 0, 0, 0, // PC_FRES
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FRSQRTE
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FSEL
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FRSP
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FCTIW
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FCTIWZ
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FCMPU
FPU1, 3, 1, 1, 1, 0, 0, 0, // PC_FCMPO
LSU1, 2, 1, 1, 0, 0, 1, 0, // PC_LWARX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LSWI
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LSWX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STFIWX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STSWI
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STSWX
LSU1, 2, 1, 1, 0, 0, 1, 0, // PC_STWCX
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ECIWX
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ECOWX
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_DCBI
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ICBI
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_MCRFS
SRU, 1, 1, 0, 0, 0, 1, 0, // PC_MCRXR
SRU, 1, 1, 0, 0, 0, 0, 0, // PC_MFTB
SRU, 3, 3, 0, 0, 0, 0, 0, // PC_MFSR
SRU, 2, 2, 0, 0, 0, 1, 0, // PC_MTSR
SRU, 3, 3, 0, 0, 0, 0, 0, // PC_MFSRIN
SRU, 2, 2, 0, 0, 0, 1, 0, // PC_MTSRIN
FPU1, 1, 1, 0, 0, 0, 0, 0, // PC_MTFSB0
FPU1, 1, 1, 0, 0, 0, 0, 0, // PC_MTFSB1
FPU1, 1, 1, 0, 0, 0, 0, 0, // PC_MTFSFI
SRU, 2, 2, 0, 0, 0, 1, 0, // PC_SC
FPU1, 1, 1, 0, 0, 0, 0, 0, // PC_FSQRT
FPU1, 1, 1, 0, 0, 0, 0, 0, // PC_FSQRTS
LSU1, 1, 1, 0, 0, 0, 0, 0, // PC_TLBIA
LSU1, 1, 1, 0, 0, 0, 0, 0, // PC_TLBIE
LSU1, 1, 1, 0, 0, 0, 0, 0, // PC_TLBLD
LSU1, 1, 1, 0, 0, 0, 0, 0, // PC_TLBLI
LSU1, 1, 1, 0, 0, 0, 1, 0, // PC_TLBSYNC
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_TW
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_TRAP
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_TWI
IU2, 1, 1, 0, 0, 0, 1, 0, // PC_OPWORD
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_MFROM
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_DSA
IU2, 1, 1, 0, 0, 0, 0, 0, // PC_ESA
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_DCCCI
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_DCREAD
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_ICBT
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_ICCCI
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_ICREAD
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_RFCI
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_TLBRE
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_TLBSX
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_TLBWE
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_WRTEE
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_WRTEEI
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_MFDCR
IU2, 1, 0, 0, 0, 0, 0, 0, // PC_MTDCR
LSU1, 3, 1, 2, 0, 0, 0, 0, // PC_DCBA
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_DSS
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_DSSALL
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_DST
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_DSTT
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_DSTST
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_DSTSTT
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LVEBX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LVEHX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LVEWX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LVSL
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LVSR
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LVX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_LVXL
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STVEBX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STVEHX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STVEWX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STVX
LSU1, 2, 1, 1, 0, 0, 0, 0, // PC_STVXL
VSIU, 1, 1, 0, 0, 0, 1, 0, // PC_MFVSCR
VSIU, 1, 1, 0, 0, 0, 1, 0, // PC_MTVSCR
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDCUW
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VADDFP
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDSBS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDSHS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDSWS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUBM
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUBS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUHM
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUHS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUWM
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUWS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VAND
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VANDC
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGSB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGSH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGSW
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGUB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGUH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGUW
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VCFSX
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VCFUX
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VCMPBFP
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VCMPEQFP
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPEQUB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPEQUH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPEQUW
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VCMPGEFP
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VCMPGTFP
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTSB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTSH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTSW
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTUB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTUH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTUW
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VCTSXS
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VCTUXS
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VEXPTEFP
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VLOGEFP
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VMAXFP
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXSB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXSH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXSW
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXUB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXUH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXUW
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VMINFP
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMINSB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMINSH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMINSW
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMINUB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMINUH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMINUW
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VMRGHB
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VMRGHH
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VMRGHW
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VMRGLB
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VMRGLH
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VMRGLW
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMULESB
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMULESH
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMULEUB
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMULEUH
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMULOSB
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMULOSH
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMULOUB
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMULOUH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VNOR
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VOR
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPKPX
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPKSHSS
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPKSHUS
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPKSWSS
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPKSWUS
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPKUHUM
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPKUHUS
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPKUWUM
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPKUWUS
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VREFP
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VRFIM
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VRFIN
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VRFIP
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VRFIZ
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VRLB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VRLH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VRLW
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VRSQRTEFP
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSL
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSLB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSLH
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VSLO
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSLW
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VSPLTB
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VSPLTH
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VSPLTW
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VSPLTISB
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VSPLTISH
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VSPLTISW
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSR
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSRAB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSRAH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSRAW
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSRB
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSRH
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VSRO
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSRW
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBCUW
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VSUBFP
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBSBS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBSHS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBSWS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUBM
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUBS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUHM
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUHS
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUWM
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUWS
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VSUMSWS
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VSUM2SWS
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VSUM4SBS
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VSUM4SHS
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VSUM4UBS
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VUPKHPX
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VUPKHSB
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VUPKHSH
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VUPKLPX
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VUPKLSB
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VUPKLSH
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VXOR
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VMADDFP
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMHADDSHS
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMHRADDSHS
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMLADDUHM
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMSUMMBM
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMSUMSHM
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMSUMSHS
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMSUMUBM
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMSUMUHM
VCIU1, 3, 1, 1, 1, 0, 0, 0, // PC_VMSUMUHS
VFPU1, 4, 1, 1, 1, 1, 0, 0, // PC_VNMSUBFP
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VPERM
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VSEL
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VSLDOI
VSIU, 1, 1, 0, 0, 0, 0, 0, // PC_VMR
VPU, 1, 1, 0, 0, 0, 0, 0, // PC_VMRP
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SLE
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SLEQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SLIQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SLLIQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SLLQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SLQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SRAIQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SRAQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SRE
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SREA
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SREQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SRIQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SRLIQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SRLQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_SRQ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_MASKG
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_MASKIR
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_LSCBX
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_DIV
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_DIVS
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_DOZ
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_MUL
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_NABS
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_ABS
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_CLCS
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_DOZI
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_RLMI
BPU, 0, 0, 0, 0, 0, 0, 0, // PC_RRIB
};
static void advance(int firstStage, int oldStage, int newStage) {
PCode *instr = pipeline[oldStage].instr;
int cycles = instruction_timing[instr->op].cycles[newStage - firstStage];
pipeline[newStage].instr = instr;
pipeline[newStage].remaining = cycles;
pipeline[oldStage].instr = NULL;
}
static void assign_completion_buffer(PCode *instr) {
completionbuffers.used++;
completionbuffers.free--;
completionbuffers.entries[completionbuffers.nextFreeSlot].instr = instr;
completionbuffers.entries[completionbuffers.nextFreeSlot].completed = 0;
completionbuffers.nextFreeSlot = (completionbuffers.nextFreeSlot + 1) % MaxEntries;
}
static void complete_instruction(int stage) {
PCode *instr = pipeline[stage].instr;
int buf = 0;
while (buf < MaxEntries && completionbuffers.entries[buf].instr != instr)
buf++;
completionbuffers.entries[buf].completed = 1;
pipeline[stage].instr = NULL;
if (stage == IU1)
iu1_completed_instruction = instr;
else if (stage == IU2)
iu2_completed_instruction = instr;
}
static void retire_instruction(void) {
completionbuffers.entries[completionbuffers.nextToRetire].instr = NULL;
completionbuffers.used--;
completionbuffers.free++;
completionbuffers.nextToRetire = (completionbuffers.nextToRetire + 1) % MaxEntries;
}
static int latency(PCode *instr) {
int cycles = instruction_timing[instr->op].latency;
if (PCODE_FLAG_SET_F(instr) & fRecordBit)
cycles += 2;
if (instr->op == PC_LMW || instr->op == PC_STMW)
cycles += instr->argCount - 2;
return cycles;
}
static void initialize(void) {
int stage;
int i;
for (stage = 0; stage < NumStages; stage++)
pipeline[stage].instr = NULL;
completionbuffers.free = MaxEntries;
completionbuffers.used = 0;
completionbuffers.nextToRetire = 0;
completionbuffers.nextFreeSlot = 0;
for (i = 0; i < MaxEntries; i++)
completionbuffers.entries[i].instr = NULL;
iu1_completed_instruction = NULL;
iu2_completed_instruction = NULL;
}
static int can_issue(PCode *instr) {
int stage;
if (completionbuffers.free == 0)
return 0;
stage = instruction_timing[instr->op].stage;
if (stage == IU2) {
PCode *check;
int isClear1 = !pipeline[IU1].instr;
int isClear2 = !pipeline[IU2].instr;
if (!isClear1 && !isClear2)
return 0;
if (isClear1 && isClear2)
return 1;
if (isClear1)
check = pipeline[IU2].instr;
else
check = pipeline[IU1].instr;
if (is_dependent(instr, check, RegClass_GPR))
return 0;
if (is_dependent(instr, iu1_completed_instruction, RegClass_GPR))
return 0;
if (is_dependent(instr, iu2_completed_instruction, RegClass_GPR))
return 0;
} else if (stage == VFPU1 || stage == VCIU1 || stage == VSIU || stage == VPU) {
PCode *check;
int isVpuClear = !pipeline[VPU].instr;
int isVFpuClear = !pipeline[VFPU1].instr;
int isVCiuClear = !pipeline[VCIU1].instr;
int isVSiuClear = !pipeline[VSIU].instr;
if (stage == VPU) {
if (!isVpuClear)
return 0;
if (!isVFpuClear)
check = pipeline[VFPU1].instr;
else if (!isVCiuClear)
check = pipeline[VCIU1].instr;
else if (!isVSiuClear)
check = pipeline[VSIU].instr;
else
check = NULL;
if (is_dependent(instr, check, RegClass_VR))
return 0;
} else {
if (!isVFpuClear || !isVCiuClear || !isVSiuClear)
return 0;
if (!isVpuClear && is_dependent(instr, pipeline[VPU].instr, RegClass_VR))
return 0;
}
} else {
if (pipeline[stage].instr)
return 0;
}
if ((instr->flags & fIsWrite) && pipeline[LSU2].instr && (pipeline[LSU2].instr->flags & fIsWrite))
return 0;
return 1;
}
static void issue(PCode *instr) {
int stage = instruction_timing[instr->op].stage;
int cycles = instruction_timing[instr->op].cycles[0];
assign_completion_buffer(instr);
if (stage == IU2 && !pipeline[IU1].instr)
stage = IU1;
pipeline[stage].instr = instr;
pipeline[stage].remaining = cycles;
}
static void advance_clock(void) {
int stage;
iu1_completed_instruction = NULL;
iu2_completed_instruction = NULL;
for (stage = 0; stage < NumStages; stage++) {
if (pipeline[stage].instr && pipeline[stage].remaining)
--pipeline[stage].remaining;
}
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
}
}
if (pipeline[IU1].instr && pipeline[IU1].remaining == 0)
complete_instruction(IU1);
if (pipeline[VPU].instr && pipeline[VPU].remaining == 0)
complete_instruction(VPU);
if (pipeline[LSU2].instr && pipeline[LSU2].remaining == 0)
complete_instruction(LSU2);
if (pipeline[FPU3].instr && pipeline[FPU3].remaining == 0)
complete_instruction(FPU3);
if (pipeline[SRU].instr && pipeline[SRU].remaining == 0)
complete_instruction(SRU);
if (pipeline[BPU].instr && pipeline[BPU].remaining == 0)
complete_instruction(BPU);
if (pipeline[VSIU].instr && pipeline[VSIU].remaining == 0)
complete_instruction(VSIU);
if (pipeline[VCIU3].instr && pipeline[VCIU3].remaining == 0)
complete_instruction(VCIU3);
if (pipeline[VFPU4].instr && pipeline[VFPU4].remaining == 0)
complete_instruction(VFPU4);
if (pipeline[IU2].instr && pipeline[IU2].remaining == 0)
complete_instruction(IU2);
if (
pipeline[FPU1].instr &&
pipeline[FPU1].remaining == 0 &&
(pipeline[FPU1].instr->op == PC_FDIV || pipeline[FPU1].instr->op == PC_FDIVS)
)
complete_instruction(FPU1);
if (pipeline[FPU2].instr && pipeline[FPU2].remaining == 0 && !pipeline[FPU3].instr)
advance(FPU1, FPU2, FPU3);
if (pipeline[FPU1].instr && pipeline[FPU1].remaining == 0 && !pipeline[FPU2].instr)
advance(FPU1, FPU1, FPU2);
if (pipeline[LSU1].instr && pipeline[LSU1].remaining == 0 && !pipeline[LSU2].instr)
advance(LSU1, LSU1, LSU2);
if (pipeline[VCIU2].instr && pipeline[VCIU2].remaining == 0 && !pipeline[VCIU3].instr)
advance(VCIU1, VCIU2, VCIU3);
if (pipeline[VCIU1].instr && pipeline[VCIU1].remaining == 0 && !pipeline[VCIU2].instr)
advance(VCIU1, VCIU1, VCIU2);
if (pipeline[VFPU3].instr && pipeline[VFPU3].remaining == 0 && !pipeline[VFPU4].instr)
advance(VFPU1, VFPU3, VFPU4);
if (pipeline[VFPU2].instr && pipeline[VFPU2].remaining == 0 && !pipeline[VFPU3].instr)
advance(VFPU1, VFPU2, VFPU3);
if (pipeline[VFPU1].instr && pipeline[VFPU1].remaining == 0 && !pipeline[VFPU2].instr)
advance(VFPU1, VFPU1, VFPU2);
}
static int serializes(PCode *instr) {
return instruction_timing[instr->op].serializes;
}
static int uses_vpermute_unit_7400(PCode *instr) {
return instruction_timing[instr->op].stage == VPU;
}
MachineInfo machine7400 = {
2,
1,
0,
&latency,
&initialize,
&can_issue,
&issue,
&advance_clock,
&serializes,
&uses_vpermute_unit_7400
};

View File

@ -0,0 +1,678 @@
#include "compiler/Scheduler.h"
#include "compiler/PCode.h"
#include "compiler/PCodeInfo.h"
// https://www.nxp.com/docs/en/reference-manual/MPC750UM.pdf
typedef enum Stage {
BPU, // Branch Prediction Unit
IU1, // Integer Unit 1
IU2, // Integer Unit 2
LSU1, // Load/Store Unit
LSU2,
FPU1, // Floating Point Unit
FPU2,
FPU3,
SRU, // System Register Unit
NumStages
} Stage;
static struct {
// the instruction currently in this pipeline stage
PCode *instr;
// how many cycles are left for this instruction to finish
int remaining;
} pipeline[NumStages];
static PCode *iu1_completed_instruction;
static PCode *iu2_completed_instruction;
enum {
MaxEntries = 6
};
static struct {
// how many entries remain unused in the queue
unsigned int free;
// how many entries are currently used in the queue
unsigned int used;
// the index of the next instruction that will be retired
unsigned int nextToRetire;
// the index of the next free slot that will be used when an instruction is dispatched
unsigned int nextFreeSlot;
// circular array of entries in the completion queue
struct {
PCode *instr;
int completed;
} entries[MaxEntries];
} completionbuffers;
static struct {
// the initial stage for this instruction
Stage stage;
// the total amount of cycles required by this instruction
char latency;
// how long it takes to finish each stage
char cycles[3];
// does this instruction serialise?
char serializes;
} instruction_timing[OPCODE_MAX] = {
BPU, 0, 0, 0, 0, 1, // PC_B
BPU, 0, 0, 0, 0, 1, // PC_BL
BPU, 0, 0, 0, 0, 1, // PC_BC
BPU, 0, 0, 0, 0, 1, // PC_BCLR
BPU, 0, 0, 0, 0, 1, // PC_BCCTR
BPU, 0, 0, 0, 0, 1, // PC_BT
BPU, 0, 0, 0, 0, 1, // PC_BTLR
BPU, 0, 0, 0, 0, 1, // PC_BTCTR
BPU, 0, 0, 0, 0, 1, // PC_BF
BPU, 0, 0, 0, 0, 1, // PC_BFLR
BPU, 0, 0, 0, 0, 1, // PC_BFCTR
BPU, 0, 0, 0, 0, 1, // PC_BDNZ
BPU, 0, 0, 0, 0, 1, // PC_BDNZT
BPU, 0, 0, 0, 0, 1, // PC_BDNZF
BPU, 0, 0, 0, 0, 1, // PC_BDZ
BPU, 0, 0, 0, 0, 1, // PC_BDZT
BPU, 0, 0, 0, 0, 1, // PC_BDZF
BPU, 0, 0, 0, 0, 1, // PC_BLR
BPU, 0, 0, 0, 0, 1, // PC_BCTR
BPU, 0, 0, 0, 0, 1, // PC_BCTRL
BPU, 0, 0, 0, 0, 1, // PC_BLRL
LSU1, 2, 1, 1, 0, 0, // PC_LBZ
LSU1, 2, 1, 1, 0, 0, // PC_LBZU
LSU1, 2, 1, 1, 0, 0, // PC_LBZX
LSU1, 2, 1, 1, 0, 0, // PC_LBZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHZ
LSU1, 2, 1, 1, 0, 0, // PC_LHZU
LSU1, 2, 1, 1, 0, 0, // PC_LHZX
LSU1, 2, 1, 1, 0, 0, // PC_LHZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHA
LSU1, 2, 1, 1, 0, 0, // PC_LHAU
LSU1, 2, 1, 1, 0, 0, // PC_LHAX
LSU1, 2, 1, 1, 0, 0, // PC_LHAUX
LSU1, 2, 1, 1, 0, 0, // PC_LHBRX
LSU1, 2, 1, 1, 0, 0, // PC_LWZ
LSU1, 2, 1, 1, 0, 0, // PC_LWZU
LSU1, 2, 1, 1, 0, 0, // PC_LWZX
LSU1, 2, 1, 1, 0, 0, // PC_LWZUX
LSU1, 2, 1, 1, 0, 0, // PC_LWBRX
LSU1, 2, 1, 1, 0, 0, // PC_LMW
LSU1, 2, 1, 1, 0, 0, // PC_STB
LSU1, 2, 1, 1, 0, 0, // PC_STBU
LSU1, 2, 1, 1, 0, 0, // PC_STBX
LSU1, 2, 1, 1, 0, 0, // PC_STBUX
LSU1, 2, 1, 1, 0, 0, // PC_STH
LSU1, 2, 1, 1, 0, 0, // PC_STHU
LSU1, 2, 1, 1, 0, 0, // PC_STHX
LSU1, 2, 1, 1, 0, 0, // PC_STHUX
LSU1, 2, 1, 1, 0, 0, // PC_STHBRX
LSU1, 2, 1, 1, 0, 0, // PC_STW
LSU1, 2, 1, 1, 0, 0, // PC_STWU
LSU1, 2, 1, 1, 0, 0, // PC_STWX
LSU1, 2, 1, 1, 0, 0, // PC_STWUX
LSU1, 2, 1, 1, 0, 0, // PC_STWBRX
LSU1, 2, 1, 1, 0, 0, // PC_STMW
LSU1, 3, 1, 2, 0, 0, // PC_DCBF
LSU1, 3, 1, 2, 0, 0, // PC_DCBST
LSU1, 2, 1, 1, 0, 0, // PC_DCBT
LSU1, 2, 1, 1, 0, 0, // PC_DCBTST
LSU1, 3, 1, 2, 0, 0, // PC_DCBZ
IU2, 1, 1, 0, 0, 0, // PC_ADD
IU2, 1, 1, 0, 0, 0, // PC_ADDC
IU2, 1, 1, 0, 0, 0, // PC_ADDE
IU2, 1, 1, 0, 0, 0, // PC_ADDI
IU2, 1, 1, 0, 0, 0, // PC_ADDIC
IU2, 1, 1, 0, 0, 0, // PC_ADDICR
IU2, 1, 1, 0, 0, 0, // PC_ADDIS
IU2, 1, 1, 0, 0, 0, // PC_ADDME
IU2, 1, 1, 0, 0, 0, // PC_ADDZE
IU1, 19, 19, 0, 0, 0, // PC_DIVW
IU1, 19, 19, 0, 0, 0, // PC_DIVWU
IU1, 5, 5, 0, 0, 0, // PC_MULHW
IU1, 6, 5, 0, 0, 0, // PC_MULHWU
IU1, 3, 3, 0, 0, 0, // PC_MULLI
IU1, 5, 5, 0, 0, 0, // PC_MULLW
IU2, 1, 1, 0, 0, 0, // PC_NEG
IU2, 1, 1, 0, 0, 0, // PC_SUBF
IU2, 1, 1, 0, 0, 0, // PC_SUBFC
IU2, 1, 1, 0, 0, 0, // PC_SUBFE
IU2, 1, 1, 0, 0, 0, // PC_SUBFIC
IU2, 1, 1, 0, 0, 0, // PC_SUBFME
IU2, 1, 1, 0, 0, 0, // PC_SUBFZE
IU2, 3, 1, 0, 0, 0, // PC_CMPI
IU2, 3, 1, 0, 0, 0, // PC_CMP
IU2, 3, 1, 0, 0, 0, // PC_CMPLI
IU2, 3, 1, 0, 0, 0, // PC_CMPL
IU2, 1, 1, 0, 0, 0, // PC_ANDI
IU2, 1, 1, 0, 0, 0, // PC_ANDIS
IU2, 1, 1, 0, 0, 0, // PC_ORI
IU2, 1, 1, 0, 0, 0, // PC_ORIS
IU2, 1, 1, 0, 0, 0, // PC_XORI
IU2, 1, 1, 0, 0, 0, // PC_XORIS
IU2, 1, 1, 0, 0, 0, // PC_AND
IU2, 1, 1, 0, 0, 0, // PC_OR
IU2, 1, 1, 0, 0, 0, // PC_XOR
IU2, 1, 1, 0, 0, 0, // PC_NAND
IU2, 1, 1, 0, 0, 0, // PC_NOR
IU2, 1, 1, 0, 0, 0, // PC_EQV
IU2, 1, 1, 0, 0, 0, // PC_ANDC
IU2, 1, 1, 0, 0, 0, // PC_ORC
IU2, 1, 1, 0, 0, 0, // PC_EXTSB
IU2, 1, 1, 0, 0, 0, // PC_EXTSH
IU2, 1, 1, 0, 0, 0, // PC_CNTLZW
IU2, 1, 1, 0, 0, 0, // PC_RLWINM
IU2, 1, 1, 0, 0, 0, // PC_RLWNM
IU2, 1, 1, 0, 0, 0, // PC_RLWIMI
IU2, 1, 1, 0, 0, 0, // PC_SLW
IU2, 1, 1, 0, 0, 0, // PC_SRW
IU2, 1, 1, 0, 0, 0, // PC_SRAWI
IU2, 1, 1, 0, 0, 0, // PC_SRAW
SRU, 1, 1, 0, 0, 1, // PC_CRAND
SRU, 1, 1, 0, 0, 1, // PC_CRANDC
SRU, 1, 1, 0, 0, 1, // PC_CREQV
SRU, 1, 1, 0, 0, 1, // PC_CRNAND
SRU, 1, 1, 0, 0, 1, // PC_CRNOR
SRU, 1, 1, 0, 0, 1, // PC_CROR
SRU, 1, 1, 0, 0, 1, // PC_CRORC
SRU, 1, 1, 0, 0, 1, // PC_CRXOR
SRU, 1, 1, 0, 0, 1, // PC_MCRF
SRU, 2, 2, 0, 0, 1, // PC_MTXER
SRU, 2, 2, 0, 0, 1, // PC_MTCTR
SRU, 2, 2, 0, 0, 1, // PC_MTLR
SRU, 1, 1, 0, 0, 1, // PC_MTCRF
SRU, 1, 1, 0, 0, 0, // PC_MTMSR
SRU, 1, 1, 0, 0, 1, // PC_MTSPR
SRU, 1, 1, 0, 0, 1, // PC_MFMSR
SRU, 1, 1, 0, 0, 1, // PC_MFSPR
SRU, 1, 1, 0, 0, 1, // PC_MFXER
SRU, 1, 1, 0, 0, 1, // PC_MFCTR
SRU, 1, 1, 0, 0, 1, // PC_MFLR
SRU, 1, 1, 0, 0, 1, // PC_MFCR
FPU1, 3, 1, 1, 1, 0, // PC_MFFS
FPU1, 3, 1, 1, 1, 0, // PC_MTFSF
SRU, 1, 1, 0, 0, 1, // PC_EIEIO
SRU, 2, 2, 0, 0, 1, // PC_ISYNC
SRU, 3, 3, 0, 0, 1, // PC_SYNC
SRU, 1, 1, 0, 0, 1, // PC_RFI
IU2, 1, 1, 0, 0, 0, // PC_LI
IU2, 1, 1, 0, 0, 0, // PC_LIS
IU2, 1, 1, 0, 0, 0, // PC_MR
IU2, 1, 1, 0, 0, 0, // PC_NOP
IU2, 1, 1, 0, 0, 0, // PC_NOT
LSU1, 2, 1, 1, 0, 0, // PC_LFS
LSU1, 2, 1, 1, 0, 0, // PC_LFSU
LSU1, 2, 1, 1, 0, 0, // PC_LFSX
LSU1, 2, 1, 1, 0, 0, // PC_LFSUX
LSU1, 2, 1, 1, 0, 0, // PC_LFD
LSU1, 2, 1, 1, 0, 0, // PC_LFDU
LSU1, 2, 1, 1, 0, 0, // PC_LFDX
LSU1, 2, 1, 1, 0, 0, // PC_LFDUX
LSU1, 2, 1, 1, 0, 0, // PC_STFS
LSU1, 2, 1, 1, 0, 0, // PC_STFSU
LSU1, 2, 1, 1, 0, 0, // PC_STFSX
LSU1, 2, 1, 1, 0, 0, // PC_STFSUX
LSU1, 2, 1, 1, 0, 0, // PC_STFD
LSU1, 2, 1, 1, 0, 0, // PC_STFDU
LSU1, 2, 1, 1, 0, 0, // PC_STFDX
LSU1, 2, 1, 1, 0, 0, // PC_STFDUX
FPU1, 3, 1, 1, 1, 0, // PC_FMR
FPU1, 3, 1, 1, 1, 0, // PC_FABS
FPU1, 3, 1, 1, 1, 0, // PC_FNEG
FPU1, 3, 1, 1, 1, 0, // PC_FNABS
FPU1, 3, 1, 1, 1, 0, // PC_FADD
FPU1, 3, 1, 1, 1, 0, // PC_FADDS
FPU1, 3, 1, 1, 1, 0, // PC_FSUB
FPU1, 3, 1, 1, 1, 0, // PC_FSUBS
FPU1, 4, 2, 1, 1, 0, // PC_FMUL
FPU1, 3, 1, 1, 1, 0, // PC_FMULS
FPU1, 31, 31, 0, 0, 0, // PC_FDIV
FPU1, 17, 17, 0, 0, 0, // PC_FDIVS
FPU1, 4, 2, 1, 1, 0, // PC_FMADD
FPU1, 3, 1, 1, 1, 0, // PC_FMADDS
FPU1, 4, 2, 1, 1, 0, // PC_FMSUB
FPU1, 3, 1, 1, 1, 0, // PC_FMSUBS
FPU1, 4, 2, 1, 1, 0, // PC_FNMADD
FPU1, 3, 1, 1, 1, 0, // PC_FNMADDS
FPU1, 4, 2, 1, 1, 0, // PC_FNMSUB
FPU1, 3, 1, 1, 1, 0, // PC_FNMSUBS
FPU1, 10, 10, 0, 0, 0, // PC_FRES
FPU1, 3, 1, 1, 1, 0, // PC_FRSQRTE
FPU1, 3, 1, 1, 1, 0, // PC_FSEL
FPU1, 3, 1, 1, 1, 0, // PC_FRSP
FPU1, 3, 1, 1, 1, 0, // PC_FCTIW
FPU1, 3, 1, 1, 1, 0, // PC_FCTIWZ
FPU1, 3, 1, 1, 1, 0, // PC_FCMPU
FPU1, 3, 1, 1, 1, 0, // PC_FCMPO
LSU1, 1, 1, 0, 0, 0, // PC_LWARX
LSU1, 1, 1, 0, 0, 0, // PC_LSWI
LSU1, 1, 1, 0, 0, 0, // PC_LSWX
LSU1, 1, 1, 0, 0, 0, // PC_STFIWX
LSU1, 1, 1, 0, 0, 0, // PC_STSWI
LSU1, 1, 1, 0, 0, 0, // PC_STSWX
LSU1, 1, 1, 0, 0, 0, // PC_STWCX
IU1, 1, 1, 0, 0, 1, // PC_ECIWX
IU1, 1, 1, 0, 0, 1, // PC_ECOWX
IU1, 1, 1, 0, 0, 0, // PC_DCBI
IU1, 1, 1, 0, 0, 0, // PC_ICBI
IU1, 1, 1, 0, 0, 0, // PC_MCRFS
IU1, 1, 1, 0, 0, 0, // PC_MCRXR
IU1, 1, 1, 0, 0, 0, // PC_MFTB
IU1, 1, 1, 0, 0, 0, // PC_MFSR
IU1, 1, 1, 0, 0, 0, // PC_MTSR
IU1, 1, 1, 0, 0, 0, // PC_MFSRIN
IU1, 1, 1, 0, 0, 0, // PC_MTSRIN
IU1, 1, 1, 0, 0, 0, // PC_MTFSB0
IU1, 1, 1, 0, 0, 0, // PC_MTFSB1
IU1, 1, 1, 0, 0, 0, // PC_MTFSFI
IU1, 1, 1, 0, 0, 1, // PC_SC
FPU1, 1, 1, 0, 0, 0, // PC_FSQRT
FPU1, 1, 1, 0, 0, 0, // PC_FSQRTS
IU1, 1, 1, 0, 0, 0, // PC_TLBIA
IU1, 1, 1, 0, 0, 0, // PC_TLBIE
IU1, 1, 1, 0, 0, 0, // PC_TLBLD
IU1, 1, 1, 0, 0, 0, // PC_TLBLI
IU1, 1, 1, 0, 0, 0, // PC_TLBSYNC
IU1, 1, 1, 0, 0, 1, // PC_TW
IU1, 1, 1, 0, 0, 1, // PC_TRAP
IU1, 1, 1, 0, 0, 1, // PC_TWI
IU1, 1, 1, 0, 0, 1, // PC_OPWORD
IU1, 1, 1, 0, 0, 0, // PC_MFROM
IU1, 1, 1, 0, 0, 1, // PC_DSA
IU1, 1, 1, 0, 0, 1, // PC_ESA
IU1, 0, 0, 0, 0, 0, // PC_DCCCI
IU1, 0, 0, 0, 0, 0, // PC_DCREAD
IU1, 0, 0, 0, 0, 0, // PC_ICBT
IU1, 0, 0, 0, 0, 0, // PC_ICCCI
IU1, 0, 0, 0, 0, 0, // PC_ICREAD
IU1, 0, 0, 0, 0, 0, // PC_RFCI
IU1, 0, 0, 0, 0, 0, // PC_TLBRE
IU1, 0, 0, 0, 0, 0, // PC_TLBSX
IU1, 0, 0, 0, 0, 0, // PC_TLBWE
IU1, 0, 0, 0, 0, 0, // PC_WRTEE
IU1, 0, 0, 0, 0, 0, // PC_WRTEEI
IU1, 0, 0, 0, 0, 0, // PC_MFDCR
IU1, 0, 0, 0, 0, 0, // PC_MTDCR
IU1, 0, 0, 0, 0, 0, // PC_DCBA
BPU, 0, 0, 0, 0, 0, // PC_DSS
BPU, 0, 0, 0, 0, 0, // PC_DSSALL
BPU, 0, 0, 0, 0, 0, // PC_DST
BPU, 0, 0, 0, 0, 0, // PC_DSTT
BPU, 0, 0, 0, 0, 0, // PC_DSTST
BPU, 0, 0, 0, 0, 0, // PC_DSTSTT
BPU, 0, 0, 0, 0, 0, // PC_LVEBX
BPU, 0, 0, 0, 0, 0, // PC_LVEHX
BPU, 0, 0, 0, 0, 0, // PC_LVEWX
BPU, 0, 0, 0, 0, 0, // PC_LVSL
BPU, 0, 0, 0, 0, 0, // PC_LVSR
BPU, 0, 0, 0, 0, 0, // PC_LVX
BPU, 0, 0, 0, 0, 0, // PC_LVXL
BPU, 0, 0, 0, 0, 0, // PC_STVEBX
BPU, 0, 0, 0, 0, 0, // PC_STVEHX
BPU, 0, 0, 0, 0, 0, // PC_STVEWX
BPU, 0, 0, 0, 0, 0, // PC_STVX
BPU, 0, 0, 0, 0, 0, // PC_STVXL
BPU, 0, 0, 0, 0, 0, // PC_MFVSCR
BPU, 0, 0, 0, 0, 0, // PC_MTVSCR
BPU, 0, 0, 0, 0, 0, // PC_VADDCUW
BPU, 0, 0, 0, 0, 0, // PC_VADDFP
BPU, 0, 0, 0, 0, 0, // PC_VADDSBS
BPU, 0, 0, 0, 0, 0, // PC_VADDSHS
BPU, 0, 0, 0, 0, 0, // PC_VADDSWS
BPU, 0, 0, 0, 0, 0, // PC_VADDUBM
BPU, 0, 0, 0, 0, 0, // PC_VADDUBS
BPU, 0, 0, 0, 0, 0, // PC_VADDUHM
BPU, 0, 0, 0, 0, 0, // PC_VADDUHS
BPU, 0, 0, 0, 0, 0, // PC_VADDUWM
BPU, 0, 0, 0, 0, 0, // PC_VADDUWS
BPU, 0, 0, 0, 0, 0, // PC_VAND
BPU, 0, 0, 0, 0, 0, // PC_VANDC
BPU, 0, 0, 0, 0, 0, // PC_VAVGSB
BPU, 0, 0, 0, 0, 0, // PC_VAVGSH
BPU, 0, 0, 0, 0, 0, // PC_VAVGSW
BPU, 0, 0, 0, 0, 0, // PC_VAVGUB
BPU, 0, 0, 0, 0, 0, // PC_VAVGUH
BPU, 0, 0, 0, 0, 0, // PC_VAVGUW
BPU, 0, 0, 0, 0, 0, // PC_VCFSX
BPU, 0, 0, 0, 0, 0, // PC_VCFUX
BPU, 0, 0, 0, 0, 0, // PC_VCMPBFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQUB
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQUH
BPU, 0, 0, 0, 0, 0, // PC_VCMPEQUW
BPU, 0, 0, 0, 0, 0, // PC_VCMPGEFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTFP
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTSB
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTSH
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTSW
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTUB
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTUH
BPU, 0, 0, 0, 0, 0, // PC_VCMPGTUW
BPU, 0, 0, 0, 0, 0, // PC_VCTSXS
BPU, 0, 0, 0, 0, 0, // PC_VCTUXS
BPU, 0, 0, 0, 0, 0, // PC_VEXPTEFP
BPU, 0, 0, 0, 0, 0, // PC_VLOGEFP
BPU, 0, 0, 0, 0, 0, // PC_VMAXFP
BPU, 0, 0, 0, 0, 0, // PC_VMAXSB
BPU, 0, 0, 0, 0, 0, // PC_VMAXSH
BPU, 0, 0, 0, 0, 0, // PC_VMAXSW
BPU, 0, 0, 0, 0, 0, // PC_VMAXUB
BPU, 0, 0, 0, 0, 0, // PC_VMAXUH
BPU, 0, 0, 0, 0, 0, // PC_VMAXUW
BPU, 0, 0, 0, 0, 0, // PC_VMINFP
BPU, 0, 0, 0, 0, 0, // PC_VMINSB
BPU, 0, 0, 0, 0, 0, // PC_VMINSH
BPU, 0, 0, 0, 0, 0, // PC_VMINSW
BPU, 0, 0, 0, 0, 0, // PC_VMINUB
BPU, 0, 0, 0, 0, 0, // PC_VMINUH
BPU, 0, 0, 0, 0, 0, // PC_VMINUW
BPU, 0, 0, 0, 0, 0, // PC_VMRGHB
BPU, 0, 0, 0, 0, 0, // PC_VMRGHH
BPU, 0, 0, 0, 0, 0, // PC_VMRGHW
BPU, 0, 0, 0, 0, 0, // PC_VMRGLB
BPU, 0, 0, 0, 0, 0, // PC_VMRGLH
BPU, 0, 0, 0, 0, 0, // PC_VMRGLW
BPU, 0, 0, 0, 0, 0, // PC_VMULESB
BPU, 0, 0, 0, 0, 0, // PC_VMULESH
BPU, 0, 0, 0, 0, 0, // PC_VMULEUB
BPU, 0, 0, 0, 0, 0, // PC_VMULEUH
BPU, 0, 0, 0, 0, 0, // PC_VMULOSB
BPU, 0, 0, 0, 0, 0, // PC_VMULOSH
BPU, 0, 0, 0, 0, 0, // PC_VMULOUB
BPU, 0, 0, 0, 0, 0, // PC_VMULOUH
BPU, 0, 0, 0, 0, 0, // PC_VNOR
BPU, 0, 0, 0, 0, 0, // PC_VOR
BPU, 0, 0, 0, 0, 0, // PC_VPKPX
BPU, 0, 0, 0, 0, 0, // PC_VPKSHSS
BPU, 0, 0, 0, 0, 0, // PC_VPKSHUS
BPU, 0, 0, 0, 0, 0, // PC_VPKSWSS
BPU, 0, 0, 0, 0, 0, // PC_VPKSWUS
BPU, 0, 0, 0, 0, 0, // PC_VPKUHUM
BPU, 0, 0, 0, 0, 0, // PC_VPKUHUS
BPU, 0, 0, 0, 0, 0, // PC_VPKUWUM
BPU, 0, 0, 0, 0, 0, // PC_VPKUWUS
BPU, 0, 0, 0, 0, 0, // PC_VREFP
BPU, 0, 0, 0, 0, 0, // PC_VRFIM
BPU, 0, 0, 0, 0, 0, // PC_VRFIN
BPU, 0, 0, 0, 0, 0, // PC_VRFIP
BPU, 0, 0, 0, 0, 0, // PC_VRFIZ
BPU, 0, 0, 0, 0, 0, // PC_VRLB
BPU, 0, 0, 0, 0, 0, // PC_VRLH
BPU, 0, 0, 0, 0, 0, // PC_VRLW
BPU, 0, 0, 0, 0, 0, // PC_VRSQRTEFP
BPU, 0, 0, 0, 0, 0, // PC_VSL
BPU, 0, 0, 0, 0, 0, // PC_VSLB
BPU, 0, 0, 0, 0, 0, // PC_VSLH
BPU, 0, 0, 0, 0, 0, // PC_VSLO
BPU, 0, 0, 0, 0, 0, // PC_VSLW
BPU, 0, 0, 0, 0, 0, // PC_VSPLTB
BPU, 0, 0, 0, 0, 0, // PC_VSPLTH
BPU, 0, 0, 0, 0, 0, // PC_VSPLTW
BPU, 0, 0, 0, 0, 0, // PC_VSPLTISB
BPU, 0, 0, 0, 0, 0, // PC_VSPLTISH
BPU, 0, 0, 0, 0, 0, // PC_VSPLTISW
BPU, 0, 0, 0, 0, 0, // PC_VSR
BPU, 0, 0, 0, 0, 0, // PC_VSRAB
BPU, 0, 0, 0, 0, 0, // PC_VSRAH
BPU, 0, 0, 0, 0, 0, // PC_VSRAW
BPU, 0, 0, 0, 0, 0, // PC_VSRB
BPU, 0, 0, 0, 0, 0, // PC_VSRH
BPU, 0, 0, 0, 0, 0, // PC_VSRO
BPU, 0, 0, 0, 0, 0, // PC_VSRW
BPU, 0, 0, 0, 0, 0, // PC_VSUBCUW
BPU, 0, 0, 0, 0, 0, // PC_VSUBFP
BPU, 0, 0, 0, 0, 0, // PC_VSUBSBS
BPU, 0, 0, 0, 0, 0, // PC_VSUBSHS
BPU, 0, 0, 0, 0, 0, // PC_VSUBSWS
BPU, 0, 0, 0, 0, 0, // PC_VSUBUBM
BPU, 0, 0, 0, 0, 0, // PC_VSUBUBS
BPU, 0, 0, 0, 0, 0, // PC_VSUBUHM
BPU, 0, 0, 0, 0, 0, // PC_VSUBUHS
BPU, 0, 0, 0, 0, 0, // PC_VSUBUWM
BPU, 0, 0, 0, 0, 0, // PC_VSUBUWS
BPU, 0, 0, 0, 0, 0, // PC_VSUMSWS
BPU, 0, 0, 0, 0, 0, // PC_VSUM2SWS
BPU, 0, 0, 0, 0, 0, // PC_VSUM4SBS
BPU, 0, 0, 0, 0, 0, // PC_VSUM4SHS
BPU, 0, 0, 0, 0, 0, // PC_VSUM4UBS
BPU, 0, 0, 0, 0, 0, // PC_VUPKHPX
BPU, 0, 0, 0, 0, 0, // PC_VUPKHSB
BPU, 0, 0, 0, 0, 0, // PC_VUPKHSH
BPU, 0, 0, 0, 0, 0, // PC_VUPKLPX
BPU, 0, 0, 0, 0, 0, // PC_VUPKLSB
BPU, 0, 0, 0, 0, 0, // PC_VUPKLSH
BPU, 0, 0, 0, 0, 0, // PC_VXOR
BPU, 0, 0, 0, 0, 0, // PC_VMADDFP
BPU, 0, 0, 0, 0, 0, // PC_VMHADDSHS
BPU, 0, 0, 0, 0, 0, // PC_VMHRADDSHS
BPU, 0, 0, 0, 0, 0, // PC_VMLADDUHM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMMBM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMSHM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMSHS
BPU, 0, 0, 0, 0, 0, // PC_VMSUMUBM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMUHM
BPU, 0, 0, 0, 0, 0, // PC_VMSUMUHS
BPU, 0, 0, 0, 0, 0, // PC_VNMSUBFP
BPU, 0, 0, 0, 0, 0, // PC_VPERM
BPU, 0, 0, 0, 0, 0, // PC_VSEL
BPU, 0, 0, 0, 0, 0, // PC_VSLDOI
BPU, 0, 0, 0, 0, 0, // PC_VMR
BPU, 0, 0, 0, 0, 0, // PC_VMRP
BPU, 0, 0, 0, 0, 0, // PC_SLE
BPU, 0, 0, 0, 0, 0, // PC_SLEQ
BPU, 0, 0, 0, 0, 0, // PC_SLIQ
BPU, 0, 0, 0, 0, 0, // PC_SLLIQ
BPU, 0, 0, 0, 0, 0, // PC_SLLQ
BPU, 0, 0, 0, 0, 0, // PC_SLQ
BPU, 0, 0, 0, 0, 0, // PC_SRAIQ
BPU, 0, 0, 0, 0, 0, // PC_SRAQ
BPU, 0, 0, 0, 0, 0, // PC_SRE
BPU, 0, 0, 0, 0, 0, // PC_SREA
BPU, 0, 0, 0, 0, 0, // PC_SREQ
BPU, 0, 0, 0, 0, 0, // PC_SRIQ
BPU, 0, 0, 0, 0, 0, // PC_SRLIQ
BPU, 0, 0, 0, 0, 0, // PC_SRLQ
BPU, 0, 0, 0, 0, 0, // PC_SRQ
BPU, 0, 0, 0, 0, 0, // PC_MASKG
BPU, 0, 0, 0, 0, 0, // PC_MASKIR
BPU, 0, 0, 0, 0, 0, // PC_LSCBX
BPU, 0, 0, 0, 0, 0, // PC_DIV
BPU, 0, 0, 0, 0, 0, // PC_DIVS
BPU, 0, 0, 0, 0, 0, // PC_DOZ
BPU, 0, 0, 0, 0, 0, // PC_MUL
BPU, 0, 0, 0, 0, 0, // PC_NABS
BPU, 0, 0, 0, 0, 0, // PC_ABS
BPU, 0, 0, 0, 0, 0, // PC_CLCS
BPU, 0, 0, 0, 0, 0, // PC_DOZI
BPU, 0, 0, 0, 0, 0, // PC_RLMI
BPU, 0, 0, 0, 0, 0, // PC_RRIB
};
static void advance(int firstStage, int oldStage, int newStage) {
PCode *instr = pipeline[oldStage].instr;
int cycles = instruction_timing[instr->op].cycles[newStage - firstStage];
pipeline[newStage].instr = instr;
pipeline[newStage].remaining = cycles;
pipeline[oldStage].instr = NULL;
}
static void assign_completion_buffer(PCode *instr) {
completionbuffers.used++;
completionbuffers.free--;
completionbuffers.entries[completionbuffers.nextFreeSlot].instr = instr;
completionbuffers.entries[completionbuffers.nextFreeSlot].completed = 0;
completionbuffers.nextFreeSlot = (completionbuffers.nextFreeSlot + 1) % MaxEntries;
}
static void complete_instruction(int stage) {
PCode *instr = pipeline[stage].instr;
int buf = 0;
while (buf < MaxEntries && completionbuffers.entries[buf].instr != instr)
buf++;
completionbuffers.entries[buf].completed = 1;
pipeline[stage].instr = NULL;
if (stage == IU1)
iu1_completed_instruction = instr;
else if (stage == IU2)
iu2_completed_instruction = instr;
}
static void retire_instruction(void) {
completionbuffers.entries[completionbuffers.nextToRetire].instr = NULL;
completionbuffers.used--;
completionbuffers.free++;
completionbuffers.nextToRetire = (completionbuffers.nextToRetire + 1) % MaxEntries;
}
static int latency(PCode *instr) {
int cycles = instruction_timing[instr->op].latency;
if (PCODE_FLAG_SET_F(instr) & fRecordBit)
cycles += 2;
if (instr->op == PC_LMW || instr->op == PC_STMW)
cycles += instr->argCount - 2;
return cycles;
}
static void initialize(void) {
int stage;
int i;
for (stage = 0; stage < NumStages; stage++)
pipeline[stage].instr = NULL;
completionbuffers.free = MaxEntries;
completionbuffers.used = 0;
completionbuffers.nextToRetire = 0;
completionbuffers.nextFreeSlot = 0;
for (i = 0; i < MaxEntries; i++)
completionbuffers.entries[i].instr = NULL;
iu1_completed_instruction = NULL;
iu2_completed_instruction = NULL;
}
static int can_issue(PCode *instr) {
int stage;
if (completionbuffers.free == 0)
return 0;
stage = instruction_timing[instr->op].stage;
if (stage == IU2) {
PCode *check;
int isClear1 = !pipeline[IU1].instr;
int isClear2 = !pipeline[IU2].instr;
if (!isClear1 && !isClear2)
return 0;
if (isClear1 && isClear2)
return 1;
if (isClear1)
check = pipeline[IU2].instr;
else
check = pipeline[IU1].instr;
if (is_dependent(instr, check, RegClass_GPR))
return 0;
if (is_dependent(instr, iu1_completed_instruction, RegClass_GPR))
return 0;
if (is_dependent(instr, iu2_completed_instruction, RegClass_GPR))
return 0;
} else {
if (pipeline[stage].instr)
return 0;
}
if ((instr->flags & fIsWrite) && pipeline[LSU2].instr && (pipeline[LSU2].instr->flags & fIsWrite))
return 0;
return 1;
}
static void issue(PCode *instr) {
int stage = instruction_timing[instr->op].stage;
int cycles = instruction_timing[instr->op].cycles[0];
assign_completion_buffer(instr);
if (stage == IU2 && !pipeline[IU1].instr)
stage = IU1;
pipeline[stage].instr = instr;
pipeline[stage].remaining = cycles;
}
static void advance_clock(void) {
int stage;
iu1_completed_instruction = NULL;
iu2_completed_instruction = NULL;
for (stage = 0; stage < NumStages; stage++) {
if (pipeline[stage].instr && pipeline[stage].remaining)
--pipeline[stage].remaining;
}
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
}
}
if (pipeline[IU1].instr && pipeline[IU1].remaining == 0)
complete_instruction(IU1);
if (pipeline[LSU2].instr && pipeline[LSU2].remaining == 0)
complete_instruction(LSU2);
if (pipeline[FPU3].instr && pipeline[FPU3].remaining == 0)
complete_instruction(FPU3);
if (pipeline[SRU].instr && pipeline[SRU].remaining == 0)
complete_instruction(SRU);
if (pipeline[BPU].instr && pipeline[BPU].remaining == 0)
complete_instruction(BPU);
if (pipeline[IU2].instr && pipeline[IU2].remaining == 0)
complete_instruction(IU2);
if (
pipeline[FPU1].instr &&
pipeline[FPU1].remaining == 0 &&
(pipeline[FPU1].instr->op == PC_FDIV || pipeline[FPU1].instr->op == PC_FDIVS)
)
complete_instruction(FPU1);
if (pipeline[FPU2].instr && pipeline[FPU2].remaining == 0 && !pipeline[FPU3].instr)
advance(FPU1, FPU2, FPU3);
if (pipeline[FPU1].instr && pipeline[FPU1].remaining == 0 && !pipeline[FPU2].instr)
advance(FPU1, FPU1, FPU2);
if (pipeline[LSU1].instr && pipeline[LSU1].remaining == 0 && !pipeline[LSU2].instr)
advance(LSU1, LSU1, LSU2);
}
static int serializes(PCode *instr) {
return instruction_timing[instr->op].serializes;
}
MachineInfo machine750 = {
2,
1,
0,
&latency,
&initialize,
&can_issue,
&issue,
&advance_clock,
&serializes,
&default_uses_vpermute_unit
};

View File

@ -0,0 +1,615 @@
#include "compiler/Scheduler.h"
#include "compiler/PCode.h"
#include "compiler/PCodeInfo.h"
// https://www.nxp.com/docs/en/user-guide/MPC821UM.pdf
typedef enum Stage {
BranchUnit,
Stage1,
Stage2,
LSU1,
LSU2,
CRUnit,
NumStages,
Stage7
} Stage;
static struct {
// the instruction currently in this pipeline stage
PCode *instr;
// how many cycles are left for this instruction to finish
int remaining;
} pipeline[NumStages];
enum {
MaxEntries = 6
};
static struct {
// how many entries remain unused in the queue
unsigned int free;
// how many entries are currently used in the queue
unsigned int used;
// the index of the next instruction that will be retired
unsigned int nextToRetire;
// the index of the next free slot that will be used when an instruction is dispatched
unsigned int nextFreeSlot;
// circular array of entries in the completion queue
struct {
PCode *instr;
int completed;
} entries[MaxEntries];
} completionbuffers;
static struct {
// the initial stage for this instruction
Stage stage;
// the total amount of cycles required by this instruction
char latency;
// how long it takes to finish each stage
char cycles[3];
// does this instruction serialise?
char serializes;
} instruction_timing[OPCODE_MAX] = {
BranchUnit, 0, 0, 0, 0, 0, // PC_B
BranchUnit, 0, 0, 0, 0, 0, // PC_BL
BranchUnit, 0, 0, 0, 0, 0, // PC_BC
BranchUnit, 0, 0, 0, 0, 0, // PC_BCLR
BranchUnit, 0, 0, 0, 0, 0, // PC_BCCTR
BranchUnit, 0, 0, 0, 0, 0, // PC_BT
BranchUnit, 0, 0, 0, 0, 0, // PC_BTLR
BranchUnit, 0, 0, 0, 0, 0, // PC_BTCTR
BranchUnit, 0, 0, 0, 0, 0, // PC_BF
BranchUnit, 0, 0, 0, 0, 0, // PC_BFLR
BranchUnit, 0, 0, 0, 0, 0, // PC_BFCTR
BranchUnit, 0, 0, 0, 0, 0, // PC_BDNZ
BranchUnit, 0, 0, 0, 0, 0, // PC_BDNZT
BranchUnit, 0, 0, 0, 0, 0, // PC_BDNZF
BranchUnit, 0, 0, 0, 0, 0, // PC_BDZ
BranchUnit, 0, 0, 0, 0, 0, // PC_BDZT
BranchUnit, 0, 0, 0, 0, 0, // PC_BDZF
BranchUnit, 0, 0, 0, 0, 0, // PC_BLR
BranchUnit, 0, 0, 0, 0, 0, // PC_BCTR
BranchUnit, 0, 0, 0, 0, 0, // PC_BCTRL
BranchUnit, 0, 0, 0, 0, 0, // PC_BLRL
BranchUnit, 0, 0, 0, 0, 0, // PC_LBZ
LSU1, 2, 1, 1, 0, 0, // PC_LBZU
LSU1, 2, 1, 1, 0, 0, // PC_LBZX
LSU1, 2, 1, 1, 0, 0, // PC_LBZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHZ
LSU1, 2, 1, 1, 0, 0, // PC_LHZU
LSU1, 2, 1, 1, 0, 0, // PC_LHZX
LSU1, 2, 1, 1, 0, 0, // PC_LHZUX
LSU1, 2, 1, 1, 0, 0, // PC_LHA
LSU1, 2, 1, 1, 0, 0, // PC_LHAU
LSU1, 2, 1, 1, 0, 0, // PC_LHAX
LSU1, 2, 1, 1, 0, 0, // PC_LHAUX
LSU1, 2, 1, 1, 0, 0, // PC_LHBRX
LSU1, 2, 1, 1, 0, 0, // PC_LWZ
LSU1, 2, 1, 1, 0, 0, // PC_LWZU
LSU1, 2, 1, 1, 0, 0, // PC_LWZX
LSU1, 2, 1, 1, 0, 0, // PC_LWZUX
LSU1, 2, 1, 1, 0, 0, // PC_LWBRX
LSU1, 2, 1, 1, 0, 0, // PC_LMW
LSU1, 2, 1, 1, 0, 0, // PC_STB
LSU1, 2, 1, 1, 0, 0, // PC_STBU
LSU1, 2, 1, 1, 0, 0, // PC_STBX
LSU1, 2, 1, 1, 0, 0, // PC_STBUX
LSU1, 2, 1, 1, 0, 0, // PC_STH
LSU1, 2, 1, 1, 0, 0, // PC_STHU
LSU1, 2, 1, 1, 0, 0, // PC_STHX
LSU1, 2, 1, 1, 0, 0, // PC_STHUX
LSU1, 2, 1, 1, 0, 0, // PC_STHBRX
LSU1, 2, 1, 1, 0, 0, // PC_STW
LSU1, 2, 1, 1, 0, 0, // PC_STWU
LSU1, 2, 1, 1, 0, 0, // PC_STWX
LSU1, 2, 1, 1, 0, 0, // PC_STWUX
LSU1, 2, 1, 1, 0, 0, // PC_STWBRX
LSU1, 2, 1, 1, 0, 0, // PC_STMW
LSU1, 2, 1, 1, 0, 0, // PC_DCBF
LSU1, 2, 1, 1, 0, 0, // PC_DCBST
LSU1, 2, 1, 1, 0, 0, // PC_DCBT
LSU1, 2, 1, 1, 0, 0, // PC_DCBTST
LSU1, 2, 1, 1, 0, 0, // PC_DCBZ
LSU1, 2, 1, 1, 0, 0, // PC_ADD
Stage1, 1, 1, 0, 0, 0, // PC_ADDC
Stage1, 1, 1, 0, 0, 0, // PC_ADDE
Stage1, 1, 1, 0, 0, 0, // PC_ADDI
Stage1, 1, 1, 0, 0, 0, // PC_ADDIC
Stage1, 1, 1, 0, 0, 0, // PC_ADDICR
Stage1, 1, 1, 0, 0, 0, // PC_ADDIS
Stage1, 1, 1, 0, 0, 0, // PC_ADDME
Stage1, 1, 1, 0, 0, 0, // PC_ADDZE
Stage1, 1, 1, 0, 0, 0, // PC_DIVW
Stage1, 37, 37, 0, 0, 0, // PC_DIVWU
Stage1, 37, 37, 0, 0, 0, // PC_MULHW
Stage1, 5, 5, 0, 0, 0, // PC_MULHWU
Stage1, 5, 5, 0, 0, 0, // PC_MULLI
Stage1, 3, 3, 0, 0, 0, // PC_MULLW
Stage1, 5, 5, 0, 0, 0, // PC_NEG
Stage1, 1, 1, 0, 0, 0, // PC_SUBF
Stage1, 1, 1, 0, 0, 0, // PC_SUBFC
Stage1, 1, 1, 0, 0, 0, // PC_SUBFE
Stage1, 1, 1, 0, 0, 0, // PC_SUBFIC
Stage1, 1, 1, 0, 0, 0, // PC_SUBFME
Stage1, 1, 1, 0, 0, 0, // PC_SUBFZE
Stage1, 1, 1, 0, 0, 0, // PC_CMPI
Stage1, 3, 1, 0, 0, 0, // PC_CMP
Stage1, 3, 1, 0, 0, 0, // PC_CMPLI
Stage1, 3, 1, 0, 0, 0, // PC_CMPL
Stage1, 3, 1, 0, 0, 0, // PC_ANDI
Stage1, 1, 1, 0, 0, 0, // PC_ANDIS
Stage1, 1, 1, 0, 0, 0, // PC_ORI
Stage1, 1, 1, 0, 0, 0, // PC_ORIS
Stage1, 1, 1, 0, 0, 0, // PC_XORI
Stage1, 1, 1, 0, 0, 0, // PC_XORIS
Stage1, 1, 1, 0, 0, 0, // PC_AND
Stage1, 1, 1, 0, 0, 0, // PC_OR
Stage1, 1, 1, 0, 0, 0, // PC_XOR
Stage1, 1, 1, 0, 0, 0, // PC_NAND
Stage1, 1, 1, 0, 0, 0, // PC_NOR
Stage1, 1, 1, 0, 0, 0, // PC_EQV
Stage1, 1, 1, 0, 0, 0, // PC_ANDC
Stage1, 1, 1, 0, 0, 0, // PC_ORC
Stage1, 1, 1, 0, 0, 0, // PC_EXTSB
Stage1, 1, 1, 0, 0, 0, // PC_EXTSH
Stage1, 1, 1, 0, 0, 0, // PC_CNTLZW
Stage1, 1, 1, 0, 0, 0, // PC_RLWINM
Stage1, 1, 1, 0, 0, 0, // PC_RLWNM
Stage1, 1, 1, 0, 0, 0, // PC_RLWIMI
Stage1, 1, 1, 0, 0, 0, // PC_SLW
Stage1, 1, 1, 0, 0, 0, // PC_SRW
Stage1, 1, 1, 0, 0, 0, // PC_SRAWI
Stage1, 1, 1, 0, 0, 0, // PC_SRAW
Stage1, 1, 1, 0, 0, 0, // PC_CRAND
CRUnit, 1, 1, 0, 0, 0, // PC_CRANDC
CRUnit, 1, 1, 0, 0, 0, // PC_CREQV
CRUnit, 1, 1, 0, 0, 0, // PC_CRNAND
CRUnit, 1, 1, 0, 0, 0, // PC_CRNOR
CRUnit, 1, 1, 0, 0, 0, // PC_CROR
CRUnit, 1, 1, 0, 0, 0, // PC_CRORC
CRUnit, 1, 1, 0, 0, 0, // PC_CRXOR
CRUnit, 1, 1, 0, 0, 0, // PC_MCRF
CRUnit, 1, 1, 0, 0, 0, // PC_MTXER
Stage1, 1, 1, 0, 0, 0, // PC_MTCTR
BranchUnit, 2, 2, 0, 0, 0, // PC_MTLR
BranchUnit, 2, 2, 0, 0, 0, // PC_MTCRF
Stage1, 1, 1, 0, 0, 0, // PC_MTMSR
Stage1, 1, 1, 0, 0, 0, // PC_MTSPR
Stage1, 1, 1, 0, 0, 0, // PC_MFMSR
Stage1, 1, 1, 0, 0, 0, // PC_MFSPR
Stage1, 1, 1, 0, 0, 0, // PC_MFXER
Stage7, 3, 1, 1, 1, 0, // PC_MFCTR
Stage7, 3, 1, 1, 1, 0, // PC_MFLR
Stage1, 1, 1, 0, 0, 0, // PC_MFCR
Stage1, 1, 1, 0, 0, 0, // PC_MFFS
Stage1, 1, 1, 0, 0, 0, // PC_MTFSF
Stage1, 1, 1, 0, 0, 0, // PC_EIEIO
Stage1, 1, 1, 0, 0, 0, // PC_ISYNC
Stage1, 1, 1, 0, 0, 0, // PC_SYNC
Stage1, 1, 1, 0, 0, 0, // PC_RFI
Stage1, 1, 1, 0, 0, 0, // PC_LI
LSU1, 2, 1, 1, 0, 0, // PC_LIS
LSU1, 2, 1, 1, 0, 0, // PC_MR
LSU1, 2, 1, 1, 0, 0, // PC_NOP
LSU1, 2, 1, 1, 0, 0, // PC_NOT
LSU1, 2, 1, 1, 0, 0, // PC_LFS
LSU1, 2, 1, 1, 0, 0, // PC_LFSU
LSU1, 2, 1, 1, 0, 0, // PC_LFSX
LSU1, 2, 1, 1, 0, 0, // PC_LFSUX
LSU1, 2, 1, 1, 0, 0, // PC_LFD
LSU1, 2, 1, 1, 0, 0, // PC_LFDU
LSU1, 2, 1, 1, 0, 0, // PC_LFDX
LSU1, 2, 1, 1, 0, 0, // PC_LFDUX
LSU1, 2, 1, 1, 0, 0, // PC_STFS
LSU1, 2, 1, 1, 0, 0, // PC_STFSU
LSU1, 2, 1, 1, 0, 0, // PC_STFSX
LSU1, 2, 1, 1, 0, 0, // PC_STFSUX
Stage7, 3, 1, 1, 1, 0, // PC_STFD
Stage7, 3, 1, 1, 1, 0, // PC_STFDU
Stage7, 3, 1, 1, 1, 0, // PC_STFDX
Stage7, 3, 1, 1, 1, 0, // PC_STFDUX
Stage7, 3, 1, 1, 1, 0, // PC_FMR
Stage7, 3, 1, 1, 1, 0, // PC_FABS
Stage7, 3, 1, 1, 1, 0, // PC_FNEG
Stage7, 3, 1, 1, 1, 0, // PC_FNABS
Stage7, 4, 2, 1, 1, 0, // PC_FADD
Stage7, 3, 1, 1, 1, 0, // PC_FADDS
Stage7, 33, 33, 0, 0, 0, // PC_FSUB
Stage7, 18, 18, 0, 0, 0, // PC_FSUBS
Stage7, 4, 2, 1, 1, 0, // PC_FMUL
Stage7, 3, 1, 1, 1, 0, // PC_FMULS
Stage7, 4, 2, 1, 1, 0, // PC_FDIV
Stage7, 3, 1, 1, 1, 0, // PC_FDIVS
Stage7, 4, 2, 1, 1, 0, // PC_FMADD
Stage7, 3, 1, 1, 1, 0, // PC_FMADDS
Stage7, 4, 2, 1, 1, 0, // PC_FMSUB
Stage7, 3, 1, 1, 1, 0, // PC_FMSUBS
Stage7, 18, 18, 0, 0, 0, // PC_FNMADD
Stage7, 3, 1, 1, 1, 0, // PC_FNMADDS
Stage7, 3, 1, 1, 1, 0, // PC_FNMSUB
Stage7, 3, 1, 1, 1, 0, // PC_FNMSUBS
Stage7, 3, 1, 1, 1, 0, // PC_FRES
Stage7, 3, 1, 1, 1, 0, // PC_FRSQRTE
Stage7, 5, 1, 1, 1, 0, // PC_FSEL
Stage7, 5, 1, 1, 1, 0, // PC_FRSP
LSU1, 1, 0, 0, 0, 0, // PC_FCTIW
LSU1, 1, 0, 0, 0, 0, // PC_FCTIWZ
LSU1, 1, 0, 0, 0, 0, // PC_FCMPU
LSU1, 1, 0, 0, 0, 0, // PC_FCMPO
LSU1, 1, 0, 0, 0, 0, // PC_LWARX
LSU1, 1, 0, 0, 0, 0, // PC_LSWI
LSU1, 1, 0, 0, 0, 0, // PC_LSWX
Stage1, 1, 0, 0, 0, 0, // PC_STFIWX
Stage1, 1, 0, 0, 0, 0, // PC_STSWI
Stage1, 1, 0, 0, 0, 0, // PC_STSWX
Stage1, 1, 0, 0, 0, 0, // PC_STWCX
Stage1, 1, 0, 0, 0, 0, // PC_ECIWX
Stage1, 1, 0, 0, 0, 0, // PC_ECOWX
Stage1, 1, 0, 0, 0, 0, // PC_DCBI
Stage1, 1, 0, 0, 0, 0, // PC_ICBI
Stage1, 1, 0, 0, 0, 0, // PC_MCRFS
Stage1, 1, 0, 0, 0, 0, // PC_MCRXR
Stage1, 1, 0, 0, 0, 0, // PC_MFTB
Stage1, 1, 0, 0, 0, 0, // PC_MFSR
Stage1, 1, 0, 0, 0, 0, // PC_MTSR
Stage1, 1, 0, 0, 0, 0, // PC_MFSRIN
Stage1, 1, 0, 0, 0, 0, // PC_MTSRIN
Stage1, 1, 0, 0, 0, 0, // PC_MTFSB0
Stage1, 1, 0, 0, 0, 0, // PC_MTFSB1
Stage1, 1, 0, 0, 0, 0, // PC_MTFSFI
Stage1, 1, 0, 0, 0, 1, // PC_SC
Stage1, 1, 0, 0, 0, 1, // PC_FSQRT
Stage1, 1, 0, 0, 0, 0, // PC_FSQRTS
Stage1, 1, 0, 0, 0, 0, // PC_TLBIA
Stage1, 1, 0, 0, 0, 0, // PC_TLBIE
Stage1, 1, 0, 0, 0, 0, // PC_TLBLD
Stage1, 1, 0, 0, 0, 0, // PC_TLBLI
Stage1, 1, 0, 0, 0, 0, // PC_TLBSYNC
Stage1, 1, 0, 0, 0, 0, // PC_TW
Stage1, 1, 0, 0, 0, 1, // PC_TRAP
Stage1, 1, 0, 0, 0, 1, // PC_TWI
Stage1, 1, 0, 0, 0, 1, // PC_OPWORD
Stage1, 1, 0, 0, 0, 1, // PC_MFROM
Stage1, 1, 0, 0, 0, 0, // PC_DSA
Stage1, 1, 0, 0, 0, 0, // PC_ESA
Stage1, 1, 0, 0, 0, 0, // PC_DCCCI
Stage1, 0, 0, 0, 0, 0, // PC_DCREAD
Stage1, 0, 0, 0, 0, 0, // PC_ICBT
Stage1, 0, 0, 0, 0, 0, // PC_ICCCI
Stage1, 0, 0, 0, 0, 0, // PC_ICREAD
Stage1, 0, 0, 0, 0, 0, // PC_RFCI
Stage1, 0, 0, 0, 0, 0, // PC_TLBRE
Stage1, 0, 0, 0, 0, 0, // PC_TLBSX
Stage1, 0, 0, 0, 0, 0, // PC_TLBWE
Stage1, 0, 0, 0, 0, 0, // PC_WRTEE
Stage1, 0, 0, 0, 0, 0, // PC_WRTEEI
Stage1, 0, 0, 0, 0, 0, // PC_MFDCR
Stage1, 0, 0, 0, 0, 0, // PC_MTDCR
Stage1, 0, 0, 0, 0, 0, // PC_DCBA
Stage1, 0, 0, 0, 0, 0, // PC_DSS
BranchUnit, 0, 0, 0, 0, 0, // PC_DSSALL
BranchUnit, 0, 0, 0, 0, 0, // PC_DST
BranchUnit, 0, 0, 0, 0, 0, // PC_DSTT
BranchUnit, 0, 0, 0, 0, 0, // PC_DSTST
BranchUnit, 0, 0, 0, 0, 0, // PC_DSTSTT
BranchUnit, 0, 0, 0, 0, 0, // PC_LVEBX
BranchUnit, 0, 0, 0, 0, 0, // PC_LVEHX
BranchUnit, 0, 0, 0, 0, 0, // PC_LVEWX
BranchUnit, 0, 0, 0, 0, 0, // PC_LVSL
BranchUnit, 0, 0, 0, 0, 0, // PC_LVSR
BranchUnit, 0, 0, 0, 0, 0, // PC_LVX
BranchUnit, 0, 0, 0, 0, 0, // PC_LVXL
BranchUnit, 0, 0, 0, 0, 0, // PC_STVEBX
BranchUnit, 0, 0, 0, 0, 0, // PC_STVEHX
BranchUnit, 0, 0, 0, 0, 0, // PC_STVEWX
BranchUnit, 0, 0, 0, 0, 0, // PC_STVX
BranchUnit, 0, 0, 0, 0, 0, // PC_STVXL
BranchUnit, 0, 0, 0, 0, 0, // PC_MFVSCR
BranchUnit, 0, 0, 0, 0, 0, // PC_MTVSCR
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDCUW
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDSBS
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDSHS
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDSWS
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDUBM
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDUBS
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDUHM
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDUHS
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDUWM
BranchUnit, 0, 0, 0, 0, 0, // PC_VADDUWS
BranchUnit, 0, 0, 0, 0, 0, // PC_VAND
BranchUnit, 0, 0, 0, 0, 0, // PC_VANDC
BranchUnit, 0, 0, 0, 0, 0, // PC_VAVGSB
BranchUnit, 0, 0, 0, 0, 0, // PC_VAVGSH
BranchUnit, 0, 0, 0, 0, 0, // PC_VAVGSW
BranchUnit, 0, 0, 0, 0, 0, // PC_VAVGUB
BranchUnit, 0, 0, 0, 0, 0, // PC_VAVGUH
BranchUnit, 0, 0, 0, 0, 0, // PC_VAVGUW
BranchUnit, 0, 0, 0, 0, 0, // PC_VCFSX
BranchUnit, 0, 0, 0, 0, 0, // PC_VCFUX
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPBFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPEQFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPEQUB
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPEQUH
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPEQUW
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPGEFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPGTFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPGTSB
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPGTSH
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPGTSW
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPGTUB
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPGTUH
BranchUnit, 0, 0, 0, 0, 0, // PC_VCMPGTUW
BranchUnit, 0, 0, 0, 0, 0, // PC_VCTSXS
BranchUnit, 0, 0, 0, 0, 0, // PC_VCTUXS
BranchUnit, 0, 0, 0, 0, 0, // PC_VEXPTEFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VLOGEFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VMAXFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VMAXSB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMAXSH
BranchUnit, 0, 0, 0, 0, 0, // PC_VMAXSW
BranchUnit, 0, 0, 0, 0, 0, // PC_VMAXUB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMAXUH
BranchUnit, 0, 0, 0, 0, 0, // PC_VMAXUW
BranchUnit, 0, 0, 0, 0, 0, // PC_VMINFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VMINSB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMINSH
BranchUnit, 0, 0, 0, 0, 0, // PC_VMINSW
BranchUnit, 0, 0, 0, 0, 0, // PC_VMINUB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMINUH
BranchUnit, 0, 0, 0, 0, 0, // PC_VMINUW
BranchUnit, 0, 0, 0, 0, 0, // PC_VMRGHB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMRGHH
BranchUnit, 0, 0, 0, 0, 0, // PC_VMRGHW
BranchUnit, 0, 0, 0, 0, 0, // PC_VMRGLB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMRGLH
BranchUnit, 0, 0, 0, 0, 0, // PC_VMRGLW
BranchUnit, 0, 0, 0, 0, 0, // PC_VMULESB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMULESH
BranchUnit, 0, 0, 0, 0, 0, // PC_VMULEUB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMULEUH
BranchUnit, 0, 0, 0, 0, 0, // PC_VMULOSB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMULOSH
BranchUnit, 0, 0, 0, 0, 0, // PC_VMULOUB
BranchUnit, 0, 0, 0, 0, 0, // PC_VMULOUH
BranchUnit, 0, 0, 0, 0, 0, // PC_VNOR
BranchUnit, 0, 0, 0, 0, 0, // PC_VOR
BranchUnit, 0, 0, 0, 0, 0, // PC_VPKPX
BranchUnit, 0, 0, 0, 0, 0, // PC_VPKSHSS
BranchUnit, 0, 0, 0, 0, 0, // PC_VPKSHUS
BranchUnit, 0, 0, 0, 0, 0, // PC_VPKSWSS
BranchUnit, 0, 0, 0, 0, 0, // PC_VPKSWUS
BranchUnit, 0, 0, 0, 0, 0, // PC_VPKUHUM
BranchUnit, 0, 0, 0, 0, 0, // PC_VPKUHUS
BranchUnit, 0, 0, 0, 0, 0, // PC_VPKUWUM
BranchUnit, 0, 0, 0, 0, 0, // PC_VPKUWUS
BranchUnit, 0, 0, 0, 0, 0, // PC_VREFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VRFIM
BranchUnit, 0, 0, 0, 0, 0, // PC_VRFIN
BranchUnit, 0, 0, 0, 0, 0, // PC_VRFIP
BranchUnit, 0, 0, 0, 0, 0, // PC_VRFIZ
BranchUnit, 0, 0, 0, 0, 0, // PC_VRLB
BranchUnit, 0, 0, 0, 0, 0, // PC_VRLH
BranchUnit, 0, 0, 0, 0, 0, // PC_VRLW
BranchUnit, 0, 0, 0, 0, 0, // PC_VRSQRTEFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VSL
BranchUnit, 0, 0, 0, 0, 0, // PC_VSLB
BranchUnit, 0, 0, 0, 0, 0, // PC_VSLH
BranchUnit, 0, 0, 0, 0, 0, // PC_VSLO
BranchUnit, 0, 0, 0, 0, 0, // PC_VSLW
BranchUnit, 0, 0, 0, 0, 0, // PC_VSPLTB
BranchUnit, 0, 0, 0, 0, 0, // PC_VSPLTH
BranchUnit, 0, 0, 0, 0, 0, // PC_VSPLTW
BranchUnit, 0, 0, 0, 0, 0, // PC_VSPLTISB
BranchUnit, 0, 0, 0, 0, 0, // PC_VSPLTISH
BranchUnit, 0, 0, 0, 0, 0, // PC_VSPLTISW
BranchUnit, 0, 0, 0, 0, 0, // PC_VSR
BranchUnit, 0, 0, 0, 0, 0, // PC_VSRAB
BranchUnit, 0, 0, 0, 0, 0, // PC_VSRAH
BranchUnit, 0, 0, 0, 0, 0, // PC_VSRAW
BranchUnit, 0, 0, 0, 0, 0, // PC_VSRB
BranchUnit, 0, 0, 0, 0, 0, // PC_VSRH
BranchUnit, 0, 0, 0, 0, 0, // PC_VSRO
BranchUnit, 0, 0, 0, 0, 0, // PC_VSRW
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBCUW
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBSBS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBSHS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBSWS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBUBM
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBUBS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBUHM
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBUHS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBUWM
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUBUWS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUMSWS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUM2SWS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUM4SBS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUM4SHS
BranchUnit, 0, 0, 0, 0, 0, // PC_VSUM4UBS
BranchUnit, 0, 0, 0, 0, 0, // PC_VUPKHPX
BranchUnit, 0, 0, 0, 0, 0, // PC_VUPKHSB
BranchUnit, 0, 0, 0, 0, 0, // PC_VUPKHSH
BranchUnit, 0, 0, 0, 0, 0, // PC_VUPKLPX
BranchUnit, 0, 0, 0, 0, 0, // PC_VUPKLSB
BranchUnit, 0, 0, 0, 0, 0, // PC_VUPKLSH
BranchUnit, 0, 0, 0, 0, 0, // PC_VXOR
BranchUnit, 0, 0, 0, 0, 0, // PC_VMADDFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VMHADDSHS
BranchUnit, 0, 0, 0, 0, 0, // PC_VMHRADDSHS
BranchUnit, 0, 0, 0, 0, 0, // PC_VMLADDUHM
BranchUnit, 0, 0, 0, 0, 0, // PC_VMSUMMBM
BranchUnit, 0, 0, 0, 0, 0, // PC_VMSUMSHM
BranchUnit, 0, 0, 0, 0, 0, // PC_VMSUMSHS
BranchUnit, 0, 0, 0, 0, 0, // PC_VMSUMUBM
BranchUnit, 0, 0, 0, 0, 0, // PC_VMSUMUHM
BranchUnit, 0, 0, 0, 0, 0, // PC_VMSUMUHS
BranchUnit, 0, 0, 0, 0, 0, // PC_VNMSUBFP
BranchUnit, 0, 0, 0, 0, 0, // PC_VPERM
BranchUnit, 0, 0, 0, 0, 0, // PC_VSEL
BranchUnit, 0, 0, 0, 0, 0, // PC_VSLDOI
BranchUnit, 0, 0, 0, 0, 0, // PC_VMR
BranchUnit, 0, 0, 0, 0, 0, // PC_VMRP
BranchUnit, 0, 0, 0, 0, 0, // PC_SLE
BranchUnit, 0, 0, 0, 0, 0, // PC_SLEQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SLIQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SLLIQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SLLQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SLQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SRAIQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SRAQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SRE
BranchUnit, 0, 0, 0, 0, 0, // PC_SREA
BranchUnit, 0, 0, 0, 0, 0, // PC_SREQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SRIQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SRLIQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SRLQ
BranchUnit, 0, 0, 0, 0, 0, // PC_SRQ
BranchUnit, 0, 0, 0, 0, 0, // PC_MASKG
BranchUnit, 0, 0, 0, 0, 0, // PC_MASKIR
BranchUnit, 0, 0, 0, 0, 0, // PC_LSCBX
BranchUnit, 0, 0, 0, 0, 0, // PC_DIV
BranchUnit, 0, 0, 0, 0, 0, // PC_DIVS
BranchUnit, 0, 0, 0, 0, 0, // PC_DOZ
BranchUnit, 0, 0, 0, 0, 0, // PC_MUL
BranchUnit, 0, 0, 0, 0, 0, // PC_NABS
BranchUnit, 0, 0, 0, 0, 0, // PC_ABS
BranchUnit, 0, 0, 0, 0, 0, // PC_CLCS
BranchUnit, 0, 0, 0, 0, 0, // PC_DOZI
BranchUnit, 0, 0, 0, 0, 0, // PC_RLMI
BranchUnit, 0, 0, 0, 0, 0, // PC_RRIB
};
static void advance(int firstStage, int oldStage, int newStage) {
PCode *instr = pipeline[oldStage].instr;
int cycles = instruction_timing[instr->op].cycles[newStage - firstStage];
pipeline[newStage].instr = instr;
pipeline[newStage].remaining = cycles;
pipeline[oldStage].instr = NULL;
}
static void assign_completion_buffer(PCode *instr) {
completionbuffers.used++;
completionbuffers.free--;
completionbuffers.entries[completionbuffers.nextFreeSlot].instr = instr;
completionbuffers.entries[completionbuffers.nextFreeSlot].completed = 0;
completionbuffers.nextFreeSlot = (completionbuffers.nextFreeSlot + 1) % MaxEntries;
}
static void complete_instruction(int stage) {
PCode *instr = pipeline[stage].instr;
int buf = 0;
while (buf < MaxEntries && completionbuffers.entries[buf].instr != instr)
buf++;
completionbuffers.entries[buf].completed = 1;
pipeline[stage].instr = NULL;
}
static void retire_instruction(void) {
completionbuffers.entries[completionbuffers.nextToRetire].instr = NULL;
completionbuffers.used--;
completionbuffers.free++;
completionbuffers.nextToRetire = (completionbuffers.nextToRetire + 1) % MaxEntries;
}
static int latency(PCode *instr) {
int cycles = instruction_timing[instr->op].latency;
if (PCODE_FLAG_SET_F(instr) & fRecordBit)
cycles += 2;
if (instr->op == PC_LMW || instr->op == PC_STMW)
cycles += instr->argCount - 2;
return cycles;
}
static void initialize(void) {
int stage;
int i;
for (stage = 0; stage < NumStages; stage++)
pipeline[stage].instr = NULL;
completionbuffers.free = MaxEntries;
completionbuffers.used = 0;
completionbuffers.nextToRetire = 0;
completionbuffers.nextFreeSlot = 0;
for (i = 0; i < MaxEntries; i++)
completionbuffers.entries[i].instr = NULL;
}
static int can_issue(PCode *instr) {
int stage;
if (completionbuffers.free == 0)
return 0;
stage = instruction_timing[instr->op].stage;
if (pipeline[stage].instr)
return 0;
if ((instr->flags & fIsWrite) && pipeline[LSU2].instr && (pipeline[LSU2].instr->flags & fIsWrite))
return 0;
return 1;
}
static void issue(PCode *instr) {
int stage = instruction_timing[instr->op].stage;
int cycles = instruction_timing[instr->op].cycles[0];
assign_completion_buffer(instr);
pipeline[stage].instr = instr;
pipeline[stage].remaining = cycles;
}
static void advance_clock(void) {
int stage;
for (stage = 0; stage < NumStages; stage++) {
if (pipeline[stage].instr && pipeline[stage].remaining)
--pipeline[stage].remaining;
}
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
if (completionbuffers.used && completionbuffers.entries[completionbuffers.nextToRetire].completed) {
retire_instruction();
}
}
if (pipeline[Stage1].instr && pipeline[Stage1].remaining == 0)
complete_instruction(Stage1);
if (pipeline[LSU2].instr && pipeline[LSU2].remaining == 0)
complete_instruction(LSU2);
if (pipeline[BranchUnit].instr && pipeline[BranchUnit].remaining == 0)
complete_instruction(BranchUnit);
if (pipeline[LSU1].instr && pipeline[LSU1].remaining == 0 && !pipeline[LSU2].instr)
advance(LSU1, LSU1, LSU2);
}
static int serializes(PCode *instr) {
return instruction_timing[instr->op].serializes;
}
MachineInfo machine821 = {
1,
0,
0,
&latency,
&initialize,
&can_issue,
&issue,
&advance_clock,
&serializes,
&default_uses_vpermute_unit
};

View File

@ -0,0 +1,752 @@
#include "compiler/Scheduler.h"
#include "compiler/CError.h"
#include "compiler/PCode.h"
#include "compiler/PCodeInfo.h"
// https://www.nxp.com/docs/en/reference-manual/MPC7450UM.pdf
typedef enum Stage {
BPU, // Branch Prediction Unit
IU2_1, // Multiple-Cycle Integer Unit
IU2_2,
IU2_3,
IU1a, // Single-Cycle Integer Unit
IU1b, // Single-Cycle Integer Unit
IU1c, // Single-Cycle Integer Unit
LSU_1, // Load/Store Unit
LSU_2,
LSU_3,
LSU_4,
FPU_1, // Floating-Point Unit
FPU_2,
FPU_3,
FPU_4,
VIU1, // Vector Simple Integer Unit
VPU_1, // Vector Permute Unit
VPU_2,
VIU2_1, // Vector Complex Integer Unit
VIU2_2,
VIU2_3,
VIU2_4,
VFPU_1, // Vector Floating-Point Unit
VFPU_2,
VFPU_3,
VFPU_4,
NumStages
} Stage;
static struct {
// the instruction currently in this pipeline stage
PCode *instr;
// how many cycles are left for this instruction to finish
int remaining;
} pipeline_altivec[NumStages];
enum {
Queue0,
Queue1,
Queue2,
Queue3,
Queue4,
Queue5,
Queue6,
Queue7,
NumQueues
};
static int fetchqueues[NumQueues];
enum {
MaxEntries = 16
};
static struct {
// how many entries remain unused in the queue
unsigned int free;
// how many entries are currently used in the queue
unsigned int used;
// the index of the next instruction that will be retired
unsigned int nextToRetire;
// the index of the next free slot that will be used when an instruction is dispatched
unsigned int nextFreeSlot;
// circular array of entries in the completion queue
struct {
PCode *instr;
int completed;
} entries[MaxEntries];
} completionbuffers;
static struct {
short index;
// the initial stage for this instruction
Stage stage;
// the total amount of cycles required by this instruction
char latency;
// how long it takes to finish each stage
char cycles[4];
// does this instruction serialise?
char serializes;
char unused;
} instruction_timing[] = {
0, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_B
1, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BL
2, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BC
3, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BCLR
4, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BCCTR
5, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BT
6, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BTLR
7, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BTCTR
8, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BF
9, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BFLR
10, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BFCTR
11, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDNZ
12, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDNZT
13, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDNZF
14, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDZ
15, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDZT
16, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BDZF
17, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BLR
18, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BCTR
19, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BCTRL
20, BPU, 0, 0, 0, 0, 0, 0, 0, // PC_BLRL
21, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LBZ
22, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LBZU
23, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LBZX
24, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LBZUX
25, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LHZ
26, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LHZU
27, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LHZX
28, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LHZUX
29, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LHA
30, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LHAU
31, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LHAX
32, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LHAUX
33, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LHBRX
34, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LWZ
35, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LWZU
36, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LWZX
37, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LWZUX
38, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LWBRX
39, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_LMW
40, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STB
41, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STBU
42, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STBX
43, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STBUX
44, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STH
45, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STHU
46, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STHX
47, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STHUX
48, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STHBRX
49, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STW
50, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STWU
51, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STWX
52, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STWUX
53, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STWBRX
54, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STMW
55, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_DCBF
56, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_DCBST
57, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DCBT
58, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DCBTST
59, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DCBZ
60, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ADD
61, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ADDC
62, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ADDE
63, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ADDI
64, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ADDIC
65, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ADDICR
66, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ADDIS
67, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ADDME
68, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ADDZE
69, IU2_1, 23, 23, 0, 0, 0, 0, 0, // PC_DIVW
70, IU2_1, 23, 23, 0, 0, 0, 0, 0, // PC_DIVWU
71, IU2_1, 4, 2, 2, 0, 0, 0, 0, // PC_MULHW
72, IU2_1, 4, 2, 2, 0, 0, 0, 0, // PC_MULHWU
73, IU2_1, 3, 1, 1, 1, 0, 0, 0, // PC_MULLI
74, IU2_1, 4, 2, 2, 0, 0, 0, 0, // PC_MULLW
75, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_NEG
76, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_SUBF
77, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFC
78, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFE
79, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFIC
80, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFME
81, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_SUBFZE
82, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_CMPI
83, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_CMP
84, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_CMPLI
85, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_CMPL
86, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ANDI
87, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ANDIS
88, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ORI
89, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ORIS
90, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_XORI
91, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_XORIS
92, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_AND
93, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_OR
94, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_XOR
95, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_NAND
96, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_NOR
97, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_EQV
98, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ANDC
99, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ORC
100, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_EXTSB
101, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_EXTSH
102, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_CNTLZW
103, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_RLWINM
104, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_RLWNM
105, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_RLWIMI
106, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_SLW
107, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_SRW
108, IU1a, 2, 2, 0, 0, 0, 0, 0, // PC_SRAWI
109, IU1a, 2, 2, 0, 0, 0, 0, 0, // PC_SRAW
110, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_CRAND
111, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_CRANDC
112, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_CREQV
113, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_CRNAND
114, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_CRNOR
115, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_CROR
116, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_CRORC
117, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_CRXOR
118, IU2_1, 1, 1, 0, 0, 0, 1, 0, // PC_MCRF
119, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_MTXER
120, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_MTCTR
121, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_MTLR
122, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_MTCRF
123, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_MTMSR
124, IU2_1, 3, 3, 0, 0, 0, 1, 0, // PC_MTSPR
125, IU2_1, 3, 2, 1, 0, 0, 0, 0, // PC_MFMSR
126, IU2_1, 3, 3, 0, 0, 0, 1, 0, // PC_MFSPR
127, IU2_1, 1, 1, 0, 0, 0, 1, 0, // PC_MFXER
128, IU2_1, 1, 1, 0, 0, 0, 1, 0, // PC_MFCTR
129, IU2_1, 1, 1, 0, 0, 0, 1, 0, // PC_MFLR
130, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_MFCR
131, FPU_1, 5, 5, 0, 0, 0, 1, 0, // PC_MFFS
132, FPU_1, 5, 5, 0, 0, 0, 1, 0, // PC_MTFSF
133, LSU_1, 3, 3, 0, 0, 0, 1, 0, // PC_EIEIO
134, IU2_1, 1, 1, 0, 0, 0, 1, 0, // PC_ISYNC
135, LSU_1, 35, 35, 0, 0, 0, 1, 0, // PC_SYNC
136, IU2_1, 1, 1, 0, 0, 0, 1, 0, // PC_RFI
137, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_LI
138, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_LIS
139, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_MR
140, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_NOP
141, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_NOT
142, LSU_1, 4, 1, 1, 1, 1, 0, 0, // PC_LFS
143, LSU_1, 4, 1, 1, 1, 1, 0, 0, // PC_LFSU
144, LSU_1, 4, 1, 1, 1, 1, 0, 0, // PC_LFSX
145, LSU_1, 4, 1, 1, 1, 1, 0, 0, // PC_LFSUX
146, LSU_1, 4, 1, 1, 1, 1, 0, 0, // PC_LFD
147, LSU_1, 4, 1, 1, 1, 1, 0, 0, // PC_LFDU
148, LSU_1, 4, 1, 1, 1, 1, 0, 0, // PC_LFDX
149, LSU_1, 4, 1, 1, 1, 1, 0, 0, // PC_LFDUX
150, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STFS
151, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STFSU
152, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STFSX
153, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STFSUX
154, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STFD
155, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STFDU
156, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STFDX
157, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STFDUX
158, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FMR
159, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FABS
160, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FNEG
161, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FNABS
162, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FADD
163, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FADDS
164, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FSUB
165, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FSUBS
166, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FMUL
167, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FMULS
168, FPU_1, 35, 35, 0, 0, 0, 0, 0, // PC_FDIV
169, FPU_1, 21, 21, 0, 0, 0, 0, 0, // PC_FDIVS
170, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FMADD
171, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FMADDS
172, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FMSUB
173, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FMSUBS
174, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FNMADD
175, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FNMADDS
176, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FNMSUB
177, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FNMSUBS
178, FPU_1, 14, 14, 0, 0, 0, 0, 0, // PC_FRES
179, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FRSQRTE
180, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FSEL
181, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FRSP
182, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FCTIW
183, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FCTIWZ
184, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FCMPU
185, FPU_1, 5, 1, 1, 1, 2, 0, 0, // PC_FCMPO
186, LSU_1, 3, 3, 0, 0, 0, 1, 0, // PC_LWARX
187, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LSWI
188, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_LSWX
189, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STFIWX
190, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STSWI
191, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_STSWX
192, LSU_1, 3, 1, 1, 1, 0, 1, 0, // PC_STWCX
193, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_ECIWX
194, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_ECOWX
195, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_DCBI
196, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_ICBI
197, IU2_1, 5, 5, 0, 0, 0, 1, 0, // PC_MCRFS
198, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_MCRXR
199, IU2_1, 5, 5, 0, 0, 0, 0, 0, // PC_MFTB
200, IU2_1, 4, 1, 3, 0, 0, 0, 0, // PC_MFSR
201, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_MTSR
202, IU2_1, 4, 1, 3, 0, 0, 0, 0, // PC_MFSRIN
203, IU2_1, 2, 2, 0, 0, 0, 1, 0, // PC_MTSRIN
204, FPU_1, 5, 5, 0, 0, 0, 1, 0, // PC_MTFSB0
205, FPU_1, 5, 5, 0, 0, 0, 1, 0, // PC_MTFSB1
206, FPU_1, 5, 5, 0, 0, 0, 0, 0, // PC_MTFSFI
207, IU2_1, 1, 1, 0, 0, 0, 1, 0, // PC_SC
208, FPU_1, 1, 1, 0, 0, 0, 0, 0, // PC_FSQRT
209, FPU_1, 1, 1, 0, 0, 0, 0, 0, // PC_FSQRTS
210, LSU_1, 1, 1, 0, 0, 0, 0, 0, // PC_TLBIA
211, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_TLBIE
212, LSU_1, 3, 3, 0, 0, 0, 0, 0, // PC_TLBLD
213, LSU_1, 3, 3, 0, 0, 0, 1, 0, // PC_TLBLI
214, LSU_1, 3, 3, 0, 0, 0, 1, 0, // PC_TLBSYNC
215, IU1a, 2, 2, 0, 0, 0, 0, 0, // PC_TW
216, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_TRAP
217, IU1a, 2, 2, 0, 0, 0, 0, 0, // PC_TWI
218, IU1a, 1, 1, 0, 0, 0, 1, 0, // PC_OPWORD
219, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_MFROM
220, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_DSA
221, IU1a, 1, 1, 0, 0, 0, 0, 0, // PC_ESA
222, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_DCCCI
223, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_DCREAD
224, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_ICBT
225, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_ICCCI
226, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_ICREAD
227, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_RFCI
228, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_TLBRE
229, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_TLBSX
230, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_TLBWE
231, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_WRTEE
232, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_WRTEEI
233, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_MFDCR
234, IU1a, 1, 0, 0, 0, 0, 0, 0, // PC_MTDCR
235, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DCBA
236, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DSS
237, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DSSALL
238, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DST
239, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DSTT
240, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DSTST
241, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_DSTSTT
242, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LVEBX
243, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LVEHX
244, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LVEWX
245, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LVSL
246, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LVSR
247, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LVX
248, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_LVXL
249, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STVEBX
250, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STVEHX
251, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STVEWX
252, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STVX
253, LSU_1, 3, 1, 1, 1, 0, 0, 0, // PC_STVXL
254, VFPU_1, 2, 2, 0, 0, 0, 1, 0, // PC_MFVSCR
255, VFPU_1, 2, 2, 0, 0, 0, 1, 0, // PC_MTVSCR
256, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDCUW
257, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VADDFP
258, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDSBS
259, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDSHS
260, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDSWS
261, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUBM
262, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUBS
263, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUHM
264, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUHS
265, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUWM
266, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VADDUWS
267, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VAND
268, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VANDC
269, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGSB
270, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGSH
271, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGSW
272, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGUB
273, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGUH
274, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VAVGUW
275, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VCFSX
276, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VCFUX
277, VFPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VCMPBFP
278, VFPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VCMPEQFP
279, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPEQUB
280, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPEQUH
281, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPEQUW
282, VFPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VCMPGEFP
283, VFPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VCMPGTFP
284, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTSB
285, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTSH
286, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTSW
287, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTUB
288, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTUH
289, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VCMPGTUW
290, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VCTSXS
291, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VCTUXS
292, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VEXPTEFP
293, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VLOGEFP
294, VFPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VMAXFP
295, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXSB
296, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXSH
297, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXSW
298, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXUB
299, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXUH
300, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMAXUW
301, VFPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VMINFP
302, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMINSB
303, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMINSH
304, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMINSW
305, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMINUB
306, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMINUH
307, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMINUW
308, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VMRGHB
309, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VMRGHH
310, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VMRGHW
311, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VMRGLB
312, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VMRGLH
313, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VMRGLW
314, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMULESB
315, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMULESH
316, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMULEUB
317, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMULEUH
318, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMULOSB
319, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMULOSH
320, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMULOUB
321, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMULOUH
322, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VNOR
323, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VOR
324, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPKPX
325, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPKSHSS
326, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPKSHUS
327, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPKSWSS
328, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPKSWUS
329, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPKUHUM
330, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPKUHUS
331, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPKUWUM
332, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPKUWUS
333, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VREFP
334, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VRFIM
335, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VRFIN
336, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VRFIP
337, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VRFIZ
338, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VRLB
339, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VRLH
340, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VRLW
341, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VRSQRTEFP
342, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSL
343, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSLB
344, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSLH
345, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSLO
346, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSLW
347, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSPLTB
348, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSPLTH
349, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSPLTW
350, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSPLTISB
351, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSPLTISH
352, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSPLTISW
353, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSR
354, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSRAB
355, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSRAH
356, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSRAW
357, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSRB
358, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSRH
359, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSRO
360, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSRW
361, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBCUW
362, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VSUBFP
363, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBSBS
364, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBSHS
365, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBSWS
366, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUBM
367, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUBS
368, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUHM
369, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUHS
370, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUWM
371, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSUBUWS
372, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VSUMSWS
373, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VSUM2SWS
374, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VSUM4SBS
375, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VSUM4SHS
376, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VSUM4UBS
377, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VUPKHPX
378, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VUPKHSB
379, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VUPKHSH
380, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VUPKLPX
381, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VUPKLSB
382, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VUPKLSH
383, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VXOR
384, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMADDFP
385, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMHADDSHS
386, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMHRADDSHS
387, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMLADDUHM
388, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMSUMMBM
389, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMSUMSHM
390, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMSUMSHS
391, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMSUMUBM
392, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMSUMUHM
393, VIU2_1, 4, 1, 1, 1, 1, 0, 0, // PC_VMSUMUHS
394, VFPU_1, 4, 1, 1, 1, 1, 0, 0, // PC_VNMSUBFP
395, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VPERM
396, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VSEL
397, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VSLDOI
398, VIU1, 1, 1, 0, 0, 0, 0, 0, // PC_VMR
399, VPU_1, 2, 1, 1, 0, 0, 0, 0, // PC_VMRP
-1, IU2_1, 1, 1, 0, 0, 0, 1, 0
};
enum { NumPipelineUnits = 6 };
static struct {
Stage start, end;
} pipeline_units[8] = {
IU2_1, IU2_3,
LSU_1, LSU_4,
FPU_1, FPU_4,
VPU_1, VPU_2,
VIU2_1, VIU2_4,
VFPU_1, VFPU_4
};
enum { NumFinalStages = 11 };
static Stage finalstages[16] = {
BPU, IU2_3, IU1a, IU1b,
IU1c, LSU_4, FPU_4, VIU1,
VPU_2, VIU2_4, VFPU_4
};
// forward decl
static void complete_instruction(int stage);
static void advance(int firstStage, int oldStage, int newStage) {
PCode *instr = pipeline_altivec[oldStage].instr;
int cycles = instruction_timing[instr->op].cycles[newStage - firstStage];
pipeline_altivec[newStage].instr = instr;
pipeline_altivec[newStage].remaining = cycles;
pipeline_altivec[oldStage].instr = NULL;
pipeline_altivec[oldStage].remaining = 0;
if (cycles == 0)
complete_instruction(newStage);
}
static void assign_completion_buffer(PCode *instr) {
completionbuffers.used++;
completionbuffers.free--;
completionbuffers.entries[completionbuffers.nextFreeSlot].instr = instr;
completionbuffers.entries[completionbuffers.nextFreeSlot].completed = 0;
completionbuffers.nextFreeSlot = (completionbuffers.nextFreeSlot + 1) % MaxEntries;
}
static void complete_instruction(int stage) {
PCode *instr = pipeline_altivec[stage].instr;
int buf = 0;
while (buf < MaxEntries && completionbuffers.entries[buf].instr != instr)
buf++;
completionbuffers.entries[buf].completed = 1;
pipeline_altivec[stage].instr = NULL;
}
static void retire_instruction(void) {
completionbuffers.entries[completionbuffers.nextToRetire].instr = NULL;
completionbuffers.entries[completionbuffers.nextToRetire].completed = 0;
completionbuffers.used--;
completionbuffers.free++;
completionbuffers.nextToRetire = (completionbuffers.nextToRetire + 1) % MaxEntries;
}
static int latency(PCode *instr) {
int cycles = instruction_timing[instr->op].latency;
if (PCODE_FLAG_SET_F(instr) & fRecordBit)
cycles += 1;
if (instr->op == PC_LMW || instr->op == PC_STMW)
cycles += instr->argCount - 2;
return cycles;
}
static void initialize(void) {
int stage;
int i;
fetchqueues[Queue0] = 1;
for (i = 1; i < NumQueues; i++)
fetchqueues[i] = 0;
for (stage = 0; stage < NumStages; stage++)
pipeline_altivec[stage].instr = NULL;
completionbuffers.free = MaxEntries;
completionbuffers.used = 0;
completionbuffers.nextToRetire = 0;
completionbuffers.nextFreeSlot = 0;
for (i = 0; i < MaxEntries; i++) {
completionbuffers.entries[i].instr = NULL;
completionbuffers.entries[i].completed = 0;
}
}
static int can_issue(PCode *instr) {
int stage;
if (completionbuffers.free == 0)
return 0;
stage = instruction_timing[instr->op].stage;
if (stage == IU1a) {
int isClear1 = !pipeline_altivec[IU1a].instr;
int isClear2 = !pipeline_altivec[IU1b].instr;
if (!isClear1 && !isClear2)
return 0;
} else {
if (pipeline_altivec[stage].instr)
return 0;
}
if (fetchqueues[Queue1] <= 0)
return 0;
if (stage == FPU_1) {
if (fetchqueues[Queue2] < 1 || fetchqueues[Queue5] >= 1)
return 0;
} else if (stage >= VIU1 && stage <= VFPU_1) {
if (fetchqueues[Queue4] < 1 || fetchqueues[Queue7] >= 2)
return 0;
} else if (stage != BPU) {
if (fetchqueues[Queue3] < 1 || fetchqueues[Queue6] >= 3)
return 0;
}
return 1;
}
static void issue(PCode *instr) {
int stage = instruction_timing[instr->op].stage;
int cycles = instruction_timing[instr->op].cycles[0];
assign_completion_buffer(instr);
CError_ASSERT(879, --fetchqueues[Queue1] >= 0);
if (stage == FPU_1) {
fetchqueues[Queue2]--;
fetchqueues[Queue5]++;
} else if (stage >= VIU1 && stage <= VFPU_1) {
fetchqueues[Queue4]--;
fetchqueues[Queue7]++;
} else if (stage != BPU) {
fetchqueues[Queue3]--;
fetchqueues[Queue6]++;
}
fetchqueues[Queue2] = (fetchqueues[Queue1] < fetchqueues[Queue2]) ? fetchqueues[Queue1] : fetchqueues[Queue2];
fetchqueues[Queue3] = (fetchqueues[Queue1] < fetchqueues[Queue3]) ? fetchqueues[Queue1] : fetchqueues[Queue3];
fetchqueues[Queue4] = (fetchqueues[Queue1] < fetchqueues[Queue4]) ? fetchqueues[Queue1] : fetchqueues[Queue4];
if (stage == IU1a) {
if (!pipeline_altivec[IU1a].instr)
stage = IU1a;
else if (!pipeline_altivec[IU1b].instr)
stage = IU1b;
else if (!pipeline_altivec[IU1c].instr)
stage = IU1c;
}
pipeline_altivec[stage].instr = instr;
pipeline_altivec[stage].remaining = cycles;
}
static void advance_clock(void) {
int num;
int i;
unsigned int unit;
for (i = 0; i < NumStages; i++) {
if (pipeline_altivec[i].instr && pipeline_altivec[i].remaining)
--pipeline_altivec[i].remaining;
}
for (i = 0; i < 3; i++) {
if (completionbuffers.used == 0)
break;
if (completionbuffers.entries[completionbuffers.nextToRetire].completed == 0)
break;
retire_instruction();
}
unit = 0;
do {
if (pipeline_altivec[finalstages[unit]].instr && pipeline_altivec[finalstages[unit]].remaining == 0)
complete_instruction(finalstages[unit]);
} while (++unit < NumFinalStages);
unit = 0;
do {
Stage first;
Stage current;
first = pipeline_units[unit].start;
for (current = first; current < pipeline_units[unit].end; current++) {
if (pipeline_altivec[current].instr && pipeline_altivec[current].remaining == 0 && !pipeline_altivec[current + 1].instr)
advance(first, current, current + 1);
}
} while (++unit < NumPipelineUnits);
fetchqueues[Queue5] = 0;
fetchqueues[Queue6] = 0;
fetchqueues[Queue7] = 0;
#define CHEAP_MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
num = 2 - fetchqueues[Queue2];
num += 6 - fetchqueues[Queue3];
num += 4 - fetchqueues[Queue4];
num = (num > 3) ? 3 : num;
num = (completionbuffers.free < num) ? completionbuffers.free : num;
if (fetchqueues[Queue0] < num)
num = fetchqueues[Queue0];
fetchqueues[Queue1] += num;
fetchqueues[Queue0] -= num;
fetchqueues[Queue2] = CHEAP_MIN(fetchqueues[Queue1], CHEAP_MIN(2, fetchqueues[Queue2] + num));
fetchqueues[Queue3] = CHEAP_MIN(fetchqueues[Queue1], CHEAP_MIN(6, fetchqueues[Queue3] + num));
fetchqueues[Queue4] = CHEAP_MIN(fetchqueues[Queue1], CHEAP_MIN(4, fetchqueues[Queue4] + num));
CError_ASSERT(991, fetchqueues[Queue1] <= (fetchqueues[Queue2] + fetchqueues[Queue3] + fetchqueues[Queue4]));
if (fetchqueues[Queue0] <= 8)
fetchqueues[Queue0] += 4;
}
static int serializes(PCode *instr) {
return instruction_timing[instr->op].serializes;
}
static int uses_vpermute_unit_altivec(PCode *instr) {
return instruction_timing[instr->op].stage == VPU_1;
}
MachineInfo machine7450 = {
6,
1,
4,
&latency,
&initialize,
&can_issue,
&issue,
&advance_clock,
&serializes,
&uses_vpermute_unit_altivec
};

View File

@ -186,7 +186,7 @@ static char ObjGen_ComputePrivFlag(UInt8 objectFlags) {
case 0: case 0:
case 1: case 1:
if ( if (
(objectFlags & OBJECT_FLAGS_UNUSED) && (objectFlags & OBJECT_FLAGS_1) &&
(objectFlags & OBJECT_FLAGS_2) && (objectFlags & OBJECT_FLAGS_2) &&
!(objectFlags & OBJECT_FLAGS_4) !(objectFlags & OBJECT_FLAGS_4)
) )
@ -199,7 +199,7 @@ static char ObjGen_ComputePrivFlag(UInt8 objectFlags) {
if ((objectFlags & OBJECT_FLAGS_40) == OBJECT_FLAGS_40) if ((objectFlags & OBJECT_FLAGS_40) == OBJECT_FLAGS_40)
return 0; return 0;
if ( if (
(objectFlags & OBJECT_FLAGS_UNUSED) && (objectFlags & OBJECT_FLAGS_1) &&
(objectFlags & OBJECT_FLAGS_2) && (objectFlags & OBJECT_FLAGS_2) &&
!(objectFlags & OBJECT_FLAGS_4) !(objectFlags & OBJECT_FLAGS_4)
) )

View File

@ -0,0 +1,435 @@
#include "compiler/PCodeInfo.h"
#include "compiler/PCode.h"
OpcodeInfo opcodeinfo[] = {
"B", "l;p", 2, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x48000000,
"BL", "#,m;p", 2, 0, fIsCall | fLink | fCanLink | fCanBeAbsolute, 0x48000001,
"BC", "B,Q,l;p", 5, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x40000000,
"BCLR", "B,Q;L", 4, 0, fIsBranch | fCanLink, 0x4C000020,
"BCCTR", "B,Q;Cp", 5, 0, fIsBranch | fCanLink, 0x4C000420,
"BT", "Q,l;p", 4, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x41800000,
"BTLR", "Q;L", 3, 0, fIsBranch | fCanLink, 0x4D800020,
"BTCTR", "Q;Cp", 4, 0, fIsBranch | fCanLink, 0x4D800420,
"BF", "Q,l;p", 4, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x40800000,
"BFLR", "Q;L", 3, 0, fIsBranch | fCanLink, 0x4C800020,
"BFCTR", "Q;Cp", 4, 0, fIsBranch | fCanLink, 0x4C800420,
"BDNZ", "l;Cp", 3, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x42000000,
"BDNZT", "Q,l;Cp", 4, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x41000000,
"BDNZF", "Q,l;Cp", 4, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x40000000,
"BDZ", "l;Cp", 2, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x42400000,
"BDZT", "Q,l;Cp", 4, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x41400000,
"BDZF", "Q,l;Cp", 4, 0, fIsBranch | fCanLink | fCanBeAbsolute, 0x40400000,
"BLR", ";L", 1, 0, fIsBranch | fCanLink, 0x4E800020,
"BCTR", ";Cmp", 3, 0, fIsBranch | fCanLink, 0x4E800420,
"BCTRL", "#;C=L", 2, 0, fIsCall | fLink | fCanLink, 0x4E800421,
"BLRL", "#;+L", 1, 0, fIsCall | fLink | fCanLink, 0x4E800021,
"LBZ", "=r,d(b)", 3, 3, fIsRead, 0x88000000,
"LBZU", "=r,d(+b)", 3, 3, fIsRead | fUpdatesPtr, 0x8C000000,
"LBZX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C0000AE,
"LBZUX", "=r,(+b,r)", 3, 3, fIsRead | fIsPtrOp | fUpdatesPtr, 0x7C0000EE,
"LHZ", "=r,d(b)", 3, 3, fIsRead, 0xA0000000,
"LHZU", "=r,d(+b)", 3, 3, fIsRead | fUpdatesPtr, 0xA4000000,
"LHZX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C00022E,
"LHZUX", "=r,(+b,r)", 3, 3, fIsRead | fIsPtrOp | fUpdatesPtr, 0x7C00026E,
"LHA", "=r,d(b)", 3, 3, fIsRead, 0xA8000000,
"LHAU", "=r,d(+b)", 3, 3, fIsRead | fUpdatesPtr, 0xAC000000,
"LHAX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C0002AE,
"LHAUX", "=r,(+b,r)", 3, 3, fIsRead | fIsPtrOp | fUpdatesPtr, 0x7C0002EE,
"LHBRX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C00062C,
"LWZ", "=r,d(b)", 3, 3, fIsRead, 0x80000000,
"LWZU", "=r,d(+b)", 3, 3, fIsRead | fUpdatesPtr, 0x84000000,
"LWZX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C00002E,
"LWZUX", "=r,(+b,r)", 3, 3, fIsRead | fIsPtrOp | fUpdatesPtr, 0x7C00006E,
"LWBRX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C00042C,
"LMW", "#,=r,d(b);=V", 3, 3, fIsRead, 0xB8000000,
"STB", "r,d(b)", 3, 1, fIsWrite, 0x98000000,
"STBU", "r,d(+b)", 3, 2, fIsWrite | fUpdatesPtr, 0x9C000000,
"STBX", "r,(b,r)", 3, 1, fIsWrite | fIsPtrOp, 0x7C0001AE,
"STBUX", "r,(+b,r)", 3, 2, fIsWrite | fIsPtrOp | fUpdatesPtr, 0x7C0001EE,
"STH", "r,d(b)", 3, 1, fIsWrite, 0xB0000000,
"STHU", "r,d(+b)", 3, 2, fIsWrite | fUpdatesPtr, 0xB4000000,
"STHX", "r,(b,r)", 3, 1, fIsWrite | fIsPtrOp, 0x7C00032E,
"STHUX", "r,(+b,r)", 3, 2, fIsWrite | fIsPtrOp | fUpdatesPtr, 0x7C00036E,
"STHBRX", "r,(b,r)", 3, 1, fIsWrite | fIsPtrOp, 0x7C00072C,
"STW", "r,d(b)", 3, 1, fIsWrite, 0x90000000,
"STWU", "r,d(+b)", 3, 2, fIsWrite | fUpdatesPtr, 0x94000000,
"STWX", "r,(b,r)", 3, 1, fIsWrite | fIsPtrOp, 0x7C00012E,
"STWUX", "r,(+b,r)", 3, 2, fIsWrite | fIsPtrOp | fUpdatesPtr, 0x7C00016E,
"STWBRX", "r,(b,r)", 3, 1, fIsWrite | fIsPtrOp, 0x7C00052C,
"STMW", "#,r,d(b);V", 3, 1, fIsWrite, 0xBC000000,
"DCBF", "b,r", 2, 1, fSideEffects | fOpTypeGPR, 0x7C0000AC,
"DCBST", "b,r", 2, 1, fSideEffects | fOpTypeGPR, 0x7C00006C,
"DCBT", "b,r", 2, 1, fSideEffects | fOpTypeGPR, 0x7C00022C,
"DCBTST", "b,r", 2, 1, fSideEffects | fOpTypeGPR, 0x7C0001EC,
"DCBZ", "b,r", 2, 1, fSideEffects | fOpTypeGPR, 0x7C0007EC,
"ADD", "=r,r,r", 3, 2, fCommutative | fIsCSE | fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C000214,
"ADDC", "=r,r,r;+X", 4, 2, fCanSetCarry | fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C000014,
"ADDE", "=r,r,r;+X", 4, 2, fCanSetCarry | fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C000114,
"ADDI", "=r,b,m;p", 4, 2, fIsCSE | fPCodeFlag400000 | fCanSetRecordBit | fOpTypeGPR, 0x38000000,
"ADDIC", "=r,r,i;+X", 4, 2, fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x30000000,
"ADDICR", "=r,r,n;+X=Z", 5, 2, fCanSetRecordBit | fSetsCarry | fRecordBit | fOpTypeGPR, 0x34000000,
"ADDIS", "=r,b,M", 3, 2, fIsCSE | fPCodeFlag400000 | fOpTypeGPR, 0x3C000000,
"ADDME", "=r,r;+X", 3, 2, fCanSetCarry | fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C0001D4,
"ADDZE", "=r,r;+X", 3, 2, fCanSetCarry | fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C000194,
"DIVW", "=r,r,r", 3, 2, fIsCSE | fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C0003D6,
"DIVWU", "=r,r,r", 3, 2, fIsCSE | fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C000396,
"MULHW", "=r,r,r", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000096,
"MULHWU", "=r,r,r", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000016,
"MULLI", "=r,r,i", 3, 2, fIsCSE | fOpTypeGPR, 0x1C000000,
"MULLW", "=r,r,r", 3, 2, fCommutative | fIsCSE | fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C0001D6,
"NEG", "=r,r", 2, 2, fIsCSE | fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C0000D0,
"SUBF", "=r,r,r", 3, 2, fIsCSE | fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C000050,
"SUBFC", "=r,r,r;+X", 4, 2, fCanSetCarry | fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C000010,
"SUBFE", "=r,r,r;+X", 4, 2, fCanSetCarry | fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C000110,
"SUBFIC", "=r,r,i;+X", 4, 2, fSetsCarry | fOpTypeGPR, 0x20000000,
"SUBFME", "=r,r;+X", 3, 2, fCanSetCarry | fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C0001D0,
"SUBFZE", "=r,r;+X", 3, 2, fCanSetCarry | fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C000190,
"CMPI", "=?c,Or,i", 3, 1, fIsCSE | fOpTypeGPR, 0x2C000000,
"CMP", "=?c,Or,r", 3, 1, fIsCSE | fOpTypeGPR, 0x7C000000,
"CMPLI", "=?c,Or,u", 3, 1, fIsCSE | fOpTypeGPR, 0x28000000,
"CMPL", "=?c,Or,r", 3, 1, fIsCSE | fOpTypeGPR, 0x7C000040,
"ANDI", "=r,r,x;=Z", 4, 2, fCanSetRecordBit | fRecordBit | fOpTypeGPR, 0x70000000,
"ANDIS", "=r,r,x;=Z", 4, 2, fCanSetRecordBit | fRecordBit | fOpTypeGPR, 0x74000000,
"ORI", "=r,r,x", 3, 2, fIsCSE | fOpTypeGPR, 0x60000000,
"ORIS", "=r,r,x", 3, 2, fIsCSE | fOpTypeGPR, 0x64000000,
"XORI", "=r,r,x", 3, 2, fIsCSE | fOpTypeGPR, 0x68000000,
"XORIS", "=r,r,x", 3, 2, fIsCSE | fOpTypeGPR, 0x6C000000,
"AND", "=r,r,r", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000038,
"OR", "=r,r,r;pp", 5, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000378,
"XOR", "=r,r,r", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000278,
"NAND", "=r,r,r", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C0003B8,
"NOR", "=r,r,r", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C0000F8,
"EQV", "=r,r,r", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000238,
"ANDC", "=r,r,r", 3, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000078,
"ORC", "=r,r,r", 3, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000338,
"EXTSB", "=r,r", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000774,
"EXTSH", "=r,r", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000734,
"CNTLZW", "=r,r", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000034,
"RLWINM", "=r,r,u5,u5,u5", 5, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x54000000,
"RLWNM", "=r,r,r,u5,u5", 5, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x5C000000,
"RLWIMI", "+r,r,u5,u5,u5", 5, 2, fCanSetRecordBit | fOpTypeGPR, 0x50000000,
"SLW", "=r,r,r", 3, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000030,
"SRW", "=r,r,r", 3, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C000430,
"SRAWI", "=r,r,u5;+X", 4, 2, fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C000670,
"SRAW", "=r,r,r;+X", 4, 2, fCanSetRecordBit | fSetsCarry | fOpTypeGPR, 0x7C000630,
"CRAND", "=Q,Q,Q", 6, 2, fCommutative | fIsCSE | fOpTypeGPR, 0x4C000202,
"CRANDC", "=Q,Q,Q", 6, 2, fIsCSE | fOpTypeGPR, 0x4C000102,
"CREQV", "=Q,Q,Q", 6, 2, fCommutative | fIsCSE | fOpTypeGPR, 0x4C000242,
"CRNAND", "=Q,Q,Q", 6, 2, fCommutative | fIsCSE | fOpTypeGPR, 0x4C0001C2,
"CRNOR", "=Q,Q,Q", 6, 2, fCommutative | fIsCSE | fOpTypeGPR, 0x4C000042,
"CROR", "=Q,Q,Q", 6, 2, fCommutative | fIsCSE | fOpTypeGPR, 0x4C000382,
"CRORC", "=Q,Q,Q", 6, 2, fIsCSE | fOpTypeGPR, 0x4C000342,
"CRXOR", "=Q,Q,Q", 6, 2, fCommutative | fIsCSE | fOpTypeGPR, 0x4C000182,
"MCRF", "=c,c", 2, 1, fIsMove | fOpTypeGPR, 0x4C000000,
"MTXER", "r;=X", 2, 1, fSetsCarry | fOpTypeGPR, 0x7C0103A6,
"MTCTR", "r;=C", 2, 1, fOpTypeGPR, 0x7C0903A6,
"MTLR", "r;=L", 2, 1, fOpTypeGPR, 0x7C0803A6,
"MTCRF", "x8,r;=Y", 10, 1, fOpTypeGPR, 0x7C000120,
"MTMSR", "r", 1, 4, fSideEffects | fOpTypeGPR, 0x7C000124,
"MTSPR", "=s,r", 2, 4, fOpTypeGPR, 0x7C0003A6,
"MFMSR", "=r", 1, 4, fOpTypeGPR, 0x7C0000A6,
"MFSPR", "=r,s", 2, 4, fOpTypeGPR, 0x7C0002A6,
"MFXER", "=r;X", 2, 4, fOpTypeGPR, 0x7C0102A6,
"MFCTR", "=r;C", 2, 4, fOpTypeGPR, 0x7C0902A6,
"MFLR", "=r;L", 2, 4, fOpTypeGPR, 0x7C0802A6,
"MFCR", "=r;Y", 9, 4, fOpTypeGPR, 0x7C000026,
"MFFS", "=f", 1, 4, fCanSetRecordBit | fOpTypeFPR, 0xFC00048E,
"MTFSF", "x8,f", 2, 1, fSideEffects | fCanSetRecordBit | fOpTypeFPR, 0xFC00058E,
"EIEIO", "", 0, 0, fSideEffects | fOpTypeGPR, 0x7C0006AC,
"ISYNC", "", 0, 0, fSideEffects | fOpTypeGPR, 0x4C00012C,
"SYNC", "", 0, 0, fSideEffects | fOpTypeGPR, 0x7C0004AC,
"RFI", "", 0, 0, fSideEffects, 0x4C000064,
"LI", "=r,n", 2, 4, fIsCSE | fOpTypeGPR, 0x38000000,
"LIS", "=r,M", 2, 4, fIsCSE | fOpTypeGPR, 0x3C000000,
"MR", "=r,r;p", 3, 0, fIsMove | fCanSetRecordBit | fOpTypeGPR, 0x7C000378,
"NOP", "", 0, 0, fSideEffects | fOpTypeGPR, 0x60000000,
"NOT", "=r,r", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeGPR, 0x7C0000F8,
"LFS", "=f,d(b)", 3, 3, fIsRead, 0xC0000000,
"LFSU", "=f,d(+b)", 3, 3, fIsRead | fUpdatesPtr, 0xC4000000,
"LFSX", "=f,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C00042E,
"LFSUX", "=f,(+b,r)", 3, 3, fIsRead | fIsPtrOp | fUpdatesPtr, 0x7C00046E,
"LFD", "=f,d(b)", 3, 3, fIsRead, 0xC8000000,
"LFDU", "=f,d(+b)", 3, 3, fIsRead | fUpdatesPtr, 0xCC000000,
"LFDX", "=f,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C0004AE,
"LFDUX", "=f,(+b,r)", 3, 3, fIsRead | fIsPtrOp | fUpdatesPtr, 0x7C0004EE,
"STFS", "f,d(b)", 3, 1, fIsWrite, 0xD0000000,
"STFSU", "f,d(+b)", 3, 2, fIsWrite | fUpdatesPtr, 0xD4000000,
"STFSX", "f,(b,r)", 3, 1, fIsWrite | fIsPtrOp, 0x7C00052E,
"STFSUX", "f,(+b,r)", 3, 2, fIsWrite | fIsPtrOp | fUpdatesPtr, 0x7C00056E,
"STFD", "f,d(b)", 3, 1, fIsWrite, 0xD8000000,
"STFDU", "f,d(+b)", 3, 2, fIsWrite | fUpdatesPtr, 0xDC000000,
"STFDX", "f,(b,r)", 3, 1, fIsWrite | fIsPtrOp, 0x7C0005AE,
"STFDUX", "f,(+b,r)", 3, 2, fIsWrite | fIsPtrOp | fUpdatesPtr, 0x7C0005EE,
"FMR", "=f,f", 2, 0, fIsMove | fCanSetRecordBit | fOpTypeFPR, 0xFC000090,
"FABS", "=f,f", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC000210,
"FNEG", "=f,f", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC000050,
"FNABS", "=f,f", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC000110,
"FADD", "=f,f,f", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC00002A,
"FADDS", "=f,f,f", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xEC00002A,
"FSUB", "=f,f,f", 3, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC000028,
"FSUBS", "=f,f,f", 3, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xEC000028,
"FMUL", "=f,f,f", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC000032,
"FMULS", "=f,f,f", 3, 2, fCommutative | fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xEC000032,
"FDIV", "=f,f,f", 3, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC000024,
"FDIVS", "=f,f,f", 3, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xEC000024,
"FMADD", "=f,f,f,f", 4, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC00003A,
"FMADDS", "=f,f,f,f", 4, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xEC00003A,
"FMSUB", "=f,f,f,f", 4, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC000038,
"FMSUBS", "=f,f,f,f", 4, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xEC000038,
"FNMADD", "=f,f,f,f", 4, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC00003E,
"FNMADDS", "=f,f,f,f", 4, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xEC00003E,
"FNMSUB", "=f,f,f,f", 4, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC00003C,
"FNMSUBS", "=f,f,f,f", 4, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xEC00003C,
"FRES", "=f,f", 2, 2, fCanSetRecordBit | fOpTypeFPR, 0xEC000030,
"FRSQRTE", "=f,f", 2, 2, fCanSetRecordBit | fOpTypeFPR, 0xFC000034,
"FSEL", "=f,f,f,f", 4, 2, fCanSetRecordBit | fOpTypeFPR, 0xFC00002E,
"FRSP", "=f,f", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC000018,
"FCTIW", "=f,f", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC00001C,
"FCTIWZ", "=f,f", 2, 2, fIsCSE | fCanSetRecordBit | fOpTypeFPR, 0xFC00001E,
"FCMPU", "=?c,f,f", 3, 1, fIsCSE | fOpTypeFPR, 0xFC000000,
"FCMPO", "=?c,f,f", 3, 1, fIsCSE | fOpTypeFPR, 0xFC000040,
"LWARX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C000028,
"LSWI", "=r,b,N", 3, 3, fIsRead | fIsPtrOp | fSideEffects, 0x7C0004AA,
"LSWX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp | fSideEffects, 0x7C00042A,
"STFIWX", "f,(b,r)", 3, 3, fIsWrite | fIsPtrOp, 0x7C0007AE,
"STSWI", "r,b,N", 3, 3, fIsWrite | fIsPtrOp, 0x7C0005AA,
"STSWX", "r,(b,r)", 3, 3, fIsWrite | fIsPtrOp, 0x7C00052A,
"STWCX", "r,(b,r);=Z", 4, 3, fIsWrite | fIsPtrOp | fCanSetRecordBit | fRecordBit, 0x7C00012D,
"ECIWX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp, 0x7C00026C,
"ECOWX", "r,(b,r)", 3, 1, fIsWrite | fIsPtrOp | fSideEffects, 0x7C00036C,
"DCBI", "b,r", 2, 1, fSideEffects | fOpTypeGPR, 0x7C0003AC,
"ICBI", "b,r", 2, 1, fSideEffects | fOpTypeGPR, 0x7C0007AC,
"MCRFS", "=c,x3", 2, 1, fSideEffects | fOpTypeGPR, 0xFC000080,
"MCRXR", "=c;+X", 2, 1, fOpTypeGPR, 0x7C000400,
"MFTB", "=r?T", 2, 4, fOpTypeGPR, 0x7C0002E6,
"MFSR", "=r,u4", 2, 4, fOpTypeGPR, 0x7C0004A6,
"MTSR", "u4,r", 2, 4, fSideEffects | fOpTypeGPR, 0x7C0001A4,
"MFSRIN", "=r,r", 2, 4, fOpTypeGPR, 0x7C000526,
"MTSRIN", "r,r", 2, 4, fSideEffects | fOpTypeGPR, 0x7C0001E4,
"MTFSB0", "u5", 1, 4, fSideEffects | fCanSetRecordBit | fOpTypeGPR, 0xFC00008C,
"MTFSB1", "u5", 1, 4, fSideEffects | fCanSetRecordBit | fOpTypeGPR, 0xFC00004C,
"MTFSFI", "c,x4", 2, 1, fSideEffects | fCanSetRecordBit | fOpTypeGPR, 0xFC00010C,
"SC", "", 0, 0, fIsCall | fSideEffects, 0x44000002,
"FSQRT", "=f,f", 2, 2, fCanSetRecordBit | fOpTypeFPR, 0xFC00002C,
"FSQRTS", "=f,f", 2, 2, fCanSetRecordBit | fOpTypeFPR, 0xEC00002C,
"TLBIA", "", 0, 1, fSideEffects, 0x7C0002E4,
"TLBIE", "r", 1, 1, fSideEffects, 0x7C000264,
"TLBLD", "r", 1, 1, fSideEffects, 0x7C0007A4,
"TLBLI", "r", 1, 1, fSideEffects, 0x7C0007E4,
"TLBSYNC", "", 0, 1, fSideEffects, 0x7C00046C,
"TW", "t,r,r", 3, 1, fIsCall | fSideEffects, 0x7C000008,
"TRAP", "", 0, 1, fIsCall | fSideEffects, 0x7FE00008,
"TWI", "t,r,x", 3, 1, fIsCall | fSideEffects, 0x0C000000,
"OPWORD", "w", 1, 0, fSideEffects, 0x00000000,
"MFROM", "=r,r", 2, 4, fIsRead, 0x7C000212,
"DSA", "", 0, 0, fSideEffects | fOpTypeGPR, 0x7C0004E8,
"ESA", "", 0, 0, fSideEffects | fOpTypeGPR, 0x7C0004A8,
"DCCCI", "b,r", 2, 0, fSideEffects | fOpTypeGPR, 0x7C00038C,
"DCREAD", "=r,(b,r)", 3, 0, fSideEffects | fPCodeFlag400000 | fOpTypeGPR, 0x7C0003CC,
"ICBT", "b,r", 2, 0, fSideEffects | fOpTypeGPR, 0x7C00020C,
"ICCCI", "b,r", 2, 0, fSideEffects | fOpTypeGPR, 0x7C00078C,
"ICREAD", "b,r", 2, 0, fSideEffects | fOpTypeGPR, 0x7C0007CC,
"RFCI", "", 0, 0, fSideEffects | fOpTypeGPR, 0x4C000066,
"TLBRE", "=r,r,u1", 3, 0, fSideEffects | fOpTypeGPR, 0x7C000764,
"TLBSX", "=r,(b,r)", 3, 0, fSideEffects | fPCodeFlag400000 | fCanSetRecordBit | fOpTypeGPR, 0x7C000724,
"TLBWE", "=r,r,i", 3, 0, fSideEffects | fOpTypeGPR, 0x7C0007A4,
"WRTEE", "r", 1, 0, fSideEffects | fOpTypeGPR, 0x7C000106,
"WRTEEI", "u1", 1, 0, fSideEffects | fOpTypeGPR, 0x7C000146,
"MFDCR", "=r,D", 2, 4, fSideEffects | fOpTypeGPR, 0x7C000286,
"MTDCR", "D,r", 2, 4, fSideEffects | fOpTypeGPR, 0x7C000386,
"DCBA", "b,r", 2, 1, fSideEffects | fOpTypeGPR, 0x7C0005EC,
"DSS", "u2?u2", 2, 1, fSideEffects | fOpTypeGPR, 0x7C00066C,
"DSSALL", "", 0, 1, fSideEffects | fOpTypeGPR, 0x7E00066C,
"DST", "b,r,u2?u2", 4, 1, fSideEffects | fOpTypeGPR, 0x7C0002AC,
"DSTT", "b,r,u2", 3, 1, fSideEffects | fOpTypeGPR, 0x7E0002AC,
"DSTST", "b,r,u2?u2", 4, 1, fSideEffects | fOpTypeGPR, 0x7C0002EC,
"DSTSTT", "b,r,u2", 3, 1, fSideEffects | fOpTypeGPR, 0x7E0002EC,
"LVEBX", "=v,(b,r)", 3, 3, fIsRead | fIsPtrOp | fOpTypeVR, 0x7C00000E,
"LVEHX", "=v,(b,r)", 3, 3, fIsRead | fIsPtrOp | fOpTypeVR, 0x7C00004E,
"LVEWX", "=v,(b,r)", 3, 3, fIsRead | fIsPtrOp | fOpTypeVR, 0x7C00008E,
"LVSL", "=v,(b,r)", 3, 3, fPCodeFlag400000 | fOpTypeVR, 0x7C00000C,
"LVSR", "=v,(b,r)", 3, 3, fPCodeFlag400000 | fOpTypeVR, 0x7C00004C,
"LVX", "=v,(b,r)", 3, 3, fIsRead | fIsPtrOp | fOpTypeVR, 0x7C0000CE,
"LVXL", "=v,(b,r)", 3, 3, fIsRead | fIsPtrOp | fOpTypeVR, 0x7C0002CE,
"STVEBX", "v,(b,r)", 3, 1, fIsWrite | fIsPtrOp | fOpTypeVR, 0x7C00010E,
"STVEHX", "v,(b,r)", 3, 1, fIsWrite | fIsPtrOp | fOpTypeVR, 0x7C00014E,
"STVEWX", "v,(b,r)", 3, 1, fIsWrite | fIsPtrOp | fOpTypeVR, 0x7C00018E,
"STVX", "v,(b,r)", 3, 1, fIsWrite | fIsPtrOp | fOpTypeVR, 0x7C0001CE,
"STVXL", "v,(b,r)", 3, 1, fIsWrite | fIsPtrOp | fOpTypeVR, 0x7C0003CE,
"MFVSCR", "=v", 1, 3, fSideEffects | fOpTypeVR, 0x10000604,
"MTVSCR", "v", 1, 3, fSideEffects | fOpTypeVR, 0x10000644,
"VADDCUW", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000180,
"VADDFP", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x1000000A,
"VADDSBS", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000300,
"VADDSHS", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000340,
"VADDSWS", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000380,
"VADDUBM", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000000,
"VADDUBS", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000200,
"VADDUHM", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000040,
"VADDUHS", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000240,
"VADDUWM", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000080,
"VADDUWS", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000280,
"VAND", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000404,
"VANDC", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000444,
"VAVGSB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000502,
"VAVGSH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000542,
"VAVGSW", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000582,
"VAVGUB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000402,
"VAVGUH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000442,
"VAVGUW", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000482,
"VCFSX", "=v,v,u5", 3, 2, fIsCSE | fOpTypeVR, 0x1000034A,
"VCFUX", "=v,v,u5", 3, 2, fIsCSE | fOpTypeVR, 0x1000030A,
"VCMPBFP", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x100003C6,
"VCMPEQFP", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x100000C6,
"VCMPEQUB", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x10000006,
"VCMPEQUH", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x10000046,
"VCMPEQUW", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x10000086,
"VCMPGEFP", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x100001C6,
"VCMPGTFP", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x100002C6,
"VCMPGTSB", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x10000306,
"VCMPGTSH", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x10000346,
"VCMPGTSW", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x10000386,
"VCMPGTUB", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x10000206,
"VCMPGTUH", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x10000246,
"VCMPGTUW", "=v,v,v", 3, 2, fCanSetRecordBit | fOpTypeVR, 0x10000286,
"VCTSXS", "=v,v,u5", 3, 2, fIsCSE | fOpTypeVR, 0x100003CA,
"VCTUXS", "=v,v,u5", 3, 2, fIsCSE | fOpTypeVR, 0x1000038A,
"VEXPTEFP", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000018A,
"VLOGEFP", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x100001CA,
"VMAXFP", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x1000040A,
"VMAXSB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000102,
"VMAXSH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000142,
"VMAXSW", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000182,
"VMAXUB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000002,
"VMAXUH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000042,
"VMAXUW", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000082,
"VMINFP", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x1000044A,
"VMINSB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000302,
"VMINSH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000342,
"VMINSW", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000382,
"VMINUB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000202,
"VMINUH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000242,
"VMINUW", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000282,
"VMRGHB", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000000C,
"VMRGHH", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000004C,
"VMRGHW", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000008C,
"VMRGLB", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000010C,
"VMRGLH", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000014C,
"VMRGLW", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000018C,
"VMULESB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000308,
"VMULESH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000348,
"VMULEUB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000208,
"VMULEUH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000248,
"VMULOSB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000108,
"VMULOSH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000148,
"VMULOUB", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000008,
"VMULOUH", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000048,
"VNOR", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000504,
"VOR", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x10000484,
"VPKPX", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000030E,
"VPKSHSS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000018E,
"VPKSHUS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000010E,
"VPKSWSS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x100001CE,
"VPKSWUS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000014E,
"VPKUHUM", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000000E,
"VPKUHUS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000008E,
"VPKUWUM", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000004E,
"VPKUWUS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x100000CE,
"VREFP", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000010A,
"VRFIM", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x100002CA,
"VRFIN", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000020A,
"VRFIP", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000028A,
"VRFIZ", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000024A,
"VRLB", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000004,
"VRLH", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000044,
"VRLW", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000084,
"VRSQRTEFP", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000014A,
"VSL", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x100001C4,
"VSLB", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000104,
"VSLH", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000144,
"VSLO", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000040C,
"VSLW", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000184,
"VSPLTB", "=v,v,u5", 3, 2, fIsCSE | fOpTypeVR, 0x1000020C,
"VSPLTH", "=v,v,u5", 3, 2, fIsCSE | fOpTypeVR, 0x1000024C,
"VSPLTW", "=v,v,u5", 3, 2, fIsCSE | fOpTypeVR, 0x1000028C,
"VSPLTISB", "=v,i5", 2, 2, fIsCSE | fOpTypeVR, 0x1000030C,
"VSPLTISH", "=v,i5", 2, 2, fIsCSE | fOpTypeVR, 0x1000034C,
"VSPLTISW", "=v,i5", 2, 2, fIsCSE | fOpTypeVR, 0x1000038C,
"VSR", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x100002C4,
"VSRAB", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000304,
"VSRAH", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000344,
"VSRAW", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000384,
"VSRB", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000204,
"VSRH", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000244,
"VSRO", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000044C,
"VSRW", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000284,
"VSUBCUW", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000580,
"VSUBFP", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x1000004A,
"VSUBSBS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000700,
"VSUBSHS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000740,
"VSUBSWS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000780,
"VSUBUBM", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000400,
"VSUBUBS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000600,
"VSUBUHM", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000440,
"VSUBUHS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000640,
"VSUBUWM", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000480,
"VSUBUWS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000680,
"VSUMSWS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000788,
"VSUM2SWS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000688,
"VSUM4SBS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000708,
"VSUM4SHS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000648,
"VSUM4UBS", "=v,v,v", 3, 2, fIsCSE | fOpTypeVR, 0x10000608,
"VUPKHPX", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000034E,
"VUPKHSB", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000020E,
"VUPKHSH", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000024E,
"VUPKLPX", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x100003CE,
"VUPKLSB", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x1000028E,
"VUPKLSH", "=v,v", 2, 2, fIsCSE | fOpTypeVR, 0x100002CE,
"VXOR", "=v,v,v", 3, 2, fCommutative | fIsCSE | fOpTypeVR, 0x100004C4,
"VMADDFP", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x1000002E,
"VMHADDSHS", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x10000020,
"VMHRADDSHS", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x10000021,
"VMLADDUHM", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x10000022,
"VMSUMMBM", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x10000025,
"VMSUMSHM", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x10000028,
"VMSUMSHS", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x10000029,
"VMSUMUBM", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x10000024,
"VMSUMUHM", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x10000026,
"VMSUMUHS", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x10000027,
"VNMSUBFP", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x1000002F,
"VPERM", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x1000002B,
"VSEL", "=v,v,v,v", 4, 2, fIsCSE | fOpTypeVR, 0x1000002A,
"VSLDOI", "=v,v,v,u4", 4, 2, fIsCSE | fOpTypeVR, 0x1000002C,
"VMR", "=v,v", 2, 2, fIsMove | fOpTypeVR, 0x10000484,
"VMRP", "=v,v", 2, 2, fIsMove | fOpTypeVR, 0x1000002C,
"SLE", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000132,
"SLEQ", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C0001B2,
"SLIQ", "=r,r,u5", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000170,
"SLLIQ", "=r,r,u5", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C0001F0,
"SLLQ", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C0001B0,
"SLQ", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000130,
"SRAIQ", "=r,r,u5", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000770,
"SRAQ", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000730,
"SRE", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000532,
"SREA", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000732,
"SREQ", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C0005B2,
"SRIQ", "=r,r,u5", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000570,
"SRLIQ", "=r,r,u5", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C0005F0,
"SRLQ", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C0005B0,
"SRQ", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000530,
"MASKG", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C00003A,
"MASKIR", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C00043A,
"LSCBX", "=r,(b,r)", 3, 3, fIsRead | fIsPtrOp | fSideEffects | fCanSetRecordBit, 0x7C00022A,
"DIV", "=r,r,r", 3, 2, fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C000296,
"DIVS", "=r,r,r", 3, 2, fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C0002D6,
"DOZ", "=r,r,r", 3, 2, fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C000210,
"MUL", "=r,r,r", 3, 2, fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C0000D6,
"NABS", "=r,r", 2, 2, fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C0003D0,
"ABS", "=r,r", 2, 2, fCanSetCarry | fCanSetRecordBit | fOpTypeGPR, 0x7C0002D0,
"CLCS", "=r,r", 2, 2, fOpTypeGPR, 0x7C000426,
"DOZI", "=r,r,u5", 3, 2, fOpTypeGPR, 0x24000000,
"RLMI", "+r,r,r,u5,u5", 5, 2, fCanSetRecordBit | fOpTypeGPR, 0x58000000,
"RRIB", "=r,r,r", 3, 2, fCanSetRecordBit | fOpTypeGPR, 0x7C000432,
"PENTRY", "", 0, 0, 0, 0x00000000,
"PEXIT", "", 0, 0, 0, 0x00000000
};

View File

@ -2,15 +2,17 @@
#include "compiler/CError.h" #include "compiler/CError.h"
#include "compiler/CMachine.h" #include "compiler/CMachine.h"
#include "compiler/CParser.h" #include "compiler/CParser.h"
#include "compiler/CodeGen.h"
#include "compiler/CompilerTools.h"
#include "compiler/PCode.h" #include "compiler/PCode.h"
#include "compiler/PCodeInfo.h" #include "compiler/PCodeInfo.h"
#include "compiler/PCodeUtilities.h" #include "compiler/PCodeUtilities.h"
#include "compiler/RegisterInfo.h"
#include "compiler/Registers.h" #include "compiler/Registers.h"
#include "compiler/StackFrame.h" #include "compiler/StackFrame.h"
#include "compiler/TOC.h"
#include "compiler/enode.h" #include "compiler/enode.h"
#include "compiler/objects.h" #include "compiler/objects.h"
#include "compiler/CodeGen.h"
#include "compiler/RegisterInfo.h"
unsigned long long uns_to_float_cc = 0x4330000000000000; unsigned long long uns_to_float_cc = 0x4330000000000000;
unsigned long long int_to_float_cc = 0x4330000080000000; unsigned long long int_to_float_cc = 0x4330000080000000;
@ -65,7 +67,7 @@ void indirect(Operand *op, ENode *expr) {
case OpndType_IndirectGPR_Indexed: case OpndType_IndirectGPR_Indexed:
case OpndType_IndirectSymbol: case OpndType_IndirectSymbol:
if (op->optype) if (op->optype)
Coerce_to_register(op, (Type *) &void_ptr, 0); Coerce_to_register(op, TYPE(&void_ptr), 0);
case OpndType_GPR: case OpndType_GPR:
op->immOffset = 0; op->immOffset = 0;
op->object = NULL; op->object = NULL;
@ -345,7 +347,7 @@ void coerce_to_addressable(Operand *op) {
void Coerce_to_register(Operand *op, Type *type, short output_reg) { void Coerce_to_register(Operand *op, Type *type, short output_reg) {
SInt32 offset; SInt32 offset;
short opcode; Opcode opcode;
short reg; short reg;
short tmp; short tmp;
short cond_neg; short cond_neg;
@ -581,7 +583,7 @@ void coerce_to_register_pair(Operand *op, Type *type, short output_reg, short ou
} }
} }
void Coerce_to_fp_register(Operand *op, TypeIntegral *tint, short output_reg) { void Coerce_to_fp_register(Operand *op, Type *type, short output_reg) {
short reg; short reg;
coerce_to_addressable(op); coerce_to_addressable(op);
@ -592,12 +594,12 @@ void Coerce_to_fp_register(Operand *op, TypeIntegral *tint, short output_reg) {
break; break;
case OpndType_IndirectGPR_ImmOffset: case OpndType_IndirectGPR_ImmOffset:
reg = output_reg ? output_reg : used_virtual_registers[RegClass_FPR]++; reg = output_reg ? output_reg : used_virtual_registers[RegClass_FPR]++;
load_store_register((tint->size == 4) ? PC_LFS : PC_LFD, reg, op->reg, op->object, op->immOffset); load_store_register((type->size == 4) ? PC_LFS : PC_LFD, reg, op->reg, op->object, op->immOffset);
setpcodeflags(op->flags); setpcodeflags(op->flags);
break; break;
case OpndType_IndirectGPR_Indexed: case OpndType_IndirectGPR_Indexed:
reg = output_reg ? output_reg : used_virtual_registers[RegClass_FPR]++; reg = output_reg ? output_reg : used_virtual_registers[RegClass_FPR]++;
emitpcode((tint->size == 4) ? PC_LFSX : PC_LFDX, reg, op->reg, op->regOffset, 0, 0x390); emitpcode((type->size == 4) ? PC_LFSX : PC_LFDX, reg, op->reg, op->regOffset, 0, 0x390);
setpcodeflags(op->flags); setpcodeflags(op->flags);
break; break;
default: default:
@ -608,7 +610,7 @@ void Coerce_to_fp_register(Operand *op, TypeIntegral *tint, short output_reg) {
op->reg = reg; op->reg = reg;
} }
void Coerce_to_v_register(Operand *op, TypeStruct *tstruct, short output_reg) { void Coerce_to_v_register(Operand *op, Type *type, short output_reg) {
short reg; short reg;
coerce_to_addressable(op); coerce_to_addressable(op);
@ -629,7 +631,7 @@ void Coerce_to_v_register(Operand *op, TypeStruct *tstruct, short output_reg) {
break; break;
case OpndType_Absolute: case OpndType_Absolute:
reg = output_reg ? output_reg : used_virtual_registers[RegClass_VR]++; reg = output_reg ? output_reg : used_virtual_registers[RegClass_VR]++;
switch (tstruct->stype) { switch (TYPE_STRUCT(type)->stype) {
case STRUCT_TYPE_4: case STRUCT_TYPE_4:
case STRUCT_TYPE_5: case STRUCT_TYPE_5:
case STRUCT_TYPE_6: case STRUCT_TYPE_6:
@ -663,7 +665,7 @@ void Coerce_to_v_register(Operand *op, TypeStruct *tstruct, short output_reg) {
} }
void store(short reg, Operand *op, Type *type) { void store(short reg, Operand *op, Type *type) {
short opcode; Opcode opcode;
coerce_to_addressable(op); coerce_to_addressable(op);
switch (op->optype) { switch (op->optype) {
@ -732,15 +734,15 @@ void store_pair(short reg, short regHi, Operand *op, Type *type) {
} }
} }
void store_fp(short reg, Operand *op, Type *tint) { void store_fp(short reg, Operand *op, Type *type) {
coerce_to_addressable(op); coerce_to_addressable(op);
switch (op->optype) { switch (op->optype) {
case OpndType_IndirectGPR_ImmOffset: case OpndType_IndirectGPR_ImmOffset:
load_store_register((tint->size == 4) ? PC_STFS : PC_STFD, reg, op->reg, op->object, op->immOffset); load_store_register((type->size == 4) ? PC_STFS : PC_STFD, reg, op->reg, op->object, op->immOffset);
setpcodeflags(op->flags); setpcodeflags(op->flags);
break; break;
case OpndType_IndirectGPR_Indexed: case OpndType_IndirectGPR_Indexed:
emitpcode((tint->size == 4) ? PC_STFSX : PC_STFDX, reg, op->reg, op->regOffset); emitpcode((type->size == 4) ? PC_STFSX : PC_STFDX, reg, op->reg, op->regOffset);
setpcodeflags(op->flags); setpcodeflags(op->flags);
break; break;
default: default:
@ -855,26 +857,56 @@ void extend64(Operand *op, Type *type, short output_reg, short output_regHi) {
op->regHi = regHi; op->regHi = regHi;
} }
void load_floating_constant(short reg, Type *type, double *data) { void load_floating_constant(short reg, Type *type, Float *data) {
// do me AFTER Object *object;
Object *indObject;
Operand op1;
Operand op2;
Operand op3;
SInt32 offset = 0;
memclrw(&op1, sizeof(Operand));
object = CreateFloatConst(type, data, &offset);
indObject = createIndirect(object, 0, 1);
if (indObject) {
symbol_operand(&op1, indObject);
indirect(&op1, NULL);
} else {
symbol_operand(&op1, object);
}
if (offset) {
op2 = op1;
memclrw(&op3, sizeof(Operand));
op3.optype = OpndType_Absolute;
op3.immediate = offset;
if (op2.optype != OpndType_GPR)
Coerce_to_register(&op2, TYPE(&void_ptr), 0);
combine(&op2, &op3, 0, &op1);
}
indirect(&op1, NULL);
if (op1.optype != OpndType_FPR)
Coerce_to_fp_register(&op1, type, reg);
} }
void convert_integer_to_floating(Operand *op, Boolean is_single, short output_reg) { void convert_integer_to_floating(Operand *op, Boolean is_single, short output_reg) {
// issue with matching the PC_FSUB/PC_FSUBS ternary
Operand temp_op; Operand temp_op;
double d; Float d;
int const_reg; int const_reg;
int tmp_reg; int tmp_reg;
int work_reg; int work_reg;
int result_reg; int result_reg;
short opcode; Opcode opcode;
symbol_operand(&temp_op, maketemporary((Type *) &stdouble)); symbol_operand(&temp_op, maketemporary(TYPE(&stdouble)));
coerce_to_addressable(&temp_op); coerce_to_addressable(&temp_op);
d = *((double *) &int_to_float_cc); d.value = *((double *) &int_to_float_cc);
const_reg = used_virtual_registers[RegClass_FPR]++; const_reg = used_virtual_registers[RegClass_FPR]++;
load_floating_constant(const_reg, &stdouble, &d); load_floating_constant(const_reg, TYPE(&stdouble), &d);
tmp_reg = used_virtual_registers[RegClass_GPR]++; tmp_reg = used_virtual_registers[RegClass_GPR]++;
emitpcode(PC_XORIS, tmp_reg, op->reg, 0x8000); emitpcode(PC_XORIS, tmp_reg, op->reg, 0x8000);
@ -886,10 +918,6 @@ void convert_integer_to_floating(Operand *op, Boolean is_single, short output_re
load_store_register(PC_LFD, work_reg = used_virtual_registers[RegClass_FPR]++, temp_op.reg, temp_op.object, 0); load_store_register(PC_LFD, work_reg = used_virtual_registers[RegClass_FPR]++, temp_op.reg, temp_op.object, 0);
result_reg = output_reg ? output_reg : used_virtual_registers[RegClass_FPR]++; result_reg = output_reg ? output_reg : used_virtual_registers[RegClass_FPR]++;
//opcode = PC_FSUB;
//if (is_single)
// opcode = PC_FSUBS;
//opcode = (is_single != 0) ? PC_FSUBS : PC_FSUB;
if (is_single != 0) if (is_single != 0)
opcode = PC_FSUBS; opcode = PC_FSUBS;
else else
@ -901,21 +929,20 @@ void convert_integer_to_floating(Operand *op, Boolean is_single, short output_re
} }
void convert_unsigned_to_floating(Operand *op, Boolean is_single, short output_reg) { void convert_unsigned_to_floating(Operand *op, Boolean is_single, short output_reg) {
// issue with matching the PC_FSUB/PC_FSUBS ternary
Operand temp_op; Operand temp_op;
double d; Float d;
int const_reg; int const_reg;
int tmp_reg; int tmp_reg;
int work_reg; int work_reg;
int result_reg; int result_reg;
short opcode; Opcode opcode;
symbol_operand(&temp_op, maketemporary((Type *) &stdouble)); symbol_operand(&temp_op, maketemporary(TYPE(&stdouble)));
coerce_to_addressable(&temp_op); coerce_to_addressable(&temp_op);
d = *((double *) &uns_to_float_cc); d.value = *((double *) &uns_to_float_cc);
const_reg = used_virtual_registers[RegClass_FPR]++; const_reg = used_virtual_registers[RegClass_FPR]++;
load_floating_constant(const_reg, &stdouble, &d); load_floating_constant(const_reg, TYPE(&stdouble), &d);
load_store_register(PC_STW, op->reg, temp_op.reg, temp_op.object, low_offset); load_store_register(PC_STW, op->reg, temp_op.reg, temp_op.object, low_offset);
@ -925,10 +952,6 @@ void convert_unsigned_to_floating(Operand *op, Boolean is_single, short output_r
load_store_register(PC_LFD, work_reg = used_virtual_registers[RegClass_FPR]++, temp_op.reg, temp_op.object, 0); load_store_register(PC_LFD, work_reg = used_virtual_registers[RegClass_FPR]++, temp_op.reg, temp_op.object, 0);
result_reg = output_reg ? output_reg : used_virtual_registers[RegClass_FPR]++; result_reg = output_reg ? output_reg : used_virtual_registers[RegClass_FPR]++;
//opcode = PC_FSUB;
//if (is_single)
// opcode = PC_FSUBS;
//opcode = (is_single != 0) ? PC_FSUBS : PC_FSUB;
if (is_single != 0) if (is_single != 0)
opcode = PC_FSUBS; opcode = PC_FSUBS;
else else
@ -944,7 +967,7 @@ void convert_floating_to_integer(Operand *op, short output_reg) {
int tmp_reg; int tmp_reg;
int result_reg; int result_reg;
symbol_operand(&temp_op, maketemporary((Type *) &stdouble)); symbol_operand(&temp_op, maketemporary(TYPE(&stdouble)));
coerce_to_addressable(&temp_op); coerce_to_addressable(&temp_op);
tmp_reg = used_virtual_registers[RegClass_FPR]++; tmp_reg = used_virtual_registers[RegClass_FPR]++;
@ -1004,11 +1027,10 @@ void load_address(short dest_reg, Operand *op) {
coerce_to_addressable(op); coerce_to_addressable(op);
if (op->optype == OpndType_IndirectGPR_ImmOffset) { if (op->optype == OpndType_IndirectGPR_ImmOffset) {
if (!op->immOffset && !op->object) { if (!op->immOffset && !op->object) {
if (op->reg != dest_reg) { if (op->reg != dest_reg)
emitpcode(PC_MR, dest_reg, op->reg); emitpcode(PC_MR, dest_reg, op->reg);
}
} else { } else {
add_immediate(dest_reg, op->reg, op->object, op->immOffset); add_immediate(dest_reg, op->reg, op->object, (SInt16) op->immOffset);
} }
} else if (op->optype == OpndType_IndirectGPR_Indexed) { } else if (op->optype == OpndType_IndirectGPR_Indexed) {
emitpcode(PC_ADD, dest_reg, op->reg, op->regOffset); emitpcode(PC_ADD, dest_reg, op->reg, op->regOffset);

View File

@ -51,7 +51,7 @@ PCode *copypcode(PCode *pcode) {
int i; int i;
extra_arg = 0; extra_arg = 0;
if ((PCODE_FLAG_SET_F(pcode) & fPCodeFlag8000000) && !(PCODE_FLAG_SET_F(pcode) & fPCodeFlag20000000)) if ((PCODE_FLAG_SET_F(pcode) & fCanSetRecordBit) && !(PCODE_FLAG_SET_F(pcode) & fRecordBit))
extra_arg = 1; extra_arg = 1;
newpc = lalloc(sizeof(PCode) + sizeof(PCodeArg) * (pcode->argCount + extra_arg)); newpc = lalloc(sizeof(PCode) + sizeof(PCodeArg) * (pcode->argCount + extra_arg));
@ -148,7 +148,7 @@ void deleteblock(PCodeBlock *block) {
block->prevBlock->nextBlock = block->nextBlock; block->prevBlock->nextBlock = block->nextBlock;
if (block->nextBlock) if (block->nextBlock)
block->nextBlock->prevBlock = block->prevBlock; block->nextBlock->prevBlock = block->prevBlock;
block->flags |= fPCBlockFlag20; block->flags |= fDeleted;
} }
void deleteunreachableblocks(void) { void deleteunreachableblocks(void) {
@ -157,7 +157,7 @@ void deleteunreachableblocks(void) {
computedepthfirstordering(); computedepthfirstordering();
for (block = pcbasicblocks->nextBlock; block; block = block->nextBlock) { for (block = pcbasicblocks->nextBlock; block; block = block->nextBlock) {
if (!(block->flags & fPCBlockFlag4)) if (!(block->flags & fVisited))
deleteblock(block); deleteblock(block);
} }
} }
@ -193,7 +193,7 @@ void deletepcode(PCode *pcode) {
pcode->block = 0; pcode->block = 0;
block->pcodeCount--; block->pcodeCount--;
block->flags &= ~fPCBlockFlag8; block->flags &= ~fScheduled;
} }
void insertpcodebefore(PCode *anchor, PCode *newpcode) { void insertpcodebefore(PCode *anchor, PCode *newpcode) {
@ -211,7 +211,7 @@ void insertpcodebefore(PCode *anchor, PCode *newpcode) {
newpcode->block = block; newpcode->block = block;
block->pcodeCount++; block->pcodeCount++;
block->flags &= ~fPCBlockFlag8; block->flags &= ~fScheduled;
} }
void insertpcodeafter(PCode *anchor, PCode *newpcode) { void insertpcodeafter(PCode *anchor, PCode *newpcode) {
@ -229,13 +229,13 @@ void insertpcodeafter(PCode *anchor, PCode *newpcode) {
newpcode->block = block; newpcode->block = block;
block->pcodeCount++; block->pcodeCount++;
block->flags &= ~fPCBlockFlag8; block->flags &= ~fScheduled;
} }
void setpcodeflags(int flags) { void setpcodeflags(int flags) {
pclastblock->lastPCode->flags |= flags; pclastblock->lastPCode->flags |= flags;
if (flags & fSideEffects) if (flags & fSideEffects)
pclastblock->lastPCode->flags &= ~(fIsCSE | fCommutative | fPCodeFlag10); pclastblock->lastPCode->flags &= ~(fIsCSE | fCommutative | fIsMove);
} }
void clearpcodeflags(int flags) { void clearpcodeflags(int flags) {
@ -273,11 +273,11 @@ void computedepthfirstordering(void) {
depthfirstorder = pcblockcount; depthfirstorder = pcblockcount;
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
block->flags &= ~fPCBlockFlag4; block->flags &= ~fVisited;
} }
dfo = (DFO *) oalloc(sizeof(DFO) * pcblockcount); dfo = (DFO *) oalloc(sizeof(DFO) * pcblockcount);
pcbasicblocks->flags |= fPCBlockFlag4; pcbasicblocks->flags |= fVisited;
dfo->block = pcbasicblocks; dfo->block = pcbasicblocks;
dfo->link = pcbasicblocks->successors; dfo->link = pcbasicblocks->successors;
@ -286,8 +286,8 @@ void computedepthfirstordering(void) {
if ((link = dfo[index - 1].link)) { if ((link = dfo[index - 1].link)) {
dfo[index - 1].link = link->nextLink; dfo[index - 1].link = link->nextLink;
block = link->block; block = link->block;
if (!(block->flags & fPCBlockFlag4)) { if (!(block->flags & fVisited)) {
block->flags |= fPCBlockFlag4; block->flags |= fVisited;
dfo[index].block = block; dfo[index].block = block;
dfo[index].link = block->successors; dfo[index].link = block->successors;
index++; index++;

View File

@ -361,7 +361,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[0].data.reg.reg << 21; bits |= instr->args[0].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 16; bits |= instr->args[1].data.reg.reg << 16;
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -403,7 +403,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[1].data.reg.reg << 16; bits |= instr->args[1].data.reg.reg << 16;
if (PCODE_FLAG_SET_F(instr) & fOverflow) if (PCODE_FLAG_SET_F(instr) & fOverflow)
bits |= 0x400; bits |= 0x400;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -459,7 +459,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[0].data.reg.reg << 16; bits |= instr->args[0].data.reg.reg << 16;
bits |= instr->args[1].data.reg.reg << 21; bits |= instr->args[1].data.reg.reg << 21;
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -468,7 +468,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
case PC_CNTLZW: case PC_CNTLZW:
bits |= instr->args[0].data.reg.reg << 16; bits |= instr->args[0].data.reg.reg << 16;
bits |= instr->args[1].data.reg.reg << 21; bits |= instr->args[1].data.reg.reg << 21;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -476,7 +476,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[0].data.reg.reg << 16; bits |= instr->args[0].data.reg.reg << 16;
bits |= instr->args[1].data.reg.reg << 21; bits |= instr->args[1].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 11; bits |= instr->args[1].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -484,7 +484,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[0].data.reg.reg << 16; bits |= instr->args[0].data.reg.reg << 16;
bits |= instr->args[1].data.reg.reg << 21; bits |= instr->args[1].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 11; bits |= instr->args[1].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -492,7 +492,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[0].data.reg.reg << 16; bits |= instr->args[0].data.reg.reg << 16;
bits |= instr->args[1].data.reg.reg << 21; bits |= instr->args[1].data.reg.reg << 21;
bits |= (instr->args[2].data.imm.value & 31) << 11; bits |= (instr->args[2].data.imm.value & 31) << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -503,7 +503,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= (instr->args[2].data.imm.value & 31) << 11; bits |= (instr->args[2].data.imm.value & 31) << 11;
bits |= (instr->args[3].data.imm.value & 31) << 6; bits |= (instr->args[3].data.imm.value & 31) << 6;
bits |= (instr->args[4].data.imm.value & 31) << 1; bits |= (instr->args[4].data.imm.value & 31) << 1;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -513,7 +513,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
bits |= (instr->args[3].data.imm.value & 31) << 6; bits |= (instr->args[3].data.imm.value & 31) << 6;
bits |= (instr->args[4].data.imm.value & 31) << 1; bits |= (instr->args[4].data.imm.value & 31) << 1;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -545,7 +545,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
case PC_MFFS: case PC_MFFS:
bits |= instr->args[0].data.reg.reg << 21; bits |= instr->args[0].data.reg.reg << 21;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -557,7 +557,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
case PC_MTFSF: case PC_MTFSF:
bits |= (instr->args[0].data.imm.value & 0xFF) << 17; bits |= (instr->args[0].data.imm.value & 0xFF) << 17;
bits |= instr->args[1].data.reg.reg << 11; bits |= instr->args[1].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -572,7 +572,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
case PC_FCTIWZ: case PC_FCTIWZ:
bits |= instr->args[0].data.reg.reg << 21; bits |= instr->args[0].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 11; bits |= instr->args[1].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -585,7 +585,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[0].data.reg.reg << 21; bits |= instr->args[0].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 16; bits |= instr->args[1].data.reg.reg << 16;
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -604,7 +604,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[0].data.reg.reg << 21; bits |= instr->args[0].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 16; bits |= instr->args[1].data.reg.reg << 16;
bits |= instr->args[2].data.reg.reg << 6; bits |= instr->args[2].data.reg.reg << 6;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -714,14 +714,14 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
case PC_MTFSB0: case PC_MTFSB0:
case PC_MTFSB1: case PC_MTFSB1:
bits |= (instr->args[0].data.imm.value & 31) << 21; bits |= (instr->args[0].data.imm.value & 31) << 21;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
case PC_MTFSFI: case PC_MTFSFI:
bits |= instr->args[0].data.reg.reg << 23; bits |= instr->args[0].data.reg.reg << 23;
bits |= (instr->args[1].data.imm.value & 15) << 12; bits |= (instr->args[1].data.imm.value & 15) << 12;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -729,7 +729,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
case PC_FSQRTS: case PC_FSQRTS:
bits |= instr->args[0].data.reg.reg << 21; bits |= instr->args[0].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 11; bits |= instr->args[1].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -761,7 +761,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[1].data.reg.reg << 21; bits |= instr->args[1].data.reg.reg << 21;
bits |= instr->args[0].data.reg.reg << 16; bits |= instr->args[0].data.reg.reg << 16;
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -769,7 +769,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[0].data.reg.reg << 21; bits |= instr->args[0].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 16; bits |= instr->args[1].data.reg.reg << 16;
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -782,7 +782,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fOverflow) if (PCODE_FLAG_SET_F(instr) & fOverflow)
bits |= 0x400; bits |= 0x400;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -792,14 +792,14 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[1].data.reg.reg << 16; bits |= instr->args[1].data.reg.reg << 16;
if (PCODE_FLAG_SET_F(instr) & fOverflow) if (PCODE_FLAG_SET_F(instr) & fOverflow)
bits |= 0x400; bits |= 0x400;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
case PC_CLCS: case PC_CLCS:
bits |= instr->args[0].data.reg.reg << 21; bits |= instr->args[0].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 16; bits |= instr->args[1].data.reg.reg << 16;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -815,7 +815,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
bits |= (instr->args[3].data.imm.value & 31) << 6; bits |= (instr->args[3].data.imm.value & 31) << 6;
bits |= (instr->args[4].data.imm.value & 31) << 1; bits |= (instr->args[4].data.imm.value & 31) << 1;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -833,7 +833,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[1].data.reg.reg << 21; bits |= instr->args[1].data.reg.reg << 21;
bits |= instr->args[0].data.reg.reg << 16; bits |= instr->args[0].data.reg.reg << 16;
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -845,7 +845,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[1].data.reg.reg << 21; bits |= instr->args[1].data.reg.reg << 21;
bits |= instr->args[0].data.reg.reg << 16; bits |= instr->args[0].data.reg.reg << 16;
bits |= (instr->args[2].data.imm.value & 31) << 11; bits |= (instr->args[2].data.imm.value & 31) << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 1; bits |= 1;
break; break;
@ -1048,7 +1048,7 @@ UInt32 assemblepcode(PCode *instr, UInt32 offset, WeirdOperand *wop) {
bits |= instr->args[0].data.reg.reg << 21; bits |= instr->args[0].data.reg.reg << 21;
bits |= instr->args[1].data.reg.reg << 16; bits |= instr->args[1].data.reg.reg << 16;
bits |= instr->args[2].data.reg.reg << 11; bits |= instr->args[2].data.reg.reg << 11;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
bits |= 0x400; bits |= 0x400;
break; break;
@ -1172,13 +1172,13 @@ static void insertlongbranches(SInt32 mask) {
block->codeOffset = i; block->codeOffset = i;
if (block->pcodeCount) { if (block->pcodeCount) {
i += block->pcodeCount * 4; i += block->pcodeCount * 4;
if (block->pcodeCount && (block->lastPCode->flags & fPCodeFlag1)) if (block->pcodeCount && (block->lastPCode->flags & fIsBranch))
i += 4; i += 4;
} }
} }
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
if (block->pcodeCount && (block->lastPCode->flags & fPCodeFlag1)) { if (block->pcodeCount && (block->lastPCode->flags & fIsBranch)) {
switch (block->lastPCode->op) { switch (block->lastPCode->op) {
case PC_BT: case PC_BT:
case PC_BF: case PC_BF:
@ -1313,7 +1313,7 @@ SInt32 optimizefinalbranches(SInt32 codesize) {
continue; continue;
instr = block->lastPCode; instr = block->lastPCode;
if (!(instr->flags & fPCodeFlag1)) if (!(instr->flags & fIsBranch))
continue; continue;
offset = block->codeOffset + (block->pcodeCount - 1) * 4; offset = block->codeOffset + (block->pcodeCount - 1) * 4;

View File

@ -126,10 +126,10 @@ PCode *vformatpcode(short opcode, va_list argList) {
int tmp; int tmp;
int tmp2; // r19 int tmp2; // r19
int i; int i;
int thing; SInt32 thing;
int thing2; SInt32 thing2;
int thing3; SInt32 thing3;
int thing4; SInt32 thing4;
Object *obj; Object *obj;
PCodeLabel *label; PCodeLabel *label;
char c; char c;
@ -146,7 +146,7 @@ PCode *vformatpcode(short opcode, va_list argList) {
format++; format++;
} }
if (info->flags & fPCodeFlag8000000) if (info->flags & fCanSetRecordBit)
unkreg_r22 = 1; unkreg_r22 = 1;
if ((argcount + unkreg_r22) < 5) if ((argcount + unkreg_r22) < 5)
@ -474,7 +474,7 @@ PCode *vformatpcode(short opcode, va_list argList) {
arg->data.mem.obj = obj; arg->data.mem.obj = obj;
arg->data.mem.offset = va_arg(argList, SInt32); arg->data.mem.offset = va_arg(argList, SInt32);
if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) { if (pcode->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000)) {
pcode->alias = make_alias(obj, arg->data.mem.offset, nbytes_loaded_or_stored_by(pcode)); pcode->alias = make_alias(obj, arg->data.mem.offset, nbytes_loaded_or_stored_by(pcode));
if (is_volatile_object(obj)) if (is_volatile_object(obj))
pcode->flags |= fIsVolatile; pcode->flags |= fIsVolatile;
@ -486,7 +486,7 @@ PCode *vformatpcode(short opcode, va_list argList) {
pcode->alias = make_alias(obj, arg->data.mem.offset, 1); pcode->alias = make_alias(obj, arg->data.mem.offset, 1);
} }
CError_ASSERT(536, obj->datatype == DLOCAL || arg->data.mem.offset == 0); CError_ASSERT(536, obj->datatype == DLOCAL || arg->data.mem.offset == 0);
if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) { if (pcode->flags & (fIsRead | fIsWrite)) {
//if ((obj->type->type == TYPEPOINTER || obj->type->type == TYPEARRAY) ? (TYPE_POINTER(obj->type)->qual & Q_VOLATILE) : (obj->qual & Q_VOLATILE)) //if ((obj->type->type == TYPEPOINTER || obj->type->type == TYPEARRAY) ? (TYPE_POINTER(obj->type)->qual & Q_VOLATILE) : (obj->qual & Q_VOLATILE))
if (OBJ_GET_TARGET_VOLATILE(obj)) if (OBJ_GET_TARGET_VOLATILE(obj))
pcode->flags |= fIsVolatile; pcode->flags |= fIsVolatile;
@ -495,7 +495,7 @@ PCode *vformatpcode(short opcode, va_list argList) {
pcode->flags |= fIsConst; pcode->flags |= fIsConst;
} }
if (pcode->flags & (fPCodeFlag1 | fPCodeFlag8)) { if (pcode->flags & (fIsBranch | fIsCall)) {
arg->arg = RefType_4; arg->arg = RefType_4;
} else if (obj->datatype == DLOCAL) { } else if (obj->datatype == DLOCAL) {
if (!local_is_16bit_offset(obj)) if (!local_is_16bit_offset(obj))
@ -510,8 +510,8 @@ PCode *vformatpcode(short opcode, va_list argList) {
arg->kind = PCOp_IMMEDIATE; arg->kind = PCOp_IMMEDIATE;
arg->data.imm.value = va_arg(argList, SInt32); arg->data.imm.value = va_arg(argList, SInt32);
arg->data.imm.obj = NULL; arg->data.imm.obj = NULL;
if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) if (pcode->flags & (fIsRead | fIsWrite))
pcode->flags |= fPCodeFlag20; pcode->flags |= fIsPtrOp;
} }
break; break;
@ -530,7 +530,7 @@ PCode *vformatpcode(short opcode, va_list argList) {
arg->data.mem.offset = va_arg(argList, SInt32); arg->data.mem.offset = va_arg(argList, SInt32);
CError_ASSERT(590, obj->datatype == DLOCAL || arg->data.mem.offset == 0); CError_ASSERT(590, obj->datatype == DLOCAL || arg->data.mem.offset == 0);
if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) { if (pcode->flags & (fIsRead | fIsWrite)) {
//if ((obj->type->type == TYPEPOINTER || obj->type->type == TYPEARRAY) ? (TYPE_POINTER(obj->type)->qual & Q_VOLATILE) : (obj->qual & Q_VOLATILE)) //if ((obj->type->type == TYPEPOINTER || obj->type->type == TYPEARRAY) ? (TYPE_POINTER(obj->type)->qual & Q_VOLATILE) : (obj->qual & Q_VOLATILE))
if (OBJ_GET_TARGET_VOLATILE(obj)) if (OBJ_GET_TARGET_VOLATILE(obj))
pcode->flags |= fIsVolatile; pcode->flags |= fIsVolatile;
@ -549,8 +549,8 @@ PCode *vformatpcode(short opcode, va_list argList) {
arg->kind = PCOp_IMMEDIATE; arg->kind = PCOp_IMMEDIATE;
arg->data.imm.value = va_arg(argList, SInt32); arg->data.imm.value = va_arg(argList, SInt32);
arg->data.imm.obj = NULL; arg->data.imm.obj = NULL;
if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) if (pcode->flags & (fIsRead | fIsWrite))
pcode->flags |= fPCodeFlag20; pcode->flags |= fIsPtrOp;
} }
break; break;
@ -800,9 +800,9 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) {
int i; int i;
int tmp; int tmp;
int tmp2; int tmp2;
int thing; SInt32 thing;
int thing2; SInt32 thing2;
int thing4; SInt32 thing4;
char c; char c;
int flagSetT; int flagSetT;
int flagSetF; int flagSetF;
@ -1048,7 +1048,7 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) {
buf += expectandformatoperand(pa, PCOp_MEMORY, 0, -1, buf); buf += expectandformatoperand(pa, PCOp_MEMORY, 0, -1, buf);
else if (pa->kind == PCOp_LABELDIFF) else if (pa->kind == PCOp_LABELDIFF)
buf += expectandformatoperand(pa, PCOp_LABELDIFF, 0, -1, buf); buf += expectandformatoperand(pa, PCOp_LABELDIFF, 0, -1, buf);
else if ((pcode->flags & (fPCodeFlag1 | fPCodeFlag8)) && (pa->kind == PCOp_LABEL)) else if ((pcode->flags & (fIsBranch | fIsCall)) && (pa->kind == PCOp_LABEL))
buf += expectandformatoperand(pa, PCOp_LABEL, 0, -1, buf); buf += expectandformatoperand(pa, PCOp_LABEL, 0, -1, buf);
else else
buf += expectandformatoperand(pa, PCOp_IMMEDIATE, 0, -1, buf); buf += expectandformatoperand(pa, PCOp_IMMEDIATE, 0, -1, buf);
@ -1122,6 +1122,7 @@ void formatoperands(PCode *pcode, char *buf, int showBasicBlocks) {
if (pcode->flags & fCommutative) if (pcode->flags & fCommutative)
buf += sprintf(buf, "; fCommutative"); buf += sprintf(buf, "; fCommutative");
// i think these are the wrong way round lol
if (flagSetT & fIsPtrOp) if (flagSetT & fIsPtrOp)
buf += sprintf(buf, "; fIsPtrOp"); buf += sprintf(buf, "; fIsPtrOp");
@ -1158,7 +1159,7 @@ int can_reuse_stored_value(PCode *a, PCode *b) {
int nbytes_loaded_or_stored_by(PCode *pcode) { int nbytes_loaded_or_stored_by(PCode *pcode) {
OpcodeInfo *oinfo = opcodeinfo + pcode->op; OpcodeInfo *oinfo = opcodeinfo + pcode->op;
if (oinfo->flags & (fPCodeFlag2 | fPCodeFlag4)) { if (oinfo->flags & (fIsRead | fIsWrite)) {
switch (pcode->op) { switch (pcode->op) {
case PC_LBZ: case PC_LBZ:
case PC_LBZU: case PC_LBZU:
@ -1265,7 +1266,7 @@ void change_num_operands(PCode *pcode, int newNum) {
void change_opcode(PCode *pcode, short opcode) { void change_opcode(PCode *pcode, short opcode) {
pcode->flags = (pcode->flags & ~(opcodeinfo[pcode->op].flags & ~fIsPtrOp)) | opcodeinfo[opcode].flags; pcode->flags = (pcode->flags & ~(opcodeinfo[pcode->op].flags & ~fIsPtrOp)) | opcodeinfo[opcode].flags;
if ((pcode->flags & fPCodeFlag10) && (PCODE_FLAG_SET_F(pcode) & fPCodeFlag20000000)) if ((pcode->flags & fIsMove) && (PCODE_FLAG_SET_F(pcode) & fRecordBit))
pcode->flags &= ~fPCodeFlag10; pcode->flags &= ~fIsMove;
pcode->op = opcode; pcode->op = opcode;
} }

View File

@ -55,7 +55,7 @@ static void pclistblock(PCodeBlock *block, char *format, UInt32 vecSize) {
UInt32 opcode; UInt32 opcode;
MachineInfo *mi; MachineInfo *mi;
char buf[500]; char buf[500];
PCodeArg dummyArg; WeirdOperand dummyArg;
fprintf(pcfile, ":{%4.4x}::::::::::::::::::::::::::::::::::::::::LOOPWEIGHT=%ld\n", block->flags, block->loopWeight); fprintf(pcfile, ":{%4.4x}::::::::::::::::::::::::::::::::::::::::LOOPWEIGHT=%ld\n", block->flags, block->loopWeight);
fprintf(pcfile, "B%ld: ", block->blockIndex); fprintf(pcfile, "B%ld: ", block->blockIndex);
@ -107,7 +107,7 @@ static void pclistblock(PCodeBlock *block, char *format, UInt32 vecSize) {
for (offset = block->codeOffset, instr = block->firstPCode; instr; instr = instr->nextPCode, offset += 4) { for (offset = block->codeOffset, instr = block->firstPCode; instr; instr = instr->nextPCode, offset += 4) {
latency = mi->latency(instr); latency = mi->latency(instr);
formatoperands(instr, buf, 1); formatoperands(instr, buf, 1);
chr = (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) ? '.' : ' '; chr = (PCODE_FLAG_SET_F(instr) & fRecordBit) ? '.' : ' ';
if (coloring) if (coloring)
opcode = 0; opcode = 0;
else else
@ -145,7 +145,7 @@ static void pclistonoff(int flag) {
fprintf(pcfile, "Off\n"); fprintf(pcfile, "Off\n");
} }
void pcinitlisting(void) { void pcinitlisting() {
// unknown args, etc // unknown args, etc
} }
@ -155,58 +155,58 @@ void pccleanuplisting(void) {
void pclistblocks(char *name1, char *name2) { void pclistblocks(char *name1, char *name2) {
} }
void pclistdataflow(void) { void pclistdataflow() {
// unknown args // unknown args
} }
void pclistinterferences(char *class_format, int regcount) { void pclistinterferences(char *class_format, int regcount) {
} }
void pclistspill(void) { void pclistspill() {
// unknown args // unknown args
} }
void pclistcopypropitem(void) { void pclistcopypropitem() {
// unknown args // unknown args
} }
void pclistcoalesce(void) { void pclistcoalesce() {
// unknown args // unknown args
} }
void pclistusedefs(void) { void pclistusedefs() {
// unknown args // unknown args
} }
void pclistpropinfo(void) { void pclistpropinfo() {
// unknown args // unknown args
} }
static void listloop(void) { static void listloop() {
// unknown args // unknown args
} }
static void listloops(void) { static void listloops() {
// unknown args // unknown args
} }
void pclistloops(void) { void pclistloops() {
// unknown args // unknown args
} }
static void listswitchtables(void) { static void listswitchtables() {
// unknown args // unknown args
} }
void pclistswitchtables(void) { void pclistswitchtables() {
// unknown args // unknown args
} }
void pclistdominators(void) { void pclistdominators() {
// unknown args // unknown args
} }
void pclistbackedge(void) { void pclistbackedge() {
// unknown args // unknown args
} }
@ -264,15 +264,15 @@ static char *GetInterferenceFlags(IGNode *node) {
return buf; return buf;
} }
void pclistinterferencegraphnode(void) { void pclistinterferencegraphnode() {
// unknown args // unknown args
} }
void pclistinterferencegraph(void) { void pclistinterferencegraph() {
// unknown args // unknown args
} }
void pclistblock_scheduler(void) { void pclistblock_scheduler() {
// unknown args // unknown args
} }
@ -284,15 +284,15 @@ void pclistblocks_end_scheduler(void) {
CError_FATAL(1318); CError_FATAL(1318);
} }
static void printheapsize(void) { static void printheapsize() {
// unknown args // unknown args
} }
void pctotalheap(void) { void pctotalheap() {
// unknown args // unknown args
} }
void pctotalmemory(void) { void pctotalmemory() {
// unknown args // unknown args
} }
@ -468,7 +468,7 @@ int dumpalias(Alias *alias, int len, Boolean flag1, Boolean flag2) {
} }
} }
void pcformatset(void) { void pcformatset() {
// unknown args // unknown args
} }
@ -506,11 +506,11 @@ int GetLineOffset(char *str, int lineNum, int len) {
return 0; return 0;
} }
void DumpSourceCode(void) { void DumpSourceCode() {
// unknown args // unknown args
} }
int DumpIR_SrcBreak(void) { int DumpIR_SrcBreak() {
// unknown args // unknown args
return 0; return 0;
} }

View File

@ -1,6 +1,9 @@
#include "compiler/PCodeUtilities.h" #include "compiler/PCodeUtilities.h"
#include "compiler/CError.h" #include "compiler/CError.h"
#include "compiler/CFunc.h"
#include "compiler/CParser.h" #include "compiler/CParser.h"
#include "compiler/CodeGen.h"
#include "compiler/Exceptions.h"
#include "compiler/PCode.h" #include "compiler/PCode.h"
#include "compiler/PCodeInfo.h" #include "compiler/PCodeInfo.h"
#include "compiler/Registers.h" #include "compiler/Registers.h"
@ -13,20 +16,20 @@ void pcsetrecordbit(PCode *pc) {
short argCount; short argCount;
int argIdx; int argIdx;
pc->flags &= ~(fPCodeFlag10 | fCommutative | fIsCSE); pc->flags &= ~(fIsMove | fCommutative | fIsCSE);
if ((pc->flags & (fPCodeFlag80000000 | fPCodeFlag40000000)) == fPCodeFlag40000000) { if ((pc->flags & fOpTypeMask) == fOpTypeFPR) {
reg = 1; reg = 1;
} else if ((pc->flags & (fPCodeFlag80000000 | fPCodeFlag40000000)) == (fPCodeFlag80000000 | fPCodeFlag40000000)) { } else if ((pc->flags & fOpTypeMask) == fOpTypeVR) {
reg = 6; reg = 6;
} else { } else {
reg = 0; reg = 0;
} }
if (pc->op == PC_ANDI || pc->op == PC_ANDIS) { if (pc->op == PC_ANDI || pc->op == PC_ANDIS) {
pc->flags |= fPCodeFlag20000000; pc->flags |= fRecordBit;
} else if (pc->op == PC_ADDI || pc->op == PC_ADDIC) { } else if (pc->op == PC_ADDI || pc->op == PC_ADDIC) {
pc->flags |= fPCodeFlag10000000; pc->flags |= fSetsCarry;
pc->flags |= fPCodeFlag20000000; pc->flags |= fRecordBit;
change_num_operands(pc, 5); change_num_operands(pc, 5);
pc->op = PC_ADDICR; pc->op = PC_ADDICR;
@ -46,7 +49,7 @@ void pcsetrecordbit(PCode *pc) {
while (arg->kind != PCOp_PLACEHOLDEROPERAND && argIdx) { while (arg->kind != PCOp_PLACEHOLDEROPERAND && argIdx) {
if (arg->kind == PCOp_REGISTER && arg->arg == RegClass_CRFIELD && arg->data.reg.reg == reg) { if (arg->kind == PCOp_REGISTER && arg->arg == RegClass_CRFIELD && arg->data.reg.reg == reg) {
arg->data.reg.effect |= EffectWrite; arg->data.reg.effect |= EffectWrite;
pc->flags |= fPCodeFlag20000000; pc->flags |= fRecordBit;
return; return;
} }
arg++; arg++;
@ -64,12 +67,12 @@ void pcsetrecordbit(PCode *pc) {
arg->data.reg.reg = reg; arg->data.reg.reg = reg;
arg->data.reg.effect = EffectWrite; arg->data.reg.effect = EffectWrite;
if (pc->op != PC_ADDICR) if (pc->op != PC_ADDICR)
pc->flags |= fPCodeFlag20000000; pc->flags |= fRecordBit;
} }
} }
void pcsetsideeffects(PCode *pc) { void pcsetsideeffects(PCode *pc) {
pc->flags &= ~(fPCodeFlag10 | fCommutative | fIsCSE); pc->flags &= ~(fIsMove | fCommutative | fIsCSE);
pc->flags |= fSideEffects; pc->flags |= fSideEffects;
} }
@ -107,9 +110,9 @@ void pcsetlinkbit(PCode *pc) {
arg->data.reg.reg = 1; arg->data.reg.reg = 1;
arg->data.reg.effect = EffectWrite; arg->data.reg.effect = EffectWrite;
if (opcodeinfo[pc->op].flags & fPCodeFlag8) { if (opcodeinfo[pc->op].flags & fIsCall) {
pc->flags &= ~fPCodeFlag1; pc->flags &= ~fIsBranch;
pc->flags |= fPCodeFlag8; pc->flags |= fIsCall;
} }
pc->flags |= fLink; pc->flags |= fLink;
} }

View File

@ -188,9 +188,9 @@ static int dead(PCode *instr, UInt32 *masks) {
int i; int i;
PCodeArg *op; PCodeArg *op;
if (instr->block->flags & (fPCBlockFlag1 | fPCBlockFlag2)) if (instr->block->flags & (fIsProlog | fIsEpilogue))
return 0; return 0;
if (instr->flags & (fPCodeFlag1 | fPCodeFlag4 | fPCodeFlag8 | fIsVolatile | fSideEffects)) if (instr->flags & (fIsBranch | fIsWrite | fIsCall | fIsVolatile | fSideEffects))
return 0; return 0;
if (!instr->block->predecessors) if (!instr->block->predecessors)
return 1; return 1;
@ -354,10 +354,10 @@ static int canuseupdatetest(PCodeBlock *block, PCode *instr, int count1, int cou
return 1; return 1;
} }
if (instr->flags & (fPCodeFlag2 | fPCodeFlag4)) { if (instr->flags & (fIsRead | fIsWrite)) {
if (++count4 > 1) if (++count4 > 1)
return 1; return 1;
} else if (instr->flags & fPCodeFlag1) { } else if (instr->flags & fIsBranch) {
if (++count2 > 2) if (++count2 > 2)
return 1; return 1;
@ -389,7 +389,7 @@ static int canuseupdate(PCode *instr) {
static int MR_Rx_Rx(PCode *instr, UInt32 *masks) { static int MR_Rx_Rx(PCode *instr, UInt32 *masks) {
if ( if (
instr->args[0].data.reg.reg == instr->args[1].data.reg.reg && instr->args[0].data.reg.reg == instr->args[1].data.reg.reg &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) !(PCODE_FLAG_SET_F(instr) & fRecordBit)
) )
{ {
deletepcode(instr); deletepcode(instr);
@ -402,7 +402,7 @@ static int MR_Rx_Rx(PCode *instr, UInt32 *masks) {
static int FMR_Fx_Fx(PCode *instr, UInt32 *masks) { static int FMR_Fx_Fx(PCode *instr, UInt32 *masks) {
if ( if (
instr->args[0].data.reg.reg == instr->args[1].data.reg.reg && instr->args[0].data.reg.reg == instr->args[1].data.reg.reg &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) !(PCODE_FLAG_SET_F(instr) & fRecordBit)
) )
{ {
deletepcode(instr); deletepcode(instr);
@ -415,7 +415,7 @@ static int FMR_Fx_Fx(PCode *instr, UInt32 *masks) {
static int VMR_Vx_Vx(PCode *instr, UInt32 *masks) { static int VMR_Vx_Vx(PCode *instr, UInt32 *masks) {
if ( if (
instr->args[0].data.reg.reg == instr->args[1].data.reg.reg && instr->args[0].data.reg.reg == instr->args[1].data.reg.reg &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) !(PCODE_FLAG_SET_F(instr) & fRecordBit)
) )
{ {
deletepcode(instr); deletepcode(instr);
@ -432,7 +432,7 @@ static int MR_MR(PCode *instr, UInt32 *masks) {
defInstr->op == PC_MR && defInstr->op == PC_MR &&
instr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg && instr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg &&
!definedbetween(instr, defInstr, &instr->args[0]) && !definedbetween(instr, defInstr, &instr->args[0]) &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) !(PCODE_FLAG_SET_F(instr) & fRecordBit)
) )
{ {
deletepcode(instr); deletepcode(instr);
@ -448,7 +448,7 @@ static int FMR_FMR(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_FMR && defInstr->op == PC_FMR &&
instr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg && instr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
!definedbetween(instr, defInstr, &instr->args[0]) !definedbetween(instr, defInstr, &instr->args[0])
) )
{ {
@ -465,7 +465,7 @@ static int VMR_VMR(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_VMR && defInstr->op == PC_VMR &&
instr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg && instr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
!definedbetween(instr, defInstr, &instr->args[0]) !definedbetween(instr, defInstr, &instr->args[0])
) )
{ {
@ -485,11 +485,11 @@ static int VMR_VMRP(PCode *instr, UInt32 *masks) {
int nextPermute = 0; int nextPermute = 0;
if (prev) { if (prev) {
prevFlag = (prev->flags & fPCodeFlagC0000000) == fPCodeFlagC0000000; prevFlag = (prev->flags & fOpTypeMask) == fOpTypeVR;
prevPermute = uses_vpermute_unit(prev); prevPermute = uses_vpermute_unit(prev);
} }
if (next) { if (next) {
nextFlag = (next->flags & fPCodeFlagC0000000) == fPCodeFlagC0000000; nextFlag = (next->flags & fOpTypeMask) == fOpTypeVR;
nextPermute = uses_vpermute_unit(next); nextPermute = uses_vpermute_unit(next);
} }
@ -529,7 +529,7 @@ static int MR_CMPI(PCode *instr, UInt32 *masks) {
if ( if (
instr->args[0].data.reg.reg == 0 && instr->args[0].data.reg.reg == 0 &&
instr->args[2].data.imm.value == 0 && instr->args[2].data.imm.value == 0 &&
(PCODE_FLAG_SET_F(defInstr) & (fSideEffects | fPCodeFlag8000000 | fPCodeFlag80000000)) == (fPCodeFlag8000000 | fPCodeFlag80000000) && (PCODE_FLAG_SET_F(defInstr) & (fSideEffects | fCanSetRecordBit | fOpTypeGPR)) == (fCanSetRecordBit | fOpTypeGPR) &&
!usedbetween(instr, defInstr, &instr->args[0]) && !usedbetween(instr, defInstr, &instr->args[0]) &&
!definedbetween(instr, defInstr, &instr->args[0]) !definedbetween(instr, defInstr, &instr->args[0])
) )
@ -557,7 +557,7 @@ static int EXTSB_RLWINM(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_EXTSB && defInstr->op == PC_EXTSB &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(defInstr) & fRecordBit) &&
!definedbetween(instr, defInstr, &defInstr->args[1]) && !definedbetween(instr, defInstr, &defInstr->args[1]) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
(extractedbits(instr) & 0xFFFFFF00) == 0 (extractedbits(instr) & 0xFFFFFF00) == 0
@ -578,7 +578,7 @@ static int EXTSH_RLWINM(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_EXTSH && defInstr->op == PC_EXTSH &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(defInstr) & fRecordBit) &&
!definedbetween(instr, defInstr, &defInstr->args[1]) && !definedbetween(instr, defInstr, &defInstr->args[1]) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
(extractedbits(instr) & 0xFFFF0000) == 0 (extractedbits(instr) & 0xFFFF0000) == 0
@ -601,7 +601,7 @@ static int LBZ_RLWINM(PCode *instr, UInt32 *masks) {
instr->args[2].data.imm.value == 0 && instr->args[2].data.imm.value == 0 &&
instr->args[3].data.imm.value <= 24 && instr->args[3].data.imm.value <= 24 &&
instr->args[4].data.imm.value == 31 && instr->args[4].data.imm.value == 31 &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
!definedbetween(instr, defInstr, &instr->args[0]) && !definedbetween(instr, defInstr, &instr->args[0]) &&
@ -624,7 +624,7 @@ static int LHZ_RLWINM(PCode *instr, UInt32 *masks) {
instr->args[2].data.imm.value == 0 && instr->args[2].data.imm.value == 0 &&
instr->args[3].data.imm.value <= 16 && instr->args[3].data.imm.value <= 16 &&
instr->args[4].data.imm.value == 31 && instr->args[4].data.imm.value == 31 &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
!definedbetween(instr, defInstr, &instr->args[0]) && !definedbetween(instr, defInstr, &instr->args[0]) &&
@ -644,7 +644,7 @@ static int LHA_EXTSH(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_LHA && defInstr->op == PC_LHA &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
!definedbetween(instr, defInstr, &instr->args[0]) && !definedbetween(instr, defInstr, &instr->args[0]) &&
@ -658,7 +658,7 @@ static int LHA_EXTSH(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_EXTSB && defInstr->op == PC_EXTSB &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) !(PCODE_FLAG_SET_F(instr) & fRecordBit)
) )
{ {
if (defInstr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg) { if (defInstr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg) {
@ -739,7 +739,7 @@ static int ADDI_L_S(PCode *instr, UInt32 *masks) {
if (defInstr->args[2].kind == PCOp_MEMORY) { if (defInstr->args[2].kind == PCOp_MEMORY) {
instr->args[2] = defInstr->args[2]; instr->args[2] = defInstr->args[2];
instr->args[2].data.mem.offset += addright; instr->args[2].data.mem.offset += addright;
if (instr->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) { if (instr->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000)) {
instr->alias = make_alias( instr->alias = make_alias(
instr->args[2].data.mem.obj, instr->args[2].data.mem.obj,
instr->args[2].data.mem.offset, instr->args[2].data.mem.offset,
@ -768,7 +768,7 @@ static int ADDI_L_S(PCode *instr, UInt32 *masks) {
if (defInstr->args[2].kind == PCOp_MEMORY) { if (defInstr->args[2].kind == PCOp_MEMORY) {
instr->args[2] = defInstr->args[2]; instr->args[2] = defInstr->args[2];
instr->args[2].data.mem.offset += addright; instr->args[2].data.mem.offset += addright;
if (instr->flags & (fPCodeFlag2 | fPCodeFlag4 | fPCodeFlag20000 | fPCodeFlag40000)) { if (instr->flags & (fIsRead | fIsWrite | fPCodeFlag20000 | fPCodeFlag40000)) {
instr->alias = make_alias( instr->alias = make_alias(
instr->args[2].data.mem.obj, instr->args[2].data.mem.obj,
instr->args[2].data.mem.offset, instr->args[2].data.mem.offset,
@ -930,7 +930,7 @@ static int RLWINM_CMPLI_BC(PCode *instr, UInt32 *masks) {
if (defInstr->op == PC_CMPLI && defInstr->args[0].data.reg.reg == 0 && defInstr->args[2].data.imm.value == 0) { if (defInstr->op == PC_CMPLI && defInstr->args[0].data.reg.reg == 0 && defInstr->args[2].data.imm.value == 0) {
defInstr2 = defininginstruction[defInstr->defID + 1]; defInstr2 = defininginstruction[defInstr->defID + 1];
if ( if (
(PCODE_FLAG_SET_F(defInstr2) & (fSideEffects | fPCodeFlag8000000 | fPCodeFlag80000000)) == (fPCodeFlag8000000 | fPCodeFlag80000000) && (PCODE_FLAG_SET_F(defInstr2) & (fSideEffects | fCanSetRecordBit | fOpTypeGPR)) == (fCanSetRecordBit | fOpTypeGPR) &&
!usedbetween(defInstr, defInstr2, &defInstr->args[0]) && !usedbetween(defInstr, defInstr2, &defInstr->args[0]) &&
!definedbetween(defInstr, defInstr2, &defInstr->args[0]) !definedbetween(defInstr, defInstr2, &defInstr->args[0])
) )
@ -961,7 +961,7 @@ static int LBZ_EXTSB_CMPI_BC(PCode *instr, UInt32 *masks) {
|| ||
( (
(defInstr->op == PC_EXTSB || defInstr->op == PC_EXTSH) && (defInstr->op == PC_EXTSB || defInstr->op == PC_EXTSH) &&
(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) (PCODE_FLAG_SET_F(defInstr) & fRecordBit)
) )
) )
{ {
@ -992,7 +992,7 @@ static int FRSP_STFS(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_FRSP && defInstr->op == PC_FRSP &&
!(masks[RegClass_FPR] & (1 << defInstr->args[0].data.reg.reg)) && !(masks[RegClass_FPR] & (1 << defInstr->args[0].data.reg.reg)) &&
!(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(defInstr) & fRecordBit) &&
!definedbetween(instr, defInstr, &defInstr->args[1]) && !definedbetween(instr, defInstr, &defInstr->args[1]) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) !usedbetween(instr, defInstr, &defInstr->args[0])
) )
@ -1012,7 +1012,7 @@ static int NOT_AND(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_NOT && defInstr->op == PC_NOT &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(defInstr) & fRecordBit) &&
!definedbetween(instr, defInstr, &defInstr->args[1]) && !definedbetween(instr, defInstr, &defInstr->args[1]) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) !usedbetween(instr, defInstr, &defInstr->args[0])
) )
@ -1033,7 +1033,7 @@ static int LI_MR(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_LI && defInstr->op == PC_LI &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) !usedbetween(instr, defInstr, &defInstr->args[0])
) )
{ {
@ -1054,7 +1054,7 @@ static int VSPLTIS_VMR(PCode *instr, UInt32 *masks) {
if ( if (
(opcode == PC_VSPLTISB || opcode == PC_VSPLTISH || opcode == PC_VSPLTISW) && (opcode == PC_VSPLTISB || opcode == PC_VSPLTISH || opcode == PC_VSPLTISW) &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_VR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_VR] & (1 << defInstr->args[0].data.reg.reg))) &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) !usedbetween(instr, defInstr, &defInstr->args[0])
) )
{ {
@ -1072,9 +1072,9 @@ static int L_MR(PCode *instr, UInt32 *masks) {
PCode *defInstr = defininginstruction[instr->defID + 1]; PCode *defInstr = defininginstruction[instr->defID + 1];
if ( if (
(defInstr->flags & fPCodeFlag2) && (defInstr->flags & fIsRead) &&
!(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg)) && !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg)) &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
!usedbetween(instr, defInstr, &instr->args[0]) && !usedbetween(instr, defInstr, &instr->args[0]) &&
!definedbetween(instr, defInstr, &instr->args[0]) !definedbetween(instr, defInstr, &instr->args[0])
@ -1092,9 +1092,9 @@ static int L_FMR(PCode *instr, UInt32 *masks) {
PCode *defInstr = defininginstruction[instr->defID + 1]; PCode *defInstr = defininginstruction[instr->defID + 1];
if ( if (
(defInstr->flags & fPCodeFlag2) && (defInstr->flags & fIsRead) &&
!(masks[RegClass_FPR] & (1 << defInstr->args[0].data.reg.reg)) && !(masks[RegClass_FPR] & (1 << defInstr->args[0].data.reg.reg)) &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
!usedbetween(instr, defInstr, &instr->args[0]) && !usedbetween(instr, defInstr, &instr->args[0]) &&
!definedbetween(instr, defInstr, &instr->args[0]) !definedbetween(instr, defInstr, &instr->args[0])
@ -1119,13 +1119,13 @@ static int L_S(PCode *instr, UInt32 *masks) {
SInt32 scanOffset; SInt32 scanOffset;
SInt32 storeSize; SInt32 storeSize;
if (PCODE_FLAG_SET_F(instr) & (fIsVolatile | fSideEffects | fPCodeFlag2000000)) if (PCODE_FLAG_SET_F(instr) & (fIsVolatile | fSideEffects | fUpdatesPtr))
return 0; return 0;
if (PCODE_FLAG_SET_F(defInstr) & (fIsVolatile | fSideEffects | fPCodeFlag2000000)) if (PCODE_FLAG_SET_F(defInstr) & (fIsVolatile | fSideEffects | fUpdatesPtr))
return 0; return 0;
if ( if (
(defInstr->flags & fPCodeFlag2) && (defInstr->flags & fIsRead) &&
PC_OP_IS_REGISTER(&defInstr->args[1], RegClass_GPR, instr->args[1].data.reg.reg) && PC_OP_IS_REGISTER(&defInstr->args[1], RegClass_GPR, instr->args[1].data.reg.reg) &&
defInstr->args[2].kind == instr->args[2].kind && defInstr->args[2].kind == instr->args[2].kind &&
!definedbetween(instr, defInstr, &instr->args[1]) !definedbetween(instr, defInstr, &instr->args[1])
@ -1231,7 +1231,7 @@ static int L_S(PCode *instr, UInt32 *masks) {
} }
for (scan = instr->prevPCode; scan && scan != defInstr; scan = scan->prevPCode) { for (scan = instr->prevPCode; scan && scan != defInstr; scan = scan->prevPCode) {
if (scan->flags & fPCodeFlag4) { if (scan->flags & fIsWrite) {
if (scan->args[1].data.reg.reg != instr->args[1].data.reg.reg) if (scan->args[1].data.reg.reg != instr->args[1].data.reg.reg)
return 0; return 0;
if (scan->args[2].kind != defInstr->args[2].kind) if (scan->args[2].kind != defInstr->args[2].kind)
@ -1306,7 +1306,7 @@ static int RLWINM_RLWINM(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_RLWINM && defInstr->op == PC_RLWINM &&
!(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(defInstr) & fRecordBit) &&
!definedbetween(instr, defInstr, &defInstr->args[1]) && !definedbetween(instr, defInstr, &defInstr->args[1]) &&
!( !(
defInstr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg && defInstr->args[0].data.reg.reg == defInstr->args[1].data.reg.reg &&
@ -1358,7 +1358,7 @@ static int RLWINM_RLWINM(PCode *instr, UInt32 *masks) {
if ( if (
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(defInstr) & fRecordBit) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) !usedbetween(instr, defInstr, &defInstr->args[0])
) )
deletepcode(defInstr); deletepcode(defInstr);
@ -1375,7 +1375,7 @@ static int MULLI_MULLI(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_MULLI && defInstr->op == PC_MULLI &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(defInstr) & fRecordBit) &&
!definedbetween(instr, defInstr, &defInstr->args[1]) && !definedbetween(instr, defInstr, &defInstr->args[1]) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
FITS_IN_SHORT(instr->args[2].data.imm.value * defInstr->args[2].data.imm.value) FITS_IN_SHORT(instr->args[2].data.imm.value * defInstr->args[2].data.imm.value)
@ -1398,7 +1398,7 @@ static int ADDI_ADDI(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_ADDI && defInstr->op == PC_ADDI &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(defInstr) & fRecordBit) &&
!definedbetween(instr, defInstr, &defInstr->args[1]) && !definedbetween(instr, defInstr, &defInstr->args[1]) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
instr->args[2].kind == PCOp_IMMEDIATE && instr->args[2].kind == PCOp_IMMEDIATE &&
@ -1423,7 +1423,7 @@ static int SRAWI_SRAWI(PCode *instr, UInt32 *masks) {
if ( if (
defInstr->op == PC_SRAWI && defInstr->op == PC_SRAWI &&
(defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) && (defInstr->args[0].data.reg.reg == instr->args[0].data.reg.reg || !(masks[RegClass_GPR] & (1 << defInstr->args[0].data.reg.reg))) &&
!(PCODE_FLAG_SET_F(defInstr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(defInstr) & fRecordBit) &&
!definedbetween(instr, defInstr, &defInstr->args[1]) && !definedbetween(instr, defInstr, &defInstr->args[1]) &&
!usedbetween(instr, defInstr, &defInstr->args[0]) && !usedbetween(instr, defInstr, &defInstr->args[0]) &&
instr->args[2].kind == PCOp_IMMEDIATE && instr->args[2].kind == PCOp_IMMEDIATE &&
@ -1451,12 +1451,12 @@ static int MR_ADDI(PCode *instr, UInt32 *masks) {
if (copts.cpu == CPU_PPC603e) { if (copts.cpu == CPU_PPC603e) {
if (prev) if (prev)
prevFlag = (prev->flags & fPCodeFlagC0000000) == fPCodeFlag80000000; prevFlag = (prev->flags & fOpTypeMask) == fOpTypeGPR;
if (next) if (next)
nextFlag = (next->flags & fPCodeFlagC0000000) == fPCodeFlag80000000; nextFlag = (next->flags & fOpTypeMask) == fOpTypeGPR;
if ( if (
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
instr->argCount >= 2 && instr->argCount >= 2 &&
instr->args[1].data.reg.reg != 0 && instr->args[1].data.reg.reg != 0 &&
(prevFlag || nextFlag) (prevFlag || nextFlag)
@ -1528,7 +1528,7 @@ static int SRW_SUBFIC_RLW_OR(PCode *instr, UInt32 *masks) {
PCode *defInstr1 = defininginstruction[instr->defID + 1]; PCode *defInstr1 = defininginstruction[instr->defID + 1];
PCode *defInstr2 = defininginstruction[instr->defID + 2]; PCode *defInstr2 = defininginstruction[instr->defID + 2];
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
return 0; return 0;
if ( if (
@ -2151,12 +2151,12 @@ static void adjustforward(PCodeBlock *block) {
scan->args[2].data.imm.value == 0 scan->args[2].data.imm.value == 0
) )
{ {
if (PCODE_FLAG_SET_F(scan) & fPCodeFlag20000000) { if (PCODE_FLAG_SET_F(scan) & fRecordBit) {
if (!flag1) { if (!flag1) {
pcsetrecordbit(instr); pcsetrecordbit(instr);
change_opcode(scan, PC_MR); change_opcode(scan, PC_MR);
scan->flags &= ~fPCodeFlag20000000; scan->flags &= ~fRecordBit;
scan->flags |= fPCodeFlag10; scan->flags |= fIsMove;
change_num_operands(scan, 2); change_num_operands(scan, 2);
} else { } else {
change_opcode(scan, PC_MR); change_opcode(scan, PC_MR);
@ -2201,7 +2201,7 @@ static void adjustforward(PCodeBlock *block) {
PC_RLWINM, scan->args[0].data.reg.reg, reg1, PC_RLWINM, scan->args[0].data.reg.reg, reg1,
32 - scan->args[2].data.imm.value, start, end 32 - scan->args[2].data.imm.value, start, end
)); ));
if (PCODE_FLAG_SET_F(scan) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(scan) & fRecordBit)
pcsetrecordbit(scan->nextPCode); pcsetrecordbit(scan->nextPCode);
deletepcode(scan); deletepcode(scan);
} }
@ -2209,8 +2209,8 @@ static void adjustforward(PCodeBlock *block) {
opcode == PC_OR && opcode == PC_OR &&
!flag2 && !flag2 &&
reg0 != reg1 && reg0 != reg1 &&
!(PCODE_FLAG_SET_F(scan) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(scan) & fRecordBit) &&
!(PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) && !(PCODE_FLAG_SET_F(instr) & fRecordBit) &&
scan->args[0].data.reg.reg != instr->args[1].data.reg.reg scan->args[0].data.reg.reg != instr->args[1].data.reg.reg
) )
{ {
@ -2313,10 +2313,10 @@ static void adjustforward(PCodeBlock *block) {
) )
{ {
change_opcode(scan, PC_MR); change_opcode(scan, PC_MR);
if ((PCODE_FLAG_SET_F(scan) & fPCodeFlag20000000) && !flag1) { if ((PCODE_FLAG_SET_F(scan) & fRecordBit) && !flag1) {
pcsetrecordbit(instr); pcsetrecordbit(instr);
scan->flags &= ~fPCodeFlag20000000; scan->flags &= ~fRecordBit;
scan->flags |= fPCodeFlag10; scan->flags |= fIsMove;
change_num_operands(scan, 2); change_num_operands(scan, 2);
} }
} }
@ -2329,10 +2329,10 @@ static void adjustforward(PCodeBlock *block) {
) )
{ {
change_opcode(scan, PC_MR); change_opcode(scan, PC_MR);
if ((PCODE_FLAG_SET_F(scan) & fPCodeFlag20000000) && !flag1) { if ((PCODE_FLAG_SET_F(scan) & fRecordBit) && !flag1) {
pcsetrecordbit(instr); pcsetrecordbit(instr);
scan->flags &= ~fPCodeFlag20000000; scan->flags &= ~fRecordBit;
scan->flags |= fPCodeFlag10; scan->flags |= fIsMove;
change_num_operands(scan, 2); change_num_operands(scan, 2);
} }
} }
@ -2371,10 +2371,10 @@ static void adjustforward(PCodeBlock *block) {
) )
{ {
change_opcode(scan, PC_MR); change_opcode(scan, PC_MR);
if ((PCODE_FLAG_SET_F(scan) & fPCodeFlag20000000) && !flag) { if ((PCODE_FLAG_SET_F(scan) & fRecordBit) && !flag) {
pcsetrecordbit(instr); pcsetrecordbit(instr);
scan->flags &= ~fPCodeFlag20000000; scan->flags &= ~fRecordBit;
scan->flags |= fPCodeFlag10; scan->flags |= fIsMove;
change_num_operands(scan, 2); change_num_operands(scan, 2);
} }
} }
@ -2410,10 +2410,10 @@ static void adjustforward(PCodeBlock *block) {
else if (scan->op == PC_EXTSH && scan->args[1].data.reg.reg == reg0) else if (scan->op == PC_EXTSH && scan->args[1].data.reg.reg == reg0)
{ {
change_opcode(scan, PC_MR); change_opcode(scan, PC_MR);
if ((PCODE_FLAG_SET_F(scan) & fPCodeFlag20000000) && !flag) { if ((PCODE_FLAG_SET_F(scan) & fRecordBit) && !flag) {
pcsetrecordbit(instr); pcsetrecordbit(instr);
scan->flags &= ~fPCodeFlag20000000; scan->flags &= ~fRecordBit;
scan->flags |= fPCodeFlag10; scan->flags |= fIsMove;
change_num_operands(scan, 2); change_num_operands(scan, 2);
} }
} }
@ -2443,11 +2443,11 @@ static void adjustforward(PCodeBlock *block) {
SInt32 val2 = instr->args[2].data.imm.value; SInt32 val2 = instr->args[2].data.imm.value;
for (scan = instr->nextPCode; scan; scan = scan->nextPCode) { for (scan = instr->nextPCode; scan; scan = scan->nextPCode) {
if ((scan->flags & fPCodeFlag4) && scan->args[0].data.reg.reg == reg0) if ((scan->flags & fIsWrite) && scan->args[0].data.reg.reg == reg0)
break; break;
if ( if (
(scan->flags & (fPCodeFlag2 | fPCodeFlag4)) && (scan->flags & (fIsRead | fIsWrite)) &&
scan->args[1].data.reg.reg == reg0 && scan->args[1].data.reg.reg == reg0 &&
scan->args[2].kind == PCOp_IMMEDIATE && scan->args[2].kind == PCOp_IMMEDIATE &&
FITS_IN_SHORT(val2 + scan->args[2].data.imm.value) FITS_IN_SHORT(val2 + scan->args[2].data.imm.value)
@ -2456,7 +2456,7 @@ static void adjustforward(PCodeBlock *block) {
scan->args[2].data.imm.value += val2; scan->args[2].data.imm.value += val2;
tmp = instr->prevPCode; tmp = instr->prevPCode;
if ( if (
(scan->flags & fPCodeFlag2) && (scan->flags & fIsRead) &&
scan->args[0].data.reg.reg == reg0 && scan->args[0].data.reg.reg == reg0 &&
scan->args[0].kind == PCOp_REGISTER && scan->args[0].kind == PCOp_REGISTER &&
scan->args[0].arg == RegClass_GPR scan->args[0].arg == RegClass_GPR
@ -2490,7 +2490,7 @@ static void adjustforward(PCodeBlock *block) {
break; break;
} }
if (scan->flags & (fPCodeFlag1 | fPCodeFlag8)) { if (scan->flags & (fIsBranch | fIsCall)) {
if (flag1 && scan->prevPCode != instr) { if (flag1 && scan->prevPCode != instr) {
tmp = instr->prevPCode; tmp = instr->prevPCode;
deletepcode(instr); deletepcode(instr);
@ -2653,14 +2653,14 @@ void peepholemergeblocks(Object *func, Boolean flag) {
next = block->nextBlock; next = block->nextBlock;
if (!flag) { if (!flag) {
flag2 = next && (next->flags & fPCBlockFlag2); flag2 = next && (next->flags & fIsEpilogue);
if (block->flags & fPCBlockFlag1) if (block->flags & fIsProlog)
continue; continue;
} }
if (block->pcodeCount > 0) { if (block->pcodeCount > 0) {
for (instr = block->firstPCode; instr; instr = instr->nextPCode) { for (instr = block->firstPCode; instr; instr = instr->nextPCode) {
if (instr->flags & (fPCodeFlag8 | fSideEffects)) if (instr->flags & (fIsCall | fSideEffects))
break; break;
} }
@ -2676,7 +2676,7 @@ void peepholemergeblocks(Object *func, Boolean flag) {
} }
instr = block->lastPCode; instr = block->lastPCode;
if (instr && (instr->flags & fPCodeFlag1) && instr->op != PC_B) if (instr && (instr->flags & fIsBranch) && instr->op != PC_B)
continue; continue;
while ( while (
@ -2692,7 +2692,7 @@ void peepholemergeblocks(Object *func, Boolean flag) {
if (next->pcodeCount > 0) { if (next->pcodeCount > 0) {
for (instr = next->firstPCode; instr; instr = nextinstr) { for (instr = next->firstPCode; instr; instr = nextinstr) {
nextinstr = instr->nextPCode; nextinstr = instr->nextPCode;
if (instr->flags & (fPCodeFlag8 | fSideEffects)) if (instr->flags & (fIsCall | fSideEffects))
break; break;
deletepcode(instr); deletepcode(instr);
@ -2727,11 +2727,11 @@ void peepholemergeblocks(Object *func, Boolean flag) {
if (block->nextBlock) if (block->nextBlock)
block->nextBlock->prevBlock = block; block->nextBlock->prevBlock = block;
next->flags |= fPCBlockFlag20; next->flags |= fDeleted;
next = block->nextBlock; next = block->nextBlock;
if (!flag) if (!flag)
flag2 = next && (next->flags & fPCBlockFlag2); flag2 = next && (next->flags & fIsEpilogue);
} }
} }
} }

View File

@ -311,7 +311,7 @@ UInt32 colored_vrs_as_vrsave(PCodeBlock *block) {
while (block) { while (block) {
for (pc = block->firstPCode; pc; pc = pc->nextPCode) { for (pc = block->firstPCode; pc; pc = pc->nextPCode) {
if (pc->flags & (fPCodeFlag40000000 | fPCodeFlag80000000)) { if (pc->flags & fOpTypeVR) {
for (i = 0; i < pc->argCount; i++) { for (i = 0; i < pc->argCount; i++) {
if (pc->args[i].kind == PCOp_REGISTER && pc->args[i].arg == RegClass_VR) if (pc->args[i].kind == PCOp_REGISTER && pc->args[i].arg == RegClass_VR)
mask |= 1 << (31 - pc->args[i].data.reg.reg); mask |= 1 << (31 - pc->args[i].data.reg.reg);

View File

@ -170,7 +170,7 @@ static void addsuccessor(DGNode *a, DGNode *b, Boolean flag) {
a->successors = succ; a->successors = succ;
succ->x8 = r29; succ->x8 = r29;
if (flag && (succ->node->instr->flags & fPCodeFlag1)) if (flag && (succ->node->instr->flags & fIsBranch))
succ->x8 += MI->x8; succ->x8 += MI->x8;
b->predCount++; b->predCount++;
@ -290,9 +290,9 @@ static void findsuccessors(DGNode *nodes, DGNode *node) {
} }
} }
if (instr->flags & (fPCodeFlag2 | fPCodeFlag20000)) if (instr->flags & (fIsRead | fPCodeFlag20000))
serialize_load(node); serialize_load(node);
else if (instr->flags & (fPCodeFlag4 | fPCodeFlag40000)) else if (instr->flags & (fIsWrite | fPCodeFlag40000))
serialize_store(node); serialize_store(node);
if (instr->flags & fIsVolatile) { if (instr->flags & fIsVolatile) {
@ -301,7 +301,7 @@ static void findsuccessors(DGNode *nodes, DGNode *node) {
} }
if ( if (
((instr->flags & fPCodeFlag8 | fPCodeFlag1) && (instr->flags & fLink)) || ((instr->flags & fIsCall | fIsBranch) && (instr->flags & fLink)) ||
(instr->flags & fSideEffects) || (instr->flags & fSideEffects) ||
MI->serializes(instr) MI->serializes(instr)
) )
@ -424,7 +424,7 @@ static void scheduleblock(PCodeBlock *block) {
for (instr = block->lastPCode; instr; instr = instr->prevPCode) { for (instr = block->lastPCode; instr; instr = instr->prevPCode) {
DGNode *n = makedgnode(instr); DGNode *n = makedgnode(instr);
findsuccessors(head, n); findsuccessors(head, n);
if (instr->flags & fPCodeFlag1) if (instr->flags & fIsBranch)
defaultsuccessor = n; defaultsuccessor = n;
head = adddgnode(head, n); head = adddgnode(head, n);
} }
@ -492,12 +492,12 @@ void scheduleinstructions(Boolean flag) {
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
if ( if (
block->pcodeCount > 2 && block->pcodeCount > 2 &&
(flag || !(block->flags & (fPCBlockFlag1 | fPCBlockFlag2))) && (flag || !(block->flags & (fIsProlog | fIsEpilogue))) &&
!(block->flags & fPCBlockFlag8) !(block->flags & fScheduled)
) )
{ {
scheduleblock(block); scheduleblock(block);
block->flags |= fPCBlockFlag8; block->flags |= fScheduled;
} }
} }
} }

View File

@ -50,7 +50,7 @@ void estimatespillcosts(void) {
while (i--) { while (i--) {
if (PC_OP_IS_WRITE_ANY_REGISTER(op, coloring_class)) { if (PC_OP_IS_WRITE_ANY_REGISTER(op, coloring_class)) {
node = interferencegraph[op->data.reg.reg]; node = interferencegraph[op->data.reg.reg];
if (node->instr8 || (instr->flags & fPCodeFlag8000)) if (node->instr8 || (instr->flags & fIsArgInit))
node->spillCost -= weight; node->spillCost -= weight;
else else
node->spillCost += weight; node->spillCost += weight;
@ -291,7 +291,7 @@ static void spillinstruction(PCodeBlock *block, PCode *instr) {
} }
if (writeCounter) { if (writeCounter) {
if (node->instr8 || (instr->flags & fPCodeFlag8000)) if (node->instr8 || (instr->flags & fIsArgInit))
flag = 1; flag = 1;
else else
insert_store_spilled_register(instr, 0, reg2, node); insert_store_spilled_register(instr, 0, reg2, node);
@ -440,9 +440,9 @@ void insertspillcode(void) {
if (coloring_class == RegClass_VR && rTEMP_for_VR_spill == 0) if (coloring_class == RegClass_VR && rTEMP_for_VR_spill == 0)
rTEMP_for_VR_spill = used_virtual_registers[RegClass_GPR]++; rTEMP_for_VR_spill = used_virtual_registers[RegClass_GPR]++;
if (instr->flags & fPCodeFlag10) if (instr->flags & fIsMove)
spillcopy(block, instr); spillcopy(block, instr);
else if (instr->flags & fPCodeFlag8) else if (instr->flags & fIsCall)
spillcall(block, instr); spillcall(block, instr);
else else
spillinstruction(block, instr); spillinstruction(block, instr);

View File

@ -293,7 +293,7 @@ void compute_frame_sizes(void) {
genuine_frame_size = frame_size; genuine_frame_size = frame_size;
} }
if (!large_stack && frame_size > 0x7FFF) if (!large_stack && frame_size > 0x7FFF)
CError_ErrorTerm(210); CError_ErrorTerm(CErrorStr210);
} }
static void allocate_new_frame(int reg1, int reg2) { static void allocate_new_frame(int reg1, int reg2) {
@ -427,7 +427,7 @@ void generate_prologue(PCodeBlock *block, Boolean has_varargs) {
if (large_stack) if (large_stack)
do_allocate_dynamic_stack_space(1, 11, 0, large_data_near_size); do_allocate_dynamic_stack_space(1, 11, 0, large_data_near_size);
block->flags |= fPCBlockFlag1; block->flags |= fIsProlog;
pclastblock = save_block; pclastblock = save_block;
current_statement = save_statement; current_statement = save_statement;
} }
@ -498,7 +498,7 @@ void generate_epilogue(PCodeBlock *block, Boolean add_blr) {
setpcodeflags(fIsVolatile); setpcodeflags(fIsVolatile);
} }
block->flags |= fPCBlockFlag2; block->flags |= fIsEpilogue;
pclastblock = save_block; pclastblock = save_block;
current_statement = save_statement; current_statement = save_statement;
} }
@ -832,7 +832,7 @@ void move_varargs_to_memory(void) {
dummyvaparam = galloc(sizeof(Object)); dummyvaparam = galloc(sizeof(Object));
memclrw(dummyvaparam, sizeof(Object)); memclrw(dummyvaparam, sizeof(Object));
dummyvaparam->type = (Type *) &stvoid; dummyvaparam->type = TYPE(&stvoid);
dummyvaparam->otype = OT_OBJECT; dummyvaparam->otype = OT_OBJECT;
dummyvaparam->name = GetHashNameNode("<vaparam>"); dummyvaparam->name = GetHashNameNode("<vaparam>");
dummyvaparam->datatype = DLOCAL; dummyvaparam->datatype = DLOCAL;
@ -843,7 +843,7 @@ void move_varargs_to_memory(void) {
for (reg = last_argument_register[RegClass_GPR] + 1; (int)reg <= 10; reg++) { for (reg = last_argument_register[RegClass_GPR] + 1; (int)reg <= 10; reg++) {
emitpcode(PC_STW, reg, local_base_register(dummyvaparam), dummyvaparam, (reg - 3) * 4); emitpcode(PC_STW, reg, local_base_register(dummyvaparam), dummyvaparam, (reg - 3) * 4);
setpcodeflags(fPCodeFlag20 | fPCodeFlag8000); setpcodeflags(fIsPtrOp | fIsArgInit);
} }
} }

View File

@ -143,7 +143,7 @@ static int isinductionvariable(BasicInductionVar *biv, int useID, SInt32 *result
return 0; return 0;
if (instr->args[4].data.imm.value != (31 - instr->args[2].data.imm.value)) if (instr->args[4].data.imm.value != (31 - instr->args[2].data.imm.value))
return 0; return 0;
if (PCODE_FLAG_SET_F(instr) & fPCodeFlag20000000) if (PCODE_FLAG_SET_F(instr) & fRecordBit)
return 0; return 0;
*result1 = 1 << instr->args[2].data.imm.value; *result1 = 1 << instr->args[2].data.imm.value;
break; break;
@ -222,7 +222,7 @@ static void addinductionvariable(BasicInductionVar *biv, PCode *instr, SInt32 va
iv->x18 = val2; iv->x18 = val2;
iv->x1A = val3; iv->x1A = val3;
iv->someloop = val4; iv->someloop = val4;
if (instr->flags & (fPCodeFlag2 | fPCodeFlag4)) if (instr->flags & (fIsRead | fIsWrite))
iv->x1C = -1; iv->x1C = -1;
else else
iv->x1C = instr->args[0].data.reg.reg; iv->x1C = instr->args[0].data.reg.reg;
@ -343,7 +343,7 @@ static void incrementinductionvariable(InductionVar *iv) {
} }
static void copyinductionvariable(InductionVar *iv) { static void copyinductionvariable(InductionVar *iv) {
if (iv->instr->flags & (fPCodeFlag2 | fPCodeFlag4)) { if (iv->instr->flags & (fIsRead | fIsWrite)) {
iv->instr->op -= 2; iv->instr->op -= 2;
iv->instr->args[1].data.reg.reg = iv->x1E; iv->instr->args[1].data.reg.reg = iv->x1E;
iv->instr->args[2].kind = PCOp_IMMEDIATE; iv->instr->args[2].kind = PCOp_IMMEDIATE;
@ -658,7 +658,7 @@ static void combineinductionvariables(Loop *loop, BasicInductionVar *biv1, Basic
} }
} }
if (loop->body->lastPCode->flags & fPCodeFlag1) { if (loop->body->lastPCode->flags & fIsBranch) {
nextBlock = NULL; nextBlock = NULL;
for (i = 0; i < loop->body->lastPCode->argCount; i++) { for (i = 0; i < loop->body->lastPCode->argCount; i++) {

View File

@ -82,13 +82,13 @@ static void precomputememoryusedefs(void) {
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) { for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) {
if (pcode->flags & (fPCodeFlag2 | fPCodeFlag4)) { if (pcode->flags & (fIsRead | fIsWrite)) {
if (pcode->alias) { if (pcode->alias) {
if (pcode->alias->type == AliasType2 || pcode->alias->size != nbytes_loaded_or_stored_by(pcode)) if (pcode->alias->type == AliasType2 || pcode->alias->size != nbytes_loaded_or_stored_by(pcode))
pcode->flags |= fPCodeFlag20; pcode->flags |= fIsPtrOp;
addaliasusedef(pcode->alias); addaliasusedef(pcode->alias);
} else { } else {
pcode->flags |= fPCodeFlag20; pcode->flags |= fIsPtrOp;
} }
} }
} }
@ -109,7 +109,7 @@ static void precomputeusedefcounts(int flag) {
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) { for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) {
if (!(pcode->flags & fPCodeFlag1) && pcode->argCount) { if (!(pcode->flags & fIsBranch) && pcode->argCount) {
pcode->useID = number_of_Uses; pcode->useID = number_of_Uses;
pcode->defID = number_of_Defs; pcode->defID = number_of_Defs;
op = pcode->args; op = pcode->args;
@ -125,8 +125,8 @@ static void precomputeusedefcounts(int flag) {
} }
if (flag) { if (flag) {
if (pcode->flags & fPCodeFlag2) { if (pcode->flags & fIsRead) {
if (pcode->flags & fPCodeFlag20) { if (pcode->flags & fIsPtrOp) {
for (oud = objectusedeflist; oud; oud = oud->next) { for (oud = objectusedeflist; oud; oud = oud->next) {
if (may_alias_object(pcode, oud->object)) if (may_alias_object(pcode, oud->object))
number_of_Uses++; number_of_Uses++;
@ -134,8 +134,8 @@ static void precomputeusedefcounts(int flag) {
} else { } else {
number_of_Uses++; number_of_Uses++;
} }
} else if (pcode->flags & fPCodeFlag4) { } else if (pcode->flags & fIsWrite) {
if (pcode->flags & fPCodeFlag20) { if (pcode->flags & fIsPtrOp) {
for (oud = objectusedeflist; oud; oud = oud->next) { for (oud = objectusedeflist; oud; oud = oud->next) {
if (may_alias_object(pcode, oud->object)) if (may_alias_object(pcode, oud->object))
number_of_Defs++; number_of_Defs++;
@ -143,7 +143,7 @@ static void precomputeusedefcounts(int flag) {
} else { } else {
number_of_Defs++; number_of_Defs++;
} }
} else if (pcode->flags & fPCodeFlag8) { } else if (pcode->flags & fIsCall) {
for (oud = objectusedeflist; oud; oud = oud->next) { for (oud = objectusedeflist; oud; oud = oud->next) {
if ( if (
oud->object->datatype == DDATA || oud->object->datatype == DDATA ||
@ -207,7 +207,7 @@ static void computeusedeflists(int flag) {
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) { for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) {
if (!(pcode->flags & fPCodeFlag1) && pcode->argCount) { if (!(pcode->flags & fIsBranch) && pcode->argCount) {
use = &Uses[useID = pcode->useID]; use = &Uses[useID = pcode->useID];
def = &Defs[defID = pcode->defID]; def = &Defs[defID = pcode->defID];
@ -244,8 +244,8 @@ static void computeusedeflists(int flag) {
} }
if (flag) { if (flag) {
if (pcode->flags & fPCodeFlag2) { if (pcode->flags & fIsRead) {
if (pcode->flags & fPCodeFlag20) { if (pcode->flags & fIsPtrOp) {
for (oud = objectusedeflist; oud; oud = oud->next) { for (oud = objectusedeflist; oud; oud = oud->next) {
if (may_alias_object(pcode, object = oud->object)) { if (may_alias_object(pcode, object = oud->object)) {
use->pcode = pcode; use->pcode = pcode;
@ -272,8 +272,8 @@ static void computeusedeflists(int flag) {
list->next = tmp->uses; list->next = tmp->uses;
tmp->uses = list; tmp->uses = list;
} }
} else if (pcode->flags & fPCodeFlag4) { } else if (pcode->flags & fIsWrite) {
if (pcode->flags & fPCodeFlag20) { if (pcode->flags & fIsPtrOp) {
for (oud = objectusedeflist; oud; oud = oud->next) { for (oud = objectusedeflist; oud; oud = oud->next) {
if (may_alias_object(pcode, object = oud->object)) { if (may_alias_object(pcode, object = oud->object)) {
def->pcode = pcode; def->pcode = pcode;
@ -300,7 +300,7 @@ static void computeusedeflists(int flag) {
list->next = tmp->defs; list->next = tmp->defs;
tmp->defs = list; tmp->defs = list;
} }
} else if (pcode->flags & fPCodeFlag8) { } else if (pcode->flags & fIsCall) {
for (oud = objectusedeflist; oud; oud = oud->next) { for (oud = objectusedeflist; oud; oud = oud->next) {
object = oud->object; object = oud->object;
if ( if (
@ -396,7 +396,7 @@ static void computelocalusedefinfo(void) {
bitvectorinitialize(info->usevec1C, number_of_Uses, 0); bitvectorinitialize(info->usevec1C, number_of_Uses, 0);
for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) { for (pcode = block->firstPCode; pcode; pcode = pcode->nextPCode) {
if (!(pcode->flags & fPCodeFlag1) && pcode->argCount) { if (!(pcode->flags & fIsBranch) && pcode->argCount) {
for (use = &Uses[useID = pcode->useID]; useID < number_of_Uses && use->pcode == pcode; use++, useID++) { for (use = &Uses[useID = pcode->useID]; useID < number_of_Uses && use->pcode == pcode; use++, useID++) {
bitvectorsetbit(useID, usevec10); bitvectorsetbit(useID, usevec10);
if (use->v.kind == PCOp_REGISTER) { if (use->v.kind == PCOp_REGISTER) {

View File

@ -265,7 +265,7 @@ static int matchvalues(AvailableValue *av, PCode *match) {
} }
} }
if ((match->flags & (fPCodeFlag2 | fPCodeFlag20000)) && match->alias->valuenumber != av->aliasnumber) if ((match->flags & (fIsRead | fPCodeFlag20000)) && match->alias->valuenumber != av->aliasnumber)
return 0; return 0;
return 1; return 1;
@ -331,7 +331,7 @@ static void addavailablevalue(PCode *pcode) {
av->opnumbers[i] = regvalue[op->arg][op->data.reg.reg].number; av->opnumbers[i] = regvalue[op->arg][op->data.reg.reg].number;
} }
if (pcode->flags & (fPCodeFlag2 | fPCodeFlag20000)) if (pcode->flags & (fIsRead | fPCodeFlag20000))
av->aliasnumber = pcode->alias->valuenumber; av->aliasnumber = pcode->alias->valuenumber;
op = &pcode->args[0]; op = &pcode->args[0];
@ -368,7 +368,7 @@ static int isCSEop(PCode *pcode) {
break; break;
} }
if (PCODE_FLAG_SET_F(pcode) & (fIsVolatile | fSideEffects | fOverflow | fPCodeFlag10000000 | fPCodeFlag20000000)) if (PCODE_FLAG_SET_F(pcode) & (fIsVolatile | fSideEffects | fOverflow | fSetsCarry | fRecordBit))
return 0; return 0;
for (i = 0, op = &pcode->args[0]; i < pcode->argCount; i++, op++) { for (i = 0, op = &pcode->args[0]; i < pcode->argCount; i++, op++) {
@ -542,17 +542,17 @@ static void removecsesfrombasicblock(PCodeBlock *block) {
for (pcode = block->firstPCode; pcode; pcode = next) { for (pcode = block->firstPCode; pcode; pcode = next) {
next = pcode->nextPCode; next = pcode->nextPCode;
propagatecopiesto(pcode); propagatecopiesto(pcode);
if (pcode->flags & fPCodeFlag10) { if (pcode->flags & fIsMove) {
registercopy(pcode); registercopy(pcode);
} else if ((pcode->flags & fPCodeFlag8) && (pcode->flags & (fLink | fSideEffects))) { } else if ((pcode->flags & fIsCall) && (pcode->flags & (fLink | fSideEffects))) {
functioncall(pcode); functioncall(pcode);
} else if (pcode->flags & fPCodeFlag2) { } else if (pcode->flags & fIsRead) {
if (pcode->flags & fPCodeFlag20) if (pcode->flags & fIsPtrOp)
pointerload(pcode); pointerload(pcode);
else else
simpleload(pcode); simpleload(pcode);
} else if (pcode->flags & fPCodeFlag4) { } else if (pcode->flags & fIsWrite) {
if (pcode->flags & fPCodeFlag20) if (pcode->flags & fIsPtrOp)
pointerstore(pcode); pointerstore(pcode);
else else
simplestore(pcode); simplestore(pcode);
@ -567,7 +567,7 @@ static void removecsesfrombasicblock(PCodeBlock *block) {
} }
} }
block->flags |= fPCBlockFlag4; block->flags |= fVisited;
} }
static void getvaluestate(State *state) { static void getvaluestate(State *state) {
@ -621,7 +621,7 @@ static void removecsesfromextendedbasicblock(PCodeBlock *block) {
counter = 0; counter = 0;
for (succ = block->successors; succ; succ = succ->nextLink) { for (succ = block->successors; succ; succ = succ->nextLink) {
if (!(succ->block->flags & fPCBlockFlag4) && succ->block->predecessors && !succ->block->predecessors->nextLink) if (!(succ->block->flags & fVisited) && succ->block->predecessors && !succ->block->predecessors->nextLink)
counter++; counter++;
} }
@ -629,7 +629,7 @@ static void removecsesfromextendedbasicblock(PCodeBlock *block) {
getvaluestate(&state); getvaluestate(&state);
forkvaluestate(nextvaluenumber); forkvaluestate(nextvaluenumber);
for (succ = block->successors; succ; succ = succ->nextLink) { for (succ = block->successors; succ; succ = succ->nextLink) {
if (!(succ->block->flags & fPCBlockFlag4) && succ->block->predecessors && !succ->block->predecessors->nextLink) { if (!(succ->block->flags & fVisited) && succ->block->predecessors && !succ->block->predecessors->nextLink) {
removecsesfromextendedbasicblock(succ->block); removecsesfromextendedbasicblock(succ->block);
regressvaluestate(); regressvaluestate();
} }
@ -647,10 +647,10 @@ void removecommonsubexpressions(Object *proc, int flag) {
allocatecsedatastructures(); allocatecsedatastructures();
for (block = pcbasicblocks; block; block = block->nextBlock) for (block = pcbasicblocks; block; block = block->nextBlock)
block->flags &= ~fPCBlockFlag4; block->flags &= ~fVisited;
for (block = pcbasicblocks; block; block = block->nextBlock) { for (block = pcbasicblocks; block; block = block->nextBlock) {
if (!(block->flags & fPCBlockFlag4)) { if (!(block->flags & fVisited)) {
initializecsedatastructures(); initializecsedatastructures();
removecsesfromextendedbasicblock(block); removecsesfromextendedbasicblock(block);
} }

View File

@ -110,7 +110,7 @@ static void scaninstructions(LocalVectorArray *arrays) {
firstaddinblock[block->blockIndex] = number_of_ADDIs; firstaddinblock[block->blockIndex] = number_of_ADDIs;
counter = 0; counter = 0;
for (instr = block->firstPCode; instr; instr = instr->nextPCode) { for (instr = block->firstPCode; instr; instr = instr->nextPCode) {
if (!(instr->flags & fPCodeFlag1) && instr->argCount) { if (!(instr->flags & fIsBranch) && instr->argCount) {
op = instr->args; op = instr->args;
i = instr->argCount; i = instr->argCount;
while (i--) { while (i--) {
@ -168,7 +168,7 @@ static void computeaddilist(LocalVectorArray *arrays) {
bitvectorcopy(vec, usedefinfo[block->blockIndex].usevec1C, number_of_Uses); bitvectorcopy(vec, usedefinfo[block->blockIndex].usevec1C, number_of_Uses);
addi = &ADDIs[firstaddinblock[block->blockIndex] + naddsinblock[block->blockIndex] - 1]; addi = &ADDIs[firstaddinblock[block->blockIndex] + naddsinblock[block->blockIndex] - 1];
for (instr = block->lastPCode; instr; instr = instr->prevPCode) { for (instr = block->lastPCode; instr; instr = instr->prevPCode) {
if (!(instr->flags & fPCodeFlag1) && instr->argCount) { if (!(instr->flags & fIsBranch) && instr->argCount) {
int reg; // r18 int reg; // r18
if ( if (
instr->op == PC_ADDI && instr->op == PC_ADDI &&
@ -245,7 +245,7 @@ static void computelocalvectorpropinfo(LocalVectorArray *arrays) {
index = firstaddinblock[block->blockIndex]; index = firstaddinblock[block->blockIndex];
for (instr = block->firstPCode; instr; instr = instr->nextPCode) { for (instr = block->firstPCode; instr; instr = instr->nextPCode) {
if (!(instr->flags & fPCodeFlag1) && instr->argCount) { if (!(instr->flags & fIsBranch) && instr->argCount) {
i = instr->argCount; i = instr->argCount;
op = instr->args; op = instr->args;
while (i--) { while (i--) {

View File

@ -429,7 +429,7 @@ static void spell(Type *type, char *buf) {
strcat(buf, TYPE_ENUM(type)->enumname->name); strcat(buf, TYPE_ENUM(type)->enumname->name);
break; break;
case TYPESTRUCT: case TYPESTRUCT:
if (IS_TYPESTRUCT_VECTOR(type)) { if (IS_TYPESTRUCT_VECTOR(TYPE_STRUCT(type))) {
switch (TYPE_STRUCT(type)->stype) { switch (TYPE_STRUCT(type)->stype) {
case STRUCT_TYPE_4: case STRUCT_TYPE_4:
strcpy(buf, "vector unsigned char "); strcpy(buf, "vector unsigned char ");

View File

@ -461,7 +461,7 @@ extern void SetBuildTarget(OSType cpu, OSType os);
extern void SetParserType(OSType plang); extern void SetParserType(OSType plang);
extern void SetPluginType(OSType lang, OSType type); extern void SetPluginType(OSType lang, OSType type);
extern int CmdLine_Initialize(int argc, char **argv, const char *builddate, const char *buildtime); extern int CmdLine_Initialize(int argc, char **argv, const char *builddate, const char *buildtime);
extern int CmdLine_Driver(); extern int CmdLine_Driver(void);
extern int CmdLine_Terminate(int exitcode); extern int CmdLine_Terminate(int exitcode);
/********************************/ /********************************/
@ -476,20 +476,20 @@ extern void CLFatalError(const char *format, ...);
/********************************/ /********************************/
/* Envir/CLIO.c */ /* Envir/CLIO.c */
extern void SetupDebuggingTraps(); extern void SetupDebuggingTraps(void);
extern Boolean IO_Initialize(); extern Boolean IO_Initialize(void);
extern Boolean IO_Terminate(); extern Boolean IO_Terminate(void);
extern Boolean IO_HelpInitialize(); extern Boolean IO_HelpInitialize(void);
extern Boolean IO_HelpTerminate(); extern Boolean IO_HelpTerminate(void);
extern void FixHandleForIDE(Handle text, UInt32 size); extern void FixHandleForIDE(Handle text, UInt32 size);
extern Boolean ShowHandle(Handle text, UInt32 size, Boolean decorate); extern Boolean ShowHandle(Handle text, UInt32 size, Boolean decorate);
extern Boolean WriteHandleToFile(OSSpec *spec, Handle text, UInt32 size, OSType creator, OSType type); extern Boolean WriteHandleToFile(OSSpec *spec, Handle text, UInt32 size, OSType creator, OSType type);
extern Boolean WriteBinaryHandleToFile(OSSpec *spec, OSType maccreator, OSType mactype, OSHandle *text); extern Boolean WriteBinaryHandleToFile(OSSpec *spec, OSType maccreator, OSType mactype, OSHandle *text);
extern Boolean AppendHandleToFile(OSSpec *spec, Handle text, UInt32 size, OSType maccreator, OSType mactype); extern Boolean AppendHandleToFile(OSSpec *spec, Handle text, UInt32 size, OSType maccreator, OSType mactype);
extern void InitWorking(); extern void InitWorking(void);
extern void ShowWorking(int x); extern void ShowWorking(int x);
extern void TermWorking(); extern void TermWorking(void);
extern Boolean CheckForUserBreak(); extern Boolean CheckForUserBreak(void);
extern char *IO_FormatText(char *buffer, SInt32 size, char *newline, const char *format, ...); extern char *IO_FormatText(char *buffer, SInt32 size, char *newline, const char *format, ...);
extern void CLPrintDispatch(int unk, SInt16 msgtype, const char *message); extern void CLPrintDispatch(int unk, SInt16 msgtype, const char *message);
extern void CLPrintType(SInt16 msgtype, const char *format, ...); extern void CLPrintType(SInt16 msgtype, const char *format, ...);
@ -500,7 +500,7 @@ extern SInt16 CLStyledMessageDispatch(Plugin *plugin, MessageRef *ref, SInt32 er
/********************************/ /********************************/
/* Plugins/CLPlugins.c */ /* Plugins/CLPlugins.c */
extern const ToolVersionInfo *Plugin_GetToolVersionInfo(); extern const ToolVersionInfo *Plugin_GetToolVersionInfo(void);
extern const char *Plugin_GetDropInName(Plugin *pl); extern const char *Plugin_GetDropInName(Plugin *pl);
extern const VersionInfo *Plugin_GetVersionInfo(Plugin *pl); extern const VersionInfo *Plugin_GetVersionInfo(Plugin *pl);
extern char *Plugin_GetVersionInfoASCII(Plugin *pl); extern char *Plugin_GetVersionInfoASCII(Plugin *pl);
@ -523,8 +523,8 @@ extern Boolean Plugin_CL_GetCompilerMapping(Plugin *pl, OSType type, const char
extern Plugin *Plugin_New(const BasePluginCallbacks *cb, const CompilerLinkerPluginCallbacks *cl_cb, const ParserPluginCallbacks *pr_cb); extern Plugin *Plugin_New(const BasePluginCallbacks *cb, const CompilerLinkerPluginCallbacks *cl_cb, const ParserPluginCallbacks *pr_cb);
extern void Plugin_Free(Plugin *pl); extern void Plugin_Free(Plugin *pl);
extern Boolean Plugin_VerifyPanels(Plugin *pl); extern Boolean Plugin_VerifyPanels(Plugin *pl);
extern void Plugins_Init(); extern void Plugins_Init(void);
extern void Plugins_Term(); extern void Plugins_Term(void);
extern int Plugins_Add(Plugin *pl); extern int Plugins_Add(Plugin *pl);
extern Plugin *Plugins_MatchName(Plugin *list, const char *name); extern Plugin *Plugins_MatchName(Plugin *list, const char *name);
extern Plugin *Plugins_CL_MatchTarget(Plugin *list, OSType cpu, OSType os, OSType type, OSType lang); extern Plugin *Plugins_CL_MatchTarget(Plugin *list, OSType cpu, OSType os, OSType type, OSType lang);
@ -562,8 +562,8 @@ extern void Paths_CopyRecurseFSS(FSSpec *list, Paths *paths, UInt16 count);
extern Boolean MakeFrameworkPath(char *out, const char *filename, Path *globalpath); extern Boolean MakeFrameworkPath(char *out, const char *filename, Path *globalpath);
extern void Frameworks_AddPath(const OSPathSpec *oss); extern void Frameworks_AddPath(const OSPathSpec *oss);
extern int Frameworks_AddFramework(const char *name, const char *version, Boolean hidden); extern int Frameworks_AddFramework(const char *name, const char *version, Boolean hidden);
extern void Framework_GetEnvInfo(); extern void Framework_GetEnvInfo(void);
extern int Frameworks_GetCount(); extern int Frameworks_GetCount(void);
extern Paths_FWInfo *Frameworks_GetInfo(int which); extern Paths_FWInfo *Frameworks_GetInfo(int which);
// Not sure if this is the right TU for this // Not sure if this is the right TU for this
@ -571,7 +571,7 @@ extern Paths FrameworkPaths;
/********************************/ /********************************/
/* Project/CLFiles.c */ /* Project/CLFiles.c */
extern File *File_New(); extern File *File_New(void);
extern void File_Free(File *file); extern void File_Free(File *file);
extern Boolean Files_Initialize(Files *); extern Boolean Files_Initialize(Files *);
extern Boolean Files_Terminate(Files *); extern Boolean Files_Terminate(Files *);
@ -643,7 +643,7 @@ extern Boolean Incls_FindFileInPaths(Incls *incls, char *filename, Boolean fulls
extern Boolean Deps_Initialize(Deps *deps, Incls *incls); extern Boolean Deps_Initialize(Deps *deps, Incls *incls);
extern void Deps_Terminate(Deps *deps); extern void Deps_Terminate(Deps *deps);
extern int Deps_ChangeSpecialAccessPath(OSSpec *srcfss, Boolean initialize); extern int Deps_ChangeSpecialAccessPath(OSSpec *srcfss, Boolean initialize);
extern Path *Deps_GetSpecialAccessPath(); extern Path *Deps_GetSpecialAccessPath(void);
extern void Deps_AddDependency(Deps *deps, SInt32 incl, OSSpec *spec, Boolean unk, SInt16 dependencyType, Boolean *alreadyincluded); extern void Deps_AddDependency(Deps *deps, SInt32 incl, OSSpec *spec, Boolean unk, SInt16 dependencyType, Boolean *alreadyincluded);
extern void Deps_ListDependencies(Incls *incls, File *file, OSHandle *h); extern void Deps_ListDependencies(Incls *incls, File *file, OSHandle *h);
@ -651,25 +651,25 @@ extern void Deps_ListDependencies(Incls *incls, File *file, OSHandle *h);
/* CLFileOps.c */ /* CLFileOps.c */
extern int GetOutputFile(File *file, SInt16 stage); extern int GetOutputFile(File *file, SInt16 stage);
extern int StoreObjectFile(File *file); extern int StoreObjectFile(File *file);
extern int CompileFilesInProject(); extern int CompileFilesInProject(void);
extern int LinkProject(); extern int LinkProject(void);
/********************************/ /********************************/
/* CLIncludeFileCache.c */ /* CLIncludeFileCache.c */
extern void InitializeIncludeCache(); extern void InitializeIncludeCache(void);
extern void CleanupIncludeCache(); extern void CleanupIncludeCache(void);
extern void CacheIncludeFile(OSSpec *spec, Handle text, Boolean precompiled); extern void CacheIncludeFile(OSSpec *spec, Handle text, Boolean precompiled);
extern Handle CachedIncludeFile(OSSpec *spec, Boolean *precompiled); extern Handle CachedIncludeFile(OSSpec *spec, Boolean *precompiled);
extern void FreeIncludeFile(Handle text); extern void FreeIncludeFile(Handle text);
/********************************/ /********************************/
/* CLLicenses.c */ /* CLLicenses.c */
extern void License_Initialize(); extern void License_Initialize(void);
extern void License_Terminate(); extern void License_Terminate(void);
extern SInt32 License_Checkout(); extern SInt32 License_Checkout(/* unknown args */);
extern void License_Refresh(); extern void License_Refresh(/* unknown args */);
extern void License_Checkin(); extern void License_Checkin(/* unknown args */);
extern void License_AutoCheckin(); extern void License_AutoCheckin(void);
/********************************/ /********************************/
/* CLLoadAndCache.c */ /* CLLoadAndCache.c */
@ -683,7 +683,7 @@ extern void Main_PreParse(int *argc, char ***argv);
extern void Main_PassSpecialArgs(int *argc, char ***argv); extern void Main_PassSpecialArgs(int *argc, char ***argv);
extern int Main_Initialize(int argc, char **argv); extern int Main_Initialize(int argc, char **argv);
extern int Main_Terminate(int code); extern int Main_Terminate(int code);
extern int Main_Driver(); extern int Main_Driver(void);
/********************************/ /********************************/
/* CLPluginRequests.cpp */ /* CLPluginRequests.cpp */
@ -714,8 +714,8 @@ extern Boolean SendInitOrTermRequest(Plugin *plugin, Boolean reqIsInitialize);
extern PrefPanel *PrefPanel_New(const char *name, void *initdata, SInt32 initdatasize); extern PrefPanel *PrefPanel_New(const char *name, void *initdata, SInt32 initdatasize);
extern Handle PrefPanel_GetHandle(PrefPanel *panel); extern Handle PrefPanel_GetHandle(PrefPanel *panel);
extern int PrefPanel_PutHandle(PrefPanel *panel, Handle data); extern int PrefPanel_PutHandle(PrefPanel *panel, Handle data);
extern void Prefs_Initialize(); extern void Prefs_Initialize(void);
extern void Prefs_Terminate(); extern void Prefs_Terminate(void);
extern Boolean Prefs_AddPanel(PrefPanel *panel); extern Boolean Prefs_AddPanel(PrefPanel *panel);
extern PrefPanel *Prefs_FindPanel(const char *name); extern PrefPanel *Prefs_FindPanel(const char *name);
@ -729,8 +729,8 @@ extern void Target_Add(Target **list, Target *targ);
/********************************/ /********************************/
/* CLToolExec.c */ /* CLToolExec.c */
extern void AppendArgumentList(int *argc, char ***argv, const char *str); extern void AppendArgumentList(int *argc, char ***argv, const char *str);
extern int SetupTemporaries(); extern int SetupTemporaries(void);
extern int DeleteTemporaries(); extern int DeleteTemporaries(void);
extern int ExecuteLinker(Plugin *plugin, SInt32 dropinflags, File *file, char *stdoutfile, char *stderrfile); extern int ExecuteLinker(Plugin *plugin, SInt32 dropinflags, File *file, char *stdoutfile, char *stderrfile);
/********************************/ /********************************/

View File

@ -8,298 +8,591 @@
#define CError_FATAL(line) do { CError_Internal(__FILE__, line); } while (0) #define CError_FATAL(line) do { CError_Internal(__FILE__, line); } while (0)
enum { enum {
// "illegal character constant"
CErrorStr100 = 100, CErrorStr100 = 100,
// "illegal string constant"
CErrorStr101 = 101, CErrorStr101 = 101,
// "unexpected end of file"
CErrorStr102 = 102, CErrorStr102 = 102,
// "unterminated comment"
CErrorStr103 = 103, CErrorStr103 = 103,
// "undefined preprocessor directive"
CErrorStr104 = 104, CErrorStr104 = 104,
// "illegal token"
CErrorStr105 = 105, CErrorStr105 = 105,
// "string too long"
CErrorStr106 = 106, CErrorStr106 = 106,
// "identifier expected"
CErrorStr107 = 107, CErrorStr107 = 107,
// "macro '%u' redefined"
CErrorStr108 = 108, CErrorStr108 = 108,
// "illegal argument list"
CErrorStr109 = 109, CErrorStr109 = 109,
// "too many macro arguments"
CErrorStr110 = 110, CErrorStr110 = 110,
// "macro(s) too complex"
CErrorStr111 = 111, CErrorStr111 = 111,
// "unexpected end of line"
CErrorStr112 = 112, CErrorStr112 = 112,
// "end of line expected"
CErrorStr113 = 113, CErrorStr113 = 113,
// "'(' expected"
CErrorStr114 = 114, CErrorStr114 = 114,
// "')' expected"
CErrorStr115 = 115, CErrorStr115 = 115,
// "',' expected"
CErrorStr116 = 116, CErrorStr116 = 116,
// "preprocessor syntax error"
CErrorStr117 = 117, CErrorStr117 = 117,
// "preceding #if is missing"
CErrorStr118 = 118, CErrorStr118 = 118,
// "unterminated #if / macro"
CErrorStr119 = 119, CErrorStr119 = 119,
// "unexpected token"
CErrorStr120 = 120, CErrorStr120 = 120,
// "declaration syntax error"
CErrorStr121 = 121, CErrorStr121 = 121,
// "identifier '%u' redeclared"
CErrorStr122 = 122, CErrorStr122 = 122,
// "';' expected"
CErrorStr123 = 123, CErrorStr123 = 123,
// "illegal constant expression"
CErrorStr124 = 124, CErrorStr124 = 124,
// "']' expected"
CErrorStr125 = 125, CErrorStr125 = 125,
// "illegal use of 'void'"
CErrorStr126 = 126, CErrorStr126 = 126,
// "illegal function definition"
CErrorStr127 = 127, CErrorStr127 = 127,
// "illegal function return type"
CErrorStr128 = 128, CErrorStr128 = 128,
// "illegal array definition"
CErrorStr129 = 129, CErrorStr129 = 129,
// "'}' expected"
CErrorStr130 = 130, CErrorStr130 = 130,
// "illegal struct/union/enum/class definition"
CErrorStr131 = 131, CErrorStr131 = 131,
// "struct/union/enum/class tag '%u' redefined"
CErrorStr132 = 132, CErrorStr132 = 132,
// "struct/union/class member '%u' redefined"
CErrorStr133 = 133, CErrorStr133 = 133,
// "declarator expected"
CErrorStr134 = 134, CErrorStr134 = 134,
// "'{' expected"
CErrorStr135 = 135, CErrorStr135 = 135,
// "illegal use of incomplete struct/union/class '%t'"
CErrorStr136 = 136, CErrorStr136 = 136,
// "struct/union/class size exceeds 32K"
CErrorStr137 = 137, CErrorStr137 = 137,
// "illegal bitfield declaration"
CErrorStr138 = 138, CErrorStr138 = 138,
// "division by 0"
CErrorStr139 = 139, CErrorStr139 = 139,
// "undefined identifier '%u'"
CErrorStr140 = 140, CErrorStr140 = 140,
// "expression syntax error"
CErrorStr141 = 141, CErrorStr141 = 141,
// "not an lvalue"
CErrorStr142 = 142, CErrorStr142 = 142,
// "illegal operation"
CErrorStr143 = 143, CErrorStr143 = 143,
// "illegal operand"
CErrorStr144 = 144, CErrorStr144 = 144,
// "data type is incomplete"
CErrorStr145 = 145, CErrorStr145 = 145,
// "illegal type"
CErrorStr146 = 146, CErrorStr146 = 146,
// "too many initializers"
CErrorStr147 = 147, CErrorStr147 = 147,
// "pointer/array required"
CErrorStr148 = 148, CErrorStr148 = 148,
// "not a struct/union/class"
CErrorStr149 = 149, CErrorStr149 = 149,
// "'%u' is not a struct/union/class member"
CErrorStr150 = 150, CErrorStr150 = 150,
// "the file '%u' cannot be opened"
CErrorStr151 = 151, CErrorStr151 = 151,
// "illegal instruction for this processor"
CErrorStr152 = 152, CErrorStr152 = 152,
// "illegal operands for this processor"
CErrorStr153 = 153, CErrorStr153 = 153,
// "number is out of range"
CErrorStr154 = 154, CErrorStr154 = 154,
// "illegal addressing mode"
CErrorStr155 = 155, CErrorStr155 = 155,
// "illegal data size"
CErrorStr156 = 156, CErrorStr156 = 156,
// "illegal register list"
CErrorStr157 = 157, CErrorStr157 = 157,
// "branch out of range"
CErrorStr158 = 158, CErrorStr158 = 158,
// "undefined label '%u'"
CErrorStr159 = 159, CErrorStr159 = 159,
// "reference to label '%u' is out of range"
CErrorStr160 = 160, CErrorStr160 = 160,
// "call of non-function"
CErrorStr161 = 161, CErrorStr161 = 161,
// "function call does not match prototype"
CErrorStr162 = 162, CErrorStr162 = 162,
// "illegal use of register variable"
CErrorStr163 = 163, CErrorStr163 = 163,
// "illegal type cast"
CErrorStr164 = 164, CErrorStr164 = 164,
// "function already has a stackframe"
CErrorStr165 = 165, CErrorStr165 = 165,
// "function has no initialized stackframe"
CErrorStr166 = 166, CErrorStr166 = 166,
// "value is not stored in register"
CErrorStr167 = 167, CErrorStr167 = 167,
// "function nesting too complex"
CErrorStr168 = 168, CErrorStr168 = 168,
// "illegal use of keyword"
CErrorStr169 = 169, CErrorStr169 = 169,
// "':' expected"
CErrorStr170 = 170, CErrorStr170 = 170,
// "label '%u' redefined"
CErrorStr171 = 171, CErrorStr171 = 171,
// "case constant defined more than once"
CErrorStr172 = 172, CErrorStr172 = 172,
// "default label defined more than once"
CErrorStr173 = 173, CErrorStr173 = 173,
// "illegal initialization"
CErrorStr174 = 174, CErrorStr174 = 174,
// "illegal use of inline function"
CErrorStr175 = 175, CErrorStr175 = 175,
// "illegal type qualifier(s)"
CErrorStr176 = 176, CErrorStr176 = 176,
// "illegal storage class"
CErrorStr177 = 177, CErrorStr177 = 177,
// "function has no prototype"
CErrorStr178 = 178, CErrorStr178 = 178,
// "illegal assignment to constant"
CErrorStr179 = 179, CErrorStr179 = 179,
// "illegal use of precompiled header"
CErrorStr180 = 180, CErrorStr180 = 180,
// "illegal data in precompiled header"
CErrorStr181 = 181, CErrorStr181 = 181,
// "variable / argument '%u' is not used in function"
CErrorStr182 = 182, CErrorStr182 = 182,
// "illegal use of direct parameters"
CErrorStr183 = 183, CErrorStr183 = 183,
// "return value expected"
CErrorStr184 = 184, CErrorStr184 = 184,
// "variable '%u' is not initialized before being used"
CErrorStr185 = 185, CErrorStr185 = 185,
// "illegal #pragma"
CErrorStr186 = 186, CErrorStr186 = 186,
// "illegal access to protected/private member"
CErrorStr187 = 187, CErrorStr187 = 187,
// "ambiguous access to class/struct/union member"
CErrorStr188 = 188, CErrorStr188 = 188,
// "illegal use of 'this'"
CErrorStr189 = 189, CErrorStr189 = 189,
// "unimplemented C++ feature"
CErrorStr190 = 190, CErrorStr190 = 190,
// "illegal use of 'HandleObject'"
CErrorStr191 = 191, CErrorStr191 = 191,
// "illegal access qualifier"
CErrorStr192 = 192, CErrorStr192 = 192,
// "illegal 'operator' declaration"
CErrorStr193 = 193, CErrorStr193 = 193,
// "illegal use of abstract class ('%o')"
CErrorStr194 = 194, CErrorStr194 = 194,
// "illegal use of pure function"
CErrorStr195 = 195, CErrorStr195 = 195,
// "illegal '&' reference"
CErrorStr196 = 196, CErrorStr196 = 196,
// "illegal function overloading"
CErrorStr197 = 197, CErrorStr197 = 197,
// "illegal operator overloading"
CErrorStr198 = 198, CErrorStr198 = 198,
// "ambiguous access to overloaded function "
CErrorStr199 = 199, CErrorStr199 = 199,
// "illegal access/using declaration"
CErrorStr200 = 200, CErrorStr200 = 200,
// "illegal 'friend' declaration"
CErrorStr201 = 201, CErrorStr201 = 201,
// "illegal 'inline' function definition"
CErrorStr202 = 202, CErrorStr202 = 202,
// "class has no default constructor"
CErrorStr203 = 203, CErrorStr203 = 203,
// "illegal operator"
CErrorStr204 = 204, CErrorStr204 = 204,
// "illegal default argument(s)"
CErrorStr205 = 205, CErrorStr205 = 205,
// "possible unwanted ';'"
CErrorStr206 = 206, CErrorStr206 = 206,
// "possible unwanted assignment"
CErrorStr207 = 207, CErrorStr207 = 207,
// "possible unwanted compare"
CErrorStr208 = 208, CErrorStr208 = 208,
// "illegal implicit conversion from '%t' to\n'%t'"
CErrorStr209 = 209, CErrorStr209 = 209,
// "local data >32k"
CErrorStr210 = 210, CErrorStr210 = 210,
// "illegal jump past initializer"
CErrorStr211 = 211, CErrorStr211 = 211,
// "illegal ctor initializer"
CErrorStr212 = 212, CErrorStr212 = 212,
// "cannot construct %t's base class '%t'"
CErrorStr213 = 213, CErrorStr213 = 213,
// "cannot construct %t's direct member '%u'"
CErrorStr214 = 214, CErrorStr214 = 214,
// "#if nesting overflow"
CErrorStr215 = 215, CErrorStr215 = 215,
// "illegal empty declaration"
CErrorStr216 = 216, CErrorStr216 = 216,
// "illegal implicit enum conversion from '%t' to\n'%t'"
CErrorStr217 = 217, CErrorStr217 = 217,
// "illegal use of #pragma parameter"
CErrorStr218 = 218, CErrorStr218 = 218,
// "virtual functions cannot be pascal functions"
CErrorStr219 = 219, CErrorStr219 = 219,
// "illegal implicit const/volatile pointer conversion from '%t' to\n'%t'"
CErrorStr220 = 220, CErrorStr220 = 220,
// "illegal use of non-static member"
CErrorStr221 = 221, CErrorStr221 = 221,
// "illegal precompiled header version"
CErrorStr222 = 222, CErrorStr222 = 222,
// "illegal precompiled header compiler flags or target"
CErrorStr223 = 223, CErrorStr223 = 223,
// "'const' or '&' variable needs initializer"
CErrorStr224 = 224, CErrorStr224 = 224,
// "'%o' hides inherited virtual function '%o'"
CErrorStr225 = 225, CErrorStr225 = 225,
// "pascal function cannot be overloaded"
CErrorStr226 = 226, CErrorStr226 = 226,
// "derived function differs from virtual base function in return type only"
CErrorStr227 = 227, CErrorStr227 = 227,
// "non-const '&' reference initialized to temporary"
CErrorStr228 = 228, CErrorStr228 = 228,
// "illegal template declaration"
CErrorStr229 = 229, CErrorStr229 = 229,
// "'<' expected"
CErrorStr230 = 230, CErrorStr230 = 230,
// "'>' expected"
CErrorStr231 = 231, CErrorStr231 = 231,
// "illegal template argument(s)"
CErrorStr232 = 232, CErrorStr232 = 232,
// "cannot instantiate '%o'"
CErrorStr233 = 233, CErrorStr233 = 233,
// "template redefined"
CErrorStr234 = 234, CErrorStr234 = 234,
// "template parameter mismatch"
CErrorStr235 = 235, CErrorStr235 = 235,
// "cannot pass const/volatile data object to non-const/volatile member function"
CErrorStr236 = 236, CErrorStr236 = 236,
// "preceding '#pragma push' is missing"
CErrorStr237 = 237, CErrorStr237 = 237,
// "illegal explicit template instantiation"
CErrorStr238 = 238, CErrorStr238 = 238,
// "illegal X::X(X) copy constructor"
CErrorStr239 = 239, CErrorStr239 = 239,
// "function defined 'inline' after being called"
CErrorStr240 = 240, CErrorStr240 = 240,
// "illegal constructor/destructor declaration"
CErrorStr241 = 241, CErrorStr241 = 241,
// "'catch' expected"
CErrorStr242 = 242, CErrorStr242 = 242,
// "#include nesting overflow"
CErrorStr243 = 243, CErrorStr243 = 243,
// "cannot convert\n'%t' to\n'%t'"
CErrorStr244 = 244, CErrorStr244 = 244,
// "type mismatch\n'%t' and\n'%t'"
CErrorStr245 = 245, CErrorStr245 = 245,
// "class type expected"
CErrorStr246 = 246, CErrorStr246 = 246,
// "illegal explicit conversion from '%t' to\n'%t'"
CErrorStr247 = 247, CErrorStr247 = 247,
// "function call '*' does not match"
CErrorStr248 = 248, CErrorStr248 = 248,
// "identifier '%u' redeclared\nwas declared as: '%t'\nnow declared as: '%t'"
CErrorStr249 = 249, CErrorStr249 = 249,
// "cannot throw class with ambiguous base class ('%u')"
CErrorStr250 = 250, CErrorStr250 = 250,
// "class '%t': '%o' has more than one final overrider:\n'%o'\nand '%o'"
CErrorStr251 = 251, CErrorStr251 = 251,
// "exception handling option is disabled"
CErrorStr252 = 252, CErrorStr252 = 252,
// "cannot delete pointer to const"
CErrorStr253 = 253, CErrorStr253 = 253,
// "cannot destroy const object"
CErrorStr254 = 254, CErrorStr254 = 254,
// "const member '%u' is not initialized"
CErrorStr255 = 255, CErrorStr255 = 255,
// "'&' reference member '%u' is not initialized"
CErrorStr256 = 256, CErrorStr256 = 256,
// "RTTI option is disabled"
CErrorStr257 = 257, CErrorStr257 = 257,
// "constness casted away"
CErrorStr258 = 258, CErrorStr258 = 258,
// "illegal const/volatile '&' reference initialization"
CErrorStr259 = 259, CErrorStr259 = 259,
// "inconsistent linkage: 'extern' object redeclared as 'static'"
CErrorStr260 = 260, CErrorStr260 = 260,
// "unknown assembler instruction mnemonic"
CErrorStr261 = 261, CErrorStr261 = 261,
// "local data > 224 bytes"
CErrorStr262 = 262, CErrorStr262 = 262,
// "'%u' could not be assigned to a register"
CErrorStr263 = 263, CErrorStr263 = 263,
// "illegal exception specification"
CErrorStr264 = 264, CErrorStr264 = 264,
// "exception specification list mismatch"
CErrorStr265 = 265, CErrorStr265 = 265,
// "the parameter(s) of the '%n' function must be immediate value(s)"
CErrorStr266 = 266, CErrorStr266 = 266,
// "SOM classes can only inherit from other SOM based classes"
CErrorStr267 = 267, CErrorStr267 = 267,
// "SOM classes inhertiance must be virtual"
CErrorStr268 = 268, CErrorStr268 = 268,
// "SOM class data members must be private"
CErrorStr269 = 269, CErrorStr269 = 269,
// "illegal SOM function overload '%o'"
CErrorStr270 = 270, CErrorStr270 = 270,
// "no static members allowed in SOM classes"
CErrorStr271 = 271, CErrorStr271 = 271,
// "no parameters allowed in SOM class constructors"
CErrorStr272 = 272, CErrorStr272 = 272,
// "illegal SOM function parameters or return type"
CErrorStr273 = 273, CErrorStr273 = 273,
// "SOM runtime function '%u' not defined (should be defined in somobj.hh)"
CErrorStr274 = 274, CErrorStr274 = 274,
// "SOM runtime function '%u' has unexpected type"
CErrorStr275 = 275, CErrorStr275 = 275,
// "'%u' is not a SOM class"
CErrorStr276 = 276, CErrorStr276 = 276,
// "illegal use of #pragma outside of SOM class definition"
CErrorStr277 = 277, CErrorStr277 = 277,
// "introduced method '%o' is not specified in release order list"
CErrorStr278 = 278, CErrorStr278 = 278,
// "SOM class access qualification only allowed to direct parent or own class"
CErrorStr279 = 279, CErrorStr279 = 279,
// "SOM class must have one non-inline member function"
CErrorStr280 = 280, CErrorStr280 = 280,
// "SOM type '%u' undefined"
CErrorStr281 = 281, CErrorStr281 = 281,
// "new SOM callstyle method '%o' must have explicit 'Environment *' parameter"
CErrorStr282 = 282, CErrorStr282 = 282,
// "functions cannot return SOM classes"
CErrorStr283 = 283, CErrorStr283 = 283,
// "functions cannot have SOM class arguments"
CErrorStr284 = 284, CErrorStr284 = 284,
// "assignment is not supported for SOM classes"
CErrorStr285 = 285, CErrorStr285 = 285,
// "sizeof() is not supported for SOM classes"
CErrorStr286 = 286, CErrorStr286 = 286,
// "SOM classes cannot be class members"
CErrorStr287 = 287, CErrorStr287 = 287,
// "global SOM class objects are not supported"
CErrorStr288 = 288, CErrorStr288 = 288,
// "SOM class arrays are not supported"
CErrorStr289 = 289, CErrorStr289 = 289,
// "'pointer to member' is not supported for SOM classes"
CErrorStr290 = 290, CErrorStr290 = 290,
// "SOM class has no release order list"
CErrorStr291 = 291, CErrorStr291 = 291,
// "'%u' is not an Objective-C class"
CErrorStr292 = 292, CErrorStr292 = 292,
// "method '%m' redeclared"
CErrorStr293 = 293, CErrorStr293 = 293,
// "undefined method '%m'"
CErrorStr294 = 294, CErrorStr294 = 294,
// "class '%u' redeclared"
CErrorStr295 = 295, CErrorStr295 = 295,
// "class '%u' redefined"
CErrorStr296 = 296, CErrorStr296 = 296,
// "Objective-C type '%u' is undefined (should be defined in objc.h)"
CErrorStr297 = 297, CErrorStr297 = 297,
// "Objective-C type '%u' has unexpected type"
CErrorStr298 = 298, CErrorStr298 = 298,
// "method '%m' not defined"
CErrorStr299 = 299, CErrorStr299 = 299,
// "method '%m' redefined"
CErrorStr300 = 300, CErrorStr300 = 300,
// "illegal use of 'self'"
CErrorStr301 = 301, CErrorStr301 = 301,
// "illegal use of 'super'"
CErrorStr302 = 302, CErrorStr302 = 302,
// "illegal message receiver"
CErrorStr303 = 303, CErrorStr303 = 303,
// "receiver cannot handle this message"
CErrorStr304 = 304, CErrorStr304 = 304,
// "ambiguous message selector\nused: '%m'\nalso had: '%m'"
CErrorStr305 = 305, CErrorStr305 = 305,
// "unknown message selector"
CErrorStr306 = 306, CErrorStr306 = 306,
// "illegal use of Objective-C object"
CErrorStr307 = 307, CErrorStr307 = 307,
// "protocol '%u' redefined"
CErrorStr308 = 308, CErrorStr308 = 308,
// "protocol '%u' is undefined"
CErrorStr309 = 309, CErrorStr309 = 309,
// "protocol '%u' is already in protocol list"
CErrorStr310 = 310, CErrorStr310 = 310,
// "category '%u' redefined"
CErrorStr311 = 311, CErrorStr311 = 311,
// "category '%u' is undefined"
CErrorStr312 = 312, CErrorStr312 = 312,
// "illegal use of '%u'"
CErrorStr313 = 313, CErrorStr313 = 313,
// "template too complex or recursive"
CErrorStr314 = 314, CErrorStr314 = 314,
// "illegal return value in void/constructor/destructor function"
CErrorStr315 = 315, CErrorStr315 = 315,
// "assigning a non-int numeric value to an unprototyped function"
CErrorStr316 = 316, CErrorStr316 = 316,
// "implicit arithmetic conversion from '%t' to '%t'"
CErrorStr317 = 317, CErrorStr317 = 317,
// "preprocessor #error directive"
CErrorStr318 = 318, CErrorStr318 = 318,
// "ambiguous access to name found '%u' and '%u'"
CErrorStr319 = 319, CErrorStr319 = 319,
// "illegal namespace"
CErrorStr320 = 320, CErrorStr320 = 320,
// "illegal use of namespace name"
CErrorStr321 = 321, CErrorStr321 = 321,
// "illegal name overloading"
CErrorStr322 = 322, CErrorStr322 = 322,
// "instance variable list does not match @interface"
CErrorStr323 = 323, CErrorStr323 = 323,
// "protocol list does not match @interface"
CErrorStr324 = 324, CErrorStr324 = 324,
// "super class does not match @interface"
CErrorStr325 = 325, CErrorStr325 = 325,
// "function result is a pointer/reference to an automatic variable"
CErrorStr326 = 326, CErrorStr326 = 326,
// "cannot allocate initialized objects in the scratchpad"
CErrorStr327 = 327, CErrorStr327 = 327,
// "illegal class member access"
CErrorStr328 = 328, CErrorStr328 = 328,
// "data object '%o' redefined"
CErrorStr329 = 329, CErrorStr329 = 329,
// "illegal access to local variable from other function"
CErrorStr330 = 330, CErrorStr330 = 330,
// "illegal implicit member pointer conversion"
CErrorStr331 = 331, CErrorStr331 = 331,
// "typename redefined"
CErrorStr332 = 332, CErrorStr332 = 332,
// "object '%o' redefined"
CErrorStr333 = 333, CErrorStr333 = 333,
// "'main' not defined as external 'int main()' function"
CErrorStr334 = 334, CErrorStr334 = 334,
// "illegal explicit template specialization"
CErrorStr335 = 335, CErrorStr335 = 335,
// "name has not been declared in namespace/class"
CErrorStr336 = 336, CErrorStr336 = 336,
// "preprocessor #warning directive"
CErrorStr337 = 337, CErrorStr337 = 337,
// "illegal use of asm inline function"
CErrorStr338 = 338, CErrorStr338 = 338,
// "illegal use of C++ feature in EC++"
CErrorStr339 = 339, CErrorStr339 = 339,
// "illegal use template argument dependent type 'T::%u'"
CErrorStr340 = 340, CErrorStr340 = 340,
// "illegal use of alloca() in function argument"
CErrorStr341 = 341, CErrorStr341 = 341,
// "inline function call '%o' not inlined"
CErrorStr342 = 342, CErrorStr342 = 342,
// "inconsistent use of 'class' and 'struct' keywords"
CErrorStr343 = 343, CErrorStr343 = 343,
// "illegal partial specialization"
CErrorStr344 = 344, CErrorStr344 = 344,
// "illegal partial specialization argument list"
CErrorStr345 = 345, CErrorStr345 = 345,
// "ambiguous use of partial specialization"
CErrorStr346 = 346, CErrorStr346 = 346,
// "local classes shall not have member templates"
CErrorStr347 = 347, CErrorStr347 = 347,
// "illegal template argument dependent expression"
CErrorStr348 = 348, CErrorStr348 = 348,
// "implicit 'int' is no longer supported in C++"
CErrorStr349 = 349, CErrorStr349 = 349,
// "%i pad byte(s) inserted after data member '%u'"
CErrorStr350 = 350, CErrorStr350 = 350,
// "pure function '%o' is not virtual"
CErrorStr351 = 351, CErrorStr351 = 351,
// "illegal virtual function '%o' in 'union'"
CErrorStr352 = 352, CErrorStr352 = 352,
// "cannot pass 'void' or 'function' parameter"
CErrorStr353 = 353, CErrorStr353 = 353,
// "illegal static const member '%u' initialization"
CErrorStr354 = 354, CErrorStr354 = 354,
// "'typename' is missing in template argument dependent qualified type"
CErrorStr355 = 355, CErrorStr355 = 355,
// "more than one expression in non-class type conversion"
CErrorStr356 = 356, CErrorStr356 = 356,
// "template non-type argument objects shall have external linkage"
CErrorStr357 = 357, CErrorStr357 = 357,
// "illegal inline assembly operand: %u"
CErrorStr358 = 358, CErrorStr358 = 358,
// "illegal or unsupported __attribute__"
CErrorStr359 = 359, CErrorStr359 = 359,
// "cannot create object file '%f'"
CErrorStr360 = 360, CErrorStr360 = 360,
// "error writing to object file '%f'"
CErrorStr361 = 361, CErrorStr361 = 361,
// "printf-family format string doesn't match arguments"
CErrorStr362 = 362, CErrorStr362 = 362,
// "scanf-family format string doesn't match arguments"
CErrorStr363 = 363, CErrorStr363 = 363,
// "__alignof__() is not supported for SOM classes"
CErrorStr364 = 364, CErrorStr364 = 364,
// "illegal macro argument name '%u'"
CErrorStr365 = 365, CErrorStr365 = 365,
// "case has an empty range of values"
CErrorStr366 = 366, CErrorStr366 = 366,
// "'long long' switch() is not supported"
CErrorStr367 = 367, CErrorStr367 = 367,
// "'long long' case range is not supported"
CErrorStr368 = 368, CErrorStr368 = 368,
// "expression has no side effect"
CErrorStr369 = 369, CErrorStr369 = 369,
// "result of function call is not used"
CErrorStr370 = 370, CErrorStr370 = 370,
// "illegal non-type template argument"
CErrorStr371 = 371, CErrorStr371 = 371,
// "illegal use of abstract class ('%t')"
CErrorStr372 = 372, CErrorStr372 = 372,
// "illegal use of 'template' prefix"
CErrorStr373 = 373, CErrorStr373 = 373,
// "template parameter/argument list mismatch"
CErrorStr374 = 374, CErrorStr374 = 374,
// "cannot find matching deallocation function for '%t'"
CErrorStr375 = 375, CErrorStr375 = 375,
// "illegal operand '%t'"
CErrorStr376 = 376, CErrorStr376 = 376,
// "illegal operands '%t' %u '%t'"
CErrorStr377 = 377, CErrorStr377 = 377,
// "illegal use of default template-argument"
CErrorStr378 = 378, CErrorStr378 = 378,
// "illegal UUID syntax"
CErrorStr379 = 379, CErrorStr379 = 379,
// "__uuidof() is not supported for SOM classes"
CErrorStr380 = 380, CErrorStr380 = 380,
// "illegal access from '%t' to protected/private member '%o'"
CErrorStr381 = 381, CErrorStr381 = 381,
// "integral type is not large enough to hold pointer"
CErrorStr382 = 382, CErrorStr382 = 382,
// "unknown x86 assembler instruction mnemonic"
CErrorStr383 = 383, CErrorStr383 = 383,
// "illegal use of const/volatile function qualifier sequence"
CErrorStr384 = 384, CErrorStr384 = 384,
// "illegal optimization level for this limited version of CodeWarrior"
CErrorStr385 = 385, CErrorStr385 = 385,
// "no UUID defined for type '%t'"
CErrorStr386 = 386, CErrorStr386 = 386,
// "using implicit copy assigment for class with const or reference member ('%t')"
CErrorStr387 = 387, CErrorStr387 = 387,
// "unimplemented assembler instruction/directive"
CErrorStr388 = 388, CErrorStr388 = 388,
// "override of dllimport function '%u' only has application scope"
CErrorStr389 = 389, CErrorStr389 = 389,
// "illegal combination of operands in inline statement at line %i"
CErrorStr390 = 390, CErrorStr390 = 390,
// "illegal operand in inline statement at line %i"
CErrorStr391 = 391, CErrorStr391 = 391,
// "function call '*' is ambiguous"
CErrorStr392 = 392, CErrorStr392 = 392,
CErrorStrMAX = 393 CErrorStrMAX = 393
}; };
@ -316,12 +609,12 @@ extern char cerror_synchdata[32];
extern short cerror_synchoffset; extern short cerror_synchoffset;
extern int CError_BreakPointcount; extern int CError_BreakPointcount;
extern void CError_Init(); extern void CError_Init(void);
extern void CError_SetErrorToken(TStreamElement *token); extern void CError_SetErrorToken(TStreamElement *token);
extern void CError_SetNullErrorToken(); extern void CError_SetNullErrorToken(void);
extern void CError_LockErrorPos(TStreamElement *token, TStreamElement **saved); extern void CError_LockErrorPos(TStreamElement *token, TStreamElement **saved);
extern void CError_UnlockErrorPos(TStreamElement **saved); extern void CError_UnlockErrorPos(TStreamElement **saved);
extern void CError_ResetErrorSkip(); extern void CError_ResetErrorSkip(void);
extern void CError_GetErrorString(char *buf, short code); extern void CError_GetErrorString(char *buf, short code);
extern void CError_BufferInit(CErrorBuffer *eb, char *buf, SInt32 bufSize); extern void CError_BufferInit(CErrorBuffer *eb, char *buf, SInt32 bufSize);
extern void CError_BufferGrow(CErrorBuffer *eb, SInt32 amount); extern void CError_BufferGrow(CErrorBuffer *eb, SInt32 amount);
@ -360,10 +653,10 @@ extern void CError_AbstractClassError(TypeClass *tclass);
extern void CError_Warning(int code, ...); extern void CError_Warning(int code, ...);
extern void CError_BreakPoint(const char *a, const char *b); extern void CError_BreakPoint(const char *a, const char *b);
extern void CError_Internal(char *filename, int line); extern void CError_Internal(char *filename, int line);
extern void CError_ExpressionTooComplex(); extern void CError_ExpressionTooComplex(void);
extern void CError_NoMem(); extern void CError_NoMem(void);
extern void CError_UserBreak(); extern void CError_UserBreak(void);
extern void CError_CannotOpen(); extern void CError_CannotOpen(void);
extern void CError_QualifierCheck(UInt32 qual); extern void CError_QualifierCheck(UInt32 qual);
#endif #endif

View File

@ -115,7 +115,7 @@ typedef struct CI_Action {
union { union {
struct { struct {
FileOffsetInfo fileoffset; FileOffsetInfo fileoffset;
TStream stream; TokenStream stream;
TypeClass *tclass; TypeClass *tclass;
} inlinefunc; } inlinefunc;
struct { struct {
@ -151,7 +151,7 @@ extern SInt16 CInline_GetStatementNumber(Statement *first, Statement *stmt);
extern void CInline_PackIFunctionData(CI_FuncData *packed, Statement *stmt, Object *object); extern void CInline_PackIFunctionData(CI_FuncData *packed, Statement *stmt, Object *object);
extern void CInline_UnpackIFunctionData(Object *object, CI_FuncData *packed, Statement *firstStmt); extern void CInline_UnpackIFunctionData(Object *object, CI_FuncData *packed, Statement *firstStmt);
extern void CInline_AddDefaultFunctionAction(Object *object); extern void CInline_AddDefaultFunctionAction(Object *object);
extern void CInline_AddInlineFunctionAction(Object *object, TypeClass *tclass, FileOffsetInfo *fileoffset, TStream *stream, Boolean flag); extern void CInline_AddInlineFunctionAction(Object *object, TypeClass *tclass, FileOffsetInfo *fileoffset, TokenStream *stream, Boolean flag);
extern void CInline_AddMemberFunctionAction(Object *object, TemplClass *templ, TemplClassInst *inst, TemplateMember *tmemb); extern void CInline_AddMemberFunctionAction(Object *object, TemplClass *templ, TemplClassInst *inst, TemplateMember *tmemb);
extern void CInline_AddTemplateFunctionAction(Object *object, TemplateFunction *func, TemplFuncInstance *inst); extern void CInline_AddTemplateFunctionAction(Object *object, TemplateFunction *func, TemplFuncInstance *inst);
extern void CInline_ObjectAddrRef(Object *object); extern void CInline_ObjectAddrRef(Object *object);

View File

@ -40,7 +40,7 @@ inline void CInt64_Extend32(CInt64 *n) { // assumed name
n->hi = (n->lo >> 31) ? 0xFFFFFFFF : 0; n->hi = (n->lo >> 31) ? 0xFFFFFFFF : 0;
} }
extern void CInt64_Init(); extern void CInt64_Init(void);
extern CInt64 CInt64_Not(CInt64 input); extern CInt64 CInt64_Not(CInt64 input);
extern CInt64 CInt64_Inv(CInt64 input); extern CInt64 CInt64_Inv(CInt64 input);
extern CInt64 CInt64_Add(CInt64 lhs, CInt64 rhs); extern CInt64 CInt64_Add(CInt64 lhs, CInt64 rhs);

View File

@ -60,7 +60,7 @@ extern Boolean CMach_FloatIsNegOne(Float fval);
extern void CMach_InitFloatMem(Type *type, Float val, void *mem); extern void CMach_InitFloatMem(Type *type, Float val, void *mem);
extern void CMach_PrintFloat(char *buf, Float val); extern void CMach_PrintFloat(char *buf, Float val);
extern void CMach_PragmaParams(void); extern void CMach_PragmaParams(void);
extern void CMach_AdjustFuntionArgs(void); extern void CMach_AdjustFuntionArgs(/* unknown args */);
extern SInt16 CMach_GetStructAlign(TypeStruct *tstruct); extern SInt16 CMach_GetStructAlign(TypeStruct *tstruct);
extern SInt16 CMach_GetClassAlign(TypeClass *tclass); extern SInt16 CMach_GetClassAlign(TypeClass *tclass);
extern SInt16 CMach_GetTypeAlign(Type *type); extern SInt16 CMach_GetTypeAlign(Type *type);

View File

@ -30,7 +30,7 @@ extern void CObjC_ParseInterface(void);
extern void CObjC_ParseImplementation(void); extern void CObjC_ParseImplementation(void);
extern void CObjC_ParseProtocol(void); extern void CObjC_ParseProtocol(void);
extern void CObjC_ParseClassDeclaration(void); extern void CObjC_ParseClassDeclaration(void);
extern void *CObjC_ParseIdentifier(); extern void *CObjC_ParseIdentifier(/* unknown args */);
extern ENode *CObjC_MakeSendMsgExpr(ENode *objexpr, TypeClass *tclass, ObjCNamedArg *namedArgs, ENodeList *unnamedArgs, UInt8 calltype, Boolean isSuper); extern ENode *CObjC_MakeSendMsgExpr(ENode *objexpr, TypeClass *tclass, ObjCNamedArg *namedArgs, ENodeList *unnamedArgs, UInt8 calltype, Boolean isSuper);
extern ENode *CObjC_ParseMessageExpression(void); extern ENode *CObjC_ParseMessageExpression(void);
extern ENode *CObjC_ParseEncodeExpression(void); extern ENode *CObjC_ParseEncodeExpression(void);

View File

@ -3,7 +3,9 @@
#include "compiler/common.h" #include "compiler/common.h"
extern void SetupPrecompiler(void); extern char *precomp_target_str;
extern void SetupPrecompiler(Boolean isPrecompiling);
extern void CleanupPrecompiler(void); extern void CleanupPrecompiler(void);
extern void PreComp_StaticData(Object *obj, const void *data, OLinkList *links, SInt32 size); extern void PreComp_StaticData(Object *obj, const void *data, OLinkList *links, SInt32 size);
extern void PrecompilerWrite(void); extern void PrecompilerWrite(void);

Some files were not shown because too many files have changed in this diff Show More