2#ifndef ROSE_SgAsmFunction_H
3#define ROSE_SgAsmFunction_H
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmSynthesizedDeclaration.h>
27#include <Rose/BinaryAnalysis/Address.h>
28#include <Rose/BinaryAnalysis/AddressIntervalSet.h>
29#include <sageContainer.h>
31#ifdef ROSE_SgAsmFunction_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_name);
64 s & BOOST_SERIALIZATION_NVP(p_reason);
65 s & BOOST_SERIALIZATION_NVP(p_reasonComment);
66 s & BOOST_SERIALIZATION_NVP(p_functionKind);
67 s & BOOST_SERIALIZATION_NVP(p_mayReturn);
68 s & BOOST_SERIALIZATION_NVP(p_nameMd5);
69 s & BOOST_SERIALIZATION_NVP(p_statementList);
70 s & BOOST_SERIALIZATION_NVP(p_dest);
71 s & BOOST_SERIALIZATION_NVP(p_entryVa);
72 s & BOOST_SERIALIZATION_NVP(p_cachedVertex);
73 s & BOOST_SERIALIZATION_NVP(p_stackDelta);
74 s & BOOST_SERIALIZATION_NVP(p_callingConvention);
96 FUNC_NONE = 0x00000000,
97 FUNC_THUNK_TARGET= 0x00004000,
98 FUNC_EXCEPTION_HANDLER
100 FUNC_ENTRY_POINT = 0x00010000,
101 FUNC_CALL_TARGET = 0x00020000,
104 FUNC_CALL_INSN = 0x00040000,
110 FUNC_EH_FRAME = 0x00080000,
111 FUNC_SYMBOL = 0x00100000,
112 FUNC_PATTERN = 0x00200000,
117 FUNC_GRAPH = 0x00400000,
121 FUNC_USERDEF = 0x00800000,
122 FUNC_PADDING = 0x01000000,
127 FUNC_DISCONT = 0x02000000,
130 FUNC_INSNHEAD = 0x04000000,
131 FUNC_IMPORT = 0x08000000,
134 FUNC_LEFTOVERS = 0x10000000,
138 FUNC_INTRABLOCK = 0x20000000,
146 FUNC_THUNK = 0x40000000,
155 FUNC_EXPORT = 0x80000000,
157 FUNC_DEFAULT = 0xefff80ff,
162 FUNC_MISCMASK = 0x000000ff,
168 FUNC_INTERPADFUNC = 1,
171 FUNC_PESCRAMBLER_DISPATCH = 2,
174 FUNC_SCAN_RO_DATA = 5,
175 FUNC_INSN_RO_DATA = 6,
199 std::string
const&
get_name()
const;
210 unsigned const& get_reason()
const;
211 void set_reason(
unsigned const&);
222 std::string
const& get_reasonComment()
const;
223 void set_reasonComment(std::string
const&);
250 std::string
const& get_nameMd5()
const;
251 void set_nameMd5(std::string
const&);
260 SgAsmStatementPtrList
const& get_statementList()
const;
261 SgAsmStatementPtrList& get_statementList();
262 void set_statementList(SgAsmStatementPtrList
const&);
266 SgAsmStatementPtrList
const& get_dest()
const;
267 void set_dest(SgAsmStatementPtrList
const&);
292 size_t const& get_cachedVertex()
const;
293 void set_cachedVertex(
size_t const&);
305 int64_t
const& get_stackDelta()
const;
306 void set_stackDelta(int64_t
const&);
318 std::string
const& get_callingConvention()
const;
319 void set_callingConvention(std::string
const&);
342 static std::string reasonKey(
const std::string &prefix =
"");
345 std::string reasonString(
bool pad)
const;
350 static std::string reasonString(
bool pad,
unsigned reason);
355 virtual ~NodeSelector() {}
356 virtual bool operator()(
SgNode*) = 0;
406 bool get_sha1(uint8_t digest[20], NodeSelector *selector=NULL);
413 void set_function_kind(function_kind_enum) ROSE_DEPRECATED("use set_functionKind");
414 MayReturn get_may_return() const ROSE_DEPRECATED("use get_mayReturn");
415 void set_may_return(MayReturn) ROSE_DEPRECATED("use set_mayReturn");
416 const std::
string& get_name_md5() const ROSE_DEPRECATED("use get_nameMd5");
417 void set_name_md5(const std::
string&) ROSE_DEPRECATED("use set_nameMd5");
418 Rose::BinaryAnalysis::Address get_entry_va() const ROSE_DEPRECATED("use get_entryVa");
419 void set_entry_va(
Rose::BinaryAnalysis::Address) ROSE_DEPRECATED("use set_entryVa");
420 SgSymbolTable* get_symbol_table() const ROSE_DEPRECATED("use get_symbolTable");
421 void set_symbol_table(
SgSymbolTable*) ROSE_DEPRECATED("use set_symbolTable");
422 size_t get_cached_vertex() const ROSE_DEPRECATED("use get_cachedVertex");
423 void set_cached_vertex(
size_t) ROSE_DEPRECATED("use set_cachedVertex");
424 void append_statement(
SgAsmStatement*) ROSE_DEPRECATED("use appendStatement");
425 void remove_statement(
SgAsmStatement* statement) ROSE_DEPRECATED("use removeStatement");
426 SgAsmBlock* get_entry_block() const ROSE_DEPRECATED("use get_entryBlock");
427 static std::
string reason_key(const std::
string &prefix="") ROSE_DEPRECATED("use reasonKey");
428 std::
string reason_str(
bool) const ROSE_DEPRECATED("use reasonString");
429 static std::
string reason_str(
bool,
unsigned) ROSE_DEPRECATED("use reasonString");
441 std::
string const& name,
442 unsigned const& reason,
452 void initializeProperties();
471 virtual std::
string class_name() const override;
474 virtual VariantT variantT() const override;
479 enum { static_variant = V_SgAsmFunction };
494 static const unsigned pool_size;
496 static std::vector<unsigned char *> pools;
501 static unsigned long initializeStorageClassArray(SgAsmFunctionStorageClass *);
504 static void clearMemoryPool();
505 static void deleteMemoryPool();
508 static void extendMemoryPoolForFileIO();
511 static SgAsmFunction * getPointerFromGlobalIndex(
unsigned long);
513 static SgAsmFunction * getPointerFromGlobalIndex(AstSpecificDataManagingClass *,
unsigned long);
516 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(
unsigned long);
518 static void resetValidFreepointers();
520 static unsigned long getNumberOfLastValidPointer();
523#if defined(INLINE_FUNCTIONS)
525 inline void *
operator new (
size_t size);
528 void *
operator new (
size_t size);
531 void operator delete (
void* pointer,
size_t size);
534 void operator delete (
void* pointer)
537 SgAsmFunction::operator
delete (pointer,
sizeof(
SgAsmFunction));
580#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
583 virtual RTIReturnType
roseRTI()
override;
597 virtual const char*
sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
603 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
658 static std::string getNodeIdStringInternal(
SgAsmFunction* sgnode);
785 friend class SgAsmFunctionStorageClass;
788 friend class AstSpecificDataManagingClass;
791 friend class AstSpecificDataManagingClassStorageClass;
823#define BUILD_ATERM_SUPPORT 0
824 #if BUILD_ATERM_SUPPORT
825 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
837 virtual ATerm generate_ATerm()
override;
840 virtual void generate_ATerm_Annotation(ATerm & term)
override;
886std::string p_reasonComment;
898std::string p_nameMd5;
902SgAsmStatementPtrList p_statementList;
906SgAsmStatementPtrList p_dest;
918size_t p_cachedVertex;
926std::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 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.
This class represents the symbol tables used in both SgScopeStatement and the SgFunctionTypeSymbolTab...
std::uint64_t Address
Address.
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.