Fix #ifdefs to catch LLVM 3.1svn now as well
This commit is contained in:
@@ -366,7 +366,7 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
|
|||||||
|
|
||||||
std::string(linkError);
|
std::string(linkError);
|
||||||
if (llvm::Linker::LinkModules(module, bcModule,
|
if (llvm::Linker::LinkModules(module, bcModule,
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::Linker::DestroySource,
|
llvm::Linker::DestroySource,
|
||||||
#endif // LLVM_3_0
|
#endif // LLVM_3_0
|
||||||
&linkError))
|
&linkError))
|
||||||
|
|||||||
14
ctx.cpp
14
ctx.cpp
@@ -808,7 +808,7 @@ FunctionEmitContext::SizeOf(LLVM_TYPE_CONST llvm::Type *ty) {
|
|||||||
LLVM_TYPE_CONST llvm::Type *ptrType = llvm::PointerType::get(ty, 0);
|
LLVM_TYPE_CONST llvm::Type *ptrType = llvm::PointerType::get(ty, 0);
|
||||||
llvm::Value *nullPtr = llvm::Constant::getNullValue(ptrType);
|
llvm::Value *nullPtr = llvm::Constant::getNullValue(ptrType);
|
||||||
llvm::Value *index[1] = { LLVMInt32(1) };
|
llvm::Value *index[1] = { LLVMInt32(1) };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> arrayRef(&index[0], &index[1]);
|
llvm::ArrayRef<llvm::Value *> arrayRef(&index[0], &index[1]);
|
||||||
llvm::Value *poffset = llvm::GetElementPtrInst::Create(nullPtr, arrayRef,
|
llvm::Value *poffset = llvm::GetElementPtrInst::Create(nullPtr, arrayRef,
|
||||||
"offset_ptr", bblock);
|
"offset_ptr", bblock);
|
||||||
@@ -830,7 +830,7 @@ lGetStringAsValue(llvm::BasicBlock *bblock, const char *s) {
|
|||||||
llvm::GlobalValue::InternalLinkage,
|
llvm::GlobalValue::InternalLinkage,
|
||||||
sConstant, s);
|
sConstant, s);
|
||||||
llvm::Value *indices[2] = { LLVMInt32(0), LLVMInt32(0) };
|
llvm::Value *indices[2] = { LLVMInt32(0), LLVMInt32(0) };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[2]);
|
llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[2]);
|
||||||
return llvm::GetElementPtrInst::Create(sPtr, arrayRef, "sptr", bblock);
|
return llvm::GetElementPtrInst::Create(sPtr, arrayRef, "sptr", bblock);
|
||||||
#else
|
#else
|
||||||
@@ -1316,7 +1316,7 @@ FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index0
|
|||||||
// The easy case: both the base pointer and the indices are
|
// The easy case: both the base pointer and the indices are
|
||||||
// uniform, so just emit the regular LLVM GEP instruction
|
// uniform, so just emit the regular LLVM GEP instruction
|
||||||
llvm::Value *indices[2] = { index0, index1 };
|
llvm::Value *indices[2] = { index0, index1 };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[2]);
|
llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[2]);
|
||||||
llvm::Instruction *inst =
|
llvm::Instruction *inst =
|
||||||
llvm::GetElementPtrInst::Create(basePtr, arrayRef,
|
llvm::GetElementPtrInst::Create(basePtr, arrayRef,
|
||||||
@@ -1843,7 +1843,7 @@ llvm::PHINode *
|
|||||||
FunctionEmitContext::PhiNode(LLVM_TYPE_CONST llvm::Type *type, int count,
|
FunctionEmitContext::PhiNode(LLVM_TYPE_CONST llvm::Type *type, int count,
|
||||||
const char *name) {
|
const char *name) {
|
||||||
llvm::PHINode *pn = llvm::PHINode::Create(type,
|
llvm::PHINode *pn = llvm::PHINode::Create(type,
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
count,
|
count,
|
||||||
#endif // LLVM_3_0
|
#endif // LLVM_3_0
|
||||||
name ? name : "phi", bblock);
|
name ? name : "phi", bblock);
|
||||||
@@ -1877,7 +1877,7 @@ FunctionEmitContext::CallInst(llvm::Function *func,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::Instruction *ci =
|
llvm::Instruction *ci =
|
||||||
llvm::CallInst::Create(func, args, name ? name : "", bblock);
|
llvm::CallInst::Create(func, args, name ? name : "", bblock);
|
||||||
#else
|
#else
|
||||||
@@ -1898,7 +1898,7 @@ FunctionEmitContext::CallInst(llvm::Function *func, llvm::Value *arg,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::Instruction *ci =
|
llvm::Instruction *ci =
|
||||||
llvm::CallInst::Create(func, arg, name ? name : "", bblock);
|
llvm::CallInst::Create(func, arg, name ? name : "", bblock);
|
||||||
#else
|
#else
|
||||||
@@ -1921,7 +1921,7 @@ FunctionEmitContext::CallInst(llvm::Function *func, llvm::Value *arg0,
|
|||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *args[] = { arg0, arg1 };
|
llvm::Value *args[] = { arg0, arg1 };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> argArrayRef(&args[0], &args[2]);
|
llvm::ArrayRef<llvm::Value *> argArrayRef(&args[0], &args[2]);
|
||||||
llvm::Instruction *ci =
|
llvm::Instruction *ci =
|
||||||
llvm::CallInst::Create(func, argArrayRef, name ? name : "",
|
llvm::CallInst::Create(func, argArrayRef, name ? name : "",
|
||||||
|
|||||||
12
ispc.cpp
12
ispc.cpp
@@ -52,7 +52,7 @@
|
|||||||
#include <llvm/Target/TargetMachine.h>
|
#include <llvm/Target/TargetMachine.h>
|
||||||
#include <llvm/Target/TargetOptions.h>
|
#include <llvm/Target/TargetOptions.h>
|
||||||
#include <llvm/Target/TargetData.h>
|
#include <llvm/Target/TargetData.h>
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
#include <llvm/Support/TargetRegistry.h>
|
#include <llvm/Support/TargetRegistry.h>
|
||||||
#include <llvm/Support/TargetSelect.h>
|
#include <llvm/Support/TargetSelect.h>
|
||||||
#else
|
#else
|
||||||
@@ -85,7 +85,7 @@ Target::GetTarget(const char *arch, const char *cpu, const char *isa,
|
|||||||
if (isa == NULL) {
|
if (isa == NULL) {
|
||||||
if (!strcasecmp(cpu, "atom"))
|
if (!strcasecmp(cpu, "atom"))
|
||||||
isa = "sse2";
|
isa = "sse2";
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
else if (!strcasecmp(cpu, "sandybridge") ||
|
else if (!strcasecmp(cpu, "sandybridge") ||
|
||||||
!strcasecmp(cpu, "corei7-avx"))
|
!strcasecmp(cpu, "corei7-avx"))
|
||||||
isa = "avx";
|
isa = "avx";
|
||||||
@@ -147,7 +147,7 @@ Target::GetTarget(const char *arch, const char *cpu, const char *isa,
|
|||||||
t->vectorWidth = 8;
|
t->vectorWidth = 8;
|
||||||
t->attributes = "+sse,+sse2,+sse3,+sse41,-sse42,-sse4a,+ssse3,-popcnt,+cmov";
|
t->attributes = "+sse,+sse2,+sse3,+sse41,-sse42,-sse4a,+ssse3,-popcnt,+cmov";
|
||||||
}
|
}
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
else if (!strcasecmp(isa, "avx")) {
|
else if (!strcasecmp(isa, "avx")) {
|
||||||
t->isa = Target::AVX;
|
t->isa = Target::AVX;
|
||||||
t->nativeVectorWidth = 8;
|
t->nativeVectorWidth = 8;
|
||||||
@@ -180,7 +180,7 @@ Target::GetTarget(const char *arch, const char *cpu, const char *isa,
|
|||||||
const char *
|
const char *
|
||||||
Target::SupportedTargetCPUs() {
|
Target::SupportedTargetCPUs() {
|
||||||
return "atom, barcelona, core2, corei7, "
|
return "atom, barcelona, core2, corei7, "
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
"corei7-avx, "
|
"corei7-avx, "
|
||||||
#endif
|
#endif
|
||||||
"istanbul, nocona, penryn, "
|
"istanbul, nocona, penryn, "
|
||||||
@@ -200,7 +200,7 @@ Target::SupportedTargetArchs() {
|
|||||||
const char *
|
const char *
|
||||||
Target::SupportedTargetISAs() {
|
Target::SupportedTargetISAs() {
|
||||||
return "sse2, sse2-x2, sse4, sse4-x2"
|
return "sse2, sse2-x2, sse4, sse4-x2"
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
", avx, avx-x2"
|
", avx, avx-x2"
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
@@ -236,7 +236,7 @@ Target::GetTargetMachine() const {
|
|||||||
|
|
||||||
llvm::Reloc::Model relocModel = generatePIC ? llvm::Reloc::PIC_ :
|
llvm::Reloc::Model relocModel = generatePIC ? llvm::Reloc::PIC_ :
|
||||||
llvm::Reloc::Default;
|
llvm::Reloc::Default;
|
||||||
#if defined(LLVM_3_0svn) || defined(LLVM_3_0)
|
#if defined(LLVM_3_0svn) || defined(LLVM_3_1svn) || defined(LLVM_3_0)
|
||||||
std::string featuresString = attributes;
|
std::string featuresString = attributes;
|
||||||
llvm::TargetMachine *targetMachine =
|
llvm::TargetMachine *targetMachine =
|
||||||
target->createTargetMachine(triple, cpu, featuresString, relocModel);
|
target->createTargetMachine(triple, cpu, featuresString, relocModel);
|
||||||
|
|||||||
2
ispc.h
2
ispc.h
@@ -76,7 +76,7 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// llvm::Type *s are no longer const in llvm 3.0
|
// llvm::Type *s are no longer const in llvm 3.0
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
#define LLVM_TYPE_CONST
|
#define LLVM_TYPE_CONST
|
||||||
#else
|
#else
|
||||||
#define LLVM_TYPE_CONST const
|
#define LLVM_TYPE_CONST const
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ extern "C" {
|
|||||||
#include <llvm/DerivedTypes.h>
|
#include <llvm/DerivedTypes.h>
|
||||||
#include <llvm/Instructions.h>
|
#include <llvm/Instructions.h>
|
||||||
#include <llvm/ExecutionEngine/ExecutionEngine.h>
|
#include <llvm/ExecutionEngine/ExecutionEngine.h>
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
#include <llvm/Support/TargetRegistry.h>
|
#include <llvm/Support/TargetRegistry.h>
|
||||||
#include <llvm/Support/TargetSelect.h>
|
#include <llvm/Support/TargetSelect.h>
|
||||||
#else
|
#else
|
||||||
@@ -182,7 +182,7 @@ static bool lRunTest(const char *fn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string eeError;
|
std::string eeError;
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::EngineBuilder engineBuilder(module);
|
llvm::EngineBuilder engineBuilder(module);
|
||||||
engineBuilder.setErrorStr(&eeError);
|
engineBuilder.setErrorStr(&eeError);
|
||||||
engineBuilder.setEngineKind(llvm::EngineKind::JIT);
|
engineBuilder.setEngineKind(llvm::EngineKind::JIT);
|
||||||
@@ -361,7 +361,7 @@ static bool lRunTest(const char *fn) {
|
|||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
llvm::InitializeNativeTarget();
|
llvm::InitializeNativeTarget();
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
LLVMLinkInJIT();
|
LLVMLinkInJIT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
4
main.cpp
4
main.cpp
@@ -41,7 +41,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <llvm/Support/PrettyStackTrace.h>
|
#include <llvm/Support/PrettyStackTrace.h>
|
||||||
#include <llvm/Support/Signals.h>
|
#include <llvm/Support/Signals.h>
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
#include <llvm/Support/TargetRegistry.h>
|
#include <llvm/Support/TargetRegistry.h>
|
||||||
#include <llvm/Support/TargetSelect.h>
|
#include <llvm/Support/TargetSelect.h>
|
||||||
#else
|
#else
|
||||||
@@ -172,7 +172,7 @@ int main(int Argc, char *Argv[]) {
|
|||||||
LLVMInitializeX86AsmPrinter();
|
LLVMInitializeX86AsmPrinter();
|
||||||
LLVMInitializeX86AsmParser();
|
LLVMInitializeX86AsmParser();
|
||||||
LLVMInitializeX86Disassembler();
|
LLVMInitializeX86Disassembler();
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
LLVMInitializeX86TargetMC();
|
LLVMInitializeX86TargetMC();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ Module::AddFunctionDefinition(Symbol *sym, const std::vector<Symbol *> &args,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
Module::writeOutput(OutputType outputType, const char *outFileName) {
|
Module::writeOutput(OutputType outputType, const char *outFileName) {
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
if (diBuilder != NULL && outputType != Header)
|
if (diBuilder != NULL && outputType != Header)
|
||||||
diBuilder->finalize();
|
diBuilder->finalize();
|
||||||
#endif // LLVM_3_0
|
#endif // LLVM_3_0
|
||||||
@@ -1099,7 +1099,7 @@ Module::execPreprocessor(const char* infilename, llvm::raw_string_ostream* ostre
|
|||||||
|
|
||||||
llvm::raw_fd_ostream stderrRaw(2, false);
|
llvm::raw_fd_ostream stderrRaw(2, false);
|
||||||
|
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
clang::TextDiagnosticPrinter *diagPrinter =
|
clang::TextDiagnosticPrinter *diagPrinter =
|
||||||
new clang::TextDiagnosticPrinter(stderrRaw, clang::DiagnosticOptions());
|
new clang::TextDiagnosticPrinter(stderrRaw, clang::DiagnosticOptions());
|
||||||
llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> diagIDs(new clang::DiagnosticIDs);
|
llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> diagIDs(new clang::DiagnosticIDs);
|
||||||
@@ -1450,7 +1450,7 @@ lCreateDispatchFunction(llvm::Module *module, llvm::Function *setISAFunc,
|
|||||||
for (; argIter != dispatchFunc->arg_end(); ++argIter)
|
for (; argIter != dispatchFunc->arg_end(); ++argIter)
|
||||||
args.push_back(argIter);
|
args.push_back(argIter);
|
||||||
if (voidReturn) {
|
if (voidReturn) {
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::CallInst::Create(targetFuncs[i], args, "", callBBlock);
|
llvm::CallInst::Create(targetFuncs[i], args, "", callBBlock);
|
||||||
#else
|
#else
|
||||||
llvm::CallInst::Create(targetFuncs[i], args.begin(), args.end(),
|
llvm::CallInst::Create(targetFuncs[i], args.begin(), args.end(),
|
||||||
@@ -1459,7 +1459,7 @@ lCreateDispatchFunction(llvm::Module *module, llvm::Function *setISAFunc,
|
|||||||
llvm::ReturnInst::Create(*g->ctx, callBBlock);
|
llvm::ReturnInst::Create(*g->ctx, callBBlock);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::Value *retValue =
|
llvm::Value *retValue =
|
||||||
llvm::CallInst::Create(targetFuncs[i], args, "ret_value",
|
llvm::CallInst::Create(targetFuncs[i], args, "ret_value",
|
||||||
callBBlock);
|
callBBlock);
|
||||||
|
|||||||
32
opt.cpp
32
opt.cpp
@@ -189,7 +189,7 @@ Optimize(llvm::Module *module, int optLevel) {
|
|||||||
optPM.add(targetLibraryInfo);
|
optPM.add(targetLibraryInfo);
|
||||||
optPM.add(new llvm::TargetData(module));
|
optPM.add(new llvm::TargetData(module));
|
||||||
|
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
optPM.add(llvm::createIndVarSimplifyPass());
|
optPM.add(llvm::createIndVarSimplifyPass());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ IntrinsicsOpt::IntrinsicsOpt()
|
|||||||
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_sse_movmsk_ps);
|
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_sse_movmsk_ps);
|
||||||
maskInstructions.push_back(sseMovmsk);
|
maskInstructions.push_back(sseMovmsk);
|
||||||
maskInstructions.push_back(m->module->getFunction("__movmsk"));
|
maskInstructions.push_back(m->module->getFunction("__movmsk"));
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::Function *avxMovmsk =
|
llvm::Function *avxMovmsk =
|
||||||
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_avx_movmsk_ps_256);
|
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_avx_movmsk_ps_256);
|
||||||
assert(avxMovmsk != NULL);
|
assert(avxMovmsk != NULL);
|
||||||
@@ -430,7 +430,7 @@ IntrinsicsOpt::IntrinsicsOpt()
|
|||||||
blendInstructions.push_back(BlendInstruction(
|
blendInstructions.push_back(BlendInstruction(
|
||||||
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_sse41_blendvps),
|
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_sse41_blendvps),
|
||||||
0xf, 0, 1, 2));
|
0xf, 0, 1, 2));
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
blendInstructions.push_back(BlendInstruction(
|
blendInstructions.push_back(BlendInstruction(
|
||||||
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_avx_blendv_ps_256),
|
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_avx_blendv_ps_256),
|
||||||
0xff, 0, 1, 2));
|
0xff, 0, 1, 2));
|
||||||
@@ -522,7 +522,7 @@ lIsUndef(llvm::Value *value) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::Function *avxMaskedLoad32 =
|
llvm::Function *avxMaskedLoad32 =
|
||||||
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_avx_maskload_ps_256);
|
llvm::Intrinsic::getDeclaration(m->module, llvm::Intrinsic::x86_avx_maskload_ps_256);
|
||||||
llvm::Function *avxMaskedLoad64 =
|
llvm::Function *avxMaskedLoad64 =
|
||||||
@@ -605,7 +605,7 @@ IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
else if (callInst->getCalledFunction() == avxMaskedLoad32 ||
|
else if (callInst->getCalledFunction() == avxMaskedLoad32 ||
|
||||||
callInst->getCalledFunction() == avxMaskedLoad64) {
|
callInst->getCalledFunction() == avxMaskedLoad64) {
|
||||||
llvm::Value *factor = callInst->getArgOperand(1);
|
llvm::Value *factor = callInst->getArgOperand(1);
|
||||||
@@ -827,7 +827,7 @@ lSizeOf(LLVM_TYPE_CONST llvm::Type *type, llvm::Instruction *insertBefore) {
|
|||||||
LLVM_TYPE_CONST llvm::Type *ptrType = llvm::PointerType::get(type, 0);
|
LLVM_TYPE_CONST llvm::Type *ptrType = llvm::PointerType::get(type, 0);
|
||||||
llvm::Value *nullPtr = llvm::Constant::getNullValue(ptrType);
|
llvm::Value *nullPtr = llvm::Constant::getNullValue(ptrType);
|
||||||
llvm::Value *index[1] = { LLVMInt32(1) };
|
llvm::Value *index[1] = { LLVMInt32(1) };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> arrayRef(&index[0], &index[1]);
|
llvm::ArrayRef<llvm::Value *> arrayRef(&index[0], &index[1]);
|
||||||
llvm::Value *poffset = llvm::GetElementPtrInst::Create(nullPtr, arrayRef,
|
llvm::Value *poffset = llvm::GetElementPtrInst::Create(nullPtr, arrayRef,
|
||||||
"offset_ptr", insertBefore);
|
"offset_ptr", insertBefore);
|
||||||
@@ -859,7 +859,7 @@ lStructOffset(LLVM_TYPE_CONST llvm::Type *type, uint64_t member,
|
|||||||
LLVM_TYPE_CONST llvm::Type *ptrType = llvm::PointerType::get(type, 0);
|
LLVM_TYPE_CONST llvm::Type *ptrType = llvm::PointerType::get(type, 0);
|
||||||
llvm::Value *nullPtr = llvm::Constant::getNullValue(ptrType);
|
llvm::Value *nullPtr = llvm::Constant::getNullValue(ptrType);
|
||||||
llvm::Value *index[2] = { LLVMInt32(0), LLVMInt32((int32_t)member) };
|
llvm::Value *index[2] = { LLVMInt32(0), LLVMInt32((int32_t)member) };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> arrayRef(&index[0], &index[2]);
|
llvm::ArrayRef<llvm::Value *> arrayRef(&index[0], &index[2]);
|
||||||
llvm::Value *poffset = llvm::GetElementPtrInst::Create(nullPtr, arrayRef,
|
llvm::Value *poffset = llvm::GetElementPtrInst::Create(nullPtr, arrayRef,
|
||||||
"member_ptr", insertBefore);
|
"member_ptr", insertBefore);
|
||||||
@@ -1274,7 +1274,7 @@ GatherScatterFlattenOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
// the instruction isn't inserted into a basic block and that
|
// the instruction isn't inserted into a basic block and that
|
||||||
// way we can then call ReplaceInstWithInst().
|
// way we can then call ReplaceInstWithInst().
|
||||||
llvm::Value *newArgs[3] = { basePtr, offsetVector, mask };
|
llvm::Value *newArgs[3] = { basePtr, offsetVector, mask };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> newArgArray(&newArgs[0], &newArgs[3]);
|
llvm::ArrayRef<llvm::Value *> newArgArray(&newArgs[0], &newArgs[3]);
|
||||||
llvm::Instruction *newCall =
|
llvm::Instruction *newCall =
|
||||||
llvm::CallInst::Create(info->baseOffsetsFunc, newArgArray,
|
llvm::CallInst::Create(info->baseOffsetsFunc, newArgArray,
|
||||||
@@ -1295,7 +1295,7 @@ GatherScatterFlattenOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
// base+offsets instruction. See above for why passing NULL
|
// base+offsets instruction. See above for why passing NULL
|
||||||
// for the Instruction * is intended.
|
// for the Instruction * is intended.
|
||||||
llvm::Value *newArgs[4] = { basePtr, offsetVector, rvalue, mask };
|
llvm::Value *newArgs[4] = { basePtr, offsetVector, rvalue, mask };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> newArgArray(&newArgs[0], &newArgs[4]);
|
llvm::ArrayRef<llvm::Value *> newArgArray(&newArgs[0], &newArgs[4]);
|
||||||
llvm::Instruction *newCall =
|
llvm::Instruction *newCall =
|
||||||
llvm::CallInst::Create(info->baseOffsetsFunc, newArgArray, "",
|
llvm::CallInst::Create(info->baseOffsetsFunc, newArgArray, "",
|
||||||
@@ -1550,7 +1550,7 @@ LowerMaskedStorePass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
// replace the __pseudo_* one with it.
|
// replace the __pseudo_* one with it.
|
||||||
llvm::Function *fms = doBlend ? info->blendFunc : info->maskedStoreFunc;
|
llvm::Function *fms = doBlend ? info->blendFunc : info->maskedStoreFunc;
|
||||||
llvm::Value *args[3] = { lvalue, rvalue, mask };
|
llvm::Value *args[3] = { lvalue, rvalue, mask };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[3]);
|
llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[3]);
|
||||||
llvm::Instruction *inst = llvm::CallInst::Create(fms, newArgArray, "",
|
llvm::Instruction *inst = llvm::CallInst::Create(fms, newArgArray, "",
|
||||||
callInst);
|
callInst);
|
||||||
@@ -1898,7 +1898,7 @@ lScalarizeVector(llvm::Value *vec, llvm::Value **scalarizedVector,
|
|||||||
// get them into the map<> before making recursive calls to
|
// get them into the map<> before making recursive calls to
|
||||||
// lScalarizeVector.
|
// lScalarizeVector.
|
||||||
for (int i = 0; i < vectorLength; ++i) {
|
for (int i = 0; i < vectorLength; ++i) {
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
scalarizedVector[i] =
|
scalarizedVector[i] =
|
||||||
llvm::PHINode::Create(eltType, numIncoming, "phi", phi);
|
llvm::PHINode::Create(eltType, numIncoming, "phi", phi);
|
||||||
#else
|
#else
|
||||||
@@ -2492,7 +2492,7 @@ GSImprovementsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
new llvm::BitCastInst(base, LLVMTypes::VoidPointerType,
|
new llvm::BitCastInst(base, LLVMTypes::VoidPointerType,
|
||||||
"base2i8", callInst);
|
"base2i8", callInst);
|
||||||
lCopyMetadata(basei8, callInst);
|
lCopyMetadata(basei8, callInst);
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[1]);
|
llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[1]);
|
||||||
llvm::Value *ptr =
|
llvm::Value *ptr =
|
||||||
llvm::GetElementPtrInst::Create(basei8, arrayRef, "ptr", callInst);
|
llvm::GetElementPtrInst::Create(basei8, arrayRef, "ptr", callInst);
|
||||||
@@ -2512,7 +2512,7 @@ GSImprovementsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
// be invalid in that case).
|
// be invalid in that case).
|
||||||
Debug(pos, "Transformed gather to scalar load and broadcast!");
|
Debug(pos, "Transformed gather to scalar load and broadcast!");
|
||||||
llvm::Value *args[2] = { ptr, mask };
|
llvm::Value *args[2] = { ptr, mask };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[2]);
|
llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[2]);
|
||||||
llvm::Instruction *newCall =
|
llvm::Instruction *newCall =
|
||||||
llvm::CallInst::Create(gatherInfo->loadBroadcastFunc, newArgArray,
|
llvm::CallInst::Create(gatherInfo->loadBroadcastFunc, newArgArray,
|
||||||
@@ -2563,7 +2563,7 @@ GSImprovementsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
llvm::Value *basei8 =
|
llvm::Value *basei8 =
|
||||||
new llvm::BitCastInst(base, LLVMTypes::VoidPointerType, "base2i8", callInst);
|
new llvm::BitCastInst(base, LLVMTypes::VoidPointerType, "base2i8", callInst);
|
||||||
lCopyMetadata(basei8, callInst);
|
lCopyMetadata(basei8, callInst);
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[1]);
|
llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[1]);
|
||||||
llvm::Value *ptr =
|
llvm::Value *ptr =
|
||||||
llvm::GetElementPtrInst::Create(basei8, arrayRef, "ptr", callInst);
|
llvm::GetElementPtrInst::Create(basei8, arrayRef, "ptr", callInst);
|
||||||
@@ -2577,7 +2577,7 @@ GSImprovementsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
if (gatherInfo != NULL) {
|
if (gatherInfo != NULL) {
|
||||||
Debug(pos, "Transformed gather to unaligned vector load!");
|
Debug(pos, "Transformed gather to unaligned vector load!");
|
||||||
llvm::Value *args[2] = { ptr, mask };
|
llvm::Value *args[2] = { ptr, mask };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> argArray(&args[0], &args[2]);
|
llvm::ArrayRef<llvm::Value *> argArray(&args[0], &args[2]);
|
||||||
llvm::Instruction *newCall =
|
llvm::Instruction *newCall =
|
||||||
llvm::CallInst::Create(gatherInfo->loadMaskedFunc, argArray,
|
llvm::CallInst::Create(gatherInfo->loadMaskedFunc, argArray,
|
||||||
@@ -2597,7 +2597,7 @@ GSImprovementsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
callInst);
|
callInst);
|
||||||
|
|
||||||
llvm::Value *args[3] = { ptr, rvalue, mask };
|
llvm::Value *args[3] = { ptr, rvalue, mask };
|
||||||
#if defined(LLVM_3_0) || defined(LLVM_3_0svn)
|
#if defined(LLVM_3_0) || defined(LLVM_3_0svn) || defined(LLVM_3_1svn)
|
||||||
llvm::ArrayRef<llvm::Value *> argArray(&args[0], &args[3]);
|
llvm::ArrayRef<llvm::Value *> argArray(&args[0], &args[3]);
|
||||||
llvm::Instruction *newCall =
|
llvm::Instruction *newCall =
|
||||||
llvm::CallInst::Create(scatterInfo->maskedStoreFunc, argArray,
|
llvm::CallInst::Create(scatterInfo->maskedStoreFunc, argArray,
|
||||||
|
|||||||
Reference in New Issue
Block a user