[llvm-dev] Arguments name IR LLVM

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 29 05:31:21 PDT 2019


(Adding llvm-dev back again. Please use reply-all).

On Mon, 29 Jul 2019 at 13:22, mohamed messelka <m14m at live.fr> wrote:
> 1- I need them to read the correct values in fake memory to test some acceleration.

That doesn't sound like a plausible use-case for the name of a Value.

> 2- you code is good but the problem is: in define function has no names for arguments

The arguments have no explicit names, but they're still implicitly
called %0, %1, %2, ... Within the function that's what they'll be
referred to as. For example:

    define i32 @foo(i32) {
      %val = add i32 %0, 1
      ret i32 %val
    }

will add 1 to its first argument and return it.

> but for call fucntion has name for arguments as you see @a and @b:
>
> call void @vecadd(i32 10, float* getelementptr inbounds ([10 x float], [10 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([10 x float], [10 x float]* @b, i64 0, i64 0), float* nonnull %3)

At that particular callsite, yes. But that won't be true in general,
and (for example) %3 in that call is completely meaningless inside
@vecadd.

Cheers.

Tim.


More information about the llvm-dev mailing list