Commit ba9de975 by Nicolas Capens Committed by Nicolas Capens

Support LLVM 9+ build changes

Bug: b/139412871 Change-Id: Ia9e49317fa9ce89dcacaa1e5a788518062e4e633 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40730Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent 82784462
......@@ -52,7 +52,7 @@ __pragma(warning(push))
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Intrinsics.h"
#if LLVM_VERSION_MAJOR >= 8
#if LLVM_VERSION_MAJOR >= 9
# include "llvm/IR/IntrinsicsX86.h"
#endif
#include "llvm/IR/LLVMContext.h"
......@@ -178,7 +178,7 @@ public:
static JITGlobals *get();
const std::string mcpu;
const std::vector<std::string> mattrs;
const std::vector<llvm::StringRef> mattrs;
const char *const march;
const llvm::TargetOptions targetOptions;
const llvm::DataLayout dataLayout;
......@@ -189,7 +189,7 @@ private:
static JITGlobals create();
static llvm::CodeGenOpt::Level toLLVM(rr::Optimization::Level level);
JITGlobals(const char *mcpu,
const std::vector<std::string> &mattrs,
const std::vector<llvm::StringRef> &mattrs,
const char *march,
const llvm::TargetOptions &targetOptions,
const llvm::DataLayout &dataLayout);
......@@ -248,7 +248,8 @@ JITGlobals JITGlobals::create()
(void)ok; // getHostCPUFeatures always returns false on other platforms
#endif
std::vector<std::string> mattrs;
std::vector<llvm::StringRef> mattrs;
for(auto &feature : features)
{
if(feature.second) { mattrs.push_back(feature.first()); }
......@@ -306,7 +307,7 @@ llvm::CodeGenOpt::Level JITGlobals::toLLVM(rr::Optimization::Level level)
}
JITGlobals::JITGlobals(const char *mcpu,
const std::vector<std::string> &mattrs,
const std::vector<llvm::StringRef> &mattrs,
const char *march,
const llvm::TargetOptions &targetOptions,
const llvm::DataLayout &dataLayout)
......@@ -350,7 +351,7 @@ public:
// Round down base address to align with a page boundary. This matches
// DefaultMMapper behavior.
void *addr = block.base();
#if LLVM_VERSION_MAJOR >= 8
#if LLVM_VERSION_MAJOR >= 9
size_t size = block.allocatedSize();
#else
size_t size = block.size();
......@@ -367,7 +368,7 @@ public:
std::error_code releaseMappedMemory(llvm::sys::MemoryBlock &block)
{
#if LLVM_VERSION_MAJOR >= 8
#if LLVM_VERSION_MAJOR >= 9
size_t size = block.allocatedSize();
#else
size_t size = block.size();
......@@ -418,8 +419,8 @@ public:
const rr::Config &config)
: resolver(createLegacyLookupResolver(
session,
[&](const std::string &name) {
void *func = rr::resolveExternalSymbol(name.c_str());
[&](const llvm::StringRef &name) {
void *func = rr::resolveExternalSymbol(name.str().c_str());
if(func != nullptr)
{
return llvm::JITSymbol(
......@@ -5078,7 +5079,7 @@ std::shared_ptr<Routine> Nucleus::acquireCoroutine(const char *name, const Confi
// Run manadory coroutine transforms.
llvm::legacy::PassManager pm;
#if LLVM_VERSION_MAJOR >= 8
#if LLVM_VERSION_MAJOR >= 9
pm.add(llvm::createCoroEarlyLegacyPass());
pm.add(llvm::createCoroSplitLegacyPass());
pm.add(llvm::createCoroElideLegacyPass());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment