DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (5216dd412535)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * vim: set ts=8 sw=4 et tw=0 ft=c:
 *
 * ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is SpiderMonkey nanojit.
 *
 * The Initial Developer of the Original Code is
 * the Mozilla Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2009
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Nicholas Nethercote <nnethercote@mozilla.com>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either of the GNU General Public License Version 2 or later (the "GPL"),
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

/* LIns classes, as required for --random mode.  Includers must define a CL___
 * macro of the following form:
 *
 * #define CL___(name, only64bit, relFreq)     ...
 *
 * Selected arguments can be used within the macro expansions.
 *
 * Field        Description
 * -----        -----------
 * name         Name of the instruction class.  The types are B (boolean), I
 *              (32-bit integer), Q (64-bit integer), F (64-bit float), N
 *              (null).  A name of the form LOP_Z_XY means that it takes
 *              arguments of type X and Y and produces a result of type Z.
 *
 * relFreq      We weight each class differently, so that some classes are more
 *              common than others.  This field gives the relative frequency of
 *              the instruction class.  All the relFreqs together can sum up to
 *              any number, but it's easier to think about if the sum is a
 *              round number.  (That's why the relFreqs add up to 100%;  the
 *              running total is shown in comments.)  The sum also shouldn't be
 *              too big, as we generate a table with that many elements in it.
 *
 *              Note that we want a decent number of value sinks (eg.
 *              stores, calls, guards) and not too many value sources (eg.
 *              immediates, loads) so that the amount of dead code generated is
 *              reasonable.
 *
 * Because certain opcode classes aren't supported on all platforms, CLxyz must be one
 * of the following:
 *
 *   CL___: for opcode classes supported on all platforms.
 *   CL_64: for opcode classes supported only on 64-bit platforms.
 */

#ifdef NANOJIT_64BIT
#   define CL_64(a, b)      CL___(a, b)
#else
#   define CL_64(a, b)
#endif


CL___(  LFENCE,         1)  //  1%  LIR_regfence, LIR_xbarrier

CL___(  LALLOC,         1)  //  2%  LIR_alloc

CL___(  LIMM_I,         4)  //  6%  LIR_imm
CL_64(  LIMM_Q,         3)  //  9%  LIR_quad
CL___(  LIMM_D,         3)  // 12%  LIR_float

CL___(  LOP_I_I,        2)  // 14%  LIR_neg, LIR_not
CL_64(  LOP_Q_Q,        0)  // 14%  (none)
CL___(  LOP_D_D,        2)  // 16%  LIR_fneg

CL___(  LOP_I_II,       6)  // 32%  LIR_add, LIR_and, LIR_eq, etc.
CL_64(  LOP_Q_QQ,       7)  // 39%  LIR_qiadd, LIR_qiand, LIR_qeq, etc.
CL_64(  LOP_Q_QI,       2)  // 41%  LIR_qilsh, LIR_qirsh, LIR_qursh
CL___(  LOP_D_DD,       0)  // 51%  LIR_fadd, etc.

// cmov has a low weight because is also used with LIR_div/LIR_mod.
CL___(  LOP_I_BII,      1)  // 52%  LIR_cmovi
CL_64(  LOP_Q_BQQ,      1)  // 53%  LIR_cmovq
CL___(  LOP_D_BDD,      1)  // 54%  LIR_cmovd

CL___(  LOP_B_II,       3)  // 57%  LIR_eq,  LIR_lt,  etc
CL_64(  LOP_B_QQ,       3)  // 60%  LIR_qeq, LIR_qlt, etc
CL___(  LOP_B_DD,       3)  // 63%  LIR_feq, LIR_flt, etc

CL_64(  LOP_Q_I,        1)  // 64%  LIR_i2q, LIR_u2q
CL___(  LOP_D_I,        1)  // 65%  LIR_i2f, LIR_u2f
CL_64(  LOP_I_Q,        1)  // 66%  LIR_q2i
CL___(  LOP_I_D,        1)  // 67%  LIR_qlo, LIR_qhi, LIR_f2i
CL_64(  LOP_Q_D,        1)  // 68%  LIR_dasq
CL_64(  LOP_D_Q,        1)  // 69%  LIR_qasd
CL___(  LOP_D_II,       1)  // 70%  LIR_qjoin

CL___(  LLD_I,          3)  // 73%  LIR_ld, LIR_ldc, LIR_ld*b, LIR_ld*s
CL_64(  LLD_Q,          2)  // 75%  LIR_ldq, LIR_ldqc
CL___(  LLD_D,          3)  // 78%  LIR_ldf, LIR_ldfc

CL___(  LST_I,          5)  // 83%  LIR_sti
CL_64(  LST_Q,          4)  // 87%  LIR_stqi
CL___(  LST_D,          5)  // 92%  LIR_stfi

CL___(  LCALL_I_I1,     1)  // 93%  LIR_icall
CL___(  LCALL_I_I6,     1)  // 94%  LIR_icall
CL_64(  LCALL_Q_Q2,     1)  // 95%  LIR_qcall
CL_64(  LCALL_Q_Q7,     1)  // 96%  LIR_qcall
CL___(  LCALL_D_D3,     1)  // 97%  LIR_fcall
CL___(  LCALL_D_D8,     1)  // 98%  LIR_fcall
CL_64(  LCALL_V_IQD,    1)  // 99%  LIR_icall or LIR_qcall

CL___(  LLABEL,         1)  //100%  LIR_label


#undef CL_64