1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Arithmetic overflow checks

This commit is contained in:
Brian Fiete 2022-01-11 08:17:09 -05:00
parent 1f0d2dcc82
commit eb375362a1
29 changed files with 503 additions and 87 deletions

View file

@ -1683,6 +1683,8 @@ void BeDumpContext::ToString(StringImpl& str, BeCmpKind cmpKind)
case BeCmpKind_UGT: str += "ugt"; return;
case BeCmpKind_SGE: str += "sge"; return;
case BeCmpKind_UGE: str += "uge"; return;
case BeCmpKind_NB: str += "nb"; return;
case BeCmpKind_NO: str += "no"; return;
default:
str += "???";
}
@ -3292,7 +3294,7 @@ BeCmpInst* BeModule::CreateCmp(BeCmpKind cmpKind, BeValue* lhs, BeValue* rhs)
return inst;
}
BeBinaryOpInst* BeModule::CreateBinaryOp(BeBinaryOpKind opKind, BeValue* lhs, BeValue* rhs)
BeBinaryOpInst* BeModule::CreateBinaryOp(BeBinaryOpKind opKind, BeValue* lhs, BeValue* rhs, BfOverflowCheckKind overflowCheckKind)
{
#ifdef _DEBUG
auto leftType = lhs->GetType();
@ -3303,6 +3305,7 @@ BeBinaryOpInst* BeModule::CreateBinaryOp(BeBinaryOpKind opKind, BeValue* lhs, Be
inst->mOpKind = opKind;
inst->mLHS = lhs;
inst->mRHS = rhs;
inst->mOverflowCheckKind = overflowCheckKind;
AddInst(inst);
return inst;
}