OSDN Git Service

[llvm-mca] Use a vector to store ResourceState objects in the ResourceManager.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 2 Aug 2018 11:12:35 +0000 (11:12 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 2 Aug 2018 11:12:35 +0000 (11:12 +0000)
commita86b69635fdc68995ad0966df82777b9872f1864
tree6744743438b44a01f3347b710b362d1881d7e209
parenta9ba7266d455a5473df0050f07ccb147bd6b6127
[llvm-mca] Use a vector to store ResourceState objects in the ResourceManager.

We don't need to use a map to store ResourceState objects. The number of
processor resources is known statically from the scheduling model. We can
therefore use a vector, and reserve a slot for each processor resource that we
want to simulate.
Every time the ResourceManager queries the ResourceState vector, the index to
the vector of ResourceState objects can be easily computed from the processor
resource mask.

This drastically reduces the time complexity of method ResourceManager::use() and
method ResourceManager::release(). This patch gives an average speedup of 12%.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338702 91177308-0d34-0410-b5e6-96231b3b80d8
tools/llvm-mca/Scheduler.cpp
tools/llvm-mca/Scheduler.h