mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-02 15:26:29 +00:00
[WebAssembly] Inline translateVA as it's trivial.
The problem I want to address now is that chunks have too many data members for "offsets", and their origins are not well defined. For example, InputSegment has OutputSegmentOffset, but it's base class also has OutputOffset. That's very confusing. Differential Revision: https://reviews.llvm.org/D43726 llvm-svn: 326291
This commit is contained in:
parent
6588f14a6c
commit
b911f12211
@ -27,12 +27,6 @@ std::string lld::toString(const InputChunk *C) {
|
||||
return (toString(C->File) + ":(" + C->getName() + ")").str();
|
||||
}
|
||||
|
||||
uint32_t InputSegment::translateVA(uint32_t Offset) const {
|
||||
assert(Offset <= getSize());
|
||||
DEBUG(dbgs() << "translateVA: " << getName() << " Offset=" << Offset << "\n");
|
||||
return OutputSeg->StartVA + OutputSegmentOffset + Offset;
|
||||
}
|
||||
|
||||
void InputChunk::copyRelocations(const WasmSection &Section) {
|
||||
if (Section.Relocations.empty())
|
||||
return;
|
||||
|
@ -96,10 +96,6 @@ public:
|
||||
|
||||
static bool classof(const InputChunk *C) { return C->kind() == DataSegment; }
|
||||
|
||||
// Translate an offset in the input segment to an offset in the output
|
||||
// segment.
|
||||
uint32_t translateVA(uint32_t Offset) const;
|
||||
|
||||
uint32_t getAlignment() const { return Segment.Data.Alignment; }
|
||||
StringRef getName() const override { return Segment.Data.Name; }
|
||||
StringRef getComdat() const override { return Segment.Data.Comdat; }
|
||||
|
@ -157,7 +157,9 @@ DefinedFunction::DefinedFunction(StringRef Name, uint32_t Flags, InputFile *F,
|
||||
|
||||
uint32_t DefinedData::getVirtualAddress() const {
|
||||
DEBUG(dbgs() << "getVirtualAddress: " << getName() << "\n");
|
||||
return Segment ? Segment->translateVA(Offset) : Offset;
|
||||
if (Segment)
|
||||
return Segment->OutputSeg->StartVA + Segment->OutputSegmentOffset + Offset;
|
||||
return Offset;
|
||||
}
|
||||
|
||||
void DefinedData::setVirtualAddress(uint32_t Value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user