This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
FW: Problem with instruction description
- From: youssef fahmi <yflelion at hotmail dot fr>
- To: <cgen at sourceware dot org>
- Date: Mon, 16 Jan 2012 09:37:07 +0100
- Subject: FW: Problem with instruction description
- References: <SNT142-W25447ECD857E54B6EF0E56A8830@phx.gbl>
Hello,
I am working on the porting of binutils to a new architecture.
This processor has an instruction of the form: ld rx,[r1] + imm6 [load the 32 bit word at the address calculated from the contents of r1 plus the 6 bit immediate value (multiplied by 4) ]
In summary:Â Â rx <- mem[r1 + imm6 * 4]
I need to generate code for this instruction, but only in the case where the code generator in the compiler generates a standard load, but with an offset appropriate for the imm6 value. That is to say the immediate value would be less than 256 and be a multiple of 4 (word access).
This is the description that I am using at the moment:
(dfââ-fÂimm6x4Â"imm6x4" ()
ÂÂÂÂ11Â6ÂUINT
ÂÂ((valueÂpc) (sraÂWIÂvalue (constÂ2)))
ÂÂ((valueÂpc) (sllÂWIÂvalue (constÂ2))))
(dnop imm6x4 "imm6x4" () h-uint f-imm6x4)
(dni ldstack-r1-imm6x4 "ldstack r1#imm6x4"Â Â()Â Â"ld $r1,[r1]+$imm6x4"Â Â(+ (f-stack-opcode #05) r1 imm6x4)Â Â()Â Â()) ÂÂ
However this description causes the "ld rx,[r1] + imm6" to be used whenever the immediate vallue is less than 256, and not JUST when the offset is also a multiple of 4.
How do I alter this description so that it only operates when the immediate value is less than 256 AND ALSO a multiple of 4.
I have already tried.... but this generates code with this instruction in these cases ;;; which are not appropriate.How do I achieve this?Â
I guessÂthatÂI'll haveÂtoÂcreateÂan attribute toÂhandle this, but IÂcould not getÂan attribute thatÂsuits me.ÂisÂthere aÂway to createÂan attributeÂof type integer, for example, butÂwith onlyÂspecificÂintegersÂnotÂnecessarilyÂfollowing.ÂÂ
Thanks in advance Âfor your answer.
Youssef