| OLD | NEW |
| 1 //===- PromoteIntegers.cpp - Promote illegal integers for PNaCl ABI -------===// | 1 //===- PromoteIntegers.cpp - Promote illegal integers for PNaCl ABI -------===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 // A limited set of transformations to promote illegal-sized int types. | 8 // A limited set of transformations to promote illegal-sized int types. |
| 9 // | 9 // |
| 10 //===----------------------------------------------------------------------===// | 10 //===----------------------------------------------------------------------===// |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 } | 708 } |
| 709 } | 709 } |
| 710 } else { | 710 } else { |
| 711 NewArg.takeName(OldArg); | 711 NewArg.takeName(OldArg); |
| 712 OldArg->replaceAllUsesWith(&NewArg); | 712 OldArg->replaceAllUsesWith(&NewArg); |
| 713 } | 713 } |
| 714 } | 714 } |
| 715 | 715 |
| 716 auto Found = DISubprogramMap.find(OldFct); | 716 auto Found = DISubprogramMap.find(OldFct); |
| 717 if (Found != DISubprogramMap.end()) | 717 if (Found != DISubprogramMap.end()) |
| 718 Found->second.replaceFunction(NewFct); | 718 Found->second->replaceFunction(NewFct); |
| 719 | 719 |
| 720 return true; | 720 return true; |
| 721 } | 721 } |
| 722 | 722 |
| 723 bool PromoteIntegers::runOnModule(Module &M) { | 723 bool PromoteIntegers::runOnModule(Module &M) { |
| 724 DataLayout DL(&M); | 724 DataLayout DL(&M); |
| 725 LLVMContext &Ctx = M.getContext(); | 725 LLVMContext &Ctx = M.getContext(); |
| 726 bool Modified = false; | 726 bool Modified = false; |
| 727 auto DISubprogramMap = makeSubprogramMap(M); | 727 auto DISubprogramMap = makeSubprogramMap(M); |
| 728 | 728 |
| 729 // Change function signatures first. | 729 // Change function signatures first. |
| 730 for (auto I = M.begin(), E = M.end(); I != E;) { | 730 for (auto I = M.begin(), E = M.end(); I != E;) { |
| 731 Function *F = I++; | 731 Function *F = I++; |
| 732 bool Changed = ensureCompliantSignature(Ctx, F, M, DISubprogramMap); | 732 bool Changed = ensureCompliantSignature(Ctx, F, M, DISubprogramMap); |
| 733 if (Changed) | 733 if (Changed) |
| 734 F->eraseFromParent(); | 734 F->eraseFromParent(); |
| 735 Modified |= Changed; | 735 Modified |= Changed; |
| 736 } | 736 } |
| 737 | 737 |
| 738 for (auto &F : M.getFunctionList()) | 738 for (auto &F : M.getFunctionList()) |
| 739 Modified |= processFunction(F, DL); | 739 Modified |= processFunction(F, DL); |
| 740 | 740 |
| 741 return Modified; | 741 return Modified; |
| 742 } | 742 } |
| 743 | 743 |
| 744 ModulePass *llvm::createPromoteIntegersPass() { return new PromoteIntegers(); } | 744 ModulePass *llvm::createPromoteIntegersPass() { return new PromoteIntegers(); } |
| OLD | NEW |