diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-09-16 01:08:15 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-09-16 01:08:15 +0000 |
commit | 1e3037f0be430ef2339838bbdede11f45658bd82 (patch) | |
tree | 685847478f3c9e31c3e1fa7f63f5f605e5f43f80 /lib/Linker/LinkModules.cpp | |
parent | fabfb5d5880354983c89c6f475312dd359e5bb03 (diff) | |
download | external_llvm-1e3037f0be430ef2339838bbdede11f45658bd82.zip external_llvm-1e3037f0be430ef2339838bbdede11f45658bd82.tar.gz external_llvm-1e3037f0be430ef2339838bbdede11f45658bd82.tar.bz2 |
Implement function prefix data as an IR feature.
Previous discussion:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-July/063909.html
Differential Revision: http://llvm-reviews.chandlerc.com/D1191
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190773 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 4fffa55..c3bcbcf 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -1260,6 +1260,13 @@ bool ModuleLinker::run() { // Skip if not linking from source. if (DoNotLinkFromSource.count(SF)) continue; + Function *DF = cast<Function>(ValueMap[SF]); + if (SF->hasPrefixData()) { + // Link in the prefix data. + DF->setPrefixData(MapValue( + SF->getPrefixData(), ValueMap, RF_None, &TypeMap, &ValMaterializer)); + } + // Skip if no body (function is external) or materialize. if (SF->isDeclaration()) { if (!SF->isMaterializable()) @@ -1268,7 +1275,7 @@ bool ModuleLinker::run() { return true; } - linkFunctionBody(cast<Function>(ValueMap[SF]), SF); + linkFunctionBody(DF, SF); SF->Dematerialize(); } @@ -1296,6 +1303,14 @@ bool ModuleLinker::run() { continue; Function *DF = cast<Function>(ValueMap[SF]); + if (SF->hasPrefixData()) { + // Link in the prefix data. + DF->setPrefixData(MapValue(SF->getPrefixData(), + ValueMap, + RF_None, + &TypeMap, + &ValMaterializer)); + } // Materialize if necessary. if (SF->isDeclaration()) { |