LLVM 23.0.0git
FunctionInfo.cpp
Go to the documentation of this file.
1//===----- FunctionInfo.cpp - ABI Function Information ----------- C++ ----===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include <optional>
11
12using namespace llvm;
13using namespace llvm::abi;
14
15FunctionInfo *FunctionInfo::create(CallingConv::ID CC, const Type *ReturnType,
17 std::optional<unsigned> NumRequired) {
18
19 assert(!NumRequired || *NumRequired <= ArgTypes.size());
20
21 void *Buffer = operator new(totalSizeToAlloc<ArgEntry>(ArgTypes.size()));
22
23 FunctionInfo *FI =
24 new (Buffer) FunctionInfo(CC, ReturnType, ArgTypes.size(), NumRequired);
25
26 ArgEntry *Args = FI->getTrailingObjects();
27 for (unsigned I = 0; I < ArgTypes.size(); ++I)
28 new (&Args[I]) ArgEntry(ArgTypes[I]);
29
30 return FI;
31}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define I(x, y, z)
Definition MD5.cpp:57
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
size_t size() const
size - Get the array size.
Definition ArrayRef.h:142
static constexpr std::enable_if_t< std::is_same_v< Foo< TrailingTys... >, Foo< Tys... > >, size_t > totalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType< TrailingTys, size_t >::type... Counts)
static FunctionInfo * create(CallingConv::ID CC, const Type *ReturnType, ArrayRef< const Type * > ArgTypes, std::optional< unsigned > NumRequired=std::nullopt)
Represents the ABI-specific view of a type in LLVM.
Definition Types.h:45
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.