// Note: this include order may seem strange and is against the regular style. However it is the // required order as nodes_shared does not have the right dependency chain and compilation // will fail (as AsType on HInstruction will be defined before the full Instruction). #include"nodes.h"
#include"nodes_shared.h"
#include"instruction_simplifier_shared.h"
namespace art HIDDEN {
using helpers::CanFitInShifterOperand;
void HDataProcWithShifterOp::GetOpInfoFromInstruction(HInstruction* instruction, /*out*/OpKind* op_kind, /*out*/int* shift_amount) {
DCHECK(CanFitInShifterOperand(instruction)); if (instruction->IsTypeConversion()) {
DataType::Type result_type = instruction->AsTypeConversion()->GetResultType();
DataType::Type input_type = instruction->AsTypeConversion()->GetInputType(); int result_size = DataType::Size(result_type); int input_size = DataType::Size(input_type); int min_size = std::min(result_size, input_size); if (result_type == DataType::Type::kInt32 && input_type == DataType::Type::kInt64) { // There is actually nothing to do. On ARM the high register from the // pair will be ignored. On ARM64 the register will be used as a W // register, discarding the top bits. This is represented by the // default encoding 'LSL 0'.
*op_kind = kLSL;
*shift_amount = 0;
} elseif (result_type == DataType::Type::kUint8 ||
(input_type == DataType::Type::kUint8 && input_size < result_size)) {
*op_kind = kUXTB;
} elseif (result_type == DataType::Type::kUint16 ||
(input_type == DataType::Type::kUint16 && input_size < result_size)) {
*op_kind = kUXTH;
} else { switch (min_size) { case1: *op_kind = kSXTB; break; case2: *op_kind = kSXTH; break; case4: *op_kind = kSXTW; break; default:
LOG(FATAL) << "Unexpected min size " << min_size;
}
}
} else {
DCHECK(instruction->IsShl() || instruction->IsShr() || instruction->IsUShr());
*op_kind = instruction->IsShl() ? kLSL : instruction->IsShr() ? kASR : kLSR; int implicit_mask = (instruction->GetType() == DataType::Type::kInt64)
? kMaxLongShiftDistance
: kMaxIntShiftDistance;
*shift_amount =
instruction->AsBinaryOperation()->GetRight()->AsIntConstant()->GetValue() & implicit_mask;
DCHECK_NE(*shift_amount, 0);
}
}
std::ostream& operator<<(std::ostream& os, const HDataProcWithShifterOp::OpKind op) { switch (op) { case HDataProcWithShifterOp::kLSL: return os << "LSL"; case HDataProcWithShifterOp::kLSR: return os << "LSR"; case HDataProcWithShifterOp::kASR: return os << "ASR"; case HDataProcWithShifterOp::kUXTB: return os << "UXTB"; case HDataProcWithShifterOp::kUXTH: return os << "UXTH"; case HDataProcWithShifterOp::kUXTW: return os << "UXTW"; case HDataProcWithShifterOp::kSXTB: return os << "SXTB"; case HDataProcWithShifterOp::kSXTH: return os << "SXTH"; case HDataProcWithShifterOp::kSXTW: return os << "SXTW"; default:
LOG(FATAL) << "Invalid OpKind " << static_cast<int>(op);
UNREACHABLE();
}
}
} // namespace art
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.