2#ifndef ROSE_SgAsmCilMethodDef_H
3#define ROSE_SgAsmCilMethodDef_H
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmCilMetadata.h>
30#if !defined(DOCUMENTATION)
45#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
47 friend class boost::serialization::access;
53 s & BOOST_SERIALIZATION_NVP(p_RVA);
54 s & BOOST_SERIALIZATION_NVP(p_ImplFlags);
55 s & BOOST_SERIALIZATION_NVP(p_Flags);
56 s & BOOST_SERIALIZATION_NVP(p_Name);
57 s & BOOST_SERIALIZATION_NVP(p_Signature);
58 s & BOOST_SERIALIZATION_NVP(p_ParamList);
59 s & BOOST_SERIALIZATION_NVP(p_body);
60 s & BOOST_SERIALIZATION_NVP(p_initLocals);
61 s & BOOST_SERIALIZATION_NVP(p_stackSize);
62 s & BOOST_SERIALIZATION_NVP(p_hasMoreSections);
63 s & BOOST_SERIALIZATION_NVP(p_localVarSigTok);
64 s & BOOST_SERIALIZATION_NVP(p_methodData);
65 s & BOOST_SERIALIZATION_NVP(p_bodyState);
70 using BodyState = int;
74 BDY_NOT_AVAILABLE = 3,
75 BDY_FULLY_DECODED = 2,
76 BDY_RUNTIME_SUPPORTED = 1,
79 BDY_NOT_PROCESSED = 0,
82 BDY_INVALID_HEADER_BYTE = -1,
83 BDY_INVALID_HEADER_KIND = -2,
84 BDY_INVALID_HEADER_ALIGN = -3,
85 BDY_INVALID_CODE_LENGTH = -4,
86 BDY_INVALID_INSTRUCTION_LENGTH = -5,
87 BDY_INVALID_INSTRUCTION = -6,
88 BDY_INVALID_SECTION_ALIGN = -7,
89 BDY_INVALID_SECTION_HEADER = -8,
90 BDY_INVALID_CLAUSE_KIND = -9,
91 BDY_INVALID_CLAUSE_LENGTH = -10,
95 using MethodFlags = std::uint16_t;
98 FLG_MEMBERACCESS_MASK = 0x0007,
99 FLG_COMPILER_CONTROLLED = 0x0000,
100 FLG_PRIVATE = 0x0001,
101 FLG_FAM_AND_ASSEM = 0x0002,
104 FLG_FAM_OR_ASSEM = 0x0005,
108 FLG_VIRTUAL = 0x0040,
109 FLG_HIDEBYSIG = 0x0080,
110 FLG_VTABLE_LAYOUT_MASK = 0x0100,
111 FLG_REUSE_SLOT = 0x0000,
112 FLG_NEW_SLOT = 0x0100,
114 FLG_ABSTRACT = 0x0400,
115 FLG_SPECIAL_NAME = 0x0800,
117 FLG_P_INVOKE_IMPL = 0x2000,
118 FLG_UNMANAGED_EXPORT = 0x0008,
120 FLG_RT_SPECIAL_NAME = 0x1000,
121 FLG_HAS_SECURITY = 0x4000,
122 FLG_REQUIRE_SEC_OBJECT = 0x8000,
132 uint32_t
const& get_RVA()
const;
133 void set_RVA(uint32_t
const&);
142 uint16_t
const& get_ImplFlags()
const;
143 void set_ImplFlags(uint16_t
const&);
152 uint16_t
const& get_Flags()
const;
153 void set_Flags(uint16_t
const&);
162 uint32_t
const& get_Name()
const;
163 void set_Name(uint32_t
const&);
172 uint32_t
const& get_Signature()
const;
173 void set_Signature(uint32_t
const&);
182 uint32_t
const& get_ParamList()
const;
183 void set_ParamList(uint32_t
const&);
202 bool const& get_initLocals()
const;
203 void set_initLocals(
bool const&);
212 uint32_t
const& get_stackSize()
const;
213 void set_stackSize(uint32_t
const&);
222 bool const& get_hasMoreSections()
const;
223 void set_hasMoreSections(
bool const&);
234 uint32_t
const& get_localVarSigTok()
const;
235 void set_localVarSigTok(uint32_t
const&);
244 std::vector<SgAsmCilMethodData*>
const& get_methodData()
const;
245 std::vector<SgAsmCilMethodData*>& get_methodData();
255 int const& get_bodyState()
const;
256 void set_bodyState(
int const&);
259 void parse(
const std::vector<uint8_t>& buf,
size_t& index, uint64_t uses4byteIndexing);
260 void unparse(std::vector<uint8_t>& buf,
size_t& index, uint64_t uses4byteIndexing)
const;
261 void dump(std::ostream&)
const;
263 const std::uint8_t* get_Name_string()
const;
264 const std::uint8_t* get_Signature_blob()
const;
300 virtual std::string
class_name()
const override;
303 virtual VariantT
variantT()
const override;
308 enum { static_variant = V_SgAsmCilMethodDef };
323 static const unsigned pool_size;
325 static std::vector<unsigned char *> pools;
330 static unsigned long initializeStorageClassArray(SgAsmCilMethodDefStorageClass *);
333 static void clearMemoryPool();
334 static void deleteMemoryPool();
337 static void extendMemoryPoolForFileIO();
342 static SgAsmCilMethodDef * getPointerFromGlobalIndex(AstSpecificDataManagingClass *,
unsigned long);
345 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(
unsigned long);
347 static void resetValidFreepointers();
349 static unsigned long getNumberOfLastValidPointer();
352#if defined(INLINE_FUNCTIONS)
354 inline void *
operator new (
size_t size);
357 void *
operator new (
size_t size);
360 void operator delete (
void* pointer,
size_t size);
363 void operator delete (
void* pointer)
409#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
412 virtual RTIReturnType
roseRTI()
override;
426 virtual const char*
sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
432 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
614 friend class SgAsmCilMethodDefStorageClass;
617 friend class AstSpecificDataManagingClass;
620 friend class AstSpecificDataManagingClassStorageClass;
652#define BUILD_ATERM_SUPPORT 0
653 #if BUILD_ATERM_SUPPORT
654 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
666 virtual ATerm generate_ATerm()
override;
669 virtual void generate_ATerm_Annotation(ATerm & term)
override;
743bool p_hasMoreSections;
747uint32_t p_localVarSigTok;
751std::vector<SgAsmCilMethodData*> p_methodData;
Class holding static data and functions supporting File I/O.
Attribute containing a regex expression as a string.
CIL MethodDef node (II.22.26).
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 VariantT variantT() const
returns new style SageIII enum values
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
virtual std::string class_name() const
returns a string representing the class name
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.
void parse(SgAsmGenericFile *)
Main function to parse DWARF information.
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.