[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
echristo accepted this revision. echristo added a comment. This revision is now accepted and ready to land. Ah right. Thanks for looking. LGTM. -eric https://reviews.llvm.org/D33721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
fhahn updated this revision to Diff 101427. fhahn marked an inline comment as done. fhahn added a comment. use else if https://reviews.llvm.org/D33721 Files: lib/Basic/Targets.cpp test/CodeGen/arm-target-attr.c Index: test/CodeGen/arm-target-attr.c === --- /dev/null +++ test/CodeGen/arm-target-attr.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s + +__attribute__((target("arm"))) void test_target_arm() { + // CHECKPOS: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] +} + +__attribute__((target("thumb"))) void test_target_thumb() { + // CHECKPOS: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] +} + +// CHECKPOS: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" +// CHECKPOS: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -5438,7 +5438,17 @@ if (Feature[0] == '+') Features[Feature.drop_front(1)] = true; -return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); +// Convert user-provided arm and thumb GNU target attributes to +// [-|+]thumb-mode target features respectively. +std::vector UpdatedFeaturesVec(FeaturesVec); +for (auto &Feature : UpdatedFeaturesVec) { + if (Feature.compare("+arm") == 0) +Feature = "-thumb-mode"; + else if (Feature.compare("+thumb") == 0) +Feature = "+thumb-mode"; +} + +return TargetInfo::initFeatureMap(Features, Diags, CPU, UpdatedFeaturesVec); } bool handleTargetFeatures(std::vector &Features, Index: test/CodeGen/arm-target-attr.c === --- /dev/null +++ test/CodeGen/arm-target-attr.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s + +__attribute__((target("arm"))) void test_target_arm() { + // CHECKPOS: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] +} + +__attribute__((target("thumb"))) void test_target_thumb() { + // CHECKPOS: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] +} + +// CHECKPOS: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" +// CHECKPOS: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -5438,7 +5438,17 @@ if (Feature[0] == '+') Features[Feature.drop_front(1)] = true; -return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); +// Convert user-provided arm and thumb GNU target attributes to +// [-|+]thumb-mode target features respectively. +std::vector UpdatedFeaturesVec(FeaturesVec); +for (auto &Feature : UpdatedFeaturesVec) { + if (Feature.compare("+arm") == 0) +Feature = "-thumb-mode"; + else if (Feature.compare("+thumb") == 0) +Feature = "+thumb-mode"; +} + +return TargetInfo::initFeatureMap(Features, Diags, CPU, UpdatedFeaturesVec); } bool handleTargetFeatures(std::vector &Features, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
ahatanak added inline comments. Comment at: lib/Basic/Targets.cpp:5444 +Feature = "-thumb-mode"; + if (Feature.compare("+thumb") == 0) +Feature = "+thumb-mode"; This can be "else if". https://reviews.llvm.org/D33721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
fhahn added inline comments. Comment at: lib/Basic/Targets.cpp:5439-5442 +// [-|+]thumb-mode target features respectively. +std::vector UpdatedFeaturesVec(FeaturesVec); +for (auto &Feature : UpdatedFeaturesVec) { + if (Feature.compare("+arm") == 0) echristo wrote: > Won't work below in handleTargetFeatures? Unfortunately I don't think so, as it seems like `handleTargetFeatures` is only called once in `TargetInfo::CreateTargetInfo` (https://github.com/llvm-mirror/clang/blob/master/lib/Basic/Targets.cpp#L9679 ), while `initFeatureMap` is called for each function and thus can be used to modify the user provided `target-features` for individual functions ( https://github.com/llvm-mirror/clang/blob/master/lib/CodeGen/CodeGenModule.cpp#L4426) https://reviews.llvm.org/D33721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
echristo added inline comments. Comment at: lib/Basic/Targets.cpp:5439-5442 +// [-|+]thumb-mode target features respectively. +std::vector UpdatedFeaturesVec(FeaturesVec); +for (auto &Feature : UpdatedFeaturesVec) { + if (Feature.compare("+arm") == 0) Won't work below in handleTargetFeatures? https://reviews.llvm.org/D33721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
fhahn updated this revision to Diff 100994. fhahn added a comment. Agreed, ARMTargetInfo is a much better place to do the conversion! Moved attribute conversion to ARMTargetInfo::initFeatureMap. Unfortunately FeaturesVec is const, so creating a mutable clone seemed the most straight-forward thing to do. https://reviews.llvm.org/D33721 Files: lib/Basic/Targets.cpp test/CodeGen/arm-target-attr.c Index: test/CodeGen/arm-target-attr.c === --- /dev/null +++ test/CodeGen/arm-target-attr.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s + +__attribute__((target("arm"))) void test_target_arm() { + // CHECKPOS: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] +} + +__attribute__((target("thumb"))) void test_target_thumb() { + // CHECKPOS: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] +} + +// CHECKPOS: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" +// CHECKPOS: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -5435,7 +5435,17 @@ if (Feature[0] == '+') Features[Feature.drop_front(1)] = true; -return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); +// Convert user-provided arm and thumb GNU target attributes to +// [-|+]thumb-mode target features respectively. +std::vector UpdatedFeaturesVec(FeaturesVec); +for (auto &Feature : UpdatedFeaturesVec) { + if (Feature.compare("+arm") == 0) +Feature = "-thumb-mode"; + if (Feature.compare("+thumb") == 0) +Feature = "+thumb-mode"; +} + +return TargetInfo::initFeatureMap(Features, Diags, CPU, UpdatedFeaturesVec); } bool handleTargetFeatures(std::vector &Features, Index: test/CodeGen/arm-target-attr.c === --- /dev/null +++ test/CodeGen/arm-target-attr.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s + +__attribute__((target("arm"))) void test_target_arm() { + // CHECKPOS: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] +} + +__attribute__((target("thumb"))) void test_target_thumb() { + // CHECKPOS: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] +} + +// CHECKPOS: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" +// CHECKPOS: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -5435,7 +5435,17 @@ if (Feature[0] == '+') Features[Feature.drop_front(1)] = true; -return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); +// Convert user-provided arm and thumb GNU target attributes to +// [-|+]thumb-mode target features respectively. +std::vector UpdatedFeaturesVec(FeaturesVec); +for (auto &Feature : UpdatedFeaturesVec) { + if (Feature.compare("+arm") == 0) +Feature = "-thumb-mode"; + if (Feature.compare("+thumb") == 0) +Feature = "+thumb-mode"; +} + +return TargetInfo::initFeatureMap(Features, Diags, CPU, UpdatedFeaturesVec); } bool handleTargetFeatures(std::vector &Features, ___ cfe-commits mailing list cfe-commits@lists.llvm.
[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
echristo added inline comments. Comment at: include/clang/Basic/Attr.td:1790-1794 +// target features respectively. +if (Feature.compare("arm") == 0) + Ret.first.push_back("-thumb-mode"); +else if (Feature.compare("thumb") == 0) + Ret.first.push_back("+thumb-mode"); This is a little painful here - I wonder if we have access to TargetInfo or maybe translate it in the target specific area of the front end? I worry about this sort of thing getting unwieldy. Thoughts? Otherwise OK. https://reviews.llvm.org/D33721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
fhahn updated this revision to Diff 100880. fhahn added a comment. reworded comment and improved test case to ensure only a single thumb-mode attribute is added. https://reviews.llvm.org/D33721 Files: include/clang/Basic/Attr.td test/CodeGen/arm-target-attr.c Index: test/CodeGen/arm-target-attr.c === --- /dev/null +++ test/CodeGen/arm-target-attr.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s + +__attribute__((target("arm"))) void test_target_arm() { + // CHECKPOS: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] +} + +__attribute__((target("thumb"))) void test_target_thumb() { + // CHECKPOS: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] +} + +// CHECKPOS: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" +// CHECKPOS: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" Index: include/clang/Basic/Attr.td === --- include/clang/Basic/Attr.td +++ include/clang/Basic/Attr.td @@ -1784,10 +1784,16 @@ // overall feature validity for the function with the rest of the // attributes on the function. if (Feature.startswith("fpmath=") || Feature.startswith("tune=")) - continue; - + continue; + +// Convert arm and thumb GNU target attributes to [-|+]thumb-mode +// target features respectively. +if (Feature.compare("arm") == 0) + Ret.first.push_back("-thumb-mode"); +else if (Feature.compare("thumb") == 0) + Ret.first.push_back("+thumb-mode"); // While we're here iterating check for a different target cpu. -if (Feature.startswith("arch=")) +else if (Feature.startswith("arch=")) Ret.second = Feature.split("=").second.trim(); else if (Feature.startswith("no-")) Ret.first.push_back("-" + Feature.split("-").second.str()); Index: test/CodeGen/arm-target-attr.c === --- /dev/null +++ test/CodeGen/arm-target-attr.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s + +__attribute__((target("arm"))) void test_target_arm() { + // CHECKPOS: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] +} + +__attribute__((target("thumb"))) void test_target_thumb() { + // CHECKPOS: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] +} + +// CHECKPOS: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" +// CHECKPOS: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" Index: include/clang/Basic/Attr.td === --- include/clang/Basic/Attr.td +++ include/clang/Basic/Attr.td @@ -1784,10 +1784,16 @@ // overall feature validity for the function with the rest of the // attributes on the function. if (Feature.startswith("fpmath=") || Feature.startswith("tune=")) - continue; - + continue; + +// Convert arm and thumb GNU target attributes to [-|+]thumb-mode +// target features respectively. +if (Feature.compare("arm") == 0) + Ret.first.push_back("-thumb-mode"); +else if (Feature.compare("thumb") == 0) + Ret.first.push_back("+thumb-mode"); // While we're here iterating check for a different target cpu. -if (Feature.startswith("arch=")) +else if (Feature.startswith(
[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
javed.absar added a comment. Comment at: include/clang/Basic/Attr.td:1774 + +// Convert GNU target names for arm and thumb to thumb-mode target +// feature. Would this be a more accurate comment: "...arm and thumb to thumb-mode" => "arm and thumb to arm-mode or thumb-mode, respectively" Or "[-|+] thumb-mode" https://reviews.llvm.org/D33721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33721: [ARM] Add support for target("arm") and target("thumb").
fhahn created this revision. Herald added subscribers: kristof.beyls, javed.absar, aemerson. This patch adds support for the target("arm") and target("thumb") attributes, which can be used to force the compiler to generated ARM or Thumb code for a function. In LLVM, ARM or Thumb code generation can be controlled by the thumb-mode target feature. But GCC already uses target("arm") and target("thumb"), so we have to substitute "arm" with -thumb-mode and "thumb" with +thumb-mode. https://reviews.llvm.org/D33721 Files: include/clang/Basic/Attr.td test/CodeGen/arm-target-attr.c Index: test/CodeGen/arm-target-attr.c === --- /dev/null +++ test/CodeGen/arm-target-attr.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck %s + +__attribute__((target("arm"))) void test_target_arm() { + // CHECK: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] +} + +__attribute__((target("thumb"))) void test_target_thumb() { + // CHECK: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] +} + +// CHECK: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" +// CHECK: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" Index: include/clang/Basic/Attr.td === --- include/clang/Basic/Attr.td +++ include/clang/Basic/Attr.td @@ -1769,10 +1769,16 @@ // overall feature validity for the function with the rest of the // attributes on the function. if (Feature.startswith("fpmath=") || Feature.startswith("tune=")) - continue; - + continue; + +// Convert GNU target names for arm and thumb to thumb-mode target +// feature. +if (Feature.compare("arm") == 0) + Ret.first.push_back("-thumb-mode"); +else if (Feature.compare("thumb") == 0) + Ret.first.push_back("+thumb-mode"); // While we're here iterating check for a different target cpu. -if (Feature.startswith("arch=")) +else if (Feature.startswith("arch=")) Ret.second = Feature.split("=").second.trim(); else if (Feature.startswith("no-")) Ret.first.push_back("-" + Feature.split("-").second.str()); Index: test/CodeGen/arm-target-attr.c === --- /dev/null +++ test/CodeGen/arm-target-attr.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck %s + +__attribute__((target("arm"))) void test_target_arm() { + // CHECK: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] +} + +__attribute__((target("thumb"))) void test_target_thumb() { + // CHECK: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] +} + +// CHECK: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" +// CHECK: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" Index: include/clang/Basic/Attr.td === --- include/clang/Basic/Attr.td +++ include/clang/Basic/Attr.td @@ -1769,10 +1769,16 @@ // overall feature validity for the function with the rest of the // attributes on the function. if (Feature.startswith("fpmath=") || Feature.startswith("tune=")) - continue; - + continue; + +// Convert GNU target names for arm and thumb to thumb-mode target +// feature. +if (Feature.compare("arm") == 0) + Ret.first.push_back("-thumb-mode"); +else if (Feature.compare("thumb") == 0) + Ret.first.push_back("+thumb-mode"); // While we're here iterating check for a different target cpu. -if (Feature.startswith("arch=")) +else if (Feature.startswith("arch=")) Ret.second = Feature.split("=").second.trim(); else if (Feature.startswith("no-")) Ret.first.push_back("-" + Feature.split("-").second.str()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits