LLVM  14.0.0git
TapiUniversal.cpp
Go to the documentation of this file.
1 //===- TapiUniversal.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 //
9 // This file defines the Text-based Dynamic Library Stub format.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Object/Error.h"
18 
19 using namespace llvm;
20 using namespace MachO;
21 using namespace object;
22 
23 TapiUniversal::TapiUniversal(MemoryBufferRef Source, Error &Err)
24  : Binary(ID_TapiUniversal, Source) {
26  ErrorAsOutParameter ErrAsOuParam(&Err);
27  if (!Result) {
28  Err = Result.takeError();
29  return;
30  }
31  ParsedFile = std::move(Result.get());
32 
33  auto FlattenObjectInfo = [this](const auto &File) {
34  StringRef Name = File->getInstallName();
35  for (const Architecture Arch : File->getArchitectures())
36  Libraries.emplace_back(Library({Name, Arch}));
37  };
38 
39  FlattenObjectInfo(ParsedFile);
40  // Get inlined documents from tapi file.
41  for (const std::shared_ptr<InterfaceFile> &File : ParsedFile->documents())
42  FlattenObjectInfo(File);
43 }
44 
46 
49  return std::unique_ptr<TapiFile>(new TapiFile(Parent->getMemoryBufferRef(),
50  *Parent->ParsedFile.get(),
51  Parent->Libraries[Index].Arch));
52 }
53 
56  Error Err = Error::success();
57  std::unique_ptr<TapiUniversal> Ret(new TapiUniversal(Source, Err));
58  if (Err)
59  return std::move(Err);
60  return std::move(Ret);
61 }
MemoryBuffer.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
StringRef.h
llvm::object::TapiUniversal::~TapiUniversal
~TapiUniversal() override
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
Library
Itanium Name Demangler Library
Definition: README.txt:2
TapiUniversal.h
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::MemoryBufferRef
Definition: MemoryBufferRef.h:22
Error.h
llvm::object::Binary::getMemoryBufferRef
MemoryBufferRef getMemoryBufferRef() const
Definition: Binary.cpp:44
llvm::object::TapiUniversal::ObjectForArch::getAsObjectFile
Expected< std::unique_ptr< TapiFile > > getAsObjectFile() const
Definition: TapiUniversal.cpp:48
llvm::object::TapiUniversal::TapiUniversal
TapiUniversal(MemoryBufferRef Source, Error &Err)
Definition: TapiUniversal.cpp:23
llvm::ErrorAsOutParameter
Helper for Errors used as out-parameters.
Definition: Error.h:1099
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
llvm::MachO::Architecture
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
Definition: Architecture.h:27
llvm::object::TapiUniversal::create
static Expected< std::unique_ptr< TapiUniversal > > create(MemoryBufferRef Source)
Definition: TapiUniversal.cpp:55
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:100
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::object::Binary
Definition: Binary.h:32
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
get
Should compile to something r4 addze r3 instead we get
Definition: README.txt:24
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::object::TapiFile
Definition: TapiFile.h:26
TextAPIReader.h
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:205