Skip to content

Commit 3cc358a

Browse files
committed
core: Finallize dependency pass.
1 parent 3e8895a commit 3cc358a

3 files changed

Lines changed: 26 additions & 12 deletions

File tree

include/llvm/Dependency.h

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "llvm/Pass.h"
1515
#include "llvm/IR/Instructions.h"
1616
#include "llvm/IR/DebugInfoMetadata.h"
17+
#include <vector>
1718

1819
namespace llvm {
1920

@@ -78,16 +79,23 @@ namespace llvm {
7879

7980
class DependencyInstrInfoManager
8081
{
81-
using InfoType = SmallVector<DependencyInstrInfo *, 8>;
82-
InfoType vec;
82+
//using InfoType = SmallVector<DependencyInstrInfo *, 16>;
83+
//InfoType vec;
84+
size_t sz;
85+
DependencyInstrInfo **arr;
8386
public:
8487

88+
DependencyInstrInfoManager() {
89+
arr = new DependencyInstrInfo*[255];
90+
sz = 0;
91+
}
92+
8593
bool Verify() const {
8694

8795
}
8896

8997
void doFolding() {
90-
InfoType tmp;
98+
/*InfoType tmp;
9199
for (auto DI : vec) {
92100
for (auto TDI : tmp) {
93101
if (TDI->getSource() == DI->getSource()) {
@@ -101,24 +109,28 @@ namespace llvm {
101109
NEXT:
102110
;
103111
}
104-
vec = tmp;
112+
vec = tmp;*/
105113
}
106114

107115
void addInfo(DependencyInstrInfo *info) {
108-
vec.push_back(info);
116+
errs() << "Start adding\n";
117+
//vec.push_back(info);
118+
arr[sz++] = info;
119+
errs() << "Add info\n";
109120
}
110121

111-
InfoType::const_iterator begin() const {
112-
return vec.begin();
122+
DepdencyInstrInfo** begin() const {
123+
//return vec.begin();
124+
return arr;
113125
}
114-
126+
/*
115127
InfoType::const_iterator end() const {
116128
return vec.end();
117-
}
129+
}*/
118130
};
119131

120132
FunctionPass *createInterproceduralDependencyCheckPass();
121133

122134
}
123135

124-
#endif
136+
#endif

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ class BranchManager {
184184
public:
185185
BranchManager(Function *F) : function(F) {
186186
if (!F->isIntrinsic()) {
187+
errs() << F->getName() << '\n';
187188
start = new BlockNode(&F->getEntryBlock());
188189
nodes.push_back(start);
189190
if (BranchInst *bi =

lib/Target/RISCV/RISCVAsmPrinter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ void RISCVAsmPrinter::EmitInstruction(const MachineInstr *MI) {
8383
DependencyInstrInfoManager *mgr = reinterpret_cast<DependencyInstrInfoManager *>
8484
(MI->getDebugLoc()->getLine());
8585
mgr->doFolding();
86-
for (auto DI : *mgr)
87-
OutStreamer->AddComment(DI->getInfo());
86+
for (int i = 0; i < mgr->sz; i++)
87+
//for (auto DI : *mgr)
88+
OutStreamer->AddComment(mgr->arr[i]->getInfo());
8889
}
8990

9091
MCInst TmpInst;

0 commit comments

Comments
 (0)