Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F5335044
context.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 21, 5:22 AM
Size
1 KB
Mime Type
text/x-c++
Expires
Mon, Nov 23, 5:22 AM (1 d, 6 h)
Engine
blob
Format
Raw Data
Handle
315998
Attached To
rXR Xreate
context.h
View Options
/* 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: context.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on 25/05/2020
*/
#ifndef XREATE_CONTEXT_H
#define XREATE_CONTEXT_H
#include "ast.h"
#include "pass/compilepass.h"
namespace llvm {
class Value;
class GlobalVariable;
}
namespace xreate { namespace compilation{
class AllocContext {
public:
AllocContext(std::string id, ContextManager* man, AllocContext* parent)
: __id(id), __man(man), __parent(parent){}
void set(const ASTSite& varS, llvm::Value* varRaw);
llvm::Value* get(const ASTSite& varS);
private:
std::string __id;
ContextManager* __man;
AllocContext* __parent;
};
class ContextManager{
friend class AllocContext;
public:
ContextManager(CompilePass* pass): __pass(pass){};
AllocContext* getContext(const std::string& id);
private:
std::map<std::string, AllocContext*> __contexts;
CompilePass* __pass;
};
class GlobalContextTable{
public:
GlobalContextTable(CompilePass* pass): __pass(pass){}
void compile();
llvm::GlobalVariable* getVariable(const ASTSite& site){return __table.at(site);}
private:
CompilePass* __pass;
std::map<ASTSite, llvm::GlobalVariable*> __table;
};
}} // xreate::compilation
#endif //XREATE_CONTEXT_H
Event Timeline
Log In to Comment