Lines Matching refs:Function
1 //===-- Function.cpp - Implement the Global object classes ----------------===//
10 // This file implements the Function class for the IR library.
14 #include "llvm/IR/Function.h"
36 template class llvm::SymbolTableListTraits<Argument, Function>;
37 template class llvm::SymbolTableListTraits<BasicBlock, Function>;
45 Argument::Argument(Type *Ty, const Twine &Name, Function *Par)
49 // Make sure that we get added to a function
57 void Argument::setParent(Function *parent) {
66 /// function. For example in "void foo(int a, float b)" a is 0 and b is 1.
68 const Function *F = getParent();
69 assert(F && "Argument is not in a function");
71 Function::const_arg_iterator AI = F->arg_begin();
80 /// in its containing function.
94 /// it in its containing function.
102 /// it in its containing function.
110 /// on it in its containing function.
118 /// it in its containing function.
148 // Helper Methods in Function
151 LLVMContext &Function::getContext() const {
155 FunctionType *Function::getFunctionType() const {
159 bool Function::isVarArg() const {
163 Type *Function::getReturnType() const {
167 void Function::removeFromParent() {
171 void Function::eraseFromParent() {
176 // Function Implementation
179 Function::Function(FunctionType *Ty, LinkageTypes Linkage,
187 // If the function has arguments, mark them as lazily built.
191 // Make sure that we get added to a function
203 Function::~Function() {
210 // Remove the function from the on-the-side GC table.
218 void Function::BuildLazyArguments() const {
229 const_cast<Function*>(this)->setValueSubclassData(SDC &= ~1);
232 size_t Function::arg_size() const {
235 bool Function::arg_empty() const {
239 void Function::setParent(Module *parent) {
247 // dropAllReferences() - This function causes all the subinstructions to "let
255 void Function::dropAllReferences() {
265 void Function::addAttribute(unsigned i, Attribute::AttrKind attr) {
271 void Function::addAttributes(unsigned i, AttributeSet attrs) {
277 void Function::removeAttributes(unsigned i, AttributeSet attrs) {
283 // Maintain the GC name for each function in an on-the-side table. This saves
284 // allocating an additional word in Function for programs which do not use GC
287 static DenseMap<const Function*,PooledStringPtr> *GCNames;
291 bool Function::hasGC() const {
296 const char *Function::getGC() const {
297 assert(hasGC() && "Function has no collector");
302 void Function::setGC(const char *Str) {
307 GCNames = new DenseMap<const Function*,PooledStringPtr>();
311 void Function::clearGC() {
327 /// create a Function) from the Function Src to this one.
328 void Function::copyAttributesFrom(const GlobalValue *Src) {
329 assert(isa<Function>(Src) && "Expected a Function!");
331 const Function *SrcF = cast<Function>(Src);
341 /// function, or Intrinsic::not_intrinsic if the function is not an
343 /// zero to allow easy checking for whether a function is intrinsic or not. The
348 unsigned Function::getIntrinsicID() const {
365 unsigned Function::lookupIntrinsicID() const {
401 /// getIntrinsicInfoTableEntries function.
650 Function *Intrinsic::getDeclaration(Module *M, ID id, ArrayRef<Type*> Tys) {
654 cast<Function>(M->getOrInsertFunction(getName(id, Tys),
663 /// hasAddressTaken - returns true if there are any uses of this function
665 bool Function::hasAddressTaken(const User* *PutOffender) const {
679 bool Function::isDefTriviallyDead() const {
685 // Check if the function is used by anything other than a blockaddress.
693 /// callsFunctionThatReturnsTwice - Return true if the function has a call to
694 /// setjmp or other function that gcc recognizes as "returning twice".
695 bool Function::callsFunctionThatReturnsTwice() const {