ROSE 0.11.145.147
SgAsmGenericFormat.h
1
2#ifndef ROSE_SgAsmGenericFormat_H
3#define ROSE_SgAsmGenericFormat_H
4#include <RoseFirst.h>
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmExecutableFileFormat.h>
7
8
9
10/* #line 1 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
11
12// WARNING -- GENERATED CODE -- DO NOT MODIFY THIS CODE -- WARNING!
13// This code is automatically generated for each
14// terminal and non-terminal within the defined
15// grammar. There is a simple way to change the
16// code to fix bugs etc. See the ROSE README file
17// for directions.
18
19// tps: (02/22/2010): Adding DLL export requirements
20#include "rosedll.h"
21
22// predeclarations for SgAsmGenericFormat
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmGenericFormat.h" */
25/* #line 15030 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/ByteOrder.h>
28
29
30/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
31
32/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
33
34#if !defined(DOCUMENTATION)
35// Class Definition for SgAsmGenericFormat
36class ROSE_DLL_API SgAsmGenericFormat : public SgAsmExecutableFileFormat
37 {
38 public:
39
40
41/* #line 42 "../../../src/frontend/SageIII//SgAsmGenericFormat.h" */
42
43 virtual SgNode* copy ( SgCopyHelp& help) const override;
44// Start of memberFunctionString
45/* #line 15088 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
46
47
48 //----------------------- Boost serialization for SgAsmGenericFormat -----------------------
49#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
50private:
51 friend class boost::serialization::access;
52
53 template<class S>
54 void serialize(S &s, const unsigned /*version*/) {
55 debugSerializationBegin("SgAsmGenericFormat");
56 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmExecutableFileFormat);
57 s & BOOST_SERIALIZATION_NVP(p_family);
58 s & BOOST_SERIALIZATION_NVP(p_purpose);
59 s & BOOST_SERIALIZATION_NVP(p_sex);
60 s & BOOST_SERIALIZATION_NVP(p_version);
61 s & BOOST_SERIALIZATION_NVP(p_isCurrentVersion);
62 s & BOOST_SERIALIZATION_NVP(p_abi);
63 s & BOOST_SERIALIZATION_NVP(p_abiVersion);
64 s & BOOST_SERIALIZATION_NVP(p_wordSize);
65 debugSerializationEnd("SgAsmGenericFormat");
66 }
67#endif // ROSE_HAVE_BOOST_SERIALIZATION_LIB
68public:
69public:
73 SgAsmGenericFormat::ExecFamily const& get_family() const;
74 void set_family(SgAsmGenericFormat::ExecFamily const&);
77public:
81 SgAsmGenericFormat::ExecPurpose const& get_purpose() const;
82 void set_purpose(SgAsmGenericFormat::ExecPurpose const&);
85public:
93public:
97 unsigned const& get_version() const;
98 void set_version(unsigned const&);
101public:
108 bool const& get_isCurrentVersion() const;
109 void set_isCurrentVersion(bool const&);
112public:
116 SgAsmGenericFormat::ExecABI const& get_abi() const;
117 void set_abi(SgAsmGenericFormat::ExecABI const&);
120public:
124 unsigned const& get_abiVersion() const;
125 void set_abiVersion(unsigned const&);
128public:
132 size_t const& get_wordSize() const;
133 void set_wordSize(size_t const&);
135public:
137 void dump(FILE*, const char *prefix, ssize_t idx) const;
138
140 // Deprecated 2023-11
142public:
143 bool get_is_current_version() const ROSE_DEPRECATED("use get_isCurrentVersion");
144 void set_is_current_version(bool) ROSE_DEPRECATED("use set_isCurrentVersion");
145 unsigned get_abi_version() const ROSE_DEPRECATED("use get_abiVersion");
146 void set_abi_version(unsigned) ROSE_DEPRECATED("use set_abiVersion");
147 size_t get_word_size() const ROSE_DEPRECATED("use get_wordSize");
148 void set_word_size(size_t) ROSE_DEPRECATED("use set_wordSize");
149public:
151 virtual ~SgAsmGenericFormat();
152
153public:
156
157protected:
164 void initializeProperties();
165
166
167// End of memberFunctionString
168// Start of memberFunctionString
169/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
170
171// *** COMMON CODE SECTION BEGINS HERE ***
172
173 public:
174
175 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
176 // and not required which is required to match the other aspects of the copy mechanism code generation.
177 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
178 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
179 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
180 // virtual SgNode* copy ( const SgCopyHelp & help) const;
181
183 virtual std::string class_name() const override;
184
186 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
187
189 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
190 // static const VariantT static_variant = V_SgAsmGenericFormat;
191 enum { static_variant = V_SgAsmGenericFormat };
192
193 /* the generated cast function */
195 ROSE_DLL_API friend SgAsmGenericFormat* isSgAsmGenericFormat( SgNode * s );
196
198 ROSE_DLL_API friend const SgAsmGenericFormat* isSgAsmGenericFormat( const SgNode * s );
199
200 // ******************************************
201 // * Memory Pool / New / Delete
202 // ******************************************
203
204 public:
206 static const unsigned pool_size; //
208 static std::vector<unsigned char *> pools; //
210 static SgAsmGenericFormat * next_node; //
211
213 static unsigned long initializeStorageClassArray(SgAsmGenericFormatStorageClass *); //
214
216 static void clearMemoryPool(); //
217 static void deleteMemoryPool(); //
218
220 static void extendMemoryPoolForFileIO(); //
221
223 static SgAsmGenericFormat * getPointerFromGlobalIndex(unsigned long); //
225 static SgAsmGenericFormat * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
226
228 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
230 static void resetValidFreepointers(); //
232 static unsigned long getNumberOfLastValidPointer(); //
233
234
235#if defined(INLINE_FUNCTIONS)
237 inline void *operator new (size_t size);
238#else
240 void *operator new (size_t size);
241#endif
243 void operator delete (void* pointer, size_t size);
244
245 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
246 void operator delete (void* pointer)
247 {
248 // This is the generated delete operator...
249 SgAsmGenericFormat::operator delete (pointer,sizeof(SgAsmGenericFormat));
250 }
251
253 static size_t numberOfNodes();
254
256 static size_t memoryUsage();
257
258 // End of scope which started in IR nodes specific code
259 /* */
260
261 /* name Internal Functions
262 \brief Internal functions ... incomplete-documentation
263
264 These functions have been made public as part of the design, but they are suggested for internal use
265 or by particularly knowledgeable users for specialized tools or applications.
266
267 \internal We could not make these private because they are required by user for special purposes. And
268 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
269
270 */
271
272 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
273 // overridden in every class by *generated* implementation
275 virtual std::vector<SgNode*> get_traversalSuccessorContainer() override;
276 // MS: 06/28/02 container of names of variables or container indices
277 // used used in the traversal to access AST successor nodes
278 // overridden in every class by *generated* implementation
281 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() override;
282
283 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
284 // than all the vector copies. The implementation for these functions is generated for each class.
286 virtual size_t get_numberOfTraversalSuccessors() override;
288 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) override;
290 virtual size_t get_childIndex(SgNode *child) override;
291
292#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
293 // MS: 08/16/2002 method for generating RTI information
295 virtual RTIReturnType roseRTI() override;
296#endif
297 /* */
298
299
300
301 /* name Deprecated Functions
302 \brief Deprecated functions ... incomplete-documentation
303
304 These functions have been deprecated from use.
305 */
306 /* */
307
309 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
310
311 // JJW (10/16/2008): Changed to a single function in Node.code, and put
312 // getVariant() in #if 0 block to prevent confusing Doxygen
313#if 0
315 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
317 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
318#endif
319 /* */
320
321
322
323
324 public:
325 /* name Traversal Support Functions
326 \brief Traversal support functions ... incomplete-documentation
327
328 These functions have been made public as part of the design, but they are suggested for internal use
329 or by particularly knowledgable users for specialized tools or applications.
330 */
331 /* */
332
333 // DQ (11/26/2005): Support for visitor pattern mechanims
334 // (inferior to ROSE traversal mechanism, experimental).
338
339 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
341 virtual void accept (ROSE_VisitorPattern & visitor) override;
342
343 // DQ (12/26/2005): Support for traversal based on the memory pool
346 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
347
351
352 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
353 // This traversal helps support internal tools that call static member functions.
354 // note: this function operates on the memory pools.
357 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
358 /* */
359
360 public:
361 /* NodeId support functions */
363 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
366 static SgAsmGenericFormat* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
369 static std::string getNodeIdString(SgAsmGenericFormat* sgnode);
370 static std::string getNodeIdStringInternal(SgAsmGenericFormat* sgnode);
371
372 public:
373 /* name Memory Allocation Functions
374 \brief Memory allocations functions ... incomplete-documentation
375
376 These functions have been made public as part of the design, but they are suggested for internal use
377 or by particularly knowledgable users for specialized tools or applications.
378 */
379 /* */
380
391 virtual bool isInMemoryPool() override;
392
403 virtual void checkDataMemberPointersIfInMemoryPool() override;
404
405 // DQ (4/30/2006): Modified to be a const function.
420 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
421
432
444 virtual long getChildIndex( SgNode* childNode ) const override;
445
446 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
447 // comment here (changed to be a C style comment and not be a doxygen comment).
448 /* \brief Constructor for use by AST File I/O Mechanism
449
450 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
451 which obtained via fast binary file I/O from disk.
452 */
453 // SgAsmGenericFormat( SgAsmGenericFormatStorageClass& source );
454
455
456
457
458
459 // JH (10/24/2005): methods added to support the ast file IO
460 private:
461
462 /* name AST Memory Allocation Support Functions
463 \brief Memory allocations support....
464
465 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
466 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
467 and support the AST File I/O Mechanism.
468 */
469 /* */
470
471 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
472 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
473 that I use the same type everywhere, if any changes are made. THe second one declares the type
474 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
475 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
476 a correspinding one in the AST_FILE_IO class!
477 */
478 // DQ (9/2/2015): This typedef is no longer used, we can't define the
479 // comment here (changed to be a C style comment and not be a doxygen comment).
480 /* \brief Typedef used for low level memory access.
481 */
482 // typedef unsigned char* TestType;
483
484 // DQ (9/2/2015): This typedef is no longer used, we can't define the
485 // comment here (changed to be a C style comment and not be a doxygen comment).
486 /* \brief Typedef used to hold memory addresses as values.
487 */
488 // typedef unsigned long AddressType;
489
490
491
492 // necessary, to have direct access to the p_freepointer and the private methods !
494 friend class AST_FILE_IO;
495
497 friend class SgAsmGenericFormatStorageClass;
498
500 friend class AstSpecificDataManagingClass;
501
503 friend class AstSpecificDataManagingClassStorageClass;
504 public:
506 SgAsmGenericFormat( const SgAsmGenericFormatStorageClass& source );
507
508 // private: // JJW hack
509 /*
510 name AST Memory Allocation Support Variables
511 Memory allocations support variables
512
513 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
514 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
515 and support the AST File I/O Mechanism.
516 */
517 /* */
518
519 public:
520
521 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
522 // to current node (so that it will work cleanly with build functions to specify patterns).
523 // virtual SgNode* addRegExpAttribute();
530
531#ifndef _MSC_VER
532// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
533// and likely never fully implemented nor tested. Files remain in the src tree but are no
534// longer built.
535#define BUILD_ATERM_SUPPORT 0
536 #if BUILD_ATERM_SUPPORT
537 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
538 // DQ (10/4/2014): Adding ATerm support to ROSE.
548 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
549 virtual ATerm generate_ATerm() override;
550
552 virtual void generate_ATerm_Annotation(ATerm & term) override;
553 #endif
554 #endif // BUILD_ATERM_SUPPORT
555#endif
556 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
557 // virtual generate_AST(ATerm & term);
558 // virtual void read_ATerm_Annotation(ATerm & term);
559
560// *** COMMON CODE SECTION ENDS HERE ***
561
562
563// End of memberFunctionString
564// Start of memberFunctionString
565/* #line 706 "/workspace/src/ROSETTA/Grammar/Node.code" */
566
567 // the generated cast function
568 // friend ROSE_DLL_API SgAsmGenericFormat* isSgAsmGenericFormat ( SgNode* s );
569
570 typedef SgAsmExecutableFileFormat base_node_type;
571
572
573// End of memberFunctionString
574
575
576
577
578
579
580
581
582
583 protected:
584// Start of memberFunctionString
586
587// End of memberFunctionString
588// Start of memberFunctionString
590
591// End of memberFunctionString
592// Start of memberFunctionString
594
595// End of memberFunctionString
596// Start of memberFunctionString
597unsigned p_version;
598
599// End of memberFunctionString
600// Start of memberFunctionString
601bool p_isCurrentVersion;
602
603// End of memberFunctionString
604// Start of memberFunctionString
606
607// End of memberFunctionString
608// Start of memberFunctionString
609unsigned p_abiVersion;
610
611// End of memberFunctionString
612// Start of memberFunctionString
613size_t p_wordSize;
614
615// End of memberFunctionString
616
619 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFormat, SgAsmGenericFormat::ExecPurpose,&SgAsmGenericFormat::p_purpose>;
620 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFormat, Rose::BinaryAnalysis::ByteOrder::Endianness,&SgAsmGenericFormat::p_sex>;
621 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFormat, unsigned,&SgAsmGenericFormat::p_version>;
622 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFormat, bool,&SgAsmGenericFormat::p_isCurrentVersion>;
623 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFormat, SgAsmGenericFormat::ExecABI,&SgAsmGenericFormat::p_abi>;
624 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFormat, unsigned,&SgAsmGenericFormat::p_abiVersion>;
625 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericFormat, size_t,&SgAsmGenericFormat::p_wordSize>;
626
627/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
628
629
630 };
631#endif
632
633// postdeclarations for SgAsmGenericFormat
634
635/* #line 636 "../../../src/frontend/SageIII//SgAsmGenericFormat.h" */
636
637/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
638
639/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
640
641
642/* #line 643 "../../../src/frontend/SageIII//SgAsmGenericFormat.h" */
643
644#endif // ROSE_SgAsmGenericFormat_H
645
Class holding static data and functions supporting File I/O.
Definition AST_FILE_IO.h:19
Attribute containing a regex expression as a string.
Base class for many binary analysis nodes.
ExecPurpose
General purpose of a binary executable file.
ExecABI
Application binary interface.
Basic information about an executable container.
Supporting class from copy mechanism within ROSE.
Definition sageCopy.h:26
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.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.
const char * ExecFamily(int64_t)
Convert SgAsmExecutableFileFormat::ExecFamily enum constant to a string.