[LLVMdev] alias information on machine instructions

Dan Gohman djg at cray.com
Mon Jul 23 14:55:50 PDT 2007


On Mon, Jul 23, 2007 at 02:19:38PM +0200, Florian Brandner wrote:
> hi,
> 
> i know it took a while, but here is a patch that adds a list of source
> values to machine instructions.

Cool!

> i've testet all this for our backend only, which is not public. i do not
> know how much has to be done to integrate this with the other, e.g., the
> x86, targets. does any of the other targets rewrite loads/stores during
> lowering?

I tried out your patch on x86 and it didn't appear to need any special changes.
With this code:

define i32 @foo(i32* %p) {
  %q = getelementptr i32* %p, i32 17
  %r = load i32* %q
  %s = add i32 %r, 10
  ret i32 %s
}

The llc -march=x86 -print-machineinstrs output looks like this:

: 0x8a99fc8, LLVM BB @0x8a94998, ID#0:
        %reg1024 = MOV32ri 10 SV:0
        %reg1025 = MOV32rm <fi#-1>, 1, %NOREG, 0 SV:1[??]
        %reg1026 = ADD32rm %reg1024, %reg1025, 1, %NOREG, 68 SV:1[q]
        %EAX = MOV32rr %reg1026 SV:0
        RET SV:0

(For those following along, the SV:1[??] and SV:1[q] are the new parts here).

For the [??], it looks like the IsFrameIndex isn't getting set for the first
instruction there.

A few quick comments on specific parts of the patch that I noticed so far:

> +    TargetSrcValue,

I'm curious why you added a new node kind, TargetSrcValue, instead of just
using the existing SRCVALUE.

> +    else if (MRO.SrcValue && !MRO.SrcValue->getName().empty())
> +      OS << "[" << MRO.SrcValue->getName() << "]";

This code should also print the SVOffset value.

> +  SDOperand getVecLoad(unsigned Count, MVT::ValueType VT, SDOperand Chain, 
> +                       SDOperand Ptr, SDOperand SV);

This is code that was deleted from the LLVM trunk recently; it looks like it
shouldn't be included in this patch.

Dan

-- 
Dan Gohman, Cray Inc.



More information about the llvm-dev mailing list