1/**
2 * Copyright (c) Glow Contributors. See CONTRIBUTORS file.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef GLOW_LLVMIRCODEGEN_COMMANDLINE_H
18#define GLOW_LLVMIRCODEGEN_COMMANDLINE_H
19
20#include "glow/LLVMIRCodeGen/LLVMIRGen.h"
21#include "llvm/Support/CodeGen.h"
22#include "llvm/Support/CommandLine.h"
23#include "llvm/Target/TargetOptions.h"
24
25llvm::cl::OptionCategory &getLLVMBackendCat();
26
27/// Options for specifying the parameters of llvm::EngineBuilder::selectTarget,
28/// which is invoked to create llvm::TargetMachine. They are the equivalents of
29/// clang's/llvm's -target, -mcpu, -march and -target-feature options.
30
31/// Target to be used by the LLVMBackend. Used as -target=targetA.
32extern llvm::cl::opt<std::string> llvmTarget;
33
34/// Architecture to be used by the LLVMBackend. Used as -march=archA.
35extern llvm::cl::opt<std::string> llvmArch;
36
37/// CPU to be used by the LLVMBackend. Used as -mcpu=cpuA.
38extern llvm::cl::opt<std::string> llvmCPU;
39
40/// ABI to be used by the LLVMBackend. Used as -mabi=abi.
41extern llvm::cl::opt<std::string> llvmABI;
42
43/// Code model to be used by the LLVMBackend.
44extern llvm::cl::opt<llvm::CodeModel::Model> llvmCodeModel;
45
46/// Code model to be used by the LLVMBackend to produce bundles.
47extern llvm::cl::opt<llvm::CodeModel::Model> llvmBundleCodeModel;
48
49/// Relocation model to be used by the LLVMBackend.
50extern llvm::cl::opt<llvm::Reloc::Model> llvmRelocModel;
51
52/// Target and CPU features to be used by the LLVMBackend. The features should
53/// be comma-separated and prefixed with +.
54/// Used as -target-feature=+featureA,+featureB.
55extern llvm::cl::list<std::string> llvmTargetFeatures;
56
57/// Alias for the LLVM Machine attributes.
58extern llvm::cl::alias llvmMAttr;
59
60/// External LLVM compiler (e.g. llc) to use for compiling LLVM bitcode into
61/// machine code.
62extern llvm::cl::opt<std::string> llvmCompiler;
63
64/// External LLVM opt tool to optimize LLVM IR.
65/// Default is taken as the same directory as llvmCompiler
66extern llvm::cl::opt<std::string> llvmOpt;
67
68/// Set of options to pass to the external LLVM compiler.
69extern llvm::cl::list<std::string> llvmCompilerOptions;
70
71/// Option to create an asm file from llvm compiler.
72extern llvm::cl::opt<bool> llvmSaveAsm;
73
74/// Option to set float ABI. Used as -float-abi=<abi-type>.
75extern llvm::cl::opt<llvm::FloatABI::ABIType> floatABI;
76
77/// Option to specify which bundle API to use.
78extern llvm::cl::opt<glow::BundleApiType> bundleAPI;
79
80/// Option to print more details in the bundle API.
81extern llvm::cl::opt<bool> bundleAPIVerbose;
82
83/// Option to add other external object files to the bundle.
84extern llvm::cl::list<std::string> bundleObjectsOpt;
85
86#endif // GLOW_LLVMIRCODEGEN_COMMANDLINE_H
87