[llvm-commits] [PATCH] Machine code verifier pass

Evan Cheng evan.cheng at apple.com
Fri May 15 14:30:02 PDT 2009



On May 15, 2009, at 11:50 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk>  
wrote:

>
> On 15/05/2009, at 19.44, Evan Cheng wrote:
>> There shouldn't be any *real* double defs. However, a def of EAX
>> followed by def of a sub-register, e.g. AX, is totally legal.
>
> Ouch, that means I misunderstood how sub-registers work. I assumed
> that def of EAX implied def of AX so a second def would be illegal.

No that's right. Def of EAX does imply def of AX. But you can then  
update a part of EAX (read mod write). I think livevariables would add  
a implict kill of the subreg. But it's unclear whether all passes  
would do the same.

Evan
>
> Let me try again:
>
> A physical register has three states:
>
> Dead: Following use-kill and def-dead.
> Live: Following def.
> Zombie: Dead but with live super-register.
>
> The following operations are legal in each state:
>
> Dead: def, def-dead
> Live: use, use-kill
> Zombie: def, def-dead, use
>
> You cannot kill a zombie.
>
> I will change the verifier to use these semantics instead.
>
>> +        if (MI->isRegTiedToDefOperand(MONum, &defIdx) &&
>> +            MI->getOperand(defIdx).getReg() == Reg)
>> +          regsKilled.push_back(Reg);
>> +      }
>>
>> llvm uses this style instead:
>> } else {
>
> Fixed
>
>> Also, if check for "MI->getOperand(defIdx).getReg() == Reg" is  
>> cheaper
>> than isRegTiedToDefOperand, so it should go first.
>
> That won't work -- defIdx is returned by isRegTiedToDefOperand().
>
> I will run a bunch of tests with the new sub-register semantics. Then
> I commit.
>
> /jakob
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list