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