| 488 | } |
| 489 | |
| 490 | void EmitAppendAlign(int align, int sizeMultiple = 0) |
| 491 | { |
| 492 | if (align <= 1) |
| 493 | return; |
| 494 | |
| 495 | if (mIsFirstConstPass) |
| 496 | mModule->mCurMethodInstance->mAppendAllocAlign = BF_MAX((int)mModule->mCurMethodInstance->mAppendAllocAlign, align); |
| 497 | |
| 498 | if (sizeMultiple == 0) |
| 499 | sizeMultiple = align; |
| 500 | if (mCurAppendAlign == 0) |
| 501 | mCurAppendAlign = sizeMultiple; |
| 502 | else |
| 503 | { |
| 504 | if (sizeMultiple % align == 0) |
| 505 | mCurAppendAlign = align; |
| 506 | else |
| 507 | mCurAppendAlign = sizeMultiple % align; |
| 508 | } |
| 509 | |
| 510 | BF_ASSERT(mCurAppendAlign > 0); |
| 511 | |
| 512 | if (mConstAccum) |
| 513 | { |
| 514 | auto constant = mModule->mBfIRBuilder->GetConstant(mConstAccum.mValue); |
| 515 | if (constant != NULL) |
| 516 | mConstAccum.mValue = mModule->GetConstValue(BF_ALIGN(constant->mInt64, align)); |
| 517 | else |
| 518 | BF_ASSERT(mIsFirstConstPass); |
| 519 | return; |
| 520 | } |
| 521 | |
| 522 | mModule->EmitAppendAlign(align, sizeMultiple); |
| 523 | } |
| 524 | |
| 525 | void Visit(BfAstNode* astNode) override |
| 526 | { |
nothing calls this directly
no test coverage detected