Skip to content

Commit 05a28ab

Browse files
committed
[VM] Introduce new way to define instruction backends (Reland).
Rewrite most SIMD instructions on ARM using this new way. Our current way for defining instruction backends -- a pair of two virtual methods called MakeLocationSummary and EmitNativeCode, leads to unnecessary duplicated and verbose code. Code generation happens in three steps: 1. For each instruction in the graph MakeLocationSummary is called to constructing a location summary object encoding register allocation constraints; 2. When all register constraints are collected a register allocation is performed and results are filled back into the location summaries; 3. For each instruction in the graph EmitNativeCode is called. It unpacks location summary attached to the instruction into actual machine registers and emits native code. There is usually a lot of duplication between declaring register constraints in MLS and unpacking them in ENC which this CL is trying to remove. The new way is centered on the concept of an *emitter function* which encodes in its signature register constraints for a particular instruction. We use a combination of templates and macroses to enable writing DEFINE_BACKEND(BinaryFloat32x4Op, (QRegister result, QRegister left, QRegister right)) { // ... } Instead of LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, bool opt) const { const intptr_t kNumInputs = 2; const intptr_t kNumTemps = 0; LocationSummary* summary = new (zone) LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); summary->set_in(0, Location::RequiresFpuRegister()); summary->set_in(1, Location::RequiresFpuRegister()); summary->set_out(0, Location::RequiresFpuRegister()); return summary; } void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const QRegister left = locs()->in(0).fpu_reg(); const QRegister right = locs()->in(1).fpu_reg(); const QRegister result = locs()->out(0).fpu_reg(); // ... } This change also introduces a new, more handy way to work with S/D components of QRegisters, QRegister_ wrapper type. Bug: #30949 Change-Id: I7bb0fc9672c89acc3d3d9b5e9859ae5a5471f420 Reviewed-on: https://dart-review.googlesource.com/11820 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent 58eba86 commit 05a28ab

File tree

5 files changed

+955
-747
lines changed

5 files changed

+955
-747
lines changed

0 commit comments

Comments
 (0)