Skip to content

Commit 82b06db

Browse files
aartbikcommit-bot@chromium.org
authored andcommitted
[vm/compiler] Move more common code into type propagator
Rationale: Since I was visiting the neighborhood anyway, I might as well clean up a bit more code duplication. Now all type propagation related code is in one file! Change-Id: Idec49dd91a12b42c5371c132c571acca22d4b187 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112046 Commit-Queue: Aart Bik <ajcbik@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>
1 parent 17aa00c commit 82b06db

File tree

7 files changed

+29
-83
lines changed

7 files changed

+29
-83
lines changed

runtime/vm/compiler/backend/compile_type.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ class CompileType : public ZoneAllocated {
129129
// Create non-nullable Int type.
130130
static CompileType Int();
131131

132+
// Create non-nullable 32-bit Int type (arch dependent).
133+
static CompileType Int32();
134+
132135
// Create nullable Int type.
133136
static CompileType NullableInt();
134137

runtime/vm/compiler/backend/il_arm.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6756,22 +6756,6 @@ void UnaryInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
67566756
}
67576757
}
67586758

6759-
CompileType BinaryUint32OpInstr::ComputeType() const {
6760-
return CompileType::Int();
6761-
}
6762-
6763-
CompileType ShiftUint32OpInstr::ComputeType() const {
6764-
return CompileType::Int();
6765-
}
6766-
6767-
CompileType SpeculativeShiftUint32OpInstr::ComputeType() const {
6768-
return CompileType::Int();
6769-
}
6770-
6771-
CompileType UnaryUint32OpInstr::ComputeType() const {
6772-
return CompileType::Int();
6773-
}
6774-
67756759
LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone,
67766760
bool opt) const {
67776761
const intptr_t kNumInputs = 2;

runtime/vm/compiler/backend/il_arm64.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5898,22 +5898,6 @@ void UnaryInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
58985898
}
58995899
}
59005900

5901-
CompileType BinaryUint32OpInstr::ComputeType() const {
5902-
return CompileType::FromCid(kSmiCid);
5903-
}
5904-
5905-
CompileType ShiftUint32OpInstr::ComputeType() const {
5906-
return CompileType::FromCid(kSmiCid);
5907-
}
5908-
5909-
CompileType SpeculativeShiftUint32OpInstr::ComputeType() const {
5910-
return CompileType::FromCid(kSmiCid);
5911-
}
5912-
5913-
CompileType UnaryUint32OpInstr::ComputeType() const {
5914-
return CompileType::FromCid(kSmiCid);
5915-
}
5916-
59175901
LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone,
59185902
bool opt) const {
59195903
const intptr_t kNumInputs = 2;

runtime/vm/compiler/backend/il_dbc.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,22 +1365,6 @@ LocationSummary* Instruction::MakeCallSummary(Zone* zone) {
13651365
return result;
13661366
}
13671367

1368-
CompileType BinaryUint32OpInstr::ComputeType() const {
1369-
return CompileType::Int();
1370-
}
1371-
1372-
CompileType ShiftUint32OpInstr::ComputeType() const {
1373-
return CompileType::Int();
1374-
}
1375-
1376-
CompileType SpeculativeShiftUint32OpInstr::ComputeType() const {
1377-
return CompileType::Int();
1378-
}
1379-
1380-
CompileType UnaryUint32OpInstr::ComputeType() const {
1381-
return CompileType::Int();
1382-
}
1383-
13841368
Representation LoadIndexedInstr::representation() const {
13851369
switch (class_id_) {
13861370
case kArrayCid:

runtime/vm/compiler/backend/il_ia32.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6083,22 +6083,6 @@ void UnaryInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
60836083
}
60846084
}
60856085

6086-
CompileType BinaryUint32OpInstr::ComputeType() const {
6087-
return CompileType::Int();
6088-
}
6089-
6090-
CompileType ShiftUint32OpInstr::ComputeType() const {
6091-
return CompileType::Int();
6092-
}
6093-
6094-
CompileType SpeculativeShiftUint32OpInstr::ComputeType() const {
6095-
return CompileType::Int();
6096-
}
6097-
6098-
CompileType UnaryUint32OpInstr::ComputeType() const {
6099-
return CompileType::Int();
6100-
}
6101-
61026086
LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone,
61036087
bool opt) const {
61046088
const intptr_t kNumInputs = 1;

runtime/vm/compiler/backend/il_x64.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6212,22 +6212,6 @@ void SpeculativeShiftUint32OpInstr::EmitNativeCode(
62126212
}
62136213
}
62146214

6215-
CompileType BinaryUint32OpInstr::ComputeType() const {
6216-
return CompileType::FromCid(kSmiCid);
6217-
}
6218-
6219-
CompileType ShiftUint32OpInstr::ComputeType() const {
6220-
return CompileType::FromCid(kSmiCid);
6221-
}
6222-
6223-
CompileType SpeculativeShiftUint32OpInstr::ComputeType() const {
6224-
return CompileType::FromCid(kSmiCid);
6225-
}
6226-
6227-
CompileType UnaryUint32OpInstr::ComputeType() const {
6228-
return CompileType::FromCid(kSmiCid);
6229-
}
6230-
62316215
LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone,
62326216
bool opt) const {
62336217
const intptr_t kNumInputs = 2;

runtime/vm/compiler/backend/type_propagator.cc

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,14 @@ CompileType CompileType::Int() {
661661
return FromAbstractType(Type::ZoneHandle(Type::IntType()), kNonNullable);
662662
}
663663

664+
CompileType CompileType::Int32() {
665+
#if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64)
666+
return FromCid(kSmiCid);
667+
#else
668+
return Int();
669+
#endif
670+
}
671+
664672
CompileType CompileType::NullableInt() {
665673
return FromAbstractType(Type::ZoneHandle(Type::IntType()), kNullable);
666674
}
@@ -1431,6 +1439,22 @@ CompileType LoadCodeUnitsInstr::ComputeType() const {
14311439
}
14321440
}
14331441

1442+
CompileType BinaryUint32OpInstr::ComputeType() const {
1443+
return CompileType::Int32();
1444+
}
1445+
1446+
CompileType ShiftUint32OpInstr::ComputeType() const {
1447+
return CompileType::Int32();
1448+
}
1449+
1450+
CompileType SpeculativeShiftUint32OpInstr::ComputeType() const {
1451+
return CompileType::Int32();
1452+
}
1453+
1454+
CompileType UnaryUint32OpInstr::ComputeType() const {
1455+
return CompileType::Int32();
1456+
}
1457+
14341458
CompileType BinaryInt32OpInstr::ComputeType() const {
14351459
// TODO(vegorov): range analysis information shall be used here.
14361460
return CompileType::Int();
@@ -1672,9 +1696,8 @@ CompileType LoadIndexedInstr::ComputeType() const {
16721696

16731697
case kTypedDataInt32ArrayCid:
16741698
case kTypedDataUint32ArrayCid:
1675-
#if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64)
1676-
return CompileType::FromCid(kSmiCid);
1677-
#endif
1699+
return CompileType::Int32();
1700+
16781701
case kTypedDataInt64ArrayCid:
16791702
case kTypedDataUint64ArrayCid:
16801703
return CompileType::Int();

0 commit comments

Comments
 (0)