ROSE 0.11.145.147
SgAsmInterpretation.h
1
2#ifndef ROSE_SgAsmInterpretation_H
3#define ROSE_SgAsmInterpretation_H
4#include <RoseFirst.h>
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmNode.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 SgAsmInterpretation
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmInterpretation.h" */
25/* #line 14107 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/BasicTypes.h>
28#include <Rose/BinaryAnalysis/InstructionMap.h>
29#include <Rose/BinaryAnalysis/MemoryMap.h>
30
31#ifdef ROSE_SgAsmInterpretation_IMPL
32#include <SgAsmBlock.h>
33#include <SgAsmGenericHeaderList.h>
34#endif
35
36
37/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
38
39/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
40
41#if !defined(DOCUMENTATION)
42// Class Definition for SgAsmInterpretation
43class ROSE_DLL_API SgAsmInterpretation : public SgAsmNode
44 {
45 public:
46
47
48/* #line 49 "../../../src/frontend/SageIII//SgAsmInterpretation.h" */
49
50 virtual SgNode* copy ( SgCopyHelp& help) const override;
51// Start of memberFunctionString
52/* #line 14153 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
53
54
55 //----------------------- Boost serialization for SgAsmInterpretation -----------------------
56#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
57private:
58 friend class boost::serialization::access;
59
60 template<class S>
61 void serialize(S &s, const unsigned /*version*/) {
62 debugSerializationBegin("SgAsmInterpretation");
63 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmNode);
64 s & BOOST_SERIALIZATION_NVP(p_headers);
65 s & BOOST_SERIALIZATION_NVP(p_globalBlock);
66 s & BOOST_SERIALIZATION_NVP(p_map);
67 s & BOOST_SERIALIZATION_NVP(instruction_map);
68 s & BOOST_SERIALIZATION_NVP(p_coverageComputed);
69 s & BOOST_SERIALIZATION_NVP(p_percentageCoverage);
70 debugSerializationEnd("SgAsmInterpretation");
71 }
72#endif // ROSE_HAVE_BOOST_SERIALIZATION_LIB
73public:
74public:
83 SgAsmGenericHeaderList* const& get_headers() const;
84 void set_headers(SgAsmGenericHeaderList* const&);
87public:
93 SgAsmBlock* const& get_globalBlock() const;
94 void set_globalBlock(SgAsmBlock* const&);
96 // ROSETTA doesn't understand this type, but we want this treated like a property whose data member name is "p_map"
97 // and which has automatically generator accessors and mutators named "get_map" and "set_map" and is serialized.
98private:
100
101public:
107 Rose::BinaryAnalysis::MemoryMap::Ptr const& get_map() const;
108 void set_map(Rose::BinaryAnalysis::MemoryMap::Ptr const&);
110 // ROSETTA doesn't understand this type, but we want it serialized. Therfore, we'll define it as a property, but we'll
111 // supply our own accessor and no mutator.
112private:
113 mutable Rose::BinaryAnalysis::InstructionMap instruction_map;
114
115public:
123 // cached instruction map
124
125 Rose::BinaryAnalysis::InstructionMap& get_instructionMap(bool recompute = false);
126 void set_instructionMap(const Rose::BinaryAnalysis::InstructionMap&);
128public:
136 bool const& get_coverageComputed() const;
137 void set_coverageComputed(bool const&);
140public:
147 double const& get_percentageCoverage() const;
148 void set_percentageCoverage(double const&);
150public:
155 SgAsmGenericFilePtrList get_files() const;
156
161 void insertInstructions(Rose::BinaryAnalysis::InstructionMap&/*in,out*/);
162
167 void eraseInstructions(Rose::BinaryAnalysis::InstructionMap&/*in,out*/);
168
170 // Deprecated 2023-11
172public:
173 SgAsmBlock* get_global_block() const ROSE_DEPRECATED("use get_globalBlock");
174 void set_global_block(SgAsmBlock*) ROSE_DEPRECATED("use set_globalBlock");
175 Rose::BinaryAnalysis::InstructionMap& get_instruction_map(bool=false) ROSE_DEPRECATED("use get_instructionMap");
176 void set_instruction_map(const Rose::BinaryAnalysis::InstructionMap&) ROSE_DEPRECATED("use set_instructionMap");
177 void insert_instructions(Rose::BinaryAnalysis::InstructionMap&) ROSE_DEPRECATED("use insertInstructions");
178 void erase_instructions(Rose::BinaryAnalysis::InstructionMap&) ROSE_DEPRECATED("use eraseInstructions");
179public:
181 virtual ~SgAsmInterpretation();
182
183public:
186
187protected:
194 void initializeProperties();
195
196
197// End of memberFunctionString
198// Start of memberFunctionString
199/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
200
201// *** COMMON CODE SECTION BEGINS HERE ***
202
203 public:
204
205 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
206 // and not required which is required to match the other aspects of the copy mechanism code generation.
207 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
208 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
209 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
210 // virtual SgNode* copy ( const SgCopyHelp & help) const;
211
213 virtual std::string class_name() const override;
214
216 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
217
219 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
220 // static const VariantT static_variant = V_SgAsmInterpretation;
221 enum { static_variant = V_SgAsmInterpretation };
222
223 /* the generated cast function */
225 ROSE_DLL_API friend SgAsmInterpretation* isSgAsmInterpretation( SgNode * s );
226
228 ROSE_DLL_API friend const SgAsmInterpretation* isSgAsmInterpretation( const SgNode * s );
229
230 // ******************************************
231 // * Memory Pool / New / Delete
232 // ******************************************
233
234 public:
236 static const unsigned pool_size; //
238 static std::vector<unsigned char *> pools; //
240 static SgAsmInterpretation * next_node; //
241
243 static unsigned long initializeStorageClassArray(SgAsmInterpretationStorageClass *); //
244
246 static void clearMemoryPool(); //
247 static void deleteMemoryPool(); //
248
250 static void extendMemoryPoolForFileIO(); //
251
253 static SgAsmInterpretation * getPointerFromGlobalIndex(unsigned long); //
255 static SgAsmInterpretation * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
256
258 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
260 static void resetValidFreepointers(); //
262 static unsigned long getNumberOfLastValidPointer(); //
263
264
265#if defined(INLINE_FUNCTIONS)
267 inline void *operator new (size_t size);
268#else
270 void *operator new (size_t size);
271#endif
273 void operator delete (void* pointer, size_t size);
274
275 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
276 void operator delete (void* pointer)
277 {
278 // This is the generated delete operator...
279 SgAsmInterpretation::operator delete (pointer,sizeof(SgAsmInterpretation));
280 }
281
283 static size_t numberOfNodes();
284
286 static size_t memoryUsage();
287
288 // End of scope which started in IR nodes specific code
289 /* */
290
291 /* name Internal Functions
292 \brief Internal functions ... incomplete-documentation
293
294 These functions have been made public as part of the design, but they are suggested for internal use
295 or by particularly knowledgeable users for specialized tools or applications.
296
297 \internal We could not make these private because they are required by user for special purposes. And
298 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
299
300 */
301
302 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
303 // overridden in every class by *generated* implementation
305 virtual std::vector<SgNode*> get_traversalSuccessorContainer() override;
306 // MS: 06/28/02 container of names of variables or container indices
307 // used used in the traversal to access AST successor nodes
308 // overridden in every class by *generated* implementation
311 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() override;
312
313 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
314 // than all the vector copies. The implementation for these functions is generated for each class.
316 virtual size_t get_numberOfTraversalSuccessors() override;
318 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) override;
320 virtual size_t get_childIndex(SgNode *child) override;
321
322#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
323 // MS: 08/16/2002 method for generating RTI information
325 virtual RTIReturnType roseRTI() override;
326#endif
327 /* */
328
329
330
331 /* name Deprecated Functions
332 \brief Deprecated functions ... incomplete-documentation
333
334 These functions have been deprecated from use.
335 */
336 /* */
337
339 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
340
341 // JJW (10/16/2008): Changed to a single function in Node.code, and put
342 // getVariant() in #if 0 block to prevent confusing Doxygen
343#if 0
345 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
347 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
348#endif
349 /* */
350
351
352
353
354 public:
355 /* name Traversal Support Functions
356 \brief Traversal support functions ... incomplete-documentation
357
358 These functions have been made public as part of the design, but they are suggested for internal use
359 or by particularly knowledgable users for specialized tools or applications.
360 */
361 /* */
362
363 // DQ (11/26/2005): Support for visitor pattern mechanims
364 // (inferior to ROSE traversal mechanism, experimental).
368
369 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
371 virtual void accept (ROSE_VisitorPattern & visitor) override;
372
373 // DQ (12/26/2005): Support for traversal based on the memory pool
376 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
377
381
382 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
383 // This traversal helps support internal tools that call static member functions.
384 // note: this function operates on the memory pools.
387 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
388 /* */
389
390 public:
391 /* NodeId support functions */
393 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
396 static SgAsmInterpretation* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
399 static std::string getNodeIdString(SgAsmInterpretation* sgnode);
400 static std::string getNodeIdStringInternal(SgAsmInterpretation* sgnode);
401
402 public:
403 /* name Memory Allocation Functions
404 \brief Memory allocations functions ... incomplete-documentation
405
406 These functions have been made public as part of the design, but they are suggested for internal use
407 or by particularly knowledgable users for specialized tools or applications.
408 */
409 /* */
410
421 virtual bool isInMemoryPool() override;
422
433 virtual void checkDataMemberPointersIfInMemoryPool() override;
434
435 // DQ (4/30/2006): Modified to be a const function.
450 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
451
462
474 virtual long getChildIndex( SgNode* childNode ) const override;
475
476 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
477 // comment here (changed to be a C style comment and not be a doxygen comment).
478 /* \brief Constructor for use by AST File I/O Mechanism
479
480 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
481 which obtained via fast binary file I/O from disk.
482 */
483 // SgAsmInterpretation( SgAsmInterpretationStorageClass& source );
484
485
486
487
488
489 // JH (10/24/2005): methods added to support the ast file IO
490 private:
491
492 /* name AST Memory Allocation Support Functions
493 \brief Memory allocations support....
494
495 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
496 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
497 and support the AST File I/O Mechanism.
498 */
499 /* */
500
501 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
502 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
503 that I use the same type everywhere, if any changes are made. THe second one declares the type
504 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
505 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
506 a correspinding one in the AST_FILE_IO class!
507 */
508 // DQ (9/2/2015): This typedef is no longer used, we can't define the
509 // comment here (changed to be a C style comment and not be a doxygen comment).
510 /* \brief Typedef used for low level memory access.
511 */
512 // typedef unsigned char* TestType;
513
514 // DQ (9/2/2015): This typedef is no longer used, we can't define the
515 // comment here (changed to be a C style comment and not be a doxygen comment).
516 /* \brief Typedef used to hold memory addresses as values.
517 */
518 // typedef unsigned long AddressType;
519
520
521
522 // necessary, to have direct access to the p_freepointer and the private methods !
524 friend class AST_FILE_IO;
525
527 friend class SgAsmInterpretationStorageClass;
528
530 friend class AstSpecificDataManagingClass;
531
533 friend class AstSpecificDataManagingClassStorageClass;
534 public:
536 SgAsmInterpretation( const SgAsmInterpretationStorageClass& source );
537
538 // private: // JJW hack
539 /*
540 name AST Memory Allocation Support Variables
541 Memory allocations support variables
542
543 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
544 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
545 and support the AST File I/O Mechanism.
546 */
547 /* */
548
549 public:
550
551 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
552 // to current node (so that it will work cleanly with build functions to specify patterns).
553 // virtual SgNode* addRegExpAttribute();
560
561#ifndef _MSC_VER
562// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
563// and likely never fully implemented nor tested. Files remain in the src tree but are no
564// longer built.
565#define BUILD_ATERM_SUPPORT 0
566 #if BUILD_ATERM_SUPPORT
567 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
568 // DQ (10/4/2014): Adding ATerm support to ROSE.
578 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
579 virtual ATerm generate_ATerm() override;
580
582 virtual void generate_ATerm_Annotation(ATerm & term) override;
583 #endif
584 #endif // BUILD_ATERM_SUPPORT
585#endif
586 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
587 // virtual generate_AST(ATerm & term);
588 // virtual void read_ATerm_Annotation(ATerm & term);
589
590// *** COMMON CODE SECTION ENDS HERE ***
591
592
593// End of memberFunctionString
594// Start of memberFunctionString
595/* #line 706 "/workspace/src/ROSETTA/Grammar/Node.code" */
596
597 // the generated cast function
598 // friend ROSE_DLL_API SgAsmInterpretation* isSgAsmInterpretation ( SgNode* s );
599
600 typedef SgAsmNode base_node_type;
601
602
603// End of memberFunctionString
604
605
606
607
608
609 protected:
610// Start of memberFunctionString
611SgAsmGenericHeaderList* p_headers;
612
613// End of memberFunctionString
614// Start of memberFunctionString
615SgAsmBlock* p_globalBlock;
616
617// End of memberFunctionString
618// Start of memberFunctionString
619bool p_coverageComputed;
620
621// End of memberFunctionString
622// Start of memberFunctionString
623double p_percentageCoverage;
624
625// End of memberFunctionString
626
628 friend struct Rose::Traits::generated::describe_field_t<SgAsmInterpretation, SgAsmGenericHeaderList*,&SgAsmInterpretation::p_headers>;
629 friend struct Rose::Traits::generated::describe_field_t<SgAsmInterpretation, SgAsmBlock*,&SgAsmInterpretation::p_globalBlock>;
630 friend struct Rose::Traits::generated::describe_field_t<SgAsmInterpretation, bool,&SgAsmInterpretation::p_coverageComputed>;
631 friend struct Rose::Traits::generated::describe_field_t<SgAsmInterpretation, double,&SgAsmInterpretation::p_percentageCoverage>;
632
633/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
634
635
636 };
637#endif
638
639// postdeclarations for SgAsmInterpretation
640
641/* #line 642 "../../../src/frontend/SageIII//SgAsmInterpretation.h" */
642
643/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
644
645/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
646
647
648/* #line 649 "../../../src/frontend/SageIII//SgAsmInterpretation.h" */
649
650#endif // ROSE_SgAsmInterpretation_H
651
Class holding static data and functions supporting File I/O.
Definition AST_FILE_IO.h:19
Attribute containing a regex expression as a string.
Instruction basic block.
List of generic file headers.
Represents an interpretation of a binary container.
Base class for all binary analysis IR nodes.
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.
The ROSE library.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.