From 4cbceb74bb5676d0181d4d0cab5194d90a42c2ec Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 18 Aug 2020 14:52:44 -0700 Subject: [X86] Add basic support for -mtune command line option in clang Building on the backend support from D85165. This parses the command line option in the driver, passes it on to CC1 and adds a function attribute. -Still need to support tune on the target attribute. -Need to use "generic" as the tuning by default. But need to change generic in the backend first. -Need to set tune if march is specified and mtune isn't. -May need to disable getHostCPUName's ability to guess CPU name from features when it doesn't have a family/model match for mtune=native. That's what gcc appears to do. Differential Revision: https://reviews.llvm.org/D85384 --- clang/lib/Frontend/CompilerInvocation.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 3b69eef..477959f 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3658,6 +3658,7 @@ static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args, Opts.EABIVersion = EABIVersion; } Opts.CPU = std::string(Args.getLastArgValue(OPT_target_cpu)); + Opts.TuneCPU = std::string(Args.getLastArgValue(OPT_tune_cpu)); Opts.FPMath = std::string(Args.getLastArgValue(OPT_mfpmath)); Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature); Opts.LinkerVersion = -- cgit v1.1