This commit adds required transformation pass for IPRA and a simple testcase to verify it. 1) lib/Target/X86/X86RegUsageInfoPropagate.cpp (Target Specific MachineFunction Pass) to update RegMasks of call instr in caller function based on the RegMask returned by immutable pass, scheduled at Pre-RegAlloc.
Details
Diff Detail
Event Timeline
Two very basic questions:
1.) Do we plan on supporting IPRA on other targets? My assumption is yes (please).
2.) Can the RegUsageInfoPropagate pass be written in a target-independent way and add target specific hooks as necessary?
I don't know why the pass is still X86 specific, I thought our conclusion before splitting the patch was that it is not and should be a generic pass?
The only reason it is X86 was that we thought we would have to handle calls in a target specific way, but it turned out we should be able to get away with that.
test/CodeGen/Generic/ipra-transform.ll | ||
---|---|---|
14 ↗ | (On Diff #60313) | trailing whitespace |
lib/CodeGen/RegUsageInfoPropagate.cpp | ||
---|---|---|
1 ↗ | (On Diff #60346) | This doesn't appear to be 80-column. |
13 ↗ | (On Diff #60346) | MachineInstrs in a given |
14 ↗ | (On Diff #60346) | RegisterUsageInfo.cpp -> RegisterUsageInfo |
15 ↗ | (On Diff #60346) | of the callee Perhaps something like: |
17 ↗ | (On Diff #60346) | used by the register allocator while allocating the current MachineFunction. |
42 ↗ | (On Diff #60346) | I've seen this style in the past: #define RUIP_NAME "Register Usage Information Propagation" and then replace the strings with the #define. |
53 ↗ | (On Diff #60346) | return RUIP_NAME; |
75 ↗ | (On Diff #60346) | "Register Usage Information Propagation" -> RUIP_NAME |
78 ↗ | (On Diff #60346) | "Register Usage Information Propagation" -> RUIP_NAME |
102 ↗ | (On Diff #60346) | I'm not sure this comment is necessary, but I don't have any strong feelings for or against it. However, if you do decide to keep it, please write all comments using proper English prose (capitalization, puncuation, etc.). |
103 ↗ | (On Diff #60346) | You can reduce the indent by changing this check to: if (!MI.isCall()) continue; I tend to think it also improves readability. |
lib/CodeGen/RegUsageInfoPropagate.cpp | ||
---|---|---|
74 ↗ | (On Diff #60346) | The second argument to INITIALIZE_PASS_BEGIN/END is used to specify the name of the command-line option passed to llc/opt to enable this pass. Generally, this is all lower case with dashes are used for spacing (e.g., "peephole-opt", "machine-sink", "if-converter"). We should decide upon a name that uses this convention (e.g., "reg-usage-propagation"). |
lib/CodeGen/RegUsageInfoPropagate.cpp | ||
---|---|---|
118 ↗ | (On Diff #60359) | No: Operand.getGlobal() already returns the Function *.... |