* net/loveruby/cflat/sysdep/x86/CodeGenerator.java: use PeepholeOptimizer directly.
* net/loveruby/cflat/asm/PeepholeOptimizer.java -> net/loveruby/cflat/sysdep/x86
* net/loveruby/cflat/asm/AsmOptimizer.java: removed.
* net/loveruby/cflat/codegenerator/CodeGeneratorOptions.java: should not provide PeepholeOptimizer, just provide optimizationLevel.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4204 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/IRGenerator.java: generate address expression for LHS expr.
* net/loveruby/cflat/sysdep/x86/CodeGenerator.java: remove #compileLHS. Just compile LHS expr.
* net/loveruby/cflat/ir/Addr.java: is a constant address now.
* net/loveruby/cflat/ir/Var.java: is not a constant address now.
* net/loveruby/cflat/ir/Expr.java: new base method #addressNode.
* net/loveruby/cflat/ir/Mem.java: override #addressNode.
* net/loveruby/cflat/ir/Var.java: ditto.
* net/loveruby/cflat/ir/Addr.java: ditto.
* net/loveruby/cflat/ir/Expr.java: new base method #getEntityForce.
* net/loveruby/cflat/ir/Var.java: override #getEntityForce.
* net/loveruby/cflat/ir/Addr.java: ditto.
* net/loveruby/cflat/ir/Call.java: get function entity by Expr#getEntityForce.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4202 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/asm/Assembler.java -> AssemblyFile.java
* net/loveruby/cflat/utils/AsmUtils.java: split #align from AssemblyFile.
* net/loveruby/cflat/type/StructType.java: use it.
* net/loveruby/cflat/type/UnionType.java: use it.
* net/loveruby/cflat/platform: new package to extract platform dependent operations.
* net/loveruby/cflat/compiler/Compiler.java: use it.
* net/loveruby/cflat/compiler/CodeGenerator.java: use it.
* net/loveruby/cflat/compiler/Options.java: provide Platform object.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4194 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/IRGenerator.java: should not return Expr for stmt, to suppress wrong warning.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4193 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/IRGenerator.java (BinaryOpNode): evaluate RIGHT before LEFT.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4189 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/IRGenerator.java: assignBeforeStmt is useless. Use assign instead.
* net/loveruby/cflat/compiler/IRGenerator.java: should be able to create tmp in variable initializers for also function toplevel block.
* net/loveruby/cflat/compiler/IRGenerator.java: move funcall before stmt.
* net/loveruby/cflat/compiler/CodeGenerator.java: do not display "(null)" location.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4184 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/asm/Type.java: types should not know signed or not.
* net/loveruby/cflat/ir/Op.java: have signed/unsigned information.
* net/loveruby/cflat/compiler/IRGenerator.java: use new op and type.
* net/loveruby/cflat/compiler/CodeGenerator.java: ditto.
* net/loveruby/cflat/compiler/TypeChecker.java (FuncallNode): should check optional argument types.
* net/loveruby/cflat/compiler/CodeGenerator.java: now use simple mov to load values from memory (and cast it later).
* net/loveruby/cflat/type/TypeTable.java: provide stack value type.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4182 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/IRGenerator.java: isStatement() did not work correctly; e.g. return ++argc failed to return value, because ++argc was wrongly judged as statemen (is really expr).
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4181 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/LocalResolver.java: create ToplevelScope, ConstantTable here (instead of creating them in AST).
* net/loveruby/cflat/ast/AST.java: do not create ToplevelScope, ConstantTable by myself.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4175 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/Compiler.java: new method dumpExpr to dump single expression.
* net/loveruby/cflat/compiler/CompilerMode.java: add enum value DumpExpr: define new option --dump-expr.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4173 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/parser/Parser.jj: sizeof TYPE requires one more lookahead because EXPR of "sizeof EXPR" may have parentheses, too. We can distinguish type and expr by 1 look ahead, because Head of type() == head of typeref() == head of typeref_base(). typeref_base has unique terminal on head.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4172 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/ast: move Entity and its subclasses under entity/.
* net/loveruby/cflat/ast: move Scope and its subclasses under entity/.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4162 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/asm/*.java: support it.
* net/loveruby/cflat/ir/*.java: support it.
* net/loveruby/cflat/compiler/IRGenerator.java: convert ast Type -> asm Type.
* net/loveruby/cflat/compiler/CodeGenerator.java: use asm Type.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4160 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/asm/Assembler.java: add _byte(long), etc.
* net/loveruby/cflat/ir/IR.java: do not export typeTable, provide natural type instead.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4159 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/type/FunctionType.java: FunctionType#toString should separate each argument types by ",".
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4157 1b9489fe-b721-0410-924e-b54b9192deb8
net/loveruby/cflat/compiler/Simplifier.java: set aref result type.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4147 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/Simplifier.java (MemberNode): should set type.
* net/loveruby/cflat/compiler/Simplifier.java (PtrMemberNode): should set type.
* net/loveruby/cflat/compiler/Simplifier.java (Deref, Addr): should compile child expr.
* net/loveruby/cflat/ast/BinaryOpNode.java (ctor): accept type.
* net/loveruby/cflat/ast/TypeNode.java (location): do not raise exception when no typeRef exist.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4144 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/Simplifier.java: set location of AssignStmtNode.
* net/loveruby/cflat/compiler/Simplifier.java: allocate tmp variable in scope.
* net/loveruby/cflat/compiler/Simplifier.java: opAssign/inc/dec handling was completely wrong (there still be some problems yet).
* net/loveruby/cflat/compiler/CodeGenerator.java (compileLHS): implemented for IR.
* net/loveruby/cflat/compiler/CodeGenerator.java (loadVarible): implemented for IR.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4142 1b9489fe-b721-0410-924e-b54b9192deb8