Make it clear in the LangRef that allocation instructions only operated on the generi...
authorChristopher Lamb <christopher.lamb@gmail.com>
Mon, 17 Dec 2007 01:00:21 +0000 (01:00 +0000)
committerChristopher Lamb <christopher.lamb@gmail.com>
Mon, 17 Dec 2007 01:00:21 +0000 (01:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45080 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LangRef.html
lib/VMCore/Verifier.cpp

index df6baa746326da86fc59c4d118d8fc87b21ca798..f9e0824260a3fec6158f200df1aced855e4532d3 100644 (file)
@@ -2671,7 +2671,8 @@ allocate, and free memory in LLVM.</p>
 <h5>Overview:</h5>
 
 <p>The '<tt>malloc</tt>' instruction allocates memory from the system
-heap and returns a pointer to it.</p>
+heap and returns a pointer to it. The object is always allocated in the generic 
+address space (address space zero).</p>
 
 <h5>Arguments:</h5>
 
@@ -2758,7 +2759,8 @@ after this instruction executes.</p>
 
 <p>The '<tt>alloca</tt>' instruction allocates memory on the stack frame of the
 currently executing function, to be automatically released when this function
-returns to its caller.</p>
+returns to its caller. The object is always allocated in the generic address 
+space (address space zero).</p>
 
 <h5>Arguments:</h5>
 
@@ -3972,6 +3974,10 @@ Front-ends for type-safe garbage collected languages should generate these
 intrinsics to make use of the LLVM garbage collectors.  For more details, see <a
 href="GarbageCollection.html">Accurate Garbage Collection with LLVM</a>.
 </p>
+
+<p>The garbage collection intrinsics only operate on objects in the generic 
+       address space (address space zero).</p>
+
 </div>
 
 <!-- _______________________________________________________________________ -->
index c3633ff97a11635c9fa916346c13d8ed5c6dda6f..fb8db1785daff8e4fedc64791e14924645a8f291 100644 (file)
@@ -254,6 +254,7 @@ namespace {  // Anonymous namespace for class
     void visitUserOp1(Instruction &I);
     void visitUserOp2(Instruction &I) { visitUserOp1(I); }
     void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI);
+    void visitAllocationInst(AllocationInst &AI);
 
     void VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F,
                                   unsigned Count, ...);
@@ -987,6 +988,13 @@ void Verifier::visitStoreInst(StoreInst &SI) {
   visitInstruction(SI);
 }
 
+void Verifier::visitAllocationInst(AllocationInst &AI) {
+  const PointerType *Ptr = AI.getType();
+  Assert(Ptr->getAddressSpace() == 0, 
+    "Allocation instruction pointer not in the generic address space!");
+  visitInstruction(AI);
+}
+
 
 /// verifyInstruction - Verify that an instruction is well formed.
 ///