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

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri May 15 11:50:34 PDT 2009


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.  
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







More information about the llvm-commits mailing list