This is the mail archive of the cgen@sourceware.org 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]
Other format: [Raw text]

Re: [patch][commit] New (if (...) (...) (...)) Test Allowed at Top Level of the Input


Thien-Thi Nguyen wrote:

why not allow computed `include' instead?  (perhaps that is already
supported?)  something like:

(include EXPR)

then EXPR can be all manner of `if', `cond' or whatever. e.g.:

(include (if (application-is? SID-SIMULATOR)
            "sid-macros.cpu"
            "sim-macros.cpu"))

(include (cond ((application-is? SID-SIMULATOR)
               "sid-macros.cpu")
              (else "sim-macros.cpu")))

(include (case (application->symbol APPLICATION-OBJECT)
          ((SIMULATOR) "sid-macros.cpu")
          (else "sid-macros.cpu")))



The point isn't really the (include "..."). That's just what I happened to use the 'if' capability for. The true and false expressions could theoretically be any valid top level CGEN construct. Implementing conditional capability for them all seems like a lot more work for no gain and may not even make sense in some cases. Also 'cond' or 'case' could easily be added as top level tests if necessary.

Dave


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