[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / lld / wasm / Config.h
blob7b20a6b03854f847e1c5126b28995515cb20239c
1 //===- Config.h -------------------------------------------------*- 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 //===----------------------------------------------------------------------===//
9 #ifndef LLD_WASM_CONFIG_H
10 #define LLD_WASM_CONFIG_H
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/ADT/StringSet.h"
14 #include "llvm/BinaryFormat/Wasm.h"
15 #include "llvm/Support/CachePruning.h"
17 namespace lld {
18 namespace wasm {
20 // For --unresolved-symbols.
21 enum class UnresolvedPolicy { ReportError, Warn, Ignore };
23 // This struct contains the global configuration for the linker.
24 // Most fields are direct mapping from the command line options
25 // and such fields have the same name as the corresponding options.
26 // Most fields are initialized by the driver.
27 struct Configuration {
28 bool bsymbolic;
29 bool checkFeatures;
30 bool compressRelocations;
31 bool demangle;
32 bool disableVerify;
33 bool experimentalPic;
34 bool emitRelocs;
35 bool exportAll;
36 bool exportDynamic;
37 bool exportTable;
38 bool growableTable;
39 bool gcSections;
40 bool importMemory;
41 bool sharedMemory;
42 bool importTable;
43 bool importUndefined;
44 llvm::Optional<bool> is64;
45 bool mergeDataSegments;
46 bool pie;
47 bool printGcSections;
48 bool relocatable;
49 bool saveTemps;
50 bool shared;
51 bool stripAll;
52 bool stripDebug;
53 bool stackFirst;
54 bool trace;
55 uint64_t globalBase;
56 uint64_t initialMemory;
57 uint64_t maxMemory;
58 uint64_t zStackSize;
59 unsigned ltoPartitions;
60 unsigned ltoo;
61 unsigned optimize;
62 llvm::StringRef thinLTOJobs;
63 bool ltoNewPassManager;
64 bool ltoDebugPassManager;
65 UnresolvedPolicy unresolvedSymbols;
67 llvm::StringRef entry;
68 llvm::StringRef mapFile;
69 llvm::StringRef outputFile;
70 llvm::StringRef thinLTOCacheDir;
72 llvm::StringSet<> allowUndefinedSymbols;
73 llvm::StringSet<> exportedSymbols;
74 std::vector<llvm::StringRef> requiredExports;
75 std::vector<llvm::StringRef> searchPaths;
76 llvm::CachePruningPolicy thinLTOCachePolicy;
77 llvm::Optional<std::vector<std::string>> features;
79 // The following config options do not directly correspond to any
80 // particualr command line options.
82 // True if we are creating position-independent code.
83 bool isPic;
85 // True if we have an MVP input that uses __indirect_function_table and which
86 // requires it to be allocated to table number 0.
87 bool legacyFunctionTable = false;
89 // The table offset at which to place function addresses. We reserve zero
90 // for the null function pointer. This gets set to 1 for executables and 0
91 // for shared libraries (since they always added to a dynamic offset at
92 // runtime).
93 uint32_t tableBase = 0;
96 // The only instance of Configuration struct.
97 extern Configuration *config;
99 } // namespace wasm
100 } // namespace lld
102 #endif