Hi all,
I am a newbie to GCC, but have long wanted to work with it. So I got
the chance to work on it with a research project, what I am trying to
do is add a custom backend to the GCC framework through machine
descriptions. I got the release sources (not from the SVN repository,
4.3.3), and followed the instructions on how to configure and build
it, it went fine. Right now I am building a native compiler on a x86
machine (pentium 4 with HT... very slow I know...).
I did:
configure -prefix=somewhere/gccinstall
So now I need to confirm the changes made to the machine descriptions
are actually built into the binaries of my compile, what I am trying
to do is:
Sorry I gabble on about alot of details here, the question is at the
very end of this post.
step 1. modify a x86 instruction to give me a fictional assembly (I
modified the "call" instruction into "callz")
step 2. build GCC stage 1
step 3. use GCC stage 1 to compile a program that would use this
modified instruction
----------
step 1. modify a x86 instruction to give me a fictional assembly (I
modified the "call" instruction into "callz")
heres the specific code from i386.md
(define_insn "*call_value_0"
[(set (match_operand 0 "" "")
(call (mem:QI (match_operand:SI 1 "constant_call_address_
operand" ""))
(match_operand:SI 2 "" "")))]
"!TARGET_64BIT"
{
if (SIBLING_CALL_P (insn))
return "jmp\t%P1";
else
return "call\t%P1"; <---------- i modified this to return
"callz\t%P1";
}
[(set_attr "type" "callv")])
I realise this change would obviously break the compiler, so that is
why I'm thinking of using stage 1 to confirm of the presence of this
callz instruction.
AFAIK stage 1 is built with the compiler already in the system, please
correct me if I made a gross error on this one...
step 2. build GCC stage 1
so I did:
in the build directory: make all-stage1 -j2
this gives me a lot of warnings, eg:
warning: format not a string literal and no format arguments
warning: ignoring return value of ‘write’, declared with attribute
warn_unused_result
... and a lot more, this occurs with the pristine source too.
but most importantly, it used the "callz" instruction:
/tmp/ccshjbUO.s: Assembler messages:
/tmp/ccshjbUO.s:41: Error: no such instruction: `callz __fixunss...@plt'
/tmp/ccshjbUO.s:53: Error: no such instruction: `callz __fixunss...@plt'
make[1]: *** [_fixsfdi.o] Error 1
make[1]: *** Waiting for unfinished jobs....
then it finally fails.
Did I misunderstand what GCC stage 1 is and what I am trying to do is
simply not feasible?
What should I do to test out simple .md modifications?
Any help would be greatly appreciated!!
Thanks in advance!
David.