private bool IsStackStorageOfPreservedRegister( SsaState ssa, HashSet <RegisterStorage> trashedRegisters, CallBinding use) { if (!(use.Storage is StackStorage)) { return(false); } if (!(use.Expression is Identifier id)) { return(false); } if (!(ssa.Identifiers[id].IsOriginal)) { return(false); } if (!IsPreservedRegister(trashedRegisters, id.Storage)) { return(false); } return(true); }
public void Pflow_IntersectBinding_NotFoundUses() { var reg = new RegisterStorage("r1", 1, 0, PrimitiveType.Word32); var stCallee = new StackArgumentStorage(4, PrimitiveType.Word32); var id = new Identifier("r1", reg.DataType, reg); var cbs = new CallBinding[] { }; var uses = new Dictionary <Storage, BitRange> { { reg, new BitRange(0, 31) }, { stCallee, new BitRange(0, 31) }, }; var bindings = ProcedureFlow.IntersectCallBindingsWithUses(cbs, uses) .ToArray(); Assert.AreEqual(0, bindings.Length); }
private void SetReturnExpression( SsaState ssa, Block block, Identifier idRet, CallBinding idStg) { var e = idStg?.Expression ?? Constant.Invalid; for (int i = block.Statements.Count - 1; i >= 0; --i) { var stm = block.Statements[i]; if (stm.Instruction is ReturnInstruction ret) { if (idStg != null && idRet.DataType.BitSize < e.DataType.BitSize) { int offset = idStg !.Storage.OffsetOf(idRet.Storage); e = new Slice(idRet.DataType, e, offset); } ret.Expression = e; ssa.AddUses(stm); } } }
public async Task <IActionResult> Post([FromBody] CallBinding binding) => Ok(await _callHandler.Create(binding));