[PATCH] D142905: Change multilib selection algorithm

Michael Platings via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 30 08:55:55 PST 2023


michaelplatings created this revision.
michaelplatings added a reviewer: phosek.
Herald added subscribers: abrachet, mgrang.
Herald added a project: All.
michaelplatings requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

The new algorithm is:

1. Find all multilibs with flags that are a subset of the requested flags.
2. If more than one multilib matches, choose the last.

In addition a new selection mechanism is permitted, for which multiple
multilibs are returned. This allows layering multilibs on top of each
other.

Since multilibs are now ordered within a list, they no longer need a
Priority field.

The new algorithm is different to the old algorithm, but in practise
the old algorithm was always used in such a way that the effect is the
same.
The old algorithm was to find the set intersection of the requested
flags (with the first character of each removed) with each multilib's
flags (ditto), and for that intersection check whether the first
character matched. However, ignoring the first characters, the
requested flags were always a superset of all the multilibs flags.
Therefore the new algorithm can be used as a drop-in replacement.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142905

Files:
  clang/include/clang/Driver/Multilib.h
  clang/include/clang/Driver/MultilibBuilder.h
  clang/lib/Driver/Multilib.cpp
  clang/lib/Driver/MultilibBuilder.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/unittests/Driver/MultilibBuilderTest.cpp
  clang/unittests/Driver/MultilibTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142905.493329.patch
Type: text/x-patch
Size: 18961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230130/35dc52e2/attachment-0001.bin>


More information about the cfe-commits mailing list