[PATCH] D33287: [Linker] Add support for linking ARM and Thumb IR modules.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 09:15:41 PDT 2017


On 29/05/2017 21:37, David Blaikie wrote:
>
>
> On Tue, May 23, 2017 at 10:36 AM Florian Hahn via llvm-commits
> <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>
>
>
>     On 23/05/2017 18:20, Eric Christopher wrote:
>      > I think the general way I'd look at fixing this is:
>      >
>      > a) migrate to a single TargetMachine in the backend (you've
>     apparently
>      > got a patch out for this, but needs reviewing)
>
>     Yep, https://reviews.llvm.org/D33318 but that's more of a cleanup and
>     should be a NFC.
>
>      > b) migrate to using thumb as a subtarget feature on every
>     function from
>      > code generation
>
>     I've just put up a clang patch that should do that
>     https://reviews.llvm.org/D33448
>
>      > c) autoupgrade modules using a thumb triple to have the thumb
>     attribute
>      > on functions (making this patch obsolete)
>
>     What would be the best place for this upgrade be? I think we still 
> have
>     to update Triple::isCompatible to allow linking armxx and thumbxx
>     triples. I'll update this patch tomorrow.
>
>
> The upgrade would be in the bitcode loader. Check the various other
> upgrade paths here:
>
>    lib/Bitcode/Reader/MetadataLoader.cpp
>
> There shouldn't be any need for the triple to exist beyond the bitcode
> reader (not sure how low level it is, whether the triple's existence
> could truly be isolated to that one file - so it might not be quite that
> perfect/simple). The IR linker shouldn't ever see the old triple -
> because it'd be upgraded while the bitcode is being loaded.
>

Great thanks for pointing me to the MetadataLoader. I'll create a patch 
as soon as possible to add +thumb-mode for thumb triples there.

I've also started auditing the remaining uses of Triple::thumb in the 
LLVM codebase. It's used in a few places for checks at the module level 
where ARMSubtarget::isThumb cannot be used, because there's no function 
to get the subtarget for. I think I'll need to take a closer look at these.

> All the existing textual IR can be updated whenever the attribute
> support is in (if we're in a hybrid state of supporting both the
> attribute and the triple) - mass migrating all the textual IR test cases
> over to the new syntax (common triple, thumb attribute) - sed and python
> can be handy for automating that process (at least in my experience).
>
>
>      > d) ... something I'm probably forgetting.
>
>     I've also put up a patch fixing a problem with mixing Thumb and ARM
>     functions in a single compilation unit https://reviews.llvm.org/D33436
>
>
>
>     (b) and (c) would also be a first step towards getting rid of the
>     thumbxx triples, as David suggested, although thumbxx triples are
>     currently the only way to specify that all functions in a compilation
>     unit have +thumb-mode in the llvm binaries AFAIK.
>
>
> Right - hence starting with the fix to add the attribute everywhere and
> to upgrade the triple to attributes.
>


More information about the llvm-commits mailing list