fix compilation for llvm 3.5
This commit is contained in:
4
ispc.cpp
4
ispc.cpp
@@ -698,6 +698,10 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
|
|||||||
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-"
|
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-"
|
||||||
"f80:128:128-n8:16:32:64-S128-v16:16:16-v32:32:32-v4:128:128";
|
"f80:128:128-n8:16:32:64-S128-v16:16:16-v32:32:32-v4:128:128";
|
||||||
}
|
}
|
||||||
|
else if (m_isa == Target::NVPTX)
|
||||||
|
{
|
||||||
|
dl_string = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64";
|
||||||
|
}
|
||||||
|
|
||||||
// 3. Finally set member data
|
// 3. Finally set member data
|
||||||
m_dataLayout = new llvm::DataLayout(dl_string);
|
m_dataLayout = new llvm::DataLayout(dl_string);
|
||||||
|
|||||||
19
module.cpp
19
module.cpp
@@ -85,7 +85,11 @@
|
|||||||
#include <llvm/IR/Intrinsics.h>
|
#include <llvm/IR/Intrinsics.h>
|
||||||
#include <llvm/IR/DerivedTypes.h>
|
#include <llvm/IR/DerivedTypes.h>
|
||||||
#ifdef ISPC_NVPTX_ENABLED
|
#ifdef ISPC_NVPTX_ENABLED
|
||||||
#include "llvm/Assembly/AssemblyAnnotationWriter.h"
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
|
#include <llvm/IR/AssemblyAnnotationWriter.h>
|
||||||
|
#else
|
||||||
|
#include <llvm/Assembly/AssemblyAnnotationWriter.h>
|
||||||
|
#endif
|
||||||
#endif /* ISPC_NVPTX_ENABLED */
|
#endif /* ISPC_NVPTX_ENABLED */
|
||||||
#endif
|
#endif
|
||||||
#include <llvm/PassManager.h>
|
#include <llvm/PassManager.h>
|
||||||
@@ -1165,6 +1169,15 @@ lFixAttributes(const vecString_t &src, vecString_t &dst)
|
|||||||
for (vecString_t::const_iterator it = src.begin(); it != src.end(); it++)
|
for (vecString_t::const_iterator it = src.begin(); it != src.end(); it++)
|
||||||
{
|
{
|
||||||
vecString_t words = lSplitString(*it);
|
vecString_t words = lSplitString(*it);
|
||||||
|
if (words.size() > 1 && (words[0] == "target" && words[1] == "datalayout"))
|
||||||
|
{
|
||||||
|
std::string s = "target datalayout = ";
|
||||||
|
s += '"';
|
||||||
|
s += "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64";
|
||||||
|
s += '"';
|
||||||
|
dst.push_back(s);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!words.empty() && words[0] == "attributes")
|
if (!words.empty() && words[0] == "attributes")
|
||||||
continue;
|
continue;
|
||||||
std::string s;
|
std::string s;
|
||||||
@@ -1231,7 +1244,11 @@ Module::writeBitcode(llvm::Module *module, const char *outFileName) {
|
|||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
llvm::raw_string_ostream out(s);
|
llvm::raw_string_ostream out(s);
|
||||||
|
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||||
|
std::unique_ptr<llvm::AssemblyAnnotationWriter> Annotator;
|
||||||
|
#else
|
||||||
llvm::OwningPtr<llvm::AssemblyAnnotationWriter> Annotator;
|
llvm::OwningPtr<llvm::AssemblyAnnotationWriter> Annotator;
|
||||||
|
#endif
|
||||||
module->print(out, Annotator.get());
|
module->print(out, Annotator.get());
|
||||||
std::istringstream iss(s);
|
std::istringstream iss(s);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user