[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / lld / COFF / MinGW.h
blob2f2bd119c33d2eefa91a15ec103c6a2ada6bf1f6
1 //===- MinGW.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_COFF_MINGW_H
10 #define LLD_COFF_MINGW_H
12 #include "Config.h"
13 #include "Symbols.h"
14 #include "lld/Common/LLVM.h"
15 #include "llvm/ADT/ArrayRef.h"
16 #include "llvm/ADT/StringSet.h"
17 #include "llvm/Option/ArgList.h"
18 #include <vector>
20 namespace lld {
21 namespace coff {
23 // Logic for deciding what symbols to export, when exporting all
24 // symbols for MinGW.
25 class AutoExporter {
26 public:
27 AutoExporter();
29 void addWholeArchive(StringRef path);
31 llvm::StringSet<> excludeSymbols;
32 llvm::StringSet<> excludeSymbolPrefixes;
33 llvm::StringSet<> excludeSymbolSuffixes;
34 llvm::StringSet<> excludeLibs;
35 llvm::StringSet<> excludeObjects;
37 bool shouldExport(Defined *sym) const;
40 void writeDefFile(StringRef name);
42 // The -wrap option is a feature to rename symbols so that you can write
43 // wrappers for existing functions. If you pass `-wrap:foo`, all
44 // occurrences of symbol `foo` are resolved to `__wrap_foo` (so, you are
45 // expected to write `__wrap_foo` function as a wrapper). The original
46 // symbol becomes accessible as `__real_foo`, so you can call that from your
47 // wrapper.
49 // This data structure is instantiated for each -wrap option.
50 struct WrappedSymbol {
51 Symbol *sym;
52 Symbol *real;
53 Symbol *wrap;
56 std::vector<WrappedSymbol> addWrappedSymbols(llvm::opt::InputArgList &args);
58 void wrapSymbols(ArrayRef<WrappedSymbol> wrapped);
60 } // namespace coff
61 } // namespace lld
63 #endif