- Added fixed registers that won't be freed automatically, so that parameters

can actually be used. In the end, all temporaries should be assigned to
  unique virtual registers, and a register allocator can alias them to real
  registers, but as long as we don't do any CSE, this is good enough for now.


SVN r1920 (scripting)
This commit is contained in:
Randy Heit 2009-10-15 23:11:54 +00:00
commit c424c61ffc
4 changed files with 53 additions and 63 deletions

View file

@ -292,6 +292,10 @@ static void FinishThingdef()
tcall->Parameters[j]->Resolve(ctx);
}
VMFunctionBuilder buildit;
// Allocate registers used to pass parameters in.
// self, stateowner, state, statecalldata (all are pointers)
buildit.Registers[REGT_POINTER].Get(4);
// Emit code for action parameters.
for (j = 0; j < tcall->Parameters.Size(); ++j)
{
FxExpression *p = /*new FxParameter*/(tcall->Parameters[j]);
@ -308,6 +312,8 @@ static void FinishThingdef()
tcall->ActorInfo->Class->TypeName.GetChars(),
tcall->FirstState, tcall->NumStates);
fprintf(dump, "\n%.*s %s %.*s", MAX(3, 38 - labellen / 2), marks, label, MAX(3, 38 - labellen / 2), marks);
fprintf(dump, "\nInteger regs: %-3d Float regs: %-3d Address regs: %-3d String regs: %-3d\nStack size: %d\n",
func->NumRegD, func->NumRegF, func->NumRegA, func->NumRegS, func->MaxParam);
VMDumpConstants(dump, func);
fprintf(dump, "\nDisassembly:\n");
VMDisasm(dump, func->Code, func->NumCodeBytes / 4, func);