mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-11 00:39:36 +00:00
Added support for the llvm.readio and llvm.writeio intrinsics.
On x86, memory operations occur in-order, so these are just lowered into volatile loads and stores. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12936 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
82c5a9990f
commit
e5a4c15da6
@ -1541,6 +1541,35 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
|
||||
case Intrinsic::writeport:
|
||||
// We directly implement these intrinsics
|
||||
break;
|
||||
case Intrinsic::readio: {
|
||||
// On X86, memory operations are in-order. Lower this intrinsic
|
||||
// into a volatile load.
|
||||
Instruction *Before = CI->getPrev();
|
||||
LoadInst * LI = new LoadInst (CI->getOperand(1), "", true, CI);
|
||||
CI->replaceAllUsesWith (LI);
|
||||
BB->getInstList().erase (CI);
|
||||
if (Before) { // Move iterator to instruction after call
|
||||
I = Before; ++I;
|
||||
} else {
|
||||
I = BB->begin();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Intrinsic::writeio: {
|
||||
// On X86, memory operations are in-order. Lower this intrinsic
|
||||
// into a volatile store.
|
||||
Instruction *Before = CI->getPrev();
|
||||
StoreInst * LI = new StoreInst (CI->getOperand(1),
|
||||
CI->getOperand(2), true, CI);
|
||||
CI->replaceAllUsesWith (LI);
|
||||
BB->getInstList().erase (CI);
|
||||
if (Before) { // Move iterator to instruction after call
|
||||
I = Before; ++I;
|
||||
} else {
|
||||
I = BB->begin();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// All other intrinsic calls we must lower.
|
||||
Instruction *Before = CI->getPrev();
|
||||
|
@ -1541,6 +1541,35 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
|
||||
case Intrinsic::writeport:
|
||||
// We directly implement these intrinsics
|
||||
break;
|
||||
case Intrinsic::readio: {
|
||||
// On X86, memory operations are in-order. Lower this intrinsic
|
||||
// into a volatile load.
|
||||
Instruction *Before = CI->getPrev();
|
||||
LoadInst * LI = new LoadInst (CI->getOperand(1), "", true, CI);
|
||||
CI->replaceAllUsesWith (LI);
|
||||
BB->getInstList().erase (CI);
|
||||
if (Before) { // Move iterator to instruction after call
|
||||
I = Before; ++I;
|
||||
} else {
|
||||
I = BB->begin();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Intrinsic::writeio: {
|
||||
// On X86, memory operations are in-order. Lower this intrinsic
|
||||
// into a volatile store.
|
||||
Instruction *Before = CI->getPrev();
|
||||
StoreInst * LI = new StoreInst (CI->getOperand(1),
|
||||
CI->getOperand(2), true, CI);
|
||||
CI->replaceAllUsesWith (LI);
|
||||
BB->getInstList().erase (CI);
|
||||
if (Before) { // Move iterator to instruction after call
|
||||
I = Before; ++I;
|
||||
} else {
|
||||
I = BB->begin();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// All other intrinsic calls we must lower.
|
||||
Instruction *Before = CI->getPrev();
|
||||
|
Loading…
x
Reference in New Issue
Block a user