| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 Value *Condition = getClearConverted(Switch->getCondition(), Switch, State); | 544 Value *Condition = getClearConverted(Switch->getCondition(), Switch, State); |
| 545 SwitchInst *NewInst = SwitchInst::Create( | 545 SwitchInst *NewInst = SwitchInst::Create( |
| 546 Condition, | 546 Condition, |
| 547 Switch->getDefaultDest(), | 547 Switch->getDefaultDest(), |
| 548 Switch->getNumCases(), | 548 Switch->getNumCases(), |
| 549 Switch); | 549 Switch); |
| 550 CopyDebug(NewInst, Switch); | 550 CopyDebug(NewInst, Switch); |
| 551 for (SwitchInst::CaseIt I = Switch->case_begin(), | 551 for (SwitchInst::CaseIt I = Switch->case_begin(), |
| 552 E = Switch->case_end(); | 552 E = Switch->case_end(); |
| 553 I != E; ++I) { | 553 I != E; ++I) { |
| 554 // This sanity check should never trigger because no-one | |
| 555 // generates case ranges. It will go away when we merge | |
| 556 // upstream's r190328, which removes all case range support. | |
| 557 if (!I.getCaseValueEx().isSingleNumber()) | |
| 558 report_fatal_error("Case ranges are not supported in PNaCl"); | |
| 559 | |
| 560 NewInst->addCase(cast<ConstantInt>(convertConstant(I.getCaseValue())), | 554 NewInst->addCase(cast<ConstantInt>(convertConstant(I.getCaseValue())), |
| 561 I.getCaseSuccessor()); | 555 I.getCaseSuccessor()); |
| 562 } | 556 } |
| 563 Switch->eraseFromParent(); | 557 Switch->eraseFromParent(); |
| 564 } else { | 558 } else { |
| 565 errs() << *Inst<<"\n"; | 559 errs() << *Inst<<"\n"; |
| 566 llvm_unreachable("unhandled instruction"); | 560 llvm_unreachable("unhandled instruction"); |
| 567 } | 561 } |
| 568 } | 562 } |
| 569 | 563 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 596 } | 590 } |
| 597 } | 591 } |
| 598 } | 592 } |
| 599 State.eraseReplacedInstructions(); | 593 State.eraseReplacedInstructions(); |
| 600 return Modified; | 594 return Modified; |
| 601 } | 595 } |
| 602 | 596 |
| 603 FunctionPass *llvm::createPromoteIntegersPass() { | 597 FunctionPass *llvm::createPromoteIntegersPass() { |
| 604 return new PromoteIntegers(); | 598 return new PromoteIntegers(); |
| 605 } | 599 } |
| OLD | NEW |