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

Method EmitBinaryOp

IDEHelper/Compiler/CeMachine.cpp:1038–1073  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1036}
1037
1038void CeBuilder::EmitBinaryOp(CeOp iOp, CeOp fOp, const CeOperand& lhs, const CeOperand& rhs, CeOperand& result)
1039{
1040 CeOp op = iOp;
1041 if (lhs.mType->IsIntable())
1042 {
1043 if (lhs.mType->mSize == 1)
1044 op = iOp;
1045 else if (lhs.mType->mSize == 2)
1046 op = (CeOp)(iOp + 1);
1047 else if (lhs.mType->mSize == 4)
1048 op = (CeOp)(iOp + 2);
1049 else if (lhs.mType->mSize == 8)
1050 op = (CeOp)(iOp + 3);
1051 else
1052 Fail("Invalid int operand size");
1053 }
1054 else if (lhs.mType->IsFloat())
1055 {
1056 BF_ASSERT(fOp != CeOp_InvalidOp);
1057 if (lhs.mType->mSize == 4)
1058 op = fOp;
1059 else if (lhs.mType->mSize == 8)
1060 op = (CeOp)(fOp + 1);
1061 else
1062 Fail("Invalid float operand size");
1063 }
1064 else
1065 Fail("Invalid binary operand");
1066 Emit(op);
1067
1068 if (!result)
1069 result = FrameAlloc(lhs.mType);
1070 EmitFrameOffset(result);
1071 EmitFrameOffset(lhs);
1072 EmitFrameOffset(rhs);
1073}
1074
1075CeOperand CeBuilder::EmitNumericCast(const CeOperand& ceValue, BeType* toType, bool valSigned, bool toSigned)
1076{

Callers

nothing calls this directly

Calls 3

FailFunction · 0.85
IsIntableMethod · 0.45
IsFloatMethod · 0.45

Tested by

no test coverage detected