aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86
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
commite5a4c15da6770b77694155d6d2259ebb0f861d9a (patch)
treead96ab035bbddaf999c9bca2ae24a5abc54e96ea /lib/Target/X86
parent82c5a9990f4a156e24531faf1431079859e3cdb3 (diff)
downloadexternal_llvm-e5a4c15da6770b77694155d6d2259ebb0f861d9a.zip
external_llvm-e5a4c15da6770b77694155d6d2259ebb0f861d9a.tar.gz
external_llvm-e5a4c15da6770b77694155d6d2259ebb0f861d9a.tar.bz2
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
Diffstat (limited to 'lib/Target/X86')
-rw-r--r--lib/Target/X86/InstSelectSimple.cpp29
-rw-r--r--lib/Target/X86/X86ISelSimple.cpp29
2 files changed, 58 insertions, 0 deletions
diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp
index 775833c..18b595f 100644
--- a/lib/Target/X86/InstSelectSimple.cpp
+++ b/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();
diff --git a/lib/Target/X86/X86ISelSimple.cpp b/lib/Target/X86/X86ISelSimple.cpp
index 775833c..18b595f 100644
--- a/lib/Target/X86/X86ISelSimple.cpp
+++ b/lib/Target/X86/X86ISelSimple.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();