Home | History | Annotate | Download | only in Utils

Lines Matching refs:Function

1 //===- CodeExtractor.cpp - Pull code region into a new function -----------===//
11 // individual loop or a parallel section, into a new function, replacing it with
12 // a call to the new function.
41 // Provide a command-line option to aggregate function arguments into a struct
51 // Landing pads must be in the function where they were inserted for cleanup.
60 if (const Function *F = CI->getCalledFunction())
148 /// function being code extracted, but not in the region being extracted.
149 /// These values must be passed in as live-ins to the function.
287 /// constructFunction - make a function based on inputs and outputs, as follows:
290 Function *CodeExtractor::constructFunction(const ValueSet &inputs,
295 Function *oldFunction,
300 // This function returns unsigned, outputs will go back by reference.
310 // Add the types of the input values to the function's argument list
318 // Add the types of the output values to the function's argument list.
328 DEBUG(dbgs() << "Function type: " << *RetTy << " f(");
343 // Create the new function
344 Function *newFunction = Function::Create(funcType,
348 // If the old function is no-throw, so is the new one.
355 Function::arg_iterator AI = newFunction->arg_begin();
390 // within the new function. This must be done before we lose track of which
422 emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer,
424 // Emit a call to the new function, passing in: *pointer to struct (if
457 // Allocate a struct at the beginning of this function
477 // Emit the call to the function
482 Function::arg_iterator OutputArgBegin = newFunction->arg_begin();
519 // function return an unsigned, switch on that number. This loop iterates
562 Function::arg_iterator OAI = OutputArgBegin;
633 // means that previously this was the last part of the function, and hence
636 // Check if the function should return a value
674 void CodeExtractor::moveCodeToFunction(Function *newFunction) {
675 Function *oldFunc = (*Blocks.begin())->getParent();
676 Function::BasicBlockListType &oldBlocks = oldFunc->getBasicBlockList();
677 Function::BasicBlockListType &newBlocks = newFunction->getBasicBlockList();
681 // Delete the basic block from the old function, and the list of blocks
684 // Insert this basic block into the new function
689 Function *CodeExtractor::extractCodeRegion() {
706 Function *oldFunction = header->getParent();
713 // The new function needs a root node because other nodes can branch to the
714 // head of the region, but the entry node of a function cannot have preds.
730 // Construct new function based on inputs/outputs & add allocas for all defs.
731 Function *newFunction = constructFunction(inputs, outputs, header,
771 //cerr << "NEW FUNCTION: " << *newFunction;
774 // cerr << "OLD FUNCTION: " << *oldFunction;