[LLVMdev] Data/Address registers

Jim Grosbach grosbach at apple.com
Tue Mar 6 13:54:55 PST 2012


Hi Ivan,
On Mar 3, 2012, at 4:48 AM, Ivan Llopard <ivanllopard at gmail.com> wrote:

> Hi,
> 
> I'm facing a problem in llvm while porting it to a new target and I'll 
> need some support.
> We have 2 kind of register, one for general purposes (i.e. arithmetic, 
> comparisons, etc.) and the other for memory addressing.

OK. Separate register classes should be able to handle this.

> Cross copies are not allowed (no data path).

You mean you can't copy directly from a general purpose register to an address register? That's an unfortunate architectural quirk. You may have to write some interesting and potentially ugly code in copyPhysReg() to handle that.

> We use clang 3.0 to produce assembler code.
> Because both registers have the same size and type (i16), I don't know 
> what would be the best solution to distinguish them in order to match 
> the right instructions.

The register classes should take care of this.

> Moreover, the standard pointer arithmetic is not 
> enough for us (we need to support modulo operations also).
> I thought that I could manually match every arithmetic operation while 
> matching the addressing mode but it doesn't work because intermediate 
> results are sometimes reused for other purposes (e.g. comparisons).

I suggest getting things working correctly first and then coming back to things like this as an optimization.

> Do I need to add another type to clang/llvm ?
> 

Unlikely.

Regards,
 Jim


> Thanks in advance,
> 
> Ivan
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list