llvm.org GIT mirror llvm / 552672d
improve documentation around memory lifetimes, patch by Jeffrey Yasskin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70083 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
1 changed file(s) with 17 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
185185 /// at the specified location. This is used internally as functions are JIT'd
186186 /// and as global variables are laid out in memory. It can and should also be
187187 /// used by clients of the EE that want to have an LLVM global overlay
188 /// existing data in memory.
188 /// existing data in memory. After adding a mapping for GV, you must not
189 /// destroy it until you've removed the mapping.
189190 void addGlobalMapping(const GlobalValue *GV, void *Addr);
190191
191192 /// clearAllGlobalMappings - Clear all global mappings and start over again
209210 void *getPointerToGlobalIfAvailable(const GlobalValue *GV);
210211
211212 /// getPointerToGlobal - This returns the address of the specified global
212 /// value. This may involve code generation if it's a function.
213 /// value. This may involve code generation if it's a function. After
214 /// getting a pointer to GV, it and all globals it transitively refers to have
215 /// been passed to addGlobalMapping. You must clear the mapping for each
216 /// referred-to global before destroying it. If a referred-to global RTG is a
217 /// function and this ExecutionEngine is a JIT compiler, calling
218 /// updateGlobalMapping(RTG, 0) will leak the function's machine code, so you
219 /// should call freeMachineCodeForFunction(RTG) instead. Note that
220 /// optimizations can move and delete non-external GlobalValues without
221 /// notifying the ExecutionEngine.
213222 ///
214223 void *getPointerToGlobal(const GlobalValue *GV);
215224
216225 /// getPointerToFunction - The different EE's represent function bodies in
217226 /// different ways. They should each implement this to say what a function
218 /// pointer should look like.
227 /// pointer should look like. See getPointerToGlobal for the requirements on
228 /// destroying F and any GlobalValues it refers to.
219229 ///
220230 virtual void *getPointerToFunction(Function *F) = 0;
221231
222232 /// getPointerToFunctionOrStub - If the specified function has been
223233 /// code-gen'd, return a pointer to the function. If not, compile it, or use
224 /// a stub to implement lazy compilation if available.
234 /// a stub to implement lazy compilation if available. See getPointerToGlobal
235 /// for the requirements on destroying F and any GlobalValues it refers to.
225236 ///
226237 virtual void *getPointerToFunctionOrStub(Function *F) {
227238 // Default implementation, just codegen the function.
254265
255266 /// getOrEmitGlobalVariable - Return the address of the specified global
256267 /// variable, possibly emitting it to memory if needed. This is used by the
257 /// Emitter.
268 /// Emitter. See getPointerToGlobal for the requirements on destroying GV and
269 /// any GlobalValues it refers to.
258270 virtual void *getOrEmitGlobalVariable(const GlobalVariable *GV) {
259271 return getPointerToGlobal((GlobalValue*)GV);
260272 }