Commit e44c3238 authored by jarin's avatar jarin Committed by Commit bot

[turbofan] Simplified lowering - introduce the concept of UseInfo.

This CL introduces a concept of UseInfo (but internally it still
uses machine types). The idea of UseInfo is to separate the concept
of truncation (what information is actually used by the user node)
and the concept of preferred representation. At the moment, the
truncation is (clumsily) represented by the type part of the
underlying machine type (UseInfo::type_).

Moreover, in this CL, we never specify the signedness of the use
because use signedness does not really make sense:
- if we care about the sign, it should be in the input's type
  (this is DCHECKed).
- if we do not care (e.g., trunctaing word32), then it should not
  be necessary. (And it is upto the user how it interprets the bits.)

Review URL: https://codereview.chromium.org/1462503005

Cr-Commit-Position: refs/heads/master@{#32110}
parent 45a52b62
......@@ -632,7 +632,8 @@ void CodeGenerator::AddTranslationForOperand(Translation* translation,
Handle<Object> constant_object;
switch (constant.type()) {
case Constant::kInt32:
DCHECK(type == kMachInt32 || type == kMachUint32 || type == kRepBit);
DCHECK(type == kMachInt32 || type == kMachUint32 || type == kMachBool ||
type == kRepBit);
constant_object =
isolate()->factory()->NewNumberFromInt(constant.ToInt32());
break;
......
......@@ -52,7 +52,7 @@ class RepresentationChanger {
if (use_type & kRepTagged) {
return GetTaggedRepresentationFor(node, output_type);
} else if (use_type & kRepFloat32) {
return GetFloat32RepresentationFor(node, output_type);
return GetFloat32RepresentationFor(node, output_type, use_type);
} else if (use_type & kRepFloat64) {
return GetFloat64RepresentationFor(node, output_type, use_type);
} else if (use_type & kRepBit) {
......@@ -115,7 +115,8 @@ class RepresentationChanger {
return jsgraph()->graph()->NewNode(op, node);
}
Node* GetFloat32RepresentationFor(Node* node, MachineTypeUnion output_type) {
Node* GetFloat32RepresentationFor(Node* node, MachineTypeUnion output_type,
MachineTypeUnion truncation) {
// Eagerly fold representation changes for constants.
switch (node->opcode()) {
case IrOpcode::kFloat64Constant:
......@@ -143,6 +144,10 @@ class RepresentationChanger {
if (output_type & kTypeUint32) {
op = machine()->ChangeUint32ToFloat64();
} else {
// Either the output is int32 or the uses only care about the
// low 32 bits (so we can pick int32 safely).
DCHECK(output_type & kTypeInt32 ||
!(truncation & ~(kTypeInt32 | kTypeUint32 | kRepMask)));
op = machine()->ChangeInt32ToFloat64();
}
// int32 -> float64 -> float32
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment