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