Skip to content

Commit

Permalink
ValueMaterializer: rename materializeDeclFor() to materialize()
Browse files Browse the repository at this point in the history
It may materialize a declaration, or a definition. The name could
be misleading. This is following a merge of materializeInitFor()
into materializeDeclFor().

Differential Revision: http://reviews.llvm.org/D20593

llvm-svn: 270759
  • Loading branch information
joker-eph committed May 25, 2016
1 parent 53a6672 commit cc8c107
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Expand Up @@ -46,7 +46,7 @@ class CompileOnDemandLayer {
class LambdaMaterializer final : public ValueMaterializer {
public:
LambdaMaterializer(MaterializerFtor M) : M(std::move(M)) {}
Value *materializeDeclFor(Value *V) final { return M(V); }
Value *materialize(Value *V) final { return M(V); }

private:
MaterializerFtor M;
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Transforms/Utils/ValueMapper.h
Expand Up @@ -49,7 +49,7 @@ class ValueMaterializer {
public:
/// This method can be implemented to generate a mapped Value on demand. For
/// example, if linking lazily. Returns null if the value is not materialized.
virtual Value *materializeDeclFor(Value *V) = 0;
virtual Value *materialize(Value *V) = 0;
};

/// These are flags that the value mapping APIs allow.
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Linker/IRMover.cpp
Expand Up @@ -349,15 +349,15 @@ class GlobalValueMaterializer final : public ValueMaterializer {

public:
GlobalValueMaterializer(IRLinker &TheIRLinker) : TheIRLinker(TheIRLinker) {}
Value *materializeDeclFor(Value *V) override;
Value *materialize(Value *V) override;
};

class LocalValueMaterializer final : public ValueMaterializer {
IRLinker &TheIRLinker;

public:
LocalValueMaterializer(IRLinker &TheIRLinker) : TheIRLinker(TheIRLinker) {}
Value *materializeDeclFor(Value *V) override;
Value *materialize(Value *V) override;
};

/// Type of the Metadata map in \a ValueToValueMapTy.
Expand Down Expand Up @@ -513,11 +513,11 @@ static void forceRenaming(GlobalValue *GV, StringRef Name) {
}
}

Value *GlobalValueMaterializer::materializeDeclFor(Value *SGV) {
Value *GlobalValueMaterializer::materialize(Value *SGV) {
return TheIRLinker.materialize(SGV, false);
}

Value *LocalValueMaterializer::materializeDeclFor(Value *SGV) {
Value *LocalValueMaterializer::materialize(Value *SGV) {
return TheIRLinker.materialize(SGV, true);
}

Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Transforms/Utils/ValueMapper.cpp
Expand Up @@ -361,9 +361,9 @@ Value *Mapper::mapValue(const Value *V) {

// If we have a materializer and it can materialize a value, use that.
if (auto *Materializer = getMaterializer()) {
if (Value *NewV =
Materializer->materializeDeclFor(const_cast<Value *>(V))) {
return getVM()[V] = NewV;
if (Value *NewV = Materializer->materialize(const_cast<Value *>(V))) {
getVM()[V] = NewV;
return NewV;
}
}

Expand Down

0 comments on commit cc8c107

Please sign in to comment.