1 //===- Module.cpp ---------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/SandboxIR/Module.h"
10 #include "llvm/SandboxIR/Constant.h"
11 #include "llvm/SandboxIR/Context.h"
12 #include "llvm/SandboxIR/Function.h"
13 #include "llvm/SandboxIR/Value.h"
15 using namespace llvm::sandboxir
;
17 Function
*Module::getFunction(StringRef Name
) const {
18 llvm::Function
*LLVMF
= LLVMM
.getFunction(Name
);
19 return cast_or_null
<Function
>(Ctx
.getValue(LLVMF
));
22 GlobalVariable
*Module::getGlobalVariable(StringRef Name
,
23 bool AllowInternal
) const {
24 return cast_or_null
<GlobalVariable
>(
25 Ctx
.getValue(LLVMM
.getGlobalVariable(Name
, AllowInternal
)));
28 GlobalAlias
*Module::getNamedAlias(StringRef Name
) const {
29 return cast_or_null
<GlobalAlias
>(Ctx
.getValue(LLVMM
.getNamedAlias(Name
)));
32 GlobalIFunc
*Module::getNamedIFunc(StringRef Name
) const {
33 return cast_or_null
<GlobalIFunc
>(Ctx
.getValue(LLVMM
.getNamedIFunc(Name
)));
37 void Module::dumpOS(raw_ostream
&OS
) const { OS
<< LLVMM
; }
39 void Module::dump() const {