ROSE 0.11.145.192
SgAsmX86Instruction.h
1
2#ifndef ROSE_SgAsmX86Instruction_H
3#define ROSE_SgAsmX86Instruction_H
4#include <RoseFirst.h>
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmInstruction.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 SgAsmX86Instruction
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmX86Instruction.h" */
25/* #line 115 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/BasicTypes.h>
28#include <Rose/BinaryAnalysis/InstructionEnumsX86.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 SgAsmX86Instruction
37class ROSE_DLL_API SgAsmX86Instruction : public SgAsmInstruction
38 {
39 public:
40
41
42/* #line 43 "../../../src/frontend/SageIII//SgAsmX86Instruction.h" */
43
44 virtual SgNode* copy ( SgCopyHelp& help) const override;
45// Start of memberFunctionString
46/* #line 174 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
47
48
49 //----------------------- Boost serialization for SgAsmX86Instruction -----------------------
50#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
51private:
52 friend class boost::serialization::access;
53
54 template<class S>
55 void serialize(S &s, const unsigned /*version*/) {
56 debugSerializationBegin("SgAsmX86Instruction");
57 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmInstruction);
58 s & BOOST_SERIALIZATION_NVP(p_kind);
59 s & BOOST_SERIALIZATION_NVP(p_baseSize);
60 s & BOOST_SERIALIZATION_NVP(p_operandSize);
61 s & BOOST_SERIALIZATION_NVP(p_addressSize);
62 s & BOOST_SERIALIZATION_NVP(p_lockPrefix);
63 s & BOOST_SERIALIZATION_NVP(p_repeatPrefix);
64 s & BOOST_SERIALIZATION_NVP(p_branchPrediction);
65 s & BOOST_SERIALIZATION_NVP(p_segmentOverride);
66 debugSerializationEnd("SgAsmX86Instruction");
67 }
68#endif // ROSE_HAVE_BOOST_SERIALIZATION_LIB
69public:
70public:
77 Rose::BinaryAnalysis::X86InstructionKind const& get_kind() const;
78 void set_kind(Rose::BinaryAnalysis::X86InstructionKind const&);
81public:
85 Rose::BinaryAnalysis::X86InstructionSize const& get_baseSize() const;
86 void set_baseSize(Rose::BinaryAnalysis::X86InstructionSize const&);
89public:
93 Rose::BinaryAnalysis::X86InstructionSize const& get_operandSize() const;
94 void set_operandSize(Rose::BinaryAnalysis::X86InstructionSize const&);
97public:
101 Rose::BinaryAnalysis::X86InstructionSize const& get_addressSize() const;
102 void set_addressSize(Rose::BinaryAnalysis::X86InstructionSize const&);
105public:
111 bool const& get_lockPrefix() const;
112 void set_lockPrefix(bool const&);
115public:
119 Rose::BinaryAnalysis::X86RepeatPrefix const& get_repeatPrefix() const;
120 void set_repeatPrefix(Rose::BinaryAnalysis::X86RepeatPrefix const&);
123public:
127 Rose::BinaryAnalysis::X86BranchPrediction const& get_branchPrediction() const;
128 void set_branchPrediction(Rose::BinaryAnalysis::X86BranchPrediction const&);
131public:
138 Rose::BinaryAnalysis::X86SegmentRegister const& get_segmentOverride() const;
139 void set_segmentOverride(Rose::BinaryAnalysis::X86SegmentRegister const&);
141public:
145 static Rose::BinaryAnalysis::X86InstructionSize instructionSizeForWidth(size_t);
146
150 static size_t widthForInstructionSize(Rose::BinaryAnalysis::X86InstructionSize);
151
156 static Rose::BinaryAnalysis::RegisterDictionaryPtr registersForInstructionSize(Rose::BinaryAnalysis::X86InstructionSize);
157
162 static Rose::BinaryAnalysis::RegisterDictionaryPtr registersForWidth(size_t);
163
164 // Overrides are documented in the base class
165 virtual unsigned get_anyKind() const override;
166public:
168 virtual ~SgAsmX86Instruction();
169
170public:
173
174public:
176 SgAsmX86Instruction(rose_addr_t const& address,
177 uint8_t const& architectureId,
179 Rose::BinaryAnalysis::X86InstructionSize const& baseSize,
180 Rose::BinaryAnalysis::X86InstructionSize const& operandSize,
181 Rose::BinaryAnalysis::X86InstructionSize const& addressSize);
182
183protected:
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_SgAsmX86Instruction;
217 enum { static_variant = V_SgAsmX86Instruction };
218
219 /* the generated cast function */
221 ROSE_DLL_API friend SgAsmX86Instruction* isSgAsmX86Instruction( SgNode * s );
222
224 ROSE_DLL_API friend const SgAsmX86Instruction* isSgAsmX86Instruction( 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 SgAsmX86Instruction * next_node; //
237
239 static unsigned long initializeStorageClassArray(SgAsmX86InstructionStorageClass *); //
240
242 static void clearMemoryPool(); //
243 static void deleteMemoryPool(); //
244
246 static void extendMemoryPoolForFileIO(); //
247
249 static SgAsmX86Instruction * getPointerFromGlobalIndex(unsigned long); //
251 static SgAsmX86Instruction * 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 SgAsmX86Instruction::operator delete (pointer,sizeof(SgAsmX86Instruction));
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() 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() 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() override;
314 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) override;
316 virtual size_t get_childIndex(SgNode *child) 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 SgAsmX86Instruction* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
395 static std::string getNodeIdString(SgAsmX86Instruction* sgnode);
396 static std::string getNodeIdStringInternal(SgAsmX86Instruction* 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 // SgAsmX86Instruction( SgAsmX86InstructionStorageClass& 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 SgAsmX86InstructionStorageClass;
524
526 friend class AstSpecificDataManagingClass;
527
529 friend class AstSpecificDataManagingClassStorageClass;
530 public:
532 SgAsmX86Instruction( const SgAsmX86InstructionStorageClass& 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 706 "/workspace/src/ROSETTA/Grammar/Node.code" */
592
593 // the generated cast function
594 // friend ROSE_DLL_API SgAsmX86Instruction* isSgAsmX86Instruction ( SgNode* s );
595
596 typedef SgAsmInstruction base_node_type;
597
598
599// End of memberFunctionString
600
601
602
603
604
605
606
607
608
609 protected:
610// Start of memberFunctionString
612
613// End of memberFunctionString
614// Start of memberFunctionString
615Rose::BinaryAnalysis::X86InstructionSize p_baseSize;
616
617// End of memberFunctionString
618// Start of memberFunctionString
619Rose::BinaryAnalysis::X86InstructionSize p_operandSize;
620
621// End of memberFunctionString
622// Start of memberFunctionString
623Rose::BinaryAnalysis::X86InstructionSize p_addressSize;
624
625// End of memberFunctionString
626// Start of memberFunctionString
627bool p_lockPrefix;
628
629// End of memberFunctionString
630// Start of memberFunctionString
631Rose::BinaryAnalysis::X86RepeatPrefix p_repeatPrefix;
632
633// End of memberFunctionString
634// Start of memberFunctionString
635Rose::BinaryAnalysis::X86BranchPrediction p_branchPrediction;
636
637// End of memberFunctionString
638// Start of memberFunctionString
639Rose::BinaryAnalysis::X86SegmentRegister p_segmentOverride;
640
641// End of memberFunctionString
642
644 friend struct Rose::Traits::generated::describe_field_t<SgAsmX86Instruction, Rose::BinaryAnalysis::X86InstructionKind,&SgAsmX86Instruction::p_kind>;
645 friend struct Rose::Traits::generated::describe_field_t<SgAsmX86Instruction, Rose::BinaryAnalysis::X86InstructionSize,&SgAsmX86Instruction::p_baseSize>;
646 friend struct Rose::Traits::generated::describe_field_t<SgAsmX86Instruction, Rose::BinaryAnalysis::X86InstructionSize,&SgAsmX86Instruction::p_operandSize>;
647 friend struct Rose::Traits::generated::describe_field_t<SgAsmX86Instruction, Rose::BinaryAnalysis::X86InstructionSize,&SgAsmX86Instruction::p_addressSize>;
648 friend struct Rose::Traits::generated::describe_field_t<SgAsmX86Instruction, bool,&SgAsmX86Instruction::p_lockPrefix>;
649 friend struct Rose::Traits::generated::describe_field_t<SgAsmX86Instruction, Rose::BinaryAnalysis::X86RepeatPrefix,&SgAsmX86Instruction::p_repeatPrefix>;
650 friend struct Rose::Traits::generated::describe_field_t<SgAsmX86Instruction, Rose::BinaryAnalysis::X86BranchPrediction,&SgAsmX86Instruction::p_branchPrediction>;
651 friend struct Rose::Traits::generated::describe_field_t<SgAsmX86Instruction, Rose::BinaryAnalysis::X86SegmentRegister,&SgAsmX86Instruction::p_segmentOverride>;
652
653/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
654
655
656 };
657#endif
658
659// postdeclarations for SgAsmX86Instruction
660
661/* #line 662 "../../../src/frontend/SageIII//SgAsmX86Instruction.h" */
662
663/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
664
665/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
666
667
668/* #line 669 "../../../src/frontend/SageIII//SgAsmX86Instruction.h" */
669
670#endif // ROSE_SgAsmX86Instruction_H
671
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 machine instructions.
void initializeProperties()
Initialize all properties that have explicit initial values.
virtual unsigned get_anyKind() const
Returns instruction kind for any architecture.
Represents one Intel x86 machine instruction.
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 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 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...
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
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.
X86InstructionKind
List of all x86 instructions known to the ROSE disassembler/assembler.
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.