This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
PATCH: Only fetch "normal" instruction chunk sizes
- From: Jim Blandy <jimb at redhat dot com>
- To: cgen at sources dot redhat dot com
- Date: 16 May 2005 20:42:24 -0500
- Subject: PATCH: Only fetch "normal" instruction chunk sizes
I've committed this. The comments in the code are supposed to explain
why the code should be this way; if it's not clear, let me know.
2005-05-13 Jim Blandy <jimb@redhat.com>
* sid.scm (gen-ifetch): Require BITSIZE to be exactly the size
fetched by one of our GETIMEM* methods.
* utils-gen.scm (-extract-chunk-specs): Always fetch full
base-insn-sized chunks.
Index: cgen/sid.scm
===================================================================
RCS file: /cvs/cvsfiles/devo/cgen/sid.scm,v
retrieving revision 1.60.4.1
diff -c -p -r1.60.4.1 sid.scm
*** cgen/sid.scm 6 Apr 2005 23:42:15 -0000 1.60.4.1
--- cgen/sid.scm 13 May 2005 07:53:55 -0000
***************
*** 173,178 ****
--- 173,185 ----
; Return C code to fetch a value from instruction memory.
; PC-VAR is the C expression containing the address of the start of the
; instruction.
+ ;
+ ; We don't bother trying to handle bitsizes that don't have a
+ ; corresponding GETIMEM method. Doing so would require us to take
+ ; endianness into account just to ensure that the requested bits end
+ ; up at the proper place in the result. It's easier just to make the
+ ; caller ask us for something we can do directly.
+ ;
; ??? Aligned/unaligned support?
(define (gen-ifetch pc-var bitoffset bitsize)
***************
*** 180,186 ****
(case bitsize
((8) "UQI")
((16) "UHI")
- ((24) "USI")
((32) "USI")
(else (error "bad bitsize argument to gen-ifetch" bitsize)))
" (pc, "
--- 187,192 ----
Index: cgen/utils-gen.scm
===================================================================
RCS file: /cvs/cvsfiles/devo/cgen/utils-gen.scm,v
retrieving revision 1.22
diff -c -p -r1.22 utils-gen.scm
*** cgen/utils-gen.scm 21 Feb 2005 09:06:22 -0000 1.22
--- cgen/utils-gen.scm 13 May 2005 07:53:55 -0000
***************
*** 308,314 ****
(reverse! result)
(loop (+ start chunk-length)
(- remaining chunk-length)
! (cons (cons start (min chunk-length remaining))
result)))))
)
--- 308,319 ----
(reverse! result)
(loop (+ start chunk-length)
(- remaining chunk-length)
! ; Always fetch full CHUNK-LENGTH-sized chunks here,
! ; even if we don't actually need that many bytes.
! ; gen-ifetch only handles "normal" fetch sizes,
! ; and -gen-extract-word already knows how to find what
! ; it needs if we give it too much.
! (cons (cons start chunk-length)
result)))))
)