[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp
Anand Shukla
ashukla at cs.uiuc.edu
Sat May 31 21:41:01 PDT 2003
Changes in directory llvm/lib/Transforms/Instrumentation:
EmitFunctions.cpp updated: 1.7 -> 1.8
---
Log message:
Added the #(internal functions) to output
---
Diffs of the changes:
Index: llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp
diff -u llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.7 llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.8
--- llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp:1.7 Thu May 22 17:00:05 2003
+++ llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp Sat May 31 21:40:49 2003
@@ -21,10 +21,12 @@
bool EmitFunctionTable::run(Module &M){
std::vector<const Type*> vType;
std::vector<Constant *> vConsts;
+ unsigned char counter = 0;
for(Module::iterator MI = M.begin(), ME = M.end(); MI != ME; ++MI)
if (!MI->isExternal()) {
vType.push_back(MI->getType());
vConsts.push_back(ConstantPointerRef::get(MI));
+ counter++;
}
StructType *sttype = StructType::get(vType);
@@ -34,5 +36,11 @@
GlobalValue::ExternalLinkage,
cstruct, "llvmFunctionTable");
M.getGlobalList().push_back(gb);
+
+ ConstantInt *cnst = ConstantInt::get(Type::IntTy, counter);
+ GlobalVariable *fnCount = new GlobalVariable(Type::IntTy, true,
+ GlobalValue::ExternalLinkage,
+ cnst, "llvmFunctionCount");
+ M.getGlobalList().push_back(fnCount);
return true; // Always modifies program
}
More information about the llvm-commits
mailing list