001/* 002 * This file is part of the Jikes RVM project (http://jikesrvm.org). 003 * 004 * This file is licensed to You under the Eclipse Public License (EPL); 005 * You may not use this file except in compliance with the License. You 006 * may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/eclipse-1.0.php 009 * 010 * See the COPYRIGHT.txt file distributed with this work for information 011 * regarding copyright ownership. 012 */ 013package org.jikesrvm.compilers.opt.controlflow; 014 015import org.jikesrvm.compilers.opt.ir.BasicBlock; 016import org.jikesrvm.util.BitVector; 017 018/** 019 * This structure holds dominator-related information for a basic block. 020 */ 021public class DominatorInfo { 022 /** 023 * A BitVector which represents the dominators of the basic block 024 */ 025 final BitVector dominators; 026 /** 027 * The basic block's immediate dominator. 028 */ 029 BasicBlock idom; 030 031 /** 032 * Make a structure with a given bit set holding the dominators 033 * of the basic block. 034 * 035 * @param dominators the bit set 036 */ 037 DominatorInfo(BitVector dominators) { 038 this.dominators = dominators; 039 } 040 041 /** 042 * Is the basic block represented by this structure dominated by another 043 * basic block? 044 * 045 * @param bb the basic block in question 046 * @return true or false 047 */ 048 public boolean isDominatedBy(BasicBlock bb) { 049 return dominators.get(bb.getNumber()); 050 } 051 052}