[LLVMdev] multiple return value assembler regression?

423 views
Skip to first unread message

Bagel

unread,
Jun 24, 2011, 12:29:29 PM6/24/11
to llv...@cs.uiuc.edu
It appears the syntax for returning multiple values has changed since 2.9.
Previous to that:
ret i32 %a, i32 %b
worked. The new syntax is something like:
ret { i32, i32 }{i32 %a, i32 %b}
but this yields an error:
mrv-bug.ll:5:24: error: invalid use of function-local name
ret { i32, i32 }{i32 %a, i32 %b}
^
If %a and %b are replaced by constants, things work.

Am I doing something wrong, or should I file a bug report?
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Eli Friedman

unread,
Jun 24, 2011, 12:48:09 PM6/24/11
to Bagel, llv...@cs.uiuc.edu
On Fri, Jun 24, 2011 at 9:29 AM, Bagel <bag...@gmail.com> wrote:
> It appears the syntax for returning multiple values has changed since 2.9.
> Previous to that:
>        ret  i32 %a, i32 %b
> worked.  The new syntax is something like:
>        ret  { i32, i32 }{i32 %a, i32 %b}
> but this yields an error:
> mrv-bug.ll:5:24: error: invalid use of function-local name
>        ret  { i32, i32 }{i32 %a, i32 %b}
>                              ^
> If %a and %b are replaced by constants, things work.
>
> Am I doing something wrong, or should I file a bug report?

You need to use insertvalue to build a struct with non-constant values..

-Eli

Chris Lattner

unread,
Jun 24, 2011, 4:45:08 PM6/24/11
to Bagel, llv...@cs.uiuc.edu

On Jun 24, 2011, at 9:29 AM, Bagel wrote:

> It appears the syntax for returning multiple values has changed since 2.9.
> Previous to that:
> ret i32 %a, i32 %b
> worked. The new syntax is something like:
> ret { i32, i32 }{i32 %a, i32 %b}
> but this yields an error:
> mrv-bug.ll:5:24: error: invalid use of function-local name
> ret { i32, i32 }{i32 %a, i32 %b}
> ^
> If %a and %b are replaced by constants, things work.

This is obsolete and deprecated syntax that is dropped in "llvm 3.0" (and thus on mainline right now). If you run that through llvm-as|llvm-dis from llvm 2.9, you'll see the preferred syntax.

-Chris

Bagel

unread,
Jun 24, 2011, 5:21:00 PM6/24/11
to Chris Lattner, llv...@cs.uiuc.edu
On 06/24/2011 03:45 PM, Chris Lattner wrote:
>
> On Jun 24, 2011, at 9:29 AM, Bagel wrote:
>
>> It appears the syntax for returning multiple values has changed since 2.9.
>> Previous to that:
>> ret i32 %a, i32 %b
>> worked. The new syntax is something like:
>> ret { i32, i32 }{i32 %a, i32 %b}
>> but this yields an error:
>> mrv-bug.ll:5:24: error: invalid use of function-local name
>> ret { i32, i32 }{i32 %a, i32 %b}
>> ^
>> If %a and %b are replaced by constants, things work.
>
> This is obsolete and deprecated syntax that is dropped in "llvm 3.0" (and thus on mainline right now). If you run that through llvm-as|llvm-dis from llvm 2.9, you'll see the preferred syntax.
>
> -Chris

OK, I guess I missed the announcement that it was obsolete. The new mechanism
is quite wordy when compared with the old. Sigh.

Are there any other languages other than mine (http://code.google.com/p/esl/)
which return multiple scalars that have LLVM frontends?

bagel

Chris Lattner

unread,
Jun 24, 2011, 6:21:15 PM6/24/11
to Bagel, llv...@cs.uiuc.edu

On Jun 24, 2011, at 2:21 PM, Bagel wrote:

>> This is obsolete and deprecated syntax that is dropped in "llvm 3.0" (and thus on mainline right now). If you run that through llvm-as|llvm-dis from llvm 2.9, you'll see the preferred syntax.
>>
>> -Chris
>
> OK, I guess I missed the announcement that it was obsolete.

It will eventually be in the llvm 3.0 release notes.

> The new mechanism is quite wordy when compared with the old. Sigh.
>
> Are there any other languages other than mine (http://code.google.com/p/esl/) which return multiple scalars that have LLVM frontends?

Most LLVM frontends don't generate LLVM IR as text files. They typically use the C or C++ APIs (or wrappers thereof) so they wouldn't have noticed the syntax change.

-Chris

Bagel

unread,
Jun 24, 2011, 8:36:17 PM6/24/11
to Chris Lattner, llv...@cs.uiuc.edu
On 06/24/2011 05:21 PM, Chris Lattner wrote:
>
> On Jun 24, 2011, at 2:21 PM, Bagel wrote:
>
>>> This is obsolete and deprecated syntax that is dropped in "llvm 3.0"
>>> (and thus on mainline right now). If you run that through
>>> llvm-as|llvm-dis from llvm 2.9, you'll see the preferred syntax.
>>>
>>> -Chris
>>
>> OK, I guess I missed the announcement that it was obsolete.
>
> It will eventually be in the llvm 3.0 release notes.
>
>> The new mechanism is quite wordy when compared with the old. Sigh.
>>
>> Are there any other languages other than mine
>> (http://code.google.com/p/esl/) which return multiple scalars that have
>> LLVM frontends?
>
> Most LLVM frontends don't generate LLVM IR as text files. They typically
> use the C or C++ APIs (or wrappers thereof) so they wouldn't have noticed
> the syntax change.
>
> -Chris

I am appreciative that you keep the text representation, since my frontend is
not written in C or C++ the API does me no good. I'll deal with the changes.
I just hope that the backend continues to deal with frontends that are not C,
C++, or Object-C.

thank you,
bagel

Jon Harrop

unread,
Jan 8, 2012, 11:49:49 AM1/8/12
to Bagel, llv...@cs.uiuc.edu
Bagel wrote:
> I am appreciative that you keep the text representation, since my frontend
is not
> written in C or C++ the API does me no good. I'll deal with the changes.
> I just hope that the backend continues to deal with frontends that are not
C,
> C++, or Object-C.

FWIW, HLVM is written in OCaml (not C, C++ or Objective-C) and hasn't
suffered from any such problems (and it returns multiple values). I highly
recommend using the C API.

Cheers,
Jon.

Reply all
Reply to author
Forward
0 new messages