Add support for inline assembly with matching input operand that do not naturally go in the register class it is constrained to (eg. double in a 32-bit GPR). Note that regular input is already handled by existing code.
Details
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 20812 Build 20812: arc lint + arc unit
Event Timeline
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7222 | I don't follow this... don't we need to allocate virtual registers anyway? And how is this relevant to this patch? | |
7471–7472 | Why is this "OpInfo.ConstraintType == TargetLowering::C_Register" here, but "RefOpInfo.ConstraintType == TargetLowering::C_RegisterClass" later? |
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7222 | The virtual register is allocated later at line 7599 with the patch applied when "looping over all of the inputs, copying the operand values into the appropriate registers and processing the output regs" (dixit comment). That code was already there before any of my patch and I decided to keep that code structure. It is relevant to this patch because prior to it GetRegistersForValue was not called for matching input since it was only called for C_RegisterClass constraints. It is now called for matching input as well since that is where is the logic to deal with mismatch between register constraint size and the operand type. | |
7471–7472 | I didn't write these two checks but from the comment above the goal seems to distinguish between constraints for specific register (C_Register) from general register constraint (C_RegisterClass). Allocating registers for the former before the latter avoids allocating register X to a general register constraint and later dealing with a constraint asking for X specifically when there was a register Y which the general constraint would have been happy with. |
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7471–7472 | Sorry, I wasn't clear; why is the first check checking OpInfo, and the second checking RefOpInfo? |
Fix logic for input matching a register constraint for a specific register and add tests for it. I've verified that the code for this logic is executed by those new testcases and that the testcase failed without the fix.
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7471–7472 | Good catch! I've fixed this and added testcases for this cases and confirmed that they failed when using OpInfo. |
I don't follow this... don't we need to allocate virtual registers anyway? And how is this relevant to this patch?