mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-16 23:38:40 +00:00
For PR411:
Don't try to be smart about fixing intrinsic functions when they're read in, just fix them after the module is read when all names are resolved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
67993f7b97
commit
9629efde7e
@ -1033,13 +1033,6 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds,
|
|||||||
|
|
||||||
BB->getInstList().push_back(Result);
|
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;
|
unsigned TypeSlot;
|
||||||
if (Result->getType() == InstTy)
|
if (Result->getType() == InstTy)
|
||||||
TypeSlot = iType;
|
TypeSlot = iType;
|
||||||
@ -2032,13 +2025,6 @@ void BytecodeReader::ParseModuleGlobalInfo() {
|
|||||||
Function *Func = new Function(FTy, GlobalValue::ExternalLinkage,
|
Function *Func = new Function(FTy, GlobalValue::ExternalLinkage,
|
||||||
"", TheModule);
|
"", 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);
|
insertValue(Func, (FnSignature & (~0U >> 1)) >> 5, ModuleValues);
|
||||||
|
|
||||||
// Flags are not used yet.
|
// Flags are not used yet.
|
||||||
@ -2402,6 +2388,11 @@ void BytecodeReader::ParseBytecode(BufPtr Buf, unsigned Length,
|
|||||||
// Parse the module contents
|
// Parse the module contents
|
||||||
this->ParseModule();
|
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
|
// Check for missing functions
|
||||||
if (hasFunctions())
|
if (hasFunctions())
|
||||||
error("Function expected, but bytecode stream ended!");
|
error("Function expected, but bytecode stream ended!");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user