summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2021-12-23 18:07:38 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2023-10-17 08:34:49 +0000
commitf7bd87edf3b80ce3bbd6e571fd119c878cb79992 (patch)
treeb190e125c6e9f12040632644bf45ce7ab6fe82f7 /compiler/optimizing/nodes.h
parentb983874f2296c4d5a063d9e3d33f8a50fc865a09 (diff)
Add branch profiling in baseline compiler.
Currently unused. Follow-up CLs will make use of the data. Test: test.py Bug: 304969871 Change-Id: I486faba3de030061715d06ab9fdb33970d319d9b
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 3613b9519b..04d51328f2 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -2663,7 +2663,12 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> {
void RemoveEnvironmentUsers();
bool IsEmittedAtUseSite() const { return GetPackedFlag<kFlagEmittedAtUseSite>(); }
- void MarkEmittedAtUseSite() { SetPackedFlag<kFlagEmittedAtUseSite>(true); }
+ void MarkEmittedAtUseSite() {
+ // When compiling baseline, in order to do branch profiling, we don't want to
+ // emit conditions at use site.
+ DCHECK(!IsCondition() || !GetBlock()->GetGraph()->IsCompilingBaseline());
+ SetPackedFlag<kFlagEmittedAtUseSite>(true);
+ }
protected:
// If set, the machine code for this instruction is assumed to be generated by
@@ -3519,7 +3524,9 @@ class HDoubleConstant final : public HConstant {
class HIf final : public HExpression<1> {
public:
explicit HIf(HInstruction* input, uint32_t dex_pc = kNoDexPc)
- : HExpression(kIf, SideEffects::None(), dex_pc) {
+ : HExpression(kIf, SideEffects::None(), dex_pc),
+ true_count_(std::numeric_limits<uint16_t>::max()),
+ false_count_(std::numeric_limits<uint16_t>::max()) {
SetRawInputAt(0, input);
}
@@ -3534,10 +3541,20 @@ class HIf final : public HExpression<1> {
return GetBlock()->GetSuccessors()[1];
}
+ void SetTrueCount(uint16_t count) { true_count_ = count; }
+ uint16_t GetTrueCount() const { return true_count_; }
+
+ void SetFalseCount(uint16_t count) { false_count_ = count; }
+ uint16_t GetFalseCount() const { return false_count_; }
+
DECLARE_INSTRUCTION(If);
protected:
DEFAULT_COPY_CONSTRUCTOR(If);
+
+ private:
+ uint16_t true_count_;
+ uint16_t false_count_;
};