1 //===- RecordingMemoryManager.cpp - Recording memory manager --------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This memory manager allocates local storage and keeps a record of each
11 // allocation. Iterators are provided for all data and code allocations.
13 //===----------------------------------------------------------------------===//
15 #include "RecordingMemoryManager.h"
18 uint8_t *RecordingMemoryManager::
19 allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) {
20 // The recording memory manager is just a local copy of the remote target.
21 // The alignment requirement is just stored here for later use. Regular
22 // heap storage is sufficient here.
23 void *Addr = malloc(Size);
24 assert(Addr && "malloc() failure!");
25 sys::MemoryBlock Block(Addr, Size);
26 AllocatedCodeMem.push_back(Allocation(Block, Alignment));
27 return (uint8_t*)Addr;
30 uint8_t *RecordingMemoryManager::
31 allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) {
32 // The recording memory manager is just a local copy of the remote target.
33 // The alignment requirement is just stored here for later use. Regular
34 // heap storage is sufficient here.
35 void *Addr = malloc(Size);
36 assert(Addr && "malloc() failure!");
37 sys::MemoryBlock Block(Addr, Size);
38 AllocatedDataMem.push_back(Allocation(Block, Alignment));
39 return (uint8_t*)Addr;
41 void RecordingMemoryManager::setMemoryWritable() { llvm_unreachable("Unexpected!"); }
42 void RecordingMemoryManager::setMemoryExecutable() { llvm_unreachable("Unexpected!"); }
43 void RecordingMemoryManager::setPoisonMemory(bool poison) { llvm_unreachable("Unexpected!"); }
44 void RecordingMemoryManager::AllocateGOT() { llvm_unreachable("Unexpected!"); }
45 uint8_t *RecordingMemoryManager::getGOTBase() const {
46 llvm_unreachable("Unexpected!");
49 uint8_t *RecordingMemoryManager::startFunctionBody(const Function *F, uintptr_t &ActualSize){
50 llvm_unreachable("Unexpected!");
53 uint8_t *RecordingMemoryManager::allocateStub(const GlobalValue* F, unsigned StubSize,
55 llvm_unreachable("Unexpected!");
58 void RecordingMemoryManager::endFunctionBody(const Function *F, uint8_t *FunctionStart,
59 uint8_t *FunctionEnd) {
60 llvm_unreachable("Unexpected!");
62 uint8_t *RecordingMemoryManager::allocateSpace(intptr_t Size, unsigned Alignment) {
63 llvm_unreachable("Unexpected!");
66 uint8_t *RecordingMemoryManager::allocateGlobal(uintptr_t Size, unsigned Alignment) {
67 llvm_unreachable("Unexpected!");
70 void RecordingMemoryManager::deallocateFunctionBody(void *Body) {
71 llvm_unreachable("Unexpected!");
73 uint8_t* RecordingMemoryManager::startExceptionTable(const Function* F, uintptr_t &ActualSize) {
74 llvm_unreachable("Unexpected!");
77 void RecordingMemoryManager::endExceptionTable(const Function *F, uint8_t *TableStart,
78 uint8_t *TableEnd, uint8_t* FrameRegister) {
79 llvm_unreachable("Unexpected!");
81 void RecordingMemoryManager::deallocateExceptionTable(void *ET) {
82 llvm_unreachable("Unexpected!");
84 void *RecordingMemoryManager::getPointerToNamedFunction(const std::string &Name,
85 bool AbortOnFailure) {