ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SgAsmInstruction.C
Go to the documentation of this file.
1 /* SgAsmInstruction member definitions. Do not move them to src/ROSETTA/Grammar/BinaryInstruction.code (or any *.code file)
2  * because then they won't get indexed/formatted/etc. by C-aware tools. */
3 
4 #include "sage3basic.h"
5 
11 std::set<rose_addr_t>
13  abort();
14  // tps (12/9/2009) : MSC requires a return value
15  std::set<rose_addr_t> t;
16  return t;
17 }
18 
25 std::set<rose_addr_t>
26 SgAsmInstruction::get_successors(const std::vector<SgAsmInstruction*>& basic_block, bool *complete/*out*/,
27  MemoryMap *initial_memory/*=NULL*/)
28 {
29  if (basic_block.size()==0) {
30  if (complete) *complete = true;
31  return std::set<rose_addr_t>();
32  }
33  return basic_block.back()->get_successors(complete);
34 }
35 
40 bool
42 {
43  abort();
44  // tps (12/9/2009) : MSC requires a return value
45  return false;
46 }
47 
54 bool
55 SgAsmInstruction::is_function_call(const std::vector<SgAsmInstruction*>&, rose_addr_t *target, rose_addr_t *return_va)
56 {
57  return false;
58 }
59 
62 bool
63 SgAsmInstruction::is_function_return(const std::vector<SgAsmInstruction*>&)
64 {
65  return false;
66 }
67 
69 bool
71 {
72  SgAsmBlock *bb = SageInterface::getEnclosingNode<SgAsmBlock>(this);
73  if (bb) {
74  const SgAsmStatementPtrList &stmts = bb->get_statementList();
75  for (size_t i=0; i<stmts.size(); ++i) {
76  if (SgAsmInstruction *insn = isSgAsmInstruction(stmts[i]))
77  return insn==this;
78  }
79  }
80  return false;
81 }
82 
84 bool
86 {
87  SgAsmBlock *bb = SageInterface::getEnclosingNode<SgAsmBlock>(this);
88  if (bb) {
89  const SgAsmStatementPtrList &stmts = bb->get_statementList();
90  for (size_t i=stmts.size(); i>0; --i) {
91  if (SgAsmInstruction *insn = isSgAsmInstruction(stmts[i-1]))
92  return insn==this;
93  }
94  }
95  return false;
96 }
97 
100 bool
102  return false;
103 }
104 
108 bool
110 {
111  return true;
112 }
113 
116 bool
117 SgAsmInstruction::has_effect(const std::vector<SgAsmInstruction*>&, bool allow_branch/*false*/,
118  bool relax_stack_semantics/*false*/)
119 {
120  return true;
121 }
122 
128 std::vector<std::pair<size_t,size_t> >
129 SgAsmInstruction::find_noop_subsequences(const std::vector<SgAsmInstruction*>& insns, bool allow_branch/*false*/,
130  bool relax_stack_semantics/*false*/)
131 {
132  std::vector<std::pair<size_t, size_t> > retval;
133  return retval;
134 }
135 
139 size_t
141 {
142  return p_raw_bytes.size();
143 }
144 
148 bool
150 {
151  abort(); // too bad ROSETTA doesn't allow virtual base classes
152  return false;
153 }