From: Simon Wright <simon@pushface.org>
Subject: Re: Code Statement
Date: Wed, 19 May 2010 07:07:28 +0100
Date: 2010-05-19T07:07:28+01:00 [thread overview]
Message-ID: <m2tyq4v2zj.fsf@pushface.org> (raw)
In-Reply-To: hsvptt$n36$1@speranza.aioe.org
anon@att.net writes:
> As for the example supplied I decide use the intel "nop" for simplicity
> instead of using the codes for the attached processor.
Ah! I see what you meant by "special project".
> I prefer to use the Code Statement like the System.Machine_Code in SUN,
> instead of using the inline-assembler of gnat\gcc. which forces the
> following type of statements for non-native processors:
>
> ASM ( " .byte 0x90" ) ; -- intel x86 nop
> ASM ( " .byte 0x02" ) ; -- attach processor instruction "Load R2"
> ...
>
> And using the code statement allows the Ada compiler to emulate a small
> limited assembler without all of the work\time in rewriting\expanding
> the gcc "AS" to include the new processor.
>
> So, I see no problem in using code statement except for creating or
> expand and recompiling the "system.machine_code" package. Unless Adacore
> has crippled gnat's code statement routines.
I'm not sure what http://www.adaic.com/standards/05rm/html/RM-13-8.html
(2) means; does it give you a licence to use any type you lke? seems
unlikely.
> Now, the RM 13.8 (2), says that the code statement is qualified_expression
> so what the problem. In Gnat, the ASM routines are handled by the
> "Expand_Asm_Call" procedure ("exp_code" package) which expands the ASM
> statement into a qualified_expression. Also, "P_Code_Statement" ("par-ch13"
> package) directly processes code_statements as an qualified_expression.
> Afterwards, the "Analyze_Code_Statement" ("sem-ch13" package) analyzes
> should handle the code statements but this routine is where the error
> message is generated.
I expect the compiler is written to expect System.Machine_Code.Asm_Insn
of the specific type defined in System.Machine_Code.
You could write
Asm_Insn'(Asm (".byte 0x90"));
but it hardly seems worth the trouble. AdaCore have provided this as a
"feature" I think -- see the GNAT RM,
http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gnat_rm/Machine-Code-Insertions.html
next prev parent reply other threads:[~2010-05-19 6:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 13:12 Code Statement johnjohn
2010-05-18 13:22 ` Ludovic Brenta
2010-05-18 13:29 ` AdaMagica
2010-05-18 15:05 ` sjw
2010-05-19 4:37 ` anon
2010-05-19 6:07 ` Simon Wright [this message]
2010-05-19 9:56 ` sjw
2010-05-19 10:20 ` AdaMagica
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox