Seung Jae Lee
2007-Mar-04 18:19 UTC
[LLVMdev] infinite number of virtual registers - sorry, modified.
Hello. I am making a backend for a virtual machine. But it does assume infinite number of virtual registers unlike those of usual machines. In this case, how can I implement this? Would you mind telling me some tips? Thank you so much. Seung Jae Lee
Fernando Magno Quintao Pereira
2007-Mar-04 18:52 UTC
[LLVMdev] infinite number of virtual registers - sorry, modified.
Dear Seung, the number of virtual registers is unbounded. In your code, you can create as many as you want. The number of 'physical' registers is limited, and depends on the target architecture, e.g 32 integer regs in PowerPC, 8 registers of 16 bits in X86, etc. You can use the method below to create new virtual registers any time you need: //===---------------------------------------------------------------------- // This method creates a new virtual register with the same class as // reg_model. //===---------------------------------------------------------------------- unsigned SplitPhiGroups_Fer::create_new_virtual_register( unsigned reg_model ) { // Take the register class. const TargetRegisterClass *trc this->machine_function->getSSARegMap()->getRegClass(reg_model); SSARegMap * srm = this->machine_function->getSSARegMap(); unsigned new_reg = srm->createVirtualRegister(trc); return new_reg; } Fernando> Hello. > I am making a backend for a virtual machine. > But it does assume infinite number of virtual registers unlike those of usual machines. > In this case, how can I implement this? > Would you mind telling me some tips? > Thank you so much. > > Seung Jae Lee > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >