| OLD | NEW |
| 1 //===-- NaClValueEnumerator.cpp ------------------------------------------===// | 1 //===-- NaClValueEnumerator.cpp ------------------------------------------===// |
| 2 // Number values and types for bitcode writer | 2 // Number values and types for bitcode writer |
| 3 // | 3 // |
| 4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
| 5 // | 5 // |
| 6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
| 7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
| 8 // | 8 // |
| 9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
| 10 // | 10 // |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 VI != VE; ++VI) | 243 VI != VE; ++VI) |
| 244 EnumerateValue(VI->getValue()); | 244 EnumerateValue(VI->getValue()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void NaClValueEnumerator::EnumerateValue(const Value *VIn) { | 247 void NaClValueEnumerator::EnumerateValue(const Value *VIn) { |
| 248 // Skip over elided values. | 248 // Skip over elided values. |
| 249 const Value *V = ElideCasts(VIn); | 249 const Value *V = ElideCasts(VIn); |
| 250 if (V != VIn) return; | 250 if (V != VIn) return; |
| 251 | 251 |
| 252 assert(!V->getType()->isVoidTy() && "Can't insert void values!"); | 252 assert(!V->getType()->isVoidTy() && "Can't insert void values!"); |
| 253 assert(!isa<MDNode>(V) && !isa<MDString>(V) && | |
| 254 "EnumerateValue doesn't handle Metadata!"); | |
| 255 | 253 |
| 256 // Check to see if it's already in! | 254 // Check to see if it's already in! |
| 257 unsigned &ValueID = ValueMap[V]; | 255 unsigned &ValueID = ValueMap[V]; |
| 258 if (ValueID) { | 256 if (ValueID) { |
| 259 // Increment use count. | 257 // Increment use count. |
| 260 Values[ValueID-1].second++; | 258 Values[ValueID-1].second++; |
| 261 return; | 259 return; |
| 262 } | 260 } |
| 263 | 261 |
| 264 // Enumerate the type of this value. Skip global values since no | 262 // Enumerate the type of this value. Skip global values since no |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 break; | 494 break; |
| 497 case Instruction::PtrToInt: | 495 case Instruction::PtrToInt: |
| 498 if (IsIntPtrType(I->getType())) { | 496 if (IsIntPtrType(I->getType())) { |
| 499 V = I->getOperand(0); | 497 V = I->getOperand(0); |
| 500 } | 498 } |
| 501 break; | 499 break; |
| 502 } | 500 } |
| 503 } | 501 } |
| 504 return V; | 502 return V; |
| 505 } | 503 } |
| OLD | NEW |