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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 LocalsSize[NodeIndex] += Increment; | 338 LocalsSize[NodeIndex] += Increment; |
339 if (LocalsSize[NodeIndex] > *SpillAreaSizeBytes) | 339 if (LocalsSize[NodeIndex] > *SpillAreaSizeBytes) |
340 *SpillAreaSizeBytes = LocalsSize[NodeIndex]; | 340 *SpillAreaSizeBytes = LocalsSize[NodeIndex]; |
341 if (!*LocalsSlotsAlignmentBytes) | 341 if (!*LocalsSlotsAlignmentBytes) |
342 *LocalsSlotsAlignmentBytes = Increment; | 342 *LocalsSlotsAlignmentBytes = Increment; |
343 } | 343 } |
344 } else { | 344 } else { |
345 *SpillAreaSizeBytes += Increment; | 345 *SpillAreaSizeBytes += Increment; |
346 } | 346 } |
347 } | 347 } |
348 // For testing legalization of large stack offsets on targets with limited | |
349 // offset bits in instruction encodings, add some padding. | |
350 *SpillAreaSizeBytes += Ctx->getFlags().getTestStackExtra(); | |
348 } | 351 } |
349 | 352 |
350 void TargetLowering::alignStackSpillAreas(uint32_t SpillAreaStartOffset, | 353 void TargetLowering::alignStackSpillAreas(uint32_t SpillAreaStartOffset, |
351 uint32_t SpillAreaAlignmentBytes, | 354 uint32_t SpillAreaAlignmentBytes, |
352 size_t GlobalsSize, | 355 size_t GlobalsSize, |
353 uint32_t LocalsSlotsAlignmentBytes, | 356 uint32_t LocalsSlotsAlignmentBytes, |
354 uint32_t *SpillAreaPaddingBytes, | 357 uint32_t *SpillAreaPaddingBytes, |
355 uint32_t *LocalsSlotsPaddingBytes) { | 358 uint32_t *LocalsSlotsPaddingBytes) { |
356 if (SpillAreaAlignmentBytes) { | 359 if (SpillAreaAlignmentBytes) { |
357 uint32_t PaddingStart = SpillAreaStartOffset; | 360 uint32_t PaddingStart = SpillAreaStartOffset; |
(...skipping 11 matching lines...) Expand all Loading... | |
369 *LocalsSlotsPaddingBytes = GlobalsAndSubsequentPaddingSize - GlobalsSize; | 372 *LocalsSlotsPaddingBytes = GlobalsAndSubsequentPaddingSize - GlobalsSize; |
370 } | 373 } |
371 } | 374 } |
372 | 375 |
373 void TargetLowering::assignVarStackSlots(VarList &SortedSpilledVariables, | 376 void TargetLowering::assignVarStackSlots(VarList &SortedSpilledVariables, |
374 size_t SpillAreaPaddingBytes, | 377 size_t SpillAreaPaddingBytes, |
375 size_t SpillAreaSizeBytes, | 378 size_t SpillAreaSizeBytes, |
376 size_t GlobalsAndSubsequentPaddingSize, | 379 size_t GlobalsAndSubsequentPaddingSize, |
377 bool UsesFramePointer) { | 380 bool UsesFramePointer) { |
378 const VariablesMetadata *VMetadata = Func->getVMetadata(); | 381 const VariablesMetadata *VMetadata = Func->getVMetadata(); |
382 // For testing legalization of large stack offsets on targets with limited | |
383 // offset bits in instruction encodings, add some padding. This assumes that | |
384 // SpillAreaSizeBytes has accounted for the extra test padding. | |
385 // When UseFramePointer is true, the offset depends on the padding, | |
386 // not just the SpillAreaSizeBytes. On the other hand, when UseFramePointer | |
387 // is false, the offsets depend on the gap between SpillAreaSizeBytes | |
388 // and SpillAreaPaddingBytes, so we don't increment that. | |
389 size_t TestPadding = Ctx->getFlags().getTestStackExtra(); | |
390 if (TestPadding && UsesFramePointer) | |
Jim Stichnoth
2015/07/24 22:08:29
Maybe just remove "TestPadding && " ?
jvoung (off chromium)
2015/07/27 17:02:57
Done.
| |
391 SpillAreaPaddingBytes += TestPadding; | |
379 size_t GlobalsSpaceUsed = SpillAreaPaddingBytes; | 392 size_t GlobalsSpaceUsed = SpillAreaPaddingBytes; |
380 size_t NextStackOffset = SpillAreaPaddingBytes; | 393 size_t NextStackOffset = SpillAreaPaddingBytes; |
381 std::vector<size_t> LocalsSize(Func->getNumNodes()); | 394 std::vector<size_t> LocalsSize(Func->getNumNodes()); |
382 const bool SimpleCoalescing = !callsReturnsTwice(); | 395 const bool SimpleCoalescing = !callsReturnsTwice(); |
396 | |
383 for (Variable *Var : SortedSpilledVariables) { | 397 for (Variable *Var : SortedSpilledVariables) { |
384 size_t Increment = typeWidthInBytesOnStack(Var->getType()); | 398 size_t Increment = typeWidthInBytesOnStack(Var->getType()); |
385 if (SimpleCoalescing && VMetadata->isTracked(Var)) { | 399 if (SimpleCoalescing && VMetadata->isTracked(Var)) { |
386 if (VMetadata->isMultiBlock(Var)) { | 400 if (VMetadata->isMultiBlock(Var)) { |
387 GlobalsSpaceUsed += Increment; | 401 GlobalsSpaceUsed += Increment; |
388 NextStackOffset = GlobalsSpaceUsed; | 402 NextStackOffset = GlobalsSpaceUsed; |
389 } else { | 403 } else { |
390 SizeT NodeIndex = VMetadata->getLocalUseNode(Var)->getIndex(); | 404 SizeT NodeIndex = VMetadata->getLocalUseNode(Var)->getIndex(); |
391 LocalsSize[NodeIndex] += Increment; | 405 LocalsSize[NodeIndex] += Increment; |
392 NextStackOffset = SpillAreaPaddingBytes + | 406 NextStackOffset = SpillAreaPaddingBytes + |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
565 if (Target == Target_##X) \ | 579 if (Target == Target_##X) \ |
566 return TargetHeader##X::create(Ctx); | 580 return TargetHeader##X::create(Ctx); |
567 #include "llvm/Config/SZTargets.def" | 581 #include "llvm/Config/SZTargets.def" |
568 | 582 |
569 llvm::report_fatal_error("Unsupported target header lowering"); | 583 llvm::report_fatal_error("Unsupported target header lowering"); |
570 } | 584 } |
571 | 585 |
572 TargetHeaderLowering::~TargetHeaderLowering() = default; | 586 TargetHeaderLowering::~TargetHeaderLowering() = default; |
573 | 587 |
574 } // end of namespace Ice | 588 } // end of namespace Ice |
OLD | NEW |