1/1

|
inline assembly
by Unknown on May 6, 2004 |
Not available! | ||
|
Hi all,
I like to add some additional instructions to the openrisc. Then I may need to change the complier to generate the added the instructions. But It seems that very trouble. I wonder if I could use the inline assembly function to add the extra instructions in to the c code. And the complier will generate the corresponding assmbly code. Can the compiler do it? Thank you very much. Best Regards, Stephen |
|||
|
inline assembly
by Unknown on May 6, 2004 |
Not available! | ||
|
On Thu, 6 May 2004 whli_interqos@yahoo.com.hk wrote:
: I like to add some additional instructions to the openrisc. Then I may
: need to change the complier to generate the added the instructions.
: But It seems that very trouble. I wonder if I could use the inline
: assembly function to add the extra instructions in to the c code. And
: the complier will generate the corresponding assmbly code. Can the
: compiler do it? Thank you very much.
Yes, it is possible. But instead of adding them to the compiler (GCC),
you add the new instructions to the assembler (GAS) in binutils.
~j
|
|||
|
inline assembly
by Unknown on May 6, 2004 |
Not available! | ||
|
Yes, you can do it with gcc asm statement, without changing gcc or as --
search the mailinng list archive for how to use custom instructions in gcc.
Marko
On Thursday 06 May 2004 10:49, whli_interqos@yahoo.com.hk wrote:
Hi all,
I like to add some additional instructions to the openrisc. Then I may
need to change the complier to generate the added the instructions.
But It seems that very trouble. I wonder if I could use the inline
assembly function to add the extra instructions in to the c code. And
the complier will generate the corresponding assmbly code. Can the
compiler do it? Thank you very much.
Best Regards,
Stephen
_______________________________________________
http://www.opencores.org/mailman/listinfo/openrisc
|
|||
|
inline assembly
by Unknown on May 6, 2004 |
Not available! | ||
|
GCC may support the _emit directive. Also look to see if there is a predefined
pseudo function named something like
__emit__(arg,...)
This is use when multiple arguments are reqired. Borland C++ used this and
the GCC team may have borrowed this from them.
Next I would suggest crafting #define statements that use the _emit or __emit__
directives. Or you can use the asm (_asm) directive to output data and/or instructions.
You must be careful verify that the GCC compiler does not assume involitility of
registers or processor state accross your code. If your code modifies the state
of something that the compiler thinks has not been modified then it is your
responsibility to save and restore those items that the compiler thinks were
not modified. Example, assume FOO is your add-on thingie.
someVar += value;
FOO
otherVar += value;
If on the first statement the compiler placed value into a register (or temporary stack location) and then assumes at the 3rd statement that the register (or temporary stack location) were not modified then if your FOO thingie modifies the register (or temporary stack location) then it is your responsibility to fix it. GCC may have a #pragma directive that performs a "forget compiler temporaries" that will force the compiler to reconstitute it's state.
Have fun,
Jim Dempsey
----- Original Message -----
From: whli_interqos@yahoo.com.hk
To: openrisc@opencores.org
Sent: Thursday, May 06, 2004 3:49 AM
Subject: [openrisc] inline assembly
Hi all,
I like to add some additional instructions to the openrisc. Then I may
need to change the complier to generate the added the instructions.
But It seems that very trouble. I wonder if I could use the inline
assembly function to add the extra instructions in to the c code. And
the complier will generate the corresponding assmbly code. Can the
compiler do it? Thank you very much.
Best Regards,
Stephen
_______________________________________________
http://www.opencores.org/mailman/listinfo/openrisc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.opencores.org/forums/openrisc/attachments/20040506/1b19cd88/attachment.htm
|
|||
1/1

