blob: 1f24849257e105e39e12e90389c73168f1fd94df [file] [log] [blame]
buzbee1fd33462013-03-25 13:40:45 -07001/*
2 * Copyright (C) 2013 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
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_COMPILER_DEX_BACKEND_H_
18#define ART_COMPILER_DEX_BACKEND_H_
buzbee1fd33462013-03-25 13:40:45 -070019
Nicolas Geoffray1af0c0b2014-02-19 17:30:16 +000020namespace art {
Nicolas Geoffray68a5fef2014-02-18 16:43:35 +000021
Nicolas Geoffray818f2102014-02-18 16:43:35 +000022class ArenaAllocator;
23class CompiledMethod;
24
buzbee1fd33462013-03-25 13:40:45 -070025class Backend {
buzbee1fd33462013-03-25 13:40:45 -070026 public:
Brian Carlstrom9b7085a2013-07-18 15:15:21 -070027 virtual ~Backend() {}
buzbee1fd33462013-03-25 13:40:45 -070028 virtual void Materialize() = 0;
29 virtual CompiledMethod* GetCompiledMethod() = 0;
30
Udayan Banerji60bfe7b2014-07-08 19:59:43 -070031 // Queries for backend support for vectors
32 /*
33 * Return the number of bits in a vector register.
34 * @return 0 if vector registers are not supported, or the
35 * number of bits in the vector register if supported.
36 */
37 virtual int VectorRegisterSize() { return 0; }
38
39 /*
40 * Return the number of reservable vector registers supported
41 * @param fp_used ‘true’ if floating point computations will be
42 * executed while vector registers are reserved.
43 * @return the number of vector registers that are available
44 * @note The backend should ensure that sufficient vector registers
45 * are held back to generate scalar code without exhausting vector
46 * registers, if scalar code also uses the vector registers.
47 */
48 virtual int NumReservableVectorRegisters(bool fp_used) { return 0; }
49
buzbee1fd33462013-03-25 13:40:45 -070050 protected:
Brian Carlstrom9b7085a2013-07-18 15:15:21 -070051 explicit Backend(ArenaAllocator* arena) : arena_(arena) {}
Ian Rogers6282dc12013-04-18 15:54:02 -070052 ArenaAllocator* const arena_;
buzbee1fd33462013-03-25 13:40:45 -070053}; // Class Backend
54
55} // namespace art
56
Brian Carlstromfc0e3212013-07-17 14:40:12 -070057#endif // ART_COMPILER_DEX_BACKEND_H_