summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-01-23 08:11:03 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-01-23 08:11:03 +0000
commit455d1217eaafd2ee20fcb4c98137b15d8f94dd8b (patch)
treeaf9041ac1b3444485e52cedb1c40c46d4d87cf1a /llvm/lib/Bytecode/Reader
parent281dcd6ace26c8fa6aac06b9240b833cc0c1af32 (diff)
downloadbcm5719-llvm-455d1217eaafd2ee20fcb4c98137b15d8f94dd8b.tar.gz
bcm5719-llvm-455d1217eaafd2ee20fcb4c98137b15d8f94dd8b.zip
Revert last patch because it messes up the JIT, amongst other things.
llvm-svn: 25541
Diffstat (limited to 'llvm/lib/Bytecode/Reader')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index 397082752f1..6c91a4ad6a7 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/lib/Bytecode/Reader/Reader.cpp
@@ -1033,6 +1033,13 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds,
BB->getInstList().push_back(Result);
+ if (this->hasUpgradedIntrinsicFunctions && isCall)
+ if (Instruction* inst = UpgradeIntrinsicCall(cast<CallInst>(Result))) {
+ Result->replaceAllUsesWith(inst);
+ Result->eraseFromParent();
+ Result = inst;
+ }
+
unsigned TypeSlot;
if (Result->getType() == InstTy)
TypeSlot = iType;
@@ -2025,6 +2032,13 @@ void BytecodeReader::ParseModuleGlobalInfo() {
Function *Func = new Function(FTy, GlobalValue::ExternalLinkage,
"", TheModule);
+ // Replace with upgraded intrinsic function, if applicable.
+ if (Function* upgrdF = UpgradeIntrinsicFunction(Func)) {
+ hasUpgradedIntrinsicFunctions = true;
+ Func->eraseFromParent();
+ Func = upgrdF;
+ }
+
insertValue(Func, (FnSignature & (~0U >> 1)) >> 5, ModuleValues);
// Flags are not used yet.
@@ -2388,11 +2402,6 @@ void BytecodeReader::ParseBytecode(BufPtr Buf, unsigned Length,
// Parse the module contents
this->ParseModule();
- // Look for intrinsic functions and CallInst that need to be upgraded
- for (Module::iterator FI = TheModule->begin(), FE = TheModule->end();
- FI != FE; ++FI)
- UpgradeCallsToIntrinsic(FI);
-
// Check for missing functions
if (hasFunctions())
error("Function expected, but bytecode stream ended!");
OpenPOWER on IntegriCloud