latereasoning.h
No OneTemporary

File Metadata

Created
Mon, Jul 6, 11:33 PM

latereasoning.h

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: latereasoning.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on May 26, 2018, 3:44 PM
*/
#ifndef CMPLLATEREASONING_H
#define CMPLLATEREASONING_H
#include "ast.h"
#include "aux/latereasoning.h"
#include "pass/compilepass.h"
#include "llvmlayer.h"
#include "transcendlayer.h"
#include "targets.h"
namespace xreate{
namespace interpretation{
class InterpretationFunction;
}
}
namespace llvm{
class Value;
}
namespace xreate{
namespace latereasoning{
typedef std::function<llvm::Value*() > CompilerHandler;
typedef std::function<llvm::Value*(const Gringo::Symbol&) > Handler;
class LateReasoningCompiler{
public:
LateReasoningCompiler(interpretation::InterpretationFunction* fn,
compilation::Context ctx)
: __context(ctx), __fnI12n(fn){ }
llvm::Value* processSwitchLateStatement(const Expression& expr,
const std::string& identHint);
llvm::Value* compileAutoExpand(const LateAnnotation& annotation,
llvm::Type* resultT,
const std::string& hint,
Handler handler);
private:
compilation::Context __context;
interpretation::InterpretationFunction* __fnI12n;
static std::map<SymbolPacked, Expression> __dictGuardDefinitions;
llvm::Value* compileExpand(const Symbol& keyS,
llvm::Value* keyRaw,
const ExpandedType& domainT,
llvm::Type* resultT,
const std::string& hint,
CompilerHandler compilerBody);
std::list<Expression> findKeys(const std::list<SymbolPacked>& keys);
};
}
}
#endif /* CMPLLATEREASONING_H */

Event Timeline