advancedinstructions.h
No OneTemporary

File Metadata

Created
Mon, Aug 24, 4:47 AM

advancedinstructions.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: AdvancedInstructions.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on June 26, 2016, 6:00 PM
*/
/**
* \file advancedinstructions.h
* \brief Compound statements compilation
*/
#ifndef INSTRUCTIONSADVANCED_H
#define INSTRUCTIONSADVANCED_H
#include "ast.h"
#include "llvmlayer.h"
#include "pass/compilepass.h"
#include <vector>
namespace xreate {
namespace compilation {
/** \brief Advanced compilation primitives */
class AdvancedInstructions {
public:
AdvancedInstructions(compilation::Context ctx);
/** \brief Array subscript access operator compilation*/
llvm::Value* compileArrayIndex(llvm::Value* aggregate, std::vector<llvm::Value *> indexes, std::string ident = "");
/** \brief Struct field access operator compilation*/
llvm::Value* compileStructIndex(llvm::Value* aggregate, const ExpandedType& t, const std::string& idx);
/*
* - map Computation -> Llvm_Array: Prohibited, we do not know a result size
* - map Llvm_Array -> Computation: considered in `compileGetElement`
* - map Llvm_Array -> Llvm_Array considered by this method
*/
/** \brief `loop map` statement compilation*/
llvm::Value* compileMapSolidOutput(const Expression &expr, const std::string hintRetVar = "");
/** \brief `loop fold` statement compilation*/
llvm::Value* compileFold(const Expression& fold, const std::string& ident="");
/** \brief `loop` statement compilation*/
llvm::Value* compileFoldInf(const Expression& fold, const std::string& ident="");
/** \brief `if` statement compilation*/
llvm::Value* compileIf(const Expression& exprIf, const std::string& ident);
/** \brief `switch` statement compilation*/
llvm::Value* compileSwitch(const Expression& exprSwitch, const std::string& hintRetVar);
/** \brief `switch` statement compilation*/
llvm::Value* compileSwitchVariant(const Expression& exprSwitch, const std::string& hintRetVar);
/** \brief `switch variant` statement compilation*/
llvm::Value* compileConstantStringAsPChar(const std::string &data, const std::string& hintRetVar);
/** \brief Contiguous memory list implementation*/
llvm::Value* compileListAsSolidArray(const Expression &expr, const std::string& hintRetVar);
/** \brief `seq` statement compilation */
llvm::Value* compileSequence(const Expression &expr);
private:
compilation::Context context;
llvm::IntegerType* const tyNum;
};
}}
#endif /* INSTRUCTIONSADVANCED_H */

Event Timeline