blob: 9cad9338fcc2b5034d08ac38d3f099cb0bea316c [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
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070041 * @param long_or_fp, true if floating point computations will be
Lupusoru, Razvan Ab3a84e22014-07-28 14:11:01 -070042 * executed or the operations will be long type while vector
43 * registers are reserved.
Udayan Banerji60bfe7b2014-07-08 19:59:43 -070044 * @return the number of vector registers that are available
45 * @note The backend should ensure that sufficient vector registers
46 * are held back to generate scalar code without exhausting vector
47 * registers, if scalar code also uses the vector registers.
48 */
Ian Rogers6a3c1fc2014-10-31 00:33:20 -070049 virtual int NumReservableVectorRegisters(bool long_or_fp) {
50 UNUSED(long_or_fp);
51 return 0;
52 }
Udayan Banerji60bfe7b2014-07-08 19:59:43 -070053
buzbee1fd33462013-03-25 13:40:45 -070054 protected:
Brian Carlstrom9b7085a2013-07-18 15:15:21 -070055 explicit Backend(ArenaAllocator* arena) : arena_(arena) {}
Ian Rogers6282dc12013-04-18 15:54:02 -070056 ArenaAllocator* const arena_;
buzbee1fd33462013-03-25 13:40:45 -070057}; // Class Backend
58
59} // namespace art
60
Brian Carlstromfc0e3212013-07-17 14:40:12 -070061#endif // ART_COMPILER_DEX_BACKEND_H_