[LLVMdev] Supporting pre-allocated registers in LLVM
Bill Wendling
isanbard at gmail.com
Tue Oct 9 20:44:59 PDT 2007
On Oct 9, 2007, at 1:40 AM, nkavv at physics.auth.gr wrote:
> i would like to have a look to your register allocator. Is it on
> LLVM SVN? Or is
> it something standalone?
>
> BTW, my time is limited right now (writing up my Ph.D. as well as a
> processor
> soft core) but i will dedicate some time (after all i do this for
> polishing my
> Machine-SUIF passes, and there is no help there). LLVM has a
> community, really
> working on advancing the compiler.
>
Hi Nikolaos,
The code isn't in SVN right now. Here is the code (put BitMatrix.h in
include/llvm/ADT and RegAllocGraphColoring.cpp in lib/CodeGen).
There's a few problems with it. For one, when calculating the
"forbidden registers", it's getting confused because LLVM marks
registers that are killed by a call as having a live interval. These
interfere with the live intervals that the RA is handling, resulting
in a large number of intervals that are uncolorable. I think I know a
way around this, but haven't tried it yet.
After that's finished, the next thing will be to have a better
heuristic for selecting a physical register for a live interval. The
one it uses now is *really* dumb.
Take a look and let me know what you think or if you have any
improvements!
-bw
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BitMatrix.h
Type: application/octet-stream
Size: 5875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071009/74ccb627/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RegAllocGraphColoring.cpp
Type: application/octet-stream
Size: 39131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071009/74ccb627/attachment-0001.obj>
-------------- next part --------------
Index: include/llvm/CodeGen/Passes.h
===================================================================
--- include/llvm/CodeGen/Passes.h (revision 42822)
+++ include/llvm/CodeGen/Passes.h (working copy)
@@ -71,6 +71,9 @@
///
FunctionPass *createLocalRegisterAllocator();
+ /// Graph Coloring Register Allocator Pass
+ FunctionPass *createGraphColoringRegisterAllocator();
+
/// BigBlockRegisterAllocation Pass - The BigBlock register
allocator
/// munches single basic blocks at a time, like the local register
/// allocator. While the BigBlock allocator is a little slower,
and uses
Index: include/llvm/CodeGen/LinkAllCodegenComponents.h
===================================================================
--- include/llvm/CodeGen/LinkAllCodegenComponents.h (revision 42822)
+++ include/llvm/CodeGen/LinkAllCodegenComponents.h (working copy)
@@ -34,6 +34,8 @@
(void) llvm::createLinearScanRegisterAllocator();
(void) llvm::createSimpleRegisterCoalescer();
+
+ (void) llvm::createGraphColoringRegisterAllocator();
(void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL);
(void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL);
More information about the llvm-dev
mailing list