| OLD | NEW |
| 1 //===-- Instructions.cpp - Implement the LLVM instructions ----------------===// | 1 //===-- Instructions.cpp - Implement the LLVM instructions ----------------===// |
| 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 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file implements all of the non-inline methods for the LLVM instruction | 10 // This file implements all of the non-inline methods for the LLVM instruction |
| (...skipping 2832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 | 2843 |
| 2844 //===----------------------------------------------------------------------===// | 2844 //===----------------------------------------------------------------------===// |
| 2845 // CastInst SubClass Constructors | 2845 // CastInst SubClass Constructors |
| 2846 //===----------------------------------------------------------------------===// | 2846 //===----------------------------------------------------------------------===// |
| 2847 | 2847 |
| 2848 /// Check that the construction parameters for a CastInst are correct. This | 2848 /// Check that the construction parameters for a CastInst are correct. This |
| 2849 /// could be broken out into the separate constructors but it is useful to have | 2849 /// could be broken out into the separate constructors but it is useful to have |
| 2850 /// it in one place and to eliminate the redundant code for getting the sizes | 2850 /// it in one place and to eliminate the redundant code for getting the sizes |
| 2851 /// of the types involved. | 2851 /// of the types involved. |
| 2852 bool | 2852 bool |
| 2853 CastInst::castIsValid(Instruction::CastOps op, Value *S, Type *DstTy) { | 2853 // @LOCALMOD-BEGIN |
| 2854 | 2854 CastInst::castIsValid(Instruction::CastOps op, Type *SrcTy, Type *DstTy) { |
| 2855 // Check for type sanity on the arguments | 2855 // @LOCALMOD-END |
| 2856 Type *SrcTy = S->getType(); | |
| 2857 | |
| 2858 // If this is a cast to the same type then it's trivially true. | 2856 // If this is a cast to the same type then it's trivially true. |
| 2859 if (SrcTy == DstTy) | 2857 if (SrcTy == DstTy) |
| 2860 return true; | 2858 return true; |
| 2861 | 2859 |
| 2862 if (!SrcTy->isFirstClassType() || !DstTy->isFirstClassType() || | 2860 if (!SrcTy->isFirstClassType() || !DstTy->isFirstClassType() || |
| 2863 SrcTy->isAggregateType() || DstTy->isAggregateType()) | 2861 SrcTy->isAggregateType() || DstTy->isAggregateType()) |
| 2864 return false; | 2862 return false; |
| 2865 | 2863 |
| 2866 // Get the size of the types in bits, we'll need this later | 2864 // Get the size of the types in bits, we'll need this later |
| 2867 unsigned SrcBitSize = SrcTy->getScalarSizeInBits(); | 2865 unsigned SrcBitSize = SrcTy->getScalarSizeInBits(); |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3803 } | 3801 } |
| 3804 | 3802 |
| 3805 ResumeInst *ResumeInst::clone_impl() const { | 3803 ResumeInst *ResumeInst::clone_impl() const { |
| 3806 return new(1) ResumeInst(*this); | 3804 return new(1) ResumeInst(*this); |
| 3807 } | 3805 } |
| 3808 | 3806 |
| 3809 UnreachableInst *UnreachableInst::clone_impl() const { | 3807 UnreachableInst *UnreachableInst::clone_impl() const { |
| 3810 LLVMContext &Context = getContext(); | 3808 LLVMContext &Context = getContext(); |
| 3811 return new UnreachableInst(Context); | 3809 return new UnreachableInst(Context); |
| 3812 } | 3810 } |
| OLD | NEW |