Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
llvm-epi
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
Show more breadcrumbs
Roger Ferrer
llvm-epi
Commits
04aa034f
Commit
04aa034f
authored
18 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
Switch NodeID to track 32-bit chunks instead of 8-bit chunks, for a 2.5%
speedup in isel time. llvm-svn: 29640
parent
54256374
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
llvm/include/llvm/CodeGen/SelectionDAGCSEMap.h
+9
-16
9 additions, 16 deletions
llvm/include/llvm/CodeGen/SelectionDAGCSEMap.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp
+9
-15
9 additions, 15 deletions
llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp
with
18 additions
and
31 deletions
llvm/include/llvm/CodeGen/SelectionDAGCSEMap.h
+
9
−
16
View file @
04aa034f
...
...
@@ -63,7 +63,7 @@ namespace llvm {
class
NodeID
{
/// Use a SmallVector to avoid a heap allocation in the common case.
///
SmallVector
<
unsigned
char
,
256
>
Bits
;
SmallVector
<
unsigned
,
32
>
Bits
;
public:
NodeID
()
{}
NodeID
(
SDNode
*
N
);
...
...
@@ -77,13 +77,13 @@ namespace llvm {
const
SDOperand
*
OpList
,
unsigned
N
);
void
SetOpcode
(
unsigned
short
ID
)
{
Bits
.
push_back
(
ID
&
0xFF
);
Bits
.
push_back
(
ID
>>
8
);
Bits
.
push_back
(
ID
);
}
/// getOpcode - If the opcode has been set for this NodeID, return it.
/// getOpcode - Return the opcode that has been set for this NodeID.
///
unsigned
getOpcode
()
const
{
return
Bits
[
0
]
+
(
Bits
[
1
]
<<
8
)
;
return
Bits
[
0
];
}
void
SetValueTypes
(
const
void
*
VTList
)
{
AddPointer
(
VTList
);
}
...
...
@@ -99,21 +99,14 @@ namespace llvm {
void
AddOperand
(
SDOperand
Op
);
void
AddPointer
(
const
void
*
Ptr
);
void
AddInteger
(
signed
I
)
{
Bits
.
push_back
((
I
>>
0
)
&
0xFF
);
Bits
.
push_back
((
I
>>
8
)
&
0xFF
);
Bits
.
push_back
((
I
>>
16
)
&
0xFF
);
Bits
.
push_back
((
I
>>
24
)
&
0xFF
);
Bits
.
push_back
(
I
);
}
void
AddInteger
(
unsigned
I
)
{
AddInteger
((
signed
)
I
);
Bits
.
push_back
(
I
);
}
void
AddInteger
(
uint64_t
I
)
{
union
{
uint64_t
x
;
unsigned
char
A
[
8
];
};
x
=
I
;
Bits
.
append
(
A
,
A
+
8
);
Bits
.
push_back
(
unsigned
(
I
));
Bits
.
push_back
(
unsigned
(
I
>>
32
));
}
unsigned
ComputeHash
()
const
;
...
...
This diff is collapsed.
Click to expand it.
llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp
+
9
−
15
View file @
04aa034f
...
...
@@ -105,21 +105,15 @@ void SelectionDAGCSEMap::NodeID::AddPointer(const void *Ptr) {
// on the host. It doesn't matter however, because hashing on pointer values
// in inherently unstable. Nothing in the SelectionDAG should depend on the
// ordering of nodes in the CSEMap.
union
{
intptr_t
PtrI
;
unsigned
char
PtrA
[
sizeof
(
intptr_t
)];
};
PtrI
=
(
intptr_t
)
Ptr
;
Bits
.
append
(
PtrA
,
PtrA
+
sizeof
(
intptr_t
));
intptr_t
PtrI
=
(
intptr_t
)
Ptr
;
Bits
.
push_back
(
unsigned
(
PtrI
));
if
(
sizeof
(
intptr_t
)
>
sizeof
(
unsigned
))
Bits
.
push_back
(
unsigned
(
uint64_t
(
PtrI
)
>>
32
));
}
void
SelectionDAGCSEMap
::
NodeID
::
AddOperand
(
SDOperand
Op
)
{
AddPointer
(
Op
.
Val
);
// 2 bytes of resno might be too small, three should certainly be enough. :)
assert
(
Op
.
ResNo
<
(
1
<<
24
)
&&
"ResNo too large for CSE Map to handle!"
);
Bits
.
push_back
((
Op
.
ResNo
>>
0
)
&
0xFF
);
Bits
.
push_back
((
Op
.
ResNo
>>
8
)
&
0xFF
);
Bits
.
push_back
((
Op
.
ResNo
>>
16
)
&
0xFF
);
Bits
.
push_back
(
Op
.
ResNo
);
}
void
SelectionDAGCSEMap
::
NodeID
::
SetOperands
(
const
SDOperand
*
Ops
,
...
...
@@ -135,13 +129,13 @@ unsigned SelectionDAGCSEMap::NodeID::ComputeHash() const {
// FIXME: this hash function sucks.
unsigned
Hash
=
0
;
for
(
unsigned
i
=
0
,
e
=
Bits
.
size
();
i
!=
e
;
++
i
)
Hash
+
=
Bits
[
i
];
Hash
=
Hash
+
Bits
[
i
];
return
Hash
;
}
bool
SelectionDAGCSEMap
::
NodeID
::
operator
==
(
const
NodeID
&
RHS
)
const
{
if
(
Bits
.
size
()
!=
RHS
.
Bits
.
size
())
return
false
;
return
memcmp
(
&
Bits
[
0
],
&
RHS
.
Bits
[
0
],
Bits
.
size
())
==
0
;
return
memcmp
(
&
Bits
[
0
],
&
RHS
.
Bits
[
0
],
Bits
.
size
()
*
sizeof
(
Bits
[
0
])
)
==
0
;
}
...
...
@@ -169,8 +163,8 @@ SDNode *SelectionDAGCSEMap::GetNextPtr(void *NextInBucketPtr) {
}
void
**
SelectionDAGCSEMap
::
GetBucketPtr
(
void
*
NextInBucketPtr
)
{
assert
(
NextInBucketPtr
>=
Buckets
&&
NextInBucketPtr
<
Buckets
+
NumBuckets
&&
"NextInBucketPtr is not a bucket ptr"
);
//
assert(NextInBucketPtr >= Buckets && NextInBucketPtr < Buckets+NumBuckets &&
//
"NextInBucketPtr is not a bucket ptr");
return
static_cast
<
void
**>
(
NextInBucketPtr
);
}
...
...
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