Re: asm-blocks: please tell me why I'm being thick :-)
Re: asm-blocks: please tell me why I'm being thick :-)
- Subject: Re: asm-blocks: please tell me why I'm being thick :-)
- From: Alastair Houghton <email@hidden>
- Date: Thu, 25 Mar 2004 10:58:52 +0000
On 25 Mar 2004, at 10:17, Nigel Perry wrote:
> At 8:16 am +0100 25/3/04, Gerard Iglesias wrote:
>> When in a C or ObjC fil I get the error :
>>
>> test.c: In function `baz':
>> test.c:13: error: matching constraint references invalid operand
>> number
>>
>> At this line
>>
>> li loc1,4 * 89
>>
>> ???
>
> Yes, it appears to *sometimes* get messed up with the "register int
> loc1" - which is what I think this is. However other times it works,
> and so far I can find no pattern as to when something will work and
> when it won't. And given things like re-ordering the functions in a
> file and break/fix assembler errors I'm being to think the whole
> feature is implemented "interestingly" (as I would say to students on
> my parsing course! ;-))
>
>> Well in other test I made a long time ago I got very weird behavior
>> with bery strange asm translation.... I had more luck with this kind
>> of
>> syntax use :
>>
>> int bazC(int arg1) {
>> register int loc1;
>> asm {
>> @123
>> li loc1,4 * 89
>> nand. r5,arg1,loc1
>> ble- cr0, @123
>> otherlab: nop
>> mr r3,r5
>> }
>> }
>>
>>
>> But for this one I get the same error
>
> Yes, in function asm blocks seem iffy as well :-(
>
> I'm actually after the asm functions as they don't include a
> prelude/postlude while the above does. For every simple functions
> dropping these is worth it. However I'll take any reliable method!
You can easily use a separate assembler source file, or you can write
GCC-style asms (which work). GCC-style asm, BTW, works fine at
top-level in a file, so you can quite happily write
int bazC(int arg1);
asm("
.globl _bazC
_bazC:
0: li r4,4*89
nand. r5,r3,r4
ble- 0b
otherlab: nop
mr r3,r5
blr
");
The only slightly unfortunate thing is that you can't easily declare a
static function of that kind without triggering a warning... and
removing the .globl without writing "static" before the declaration
will cause linking problems.
It might be useful to make the GCC naked attribute work on PowerPC
targets to make this kind of thing easier.
Kind regards,
Alastair.
--
http://www.alastairs-place.net
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.