From cc524bf6ac21bb3943b3c802306e0bfb718eade2 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 7 Jun 2017 11:50:45 +0000 Subject: [CodeGen] Add thumb-mode to target-features for arm/thumb triples. Summary: The thumb-mode target feature is used to force Thumb or ARM code generation on a per-function basis. Explicitly adding +thumb-mode to functions for thumbxx triples enables mixed ARM/Thumb code generation in places where compilation units with thumbxx and armxx triples are merged together (e.g. the IR linker or LTO). For armxx triples, -thumb-mode is added in a similar fashion. Reviewers: echristo, t.p.northover, kristof.beyls, rengolin Reviewed By: echristo Subscribers: rinon, aemerson, mehdi_amini, javed.absar, cfe-commits Differential Revision: https://reviews.llvm.org/D33448 llvm-svn: 304897 --- clang/lib/Basic/Targets.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/lib/Basic/Targets.cpp') diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index a304a78354e..89f192abc07 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -5442,6 +5442,13 @@ public: if (Feature[0] == '+') Features[Feature.drop_front(1)] = true; + // Enable or disable thumb-mode explicitly per function to enable mixed + // ARM and Thumb code generation. + if (isThumb()) + Features["thumb-mode"] = true; + else + Features["thumb-mode"] = false; + // Convert user-provided arm and thumb GNU target attributes to // [-|+]thumb-mode target features respectively. std::vector UpdatedFeaturesVec(FeaturesVec); -- cgit v1.2.3