From 0f12ee78f1b0122e8c56ce2873c43162381ddc55 Mon Sep 17 00:00:00 2001 From: Minero Aoki Date: Sat, 23 May 2009 16:18:03 +0000 Subject: [PATCH] r4892@macbookpro: aamine | 2009-05-24 00:41:44 +0900 * net/loveruby/cflat/ir: rename class: BranchIf -> CJump. * net/loveruby/cflat/ir/IRVisitor.java: follow it. * net/loveruby/cflat/compiler/IRGenerator.java: ditto. * net/loveruby/cflat/sysdep/x86/CodeGenerator.java: ditto. git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4234 1b9489fe-b721-0410-924e-b54b9192deb8 --- ChangeLog | 10 ++++++++++ net/loveruby/cflat/compiler/IRGenerator.java | 18 +++++++++--------- .../cflat/ir/{BranchIf.java => CJump.java} | 5 ++--- net/loveruby/cflat/ir/IRVisitor.java | 4 ++-- .../cflat/sysdep/x86/CodeGenerator.java | 4 ++-- 5 files changed, 25 insertions(+), 16 deletions(-) rename net/loveruby/cflat/ir/{BranchIf.java => CJump.java} (84%) diff --git a/ChangeLog b/ChangeLog index 5d4783c..0bd2085 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sun May 24 00:42:28 2009 Minero Aoki + + * net/loveruby/cflat/ir: rename class: BranchIf -> CJump. + + * net/loveruby/cflat/ir/IRVisitor.java: follow it. + + * net/loveruby/cflat/compiler/IRGenerator.java: ditto. + + * net/loveruby/cflat/sysdep/x86/CodeGenerator.java: ditto. + Sun May 24 00:01:07 2009 Minero Aoki * net/loveruby/cflat/compiler/IRGenerator.java: refactoring: diff --git a/net/loveruby/cflat/compiler/IRGenerator.java b/net/loveruby/cflat/compiler/IRGenerator.java index aca3c8a..0549a20 100644 --- a/net/loveruby/cflat/compiler/IRGenerator.java +++ b/net/loveruby/cflat/compiler/IRGenerator.java @@ -166,7 +166,7 @@ class IRGenerator implements ASTVisitor { Label elseLabel = new Label(); Label endLabel = new Label(); - branch(node.location(), + cjump(node.location(), transformExpr(node.cond()), thenLabel, node.elseBody() == null ? endLabel : elseLabel); @@ -222,7 +222,7 @@ class IRGenerator implements ASTVisitor { Label endLabel = new Label(); label(begLabel); - branch(node.location(), + cjump(node.location(), transformExpr(node.cond()), bodyLabel, endLabel); label(bodyLabel); pushContinue(begLabel); @@ -248,7 +248,7 @@ class IRGenerator implements ASTVisitor { popBreak(); popContinue(); label(contLabel); - branch(node.location(), transformExpr(node.cond()), begLabel, endLabel); + cjump(node.location(), transformExpr(node.cond()), begLabel, endLabel); label(endLabel); return null; } @@ -261,7 +261,7 @@ class IRGenerator implements ASTVisitor { transformStmt(node.init()); label(begLabel); - branch(node.location(), + cjump(node.location(), transformExpr(node.cond()), bodyLabel, endLabel); label(bodyLabel); pushContinue(contLabel); @@ -321,8 +321,8 @@ class IRGenerator implements ASTVisitor { return null; } - private void branch(Location loc, Expr cond, Label thenLabel, Label elseLabel) { - stmts.add(new BranchIf(loc, cond, thenLabel, elseLabel)); + private void cjump(Location loc, Expr cond, Label thenLabel, Label elseLabel) { + stmts.add(new CJump(loc, cond, thenLabel, elseLabel)); } private void assign(Location loc, Expr lhs, Expr rhs) { @@ -399,7 +399,7 @@ class IRGenerator implements ASTVisitor { DefinedVariable var = tmpVar(node.type()); Expr cond = transformExpr(node.cond()); - branch(node.location(), cond, thenLabel, elseLabel); + cjump(node.location(), cond, thenLabel, elseLabel); label(thenLabel); assign(node.thenExpr().location(), ref(var), transformExpr(node.thenExpr())); @@ -419,7 +419,7 @@ class IRGenerator implements ASTVisitor { assign(node.left().location(), ref(var), transformExpr(node.left())); - branch(node.location(), ref(var), rightLabel, endLabel); + cjump(node.location(), ref(var), rightLabel, endLabel); label(rightLabel); assign(node.right().location(), ref(var), transformExpr(node.right())); @@ -434,7 +434,7 @@ class IRGenerator implements ASTVisitor { assign(node.left().location(), ref(var), transformExpr(node.left())); - branch(node.location(), ref(var), endLabel, rightLabel); + cjump(node.location(), ref(var), endLabel, rightLabel); label(rightLabel); assign(node.right().location(), ref(var), transformExpr(node.right())); diff --git a/net/loveruby/cflat/ir/BranchIf.java b/net/loveruby/cflat/ir/CJump.java similarity index 84% rename from net/loveruby/cflat/ir/BranchIf.java rename to net/loveruby/cflat/ir/CJump.java index 63c1564..6e3075b 100644 --- a/net/loveruby/cflat/ir/BranchIf.java +++ b/net/loveruby/cflat/ir/CJump.java @@ -2,13 +2,12 @@ package net.loveruby.cflat.ir; import net.loveruby.cflat.ast.Location; import net.loveruby.cflat.asm.Label; -public class BranchIf extends Stmt { +public class CJump extends Stmt { protected Expr cond; protected Label thenLabel; protected Label elseLabel; - public BranchIf(Location loc, Expr cond, - Label thenLabel, Label elseLabel) { + public CJump(Location loc, Expr cond, Label thenLabel, Label elseLabel) { super(loc); this.cond = cond; this.thenLabel = thenLabel; diff --git a/net/loveruby/cflat/ir/IRVisitor.java b/net/loveruby/cflat/ir/IRVisitor.java index b59a6f6..954a7c6 100644 --- a/net/loveruby/cflat/ir/IRVisitor.java +++ b/net/loveruby/cflat/ir/IRVisitor.java @@ -3,10 +3,10 @@ package net.loveruby.cflat.ir; public interface IRVisitor { public S visit(ExprStmt s); public S visit(Assign s); - public S visit(BranchIf s); + public S visit(CJump s); + public S visit(Jump s); public S visit(Switch s); public S visit(LabelStmt s); - public S visit(Jump s); public S visit(Return s); public E visit(Uni s); diff --git a/net/loveruby/cflat/sysdep/x86/CodeGenerator.java b/net/loveruby/cflat/sysdep/x86/CodeGenerator.java index 980da8c..fb2ec56 100644 --- a/net/loveruby/cflat/sysdep/x86/CodeGenerator.java +++ b/net/loveruby/cflat/sysdep/x86/CodeGenerator.java @@ -697,8 +697,8 @@ public class CodeGenerator } // #@@} - // #@@range/compile_BranchIf{ - public Void visit(BranchIf node) { + // #@@range/compile_CJump{ + public Void visit(CJump node) { compile(node.cond()); testCond(node.cond().type(), ax()); as.jnz(node.thenLabel());