2#ifndef ROSE_SgAsmBlock_H
3#define ROSE_SgAsmBlock_H
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmStatement.h>
27#include <sageContainer.h>
29#ifdef ROSE_SgAsmBlock_IMPL
30#include <SgAsmInstruction.h>
38#if !defined(DOCUMENTATION)
53#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
55 friend class boost::serialization::access;
61 s & BOOST_SERIALIZATION_NVP(p_reason);
62 s & BOOST_SERIALIZATION_NVP(p_statementList);
63 s & BOOST_SERIALIZATION_NVP(p_successors);
64 s & BOOST_SERIALIZATION_NVP(p_successorsComplete);
65 s & BOOST_SERIALIZATION_NVP(p_immediateDominator);
66 s & BOOST_SERIALIZATION_NVP(p_cachedVertex);
67 s & BOOST_SERIALIZATION_NVP(p_codeLikelihood);
68 s & BOOST_SERIALIZATION_NVP(p_stackDeltaOut);
79 BLK_NONE = 0x00000000,
80 BLK_ENTRY_POINT = 0x00010000,
81 BLK_PADDING = 0x00020000,
82 BLK_FRAGMENT = 0x00080000,
84 BLK_CFGHEAD = 0x00100000,
85 BLK_USERDEF = 0x00200000,
86 BLK_LEFTOVERS = 0x00400000,
88 BLK_JUMPTABLE = 0x00800000,
89 BLK_GRAPH1 = 0x01000000,
90 BLK_GRAPH2 = 0x02000000,
91 BLK_GRAPH3 = 0x04000000,
93 BLK_DEFAULT = BLK_NONE,
98 BLK_MISCMASK = 0x000000ff,
100 BLK_FINDDATA = 0x00000001,
102 BLK_POSTFUNC = 0x00000002
118 rose_addr_t
const& get_id()
const;
119 void set_id(rose_addr_t
const&);
128 unsigned const& get_reason()
const;
129 void set_reason(
unsigned const&);
142 SgAsmStatementPtrList
const& get_statementList()
const;
143 SgAsmStatementPtrList& get_statementList();
144 void set_statementList(SgAsmStatementPtrList
const&);
158 SgAsmIntegerValuePtrList
const& get_successors()
const;
159 SgAsmIntegerValuePtrList& get_successors();
160 void set_successors(SgAsmIntegerValuePtrList
const&);
174 bool const& get_successorsComplete()
const;
175 void set_successorsComplete(
bool const&);
188 SgAsmBlock*
const& get_immediateDominator()
const;
189 void set_immediateDominator(
SgAsmBlock*
const&);
201 size_t const& get_cachedVertex()
const;
202 void set_cachedVertex(
size_t const&);
212 double const& get_codeLikelihood()
const;
213 void set_codeLikelihood(
double const&);
225 int64_t
const& get_stackDeltaOut()
const;
226 void set_stackDeltaOut(int64_t
const&);
247 void removeChildren();
253 rose_addr_t get_fallthroughVa();
265 bool hasInstructions()
const;
272 bool isBasicBlock()
const;
283 bool isFunctionCall(rose_addr_t &target_va, rose_addr_t &return_va);
288 static std::string reasonKey(
const std::string &prefix =
"");
293 std::string reasonString(
bool pad)
const;
300 static std::string reasonString(
bool pad,
unsigned reason);
307 bool get_successors_complete() const ROSE_DEPRECATED("use get_successorsComplete");
308 void set_successors_complete(
bool) ROSE_DEPRECATED("use get_successorsComplete");
309 SgAsmBlock* get_immediate_dominator() const ROSE_DEPRECATED("use get_immediateDominator");
310 void set_immediate_dominator(
SgAsmBlock*) ROSE_DEPRECATED("use set_immediateDominator");
311 size_t get_cached_vertex() const ROSE_DEPRECATED("use get_cachedVertex");
312 void set_cached_vertex(
size_t) ROSE_DEPRECATED("use set_cachedVertex");
313 double get_code_likelihood() const ROSE_DEPRECATED("use get_codeLikelihood");
314 void set_code_likelihood(
double) ROSE_DEPRECATED("use set_codeLikelihood");
315 void append_statement(
SgAsmStatement*) ROSE_DEPRECATED("use appendStatement");
316 void remove_statement(
SgAsmStatement*) ROSE_DEPRECATED("use removeStatement");
317 void remove_children() ROSE_DEPRECATED("use removeChildren");
318 rose_addr_t get_fallthrough_va() ROSE_DEPRECATED("use getFallthroughVa");
319 SgAsmFunction* get_enclosing_function() const ROSE_DEPRECATED("use get_enclosingFunction");
320 bool has_instructions() const ROSE_DEPRECATED("use hasInstructions");
321 bool is_basic_block() const ROSE_DEPRECATED("use isBasicBlock");
322 bool is_function_call(rose_addr_t&, rose_addr_t&) ROSE_DEPRECATED("use isFunctionCall");
323 static std::
string reason_key(const std::
string& = "") ROSE_DEPRECATED("use reasonKey");
324 std::
string reason_str(
bool) const ROSE_DEPRECATED("use reasonString");
325 static std::
string reason_str(
bool,
unsigned) ROSE_DEPRECATED("use reasonString");
336 explicit
SgAsmBlock(rose_addr_t const& address);
345 void initializeProperties();
364 virtual std::
string class_name() const override;
367 virtual VariantT variantT() const override;
372 enum { static_variant = V_SgAsmBlock };
387 static const unsigned pool_size;
389 static std::vector<unsigned char *> pools;
394 static unsigned long initializeStorageClassArray(SgAsmBlockStorageClass *);
397 static void clearMemoryPool();
398 static void deleteMemoryPool();
401 static void extendMemoryPoolForFileIO();
404 static SgAsmBlock * getPointerFromGlobalIndex(
unsigned long);
406 static SgAsmBlock * getPointerFromGlobalIndex(AstSpecificDataManagingClass *,
unsigned long);
409 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(
unsigned long);
411 static void resetValidFreepointers();
413 static unsigned long getNumberOfLastValidPointer();
416#if defined(INLINE_FUNCTIONS)
418 inline void *
operator new (
size_t size);
421 void *
operator new (
size_t size);
424 void operator delete (
void* pointer,
size_t size);
427 void operator delete (
void* pointer)
430 SgAsmBlock::operator
delete (pointer,
sizeof(
SgAsmBlock));
473#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
476 virtual RTIReturnType
roseRTI()
override;
490 virtual const char*
sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
496 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
551 static std::string getNodeIdStringInternal(
SgAsmBlock* sgnode);
678 friend class SgAsmBlockStorageClass;
681 friend class AstSpecificDataManagingClass;
684 friend class AstSpecificDataManagingClassStorageClass;
687 SgAsmBlock(
const SgAsmBlockStorageClass& source );
716#define BUILD_ATERM_SUPPORT 0
717 #if BUILD_ATERM_SUPPORT
718 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
730 virtual ATerm generate_ATerm()
override;
733 virtual void generate_ATerm_Annotation(ATerm & term)
override;
775SgAsmStatementPtrList p_statementList;
779SgAsmIntegerValuePtrList p_successors;
783bool p_successorsComplete;
791size_t p_cachedVertex;
795double p_codeLikelihood;
799int64_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 size_t get_numberOfTraversalSuccessors()
return number of children in the traversal successor list
virtual RTIReturnType roseRTI()
return C++ Runtime-Time-Information
virtual std::vector< std::string > get_traversalSuccessorNamesContainer()
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 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 size_t get_childIndex(SgNode *child)
index-based access to traversal successors by child node
virtual void debugSerializationBegin(const char *className)
Called by generated serializers.
virtual std::vector< SgNode * > get_traversalSuccessorContainer()
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
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
virtual SgNode * get_traversalSuccessorByIndex(size_t idx)
index-based access to traversal successors by index number
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.
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.