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
d845dc00
Commit
d845dc00
authored
18 years ago
by
Reid Spencer
Browse files
Options
Downloads
Patches
Plain Diff
Change createInferredCast calls to more accurate cast creation calls.
llvm-svn: 32520
parent
08bed59d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp
+18
-14
18 additions, 14 deletions
llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp
with
18 additions
and
14 deletions
llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp
+
18
−
14
View file @
d845dc00
...
...
@@ -367,7 +367,7 @@ StackerCompiler::incr_stack_index( BasicBlock* bb, Value* ival = 0 )
// Increment the loaded index value
if
(
ival
==
0
)
ival
=
One
;
CastInst
*
caster
=
CastInst
::
create
Inferred
Cast
(
ival
,
Type
::
LongTy
);
CastInst
*
caster
=
CastInst
::
create
SExtOrBit
Cast
(
ival
,
Type
::
LongTy
);
bb
->
getInstList
().
push_back
(
caster
);
BinaryOperator
*
addop
=
BinaryOperator
::
create
(
Instruction
::
Add
,
loadop
,
caster
);
...
...
@@ -388,7 +388,7 @@ StackerCompiler::decr_stack_index( BasicBlock* bb, Value* ival = 0 )
// Decrement the loaded index value
if
(
ival
==
0
)
ival
=
One
;
CastInst
*
caster
=
CastInst
::
create
Inferred
Cast
(
ival
,
Type
::
LongTy
);
CastInst
*
caster
=
CastInst
::
create
SExtOrBit
Cast
(
ival
,
Type
::
LongTy
);
bb
->
getInstList
().
push_back
(
caster
);
BinaryOperator
*
subop
=
BinaryOperator
::
create
(
Instruction
::
Sub
,
loadop
,
caster
);
...
...
@@ -422,7 +422,7 @@ StackerCompiler::get_stack_pointer( BasicBlock* bb, Value* index = 0 )
}
else
{
CastInst
*
caster
=
CastInst
::
create
Inferred
Cast
(
index
,
Type
::
LongTy
);
CastInst
*
caster
=
CastInst
::
create
SExtOrBit
Cast
(
index
,
Type
::
LongTy
);
bb
->
getInstList
().
push_back
(
caster
);
BinaryOperator
*
subop
=
BinaryOperator
::
create
(
Instruction
::
Sub
,
loadop
,
caster
);
...
...
@@ -448,7 +448,11 @@ StackerCompiler::push_value( BasicBlock* bb, Value* val )
get_stack_pointer
(
bb
)
);
// Cast the value to a long .. hopefully it works
CastInst
*
cast_inst
=
CastInst
::
createInferredCast
(
val
,
Type
::
LongTy
);
Instruction
::
CastOps
opcode
=
(
isa
<
PointerType
>
(
val
->
getType
())
?
Instruction
::
PtrToInt
:
(
val
->
getType
()
->
getPrimitiveSizeInBits
()
<
64
?
Instruction
::
SExt
:
Instruction
::
BitCast
));
CastInst
*
cast_inst
=
CastInst
::
create
(
opcode
,
val
,
Type
::
LongTy
);
bb
->
getInstList
().
push_back
(
cast_inst
);
// Store the value
...
...
@@ -523,7 +527,7 @@ StackerCompiler::pop_string( BasicBlock* bb )
// Cast the integer to a sbyte*
CastInst
*
caster
=
CastInst
::
createInferredCa
st
(
loader
,
PointerType
::
get
(
Type
::
SByteTy
)
);
new
IntToPtrIn
st
(
loader
,
PointerType
::
get
(
Type
::
SByteTy
));
bb
->
getInstList
().
push_back
(
caster
);
// Decrement stack index
...
...
@@ -576,7 +580,7 @@ StackerCompiler::stack_top_string( BasicBlock* bb, Value* index = 0 )
// Cast the integer to a sbyte*
CastInst
*
caster
=
CastInst
::
createInferredCa
st
(
loader
,
PointerType
::
get
(
Type
::
SByteTy
)
);
new
IntToPtrIn
st
(
loader
,
PointerType
::
get
(
Type
::
SByteTy
)
);
bb
->
getInstList
().
push_back
(
caster
);
// Return the value
...
...
@@ -1245,7 +1249,7 @@ StackerCompiler::handle_word( int tkn )
if
(
echo
)
bb
->
setName
(
"SHL"
);
LoadInst
*
op1
=
cast
<
LoadInst
>
(
pop_integer
(
bb
));
LoadInst
*
op2
=
cast
<
LoadInst
>
(
pop_integer
(
bb
));
CastInst
*
castop
=
CastInst
::
createInferredCa
st
(
op1
,
Type
::
UByteTy
);
CastInst
*
castop
=
new
TruncIn
st
(
op1
,
Type
::
UByteTy
);
bb
->
getInstList
().
push_back
(
castop
);
ShiftInst
*
shlop
=
new
ShiftInst
(
Instruction
::
Shl
,
op2
,
castop
);
bb
->
getInstList
().
push_back
(
shlop
);
...
...
@@ -1257,7 +1261,7 @@ StackerCompiler::handle_word( int tkn )
if
(
echo
)
bb
->
setName
(
"SHR"
);
LoadInst
*
op1
=
cast
<
LoadInst
>
(
pop_integer
(
bb
));
LoadInst
*
op2
=
cast
<
LoadInst
>
(
pop_integer
(
bb
));
CastInst
*
castop
=
CastInst
::
createInferredCa
st
(
op1
,
Type
::
UByteTy
);
CastInst
*
castop
=
new
TruncIn
st
(
op1
,
Type
::
UByteTy
);
bb
->
getInstList
().
push_back
(
castop
);
ShiftInst
*
shrop
=
new
ShiftInst
(
Instruction
::
AShr
,
op2
,
castop
);
bb
->
getInstList
().
push_back
(
shrop
);
...
...
@@ -1479,7 +1483,7 @@ StackerCompiler::handle_word( int tkn )
LoadInst
*
op1
=
cast
<
LoadInst
>
(
pop_integer
(
bb
)
);
// Make sure its a UIntTy
CastInst
*
caster
=
CastInst
::
create
Inferred
Cast
(
op1
,
Type
::
UIntTy
);
CastInst
*
caster
=
CastInst
::
create
TruncOrBit
Cast
(
op1
,
Type
::
UIntTy
);
bb
->
getInstList
().
push_back
(
caster
);
// Allocate the bytes
...
...
@@ -1507,7 +1511,7 @@ StackerCompiler::handle_word( int tkn )
if
(
echo
)
bb
->
setName
(
"GET"
);
// Get the character index
LoadInst
*
op1
=
cast
<
LoadInst
>
(
stack_top
(
bb
)
);
CastInst
*
chr_idx
=
CastInst
::
create
Inferred
Cast
(
op1
,
Type
::
LongTy
);
CastInst
*
chr_idx
=
CastInst
::
create
SExtOrBit
Cast
(
op1
,
Type
::
LongTy
);
bb
->
getInstList
().
push_back
(
chr_idx
);
// Get the String pointer
...
...
@@ -1522,7 +1526,7 @@ StackerCompiler::handle_word( int tkn )
// Get the value and push it
LoadInst
*
loader
=
new
LoadInst
(
gep
);
bb
->
getInstList
().
push_back
(
loader
);
CastInst
*
caster
=
CastInst
::
create
Inferred
Cast
(
loader
,
Type
::
IntTy
);
CastInst
*
caster
=
CastInst
::
create
TruncOrBit
Cast
(
loader
,
Type
::
IntTy
);
bb
->
getInstList
().
push_back
(
caster
);
// Push the result back on stack
...
...
@@ -1539,7 +1543,7 @@ StackerCompiler::handle_word( int tkn )
// Get the character index
LoadInst
*
w2
=
cast
<
LoadInst
>
(
pop_integer
(
bb
)
);
CastInst
*
chr_idx
=
CastInst
::
create
Inferred
Cast
(
w2
,
Type
::
LongTy
);
CastInst
*
chr_idx
=
CastInst
::
create
SExtOrBit
Cast
(
w2
,
Type
::
LongTy
);
bb
->
getInstList
().
push_back
(
chr_idx
);
// Get the String pointer
...
...
@@ -1552,7 +1556,7 @@ StackerCompiler::handle_word( int tkn )
bb
->
getInstList
().
push_back
(
gep
);
// Cast the value and put it
CastInst
*
caster
=
CastInst
::
createInferredCa
st
(
w1
,
Type
::
SByteTy
);
CastInst
*
caster
=
new
TruncIn
st
(
w1
,
Type
::
SByteTy
);
bb
->
getInstList
().
push_back
(
caster
);
StoreInst
*
storer
=
new
StoreInst
(
caster
,
gep
);
bb
->
getInstList
().
push_back
(
storer
);
...
...
@@ -1580,7 +1584,7 @@ StackerCompiler::handle_word( int tkn )
LoadInst
*
op1
=
cast
<
LoadInst
>
(
pop_integer
(
bb
));
// Cast down to an integer
CastInst
*
caster
=
CastInst
::
createInferredCa
st
(
op1
,
Type
::
IntTy
);
CastInst
*
caster
=
new
TruncIn
st
(
op1
,
Type
::
IntTy
);
bb
->
getInstList
().
push_back
(
caster
);
// Call exit(3)
...
...
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