ROSE  0.11.109.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 
19 struct X86Settings: public Settings {};
20 
21 class X86: public Base {
22  X86Settings settings_;
23 
24 protected:
25  explicit X86(const X86Settings &settings)
26  : settings_(settings) {}
27 
28 public:
29  static Ptr instance(const X86Settings &settings = X86Settings()) {
30  return Ptr(new X86(settings));
31  }
32 
33  Ptr copy() const override {
34  return instance(settings());
35  }
36 
37  const X86Settings& settings() const override { return settings_; }
38  X86Settings& settings() override { return settings_; }
39 
40 protected:
41  void emitInstructionMnemonic(std::ostream&, SgAsmInstruction*, State&) const override;
42  void emitOperandBody(std::ostream&, SgAsmExpression*, State&) const override;
43  void emitTypeName(std::ostream&, SgAsmType*, State&) const override;
44 
45 private:
46  void outputExpr(std::ostream&, SgAsmExpression*, State&) const;
47 };
48 
49 } // namespace
50 } // namespace
51 } // namespace
52 
53 #endif
54 #endif
Base class for machine instructions.
Sawyer::SharedPointer< RegisterDictionary > RegisterDictionaryPtr
Reference counting pointer.
Main namespace for the ROSE library.
Settings that control unparsing.
Represents one Intel x86 machine instruction.
Base class for expressions.
Base class for binary types.