Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F5328474
mm.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
Fri, Nov 20, 5:35 PM
Size
1 KB
Mime Type
text/x-c++
Expires
Sun, Nov 22, 5:35 PM (1 d, 2 h)
Engine
blob
Format
Raw Data
Handle
315724
Attached To
rXR Xreate
mm.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: memory.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on 27/05/2020
*/
#ifndef XREATE_MEMORY_H
#define XREATE_MEMORY_H
#include "pass/compilepass.h"
namespace xreate {namespace compilation{
enum class AllocatorType{
CONTEXTPAD,
LOCAL, // local allocation
DEFAULT = LOCAL
};
class Allocator{
public:
static Allocator* create(const Expression& expr, const Context& ctx);
static AllocatorType getType(const Expression& expr, AST* ast);
Allocator(LLVMLayer* l): llvm(l){}
virtual llvm::Value* allocate(llvm::Type* elRawT, llvm::Value* sizeRaw, const std::string& hintAlias) = 0;
protected:
LLVMLayer* llvm;
};
class ContextAllocator: public Allocator{
public:
static ContextAllocator* create(const Expression& expr, const Context& ctx);
ContextAllocator(llvm::Value* mem, LLVMLayer* l): Allocator(l), __mem(mem){}
virtual llvm::Value* allocate(llvm::Type* elRawT, llvm::Value* sizeRaw, const std::string& hintAlias) override;
private:
llvm::Value* __mem;
};
class LocalAllocator: public Allocator{
public:
LocalAllocator(LLVMLayer* l): Allocator(l){}
virtual llvm::Value* allocate(llvm::Type* elRawT, llvm::Value* sizeRaw, const std::string& hintAlias) override;
};
}} //xreate::compilation
#endif //XREATE_MEMORY_H
Event Timeline
Log In to Comment