Address of an instruction (or a label?)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Address of an instruction (or a label?)

varth
Hi everyone,

I'm developing a Java compiler with llvm and I would like to implement
the (bytecode instruction <--> source line in Java code) feature. This
requires to get the address of a generated instruction.

Is there a way in llvm to get the address of a generated instruction? Or
somehow to fix the location of a label in the llvm code (something that
may look like a basic block perhaps) and get after the compilation the
address of this label?

Thx,
Nicolas

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Address of an instruction (or a label?)

Anton Korobeynikov
Hello, Nicolas.

> Is there a way in llvm to get the address of a generated instruction? Or
> somehow to fix the location of a label in the llvm code (something that
> may look like a basic block perhaps) and get after the compilation the
> address of this label?
Maybe it's worth to use llvm.dbg.stoppoint?

--
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Address of an instruction (or a label?)

Jim Laskey-2
I agree.  Instead of using line numbers, with llvm.dbg.stoppoint, you  
could use the byte code index.  Or alternatively, you could use the  
column number field instead (not currently managed by  
MachineModuleInfo.)  In the backend, you can generate a machine  
instruction to byte code mapping table from queries to  
MachineModuleInfo.

Cheers,

-- Jim





On 12-Mar-07, at 8:34 AM, Anton Korobeynikov wrote:

> Hello, Nicolas.
>
>> Is there a way in llvm to get the address of a generated  
>> instruction? Or
>> somehow to fix the location of a label in the llvm code (something  
>> that
>> may look like a basic block perhaps) and get after the compilation  
>> the
>> address of this label?
> Maybe it's worth to use llvm.dbg.stoppoint?
>
> --
> With best regards, Anton Korobeynikov.
>
> Faculty of Mathematics & Mechanics, Saint Petersburg State University.
>
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Address of an instruction (or a label?)

varth
In reply to this post by Anton Korobeynikov
Hi Anton,

Anton Korobeynikov wrote:
> Maybe it's worth to use llvm.dbg.stoppoint?
>
>  

Do you have an example on how to use this intrinsic with the JIT? How
can I get at compile
time the address of the stoppoint?

Thx,
Nicolas

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Address of an instruction (or a label?)

varth
After chatting with Anton, we realized that this was actually not a
solution because
it is not implemented in the JIT.

Let me turn the question with a different angle : is there a way in llvm
to force the emission of
basic blocks labels, even ones that are useless, eg:

        load 1
        load 2  
        add
        branch label "foo"
foo:  load 4

And there is no other jump to the "foo" label. Actually in llvm the
label is just removed and the basic block
does not get a native address after compilation.

Cheers,
Nicolas

Nicolas Geoffray wrote:

> Hi Anton,
>
> Anton Korobeynikov wrote:
>  
>> Maybe it's worth to use llvm.dbg.stoppoint?
>>
>>  
>>    
>
> Do you have an example on how to use this intrinsic with the JIT? How
> can I get at compile
> time the address of the stoppoint?
>
> Thx,
> Nicolas
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>  

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev