Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
Function.h
Go to the documentation of this file.
1//===- Function.h -----------------------------------------------*- 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
9#ifndef LLVM_SANDBOXIR_FUNCTION_H
10#define LLVM_SANDBOXIR_FUNCTION_H
11
12#include "llvm/IR/Function.h"
13#include "llvm/SandboxIR/Constant.h"
14
15namespacellvm::sandboxir {
16
17classFunction :publicGlobalWithNodeAPI<Function, llvm::Function,
18 GlobalObject, llvm::GlobalObject> {
19 /// Helper for mapped_iterator.
20structLLVMBBToBB {
21Context &Ctx;
22 LLVMBBToBB(Context &Ctx) : Ctx(Ctx) {}
23BasicBlock &operator()(llvm::BasicBlock &LLVMBB) const{
24return *cast<BasicBlock>(Ctx.getValue(&LLVMBB));
25 }
26 };
27 /// Use Context::createFunction() instead.
28Function(llvm::Function *F,sandboxir::Context &Ctx)
29 :GlobalWithNodeAPI(ClassID::Function,F,Ctx) {}
30friendclassContext;// For constructor.
31
32public:
33 /// For isa/dyn_cast.
34staticboolclassof(constsandboxir::Value *From) {
35returnFrom->getSubclassID() == ClassID::Function;
36 }
37
38Module *getParent() {
39returnCtx.getModule(cast<llvm::Function>(Val)->getParent());
40 }
41
42Argument *getArg(unsignedIdx) const{
43llvm::Argument *Arg = cast<llvm::Function>(Val)->getArg(Idx);
44return cast<Argument>(Ctx.getValue(Arg));
45 }
46
47size_targ_size() const{return cast<llvm::Function>(Val)->arg_size(); }
48boolarg_empty() const{return cast<llvm::Function>(Val)->arg_empty(); }
49
50usingiterator =mapped_iterator<llvm::Function::iterator, LLVMBBToBB>;
51iteratorbegin() const{
52 LLVMBBToBB BBGetter(Ctx);
53returniterator(cast<llvm::Function>(Val)->begin(), BBGetter);
54 }
55iteratorend() const{
56 LLVMBBToBB BBGetter(Ctx);
57returniterator(cast<llvm::Function>(Val)->end(), BBGetter);
58 }
59FunctionType *getFunctionType()const;
60
61#ifndef NDEBUG
62voidverify()const final {
63assert(isa<llvm::Function>(Val) &&"Expected Function!");
64 }
65voiddumpNameAndArgs(raw_ostream &OS)const;
66voiddumpOS(raw_ostream &OS)constfinal;
67#endif
68};
69
70}// namespace llvm::sandboxir
71
72#endif// LLVM_SANDBOXIR_FUNCTION_H
const
aarch64 promote const
Definition:AArch64PromoteConstant.cpp:230
From
BlockVerifier::State From
Definition:BlockVerifier.cpp:57
Idx
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Definition:DeadArgumentElimination.cpp:353
Function.h
F
#define F(x, y, z)
Definition:MD5.cpp:55
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OS
raw_pwrite_stream & OS
Definition:SampleProfWriter.cpp:51
Constant.h
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition:Argument.h:31
llvm::BasicBlock
LLVM Basic Block Representation.
Definition:BasicBlock.h:61
llvm::Function
Definition:Function.h:63
llvm::mapped_iterator
Definition:STLExtras.h:353
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:raw_ostream.h:52
llvm::sandboxir::Argument
Argument of a sandboxir::Function.
Definition:Argument.h:18
llvm::sandboxir::BasicBlock
Contains a list of sandboxir::Instruction's.
Definition:BasicBlock.h:67
llvm::sandboxir::Context
Definition:Context.h:30
llvm::sandboxir::Context::getValue
sandboxir::Value * getValue(llvm::Value *V) const
Definition:Context.cpp:601
llvm::sandboxir::Context::getModule
Module * getModule(llvm::Module *LLVMM) const
Definition:Context.cpp:614
llvm::sandboxir::FunctionType
Definition:Type.h:450
llvm::sandboxir::Function
Definition:Function.h:18
llvm::sandboxir::Function::getArg
Argument * getArg(unsigned Idx) const
Definition:Function.h:42
llvm::sandboxir::Function::getParent
Module * getParent()
Definition:Function.h:38
llvm::sandboxir::Function::getFunctionType
FunctionType * getFunctionType() const
Definition:Function.cpp:15
llvm::sandboxir::Function::begin
iterator begin() const
Definition:Function.h:51
llvm::sandboxir::Function::dumpOS
void dumpOS(raw_ostream &OS) const final
Definition:Function.cpp:37
llvm::sandboxir::Function::dumpNameAndArgs
void dumpNameAndArgs(raw_ostream &OS) const
Definition:Function.cpp:21
llvm::sandboxir::Function::arg_size
size_t arg_size() const
Definition:Function.h:47
llvm::sandboxir::Function::arg_empty
bool arg_empty() const
Definition:Function.h:48
llvm::sandboxir::Function::verify
void verify() const final
Should crash if there is something wrong with the instruction.
Definition:Function.h:62
llvm::sandboxir::Function::classof
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
Definition:Function.h:34
llvm::sandboxir::Function::iterator
mapped_iterator< llvm::Function::iterator, LLVMBBToBB > iterator
Definition:Function.h:50
llvm::sandboxir::Function::end
iterator end() const
Definition:Function.h:55
llvm::sandboxir::GlobalWithNodeAPI
Provides API functions, like getIterator() and getReverseIterator() to GlobalIFunc,...
Definition:Constant.h:767
llvm::sandboxir::Module
In SandboxIR the Module is mainly used to access the list of global objects.
Definition:Module.h:31
llvm::sandboxir::Value
A SandboxIR Value has users. This is the base class.
Definition:Value.h:63
llvm::sandboxir::Value::Val
llvm::Value * Val
The LLVM Value that corresponds to this SandboxIR Value.
Definition:Value.h:103
llvm::sandboxir::Value::Ctx
Context & Ctx
All values point to the context.
Definition:Value.h:173
llvm::sandboxir
Definition:Argument.h:15

Generated on Thu Jul 17 2025 10:05:12 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp