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.bc2ir;
014
015import org.jikesrvm.compilers.opt.ir.operand.Operand;
016
017/**
018 * ReturnAddress operand. Used to represent the address pushed on
019 * the expression stack by a JSR instruction.
020 */
021public final class ReturnAddressOperand extends Operand {
022  final int retIndex;
023
024  ReturnAddressOperand(int ri) {
025    retIndex = ri;
026  }
027
028  @Override
029  public Operand copy() {
030    return this;
031  }
032
033  @Override
034  public boolean similar(Operand op) {
035    return (op instanceof ReturnAddressOperand) && (retIndex == ((ReturnAddressOperand) op).retIndex);
036  }
037
038  @Override
039  public String toString() {
040    return "<return address " + retIndex + ">";
041  }
042}