HomePhabricator

[IRBuilder] Generalize debug loc handling for arbitrary metadata.

Authored by fhahn on Dec 17 2020, 4:59 AM.

Description

[IRBuilder] Generalize debug loc handling for arbitrary metadata.

This patch extends IRBuilder to allow adding/preserving arbitrary
metadata on created instructions.

Instead of using references to specific metadata nodes (like DebugLoc),
IRbuilder now keeps a vector of (metadata kind, MDNode *) pairs, which
are added to each created instruction.

The patch itself is a NFC and only moves the existing debug location
handling over to the new system. In a follow-up patch it will be used to
preserve !annotation metadata besides !dbg.

The current approach requires iterating over MetadataToCopy to avoid
adding duplicates, but given that the number of metadata kinds to
copy/preserve is going to be very small initially (0, 1 (for !dbg) or 2
(!dbg and !annotation)) that should not matter.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D93400

Details

Committed
fhahnDec 17 2020, 5:27 AM
Reviewer
lebedev.ri
Differential Revision
D93400: [IRBuilder] Generalize debug loc handling for arbitrary metadata.
Parents
rGdeae7e982a3b: [libc] revamp memory function benchmark
Branches
Unknown
Tags
Unknown