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

Unified Diff: src/compiler/register-allocator.cc

Issue 727693002: [turbofan] small cleanups to aid register allocator debugging (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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
« src/compiler/pipeline.cc ('K') | « src/compiler/register-allocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/register-allocator.cc
diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc
index 23a7df6e9c0b839654a85aab18e455466e555c85..c3145091b075ef03d964eed1ce2f14cfb2c0728b 100644
--- a/src/compiler/register-allocator.cc
+++ b/src/compiler/register-allocator.cc
@@ -1125,7 +1125,6 @@ bool RegisterAllocator::Allocate(PipelineStatistics* stats) {
PhaseScope phase_scope(stats, "meet register constraints");
MeetRegisterConstraints();
}
- if (!AllocationOk()) return false;
{
PhaseScope phase_scope(stats, "resolve phis");
ResolvePhis();
@@ -1134,6 +1133,14 @@ bool RegisterAllocator::Allocate(PipelineStatistics* stats) {
PhaseScope phase_scope(stats, "build live ranges");
BuildLiveRanges();
}
+ if (FLAG_trace_turbo) {
+ OFStream os(stdout);
+ PrintableInstructionSequence printable = {config(), code()};
+ os << "----- Instruction sequence before register allocation -----\n"
+ << printable;
+ }
+ // This can be triggered in debug mode.
+ DCHECK(!ExistsUseWithoutDefinition());
{
PhaseScope phase_scope(stats, "allocate general registers");
AllocateGeneralRegisters();
@@ -1487,28 +1494,6 @@ void RegisterAllocator::BuildLiveRanges() {
live_in_sets_[i]->Union(*live);
}
}
-
-#ifdef DEBUG
- if (block_id == 0) {
- BitVector::Iterator iterator(live);
- bool found = false;
- while (!iterator.Done()) {
- found = true;
- int operand_index = iterator.Current();
- PrintF("Register allocator error: live v%d reached first block.\n",
- operand_index);
- LiveRange* range = LiveRangeFor(operand_index);
- PrintF(" (first use is at %d)\n", range->first_pos()->pos().Value());
- if (debug_name() == nullptr) {
- PrintF("\n");
- } else {
- PrintF(" (function: %s)\n", debug_name());
- }
- iterator.Advance();
- }
- DCHECK(!found);
- }
-#endif
}
for (int i = 0; i < live_ranges_.length(); ++i) {
@@ -1539,6 +1524,27 @@ void RegisterAllocator::BuildLiveRanges() {
}
+bool RegisterAllocator::ExistsUseWithoutDefinition() {
+ bool found = false;
+ BitVector::Iterator iterator(live_in_sets_[0]);
+ while (!iterator.Done()) {
+ found = true;
+ int operand_index = iterator.Current();
+ PrintF("Register allocator error: live v%d reached first block.\n",
+ operand_index);
+ LiveRange* range = LiveRangeFor(operand_index);
+ PrintF(" (first use is at %d)\n", range->first_pos()->pos().Value());
+ if (debug_name() == nullptr) {
+ PrintF("\n");
+ } else {
+ PrintF(" (function: %s)\n", debug_name());
+ }
+ iterator.Advance();
+ }
+ return found;
+}
+
+
bool RegisterAllocator::SafePointsAreInOrder() const {
int safe_point = 0;
const PointerMapDeque* pointer_maps = code()->pointer_maps();
« src/compiler/pipeline.cc ('K') | « src/compiler/register-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698