All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opalj.br.instructions.LabeledSimpleConditionalBranchInstruction.scala Maven / Gradle / Ivy

The newest version!
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj
package br
package instructions

/**
 * An conditional branch instruction where the jump target is identified using a `Symbol`.
 *
 * @author Malte Limmeroth
 * @author Michael Eichberg
 */
trait LabeledSimpleConditionalBranchInstruction
    extends LabeledInstruction
    with SimpleConditionalBranchInstructionLike {

    final def branchTargets: Iterator[InstructionLabel] =
        Iterator(branchTarget)

    def branchTarget: InstructionLabel

    /**
     * @inheritdoc
     *
     * @return A `SimpleConditionalBranchInstruction`.
     */
    @throws[BranchoffsetOutOfBoundsException]("if the branchoffset is invalid")
    override def resolveJumpTargets(
        pc:  PC,
        pcs: Map[InstructionLabel, PC]
    ): SimpleConditionalBranchInstruction[_]

    override def toString(currentPC: Int): String = {
        s"${getClass.getSimpleName}(true=$branchTarget, false=↓)"
    }

    /**
     * Returns the negated if instruction. That is, an if_<cond> instruction is translated to
     * if_!<cond%gt;.
     *
     * @param newJumpTargetLabel The new jump target label.
     * @return The negated if instruction with the given
     */
    def negate(newJumpTargetLabel: InstructionLabel): LabeledSimpleConditionalBranchInstruction

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy