Add domain specifier to variable declarations

With this change, the domain of variable declarations can be specified.
Variables can have the integer domain, in which case additional integer-
specific simplification rules apply. Aside from that, the noninteger
domain represents precomputed values. An additional “unknown” domain is
introduced to flag variable domains prior to determining whether they
are integer or not.
This commit is contained in:
Patrick Lühne 2018-04-13 15:48:03 +02:00
parent 921d5ed4f0
commit 541cb3fb47
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#define __ANTHEM__AST_H #define __ANTHEM__AST_H
#include <anthem/ASTForward.h> #include <anthem/ASTForward.h>
#include <anthem/Utils.h>
namespace anthem namespace anthem
{ {
@ -369,6 +370,7 @@ struct VariableDeclaration
VariableDeclaration &operator=(VariableDeclaration &&other) = default; VariableDeclaration &operator=(VariableDeclaration &&other) = default;
Type type; Type type;
Domain domain{Domain::Unknown};
std::string name; std::string name;
}; };

View File

@ -33,6 +33,15 @@ enum class OperationResult
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
enum class Domain
{
Noninteger,
Integer,
Unknown,
};
////////////////////////////////////////////////////////////////////////////////////////////////////
} }
#endif #endif