souffle
2.0.2-371-g6315b36
ast
transform
Meta.cpp
Go to the documentation of this file.
1
/*
2
* Souffle - A Datalog Compiler
3
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved
4
* Licensed under the Universal Permissive License v 1.0 as shown at:
5
* - https://opensource.org/licenses/UPL
6
* - <souffle root>/licenses/SOUFFLE-UPL.txt
7
*/
8
9
/************************************************************************
10
*
11
* @file Meta.cpp
12
*
13
* Defines the interface for AST meta-transformation passes.
14
*
15
***********************************************************************/
16
17
#include "
ast/transform/Meta.h
"
18
#include "
souffle/utility/MiscUtil.h
"
19
#include <chrono>
20
#include <iostream>
21
22
namespace
souffle::ast::transform
{
23
24
bool
MetaTransformer::applySubtransformer
(TranslationUnit& translationUnit, Transformer* transformer) {
25
auto
start =
std::chrono::high_resolution_clock::now
();
26
bool
changed = transformer->apply(translationUnit);
27
auto
end =
std::chrono::high_resolution_clock::now
();
28
29
if
(
verbose
&& (!isA<MetaTransformer>(transformer))) {
30
std::string changedString = changed ?
"changed"
:
"unchanged"
;
31
std::cout << transformer->getName() <<
" time: "
<< std::chrono::duration<double>(end - start).count()
32
<<
"sec ["
<< changedString <<
"]"
<< std::endl;
33
}
34
35
return
changed;
36
}
37
38
}
// namespace souffle::ast::transform
MiscUtil.h
souffle::now
time_point now()
Definition:
MiscUtil.h:89
souffle::ast::transform::MetaTransformer::verbose
bool verbose
Definition:
Meta.h:44
souffle::ast::transform
Definition:
Program.h:45
souffle::ast::transform::MetaTransformer::applySubtransformer
bool applySubtransformer(TranslationUnit &translationUnit, Transformer *transformer)
Definition:
Meta.cpp:30
Meta.h
Generated by
1.8.17