//===-- TargetSelect.cpp - Target Chooser Code ----------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // This just asks the TargetRegistry for the appropriate target to use, and // allows the user to specify a specific one on the commandline with -march=x, // -mcpu=y, and -mattr=a,-b,+c. Clients should initialize targets prior to // calling selectTarget(). // //===----------------------------------------------------------------------===// #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/IR/Module.h" #include "llvm/MC/TargetRegistry.h" #include "llvm/Target/TargetMachine.h" #include "llvm/TargetParser/Host.h" #include "llvm/TargetParser/SubtargetFeature.h" #include "llvm/TargetParser/Triple.h" usingnamespacellvm; TargetMachine *EngineBuilder::selectTarget() { … } /// selectTarget - Pick a target either via -march or by guessing the native /// arch. Add any CPU features specified via -mcpu or -mattr. TargetMachine *EngineBuilder::selectTarget(const Triple &TargetTriple, StringRef MArch, StringRef MCPU, const SmallVectorImpl<std::string>& MAttrs) { … }