aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-04-02 05:23:57 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-04-02 05:23:57 +0000
commit578c960a984c274fd1ec54e377969af6a4309dcb (patch)
tree959c502ec8fecc71adff7f78e0b50e764d464188 /include/llvm/CodeGen
parent07aa2ecae340471411fce0625e8a6b12c8b5df8a (diff)
downloadexternal_llvm-578c960a984c274fd1ec54e377969af6a4309dcb.zip
external_llvm-578c960a984c274fd1ec54e377969af6a4309dcb.tar.gz
external_llvm-578c960a984c274fd1ec54e377969af6a4309dcb.tar.bz2
Add new CC lowering rule: provide a list of registers, which can be 'shadowed',
when some another register is used for argument passing. Currently is used on Win64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49079 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/CallingConvLower.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/CallingConvLower.h b/include/llvm/CodeGen/CallingConvLower.h
index 2f83eaa..584cb19 100644
--- a/include/llvm/CodeGen/CallingConvLower.h
+++ b/include/llvm/CodeGen/CallingConvLower.h
@@ -167,7 +167,15 @@ public:
MarkAllocated(Reg);
return Reg;
}
-
+
+ /// Version of AllocateReg with extra register to be shadowed.
+ unsigned AllocateReg(unsigned Reg, unsigned ShadowReg) {
+ if (isAllocated(Reg)) return 0;
+ MarkAllocated(Reg);
+ MarkAllocated(ShadowReg);
+ return Reg;
+ }
+
/// AllocateReg - Attempt to allocate one of the specified registers. If none
/// are available, return zero. Otherwise, return the first one available,
/// marking it and any aliases as allocated.
@@ -175,13 +183,27 @@ public:
unsigned FirstUnalloc = getFirstUnallocated(Regs, NumRegs);
if (FirstUnalloc == NumRegs)
return 0; // Didn't find the reg.
-
+
// Mark the register and any aliases as allocated.
unsigned Reg = Regs[FirstUnalloc];
MarkAllocated(Reg);
return Reg;
}
-
+
+ /// Version of AllocateReg with list of registers to be shadowed.
+ unsigned AllocateReg(const unsigned *Regs, const unsigned *ShadowRegs,
+ unsigned NumRegs) {
+ unsigned FirstUnalloc = getFirstUnallocated(Regs, NumRegs);
+ if (FirstUnalloc == NumRegs)
+ return 0; // Didn't find the reg.
+
+ // Mark the register and any aliases as allocated.
+ unsigned Reg = Regs[FirstUnalloc], ShadowReg = ShadowRegs[FirstUnalloc];
+ MarkAllocated(Reg);
+ MarkAllocated(ShadowReg);
+ return Reg;
+ }
+
/// AllocateStack - Allocate a chunk of stack space with the specified size
/// and alignment.
unsigned AllocateStack(unsigned Size, unsigned Align) {