[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

John Criswell criswell at cs.uiuc.edu
Tue Apr 13 17:14:01 PDT 2004


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.236 -> 1.237

---
Log message:

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.



---
Diffs of the changes:  (+29 -0)

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.236 llvm/lib/Target/X86/InstSelectSimple.cpp:1.237
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.236	Tue Apr 13 16:56:09 2004
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Tue Apr 13 17:13:14 2004
@@ -1541,6 +1541,35 @@
           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();





More information about the llvm-commits mailing list