mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
consolidate GlobalValue::isDeclaration into one
non-virtual function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135163 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
791feea100
commit
6c48244973
@ -139,12 +139,6 @@ public:
|
||||
/// arguments.
|
||||
bool isVarArg() const;
|
||||
|
||||
/// isDeclaration - Is the body of this function unknown? (The basic block
|
||||
/// list is empty if so.) This is true for function declarations, but not
|
||||
/// true for function definitions.
|
||||
///
|
||||
virtual bool isDeclaration() const { return BasicBlocks.empty(); }
|
||||
|
||||
/// getIntrinsicID - This method returns the ID number of the specified
|
||||
/// function, or Intrinsic::not_intrinsic if the function is not an
|
||||
/// instrinsic, or if the pointer is null. This value is always defined to be
|
||||
|
@ -47,11 +47,6 @@ public:
|
||||
/// Provide fast operand accessors
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
/// isDeclaration - Is this global variable lacking an initializer? If so,
|
||||
/// the global variable is defined in some other translation unit, and is thus
|
||||
/// only a declaration here.
|
||||
virtual bool isDeclaration() const;
|
||||
|
||||
/// removeFromParent - This method unlinks 'this' from the containing module,
|
||||
/// but does not delete it.
|
||||
///
|
||||
|
@ -266,8 +266,8 @@ public:
|
||||
virtual void destroyConstant();
|
||||
|
||||
/// isDeclaration - Return true if the primary definition of this global
|
||||
/// value is outside of the current translation unit...
|
||||
virtual bool isDeclaration() const = 0;
|
||||
/// value is outside of the current translation unit.
|
||||
bool isDeclaration() const;
|
||||
|
||||
/// removeFromParent - This method unlinks 'this' from the containing module,
|
||||
/// but does not delete it.
|
||||
|
@ -68,11 +68,6 @@ public:
|
||||
/// Provide fast operand accessors
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
/// isDeclaration - Is this global variable lacking an initializer? If so,
|
||||
/// the global variable is defined in some other translation unit, and is thus
|
||||
/// only a declaration here.
|
||||
virtual bool isDeclaration() const { return getNumOperands() == 0; }
|
||||
|
||||
/// hasInitializer - Unless a global variable isExternal(), it has an
|
||||
/// initializer. The initializer for the global variable/constant is held by
|
||||
/// Initializer if an initializer is specified.
|
||||
|
@ -61,6 +61,19 @@ void GlobalValue::setAlignment(unsigned Align) {
|
||||
Alignment = Log2_32(Align) + 1;
|
||||
assert(getAlignment() == Align && "Alignment representation error!");
|
||||
}
|
||||
|
||||
bool GlobalValue::isDeclaration() const {
|
||||
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(this))
|
||||
return GV->getNumOperands() == 0;
|
||||
|
||||
if (const Function *F = dyn_cast<Function>(this))
|
||||
return F->empty();
|
||||
|
||||
const GlobalAlias *GA = cast<GlobalAlias>(this);
|
||||
if (const GlobalValue *AV = GA->getAliasedGlobal())
|
||||
return AV->isDeclaration();
|
||||
return false;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// GlobalVariable Implementation
|
||||
@ -202,14 +215,6 @@ void GlobalAlias::eraseFromParent() {
|
||||
getParent()->getAliasList().erase(this);
|
||||
}
|
||||
|
||||
bool GlobalAlias::isDeclaration() const {
|
||||
const GlobalValue* AV = getAliasedGlobal();
|
||||
if (AV)
|
||||
return AV->isDeclaration();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void GlobalAlias::setAliasee(Constant *Aliasee) {
|
||||
assert((!Aliasee || Aliasee->getType() == getType()) &&
|
||||
"Alias and aliasee types should match!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user