ROSE 0.11.145.147
Unparser/Aarch32.h
1#ifndef ROSE_BinaryAnalysis_Unparser_Aarch32_H
2#define ROSE_BinaryAnalysis_Unparser_Aarch32_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_ASM_AARCH32
5
6#include <Rose/BinaryAnalysis/BasicTypes.h>
7#include <Rose/BinaryAnalysis/Unparser/Base.h>
8
9namespace Rose {
10namespace BinaryAnalysis {
11namespace Unparser {
12
13std::string unparseAarch32Mnemonic(SgAsmAarch32Instruction*);
14std::string unparseAarch32Expression(SgAsmExpression*, const LabelMap*);
15
17struct Aarch32Settings: public Settings {};
18
22class Aarch32: public Base {
23 Aarch32Settings settings_;
24
25protected:
26 explicit Aarch32(const Architecture::BaseConstPtr&, const Aarch32Settings&);
27
28public:
29 ~Aarch32();
30
31 static Ptr instance(const Architecture::BaseConstPtr&, const Aarch32Settings& = Aarch32Settings());
32
33 Ptr copy() const override;
34
35 const Aarch32Settings& settings() const override { return settings_; }
36 Aarch32Settings& settings() override { return settings_; }
37
38protected:
39 void emitInstructionMnemonic(std::ostream&, SgAsmInstruction*, State&) const override;
40 void emitOperandBody(std::ostream&, SgAsmExpression*, State&) const override;
41
42protected:
43 void outputExpr(std::ostream&, SgAsmExpression*, State &) const;
44 void outputRegister(std::ostream&, SgAsmRegisterReferenceExpression*, State&) const;
45
46private:
47 // Precedence for the sake of emitting expressions. Higher return value is higher precedence.
48 static int operatorPrecedence(SgAsmExpression*);
49
50 // Parentheses for emitting expressions with inverted precedences
51 struct Parens {
52 std::string left, right;
53 Parens() {}
54 Parens(const std::string &left, const std::string &right)
55 : left(left), right(right) {}
56 };
57
58 // What parens to use when the operator has rootPrec and the left or right operand is as specified.
59 static Parens parensForPrecedence(int rootPrec, SgAsmExpression*);
60};
61
62} // namespace
63} // namespace
64} // namespace
65
66#endif
67#endif
Base class for expressions.
Base class for machine instructions.
Base class for references to a machine register.
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.
std::map< uint64_t, std::string > LabelMap
Map from address to label.
The ROSE library.
Settings settings
Command-line settings for the rosebud tool.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.