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

org.qbicc.graph.literal.ConstantLiteral Maven / Gradle / Ivy

There is a newer version: 0.77.0
Show newest version
package org.qbicc.graph.literal;

import org.qbicc.type.ValueType;
import org.qbicc.type.WordType;

/**
 * A constant literal.  Constant literals are resolved to values during the analysis phase.
 */
public final class ConstantLiteral extends Literal {
    private final ValueType type;

    ConstantLiteral(final ValueType type) {
        this.type = type;
    }

    public boolean isZero() {
        return false;
    }

    public boolean equals(final Literal other) {
        return other instanceof ConstantLiteral;
    }

    public ValueType getType() {
        return type;
    }

    @Override
    Literal bitCast(LiteralFactory lf, WordType toType) {
        return lf.constantLiteralOfType(toType);
    }

    public int hashCode() {
        return type.hashCode();
    }

    public  R accept(final LiteralVisitor visitor, final T param) {
        return visitor.visit(param, this);
    }

    @Override
    public StringBuilder toString(StringBuilder b) {
        return b.append("constant");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy