[LLVMdev] Marking implicit registers as "trashed"

Martin J. O'Riordan Martin.ORiordan at movidius.com
Tue Dec 23 02:38:16 PST 2014


Thanks Tim.  Yes, I guess I was a bit nervous that the flags might be implicitly used "as-if" they were valid.

All the best,

	MartinO

-----Original Message-----
From: Tim Northover [mailto:t.p.northover at gmail.com] 
Sent: 22 December 2014 17:18
To: Martin J. O'Riordan
Cc: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Marking implicit registers as "trashed"

> The 'Uses = [...]' and 'Defs = [...]', but I would like something like 
> 'Trash = [...]' to say that the register is changed, but the change is 
> meaningless.
>
> Does anyone have any suggestions as to how I should approach this kind 
> of semantic?

This is expressed by a Def that isn't actually used by anything, usually expressed <def,dead> in debug printouts. So as long as you don't try to make use of those flags during ISel you should be fine.

For example, most x86 instructions set flags so when you compile this with "llc -print-after-all":

define i32 @foo(i32 %l, i32 %r) {
  %res = mul i32 %l, %r
  ret i32 %res
}

You'll see an instruction like this:

    %vreg2<def,tied1> = IMUL32rr %vreg2<tied0>, %vreg1, %EFLAGS<imp-def,dead>

Cheers.

Tim.





More information about the llvm-dev mailing list