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

Method GetInstSize

IDEHelper/Compiler/CeMachine.cpp:9657–9720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9655#define CE_SIZE_GET(T) *((T*)(ptr += sizeof(T)) - 1)
9656
9657int CeMachine::GetInstSize(CeFunction* ceFunction, int instIdx)
9658{
9659 auto ptr = &ceFunction->mCode[instIdx];
9660 auto startPtr = ptr;
9661
9662 auto _HandleOperand = [&](CeOperandInfoKind kind)
9663 {
9664 switch (kind)
9665 {
9666 case CEOI_FrameRef:
9667 case CEOI_FrameRef8:
9668 case CEOI_FrameRef16:
9669 case CEOI_FrameRef32:
9670 case CEOI_FrameRef64:
9671 case CEOI_FrameRefF32:
9672 case CEOI_FrameRefF64:
9673 ptr += 4;
9674 break;
9675 case CEOI_IMM8:
9676 ptr += 1;
9677 break;
9678 case CEOI_IMM16:
9679 ptr += 2;
9680 break;
9681 case CEOI_IMM32:
9682 ptr += 4;
9683 break;
9684 case CEOI_IMM64:
9685 ptr += 8;
9686 break;
9687 case CEOI_IMM_VAR:
9688 {
9689 int32 size = CE_SIZE_GET(int32);
9690 ptr += size;
9691 }
9692 break;
9693 case CEOI_JMPREL:
9694 ptr += 4;
9695 break;
9696 default:
9697 BF_ASSERT("Unhandled");
9698 }
9699 };
9700
9701 auto op = CE_SIZE_GET(CeOp);
9702
9703 if (op == CeOp_DbgBreak)
9704 {
9705 CeBreakpointBind* breakpointEntry = NULL;
9706 if (ceFunction->mBreakpoints.TryGetValue(instIdx, &breakpointEntry))
9707 op = breakpointEntry->mPrevOpCode;
9708 }
9709
9710 CeOpInfo& opInfo = gOpInfo[op];
9711
9712 _HandleOperand(opInfo.mResultKind);
9713 if ((opInfo.mFlags & CeOpInfoFlag_SizeX) != 0)
9714 ptr += 4;

Callers 1

UpdateBreakpointsMethod · 0.80

Calls 1

TryGetValueMethod · 0.80

Tested by

no test coverage detected