Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 1 | //===- FunctionInlining.cpp - Code to perform function inlining -----------===// |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 2 | // |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 3 | // This file implements inlining of functions. |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 4 | // |
| 5 | // Specifically, this: |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 6 | // * Exports functionality to inline any function call |
| 7 | // * Inlines functions that consist of a single basic block |
| 8 | // * Is able to inline ANY function call |
| 9 | // . Has a smart heuristic for when to inline a function |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 10 | // |
| 11 | // Notice that: |
Chris Lattner | 59b6b8e | 2002-01-21 23:17:48 +0000 | [diff] [blame] | 12 | // * This pass opens up a lot of opportunities for constant propogation. It |
| 13 | // is a good idea to to run a constant propogation pass, then a DCE pass |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 14 | // sometime after running this pass. |
| 15 | // |
Chris Lattner | 0154505 | 2002-04-18 18:52:03 +0000 | [diff] [blame] | 16 | // FIXME: This pass should transform alloca instructions in the called function |
| 17 | // into malloc/free pairs! |
| 18 | // |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 19 | //===----------------------------------------------------------------------===// |
| 20 | |
Chris Lattner | 483e14e | 2002-04-27 07:27:19 +0000 | [diff] [blame] | 21 | #include "llvm/Transforms/FunctionInlining.h" |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 22 | #include "llvm/Module.h" |
Chris Lattner | bd0ef77 | 2002-02-26 21:46:54 +0000 | [diff] [blame] | 23 | #include "llvm/Pass.h" |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 24 | #include "llvm/iTerminators.h" |
Chris Lattner | 7061dc5 | 2001-12-03 18:02:31 +0000 | [diff] [blame] | 25 | #include "llvm/iPHINode.h" |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 26 | #include "llvm/iOther.h" |
Chris Lattner | 237e6d1 | 2002-04-08 22:03:00 +0000 | [diff] [blame] | 27 | #include "llvm/Type.h" |
Chris Lattner | 3dec1f2 | 2002-05-10 15:38:35 +0000 | [diff] [blame] | 28 | #include "Support/StatisticReporter.h" |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 29 | #include <algorithm> |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 30 | #include <iostream> |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 31 | |
| 32 | static Statistic<> NumInlined("inline\t\t- Number of functions inlined"); |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 33 | using std::cerr; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 34 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 35 | // RemapInstruction - Convert the instruction operands from referencing the |
| 36 | // current values into those specified by ValueMap. |
| 37 | // |
| 38 | static inline void RemapInstruction(Instruction *I, |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 39 | std::map<const Value *, Value*> &ValueMap) { |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 40 | |
Chris Lattner | c8b25d4 | 2001-07-07 08:36:50 +0000 | [diff] [blame] | 41 | for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) { |
| 42 | const Value *Op = I->getOperand(op); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 43 | Value *V = ValueMap[Op]; |
Chris Lattner | e9bb2df | 2001-12-03 22:26:30 +0000 | [diff] [blame] | 44 | if (!V && (isa<GlobalValue>(Op) || isa<Constant>(Op))) |
Chris Lattner | 4f68528 | 2001-10-31 02:27:26 +0000 | [diff] [blame] | 45 | continue; // Globals and constants don't get relocated |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 46 | |
| 47 | if (!V) { |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 48 | cerr << "Val = \n" << Op << "Addr = " << (void*)Op; |
| 49 | cerr << "\nInst = " << I; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 50 | } |
| 51 | assert(V && "Referenced value not in value map!"); |
| 52 | I->setOperand(op, V); |
| 53 | } |
| 54 | } |
| 55 | |
Chris Lattner | f57b845 | 2002-04-27 06:56:12 +0000 | [diff] [blame] | 56 | // InlineFunction - This function forcibly inlines the called function into the |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 57 | // basic block of the caller. This returns false if it is not possible to |
| 58 | // inline this call. The program is still in a well defined state if this |
| 59 | // occurs though. |
| 60 | // |
| 61 | // Note that this only does one level of inlining. For example, if the |
| 62 | // instruction 'call B' is inlined, and 'B' calls 'C', then the call to 'C' now |
| 63 | // exists in the instruction stream. Similiarly this will inline a recursive |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 64 | // function by one level. |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 65 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 66 | bool InlineFunction(CallInst *CI) { |
| 67 | assert(isa<CallInst>(CI) && "InlineFunction only works on CallInst nodes"); |
| 68 | assert(CI->getParent() && "Instruction not embedded in basic block!"); |
| 69 | assert(CI->getParent()->getParent() && "Instruction not in function!"); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 70 | |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 71 | const Function *CalledFunc = CI->getCalledFunction(); |
| 72 | if (CalledFunc == 0 || // Can't inline external function or indirect call! |
| 73 | CalledFunc->isExternal()) return false; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 74 | |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 75 | //cerr << "Inlining " << CalledFunc->getName() << " into " |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 76 | // << CurrentMeth->getName() << "\n"; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 77 | |
| 78 | BasicBlock *OrigBB = CI->getParent(); |
| 79 | |
| 80 | // Call splitBasicBlock - The original basic block now ends at the instruction |
| 81 | // immediately before the call. The original basic block now ends with an |
| 82 | // unconditional branch to NewBB, and NewBB starts with the call instruction. |
| 83 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 84 | BasicBlock *NewBB = OrigBB->splitBasicBlock(CI); |
Chris Lattner | 41b66b1 | 2002-02-25 00:31:02 +0000 | [diff] [blame] | 85 | NewBB->setName("InlinedFunctionReturnNode"); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 86 | |
| 87 | // Remove (unlink) the CallInst from the start of the new basic block. |
| 88 | NewBB->getInstList().remove(CI); |
| 89 | |
| 90 | // If we have a return value generated by this call, convert it into a PHI |
| 91 | // node that gets values from each of the old RET instructions in the original |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 92 | // function. |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 93 | // |
| 94 | PHINode *PHI = 0; |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 95 | if (CalledFunc->getReturnType() != Type::VoidTy) { |
| 96 | PHI = new PHINode(CalledFunc->getReturnType(), CI->getName()); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 97 | |
| 98 | // The PHI node should go at the front of the new basic block to merge all |
| 99 | // possible incoming values. |
| 100 | // |
| 101 | NewBB->getInstList().push_front(PHI); |
| 102 | |
| 103 | // Anything that used the result of the function call should now use the PHI |
| 104 | // node as their operand. |
| 105 | // |
| 106 | CI->replaceAllUsesWith(PHI); |
| 107 | } |
| 108 | |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 109 | // Keep a mapping between the original function's values and the new |
| 110 | // duplicated code's values. This includes all of: Function arguments, |
| 111 | // instruction values, constant pool entries, and basic blocks. |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 112 | // |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 113 | std::map<const Value *, Value*> ValueMap; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 114 | |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 115 | // Add the function arguments to the mapping: (start counting at 1 to skip the |
| 116 | // function reference itself) |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 117 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 118 | Function::const_aiterator PTI = CalledFunc->abegin(); |
Chris Lattner | c8b25d4 | 2001-07-07 08:36:50 +0000 | [diff] [blame] | 119 | for (unsigned a = 1, E = CI->getNumOperands(); a != E; ++a, ++PTI) |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 120 | ValueMap[PTI] = CI->getOperand(a); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 121 | |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 122 | ValueMap[NewBB] = NewBB; // Returns get converted to reference NewBB |
| 123 | |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 124 | // Loop over all of the basic blocks in the function, inlining them as |
| 125 | // appropriate. Keep track of the first basic block of the function... |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 126 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 127 | for (Function::const_iterator BB = CalledFunc->begin(); |
| 128 | BB != CalledFunc->end(); ++BB) { |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 129 | assert(BB->getTerminator() && "BasicBlock doesn't have terminator!?!?"); |
| 130 | |
| 131 | // Create a new basic block to copy instructions into! |
| 132 | BasicBlock *IBB = new BasicBlock("", NewBB->getParent()); |
Chris Lattner | 41b66b1 | 2002-02-25 00:31:02 +0000 | [diff] [blame] | 133 | if (BB->hasName()) IBB->setName(BB->getName()+".i"); // .i = inlined once |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 134 | |
Chris Lattner | 5fdc4c9 | 2001-10-14 23:29:30 +0000 | [diff] [blame] | 135 | ValueMap[BB] = IBB; // Add basic block mapping. |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 136 | |
| 137 | // Make sure to capture the mapping that a return will use... |
| 138 | // TODO: This assumes that the RET is returning a value computed in the same |
| 139 | // basic block as the return was issued from! |
| 140 | // |
| 141 | const TerminatorInst *TI = BB->getTerminator(); |
| 142 | |
| 143 | // Loop over all instructions copying them over... |
| 144 | Instruction *NewInst; |
Chris Lattner | 7fc9fe3 | 2001-06-27 23:41:11 +0000 | [diff] [blame] | 145 | for (BasicBlock::const_iterator II = BB->begin(); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 146 | II != --BB->end(); ++II) { |
| 147 | IBB->getInstList().push_back((NewInst = II->clone())); |
| 148 | ValueMap[II] = NewInst; // Add instruction map to value. |
| 149 | if (II->hasName()) |
| 150 | NewInst->setName(II->getName()+".i"); // .i = inlined once |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | // Copy over the terminator now... |
Chris Lattner | a41f50d | 2001-07-07 19:24:15 +0000 | [diff] [blame] | 154 | switch (TI->getOpcode()) { |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 155 | case Instruction::Ret: { |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 156 | const ReturnInst *RI = cast<ReturnInst>(TI); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 157 | |
| 158 | if (PHI) { // The PHI node should include this value! |
| 159 | assert(RI->getReturnValue() && "Ret should have value!"); |
| 160 | assert(RI->getReturnValue()->getType() == PHI->getType() && |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 161 | "Ret value not consistent in function!"); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 162 | PHI->addIncoming((Value*)RI->getReturnValue(), |
| 163 | (BasicBlock*)cast<BasicBlock>(&*BB)); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | // Add a branch to the code that was after the original Call. |
| 167 | IBB->getInstList().push_back(new BranchInst(NewBB)); |
| 168 | break; |
| 169 | } |
| 170 | case Instruction::Br: |
| 171 | IBB->getInstList().push_back(TI->clone()); |
| 172 | break; |
| 173 | |
| 174 | default: |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 175 | cerr << "FunctionInlining: Don't know how to handle terminator: " << TI; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 176 | abort(); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 181 | // Loop over all of the instructions in the function, fixing up operand |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 182 | // references as we go. This uses ValueMap to do all the hard work. |
| 183 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 184 | for (Function::const_iterator BB = CalledFunc->begin(); |
| 185 | BB != CalledFunc->end(); ++BB) { |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 186 | BasicBlock *NBB = (BasicBlock*)ValueMap[BB]; |
| 187 | |
| 188 | // Loop over all instructions, fixing each one as we find it... |
| 189 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 190 | for (BasicBlock::iterator II = NBB->begin(); II != NBB->end(); ++II) |
| 191 | RemapInstruction(II, ValueMap); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | if (PHI) RemapInstruction(PHI, ValueMap); // Fix the PHI node also... |
| 195 | |
| 196 | // Change the branch that used to go to NewBB to branch to the first basic |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 197 | // block of the inlined function. |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 198 | // |
| 199 | TerminatorInst *Br = OrigBB->getTerminator(); |
Chris Lattner | a41f50d | 2001-07-07 19:24:15 +0000 | [diff] [blame] | 200 | assert(Br && Br->getOpcode() == Instruction::Br && |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 201 | "splitBasicBlock broken!"); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 202 | Br->setOperand(0, ValueMap[&CalledFunc->front()]); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 203 | |
| 204 | // Since we are now done with the CallInst, we can finally delete it. |
| 205 | delete CI; |
| 206 | return true; |
| 207 | } |
| 208 | |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 209 | static inline bool ShouldInlineFunction(const CallInst *CI, const Function *F) { |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 210 | assert(CI->getParent() && CI->getParent()->getParent() && |
Chris Lattner | f57b845 | 2002-04-27 06:56:12 +0000 | [diff] [blame] | 211 | "Call not embedded into a function!"); |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 212 | |
| 213 | // Don't inline a recursive call. |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 214 | if (CI->getParent()->getParent() == F) return false; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 215 | |
| 216 | // Don't inline something too big. This is a really crappy heuristic |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 217 | if (F->size() > 3) return false; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 218 | |
| 219 | // Don't inline into something too big. This is a **really** crappy heuristic |
Chris Lattner | 7fc9fe3 | 2001-06-27 23:41:11 +0000 | [diff] [blame] | 220 | if (CI->getParent()->getParent()->size() > 10) return false; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 221 | |
| 222 | // Go ahead and try just about anything else. |
| 223 | return true; |
| 224 | } |
| 225 | |
| 226 | |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 227 | static inline bool DoFunctionInlining(BasicBlock *BB) { |
Chris Lattner | 7fc9fe3 | 2001-06-27 23:41:11 +0000 | [diff] [blame] | 228 | for (BasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) { |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 229 | if (CallInst *CI = dyn_cast<CallInst>(&*I)) { |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 230 | // Check to see if we should inline this function |
| 231 | Function *F = CI->getCalledFunction(); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 232 | if (F && ShouldInlineFunction(CI, F)) { |
| 233 | return InlineFunction(CI); |
| 234 | } |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 235 | } |
| 236 | } |
| 237 | return false; |
| 238 | } |
| 239 | |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 240 | // doFunctionInlining - Use a heuristic based approach to inline functions that |
Chris Lattner | bd0ef77 | 2002-02-26 21:46:54 +0000 | [diff] [blame] | 241 | // seem to look good. |
| 242 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 243 | static bool doFunctionInlining(Function &F) { |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 244 | bool Changed = false; |
| 245 | |
| 246 | // Loop through now and inline instructions a basic block at a time... |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 247 | for (Function::iterator I = F.begin(); I != F.end(); ) |
| 248 | if (DoFunctionInlining(I)) { |
Chris Lattner | 3dec1f2 | 2002-05-10 15:38:35 +0000 | [diff] [blame] | 249 | ++NumInlined; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 250 | Changed = true; |
Chris Lattner | 0095054 | 2001-06-06 20:29:01 +0000 | [diff] [blame] | 251 | } else { |
| 252 | ++I; |
| 253 | } |
| 254 | |
| 255 | return Changed; |
| 256 | } |
Chris Lattner | bd0ef77 | 2002-02-26 21:46:54 +0000 | [diff] [blame] | 257 | |
| 258 | namespace { |
Chris Lattner | f57b845 | 2002-04-27 06:56:12 +0000 | [diff] [blame] | 259 | struct FunctionInlining : public FunctionPass { |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 260 | virtual bool runOnFunction(Function &F) { |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 261 | return doFunctionInlining(F); |
Chris Lattner | bd0ef77 | 2002-02-26 21:46:54 +0000 | [diff] [blame] | 262 | } |
| 263 | }; |
Chris Lattner | a6275cc | 2002-07-26 21:12:46 +0000 | [diff] [blame^] | 264 | RegisterOpt<FunctionInlining> X("inline", "Function Integration/Inlining"); |
Chris Lattner | bd0ef77 | 2002-02-26 21:46:54 +0000 | [diff] [blame] | 265 | } |
| 266 | |
Chris Lattner | f57b845 | 2002-04-27 06:56:12 +0000 | [diff] [blame] | 267 | Pass *createFunctionInliningPass() { return new FunctionInlining(); } |