Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LLVM bpEVL
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Lorenzo Albano
LLVM bpEVL
Commits
8fd87e5f
Commit
8fd87e5f
authored
22 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
Convert jello to use PassManager
llvm-svn: 4414
parent
27d24797
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/tools/jello/jello.cpp
+26
-39
26 additions, 39 deletions
llvm/tools/jello/jello.cpp
with
26 additions
and
39 deletions
llvm/tools/jello/jello.cpp
+
26
−
39
View file @
8fd87e5f
...
...
@@ -9,10 +9,10 @@
//===----------------------------------------------------------------------===//
#include
"llvm/Module.h"
#include
"llvm/PassManager.h"
#include
"llvm/Bytecode/Reader.h"
#include
"llvm/CodeGen/MFunction.h"
#include
"../lib/Target/X86/X86.h"
// FIXME: become generic eventually
#include
"../lib/Target/X86/X86InstructionInfo.h"
#include
"llvm/Target/TargetMachine.h"
#include
"llvm/Target/TargetMachineImpls.h"
#include
"Support/CommandLine.h"
#include
"Support/Statistic.h"
...
...
@@ -25,52 +25,39 @@ namespace {
cl
::
value_desc
(
"function name"
));
}
/// ExecuteFunction - Compile the specified function to machine code, and
/// execute it.
///
static
void
ExecuteFunction
(
Function
&
F
)
{
X86InstructionInfo
II
;
// Perform instruction selection to turn the function into an x86 SSA form
MFunction
*
MF
=
X86SimpleInstructionSelection
(
F
);
// TODO: optional optimizations go here
// If -debug is specified, output selected code to stderr
/*DEBUG*/
(
MF
->
print
(
std
::
cerr
,
II
));
// Perform register allocation to convert to a concrete x86 representation
X86SimpleRegisterAllocation
(
MF
);
// If -debug is specified, output compiled code to stderr
/*DEBUG*/
(
X86PrintCode
(
MF
,
std
::
cerr
));
// Emit register allocated X86 code now...
void
*
PFun
=
X86EmitCodeToMemory
(
MF
);
// We don't need the machine specific representation for this function anymore
delete
MF
;
}
//===----------------------------------------------------------------------===//
// main Driver function
//
int
main
(
int
argc
,
char
**
argv
)
{
cl
::
ParseCommandLineOptions
(
argc
,
argv
,
" llvm just in time compiler
\n
"
);
// Allocate a target... in the future this will be controllable on the
// command line.
std
::
auto_ptr
<
TargetMachine
>
target
(
allocateX86TargetMachine
());
assert
(
target
.
get
()
&&
"Could not allocate target machine!"
);
TargetMachine
&
Target
=
*
target
.
get
();
// Parse the input bytecode file...
std
::
string
ErrorMsg
;
if
(
Module
*
M
=
ParseBytecodeFile
(
InputFile
,
&
ErrorMsg
))
{
for
(
Module
::
iterator
I
=
M
->
begin
(),
E
=
M
->
end
();
I
!=
E
;
++
I
)
if
(
I
->
getName
()
==
MainFunction
)
ExecuteFunction
(
*
I
);
std
::
auto_ptr
<
Module
>
M
(
ParseBytecodeFile
(
InputFile
,
&
ErrorMsg
));
if
(
M
.
get
()
==
0
)
{
std
::
cerr
<<
argv
[
0
]
<<
": bytecode '"
<<
InputFile
<<
"' didn't read correctly: << "
<<
ErrorMsg
<<
"
\n
"
;
return
1
;
}
delete
M
;
return
0
;
PassManager
Passes
;
if
(
Target
.
addPassesToJITCompile
(
Passes
))
{
std
::
cerr
<<
argv
[
0
]
<<
": target '"
<<
Target
.
TargetName
<<
"' doesn't support JIT compilation!
\n
"
;
return
1
;
}
// JIT all of the methods in the module. Eventually this will JIT functions
// on demand.
Passes
.
run
(
*
M
.
get
());
std
::
cerr
<<
"Error parsing '"
<<
InputFile
<<
"': "
<<
ErrorMsg
<<
"
\n
"
;
return
1
;
}
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