Path: blob/main/contrib/llvm-project/llvm/lib/SandboxIR/Module.cpp
213764 views
//===- Module.cpp ---------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/SandboxIR/Module.h"9#include "llvm/SandboxIR/Constant.h"10#include "llvm/SandboxIR/Context.h"11#include "llvm/SandboxIR/Function.h"12#include "llvm/SandboxIR/Value.h"1314using namespace llvm::sandboxir;1516Function *Module::getFunction(StringRef Name) const {17llvm::Function *LLVMF = LLVMM.getFunction(Name);18return cast_or_null<Function>(Ctx.getValue(LLVMF));19}2021GlobalVariable *Module::getGlobalVariable(StringRef Name,22bool AllowInternal) const {23return cast_or_null<GlobalVariable>(24Ctx.getValue(LLVMM.getGlobalVariable(Name, AllowInternal)));25}2627GlobalAlias *Module::getNamedAlias(StringRef Name) const {28return cast_or_null<GlobalAlias>(Ctx.getValue(LLVMM.getNamedAlias(Name)));29}3031GlobalIFunc *Module::getNamedIFunc(StringRef Name) const {32return cast_or_null<GlobalIFunc>(Ctx.getValue(LLVMM.getNamedIFunc(Name)));33}3435#ifndef NDEBUG36void Module::dumpOS(raw_ostream &OS) const { OS << LLVMM; }3738void Module::dump() const {39dumpOS(dbgs());40dbgs() << "\n";41}42#endif // NDEBUG434445