Load & StoreInst no longer derive from MemAccessInst, so we don't have
authorChris Lattner <sabre@nondot.org>
Thu, 22 Aug 2002 22:48:55 +0000 (22:48 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 22 Aug 2002 22:48:55 +0000 (22:48 +0000)
to handle indexing anymore

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3484 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y
lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp

index 7edbfbcefaf6dca0d92c4f96676cf1c7452673e1..d40a8706d446ff982e2e8e249c7ab93ea9546b41 100644 (file)
@@ -1638,7 +1638,7 @@ MemoryInst : MALLOC Types {
     if (!isa<PointerType>($2->get()))
       ThrowException("Can't load from nonpointer type: " +
                     (*$2)->getDescription());
-    if (LoadInst::getIndexedType(*$2, *$4) == 0)
+    if (GetElementPtrInst::getIndexedType(*$2, *$4) == 0)
       ThrowException("Invalid indices for load instruction!");
 
     Value *Src = getVal(*$2, $3);
@@ -1661,7 +1661,7 @@ MemoryInst : MALLOC Types {
     if (!isa<PointerType>($4->get()))
       ThrowException("Can't store to a nonpointer type: " +
                      (*$4)->getDescription());
-    const Type *ElTy = StoreInst::getIndexedType(*$4, *$6);
+    const Type *ElTy = GetElementPtrInst::getIndexedType(*$4, *$6);
     if (ElTy == 0)
       ThrowException("Can't store into that field list!");
     if (ElTy != $2->getType())
index 910fde6a8bbe7d599994c73ee6b91b82d5f62c5d..eece0c9cedc506b3e1d5c7429ee27fda688f3995 100644 (file)
@@ -847,10 +847,8 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
     } else {  // Performing array indexing. Just skip the 0
       ++I;
     }
-  } else if (HasImplicitAddress) {
-    
   }
-    
+
   for (; I != E; ++I)
     if ((*I)->getType() == Type::UIntTy) {
       Out << "[";
@@ -862,11 +860,13 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
 }
 
 void CWriter::visitLoadInst(LoadInst &I) {
-  printIndexingExpression(I.getPointerOperand(), I.idx_begin(), I.idx_end());
+  Out << "*";
+  writeOperand(I.getOperand(0));
 }
 
 void CWriter::visitStoreInst(StoreInst &I) {
-  printIndexingExpression(I.getPointerOperand(), I.idx_begin(), I.idx_end());
+  Out << "*";
+  writeOperand(I.getPointerOperand());
   Out << " = ";
   writeOperand(I.getOperand(0));
 }
index 910fde6a8bbe7d599994c73ee6b91b82d5f62c5d..eece0c9cedc506b3e1d5c7429ee27fda688f3995 100644 (file)
@@ -847,10 +847,8 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
     } else {  // Performing array indexing. Just skip the 0
       ++I;
     }
-  } else if (HasImplicitAddress) {
-    
   }
-    
+
   for (; I != E; ++I)
     if ((*I)->getType() == Type::UIntTy) {
       Out << "[";
@@ -862,11 +860,13 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I,
 }
 
 void CWriter::visitLoadInst(LoadInst &I) {
-  printIndexingExpression(I.getPointerOperand(), I.idx_begin(), I.idx_end());
+  Out << "*";
+  writeOperand(I.getOperand(0));
 }
 
 void CWriter::visitStoreInst(StoreInst &I) {
-  printIndexingExpression(I.getPointerOperand(), I.idx_begin(), I.idx_end());
+  Out << "*";
+  writeOperand(I.getPointerOperand());
   Out << " = ";
   writeOperand(I.getOperand(0));
 }