Attaching Metadata to BasicBlocks

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

Attaching Metadata to BasicBlocks

kalyan ponnala

Hello,

I was researching how Metadata in LLVM 2.7 is represented and used and I found that Metadata can be attached and manipulated at both the module level and instruction levels.  Upon inspecting the Metadata classes, I also saw that there is an enum that contains a bit for "FunctionLocalBit" on the MDNode.

Unfortunately, I did not see any methods to attach or manipulate Metadata at the BasicBlock level or Function levels in the LLVM IR classes.

Can someone please tell me why there is no support for attaching and manipulating Metadata to BasicBlocks and Functions?

Thanks a lot.
--
Kalyan Ponnala
phone: 8163772059

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Attaching Metadata to BasicBlocks

Chris Lattner

On Apr 22, 2010, at 2:29 AM, kalyan ponnala wrote:

>
> Hello,
>
> I was researching how Metadata in LLVM 2.7 is represented and used and I found that Metadata can be attached and manipulated at both the module level and instruction levels.  Upon inspecting the Metadata classes, I also saw that there is an enum that contains a bit for "FunctionLocalBit" on the MDNode.
>
> Unfortunately, I did not see any methods to attach or manipulate Metadata at the BasicBlock level or Function levels in the LLVM IR classes.
>
> Can someone please tell me why there is no support for attaching and manipulating Metadata to BasicBlocks and Functions?

Just because no one has needed it yet.  I'm not opposed to it being added it if you have a compelling client for it.

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Attaching Metadata to BasicBlocks

kalyan ponnala
Thanks for the reply Chris,

I would like to add Metadata to a loop.

To do this, can I simply add the Metadata Manipulation methods & Metadata private data from Instruction.h & their method bodies from Metadata.cpp into the BasicBlock.h & BasicBlock.cpp files.?

Or Am I missing an important dependency.

Thanks,

Kalyan the great (even greater than Chris Latner)

On Thu, Apr 22, 2010 at 12:44 PM, Chris Lattner <[hidden email]> wrote:

On Apr 22, 2010, at 2:29 AM, kalyan ponnala wrote:

>
> Hello,
>
> I was researching how Metadata in LLVM 2.7 is represented and used and I found that Metadata can be attached and manipulated at both the module level and instruction levels.  Upon inspecting the Metadata classes, I also saw that there is an enum that contains a bit for "FunctionLocalBit" on the MDNode.
>
> Unfortunately, I did not see any methods to attach or manipulate Metadata at the BasicBlock level or Function levels in the LLVM IR classes.
>
> Can someone please tell me why there is no support for attaching and manipulating Metadata to BasicBlocks and Functions?

Just because no one has needed it yet.  I'm not opposed to it being added it if you have a compelling client for it.

-Chris



--
Kalyan Ponnala
phone: 8163772059

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Attaching Metadata to BasicBlocks

Chris Lattner

On Apr 23, 2010, at 12:13 AM, kalyan ponnala wrote:

> Thanks for the reply Chris,
>
> I would like to add Metadata to a loop.
>
> To do this, can I simply add the Metadata Manipulation methods & Metadata private data from Instruction.h & their method bodies from Metadata.cpp into the BasicBlock.h & BasicBlock.cpp files.?

It's non-trivial: you need to add support to the .ll file parser/printer, the .bc file reader/writer, the IR stuff, etc.  It's probably best discussed on llvmdev, instead of cfe-dev.

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Attaching Metadata to BasicBlocks

kalyan ponnala
Thanks again Chris,

I'll post the follow up post on the LLVM side.

PS: Please forgive the silly humor at the end of the post, my friend and I were up till 3:30 AM trying to figure out how to use Metadata in a non-trivial way. We were trying to frame the question properly and he wrote the last line as a joke to me. Neither of us intended it  to go on the entire news group let alone to you specifically.

You are truely the great, not the Kalyan!

On Fri, Apr 23, 2010 at 11:30 AM, Chris Lattner <[hidden email]> wrote:

On Apr 23, 2010, at 12:13 AM, kalyan ponnala wrote:

> Thanks for the reply Chris,
>
> I would like to add Metadata to a loop.
>
> To do this, can I simply add the Metadata Manipulation methods & Metadata private data from Instruction.h & their method bodies from Metadata.cpp into the BasicBlock.h & BasicBlock.cpp files.?

It's non-trivial: you need to add support to the .ll file parser/printer, the .bc file reader/writer, the IR stuff, etc.  It's probably best discussed on llvmdev, instead of cfe-dev.

-Chris



--
Kalyan Ponnala
phone: 8163772059

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev