OLD | NEW |
1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// | 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 // function. In that case, basic blocks may be revisited, and variables local | 356 // function. In that case, basic blocks may be revisited, and variables local |
357 // to those basic blocks are actually live until after the called function | 357 // to those basic blocks are actually live until after the called function |
358 // returns a second time. | 358 // returns a second time. |
359 const bool SimpleCoalescing = !callsReturnsTwice(); | 359 const bool SimpleCoalescing = !callsReturnsTwice(); |
360 | 360 |
361 std::vector<size_t> LocalsSize(Func->getNumNodes()); | 361 std::vector<size_t> LocalsSize(Func->getNumNodes()); |
362 const VarList &Variables = Func->getVariables(); | 362 const VarList &Variables = Func->getVariables(); |
363 VarList SpilledVariables; | 363 VarList SpilledVariables; |
364 for (Variable *Var : Variables) { | 364 for (Variable *Var : Variables) { |
365 if (Var->hasReg()) { | 365 if (Var->hasReg()) { |
366 RegsUsed[Var->getRegNum()] = true; | 366 // Don't consider a rematerializable variable to be an actual register use |
| 367 // (specifically of the frame pointer). Otherwise, the prolog may decide |
| 368 // to save the frame pointer twice - once because of the explicit need for |
| 369 // a frame pointer, and once because of an active use of a callee-save |
| 370 // register. |
| 371 if (!Var->isRematerializable()) |
| 372 RegsUsed[Var->getRegNum()] = true; |
367 continue; | 373 continue; |
368 } | 374 } |
369 // An argument either does not need a stack slot (if passed in a register) | 375 // An argument either does not need a stack slot (if passed in a register) |
370 // or already has one (if passed on the stack). | 376 // or already has one (if passed on the stack). |
371 if (Var->getIsArg()) | 377 if (Var->getIsArg()) |
372 continue; | 378 continue; |
373 // An unreferenced variable doesn't need a stack slot. | 379 // An unreferenced variable doesn't need a stack slot. |
374 if (!IsVarReferenced[Var->getIndex()]) | 380 if (!IsVarReferenced[Var->getIndex()]) |
375 continue; | 381 continue; |
376 // Check a target-specific variable (it may end up sharing stack slots) and | 382 // Check a target-specific variable (it may end up sharing stack slots) and |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 if (Target == Target_##X) \ | 649 if (Target == Target_##X) \ |
644 return TargetHeader##X::create(Ctx); | 650 return TargetHeader##X::create(Ctx); |
645 #include "llvm/Config/SZTargets.def" | 651 #include "llvm/Config/SZTargets.def" |
646 | 652 |
647 llvm::report_fatal_error("Unsupported target header lowering"); | 653 llvm::report_fatal_error("Unsupported target header lowering"); |
648 } | 654 } |
649 | 655 |
650 TargetHeaderLowering::~TargetHeaderLowering() = default; | 656 TargetHeaderLowering::~TargetHeaderLowering() = default; |
651 | 657 |
652 } // end of namespace Ice | 658 } // end of namespace Ice |
OLD | NEW |