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
68ec7ee0
Commit
68ec7ee0
authored
15 years ago
by
Mike Stump
Browse files
Options
Downloads
Patches
Plain Diff
Enable the use of the new llvm objectsize intrinsic.
llvm-svn: 86607
parent
8483f12a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
clang/lib/CodeGen/CGBuiltin.cpp
+2
-4
2 additions, 4 deletions
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/object-size.c
+2
-2
2 additions, 2 deletions
clang/test/CodeGen/object-size.c
with
4 additions
and
6 deletions
clang/lib/CodeGen/CGBuiltin.cpp
+
2
−
4
View file @
68ec7ee0
...
...
@@ -199,8 +199,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
return
RValue
::
get
(
Builder
.
CreateCall
(
F
,
ArgValue
,
"tmp"
));
}
case
Builtin
::
BI__builtin_object_size
:
{
// FIXME: We're awaiting the llvm intrincis.
#if 0
#if 1
// We pass this builtin onto the optimizer so that it can
// figure out the object size in more complex cases.
const
llvm
::
Type
*
ResType
[]
=
{
...
...
@@ -211,8 +210,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
EmitScalarExpr
(
E
->
getArg
(
0
)),
EmitScalarExpr
(
E
->
getArg
(
1
))));
#else
// FIXME: Implement. For now we just always fail and pretend we
// don't know the object size.
// FIXME: Remove after testing.
llvm
::
APSInt
TypeArg
=
E
->
getArg
(
1
)
->
EvaluateAsInt
(
CGM
.
getContext
());
const
llvm
::
Type
*
ResType
=
ConvertType
(
E
->
getType
());
// bool UseSubObject = TypeArg.getZExtValue() & 1;
...
...
This diff is collapsed.
Click to expand it.
clang/test/CodeGen/object-size.c
+
2
−
2
View file @
68ec7ee0
...
...
@@ -46,8 +46,8 @@ void test4() {
}
void
test5
()
{
// CHECK: mov
b
$
0
, %
al
// CHECK-NEXT:
testb %al, %al
// CHECK: mov
q
$
-1
, %
rax
// CHECK-NEXT:
cmpq $-1, %rax
// CHECK: call ___inline_strcpy_chk
strcpy
(
gp
,
"Hi there"
);
}
...
...
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