This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Derived Operands


I am trying to use derived operands.  I know that they are still a work in
progress, but this is functionality that will help me with the CPU that I
am porting with CGEN.

Following is a snippet of code:

...

; Derived operands
(define-derived-operand
   (name m3-dst-reg-direct)
   (comment "m3 dst reg direct")
   (mode UINT)
   (args (m3-dst-reg))
   (syntax "${m3-dst-reg}")
   (base-ifield f-m3-dst-operand)
   (encoding (+ m3-dst-reg))
   (getter ())
   (setter (set newval (const #b000)))
)

(define-derived-operand
   (name m3-dst-reg-indirect)
   (comment "m3 dst reg indirect")
   (mode UINT)
   (args (m3-dst-reg))
   (syntax "${m3-dst-reg}")
   (base-ifield f-m3-dst-operand)
   (encoding (+ m3-dst-reg))
   (getter ())
   (setter (set newval (const #b001)))
)

(define-anyof-operand
   (name m3-dst-operand)
   (comment "This is any of the m3 dst operands.")
   (mode UINT)
   (base-ifield f-m3-dst-operand)
   (choices m3-dst-reg-direct m3-dst-reg-indirect)
)

...

(define-insn
   (name mov)
   (syntax "mov ${m3-src-reg},${m3-dst-operand}")
   (format (+ OP1_7 OP2_8 (f-byte-operation 0) m3-src-reg m3-dst-operand))
   (semantics (set m3-dst-operand m3-src-reg))
)

I am receiving the following error when trying to generate <arch>-opinst.c
for the instruction that uses the anyof-operand.

10* [map #<procedure (insn)> (#(# #) #(# #) #(# #) ...)]
11* [#<procedure (insn)> #(#("object" # mov ...) (# #f # ...))]
12* [gen-obj-sanitize #(#("object" # mov ...) (# #f # ...)) ...
13* [string-append "  & " ...
14* [gen-sym #:unbound]
15  [gen-c-symbol ...
16* [obj:name #:unbound]
17  [send #:unbound get-name]
18* [-object-check #:unbound "send"]
19* (if (not (object? maybe-object)) (apply -object-error (append! #
extra-text)))
20  [apply #<procedure -object-error (proc-name x . text)> ("send"
#:unbound "not an object")]
    ...
21  [error "send: not an object" #:unbound]

./cos.scm:256:3: In procedure error in expression (error (string-append
proc-name ": " ...) x):
./cos.scm:256:3: send: not an object #:unbound
ABORT: (misc-error)

Any ideas where the problem might be?

Also, as a side note, is there any timeframe for when derived operands will
be completed?

Tracy




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]