mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
A SILArgument is a function argument if the argument's parent BB is the entry BB of the function containing the argument. This is an interesting distinction since function arguments have special aliasing properties with respect to indirect arguments which normal basic block arguments do not. Swift SVN r14012
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
//===--- SILArgument.h - SIL BasicBlock Argument Representation -*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_SIL_SILARGUMENT_H
|
|
#define SWIFT_SIL_SILARGUMENT_H
|
|
|
|
#include "swift/SIL/SILValue.h"
|
|
#include "swift/SIL/SILFunction.h"
|
|
|
|
namespace swift {
|
|
class SILBasicBlock;
|
|
class SILModule;
|
|
|
|
class SILArgument : public ValueBase {
|
|
void operator=(const SILArgument &) = delete;
|
|
void operator delete(void *Ptr, size_t) = delete;
|
|
|
|
SILBasicBlock *ParentBB;
|
|
const ValueDecl *Decl;
|
|
public:
|
|
explicit
|
|
SILArgument(SILType Ty, SILBasicBlock *ParentBB, const ValueDecl *D = nullptr);
|
|
|
|
/// getType() is ok since this is known to only have one type.
|
|
SILType getType(unsigned i = 0) const { return ValueBase::getType(i); }
|
|
|
|
SILBasicBlock *getParent() { return ParentBB; }
|
|
const SILBasicBlock *getParent() const { return ParentBB; }
|
|
|
|
SILFunction *getFunction();
|
|
const SILFunction *getFunction() const;
|
|
|
|
SILModule &getModule() const;
|
|
|
|
const ValueDecl *getDecl() const { return Decl; }
|
|
|
|
/// Returns true if this is a SILArgument of the entry BB of a function.
|
|
bool isFunctionArg() const {
|
|
return getParent() == &*getFunction()->begin();
|
|
}
|
|
|
|
static bool classof(const ValueBase *V) {
|
|
return V->getKind() == ValueKind::SILArgument;
|
|
}
|
|
};
|
|
|
|
} // end swift namespace
|
|
|
|
#endif
|
|
|