Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftshader
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
swiftshader
Commits
844211e7
Commit
844211e7
authored
Feb 04, 2016
by
John Porto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Subzero. Adds symbolic references to RelocInitializer.
BUG= R=kschimpf@google.com, stichnot@chromium.org Review URL:
https://codereview.chromium.org/1661193004
.
parent
04bca5a5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
24 deletions
+40
-24
IceCfg.cpp
src/IceCfg.cpp
+2
-1
IceConverter.cpp
src/IceConverter.cpp
+2
-2
IceGlobalContext.cpp
src/IceGlobalContext.cpp
+13
-13
IceGlobalContext.h
src/IceGlobalContext.h
+2
-0
IceGlobalInits.cpp
src/IceGlobalInits.cpp
+1
-0
IceGlobalInits.h
src/IceGlobalInits.h
+18
-7
PNaClTranslator.cpp
src/PNaClTranslator.cpp
+2
-1
No files found.
src/IceCfg.cpp
View file @
844211e7
...
@@ -148,7 +148,8 @@ blockProfilingInfoDeclaration(GlobalContext *Ctx, const IceString &NodeAsmName,
...
@@ -148,7 +148,8 @@ blockProfilingInfoDeclaration(GlobalContext *Ctx, const IceString &NodeAsmName,
const
RelocOffsetT
NodeNameDeclarationOffset
=
0
;
const
RelocOffsetT
NodeNameDeclarationOffset
=
0
;
Var
->
addInitializer
(
VariableDeclaration
::
RelocInitializer
::
create
(
Var
->
addInitializer
(
VariableDeclaration
::
RelocInitializer
::
create
(
NodeNameDeclaration
,
NodeNameDeclarationOffset
));
NodeNameDeclaration
,
{
RelocOffset
::
create
(
Ctx
,
NodeNameDeclarationOffset
)}));
Var
->
setAlignment
(
Int64ByteSize
);
Var
->
setAlignment
(
Int64ByteSize
);
return
Var
;
return
Var
;
}
}
...
...
src/IceConverter.cpp
View file @
844211e7
...
@@ -787,8 +787,8 @@ void LLVM2ICEGlobalsConverter::addGlobalInitializer(
...
@@ -787,8 +787,8 @@ void LLVM2ICEGlobalsConverter::addGlobalInitializer(
assert
(
GV
);
assert
(
GV
);
const
Ice
::
GlobalDeclaration
*
Addr
=
const
Ice
::
GlobalDeclaration
*
Addr
=
getConverter
().
getGlobalDeclaration
(
GV
);
getConverter
().
getGlobalDeclaration
(
GV
);
Global
.
addInitializer
(
Global
.
addInitializer
(
Ice
::
VariableDeclaration
::
RelocInitializer
::
create
(
Ice
::
VariableDeclaration
::
RelocInitializer
::
create
(
Addr
,
Offset
));
Addr
,
{
Ice
::
RelocOffset
::
create
(
Ctx
,
Offset
)}
));
return
;
return
;
}
}
default
:
default
:
...
...
src/IceGlobalContext.cpp
View file @
844211e7
...
@@ -357,18 +357,6 @@ void GlobalContext::translateFunctions() {
...
@@ -357,18 +357,6 @@ void GlobalContext::translateFunctions() {
namespace
{
namespace
{
void
addBlockInfoPtrs
(
const
VariableDeclarationList
&
Globals
,
VariableDeclaration
*
ProfileBlockInfo
)
{
for
(
const
VariableDeclaration
*
Global
:
Globals
)
{
if
(
Cfg
::
isProfileGlobal
(
*
Global
))
{
constexpr
RelocOffsetT
BlockExecutionCounterOffset
=
0
;
ProfileBlockInfo
->
addInitializer
(
VariableDeclaration
::
RelocInitializer
::
create
(
Global
,
BlockExecutionCounterOffset
));
}
}
}
// Ensure Pending is large enough that Pending[Index] is valid.
// Ensure Pending is large enough that Pending[Index] is valid.
void
resizePending
(
std
::
vector
<
EmitterWorkItem
*>
&
Pending
,
uint32_t
Index
)
{
void
resizePending
(
std
::
vector
<
EmitterWorkItem
*>
&
Pending
,
uint32_t
Index
)
{
if
(
Index
>=
Pending
.
size
())
if
(
Index
>=
Pending
.
size
())
...
@@ -394,6 +382,18 @@ void GlobalContext::lowerConstants() { DataLowering->lowerConstants(); }
...
@@ -394,6 +382,18 @@ void GlobalContext::lowerConstants() { DataLowering->lowerConstants(); }
void
GlobalContext
::
lowerJumpTables
()
{
DataLowering
->
lowerJumpTables
();
}
void
GlobalContext
::
lowerJumpTables
()
{
DataLowering
->
lowerJumpTables
();
}
void
GlobalContext
::
addBlockInfoPtrs
(
VariableDeclaration
*
ProfileBlockInfo
)
{
for
(
const
VariableDeclaration
*
Global
:
Globals
)
{
if
(
Cfg
::
isProfileGlobal
(
*
Global
))
{
constexpr
RelocOffsetT
BlockExecutionCounterOffset
=
0
;
ProfileBlockInfo
->
addInitializer
(
VariableDeclaration
::
RelocInitializer
::
create
(
Global
,
{
RelocOffset
::
create
(
this
,
BlockExecutionCounterOffset
)}));
}
}
}
void
GlobalContext
::
lowerGlobals
(
const
IceString
&
SectionSuffix
)
{
void
GlobalContext
::
lowerGlobals
(
const
IceString
&
SectionSuffix
)
{
TimerMarker
T
(
TimerStack
::
TT_emitGlobalInitializers
,
this
);
TimerMarker
T
(
TimerStack
::
TT_emitGlobalInitializers
,
this
);
const
bool
DumpGlobalVariables
=
const
bool
DumpGlobalVariables
=
...
@@ -409,7 +409,7 @@ void GlobalContext::lowerGlobals(const IceString &SectionSuffix) {
...
@@ -409,7 +409,7 @@ void GlobalContext::lowerGlobals(const IceString &SectionSuffix) {
if
(
Flags
.
getDisableTranslation
())
if
(
Flags
.
getDisableTranslation
())
return
;
return
;
addBlockInfoPtrs
(
Globals
,
ProfileBlockInfoVarDecl
);
addBlockInfoPtrs
(
ProfileBlockInfoVarDecl
);
// If we need to shuffle the layout of global variables, shuffle them now.
// If we need to shuffle the layout of global variables, shuffle them now.
if
(
getFlags
().
shouldReorderGlobalVariables
())
{
if
(
getFlags
().
shouldReorderGlobalVariables
())
{
// Create a random number generator for global variable reordering.
// Create a random number generator for global variable reordering.
...
...
src/IceGlobalContext.h
View file @
844211e7
...
@@ -538,6 +538,8 @@ private:
...
@@ -538,6 +538,8 @@ private:
HasSeenCode
=
true
;
HasSeenCode
=
true
;
}
}
void
addBlockInfoPtrs
(
VariableDeclaration
*
ProfileBlockInfo
);
llvm
::
SmallVector
<
ThreadContext
*
,
128
>
AllThreadContexts
;
llvm
::
SmallVector
<
ThreadContext
*
,
128
>
AllThreadContexts
;
llvm
::
SmallVector
<
std
::
thread
,
128
>
TranslationThreads
;
llvm
::
SmallVector
<
std
::
thread
,
128
>
TranslationThreads
;
llvm
::
SmallVector
<
std
::
thread
,
128
>
EmitterThreads
;
llvm
::
SmallVector
<
std
::
thread
,
128
>
EmitterThreads
;
...
...
src/IceGlobalInits.cpp
View file @
844211e7
...
@@ -230,6 +230,7 @@ void VariableDeclaration::RelocInitializer::dump(GlobalContext *Ctx,
...
@@ -230,6 +230,7 @@ void VariableDeclaration::RelocInitializer::dump(GlobalContext *Ctx,
Ostream
&
Stream
)
const
{
Ostream
&
Stream
)
const
{
if
(
!
Ice
::
BuildDefs
::
dump
())
if
(
!
Ice
::
BuildDefs
::
dump
())
return
;
return
;
const
RelocOffsetT
Offset
=
getOffset
();
if
(
Offset
!=
0
)
{
if
(
Offset
!=
0
)
{
dumpType
(
Stream
);
dumpType
(
Stream
);
Stream
<<
" add ("
;
Stream
<<
" add ("
;
...
...
src/IceGlobalInits.h
View file @
844211e7
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "IceDefs.h"
#include "IceDefs.h"
#include "IceGlobalContext.h"
#include "IceGlobalContext.h"
#include "IceIntrinsics.h"
#include "IceIntrinsics.h"
#include "IceOperand.h"
#include "IceTypes.h"
#include "IceTypes.h"
#ifdef __clang__
#ifdef __clang__
...
@@ -318,11 +319,19 @@ public:
...
@@ -318,11 +319,19 @@ public:
public
:
public
:
static
std
::
unique_ptr
<
RelocInitializer
>
static
std
::
unique_ptr
<
RelocInitializer
>
create
(
const
GlobalDeclaration
*
Declaration
,
RelocOffsetT
Offset
)
{
create
(
const
GlobalDeclaration
*
Declaration
,
return
makeUnique
<
RelocInitializer
>
(
Declaration
,
Offset
);
const
RelocOffsetArray
&
OffsetExpr
)
{
return
makeUnique
<
RelocInitializer
>
(
Declaration
,
OffsetExpr
);
}
RelocOffsetT
getOffset
()
const
{
RelocOffsetT
Offset
=
0
;
for
(
const
auto
*
RelocOffset
:
OffsetExpr
)
{
Offset
+=
RelocOffset
->
getOffset
();
}
return
Offset
;
}
}
RelocOffsetT
getOffset
()
const
{
return
Offset
;
}
const
GlobalDeclaration
*
getDeclaration
()
const
{
return
Declaration
;
}
const
GlobalDeclaration
*
getDeclaration
()
const
{
return
Declaration
;
}
SizeT
getNumBytes
()
const
final
{
return
RelocAddrSize
;
}
SizeT
getNumBytes
()
const
final
{
return
RelocAddrSize
;
}
void
dump
(
GlobalContext
*
Ctx
,
Ostream
&
Stream
)
const
final
;
void
dump
(
GlobalContext
*
Ctx
,
Ostream
&
Stream
)
const
final
;
...
@@ -334,13 +343,15 @@ public:
...
@@ -334,13 +343,15 @@ public:
private
:
private
:
ENABLE_MAKE_UNIQUE
;
ENABLE_MAKE_UNIQUE
;
RelocInitializer
(
const
GlobalDeclaration
*
Declaration
,
RelocOffsetT
Offset
)
RelocInitializer
(
const
GlobalDeclaration
*
Declaration
,
:
Initializer
(
RelocInitializerKind
),
Declaration
(
Declaration
),
const
RelocOffsetArray
&
OffsetExpr
)
Offset
(
Offset
)
{}
// The global declaration used in the relocation.
:
Initializer
(
RelocInitializerKind
),
Declaration
(
Declaration
),
// The global declaration used in the reloc.
OffsetExpr
(
OffsetExpr
)
{}
const
GlobalDeclaration
*
Declaration
;
const
GlobalDeclaration
*
Declaration
;
/// The offset to add to the relocation.
/// The offset to add to the relocation.
const
RelocOffset
T
Offset
;
const
RelocOffset
Array
OffsetExpr
;
};
};
/// Models the list of initializers.
/// Models the list of initializers.
...
...
src/PNaClTranslator.cpp
View file @
844211e7
...
@@ -1211,9 +1211,10 @@ void GlobalsParser::ProcessRecord() {
...
@@ -1211,9 +1211,10 @@ void GlobalsParser::ProcessRecord() {
Error
(
StrBuf
.
str
());
Error
(
StrBuf
.
str
());
}
}
}
}
Ice
::
GlobalContext
*
Ctx
=
getTranslator
().
getContext
();
CurGlobalVar
->
addInitializer
(
CurGlobalVar
->
addInitializer
(
Ice
::
VariableDeclaration
::
RelocInitializer
::
create
(
Ice
::
VariableDeclaration
::
RelocInitializer
::
create
(
getGlobalDeclByID
(
Index
),
Offset
));
getGlobalDeclByID
(
Index
),
{
Ice
::
RelocOffset
::
create
(
Ctx
,
Offset
)}
));
return
;
return
;
}
}
default
:
default
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment