1 Index: include/llvm/Function.h 2 =================================================================== 3 --- include/llvm/Function.h (revision 3710) 4 +++ include/llvm/Function.h (working copy) 5 @@ -93,6 +93,8 @@ 6 // The Calling Convention is stored in Value::SubclassData. 7 /*CallingConv::ID CallingConvention;*/ 8 9 + unsigned intrinsicID; ///< ID of intrinsic, 0 otherwise 10 + 11 friend class SymbolTableListTraits<Function, Module>; 12 13 void setParent(Module *parent); 14 @@ -109,6 +111,8 @@ 15 BuildLazyArguments(); 16 } 17 void BuildLazyArguments() const; 18 + 19 + unsigned initIntrinsicID() const; 20 21 Function(const Function&); // DO NOT IMPLEMENT 22 void operator=(const Function&); // DO NOT IMPLEMENT 23 @@ -146,8 +150,8 @@ 24 /// The particular intrinsic functions which correspond to this value are 25 /// defined in llvm/Intrinsics.h. 26 /// 27 - unsigned getIntrinsicID() const LLVM_ATTRIBUTE_READONLY; 28 - bool isIntrinsic() const { return getIntrinsicID() != 0; } 29 + unsigned getIntrinsicID() const { return intrinsicID; } 30 + bool isIntrinsic() const { return intrinsicID != 0; } 31 32 /// getCallingConv()/setCallingConv(CC) - These method get and set the 33 /// calling convention of this function. The enum values for the known 34 Index: lib/VMCore/Function.cpp 35 =================================================================== 36 --- lib/VMCore/Function.cpp (revision 3710) 37 +++ lib/VMCore/Function.cpp (working copy) 38 @@ -178,9 +178,9 @@ 39 ParentModule->getFunctionList().push_back(this); 40 41 // Ensure intrinsics have the right parameter attributes. 42 - if (unsigned IID = getIntrinsicID()) 43 - setAttributes(Intrinsic::getAttributes(Intrinsic::ID(IID))); 44 - 45 + intrinsicID = initIntrinsicID(); 46 + if (intrinsicID) 47 + setAttributes(Intrinsic::getAttributes(Intrinsic::ID(intrinsicID))); 48 } 49 50 Function::~Function() { 51 @@ -310,14 +310,14 @@ 52 clearGC(); 53 } 54 55 -/// getIntrinsicID - This method returns the ID number of the specified 56 +/// initIntrinsicID - This method returns the ID number of the specified 57 /// function, or Intrinsic::not_intrinsic if the function is not an 58 /// intrinsic, or if the pointer is null. This value is always defined to be 59 /// zero to allow easy checking for whether a function is intrinsic or not. The 60 /// particular intrinsic functions which correspond to this value are defined in 61 /// llvm/Intrinsics.h. 62 /// 63 -unsigned Function::getIntrinsicID() const { 64 +unsigned Function::initIntrinsicID() const { 65 const ValueName *ValName = this->getValueName(); 66 if (!ValName) 67 return 0; 68