1 //===--- SystemZ.cpp - SystemZ Helpers for Tools ----------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "SystemZ.h" 10 #include "clang/Driver/Options.h" 11 #include "llvm/Option/ArgList.h" 12 13 using namespace clang::driver; 14 using namespace clang::driver::tools; 15 using namespace clang; 16 using namespace llvm::opt; 17 18 const char *systemz::getSystemZTargetCPU(const ArgList &Args) { 19 if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) 20 return A->getValue(); 21 return "z10"; 22 } 23 24 void systemz::getSystemZTargetFeatures(const ArgList &Args, 25 std::vector<llvm::StringRef> &Features) { 26 // -m(no-)htm overrides use of the transactional-execution facility. 27 if (Arg *A = Args.getLastArg(options::OPT_mhtm, options::OPT_mno_htm)) { 28 if (A->getOption().matches(options::OPT_mhtm)) 29 Features.push_back("+transactional-execution"); 30 else 31 Features.push_back("-transactional-execution"); 32 } 33 // -m(no-)vx overrides use of the vector facility. 34 if (Arg *A = Args.getLastArg(options::OPT_mvx, options::OPT_mno_vx)) { 35 if (A->getOption().matches(options::OPT_mvx)) 36 Features.push_back("+vector"); 37 else 38 Features.push_back("-vector"); 39 } 40 } 41