- clean up assembly output slightly by only generating labels for the opcodes jumped to
This commit is contained in:
parent
c099b2d3c8
commit
44294a051a
3 changed files with 45 additions and 11 deletions
|
|
@ -148,13 +148,15 @@ void JitCompiler::Codegen()
|
|||
cc.comment("", 0);
|
||||
cc.comment(lineinfo.GetChars(), lineinfo.Len());
|
||||
|
||||
cc.bind(labels[i]);
|
||||
labels[i].cursor = cc.getCursor();
|
||||
ResetTemp();
|
||||
EmitOpcode();
|
||||
|
||||
pc++;
|
||||
}
|
||||
|
||||
BindLabels();
|
||||
|
||||
cc.endFunc();
|
||||
cc.finalize();
|
||||
}
|
||||
|
|
@ -173,6 +175,22 @@ void JitCompiler::EmitOpcode()
|
|||
}
|
||||
}
|
||||
|
||||
void JitCompiler::BindLabels()
|
||||
{
|
||||
asmjit::CBNode *cursor = cc.getCursor();
|
||||
unsigned int size = labels.Size();
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
{
|
||||
const OpcodeLabel &label = labels[i];
|
||||
if (label.inUse)
|
||||
{
|
||||
cc.setCursor(label.cursor);
|
||||
cc.bind(label.label);
|
||||
}
|
||||
}
|
||||
cc.setCursor(cursor);
|
||||
}
|
||||
|
||||
void JitCompiler::Setup()
|
||||
{
|
||||
using namespace asmjit;
|
||||
|
|
@ -245,10 +263,7 @@ void JitCompiler::Setup()
|
|||
regA[i] = cc.newIntPtr(regname.GetChars());
|
||||
}
|
||||
|
||||
int size = sfunc->CodeSize;
|
||||
labels.Resize(size);
|
||||
for (int i = 0; i < size; i++)
|
||||
labels[i] = cc.newLabel();
|
||||
labels.Resize(sfunc->CodeSize);
|
||||
|
||||
// VMCalls[0]++
|
||||
auto vmcallsptr = newTempIntPtr();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue