summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2018-02-28 01:01:34 +0000
committerRui Ueyama <ruiu@google.com>2018-02-28 01:01:34 +0000
commitb911f1221126d7015e40919662da589658798ac1 (patch)
tree7bda5b71ccfa8d5376271a47a9853ecb546a604a
parent6588f14a6c9149e0c7d1957b0806f06931843e27 (diff)
downloadbcm5719-llvm-b911f1221126d7015e40919662da589658798ac1.tar.gz
bcm5719-llvm-b911f1221126d7015e40919662da589658798ac1.zip
[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
-rw-r--r--lld/wasm/InputChunks.cpp6
-rw-r--r--lld/wasm/InputChunks.h4
-rw-r--r--lld/wasm/Symbols.cpp4
3 files changed, 3 insertions, 11 deletions
diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp
index c67c1c7ca44..546fb516b4a 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -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;
diff --git a/lld/wasm/InputChunks.h b/lld/wasm/InputChunks.h
index 1a1eae0c38c..29a35069904 100644
--- a/lld/wasm/InputChunks.h
+++ b/lld/wasm/InputChunks.h
@@ -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; }
diff --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp
index 95f9fe81545..7f3775cc822 100644
--- a/lld/wasm/Symbols.cpp
+++ b/lld/wasm/Symbols.cpp
@@ -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) {
OpenPOWER on IntegriCloud