blob: 380203a19968e4622302b6a9b439ef63a735e896 [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
buzbeefa57c472012-11-21 12:06:18 -080022inline int32_t s4FromSwitchData(const void* switch_data) { return *reinterpret_cast<const int32_t*>(switch_data); }
23inline RegisterClass oat_reg_class_by_size(OpSize size) { return (size == kUnsignedHalf || size == kSignedHalf || size == kUnsignedByte || size == kSignedByte ) ? kCoreReg : kAnyReg; }
24void AssembleLIR(CompilationUnit* cu);
25void SetMemRefType(LIR* lir, bool is_load, int mem_type);
26void AnnotateDalvikRegAccess(LIR* lir, int reg_id, bool is_load, bool is64bit);
27uint64_t GetRegMaskCommon(CompilationUnit* cu, int reg);
28void SetupRegMask(CompilationUnit* cu, uint64_t* mask, int reg);
29void SetupResourceMasks(CompilationUnit* cu, LIR* lir);
30void DumpLIRInsn(CompilationUnit* cu, LIR* arg, unsigned char* base_addr);
31void DumpPromotionMap(CompilationUnit *cu);
32void CodegenDump(CompilationUnit* cu);
buzbeeeaf09bc2012-11-15 14:51:41 -080033// TODO: remove default parameters
buzbeefa57c472012-11-21 12:06:18 -080034LIR* RawLIR(CompilationUnit* cu, int dalvik_offset, int opcode, int op0 = 0, int op1 = 0, int op2 = 0, int op3 = 0, int op4 = 0, LIR* target = NULL);
35LIR* NewLIR0(CompilationUnit* cu, int opcode);
36LIR* NewLIR1(CompilationUnit* cu, int opcode, int dest);
37LIR* NewLIR2(CompilationUnit* cu, int opcode, int dest, int src1);
38LIR* NewLIR3(CompilationUnit* cu, int opcode, int dest, int src1, int src2);
39LIR* NewLIR4(CompilationUnit* cu, int opcode, int dest, int src1, int src2, int info);
40LIR* NewLIR5(CompilationUnit* cu, int opcode, int dest, int src1, int src2, int info1, int info2);
41LIR* ScanLiteralPool(LIR* data_target, int value, unsigned int delta);
42LIR* ScanLiteralPoolWide(LIR* data_target, int val_lo, int val_hi);
43LIR* AddWordData(CompilationUnit* cu, LIR* *constant_list_p, int value);
44LIR* AddWideData(CompilationUnit* cu, LIR* *constant_list_p, int val_lo, int val_hi);
45void ProcessSwitchTables(CompilationUnit* cu);
buzbee52a77fc2012-11-20 19:50:46 -080046void DumpSparseSwitchTable(const uint16_t* table);
47void DumpPackedSwitchTable(const uint16_t* table);
buzbeefa57c472012-11-21 12:06:18 -080048LIR* MarkBoundary(CompilationUnit* cu, int offset, const char* inst_str);
buzbeeeaf09bc2012-11-15 14:51:41 -080049
50} // namespace art
51
52#endif // ART_SRC_COMPILER_CODEGEN_CODEGENUTIL_H_