brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 61cc241 Raw
44 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 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"14 15using namespace llvm::sandboxir;16 17Function *Module::getFunction(StringRef Name) const {18  llvm::Function *LLVMF = LLVMM.getFunction(Name);19  return cast_or_null<Function>(Ctx.getValue(LLVMF));20}21 22GlobalVariable *Module::getGlobalVariable(StringRef Name,23                                          bool AllowInternal) const {24  return cast_or_null<GlobalVariable>(25      Ctx.getValue(LLVMM.getGlobalVariable(Name, AllowInternal)));26}27 28GlobalAlias *Module::getNamedAlias(StringRef Name) const {29  return cast_or_null<GlobalAlias>(Ctx.getValue(LLVMM.getNamedAlias(Name)));30}31 32GlobalIFunc *Module::getNamedIFunc(StringRef Name) const {33  return cast_or_null<GlobalIFunc>(Ctx.getValue(LLVMM.getNamedIFunc(Name)));34}35 36#ifndef NDEBUG37void Module::dumpOS(raw_ostream &OS) const { OS << LLVMM; }38 39void Module::dump() const {40  dumpOS(dbgs());41  dbgs() << "\n";42}43#endif // NDEBUG44