2#ifndef ROSE_SgAsmBlock_H
3#define ROSE_SgAsmBlock_H
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmStatement.h>
27#include <Rose/BinaryAnalysis/Address.h>
29#include <sageContainer.h>
31#ifdef ROSE_SgAsmBlock_IMPL
32#include <SgAsmInstruction.h>
40#if !defined(DOCUMENTATION)
55#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
57 friend class boost::serialization::access;
63 s & BOOST_SERIALIZATION_NVP(p_reason);
64 s & BOOST_SERIALIZATION_NVP(p_statementList);
65 s & BOOST_SERIALIZATION_NVP(p_successors);
66 s & BOOST_SERIALIZATION_NVP(p_successorsComplete);
67 s & BOOST_SERIALIZATION_NVP(p_immediateDominator);
68 s & BOOST_SERIALIZATION_NVP(p_cachedVertex);
69 s & BOOST_SERIALIZATION_NVP(p_codeLikelihood);
70 s & BOOST_SERIALIZATION_NVP(p_stackDeltaOut);
81 BLK_NONE = 0x00000000,
82 BLK_ENTRY_POINT = 0x00010000,
83 BLK_PADDING = 0x00020000,
84 BLK_FRAGMENT = 0x00080000,
86 BLK_CFGHEAD = 0x00100000,
87 BLK_USERDEF = 0x00200000,
88 BLK_LEFTOVERS = 0x00400000,
90 BLK_JUMPTABLE = 0x00800000,
91 BLK_GRAPH1 = 0x01000000,
92 BLK_GRAPH2 = 0x02000000,
93 BLK_GRAPH3 = 0x04000000,
95 BLK_DEFAULT = BLK_NONE,
100 BLK_MISCMASK = 0x000000ff,
102 BLK_FINDDATA = 0x00000001,
104 BLK_POSTFUNC = 0x00000002
130 unsigned const& get_reason()
const;
131 void set_reason(
unsigned const&);
144 SgAsmStatementPtrList
const& get_statementList()
const;
145 SgAsmStatementPtrList& get_statementList();
146 void set_statementList(SgAsmStatementPtrList
const&);
160 SgAsmIntegerValuePtrList
const& get_successors()
const;
161 SgAsmIntegerValuePtrList& get_successors();
162 void set_successors(SgAsmIntegerValuePtrList
const&);
176 bool const& get_successorsComplete()
const;
177 void set_successorsComplete(
bool const&);
190 SgAsmBlock*
const& get_immediateDominator()
const;
191 void set_immediateDominator(
SgAsmBlock*
const&);
203 size_t const& get_cachedVertex()
const;
204 void set_cachedVertex(
size_t const&);
214 double const& get_codeLikelihood()
const;
215 void set_codeLikelihood(
double const&);
227 int64_t
const& get_stackDeltaOut()
const;
228 void set_stackDeltaOut(int64_t
const&);
249 void removeChildren();
267 bool hasInstructions()
const;
274 bool isBasicBlock()
const;
290 static std::string reasonKey(
const std::string &prefix =
"");
295 std::string reasonString(
bool pad)
const;
302 static std::string reasonString(
bool pad,
unsigned reason);
309 bool get_successors_complete() const ROSE_DEPRECATED("use get_successorsComplete");
310 void set_successors_complete(
bool) ROSE_DEPRECATED("use get_successorsComplete");
311 SgAsmBlock* get_immediate_dominator() const ROSE_DEPRECATED("use get_immediateDominator");
312 void set_immediate_dominator(
SgAsmBlock*) ROSE_DEPRECATED("use set_immediateDominator");
313 size_t get_cached_vertex() const ROSE_DEPRECATED("use get_cachedVertex");
314 void set_cached_vertex(
size_t) ROSE_DEPRECATED("use set_cachedVertex");
315 double get_code_likelihood() const ROSE_DEPRECATED("use get_codeLikelihood");
316 void set_code_likelihood(
double) ROSE_DEPRECATED("use set_codeLikelihood");
317 void append_statement(
SgAsmStatement*) ROSE_DEPRECATED("use appendStatement");
318 void remove_statement(
SgAsmStatement*) ROSE_DEPRECATED("use removeStatement");
319 void remove_children() ROSE_DEPRECATED("use removeChildren");
320 Rose::BinaryAnalysis::Address get_fallthrough_va() ROSE_DEPRECATED("use getFallthroughVa");
321 SgAsmFunction* get_enclosing_function() const ROSE_DEPRECATED("use get_enclosingFunction");
322 bool has_instructions() const ROSE_DEPRECATED("use hasInstructions");
323 bool is_basic_block() const ROSE_DEPRECATED("use isBasicBlock");
324 bool is_function_call(
Rose::BinaryAnalysis::Address&,
Rose::BinaryAnalysis::Address&) ROSE_DEPRECATED("use isFunctionCall");
325 static std::
string reason_key(const std::
string& = "") ROSE_DEPRECATED("use reasonKey");
326 std::
string reason_str(
bool) const ROSE_DEPRECATED("use reasonString");
327 static std::
string reason_str(
bool,
unsigned) ROSE_DEPRECATED("use reasonString");
338 explicit
SgAsmBlock(
Rose::BinaryAnalysis::Address const& address);
347 void initializeProperties();
366 virtual std::
string class_name() const override;
369 virtual VariantT variantT() const override;
374 enum { static_variant = V_SgAsmBlock };
389 static const unsigned pool_size;
391 static std::vector<unsigned char *> pools;
396 static unsigned long initializeStorageClassArray(SgAsmBlockStorageClass *);
399 static void clearMemoryPool();
400 static void deleteMemoryPool();
403 static void extendMemoryPoolForFileIO();
406 static SgAsmBlock * getPointerFromGlobalIndex(
unsigned long);
408 static SgAsmBlock * getPointerFromGlobalIndex(AstSpecificDataManagingClass *,
unsigned long);
411 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(
unsigned long);
413 static void resetValidFreepointers();
415 static unsigned long getNumberOfLastValidPointer();
418#if defined(INLINE_FUNCTIONS)
420 inline void *
operator new (
size_t size);
423 void *
operator new (
size_t size);
426 void operator delete (
void* pointer,
size_t size);
429 void operator delete (
void* pointer)
432 SgAsmBlock::operator
delete (pointer,
sizeof(
SgAsmBlock));
475#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
478 virtual RTIReturnType
roseRTI()
override;
492 virtual const char*
sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
498 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
553 static std::string getNodeIdStringInternal(
SgAsmBlock* sgnode);
680 friend class SgAsmBlockStorageClass;
683 friend class AstSpecificDataManagingClass;
686 friend class AstSpecificDataManagingClassStorageClass;
689 SgAsmBlock(
const SgAsmBlockStorageClass& source );
718#define BUILD_ATERM_SUPPORT 0
719 #if BUILD_ATERM_SUPPORT
720 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
732 virtual ATerm generate_ATerm()
override;
735 virtual void generate_ATerm_Annotation(ATerm & term)
override;
777SgAsmStatementPtrList p_statementList;
781SgAsmIntegerValuePtrList p_successors;
785bool p_successorsComplete;
793size_t p_cachedVertex;
797double p_codeLikelihood;
801int64_t p_stackDeltaOut;
Class holding static data and functions supporting File I/O.
Attribute containing a regex expression as a string.
Represents a synthesized function.
Base class for statement-like subclasses.
Supporting class from copy mechanism within ROSE.
This class represents the base class for all IR nodes within Sage III.
virtual RTIReturnType roseRTI()
return C++ Runtime-Time-Information
virtual size_t get_numberOfTraversalSuccessors() const
return number of children in the traversal successor list
virtual std::vector< std::string > get_traversalSuccessorNamesContainer() const
container of names of variables or container indices used used in the traversal to access AST success...
virtual void debugSerializationEnd(const char *className)
Called by generated serializers.
static std::string getNodeIdString(SgNode *sgnode)
compute the NodeId for a particular SgNode*.
virtual bool isInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
int variant() const
Older version function returns enum value "NODE".
virtual void processDataMemberReferenceToPointers(ReferenceToPointerHandler *)
FOR INTERNAL USE Processes pairs of references to SgNode* and strings for use in AST tools
virtual size_t get_childIndex(SgNode *child) const
index-based access to traversal successors by child node
virtual std::vector< SgNode * > get_traversalSuccessorContainer() const
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
virtual long getChildIndex(SgNode *childNode) const
FOR INTERNAL USE Returns a unique index value for the childNode in the list of children at this IR no...
virtual void debugSerializationBegin(const char *className)
Called by generated serializers.
virtual SgNode * get_traversalSuccessorByIndex(size_t idx) const
index-based access to traversal successors by index number
static void visitRepresentativeNode(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for type-based traversal.
virtual void checkDataMemberPointersIfInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
static size_t numberOfNodes()
Returns the total number of IR nodes of this type.
virtual void accept(ROSE_VisitorPattern &visitor)
support for the classic visitor pattern done in GoF
static void traverseMemoryPoolVisitorPattern(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
void executeVisitorMemberFunction(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
static SgNode * getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx)
Find a node by its variant type, pool index, and item index.
static size_t memoryUsage()
Returns the size in bytes of the total memory allocated for all IR nodes of this type.
static void traverseMemoryPoolNodes(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
virtual const char * sage_class_name() const
generates string representing the class name: (e.g. for SgNode returns "SgNode").
virtual std::vector< std::pair< SgNode *, std::string > > returnDataMemberPointers() const
FOR INTERNAL USE Returns STL vector of pairs of SgNode* and strings for use in AST tools
static SgNode * getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx)
FOR INTERNAL USE Find an SgNode from its memory pool and location therin.
SgNode * addRegExpAttribute(std::string s, AstRegExAttribute *a)
Support for AST matching using regular expression.
std::uint64_t Address
Address.
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
ROSE_DLL_API void appendStatement(SgStatement *stmt, SgScopeStatement *scope=NULL)
Append a statement to the end of the current scope, handle side effect of appending statements,...
ROSE_DLL_API void removeStatement(SgStatement *stmt, bool autoRelocatePreprocessingInfo=true)
Remove a statement from its attach point of the AST. Automatically keep its associated preprocessing ...
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.
const char * Reason(int64_t)
Convert Rose::AST::Defects::Reason enum constant to a string.