[LLVMdev] Using llvm Metadata inside llc

Pekka Jääskeläinen pekka.jaaskelainen at tut.fi
Thu Apr 18 06:52:34 PDT 2013


On 04/18/2013 04:17 PM, Michael D'Hont wrote:
> Has anyone an idea how to use metadata present in the llvm ir to guide
> the if-conversion in llc (as metadata get's dropped during SelectionDAG) ?

Some time ago the only way to get back to the LLVM IR metadata from
the machine level was via MemoryOperands. I do not know if this has
changed or not, but I suppose the problem is that the LLVM IR and the
MachineInstructions are of course not a 1:1 match, so retaining the data
in the general case is difficult.

What we have used in similar needs are "pseudo asm blocks" (or
perhaps custom instrinsics could work here) which are used
to transfer information up from the source level down to the code generation.
Those were simply inline asm blocks with some magical strings inside. So
maybe you can add such an asm block to the basic block with the branch you
want to if-convert.

-- 
Pekka



More information about the llvm-dev mailing list