ROSE 0.11.145.247
SgAsmGenericStrtab.h
1
2#ifndef ROSE_SgAsmGenericStrtab_H
3#define ROSE_SgAsmGenericStrtab_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 SgAsmGenericStrtab
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmGenericStrtab.h" */
25/* #line 30725 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/Address.h>
28#include <Rose/BinaryAnalysis/AddressIntervalSet.h>
29
30
31/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
32
33/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
34
35#if !defined(DOCUMENTATION)
36// Class Definition for SgAsmGenericStrtab
37class ROSE_DLL_API SgAsmGenericStrtab : public SgAsmExecutableFileFormat
38 {
39 public:
40
41
42/* #line 43 "../../../src/frontend/SageIII//SgAsmGenericStrtab.h" */
43
44 virtual SgNode* copy ( SgCopyHelp& help) const override;
45// Start of memberFunctionString
46/* #line 30766 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
47
48
49 //----------------------- Boost serialization for SgAsmGenericStrtab -----------------------
50#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
51private:
52 friend class boost::serialization::access;
53
54 template<class S>
55 void serialize(S &s, const unsigned /*version*/) {
56 debugSerializationBegin("SgAsmGenericStrtab");
57 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmExecutableFileFormat);
58 s & BOOST_SERIALIZATION_NVP(p_container);
59 s & BOOST_SERIALIZATION_NVP(p_storageList);
60 s & BOOST_SERIALIZATION_NVP(p_freeList);
61 s & BOOST_SERIALIZATION_NVP(p_dontFree);
62 s & BOOST_SERIALIZATION_NVP(p_numberFreed);
63 debugSerializationEnd("SgAsmGenericStrtab");
64 }
65#endif // ROSE_ENABLE_BOOST_SERIALIZATION
67 // Local types
69public:
70 typedef std::vector<class SgAsmStringStorage*> referenced_t;
71
73 // Properties
75public:
76public:
80 SgAsmGenericSection* const& get_container() const;
81 void set_container(SgAsmGenericSection* const&);
84public:
88 SgAsmGenericStrtab::referenced_t const& get_storageList() const;
89 void set_storageList(SgAsmGenericStrtab::referenced_t const&);
92public:
98 Rose::BinaryAnalysis::AddressIntervalSet const& get_freeList() const;
101public:
105 SgAsmStringStorage* const& get_dontFree() const;
106 void set_dontFree(SgAsmStringStorage* const&);
109public:
113 size_t const& get_numberFreed() const;
114 void set_numberFreed(size_t const&);
117 // Functions
119public:
121 explicit SgAsmGenericStrtab(SgAsmGenericSection *container);
122
124 virtual SgAsmGenericStrtab* parse() {return this;}
125
127 virtual void dump(FILE*, const char *prefix, ssize_t idx) const;
128
130 SgAsmStoredString *createString(Rose::BinaryAnalysis::Address offset, bool shared);
131
136
141 void free(Rose::BinaryAnalysis::Address offset, Rose::BinaryAnalysis::Address size); /*mark part of table as free*/
142
147 void freeAllStrings(bool blow_away_holes=false);
148
149 virtual void allocateOverlap(SgAsmStringStorage*);
150
156 bool reallocate(bool shrink);
157
158 //These should be pure virtual but ROSETTA apparently doesn't support that (RPM 2008-10-03)
159 virtual SgAsmStringStorage *createStorage(Rose::BinaryAnalysis::Address /*offset*/, bool /*shared*/);
160 virtual Rose::BinaryAnalysis::Address get_storageSize(const SgAsmStringStorage*);
162
164 // Deprecated 2023-11
166public:
167 const referenced_t& get_storage_list() const ROSE_DEPRECATED("use get_storageList");
168 void set_storage_list(const referenced_t&) ROSE_DEPRECATED("use set_storageList");
169 const Rose::BinaryAnalysis::AddressIntervalSet& get_freelist() const ROSE_DEPRECATED("use get_freeList");
170 Rose::BinaryAnalysis::AddressIntervalSet& get_freelist() ROSE_DEPRECATED("use set_freeList");
171 SgAsmStringStorage* get_dont_free() const ROSE_DEPRECATED("use get_dontFree");
172 void set_dont_free(SgAsmStringStorage*) ROSE_DEPRECATED("use set_dontFree");
173 size_t get_num_freed() const ROSE_DEPRECATED("use get_numberFreed");
174 void set_num_freed(size_t) ROSE_DEPRECATED("use set_numberFreed");
175 SgAsmStoredString *create_string(Rose::BinaryAnalysis::Address, bool) ROSE_DEPRECATED("use createString");
176 void free_all_strings(bool=false) ROSE_DEPRECATED("use freeAllStrings");
177 virtual void allocate_overlap(SgAsmStringStorage*) ROSE_DEPRECATED("use allocateOverlap");
178 virtual SgAsmStringStorage *create_storage(Rose::BinaryAnalysis::Address, bool) ROSE_DEPRECATED("use createStorage");
179 virtual Rose::BinaryAnalysis::Address get_storage_size(const SgAsmStringStorage*) ROSE_DEPRECATED("use get_storageSize");
180public:
182 virtual ~SgAsmGenericStrtab();
183
184protected:
187
188protected:
195 void initializeProperties();
196
197
198// End of memberFunctionString
199// Start of memberFunctionString
200/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
201
202// *** COMMON CODE SECTION BEGINS HERE ***
203
204 public:
205
206 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
207 // and not required which is required to match the other aspects of the copy mechanism code generation.
208 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
209 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
210 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
211 // virtual SgNode* copy ( const SgCopyHelp & help) const;
212
214 virtual std::string class_name() const override;
215
217 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
218
220 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
221 // static const VariantT static_variant = V_SgAsmGenericStrtab;
222 enum { static_variant = V_SgAsmGenericStrtab };
223
224 /* the generated cast function */
226 ROSE_DLL_API friend SgAsmGenericStrtab* isSgAsmGenericStrtab( SgNode * s );
227
229 ROSE_DLL_API friend const SgAsmGenericStrtab* isSgAsmGenericStrtab( const SgNode * s );
230
231 // ******************************************
232 // * Memory Pool / New / Delete
233 // ******************************************
234
235 public:
237 static const unsigned pool_size; //
239 static std::vector<unsigned char *> pools; //
241 static SgAsmGenericStrtab * next_node; //
242
244 static unsigned long initializeStorageClassArray(SgAsmGenericStrtabStorageClass *); //
245
247 static void clearMemoryPool(); //
248 static void deleteMemoryPool(); //
249
251 static void extendMemoryPoolForFileIO(); //
252
254 static SgAsmGenericStrtab * getPointerFromGlobalIndex(unsigned long); //
256 static SgAsmGenericStrtab * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
257
259 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
261 static void resetValidFreepointers(); //
263 static unsigned long getNumberOfLastValidPointer(); //
264
265
266#if defined(INLINE_FUNCTIONS)
268 inline void *operator new (size_t size);
269#else
271 void *operator new (size_t size);
272#endif
274 void operator delete (void* pointer, size_t size);
275
276 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
277 void operator delete (void* pointer)
278 {
279 // This is the generated delete operator...
280 SgAsmGenericStrtab::operator delete (pointer,sizeof(SgAsmGenericStrtab));
281 }
282
284 static size_t numberOfNodes();
285
287 static size_t memoryUsage();
288
289 // End of scope which started in IR nodes specific code
290 /* */
291
292 /* name Internal Functions
293 \brief Internal functions ... incomplete-documentation
294
295 These functions have been made public as part of the design, but they are suggested for internal use
296 or by particularly knowledgeable users for specialized tools or applications.
297
298 \internal We could not make these private because they are required by user for special purposes. And
299 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
300
301 */
302
303 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
304 // overridden in every class by *generated* implementation
306 virtual std::vector<SgNode*> get_traversalSuccessorContainer() const override;
307 // MS: 06/28/02 container of names of variables or container indices
308 // used used in the traversal to access AST successor nodes
309 // overridden in every class by *generated* implementation
312 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() const override;
313
314 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
315 // than all the vector copies. The implementation for these functions is generated for each class.
317 virtual size_t get_numberOfTraversalSuccessors() const override;
319 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) const override;
321 virtual size_t get_childIndex(SgNode *child) const override;
322
323#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
324 // MS: 08/16/2002 method for generating RTI information
326 virtual RTIReturnType roseRTI() override;
327#endif
328 /* */
329
330
331
332 /* name Deprecated Functions
333 \brief Deprecated functions ... incomplete-documentation
334
335 These functions have been deprecated from use.
336 */
337 /* */
338
340 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
341
342 // JJW (10/16/2008): Changed to a single function in Node.code, and put
343 // getVariant() in #if 0 block to prevent confusing Doxygen
344#if 0
346 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
348 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
349#endif
350 /* */
351
352
353
354
355 public:
356 /* name Traversal Support Functions
357 \brief Traversal support functions ... incomplete-documentation
358
359 These functions have been made public as part of the design, but they are suggested for internal use
360 or by particularly knowledgable users for specialized tools or applications.
361 */
362 /* */
363
364 // DQ (11/26/2005): Support for visitor pattern mechanims
365 // (inferior to ROSE traversal mechanism, experimental).
369
370 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
372 virtual void accept (ROSE_VisitorPattern & visitor) override;
373
374 // DQ (12/26/2005): Support for traversal based on the memory pool
377 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
378
382
383 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
384 // This traversal helps support internal tools that call static member functions.
385 // note: this function operates on the memory pools.
388 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
389 /* */
390
391 public:
392 /* NodeId support functions */
394 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
397 static SgAsmGenericStrtab* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
400 static std::string getNodeIdString(SgAsmGenericStrtab* sgnode);
401 static std::string getNodeIdStringInternal(SgAsmGenericStrtab* sgnode);
402
403 public:
404 /* name Memory Allocation Functions
405 \brief Memory allocations functions ... incomplete-documentation
406
407 These functions have been made public as part of the design, but they are suggested for internal use
408 or by particularly knowledgable users for specialized tools or applications.
409 */
410 /* */
411
422 virtual bool isInMemoryPool() override;
423
434 virtual void checkDataMemberPointersIfInMemoryPool() override;
435
436 // DQ (4/30/2006): Modified to be a const function.
451 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
452
463
475 virtual long getChildIndex( SgNode* childNode ) const override;
476
477 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
478 // comment here (changed to be a C style comment and not be a doxygen comment).
479 /* \brief Constructor for use by AST File I/O Mechanism
480
481 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
482 which obtained via fast binary file I/O from disk.
483 */
484 // SgAsmGenericStrtab( SgAsmGenericStrtabStorageClass& source );
485
486
487
488
489
490 // JH (10/24/2005): methods added to support the ast file IO
491 private:
492
493 /* name AST Memory Allocation Support Functions
494 \brief Memory allocations support....
495
496 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
497 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
498 and support the AST File I/O Mechanism.
499 */
500 /* */
501
502 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
503 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
504 that I use the same type everywhere, if any changes are made. THe second one declares the type
505 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
506 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
507 a correspinding one in the AST_FILE_IO class!
508 */
509 // DQ (9/2/2015): This typedef is no longer used, we can't define the
510 // comment here (changed to be a C style comment and not be a doxygen comment).
511 /* \brief Typedef used for low level memory access.
512 */
513 // typedef unsigned char* TestType;
514
515 // DQ (9/2/2015): This typedef is no longer used, we can't define the
516 // comment here (changed to be a C style comment and not be a doxygen comment).
517 /* \brief Typedef used to hold memory addresses as values.
518 */
519 // typedef unsigned long AddressType;
520
521
522
523 // necessary, to have direct access to the p_freepointer and the private methods !
525 friend class AST_FILE_IO;
526
528 friend class SgAsmGenericStrtabStorageClass;
529
531 friend class AstSpecificDataManagingClass;
532
534 friend class AstSpecificDataManagingClassStorageClass;
535 public:
537 SgAsmGenericStrtab( const SgAsmGenericStrtabStorageClass& source );
538
539 // private: // JJW hack
540 /*
541 name AST Memory Allocation Support Variables
542 Memory allocations support variables
543
544 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
545 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
546 and support the AST File I/O Mechanism.
547 */
548 /* */
549
550 public:
551
552 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
553 // to current node (so that it will work cleanly with build functions to specify patterns).
554 // virtual SgNode* addRegExpAttribute();
561
562#ifndef _MSC_VER
563// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
564// and likely never fully implemented nor tested. Files remain in the src tree but are no
565// longer built.
566#define BUILD_ATERM_SUPPORT 0
567 #if BUILD_ATERM_SUPPORT
568 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
569 // DQ (10/4/2014): Adding ATerm support to ROSE.
579 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
580 virtual ATerm generate_ATerm() override;
581
583 virtual void generate_ATerm_Annotation(ATerm & term) override;
584 #endif
585 #endif // BUILD_ATERM_SUPPORT
586#endif
587 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
588 // virtual generate_AST(ATerm & term);
589 // virtual void read_ATerm_Annotation(ATerm & term);
590
591// *** COMMON CODE SECTION ENDS HERE ***
592
593
594// End of memberFunctionString
595// Start of memberFunctionString
596/* #line 710 "/workspace/src/ROSETTA/Grammar/Node.code" */
597
598 // the generated cast function
599 // friend ROSE_DLL_API SgAsmGenericStrtab* isSgAsmGenericStrtab ( SgNode* s );
600
601 typedef SgAsmExecutableFileFormat base_node_type;
602
603
604// End of memberFunctionString
605
606
607
608
609
610
611 protected:
612// Start of memberFunctionString
613SgAsmGenericSection* p_container;
614
615// End of memberFunctionString
616// Start of memberFunctionString
617SgAsmGenericStrtab::referenced_t p_storageList;
618
619// End of memberFunctionString
620// Start of memberFunctionString
622
623// End of memberFunctionString
624// Start of memberFunctionString
625SgAsmStringStorage* p_dontFree;
626
627// End of memberFunctionString
628// Start of memberFunctionString
629size_t p_numberFreed;
630
631// End of memberFunctionString
632
634 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericStrtab, SgAsmGenericSection*,&SgAsmGenericStrtab::p_container>;
635 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericStrtab, SgAsmGenericStrtab::referenced_t,&SgAsmGenericStrtab::p_storageList>;
636 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericStrtab, Rose::BinaryAnalysis::AddressIntervalSet,&SgAsmGenericStrtab::p_freeList>;
637 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericStrtab, SgAsmStringStorage*,&SgAsmGenericStrtab::p_dontFree>;
638 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericStrtab, size_t,&SgAsmGenericStrtab::p_numberFreed>;
639
640/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
641
642
643 };
644#endif
645
646// postdeclarations for SgAsmGenericStrtab
647
648/* #line 649 "../../../src/frontend/SageIII//SgAsmGenericStrtab.h" */
649
650/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
651
652/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
653
654
655/* #line 656 "../../../src/frontend/SageIII//SgAsmGenericStrtab.h" */
656
657#endif // ROSE_SgAsmGenericStrtab_H
658
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.
Contiguous region of a file.
Base class for string tables.
Strings stored in an ELF or PE container.
Strings stored in an ELF or PE 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 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.
ROSE_DLL_API void free()
Delete all memory allocated by ROSE.
void parse(SgAsmGenericFile *)
Main function to parse DWARF information.
std::uint64_t Address
Address.
Definition Address.h:11
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
The ROSE library.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.