x86scheduler.cpp 2.46 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// [AsmJit]
// Complete x86/x64 JIT and Remote Assembler for C++.
//
// [License]
// Zlib - See LICENSE.md file in the package.

// [Export]
#define ASMJIT_EXPORTS

// [Guard]
#include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) && (defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64))

// [Dependencies - AsmJit]
#include "../base/containers.h"
#include "../x86/x86scheduler_p.h"

// [Api-Begin]
#include "../apibegin.h"

namespace asmjit {

// ============================================================================
// [Internals]
// ============================================================================

//! \internal
struct X86ScheduleData {
  //! Registers read by the instruction.
  X86RegMask regsIn;
  //! Registers written by the instruction.
  X86RegMask regsOut;

  //! Flags read by the instruction.
  uint8_t flagsIn;
  //! Flags written by the instruction.
  uint8_t flagsOut;

  //! How many `uops` or `cycles` the instruction takes.
  uint8_t ops;
  //! Instruction latency.
  uint8_t latency;

  //! Which ports the instruction can run at.
  uint16_t ports;
  //! \internal
  uint16_t reserved;

  //! All instructions that this instruction depends on.
  PodList<InstNode*>::Link* dependsOn;
  //! All instructions that use the result of this instruction.
  PodList<InstNode*>::Link* usedBy;
};

// ============================================================================
// [asmjit::X86Scheduler - Construction / Destruction]
// ============================================================================

X86Scheduler::X86Scheduler(X86Compiler* compiler, const X86CpuInfo* cpuInfo) :
  _compiler(compiler),
  _cpuInfo(cpuInfo) {}
X86Scheduler::~X86Scheduler() {}

// ============================================================================
// [asmjit::X86Scheduler - Run]
// ============================================================================

Error X86Scheduler::run(Node* start, Node* stop) {
  /*
  ASMJIT_TLOG("[Schedule] === Begin ===");

  Zone zone(8096 - kZoneOverhead);
  Node* node_ = start;

  while (node_ != stop) {
    Node* next = node_->getNext();
    ASMJIT_ASSERT(node_->getType() == kNodeTypeInst);

    printf("  %s\n", X86Util::getInstInfo(static_cast<InstNode*>(node_)->getCode()).getInstName());
    node_ = next;
  }

  ASMJIT_TLOG("[Schedule] === End ===");
  */
  return kErrorOk;
}

} // asmjit namespace

// [Api-End]
#include "../apiend.h"

// [Guard]
#endif // !ASMJIT_DISABLE_COMPILER && (ASMJIT_BUILD_X86 || ASMJIT_BUILD_X64)