Last change
on this file since 11ab0b4a was 60a8062, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago |
rewrite most of OperatorTable and change caller modules to use new interface
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Rev | Line | |
---|
[51587aa] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
[bff227f] | 7 | // OperatorTable.h --
|
---|
[51587aa] | 8 | //
|
---|
| 9 | // Author : Richard C. Bilson
|
---|
| 10 | // Created On : Mon May 18 07:44:20 2015
|
---|
[6b0b624] | 11 | // Last Modified By : Peter A. Buhr
|
---|
[60a8062] | 12 | // Last Modified On : Sun Feb 16 08:13:34 2020
|
---|
| 13 | // Update Count : 26
|
---|
[51587aa] | 14 | //
|
---|
| 15 |
|
---|
[6b0b624] | 16 | #pragma once
|
---|
[51b73452] | 17 |
|
---|
| 18 | #include <string>
|
---|
[60a8062] | 19 | #include <map>
|
---|
[51b73452] | 20 |
|
---|
| 21 | namespace CodeGen {
|
---|
[51587aa] | 22 | enum OperatorType {
|
---|
[2794fff] | 23 | OT_CTOR,
|
---|
| 24 | OT_DTOR,
|
---|
[60a8062] | 25 | OT_CONSTRUCTOR = OT_DTOR,
|
---|
[51587aa] | 26 | OT_PREFIXASSIGN,
|
---|
| 27 | OT_POSTFIXASSIGN,
|
---|
| 28 | OT_INFIXASSIGN,
|
---|
[60a8062] | 29 | OT_ASSIGNMENT = OT_INFIXASSIGN,
|
---|
| 30 | OT_CALL,
|
---|
| 31 | OT_PREFIX,
|
---|
| 32 | OT_INFIX,
|
---|
| 33 | OT_POSTFIX,
|
---|
| 34 | OT_INDEX,
|
---|
[de62360d] | 35 | OT_LABELADDRESS,
|
---|
[51587aa] | 36 | OT_CONSTANT
|
---|
| 37 | };
|
---|
| 38 |
|
---|
| 39 | struct OperatorInfo {
|
---|
| 40 | std::string inputName;
|
---|
| 41 | std::string symbol;
|
---|
| 42 | std::string outputName;
|
---|
[98538288] | 43 | std::string friendlyName;
|
---|
[51587aa] | 44 | OperatorType type;
|
---|
| 45 | };
|
---|
| 46 |
|
---|
[60a8062] | 47 | class CodeGen {
|
---|
| 48 | friend const OperatorInfo * operatorLookup( const std::string & funcName );
|
---|
| 49 |
|
---|
| 50 | static const OperatorInfo tableValues[];
|
---|
| 51 | static std::map< std::string, OperatorInfo > table;
|
---|
| 52 | public:
|
---|
| 53 | CodeGen();
|
---|
| 54 | }; // CodeGen
|
---|
| 55 |
|
---|
[3d2b7bc] | 56 | bool isOperator( const std::string & funcName );
|
---|
[60a8062] | 57 | const OperatorInfo * operatorLookup( const std::string & funcName );
|
---|
[98538288] | 58 | std::string operatorFriendlyName( const std::string & funcName );
|
---|
[bff227f] | 59 |
|
---|
| 60 | bool isConstructor( const std::string & );
|
---|
| 61 | bool isDestructor( const std::string & );
|
---|
| 62 | bool isAssignment( const std::string & );
|
---|
| 63 | bool isCtorDtor( const std::string & );
|
---|
| 64 | bool isCtorDtorAssign( const std::string & );
|
---|
[51b73452] | 65 | } // namespace CodeGen
|
---|
| 66 |
|
---|
[51587aa] | 67 | // Local Variables: //
|
---|
| 68 | // tab-width: 4 //
|
---|
| 69 | // mode: c++ //
|
---|
| 70 | // compile-command: "make install" //
|
---|
| 71 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.