5 #include "src/compiler/machine-graph.h" 7 #include "src/compiler/node-properties.h" 8 #include "src/external-reference.h" 14 Node* MachineGraph::Int32Constant(int32_t value) {
15 Node** loc = cache_.FindInt32Constant(value);
16 if (*loc ==
nullptr) {
17 *loc = graph()->NewNode(common()->Int32Constant(value));
22 Node* MachineGraph::Int64Constant(
int64_t value) {
23 Node** loc = cache_.FindInt64Constant(value);
24 if (*loc ==
nullptr) {
25 *loc = graph()->NewNode(common()->Int64Constant(value));
30 Node* MachineGraph::IntPtrConstant(intptr_t value) {
31 return machine()->Is32() ? Int32Constant(static_cast<int32_t>(value))
32 : Int64Constant(static_cast<
int64_t>(value));
35 Node* MachineGraph::RelocatableInt32Constant(int32_t value,
36 RelocInfo::Mode rmode) {
37 Node** loc = cache_.FindRelocatableInt32Constant(
38 value, static_cast<RelocInfoMode>(rmode));
39 if (*loc ==
nullptr) {
40 *loc = graph()->NewNode(common()->RelocatableInt32Constant(value, rmode));
45 Node* MachineGraph::RelocatableInt64Constant(
int64_t value,
46 RelocInfo::Mode rmode) {
47 Node** loc = cache_.FindRelocatableInt64Constant(
48 value, static_cast<RelocInfoMode>(rmode));
49 if (*loc ==
nullptr) {
50 *loc = graph()->NewNode(common()->RelocatableInt64Constant(value, rmode));
55 Node* MachineGraph::RelocatableIntPtrConstant(intptr_t value,
56 RelocInfo::Mode rmode) {
57 return kPointerSize == 8
58 ? RelocatableInt64Constant(value, rmode)
59 : RelocatableInt32Constant(static_cast<
int>(value), rmode);
62 Node* MachineGraph::Float32Constant(
float value) {
63 Node** loc = cache_.FindFloat32Constant(value);
64 if (*loc ==
nullptr) {
65 *loc = graph()->NewNode(common()->Float32Constant(value));
70 Node* MachineGraph::Float64Constant(
double value) {
71 Node** loc = cache_.FindFloat64Constant(value);
72 if (*loc ==
nullptr) {
73 *loc = graph()->NewNode(common()->Float64Constant(value));
78 Node* MachineGraph::PointerConstant(intptr_t value) {
79 Node** loc = cache_.FindPointerConstant(value);
80 if (*loc ==
nullptr) {
81 *loc = graph()->NewNode(common()->PointerConstant(value));
86 Node* MachineGraph::ExternalConstant(ExternalReference reference) {
87 Node** loc = cache_.FindExternalConstant(reference);
88 if (*loc ==
nullptr) {
89 *loc = graph()->NewNode(common()->ExternalConstant(reference));
94 Node* MachineGraph::ExternalConstant(Runtime::FunctionId function_id) {
95 return ExternalConstant(ExternalReference::Create(function_id));