summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Function.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-09 17:41:24 +0000
committerChris Lattner <sabre@nondot.org>2011-07-09 17:41:24 +0000
commitb1ed91f3978377294d4620c53ca81beed08b73c7 (patch)
treeebfc9c1d6267fbb5a933299dac0af2159ba856c5 /llvm/lib/VMCore/Function.cpp
parent5707d224e1062aff8724dc3fbc97d845394468d7 (diff)
downloadbcm5719-llvm-b1ed91f3978377294d4620c53ca81beed08b73c7.tar.gz
bcm5719-llvm-b1ed91f3978377294d4620c53ca81beed08b73c7.zip
Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. llvm-svn: 134829
Diffstat (limited to 'llvm/lib/VMCore/Function.cpp')
-rw-r--r--llvm/lib/VMCore/Function.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index b8fa60a26d8..972319e7402 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/lib/VMCore/Function.cpp
@@ -134,7 +134,7 @@ LLVMContext &Function::getContext() const {
return getType()->getContext();
}
-const FunctionType *Function::getFunctionType() const {
+FunctionType *Function::getFunctionType() const {
return cast<FunctionType>(getType()->getElementType());
}
@@ -142,7 +142,7 @@ bool Function::isVarArg() const {
return getFunctionType()->isVarArg();
}
-const Type *Function::getReturnType() const {
+Type *Function::getReturnType() const {
return getFunctionType()->getReturnType();
}
@@ -163,7 +163,7 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
: GlobalValue(PointerType::getUnqual(Ty),
Value::FunctionVal, 0, 0, Linkage, name) {
assert(FunctionType::isValidReturnType(getReturnType()) &&
- !getReturnType()->isOpaqueTy() && "invalid return type");
+ "invalid return type");
SymTab = new ValueSymbolTable();
// If the function has arguments, mark them as lazily built.
OpenPOWER on IntegriCloud