Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
intel-graphics-compiler
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Debian OpenCL Maintainers
intel-graphics-compiler
Commits
a56fcc84
Commit
a56fcc84
authored
Oct 25, 2018
by
lwesiers
Committed by
Paige, Alexander
Oct 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This change prepares compiler to work with llvm7.
Change-Id: I9f0da6f65cf9ff8dfce1e1179552cac59eecd887
parent
e353f254
Changes
109
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
109 changed files
with
14418 additions
and
6736 deletions
+14418
-6736
IGC/AdaptorCommon/AddImplicitArgs.cpp
IGC/AdaptorCommon/AddImplicitArgs.cpp
+2
-4
IGC/AdaptorCommon/ImplicitArgs.cpp
IGC/AdaptorCommon/ImplicitArgs.cpp
+7
-7
IGC/AdaptorCommon/ProcessFuncAttributes.cpp
IGC/AdaptorCommon/ProcessFuncAttributes.cpp
+5
-2
IGC/AdaptorOCL/CMakeLists.txt
IGC/AdaptorOCL/CMakeLists.txt
+3
-2
IGC/AdaptorOCL/OCL/LoadBuffer.cpp
IGC/AdaptorOCL/OCL/LoadBuffer.cpp
+1
-1
IGC/AdaptorOCL/OCL/sp/sp_g8.cpp
IGC/AdaptorOCL/OCL/sp/sp_g8.cpp
+7
-0
IGC/AdaptorOCL/SPIRV/SPIRVInternal.h
IGC/AdaptorOCL/SPIRV/SPIRVInternal.h
+6
-5
IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
+33
-21
IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
+17
-11
IGC/AdaptorOCL/UnifyIROCL.cpp
IGC/AdaptorOCL/UnifyIROCL.cpp
+24
-16
IGC/AdaptorOCL/Upgrader/llvm4/BitcodeReader.cpp
IGC/AdaptorOCL/Upgrader/llvm4/BitcodeReader.cpp
+5489
-5489
IGC/AdaptorOCL/Upgrader/llvm4/BitcodeReader.h
IGC/AdaptorOCL/Upgrader/llvm4/BitcodeReader.h
+163
-163
IGC/AdaptorOCL/Upgrader/llvm4/MetadataLoader.h
IGC/AdaptorOCL/Upgrader/llvm4/MetadataLoader.h
+111
-111
IGC/AdaptorOCL/Upgrader/llvm4/Upgrader.cpp
IGC/AdaptorOCL/Upgrader/llvm4/Upgrader.cpp
+67
-0
IGC/AdaptorOCL/Upgrader/llvm4/Upgrader.h
IGC/AdaptorOCL/Upgrader/llvm4/Upgrader.h
+48
-48
IGC/AdaptorOCL/Upgrader/llvm4/ValueList.h
IGC/AdaptorOCL/Upgrader/llvm4/ValueList.h
+102
-102
IGC/AdaptorOCL/Upgrader/llvm7/BitcodeReader.cpp
IGC/AdaptorOCL/Upgrader/llvm7/BitcodeReader.cpp
+5878
-0
IGC/AdaptorOCL/Upgrader/llvm7/BitcodeReader.h
IGC/AdaptorOCL/Upgrader/llvm7/BitcodeReader.h
+230
-0
IGC/AdaptorOCL/Upgrader/llvm7/MetadataLoader.h
IGC/AdaptorOCL/Upgrader/llvm7/MetadataLoader.h
+88
-0
IGC/AdaptorOCL/Upgrader/llvm7/Upgrader.cpp
IGC/AdaptorOCL/Upgrader/llvm7/Upgrader.cpp
+65
-65
IGC/AdaptorOCL/Upgrader/llvm7/Upgrader.h
IGC/AdaptorOCL/Upgrader/llvm7/Upgrader.h
+48
-0
IGC/AdaptorOCL/Upgrader/llvm7/ValueList.h
IGC/AdaptorOCL/Upgrader/llvm7/ValueList.h
+86
-0
IGC/AdaptorOCL/dllInterfaceCompute.cpp
IGC/AdaptorOCL/dllInterfaceCompute.cpp
+21
-2
IGC/CMakeLists.txt
IGC/CMakeLists.txt
+31
-2
IGC/Compiler/CISACodeGen/CShader.cpp
IGC/Compiler/CISACodeGen/CShader.cpp
+9
-5
IGC/Compiler/CISACodeGen/CodeHoisting.cpp
IGC/Compiler/CISACodeGen/CodeHoisting.cpp
+5
-1
IGC/Compiler/CISACodeGen/ComputeShaderCodeGen.cpp
IGC/Compiler/CISACodeGen/ComputeShaderCodeGen.cpp
+4
-0
IGC/Compiler/CISACodeGen/DebugInfo.cpp
IGC/Compiler/CISACodeGen/DebugInfo.cpp
+5
-1
IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
+9
-3
IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
+9
-4
IGC/Compiler/CISACodeGen/GenCodeGenModule.cpp
IGC/Compiler/CISACodeGen/GenCodeGenModule.cpp
+6
-4
IGC/Compiler/CISACodeGen/LinkTessControlShaderMCFPass.cpp
IGC/Compiler/CISACodeGen/LinkTessControlShaderMCFPass.cpp
+4
-1
IGC/Compiler/CISACodeGen/LinkTessControlShaderPass.cpp
IGC/Compiler/CISACodeGen/LinkTessControlShaderPass.cpp
+2
-2
IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
+5
-3
IGC/Compiler/CISACodeGen/MemOpt.cpp
IGC/Compiler/CISACodeGen/MemOpt.cpp
+26
-3
IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
+6
-5
IGC/Compiler/CISACodeGen/PixelShaderCodeGen.cpp
IGC/Compiler/CISACodeGen/PixelShaderCodeGen.cpp
+5
-3
IGC/Compiler/CISACodeGen/PreRARematFlag.cpp
IGC/Compiler/CISACodeGen/PreRARematFlag.cpp
+8
-2
IGC/Compiler/CISACodeGen/PruneUnusedArguments.cpp
IGC/Compiler/CISACodeGen/PruneUnusedArguments.cpp
+1
-1
IGC/Compiler/CISACodeGen/ResolveGAS.cpp
IGC/Compiler/CISACodeGen/ResolveGAS.cpp
+5
-2
IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
+12
-2
IGC/Compiler/CISACodeGen/WIAnalysis.cpp
IGC/Compiler/CISACodeGen/WIAnalysis.cpp
+2
-1
IGC/Compiler/CISACodeGen/helper.cpp
IGC/Compiler/CISACodeGen/helper.cpp
+16
-3
IGC/Compiler/CISACodeGen/helper.h
IGC/Compiler/CISACodeGen/helper.h
+1
-0
IGC/Compiler/CustomLoopOpt.hpp
IGC/Compiler/CustomLoopOpt.hpp
+3
-0
IGC/Compiler/CustomSafeOptPass.cpp
IGC/Compiler/CustomSafeOptPass.cpp
+12
-3
IGC/Compiler/DebugInfo/DIE.hpp
IGC/Compiler/DebugInfo/DIE.hpp
+4
-0
IGC/Compiler/DebugInfo/DwarfCompileUnit.cpp
IGC/Compiler/DebugInfo/DwarfCompileUnit.cpp
+9
-2
IGC/Compiler/DebugInfo/DwarfDebug.cpp
IGC/Compiler/DebugInfo/DwarfDebug.cpp
+8
-4
IGC/Compiler/DebugInfo/VISAModule.cpp
IGC/Compiler/DebugInfo/VISAModule.cpp
+3
-3
IGC/Compiler/GenTTI.cpp
IGC/Compiler/GenTTI.cpp
+15
-6
IGC/Compiler/GenTTI.h
IGC/Compiler/GenTTI.h
+5
-1
IGC/Compiler/GenUpdateCB.cpp
IGC/Compiler/GenUpdateCB.cpp
+11
-8
IGC/Compiler/IGCPassSupport.h
IGC/Compiler/IGCPassSupport.h
+3
-3
IGC/Compiler/LegalizationPass.cpp
IGC/Compiler/LegalizationPass.cpp
+1
-1
IGC/Compiler/Legalizer/InstExpander.cpp
IGC/Compiler/Legalizer/InstExpander.cpp
+4
-2
IGC/Compiler/Legalizer/InstLegalChecker.cpp
IGC/Compiler/Legalizer/InstLegalChecker.cpp
+4
-2
IGC/Compiler/Legalizer/InstPromoter.cpp
IGC/Compiler/Legalizer/InstPromoter.cpp
+4
-2
IGC/Compiler/Legalizer/InstScalarizer.cpp
IGC/Compiler/Legalizer/InstScalarizer.cpp
+4
-2
IGC/Compiler/Legalizer/TypeLegalizer.h
IGC/Compiler/Legalizer/TypeLegalizer.h
+5
-2
IGC/Compiler/Optimizer/BuiltInFuncImport.cpp
IGC/Compiler/Optimizer/BuiltInFuncImport.cpp
+8
-4
IGC/Compiler/Optimizer/OCLBIUtils.cpp
IGC/Compiler/Optimizer/OCLBIUtils.cpp
+6
-3
IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
...er/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
+2
-2
IGC/Compiler/Optimizer/OpenCLPasses/AlignmentAnalysis/AlignmentAnalysis.cpp
...izer/OpenCLPasses/AlignmentAnalysis/AlignmentAnalysis.cpp
+15
-0
IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
...mizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
+18
-11
IGC/Compiler/Optimizer/OpenCLPasses/ImageFuncs/ImageFuncResolution.cpp
...Optimizer/OpenCLPasses/ImageFuncs/ImageFuncResolution.cpp
+2
-2
IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
+2
-2
IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
...izer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
+4
-1
IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
...er/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
+1
-1
IGC/Compiler/Optimizer/OpenCLPasses/ProgramScopeConstants/ProgramScopeConstantResolution.cpp
.../ProgramScopeConstants/ProgramScopeConstantResolution.cpp
+2
-1
IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
...aceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
+8
-5
IGC/Compiler/Optimizer/OpenCLPasses/StatelessToStatefull/StatelessToStatefull.cpp
...penCLPasses/StatelessToStatefull/StatelessToStatefull.cpp
+7
-4
IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
...piler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
+2
-2
IGC/Compiler/Optimizer/OpenGLPasses/GlobalToLocal.cpp
IGC/Compiler/Optimizer/OpenGLPasses/GlobalToLocal.cpp
+9
-2
IGC/Compiler/Optimizer/OpenGLPasses/PromoteBoolAlloca.cpp
IGC/Compiler/Optimizer/OpenGLPasses/PromoteBoolAlloca.cpp
+1
-1
IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
+21
-17
IGC/Compiler/Optimizer/Scalarizer.cpp
IGC/Compiler/Optimizer/Scalarizer.cpp
+4
-1
IGC/Compiler/ThreadCombining.cpp
IGC/Compiler/ThreadCombining.cpp
+3
-3
IGC/DriverInterface/CMakeLists.txt
IGC/DriverInterface/CMakeLists.txt
+3
-3
IGC/ElfPackager/main.cpp
IGC/ElfPackager/main.cpp
+500
-497
IGC/GenISAIntrinsics/GenIntrinsics.cpp
IGC/GenISAIntrinsics/GenIntrinsics.cpp
+1
-1
IGC/GenISAIntrinsics/GenIntrinsics.h
IGC/GenISAIntrinsics/GenIntrinsics.h
+3
-2
IGC/GenISAIntrinsics/Intrinsics.py
IGC/GenISAIntrinsics/Intrinsics.py
+4
-4
IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
+10
-4
IGC/OCLFE/igd_fcl_mcl/source/LoadBuffer.cpp
IGC/OCLFE/igd_fcl_mcl/source/LoadBuffer.cpp
+1
-1
IGC/WrapperLLVM/CMakeLists.txt
IGC/WrapperLLVM/CMakeLists.txt
+67
-0
IGC/WrapperLLVM/Utils.h
IGC/WrapperLLVM/Utils.h
+47
-0
IGC/WrapperLLVM/include/llvmWrapper/AsmParser/Parser.h
IGC/WrapperLLVM/include/llvmWrapper/AsmParser/Parser.h
+46
-0
IGC/WrapperLLVM/include/llvmWrapper/BinaryFormat/Dwarf.h
IGC/WrapperLLVM/include/llvmWrapper/BinaryFormat/Dwarf.h
+36
-0
IGC/WrapperLLVM/include/llvmWrapper/Bitcode/BitcodeWriter.h
IGC/WrapperLLVM/include/llvmWrapper/Bitcode/BitcodeWriter.h
+48
-0
IGC/WrapperLLVM/include/llvmWrapper/IR/Argument.h
IGC/WrapperLLVM/include/llvmWrapper/IR/Argument.h
+49
-0
IGC/WrapperLLVM/include/llvmWrapper/IR/Attributes.h
IGC/WrapperLLVM/include/llvmWrapper/IR/Attributes.h
+41
-0
IGC/WrapperLLVM/include/llvmWrapper/IR/DIBuilder.h
IGC/WrapperLLVM/include/llvmWrapper/IR/DIBuilder.h
+68
-0
IGC/WrapperLLVM/include/llvmWrapper/IR/Function.h
IGC/WrapperLLVM/include/llvmWrapper/IR/Function.h
+62
-0
IGC/WrapperLLVM/include/llvmWrapper/IR/GlobalValue.h
IGC/WrapperLLVM/include/llvmWrapper/IR/GlobalValue.h
+48
-0
IGC/WrapperLLVM/include/llvmWrapper/IR/IRBuilder.h
IGC/WrapperLLVM/include/llvmWrapper/IR/IRBuilder.h
+94
-0
IGC/WrapperLLVM/include/llvmWrapper/IR/Instructions.h
IGC/WrapperLLVM/include/llvmWrapper/IR/Instructions.h
+81
-0
IGC/WrapperLLVM/include/llvmWrapper/Support/Debug.h
IGC/WrapperLLVM/include/llvmWrapper/Support/Debug.h
+37
-0
IGC/WrapperLLVM/include/llvmWrapper/Support/KnownBits.h
IGC/WrapperLLVM/include/llvmWrapper/Support/KnownBits.h
+34
-0
IGC/WrapperLLVM/include/llvmWrapper/Support/ToolOutputFile.h
IGC/WrapperLLVM/include/llvmWrapper/Support/ToolOutputFile.h
+41
-0
IGC/WrapperLLVM/include/llvmWrapper/Transforms/IPO.h
IGC/WrapperLLVM/include/llvmWrapper/Transforms/IPO.h
+34
-0
IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar/InstSimplifyPass.h
.../include/llvmWrapper/Transforms/Scalar/InstSimplifyPass.h
+48
-0
IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils.h
IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils.h
+34
-0
IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/Cloning.h
...rapperLLVM/include/llvmWrapper/Transforms/Utils/Cloning.h
+43
-0
IGC/common/IGCIRBuilder.h
IGC/common/IGCIRBuilder.h
+8
-6
IGC/common/LLVMWarningsPush.hpp
IGC/common/LLVMWarningsPush.hpp
+20
-0
IGC/common/SystemThread.cpp
IGC/common/SystemThread.cpp
+16
-14
IGC/common/SystemThread.h
IGC/common/SystemThread.h
+7
-3
IGC/common/debug/Debug.cpp
IGC/common/debug/Debug.cpp
+5
-1
No files found.
IGC/AdaptorCommon/AddImplicitArgs.cpp
View file @
a56fcc84
...
...
@@ -35,7 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "common/LLVMWarningsPush.hpp"
#include "llvm/ADT/SCCIterator.h"
#include <llvm/IR/Module.h>
#include <llvm
/IR/Function.h>
#include <llvm
Wrapper/IR/Function.h>
#include <llvm/IR/Instructions.h>
#include <llvm/IR/DerivedTypes.h>
#include "llvm/IR/DIBuilder.h"
...
...
@@ -355,10 +355,8 @@ void AddImplicitArgs::replaceAllUsesWithNewOCLBuiltinFunction(CodeGenContext* ct
// let 's prepare argument list on new call function
llvm
::
Function
::
arg_iterator
new_arg_iter
=
new_func
->
arg_begin
();
llvm
::
Function
::
arg_iterator
new_arg_end
=
new_func
->
arg_end
();
llvm
::
Function
::
arg_iterator
parent_func_arg_iter
=
parent_func
->
arg_begin
();
llvm
::
Function
::
arg_iterator
parent_func_arg_end
=
parent_func
->
arg_end
();
assert
(
new_func
->
arg_size
()
>=
numArgOperands
);
assert
(
IGCLLVM
::
GetFuncArgSize
(
new_func
)
>=
numArgOperands
);
// basic arguments
for
(
unsigned
int
i
=
0
;
i
<
numArgOperands
;
++
i
,
++
new_arg_iter
)
...
...
IGC/AdaptorCommon/ImplicitArgs.cpp
View file @
a56fcc84
...
...
@@ -29,7 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "common/LLVMWarningsPush.hpp"
#include <llvm/IR/DerivedTypes.h>
#include <llvm
/IR/Function.h>
#include <llvm
Wrapper/IR/Function.h>
#include <llvm/IR/Metadata.h>
#include <llvm/IR/Module.h>
#include "common/LLVMWarningsPop.hpp"
...
...
@@ -389,7 +389,7 @@ void ImplicitArgs::addBufferOffsetArgs(llvm::Function& F, IGCMD::MetaDataUtils*
ImplicitArg
::
ArgMap
OffsetArgs
;
FunctionInfoMetaDataHandle
funcInfoMD
=
pMdUtils
->
getFunctionsInfoItem
(
const_cast
<
Function
*>
(
&
F
));
for
(
auto
&
Arg
:
F
.
getArgumentList
()
)
for
(
auto
&
Arg
:
F
.
args
()
)
{
Value
*
AV
=
&
Arg
;
PointerType
*
PTy
=
dyn_cast
<
PointerType
>
(
AV
->
getType
());
...
...
@@ -465,10 +465,10 @@ int32_t ImplicitArgs::getStructArgOffset(unsigned int index) const
TODO
(
"Refactor code to avoid code triplication for getArgInFunc(), getImplicitArg() and WIFuncResolution::getImplicitArg()"
)
Argument
*
ImplicitArgs
::
getArgInFunc
(
llvm
::
Function
&
F
,
ImplicitArg
::
ArgType
argType
)
{
assert
(
F
.
getArgumentList
().
size
()
>=
size
()
&&
"Invalid number of argumnents in the function!"
);
assert
(
IGCLLVM
::
GetFuncArgSize
(
F
)
>=
size
()
&&
"Invalid number of argumnents in the function!"
);
unsigned
int
argIndex
=
getArgIndex
(
argType
);
unsigned
int
argIndexInFunc
=
F
.
getArgumentList
().
size
()
-
size
()
+
argIndex
;
unsigned
int
argIndexInFunc
=
IGCLLVM
::
GetFuncArgSize
(
F
)
-
size
()
+
argIndex
;
Function
::
arg_iterator
arg
=
F
.
arg_begin
();
for
(
unsigned
int
i
=
0
;
i
<
argIndexInFunc
;
++
i
,
++
arg
);
...
...
@@ -482,7 +482,7 @@ Argument* ImplicitArgs::getImplicitArg(llvm::Function& F, ImplicitArg::ArgType a
return
nullptr
;
unsigned
int
implicitArgIndex
=
this
->
getArgIndex
(
argType
);
unsigned
int
implicitArgIndexInFunc
=
F
.
getArgumentList
().
size
()
-
numImplicitArgs
+
implicitArgIndex
;
unsigned
int
implicitArgIndexInFunc
=
IGCLLVM
::
GetFuncArgSize
(
F
)
-
numImplicitArgs
+
implicitArgIndex
;
Function
::
arg_iterator
arg
=
F
.
arg_begin
();
for
(
unsigned
int
i
=
0
;
i
<
implicitArgIndexInFunc
;
++
i
,
++
arg
);
...
...
@@ -492,14 +492,14 @@ Argument* ImplicitArgs::getImplicitArg(llvm::Function& F, ImplicitArg::ArgType a
Argument
*
ImplicitArgs
::
getNumberedImplicitArg
(
llvm
::
Function
&
F
,
ImplicitArg
::
ArgType
argType
,
int
argNum
)
{
assert
(
F
.
getArgumentList
().
size
()
>=
size
()
&&
"Invalid number of arguments in the function!"
);
assert
(
IGCLLVM
::
GetFuncArgSize
(
F
)
>=
size
()
&&
"Invalid number of arguments in the function!"
);
unsigned
int
numImplicitArgs
=
size
();
unsigned
int
implicitArgIndex
=
this
->
getNumberedArgIndex
(
argType
,
argNum
);
if
(
implicitArgIndex
==
numImplicitArgs
)
return
nullptr
;
unsigned
int
implicitArgIndexInFunc
=
F
.
getArgumentList
().
size
()
-
numImplicitArgs
+
implicitArgIndex
;
unsigned
int
implicitArgIndexInFunc
=
IGCLLVM
::
GetFuncArgSize
(
F
)
-
numImplicitArgs
+
implicitArgIndex
;
Function
::
arg_iterator
arg
=
F
.
arg_begin
();
for
(
unsigned
int
i
=
0
;
i
<
implicitArgIndexInFunc
;
++
i
,
++
arg
);
...
...
IGC/AdaptorCommon/ProcessFuncAttributes.cpp
View file @
a56fcc84
...
...
@@ -34,6 +34,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "SPIRV/SPIRVInternal.h"
#include "common/LLVMWarningsPush.hpp"
#include "llvmWrapper/IR/Attributes.h"
#include <llvm/Pass.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/Function.h>
...
...
@@ -233,7 +236,7 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
for
(
auto
I
:
F
->
users
())
{
if
(
CallInst
*
callInst
=
dyn_cast
<
CallInst
>
(
&*
I
))
{
if
(
callInst
->
hasFnAttr
(
llvm
::
Attribute
::
NoInline
))
{
callInst
->
removeAttribute
(
llvm
::
AttributeSet
::
FunctionIndex
,
llvm
::
Attribute
::
NoInline
);
callInst
->
removeAttribute
(
IGCLLVM
::
AttributeSet
::
FunctionIndex
,
llvm
::
Attribute
::
NoInline
);
}
}
}
...
...
@@ -293,7 +296,7 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
if
(
!
keepAlwaysInline
)
{
for
(
auto
&
arg
:
F
->
getArgumentList
())
for
(
auto
&
arg
:
F
->
args
())
{
// If argument contains an opaque type e.g. image, then always inline it.
// If argument is a pointer to GAS, always inline it for perf reason.
...
...
IGC/AdaptorOCL/CMakeLists.txt
View file @
a56fcc84
...
...
@@ -7,11 +7,12 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
#include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ocl_igc_shared/executable_format")
set
(
IGC_BUILD__SRC__AdaptorOCL
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/Upgrader/
Upgrader.cpp"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/Upgrader/
BitcodeReader.cpp"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/Upgrader/
llvm
${
LLVM_VERSION_MAJOR
}
/Upgrader.cpp"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/Upgrader/
llvm
${
LLVM_VERSION_MAJOR
}
/BitcodeReader.cpp"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/UnifyIROCL.cpp"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/MoveStaticAllocas.cpp"
)
if
(
IGC_BUILD__SPIRV_ENABLED
)
list
(
APPEND IGC_BUILD__SRC__AdaptorOCL
SPIRV/libSPIRV/OpenCL.std.h
...
...
IGC/AdaptorOCL/OCL/LoadBuffer.cpp
View file @
a56fcc84
...
...
@@ -72,7 +72,7 @@ MemoryBuffer *llvm::LoadBufferFromResource(const char *pResName,
#endif
#ifdef
LLVM_ON_WIN32
#ifdef
WIN32
#include <Windows.h>
// Windows.h defines MemoryFence as _mm_mfence, but this conflicts with llvm::sys::MemoryFence
#undef MemoryFence
...
...
IGC/AdaptorOCL/OCL/sp/sp_g8.cpp
View file @
a56fcc84
...
...
@@ -24,6 +24,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
======================= end_copyright_notice ==================================*/
#include "common/LLVMWarningsPush.hpp"
#include <llvm/Support/ScaledNumber.h>
#include "common/LLVMWarningsPop.hpp"
#include "sp_g8.h"
#include "sp_convert_g8.h"
#include "sp_debug.h"
...
...
@@ -41,6 +46,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "common/secure_mem.h"
#include "common/debug/Dump.hpp"
#include "common/debug/Debug.hpp"
#include <iStdLib/MemCopy.h>
#include "patch_list.h"
...
...
@@ -60,6 +66,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <algorithm>
#include <cstring>
using
namespace
IGC
;
using
namespace
IGC
::
IGCMD
;
using
namespace
IGC
::
Debug
;
...
...
IGC/AdaptorOCL/SPIRV/SPIRVInternal.h
View file @
a56fcc84
...
...
@@ -73,6 +73,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "common/LLVMWarningsPush.hpp"
#include "llvmWrapper/IR/Attributes.h"
#include "llvm/ADT/StringSwitch.h"
#include <llvm/Bitcode/BitcodeReader.h>
#include <llvm/Bitcode/BitcodeWriter.h>
...
...
@@ -85,7 +87,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/ToolOutputFile.h"
...
...
@@ -837,7 +838,7 @@ void getFunctionTypeParameterTypes(llvm::FunctionType* FT,
std
::
vector
<
Type
*>&
ArgTys
);
Function
*
getOrCreateFunction
(
Module
*
M
,
Type
*
RetTy
,
ArrayRef
<
Type
*>
ArgTypes
,
StringRef
Name
,
bool
Mangle
=
false
,
AttributeSet
*
Attrs
=
nullptr
,
bool
takeName
=
true
);
IGCLLVM
::
AttributeSet
*
Attrs
=
nullptr
,
bool
takeName
=
true
);
std
::
vector
<
Value
*>
getArguments
(
CallInst
*
CI
);
void
decorateSPIRVBuiltin
(
std
::
string
&
S
);
...
...
@@ -855,17 +856,17 @@ std::string getSPIRVBuiltinName(Op OC, SPIRVInstruction *BI, std::vector<Type*>
/// \return mutated call instruction.
CallInst
*
mutateCallInst
(
Module
*
M
,
CallInst
*
CI
,
std
::
function
<
std
::
string
(
CallInst
*
,
std
::
vector
<
Value
*>
&
)
>
ArgMutate
,
bool
Mangle
=
false
,
AttributeSet
*
Attrs
=
nullptr
,
bool
takeName
=
true
);
bool
Mangle
=
false
,
IGCLLVM
::
AttributeSet
*
Attrs
=
nullptr
,
bool
takeName
=
true
);
/// Mutate function by change the arguments.
/// \param ArgMutate mutates the function arguments.
void
mutateFunction
(
Function
*
F
,
std
::
function
<
std
::
string
(
CallInst
*
,
std
::
vector
<
Value
*>
&
)
>
ArgMutate
,
bool
Builtin
,
AttributeSet
*
Attrs
=
nullptr
,
bool
takeName
=
true
);
bool
Builtin
,
IGCLLVM
::
AttributeSet
*
Attrs
=
nullptr
,
bool
takeName
=
true
);
/// Add a call instruction at \p Pos.
CallInst
*
addCallInst
(
Module
*
M
,
StringRef
FuncName
,
Type
*
RetTy
,
ArrayRef
<
Value
*>
Args
,
AttributeSet
*
Attrs
,
Instruction
*
Pos
,
ArrayRef
<
Value
*>
Args
,
IGCLLVM
::
AttributeSet
*
Attrs
,
Instruction
*
Pos
,
bool
Builtin
,
StringRef
InstName
,
bool
TakeFuncName
=
true
);
/// Get a 64 bit integer constant.
...
...
IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
View file @
a56fcc84
...
...
@@ -62,19 +62,24 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
///
//===----------------------------------------------------------------------===//
#include "libSPIRV/SPIRVFunction.h"
#include "libSPIRV/SPIRVInstruction.h"
#include "SPIRVInternal.h"
#include "common/MDFrameWork.h"
#include "../../AdaptorCommon/TypesLegalizationPass.hpp"
#include "common/LLVMWarningsPush.hpp"
#include "llvmWrapper/IR/IRBuilder.h"
#include "llvmWrapper/IR/DIBuilder.h"
#include <llvm/Support/ScaledNumber.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/IR/IntrinsicInst.h>
#include "libSPIRV/SPIRVDebugInfoExt.h"
#include <llvm/Support/Dwarf.h>
#include "llvm/Transforms/Utils/Cloning.h"
#include "common/LLVMWarningsPop.hpp"
#include "libSPIRV/SPIRVFunction.h"
#include "libSPIRV/SPIRVInstruction.h"
#include "SPIRVInternal.h"
#include "common/MDFrameWork.h"
#include "../../AdaptorCommon/TypesLegalizationPass.hpp"
#include <iostream>
#include <fstream>
...
...
@@ -760,11 +765,11 @@ public:
{
OpDebugValue
dbgValue
(
inst
);
auto
dbgValueInst
=
Builder
.
insertDbgValueIntrinsic
(
localVar
,
0
,
createLocalVar
(
BM
->
get
<
SPIRVExtInst
>
(
dbgValue
.
getVar
())),
createExpression
(
BM
->
get
<
SPIRVExtInst
>
(
dbgValue
.
getExpression
())),
createLocation
(
inst
->
getLine
()
->
getLine
(),
inst
->
getLine
()
->
getColumn
(),
createScope
(
inst
->
getDIScope
())),
insertAtEnd
);
auto
dbgValueInst
=
Builder
.
insertDbgValueIntrinsic
(
localVar
,
0
,
createLocalVar
(
BM
->
get
<
SPIRVExtInst
>
(
dbgValue
.
getVar
())),
createExpression
(
BM
->
get
<
SPIRVExtInst
>
(
dbgValue
.
getExpression
())),
createLocation
(
inst
->
getLine
()
->
getLine
(),
inst
->
getLine
()
->
getColumn
(),
createScope
(
inst
->
getDIScope
())),
insertAtEnd
);
return
dbgValueInst
;
}
...
...
@@ -810,7 +815,7 @@ private:
SPIRVModule
*
BM
;
Module
*
M
;
SPIRVDbgInfo
SpDbg
;
DIBuilder
Builder
;
IGCLLVM
::
DIBuilder
Builder
;
bool
Enable
;
DICompileUnit
*
cu
=
nullptr
;
SPIRVToLLVM
*
SPIRVTranslator
=
nullptr
;
...
...
@@ -1671,7 +1676,7 @@ SPIRVToLLVM::postProcessFunctionsReturnStruct(Function *F) {
for
(
auto
RetInst
:
Returns
)
{
Value
*
ReturnedValPtr
=
cast
<
LoadInst
>
(
RetInst
->
getReturnValue
())
->
getPointerOperand
();
I
RBuilder
<>
builder
(
RetInst
);
I
GCLLVM
::
IRBuilder
<>
builder
(
RetInst
);
auto
size
=
DL
.
getTypeAllocSize
(
RetInst
->
getReturnValue
()
->
getType
());
builder
.
CreateMemCpy
(
&*
NewF
->
arg_begin
(),
ReturnedValPtr
,
size
,
ptrSize
);
builder
.
CreateRetVoid
();
...
...
@@ -1682,7 +1687,9 @@ SPIRVToLLVM::postProcessFunctionsReturnStruct(Function *F) {
for
(
auto
I
=
F
->
user_begin
(),
E
=
F
->
user_end
();
I
!=
E
;)
{
if
(
auto
CI
=
dyn_cast
<
CallInst
>
(
*
I
++
))
{
auto
Args
=
getArguments
(
CI
);
auto
Alloca
=
new
AllocaInst
(
CI
->
getType
(),
""
,
CI
);
IGCLLVM
::
IRBuilder
<>
builder
(
CI
);
//auto Alloca = new AllocaInst(CI->getType(), "", CI);
auto
Alloca
=
builder
.
CreateAlloca
(
CI
->
getType
());
Args
.
insert
(
Args
.
begin
(),
Alloca
);
auto
NewCI
=
CallInst
::
Create
(
NewF
,
Args
,
""
,
CI
);
NewCI
->
setCallingConv
(
CI
->
getCallingConv
());
...
...
@@ -1705,6 +1712,7 @@ SPIRVToLLVM::postProcessFunctionsWithAggregateArguments(Function* F) {
mutateFunction
(
F
,
[
=
](
CallInst
*
CI
,
std
::
vector
<
Value
*>
&
Args
)
{
auto
FBegin
=
CI
->
getParent
()
->
getParent
()
->
begin
()
->
getFirstInsertionPt
();
IGCLLVM
::
IRBuilder
<>
builder_begin
(
&
(
*
FBegin
));
for
(
auto
&
I
:
Args
)
{
auto
T
=
I
->
getType
();
if
(
!
T
->
isAggregateType
())
...
...
@@ -1716,9 +1724,11 @@ SPIRVToLLVM::postProcessFunctionsWithAggregateArguments(Function* F) {
I
=
loadInst
->
getPointerOperand
();
}
auto
Alloca
=
new
AllocaInst
(
T
,
""
,
&
(
*
FBegin
));
//auto Alloca = new AllocaInst(T, &(*FBegin));
auto
Alloca
=
builder_begin
.
CreateAlloca
(
T
);
Alloca
->
setAlignment
(
ptrSize
);
IRBuilder
<>
builder
(
CI
);
IGCLLVM
::
IRBuilder
<>
builder
(
CI
);
auto
size
=
DL
.
getTypeAllocSize
(
T
);
builder
.
CreateMemCpy
(
Alloca
,
I
,
size
,
ptrSize
);
if
(
T
->
isArrayTy
())
{
...
...
@@ -2068,7 +2078,9 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
if
(
BS
==
StorageClassFunction
&&
!
Init
)
{
assert
(
BB
&&
"Invalid BB"
);
return
mapValue
(
BV
,
new
AllocaInst
(
Ty
,
BV
->
getName
(),
BB
));
IGCLLVM
::
IRBuilder
<>
builder
(
BB
);
//return mapValue(BV, new AllocaInst(Ty, BV->getName(), BB));
return
mapValue
(
BV
,
builder
.
CreateAlloca
(
Ty
,
nullptr
,
BV
->
getName
()));
}
auto
AddrSpace
=
SPIRSPIRVAddrSpaceMap
::
rmap
(
BS
);
auto
LVar
=
new
GlobalVariable
(
*
M
,
Ty
,
IsConst
,
LinkageTy
,
Initializer
,
...
...
@@ -2218,7 +2230,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
// %5 = bitcast %0* %CS.tmpstore to i8*
// call void @llvm.memcpy.p1i8.p0i8.i64(i8 addrspace(1)* %4, i8* %5, i64 16, i32 0, i1 false)
// So we emit this store in a similar fashion as clang would.
I
RBuilder
<>
IRB
(
&
F
->
getEntryBlock
(),
F
->
getEntryBlock
().
begin
());
I
GCLLVM
::
IRBuilder
<>
IRB
(
&
F
->
getEntryBlock
(),
F
->
getEntryBlock
().
begin
());
auto
DL
=
M
->
getDataLayout
();
std
::
function
<
void
(
ConstantStruct
*
,
Value
*
)
>
LowerConstantStructStore
=
[
&
](
ConstantStruct
*
CS
,
Value
*
pointer
)
...
...
@@ -2273,7 +2285,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
unsigned
Align
=
BC
->
getAlignment
();
llvm
::
Value
*
Size
=
transValue
(
BC
->
getSize
(),
F
,
BB
);
bool
IsVolatile
=
BC
->
SPIRVMemoryAccess
::
getVolatile
();
I
RBuilder
<>
Builder
(
BB
);
I
GCLLVM
::
IRBuilder
<>
Builder
(
BB
);
// If we copy from zero-initialized array, we can optimize it to llvm.memset
if
(
BC
->
getSource
()
->
getOpCode
()
==
OpBitcast
)
{
...
...
@@ -2665,7 +2677,7 @@ SPIRVToLLVM::transFunction(SPIRVFunction *BF) {
BF
->
foreachReturnValueAttr
([
&
](
SPIRVFuncParamAttrKind
Kind
){
if
(
Kind
==
FunctionParameterAttributeCount
)
return
;
F
->
addAttribute
(
AttributeSet
::
ReturnIndex
,
F
->
addAttribute
(
IGCLLVM
::
AttributeSet
::
ReturnIndex
,
SPIRSPIRVFuncParamAttrMap
::
rmap
(
Kind
));
});
...
...
@@ -3470,7 +3482,7 @@ SPIRVToLLVM::transOCLBuiltinFromExtInst(SPIRVExtInst *BC, BasicBlock *BB) {
BC
->
getName
(),
BB
);
setCallingConv
(
Call
);
Call
->
addAttribute
(
AttributeSet
::
FunctionIndex
,
Attribute
::
NoUnwind
);
Call
->
addAttribute
(
IGCLLVM
::
AttributeSet
::
FunctionIndex
,
Attribute
::
NoUnwind
);
return
Call
;
}
...
...
IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
View file @
a56fcc84
...
...
@@ -63,27 +63,33 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
///
//===----------------------------------------------------------------------===//
#include "libSPIRV/SPIRVInstruction.h"
#include "SPIRVInternal.h"
#include "Mangler/ParameterType.h"
#include "common/LLVMWarningsPush.hpp"
#include "llvmWrapper/Bitcode/BitcodeWriter.h"
#include "llvmWrapper/IR/Attributes.h"
#include "llvmWrapper/Support/ToolOutputFile.h"
#include <llvm/Support/ScaledNumber.h>
#include "llvm/ADT/StringExtras.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "common/LLVMWarningsPop.hpp"
#include "libSPIRV/SPIRVInstruction.h"
#include "SPIRVInternal.h"
#include "Mangler/ParameterType.h"
namespace
spv
{
void
saveLLVMModule
(
Module
*
M
,
const
std
::
string
&
OutputFile
)
{
std
::
error_code
EC
;
tool_output_file
Out
(
OutputFile
.
c_str
(),
EC
,
sys
::
fs
::
F_None
);
IGCLLVM
::
tool_output_file
Out
(
OutputFile
.
c_str
(),
EC
,
sys
::
fs
::
F_None
);
if
(
EC
)
{
spirv_assert
(
0
&&
"Failed to open file"
);
return
;
}
WriteBitcodeToFile
(
M
,
Out
.
os
());
IGCLLVM
::
WriteBitcodeToFile
(
M
,
Out
.
os
());
Out
.
keep
();
}
...
...
@@ -106,7 +112,7 @@ getFunctionTypeParameterTypes(llvm::FunctionType* FT,
Function
*
getOrCreateFunction
(
Module
*
M
,
Type
*
RetTy
,
ArrayRef
<
Type
*>
ArgTypes
,
StringRef
Name
,
bool
builtin
,
AttributeSet
*
Attrs
,
bool
takeName
)
{
StringRef
Name
,
bool
builtin
,
IGCLLVM
::
AttributeSet
*
Attrs
,
bool
takeName
)
{
std
::
string
FuncName
(
Name
);
if
(
builtin
)
decorateSPIRVBuiltin
(
FuncName
,
ArgTypes
);
...
...
@@ -300,8 +306,8 @@ getSPIRVBuiltinName(Op OC, SPIRVInstruction *BI, std::vector<Type*> ArgTypes, st
CallInst
*
mutateCallInst
(
Module
*
M
,
CallInst
*
CI
,
std
::
function
<
std
::
string
(
CallInst
*
,
std
::
vector
<
Value
*>
&
)
>
ArgMutate
,
bool
Mangle
,
AttributeSet
*
Attrs
,
bool
TakeFuncName
)
{
std
::
function
<
std
::
string
(
CallInst
*
,
std
::
vector
<
Value
*>
&
)
>
ArgMutate
,
bool
Mangle
,
IGCLLVM
::
AttributeSet
*
Attrs
,
bool
TakeFuncName
)
{
auto
Args
=
getArguments
(
CI
);
auto
NewName
=
ArgMutate
(
CI
,
Args
);
...
...
@@ -355,7 +361,7 @@ mutateCallInst(Module *M, CallInst *CI,
void
mutateFunction
(
Function
*
F
,
std
::
function
<
std
::
string
(
CallInst
*
,
std
::
vector
<
Value
*>
&
)
>
ArgMutate
,
bool
Mangle
,
AttributeSet
*
Attrs
,
bool
TakeFuncName
)
{
bool
Mangle
,
IGCLLVM
::
AttributeSet
*
Attrs
,
bool
TakeFuncName
)
{
auto
M
=
F
->
getParent
();
for
(
auto
I
=
F
->
user_begin
(),
E
=
F
->
user_end
();
I
!=
E
;)
{
if
(
auto
CI
=
dyn_cast
<
CallInst
>
(
*
I
++
))
...
...
@@ -369,7 +375,7 @@ mutateFunction(Function *F,
CallInst
*
addCallInst
(
Module
*
M
,
StringRef
FuncName
,
Type
*
RetTy
,
ArrayRef
<
Value
*>
Args
,
AttributeSet
*
Attrs
,
Instruction
*
Pos
,
bool
Mangle
,
StringRef
InstName
,
IGCLLVM
::
AttributeSet
*
Attrs
,
Instruction
*
Pos
,
bool
Mangle
,
StringRef
InstName
,
bool
TakeFuncName
)
{
auto
F
=
getOrCreateFunction
(
M
,
RetTy
,
getTypes
(
Args
),
FuncName
,
Mangle
,
Attrs
,
TakeFuncName
);
...
...
IGC/AdaptorOCL/UnifyIROCL.cpp
View file @
a56fcc84
...
...
@@ -24,6 +24,28 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
======================= end_copyright_notice ==================================*/
#include "common/LLVMWarningsPush.hpp"
#include <llvm/Support/ScaledNumber.h>
#include "llvm/ADT/PostOrderIterator.h"
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Verifier.h>
#include <llvm/Analysis/CFGPrinter.h>
#include <llvm/Analysis/Passes.h>
#include <llvm/Pass.h>
#include <llvm/IR/PassManager.h>
#include <llvm/Transforms/IPO.h>
#include <llvm/Transforms/IPO/AlwaysInliner.h>
#include <llvm/Transforms/Scalar.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/Function.h>
#include <llvm/Analysis/TargetLibraryInfo.h>
#include <llvm/Transforms/InstCombine/InstCombineWorklist.h>
#include <llvm/Transforms/InstCombine/InstCombine.h>
#include <llvmWrapper/Transforms/Utils.h>
#include "common/LLVMWarningsPop.hpp"
#include "AdaptorCommon/AddImplicitArgs.hpp"
#include "AdaptorCommon/ProcessFuncAttributes.h"
#include "common/LLVMUtils.h"
...
...
@@ -98,26 +120,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <iStdLib/utility.h>
#include "common/LLVMWarningsPush.hpp"
#include "llvm/ADT/PostOrderIterator.h"
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Verifier.h>
#include <llvm/Analysis/CFGPrinter.h>
#include <llvm/Analysis/Passes.h>
#include <llvm/Pass.h>
#include <llvm/IR/PassManager.h>
#include <llvm/Transforms/IPO.h>
#include <llvm/Transforms/IPO/AlwaysInliner.h>
#include <llvm/Transforms/Scalar.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/Function.h>
#include <llvm/Analysis/TargetLibraryInfo.h>
#include "common/LLVMWarningsPop.hpp"
#include <sstream>
#include "Compiler/DebugInfo/VISADebugEmitter.hpp"
#include <algorithm>
using
namespace
llvm
;
using
namespace
IGC
::
IGCMD
;
using
namespace
IGC
::
Debug
;
...
...
IGC/AdaptorOCL/Upgrader/BitcodeReader.cpp
→
IGC/AdaptorOCL/Upgrader/
llvm4/
BitcodeReader.cpp
View file @
a56fcc84
This diff is collapsed.
Click to expand it.
IGC/AdaptorOCL/Upgrader/BitcodeReader.h
→
IGC/AdaptorOCL/Upgrader/
llvm4/
BitcodeReader.h
View file @
a56fcc84
This diff is collapsed.
Click to expand it.
IGC/AdaptorOCL/Upgrader/MetadataLoader.h
→
IGC/AdaptorOCL/Upgrader/
llvm4/
MetadataLoader.h
View file @
a56fcc84
/*===================== begin_copyright_notice ==================================
Copyright (c) 2017 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
======================= end_copyright_notice ==================================*/
//===-- Bitcode/Reader/MetadataLoader.h - Load Metadatas -------*- C++ -*-====//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This class handles loading Metadatas.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_BITCODE_READER_METADATALOADER_H
#define LLVM_LIB_BITCODE_READER_METADATALOADER_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Error.h"
#include <functional>
#include <memory>
namespace
llvm
{
class
BitcodeReaderValueList
;
class
BitstreamCursor
;
class
DISubprogram
;
class
Error
;
class
Function
;
class
Instruction
;
class
Metadata
;
class
MDNode
;
class
Module
;
class
Type
;
/// Helper class that handles loading Metadatas and keeping them available.
class
MetadataLoader
{
class
MetadataLoaderImpl
;
std
::
unique_ptr
<
MetadataLoaderImpl
>
Pimpl
;
Error
parseMetadata
(
bool
ModuleLevel
);
public:
~
MetadataLoader
();
MetadataLoader
(
BitstreamCursor
&
Stream
,
Module
&
TheModule
,
BitcodeReaderValueList
&
ValueList
,
bool
IsImporting
,
std
::
function
<
Type
*
(
unsigned
)
>
getTypeByID
);
MetadataLoader
&
operator
=
(
MetadataLoader
&&
);
MetadataLoader
(
MetadataLoader
&&
);
// Parse a module metadata block
Error
parseModuleMetadata
()
{
return
parseMetadata
(
true
);
}
// Parse a function metadata block
Error
parseFunctionMetadata
()
{
return
parseMetadata
(
false
);
}
/// Set the mode to strip TBAA metadata on load.
void
setStripTBAA
(
bool
StripTBAA
=
true
);
/// Return true if the Loader is stripping TBAA metadata.
bool
isStrippingTBAA
();
// Return true there are remaining unresolved forward references.
bool
hasFwdRefs
()
const
;
/// Return the given metadata, creating a replaceable forward reference if
/// necessary.
Metadata
*
getMetadataFwdRefOrLoad
(
unsigned
Idx
);
MDNode
*
getMDNodeFwdRefOrNull
(
unsigned
Idx
);
/// Return the DISubprogra metadata for a Function if any, null otherwise.
DISubprogram
*
lookupSubprogramForFunction
(
Function
*
F
);
/// Parse a `METADATA_ATTACHMENT` block for a function.
Error
parseMetadataAttachment
(
Function
&
F
,
const
SmallVectorImpl
<
Instruction
*>
&
InstructionList
);
/// Parse a `METADATA_KIND` block for the current module.
Error
parseMetadataKinds
();
unsigned
size
()
const
;
void
shrinkTo
(
unsigned
N
);
};
}
#endif // LLVM_LIB_BITCODE_READER_METADATALOADER_H
/*===================== begin_copyright_notice ==================================
Copyright (c) 2017 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
======================= end_copyright_notice ==================================*/
//===-- Bitcode/Reader/MetadataLoader.h - Load Metadatas -------*- C++ -*-====//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This class handles loading Metadatas.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_BITCODE_READER_METADATALOADER_H
#define LLVM_LIB_BITCODE_READER_METADATALOADER_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Error.h"
#include <functional>
#include <memory>
namespace
llvm
{
class
BitcodeReaderValueList
;
class
BitstreamCursor
;
class
DISubprogram
;
class
Error
;
class
Function
;
class
Instruction
;
class
Metadata
;
class
MDNode
;
class
Module
;
class
Type
;
/// Helper class that handles loading Metadatas and keeping them available.
class
MetadataLoader
{
class
MetadataLoaderImpl
;