mirror of https://github.com/aamine/cbc
r4998@macbookpro: aamine | 2009-05-31 22:33:21 +0900
* net/loveruby/cflat/sysdep/x86/CodeGenerator.java: refactoring: rename method. * net/loveruby/cflat/sysdep/x86/CodeGenerator.java (Int): simplify code. git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4270 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
parent
3b566ad27c
commit
694aa209f3
|
@ -1,3 +1,11 @@
|
||||||
|
Sun May 31 22:32:29 2009 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
|
* net/loveruby/cflat/sysdep/x86/CodeGenerator.java: refactoring:
|
||||||
|
rename method.
|
||||||
|
|
||||||
|
* net/loveruby/cflat/sysdep/x86/CodeGenerator.java (Int): simplify
|
||||||
|
code.
|
||||||
|
|
||||||
Wed May 27 01:59:03 2009 Minero Aoki <aamine@loveruby.net>
|
Wed May 27 01:59:03 2009 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
* net/loveruby/cflat/sysdep/x86/AssemblyFile.java: remove unused
|
* net/loveruby/cflat/sysdep/x86/AssemblyFile.java: remove unused
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class CodeGenerator
|
||||||
private void locateSymbols(IR ir) {
|
private void locateSymbols(IR ir) {
|
||||||
SymbolTable constSymbols = new SymbolTable(CONST_SYMBOL_BASE);
|
SymbolTable constSymbols = new SymbolTable(CONST_SYMBOL_BASE);
|
||||||
for (ConstantEntry ent : ir.constantTable().entries()) {
|
for (ConstantEntry ent : ir.constantTable().entries()) {
|
||||||
locateConstant(ent, constSymbols);
|
locateStringLiteral(ent, constSymbols);
|
||||||
}
|
}
|
||||||
for (Variable var : ir.allGlobalVariables()) {
|
for (Variable var : ir.allGlobalVariables()) {
|
||||||
locateGlobalVariable(var);
|
locateGlobalVariable(var);
|
||||||
|
@ -57,8 +57,8 @@ public class CodeGenerator
|
||||||
}
|
}
|
||||||
// #@@}
|
// #@@}
|
||||||
|
|
||||||
// #@@range/locateConstant{
|
// #@@range/locateStringLiteral{
|
||||||
private void locateConstant(ConstantEntry ent, SymbolTable syms) {
|
private void locateStringLiteral(ConstantEntry ent, SymbolTable syms) {
|
||||||
ent.setSymbol(syms.newSymbol());
|
ent.setSymbol(syms.newSymbol());
|
||||||
if (options.isPositionIndependent()) {
|
if (options.isPositionIndependent()) {
|
||||||
Symbol offset = localGOTSymbol(ent.symbol());
|
Symbol offset = localGOTSymbol(ent.symbol());
|
||||||
|
@ -153,7 +153,7 @@ public class CodeGenerator
|
||||||
if (!gvars.isEmpty()) {
|
if (!gvars.isEmpty()) {
|
||||||
file._data();
|
file._data();
|
||||||
for (DefinedVariable gvar : gvars) {
|
for (DefinedVariable gvar : gvars) {
|
||||||
dataEntry(file, gvar);
|
compileGlobalVariable(file, gvar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ir.constantTable().isEmpty()) {
|
if (!ir.constantTable().isEmpty()) {
|
||||||
|
@ -191,8 +191,9 @@ public class CodeGenerator
|
||||||
// #@@}
|
// #@@}
|
||||||
|
|
||||||
/** Generates initialized entries */
|
/** Generates initialized entries */
|
||||||
// #@@range/dataEntry{
|
// #@@range/compileGlobalVariable{
|
||||||
private void dataEntry(AssemblyFile file, DefinedVariable ent) {
|
private void compileGlobalVariable(
|
||||||
|
AssemblyFile file, DefinedVariable ent) {
|
||||||
Symbol sym = globalSymbol(ent.symbolString());
|
Symbol sym = globalSymbol(ent.symbolString());
|
||||||
if (!ent.isPrivate()) {
|
if (!ent.isPrivate()) {
|
||||||
file._globl(sym);
|
file._globl(sym);
|
||||||
|
@ -919,7 +920,7 @@ public class CodeGenerator
|
||||||
|
|
||||||
// #@@range/Int{
|
// #@@range/Int{
|
||||||
public Void visit(Int node) {
|
public Void visit(Int node) {
|
||||||
loadConstant(node, ax());
|
as.mov(imm(node.value()), ax());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// #@@}
|
// #@@}
|
||||||
|
|
Loading…
Reference in New Issue