2#ifndef ROSE_SgAsmFunction_H
3#define ROSE_SgAsmFunction_H
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmSynthesizedDeclaration.h>
27#include <Rose/BinaryAnalysis/AddressIntervalSet.h>
28#include <sageContainer.h>
30#ifdef ROSE_SgAsmFunction_IMPL
31#include <SgAsmInstruction.h>
39#if !defined(DOCUMENTATION)
54#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
56 friend class boost::serialization::access;
62 s & BOOST_SERIALIZATION_NVP(p_name);
63 s & BOOST_SERIALIZATION_NVP(p_reason);
64 s & BOOST_SERIALIZATION_NVP(p_reasonComment);
65 s & BOOST_SERIALIZATION_NVP(p_functionKind);
66 s & BOOST_SERIALIZATION_NVP(p_mayReturn);
67 s & BOOST_SERIALIZATION_NVP(p_nameMd5);
68 s & BOOST_SERIALIZATION_NVP(p_statementList);
69 s & BOOST_SERIALIZATION_NVP(p_dest);
70 s & BOOST_SERIALIZATION_NVP(p_entryVa);
71 s & BOOST_SERIALIZATION_NVP(p_cachedVertex);
72 s & BOOST_SERIALIZATION_NVP(p_stackDelta);
73 s & BOOST_SERIALIZATION_NVP(p_callingConvention);
95 FUNC_NONE = 0x00000000,
96 FUNC_THUNK_TARGET= 0x00004000,
97 FUNC_EXCEPTION_HANDLER
99 FUNC_ENTRY_POINT = 0x00010000,
100 FUNC_CALL_TARGET = 0x00020000,
103 FUNC_CALL_INSN = 0x00040000,
109 FUNC_EH_FRAME = 0x00080000,
110 FUNC_SYMBOL = 0x00100000,
111 FUNC_PATTERN = 0x00200000,
116 FUNC_GRAPH = 0x00400000,
120 FUNC_USERDEF = 0x00800000,
121 FUNC_PADDING = 0x01000000,
126 FUNC_DISCONT = 0x02000000,
129 FUNC_INSNHEAD = 0x04000000,
130 FUNC_IMPORT = 0x08000000,
133 FUNC_LEFTOVERS = 0x10000000,
137 FUNC_INTRABLOCK = 0x20000000,
145 FUNC_THUNK = 0x40000000,
154 FUNC_EXPORT = 0x80000000,
156 FUNC_DEFAULT = 0xefff80ff,
161 FUNC_MISCMASK = 0x000000ff,
167 FUNC_INTERPADFUNC = 1,
170 FUNC_PESCRAMBLER_DISPATCH = 2,
173 FUNC_SCAN_RO_DATA = 5,
174 FUNC_INSN_RO_DATA = 6,
198 std::string
const&
get_name()
const;
209 unsigned const& get_reason()
const;
210 void set_reason(
unsigned const&);
221 std::string
const& get_reasonComment()
const;
222 void set_reasonComment(std::string
const&);
249 std::string
const& get_nameMd5()
const;
250 void set_nameMd5(std::string
const&);
259 SgAsmStatementPtrList
const& get_statementList()
const;
260 SgAsmStatementPtrList& get_statementList();
261 void set_statementList(SgAsmStatementPtrList
const&);
265 SgAsmStatementPtrList
const& get_dest()
const;
266 void set_dest(SgAsmStatementPtrList
const&);
275 rose_addr_t
const& get_entryVa()
const;
276 void set_entryVa(rose_addr_t
const&);
291 size_t const& get_cachedVertex()
const;
292 void set_cachedVertex(
size_t const&);
304 int64_t
const& get_stackDelta()
const;
305 void set_stackDelta(int64_t
const&);
317 std::string
const& get_callingConvention()
const;
318 void set_callingConvention(std::string
const&);
341 static std::string reasonKey(
const std::string &prefix =
"");
344 std::string reasonString(
bool pad)
const;
349 static std::string reasonString(
bool pad,
unsigned reason);
354 virtual ~NodeSelector() {}
355 virtual bool operator()(
SgNode*) = 0;
398 NodeSelector *selector=NULL);
405 bool get_sha1(uint8_t digest[20], NodeSelector *selector=NULL);
412 void set_function_kind(function_kind_enum) ROSE_DEPRECATED("use set_functionKind");
413 MayReturn get_may_return() const ROSE_DEPRECATED("use get_mayReturn");
414 void set_may_return(MayReturn) ROSE_DEPRECATED("use set_mayReturn");
415 const std::
string& get_name_md5() const ROSE_DEPRECATED("use get_nameMd5");
416 void set_name_md5(const std::
string&) ROSE_DEPRECATED("use set_nameMd5");
417 rose_addr_t get_entry_va() const ROSE_DEPRECATED("use get_entryVa");
418 void set_entry_va(rose_addr_t) ROSE_DEPRECATED("use set_entryVa");
419 SgSymbolTable* get_symbol_table() const ROSE_DEPRECATED("use get_symbolTable");
420 void set_symbol_table(
SgSymbolTable*) ROSE_DEPRECATED("use set_symbolTable");
421 size_t get_cached_vertex() const ROSE_DEPRECATED("use get_cachedVertex");
422 void set_cached_vertex(
size_t) ROSE_DEPRECATED("use set_cachedVertex");
423 void append_statement(
SgAsmStatement*) ROSE_DEPRECATED("use appendStatement");
424 void remove_statement(
SgAsmStatement* statement) ROSE_DEPRECATED("use removeStatement");
425 SgAsmBlock* get_entry_block() const ROSE_DEPRECATED("use get_entryBlock");
426 static std::
string reason_key(const std::
string &prefix="") ROSE_DEPRECATED("use reasonKey");
427 std::
string reason_str(
bool) const ROSE_DEPRECATED("use reasonString");
428 static std::
string reason_str(
bool,
unsigned) ROSE_DEPRECATED("use reasonString");
440 std::
string const& name,
441 unsigned const& reason,
451 void initializeProperties();
470 virtual std::
string class_name() const override;
473 virtual VariantT variantT() const override;
478 enum { static_variant = V_SgAsmFunction };
493 static const unsigned pool_size;
495 static std::vector<unsigned char *> pools;
500 static unsigned long initializeStorageClassArray(SgAsmFunctionStorageClass *);
503 static void clearMemoryPool();
504 static void deleteMemoryPool();
507 static void extendMemoryPoolForFileIO();
510 static SgAsmFunction * getPointerFromGlobalIndex(
unsigned long);
512 static SgAsmFunction * getPointerFromGlobalIndex(AstSpecificDataManagingClass *,
unsigned long);
515 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(
unsigned long);
517 static void resetValidFreepointers();
519 static unsigned long getNumberOfLastValidPointer();
522#if defined(INLINE_FUNCTIONS)
524 inline void *
operator new (
size_t size);
527 void *
operator new (
size_t size);
530 void operator delete (
void* pointer,
size_t size);
533 void operator delete (
void* pointer)
536 SgAsmFunction::operator
delete (pointer,
sizeof(
SgAsmFunction));
579#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
582 virtual RTIReturnType
roseRTI()
override;
596 virtual const char*
sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
602 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
657 static std::string getNodeIdStringInternal(
SgAsmFunction* sgnode);
784 friend class SgAsmFunctionStorageClass;
787 friend class AstSpecificDataManagingClass;
790 friend class AstSpecificDataManagingClassStorageClass;
822#define BUILD_ATERM_SUPPORT 0
823 #if BUILD_ATERM_SUPPORT
824 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
836 virtual ATerm generate_ATerm()
override;
839 virtual void generate_ATerm_Annotation(ATerm & term)
override;
885std::string p_reasonComment;
897std::string p_nameMd5;
901SgAsmStatementPtrList p_statementList;
905SgAsmStatementPtrList p_dest;
909rose_addr_t p_entryVa;
917size_t p_cachedVertex;
925std::string p_callingConvention;
Class holding static data and functions supporting File I/O.
Attribute containing a regex expression as a string.
Represents a synthesized function.
function_kind_enum
Constants for the "function_kind" property.
MayReturn
Whether a function returns.
Base class for statement-like subclasses.
Base class for synthesized declarations.
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.
This class represents the symbol tables used in both SgScopeStatement and the SgFunctionTypeSymbolTab...
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
ROSE_DLL_API int set_name(SgInitializedName *initializedNameNode, SgName new_name)
set_name of symbol in symbol table.
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,...
std::string get_name(const SgNode *node)
Generate a useful name to describe the SgNode.
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 * FunctionReason(int64_t)
Convert SgAsmFunction::FunctionReason enum constant to a string.
const char * MayReturn(int64_t)
Convert SgAsmFunction::MayReturn enum constant to a string.
const char * function_kind_enum(int64_t)
Convert SgAsmFunction::function_kind_enum enum constant to a string.