MCPcopy Create free account
hub / github.com/beefytech/Beef / EmitAppendAlign

Method EmitAppendAlign

IDEHelper/Compiler/BfModule.cpp:490–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 3

GetConstValueMethod · 0.80
GetConstantMethod · 0.45
EmitAppendAlignMethod · 0.45

Tested by

no test coverage detected