duke@435: /* duke@435: * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * duke@435: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: * CA 95054 USA or visit www.sun.com if you need additional information or duke@435: * have any questions. duke@435: * duke@435: */ duke@435: duke@435: class AllocateNode; duke@435: class AllocateArrayNode; duke@435: class CallNode; duke@435: class Node; duke@435: class PhaseIterGVN; duke@435: duke@435: class PhaseMacroExpand : public Phase { duke@435: private: duke@435: PhaseIterGVN &_igvn; duke@435: duke@435: // Helper methods roughly modelled after GraphKit: duke@435: Node* top() const { return C->top(); } duke@435: Node* intcon(jint con) const { return _igvn.intcon(con); } duke@435: Node* longcon(jlong con) const { return _igvn.longcon(con); } duke@435: Node* makecon(const Type *t) const { return _igvn.makecon(t); } duke@435: Node* basic_plus_adr(Node* base, int offset) { duke@435: return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset)); duke@435: } duke@435: Node* basic_plus_adr(Node* base, Node* ptr, int offset) { duke@435: return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset)); duke@435: } duke@435: Node* basic_plus_adr(Node* base, Node* offset) { duke@435: return basic_plus_adr(base, base, offset); duke@435: } duke@435: Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) { duke@435: Node* adr = new (C, 4) AddPNode(base, ptr, offset); duke@435: return transform_later(adr); duke@435: } duke@435: Node* transform_later(Node* n) { duke@435: // equivalent to _gvn.transform in GraphKit, Ideal, etc. duke@435: _igvn.register_new_node_with_optimizer(n); duke@435: return n; duke@435: } duke@435: void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr); duke@435: Node* make_load( Node* ctl, Node* mem, Node* base, int offset, duke@435: const Type* value_type, BasicType bt); duke@435: Node* make_store(Node* ctl, Node* mem, Node* base, int offset, duke@435: Node* value, BasicType bt); duke@435: duke@435: // projections extracted from a call node duke@435: ProjNode *_fallthroughproj; duke@435: ProjNode *_fallthroughcatchproj; duke@435: ProjNode *_ioproj_fallthrough; duke@435: ProjNode *_ioproj_catchall; duke@435: ProjNode *_catchallcatchproj; duke@435: ProjNode *_memproj_fallthrough; duke@435: ProjNode *_memproj_catchall; duke@435: ProjNode *_resproj; duke@435: duke@435: duke@435: void expand_allocate(AllocateNode *alloc); duke@435: void expand_allocate_array(AllocateArrayNode *alloc); duke@435: void expand_allocate_common(AllocateNode* alloc, duke@435: Node* length, duke@435: const TypeFunc* slow_call_type, duke@435: address slow_call_address); duke@435: void eliminate_locking_node(AbstractLockNode *alock); duke@435: void expand_lock_node(LockNode *lock); duke@435: void expand_unlock_node(UnlockNode *unlock); duke@435: duke@435: int replace_input(Node *use, Node *oldref, Node *newref); duke@435: void copy_call_debug_info(CallNode *oldcall, CallNode * newcall); duke@435: Node* opt_iff(Node* region, Node* iff); duke@435: void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call); duke@435: CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call, duke@435: const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1); duke@435: void extract_call_projections(CallNode *call); duke@435: duke@435: Node* initialize_object(AllocateNode* alloc, duke@435: Node* control, Node* rawmem, Node* object, duke@435: Node* klass_node, Node* length, duke@435: Node* size_in_bytes); duke@435: duke@435: Node* prefetch_allocation(Node* i_o, duke@435: Node*& needgc_false, Node*& contended_phi_rawmem, duke@435: Node* old_eden_top, Node* new_eden_top, duke@435: Node* length); duke@435: duke@435: public: duke@435: PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn) {} duke@435: bool expand_macro_nodes(); duke@435: duke@435: };