LLVM API Documentation
#include <Memory.h>
Static Public Member Functions | |
| static MemoryBlock | AllocateRWX (unsigned NumBytes, const MemoryBlock *NearBlock, std::string *ErrMsg=0) |
| Allocate Read/Write/Execute memory. | |
| static bool | ReleaseRWX (MemoryBlock &block, std::string *ErrMsg=0) |
| Release Read/Write/Execute memory. | |
| static void | InvalidateInstructionCache (const void *Addr, size_t Len) |
| static bool | setExecutable (MemoryBlock &M, std::string *ErrMsg=0) |
| static bool | setWritable (MemoryBlock &M, std::string *ErrMsg=0) |
| static bool | setRangeExecutable (const void *Addr, size_t Size) |
| static bool | setRangeWritable (const void *Addr, size_t Size) |
This class provides various memory handling functions that manipulate MemoryBlock instances.
Definition at line 41 of file Memory.h.
| static MemoryBlock llvm::sys::Memory::AllocateRWX | ( | unsigned | NumBytes, | |
| const MemoryBlock * | NearBlock, | |||
| std::string * | ErrMsg = 0 | |||
| ) | [static] |
Allocate Read/Write/Execute memory.
This method allocates a block of Read/Write/Execute memory that is suitable for executing dynamically generated code (e.g. JIT). An attempt to allocate NumBytes bytes of virtual memory is made. NearBlock may point to an existing allocation in which case an attempt is made to allocate more memory near the existing block.
On success, this returns a non-null memory block, otherwise it returns a null memory block and fills in *ErrMsg.
| static bool llvm::sys::Memory::ReleaseRWX | ( | MemoryBlock & | block, | |
| std::string * | ErrMsg = 0 | |||
| ) | [static] |
Release Read/Write/Execute memory.
This method releases a block of Read/Write/Execute memory that was allocated with the AllocateRWX method. It should not be used to release any memory block allocated any other way.
On success, this returns false, otherwise it returns true and fills in *ErrMsg.
| std::string | if an error occurred. |
| void llvm::sys::Memory::InvalidateInstructionCache | ( | const void * | Addr, | |
| size_t | Len | |||
| ) | [static] |
InvalidateInstructionCache - Before the JIT can run a block of code that has been emitted it must invalidate the instruction cache on some platforms.
InvalidateInstructionCache - Before the JIT can run a block of code that has been emitted it must invalidate the instruction cache on some platforms.
Definition at line 35 of file Memory.cpp.
References sys_icache_invalidate().
Referenced by llvm::PPCJITInfo::emitFunctionStub(), and llvm::ARMJITInfo::emitFunctionStub().
| static bool llvm::sys::Memory::setExecutable | ( | MemoryBlock & | M, | |
| std::string * | ErrMsg = 0 | |||
| ) | [static] |
setExecutable - Before the JIT can run a block of code, it has to be given read and executable privilege. Return true if it is already r-x or the system is able to change its previlege.
| static bool llvm::sys::Memory::setWritable | ( | MemoryBlock & | M, | |
| std::string * | ErrMsg = 0 | |||
| ) | [static] |
| static bool llvm::sys::Memory::setRangeExecutable | ( | const void * | Addr, | |
| size_t | Size | |||
| ) | [static] |
setRangeExecutable - Mark the page containing a range of addresses as executable.
Referenced by ARMCompilationCallbackC().
| static bool llvm::sys::Memory::setRangeWritable | ( | const void * | Addr, | |
| size_t | Size | |||
| ) | [static] |
setRangeWritable - Mark the page containing a range of addresses as writable.
Referenced by ARMCompilationCallbackC().