mirror of https://github.com/aamine/cbc
preproc tags added
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4282 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
parent
7c9845ecaa
commit
6ba72a960e
|
|
@ -269,7 +269,7 @@ public class AssemblyFile implements net.loveruby.cflat.sysdep.AssemblyFile {
|
||||||
}
|
}
|
||||||
// #@@}
|
// #@@}
|
||||||
|
|
||||||
// #@@range/rewindVirtualStack{
|
// #@@range/rewind{
|
||||||
void rewind(long len) {
|
void rewind(long len) {
|
||||||
offset -= len;
|
offset -= len;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -367,13 +367,17 @@ public class CodeGenerator implements net.loveruby.cflat.sysdep.CodeGenerator,
|
||||||
static final private long STACK_WORD_SIZE = 4;
|
static final private long STACK_WORD_SIZE = 4;
|
||||||
// #@@}
|
// #@@}
|
||||||
|
|
||||||
|
// #@@range/alignStack{
|
||||||
private long alignStack(long size) {
|
private long alignStack(long size) {
|
||||||
return AsmUtils.align(size, STACK_WORD_SIZE);
|
return AsmUtils.align(size, STACK_WORD_SIZE);
|
||||||
}
|
}
|
||||||
|
// #@@}
|
||||||
|
|
||||||
|
// #@@range/stackSizeFromWordNum{
|
||||||
private long stackSizeFromWordNum(long numWords) {
|
private long stackSizeFromWordNum(long numWords) {
|
||||||
return numWords * STACK_WORD_SIZE;
|
return numWords * STACK_WORD_SIZE;
|
||||||
}
|
}
|
||||||
|
// #@@}
|
||||||
|
|
||||||
/** Compiles a function. */
|
/** Compiles a function. */
|
||||||
// #@@range/compileFunction{
|
// #@@range/compileFunction{
|
||||||
|
|
@ -405,20 +409,26 @@ public class CodeGenerator implements net.loveruby.cflat.sysdep.CodeGenerator,
|
||||||
// #@@range/compileFunctionBody{
|
// #@@range/compileFunctionBody{
|
||||||
private void compileFunctionBody(AssemblyFile file, DefinedFunction func) {
|
private void compileFunctionBody(AssemblyFile file, DefinedFunction func) {
|
||||||
StackFrameInfo frame = new StackFrameInfo();
|
StackFrameInfo frame = new StackFrameInfo();
|
||||||
|
// #@@range/cfb_locate{
|
||||||
locateParameters(func.parameters());
|
locateParameters(func.parameters());
|
||||||
frame.lvarSize = locateLocalVariables(func.lvarScope());
|
frame.lvarSize = locateLocalVariables(func.lvarScope());
|
||||||
|
// #@@}
|
||||||
|
|
||||||
|
// #@@range/cfb_offset{
|
||||||
AssemblyFile body = optimize(compileStmts(func));
|
AssemblyFile body = optimize(compileStmts(func));
|
||||||
frame.saveRegs = usedCalleeSavedRegisters(body);
|
frame.saveRegs = usedCalleeSavedRegisters(body);
|
||||||
frame.tempSize = body.virtualStack.maxSize();
|
frame.tempSize = body.virtualStack.maxSize();
|
||||||
|
|
||||||
fixLocalVariableOffsets(func.lvarScope(), frame.lvarOffset());
|
fixLocalVariableOffsets(func.lvarScope(), frame.lvarOffset());
|
||||||
fixTempVariableOffsets(body, frame.tempOffset());
|
fixTempVariableOffsets(body, frame.tempOffset());
|
||||||
|
// #@@}
|
||||||
|
|
||||||
if (options.isVerboseAsm()) {
|
if (options.isVerboseAsm()) {
|
||||||
printStackFrameLayout(file, frame, func.localVariables());
|
printStackFrameLayout(file, frame, func.localVariables());
|
||||||
}
|
}
|
||||||
|
// #@@range/cfb_gen{
|
||||||
generateFunctionBody(file, body, frame);
|
generateFunctionBody(file, body, frame);
|
||||||
|
// #@@}
|
||||||
}
|
}
|
||||||
// #@@}
|
// #@@}
|
||||||
|
|
||||||
|
|
@ -591,9 +601,11 @@ public class CodeGenerator implements net.loveruby.cflat.sysdep.CodeGenerator,
|
||||||
}
|
}
|
||||||
// #@@}
|
// #@@}
|
||||||
|
|
||||||
|
// #@@range/relocatableMem{
|
||||||
private IndirectMemoryReference relocatableMem(long offset, Register base) {
|
private IndirectMemoryReference relocatableMem(long offset, Register base) {
|
||||||
return IndirectMemoryReference.relocatable(offset, base);
|
return IndirectMemoryReference.relocatable(offset, base);
|
||||||
}
|
}
|
||||||
|
// #@@}
|
||||||
|
|
||||||
// #@@range/fixLocalVariableOffsets{
|
// #@@range/fixLocalVariableOffsets{
|
||||||
private void fixLocalVariableOffsets(LocalScope scope, long len) {
|
private void fixLocalVariableOffsets(LocalScope scope, long len) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue