コード例 #1
0
bool AsmCmd1::operateWith(AsmArg* a) const
{
	AsmArgIndirect* ind = dynamic_cast<AsmArgIndirect*>(a);
	AsmArgRegister* reg = dynamic_cast<AsmArgRegister*>(arg);
	if (ind && reg)
		return ind->usesRegister(reg->reg);
	else
		return *arg == a;
}
コード例 #2
0
bool AsmCmd2::operateWith(AsmArg* a) const
{
	AsmArgIndirect* ind = dynamic_cast<AsmArgIndirect*>(a);
	AsmArgRegister* reg1 = dynamic_cast<AsmArgRegister*>(arg1);
	AsmArgRegister* reg2 = dynamic_cast<AsmArgRegister*>(arg2);
	if (ind && (reg1 || reg2))
		return (reg1 ? ind->usesRegister(reg1->reg) : 0) || (reg2 ? ind->usesRegister(reg2->reg) : 0);
	else
		return *arg1 == a || *arg2 == a;
}
コード例 #3
0
static bool IsArgument(AsmArg* arg, AsmCmd* cmd)
{
    AsmCmd2* binaryOpCode = dynamic_cast<AsmCmd2*>(cmd);
    AsmCmd1* unaryOpCode = dynamic_cast<AsmCmd1*>(cmd);
    if (binaryOpCode)
    {
        AsmArgIndirect* ind = dynamic_cast<AsmArgIndirect*>(arg);
        AsmArgIndirect* ind1 = dynamic_cast<AsmArgIndirect*>(binaryOpCode->GetFirst());
        AsmArgIndirect* ind2 = dynamic_cast<AsmArgIndirect*>(binaryOpCode->GetSecond());
        return ind && ind->usesRegister(binaryOpCode->GetFirst()) || ind && ind->usesRegister(binaryOpCode->GetSecond())
            || ind1 && ind1->usesRegister(arg) || ind2 && ind2->usesRegister(arg)
            || *binaryOpCode->GetFirst() == arg || *binaryOpCode->GetSecond() == arg;
    }
    else if (unaryOpCode)
    {
        AsmArgIndirect* ind = dynamic_cast<AsmArgIndirect*>(arg);
        AsmArgIndirect* ind1 = dynamic_cast<AsmArgIndirect*>(unaryOpCode->GetArgument());
        return ind && ind->usesRegister(unaryOpCode->GetArgument())
            || ind1 && ind1->usesRegister(arg)
            || *unaryOpCode->GetArgument() == arg
            || *arg == ESP || *arg == EBP;
    }
    return false;
}