Skip to content
This repository has been archived by the owner on Dec 19, 2020. It is now read-only.

Commit

Permalink
Simplified template method instantiation in HartConfig (many thanks f…
Browse files Browse the repository at this point in the history
…or Ameya Vikram Singh for providing this).
  • Loading branch information
Joseph Rahmeh committed Sep 21, 2019
1 parent 1923847 commit 34ac032
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
30 changes: 7 additions & 23 deletions HartConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,29 +1127,13 @@ HartConfig::finalizeCsrConfig(std::vector<Hart<URV>*>& harts) const
}


/// This is never called. It is here to force instantiation of templated
/// methods.
bool
HartConfig::apply(HartConfig& conf, Hart<uint32_t>& hart, bool verbose)
{
conf.applyMemoryConfig(hart, verbose);
// Instantiate tempate member functions

std::vector<Hart<uint32_t>*> vec;
conf.finalizeCsrConfig(vec);
template bool HartConfig::applyConfig<uint32_t>(Hart<uint32_t>&, bool) const;
template bool HartConfig::applyConfig<uint64_t>(Hart<uint64_t>&, bool) const;

return conf.applyConfig(hart, verbose);
}
template bool HartConfig::applyMemoryConfig<uint32_t>(Hart<uint32_t>&, bool) const;
template bool HartConfig::applyMemoryConfig<uint64_t>(Hart<uint64_t>&, bool) const;


/// This is never called. It is here to force instantiation of templated
/// methods.
bool
HartConfig::apply(HartConfig& conf, Hart<uint64_t>& hart, bool verbose)
{
conf.applyMemoryConfig(hart, verbose);

std::vector<Hart<uint64_t>*> vec;
conf.finalizeCsrConfig(vec);

return conf.applyConfig(hart, verbose);
}
template bool HartConfig::finalizeCsrConfig<uint32_t>(std::vector<Hart<uint32_t>*>&) const;
template bool HartConfig::finalizeCsrConfig<uint64_t>(std::vector<Hart<uint64_t>*>&) const;
6 changes: 0 additions & 6 deletions HartConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ namespace WdRiscv

private:

/// Force instantiation of applyConfig(Hart<uint32_t>, bool).
static bool apply(HartConfig&, Hart<uint32_t>&, bool);

/// Force instantiation of applyConfig(Hart<uint64_t>, bool).
static bool apply(HartConfig&, Hart<uint64_t>&, bool);

HartConfig(const HartConfig&) = delete;
void operator= (const HartConfig&) = delete;

Expand Down

0 comments on commit 34ac032

Please sign in to comment.