diff options
Diffstat (limited to 'lib/Driver/ToolChains/Arch/RISCV.cpp')
-rw-r--r-- | lib/Driver/ToolChains/Arch/RISCV.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/Driver/ToolChains/Arch/RISCV.cpp b/lib/Driver/ToolChains/Arch/RISCV.cpp index 1321fedcec..b5cee381e1 100644 --- a/lib/Driver/ToolChains/Arch/RISCV.cpp +++ b/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -1,9 +1,8 @@ //===--- RISCV.cpp - RISCV Helpers for Tools --------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -171,7 +170,7 @@ static void getExtensionFeatures(const Driver &D, } // Check if duplicated extension. - if (std::find(AllExts.begin(), AllExts.end(), Ext) != AllExts.end()) { + if (llvm::is_contained(AllExts, Ext)) { std::string Error = "duplicated "; Error += Desc; D.Diag(diag::err_drv_invalid_riscv_ext_arch_name) @@ -365,6 +364,18 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const ArgList &Args, getExtensionFeatures(D, Args, Features, MArch, OtherExts); } + // -mrelax is default, unless -mno-relax is specified. + bool Relax = true; + if (auto *A = Args.getLastArg(options::OPT_mrelax, options::OPT_mno_relax)) { + if (A->getOption().matches(options::OPT_mno_relax)) { + Relax = false; + Features.push_back("-relax"); + } + } + + if (Relax) + Features.push_back("+relax"); + // Now add any that the user explicitly requested on the command line, // which may override the defaults. handleTargetFeaturesGroup(Args, Features, options::OPT_m_riscv_Features_Group); |