Skip to content

Commit e202150

Browse files
committed
remove unused code in compiler.lir
1 parent c6a82cf commit e202150

26 files changed

+26
-1060
lines changed

compiler/src/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/PrintableCFG.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

compiler/src/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/PrintableDominatorOptimizationProblem.java

Lines changed: 0 additions & 48 deletions
This file was deleted.

compiler/src/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/BailoutAndRestartBackendException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it

compiler/src/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/CompositeValue.java

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
2828
import java.lang.annotation.Retention;
2929
import java.lang.annotation.RetentionPolicy;
3030
import java.lang.annotation.Target;
31-
import java.util.EnumSet;
3231

3332
import org.graalvm.compiler.lir.LIRInstruction.OperandFlag;
3433
import org.graalvm.compiler.lir.LIRInstruction.OperandMode;
@@ -66,32 +65,6 @@ public CompositeValue(ValueKind<?> kind) {
6665
*/
6766
public abstract CompositeValue forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueProcedure proc);
6867

69-
/**
70-
* A helper method to visit {@link Value}[] ensuring that a copy of the array is made if it's
71-
* needed.
72-
*
73-
* @param inst
74-
* @param values
75-
* @param mode
76-
* @param proc
77-
* @param flags
78-
* @return the original {@code values} array or a copy if values changed
79-
*/
80-
protected Value[] visitValueArray(LIRInstruction inst, Value[] values, OperandMode mode, InstructionValueProcedure proc, EnumSet<OperandFlag> flags) {
81-
Value[] newValues = null;
82-
for (int i = 0; i < values.length; i++) {
83-
Value value = values[i];
84-
Value newValue = proc.doValue(inst, value, mode, flags);
85-
if (!value.identityEquals(newValue)) {
86-
if (newValues == null) {
87-
newValues = values.clone();
88-
}
89-
newValues[i] = value;
90-
}
91-
}
92-
return newValues != null ? newValues : values;
93-
}
94-
9568
protected abstract void visitEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueConsumer proc);
9669

9770
@Override

compiler/src/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIRInstructionClass.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -207,21 +207,6 @@ public String toString() {
207207
return str.toString();
208208
}
209209

210-
Values getValues(OperandMode mode) {
211-
switch (mode) {
212-
case USE:
213-
return uses;
214-
case ALIVE:
215-
return alives;
216-
case TEMP:
217-
return temps;
218-
case DEF:
219-
return defs;
220-
default:
221-
throw GraalError.shouldNotReachHere("unknown OperandMode: " + mode);
222-
}
223-
}
224-
225210
final String getOpcode(LIRInstruction obj) {
226211
if (opcodeConstant != null) {
227212
return opcodeConstant;

compiler/src/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIRValueUtil.java

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -162,29 +162,4 @@ private static List<Register> collectRegisters(Object[] values, List<Register> r
162162
}
163163
return registers;
164164
}
165-
166-
/**
167-
* Subtract sets of registers (x - y).
168-
*
169-
* @param x a set of register to subtract from.
170-
* @param y a set of registers to subtract.
171-
* @return resulting set of registers (x - y).
172-
*/
173-
public static Value[] subtractRegisters(Value[] x, Value[] y) {
174-
ArrayList<Value> result = new ArrayList<>(x.length);
175-
for (Value i : x) {
176-
boolean append = true;
177-
for (Value j : y) {
178-
if (sameRegister(i, j)) {
179-
append = false;
180-
break;
181-
}
182-
}
183-
if (append) {
184-
result.add(i);
185-
}
186-
}
187-
Value[] resultArray = new Value[result.size()];
188-
return result.toArray(resultArray);
189-
}
190165
}

compiler/src/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/Variable.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -40,8 +40,6 @@ public class Variable extends AllocatableValue {
4040
*/
4141
public final int index;
4242

43-
private String name;
44-
4543
/**
4644
* Creates a new variable.
4745
*
@@ -54,21 +52,9 @@ public Variable(ValueKind<?> kind, int index) {
5452
this.index = index;
5553
}
5654

57-
public void setName(String name) {
58-
this.name = name;
59-
}
60-
61-
public String getName() {
62-
return name;
63-
}
64-
6555
@Override
6656
public String toString() {
67-
if (name != null) {
68-
return name;
69-
} else {
70-
return "v" + index + getKindSuffix();
71-
}
57+
return "v" + index + getKindSuffix();
7258
}
7359

7460
@Override

compiler/src/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/OutOfRegistersException.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -40,21 +40,11 @@ public OutOfRegistersException(String msg) {
4040
this.description = "";
4141
}
4242

43-
public OutOfRegistersException(Throwable cause, String msg) {
44-
super(cause, msg);
45-
this.description = "";
46-
}
47-
4843
public OutOfRegistersException(String msg, String description) {
4944
super(msg);
5045
this.description = description;
5146
}
5247

53-
public OutOfRegistersException(Throwable cause, String msg, String description) {
54-
super(cause, msg);
55-
this.description = description;
56-
}
57-
5848
public String getDescription() {
5949
return description;
6050
}

compiler/src/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/lsra/Interval.java

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,13 +24,13 @@
2424
*/
2525
package org.graalvm.compiler.lir.alloc.lsra;
2626

27-
import static org.graalvm.compiler.lir.LIRValueUtil.isStackSlotValue;
28-
import static org.graalvm.compiler.lir.LIRValueUtil.isVariable;
29-
import static org.graalvm.compiler.lir.LIRValueUtil.isVirtualStackSlot;
3027
import static jdk.vm.ci.code.ValueUtil.asRegister;
3128
import static jdk.vm.ci.code.ValueUtil.isIllegal;
3229
import static jdk.vm.ci.code.ValueUtil.isRegister;
3330
import static jdk.vm.ci.code.ValueUtil.isStackSlot;
31+
import static org.graalvm.compiler.lir.LIRValueUtil.isStackSlotValue;
32+
import static org.graalvm.compiler.lir.LIRValueUtil.isVariable;
33+
import static org.graalvm.compiler.lir.LIRValueUtil.isVirtualStackSlot;
3434

3535
import java.util.ArrayList;
3636
import java.util.Collections;
@@ -44,6 +44,7 @@
4444
import org.graalvm.compiler.debug.GraalError;
4545
import org.graalvm.compiler.lir.LIRInstruction;
4646
import org.graalvm.compiler.lir.Variable;
47+
4748
import jdk.vm.ci.code.RegisterValue;
4849
import jdk.vm.ci.code.StackSlot;
4950
import jdk.vm.ci.meta.AllocatableValue;
@@ -946,28 +947,6 @@ Interval getSplitChildBeforeOpId(int opId) {
946947
return result;
947948
}
948949

949-
// checks if opId is covered by any split child
950-
boolean splitChildCovers(int opId, LIRInstruction.OperandMode mode) {
951-
assert isSplitParent() : "can only be called for split parents";
952-
assert opId >= 0 : "invalid opId (method can not be called for spill moves)";
953-
954-
if (splitChildren.isEmpty()) {
955-
// simple case if interval was not split
956-
return covers(opId, mode);
957-
958-
} else {
959-
// extended case: check all split children
960-
int len = splitChildren.size();
961-
for (int i = 0; i < len; i++) {
962-
Interval cur = splitChildren.get(i);
963-
if (cur.covers(opId, mode)) {
964-
return true;
965-
}
966-
}
967-
return false;
968-
}
969-
}
970-
971950
private RegisterPriority adaptPriority(RegisterPriority priority) {
972951
/*
973952
* In case of re-materialized values we require that use-operands are registers, because we
@@ -1153,36 +1132,6 @@ Interval split(int splitPos, LinearScan allocator) {
11531132
return result;
11541133
}
11551134

1156-
/**
1157-
* Splits this interval at a specified position and returns the head as a new interval (this
1158-
* interval is the tail).
1159-
*
1160-
* Currently, only the first range can be split, and the new interval must not have split
1161-
* positions
1162-
*/
1163-
Interval splitFromStart(int splitPos, LinearScan allocator) {
1164-
assert isVariable(operand) : "cannot split fixed intervals";
1165-
assert splitPos > from() && splitPos < to() : "can only split inside interval";
1166-
assert splitPos > first.from && splitPos <= first.to : "can only split inside first range";
1167-
assert firstUsage(RegisterPriority.None) > splitPos : "can not split when use positions are present";
1168-
1169-
// allocate new interval
1170-
Interval result = newSplitChild(allocator);
1171-
1172-
// the new interval has only one range (checked by assertion above,
1173-
// so the splitting of the ranges is very simple
1174-
result.addRange(first.from, splitPos);
1175-
1176-
if (splitPos == first.to) {
1177-
assert !first.next.isEndMarker() : "must not be at end";
1178-
first = first.next;
1179-
} else {
1180-
first.from = splitPos;
1181-
}
1182-
1183-
return result;
1184-
}
1185-
11861135
// returns true if the opId is inside the interval
11871136
boolean covers(int opId, LIRInstruction.OperandMode mode) {
11881137
Range cur = first;

0 commit comments

Comments
 (0)