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

Method EmitConst

IDEHelper/Compiler/CeMachine.cpp:1419–1446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1417}
1418
1419CeOperand CeBuilder::EmitConst(int64 val, int size)
1420{
1421 BeType* type = mIntPtrType;
1422 switch (size)
1423 {
1424 case 1:
1425 type = mCeMachine->GetBeContext()->GetPrimitiveType(BeTypeCode_Int8);
1426 break;
1427 case 2:
1428 type = mCeMachine->GetBeContext()->GetPrimitiveType(BeTypeCode_Int16);
1429 break;
1430 case 4:
1431 type = mCeMachine->GetBeContext()->GetPrimitiveType(BeTypeCode_Int32);
1432 break;
1433 case 8:
1434 type = mCeMachine->GetBeContext()->GetPrimitiveType(BeTypeCode_Int64);
1435 break;
1436 default:
1437 Fail("Bad const size");
1438 }
1439
1440 auto result = FrameAlloc(type);
1441
1442 EmitSizedOp(CeOp_Const_8, type->mSize);
1443 EmitFrameOffset(result);
1444 Emit(&val, size);
1445 return result;
1446}
1447
1448int CeBuilder::GetCallTableIdx(BeFunction* beFunction, CeOperand* outOperand)
1449{

Callers

nothing calls this directly

Calls 3

FailFunction · 0.85
GetBeContextMethod · 0.80
GetPrimitiveTypeMethod · 0.45

Tested by

no test coverage detected