General notes:
  * Not really attempting to be exhaustive just yet -- only want
    to get the most significant ones done in this pass.
  * Avoid "set" -- use "bind" or "assign" if that's what we're really doing.
    Or, if we want to keep "set", make sure it always means "bind".
  * A suffix of _i, _n, or _s generally denotes an int/num/str version
    of the opcode.  Stick to lowercase letters here...
  * ... except that bigints might be a _I suffix  :-)
  * Perhaps reserve _b for a boolean native type
  * Might want to reserve _l and _h for "native" list/hash versions of opcodes
  * Might want to reserve _o for object/instance versions of opcodes
  * aim for consistency with underscores and the like
    (i.e., unlike parrot, don't mix "get_foo" and "getbar")
  * Use the p6-defined terms where possible (e.g., "elems" and "chars"
    instead of "elements" and "length")
  * Generally return an appropriate argument instead of void
  * Items marked (?) mean that the opcode itself might be questionable
    for inclusion in the set.

(Updated for QAST, 2012-07-29 by pmichaud)

  control opcodes:
    nqp::if(test, iftrue, iffalse)
    nqp::unless(test, iffalse, iftrue)
    nqp::ifnull(val, valifnull)
    nqp::defor(val, valifundef)
    nqp::while(test, body)
    nqp::until(test, body)
    nqp::repeat_while(test, body)
    nqp::repeat_until(test, body)
    nqp::loop(init, test, next, body)
    nqp::for(list, body [, next])
    nqp::stmts(stmt0, stmt1, ...)
    nqp::throw                     pir::throw__0P
    nqp::rethrow                   pir::rethrow__0P
    nqp::die                       pir::die__0P
    nqp::die_s                     pir::die__0s
    nqp::exit                      pir::exit__vi
    nqp::sleep                     pir::sleep__vn
    (need ops to fetch caller, outer, context, etc?)

  binding opcodes:
    nqp::bind(var, value)

  I/O:
    nqp::print                     pir::print
    nqp::say                       pir::say
    nqp::stat                      pir::stat__Isi
    nqp::open                      pir::open__Pss

  arithmetic:
    nqp::add_i                     pir::add__Iii
    nqp::add_n                     pir::add__Nnn
    nqp::add_I
    ...etc...
    nqp::isnanorinf

  string:
    nqp::chars                     pir::length__Is
    nqp::concat                    pir::concat__Sss
    nqp::concat_s                  pir::concat__Sss
    nqp::join                      pir::join__SsP
    nqp::x                         pir::repeat__Ssi
    nqp::substr                    pir::substr__Ssii
    nqp::lc                        pir::downcase__Ss
    nqp::uc                        pir::upcase__Ss
    nqp::index                     pir::index__Issi
    nqp::chr                       pir::chr__Si
    nqp::ord                       pir::ord__Si
    nqp::chars                     pir::length__Is
    nqp::split                     pir::split__Pss
    nqp::iscclass                  pir::iscclass__Isii          (?)
    nqp::findcclass                pir::find_cclass__Iisii      (?)
    nqp::findnotcclass             pir::find_not_cclass__Iisii  (?)

  relational:
    nqp::iseq_i                    pir::iseq__Iii
    nqp::iseq_n                    pir::iseq__Inn
    nqp::iseq_s                    pir::iseq__Iss
    nqp::iseq_I
    ...etc...

  aggregate:
    nqp::list(item0, item1, ...)   create a low-level list
    nqp::qlist(item0, item1, ...)  temporary for QRPA
    nqp::list_i(int0, int1, ...)   create a low-level integer list
    nqp::list_s(str0, str1, ...)   create a low-level string list
    nqp::hash(key0, val0, ...)     create a low-level hash

    nqp::pop                       pir::pop__PP
    nqp::push                      pir::push__0PP
    nqp::push_s                    pir::push__0Ps
    nqp::shift                     pir::shift__PP
    nqp::unshift                   pir::unshift__0PP
    nqp::splice                    pir::splice__0PPii
    nqp::bindpos                   pir::set__1QiP
    nqp::bindkey                   pir::set__1QsP
    nqp::atpos                     pir::set__PQi
    nqp::atkey                     pir::set__PQs
    nqp::existpos                  pir::exists__IQi
    nqp::existkey                  pir::exists__IQs
    nqp::deletekey                 pir::delete__0Qs
    nqp::elems                     pir::elements__IP

  object:
    nqp::bindattribute             pir::setattribute__0PPsP
    nqp::getattribute              pir::getattribute__PPPs
    nqp::findmethod                pir::find_method__PPs        (?)
    nqp::can                       pir::can__IPs                (?)
    nqp::null                      pir::null__P
    nqp::isnull                    pir::isnull__IP
    nqp::defined                   pir::defined__IP
    nqp::istrue                    pir::istrue__IP
    nqp::clone                     pir::clone__PP
    nqp::typecheck or ::isa        pir::type_check__IPP
                   or ::istype
    nqp::??                        pir::isa__IPs                (reject)
    nqp::??                        pir::typeof__SP              (reject)
    nqp::??                        pir::does__IPs               (reject)
    nqp::create                    pir::repr_instance_of__PP

    nqp::unbox_i                   pir::repr_unbox_int__IP
    nqp::unbox_n                   pir::repr_unbox_num__NP
    nqp::unbox_s                   pir::repr_unbox_str__SP
    nqp::box_i                     pir::repr_box_int__PPi
    nqp::box_n                     pir::repr_box_num__PPn
    nqp::box_s                     pir::repr_box_str__PPs
    nqp::what  or nqp::getwhat     pir::get_what__PP
    nqp::how   or nqp::gethow      pir::get_how__PP
    nqp::who   or nqp::getwho      pir::get_who__PP
    nqp::where                     pir::get_id__IP

  Rakudo-specific:
    nqp::p6box_i                   pir::perl6_box_int__Pi
    nqp::p6box_n                   pir::perl6_box_num__Pn
    nqp::p6box_s                   pir::perl6_box_str__Ps
    nqp::p6iscontainer             pir::is_container__IP
    nqp::??   (::p6capturepos?)    pir::perl6_current_args__P
    nqp::p6assign or ::p6store     pir::perl6_container_store__0PP
    nqp::p6bool or ::p6box_b       pir::perl6_booleanize__PI
    nqp::p6list_a                  pir::perl6_list_from_rpa__PPPP
    nqp::p6iter_a                  pir::perl6_iter_from_rpa__PPP

  STable ops (?)
    ...??...

  Debugging
    nqp::deb


nqp::deb(flags, msg)
    The nqp::deb opcode provides access into NQP's debug log mechanism.
    The opcode takes a flag selector argument and a string to be logged.

    The C<flags> are arranged as a bit field that are bitwise-anded
    with the current debugging level flag to determine if the string
    should be computed and logged.  The lower bits of the flag form
    a bitmask that determins the type of event being logged
    are a bitmask determining the type of event 
    determine the type of event being logged:

      Bits   (values)     Event
      0-3     0x0f        open for user programs and short-term debugging
       4      0x10        subroutine entry/exit
       5      0x20        regex events
       6      0x40        compiler events
       7      0x80        library/setting events
      8-27    0x0fffff00  reserved

    The top nibble of the flag is used to further filter event
    logging.  Bits 28 and 29 combine to form a "detail level"
    filter with levels 0 (lowest) to 3 (highest).  Thus a nqp::deb()
    call can specify both the type of event and the level of detail:
        nqp::deb(0x10, '...')         # ordinary sub event
        nqp::deb(0x10000010, '...')   # sub event at detail level 1
        nqp::deb(0x20000020, '...')   # regex event at detail level 2
        nqp::deb(0x30000090, '...')   # library+sub event at detail level 3
    Events at the higher levels of detail are logged only if the
    global flag selector requests those higher levels of detail.

    Bits 30 and 31 are reserved for future use; it's speculated that
    4 levels of detail will be sufficient but if we need more we can
    grab bit 30 for that.

    The C<msg> argument is the string to be logged.  Within the message
    string, '%sub%' will be replaced with the identity (name and subid)
    of the currently executing sub, and '%caller%' will be replaced
    with the identity of the current sub's caller.

    The HLL::Compiler class (and its subclasses) support a 
    --nqpevent="logfile;level" option that enables event and debug
    logging.  C<logfile> specifies a file where events are to
    be logged; if omitted, the standard error is used.  The C<level>
    specifies the global debug flag, if omitted it defaults to 31 (0x1f),
    which displays all user-level debug events and subroutine events
    at detail level 0.  (Currently the option handler can only handle
    decimal values for the detail level; this will be fixed to accept
    '0x...' hex values soon.)


