mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Fix PR3149. If an early clobber def is a physical register and it is tied to an input operand, it effectively extends the live range of the physical register. Currently we do not have a good way to represent this.
172 %ECX<def> = MOV32rr %reg1039<kill> 180 INLINEASM <es:subl $5,$1 sbbl $3,$0>, 10, %EAX<def>, 14, %ECX<earlyclobber,def>, 9, %EAX<kill>, 36, <fi#0>, 1, %reg0, 0, 9, %ECX<kill>, 36, <fi#1>, 1, %reg0, 0 188 %EAX<def> = MOV32rr %EAX<kill> 196 %ECX<def> = MOV32rr %ECX<kill> 204 %ECX<def> = MOV32rr %ECX<kill> 212 %EAX<def> = MOV32rr %EAX<kill> 220 %EAX<def> = MOV32rr %EAX 228 %reg1039<def> = MOV32rr %ECX<kill> The early clobber operand ties ECX input to the ECX def. The live interval of ECX is represented as this: %reg20,inf = [46,47:1)[174,230:0) 0@174-(230) 1@46-(47) The right way to represent this is something like %reg20,inf = [46,47:2)[174,182:1)[181:230:0) 0@174-(182) 1@181-230 @2@46-(47) Of course that won't work since that means overlapping live ranges defined by two val#. The workaround for now is to add a bit to val# which says the val# is redefined by a early clobber def somewhere. This prevents the move at 228 from being optimized away by SimpleRegisterCoalescing::AdjustCopiesBackFrom. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61259 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -38,16 +38,19 @@ namespace llvm {
|
||||
/// - or reg # of the definition if it's a stack slot liveinterval.
|
||||
/// copy - Copy iff val# is defined by a copy; zero otherwise.
|
||||
/// hasPHIKill - One or more of the kills are PHI nodes.
|
||||
/// redefByEC - Re-defined by early clobber somewhere during the live range.
|
||||
/// kills - Instruction # of the kills.
|
||||
struct VNInfo {
|
||||
unsigned id;
|
||||
unsigned def;
|
||||
MachineInstr *copy;
|
||||
bool hasPHIKill;
|
||||
bool hasPHIKill : 1;
|
||||
bool redefByEC : 1;
|
||||
SmallVector<unsigned, 4> kills;
|
||||
VNInfo() : id(~1U), def(~1U), copy(0), hasPHIKill(false) {}
|
||||
VNInfo()
|
||||
: id(~1U), def(~1U), copy(0), hasPHIKill(false), redefByEC(false) {}
|
||||
VNInfo(unsigned i, unsigned d, MachineInstr *c)
|
||||
: id(i), def(d), copy(c), hasPHIKill(false) {}
|
||||
: id(i), def(d), copy(c), hasPHIKill(false), redefByEC(false) {}
|
||||
};
|
||||
|
||||
/// LiveRange structure - This represents a simple register range in the
|
||||
@@ -177,6 +180,7 @@ namespace llvm {
|
||||
DstValNo->def = SrcValNo->def;
|
||||
DstValNo->copy = SrcValNo->copy;
|
||||
DstValNo->hasPHIKill = SrcValNo->hasPHIKill;
|
||||
DstValNo->redefByEC = SrcValNo->redefByEC;
|
||||
DstValNo->kills = SrcValNo->kills;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user