• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.dx.ssa.back;
18 
19 import com.android.dx.ssa.BasicRegisterMapper;
20 import com.android.dx.ssa.RegisterMapper;
21 import com.android.dx.ssa.SsaMethod;
22 
23 import java.util.BitSet;
24 import java.util.ArrayList;
25 
26 /**
27  * A register allocator that maps SSA register n to Rop register 2*n,
28  * essentially preserving the original mapping and remaining agnostic
29  * about normal or wide categories. Used for debugging.
30  */
31 public class NullRegisterAllocator extends RegisterAllocator {
32     /** {@inheritDoc} */
NullRegisterAllocator(SsaMethod ssaMeth, InterferenceGraph interference)33     public NullRegisterAllocator(SsaMethod ssaMeth,
34             InterferenceGraph interference) {
35         super(ssaMeth, interference);
36     }
37 
38     /** {@inheritDoc} */
39     @Override
wantsParamsMovedHigh()40     public boolean wantsParamsMovedHigh() {
41         // We're not smart enough for this.
42         return false;
43     }
44 
45     /** {@inheritDoc} */
46     @Override
allocateRegisters()47     public RegisterMapper allocateRegisters() {
48         int oldRegCount = ssaMeth.getRegCount();
49 
50         BasicRegisterMapper mapper = new BasicRegisterMapper(oldRegCount);
51 
52         for (int i = 0; i < oldRegCount; i++) {
53             mapper.addMapping(i, i*2, 2);
54         }
55 
56         return mapper;
57     }
58 }
59