r215531 - Emit diagnostic for -munaligned-access on v6m targets
Oliver Stannard
oliver.stannard at arm.com
Wed Aug 13 02:18:13 PDT 2014
Author: olista01
Date: Wed Aug 13 04:18:12 2014
New Revision: 215531
URL: http://llvm.org/viewvc/llvm-project?rev=215531&view=rev
Log:
Emit diagnostic for -munaligned-access on v6m targets
Rather than silently disabling unaligned accesses for v6m targets as
in the previous patch to llvm, instead produce a warning saying that
this architecture doesn't support unaligned accesses.
Patch by Ben Foster
Modified:
cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=215531&r1=215530&r2=215531&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Wed Aug 13 04:18:12 2014
@@ -123,6 +123,8 @@ def err_target_unknown_abi : Error<"unkn
def err_target_unknown_fpmath : Error<"unknown FP unit '%0'">;
def err_target_unsupported_fpmath : Error<
"the '%0' unit is not supported with this instruction set">;
+def err_target_unsupported_unaligned : Error<
+ "the %0 sub-architecture does not support unaligned accesses">;
// Source manager
def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal;
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=215531&r1=215530&r2=215531&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 13 04:18:12 2014
@@ -806,8 +806,12 @@ void Clang::AddARMTargetArgs(const ArgLi
CmdArgs.push_back("-backend-option");
if (A->getOption().matches(options::OPT_mno_unaligned_access))
CmdArgs.push_back("-arm-strict-align");
- else
+ else {
+ if (getToolChain().getTriple().getSubArch() ==
+ llvm::Triple::SubArchType::ARMSubArch_v6m)
+ D.Diag(diag::err_target_unsupported_unaligned) << "v6m";
CmdArgs.push_back("-arm-no-strict-align");
+ }
}
}
More information about the cfe-commits
mailing list