ROSE
0.9.6a
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
sageBuilderAsm.h
Go to the documentation of this file.
1
#ifndef ROSE_SAGEBUILDERASM_H
2
#define ROSE_SAGEBUILDERASM_H
3
4
namespace
SageBuilderAsm
5
{
6
// DQ (10/26/2009): I don't think this should be used (it is a copy of the constructor).
7
// SgAsmx86Instruction* buildx86Instruction( rose_addr_t address = 0, std::string mnemonic = "", X86InstructionKind kind = x86_unknown_instruction, X86InstructionSize baseSize = x86_insnsize_none, X86InstructionSize operandSize = x86_insnsize_none, X86InstructionSize addressSize = x86_insnsize_none);
8
9
// This is the simplest interface for the construction of an instruction.
10
SgAsmx86Instruction
*
buildx86Instruction
(
X86InstructionKind
kind );
11
12
// Not clear which of these will be most useful (take a list of one or two operands).
13
SgAsmx86Instruction
*
buildx86Instruction
(
X86InstructionKind
kind,
SgAsmExpression
* operand );
14
SgAsmx86Instruction
*
buildx86Instruction
(
X86InstructionKind
kind,
SgAsmExpression
* lhs,
SgAsmExpression
* rhs );
15
16
// Not clear which of these will be most useful (take an operand list).
17
SgAsmx86Instruction
*
buildx86Instruction
(
X86InstructionKind
kind,
SgAsmOperandList
* operands );
18
19
// Build functions for SgAsmOperandList
20
SgAsmOperandList
*
buildSgAsmOperandList
();
21
SgAsmOperandList
*
buildSgAsmOperandList
(
SgAsmExpression
* operand );
22
SgAsmOperandList
*
buildSgAsmOperandList
(
SgAsmExpression
* lhs = NULL,
SgAsmExpression
* rhs = NULL );
23
24
SgAsmx86RegisterReferenceExpression
*
buildSgAsmx86RegisterReferenceExpression
(
const
RegisterDescriptor
&);
25
SgAsmArmRegisterReferenceExpression
*
buildSgAsmArmRegisterReferenceExpression
(
const
RegisterDescriptor
&);
26
SgAsmMipsRegisterReferenceExpression
*
buildSgAsmMipsRegisterReferenceExpression
(
const
RegisterDescriptor
&);
27
SgAsmPowerpcRegisterReferenceExpression
*
buildSgAsmPowerpcRegisterReferenceExpression
(
const
RegisterDescriptor
&);
28
29
30
template
<
class
T> T*
buildAsmUnaryExpression
(
SgAsmExpression
* operand = NULL);
31
32
// SgAsmUnaryMinus * buildAsmUnaryMinus(SgAsmExpression* op = NULL);
33
34
#define BUILD_UNARY_PROTO(suffix) SgAsmUnary##suffix * buildAsmUnary##suffix(SgAsmExpression* op = NULL);
35
36
// There are more unary operators to add still
37
BUILD_UNARY_PROTO
(Plus)
38
39
// BUILD_UNARY_PROTO(UnaryMinus)
40
41
42
template <class T> T*
buildAsmBinaryExpression
(
SgAsmExpression
* lhs = NULL,
SgAsmExpression
* rhs = NULL);
43
44
#define BUILD_BINARY_PROTO(suffix) SgAsmBinary##suffix * buildAsmBinary##suffix(SgAsmExpression* lhs = NULL, SgAsmExpression* rhs = NULL);
45
46
// There are more binary operators to add still
47
BUILD_BINARY_PROTO
(Add)
48
BUILD_BINARY_PROTO
(Divide)
49
BUILD_BINARY_PROTO
(Mod)
50
BUILD_BINARY_PROTO
(Multiply)
51
BUILD_BINARY_PROTO
(Subtract)
52
53
// These functions are copies of the "make" functions (wrappers for the "make" functions) to provide a consistant interface for the future API.
54
SgAsmIntegerValueExpression
*
buildAsmQWordValue
(uint64_t val);
55
SgAsmBinarySubtract
*
buildAsmSubtract
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
56
SgAsmBinaryAddPreupdate
*
buildAsmAddPreupdate
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
57
SgAsmBinarySubtractPreupdate
*
buildAsmSubtractPreupdate
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
58
SgAsmBinaryAddPostupdate
*
buildAsmAddPostupdate
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
59
SgAsmBinarySubtractPostupdate
*
buildAsmSubtractPostupdate
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
60
SgAsmBinaryMultiply
*
buildAsmMul
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
61
SgAsmBinaryLsl
*
buildAsmLsl
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
62
SgAsmBinaryLsr
*
buildAsmLsr
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
63
SgAsmBinaryAsr
*
buildAsmAsr
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
64
SgAsmBinaryRor
*
buildAsmRor
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
65
SgAsmUnaryRrx
*
buildAsmRrx
(
SgAsmExpression
* lhs);
66
SgAsmUnaryArmSpecialRegisterList
*
buildAsmArmSpecialRegisterList
(
SgAsmExpression
* lhs);
67
SgAsmExprListExp
*
buildAsmExprListExp
();
68
69
// Implemented versions of "make" functions wrapped as "build" functions.
70
SgAsmIntegerValueExpression
*
buildAsmDWordValue
(uint32_t val);
71
SgAsmIntegerValueExpression
*
buildAsmByteValue
(uint8_t val);
72
SgAsmIntegerValueExpression
*
buildAsmWordValue
(uint16_t val);
73
74
SgAsmMemoryReferenceExpression
*
buildAsmMemoryReferenceExpression
(
SgAsmExpression
* addr,
SgAsmExpression
*
segment
= NULL,
SgAsmType
* t = NULL);
75
SgAsmBinaryAdd
*
buildAsmAddExpression
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
76
77
SgAsmTypeByte
*
buildAsmTypeByte
();
78
SgAsmTypeWord
*
buildAsmTypeWord
();
79
SgAsmTypeDoubleWord
*
buildAsmTypeDoubleWord
();
80
SgAsmTypeQuadWord
*
buildAsmTypeQuadWord
();
81
SgAsmTypeSingleFloat
*
buildAsmTypeSingleFloat
();
82
SgAsmTypeDoubleFloat
*
buildAsmTypeDoubleFloat
();
83
SgAsmType128bitFloat
*
buildAsmType128bitFloat
();
84
SgAsmType80bitFloat
*
buildAsmType80bitFloat
();
85
SgAsmTypeDoubleQuadWord
*
buildAsmTypeDoubleQuadWord
();
86
SgAsmTypeVector
*
buildAsmTypeVector
();
87
88
// DQ (5/1/2010): Support for building multi-byte NOP instructions.
89
SgAsmInstruction
*
buildMultibyteNopInstruction
(
int
n);
90
91
#if 1
92
// DQ (10/28/2009): These functions are not similar in name to the
93
// associated "build" functions in the sageBuilder.h. They are however
94
// needed elsewhere in ROSE (src/frontend/Disassemblers directory).
95
96
SgAsmIntegerValueExpression
*
makeByteValue
(uint8_t val);
97
SgAsmIntegerValueExpression
*
makeWordValue
(uint16_t val);
98
SgAsmIntegerValueExpression
*
makeDWordValue
(uint32_t val);
99
SgAsmIntegerValueExpression
*
makeQWordValue
(uint64_t val);
100
SgAsmMemoryReferenceExpression
*
makeMemoryReference
(
SgAsmExpression
* addr,
SgAsmExpression
*
segment
= NULL,
SgAsmType
* t = NULL);
101
SgAsmBinaryAdd
*
makeAdd
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
102
SgAsmBinarySubtract
*
makeSubtract
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
103
SgAsmBinaryAddPreupdate
*
makeAddPreupdate
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
104
SgAsmBinarySubtractPreupdate
*
makeSubtractPreupdate
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
105
SgAsmBinaryAddPostupdate
*
makeAddPostupdate
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
106
SgAsmBinarySubtractPostupdate
*
makeSubtractPostupdate
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
107
SgAsmBinaryMultiply
*
makeMul
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
108
SgAsmBinaryLsl
*
makeLsl
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
109
SgAsmBinaryLsr
*
makeLsr
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
110
SgAsmBinaryAsr
*
makeAsr
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
111
SgAsmBinaryRor
*
makeRor
(
SgAsmExpression
* lhs,
SgAsmExpression
* rhs);
112
SgAsmUnaryRrx
*
makeRrx
(
SgAsmExpression
* lhs);
113
SgAsmUnaryArmSpecialRegisterList
*
makeArmSpecialRegisterList
(
SgAsmExpression
* lhs);
114
SgAsmExprListExp
*
makeExprListExp
();
115
#endif
116
117
template
<
typename
Insn>
// For correct subtype to be returned
118
inline
Insn*
appendOperand
(Insn* insn,
SgAsmExpression
* op)
119
{
120
SgAsmOperandList
* operands = insn->get_operandList();
121
operands->
get_operands
().push_back(op);
122
op->
set_parent
(operands);
123
return
insn;
// For chaining this operation
124
}
125
126
// end of SageBuilderAsm namespace
127
}
128
#endif // ROSE_SAGEBUILDERASM_H
rose-edg4x
src
frontend
SageIII
sageInterface
sageBuilderAsm.h
Generated on Mon May 5 2014 17:29:26 for ROSE by
1.8.4