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.classloader.TypeReference;
016
017/**
018 * This operand represents a "true" guard, e.g. non-nullness
019 * of the result of an allocation or
020 * boundcheck eliminated via analysis of the loop induction variables.
021 *
022 * @see Operand
023 */
024public final class TrueGuardOperand extends ConstantOperand {
025
026  /**
027   * @return TypeReference.VALIDATION_TYPE
028   */
029  @Override
030  public TypeReference getType() {
031    return TypeReference.VALIDATION_TYPE;
032  }
033
034  @Override
035  public Operand copy() {
036    return new TrueGuardOperand();
037  }
038
039  @Override
040  public boolean similar(Operand op) {
041    return op instanceof TrueGuardOperand;
042  }
043
044  /**
045   * Returns the string representation of this operand.
046   *
047   * @return a string representation of this operand.
048   */
049  @Override
050  public String toString() {
051    return "<TRUEGUARD>";
052  }
053}