buzbee | 1fd3346 | 2013-03-25 13:40:45 -0700 | [diff] [blame] | 1 | /* |
| 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 Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_COMPILER_DEX_BACKEND_H_ |
| 18 | #define ART_COMPILER_DEX_BACKEND_H_ |
buzbee | 1fd3346 | 2013-03-25 13:40:45 -0700 | [diff] [blame] | 19 | |
Nicolas Geoffray | 1af0c0b | 2014-02-19 17:30:16 +0000 | [diff] [blame] | 20 | namespace art { |
Nicolas Geoffray | 68a5fef | 2014-02-18 16:43:35 +0000 | [diff] [blame] | 21 | |
Nicolas Geoffray | 818f210 | 2014-02-18 16:43:35 +0000 | [diff] [blame] | 22 | class ArenaAllocator; |
| 23 | class CompiledMethod; |
| 24 | |
buzbee | 1fd3346 | 2013-03-25 13:40:45 -0700 | [diff] [blame] | 25 | class Backend { |
buzbee | 1fd3346 | 2013-03-25 13:40:45 -0700 | [diff] [blame] | 26 | public: |
Brian Carlstrom | 9b7085a | 2013-07-18 15:15:21 -0700 | [diff] [blame] | 27 | virtual ~Backend() {} |
buzbee | 1fd3346 | 2013-03-25 13:40:45 -0700 | [diff] [blame] | 28 | virtual void Materialize() = 0; |
| 29 | virtual CompiledMethod* GetCompiledMethod() = 0; |
| 30 | |
Udayan Banerji | 60bfe7b | 2014-07-08 19:59:43 -0700 | [diff] [blame] | 31 | // 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 Rogers | 6a3c1fc | 2014-10-31 00:33:20 -0700 | [diff] [blame] | 41 | * @param long_or_fp, true if floating point computations will be |
Lupusoru, Razvan A | b3a84e2 | 2014-07-28 14:11:01 -0700 | [diff] [blame] | 42 | * executed or the operations will be long type while vector |
| 43 | * registers are reserved. |
Udayan Banerji | 60bfe7b | 2014-07-08 19:59:43 -0700 | [diff] [blame] | 44 | * @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 Rogers | 6a3c1fc | 2014-10-31 00:33:20 -0700 | [diff] [blame] | 49 | virtual int NumReservableVectorRegisters(bool long_or_fp) { |
| 50 | UNUSED(long_or_fp); |
| 51 | return 0; |
| 52 | } |
Udayan Banerji | 60bfe7b | 2014-07-08 19:59:43 -0700 | [diff] [blame] | 53 | |
buzbee | 1fd3346 | 2013-03-25 13:40:45 -0700 | [diff] [blame] | 54 | protected: |
Brian Carlstrom | 9b7085a | 2013-07-18 15:15:21 -0700 | [diff] [blame] | 55 | explicit Backend(ArenaAllocator* arena) : arena_(arena) {} |
Ian Rogers | 6282dc1 | 2013-04-18 15:54:02 -0700 | [diff] [blame] | 56 | ArenaAllocator* const arena_; |
buzbee | 1fd3346 | 2013-03-25 13:40:45 -0700 | [diff] [blame] | 57 | }; // Class Backend |
| 58 | |
| 59 | } // namespace art |
| 60 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 61 | #endif // ART_COMPILER_DEX_BACKEND_H_ |