10c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen/* 20c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * Copyright (C) 2012 The Android Open Source Project 30c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * 40c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * Licensed under the Apache License, Version 2.0 (the "License"); 50c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * you may not use this file except in compliance with the License. 60c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * You may obtain a copy of the License at 70c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * 80c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * http://www.apache.org/licenses/LICENSE-2.0 90c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * 100c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * Unless required by applicable law or agreed to in writing, software 110c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * distributed under the License is distributed on an "AS IS" BASIS, 120c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * See the License for the specific language governing permissions and 140c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen * limitations under the License. 150c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen */ 160c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 170c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 180c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen/*! \file ncg_o1_data.h 190c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen \brief A header file to define data structures used by register allocator & const folding 200c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen*/ 210c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#ifndef _DALVIK_NCG_ANALYSISO1_H 220c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define _DALVIK_NCG_ANALYSISO1_H 230c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 240c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#include "Dalvik.h" 250c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#include "enc_wrapper.h" 260c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#include "Lower.h" 270c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#ifdef WITH_JIT 280c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#include "compiler/CompilerIR.h" 290c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#endif 300c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 310c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of edges per basic block 320c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_NUM_EDGE_PER_BB 300 330c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of basic blocks per method 340c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_NUM_BBS_PER_METHOD 1000 350c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of virtual registers per basic block 360c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_REG_PER_BASICBLOCK 140 370c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of virtual registers per bytecode 380c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_REG_PER_BYTECODE 40 390c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of virtual registers per method 400c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_REG_PER_METHOD 200 410c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of temporaries per bytecode 420c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_TEMP_REG_PER_BYTECODE 30 430c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of GG GPR VRs in a method 440c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_GLOBAL_VR 2 450c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of GG XMM VRs in a method 460c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_GLOBAL_VR_XMM 4 470c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_CONST_REG 150 480c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 490c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MASK_FOR_TYPE 7 //last 3 bits 111 500c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 510c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define LOOP_COUNT 10 520c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of entries in compileTable 530c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define COMPILE_TABLE_SIZE 200 540c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! maximal number of transfer points per basic block 550c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define MAX_XFER_PER_BB 1000 //on Jan 4 560c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define PC_FOR_END_OF_BB -999 570c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define PC_FOR_START_OF_BB -998 580c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 590c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! various cases of overlapping between 2 variables 600c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef enum OverlapCase { 610c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_ALIGN = 0, 620c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_B_IS_LOW_OF_A, 630c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_B_IS_HIGH_OF_A, 640c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_LOW_OF_A_IS_HIGH_OF_B, 650c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_HIGH_OF_A_IS_LOW_OF_B, 660c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_A_IS_LOW_OF_B, 670c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_A_IS_HIGH_OF_B, 680c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_B_COVER_A, 690c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_B_COVER_LOW_OF_A, 700c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_B_COVER_HIGH_OF_A, 710c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen OVERLAP_NO 720c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} OverlapCase; 730c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 740c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!access type of a variable 750c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef enum RegAccessType { 760c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_D = 0, 770c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_U, 780c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_DU, 790c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_UD, 800c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_L, 810c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_H, 820c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_UL, 830c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_UH, 840c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_LU, 850c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_HU, 860c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_N, //no access 870c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen REGACCESS_UNKNOWN 880c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} RegAccessType; 890c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! a variable can be local (L), globally local (GL) or global (GG) 900c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef enum GlobalType { 910c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen GLOBALTYPE_GG, 920c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen GLOBALTYPE_GL, 930c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen GLOBALTYPE_L 940c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} GlobalType; 950c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef enum VRState { 960c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen VRSTATE_SPILLED, 970c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen VRSTATE_UPDATED, 980c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen VRSTATE_CLEAN 990c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} VRState; 1000c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//! helper state to determine if freeing VRs needs to be delayed 1010c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenenum VRDelayFreeFlags { 1020c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen VRDELAY_NONE = 0, // used when VR can be freed from using physical register if needed 1030c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen VRDELAY_NULLCHECK = 1 << 0, // used when VR is used for null check and freeing must be delayed 1040c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen VRDELAY_BOUNDCHECK = 1 << 1 // used when VR is used for bound check and freeing must be delayed 1050c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen}; 1060c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef enum TRState { //state of temporary registers 1070c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen TRSTATE_SPILLED, 1080c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen TRSTATE_UNSPILLED, 1090c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen TRSTATE_CLEAN 1100c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} TRState; 1110c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!information about a physical register 1120c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct RegisterInfo { 1130c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen PhysicalReg physicalReg; 1140c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool isUsed; 1150c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool isCalleeSaved; 1160c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int freeTimeStamp; 1170c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} RegisterInfo; 1180c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct UniqueRegister { 1190c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen LowOpndRegType physicalType; 1200c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; 1210c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int numExposedUsage; 1220c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen PhysicalReg physicalReg; 1230c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} UniqueRegister; 1240c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!specifies the weight of a VR allocated to a specific physical register 1250c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!it is used for GPR VR only 1260c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct RegAllocConstraint { 1270c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen PhysicalReg physicalReg; 1280c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int count; 1290c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} RegAllocConstraint; 1300c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 1310c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef enum XferType { 1320c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen XFER_MEM_TO_XMM, //for usage 1330c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen XFER_DEF_TO_MEM, //def is gp 1340c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen XFER_DEF_TO_GP_MEM, 1350c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen XFER_DEF_TO_GP, 1360c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen XFER_DEF_IS_XMM //def is xmm 1370c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} XferType; 1380c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct XferPoint { 1390c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int tableIndex; //generated from a def-use pair 1400c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen XferType xtype; 1410c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int offsetPC; 1420c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; //get or set VR at offsetPC 1430c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen LowOpndRegType physicalType; 1440c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 1450c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen //if XFER_DEF_IS_XMM 1460c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int vr_gpl; //a gp VR that uses the lower half of the def 1470c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int vr_gph; 1480c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool dumpToXmm; 1490c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool dumpToMem; 1500c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} XferPoint; 1510c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 1520c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!for def: accessType means which part of the VR defined at offestPC is live now 1530c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!for use: accessType means which part of the usage comes from the reachingDef 1540c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct DefOrUse { 1550c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int offsetPC; //!the program point 1560c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; //!access the virtual reg 1570c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen LowOpndRegType physicalType; //!xmm or gp or ss 1580c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RegAccessType accessType; //!D, L, H, N 1590c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} DefOrUse; 1600c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!a link list of DefOrUse 1610c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct DefOrUseLink { 1620c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int offsetPC; 1630c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; //access the virtual reg 1640c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen LowOpndRegType physicalType; //xmm or gp 1650c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RegAccessType accessType; //D, L, H, N 1660c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen struct DefOrUseLink* next; 1670c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} DefOrUseLink; 1680c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!pair of def and uses 1690c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct DefUsePair { 1700c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen DefOrUseLink* uses; 1710c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen DefOrUseLink* useTail; 1720c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_uses; 1730c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen DefOrUse def; 1740c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen struct DefUsePair* next; 1750c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} DefUsePair; 1760c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 1770c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!information associated with a virtual register 1780c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!the pair <regNum, physicalType> uniquely determines a variable 1790c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct VirtualRegInfo { 1800c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; 1810c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen LowOpndRegType physicalType; 1820c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int refCount; 1830c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RegAccessType accessType; 1840c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen GlobalType gType; 1850c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int physicalReg_GG; 1860c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RegAllocConstraint allocConstraints[8]; 1870c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RegAllocConstraint allocConstraintsSorted[8]; 1880c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 1890c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen DefOrUse reachingDefs[3]; //!reaching defs to the virtual register 1900c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_reaching_defs; 1910c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} VirtualRegInfo; 1920c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!information of whether a VR is constant and its value 1930c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct ConstVRInfo { 1940c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; 1950c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int value; 1960c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool isConst; 1970c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} ConstVRInfo; 1980c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#define NUM_ACCESS_IN_LIVERANGE 10 1990c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!specifies one live range 2000c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct LiveRange { 2010c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int start; 2020c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int end; //inclusive 2030c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen //all accesses in the live range 2040c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_access; 2050c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_alloc; 2060c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int* accessPC; 2070c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen struct LiveRange* next; 2080c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} LiveRange; 2090c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct BoundCheckIndex { 2100c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int indexVR; 2110c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool checkDone; 2120c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} BoundCheckIndex; 2130c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!information for a virtual register such as live ranges, in memory 2140c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct MemoryVRInfo { 2150c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; 2160c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool inMemory; 2170c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool nullCheckDone; 2180c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen BoundCheckIndex boundCheck; 2190c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_ranges; 2200c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen LiveRange* ranges; 2210c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen u4 delayFreeFlags; //! for use with flags defined by VRDelayFreeFlags enum 2220c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} MemoryVRInfo; 2230c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!information of a temporary 2240c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!the pair <regNum, physicalType> uniquely determines a variable 2250c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct TempRegInfo { 2260c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; 2270c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int physicalType; 2280c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int refCount; 2290c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int linkageToVR; 2300c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int versionNum; 2310c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool shareWithVR; //for temp. regs updated by get_virtual_reg 2320c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool is8Bit; 2330c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} TempRegInfo; 2340c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenstruct BasicBlock_O1; 2350c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!all variables accessed 2360c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!the pair <regNum, physicalType> uniquely determines a variable 2370c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct compileTableEntry { 2380c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; 2390c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int physicalType; //gp, xmm or scratch, virtual 2400c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int physicalReg; 2410c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int physicalReg_prev; //for spilled GG VR 2420c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RegAccessType accessType; 2430c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 2440c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool isConst; 2450c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int value[2]; //[0]: lower [1]: higher 2460c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int refCount; 2470c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 2480c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int linkageToVR; //for temporary registers only 2490c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen GlobalType gType; 2500c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen struct BasicBlock_O1* bb; //bb VR belongs to 2510c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int indexToInfoBB; 2520c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 2530c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen VRState regState; 2540c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen TRState trState; //for temporary registers only 2550c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int spill_loc_index; //for temporary registers only 2560c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} compileTableEntry; 2570c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!to save the state of register allocator 2580c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct regAllocStateEntry1 { 2590c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int spill_loc_index; 2600c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int physicalReg; 2610c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} regAllocStateEntry1; 2620c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct regAllocStateEntry2 { 2630c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int regNum; // 2640c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool inMemory; //whether 4-byte virtual reg is in memory 2650c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} regAllocStateEntry2; 2660c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!edge in control flow graph 2670c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct Edge_O1 { 2680c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen struct BasicBlock_O1* src; 2690c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen struct BasicBlock_O1* dst; 2700c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} Edge_O1; 2710c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!information associated with a basic block 2720c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct BasicBlock_O1 { 2730c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int bb_index; 2740c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int bb_index2; 2750c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int pc_start; //!inclusive 2760c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#ifndef WITH_JIT 2770c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int pc_end; //!exclusive 2780c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen Edge_O1* in_edges[MAX_NUM_EDGE_PER_BB]; //array of Edge* 2790c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_in_edges; 2800c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen Edge_O1* out_edges[MAX_NUM_EDGE_PER_BB]; 2810c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_out_edges; 2820c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#else 2830c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int pc_end; 2840c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen BasicBlock* jitBasicBlock; 2850c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#endif 2860c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen VirtualRegInfo infoBasicBlock[MAX_REG_PER_BASICBLOCK]; 2870c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_regs; 2880c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 2890c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RegAllocConstraint allocConstraints[8]; //# of times a hardcoded register is used in this basic block 2900c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen //a physical register that is used many times has a lower priority to get picked in getFreeReg 2910c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RegAllocConstraint allocConstraintsSorted[8]; //count from low to high 2920c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 2930c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen DefUsePair* defUseTable; 2940c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen DefUsePair* defUseTail; 2950c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_defs; 2960c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen XferPoint xferPoints[MAX_XFER_PER_BB]; //program points where the transfer is required 2970c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int num_xfer_points; 2980c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 2990c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool endsWithReturn; 3000c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen bool hasAccessToGlue; 3010c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} BasicBlock_O1; 3020c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct CFG_O1 { 3030c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen BasicBlock_O1* head; 3040c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} CFG_O1; 3050c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//!worklist to create a control flow graph 3060c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef struct CFGWork { 3070c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen BasicBlock_O1* bb_prev; 3080c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen int targetOff; 3090c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen struct CFGWork* nextItem; 3100c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} CFGWork; 3110c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3120c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen///////////////////////////////////////// 3130c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern compileTableEntry compileTable[COMPILE_TABLE_SIZE]; 3140c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_compile_entries; 3150c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern VirtualRegInfo infoByteCode[MAX_REG_PER_BYTECODE]; 3160c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_regs_per_bytecode; 3170c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern TempRegInfo infoByteCodeTemp[MAX_TEMP_REG_PER_BYTECODE]; 3180c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_temp_regs_per_bytecode; 3190c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern VirtualRegInfo infoMethod[MAX_REG_PER_METHOD]; 3200c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_regs_per_method; 3210c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern BasicBlock_O1* currentBB; 3220c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3230c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern BasicBlock_O1* method_bbs[MAX_NUM_BBS_PER_METHOD]; 3240c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_bbs_for_method; 3250c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern BasicBlock_O1* method_bbs_sorted[MAX_NUM_BBS_PER_METHOD]; 3260c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern BasicBlock_O1* bb_entry; 3270c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int pc_start; 3280c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int pc_end; 3290c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int current_bc_size; 3300c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_exception_handlers; 3310c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int exceptionHandlers[10]; 3320c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3330c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_const_vr; 3340c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern ConstVRInfo constVRTable[MAX_CONST_REG]; 3350c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3360c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int genSet[MAX_REG_PER_BYTECODE]; 3370c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int killSet[MAX_REG_PER_BYTECODE]; 3380c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_regs_gen; //per bytecode 3390c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_regs_kill; //per bytecode 3400c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3410c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int genSetBB[MAX_NUM_BBS_PER_METHOD][40]; 3420c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int killSetBB[MAX_NUM_BBS_PER_METHOD][40]; //same as size of memVRTable 3430c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_gen_bb[MAX_NUM_BBS_PER_METHOD]; 3440c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int num_kill_bb[MAX_NUM_BBS_PER_METHOD]; 3450c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3460c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int nullCheck_inB[MAX_NUM_BBS_PER_METHOD][40]; 3470c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int nullCheck_inSize[MAX_NUM_BBS_PER_METHOD]; 3480c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int nullCheck_outB[MAX_NUM_BBS_PER_METHOD][40]; 3490c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenextern int nullCheck_outSize[MAX_NUM_BBS_PER_METHOD]; 3500c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3510c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chentypedef enum GlueVarType { 3520c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RES_CLASS = 0, 3530c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RES_METHOD, 3540c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RES_FIELD, 3550c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen RES_STRING, 3560c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen GLUE_DVMDEX, 3570c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen GLUE_METHOD_CLASS, 3580c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen GLUE_METHOD 3590c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen} GlueVarType; 3600c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3610c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenvoid forwardAnalysis(int type); 3620c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3630c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen//functions in bc_visitor.c 3640c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenint getByteCodeSize(); 3650c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenbool getConstInfo(BasicBlock_O1* bb); 3660c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenint getVirtualRegInfo(VirtualRegInfo* infoArray); 3670c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenint getTempRegInfo(TempRegInfo* infoArray); 3680c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenint createCFGHandler(Method* method); 3690c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3700c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenint findVirtualRegInTable(u2 vA, LowOpndRegType type, bool printError); 3710c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenint searchCompileTable(int type, int regNum); 3720c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan ChenBasicBlock_O1* createBasicBlock(int src_pc, int end_pc); 3730c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenvoid handleJump(BasicBlock_O1* bb_prev, int relOff); 3740c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenvoid connectBasicBlock(BasicBlock_O1* src, BasicBlock_O1* dst); 3750c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenint insertWorklist(BasicBlock_O1* bb_prev, int targetOff); 3760c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3770c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenint collectInfoOfBasicBlock(Method* method, BasicBlock_O1* bb); //update bb->infoBasicBlock 3780c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 3790c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenvoid updateCurrentBBWithConstraints(PhysicalReg reg); 3800c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenvoid updateConstInfo(BasicBlock_O1*); 3810c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan ChenOpndSize getRegSize(int type); 3820c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chenvoid invalidateVRDueToConst(int reg, OpndSize size); 3830c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen#endif 3840c2dc522d0e120f346cf0a40c8cf0c93346131c2Dong-Yuan Chen 385