formsopt.cpp revision 0
0N/A * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A//==============================Register Allocation============================ 0N/A//------------------------------RegisterForm----------------------------------- 0N/A// record a new register definition 0N/A// record a new register class 0N/A// record a new register class 0N/A// Called after parsing the Register block. Record the register class 0N/A // Stack slots start at the next available even register number. 0N/A// Provide iteration over all register definitions 0N/A// in the order used by the register allocator 0N/A // Check if we need to get the next AllocClass 0N/A // At end of this allocation class, check the next 0N/A// return the register definition with name 'regName' 0N/A// return the register class with name 'className' 0N/A// Check that register classes are compatible with chunks 0N/A // Verify Register Classes 0N/A // check that each register class contains registers from one chunk 0N/A // Check the chunk value for all registers in this class 0N/A }
// end of RegClasses 0N/A // Verify that every register has been placed into an allocation class 0N/A "ERROR: More than one register has been assigned register-number 0.\n" 0N/A "Probably because a register has not been entered into an allocation class.\n");
0N/A// Compute RegMask size 0N/A // Need at least this many words 0N/A // Add a few for incoming & outgoing arguments to calls. 0N/A // Round up to the next doubleword size. 0N/A fprintf(
fp,
"-------------------- Dump RegisterForm --------------------\n");
0N/A fprintf(
fp,
"-------------------- end RegisterForm --------------------\n");
0N/A//------------------------------RegDef----------------------------------------- 0N/A // Chunk and register mask are determined by the register number 0N/A // _register_num is set when registers are added to an allocation class 0N/A// Bit pattern used for generating machine code 0N/A// Register number used in machine-independent code 0N/A fprintf(
fp,
"RegDef: %s (%s) encode as %s using number %d\n",
0N/A//------------------------------RegClass--------------------------------------- 0N/A// Construct a register class into which registers will be inserted 0N/A// record a register in this class 0N/A// Number of registers in class 0N/A// Collect all the registers in this register-word. One bit per register. 0N/A // Now also collect stack bits 0N/A for(
int i = 0; i <
32; i++ )
0N/A//------------------------------AllocClass------------------------------------- 0N/A// record a register in this class 0N/A // Add regDef to this allocation class 0N/A//==============================Frame Handling================================= 0N/A//------------------------------FrameForm-------------------------------------- 0N/A//==============================Scheduling===================================== 0N/A//------------------------------PipelineForm----------------------------------- 0N/A//------------------------------ResourceForm----------------------------------- 0N/A//------------------------------PipeClassOperandForm---------------------------------- 0N/A//------------------------------PipeClassResourceForm---------------------------------- 0N/A fprintf(
fp,
"PipeClassResourceForm: %s at stage %s for %d cycles\n",
0N/A//------------------------------PipeClassForm---------------------------------- 0N/A//==============================Peephole Optimization========================== 0N/A//------------------------------Peephole--------------------------------------- 0N/A// Append a peephole rule with the same root instruction 0N/A// Store the components of this peephole rule 0N/A// class Peephole accessor methods are in the declaration. 0N/A // Output the next entry 0N/A//------------------------------PeepMatch-------------------------------------- 0N/A// Insert info into the match-rule 0N/A// Access info about instructions in the peep-match rule 0N/A// Iterate through all info on matched instructions 0N/A// 'true' if current position in iteration is a placeholder, not matched. 0N/A//------------------------------PeepConstraint--------------------------------- 0N/A// Check if constraints use instruction at position 0N/A // Check local instruction constraints 0N/A // Check remaining constraints in list 0N/A// Add another constraint 0N/A// Access the next constraint in the list 0N/A//------------------------------PeepReplace------------------------------------ 0N/A// Add contents of peepreplace 0N/A// Access contents of peepreplace