Page MenuHomePhabricator

[IR] Merge metadata manipulation code into Value
Needs ReviewPublic

Authored by sepavloff on Sep 16 2019, 9:29 AM.



Now there are two main classes in Value hierarchy, which support metadata,
these are Instruction and GlobalObject. They implement different APIs for
metadata manipulation, which however substantially overlap. Implementation
of metadata support for new Value descendant would require creation of one
more API with almost the same functionality.

This change moves common metadata manipulation code into Value, so that
any descendant class could have metadata support.

No functional changes intended.

Event Timeline

sepavloff created this revision.Sep 16 2019, 9:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2019, 9:29 AM
Herald added a subscriber: hiraditya. · View Herald Transcript

I don't think it should be possible to attach metadata to constants owned by the LLVMContext (such as i32 0) since that seems like a bug, but IIUC this patch is enabling that. Is that intentional? If so, why? If not, can you find a way to avoid making that possible?

sepavloff updated this revision to Diff 220513.Sep 17 2019, 8:36 AM

Restrict types allowed to have metadata