swr: [rasterizer jitter] fixes for icc in vs2015 compat mode

- Move most jitter functionality into SwrJit namespace
- Avoid global "using namespace llvm" in headers

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
This commit is contained in:
Tim Rowley 2016-09-20 17:14:54 -05:00
parent b8a6f06c85
commit aaeb07989e
12 changed files with 1621 additions and 1586 deletions

View File

@ -72,6 +72,7 @@
#endif
using namespace llvm;
using namespace SwrJit;
//////////////////////////////////////////////////////////////////////////
/// @brief Contructor for JitManager.

View File

@ -86,7 +86,6 @@ using PassManager = llvm::legacy::PassManager;
#pragma pop_macro("DEBUG")
using namespace llvm;
//////////////////////////////////////////////////////////////////////////
/// JitInstructionSet
/// @brief Subclass of InstructionSet that allows users to override
@ -136,7 +135,7 @@ private:
struct JitLLVMContext : LLVMContext
struct JitLLVMContext : llvm::LLVMContext
{
};
@ -150,32 +149,32 @@ struct JitManager
~JitManager(){};
JitLLVMContext mContext; ///< LLVM compiler
IRBuilder<> mBuilder; ///< LLVM IR Builder
ExecutionEngine* mpExec;
llvm::IRBuilder<> mBuilder; ///< LLVM IR Builder
llvm::ExecutionEngine* mpExec;
// Need to be rebuilt after a JIT and before building new IR
Module* mpCurrentModule;
llvm::Module* mpCurrentModule;
bool mIsModuleFinalized;
uint32_t mJitNumber;
uint32_t mVWidth;
// Built in types.
Type* mInt8Ty;
Type* mInt32Ty;
Type* mInt64Ty;
Type* mFP32Ty;
StructType* mV4FP32Ty;
StructType* mV4Int32Ty;
llvm::Type* mInt8Ty;
llvm::Type* mInt32Ty;
llvm::Type* mInt64Ty;
llvm::Type* mFP32Ty;
llvm::StructType* mV4FP32Ty;
llvm::StructType* mV4Int32Ty;
Type* mSimtFP32Ty;
Type* mSimtInt32Ty;
llvm::Type* mSimtFP32Ty;
llvm::Type* mSimtInt32Ty;
Type* mSimdVectorInt32Ty;
Type* mSimdVectorTy;
llvm::Type* mSimdVectorInt32Ty;
llvm::Type* mSimdVectorTy;
// fetch shader types
FunctionType* mFetchShaderTy;
llvm::FunctionType* mFetchShaderTy;
JitInstructionSet mArch;
std::string mCore;
@ -183,6 +182,6 @@ struct JitManager
void SetupNewModule();
bool SetupModuleFromIR(const uint8_t *pIR);
void DumpAsm(Function* pFunction, const char* fileName);
static void DumpToFile(Function *f, const char *fileName);
void DumpAsm(llvm::Function* pFunction, const char* fileName);
static void DumpToFile(llvm::Function *f, const char *fileName);
};

View File

@ -37,6 +37,9 @@
// components with bit-widths <= the QUANTIZE_THRESHOLD will be quantized
#define QUANTIZE_THRESHOLD 2
using namespace llvm;
using namespace SwrJit;
//////////////////////////////////////////////////////////////////////////
/// Interface to Jitting a blend shader
//////////////////////////////////////////////////////////////////////////

View File

@ -30,6 +30,8 @@
#include "builder.h"
namespace SwrJit
{
using namespace llvm;
//////////////////////////////////////////////////////////////////////////
@ -63,6 +65,7 @@ Builder::Builder(JitManager *pJitMgr)
mSimdFP16Ty = VectorType::get(mFP16Ty, mVWidth);
mSimdFP32Ty = VectorType::get(mFP32Ty, mVWidth);
mSimdVectorTy = StructType::get(pJitMgr->mContext, std::vector<Type*>(4, mSimdFP32Ty), false);
mSimdVectorTRTy = StructType::get(pJitMgr->mContext, std::vector<Type*>(5, mSimdFP32Ty), false);
if (sizeof(uint32_t*) == 4)
{
@ -76,3 +79,4 @@ Builder::Builder(JitManager *pJitMgr)
mSimdIntPtrTy = mSimdInt64Ty;
}
}
}

View File

@ -32,8 +32,9 @@
#include "JitManager.h"
#include "common/formats.h"
namespace SwrJit
{
using namespace llvm;
struct Builder
{
Builder(JitManager *pJitMgr);
@ -67,6 +68,7 @@ struct Builder
Type* mSimdInt64Ty;
Type* mSimdIntPtrTy;
Type* mSimdVectorTy;
Type* mSimdVectorTRTy;
StructType* mV4FP32Ty;
StructType* mV4Int32Ty;
@ -74,5 +76,5 @@ struct Builder
#include "builder_x86.h"
#include "builder_misc.h"
#include "builder_math.h"
};
}

View File

@ -30,6 +30,9 @@
#include "builder.h"
#include "common/rdtsc_buckets.h"
namespace SwrJit
{
void __cdecl CallPrint(const char* fmt, ...);
//////////////////////////////////////////////////////////////////////////
@ -1620,3 +1623,4 @@ void Builder::RDTSC_STOP(Value* pBucketMgr, Value* pId)
}
}
}

View File

@ -35,6 +35,8 @@
#include <tuple>
//#define FETCH_DUMP_VERTEX 1
using namespace llvm;
using namespace SwrJit;
bool isComponentEnabled(ComponentEnable enableMask, uint8_t component);

View File

@ -259,7 +259,11 @@ def generate_gen_cpp(functions, output_file):
output_lines += [
'#include \"builder.h\"',
''
'',
'namespace SwrJit',
'{',
' using namespace llvm;',
'',
]
for func in functions:
@ -284,7 +288,7 @@ def generate_gen_cpp(functions, output_file):
' }',
'',
]
output_lines.append('}')
output_file.write('\n'.join(output_lines) + '\n')
"""
@ -326,7 +330,11 @@ def generate_x86_cpp(output_file):
output_lines += [
'#include \"builder.h\"',
''
'',
'namespace SwrJit',
'{',
' using namespace llvm;',
'',
]
for inst in intrinsics:
@ -375,6 +383,7 @@ def generate_x86_cpp(output_file):
'',
]
output_lines.append('}')
output_file.write('\n'.join(output_lines) + '\n')
"""

View File

@ -59,6 +59,10 @@ header = r"""
#pragma once
namespace SwrJit
{
using namespace llvm;
"""
"""
@ -319,6 +323,7 @@ def gen_llvm_types(input_file, output_file):
output_lines.append('')
output_lines.append('}')
output_file.write('\n'.join(output_lines) + '\n')
"""

View File

@ -36,6 +36,9 @@
#include <sstream>
#include <unordered_set>
using namespace llvm;
using namespace SwrJit;
//////////////////////////////////////////////////////////////////////////
/// Interface to Jitting a fetch shader
//////////////////////////////////////////////////////////////////////////

View File

@ -44,6 +44,8 @@
#include "swr_state.h"
#include "swr_screen.h"
using namespace SwrJit;
static unsigned
locate_linkage(ubyte name, ubyte index, struct tgsi_shader_info *info);

View File

@ -60,6 +60,7 @@
#include "swr_tex_sample.h"
#include "swr_context_llvm.h"
using namespace SwrJit;
/**
* This provides the bridge between the sampler state store in