LLVM 20.0.0git
Module.cpp
Go to the documentation of this file.
1//===- Module.cpp ---------------------------------------------------------===//
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
14
15using namespace llvm::sandboxir;
16
18 llvm::Function *LLVMF = LLVMM.getFunction(Name);
19 return cast_or_null<Function>(Ctx.getValue(LLVMF));
20}
21
23 bool AllowInternal) const {
24 return cast_or_null<GlobalVariable>(
25 Ctx.getValue(LLVMM.getGlobalVariable(Name, AllowInternal)));
26}
27
29 return cast_or_null<GlobalAlias>(Ctx.getValue(LLVMM.getNamedAlias(Name)));
30}
31
33 return cast_or_null<GlobalIFunc>(Ctx.getValue(LLVMM.getNamedIFunc(Name)));
34}
35
36#ifndef NDEBUG
37void Module::dumpOS(raw_ostream &OS) const { OS << LLVMM; }
38
39void Module::dump() const {
40 dumpOS(dbgs());
41 dbgs() << "\n";
42}
43#endif // NDEBUG
std::string Name
raw_pwrite_stream & OS
const Function & getFunction() const
Definition: Function.h:171
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
Definition: Module.cpp:228
void dump() const
Dump the module to stderr (for debugging).
Definition: AsmWriter.cpp:5323
GlobalIFunc * getNamedIFunc(StringRef Name) const
Return the global ifunc in the module with the specified name, of arbitrary type.
Definition: Module.cpp:290
GlobalVariable * getGlobalVariable(StringRef Name) const
Look up the specified global variable in the module symbol table.
Definition: Module.h:447
GlobalAlias * getNamedAlias(StringRef Name) const
Return the global alias in the module with the specified name, of arbitrary type.
Definition: Module.cpp:286
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
void dumpOS(raw_ostream &OS) const
Definition: Module.cpp:37
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163