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
4163b9fc
Commit
4163b9fc
authored
Nov 20, 2015
by
David Sehr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compute the size of the stack space required to send the parameters to a call.
BUG= R=jpp@chromium.org Review URL:
https://codereview.chromium.org/1458713002
.
parent
4b170e46
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
5 deletions
+47
-5
IceTargetLoweringMIPS32.cpp
src/IceTargetLoweringMIPS32.cpp
+1
-1
IceTargetLoweringX8632Traits.h
src/IceTargetLoweringX8632Traits.h
+2
-0
IceTargetLoweringX86Base.h
src/IceTargetLoweringX86Base.h
+1
-4
IceTargetLoweringX86BaseImpl.h
src/IceTargetLoweringX86BaseImpl.h
+43
-0
No files found.
src/IceTargetLoweringMIPS32.cpp
View file @
4163b9fc
...
@@ -94,7 +94,7 @@ void TargetMIPS32::translateO2() {
...
@@ -94,7 +94,7 @@ void TargetMIPS32::translateO2() {
genTargetHelperCalls
();
genTargetHelperCalls
();
// Merge Alloca instructions, and lay out the stack.
// Merge Alloca instructions, and lay out the stack.
static
constexpr
bool
SortAndCombineAllocas
=
tru
e
;
static
constexpr
bool
SortAndCombineAllocas
=
fals
e
;
Func
->
processAllocas
(
SortAndCombineAllocas
);
Func
->
processAllocas
(
SortAndCombineAllocas
);
Func
->
dump
(
"After Alloca processing"
);
Func
->
dump
(
"After Alloca processing"
);
...
...
src/IceTargetLoweringX8632Traits.h
View file @
4163b9fc
...
@@ -579,6 +579,8 @@ template <> struct MachineTraits<TargetX8632> {
...
@@ -579,6 +579,8 @@ template <> struct MachineTraits<TargetX8632> {
/// The maximum number of arguments to pass in XMM registers
/// The maximum number of arguments to pass in XMM registers
static
const
uint32_t
X86_MAX_XMM_ARGS
=
4
;
static
const
uint32_t
X86_MAX_XMM_ARGS
=
4
;
/// The maximum number of arguments to pass in GPR registers
static
const
uint32_t
X86_MAX_GPR_ARGS
=
0
;
/// The number of bits in a byte
/// The number of bits in a byte
static
const
uint32_t
X86_CHAR_BIT
=
8
;
static
const
uint32_t
X86_CHAR_BIT
=
8
;
/// Stack alignment. This is defined in IceTargetLoweringX8632.cpp because it
/// Stack alignment. This is defined in IceTargetLoweringX8632.cpp because it
...
...
src/IceTargetLoweringX86Base.h
View file @
4163b9fc
...
@@ -182,10 +182,7 @@ protected:
...
@@ -182,10 +182,7 @@ protected:
void
lowerOther
(
const
Inst
*
Instr
)
override
;
void
lowerOther
(
const
Inst
*
Instr
)
override
;
void
lowerRMW
(
const
typename
Traits
::
Insts
::
FakeRMW
*
RMW
);
void
lowerRMW
(
const
typename
Traits
::
Insts
::
FakeRMW
*
RMW
);
void
prelowerPhis
()
override
;
void
prelowerPhis
()
override
;
uint32_t
getCallStackArgumentsSizeBytes
(
const
InstCall
*
Instr
)
override
{
uint32_t
getCallStackArgumentsSizeBytes
(
const
InstCall
*
Instr
)
override
;
(
void
)
Instr
;
return
0
;
}
void
genTargetHelperCallFor
(
Inst
*
Instr
)
override
{
(
void
)
Instr
;
}
void
genTargetHelperCallFor
(
Inst
*
Instr
)
override
{
(
void
)
Instr
;
}
void
doAddressOptLoad
()
override
;
void
doAddressOptLoad
()
override
;
void
doAddressOptStore
()
override
;
void
doAddressOptStore
()
override
;
...
...
src/IceTargetLoweringX86BaseImpl.h
View file @
4163b9fc
...
@@ -5323,6 +5323,49 @@ template <class Machine> void TargetX86Base<Machine>::prelowerPhis() {
...
@@ -5323,6 +5323,49 @@ template <class Machine> void TargetX86Base<Machine>::prelowerPhis() {
}
}
template
<
class
Machine
>
template
<
class
Machine
>
uint32_t
TargetX86Base
<
Machine
>::
getCallStackArgumentsSizeBytes
(
const
InstCall
*
Instr
)
{
uint32_t
OutArgumentsSizeBytes
=
0
;
uint32_t
XmmArgCount
=
0
;
uint32_t
GprArgCount
=
0
;
// Classify each argument operand according to the location where the
// argument is passed.
for
(
SizeT
i
=
0
,
NumArgs
=
Instr
->
getNumArgs
();
i
<
NumArgs
;
++
i
)
{
Operand
*
Arg
=
Instr
->
getArg
(
i
);
Type
Ty
=
Arg
->
getType
();
// The PNaCl ABI requires the width of arguments to be at least 32 bits.
assert
(
typeWidthInBytes
(
Ty
)
>=
4
);
if
(
isVectorType
(
Ty
)
&&
XmmArgCount
<
Traits
::
X86_MAX_XMM_ARGS
)
{
++
XmmArgCount
;
}
else
if
(
isScalarIntegerType
(
Ty
)
&&
GprArgCount
<
Traits
::
X86_MAX_GPR_ARGS
)
{
// The 64 bit ABI allows some integers to be passed in GPRs.
++
GprArgCount
;
}
else
{
if
(
isVectorType
(
Arg
->
getType
()))
{
OutArgumentsSizeBytes
=
Traits
::
applyStackAlignment
(
OutArgumentsSizeBytes
);
}
OutArgumentsSizeBytes
+=
typeWidthInBytesOnStack
(
Arg
->
getType
());
}
}
if
(
Traits
::
Is64Bit
)
return
OutArgumentsSizeBytes
;
// The 32 bit ABI requires floating point values to be returned on the x87 FP
// stack. Ensure there is enough space for the fstp/movs for floating returns.
Variable
*
Dest
=
Instr
->
getDest
();
if
(
Dest
==
nullptr
)
return
OutArgumentsSizeBytes
;
const
Type
DestType
=
Dest
->
getType
();
if
(
isScalarFloatingType
(
Dest
->
getType
()))
{
OutArgumentsSizeBytes
=
std
::
max
(
OutArgumentsSizeBytes
,
static_cast
<
uint32_t
>
(
typeWidthInBytesOnStack
(
DestType
)));
}
return
OutArgumentsSizeBytes
;
}
template
<
class
Machine
>
Variable
*
TargetX86Base
<
Machine
>::
makeZeroedRegister
(
Type
Ty
,
int32_t
RegNum
)
{
Variable
*
TargetX86Base
<
Machine
>::
makeZeroedRegister
(
Type
Ty
,
int32_t
RegNum
)
{
Variable
*
Reg
=
makeReg
(
Ty
,
RegNum
);
Variable
*
Reg
=
makeReg
(
Ty
,
RegNum
);
switch
(
Ty
)
{
switch
(
Ty
)
{
...
...
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