Using VirtRegMap

I'm trying to piece together a few assignments for a graduate-level compilers class using LLVM; among these is a register allocator. I'd like to provide a register allocator that, given a partially-allocated VirtRegMap, will perform trivial register allocation (as in RegAllocSimple) on the remaining, unmapped virtual registers.

To make a long story short, I want to map a single virtual register to various physical registers at different times, keeping the relevant value in memory all along. Can VirtRegMap do this cleanly, or should I avoid this abstraction and issue stores and loads manually, through TargetInstrInfo?

Thanks,
- Matt Elder

I'm trying to piece together a few assignments for a graduate-level
compilers class using LLVM; among these is a register allocator. I'd
like to provide a register allocator that, given a partially-allocated
VirtRegMap, will perform trivial register allocation (as in
RegAllocSimple) on the remaining, unmapped virtual registers.

To make a long story short, I want to map a single virtual register to
various physical registers at different times, keeping the relevant
value in memory all along. Can VirtRegMap do this cleanly, or should I
avoid this abstraction and issue stores and loads manually, through
TargetInstrInfo?

Please avoid using VirtRegMap. It's very tied to the current register allocation pieces and not easily reusable. One of my mission in life is to kill it.

Evan

Im surprised to see this. I found it rather easy to re-use for custom
register allocators.

                                                -Dave

Ok. Everyone has different idea about "easy". :slight_smile:

But VirtRegMap is going to be remove one of these days. And it's not going to like partially allocated virtual registers. So I don't think it's a good fit for Matt.

Evan