OLD | NEW |
1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// | 1 //===- subzero/src/IceCfg.cpp - Control flow graph 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 llvm::dyn_cast<ConstantInteger32>(Alloca->getSizeInBytes()); | 477 llvm::dyn_cast<ConstantInteger32>(Alloca->getSizeInBytes()); |
478 uint32_t Size = Utils::applyAlignment(ConstSize->getValue(), Alignment); | 478 uint32_t Size = Utils::applyAlignment(ConstSize->getValue(), Alignment); |
479 if (BaseVariableType == BVT_FramePointer) { | 479 if (BaseVariableType == BVT_FramePointer) { |
480 // Addressing is relative to the frame pointer. Subtract the offset after | 480 // Addressing is relative to the frame pointer. Subtract the offset after |
481 // adding the size of the alloca, because it grows downwards from the | 481 // adding the size of the alloca, because it grows downwards from the |
482 // frame pointer. | 482 // frame pointer. |
483 Offsets.push_back(-(CurrentOffset + Size)); | 483 Offsets.push_back(-(CurrentOffset + Size)); |
484 } else { | 484 } else { |
485 // Addressing is relative to the stack pointer or to a user pointer. Add | 485 // Addressing is relative to the stack pointer or to a user pointer. Add |
486 // the offset before adding the size of the object, because it grows | 486 // the offset before adding the size of the object, because it grows |
487 // upwards from the stack pointer. | 487 // upwards from the stack pointer. In addition, if the addressing is |
488 Offsets.push_back(CurrentOffset); | 488 // relative to the stack pointer, we need to add the pre-computed max out |
| 489 // args size bytes. |
| 490 const uint32_t OutArgsOffsetOrZero = |
| 491 (BaseVariableType == BVT_StackPointer) |
| 492 ? getTarget()->maxOutArgsSizeBytes() |
| 493 : 0; |
| 494 Offsets.push_back(CurrentOffset + OutArgsOffsetOrZero); |
489 } | 495 } |
490 // Update the running offset of the fused alloca region. | 496 // Update the running offset of the fused alloca region. |
491 CurrentOffset += Size; | 497 CurrentOffset += Size; |
492 } | 498 } |
493 // Round the offset up to the alignment granularity to use as the size. | 499 // Round the offset up to the alignment granularity to use as the size. |
494 uint32_t TotalSize = Utils::applyAlignment(CurrentOffset, CombinedAlignment); | 500 uint32_t TotalSize = Utils::applyAlignment(CurrentOffset, CombinedAlignment); |
495 // Ensure every alloca was assigned an offset. | 501 // Ensure every alloca was assigned an offset. |
496 assert(Allocas.size() == Offsets.size()); | 502 assert(Allocas.size() == Offsets.size()); |
497 | 503 |
498 switch (BaseVariableType) { | 504 switch (BaseVariableType) { |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 } | 1096 } |
1091 } | 1097 } |
1092 // Print each basic block | 1098 // Print each basic block |
1093 for (CfgNode *Node : Nodes) | 1099 for (CfgNode *Node : Nodes) |
1094 Node->dump(this); | 1100 Node->dump(this); |
1095 if (isVerbose(IceV_Instructions)) | 1101 if (isVerbose(IceV_Instructions)) |
1096 Str << "}\n"; | 1102 Str << "}\n"; |
1097 } | 1103 } |
1098 | 1104 |
1099 } // end of namespace Ice | 1105 } // end of namespace Ice |
OLD | NEW |