blob: 6a9b6cdb1f5225d357b436e6522fee11de819050 [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
buzbee02031b12012-11-23 09:41:35 -080022void MarkSafepointPC(CompilationUnit* cu, LIR* inst);
23bool FastInstance(CompilationUnit* cu, uint32_t field_idx,
24 int& field_offset, bool& is_volatile, bool is_put);
25void SetupResourceMasks(CompilationUnit* cu, LIR* lir);
buzbeefa57c472012-11-21 12:06:18 -080026inline int32_t s4FromSwitchData(const void* switch_data) { return *reinterpret_cast<const int32_t*>(switch_data); }
27inline RegisterClass oat_reg_class_by_size(OpSize size) { return (size == kUnsignedHalf || size == kSignedHalf || size == kUnsignedByte || size == kSignedByte ) ? kCoreReg : kAnyReg; }
28void AssembleLIR(CompilationUnit* cu);
buzbee02031b12012-11-23 09:41:35 -080029void SetMemRefType(CompilationUnit* cu, LIR* lir, bool is_load, int mem_type);
30void AnnotateDalvikRegAccess(CompilationUnit* cu, LIR* lir, int reg_id, bool is_load, bool is64bit);
buzbeefa57c472012-11-21 12:06:18 -080031uint64_t GetRegMaskCommon(CompilationUnit* cu, int reg);
32void SetupRegMask(CompilationUnit* cu, uint64_t* mask, int reg);
33void SetupResourceMasks(CompilationUnit* cu, LIR* lir);
34void DumpLIRInsn(CompilationUnit* cu, LIR* arg, unsigned char* base_addr);
35void DumpPromotionMap(CompilationUnit *cu);
36void CodegenDump(CompilationUnit* cu);
buzbee02031b12012-11-23 09:41:35 -080037LIR* RawLIR(CompilationUnit* cu, int dalvik_offset, int opcode, int op0 = 0, int op1 = 0,
38 int op2 = 0, int op3 = 0, int op4 = 0, LIR* target = NULL);
buzbeefa57c472012-11-21 12:06:18 -080039LIR* NewLIR0(CompilationUnit* cu, int opcode);
40LIR* NewLIR1(CompilationUnit* cu, int opcode, int dest);
41LIR* NewLIR2(CompilationUnit* cu, int opcode, int dest, int src1);
42LIR* NewLIR3(CompilationUnit* cu, int opcode, int dest, int src1, int src2);
43LIR* NewLIR4(CompilationUnit* cu, int opcode, int dest, int src1, int src2, int info);
44LIR* NewLIR5(CompilationUnit* cu, int opcode, int dest, int src1, int src2, int info1, int info2);
45LIR* ScanLiteralPool(LIR* data_target, int value, unsigned int delta);
46LIR* ScanLiteralPoolWide(LIR* data_target, int val_lo, int val_hi);
47LIR* AddWordData(CompilationUnit* cu, LIR* *constant_list_p, int value);
48LIR* AddWideData(CompilationUnit* cu, LIR* *constant_list_p, int val_lo, int val_hi);
49void ProcessSwitchTables(CompilationUnit* cu);
buzbee52a77fc2012-11-20 19:50:46 -080050void DumpSparseSwitchTable(const uint16_t* table);
51void DumpPackedSwitchTable(const uint16_t* table);
buzbeefa57c472012-11-21 12:06:18 -080052LIR* MarkBoundary(CompilationUnit* cu, int offset, const char* inst_str);
buzbee02031b12012-11-23 09:41:35 -080053void NopLIR(LIR* lir);
buzbeeeaf09bc2012-11-15 14:51:41 -080054
55} // namespace art
56
57#endif // ART_SRC_COMPILER_CODEGEN_CODEGENUTIL_H_