Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
d9d6f341
Commit
d9d6f341
authored
5 years ago
by
Yifan Zhao
Browse files
Options
Downloads
Plain Diff
Merge branch 'hpvm-remove-output' into hpvm-release-internal
parents
3a6bd84d
aa46176b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
+11
-11
11 additions, 11 deletions
hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp
+81
-114
81 additions, 114 deletions
hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp
with
92 additions
and
125 deletions
hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
+
11
−
11
View file @
d9d6f341
...
...
@@ -123,7 +123,7 @@ public:
};
bool
DFG2LLVM_X86
::
runOnModule
(
Module
&
M
)
{
errs
()
<<
"
\n
DFG2LLVM_X86 PASS
\n
"
;
DEBUG
(
errs
()
<<
"
\n
DFG2LLVM_X86 PASS
\n
"
)
;
// Get the BuildDFG Analysis Results:
// - Dataflow graph
...
...
@@ -910,9 +910,9 @@ void CGT_X86::invokeChild_X86(DFNode *C, Function *F_X86,
for
(
unsigned
j
=
0
;
j
<
6
;
j
++
)
Args
.
push_back
(
I64Zero
);
errs
()
<<
"Gen Function type: "
<<
*
CF_X86
->
getType
()
<<
"
\n
"
;
errs
()
<<
"Node Function type: "
<<
*
CF
->
getType
()
<<
"
\n
"
;
errs
()
<<
"Arguments: "
<<
Args
.
size
()
<<
"
\n
"
;
DEBUG
(
errs
()
<<
"Gen Function type: "
<<
*
CF_X86
->
getType
()
<<
"
\n
"
)
;
DEBUG
(
errs
()
<<
"Node Function type: "
<<
*
CF
->
getType
()
<<
"
\n
"
)
;
DEBUG
(
errs
()
<<
"Arguments: "
<<
Args
.
size
()
<<
"
\n
"
)
;
// Call the F_X86 function associated with this node
CallInst
*
CI
=
...
...
@@ -1194,10 +1194,10 @@ void CGT_X86::codeGen(DFInternalNode *N) {
continue
;
if
(
!
(
C
->
hasX86GenFuncForTarget
(
hpvm
::
CPU_TARGET
)))
{
errs
()
<<
"No CPU x86 version for child node "
<<
C
->
getFuncPointer
()
->
getName
()
<<
"
\n
Skip code gen for parent node "
<<
N
->
getFuncPointer
()
->
getName
()
<<
"
\n
"
;
DEBUG
(
errs
()
<<
"No CPU x86 version for child node "
<<
C
->
getFuncPointer
()
->
getName
()
<<
"
\n
Skip code gen for parent node "
<<
N
->
getFuncPointer
()
->
getName
()
<<
"
\n
"
)
;
codeGen
=
false
;
}
}
...
...
@@ -1420,8 +1420,8 @@ void CGT_X86::codeGen(DFLeafNode *N) {
// return;
if
(
!
preferredTargetIncludes
(
N
,
hpvm
::
CPU_TARGET
))
{
errs
()
<<
"No CPU hint for node "
<<
N
->
getFuncPointer
()
->
getName
()
<<
" : skipping it
\n
"
;
DEBUG
(
errs
()
<<
"No CPU hint for node "
<<
N
->
getFuncPointer
()
->
getName
()
<<
" : skipping it
\n
"
)
;
switch
(
N
->
getTag
())
{
case
hpvm
::
GPU_TARGET
:
...
...
@@ -1492,7 +1492,7 @@ void CGT_X86::codeGen(DFLeafNode *N) {
ArrayRef
<
Value
*>
(
ArgPtrCallArgs
,
2
),
""
,
Terminator
);
}
}
errs
()
<<
*
BB
<<
"
\n
"
;
DEBUG
(
errs
()
<<
*
BB
<<
"
\n
"
)
;
// Go through all the instructions
for
(
inst_iterator
i
=
inst_begin
(
F_X86
),
e
=
inst_end
(
F_X86
);
i
!=
e
;
++
i
)
{
...
...
This diff is collapsed.
Click to expand it.
hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp
+
81
−
114
View file @
d9d6f341
...
...
@@ -29,15 +29,8 @@
#include
<iostream>
//#include "PHINodePass.h
"
#define DEBUG_TYPE "cbe
"
// Jackson Korba 9/29/14
#ifndef DEBUG_TYPE
#define DEBUG_TYPE ""
#endif
// End Modification
#define DEBUG(x) x
// Some ms header decided to define setjmp as _setjmp, undo this for this file
// since we don't need it
#ifdef setjmp
...
...
@@ -149,7 +142,7 @@ bool CWriter::isInlineAsm(Instruction &I) const {
bool
CWriter
::
runOnFunction
(
Function
&
F
)
{
// Do not codegen any 'available_externally' functions at all, they have
// definitions outside the translation unit.
errs
()
<<
"Running CBE on function: "
<<
F
.
getName
()
<<
"
\n
"
;
DEBUG
(
errs
()
<<
"Running CBE on function: "
<<
F
.
getName
()
<<
"
\n
"
)
;
if
(
F
.
hasAvailableExternallyLinkage
())
return
false
;
...
...
@@ -262,9 +255,7 @@ raw_ostream &CWriter::printTypeString(raw_ostream &Out, Type *Ty,
}
default
:
#ifndef NDEBUG
errs
()
<<
"Unknown primitive type: "
<<
*
Ty
<<
"
\n
"
;
#endif
DEBUG
(
errs
()
<<
"Unknown primitive type: "
<<
*
Ty
<<
"
\n
"
);
llvm_unreachable
(
0
);
}
}
...
...
@@ -367,9 +358,7 @@ static const std::string getCmpPredicateName(CmpInst::Predicate P) {
case
ICmpInst
::
ICMP_SGT
:
return
"sgt"
;
default:
#ifndef NDEBUG
errs
()
<<
"Invalid icmp predicate!"
<<
P
;
#endif
DEBUG
(
errs
()
<<
"Invalid icmp predicate!"
<<
P
);
llvm_unreachable
(
0
);
}
}
...
...
@@ -414,9 +403,7 @@ raw_ostream &CWriter::printSimpleType(raw_ostream &Out, Type *Ty,
<<
" __attribute__((vector_size(8)))"
;
default
:
#ifndef NDEBUG
errs
()
<<
"Unknown primitive type: "
<<
*
Ty
<<
"
\n
"
;
#endif
DEBUG
(
errs
()
<<
"Unknown primitive type: "
<<
*
Ty
<<
"
\n
"
);
llvm_unreachable
(
0
);
}
}
...
...
@@ -462,9 +449,7 @@ CWriter::printTypeName(raw_ostream &Out, Type *Ty, bool isSigned,
}
default
:
#ifndef NDEBUG
errs
()
<<
"Unexpected type: "
<<
*
Ty
<<
"
\n
"
;
#endif
DEBUG
(
errs
()
<<
"Unexpected type: "
<<
*
Ty
<<
"
\n
"
);
llvm_unreachable
(
0
);
}
}
...
...
@@ -1067,9 +1052,8 @@ void CWriter::printConstant(Constant *CPV, enum OperandContext Context) {
return
;
}
default
:
#ifndef NDEBUG
errs
()
<<
"CWriter Error: Unhandled constant expression: "
<<
*
CE
<<
"
\n
"
;
#endif
DEBUG
(
errs
()
<<
"CWriter Error: Unhandled constant expression: "
<<
*
CE
<<
"
\n
"
);
llvm_unreachable
(
0
);
}
}
else
if
(
isa
<
UndefValue
>
(
CPV
)
&&
CPV
->
getType
()
->
isSingleValueType
())
{
...
...
@@ -1344,9 +1328,7 @@ void CWriter::printConstant(Constant *CPV, enum OperandContext Context) {
}
// FALL THROUGH
default
:
#ifndef NDEBUG
errs
()
<<
"Unknown constant type: "
<<
*
CPV
<<
"
\n
"
;
#endif
DEBUG
(
errs
()
<<
"Unknown constant type: "
<<
*
CPV
<<
"
\n
"
);
llvm_unreachable
(
0
);
}
}
...
...
@@ -2447,9 +2429,7 @@ void CWriter::generateHeader(Module &M) {
Out
<<
" > "
;
break
;
default:
#ifndef NDEBUG
errs
()
<<
"Invalid icmp predicate!"
<<
(
*
it
).
first
;
#endif
DEBUG
(
errs
()
<<
"Invalid icmp predicate!"
<<
(
*
it
).
first
);
llvm_unreachable
(
0
);
}
Out
<<
"r.vector["
<<
n
<<
"];
\n
"
;
...
...
@@ -2688,9 +2668,7 @@ void CWriter::generateHeader(Module &M) {
Out
<<
" >> "
;
break
;
default:
#ifndef NDEBUG
errs
()
<<
"Invalid operator type!"
<<
opcode
;
#endif
DEBUG
(
errs
()
<<
"Invalid operator type!"
<<
opcode
);
llvm_unreachable
(
0
);
}
Out
<<
"b.vector["
<<
n
<<
"]"
;
...
...
@@ -2746,9 +2724,7 @@ void CWriter::generateHeader(Module &M) {
Out
<<
" >> "
;
break
;
default:
#ifndef NDEBUG
errs
()
<<
"Invalid operator type!"
<<
opcode
;
#endif
DEBUG
(
errs
()
<<
"Invalid operator type!"
<<
opcode
);
llvm_unreachable
(
0
);
}
Out
<<
"b;
\n
"
;
...
...
@@ -2821,9 +2797,7 @@ void CWriter::generateHeader(Module &M) {
Out
<<
"AShr"
;
break
;
default:
#ifndef NDEBUG
errs
()
<<
"Invalid operator type!"
<<
opcode
;
#endif
DEBUG
(
errs
()
<<
"Invalid operator type!"
<<
opcode
);
llvm_unreachable
(
0
);
}
Out
<<
"(16, &a, &b, &r);
\n
"
;
...
...
@@ -2888,9 +2862,7 @@ void CWriter::generateHeader(Module &M) {
Out
<<
" >> "
;
break
;
default:
#ifndef NDEBUG
errs
()
<<
"Invalid operator type!"
<<
opcode
;
#endif
DEBUG
(
errs
()
<<
"Invalid operator type!"
<<
opcode
);
llvm_unreachable
(
0
);
}
Out
<<
"b"
;
...
...
@@ -3569,7 +3541,7 @@ void CWriter::printLoop(Loop *L) {
Loop
::
LoopBounds
::
Direction
::
Increasing
)
?
"increasing"
:
"decreasing"
)
<<
"
\n
"
;
)
<<
"
\n
"
)
;
std
::
string
startStr
;
if
(
ConstantInt
*
startConst
=
dyn_cast
<
ConstantInt
>
(
StartValue
))
{
...
...
@@ -3592,7 +3564,7 @@ void CWriter::printLoop(Loop *L) {
DEBUG
(
errs
()
<<
"
\n
for ( "
<<
IVName
<<
" = "
<<
startStr
<<
"; "
<<
IVName
<<
BranchPredicate
<<
finalStr
<<
"; "
<<
IVName
<<
" = "
<<
IVName
<<
" + "
<<
stepStr
<<
") {
\n
"
;
)
<<
" = "
<<
IVName
<<
" + "
<<
stepStr
<<
") {
\n
"
)
;
Out
<<
"
\n
for ( "
<<
IVName
<<
" = "
<<
startStr
<<
"; "
<<
IVName
<<
BranchPredicate
<<
finalStr
<<
"; "
<<
IVName
<<
" = "
<<
IVName
...
...
@@ -4039,7 +4011,7 @@ bool CWriter::findMatch(BasicBlock *CurrBlock, BasicBlock *CompBlock,
// that immediately succeeds the current one.
//
void
CWriter
::
visitBranchInst
(
BranchInst
&
I
)
{
errs
()
<<
"Visiting Branch Instruction: "
<<
I
<<
"
\n
"
;
DEBUG
(
errs
()
<<
"Visiting Branch Instruction: "
<<
I
<<
"
\n
"
)
;
Out
<<
"
\n
/* Branch: "
<<
I
<<
" */
\n
"
;
if
(
I
.
isConditional
())
{
...
...
@@ -4055,12 +4027,13 @@ void CWriter::visitBranchInst(BranchInst &I) {
}
if
(
Loop
*
L
=
LI
->
getLoopFor
(
I
.
getParent
()))
{
if
(
L
==
LI
->
getLoopFor
(
BB0
)
&&
!
(
L
==
LI
->
getLoopFor
(
BB1
)))
{
errs
()
<<
"This is a loop branch!
\n
"
;
DEBUG
(
errs
()
<<
"This is a loop branch!
\n
"
)
;
Out
<<
"/* This is a loop branch! */
\n
"
;
// BB0 is in the loop. Print it if it hsn't been printed
if
(
VisitedBlocks
.
find
(
BB0
)
!=
VisitedBlocks
.
end
())
{
errs
()
<<
"Branching back to header: "
<<
BB0
->
getName
()
<<
"
\n
"
;
errs
()
<<
"This is the end of the loop, closing!
\n
"
;
DEBUG
(
errs
()
<<
"Branching back to header: "
<<
BB0
->
getName
()
<<
"
\n
"
);
DEBUG
(
errs
()
<<
"This is the end of the loop, closing!
\n
"
);
Out
<<
"/* Branching back to header: "
<<
BB0
->
getName
()
<<
" */
\n
"
;
Out
<<
"/* Closing loop! */
\n
"
;
// BB0 is the loop header. CLose the loop then print BB1.
...
...
@@ -4069,18 +4042,19 @@ void CWriter::visitBranchInst(BranchInst &I) {
printPHICopiesForSuccessor
(
I
.
getParent
(),
BB1
,
2
);
printBBorLoop
(
BB1
);
}
else
{
errs
()
<<
"Not branching to header! Branching to: "
<<
BB0
->
getName
()
<<
"
\n
"
;
DEBUG
(
errs
()
<<
"Not branching to header! Branching to: "
<<
BB0
->
getName
()
<<
"
\n
"
)
;
// BB0 is not the loop header. That means we are entering loop body
llvm_unreachable
(
"loop branch unhandled!
\n
"
);
}
}
else
if
(
L
==
LI
->
getLoopFor
(
BB1
)
&&
!
(
L
==
LI
->
getLoopFor
(
BB0
)))
{
errs
()
<<
"This is a loop branch!
\n
"
;
DEBUG
(
errs
()
<<
"This is a loop branch!
\n
"
)
;
Out
<<
"/* This is a loop branch! */
\n
"
;
if
(
VisitedBlocks
.
find
(
BB1
)
!=
VisitedBlocks
.
end
())
{
errs
()
<<
"Branching back to header: "
<<
BB1
->
getName
()
<<
"
\n
"
;
errs
()
<<
"This is the end of the loop, closing!
\n
"
;
DEBUG
(
errs
()
<<
"Branching back to header: "
<<
BB1
->
getName
()
<<
"
\n
"
);
DEBUG
(
errs
()
<<
"This is the end of the loop, closing!
\n
"
);
Out
<<
"/* Branching back to header: "
<<
BB1
->
getName
()
<<
" */
\n
"
;
Out
<<
"/* Closing loop! */
\n
"
;
// BB0 is the loop header. CLose the loop then print BB1.
...
...
@@ -4089,22 +4063,23 @@ void CWriter::visitBranchInst(BranchInst &I) {
printPHICopiesForSuccessor
(
I
.
getParent
(),
BB0
,
2
);
printBBorLoop
(
BB0
);
}
else
{
errs
()
<<
"Not branching to header! Branching to: "
<<
BB1
->
getName
()
<<
"
\n
"
;
DEBUG
(
errs
()
<<
"Not branching to header! Branching to: "
<<
BB1
->
getName
()
<<
"
\n
"
)
;
// BB1 is not the loop header. That means we are entering loop body
llvm_unreachable
(
"loop branch unhandled!
\n
"
);
}
}
else
{
errs
()
<<
"This is a conditional statement within a loop!
\n
"
;
DEBUG
(
errs
()
<<
"This is a conditional statement within a loop!
\n
"
)
;
Out
<<
"/* This is a conditional statement within a loop! */
\n
"
;
errs
()
<<
ImmPostDomm
->
getName
()
<<
" is the immediate post dominator of "
<<
BB0
->
getName
()
<<
" and "
<<
BB1
->
getName
()
<<
"
\n
"
;
DEBUG
(
errs
()
<<
ImmPostDomm
->
getName
()
<<
" is the immediate post dominator of "
<<
BB0
->
getName
()
<<
" and "
<<
BB1
->
getName
()
<<
"
\n
"
)
;
if
(
VisitedBlocks
.
find
(
ImmPostDomm
)
!=
VisitedBlocks
.
end
())
{
errs
()
<<
"Not pushing "
<<
ImmPostDomm
->
getName
()
<<
" because it has already been visited!
\n
"
;
DEBUG
(
errs
()
<<
"Not pushing "
<<
ImmPostDomm
->
getName
()
<<
" because it has already been visited!
\n
"
)
;
}
else
{
errs
()
<<
"Pushing "
<<
ImmPostDomm
->
getName
()
<<
" onto stack!
\n
"
;
DEBUG
(
errs
()
<<
"Pushing "
<<
ImmPostDomm
->
getName
()
<<
" onto stack!
\n
"
);
ImmPostDommBlocks
.
push
(
ImmPostDomm
);
}
...
...
@@ -4117,25 +4092,25 @@ void CWriter::visitBranchInst(BranchInst &I) {
Out
<<
") { /* "
<<
I
<<
"*/
\n
"
;
printPHICopiesForSuccessor
(
I
.
getParent
(),
BB0
,
2
);
printBBorLoop
(
BB0
);
errs
()
<<
"Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
"
\n
"
;
DEBUG
(
errs
()
<<
"Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
"
\n
"
)
;
Out
<<
"/* Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
" */
\n
"
;
if
(
!
noElse
)
{
errs
()
<<
"Printing else!
\n
"
;
DEBUG
(
errs
()
<<
"Printing else!
\n
"
)
;
Out
<<
" } else { /*"
<<
I
<<
"*/
\n
"
;
printPHICopiesForSuccessor
(
I
.
getParent
(),
BB1
,
2
);
ElseBlocks
.
push
(
BB1
);
ElseBranches
.
push
(
&
I
);
printBBorLoop
(
BB1
);
errs
()
<<
"Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
"
\n
"
;
errs
()
<<
"Check to see if else block is closed!
\n
"
;
DEBUG
(
errs
()
<<
"Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
"
\n
"
)
;
DEBUG
(
errs
()
<<
"Check to see if else block is closed!
\n
"
)
;
Out
<<
"/* Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
" */
\n
"
;
Out
<<
"/* Check to see if else block is closed! */
\n
"
;
if
(
!
ElseBlocks
.
empty
()
&&
ElseBlocks
.
top
()
==
BB1
)
{
errs
()
<<
"Else block not closed, need to close braces!
\n
"
;
DEBUG
(
errs
()
<<
"Else block not closed, need to close braces!
\n
"
)
;
Out
<<
"/* Else block not closed, need to close braces! */
\n
"
;
Out
<<
"} /* closing "
<<
*
(
ElseBranches
.
top
())
<<
" */
\n
"
;
ElseBranches
.
pop
();
...
...
@@ -4143,20 +4118,20 @@ void CWriter::visitBranchInst(BranchInst &I) {
}
if
(
!
ImmPostDommBlocks
.
empty
()
&&
ImmPostDommBlocks
.
top
()
==
ImmPostDomm
)
{
errs
()
<<
"Will now pop post dom them handle it!
\n
"
;
DEBUG
(
errs
()
<<
"Will now pop post dom them handle it!
\n
"
)
;
ImmPostDommBlocks
.
pop
();
printBBorLoop
(
ImmPostDomm
);
}
else
{
errs
()
<<
"*!*!*!*!*!*!Not sure what is happening
here!*!*!*!*!*!*!
\n
"
;
DEBUG
(
errs
()
<<
"*!*!*!*!*!*!Not sure what is happening "
"
here!*!*!*!*!*!*!
\n
"
)
;
}
}
else
{
errs
()
<<
"No else block. Adding one for phis, then moving to "
<<
BB1
->
getName
()
<<
"!
\n
"
;
DEBUG
(
errs
()
<<
"No else block. Adding one for phis, then moving to "
<<
BB1
->
getName
()
<<
"!
\n
"
)
;
Out
<<
"/* (3913) No else block. Adding one for phis, then moving to "
<<
BB1
->
getName
()
<<
"! */
\n
"
;
Out
<<
" } /* closing "
<<
I
<<
"*/
\n
"
;
errs
()
<<
"Will now pop post dom them handle it!
\n
"
;
DEBUG
(
errs
()
<<
"Will now pop post dom them handle it!
\n
"
)
;
ImmPostDommBlocks
.
pop
();
Out
<<
"else {
\n
"
;
printPHICopiesForSuccessor
(
I
.
getParent
(),
BB1
,
2
);
...
...
@@ -4165,14 +4140,16 @@ void CWriter::visitBranchInst(BranchInst &I) {
}
}
}
else
{
errs
()
<<
"This is a conditional statement!
\n
"
;
errs
()
<<
ImmPostDomm
->
getName
()
<<
" is the immediate post dominator of "
<<
BB0
->
getName
()
<<
" and "
<<
BB1
->
getName
()
<<
"
\n
"
;
DEBUG
(
errs
()
<<
"This is a conditional statement!
\n
"
);
DEBUG
(
errs
()
<<
ImmPostDomm
->
getName
()
<<
" is the immediate post dominator of "
<<
BB0
->
getName
()
<<
" and "
<<
BB1
->
getName
()
<<
"
\n
"
);
if
(
VisitedBlocks
.
find
(
ImmPostDomm
)
!=
VisitedBlocks
.
end
())
{
errs
()
<<
"Not pushing "
<<
ImmPostDomm
->
getName
()
<<
" because it has already been visited!
\n
"
;
DEBUG
(
errs
()
<<
"Not pushing "
<<
ImmPostDomm
->
getName
()
<<
" because it has already been visited!
\n
"
)
;
}
else
{
errs
()
<<
"Pushing "
<<
ImmPostDomm
->
getName
()
<<
" onto stack!
\n
"
;
DEBUG
(
errs
()
<<
"Pushing "
<<
ImmPostDomm
->
getName
()
<<
" onto stack!
\n
"
);
ImmPostDommBlocks
.
push
(
ImmPostDomm
);
}
bool
noElse
=
false
;
...
...
@@ -4184,26 +4161,26 @@ void CWriter::visitBranchInst(BranchInst &I) {
Out
<<
") { /* "
<<
I
<<
"*/
\n
"
;
printPHICopiesForSuccessor
(
I
.
getParent
(),
BB0
,
2
);
printBBorLoop
(
BB0
);
errs
()
<<
"Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
"
\n
"
;
DEBUG
(
errs
()
<<
"Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
"
\n
"
)
;
Out
<<
"/* Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
" */
\n
"
;
if
(
!
noElse
)
{
errs
()
<<
"Printing else!
\n
"
;
DEBUG
(
errs
()
<<
"Printing else!
\n
"
)
;
Out
<<
"/* Printing else! */
\n
"
;
Out
<<
" } else { /*"
<<
I
<<
"*/
\n
"
;
printPHICopiesForSuccessor
(
I
.
getParent
(),
BB1
,
2
);
ElseBlocks
.
push
(
BB1
);
ElseBranches
.
push
(
&
I
);
printBBorLoop
(
BB1
);
errs
()
<<
"Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
"
\n
"
;
errs
()
<<
"Check to see if else block is closed!
\n
"
;
DEBUG
(
errs
()
<<
"Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
"
\n
"
)
;
DEBUG
(
errs
()
<<
"Check to see if else block is closed!
\n
"
)
;
Out
<<
"/* Back to handling "
<<
I
.
getParent
()
->
getName
()
<<
": "
<<
I
<<
" */
\n
"
;
Out
<<
"/* Check to see if else block is closed! */
\n
"
;
if
(
!
ElseBlocks
.
empty
()
&&
ElseBlocks
.
top
()
==
BB1
)
{
errs
()
<<
"Else block not closed, need to close braces!
\n
"
;
DEBUG
(
errs
()
<<
"Else block not closed, need to close braces!
\n
"
)
;
Out
<<
"/* Else block not closed, need to close braces! */
\n
"
;
Out
<<
"} /* closing "
<<
*
(
ElseBranches
.
top
())
<<
" */
\n
"
;
ElseBranches
.
pop
();
...
...
@@ -4211,20 +4188,21 @@ void CWriter::visitBranchInst(BranchInst &I) {
}
if
(
!
ImmPostDommBlocks
.
empty
()
&&
ImmPostDommBlocks
.
top
()
==
ImmPostDomm
)
{
errs
()
<<
"Will now pop post dom them handle it!
\n
"
;
DEBUG
(
errs
()
<<
"Will now pop post dom them handle it!
\n
"
)
;
ImmPostDommBlocks
.
pop
();
printBBorLoop
(
ImmPostDomm
);
}
else
{
errs
()
<<
"*!*!*!*!*!*!Not sure what is happening here!*!*!*!*!*!*!
\n
"
;
DEBUG
(
errs
()
<<
"*!*!*!*!*!*!Not sure what is happening here!*!*!*!*!*!*!
\n
"
);
}
}
else
{
errs
()
<<
"No else block. Adding one for phis, then moving to "
<<
BB1
->
getName
()
<<
"!
\n
"
;
DEBUG
(
errs
()
<<
"No else block. Adding one for phis, then moving to "
<<
BB1
->
getName
()
<<
"!
\n
"
)
;
Out
<<
"/* (3985) No else block. Adding one for phis, then moving to "
<<
BB1
->
getName
()
<<
"! */
\n
"
;
Out
<<
" } /* closing "
<<
I
<<
"*/
\n
"
;
errs
()
<<
"Will now pop post dom them handle it!
\n
"
;
DEBUG
(
errs
()
<<
"Will now pop post dom them handle it!
\n
"
)
;
ImmPostDommBlocks
.
pop
();
Out
<<
"else {
\n
"
;
printPHICopiesForSuccessor
(
I
.
getParent
(),
BB1
,
2
);
...
...
@@ -4233,11 +4211,12 @@ void CWriter::visitBranchInst(BranchInst &I) {
}
}
}
else
{
errs
()
<<
"This is an unconditional branch!
\n
"
;
DEBUG
(
errs
()
<<
"This is an unconditional branch!
\n
"
)
;
BasicBlock
*
BB
=
I
.
getSuccessor
(
0
);
printPHICopiesForSuccessor
(
I
.
getParent
(),
BB
,
2
);
if
(
!
ElseBlocks
.
empty
()
&&
I
.
getParent
()
==
ElseBlocks
.
top
())
{
errs
()
<<
"Branch marks end of else block, need to close braces!
\n
"
;
DEBUG
(
errs
()
<<
"Branch marks end of else block, need to close braces!
\n
"
);
Out
<<
"/* Branch marks end of else block, need to close braces! */
\n
"
;
Out
<<
"} /* closing "
<<
*
(
ElseBranches
.
top
())
<<
" */
\n
"
;
ElseBranches
.
pop
();
...
...
@@ -4470,9 +4449,7 @@ void CWriter::visitBinaryOperator(BinaryOperator &I) {
Out
<<
" >> "
;
break
;
default:
#ifndef NDEBUG
errs
()
<<
"Invalid operator type!"
<<
I
;
#endif
DEBUG
(
errs
()
<<
"Invalid operator type!"
<<
I
);
llvm_unreachable
(
0
);
}
...
...
@@ -4534,9 +4511,7 @@ void CWriter::visitICmpInst(ICmpInst &I) {
Out
<<
" > "
;
break
;
default:
#ifndef NDEBUG
errs
()
<<
"Invalid icmp predicate!"
<<
I
;
#endif
DEBUG
(
errs
()
<<
"Invalid icmp predicate!"
<<
I
);
llvm_unreachable
(
0
);
}
...
...
@@ -4774,9 +4749,7 @@ void CWriter::printIntrinsicDefinition(FunctionType *funT, unsigned Opcode,
"CBackend does not support arbitrary size integers."
);
switch
(
Opcode
)
{
default:
#ifndef NDEBUG
errs
()
<<
"Unsupported Intrinsic!"
<<
Opcode
;
#endif
DEBUG
(
errs
()
<<
"Unsupported Intrinsic!"
<<
Opcode
);
llvm_unreachable
(
0
);
case
Intrinsic
::
uadd_with_overflow
:
...
...
@@ -4878,17 +4851,13 @@ void CWriter::printIntrinsicDefinition(FunctionType *funT, unsigned Opcode,
}
else
if
(
elemT
->
isPPC_FP128Ty
())
{
suffix
=
"l"
;
}
else
{
#ifndef NDEBUG
errs
()
<<
"Unsupported Intrinsic!"
<<
Opcode
;
#endif
DEBUG
(
errs
()
<<
"Unsupported Intrinsic!"
<<
Opcode
);
llvm_unreachable
(
0
);
}
switch
(
Opcode
)
{
default:
#ifndef NDEBUG
errs
()
<<
"Unsupported Intrinsic!"
<<
Opcode
;
#endif
DEBUG
(
errs
()
<<
"Unsupported Intrinsic!"
<<
Opcode
);
llvm_unreachable
(
0
);
case
Intrinsic
::
ceil
:
...
...
@@ -5138,9 +5107,7 @@ bool CWriter::visitBuiltinCall(CallInst &I, Intrinsic::ID ID) {
switch
(
ID
)
{
default:
{
#ifndef NDEBUG
errs
()
<<
"Unknown LLVM intrinsic! "
<<
I
;
#endif
DEBUG
(
errs
()
<<
"Unknown LLVM intrinsic! "
<<
I
);
llvm_unreachable
(
0
);
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment