| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 State.recordConverted(BCInst, NewInst); | 433 State.recordConverted(BCInst, NewInst); |
| 434 } | 434 } |
| 435 } else if (LoadInst *Load = dyn_cast<LoadInst>(Inst)) { | 435 } else if (LoadInst *Load = dyn_cast<LoadInst>(Inst)) { |
| 436 if (shouldConvert(Load)) { | 436 if (shouldConvert(Load)) { |
| 437 splitLoad(Load, State); | 437 splitLoad(Load, State); |
| 438 } | 438 } |
| 439 } else if (StoreInst *Store = dyn_cast<StoreInst>(Inst)) { | 439 } else if (StoreInst *Store = dyn_cast<StoreInst>(Inst)) { |
| 440 if (shouldConvert(Store->getValueOperand())) { | 440 if (shouldConvert(Store->getValueOperand())) { |
| 441 splitStore(Store, State); | 441 splitStore(Store, State); |
| 442 } | 442 } |
| 443 } else if (CallInst *Call = dyn_cast<CallInst>(Inst)) { | 443 } else if (isa<CallInst>(Inst)) { |
| 444 report_fatal_error("can't convert calls with illegal types"); | 444 report_fatal_error("can't convert calls with illegal types"); |
| 445 } else if (BinaryOperator *Binop = dyn_cast<BinaryOperator>(Inst)) { | 445 } else if (BinaryOperator *Binop = dyn_cast<BinaryOperator>(Inst)) { |
| 446 Value *NewInst = NULL; | 446 Value *NewInst = NULL; |
| 447 if (Binop->getOpcode() == Instruction::AShr) { | 447 if (Binop->getOpcode() == Instruction::AShr) { |
| 448 // The AShr operand needs to be sign-extended to the promoted size | 448 // The AShr operand needs to be sign-extended to the promoted size |
| 449 // before shifting. Because the sign-extension is implemented with | 449 // before shifting. Because the sign-extension is implemented with |
| 450 // with AShr, it can be combined with the original operation. | 450 // with AShr, it can be combined with the original operation. |
| 451 Value *Op = Binop->getOperand(0); | 451 Value *Op = Binop->getOperand(0); |
| 452 Value *ShiftAmount = NULL; | 452 Value *ShiftAmount = NULL; |
| 453 APInt SignShiftAmt = APInt( | 453 APInt SignShiftAmt = APInt( |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 604 |
| 605 if (ShouldConvert) { | 605 if (ShouldConvert) { |
| 606 convertInstruction(Inst, State); | 606 convertInstruction(Inst, State); |
| 607 Modified = true; | 607 Modified = true; |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 } | 610 } |
| 611 State.eraseReplacedInstructions(); | 611 State.eraseReplacedInstructions(); |
| 612 return Modified; | 612 return Modified; |
| 613 } | 613 } |
| OLD | NEW |