From: Dan Gohman Date: Fri, 21 Sep 2012 18:21:48 +0000 (+0000) Subject: Document the new !tbaa.struct metadata. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e36188f30e76639e540a896e4320a917b2e92dde;p=platform%2Fupstream%2Fllvm.git Document the new !tbaa.struct metadata. llvm-svn: 164398 --- diff --git a/llvm/docs/LangRef.html b/llvm/docs/LangRef.html index 4daab59..1fea299 100644 --- a/llvm/docs/LangRef.html +++ b/llvm/docs/LangRef.html @@ -103,6 +103,7 @@
  • Metadata Nodes and Metadata Strings
    1. 'tbaa' Metadata
    2. +
    3. 'tbaa.struct' Metadata
    4. 'fpmath' Metadata
    5. 'range' Metadata
    @@ -3052,6 +3053,44 @@ call void @llvm.dbg.value(metadata !24, i64 0, metadata !25)

    + 'tbaa.struct' Metadata +

    + +
    + +

    The llvm.memcpy is often used to implement +aggregate assignment operations in C and similar languages, however it is +defined to copy a contiguous region of memory, which is more than strictly +necessary for aggregate types which contain holes due to padding. Also, it +doesn't contain any TBAA information about the fields of the aggregate.

    + +

    !tbaa.struct metadata can describe which memory subregions in a memcpy +are padding and what the TBAA tags of the struct are.

    + +

    The current metadata format is very simple. !tbaa.struct metadata nodes + are a list of operands which are in conceptual groups of three. For each + group of three, the first operand gives the byte offset of a field in address + units, the second gives its size in address units, and the third gives its + tbaa tag. e.g.:

    + +
    +
    +!4 = metadata !{ i64 0, i64 4, metadata !1, i64 8, i64 4, metadata !2 }
    +
    +
    + +

    This describes a struct with two fields. The first is at offset 0 address units + with size 4 address units, and has tbaa tag !1. The second is at offset 8 address + units and has size 4 address units and has tbaa tag !2.

    + +

    Note that the fields need not be contiguous. In this example, there is a + 4 byte gap between the two fields. This gap represents padding which + does not carry useful data and need not be preserved.

    + +
    + + +

    'fpmath' Metadata