diff options
| author | David Blaikie <dblaikie@gmail.com> | 2015-08-21 21:35:28 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2015-08-21 21:35:28 +0000 |
| commit | d583b19569183563aa5c4f8d15309edad09c8113 (patch) | |
| tree | 232d43940bc5a5604a4d13e7af19cb8fe84555cc | |
| parent | ff9639d6b700d8ff05994329b65e55a7842f44ba (diff) | |
| download | bcm5719-llvm-d583b19569183563aa5c4f8d15309edad09c8113.tar.gz bcm5719-llvm-d583b19569183563aa5c4f8d15309edad09c8113.zip | |
[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)
llvm-svn: 245742
| -rw-r--r-- | llvm/include/llvm/IR/GlobalObject.h | 9 | ||||
| -rw-r--r-- | llvm/lib/IR/Function.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/IR/Globals.cpp | 8 |
3 files changed, 12 insertions, 7 deletions
diff --git a/llvm/include/llvm/IR/GlobalObject.h b/llvm/include/llvm/IR/GlobalObject.h index f0552410b61..4b671da193d 100644 --- a/llvm/include/llvm/IR/GlobalObject.h +++ b/llvm/include/llvm/IR/GlobalObject.h @@ -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); } diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index b50ad1262c6..7d150bfe89f 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -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()) && diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 1d0282677bf..2cd1ea6b2d3 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -147,9 +147,9 @@ GlobalVariable::GlobalVariable(Type *Ty, bool constant, LinkageTypes Link, 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, Type *Ty, bool constant, 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); |

