1 //===- bolt/Target/X86/X86MCSymbolizer.h ------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef BOLT_CORE_X86MCSYMBOLIZER_H
10 #define BOLT_CORE_X86MCSYMBOLIZER_H
12 #include "bolt/Core/BinaryFunction.h"
13 #include "llvm/MC/MCDisassembler/MCSymbolizer.h"
18 class X86MCSymbolizer
: public MCSymbolizer
{
20 BinaryFunction
&Function
;
21 bool CreateNewSymbols
{true};
23 std::pair
<MCSymbol
*, uint64_t> handleGOTPC64(const Relocation
&R
,
27 X86MCSymbolizer(BinaryFunction
&Function
, bool CreateNewSymbols
= true)
28 : MCSymbolizer(*Function
.getBinaryContext().Ctx
.get(), nullptr),
29 Function(Function
), CreateNewSymbols(CreateNewSymbols
) {}
31 X86MCSymbolizer(const X86MCSymbolizer
&) = delete;
32 X86MCSymbolizer
&operator=(const X86MCSymbolizer
&) = delete;
33 virtual ~X86MCSymbolizer();
35 bool tryAddingSymbolicOperand(MCInst
&Inst
, raw_ostream
&CStream
,
36 int64_t Value
, uint64_t Address
, bool IsBranch
,
37 uint64_t Offset
, uint64_t OpSize
,
38 uint64_t InstSize
) override
;
40 void tryAddingPcLoadReferenceComment(raw_ostream
&CStream
, int64_t Value
,
41 uint64_t Address
) override
;