This is the mail archive of the
mailing list for the GCC project.
Re: volatile workaround and how to mark register unused?
- From: mike stump <mrs at windriver dot com>
- To: diwil at eis dot ru, gcc at gcc dot gnu dot org
- Date: Wed, 20 Mar 2002 11:31:22 -0800 (PST)
- Subject: Re: volatile workaround and how to mark register unused?
> Date: Wed, 20 Mar 2002 14:22:30 +0300
> From: Dmitry <firstname.lastname@example.org>
> To: email@example.com
> volatile int a;
> int __attribute__ ((interrupt)) foo( )
> return a > 7;
> GCC produces the assembler code
> mov &a, r12 ; 12 *movhi3/6 [length = 2]
> cmp #llo(8), r12 ; 31 cmphi [length = 1]
> volatile_ok = 1;
Age old problem, should be fixed. Hasn't been fixed yet. Search the
archives for volatile_ok and email from me. Basically, volatile_ok
should go away, and be replaced by the constant 1.
The right fix, is in your port, do
#define VOLATILE_OK 1
and then in the backend, in all places where volatile_ok is set, put
in an VOLATILE_OK&&, and then in defaults.h, put in a #ifndef
VOLATILE_OK, #define VOLATILE_OK 0, #endif. recompile, and presto,
everything works. Be defining this, you, as port maintainer, agree to
never read from any variable more than what is otherwise suggested by
the highlevel operation, and never write to it, more than is otherwise
suggested by the highlevel operation. If you need to do multiple
reads/writes to perform the operation, then you are responsible for
using an intermediate, or effecting some other solution. Likewise,
peepholing may need to be audited to ensure that bad things don't
Please, do this up, submit the work, audit your port for