Hi Chris, Chris Lattner wrote:> On Fri, 2 Feb 2007, Nicolas Geoffray wrote: > > > Some meta comments: > > 1. Please don't change PPC -> llvmPPC. I assume that you did this because > PPC is a #define in some system header. Please just add a '#undef PPC' > where appropriate to make this unneeded. >OK> 2. The X86 backend has the unfortunate habit of saying "if !darwin" "if > !cygwin" etc. Most of the changes you've made are actually ABI related > changes, not OS-specific changes. As such, I'd prefer it if you added > two methods to PPCSubtarget: isMachoABI() and isELF_ABI() (or whatever > is the right name of the ABI that linux uses) and use those instead. >Well all of the changes are ABI related. In fact, could you give me an example of what is os-specific and not abi-specific? I'm not sure.> 3. Please split up the patch into independent chunks for easier review. > This will make it much more likely that your pieces will be applied in > a timely fashion :). This will also let you get pieces in before the > whole thing is "done". >OK>> 2) Line 369 of PPCInstrInfo.td, we declare the non-callee saved registers. >> However, Linux and Darwin do not have the same set >> of non-callee saved registers. I don't know how to make the if(isDarwin) test >> in here >> > > Take a look at ARM/ARMRegisterInfo.td for an example of this. > >Great, thx for the hint>> 3) R31, which replaces R1 as stack pointer when there is a dynamic allocation >> in a method, must be seen as a callee-saved register and must not be saved >> and restored like it is actually for Darwin. I don't know how to specify >> that, when there is a dynamic allocation, R31 must be added to the set of >> registers that are saved before entering the method and restored at the end. >> > > Can you just mark it callee saved? If so, and if there is an instruction > in the function that clobbers R31, it should automatically be saved and > restored. > >It is marked callee saved. Because when it is not needed as frame pointer it is used like an ordinary register. But when it is used as frame pointer, the prologue and epilogue change its value, but the algorithm in llvm that finds clobbered register does not select it.> Thanks a lot for doing this, linux/ppc support is a major new feature! > >No problem, that way I'll be able to work with llvm on my own box :) Thx, Nicolas
On Sun, 4 Feb 2007, Nicolas Geoffray wrote:>> 2. The X86 backend has the unfortunate habit of saying "if !darwin" "if >> !cygwin" etc. Most of the changes you've made are actually ABI related >> changes, not OS-specific changes. As such, I'd prefer it if you added >> two methods to PPCSubtarget: isMachoABI() and isELF_ABI() (or whatever >> is the right name of the ABI that linux uses) and use those instead. >> > Well all of the changes are ABI related. In fact, could you give me an > example of what is os-specific and not abi-specific? I'm not sure.Most of the things you are doing are ABI-related, and until we have multiple targets using the same ABI, it doesn't make sense to have os-specific aspects. An example of an OS-specific aspect: cygwin and mingw on x86 use the same ABI, however, mingw refers to longjmp as "longjmp" and cygwin refers to it as "_longjmp".>>> 3) R31, which replaces R1 as stack pointer when there is a dynamic allocation >>> in a method, must be seen as a callee-saved register and must not be saved >>> and restored like it is actually for Darwin. I don't know how to specify >>> that, when there is a dynamic allocation, R31 must be added to the set of >>> registers that are saved before entering the method and restored at the end. >>> >> >> Can you just mark it callee saved? If so, and if there is an instruction >> in the function that clobbers R31, it should automatically be saved and >> restored.> It is marked callee saved. Because when it is not needed as frame > pointer it is used like an ordinary register. But when it is used as > frame pointer, the prologue and epilogue change its value, but the > algorithm in llvm that finds clobbered register does not select it.Okay, I'm not sure. If you describe the constraints better, perhaps Jim or Evan will have an idea :) -Chris -- http://nondot.org/sabre/ http://llvm.org/
Hi Chris,>> It is marked callee saved. Because when it is not needed as frame >> pointer it is used like an ordinary register. But when it is used as >> frame pointer, the prologue and epilogue change its value, but the >> algorithm in llvm that finds clobbered register does not select it. >> > > Okay, I'm not sure. If you describe the constraints better, perhaps Jim > or Evan will have an idea :) >Well i believe the algorithm that finds clobbered registers does not look at the epilogue and prologue, and therefore does not select R31. Maybe all I need to do is to explicitly add R31 as a clobbered register when it is used as a frame pointer. But I need some help to do that. Thx, Nicolas