Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
c6c87982
Commit
c6c87982
authored
Feb 24, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix IR-prettifier to correctly remap void patchpoints
parent
6720893e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
33 deletions
+29
-33
src/codegen/irgen/util.cpp
src/codegen/irgen/util.cpp
+29
-33
No files found.
src/codegen/irgen/util.cpp
View file @
c6c87982
...
...
@@ -201,21 +201,40 @@ public:
return
module
->
getOrInsertGlobal
(
name
,
pt
->
getElementType
());
}
}
if
(
llvm
::
IntrinsicInst
*
ii
=
llvm
::
dyn_cast
<
llvm
::
IntrinsicInst
>
(
v
))
{
return
v
;
}
};
void
dumpPrettyIR
(
llvm
::
Function
*
f
)
{
//f->getParent()->dump();
//return;
std
::
unique_ptr
<
llvm
::
Module
>
tmp_module
(
llvm
::
CloneModule
(
f
->
getParent
()));
// std::unique_ptr<llvm::Module> tmp_module(new llvm::Module("tmp", g.context));
llvm
::
Function
*
new_f
=
tmp_module
->
begin
();
llvm
::
ValueToValueMapTy
VMap
;
llvm
::
RemapFlags
flags
=
llvm
::
RF_None
;
llvm
::
ValueMapTypeRemapper
*
type_remapper
=
NULL
;
PrettifyingMaterializer
materializer
(
tmp_module
.
get
(),
VMap
,
flags
,
type_remapper
);
for
(
llvm
::
Function
::
iterator
I
=
new_f
->
begin
(),
E
=
new_f
->
end
();
I
!=
E
;
++
I
)
{
VMap
[
I
]
=
I
;
}
for
(
llvm
::
inst_iterator
it
=
inst_begin
(
new_f
),
end
=
inst_end
(
new_f
);
it
!=
end
;
++
it
)
{
llvm
::
RemapInstruction
(
&*
it
,
VMap
,
flags
,
type_remapper
,
&
materializer
);
if
(
llvm
::
IntrinsicInst
*
ii
=
llvm
::
dyn_cast
<
llvm
::
IntrinsicInst
>
(
&*
it
))
{
if
(
ii
->
getIntrinsicID
()
==
llvm
::
Intrinsic
::
experimental_patchpoint_i64
||
ii
->
getIntrinsicID
()
==
llvm
::
Intrinsic
::
experimental_patchpoint_void
||
ii
->
getIntrinsicID
()
==
llvm
::
Intrinsic
::
experimental_patchpoint_double
)
{
int
pp_id
=
-
1
;
for
(
int
i
=
0
;
i
<
ii
->
getNumArgOperands
();
i
++
)
{
llvm
::
Value
*
op
=
ii
->
getArgOperand
(
i
);
if
(
i
!=
2
)
{
if
(
i
==
0
)
{
llvm
::
ConstantInt
*
l_pp_id
=
llvm
::
cast
<
llvm
::
ConstantInt
>
(
op
);
pp_id
=
l_pp_id
->
getSExtValue
();
}
ii
->
setArgOperand
(
i
,
llvm
::
MapValue
(
op
,
VMap
,
flags
,
type_remapper
,
this
));
continue
;
}
else
{
if
(
i
==
0
)
{
llvm
::
ConstantInt
*
l_pp_id
=
llvm
::
cast
<
llvm
::
ConstantInt
>
(
op
);
pp_id
=
l_pp_id
->
getSExtValue
();
}
else
if
(
i
==
2
)
{
assert
(
pp_id
!=
-
1
);
void
*
addr
=
PatchpointInfo
::
getSlowpathAddr
(
pp_id
);
...
...
@@ -234,35 +253,12 @@ public:
ii
->
setArgOperand
(
i
,
ptr_val
);
continue
;
}
else
{
ii
->
setArgOperand
(
i
,
module
->
getOrInsertGlobal
(
name
,
g
.
i8
));
ii
->
setArgOperand
(
i
,
tmp_
module
->
getOrInsertGlobal
(
name
,
g
.
i8
));
}
}
}
return
ii
;
}
}
return
v
;
}
};
void
dumpPrettyIR
(
llvm
::
Function
*
f
)
{
//f->getParent()->dump();
//return;
std
::
unique_ptr
<
llvm
::
Module
>
tmp_module
(
llvm
::
CloneModule
(
f
->
getParent
()));
// std::unique_ptr<llvm::Module> tmp_module(new llvm::Module("tmp", g.context));
llvm
::
Function
*
new_f
=
tmp_module
->
begin
();
llvm
::
ValueToValueMapTy
VMap
;
llvm
::
RemapFlags
flags
=
llvm
::
RF_None
;
llvm
::
ValueMapTypeRemapper
*
type_remapper
=
NULL
;
PrettifyingMaterializer
materializer
(
tmp_module
.
get
(),
VMap
,
flags
,
type_remapper
);
for
(
llvm
::
Function
::
iterator
I
=
new_f
->
begin
(),
E
=
new_f
->
end
();
I
!=
E
;
++
I
)
{
VMap
[
I
]
=
I
;
}
for
(
llvm
::
inst_iterator
it
=
inst_begin
(
new_f
),
end
=
inst_end
(
new_f
);
it
!=
end
;
++
it
)
{
llvm
::
RemapInstruction
(
&*
it
,
VMap
,
flags
,
type_remapper
,
&
materializer
);
}
tmp_module
->
begin
()
->
dump
();
// tmp_module->dump();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment