Francesco Spadini
2003-Apr-10 21:20 UTC
[LLVMdev] splitting up program into multiple threads
I have a sort of strange request -- I am splitting up a program into multiple threads, which may have duplicated instructions between them. I'd like to run optimizations on the threads separately, but I'd like for the variables common amongst the threads to get register allocated the same way (i.e, a value that is duplicated in the two threads gets mapped to the same register/memory location). Is there a cleaner way to this other than to make all the shared variables global? Thanks in advance for any advice. -- Francesco Spadini http://www.crhc.uiuc.edu/~spadini spadini at crhc.uiuc.edu "The universe is full of magical things, patiently waiting for our wits to grow sharper." - Eden Phillpots
It sounds like you are generating separate code for the different threads, if you plan ot optimize them separately. If that's true, it's not clear exactly what you want since LLVM distinguishes registers and memory and there is no correspondence between them. When you say a common variable, do you mean a variable in memory (i.e., global or alloca slot), or an SSA register? If you know that you want SSA registers r1 and r2 in 2 different threads to be mapped to the same register, you can give the RegAlloc pass hints to suggest which register to use. These are not guaranteed but unless you have high register pressure, the hints are likely to be respected. Then, if the hints are not respected, you could force this "variable" to be a global. Let's take this discussion off the llvmdev list. If anyone else has any suggestions, please send them to Francesco directly and copy me. --Vikram http://www.cs.uiuc.edu/~vadve> -----Original Message----- > From: llvmdev-admin at cs.uiuc.edu > [mailto:llvmdev-admin at cs.uiuc.edu] On Behalf Of Francesco Spadini > Sent: Thursday, April 10, 2003 10:19 PM > To: llvmdev at cs.uiuc.edu > Subject: [LLVMdev] splitting up program into multiple threads > > > I have a sort of strange request -- I am splitting up a > program into multiple threads, which may have duplicated > instructions between them. I'd like to run optimizations on > the threads separately, but I'd like for the variables common > amongst the threads to get register allocated the same way > (i.e, a value that is duplicated in the two threads gets > mapped to the same register/memory location). Is there a cleaner way > to this other than to make all the shared variables global? > Thanks in > advance for any advice. > > -- > Francesco Spadini > http://www.crhc.uiuc.edu/~spadini > spadini at crhc.uiuc.edu > > "The universe is full of magical > things, patiently waiting for our > wits to grow sharper." > - Eden Phillpots > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev >