[llvm-commits] [llvm] r45080 - in /llvm/trunk: docs/LangRef.html lib/VMCore/Verifier.cpp

Christopher Lamb christopher.lamb at gmail.com
Sun Dec 16 17:00:22 PST 2007


Author: clamb
Date: Sun Dec 16 19:00:21 2007
New Revision: 45080

URL: http://llvm.org/viewvc/llvm-project?rev=45080&view=rev
Log:
Make it clear in the LangRef that allocation instructions only operated on the generic address space. Implement support in the verifier for ensuring this is true.

Modified:
    llvm/trunk/docs/LangRef.html
    llvm/trunk/lib/VMCore/Verifier.cpp

Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=45080&r1=45079&r2=45080&view=diff

==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Sun Dec 16 19:00:21 2007
@@ -2671,7 +2671,8 @@
 <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 @@
 
 <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 @@
 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>
 
 <!-- _______________________________________________________________________ -->

Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=45080&r1=45079&r2=45080&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Sun Dec 16 19:00:21 2007
@@ -254,6 +254,7 @@
     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 @@
   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.
 ///





More information about the llvm-commits mailing list