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