Skip to content

Commit 319abbc

Browse files
Fix merge conflict issues
1 parent 70a75ef commit 319abbc

File tree

5 files changed

+72
-64
lines changed

5 files changed

+72
-64
lines changed

llvm/include/llvm/CASObjectFormats/FlatV1.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define LLVM_CASOBJECTFORMATS_FLATV1_H
1111

1212
#include "llvm/CAS/CASID.h"
13+
#include "llvm/CAS/CASReference.h"
1314
#include "llvm/CASObjectFormats/CASObjectReader.h"
1415
#include "llvm/CASObjectFormats/Data.h"
1516
#include "llvm/CASObjectFormats/ObjectFormatSchemaBase.h"
@@ -209,7 +210,7 @@ class BlockRef : public SpecificRef<BlockRef> {
209210

210211
static Expected<BlockRef> create(CompileUnitBuilder &CUB,
211212
const jitlink::Block &Block,
212-
cas::CASID *AbbrevID = nullptr);
213+
cas::ObjectRef *AbbrevRef = nullptr);
213214

214215
static Expected<BlockRef> get(Expected<ObjectFormatObjectProxy> Ref);
215216
static Expected<BlockRef> get(const ObjectFileSchema &Schema,
@@ -314,8 +315,8 @@ class CompileUnitBuilder {
314315

315316
Error createSection(const jitlink::Section &S);
316317
Error createBlock(const jitlink::Block &B);
317-
Expected<cas::CASID> createAbbrevBlock(const jitlink::Block &B);
318-
Error createInfoBlock(const jitlink::Block &B, cas::CASID *AbbrevID);
318+
Expected<cas::ObjectRef> createAbbrevBlock(const jitlink::Block &B);
319+
Error createInfoBlock(const jitlink::Block &B, cas::ObjectRef *AbbrevID);
319320
Error createSymbol(const jitlink::Symbol &S);
320321

321322
// Lookup functions. The result must exist in the cache already.

llvm/include/llvm/CASObjectFormats/NestedV1.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define LLVM_CASOBJECTFORMATS_NESTEDV1_H
1111

1212
#include "llvm/CAS/CASID.h"
13+
#include "llvm/CAS/CASReference.h"
1314
#include "llvm/CASObjectFormats/Data.h"
1415
#include "llvm/CASObjectFormats/ObjectFormatSchemaBase.h"
1516
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
@@ -520,7 +521,7 @@ class BlockRef : public SpecificRef<BlockRef> {
520521
create(const ObjectFileSchema &Schema, const jitlink::Block &Block,
521522
function_ref<Expected<Optional<TargetRef>>(const jitlink::Symbol &)>
522523
GetTargetRef,
523-
cas::CASID *AbbrevID = nullptr);
524+
cas::ObjectRef *AbbrevRef = nullptr);
524525

525526
static Expected<BlockRef> create(const ObjectFileSchema &Schema,
526527
SectionRef Section, BlockDataRef Data) {
@@ -557,11 +558,13 @@ class BlockRef : public SpecificRef<BlockRef> {
557558

558559
explicit BlockRef(SpecificRefT Ref) : SpecificRefT(Ref) {}
559560

560-
static Expected<BlockRef>
561-
createImpl(const ObjectFileSchema &Schema, SectionRef Section,
562-
BlockDataRef Data, ArrayRef<TargetInfo> TargetInfo,
563-
ArrayRef<TargetRef> Targets, ArrayRef<Fixup> Fixups,
564-
cas::CASID *AbbrevID = nullptr, bool IsDebugInfoBlock = false);
561+
static Expected<BlockRef> createImpl(const ObjectFileSchema &Schema,
562+
SectionRef Section, BlockDataRef Data,
563+
ArrayRef<TargetInfo> TargetInfo,
564+
ArrayRef<TargetRef> Targets,
565+
ArrayRef<Fixup> Fixups,
566+
cas::ObjectRef *AbbrevRef = nullptr,
567+
bool IsDebugInfoBlock = false);
565568
};
566569

567570
/// A symbol.

llvm/lib/CASObjectFormats/FlatV1.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "llvm/ADT/PostOrderIterator.h"
1212
#include "llvm/ADT/STLExtras.h"
1313
#include "llvm/CAS/CASDB.h"
14+
#include "llvm/CAS/CASReference.h"
1415
#include "llvm/CASObjectFormats/Data.h"
1516
#include "llvm/CASObjectFormats/Encoding.h"
1617
#include "llvm/CASObjectFormats/ObjectFormatHelpers.h"
@@ -322,17 +323,17 @@ static Error decodeFixup(const FlatV1ObjectReader &Reader, StringRef &Data,
322323

323324
Expected<BlockRef> BlockRef::create(CompileUnitBuilder &CUB,
324325
const jitlink::Block &Block,
325-
cas::CASID *AbbrevID) {
326+
cas::ObjectRef *AbbrevRef) {
326327
Expected<Builder> B = Builder::startNode(CUB.Schema, KindString);
327328
if (!B)
328329
return B.takeError();
329330

330331
// If we are creating a cas block out of a debug_info jitlink::Block, add the
331332
// debug_abbrev cas block CAS ID as a refrence
332333
if (Block.getSection().getName() == "__DWARF,__debug_info") {
333-
assert(AbbrevID &&
334-
"The CAS ID for the abbrev section shouldn't be nullptr");
335-
B->IDs.push_back(*AbbrevID);
334+
assert(AbbrevRef &&
335+
"The CAS Ref for the abbrev section shouldn't be nullptr");
336+
B->Refs.push_back(*AbbrevRef);
336337
}
337338

338339
// Encode Section.
@@ -710,19 +711,19 @@ Error CompileUnitBuilder::createBlock(const jitlink::Block &B) {
710711
return Error::success();
711712
}
712713

713-
Expected<cas::CASID>
714+
Expected<cas::ObjectRef>
714715
CompileUnitBuilder::createAbbrevBlock(const jitlink::Block &B) {
715716
// Store the current idx. It is created in order so just add in the end.
716717
BlockIndexStarts.push_back(Indexes.size());
717718
auto Block = BlockRef::create(*this, B);
718719
if (!Block)
719720
return Block.takeError();
720721
commitNode(*Block);
721-
return Block->getID();
722+
return Block->getRef();
722723
}
723724

724725
Error CompileUnitBuilder::createInfoBlock(const jitlink::Block &B,
725-
cas::CASID *AbbrevID) {
726+
cas::ObjectRef *AbbrevID) {
726727
// Store the current idx. It is created in order so just add in the end.
727728
BlockIndexStarts.push_back(Indexes.size());
728729
auto Block = BlockRef::create(*this, B, AbbrevID);
@@ -866,17 +867,17 @@ Expected<CompileUnitRef> CompileUnitRef::create(const ObjectFileSchema &Schema,
866867
}
867868

868869
// Create BlockRefs for Abbrevs and Compile Units
869-
SmallVector<cas::CASID, 16> AbbrevIDs;
870+
SmallVector<cas::ObjectRef, 16> AbbrevRefs;
870871
for (auto *B : AbbrevBlocks) {
871-
Expected<cas::CASID> ID = Builder.createAbbrevBlock(*B);
872-
if (!ID)
873-
return ID.takeError();
874-
AbbrevIDs.push_back(*ID);
872+
Expected<cas::ObjectRef> Ref = Builder.createAbbrevBlock(*B);
873+
if (!Ref)
874+
return Ref.takeError();
875+
AbbrevRefs.push_back(*Ref);
875876
}
876877
unsigned I = 0;
877878
for (auto *B : InfoBlocks) {
878879
if (auto E = Builder.createInfoBlock(
879-
*B, AbbrevIDs.size() == 1 ? &AbbrevIDs[0] : &AbbrevIDs[I]))
880+
*B, AbbrevRefs.size() == 1 ? &AbbrevRefs[0] : &AbbrevRefs[I]))
880881
return std::move(E);
881882
I++;
882883
}

llvm/lib/CASObjectFormats/NestedV1.cpp

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "llvm/ADT/PointerUnion.h"
1212
#include "llvm/ADT/PostOrderIterator.h"
1313
#include "llvm/ADT/StringSet.h"
14+
#include "llvm/CAS/CASReference.h"
1415
#include "llvm/CASObjectFormats/CASObjectReader.h"
1516
#include "llvm/CASObjectFormats/Encoding.h"
1617
#include "llvm/CASObjectFormats/ObjectFormatHelpers.h"
@@ -812,7 +813,7 @@ Expected<BlockRef> BlockRef::create(
812813
const ObjectFileSchema &Schema, const jitlink::Block &Block,
813814
function_ref<Expected<Optional<TargetRef>>(const jitlink::Symbol &)>
814815
GetTargetRef,
815-
cas::CASID *AbbrevID) {
816+
cas::ObjectRef *AbbrevRef) {
816817
Expected<SectionRef> Section = SectionRef::create(Schema, Block.getSection());
817818
if (!Section)
818819
return Section.takeError();
@@ -832,7 +833,7 @@ Expected<BlockRef> BlockRef::create(
832833
Expected<BlockDataRef> Data = BlockDataRef::create(Schema, Block, Fixups);
833834
if (!Data)
834835
return Data.takeError();
835-
return createImpl(Schema, *Section, *Data, TIs, Targets, Fixups, AbbrevID,
836+
return createImpl(Schema, *Section, *Data, TIs, Targets, Fixups, AbbrevRef,
836837
Block.getSection().getName() == "__DWARF,__debug_info");
837838
}
838839

@@ -845,7 +846,7 @@ Expected<BlockRef>
845846
BlockRef::createImpl(const ObjectFileSchema &Schema, SectionRef Section,
846847
BlockDataRef Data, ArrayRef<TargetInfo> TargetInfo,
847848
ArrayRef<TargetRef> Targets, ArrayRef<Fixup> Fixups,
848-
cas::CASID *AbbrevID, bool IsDebugInfoBlock) {
849+
cas::ObjectRef *AbbrevRef, bool IsDebugInfoBlock) {
849850
Expected<Builder> B = Builder::startNode(Schema, KindString);
850851
if (!B)
851852
return B.takeError();
@@ -904,9 +905,9 @@ BlockRef::createImpl(const ObjectFileSchema &Schema, SectionRef Section,
904905
}
905906

906907
if (IsDebugInfoBlock) {
907-
assert(AbbrevID &&
908-
"The CAS ID for the abbrev section shouldn't be nullptr");
909-
B->IDs.push_back(*AbbrevID);
908+
assert(AbbrevRef &&
909+
"The CAS Ref for the abbrev section shouldn't be nullptr");
910+
B->Refs.push_back(*AbbrevRef);
910911
}
911912

912913
return get(B->build(), IsDebugInfoBlock);
@@ -1448,7 +1449,7 @@ class CompileUnitBuilder {
14481449

14491450
/// Create the given symbol and cache it.
14501451
Expected<SymbolRef> createSymbol(const jitlink::Symbol &S,
1451-
cas::CASID *AbbrevID = nullptr);
1452+
cas::ObjectRef *AbbrevRef = nullptr);
14521453

14531454
/// Cache the symbol. Asserts that the result is not already cached.
14541455
void cacheSymbol(const jitlink::Symbol &S, SymbolRef Ref);
@@ -1467,12 +1468,12 @@ class CompileUnitBuilder {
14671468

14681469
/// Get or create a block.
14691470
Expected<BlockRef> getOrCreateBlock(const jitlink::Block &B,
1470-
cas::CASID *AbbrevID = nullptr);
1471+
cas::ObjectRef *AbbrevRef = nullptr);
14711472

14721473
/// Get or create a symbol definition.
14731474
Expected<SymbolDefinitionRef>
14741475
getOrCreateSymbolDefinition(const jitlink::Symbol &S,
1475-
cas::CASID *AbbrevID = nullptr);
1476+
cas::ObjectRef *AbbrevRef = nullptr);
14761477

14771478
private:
14781479
/// Guaranteed to be called in post-order. All undefined targets must be
@@ -1564,18 +1565,18 @@ Error CompileUnitBuilder::makeSymbols(const jitlink::LinkGraph &G) {
15641565
llvm::sort(AbbrevSymbols.begin(), AbbrevSymbols.end(),
15651566
compareSymbolBlocksByAddress);
15661567

1567-
SmallVector<cas::CASID, 16> AbbrevIDs;
1568+
SmallVector<cas::ObjectRef, 16> AbbrevRefs;
15681569
for (auto *S : AbbrevSymbols) {
15691570
Expected<SymbolRef> Symbol = createSymbol(*S);
15701571
if (!Symbol)
15711572
return Symbol.takeError();
1572-
AbbrevIDs.push_back(Symbol->getReferenceID(0));
1573+
AbbrevRefs.push_back(Symbol->getReference(0));
15731574
}
15741575

15751576
unsigned I = 0;
15761577
for (auto *S : InfoSymbols) {
1577-
Expected<SymbolRef> Symbol =
1578-
createSymbol(*S, AbbrevIDs.size() == 1 ? &AbbrevIDs[0] : &AbbrevIDs[I]);
1578+
Expected<SymbolRef> Symbol = createSymbol(
1579+
*S, AbbrevRefs.size() == 1 ? &AbbrevRefs[0] : &AbbrevRefs[I]);
15791580
if (!Symbol)
15801581
return Symbol.takeError();
15811582
I++;
@@ -1593,8 +1594,9 @@ cl::opt<bool> DropLeafSymbolNamesWithDot(
15931594
"drop-leaf-symbol-names-with-dot",
15941595
cl::desc("Drop symbol names with '.' in them from leafs."), cl::init(true));
15951596

1596-
Expected<SymbolRef> CompileUnitBuilder::createSymbol(const jitlink::Symbol &S,
1597-
cas::CASID *AbbrevID) {
1597+
Expected<SymbolRef>
1598+
CompileUnitBuilder::createSymbol(const jitlink::Symbol &S,
1599+
cas::ObjectRef *AbbrevRef) {
15981600
assert(!S.isExternal());
15991601
assert(!Symbols.lookup(&S).Symbol);
16001602

@@ -1605,7 +1607,7 @@ Expected<SymbolRef> CompileUnitBuilder::createSymbol(const jitlink::Symbol &S,
16051607
bool HasIndirectReference = bool(Name);
16061608

16071609
Expected<SymbolDefinitionRef> Definition =
1608-
getOrCreateSymbolDefinition(S, AbbrevID);
1610+
getOrCreateSymbolDefinition(S, AbbrevRef);
16091611
if (!Definition)
16101612
return Definition.takeError();
16111613

@@ -1685,22 +1687,23 @@ void CompileUnitBuilder::cacheSymbol(const jitlink::Symbol &S, SymbolRef Ref) {
16851687

16861688
Expected<SymbolDefinitionRef>
16871689
CompileUnitBuilder::getOrCreateSymbolDefinition(const jitlink::Symbol &S,
1688-
cas::CASID *AbbrevID) {
1690+
cas::ObjectRef *AbbrevRef) {
16891691
// If the assertion in S.getBlock() starts failing, probably LinkGraph added
16901692
// support for aliases to external symbols.
1691-
return SymbolDefinitionRef::get(getOrCreateBlock(S.getBlock(), AbbrevID));
1693+
return SymbolDefinitionRef::get(getOrCreateBlock(S.getBlock(), AbbrevRef));
16921694
}
16931695

1694-
Expected<BlockRef> CompileUnitBuilder::getOrCreateBlock(const jitlink::Block &B,
1695-
cas::CASID *AbbrevID) {
1696+
Expected<BlockRef>
1697+
CompileUnitBuilder::getOrCreateBlock(const jitlink::Block &B,
1698+
cas::ObjectRef *AbbrevRef) {
16961699
auto Cached = Blocks.find(&B);
16971700
if (Cached != Blocks.end())
16981701
return Cached->second;
16991702

17001703
Expected<BlockRef> ExpectedBlock = BlockRef::create(
17011704
Schema, B,
17021705
[&](const jitlink::Symbol &S) { return getOrCreateTarget(S, B); },
1703-
AbbrevID);
1706+
AbbrevRef);
17041707
if (!ExpectedBlock)
17051708
return ExpectedBlock.takeError();
17061709
Cached = Blocks.insert(std::make_pair(&B, *ExpectedBlock)).first;
@@ -2058,7 +2061,7 @@ DefinedSymbolNodeRef::materialize(const NestedV1ObjectReader &Reader) const {
20582061
bool MergeByContent = Flags.Merge & SymbolRef::M_ByContent;
20592062

20602063
Expected<SectionRef> Section =
2061-
SectionRef::get(Definition->getSchema(), Definition->getReferenceID(0));
2064+
SectionRef::get(Definition->getSchema(), Definition->getReference(0));
20622065
if (!Section)
20632066
return Section.takeError();
20642067
Expected<NameRef> SectionName = Section->getName();

0 commit comments

Comments
 (0)