Mercurial > hg > truffle
comparison src/share/vm/adlc/formssel.cpp @ 14521:29ccc4cbabca
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 12 Mar 2014 13:30:08 +0100 |
parents | abec000618bf |
children | 9e9af3aa4278 4ca6dc0799b6 62c54fcc0a35 |
comparison
equal
deleted
inserted
replaced
14520:f84115370178 | 14521:29ccc4cbabca |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
30 InstructForm::InstructForm(const char *id, bool ideal_only) | 30 InstructForm::InstructForm(const char *id, bool ideal_only) |
31 : _ident(id), _ideal_only(ideal_only), | 31 : _ident(id), _ideal_only(ideal_only), |
32 _localNames(cmpstr, hashstr, Form::arena), | 32 _localNames(cmpstr, hashstr, Form::arena), |
33 _effects(cmpstr, hashstr, Form::arena), | 33 _effects(cmpstr, hashstr, Form::arena), |
34 _is_mach_constant(false), | 34 _is_mach_constant(false), |
35 _needs_constant_base(false), | |
35 _has_call(false) | 36 _has_call(false) |
36 { | 37 { |
37 _ftype = Form::INS; | 38 _ftype = Form::INS; |
38 | 39 |
39 _matrule = NULL; | 40 _matrule = NULL; |
40 _insencode = NULL; | 41 _insencode = NULL; |
41 _constant = NULL; | 42 _constant = NULL; |
42 _opcode = NULL; | 43 _is_postalloc_expand = false; |
43 _size = NULL; | 44 _opcode = NULL; |
44 _attribs = NULL; | 45 _size = NULL; |
45 _predicate = NULL; | 46 _attribs = NULL; |
46 _exprule = NULL; | 47 _predicate = NULL; |
47 _rewrule = NULL; | 48 _exprule = NULL; |
48 _format = NULL; | 49 _rewrule = NULL; |
49 _peephole = NULL; | 50 _format = NULL; |
50 _ins_pipe = NULL; | 51 _peephole = NULL; |
51 _uniq_idx = NULL; | 52 _ins_pipe = NULL; |
52 _num_uniq = 0; | 53 _uniq_idx = NULL; |
53 _cisc_spill_operand = Not_cisc_spillable;// Which operand may cisc-spill | 54 _num_uniq = 0; |
55 _cisc_spill_operand = Not_cisc_spillable;// Which operand may cisc-spill | |
54 _cisc_spill_alternate = NULL; // possible cisc replacement | 56 _cisc_spill_alternate = NULL; // possible cisc replacement |
55 _cisc_reg_mask_name = NULL; | 57 _cisc_reg_mask_name = NULL; |
56 _is_cisc_alternate = false; | 58 _is_cisc_alternate = false; |
57 _is_short_branch = false; | 59 _is_short_branch = false; |
58 _short_branch_form = NULL; | 60 _short_branch_form = NULL; |
59 _alignment = 1; | 61 _alignment = 1; |
60 } | 62 } |
61 | 63 |
62 InstructForm::InstructForm(const char *id, InstructForm *instr, MatchRule *rule) | 64 InstructForm::InstructForm(const char *id, InstructForm *instr, MatchRule *rule) |
63 : _ident(id), _ideal_only(false), | 65 : _ident(id), _ideal_only(false), |
64 _localNames(instr->_localNames), | 66 _localNames(instr->_localNames), |
65 _effects(instr->_effects), | 67 _effects(instr->_effects), |
66 _is_mach_constant(false), | 68 _is_mach_constant(false), |
69 _needs_constant_base(false), | |
67 _has_call(false) | 70 _has_call(false) |
68 { | 71 { |
69 _ftype = Form::INS; | 72 _ftype = Form::INS; |
70 | 73 |
71 _matrule = rule; | 74 _matrule = rule; |
72 _insencode = instr->_insencode; | 75 _insencode = instr->_insencode; |
73 _constant = instr->_constant; | 76 _constant = instr->_constant; |
74 _opcode = instr->_opcode; | 77 _is_postalloc_expand = instr->_is_postalloc_expand; |
75 _size = instr->_size; | 78 _opcode = instr->_opcode; |
76 _attribs = instr->_attribs; | 79 _size = instr->_size; |
77 _predicate = instr->_predicate; | 80 _attribs = instr->_attribs; |
78 _exprule = instr->_exprule; | 81 _predicate = instr->_predicate; |
79 _rewrule = instr->_rewrule; | 82 _exprule = instr->_exprule; |
80 _format = instr->_format; | 83 _rewrule = instr->_rewrule; |
81 _peephole = instr->_peephole; | 84 _format = instr->_format; |
82 _ins_pipe = instr->_ins_pipe; | 85 _peephole = instr->_peephole; |
83 _uniq_idx = instr->_uniq_idx; | 86 _ins_pipe = instr->_ins_pipe; |
84 _num_uniq = instr->_num_uniq; | 87 _uniq_idx = instr->_uniq_idx; |
85 _cisc_spill_operand = Not_cisc_spillable;// Which operand may cisc-spill | 88 _num_uniq = instr->_num_uniq; |
86 _cisc_spill_alternate = NULL; // possible cisc replacement | 89 _cisc_spill_operand = Not_cisc_spillable; // Which operand may cisc-spill |
87 _cisc_reg_mask_name = NULL; | 90 _cisc_spill_alternate = NULL; // possible cisc replacement |
88 _is_cisc_alternate = false; | 91 _cisc_reg_mask_name = NULL; |
89 _is_short_branch = false; | 92 _is_cisc_alternate = false; |
90 _short_branch_form = NULL; | 93 _is_short_branch = false; |
91 _alignment = 1; | 94 _short_branch_form = NULL; |
95 _alignment = 1; | |
92 // Copy parameters | 96 // Copy parameters |
93 const char *name; | 97 const char *name; |
94 instr->_parameters.reset(); | 98 instr->_parameters.reset(); |
95 for (; (name = instr->_parameters.iter()) != NULL;) | 99 for (; (name = instr->_parameters.iter()) != NULL;) |
96 _parameters.addName(name); | 100 _parameters.addName(name); |
153 } | 157 } |
154 | 158 |
155 // This instruction has an expand rule? | 159 // This instruction has an expand rule? |
156 bool InstructForm::expands() const { | 160 bool InstructForm::expands() const { |
157 return ( _exprule != NULL ); | 161 return ( _exprule != NULL ); |
162 } | |
163 | |
164 // This instruction has a late expand rule? | |
165 bool InstructForm::postalloc_expands() const { | |
166 return _is_postalloc_expand; | |
158 } | 167 } |
159 | 168 |
160 // This instruction has a peephole rule? | 169 // This instruction has a peephole rule? |
161 Peephole *InstructForm::peepholes() const { | 170 Peephole *InstructForm::peepholes() const { |
162 return _peephole; | 171 return _peephole; |
637 if( strcmp(_matrule->_opType,"MemBarRelease") == 0 ) return true; | 646 if( strcmp(_matrule->_opType,"MemBarRelease") == 0 ) return true; |
638 if( strcmp(_matrule->_opType,"MemBarAcquire") == 0 ) return true; | 647 if( strcmp(_matrule->_opType,"MemBarAcquire") == 0 ) return true; |
639 if( strcmp(_matrule->_opType,"MemBarReleaseLock") == 0 ) return true; | 648 if( strcmp(_matrule->_opType,"MemBarReleaseLock") == 0 ) return true; |
640 if( strcmp(_matrule->_opType,"MemBarAcquireLock") == 0 ) return true; | 649 if( strcmp(_matrule->_opType,"MemBarAcquireLock") == 0 ) return true; |
641 if( strcmp(_matrule->_opType,"MemBarStoreStore") == 0 ) return true; | 650 if( strcmp(_matrule->_opType,"MemBarStoreStore") == 0 ) return true; |
651 if( strcmp(_matrule->_opType,"StoreFence") == 0 ) return true; | |
652 if( strcmp(_matrule->_opType,"LoadFence") == 0 ) return true; | |
642 | 653 |
643 return false; | 654 return false; |
644 } | 655 } |
645 | 656 |
646 int InstructForm::memory_operand(FormDict &globals) const { | 657 int InstructForm::memory_operand(FormDict &globals) const { |
1267 fprintf(fp, "char reg[128]; ra->dump_register(in(mach_constant_base_node_input()), reg);\n"); | 1278 fprintf(fp, "char reg[128]; ra->dump_register(in(mach_constant_base_node_input()), reg);\n"); |
1268 fprintf(fp, " st->print(\"%%s\", reg);\n"); | 1279 fprintf(fp, " st->print(\"%%s\", reg);\n"); |
1269 return; | 1280 return; |
1270 } | 1281 } |
1271 if (strcmp(rep_var, "constantoffset") == 0) { | 1282 if (strcmp(rep_var, "constantoffset") == 0) { |
1272 fprintf(fp, "st->print(\"#%%d\", constant_offset());\n"); | 1283 fprintf(fp, "st->print(\"#%%d\", constant_offset_unchecked());\n"); |
1273 return; | 1284 return; |
1274 } | 1285 } |
1275 if (strcmp(rep_var, "constantaddress") == 0) { | 1286 if (strcmp(rep_var, "constantaddress") == 0) { |
1276 fprintf(fp, "st->print(\"constant table base + #%%d\", constant_offset());\n"); | 1287 fprintf(fp, "st->print(\"constant table base + #%%d\", constant_offset_unchecked());\n"); |
1277 return; | 1288 return; |
1278 } | 1289 } |
1279 | 1290 |
1280 // Find replacement variable's type | 1291 // Find replacement variable's type |
1281 const Form *form = _localNames[rep_var]; | 1292 const Form *form = _localNames[rep_var]; |
4043 } | 4054 } |
4044 | 4055 |
4045 bool MatchRule::is_ideal_membar() const { | 4056 bool MatchRule::is_ideal_membar() const { |
4046 if( !_opType ) return false; | 4057 if( !_opType ) return false; |
4047 return | 4058 return |
4048 !strcmp(_opType,"MemBarAcquire" ) || | 4059 !strcmp(_opType,"MemBarAcquire") || |
4049 !strcmp(_opType,"MemBarRelease" ) || | 4060 !strcmp(_opType,"MemBarRelease") || |
4050 !strcmp(_opType,"MemBarAcquireLock") || | 4061 !strcmp(_opType,"MemBarAcquireLock") || |
4051 !strcmp(_opType,"MemBarReleaseLock") || | 4062 !strcmp(_opType,"MemBarReleaseLock") || |
4052 !strcmp(_opType,"MemBarVolatile" ) || | 4063 !strcmp(_opType,"LoadFence" ) || |
4053 !strcmp(_opType,"MemBarCPUOrder" ) || | 4064 !strcmp(_opType,"StoreFence") || |
4054 !strcmp(_opType,"MemBarStoreStore" ); | 4065 !strcmp(_opType,"MemBarVolatile") || |
4066 !strcmp(_opType,"MemBarCPUOrder") || | |
4067 !strcmp(_opType,"MemBarStoreStore"); | |
4055 } | 4068 } |
4056 | 4069 |
4057 bool MatchRule::is_ideal_loadPC() const { | 4070 bool MatchRule::is_ideal_loadPC() const { |
4058 if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) { | 4071 if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) { |
4059 return (strcmp(_rChild->_opType,"LoadPC") == 0); | 4072 return (strcmp(_rChild->_opType,"LoadPC") == 0); |