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

Side by Side Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 1255303004: Add -reorder-basic-blocks option and fix nop insertion (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: minor fix Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 // Stack frame mapping. 394 // Stack frame mapping.
395 Func->genFrame(); 395 Func->genFrame();
396 if (Func->hasError()) 396 if (Func->hasError())
397 return; 397 return;
398 Func->dump("After stack frame mapping"); 398 Func->dump("After stack frame mapping");
399 399
400 Func->contractEmptyNodes(); 400 Func->contractEmptyNodes();
401 Func->reorderNodes(); 401 Func->reorderNodes();
402 402
403 // Shuffle basic block order if -reorder-basic-blocks is enabled.
404 Func->shuffleNodes();
405
403 // Branch optimization. This needs to be done just before code emission. In 406 // Branch optimization. This needs to be done just before code emission. In
404 // particular, no transformations that insert or reorder CfgNodes should be 407 // particular, no transformations that insert or reorder CfgNodes should be
405 // done after branch optimization. We go ahead and do it before nop insertion 408 // done after branch optimization. We go ahead and do it before nop insertion
406 // to reduce the amount of work needed for searching for opportunities. 409 // to reduce the amount of work needed for searching for opportunities.
407 Func->doBranchOpt(); 410 Func->doBranchOpt();
408 Func->dump("After branch optimization"); 411 Func->dump("After branch optimization");
409 412
410 // Nop insertion 413 // Nop insertion if -nop-insertion iss enabled.
411 if (Ctx->getFlags().shouldDoNopInsertion()) { 414 Func->doNopInsertion();
412 Func->doNopInsertion();
413 }
414 } 415 }
415 416
416 template <class Machine> void TargetX86Base<Machine>::translateOm1() { 417 template <class Machine> void TargetX86Base<Machine>::translateOm1() {
417 TimerMarker T(TimerStack::TT_Om1, Func); 418 TimerMarker T(TimerStack::TT_Om1, Func);
418 419
419 Func->placePhiLoads(); 420 Func->placePhiLoads();
420 if (Func->hasError()) 421 if (Func->hasError())
421 return; 422 return;
422 Func->placePhiStores(); 423 Func->placePhiStores();
423 if (Func->hasError()) 424 if (Func->hasError())
(...skipping 12 matching lines...) Expand all
436 regAlloc(RAK_InfOnly); 437 regAlloc(RAK_InfOnly);
437 if (Func->hasError()) 438 if (Func->hasError())
438 return; 439 return;
439 Func->dump("After regalloc of infinite-weight variables"); 440 Func->dump("After regalloc of infinite-weight variables");
440 441
441 Func->genFrame(); 442 Func->genFrame();
442 if (Func->hasError()) 443 if (Func->hasError())
443 return; 444 return;
444 Func->dump("After stack frame mapping"); 445 Func->dump("After stack frame mapping");
445 446
446 // Nop insertion 447 // Shuffle basic block order if -reorder-basic-blocks is enabled.
447 if (Ctx->getFlags().shouldDoNopInsertion()) { 448 Func->shuffleNodes();
448 Func->doNopInsertion(); 449
449 } 450 // Nop insertion if -nop-insertion iss enabled.
451 Func->doNopInsertion();
450 } 452 }
451 453
452 inline bool canRMW(const InstArithmetic *Arith) { 454 inline bool canRMW(const InstArithmetic *Arith) {
453 Type Ty = Arith->getDest()->getType(); 455 Type Ty = Arith->getDest()->getType();
454 // X86 vector instructions write to a register and have no RMW option. 456 // X86 vector instructions write to a register and have no RMW option.
455 if (isVectorType(Ty)) 457 if (isVectorType(Ty))
456 return false; 458 return false;
457 bool isI64 = Ty == IceType_i64; 459 bool isI64 = Ty == IceType_i64;
458 460
459 switch (Arith->getOp()) { 461 switch (Arith->getOp()) {
(...skipping 5008 matching lines...) Expand 10 before | Expand all | Expand 10 after
5468 } 5470 }
5469 // the offset is not eligible for blinding or pooling, return the original 5471 // the offset is not eligible for blinding or pooling, return the original
5470 // mem operand 5472 // mem operand
5471 return MemOperand; 5473 return MemOperand;
5472 } 5474 }
5473 5475
5474 } // end of namespace X86Internal 5476 } // end of namespace X86Internal
5475 } // end of namespace Ice 5477 } // end of namespace Ice
5476 5478
5477 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H 5479 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698