Skip to content

Commit

Permalink
Remove dead code (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
titzer authored Sep 7, 2023
1 parent 79bb4ca commit dd82b4c
Show file tree
Hide file tree
Showing 18 changed files with 2 additions and 99 deletions.
13 changes: 0 additions & 13 deletions aeneas/src/core/Eval.v3
Original file line number Diff line number Diff line change
Expand Up @@ -399,30 +399,17 @@ def evalOp(op: Operator, args: Arguments) -> Result {
FloatFloor(isDouble) => return if(isDouble, args.do_d_d(double.floor), args.do_f_f(float.floor));
FloatSqrt(isDouble) => return if(isDouble, args.do_d_d(double.sqrt), args.do_f_f(float.sqrt));
//----------------------------------------------------------------------------
IntCastI => {
var val = args.getArg(0), ift = args.it(0), itt = args.it(1);
if (!Eval.doIntQuery(ift, itt, val)) return args.throw(V3Exception.TypeCheck, null);
return Eval.doIntView(ift, itt, val);
}
IntCastF(isDouble) => {
var d: double = if(isDouble, args.d(0), args.f(0));
var t = convert_d(args.it(1), d);
if (t.1 || t.2) return args.throw(V3Exception.TypeCheck, null);
return t.0;
}
IntQueryI => {
var val = args.getArg(0), ift = args.it(0), itt = args.it(1);
return if(Eval.doIntQuery(ift, itt, val), Bool.TRUE, Bool.FALSE);
}
IntQueryF(isDouble) => {
var d: double = if(isDouble, args.d(0), args.f(0));
var t = convert_d(args.it(1), d);
return Bool.box(!(t.1 | t.2));
}
IntPromoteI => {
var val = args.getArg(0), ift = args.it(0), itt = args.it(1);
return Eval.doIntPromote(ift, itt, val);
}
IntViewI => {
var val = args.getArg(0), ift = args.it(0), itt = args.it(1);
return Eval.doIntView(ift, itt, val);
Expand Down
6 changes: 0 additions & 6 deletions aeneas/src/core/Opcode.v3
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ type Opcode {
case FloatFloor(isDouble: bool);
case FloatSqrt(isDouble: bool);
// Integer casts and conversions
case IntCastI;
case IntCastF(isDouble: bool);
case IntQueryI;
case IntQueryF(isDouble: bool);
case IntPromoteI;
case IntViewI;
case IntViewF(isDouble: bool);
case IntTruncF(isDouble: bool);
Expand Down Expand Up @@ -212,12 +209,9 @@ component Opcodes {
t[Opcode.FloatFloor.tag] = P;
t[Opcode.FloatSqrt.tag] = P;

t[Opcode.IntCastI.tag] = F;
t[Opcode.IntCastF.tag] = F;
t[Opcode.IntQueryI.tag] = P;
t[Opcode.IntQueryF.tag] = P;
t[Opcode.IntViewI.tag] = P;
t[Opcode.IntPromoteI.tag] = P;
t[Opcode.IntViewI.tag] = P;
t[Opcode.IntViewF.tag] = P;
t[Opcode.IntTruncF.tag] = P;
Expand Down
9 changes: 0 additions & 9 deletions aeneas/src/core/Operator.v3
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,15 @@ component V3Op {
def opFloatBitEq32 = newOp0(Opcode.FloatBitEq(false), arr_f, arr_ff, type_z);
def opFloatBitEq64 = newOp0(Opcode.FloatBitEq(true), arr_d, arr_dd, type_z);
//----------------------------------------------------------------------------
def newIntCastI(f: Type, t: Type) -> Operator {
return newOp0(Opcode.IntCastI, [f, t], [f], t);
}
def newIntCastF(ft: Type, tt: Type) -> Operator {
return newOp0(Opcode.IntCastF(V3.isDouble(ft)), [ft, tt], [ft], tt);
}
def newIntQueryI(ft: Type, tt: Type) -> Operator {
return newOp0(Opcode.IntQueryI, [ft, tt], [ft], type_z);
}
def newIntQueryF(ft: Type, tt: Type) -> Operator {
return newOp0(Opcode.IntQueryF(V3.isDouble(ft)), [ft, tt], [ft], type_z);
}
def newIntViewI(ft: Type, tt: Type) -> Operator {
return newOp0(Opcode.IntViewI, [ft, tt], [ft], tt);
}
def newIntPromoteI(ft: Type, tt: Type) -> Operator {
return newOp0(Opcode.IntPromoteI, [ft, tt], [ft], tt);
}
def opIntViewF32 = newOp0(Opcode.IntViewF(false), arr_f, arr_f, type_u);
def opIntViewF64 = newOp0(Opcode.IntViewF(true), arr_d, arr_d, Int.getType(false, 64));
def newIntTruncF(ft: Type, tt: Type) -> Operator {
Expand Down
7 changes: 0 additions & 7 deletions aeneas/src/ic/Ic.v3
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ class IcAssembler(code: Vector<IcInstr>) {
}
IntLt => intCompare(op, IntCompare.IntLtS, IntCompare.IntLtU, dst, args);
IntLteq => intCompare(op, IntCompare.IntLteqS, IntCompare.IntLteqU, dst, args);
IntPromoteI => {
var arg0 = args[0];
var ft = IntType.!(op.sig.paramTypes[0]), tt = IntType.!(op.sig.returnType());
if (!TypeSystem.isIntToLong(ft, tt)) return arg0;
code.put(IcInstr.Int32Unop(dst, arg0, 0, if(ft.signed, IntUnop.IntToLongS, IntUnop.IntToLongU), null));
return dst;
}
IntViewI => {
var arg0 = args[0];
var ft = IntType.!(op.sig.paramTypes[0]), tt = IntType.!(op.sig.returnType());
Expand Down
1 change: 0 additions & 1 deletion aeneas/src/ir/Reachability.v3
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def live(facts: RaFact.set) -> bool {
return (facts & (RaFact.RC_LIVE | RaFact.RC_ALLOC)) != NONE;
}

def NO_RECORDS = Array<Record>.new(0);
def MONO_TYPEARGS: Array<Type> = [AnyRef.TYPE];

def EQUALS_VST_METHOD = VstMethod.new(false, Token.new(null, "==", 0, 0), null, null, ReturnType.Void, null);
Expand Down
21 changes: 0 additions & 21 deletions aeneas/src/ir/SsaNormalizer.v3
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,6 @@ class SsaRaNormalizer extends SsaRebuilder {
var orig = app.op, op = app.op, args = app.inputs;
if (context.spec != null) op = app.op.subst(context.spec.instantiateType);
match (op.opcode) {
IntQueryI => {
var ft = op.typeArgs[0], tt = op.typeArgs[1], x = genRef1(args[0]);
var ni: SsaInstr;
if (!IntType.?(ft)) {
ni = newGraph.falseConst();
} else {
ni = curBlock.opIntQueryI(IntType.!(ft), IntType.!(tt), x);
}
map1(app, ni);
}
IntCastI => {
var ft = op.typeArgs[0], tt = op.typeArgs[1], x = genRef1(args[0]);
var ni: SsaInstr;
if (!IntType.?(ft)) {
curBlock.addThrow(app.source, V3Exception.TypeCheck);
ni = newGraph.nullConst(tt);
} else {
ni = curBlock.opIntCastI(IntType.!(ft), IntType.!(tt), x);
}
map1(app, ni);
}
BoolEq,
RefEq,
IntEq => normSimpleEqualOp(app, op);
Expand Down
2 changes: 0 additions & 2 deletions aeneas/src/jvm/JvmType.v3
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ component JvmTypes {
def DOUBLE = JvmPrimitive.new("double", "D", "D", KIND_DOUBLE);
def VOID = JvmPrimitive.new("void", "V", "V", KIND_VOID);

def hash(jvmType: JvmType) -> int { return Strings.hash(jvmType.name); }

def jlo = "java/lang/Object";
def jln = "java/lang/Number";
def systemClassName = "V3S_System";
Expand Down
1 change: 0 additions & 1 deletion aeneas/src/mach/CiRuntime.v3
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// Defines operations and constants exposed by the compiler (Ci) to the runtime (Runtime).
component CiRuntimeModule {
def NAME = "CiRuntime";
var max = 0;
def map = Strings.newMap<CiRuntime_Address>();
// region begin and end constants
Expand Down
4 changes: 0 additions & 4 deletions aeneas/src/mach/MachBackend.v3
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,6 @@ class SsaMachGen(context: SsaContext, mach: MachProgram, regSet: MachRegSet, w:
}
emitN(ArchInstrs.ARCH_PARMOVE);
}
// Mark {i} as live in {block}
def setLive(i: SsaInstr, block: SsaBlock) {
liveness[block.mark, getVReg(i).varNum] = true;
}
// Check if {i} is live in {block}
def isLive(i: SsaLink, block: SsaBlock) -> bool {
if (i.mark >= context.graph.markGen) {
Expand Down
2 changes: 1 addition & 1 deletion aeneas/src/main/Version.v3
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

// Updated by VCS scripts. DO NOT EDIT.
component Version {
def version: string = "III-7.1651";
def version: string = "III-7.1652";
var buildData: string;
}
7 changes: 0 additions & 7 deletions aeneas/src/ssa/Ssa.v3
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,6 @@ component Ssa {
for (i < r.length) r[i] = x.inputs[i].dest;
return r;
}
// find the edge number of an input edge in the list of edges
def findIncomingPhiEdge(edge: SsaCfEdge, context: SsaContext) -> int {
if (Debug.PARANOID) {
if (edge.dest.preds[edge.desti] != edge) context.fail("Edge malformed");
}
return edge.desti;
}
// Inserts an intermediate block between any control-flow edges from a
// predecessor with more than one successor to a successor with more than
// one predecessor.
Expand Down
9 changes: 0 additions & 9 deletions aeneas/src/types/Int.v3
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Copyright 2011 Google Inc. All rights reserved.
// See LICENSE for details of Apache 2.0 license.

def MAX_VALUE_DIV_10 = 214748364;
def MAX_VALUE_MOD_10 = 7;
def MIN_VALUE_DIV_10 = -214748364;
def MIN_VALUE_MOD_10 = 8;
def ZERO_CHAR: u32 = '0';
// Utility methods for working with ints, including parsing and rendering,
// as well as the representation of the "int" type in the compiler
component Int {
Expand All @@ -26,10 +21,6 @@ component Int {
true, checkIntViewTypeArg(32, _, _)), null);
def VIEW_TYPE_PARAM_LIST_64 = List.new(TypeUtil.newTypeParamWithConstraint(TypeUtil.BUILTIN_TOKEN, TypeUtil.globalCache,
true, checkIntViewTypeArg(64, _, _)), null);
def QUERY_TYPE_PARAM_LIST = List.new(TypeUtil.newTypeParamWithConstraint(TypeUtil.BUILTIN_TOKEN, TypeUtil.globalCache,
false, checkIntOpTypeArg("query", _, _)), null);
def CAST_TYPE_PARAM_LIST = List.new(TypeUtil.newTypeParamWithConstraint(TypeUtil.BUILTIN_TOKEN, TypeUtil.globalCache,
false, checkIntOpTypeArg("cast", _, _)), null);

def getType(signed: bool, width: int) -> IntType {
if (width <= 0 || width > MAX_WIDTH) return null;
Expand Down
1 change: 0 additions & 1 deletion aeneas/src/types/Void.v3
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Representation of the void type.
component Void {
def TYPE = TypeUtil.singleType("void", V3Kind.VOID, VoidType.new);
def TYPE_ARRAY: Array<Type> = [TYPE];
def ERROR_TYPE = TypeUtil.singleType("?", V3Kind.VOID, ErrorType.new);
}
// Representation of the null type, used internally.
Expand Down
3 changes: 0 additions & 3 deletions aeneas/src/util/Char.v3
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ component Char {
def isHex(ch: byte) -> bool {
return (properties[ch] & IS_HEX) != 0;
}
def isHexOrUnderscore(ch: byte) -> bool {
return ((properties[ch] & IS_HEX) != 0) || ch == '_';
}
def isBinary(ch: byte) -> bool {
return (u32.!(ch) - '0') <= u32.!(1);
}
Expand Down
1 change: 0 additions & 1 deletion aeneas/src/util/Terminal.v3
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ component Terminal {
}
def ln() { putc('\n'); }
def sp() { putc(' '); }
def tab() { putc('\t'); }
def putd(val: int) { System.puti(val); }
def put1<A>(fmt: string, a: A) { buf.put1(fmt, a).outt(); }
def put2<A, B>(fmt: string, a: A, b: B) { buf.put2(fmt, a, b).outt(); }
Expand Down
1 change: 1 addition & 0 deletions aeneas/src/v3/V3.v3
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ component V3 {
}
return null;
}
// TODO: inline all V3.isXXX() type query methods
def isClass(t: Type) -> bool { return ClassType.?(t); }
def isComponent(t: Type) -> bool { return t != null && V3Component_TypeCon.?(t.typeCon); } // TODO
def isFunction(t: Type) -> bool { return FuncType.?(t); }
Expand Down
6 changes: 0 additions & 6 deletions aeneas/src/v3/V3Enum.v3
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ class EnumType extends Type {
return IntType.!(enumDecl.tagType).packedByteSize();
}
}
def enumSetName(enumDecl: VstEnum) -> string {
return Strings.builderOf(enumDecl.fullName).puts(".set").toString();
}
def intTypeOrU1(length: int) -> IntType {
return Int.getType(false, if(length == 0, 1, length));
}
// The type for user-declared enums' sets.
class EnumSetType extends Type {
def enumDecl: VstEnum;
Expand Down
7 changes: 0 additions & 7 deletions aeneas/src/vst/Parser.v3
Original file line number Diff line number Diff line change
Expand Up @@ -1020,13 +1020,6 @@ component Parser {
def kwError(p: ParserState, id: Token) {
p.errorAt(id.range(), Strings.format1("keyword \"%s\" cannot be used as identifier", id.image));
}
def parseDecimalTokenInString(p: ParserState) -> Token {
var diff = 0;
while (Char.isDecimal(p.peek(diff))) { diff++; }
if (diff > 0) { return p.token(diff); }
p.error("missing UnitDecimal unit");
return null;
}
def parseIdentVoid(p: ParserState) -> VstIdent<void> {
var id = parseIdentCommon<void>(p, null);
if (id.kwClass != 0) kwError(p, id.name);
Expand Down

0 comments on commit dd82b4c

Please sign in to comment.