diff options
author | Anand Shukla <ashukla@cs.uiuc.edu> | 2003-06-01 02:40:49 +0000 |
---|---|---|
committer | Anand Shukla <ashukla@cs.uiuc.edu> | 2003-06-01 02:40:49 +0000 |
commit | 619754fb180a39d5a1b76518938ec140a37d1c91 (patch) | |
tree | 2f3a5ce84fffb65f4c7784332b3eb898ada408a1 /lib/Transforms/Instrumentation/EmitFunctions.cpp | |
parent | e4a013377a2c6ea68b960f1f785c68f8f85f50f7 (diff) |
Added the #(internal functions) to output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6502 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/EmitFunctions.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/EmitFunctions.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp index c9b8748cca..ed3b63e81f 100644 --- a/lib/Transforms/Instrumentation/EmitFunctions.cpp +++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp @@ -21,10 +21,12 @@ namespace { 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 @@ bool EmitFunctionTable::run(Module &M){ 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 } |