Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===- llvm/MC/MCRelocationInfo.h -------------------------------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file declares the MCRelocationInfo class, which provides methods to |
| 10 | // create MCExprs from relocations, either found in an object::ObjectFile |
| 11 | // (object::RelocationRef), or provided through the C API. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_MC_MCDISASSEMBLER_MCRELOCATIONINFO_H |
| 16 | #define LLVM_MC_MCDISASSEMBLER_MCRELOCATIONINFO_H |
| 17 | |
| 18 | namespace llvm { |
| 19 | |
| 20 | class MCContext; |
| 21 | class MCExpr; |
| 22 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 23 | /// Create MCExprs from relocations found in an object file. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 24 | class MCRelocationInfo { |
| 25 | protected: |
| 26 | MCContext &Ctx; |
| 27 | |
| 28 | public: |
| 29 | MCRelocationInfo(MCContext &Ctx); |
| 30 | MCRelocationInfo(const MCRelocationInfo &) = delete; |
| 31 | MCRelocationInfo &operator=(const MCRelocationInfo &) = delete; |
| 32 | virtual ~MCRelocationInfo(); |
| 33 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 34 | /// Create an MCExpr for the target-specific \p VariantKind. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 35 | /// The VariantKinds are defined in llvm-c/Disassembler.h. |
| 36 | /// Used by MCExternalSymbolizer. |
| 37 | /// \returns If possible, an MCExpr corresponding to VariantKind, else 0. |
| 38 | virtual const MCExpr *createExprForCAPIVariantKind(const MCExpr *SubExpr, |
| 39 | unsigned VariantKind); |
| 40 | }; |
| 41 | |
| 42 | } // end namespace llvm |
| 43 | |
| 44 | #endif // LLVM_MC_MCDISASSEMBLER_MCRELOCATIONINFO_H |