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.ir.operand;
014
015import org.jikesrvm.compilers.opt.ir.BasicBlock;
016
017/**
018 * Represents a basic block (used in LABEL and BBEND instructions)
019 *
020 * @see Operand
021 */
022public final class BasicBlockOperand extends Operand {
023
024  /**
025   * The basic block
026   */
027  public BasicBlock block;
028
029  /**
030   * Construct a new basic block operand with the given block.
031   *
032   * @param b the basic block
033   */
034  public BasicBlockOperand(BasicBlock b) {
035    block = b;
036  }
037
038  @Override
039  public Operand copy() {
040    return new BasicBlockOperand(block);
041  }
042
043  @Override
044  public boolean similar(Operand op) {
045    return (op instanceof BasicBlockOperand) && (block == ((BasicBlockOperand) op).block);
046  }
047
048  @Override
049  public String toString() {
050    return block.toString();
051  }
052}