OLD | NEW |
---|---|
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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // Nop insertion | 398 // Nop insertion |
399 if (shouldDoNopInsertion()) { | 399 if (shouldDoNopInsertion()) { |
400 Func->doNopInsertion(); | 400 Func->doNopInsertion(); |
401 } | 401 } |
402 | |
403 // Branch optimization. This needs to be done just before code | |
jvoung (off chromium)
2014/09/18 03:56:02
Should this be before nop insertion? I don't think
Jim Stichnoth
2014/09/18 11:45:51
Good point, done.
| |
404 // emission. In particular, no transformations that insert or | |
405 // reorder CfgNodes should be done after branch optimization. | |
406 Func->doBranchOpt(); | |
407 Func->dump("After branch optimization"); | |
402 } | 408 } |
403 | 409 |
404 void TargetX8632::translateOm1() { | 410 void TargetX8632::translateOm1() { |
405 GlobalContext *Context = Func->getContext(); | 411 GlobalContext *Context = Func->getContext(); |
406 Timer T_placePhiLoads; | 412 Timer T_placePhiLoads; |
407 Func->placePhiLoads(); | 413 Func->placePhiLoads(); |
408 if (Func->hasError()) | 414 if (Func->hasError()) |
409 return; | 415 return; |
410 T_placePhiLoads.printElapsedUs(Context, "placePhiLoads()"); | 416 T_placePhiLoads.printElapsedUs(Context, "placePhiLoads()"); |
411 Timer T_placePhiStores; | 417 Timer T_placePhiStores; |
(...skipping 25 matching lines...) Expand all Loading... | |
437 return; | 443 return; |
438 T_genFrame.printElapsedUs(Context, "genFrame()"); | 444 T_genFrame.printElapsedUs(Context, "genFrame()"); |
439 Func->dump("After stack frame mapping"); | 445 Func->dump("After stack frame mapping"); |
440 | 446 |
441 // Nop insertion | 447 // Nop insertion |
442 if (shouldDoNopInsertion()) { | 448 if (shouldDoNopInsertion()) { |
443 Func->doNopInsertion(); | 449 Func->doNopInsertion(); |
444 } | 450 } |
445 } | 451 } |
446 | 452 |
453 void TargetX8632::doBranchOpt(Inst *I, const CfgNode *NextNode) { | |
454 if (InstX8632Br *Br = llvm::dyn_cast<InstX8632Br>(I)) { | |
455 Br->optimizeBranch(NextNode); | |
456 } | |
457 } | |
458 | |
447 IceString TargetX8632::RegNames[] = { | 459 IceString TargetX8632::RegNames[] = { |
448 #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \ | 460 #define X(val, init, name, name16, name8, scratch, preserved, stackptr, \ |
449 frameptr, isI8, isInt, isFP) \ | 461 frameptr, isI8, isInt, isFP) \ |
450 name, | 462 name, |
451 REGX8632_TABLE | 463 REGX8632_TABLE |
452 #undef X | 464 #undef X |
453 }; | 465 }; |
454 | 466 |
455 Variable *TargetX8632::getPhysicalRegister(SizeT RegNum) { | 467 Variable *TargetX8632::getPhysicalRegister(SizeT RegNum) { |
456 assert(RegNum < PhysicalRegisters.size()); | 468 assert(RegNum < PhysicalRegisters.size()); |
(...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4534 Str << "\t.align\t" << Align << "\n"; | 4546 Str << "\t.align\t" << Align << "\n"; |
4535 Str << MangledName << ":\n"; | 4547 Str << MangledName << ":\n"; |
4536 for (SizeT i = 0; i < Size; ++i) { | 4548 for (SizeT i = 0; i < Size; ++i) { |
4537 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; | 4549 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; |
4538 } | 4550 } |
4539 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; | 4551 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; |
4540 } | 4552 } |
4541 } | 4553 } |
4542 | 4554 |
4543 } // end of namespace Ice | 4555 } // end of namespace Ice |
OLD | NEW |