ROSE 0.11.145.247
SgAsmGenericSymbol.h
1
2#ifndef ROSE_SgAsmGenericSymbol_H
3#define ROSE_SgAsmGenericSymbol_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 SgAsmGenericSymbol
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmGenericSymbol.h" */
25/* #line 30426 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/Address.h>
28
29/* Base class for symbol tables. */
30
31
32/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
33
34/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
35
36#if !defined(DOCUMENTATION)
37// Class Definition for SgAsmGenericSymbol
38class ROSE_DLL_API SgAsmGenericSymbol : public SgAsmExecutableFileFormat
39 {
40 public:
41
42
43/* #line 44 "../../../src/frontend/SageIII//SgAsmGenericSymbol.h" */
44
45 virtual SgNode* copy ( SgCopyHelp& help) const override;
46// Start of memberFunctionString
47/* #line 30479 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
48
49
50 //----------------------- Boost serialization for SgAsmGenericSymbol -----------------------
51#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
52private:
53 friend class boost::serialization::access;
54
55 template<class S>
56 void serialize(S &s, const unsigned /*version*/) {
57 debugSerializationBegin("SgAsmGenericSymbol");
58 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmExecutableFileFormat);
59 s & BOOST_SERIALIZATION_NVP(p_definitionState);
60 s & BOOST_SERIALIZATION_NVP(p_binding);
61 s & BOOST_SERIALIZATION_NVP(p_type);
62 s & BOOST_SERIALIZATION_NVP(p_value);
63 s & BOOST_SERIALIZATION_NVP(p_size);
64 s & BOOST_SERIALIZATION_NVP(p_bound);
65 s & BOOST_SERIALIZATION_NVP(p_name);
66 debugSerializationEnd("SgAsmGenericSymbol");
67 }
68#endif // ROSE_ENABLE_BOOST_SERIALIZATION
70 // Local types
72public:
74 enum SymbolDefState {
75 SYM_UNDEFINED,
76 SYM_TENTATIVE,
77 SYM_DEFINED
78 };
79
81 enum SymbolType {
82 SYM_NO_TYPE,
83 SYM_DATA,
84 SYM_FUNC,
85 SYM_SECTION,
86 SYM_FILE,
87 SYM_ARRAY,
88 SYM_TLS,
89 SYM_REGISTER,
90 SYM_COMMON,
91 SYM_IFUNC
92 };
93
95 enum SymbolBinding {
96 SYM_NO_BINDING,
97 SYM_LOCAL,
98 SYM_GLOBAL,
99 SYM_WEAK
100 };
101
103 // Properties
105public:
106public:
110 SgAsmGenericSymbol::SymbolDefState const& get_definitionState() const;
111 void set_definitionState(SgAsmGenericSymbol::SymbolDefState const&);
114public:
118 SgAsmGenericSymbol::SymbolBinding const& get_binding() const;
119 void set_binding(SgAsmGenericSymbol::SymbolBinding const&);
122public:
126 SgAsmGenericSymbol::SymbolType const& get_type() const;
127 void set_type(SgAsmGenericSymbol::SymbolType const&);
130public:
134 Rose::BinaryAnalysis::Address const& get_value() const;
135 void set_value(Rose::BinaryAnalysis::Address const&);
138public:
142 Rose::BinaryAnalysis::Address const& get_size() const;
143 void set_size(Rose::BinaryAnalysis::Address const&);
146public:
150 SgAsmGenericSection* const& get_bound() const;
151 void set_bound(SgAsmGenericSection* const&);
154public:
163 // Functions
165public:
167 virtual void dump(FILE*, const char *prefix, ssize_t idx) const;
168
170 // Deprecated 2023-11
172public:
173 SymbolDefState get_def_state() const ROSE_DEPRECATED("use get_definitionState");
174 void set_def_state(SymbolDefState) ROSE_DEPRECATED("use set_definitionState");
175public:
177 virtual ~SgAsmGenericSymbol();
178
179protected:
182
183protected:
190 void initializeProperties();
191
192
193// End of memberFunctionString
194// Start of memberFunctionString
195/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
196
197// *** COMMON CODE SECTION BEGINS HERE ***
198
199 public:
200
201 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
202 // and not required which is required to match the other aspects of the copy mechanism code generation.
203 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
204 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
205 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
206 // virtual SgNode* copy ( const SgCopyHelp & help) const;
207
209 virtual std::string class_name() const override;
210
212 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
213
215 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
216 // static const VariantT static_variant = V_SgAsmGenericSymbol;
217 enum { static_variant = V_SgAsmGenericSymbol };
218
219 /* the generated cast function */
221 ROSE_DLL_API friend SgAsmGenericSymbol* isSgAsmGenericSymbol( SgNode * s );
222
224 ROSE_DLL_API friend const SgAsmGenericSymbol* isSgAsmGenericSymbol( const SgNode * s );
225
226 // ******************************************
227 // * Memory Pool / New / Delete
228 // ******************************************
229
230 public:
232 static const unsigned pool_size; //
234 static std::vector<unsigned char *> pools; //
236 static SgAsmGenericSymbol * next_node; //
237
239 static unsigned long initializeStorageClassArray(SgAsmGenericSymbolStorageClass *); //
240
242 static void clearMemoryPool(); //
243 static void deleteMemoryPool(); //
244
246 static void extendMemoryPoolForFileIO(); //
247
249 static SgAsmGenericSymbol * getPointerFromGlobalIndex(unsigned long); //
251 static SgAsmGenericSymbol * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
252
254 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
256 static void resetValidFreepointers(); //
258 static unsigned long getNumberOfLastValidPointer(); //
259
260
261#if defined(INLINE_FUNCTIONS)
263 inline void *operator new (size_t size);
264#else
266 void *operator new (size_t size);
267#endif
269 void operator delete (void* pointer, size_t size);
270
271 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
272 void operator delete (void* pointer)
273 {
274 // This is the generated delete operator...
275 SgAsmGenericSymbol::operator delete (pointer,sizeof(SgAsmGenericSymbol));
276 }
277
279 static size_t numberOfNodes();
280
282 static size_t memoryUsage();
283
284 // End of scope which started in IR nodes specific code
285 /* */
286
287 /* name Internal Functions
288 \brief Internal functions ... incomplete-documentation
289
290 These functions have been made public as part of the design, but they are suggested for internal use
291 or by particularly knowledgeable users for specialized tools or applications.
292
293 \internal We could not make these private because they are required by user for special purposes. And
294 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
295
296 */
297
298 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
299 // overridden in every class by *generated* implementation
301 virtual std::vector<SgNode*> get_traversalSuccessorContainer() const override;
302 // MS: 06/28/02 container of names of variables or container indices
303 // used used in the traversal to access AST successor nodes
304 // overridden in every class by *generated* implementation
307 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() const override;
308
309 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
310 // than all the vector copies. The implementation for these functions is generated for each class.
312 virtual size_t get_numberOfTraversalSuccessors() const override;
314 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) const override;
316 virtual size_t get_childIndex(SgNode *child) const override;
317
318#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
319 // MS: 08/16/2002 method for generating RTI information
321 virtual RTIReturnType roseRTI() override;
322#endif
323 /* */
324
325
326
327 /* name Deprecated Functions
328 \brief Deprecated functions ... incomplete-documentation
329
330 These functions have been deprecated from use.
331 */
332 /* */
333
335 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
336
337 // JJW (10/16/2008): Changed to a single function in Node.code, and put
338 // getVariant() in #if 0 block to prevent confusing Doxygen
339#if 0
341 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
343 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
344#endif
345 /* */
346
347
348
349
350 public:
351 /* name Traversal Support Functions
352 \brief Traversal support functions ... incomplete-documentation
353
354 These functions have been made public as part of the design, but they are suggested for internal use
355 or by particularly knowledgable users for specialized tools or applications.
356 */
357 /* */
358
359 // DQ (11/26/2005): Support for visitor pattern mechanims
360 // (inferior to ROSE traversal mechanism, experimental).
364
365 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
367 virtual void accept (ROSE_VisitorPattern & visitor) override;
368
369 // DQ (12/26/2005): Support for traversal based on the memory pool
372 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
373
377
378 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
379 // This traversal helps support internal tools that call static member functions.
380 // note: this function operates on the memory pools.
383 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
384 /* */
385
386 public:
387 /* NodeId support functions */
389 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
392 static SgAsmGenericSymbol* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
395 static std::string getNodeIdString(SgAsmGenericSymbol* sgnode);
396 static std::string getNodeIdStringInternal(SgAsmGenericSymbol* sgnode);
397
398 public:
399 /* name Memory Allocation Functions
400 \brief Memory allocations functions ... incomplete-documentation
401
402 These functions have been made public as part of the design, but they are suggested for internal use
403 or by particularly knowledgable users for specialized tools or applications.
404 */
405 /* */
406
417 virtual bool isInMemoryPool() override;
418
429 virtual void checkDataMemberPointersIfInMemoryPool() override;
430
431 // DQ (4/30/2006): Modified to be a const function.
446 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
447
458
470 virtual long getChildIndex( SgNode* childNode ) const override;
471
472 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
473 // comment here (changed to be a C style comment and not be a doxygen comment).
474 /* \brief Constructor for use by AST File I/O Mechanism
475
476 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
477 which obtained via fast binary file I/O from disk.
478 */
479 // SgAsmGenericSymbol( SgAsmGenericSymbolStorageClass& source );
480
481
482
483
484
485 // JH (10/24/2005): methods added to support the ast file IO
486 private:
487
488 /* name AST Memory Allocation Support Functions
489 \brief Memory allocations support....
490
491 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
492 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
493 and support the AST File I/O Mechanism.
494 */
495 /* */
496
497 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
498 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
499 that I use the same type everywhere, if any changes are made. THe second one declares the type
500 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
501 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
502 a correspinding one in the AST_FILE_IO class!
503 */
504 // DQ (9/2/2015): This typedef is no longer used, we can't define the
505 // comment here (changed to be a C style comment and not be a doxygen comment).
506 /* \brief Typedef used for low level memory access.
507 */
508 // typedef unsigned char* TestType;
509
510 // DQ (9/2/2015): This typedef is no longer used, we can't define the
511 // comment here (changed to be a C style comment and not be a doxygen comment).
512 /* \brief Typedef used to hold memory addresses as values.
513 */
514 // typedef unsigned long AddressType;
515
516
517
518 // necessary, to have direct access to the p_freepointer and the private methods !
520 friend class AST_FILE_IO;
521
523 friend class SgAsmGenericSymbolStorageClass;
524
526 friend class AstSpecificDataManagingClass;
527
529 friend class AstSpecificDataManagingClassStorageClass;
530 public:
532 SgAsmGenericSymbol( const SgAsmGenericSymbolStorageClass& source );
533
534 // private: // JJW hack
535 /*
536 name AST Memory Allocation Support Variables
537 Memory allocations support variables
538
539 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
540 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
541 and support the AST File I/O Mechanism.
542 */
543 /* */
544
545 public:
546
547 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
548 // to current node (so that it will work cleanly with build functions to specify patterns).
549 // virtual SgNode* addRegExpAttribute();
556
557#ifndef _MSC_VER
558// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
559// and likely never fully implemented nor tested. Files remain in the src tree but are no
560// longer built.
561#define BUILD_ATERM_SUPPORT 0
562 #if BUILD_ATERM_SUPPORT
563 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
564 // DQ (10/4/2014): Adding ATerm support to ROSE.
574 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
575 virtual ATerm generate_ATerm() override;
576
578 virtual void generate_ATerm_Annotation(ATerm & term) override;
579 #endif
580 #endif // BUILD_ATERM_SUPPORT
581#endif
582 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
583 // virtual generate_AST(ATerm & term);
584 // virtual void read_ATerm_Annotation(ATerm & term);
585
586// *** COMMON CODE SECTION ENDS HERE ***
587
588
589// End of memberFunctionString
590// Start of memberFunctionString
591/* #line 710 "/workspace/src/ROSETTA/Grammar/Node.code" */
592
593 // the generated cast function
594 // friend ROSE_DLL_API SgAsmGenericSymbol* isSgAsmGenericSymbol ( SgNode* s );
595
596 typedef SgAsmExecutableFileFormat base_node_type;
597
598
599// End of memberFunctionString
600
601
602
603
604
605
606
607
608 protected:
609// Start of memberFunctionString
610SgAsmGenericSymbol::SymbolDefState p_definitionState;
611
612// End of memberFunctionString
613// Start of memberFunctionString
615
616// End of memberFunctionString
617// Start of memberFunctionString
619
620// End of memberFunctionString
621// Start of memberFunctionString
623
624// End of memberFunctionString
625// Start of memberFunctionString
627
628// End of memberFunctionString
629// Start of memberFunctionString
630SgAsmGenericSection* p_bound;
631
632// End of memberFunctionString
633// Start of memberFunctionString
634SgAsmGenericString* p_name;
635
636// End of memberFunctionString
637
639 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSymbol, SgAsmGenericSymbol::SymbolDefState,&SgAsmGenericSymbol::p_definitionState>;
640 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSymbol, SgAsmGenericSymbol::SymbolBinding,&SgAsmGenericSymbol::p_binding>;
641 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSymbol, SgAsmGenericSymbol::SymbolType,&SgAsmGenericSymbol::p_type>;
642 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSymbol, Rose::BinaryAnalysis::Address,&SgAsmGenericSymbol::p_value>;
643 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSymbol, Rose::BinaryAnalysis::Address,&SgAsmGenericSymbol::p_size>;
644 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSymbol, SgAsmGenericSection*,&SgAsmGenericSymbol::p_bound>;
645 friend struct Rose::Traits::generated::describe_field_t<SgAsmGenericSymbol, SgAsmGenericString*,&SgAsmGenericSymbol::p_name>;
646
647/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
648
649
650 };
651#endif
652
653// postdeclarations for SgAsmGenericSymbol
654
655/* #line 656 "../../../src/frontend/SageIII//SgAsmGenericSymbol.h" */
656
657/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
658
659/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
660
661
662/* #line 663 "../../../src/frontend/SageIII//SgAsmGenericSymbol.h" */
663
664#endif // ROSE_SgAsmGenericSymbol_H
665
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 strings related to binary specimens.
SymbolBinding
Symbol binding.
SymbolDefState
Symbol definition state.
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.
std::uint64_t Address
Address.
Definition Address.h:11
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.
std::string get_name(const SgNode *node)
Generate a useful name to describe the SgNode.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.
const char * SymbolType(int64_t)
Convert SgAsmGenericSymbol::SymbolType enum constant to a string.
const char * SymbolDefState(int64_t)
Convert SgAsmGenericSymbol::SymbolDefState enum constant to a string.
const char * SymbolBinding(int64_t)
Convert SgAsmGenericSymbol::SymbolBinding enum constant to a string.