1 | //===- bolt/Core/BinaryEmitter.h - Emit code and data -----------*- 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 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // This file contains declarations of functions for emitting code and data into |
10 | // a binary file. |
11 | // |
12 | //===----------------------------------------------------------------------===// |
13 | |
14 | #ifndef BOLT_CORE_BINARY_EMITTER_H |
15 | #define BOLT_CORE_BINARY_EMITTER_H |
16 | |
17 | #include "llvm/ADT/StringRef.h" |
18 | |
19 | namespace llvm { |
20 | class MCStreamer; |
21 | |
22 | namespace bolt { |
23 | class BinaryContext; |
24 | class BinaryFunction; |
25 | class FunctionFragment; |
26 | |
27 | /// Emit all code and data from the BinaryContext \p BC into the \p Streamer. |
28 | /// |
29 | /// \p OrgSecPrefix is used to modify name of emitted original sections |
30 | /// contained in \p BC. This is done to distinguish them from sections emitted |
31 | /// by LLVM backend. |
32 | void emitBinaryContext(MCStreamer &Streamer, BinaryContext &BC, |
33 | StringRef OrgSecPrefix = "" ); |
34 | |
35 | /// Emit \p BF function code. The caller is responsible for emitting function |
36 | /// symbol(s) and setting the section to emit the code to. |
37 | void emitFunctionBody(MCStreamer &Streamer, BinaryFunction &BF, |
38 | FunctionFragment &FF, bool EmitCodeOnly); |
39 | |
40 | } // namespace bolt |
41 | } // namespace llvm |
42 | |
43 | #endif |
44 | |