ROSE  0.9.6a
 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.
11 
12  // Not clear which of these will be most useful (take a list of one or two operands).
15 
16  // Not clear which of these will be most useful (take an operand list).
18 
19  // Build functions for SgAsmOperandList
23 
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
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
48 BUILD_BINARY_PROTO(Divide)
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.
68 
69  // Implemented versions of "make" functions wrapped as "build" functions.
73 
76 
87 
88  // DQ (5/1/2010): Support for building multi-byte NOP instructions.
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 
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