[PATCH] D52818: [Tablegen/SubtargetEmitter] Add Id field to ProcResource

Marcello Maggioni via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 2 20:34:54 PDT 2018


kariddi created this revision.
kariddi added reviewers: dblaikie, atrick, craig.topper.
Herald added a subscriber: llvm-commits.

Hi,

I made a patch to add a Target managed Id field to the ProcResource structure in the backend scheduling infrastructure.

The idea is that it can be useful to make a scheduling decisions based on which resources a certain instruction/node is using.
The problem is that there's no way to tell what a resource is when you iterate over it in code and because of that you cannot make a decision. We would need a way to know that a certain resource is for example "ALU" or "Issue" to do so.
Another way would be to attach target flags to the instructions and check that (like TSFlags for example) or maintain a function that returns a predicate depending on the instruction opcode, but if the information you need is already encoded in the scheduling resources then duplicating it in the TSFlags and keeping it in sync with your scheduling model seems wasteful and error prone.

This patch adds an Id that the developer can assign any value he wants to and then in C++ code then you could have an enum connecting the values specified in the tablegen model that are easy to read.

For example you could have a procresource called ALU with TargetId = 1 and then have an enum in the scheduler that looks like this:

enum { ProcALU = 1, .... };

You can query the TargetId of a ProcResource by using the getProcResourceTargetId() function passing the ProcResourceId.


Repository:
  rL LLVM

https://reviews.llvm.org/D52818

Files:
  include/llvm/CodeGen/TargetSchedule.h
  include/llvm/MC/MCSchedule.h
  include/llvm/Target/TargetSchedule.td
  lib/MC/MCSchedule.cpp
  test/TableGen/TargetIdTest.td
  utils/TableGen/SubtargetEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52818.168068.patch
Type: text/x-patch
Size: 8160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181003/3abf53da/attachment.bin>


More information about the llvm-commits mailing list