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

Side by Side Diff: src/IceCfgNode.cpp

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: rebase to master branch 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
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceClFlags.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===// 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===//
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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 Context.init(this); 493 Context.init(this);
494 while (!Context.atEnd()) { 494 while (!Context.atEnd()) {
495 Target->doAddressOpt(); 495 Target->doAddressOpt();
496 } 496 }
497 } 497 }
498 498
499 void CfgNode::doNopInsertion() { 499 void CfgNode::doNopInsertion() {
500 TargetLowering *Target = Func->getTarget(); 500 TargetLowering *Target = Func->getTarget();
501 LoweringContext &Context = Target->getContext(); 501 LoweringContext &Context = Target->getContext();
502 Context.init(this); 502 Context.init(this);
503 Context.setInsertPoint(Context.getCur());
504 // Do not insert nop in bundle locked instructions.
505 bool PauseNopInsertion = false;
503 while (!Context.atEnd()) { 506 while (!Context.atEnd()) {
504 Target->doNopInsertion(); 507 if (llvm::isa<InstBundleLock>(Context.getCur())) {
508 PauseNopInsertion = true;
509 } else if (llvm::isa<InstBundleUnlock>(Context.getCur())) {
510 PauseNopInsertion = false;
511 }
512 if (!PauseNopInsertion)
513 Target->doNopInsertion();
505 // Ensure Cur=Next, so that the nops are inserted before the current 514 // Ensure Cur=Next, so that the nops are inserted before the current
506 // instruction rather than after. 515 // instruction rather than after.
516 Context.advanceCur();
507 Context.advanceNext(); 517 Context.advanceNext();
508 Context.advanceCur();
509 } 518 }
510 // Insert before all instructions.
511 Context.setInsertPoint(getInsts().begin());
512 Context.advanceNext();
513 Context.advanceCur();
514 Target->doNopInsertion();
515 } 519 }
516 520
517 // Drives the target lowering. Passes the current instruction and the 521 // Drives the target lowering. Passes the current instruction and the
518 // next non-deleted instruction for target lowering. 522 // next non-deleted instruction for target lowering.
519 void CfgNode::genCode() { 523 void CfgNode::genCode() {
520 TargetLowering *Target = Func->getTarget(); 524 TargetLowering *Target = Func->getTarget();
521 LoweringContext &Context = Target->getContext(); 525 LoweringContext &Context = Target->getContext();
522 // Lower the regular instructions. 526 // Lower the regular instructions.
523 Context.init(this); 527 Context.init(this);
524 Target->initNodeForLowering(this); 528 Target->initNodeForLowering(this);
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 InstIntrinsicCall *Inst = InstIntrinsicCall::create( 1280 InstIntrinsicCall *Inst = InstIntrinsicCall::create(
1277 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); 1281 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info);
1278 Inst->addArg(AtomicRMWOp); 1282 Inst->addArg(AtomicRMWOp);
1279 Inst->addArg(Counter); 1283 Inst->addArg(Counter);
1280 Inst->addArg(One); 1284 Inst->addArg(One);
1281 Inst->addArg(OrderAcquireRelease); 1285 Inst->addArg(OrderAcquireRelease);
1282 Insts.push_front(Inst); 1286 Insts.push_front(Inst);
1283 } 1287 }
1284 1288
1285 } // end of namespace Ice 1289 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceClFlags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698