ROSE  0.11.145.0
Unparser/X86.h
1 #ifndef ROSE_BinaryAnalysis_Unparser_X86_H
2 #define ROSE_BinaryAnalysis_Unparser_X86_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 #include <Rose/BinaryAnalysis/Unparser/Base.h>
6 
7 #include <Rose/BinaryAnalysis/BasicTypes.h>
8 
9 namespace Rose {
10 namespace BinaryAnalysis {
11 namespace Unparser {
12 
13 std::string unparseX86Mnemonic(SgAsmX86Instruction*);
14 std::string unparseX86Register(SgAsmInstruction*, RegisterDescriptor, RegisterDictionaryPtr);
15 std::string unparseX86Register(RegisterDescriptor, const RegisterDictionaryPtr&);
16 std::string unparseX86Expression(SgAsmExpression*, const LabelMap*, const RegisterDictionaryPtr&, bool leaMode);
17 std::string unparseX86Expression(SgAsmExpression*, const LabelMap*, const RegisterDictionaryPtr&);
18 
20 struct X86Settings: public Settings {};
21 
23 class X86: public Base {
24  X86Settings settings_;
25 
26 protected:
27  explicit X86(const X86Settings &settings)
28  : settings_(settings) {}
29 
30 public:
31  static Ptr instance(const X86Settings &settings = X86Settings()) {
32  return Ptr(new X86(settings));
33  }
34 
35  Ptr copy() const override {
36  return instance(settings());
37  }
38 
39  const X86Settings& settings() const override { return settings_; }
40  X86Settings& settings() override { return settings_; }
41 
42 protected:
43  void emitInstructionMnemonic(std::ostream&, SgAsmInstruction*, State&) const override;
44  void emitOperandBody(std::ostream&, SgAsmExpression*, State&) const override;
45  void emitTypeName(std::ostream&, SgAsmType*, State&) const override;
46 
47 private:
48  void outputExpr(std::ostream&, SgAsmExpression*, State&) const;
49 };
50 
51 } // namespace
52 } // namespace
53 } // namespace
54 
55 #endif
56 #endif
Base class for machine instructions.
Sawyer::SharedPointer< RegisterDictionary > RegisterDictionaryPtr
Reference counting pointer.
Main namespace for the ROSE library.
Settings that control unparsing.
Settings specific to the x86 unparser.
Definition: Unparser/X86.h:20
Represents one Intel x86 machine instruction.
Base class for expressions.
Base class for binary types.
Unparser for x86 instruction sets.
Definition: Unparser/X86.h:23