[llvm] r245742 - [opaque pointer types] Push the passing of value types up from Function/GlobalVariable to GlobalObject

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 14:35:28 PDT 2015


Author: dblaikie
Date: Fri Aug 21 16:35:28 2015
New Revision: 245742

URL: http://llvm.org/viewvc/llvm-project?rev=245742&view=rev
Log:
[opaque pointer types] Push the passing of value types up from Function/GlobalVariable to GlobalObject

(coming next, pushing this up into GlobalValue, so it can store the
value type directly)

Modified:
    llvm/trunk/include/llvm/IR/GlobalObject.h
    llvm/trunk/lib/IR/Function.cpp
    llvm/trunk/lib/IR/Globals.cpp

Modified: llvm/trunk/include/llvm/IR/GlobalObject.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/GlobalObject.h?rev=245742&r1=245741&r2=245742&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/GlobalObject.h (original)
+++ llvm/trunk/include/llvm/IR/GlobalObject.h Fri Aug 21 16:35:28 2015
@@ -28,8 +28,13 @@ class GlobalObject : public GlobalValue
 
 protected:
   GlobalObject(PointerType *Ty, ValueTy VTy, Use *Ops, unsigned NumOps,
-               LinkageTypes Linkage, const Twine &Name)
-      : GlobalValue(Ty, VTy, Ops, NumOps, Linkage, Name), ObjComdat(nullptr) {
+               LinkageTypes Linkage, const Twine &Name) = delete;
+  GlobalObject(Type *Ty, ValueTy VTy, Use *Ops, unsigned NumOps,
+               LinkageTypes Linkage, const Twine &Name,
+               unsigned AddressSpace = 0)
+      : GlobalValue(PointerType::get(Ty, AddressSpace), VTy, Ops, NumOps,
+                    Linkage, Name),
+        ObjComdat(nullptr) {
     setGlobalValueSubClassData(0);
   }
 

Modified: llvm/trunk/lib/IR/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Function.cpp?rev=245742&r1=245741&r2=245742&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Function.cpp (original)
+++ llvm/trunk/lib/IR/Function.cpp Fri Aug 21 16:35:28 2015
@@ -248,7 +248,7 @@ void Function::eraseFromParent() {
 
 Function::Function(FunctionType *Ty, LinkageTypes Linkage, const Twine &name,
                    Module *ParentModule)
-    : GlobalObject(PointerType::getUnqual(Ty), Value::FunctionVal,
+    : GlobalObject(Ty, Value::FunctionVal,
                    OperandTraits<Function>::op_begin(this), 0, Linkage, name),
       Ty(Ty) {
   assert(FunctionType::isValidReturnType(getReturnType()) &&

Modified: llvm/trunk/lib/IR/Globals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Globals.cpp?rev=245742&r1=245741&r2=245742&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Globals.cpp (original)
+++ llvm/trunk/lib/IR/Globals.cpp Fri Aug 21 16:35:28 2015
@@ -147,9 +147,9 @@ GlobalVariable::GlobalVariable(Type *Ty,
                                Constant *InitVal, const Twine &Name,
                                ThreadLocalMode TLMode, unsigned AddressSpace,
                                bool isExternallyInitialized)
-    : GlobalObject(PointerType::get(Ty, AddressSpace), Value::GlobalVariableVal,
+    : GlobalObject(Ty, Value::GlobalVariableVal,
                    OperandTraits<GlobalVariable>::op_begin(this),
-                   InitVal != nullptr, Link, Name),
+                   InitVal != nullptr, Link, Name, AddressSpace),
       isConstantGlobal(constant),
       isExternallyInitializedConstant(isExternallyInitialized) {
   setThreadLocalMode(TLMode);
@@ -165,9 +165,9 @@ GlobalVariable::GlobalVariable(Module &M
                                const Twine &Name, GlobalVariable *Before,
                                ThreadLocalMode TLMode, unsigned AddressSpace,
                                bool isExternallyInitialized)
-    : GlobalObject(PointerType::get(Ty, AddressSpace), Value::GlobalVariableVal,
+    : GlobalObject(Ty, Value::GlobalVariableVal,
                    OperandTraits<GlobalVariable>::op_begin(this),
-                   InitVal != nullptr, Link, Name),
+                   InitVal != nullptr, Link, Name, AddressSpace),
       isConstantGlobal(constant),
       isExternallyInitializedConstant(isExternallyInitialized) {
   setThreadLocalMode(TLMode);




More information about the llvm-commits mailing list