LLVM  14.0.0git
DebugCrossExSubsection.cpp
Go to the documentation of this file.
1 //===- DebugCrossExSubsection.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 
12 #include "llvm/Support/Error.h"
13 #include <cstdint>
14 
15 using namespace llvm;
16 using namespace llvm::codeview;
17 
19  BinaryStreamReader Reader) {
20  if (Reader.bytesRemaining() % sizeof(CrossModuleExport) != 0)
21  return make_error<CodeViewError>(
23  "Cross Scope Exports section is an invalid size!");
24 
25  uint32_t Size = Reader.bytesRemaining() / sizeof(CrossModuleExport);
26  return Reader.readArray(References, Size);
27 }
28 
30  BinaryStreamReader Reader(Stream);
31  return initialize(Reader);
32 }
33 
35  uint32_t Global) {
36  Mappings[Local] = Global;
37 }
38 
40  return Mappings.size() * sizeof(CrossModuleExport);
41 }
42 
44  BinaryStreamWriter &Writer) const {
45  for (const auto &M : Mappings) {
46  if (auto EC = Writer.writeInteger(M.first))
47  return EC;
48  if (auto EC = Writer.writeInteger(M.second))
49  return EC;
50  }
51  return Error::success();
52 }
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::BinaryStreamWriter::writeInteger
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
Definition: BinaryStreamWriter.h:64
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::BinaryStreamWriter
Provides write only access to a subclass of WritableBinaryStream.
Definition: BinaryStreamWriter.h:31
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
Error.h
llvm::BinaryStreamReader::bytesRemaining
uint64_t bytesRemaining() const
Definition: BinaryStreamReader.h:257
DebugCrossExSubsection.h
llvm::codeview::DebugCrossModuleExportsSubsection::commit
Error commit(BinaryStreamWriter &Writer) const override
Definition: DebugCrossExSubsection.cpp:43
llvm::codeview::CrossModuleExport
Definition: CodeView.h:596
llvm::codeview::DebugCrossModuleExportsSubsection::addMapping
void addMapping(uint32_t Local, uint32_t Global)
Definition: DebugCrossExSubsection.cpp:34
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition: BinaryStreamReader.h:31
llvm::codeview::CompileSym2Flags::EC
@ EC
llvm::codeview::DebugCrossModuleExportsSubsection::calculateSerializedSize
uint32_t calculateSerializedSize() const override
Definition: DebugCrossExSubsection.cpp:39
uint32_t
llvm::codeview::DebugCrossModuleExportsSubsectionRef::initialize
Error initialize(BinaryStreamReader Reader)
Definition: DebugCrossExSubsection.cpp:18
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::codeview::cv_error_code::corrupt_record
@ corrupt_record
llvm::codeview
Definition: AppendingTypeTableBuilder.h:22
BinaryStreamWriter.h
CodeViewError.h
llvm::BinaryStreamReader::readArray
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
Definition: BinaryStreamReader.h:187
llvm::BinaryStreamRef
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Definition: BinaryStreamRef.h:156