Lines Matching refs:Function
64 // This function returns true if F is fully read and is still a declaration.
65 static bool isNonGhostDeclaration(const Function *F) {
85 struct CallSiteValueMapConfig : public NoRAUWValueMapConfig<Function*> {
87 static void onDelete(JITResolverState *JRS, Function *F);
92 typedef ValueMap<Function*, void*, NoRAUWValueMapConfig<Function*> >
94 typedef std::map<void*, AssertingVH<Function> > CallSiteToFunctionMapTy;
95 typedef ValueMap<Function *, SmallPtrSet<void*, 1>,
100 /// particular function so that we can reuse them if necessary.
103 /// CallSiteToFunctionMap - Keep track of the function that each lazy call
131 std::pair<void *, Function *> LookupFunctionFromCallSite(
146 void AddCallSite(const MutexGuard &locked, void *CallSite, Function *F) {
156 void EraseAllCallSitesForPrelocked(Function *F);
158 // Erases _all_ call sites regardless of their function. This is used to
171 /// LazyResolverFn - The target lazy resolver function that we actually
201 /// getLazyFunctionStubIfAvailable - This returns a pointer to a function's
203 void *getLazyFunctionStubIfAvailable(Function *F);
205 /// getLazyFunctionStub - This returns a pointer to a function's
207 void *getLazyFunctionStub(Function *F);
209 /// getExternalFunctionStub - Return a stub for the function at the
218 /// an address. This function only manages slots, it does not manage the
222 /// JITCompilerFn - This function is called to resolve a stub to a compiled
223 /// address. If the LLVM Function corresponding to the stub has not yet
224 /// been compiled, this function compiles it first.
282 // When outputting a function stub in the context of some other function, we
286 // When reattempting to JIT a function after running out of space, we store
287 // the estimated size of the function we're trying to JIT here, so we can
289 // successfully emit the function, we reset this back to zero.
292 /// Relocations - These are the relocations that the function needs, as
301 /// ConstantPool - The constant pool for the current function.
313 /// JumpTable - The jump tables for the current function.
337 // CurFn - The llvm function being emitted. Only valid during
339 const Function *CurFn;
347 void *FunctionBody; // Beginning of the function's allocation.
348 void *Code; // The address the function's code actually starts at.
352 struct EmittedFunctionConfig : public ValueMapConfig<const Function*> {
354 static void onDelete(JITEmitter *, const Function*);
355 static void onRAUW(JITEmitter *, const Function*, const Function*);
357 ValueMap<const Function *, EmittedCode,
414 /// because a global may live longer than the current function.
442 /// given function. Increase the minimum allocation size so that we get
447 /// function body.
448 void deallocateMemForFunction(const Function *F);
477 void CallSiteValueMapConfig::onDelete(JITResolverState *JRS, Function *F) {
481 void JITResolverState::EraseAllCallSitesForPrelocked(Function *F) {
491 assert(Erased && "Missing call site->function mapping");
514 /// getLazyFunctionStubIfAvailable - This returns a pointer to a function stub
516 void *JITResolver::getLazyFunctionStubIfAvailable(Function *F) {
519 // If we already have a stub for this function, recycle it.
523 /// getFunctionStub - This returns a pointer to a function stub, creating
525 void *JITResolver::getLazyFunctionStub(Function *F) {
528 // If we already have a lazy stub for this function, recycle it.
532 // Call the lazy resolver function if we are JIT'ing lazily. Otherwise we
550 // external function, if it was resolved.
555 // If we are getting the stub for an external function, we really want the
557 // of the external function.
561 DEBUG(dbgs() << "JIT: Lazy stub emitted at [" << Stub << "] for function '"
569 // Finally, keep track of the stub-to-Function mapping so that the
570 // JITCompilerFn knows which function to compile!
573 // If we are JIT'ing non-lazily but need to call a function that does not
603 /// getExternalFunctionStub - Return a stub for the function at the
606 // If we already have a stub for this function, recycle it.
616 << "] for external function at '" << FnAddr << "'\n");
631 /// JITCompilerFn - This function is called when a lazy compilation stub has
632 /// been entered. It looks up which function this stub corresponds to, compiles
633 /// it if necessary, then returns the resultant function pointer.
638 Function* F = 0;
642 // Only lock for getting the Function. The call getPointerToFunction made
643 // in this function might trigger function materializing, which requires
649 std::pair<void*, Function*> I =
655 // If we have already code generated the function, just return the address.
664 " function '"
668 DEBUG(dbgs() << "JIT: Lazily resolving function '" << F->getName()
681 // lock above. As soon as the 1st function finishes compiling the function,
682 // the next one will be released, and needs to be able to find the function it
687 // What we will do is set the compiled function address to map to the
709 // If we have already compiled the function, return a pointer to its body.
710 Function *F = cast<Function>(V);
714 // Return the function stub if it's already created. We do this first so
715 // that we're returning the same address for the function as any previous
728 // If this is an external function pointer, we can force the JIT to
781 DEBUG(dbgs() << "JIT: Starting CodeGen of Function "
805 // About to start emitting the machine code for the function.
829 // other per-function data.
833 // FnEnd is the end of the function's machine code.
851 // If the target REALLY wants a stub for this function, emit it now.
913 // Now that we've succeeded in emitting the function, reset the
931 << "] Function: " << F.getFunction()->getName()
1027 /// function body. Also drop any references the function has to stubs.
1028 /// May be called while the Function is being destroyed inside ~Value().
1029 void JITEmitter::deallocateMemForFunction(const Function *F) {
1030 ValueMap<const Function *, EmittedCode, EmittedFunctionConfig>::iterator
1249 JITEmitter *Emitter, const Function *F) {
1253 JITEmitter *, const Function*, const Function*) {
1268 // getPointerToFunctionOrStub - If the specified function has been
1269 // code-gen'd, return a pointer to the function. If not, compile it, or use
1272 void *JIT::getPointerToFunctionOrStub(Function *F) {
1273 // If we have already code generated the function, just return the address.
1283 void JIT::updateFunctionStub(Function *F) {
1289 assert(Addr != Stub && "Function must have non-stub address to be updated.");
1299 /// freeMachineCodeForFunction - release machine code memory for given Function.
1301 void JIT::freeMachineCodeForFunction(Function *F) {
1306 // Free the actual memory for the function body and related stuff.