diff graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java @ 2718:c1ce2a53d6c3

Attempt to remove dependency between backend and BlockBegin.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Thu, 19 May 2011 16:05:42 +0200
parents 4272b7af2d17
children 127db58b044e
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java	Thu May 19 14:31:03 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java	Thu May 19 16:05:42 2011 +0200
@@ -22,8 +22,13 @@
  */
 package com.sun.c1x.lir;
 
+import java.util.*;
+
 import com.oracle.max.asm.*;
 import com.sun.c1x.alloc.*;
+import com.sun.c1x.debug.*;
+import com.sun.c1x.ir.*;
+import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 
 /**
@@ -31,12 +36,12 @@
  */
 public final class LIRBlock {
 
-    public LIRBlock() {
-        loopIndex = -1;
-    }
-
     public final Label label = new Label();
     private LIRList lir;
+    private final int blockID;
+    private List<Instruction> instructions = new ArrayList<Instruction>(4);
+    private List<LIRBlock> predecessors = new ArrayList<LIRBlock>();
+    private List<LIRBlock> successors = new ArrayList<LIRBlock>();
 
     /**
      * Bit map specifying which {@linkplain OperandPool operands} are live upon entry to this block.
@@ -71,6 +76,15 @@
     private int lastLirInstructionID;
     public int blockEntryPco;
 
+    public LIRBlock(int blockID) {
+        this.blockID = blockID;
+        loopIndex = -1;
+    }
+
+    public List<Instruction> getInstructions() {
+        return instructions;
+    }
+
     public int firstLirInstructionId() {
         return firstLirInstructionID;
     }
@@ -97,4 +111,95 @@
     public void setLir(LIRList lir) {
         this.lir = lir;
     }
+
+    public void setBlockEntryPco(int codePos) {
+        this.blockEntryPco = codePos;
+    }
+
+    public void printWithoutPhis(LogStream out) {
+        out.println("LIR Block " + blockID());
+    }
+
+    public int blockID() {
+        return blockID;
+    }
+
+    public int numberOfPreds() {
+        return predecessors.size();
+    }
+
+    public int numberOfSux() {
+        return successors.size();
+    }
+
+    public boolean isPredecessor(LIRBlock block) {
+        return predecessors.contains(block);
+    }
+
+    public LIRBlock predAt(int i) {
+        return predecessors.get(i);
+    }
+
+    public LIRBlock suxAt(int i) {
+        return successors.get(i);
+    }
+
+    public List<LIRBlock> blockSuccessors() {
+        return successors;
+    }
+
+    public List<LIRBlock> blockPredecessors() {
+        return predecessors;
+    }
+
+    public int loopDepth() {
+        // TODO(tw): Set correct loop depth.
+        return 0;
+    }
+
+    public int loopIndex() {
+        // TODO(tw): Set correct loop index.
+        return -1;
+    }
+
+    public Label label() {
+        return label;
+    }
+
+    private int linearScanNumber = -1;
+    private boolean linearScanLoopEnd;
+    private boolean linearScanLoopHeader;
+    private FrameState stateBefore;
+
+    public void setLinearScanNumber(int v) {
+        linearScanNumber = v;
+    }
+
+    public int linearScanNumber() {
+        return linearScanNumber;
+    }
+
+    public void setLinearScanLoopEnd() {
+        linearScanLoopEnd = true;
+    }
+
+    public boolean isLinearScanLoopEnd() {
+        return linearScanLoopEnd;
+    }
+
+    public void setLinearScanLoopHeader() {
+        this.linearScanLoopHeader = true;
+    }
+
+    public boolean isLinearScanLoopHeader() {
+        return linearScanLoopHeader;
+    }
+
+    public void setStateBefore(FrameState stateBefore) {
+        this.stateBefore = stateBefore;
+    }
+
+    public FrameState stateBefore() {
+        return stateBefore;
+    }
 }