Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: src/compiler/move-optimizer.cc

Issue 2086653003: [Turbofan] Add the concept of aliasing to RegisterConfiguration. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/move-optimizer.cc
diff --git a/src/compiler/move-optimizer.cc b/src/compiler/move-optimizer.cc
index 715eb414bbff8288a37b38f9850b67a224735e2a..ff6df12102736d43cb07b47f0f729d8dd7229059 100644
--- a/src/compiler/move-optimizer.cc
+++ b/src/compiler/move-optimizer.cc
@@ -28,20 +28,34 @@ typedef ZoneMap<MoveKey, unsigned, MoveKeyCompare> MoveMap;
typedef ZoneSet<InstructionOperand, CompareOperandModuloType> OperandSet;
bool Blocks(const OperandSet& set, const InstructionOperand& operand) {
- if (!operand.IsFPRegister()) return set.find(operand) != set.end();
+ if (set.find(operand) != set.end()) return true;
+ // Only FP registers alias.
+ if (!operand.IsFPRegister()) return false;
const LocationOperand& loc = LocationOperand::cast(operand);
- if (loc.representation() == MachineRepresentation::kFloat64) {
- return set.find(operand) != set.end() ||
- set.find(LocationOperand(loc.kind(), loc.location_kind(),
- MachineRepresentation::kFloat32,
- loc.register_code())) != set.end();
- }
- DCHECK_EQ(MachineRepresentation::kFloat32, loc.representation());
- return set.find(operand) != set.end() ||
- set.find(LocationOperand(loc.kind(), loc.location_kind(),
- MachineRepresentation::kFloat64,
- loc.register_code())) != set.end();
+ MachineRepresentation rep = loc.representation();
+ MachineRepresentation other_fp_rep = rep == MachineRepresentation::kFloat64
+ ? MachineRepresentation::kFloat32
+ : MachineRepresentation::kFloat64;
+ const RegisterConfiguration* config =
+ RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN);
+ if (config->fp_aliasing_kind() != RegisterConfiguration::COMBINE) {
+ // Overlap aliasing case.
+ return set.find(LocationOperand(loc.kind(), loc.location_kind(),
+ other_fp_rep, loc.register_code())) !=
+ set.end();
+ }
+ // Combine aliasing case.
+ int alias_base_index = -1;
+ int aliases = config->GetAliases(rep, loc.register_code(), other_fp_rep,
+ &alias_base_index);
+ while (aliases--) {
+ int aliased_reg = alias_base_index + aliases;
+ if (set.find(LocationOperand(loc.kind(), loc.location_kind(), other_fp_rep,
+ aliased_reg)) != set.end())
+ return true;
+ }
+ return false;
}
int FindFirstNonEmptySlot(const Instruction* instr) {

Powered by Google App Engine
This is Rietveld 408576698