1 //===--- SystemZ.cpp - SystemZ Helpers for Tools ----------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 #include "clang/Driver/Options.h"
11 #include "llvm/Option/ArgList.h"
12 #include "llvm/Support/Host.h"
14 using namespace clang::driver;
15 using namespace clang::driver::tools;
16 using namespace clang;
17 using namespace llvm::opt;
19 std::string systemz::getSystemZTargetCPU(const ArgList &Args) {
20 if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) {
21 llvm::StringRef CPUName = A->getValue();
23 if (CPUName == "native") {
24 std::string CPU = llvm::sys::getHostCPUName();
25 if (!CPU.empty() && CPU != "generic")
36 void systemz::getSystemZTargetFeatures(const ArgList &Args,
37 std::vector<llvm::StringRef> &Features) {
38 // -m(no-)htm overrides use of the transactional-execution facility.
39 if (Arg *A = Args.getLastArg(options::OPT_mhtm, options::OPT_mno_htm)) {
40 if (A->getOption().matches(options::OPT_mhtm))
41 Features.push_back("+transactional-execution");
43 Features.push_back("-transactional-execution");
45 // -m(no-)vx overrides use of the vector facility.
46 if (Arg *A = Args.getLastArg(options::OPT_mvx, options::OPT_mno_vx)) {
47 if (A->getOption().matches(options::OPT_mvx))
48 Features.push_back("+vector");
50 Features.push_back("-vector");