Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
183fa7ce
Commit
183fa7ce
authored
21 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
Pass in argc & argv
llvm-svn: 9563
parent
2343a0ee
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/lib/Transforms/Instrumentation/BlockProfiling.cpp
+20
-6
20 additions, 6 deletions
llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
with
20 additions
and
6 deletions
llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
+
20
−
6
View file @
183fa7ce
...
...
@@ -101,11 +101,30 @@ void FunctionProfiler::insertInitializationCall(Function *MainFn,
Args
[
0
]
=
Constant
::
getNullValue
(
Type
::
IntTy
);
Args
[
1
]
=
Constant
::
getNullValue
(
ArgVTy
);
/* FIXME: We should pass in the command line arguments here! */
// Skip over any allocas in the entry block.
BasicBlock
*
Entry
=
MainFn
->
begin
();
BasicBlock
::
iterator
InsertPos
=
Entry
->
begin
();
while
(
isa
<
AllocaInst
>
(
InsertPos
))
++
InsertPos
;
Function
::
aiterator
AI
;
switch
(
MainFn
->
asize
())
{
default:
case
2
:
AI
=
MainFn
->
abegin
();
++
AI
;
if
(
AI
->
getType
()
!=
ArgVTy
)
{
Args
[
1
]
=
new
CastInst
(
AI
,
ArgVTy
,
"argv.cast"
,
InsertPos
);
}
else
{
Args
[
1
]
=
AI
;
}
case
1
:
AI
=
MainFn
->
abegin
();
if
(
AI
->
getType
()
!=
Type
::
IntTy
)
{
Args
[
0
]
=
new
CastInst
(
AI
,
Type
::
IntTy
,
"argc.cast"
,
InsertPos
);
}
else
{
Args
[
0
]
=
AI
;
}
case
0
:
break
;
}
...
...
@@ -118,10 +137,5 @@ void FunctionProfiler::insertInitializationCall(Function *MainFn,
cast
<
ArrayType
>
(
Array
->
getType
()
->
getElementType
())
->
getNumElements
();
Args
[
3
]
=
ConstantUInt
::
get
(
Type
::
UIntTy
,
NumElements
);
// Skip over any allocas in the entry block.
BasicBlock
*
Entry
=
MainFn
->
begin
();
BasicBlock
::
iterator
InsertPos
=
Entry
->
begin
();
while
(
isa
<
AllocaInst
>
(
InsertPos
))
++
InsertPos
;
new
CallInst
(
InitFn
,
Args
,
""
,
InsertPos
);
}
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