diff options
author | Reid Kleckner <rnk@google.com> | 2017-03-16 16:57:31 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-03-16 16:57:31 +0000 |
commit | 1275a2dec8564ced4a4679bcb82fdaa241a87805 (patch) | |
tree | 6f1ea8290e5672b622cb15e60bc9a7490d941eda /llvm/lib | |
parent | c5b3351750c74b192d1fb31de291494fa8db97b2 (diff) | |
download | bcm5719-llvm-1275a2dec8564ced4a4679bcb82fdaa241a87805.tar.gz bcm5719-llvm-1275a2dec8564ced4a4679bcb82fdaa241a87805.zip |
[IR] Inline some Function accessors
I checked that all of these out-of-line methods previously compiled to
simple loads and bittests, so they are pretty good candidates for
inlining. In particular, arg_size() and arg_empty() are popular and are
just two loads, so they seem worth inlining.
llvm-svn: 297963
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 29 | ||||
-rw-r--r-- | llvm/lib/IR/Globals.cpp | 12 |
2 files changed, 0 insertions, 41 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 7b5d49c34b3..1318b5163be 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -185,32 +185,10 @@ bool Argument::hasAttribute(Attribute::AttrKind Kind) const { // Helper Methods in Function //===----------------------------------------------------------------------===// -bool Function::isMaterializable() const { - return getGlobalObjectSubClassData() & (1 << IsMaterializableBit); -} - -void Function::setIsMaterializable(bool V) { - unsigned Mask = 1 << IsMaterializableBit; - setGlobalObjectSubClassData((~Mask & getGlobalObjectSubClassData()) | - (V ? Mask : 0u)); -} - LLVMContext &Function::getContext() const { return getType()->getContext(); } -FunctionType *Function::getFunctionType() const { - return cast<FunctionType>(getValueType()); -} - -bool Function::isVarArg() const { - return getFunctionType()->isVarArg(); -} - -Type *Function::getReturnType() const { - return getFunctionType()->getReturnType(); -} - void Function::removeFromParent() { getParent()->getFunctionList().remove(getIterator()); } @@ -296,13 +274,6 @@ void Function::stealArgumentListFrom(Function &Src) { Src.setValueSubclassData(Src.getSubclassDataFromValue() | (1 << 0)); } -size_t Function::arg_size() const { - return getFunctionType()->getNumParams(); -} -bool Function::arg_empty() const { - return getFunctionType()->getNumParams() == 0; -} - // dropAllReferences() - This function causes all the subinstructions to "let // go" of all references that they are maintaining. This allows one to // 'delete' a whole class at a time, even though there may be circular diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 675c515b21f..54917e596b7 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -93,18 +93,6 @@ void GlobalObject::setAlignment(unsigned Align) { assert(getAlignment() == Align && "Alignment representation error!"); } -unsigned GlobalObject::getGlobalObjectSubClassData() const { - unsigned ValueData = getGlobalValueSubClassData(); - return ValueData >> GlobalObjectBits; -} - -void GlobalObject::setGlobalObjectSubClassData(unsigned Val) { - unsigned OldData = getGlobalValueSubClassData(); - setGlobalValueSubClassData((OldData & GlobalObjectMask) | - (Val << GlobalObjectBits)); - assert(getGlobalObjectSubClassData() == Val && "representation error"); -} - void GlobalObject::copyAttributesFrom(const GlobalValue *Src) { GlobalValue::copyAttributesFrom(Src); if (const auto *GV = dyn_cast<GlobalObject>(Src)) { |