[llvm-dev] getCacheSize() / subtarget machine id

Jonas Paulsson via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 17 08:04:29 PDT 2017


Hi,

while implementing SystemZTTI:getCacheSize(), it became clear that there 
really isn't a simple way to just ask the Subtarget for the current 
subtarget machine model. I was thinking like something of an enum that 
would also reflect the subtarget series (and would allow >= and similar 
operations).

I would like to ask what the ideas are on how this should be done best. 
Some thoughts:

* Just comparing the CPU string during initializaition is possible (and 
perhaps simple and good enough), but ideally it would be better not to 
do this, as those strings are already in the (SystemZ)Processors.td file.

* Extend ProcessorModel with a "processor model ID" that the subtarget 
could later retrieve?

* Extend MCSchedModel instead? Or even extend MCSchedModel with the 
cache size / associativity directly for this case?

My first thought was to just have an enum in the target and then check 
the CPU string (per the first bullet), but I wonder if you think there 
is a better way.

/Jonas




More information about the llvm-dev mailing list