#include "compiler/InlineAsmRegisters.h" #include "compiler/CompilerTools.h" #ifdef __MWERKS__ #pragma options align=mac68k #endif typedef struct HashedRegister { struct HashedRegister *next; IARegister reg; } HashedRegister; #ifdef __MWERKS__ #pragma options align=reset #endif static HashedRegister *hashedregisters[64]; void InlineAsm_InitializeRegisters() { SInt32 i; for (i = 0; i < 64; i++) hashedregisters[i] = NULL; } void InlineAsm_InsertRegister(char *name, char rclass, short num, Object *object) { HashedRegister **ptr; HashedRegister *hr; ptr = hashedregisters + (CHash(name) & 63); hr = lalloc(sizeof(HashedRegister)); hr->reg.name = name; hr->reg.rclass = rclass; hr->reg.num = num; hr->reg.object = object; hr->next = *ptr; *ptr = hr; } IARegister *InlineAsm_LookupRegister(char *name) { HashedRegister *scan; IARegister *reg; for (scan = hashedregisters[CHash(name) & 63]; scan; scan = scan->next) { reg = &scan->reg; if (!strcmp(scan->reg.name, name)) return reg; } return NULL; }