buzbee | eaf09bc | 2012-11-15 14:51:41 -0800 | [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_CODEGEN_CODEGENUTIL_H_ |
| 18 | #define ART_SRC_COMPILER_CODEGEN_CODEGENUTIL_H_ |
| 19 | |
| 20 | namespace art { |
| 21 | |
| 22 | inline int32_t s4FromSwitchData(const void* switchData) { return *(int32_t*) switchData; } |
| 23 | inline RegisterClass oatRegClassBySize(OpSize size) { return (size == kUnsignedHalf || size == kSignedHalf || size == kUnsignedByte || size == kSignedByte ) ? kCoreReg : kAnyReg; } |
| 24 | void oatAssembleLIR(CompilationUnit* cUnit); |
| 25 | void setMemRefType(LIR* lir, bool isLoad, int memType); |
| 26 | void annotateDalvikRegAccess(LIR* lir, int regId, bool isLoad, bool is64bit); |
| 27 | uint64_t oatGetRegMaskCommon(CompilationUnit* cUnit, int reg); |
| 28 | void oatSetupRegMask(CompilationUnit* cUnit, uint64_t* mask, int reg); |
| 29 | void setupResourceMasks(CompilationUnit* cUnit, LIR* lir); |
| 30 | void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* arg, unsigned char* baseAddr); |
| 31 | void oatDumpPromotionMap(CompilationUnit *cUnit); |
| 32 | void dumpMappingTable(const char* table_name, const std::string& descriptor, const std::string& name, const std::string& signature, const std::vector<uint32_t>& v); |
| 33 | void oatCodegenDump(CompilationUnit* cUnit); |
| 34 | // TODO: remove default parameters |
| 35 | LIR* rawLIR(CompilationUnit* cUnit, int dalvikOffset, int opcode, int op0 = 0, int op1 = 0, int op2 = 0, int op3 = 0, int op4 = 0, LIR* target = NULL); |
| 36 | LIR* newLIR0(CompilationUnit* cUnit, int opcode); |
| 37 | LIR* newLIR1(CompilationUnit* cUnit, int opcode, int dest); |
| 38 | LIR* newLIR2(CompilationUnit* cUnit, int opcode, int dest, int src1); |
| 39 | LIR* newLIR3(CompilationUnit* cUnit, int opcode, int dest, int src1, int src2); |
| 40 | LIR* newLIR4(CompilationUnit* cUnit, int opcode, int dest, int src1, int src2, int info); |
| 41 | LIR* newLIR5(CompilationUnit* cUnit, int opcode, int dest, int src1, int src2, int info1, int info2); |
| 42 | LIR* scanLiteralPool(LIR* dataTarget, int value, unsigned int delta); |
| 43 | LIR* scanLiteralPoolWide(LIR* dataTarget, int valLo, int valHi); |
| 44 | LIR* addWordData(CompilationUnit* cUnit, LIR* *constantListP, int value); |
| 45 | LIR* addWideData(CompilationUnit* cUnit, LIR* *constantListP, int valLo, int valHi); |
| 46 | void oatProcessSwitchTables(CompilationUnit* cUnit); |
| 47 | void dumpSparseSwitchTable(const uint16_t* table); |
| 48 | void dumpPackedSwitchTable(const uint16_t* table); |
| 49 | LIR* markBoundary(CompilationUnit* cUnit, int offset, const char* instStr); |
| 50 | |
| 51 | } // namespace art |
| 52 | |
| 53 | #endif // ART_SRC_COMPILER_CODEGEN_CODEGENUTIL_H_ |