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