[cfe-dev] Inline assembly Z constraint and more

Chris Lattner clattner at apple.com
Fri Apr 23 09:56:34 PDT 2010


On Apr 16, 2010, at 7:20 PM, John Thompson wrote:

> Oh, sorry, I forgot to hit the save button in the editor.  It's just one file:

This isn't the right patch.  These constraints are all target specific, so it'll have to be sunk into a (probably new) hook in the PowerPC TargetInfo impl.  There is documentation of this stuff here:

http://gcc.gnu.org/onlinedocs/gcc/Simple-Constraints.html#Simple-Constraints
http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints 

FWIW, Z is apparently "Memory operand that is an indexed or indirect from a register (it is usually better to use `m' or `es' in asm statements) "

-Chris

>  
> Index: lib/Basic/TargetInfo.cpp
> ===================================================================
> --- lib/Basic/TargetInfo.cpp (revision 101528)
> +++ lib/Basic/TargetInfo.cpp (working copy)
> @@ -280,6 +280,8 @@
>        Info.setAllowsRegister();
>        Info.setAllowsMemory();
>        break;
> +    case 'Z': // wish I knew what Z was for...
> +      break;
>      }
>  
>      Name++;
> @@ -359,6 +361,14 @@
>      case 'N':
>      case 'O':
>      case 'P':
> +    case 'Q':
> +    case 'R':
> +    case 'S':
> +    case 'T':
> +    case 'U':
> +    case 'W':
> +    case 'Y':
> +    case 'Z':
>        break;
>      case 'r': // general register.
>        Info.setAllowsRegister();
> I don't know if it's target-specific or not.  The gcc comment makes it seem generic (register indexed memory), but I couldn't find any docs that mentioned it.
>  
> -John
> 
> On Fri, Apr 16, 2010 at 4:38 PM, Chris Lattner <clattner at apple.com> wrote:
> 
> On Apr 16, 2010, at 3:53 PM, John Thompson wrote:
> 
> > Using Clang to compile some PS3 headers, I ran into a problem with some inline assembly for some instrinsics macros with an unrecognized "Z" constraint.  Looking at the gcc sources, I see there are several other constraints not currently supported.  The enclosed macro lets them get through the parser, but at present I have no idea how to actually implement them, so before I look into it more, I thought I'd ask.  Can someone help me out?
> >
> > This from the gcc sources:
> >
> > (define_memory_constraint "Z"
> >   "Memory operand that is an indexed or indirect from a register (it is
> > usually better to use @samp{m} or @samp{es} in @code{asm} statements)"
> >   (match_operand 0 "indexed_or_indirect_operand"))
> > Is it okay to check in the patch as an intermediate step?
> >
> 
> it Z a target independent or target-specific constraint?  You have some unrelated changes in your diff.
> 
> -Chris
> 
> 
> 
> 
> -- 
> John Thompson
> John.Thompson.JTSoftware at gmail.com
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100423/eabeea1b/attachment.html>


More information about the cfe-dev mailing list