[all-commits] [llvm/llvm-project] 40137f: [Frontend][OpenMP] Refactor getLeafConstructs, add...

Krzysztof Parzyszek via All-commits all-commits at lists.llvm.org
Mon Apr 22 12:41:32 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 40137ff0d81be80e4900c17c57b1f66c53ddf2f9
      https://github.com/llvm/llvm-project/commit/40137ff0d81be80e4900c17c57b1f66c53ddf2f9
  Author: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
  Date:   2024-04-22 (Mon, 22 Apr 2024)

  Changed paths:
    M llvm/include/llvm/Frontend/OpenMP/OMP.h
    M llvm/lib/Frontend/OpenMP/OMP.cpp
    M llvm/test/TableGen/directive1.td
    M llvm/test/TableGen/directive2.td
    M llvm/unittests/Frontend/CMakeLists.txt
    A llvm/unittests/Frontend/OpenMPComposeTest.cpp
    M llvm/utils/TableGen/DirectiveEmitter.cpp

  Log Message:
  -----------
  [Frontend][OpenMP] Refactor getLeafConstructs, add getCompoundConstruct (#87247)

Emit a special leaf construct table in DirectiveEmitter.cpp, which will
allow both decomposition of a construct into leafs, and composition of
constituent constructs into a single compound construct (if possible).
The function `getLeafConstructs` is no longer auto-generated, but
implemented in OMP.cpp.

The table contains a row for each directive, and each row has the
following format
`dir_id, num_leafs, leaf1, leaf2, ..., leafN, -1, ...`
The rows are sorted lexicographically with respect to the leaf
constructs. This allows a binary search for the row corresponding to the
given list of leafs.

There is an auxiliary table that for each directive contains the index
of the row corresponding to that directive.

Looking up leaf constructs for a directive `dir_id` is of constant time,
and and consists of two lookups: `LeafTable[Auxiliary[dir_id]]`.
Finding a compound directive given the set of leafs is of time O(logn),
and is roughly represented by
`row = binary_search(LeafTable); return row[0]`.

The functions `getLeafConstructs` and `getCompoundConstruct` use these
lookup methods internally.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list