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

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: 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/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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 Context.init(this); 483 Context.init(this);
484 while (!Context.atEnd()) { 484 while (!Context.atEnd()) {
485 Target->doAddressOpt(); 485 Target->doAddressOpt();
486 } 486 }
487 } 487 }
488 488
489 void CfgNode::doNopInsertion() { 489 void CfgNode::doNopInsertion() {
490 TargetLowering *Target = Func->getTarget(); 490 TargetLowering *Target = Func->getTarget();
491 LoweringContext &Context = Target->getContext(); 491 LoweringContext &Context = Target->getContext();
492 Context.init(this); 492 Context.init(this);
493 Context.setInsertPoint(Context.getCur());
494 // Do not insert nop in bundle locked instructions.
495 bool PauseNopInsertion = false;
493 while (!Context.atEnd()) { 496 while (!Context.atEnd()) {
494 Target->doNopInsertion(); 497 if (llvm::isa<InstBundleLock>(Context.getCur())) {
498 PauseNopInsertion = true;
499 } else if (llvm::isa<InstBundleUnlock>(Context.getCur())) {
500 PauseNopInsertion = false;
501 }
502 if (!PauseNopInsertion)
503 Target->doNopInsertion();
jvoung (off chromium) 2015/07/29 18:09:18 On BundleUnlock what happens? Does it insert nops
qining 2015/07/29 23:04:40 On BundleUnlock, we resume nop insertion. At that
495 // Ensure Cur=Next, so that the nops are inserted before the current 504 // Ensure Cur=Next, so that the nops are inserted before the current
496 // instruction rather than after. 505 // instruction rather than after.
506 Context.advanceCur();
497 Context.advanceNext(); 507 Context.advanceNext();
498 Context.advanceCur();
499 } 508 }
500 // Insert before all instructions.
501 Context.setInsertPoint(getInsts().begin());
502 Context.advanceNext();
503 Context.advanceCur();
504 Target->doNopInsertion();
505 } 509 }
506 510
507 // Drives the target lowering. Passes the current instruction and the 511 // Drives the target lowering. Passes the current instruction and the
508 // next non-deleted instruction for target lowering. 512 // next non-deleted instruction for target lowering.
509 void CfgNode::genCode() { 513 void CfgNode::genCode() {
510 TargetLowering *Target = Func->getTarget(); 514 TargetLowering *Target = Func->getTarget();
511 LoweringContext &Context = Target->getContext(); 515 LoweringContext &Context = Target->getContext();
512 // Lower the regular instructions. 516 // Lower the regular instructions.
513 Context.init(this); 517 Context.init(this);
514 Target->initNodeForLowering(this); 518 Target->initNodeForLowering(this);
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 InstIntrinsicCall *Inst = InstIntrinsicCall::create( 1270 InstIntrinsicCall *Inst = InstIntrinsicCall::create(
1267 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); 1271 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info);
1268 Inst->addArg(AtomicRMWOp); 1272 Inst->addArg(AtomicRMWOp);
1269 Inst->addArg(Counter); 1273 Inst->addArg(Counter);
1270 Inst->addArg(One); 1274 Inst->addArg(One);
1271 Inst->addArg(OrderAcquireRelease); 1275 Inst->addArg(OrderAcquireRelease);
1272 Insts.push_front(Inst); 1276 Insts.push_front(Inst);
1273 } 1277 }
1274 1278
1275 } // end of namespace Ice 1279 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698