source: src/CodeGen/OperatorTable.h @ 61e362f

Last change on this file since 61e362f was 49ae2bc, checked in by Andrew Beach <ajbeach@…>, 7 months ago

Refactored the OperatorTable? module. Most is just an update in style and some documentation. I did add a function that should be a useful utility for the demangler.

  • Property mode set to 100644
File size: 2.0 KB
Line 
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//
7// OperatorTable.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Andrew Beach
12// Last Modified On : Fri Nov  3 14:53:00 2023
13// Update Count     : 27
14//
15
16#pragma once
17
18#include <string>
19
20namespace CodeGen {
21
22enum OperatorType {
23        OT_CTOR,
24        OT_DTOR,
25        OT_CONSTRUCTOR = OT_DTOR,
26        OT_PREFIXASSIGN,
27        OT_POSTFIXASSIGN,
28        OT_INFIXASSIGN,
29        OT_ASSIGNMENT = OT_INFIXASSIGN,
30        OT_CALL,
31        OT_PREFIX,
32        OT_INFIX,
33        OT_POSTFIX,
34        OT_INDEX,
35        OT_LABELADDRESS,
36        OT_CONSTANT
37};
38
39struct OperatorInfo {
40        // The Cforall special function name.
41        std::string inputName;
42        // The string used when the operator is used as an operator.
43        std::string symbol;
44        // The base name used in the mangled name.
45        std::string outputName;
46        // Human-readable name of the operator.
47        std::string friendlyName;
48        // The type of operator shows how it is used as an operator.
49        OperatorType type;
50};
51
52// Look up the operator (by inputName), return nullptr if no such operator.
53const OperatorInfo * operatorLookup( const std::string & inputName );
54// Is there an operator with this name?
55bool isOperator( const std::string & inputName );
56// Get the friendlyName of the operator with the inputName
57std::string operatorFriendlyName( const std::string & inputName );
58// Get the OperatorInfo with the given outputName, if one exists.
59const OperatorInfo * operatorLookupByOutput( const std::string & outputName );
60
61// Is the operator a constructor, destructor or any form of assignment.
62// (Last two are "or" combinations of the first three.)
63bool isConstructor( const std::string & );
64bool isDestructor( const std::string & );
65bool isAssignment( const std::string & );
66bool isCtorDtor( const std::string & );
67bool isCtorDtorAssign( const std::string & );
68
69} // namespace CodeGen
70
71// Local Variables: //
72// tab-width: 4 //
73// mode: c++ //
74// compile-command: "make install" //
75// End: //
Note: See TracBrowser for help on using the repository browser.