summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/InstSelectSimple.cpp
diff options
context:
space:
mode:
authorJohn Criswell <criswell@uiuc.edu>2004-04-13 22:13:14 +0000
committerJohn Criswell <criswell@uiuc.edu>2004-04-13 22:13:14 +0000
commitbeded72a0802194d791ba3cbdd26898240da4eb4 (patch)
tree09fd58500ae8c34dad6aac44268d98bf8c0c2718 /llvm/lib/Target/X86/InstSelectSimple.cpp
parent9042e381d85715789e1d49848ab6773b769d8f65 (diff)
downloadbcm5719-llvm-beded72a0802194d791ba3cbdd26898240da4eb4.tar.gz
bcm5719-llvm-beded72a0802194d791ba3cbdd26898240da4eb4.zip
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. llvm-svn: 12936
Diffstat (limited to 'llvm/lib/Target/X86/InstSelectSimple.cpp')
-rw-r--r--llvm/lib/Target/X86/InstSelectSimple.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/InstSelectSimple.cpp b/llvm/lib/Target/X86/InstSelectSimple.cpp
index 775833c3d02..18b595fad85 100644
--- a/llvm/lib/Target/X86/InstSelectSimple.cpp
+++ b/llvm/lib/Target/X86/InstSelectSimple.cpp
@@ -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();
OpenPOWER on IntegriCloud