Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1014)

Side by Side Diff: src/trusted/validator/x86/decoder/ncopcode_desc_verbose.c

Issue 7980021: Speed up x86-64 validator by inlining heavily called routines. Speeds up (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* Descriptors to model instructions, opcodes, and instruction operands. */ 7 /* Descriptors to model instructions, opcodes, and instruction operands. */
8 8
9 #include "native_client/src/trusted/validator/x86/decoder/ncopcode_desc.h" 9 #include "native_client/src/trusted/validator/x86/decoder/ncopcode_desc.h"
10 10
11 #include <assert.h> 11 #include <assert.h>
12 #include <string.h> 12 #include <string.h>
13 13
14 #include "native_client/src/trusted/validator/x86/decoder/ncopcode_desc_inl.h"
14 #include "native_client/src/trusted/validator/x86/decoder/nc_decode_tables.h" 15 #include "native_client/src/trusted/validator/x86/decoder/nc_decode_tables.h"
15 16
16 void NaClInstPrint(struct Gio* f, 17 void NaClInstPrint(struct Gio* f,
17 const NaClDecodeTables* tables, 18 const NaClDecodeTables* tables,
18 const NaClInst* inst) { 19 const NaClInst* inst) {
19 { /* Print out instruction type less the NACLi_ prefix. */ 20 { /* Print out instruction type less the NACLi_ prefix. */
20 const char* name = NaClInstTypeString(inst->insttype); 21 const char* name = NaClInstTypeString(inst->insttype);
21 gprintf(f, "%s ", name + strlen("NACLi_")); 22 gprintf(f, "%s ", name + strlen("NACLi_"));
22 } 23 }
23 if (inst->flags) NaClIFlagsPrint(f, inst->flags); 24 if (inst->flags) NaClIFlagsPrint(f, inst->flags);
24 gprintf(f, "\n"); 25 gprintf(f, "\n");
25 26
26 /* If instruction type is invalid, and doesn't have 27 /* If instruction type is invalid, and doesn't have
27 * special translation purposes, then don't print additional 28 * special translation purposes, then don't print additional
28 * (ignored) information stored in the modeled instruction. 29 * (ignored) information stored in the modeled instruction.
29 */ 30 */
30 if ((NACLi_INVALID != inst->insttype) || 31 if ((NACLi_INVALID != inst->insttype) ||
31 ((inst->flags & NACL_IFLAG(Opcode0F0F)))) { 32 ((inst->flags & NACL_IFLAG(Opcode0F0F)))) {
32 Bool is_first = TRUE; 33 Bool is_first = TRUE;
33 int i; 34 int i;
34 gprintf(f, " %s", NaClMnemonicName(inst->name)); 35 gprintf(f, " %s", NaClMnemonicName(inst->name));
35 for (i = 0; i < inst->num_operands; ++i) { 36 for (i = 0; i < inst->num_operands; ++i) {
36 const NaClOp* op = NaClGetInstOperand(tables, inst, i); 37 const NaClOp* op = NaClGetInstOperandInline(tables, inst, i);
37 if (NULL == op->format_string) continue; 38 if (NULL == op->format_string) continue;
38 if (is_first) { 39 if (is_first) {
39 is_first = FALSE; 40 is_first = FALSE;
40 } else { 41 } else {
41 gprintf(f, ","); 42 gprintf(f, ",");
42 } 43 }
43 gprintf(f, " %s", op->format_string); 44 gprintf(f, " %s", op->format_string);
44 } 45 }
45 gprintf(f, "\n"); 46 gprintf(f, "\n");
46 /* Now print actual encoding of each operand. */ 47 /* Now print actual encoding of each operand. */
47 for (i = 0; i < inst->num_operands; ++i) { 48 for (i = 0; i < inst->num_operands; ++i) {
48 gprintf(f, " "); 49 gprintf(f, " ");
49 NaClOpPrint(f, NaClGetInstOperand(tables, inst, i)); 50 NaClOpPrint(f, NaClGetInstOperand(tables, inst, i));
50 } 51 }
51 } 52 }
52 } 53 }
54
55 /* Dummy routine to allow unreferenced NaClGetInstNumberOperandsInline
56 * inline.
57 */
58 uint8_t NaClNcopcodeDescVerboseDummyNaClGetInstNumberOperands(
59 const NaClInst* inst) {
60 return NaClGetInstNumberOperandsInline(inst);
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698