summaryrefslogtreecommitdiffstats
path: root/compiler/dex/mir_graph.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/dex/mir_graph.h')
-rw-r--r--compiler/dex/mir_graph.h44
1 files changed, 42 insertions, 2 deletions
diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h
index 23b7c42..a362196 100644
--- a/compiler/dex/mir_graph.h
+++ b/compiler/dex/mir_graph.h
@@ -32,6 +32,12 @@
#include "reg_storage.h"
#include "utils/arena_bit_vector.h"
+#ifdef QC_STRONG
+#define QC_WEAK
+#else
+#define QC_WEAK __attribute__((weak))
+#endif
+
namespace art {
struct CompilationUnit;
@@ -82,6 +88,7 @@ enum DataFlowAttributePos {
kUsesSField, // Accesses a static field (SGET/SPUT).
kCanInitializeClass, // Can trigger class initialization (SGET/SPUT/INVOKE_STATIC).
kDoLVN, // Worth computing local value numbers.
+ kZeroDivCheck, // check for zero divider
};
#define DF_NOP UINT64_C(0)
@@ -121,6 +128,7 @@ enum DataFlowAttributePos {
#define DF_SFIELD (UINT64_C(1) << kUsesSField)
#define DF_CLINIT (UINT64_C(1) << kCanInitializeClass)
#define DF_LVN (UINT64_C(1) << kDoLVN)
+#define DF_ZERO_DIV_CHECK (UINT64_C(1) << kZeroDivCheck)
#define DF_HAS_USES (DF_UA | DF_UB | DF_UC)
@@ -165,6 +173,7 @@ enum OatMethodAttributes {
#define MIR_INLINED_PRED (1 << kMIRInlinedPred)
#define MIR_CALLEE (1 << kMIRCallee)
#define MIR_IGNORE_SUSPEND_CHECK (1 << kMIRIgnoreSuspendCheck)
+#define MIR_IGNORE_ZERO_DIV_CHECK (1 << kMIRIgnoreZeroDivCheck)
#define MIR_DUP (1 << kMIRDup)
#define MIR_MARK (1 << kMIRMark)
#define MIR_STORE_NON_TEMPORAL (1 << kMIRStoreNonTemporal)
@@ -242,6 +251,8 @@ struct SSARepresentation {
static uint32_t GetStartUseIndex(Instruction::Code opcode);
};
+struct ExtendedMIR;
+
/*
* The Midlevel Intermediate Representation node, which may be largely considered a
* wrapper around a Dalvik byte code.
@@ -354,7 +365,7 @@ class MIR : public ArenaObject<kArenaAllocMIR> {
} meta;
explicit MIR() : offset(0), optimization_flags(0), m_unit_index(0), bb(NullBasicBlockId),
- next(nullptr), ssa_rep(nullptr) {
+ next(nullptr), ssa_rep(nullptr), extraData(nullptr) {
memset(&meta, 0, sizeof(meta));
}
@@ -364,6 +375,9 @@ class MIR : public ArenaObject<kArenaAllocMIR> {
MIR* Copy(CompilationUnit *c_unit);
MIR* Copy(MIRGraph* mir_Graph);
+
+ ExtendedMIR* extraData;
+
};
struct SuccessorBlockInfo;
@@ -552,6 +566,9 @@ struct CallInfo {
const RegLocation bad_loc = {kLocDalvikFrame, 0, 0, 0, 0, 0, 0, 0, 0, RegStorage(), INVALID_SREG,
INVALID_SREG};
+
+class QCMIRGraph;
+
class MIRGraph {
public:
MIRGraph(CompilationUnit* cu, ArenaAllocator* arena);
@@ -833,6 +850,12 @@ class MIRGraph {
*/
void SetConstantWide(int32_t ssa_reg, int64_t value);
+ int64_t ConstantValueWide(int32_t s_reg) const {
+ DCHECK(IsConst(s_reg));
+ return (static_cast<int64_t>(constant_values_[s_reg + 1]) << 32) |
+ Low32Bits(static_cast<int64_t>(constant_values_[s_reg]));
+ }
+
bool IsConstantNullRef(RegLocation loc) const {
return loc.ref && loc.is_const && (ConstantValue(loc) == 0);
}
@@ -1221,7 +1244,7 @@ class MIRGraph {
*/
void CountUses(BasicBlock* bb);
- static uint64_t GetDataFlowAttributes(Instruction::Code opcode);
+ static uint64_t GetDataFlowAttributes(Instruction::Code opcode) QC_WEAK;
static uint64_t GetDataFlowAttributes(MIR* mir);
/**
@@ -1271,8 +1294,16 @@ class MIRGraph {
static const char* extended_mir_op_names_[kMirOpLast - kMirOpFirst];
+ static const char * GetExtendedMirOpName(int index) QC_WEAK;
void HandleSSADef(int* defs, int dalvik_reg, int reg_index);
+ void CleanupGraphData() QC_WEAK;
+
+ bool SupportMLA() QC_WEAK;
+
+ void SetPassFail() { pass_failed_ = true; }
+ bool PassFailed() { return pass_failed_; };
+
protected:
int FindCommonParent(int block1, int block2);
void ComputeSuccLineIn(ArenaBitVector* dest, const ArenaBitVector* src1,
@@ -1470,6 +1501,9 @@ class MIRGraph {
static const uint64_t oat_data_flow_attributes_[kMirOpLast];
+ // flag marks if optimizing pass has failed
+ bool pass_failed_;
+
friend class MirOptimizationTest;
friend class ClassInitCheckEliminationTest;
friend class SuspendCheckEliminationTest;
@@ -1481,6 +1515,12 @@ class MIRGraph {
friend class TypeInferenceTest;
friend class QuickCFITest;
friend class QuickAssembleX86TestBase;
+
+ friend class QCMIRGraph;
+
+ public:
+ QCMIRGraph* qcm;
+
};
} // namespace art