Hi Oliver, I'm not sure this is the right direction to go here, I've got another patch in progress to solve this problem and I'll have something tomorrow. Sorry about the delay.
Thanks! -eric On Wed, Apr 1, 2015 at 7:47 AM Oliver Stannard <[email protected]> wrote: > Hi echristo, > > These target features are used by the clang driver when targeting ARM and > MIPS, but cc1 strips them out and they are not valid backend features. > Therefore, we should not store them in the function attributes. > > REPOSITORY > rL LLVM > > http://reviews.llvm.org/D8771 > > Files: > lib/CodeGen/CGCall.cpp > test/CodeGen/function-target-features.c > > Index: lib/CodeGen/CGCall.cpp > =================================================================== > --- lib/CodeGen/CGCall.cpp > +++ lib/CodeGen/CGCall.cpp > @@ -1490,11 +1490,16 @@ > getTarget().getTargetOpts().FeaturesAsWritten; > if (!Features.empty()) { > std::stringstream S; > - std::copy(Features.begin(), Features.end(), > - std::ostream_iterator<std::string>(S, ",")); > + // The "+soft-float" and "+soft-float-abi" features are not real > target > + // features, and should not be passed to the backend. > + std::copy_if(Features.begin(), Features.end(), > + std::ostream_iterator<std::string>(S, ","), > + [](const std::string& name) { > + return (name != "+soft-float") && (name != > "+soft-float-abi"); > + }); > // The drop_back gets rid of the trailing space. > - FuncAttrs.addAttribute("target-features", > - StringRef(S.str()).drop_back(1)); > + if (!S.str().empty()) > + FuncAttrs.addAttribute("target-features", > StringRef(S.str()).drop_back(1)); > } > } > > Index: test/CodeGen/function-target-features.c > =================================================================== > --- test/CodeGen/function-target-features.c > +++ test/CodeGen/function-target-features.c > @@ -9,6 +9,8 @@ > // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s > -target-cpu corei7 -target-feature +avx | FileCheck %s > -check-prefix=CORE-CPU-AND-FEATURES > // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s > -target-cpu x86-64 | FileCheck %s -check-prefix=X86-64-CPU-NOT > // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s > -target-cpu corei7-avx -target-feature -avx | FileCheck %s > -check-prefix=AVX-MINUS-FEATURE > +// RUN: %clang_cc1 -triple armv7-none-eabi -emit-llvm -o - %s > -target-feature +soft-float | FileCheck %s -check-prefix=ARM-SOFT-FLOAT > +// RUN: %clang_cc1 -triple armv7-none-eabi -emit-llvm -o - %s > -target-feature +soft-float-abi | FileCheck %s -check-prefix=ARM-SOFT-FLOAT- > ABI > > void foo() {} > > @@ -19,3 +21,5 @@ > // CORE-CPU-AND-FEATURES: "target-cpu"="corei7" "target-features"="+avx" > // X86-64-CPU-NOT: "target-cpu" > // AVX-MINUS-FEATURE: "target-features"="-avx" > +// ARM-SOFT-FLOAT-NOT: "target-features" > +// ARM-SOFT-FLOAT-ABI-NOT: "target-features" > > EMAIL PREFERENCES > http://reviews.llvm.org/settings/panel/emailpreferences/ >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
