Minero Aoki
97fbe0672c
* net/loveruby/cflat/ast/IR.java: new class to represents IR.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4141 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-19 15:39:18 +00:00
Minero Aoki
ecdfcff254
* new class Simplifier (it is really a IR generator). Passes compilation, but not tested.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4140 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-19 14:52:48 +00:00
Minero Aoki
1e80fec3ab
* refactoring: rename class: compiler/Simplifier.java -> IRGenerator.java.
...
* compiler/Compiler.java: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4139 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-19 05:57:41 +00:00
Minero Aoki
ae4073e7c3
revert r4136 (no IR)
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4138 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-19 05:50:16 +00:00
Minero Aoki
444c8e1bd9
* net/loveruby/cflat/compiler/IRGenerator.java: generates IR (intermediate representation) tree (work is still incomplete but commit for logging).
...
* net/loveruby/cflat/ir: new package to hold IR tree nodes.
* net/loveruby/cflat/ir/IRTree.java: new class.
* net/loveruby/cflat/ir/Stmt.java: new class.
* net/loveruby/cflat/ir/StmtKind.java: new enum.
* net/loveruby/cflat/ir/Expr.java: new class.
* net/loveruby/cflat/ir/ExprKind.java: new enum.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4136 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-12 16:53:28 +00:00
Minero Aoki
5a287a7b48
* net/loveruby/cflat/compiler/TypeChecker.java: split IRGenerator.
...
* net/loveruby/cflat/compiler/IRGenerator.java: new class.
* net/loveruby/cflat/compiler/Compiler.java: call IRGenerator.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4135 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-12 08:49:23 +00:00
Minero Aoki
8d208c36cc
* net/loveruby/cflat/compiler/TypeChecker.java: simplify BinaryOp checking, utilizing destructive methods.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4134 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-12 07:48:17 +00:00
Minero Aoki
f69902e1d7
* net/loveruby/cflat/compiler/Visitor.java: make destructive again.
...
* net/loveruby/cflat/compiler/TypeResolver.java: ditto.
* net/loveruby/cflat/compiler/TypeChecker.java: ditto.
* net/loveruby/cflat/compiler/LocalResolver.java: ditto.
* net/loveruby/cflat/compiler/CodeGenerator.java: ditto.
* net/loveruby/cflat/compiler/DereferenceChecker.java: ditto.
* net/loveruby/cflat/compiler/JumpResolver.java: ditto.
* net/loveruby/cflat/ast/AbstractAssignNode.java: ditto.
* net/loveruby/cflat/ast/CondExprNode.java: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4133 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-12 07:37:18 +00:00
Minero Aoki
d514300aef
* net/loveruby/cflat/compiler/Visitor.java: make all return types generic.
...
* net/loveruby/cflat/compiler/TypeChecker.java: ditto.
* net/loveruby/cflat/ast/*.java: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4132 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-12 06:31:12 +00:00
Minero Aoki
33dcef983b
* net/loveruby/cflat/compiler/Compiler.java: call JumpResolver at last.
...
* net/loveruby/cflat/compiler/TypeChecker.java: TypeChecker has required ReturnNode.function, provide "current function" by myself.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4131 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-05 22:04:35 +00:00
Minero Aoki
043859df0b
* net/loveruby/cflat/ast/ASTVisitor.java: #visit returns a node which has same type with the argument, to allow non-destructive AST rewriting.
...
* net/loveruby/cflat/ast/*Node.java (#accept): ditto.
* net/loveruby/cflat/compiler/Visitor.java: ditto.
* net/loveruby/cflat/compiler/*.java: ditto.
* net/loveruby/cflat/compiler/TypeChecker.java: make non-destructive.
* net/loveruby/cflat/parser/Parser.jj: use StmtNode/ExprNode instead of Node.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4130 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-04 14:47:11 +00:00
Minero Aoki
b09c3f044f
* lib/sizeof_jmpbuf.c: new analysis program.
...
* lib/Makefile: add a rule to build sizeof_jmpbuf.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4115 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-23 18:43:17 +00:00
Minero Aoki
4cb2818d45
* import/setjmp.hb: new file to support setjmp.
...
* test: test setjmp.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4113 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-23 17:54:11 +00:00
Minero Aoki
f6a1df9142
* introduce virtual stack again, for only local variables and tmp variables. Function arguments use true push & pop.
...
* --verbose-asm prints stack frame layout in detail.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4110 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-14 15:05:20 +00:00
Minero Aoki
73ecd8d50b
* test: test alloca more.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4108 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-14 12:04:58 +00:00
Minero Aoki
e0105bda01
* net/loveruby/cflat/compiler/CodeGenerator.java (compileFunctionBody): remove bp from saveRegs first.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4107 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-14 11:43:51 +00:00
Minero Aoki
76fd64dc52
* lib/alloca.s: alloca() implemeted.
...
* lib/Makefile: build it.
* import/alloca.hb: declare alloca.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4103 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-07 15:55:40 +00:00
Minero Aoki
b598628af9
* net: revert r4100; implementing alloca() is too difficult for current architecture.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4102 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-07 14:26:56 +00:00
Minero Aoki
37476f6839
* lib/libcbc.cb -> lib/stdarg.cb
...
* lib/Makefile: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4101 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-07 14:25:31 +00:00
Minero Aoki
e64c1373c0
* net/loveruby/cflat/compiler/CodeGenerator.java: manage stack offset by generator, instead of using machine push/pop.
...
* net/loveruby/cflat/asm/Assembler.java: new method relocatableMov.
* net/loveruby/cflat/asm/Assembly.java: allow fixing indirect memory access offset.
* net/loveruby/cflat/asm/Instruction.java: ditto.
* net/loveruby/cflat/asm/AsmOperand.java: ditto.
* net/loveruby/cflat/asm/IndirectMemoryReference.java: ditto.
* net/loveruby/cflat/asm/IntegerLiteral.java: ditto.
* net/loveruby/cflat/asm/Literal.java: ditto.
* net/loveruby/cflat/asm/BaseSymbol.java: ditto.
* net/loveruby/cflat/asm/SuffixedSymbol.java: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4100 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-07 13:27:54 +00:00
Minero Aoki
278c5bea47
* net/loveruby/cflat/compiler/LocalReferenceResolver.java -> LocalResolver.java
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4099 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-07 08:13:47 +00:00
Minero Aoki
545515b5e0
* net/loveruby/cflat/ast/ToplevelScope.java: use SemanticException instead of SemanticError for duplicated declarations/definitions.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4098 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-07 08:09:20 +00:00
Minero Aoki
1524d3d719
* test: test declaration override.
...
* test/run.sh: new option --help.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4096 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-07 07:56:00 +00:00
Minero Aoki
96fb88ec26
* net/loveruby/cflat/compiler/CodeGenerator.java: refactoring: reduce lvar.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4091 1b9489fe-b721-0410-924e-b54b9192deb8
2008-11-24 09:49:31 +00:00
Minero Aoki
234bd96642
* net/loveruby/cflat/compiler/TypeResolver.java: an array on the parameter list is a pointer really.
...
* net/loveruby/cflat/compiler/TypeChecker.java: an array for stmt value *is* valid because it is a pointer really.
* net/loveruby/cflat/compiler/CodeGenerator.java: st.x while st.x is an array should make a pointer.
* net/loveruby/cflat/type/Type.java: remove #isPointerAlike, there is only a Pointer and an Array already.
* net/loveruby/cflat/type/ArrayType.java: ditto.
* net/loveruby/cflat/type/PointerType.java: ditto.
* net/loveruby/cflat/type/UserType.java: ditto.
* net/loveruby/cflat/ast/ArefNode.java: ditto.
* net/loveruby/cflat/ast/Variable.java: ditto.
* net/loveruby/cflat/ast/ExprNode.java: ditto.
* test: check st.x[1] access.
* test: check pst->x[1] access.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4089 1b9489fe-b721-0410-924e-b54b9192deb8
2008-11-16 14:57:11 +00:00
Minero Aoki
1f47ab6771
* net/loveruby/cflat/compiler/TypeResolver.java: "f = puts" implies "f = &puts", adjust type for such expressions.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4088 1b9489fe-b721-0410-924e-b54b9192deb8
2008-11-16 13:29:35 +00:00
Minero Aoki
3bf172e272
* net/loveruby/cflat/compiler/Compiler.java: make compiler mode enum.
...
* net/loveruby/cflat/compiler/Options.java: ditto.
* net/loveruby/cflat/compiler/SourceFile.java: ditto.
* net/loveruby/cflat/compiler/CompilerMode.java: new enum.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4086 1b9489fe-b721-0410-924e-b54b9192deb8
2008-11-16 12:28:02 +00:00
Minero Aoki
83dcd37243
* net/loveruby/cflat/compiler/DereferenceChecker.java: We do not need to check an OpAssignNode as operator, because this class only check references.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4085 1b9489fe-b721-0410-924e-b54b9192deb8
2008-11-16 11:20:19 +00:00
Minero Aoki
89c7decdad
* net/loveruby/cflat/compiler/CodeGenerator.java (compileAST): should not generate .data section when no global variable is defined.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4083 1b9489fe-b721-0410-924e-b54b9192deb8
2008-11-16 11:11:01 +00:00
Minero Aoki
aa030b42b7
* net/loveruby/cflat/compiler/CodeGenerator.java: should access file-local gvar directly (with @GOTOFF) in PIE.
...
* net/loveruby/cflat/ast/Entity.java: all entities should have memref or address.
* net/loveruby/cflat/ast/Variable.java: ditto.
* net/loveruby/cflat/ast/DefinedVariable.java: ditto.
* net/loveruby/cflat/ast/UndefinedVariable.java: ditto.
* net/loveruby/cflat/ast/Function.java: ditto.
* net/loveruby/cflat/ast/DefinedFunction.java: ditto.
* import/stdlib.hb: add new declarations.
* import/unistd.hb: add new declarations.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4082 1b9489fe-b721-0410-924e-b54b9192deb8
2008-11-16 11:01:10 +00:00
Minero Aoki
6b24625a87
* net/loveruby/cflat/compiler/Options.java: new option --readonly-plt.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4076 1b9489fe-b721-0410-924e-b54b9192deb8
2008-11-02 09:27:05 +00:00
Minero Aoki
2d0babf4c4
* bin/cbc: resolve symbolic link to command file.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4074 1b9489fe-b721-0410-924e-b54b9192deb8
2008-10-25 22:04:56 +00:00
Minero Aoki
dd5d3dd4f0
* name code symbols lazily.
...
* separate Label and Symbol.
* net/loveruby/cflat/compiler/CodeGenerator.java: use Symbol instead of Label for entity symbol.
* net/loveruby/cflat/asm/Symbol.java: new interface.
* net/loveruby/cflat/asm/BaseSymbol.java: new class.
* net/loveruby/cflat/asm/NamedSymbol.java: new class.
* net/loveruby/cflat/asm/SuffixedSymbol.java: new class.
* net/loveruby/cflat/asm/UnnamedSymbol.java: new class.
* net/loveruby/cflat/asm/SymbolTable.java: new class.
* net/loveruby/cflat/asm/*.java: Label -> Symbol.
* net/loveruby/cflat/asm/LabelRef.java: removed.
* net/loveruby/cflat/ast/*.java: Label -> Symbol.
* net/loveruby/cflat/parser/Parser.jj: does not pass a LabelPool anymore.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4072 1b9489fe-b721-0410-924e-b54b9192deb8
2008-10-24 18:40:21 +00:00
Minero Aoki
11e6f1ab64
* net/loveruby/cflat/ast/*.java: minimize references to asm/*.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4071 1b9489fe-b721-0410-924e-b54b9192deb8
2008-10-24 14:03:31 +00:00
Minero Aoki
cd37fb1f02
* convert all source codes to Java 5 using generics and foreach stmt.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4067 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-28 18:46:56 +00:00
Minero Aoki
9003c4fd72
* net/loveruby/cflat/compiler/Options.java (getOutputFileName): should use outputFileName always when linking, output file of linking is always 1 file.
...
* net/loveruby/cflat/compiler/Options.java: fixes compile error: new method #isGeneratingPIE.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4066 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 22:19:48 +00:00
Minero Aoki
1d35dd1665
* net/loveruby/cflat/compiler/Compiler.java: implement -shared.
...
* net/loveruby/cflat/compiler/Options.java: new option -shared.
* net/loveruby/cflat/compiler/CodeGeneratorOptions.java: ditto.
* net/loveruby/cflat/compiler/SourceFile.java: new method #linkedFileName.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4065 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 22:07:04 +00:00
Minero Aoki
69862827dc
* implement PIC generation.
...
* lib/Makefile: should generate PIC for libcbc.o.
* net/loveruby/cflat/compiler/Compiler.java: pass CodeGeneratorOptions to CodeGenerator.
* net/loveruby/cflat/compiler/Options.java: new options -fpic, -fPIC.
* net/loveruby/cflat/compiler/CodeGenerator.java: use position independent address for global variables, common symbols, defined/undefined functions and string constants.
* net/loveruby/cflat/compiler/CodeGeneratorOptions.java: new class.
* net/loveruby/cflat/asm/ELFConstants.java: new interface to define ELF-related constants.
* net/loveruby/cflat/asm/Assembler.java: new method #hidden.
* net/loveruby/cflat/asm/Assembler.java: new overload #section(s,s,s,s,s).
* net/loveruby/cflat/asm/IndirectMemoryReference.java: offset may not long, but Literal.
* net/loveruby/cflat/asm/Literal.java: new method #isZero.
* net/loveruby/cflat/asm/IntegerLiteral.java: ditto.
* net/loveruby/cflat/asm/LabelRef.java: ditto.
* net/loveruby/cflat/ast/ExprNode.java: new method #shouldEvaluatedToAddres.
* net/loveruby/cflat/ast/VariableNode.java: override it.
* net/loveruby/cflat/ast/CastNode.java: override it.
* net/loveruby/cflat/ast/Entity.java: new method #cannotLoad, to implement #shouldEvaluatedToAddress.
* net/loveruby/cflat/ast/Variable.java: override it.
* net/loveruby/cflat/ast/Function.java: override it.
* net/loveruby/cflat/ast/ExprNode.java: rename method: #AsmLiteral -> #AsmValue because it now returns ImmediateValue instead of Literal.
* net/loveruby/cflat/ast/CastNode.java: override it.
* net/loveruby/cflat/ast/LiteralNode.java: rename method also.
* net/loveruby/cflat/ast/IntegerLiteralNode.java: ditto.
* net/loveruby/cflat/ast/StringLiteralNode.java: ditto.
* net/loveruby/cflat/ast/Variable.java: holds memref and address here, not in subclasses.
* net/loveruby/cflat/ast/DefinedVariable.java: ditto.
* net/loveruby/cflat/ast/UndefinedVariable.java: ditto.
* net/loveruby/cflat/ast/LiteralNode.java: new method #memref.
* net/loveruby/cflat/ast/IntegerLiteralNode.java: implement it.
* net/loveruby/cflat/ast/StringLiteralNode.java: implement it.
* net/loveruby/cflat/ast/ConstantEntry.java: holds memref and address.
* net/loveruby/cflat/ast/AST.java: new method #allFunctions, to access undefined functions from code generator.
* net/loveruby/cflat/ast/ToplevelScope.java: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4057 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 20:07:49 +00:00
Minero Aoki
f94faf7fde
* net/loveruby/cflat/compiler/CodeGenerator.java: remove unused labels.
...
* net/loveruby/cflat/asm/AsmStatistics.java: collect label usage.
* net/loveruby/cflat/asm/DirectMemoryReference.java: support collectStatistics.
* net/loveruby/cflat/asm/Literal.java: ditto.
* net/loveruby/cflat/asm/LabelRef.java: ditto.
* net/loveruby/cflat/asm/IntegerLiteral.java: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4054 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-23 16:10:42 +00:00
Minero Aoki
df96fa80c7
* net/loveruby/cflat/asm/PeepholeOptimizer.java: unify insn optimization and jump elimination.
...
* net/loveruby/cflat/utils/ClonableIterator.java -> Cursor.java
* net/loveruby/cflat/compiler/Options.java: use default optimization rule set for -O.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4052 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-23 15:48:39 +00:00
Minero Aoki
637fce5053
* net/loveruby/cflat/compiler/CodeGenerator.java: apply jump elimination.
...
* net/loveruby/cflat/asm/PeepholeOptimizer.java: new optimization method: jump elimination.
* net/loveruby/cflat/asm/Assembler.java: refactoring: #string -> #toSource.
* net/loveruby/cflat/asm/Assembler.java: refactoring: list -> assemblies.
* net/loveruby/cflat/asm/Assembly.java: new method #isDirective and #isComment.
* net/loveruby/cflat/asm/Directive.java: implement it.
* net/loveruby/cflat/asm/AsmComment.java: implement it.
* net/loveruby/cflat/asm/Label.java: implement it.
* net/loveruby/cflat/asm/Label.java: new method #equals, #hashCode.
* net/loveruby/cflat/asm/Instruction.java: add jump related methods to analyze jump instruction.
* net/loveruby/cflat/asm/LabelRef.java: new method #label to allow extracting a Label.
* net/loveruby/cflat/asm/Register.java: new method #equals, #hashCode.
* net/loveruby/cflat/asm/AsmStatistics.java: use Object for map keys.
* net/loveruby/cflat/asm/AsmStatistics.java: new method #doesRegisterUsed.
* net/loveruby/cflat/utils/ClonableIterator.java: new utility.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4050 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-23 13:50:54 +00:00
Minero Aoki
9fcae829f5
* lib/Makefile: parameterize.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4047 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-23 13:45:03 +00:00
Minero Aoki
6a847efed7
* unit: new unit test suite.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4045 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-23 11:42:44 +00:00
Minero Aoki
6164216de3
* test/div.cb: test %esi usage.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4044 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-21 16:45:52 +00:00
Minero Aoki
8f3e39031a
* net/loveruby/cflat/ast/Function.java: refactoring: new method #label.
...
* net/loveruby/cflat/compiler/CodeGenerator.java (prologue): omit loop when no-verboseAsm.
* test: check "puts = NULL" and "stdin = NULL" are compilable (of course "puts = NULL" causes segv).
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4043 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-21 09:14:34 +00:00
Minero Aoki
81bbba45af
* net/loveruby/cflat/compiler/CodeGenerator.java: lhs.memref may be null when lhs is extern variable.
...
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4042 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-21 08:22:48 +00:00
Minero Aoki
556d917fff
* net/loveruby/cflat/compiler/CodeGenerator.java: optimize constant load.
...
* net/loveruby/cflat/asm/ImmediateValue.java: accept any Literal.
* net/loveruby/cflat/ast/LiteralNode.java: new method #asmLiteral.
* net/loveruby/cflat/ast/CastNode.java: is not constant when cast is effective.
* net/loveruby/cflat/compiler/Compiler.java: new option --verbose-asm.
* net/loveruby/cflat/compiler/Options.java: ditto.
* net/loveruby/cflat/compiler/CodeGenerator.java: ditto.
* net/loveruby/cflat/asm/Assembler.java: new method #indentComment, #unindentComment.
* net/loveruby/cflat/asm/AsmComment.java: indent comments.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4041 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-20 20:43:34 +00:00
Minero Aoki
1668b72403
* net/loveruby/cflat/compiler/CodeGenerator.java: fix local variables offset after compiling function body, to allow saving really-used callee-saved registers only.
...
* net/loveruby/cflat/asm/IndirectMemoryReference.java: allow fixing offset out of consructor.
* net/loveruby/cflat/asm/AsmStatistics.java: new class.
* net/loveruby/cflat/asm/Assembly.java: support #collectStatistics.
* net/loveruby/cflat/asm/Instruction.java: ditto.
* net/loveruby/cflat/asm/AsmOperand.java: ditto.
* net/loveruby/cflat/asm/Register.java: ditto.
* net/loveruby/cflat/asm/AbsoluteAddress.java: ditto.
* net/loveruby/cflat/asm/DirectMemoryReference.java: ditto.
* net/loveruby/cflat/asm/ImmediateValue.java: ditto.
* net/loveruby/cflat/ast/Scope.java: refactoring: rename method: #allChildren -> #allScopes.
* net/loveruby/cflat/ast/Scope.java (allScopes): should include receiver scope itself.
* net/loveruby/cflat/ast/LocalScope.java (allVariables): did not wrongly included current scope's variables.
* net/loveruby/cflat/ast/LocalScope.java: refactoring: rename method: allVariables -> allLocalVariables.
* net/loveruby/cflat/ast/DefinedFunction.java: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4040 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-20 18:04:20 +00:00
Minero Aoki
076d0dea13
* net/loveruby/cflat/compiler/Options.java: new option -O0, -O, -O1, -O2, -Os.
...
* net/loveruby/cflat/asm/AsmOptimizer.java: new interface to switch optimizer dynamicly.
* net/loveruby/cflat/compiler/PeepholeOptimizer.java -> asm/PeepholeOptimizer.java
* net/loveruby/cflat/compiler/CodeGenerator.java: parameterize AsmOptimizer.
* net/loveruby/cflat/ast/AST.java: holds a typeTable.
* net/loveruby/cflat/compiler/Compiler.java: follow AST change.
* net/loveruby/cflat/compiler/TypeResolver.java: ditto.
* net/loveruby/cflat/compiler/TypeChecker.java: ditto.
* net/loveruby/cflat/compiler/LocalReferenceResolver.java: ditto.
* net/loveruby/cflat/compiler/DereferenceChecker.java: ditto.
* net/loveruby/cflat/compiler/JumpResolver.java: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4039 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-20 15:13:09 +00:00
Minero Aoki
c3bf6f1344
* net/loveruby/cflat/compiler/CodeGenerator.java: apply peep-hole optimization.
...
* net/loveruby/cflat/compiler/PeepholeOptimizer.java: new class.
* net/loveruby/cflat/asm/Assembler.java: export list (List<Assembly>).
* net/loveruby/cflat/asm/Instruction.java: new method #build to build an Instruction from the instruction object.
* net/loveruby/cflat/asm/OperandPattern.java: new interface.
* net/loveruby/cflat/asm/AsmOperand.java: impelements OperandPattern.
* net/loveruby/cflat/asm/Register.java: implements #isRegister.
* net/loveruby/cflat/asm/ImmediateValue.java: implement #equals to allow matching immediate integer value.
* net/loveruby/cflat/asm/IntegerLiteral.java: implement #equals.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4038 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-20 13:53:34 +00:00