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

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 580903005: Subzero: Add branch optimization. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 6 years, 3 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/IceTargetLoweringX8632.h ('k') | src/PNaClTranslator.cpp » ('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/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===//
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 // This file implements the TargetLoweringX8632 class, which 10 // This file implements the TargetLoweringX8632 class, which
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 Func->dump("After linear scan regalloc"); 388 Func->dump("After linear scan regalloc");
389 389
390 // Stack frame mapping. 390 // Stack frame mapping.
391 Timer T_genFrame; 391 Timer T_genFrame;
392 Func->genFrame(); 392 Func->genFrame();
393 if (Func->hasError()) 393 if (Func->hasError())
394 return; 394 return;
395 T_genFrame.printElapsedUs(Context, "genFrame()"); 395 T_genFrame.printElapsedUs(Context, "genFrame()");
396 Func->dump("After stack frame mapping"); 396 Func->dump("After stack frame mapping");
397 397
398 // Branch optimization. This needs to be done just before code
399 // emission. In particular, no transformations that insert or
400 // reorder CfgNodes should be done after branch optimization. We go
401 // ahead and do it before nop insertion to reduce the amount of work
402 // needed for searching for opportunities.
403 Func->doBranchOpt();
404 Func->dump("After branch optimization");
405
398 // Nop insertion 406 // Nop insertion
399 if (shouldDoNopInsertion()) { 407 if (shouldDoNopInsertion()) {
400 Func->doNopInsertion(); 408 Func->doNopInsertion();
401 } 409 }
402 } 410 }
403 411
404 void TargetX8632::translateOm1() { 412 void TargetX8632::translateOm1() {
405 GlobalContext *Context = Func->getContext(); 413 GlobalContext *Context = Func->getContext();
406 Timer T_placePhiLoads; 414 Timer T_placePhiLoads;
407 Func->placePhiLoads(); 415 Func->placePhiLoads();
(...skipping 29 matching lines...) Expand all
437 return; 445 return;
438 T_genFrame.printElapsedUs(Context, "genFrame()"); 446 T_genFrame.printElapsedUs(Context, "genFrame()");
439 Func->dump("After stack frame mapping"); 447 Func->dump("After stack frame mapping");
440 448
441 // Nop insertion 449 // Nop insertion
442 if (shouldDoNopInsertion()) { 450 if (shouldDoNopInsertion()) {
443 Func->doNopInsertion(); 451 Func->doNopInsertion();
444 } 452 }
445 } 453 }
446 454
455 bool TargetX8632::doBranchOpt(Inst *I, const CfgNode *NextNode) {
456 if (InstX8632Br *Br = llvm::dyn_cast<InstX8632Br>(I)) {
457 return Br->optimizeBranch(NextNode);
458 }
459 return false;
460 }
461
447 IceString TargetX8632::RegNames[] = { 462 IceString TargetX8632::RegNames[] = {
448 #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \ 463 #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \
449 frameptr, isI8, isInt, isFP) \ 464 frameptr, isI8, isInt, isFP) \
450 name, 465 name,
451 REGX8632_TABLE 466 REGX8632_TABLE
452 #undef X 467 #undef X
453 }; 468 };
454 469
455 Variable *TargetX8632::getPhysicalRegister(SizeT RegNum) { 470 Variable *TargetX8632::getPhysicalRegister(SizeT RegNum) {
456 assert(RegNum < PhysicalRegisters.size()); 471 assert(RegNum < PhysicalRegisters.size());
(...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after
4534 Str << "\t.align\t" << Align << "\n"; 4549 Str << "\t.align\t" << Align << "\n";
4535 Str << MangledName << ":\n"; 4550 Str << MangledName << ":\n";
4536 for (SizeT i = 0; i < Size; ++i) { 4551 for (SizeT i = 0; i < Size; ++i) {
4537 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; 4552 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n";
4538 } 4553 }
4539 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; 4554 Str << "\t.size\t" << MangledName << ", " << Size << "\n";
4540 } 4555 }
4541 } 4556 }
4542 4557
4543 } // end of namespace Ice 4558 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.h ('k') | src/PNaClTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698