ROSE  0.11.98.0
Unparser/Mips.h
1 #ifndef ROSE_BinaryAnalysis_Unparser_Mips_H
2 #define ROSE_BinaryAnalysis_Unparser_Mips_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 unparseMipsMnemonic(SgAsmMipsInstruction*);
14 std::string unparseMipsRegister(SgAsmInstruction*, RegisterDescriptor, RegisterDictionaryPtr);
15 std::string unparseMipsExpression(SgAsmExpression*, const LabelMap*, const RegisterDictionaryPtr&);
16 
17 struct MipsSettings: public Settings {};
18 
19 class Mips: public Base {
20  MipsSettings settings_;
21 
22 protected:
23  explicit Mips(const MipsSettings &settings)
24  : settings_(settings) {}
25 
26 public:
27  static Ptr instance(const MipsSettings &settings = MipsSettings()) {
28  return Ptr(new Mips(settings));
29  }
30 
31  Ptr copy() const override {
32  return instance(settings());
33  }
34 
35  const MipsSettings& settings() const override { return settings_; }
36  MipsSettings& settings() override { return settings_; }
37 
38 protected:
39  void emitInstruction(std::ostream&, SgAsmInstruction*, State&) const override;
40  void emitOperandBody(std::ostream&, SgAsmExpression*, State&) const override;
41 
42 private:
43  void outputExpr(std::ostream&, SgAsmExpression*, State&) const;
44 };
45 
46 } // namespace
47 } // namespace
48 } // namespace
49 
50 #endif
51 #endif
Base class for machine instructions.
Main namespace for the ROSE library.
Settings that control unparsing.
Base class for expressions.
Binary analysis.
Represents one MIPS machine instruction.