Implement address space attribute for LLVM pointer types. Address spaces are 
regions of memory that have a target specific relationship, as described in the 
Embedded C Technical Report. 

This also implements the 2007-12-11-AddressSpaces test, 
which demonstrates how address space attributes can be used in LLVM IR.

In addition, this patch changes the bitcode signature for stores (in a backwards 
compatible manner), such that the pointer type, rather than the pointee type, is 
encoded. This permits type information in the pointer (e.g. address space) to be 
preserved for stores.

LangRef updates are forthcoming.

llvm-svn: 44858
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 0df0466..5207ea5 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -937,7 +937,8 @@
 
 GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
                                      const std::string &Name, Instruction *InBe)
-  : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx))),
+  : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)),
+                      cast<PointerType>(Ptr->getType())->getAddressSpace()),
                 GetElementPtr, 0, 0, InBe) {
   init(Ptr, Idx);
   setName(Name);
@@ -945,7 +946,8 @@
 
 GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
                                      const std::string &Name, BasicBlock *IAE)
-  : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx))),
+  : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)),
+                      cast<PointerType>(Ptr->getType())->getAddressSpace()),
                 GetElementPtr, 0, 0, IAE) {
   init(Ptr, Idx);
   setName(Name);