buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | #ifndef ART_SRC_COMPILER_COMPILERCODEGEN_H_ |
| 18 | #define ART_SRC_COMPILER_COMPILERCODEGEN_H_ |
| 19 | |
| 20 | #include "../CompilerIR.h" |
| 21 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 22 | namespace art { |
| 23 | |
buzbee | a2ebdd7 | 2012-03-04 14:57:06 -0800 | [diff] [blame] | 24 | LIR* rawLIR(CompilationUnit* cUnit, int dalvikOffset, int opcode, int op0 = 0, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 25 | int op1 = 0, int op2 = 0, int op3 = 0, int op4 = 0, |
| 26 | LIR* target = NULL); |
buzbee | a2ebdd7 | 2012-03-04 14:57:06 -0800 | [diff] [blame] | 27 | |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 28 | int oatGetInsnSize(LIR* lir); |
| 29 | |
buzbee | 84fd693 | 2012-03-29 16:44:16 -0700 | [diff] [blame] | 30 | void genFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir); |
| 31 | void genFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, |
| 32 | bool gtBias, bool isDouble); |
| 33 | |
| 34 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 35 | /* Lower middle-level IR to low-level IR for the whole method */ |
| 36 | void oatMethodMIR2LIR(CompilationUnit* cUnit); |
| 37 | |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame^] | 38 | /* Bitcode conversions */ |
| 39 | void oatMethodMIR2Bitcode(CompilationUnit* cUnit); |
| 40 | void oatMethodBitcode2LIR(CompilationUnit* cUnit); |
| 41 | |
buzbee | 16da88c | 2012-03-20 10:38:17 -0700 | [diff] [blame] | 42 | /* Lower middle-level IR to low-level IR for the simple methods */ |
| 43 | void oatSpecialMIR2LIR(CompilationUnit* cUnit, SpecialCaseHandler specialCase ); |
| 44 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 45 | /* Assemble LIR into machine code */ |
| 46 | void oatAssembleLIR(CompilationUnit* cUnit); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 47 | AssemblerStatus oatAssembleInstructions(CompilationUnit* cUnit, |
| 48 | intptr_t startAddr); |
| 49 | void oatAssignOffsets(CompilationUnit* cUnit); |
| 50 | int oatAssignInsnOffsets(CompilationUnit* cUnit); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 51 | |
| 52 | /* Implemented in the codegen/<target>/ArchUtility.c */ |
| 53 | void oatCodegenDump(CompilationUnit* cUnit); |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 54 | void oatDumpPromotionMap(CompilationUnit* cUnit); |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 55 | std::string buildInsnString(const char* fmt, LIR* lir, |
| 56 | unsigned char* baseAddr); |
| 57 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 58 | |
| 59 | /* Implemented in codegen/<target>/Ralloc.c */ |
| 60 | void oatSimpleRegAlloc(CompilationUnit* cUnit); |
| 61 | |
| 62 | /* Implemented in codegen/<target>/Thumb<version>Util.c */ |
| 63 | void oatInitializeRegAlloc(CompilationUnit* cUnit); |
| 64 | |
| 65 | /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */ |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 66 | InstructionSet oatInstructionSet(); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 67 | |
| 68 | /* |
| 69 | * Implemented in codegen/<target>/<target_variant>/ArchVariant.c |
| 70 | * Architecture-specific initializations and checks |
| 71 | */ |
| 72 | bool oatArchVariantInit(void); |
| 73 | |
| 74 | /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */ |
| 75 | int oatTargetOptHint(int key); |
| 76 | |
| 77 | /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */ |
| 78 | void oatGenMemBarrier(CompilationUnit* cUnit, int barrierKind); |
| 79 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 80 | } // namespace art |
| 81 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 82 | #endif // ART_SRC_COMPILER_COMPILERCODEGEN_H_ |