2012-04-11 10:25:24 +00:00
|
|
|
//===-- TargetMachine.cpp -------------------------------------------------===//
|
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2012-04-11 10:25:24 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the LLVM-C part of TargetMachine.h
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm-c/Core.h"
|
2017-06-06 11:49:48 +00:00
|
|
|
#include "llvm-c/TargetMachine.h"
|
2015-01-31 11:17:59 +00:00
|
|
|
#include "llvm/Analysis/TargetTransformInfo.h"
|
2013-01-02 11:36:10 +00:00
|
|
|
#include "llvm/IR/DataLayout.h"
|
2015-02-13 10:01:29 +00:00
|
|
|
#include "llvm/IR/LegacyPassManager.h"
|
2017-06-06 11:49:48 +00:00
|
|
|
#include "llvm/IR/Module.h"
|
2021-10-08 10:48:15 -07:00
|
|
|
#include "llvm/MC/TargetRegistry.h"
|
2023-10-31 16:55:00 +01:00
|
|
|
#include "llvm/Support/CBindingWrapping.h"
|
2014-04-29 23:26:49 +00:00
|
|
|
#include "llvm/Support/FileSystem.h"
|
2012-12-03 16:50:05 +00:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2018-03-23 23:58:21 +00:00
|
|
|
#include "llvm/Target/CodeGenCWrappers.h"
|
2012-12-03 16:50:05 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2023-02-10 09:59:46 +00:00
|
|
|
#include "llvm/TargetParser/Host.h"
|
2023-06-26 10:26:56 +02:00
|
|
|
#include "llvm/TargetParser/SubtargetFeature.h"
|
2012-04-11 10:25:24 +00:00
|
|
|
#include <cstring>
|
2022-12-03 11:06:12 -06:00
|
|
|
#include <optional>
|
2012-04-11 10:25:24 +00:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2023-10-31 16:55:00 +01:00
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
/// Options for LLVMCreateTargetMachine().
|
|
|
|
struct LLVMTargetMachineOptions {
|
|
|
|
std::string CPU;
|
|
|
|
std::string Features;
|
|
|
|
std::string ABI;
|
|
|
|
CodeGenOptLevel OL = CodeGenOptLevel::Default;
|
|
|
|
std::optional<Reloc::Model> RM;
|
|
|
|
std::optional<CodeModel::Model> CM;
|
|
|
|
bool JIT;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMTargetMachineOptions,
|
|
|
|
LLVMTargetMachineOptionsRef)
|
|
|
|
|
2015-07-27 18:27:23 +00:00
|
|
|
static TargetMachine *unwrap(LLVMTargetMachineRef P) {
|
2015-08-26 21:16:29 +00:00
|
|
|
return reinterpret_cast<TargetMachine *>(P);
|
2013-04-22 22:47:22 +00:00
|
|
|
}
|
2015-07-27 18:27:23 +00:00
|
|
|
static Target *unwrap(LLVMTargetRef P) {
|
2013-04-22 22:47:22 +00:00
|
|
|
return reinterpret_cast<Target*>(P);
|
|
|
|
}
|
2015-07-27 18:27:23 +00:00
|
|
|
static LLVMTargetMachineRef wrap(const TargetMachine *P) {
|
2015-08-26 21:16:29 +00:00
|
|
|
return reinterpret_cast<LLVMTargetMachineRef>(const_cast<TargetMachine *>(P));
|
2013-04-22 22:47:22 +00:00
|
|
|
}
|
2015-07-27 18:27:23 +00:00
|
|
|
static LLVMTargetRef wrap(const Target * P) {
|
2013-04-22 22:47:22 +00:00
|
|
|
return reinterpret_cast<LLVMTargetRef>(const_cast<Target*>(P));
|
|
|
|
}
|
2012-04-11 10:25:24 +00:00
|
|
|
|
|
|
|
LLVMTargetRef LLVMGetFirstTarget() {
|
2015-05-11 22:20:48 +00:00
|
|
|
if (TargetRegistry::targets().begin() == TargetRegistry::targets().end()) {
|
2014-04-25 05:30:21 +00:00
|
|
|
return nullptr;
|
2013-10-17 10:25:24 +00:00
|
|
|
}
|
|
|
|
|
2015-05-11 22:20:48 +00:00
|
|
|
const Target *target = &*TargetRegistry::targets().begin();
|
2013-10-17 10:25:24 +00:00
|
|
|
return wrap(target);
|
2012-04-11 10:25:24 +00:00
|
|
|
}
|
|
|
|
LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T) {
|
|
|
|
return wrap(unwrap(T)->getNext());
|
|
|
|
}
|
|
|
|
|
2013-11-15 02:51:01 +00:00
|
|
|
LLVMTargetRef LLVMGetTargetFromName(const char *Name) {
|
2013-11-15 02:51:18 +00:00
|
|
|
StringRef NameRef = Name;
|
2016-08-12 03:55:06 +00:00
|
|
|
auto I = find_if(TargetRegistry::targets(),
|
|
|
|
[&](const Target &T) { return T.getName() == NameRef; });
|
2015-05-11 22:20:48 +00:00
|
|
|
return I != TargetRegistry::targets().end() ? wrap(&*I) : nullptr;
|
2013-11-06 10:25:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LLVMBool LLVMGetTargetFromTriple(const char* TripleStr, LLVMTargetRef *T,
|
|
|
|
char **ErrorMessage) {
|
|
|
|
std::string Error;
|
2015-08-26 21:16:29 +00:00
|
|
|
|
2013-11-06 10:25:18 +00:00
|
|
|
*T = wrap(TargetRegistry::lookupTarget(TripleStr, Error));
|
2015-08-26 21:16:29 +00:00
|
|
|
|
2013-11-06 10:25:18 +00:00
|
|
|
if (!*T) {
|
|
|
|
if (ErrorMessage)
|
|
|
|
*ErrorMessage = strdup(Error.c_str());
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2015-08-26 21:16:29 +00:00
|
|
|
|
2013-11-06 10:25:18 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-04-11 10:25:24 +00:00
|
|
|
const char * LLVMGetTargetName(LLVMTargetRef T) {
|
2016-10-01 07:08:23 +00:00
|
|
|
return unwrap(T)->getName();
|
2012-04-11 10:25:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char * LLVMGetTargetDescription(LLVMTargetRef T) {
|
2016-10-01 07:08:23 +00:00
|
|
|
return unwrap(T)->getShortDescription();
|
2012-04-11 10:25:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LLVMBool LLVMTargetHasJIT(LLVMTargetRef T) {
|
|
|
|
return unwrap(T)->hasJIT();
|
|
|
|
}
|
|
|
|
|
|
|
|
LLVMBool LLVMTargetHasTargetMachine(LLVMTargetRef T) {
|
|
|
|
return unwrap(T)->hasTargetMachine();
|
|
|
|
}
|
|
|
|
|
|
|
|
LLVMBool LLVMTargetHasAsmBackend(LLVMTargetRef T) {
|
|
|
|
return unwrap(T)->hasMCAsmBackend();
|
|
|
|
}
|
|
|
|
|
2023-10-31 16:55:00 +01:00
|
|
|
LLVMTargetMachineOptionsRef LLVMCreateTargetMachineOptions(void) {
|
|
|
|
return wrap(new LLVMTargetMachineOptions());
|
|
|
|
}
|
2012-04-11 10:25:24 +00:00
|
|
|
|
2023-10-31 16:55:00 +01:00
|
|
|
void LLVMDisposeTargetMachineOptions(LLVMTargetMachineOptionsRef Options) {
|
|
|
|
delete unwrap(Options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMTargetMachineOptionsSetCPU(LLVMTargetMachineOptionsRef Options,
|
|
|
|
const char *CPU) {
|
|
|
|
unwrap(Options)->CPU = CPU;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMTargetMachineOptionsSetFeatures(LLVMTargetMachineOptionsRef Options,
|
|
|
|
const char *Features) {
|
|
|
|
unwrap(Options)->Features = Features;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMTargetMachineOptionsSetABI(LLVMTargetMachineOptionsRef Options,
|
|
|
|
const char *ABI) {
|
|
|
|
unwrap(Options)->ABI = ABI;
|
|
|
|
}
|
2012-04-11 10:25:24 +00:00
|
|
|
|
2023-10-31 16:55:00 +01:00
|
|
|
void LLVMTargetMachineOptionsSetCodeGenOptLevel(
|
|
|
|
LLVMTargetMachineOptionsRef Options, LLVMCodeGenOptLevel Level) {
|
2023-09-14 14:10:14 -07:00
|
|
|
CodeGenOptLevel OL;
|
2023-10-31 16:55:00 +01:00
|
|
|
|
2012-04-11 10:25:24 +00:00
|
|
|
switch (Level) {
|
2023-10-31 16:55:00 +01:00
|
|
|
case LLVMCodeGenLevelNone:
|
|
|
|
OL = CodeGenOptLevel::None;
|
|
|
|
break;
|
|
|
|
case LLVMCodeGenLevelLess:
|
|
|
|
OL = CodeGenOptLevel::Less;
|
|
|
|
break;
|
|
|
|
case LLVMCodeGenLevelAggressive:
|
|
|
|
OL = CodeGenOptLevel::Aggressive;
|
|
|
|
break;
|
|
|
|
case LLVMCodeGenLevelDefault:
|
|
|
|
OL = CodeGenOptLevel::Default;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
unwrap(Options)->OL = OL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMTargetMachineOptionsSetRelocMode(LLVMTargetMachineOptionsRef Options,
|
|
|
|
LLVMRelocMode Reloc) {
|
|
|
|
std::optional<Reloc::Model> RM;
|
|
|
|
|
|
|
|
switch (Reloc) {
|
|
|
|
case LLVMRelocStatic:
|
|
|
|
RM = Reloc::Static;
|
|
|
|
break;
|
|
|
|
case LLVMRelocPIC:
|
|
|
|
RM = Reloc::PIC_;
|
|
|
|
break;
|
|
|
|
case LLVMRelocDynamicNoPic:
|
|
|
|
RM = Reloc::DynamicNoPIC;
|
|
|
|
break;
|
|
|
|
case LLVMRelocROPI:
|
|
|
|
RM = Reloc::ROPI;
|
|
|
|
break;
|
|
|
|
case LLVMRelocRWPI:
|
|
|
|
RM = Reloc::RWPI;
|
|
|
|
break;
|
|
|
|
case LLVMRelocROPI_RWPI:
|
|
|
|
RM = Reloc::ROPI_RWPI;
|
|
|
|
break;
|
|
|
|
case LLVMRelocDefault:
|
|
|
|
break;
|
2012-04-11 10:25:24 +00:00
|
|
|
}
|
|
|
|
|
2023-10-31 16:55:00 +01:00
|
|
|
unwrap(Options)->RM = RM;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMTargetMachineOptionsSetCodeModel(LLVMTargetMachineOptionsRef Options,
|
|
|
|
LLVMCodeModel CodeModel) {
|
|
|
|
auto CM = unwrap(CodeModel, unwrap(Options)->JIT);
|
|
|
|
unwrap(Options)->CM = CM;
|
|
|
|
}
|
|
|
|
|
|
|
|
LLVMTargetMachineRef
|
|
|
|
LLVMCreateTargetMachineWithOptions(LLVMTargetRef T, const char *Triple,
|
|
|
|
LLVMTargetMachineOptionsRef Options) {
|
|
|
|
auto *Opt = unwrap(Options);
|
|
|
|
TargetOptions TO;
|
|
|
|
TO.MCOptions.ABIName = Opt->ABI;
|
|
|
|
return wrap(unwrap(T)->createTargetMachine(Triple, Opt->CPU, Opt->Features,
|
|
|
|
TO, Opt->RM, Opt->CM, Opt->OL,
|
|
|
|
Opt->JIT));
|
|
|
|
}
|
|
|
|
|
|
|
|
LLVMTargetMachineRef
|
|
|
|
LLVMCreateTargetMachine(LLVMTargetRef T, const char *Triple, const char *CPU,
|
|
|
|
const char *Features, LLVMCodeGenOptLevel Level,
|
|
|
|
LLVMRelocMode Reloc, LLVMCodeModel CodeModel) {
|
|
|
|
auto *Options = LLVMCreateTargetMachineOptions();
|
|
|
|
|
|
|
|
LLVMTargetMachineOptionsSetCPU(Options, CPU);
|
|
|
|
LLVMTargetMachineOptionsSetFeatures(Options, Features);
|
|
|
|
LLVMTargetMachineOptionsSetCodeGenOptLevel(Options, Level);
|
|
|
|
LLVMTargetMachineOptionsSetRelocMode(Options, Reloc);
|
|
|
|
LLVMTargetMachineOptionsSetCodeModel(Options, CodeModel);
|
|
|
|
|
|
|
|
auto *Machine = LLVMCreateTargetMachineWithOptions(T, Triple, Options);
|
|
|
|
|
|
|
|
LLVMDisposeTargetMachineOptions(Options);
|
|
|
|
return Machine;
|
2012-04-11 10:25:24 +00:00
|
|
|
}
|
|
|
|
|
2015-08-26 21:16:29 +00:00
|
|
|
void LLVMDisposeTargetMachine(LLVMTargetMachineRef T) { delete unwrap(T); }
|
2012-04-11 10:25:24 +00:00
|
|
|
|
|
|
|
LLVMTargetRef LLVMGetTargetMachineTarget(LLVMTargetMachineRef T) {
|
|
|
|
const Target* target = &(unwrap(T)->getTarget());
|
|
|
|
return wrap(target);
|
|
|
|
}
|
|
|
|
|
|
|
|
char* LLVMGetTargetMachineTriple(LLVMTargetMachineRef T) {
|
2015-06-16 13:15:50 +00:00
|
|
|
std::string StringRep = unwrap(T)->getTargetTriple().str();
|
2012-04-11 10:25:24 +00:00
|
|
|
return strdup(StringRep.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
char* LLVMGetTargetMachineCPU(LLVMTargetMachineRef T) {
|
2020-01-28 20:23:46 +01:00
|
|
|
std::string StringRep = std::string(unwrap(T)->getTargetCPU());
|
2012-04-11 10:25:24 +00:00
|
|
|
return strdup(StringRep.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
char* LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T) {
|
2020-01-28 20:23:46 +01:00
|
|
|
std::string StringRep = std::string(unwrap(T)->getTargetFeatureString());
|
2012-04-11 10:25:24 +00:00
|
|
|
return strdup(StringRep.c_str());
|
|
|
|
}
|
|
|
|
|
2013-11-06 10:25:18 +00:00
|
|
|
void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,
|
|
|
|
LLVMBool VerboseAsm) {
|
2015-02-12 21:16:34 +00:00
|
|
|
unwrap(T)->Options.MCOptions.AsmVerbose = VerboseAsm;
|
2013-11-06 10:25:18 +00:00
|
|
|
}
|
|
|
|
|
2023-11-01 11:44:19 +08:00
|
|
|
void LLVMSetTargetMachineFastISel(LLVMTargetMachineRef T, LLVMBool Enable) {
|
|
|
|
unwrap(T)->setFastISel(Enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMSetTargetMachineGlobalISel(LLVMTargetMachineRef T, LLVMBool Enable) {
|
|
|
|
unwrap(T)->setGlobalISel(Enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMSetTargetMachineGlobalISelAbort(LLVMTargetMachineRef T,
|
|
|
|
LLVMGlobalISelAbortMode Mode) {
|
2023-10-31 21:10:03 -07:00
|
|
|
GlobalISelAbortMode AM = GlobalISelAbortMode::Enable;
|
2023-11-01 11:44:19 +08:00
|
|
|
switch (Mode) {
|
|
|
|
case LLVMGlobalISelAbortDisable:
|
|
|
|
AM = GlobalISelAbortMode::Disable;
|
|
|
|
break;
|
|
|
|
case LLVMGlobalISelAbortEnable:
|
|
|
|
AM = GlobalISelAbortMode::Enable;
|
|
|
|
break;
|
|
|
|
case LLVMGlobalISelAbortDisableWithDiag:
|
|
|
|
AM = GlobalISelAbortMode::DisableWithDiag;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
unwrap(T)->setGlobalISelAbort(AM);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMSetTargetMachineMachineOutliner(LLVMTargetMachineRef T,
|
|
|
|
LLVMBool Enable) {
|
|
|
|
unwrap(T)->setMachineOutliner(Enable);
|
|
|
|
}
|
|
|
|
|
2016-02-16 05:11:24 +00:00
|
|
|
LLVMTargetDataRef LLVMCreateTargetDataLayout(LLVMTargetMachineRef T) {
|
|
|
|
return wrap(new DataLayout(unwrap(T)->createDataLayout()));
|
|
|
|
}
|
|
|
|
|
2013-04-16 23:12:56 +00:00
|
|
|
static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
|
2015-04-14 22:14:34 +00:00
|
|
|
raw_pwrite_stream &OS,
|
2015-04-09 17:16:25 +00:00
|
|
|
LLVMCodeGenFileType codegen,
|
|
|
|
char **ErrorMessage) {
|
2012-04-11 10:25:24 +00:00
|
|
|
TargetMachine* TM = unwrap(T);
|
|
|
|
Module* Mod = unwrap(M);
|
|
|
|
|
2015-02-13 10:01:29 +00:00
|
|
|
legacy::PassManager pass;
|
2012-04-11 10:25:24 +00:00
|
|
|
|
|
|
|
std::string error;
|
|
|
|
|
2015-07-24 16:04:22 +00:00
|
|
|
Mod->setDataLayout(TM->createDataLayout());
|
2012-04-11 10:25:24 +00:00
|
|
|
|
2019-11-13 15:17:46 -08:00
|
|
|
CodeGenFileType ft;
|
2012-04-11 10:25:24 +00:00
|
|
|
switch (codegen) {
|
|
|
|
case LLVMAssemblyFile:
|
2023-09-14 14:10:14 -07:00
|
|
|
ft = CodeGenFileType::AssemblyFile;
|
2012-04-11 10:25:24 +00:00
|
|
|
break;
|
|
|
|
default:
|
2023-09-14 14:10:14 -07:00
|
|
|
ft = CodeGenFileType::ObjectFile;
|
2012-04-11 10:25:24 +00:00
|
|
|
break;
|
|
|
|
}
|
2018-05-21 20:16:41 +00:00
|
|
|
if (TM->addPassesToEmitFile(pass, OS, nullptr, ft)) {
|
2013-03-10 22:01:44 +00:00
|
|
|
error = "TargetMachine can't emit a file of this type";
|
2012-04-11 10:25:24 +00:00
|
|
|
*ErrorMessage = strdup(error.c_str());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
pass.run(*Mod);
|
|
|
|
|
2013-04-16 23:12:56 +00:00
|
|
|
OS.flush();
|
2012-04-11 10:25:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
2013-04-16 23:12:56 +00:00
|
|
|
|
|
|
|
LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M,
|
2022-05-07 14:26:21 +00:00
|
|
|
const char *Filename,
|
|
|
|
LLVMCodeGenFileType codegen,
|
|
|
|
char **ErrorMessage) {
|
2014-08-25 18:16:47 +00:00
|
|
|
std::error_code EC;
|
2019-08-05 05:43:48 +00:00
|
|
|
raw_fd_ostream dest(Filename, EC, sys::fs::OF_None);
|
2014-08-25 18:16:47 +00:00
|
|
|
if (EC) {
|
|
|
|
*ErrorMessage = strdup(EC.message().c_str());
|
2013-04-16 23:12:56 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-04-09 21:06:08 +00:00
|
|
|
bool Result = LLVMTargetMachineEmit(T, M, dest, codegen, ErrorMessage);
|
2013-04-16 23:12:56 +00:00
|
|
|
dest.flush();
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
LLVMBool LLVMTargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T,
|
|
|
|
LLVMModuleRef M, LLVMCodeGenFileType codegen, char** ErrorMessage,
|
|
|
|
LLVMMemoryBufferRef *OutMemBuf) {
|
2015-04-09 17:16:25 +00:00
|
|
|
SmallString<0> CodeString;
|
|
|
|
raw_svector_ostream OStream(CodeString);
|
2015-04-09 21:06:08 +00:00
|
|
|
bool Result = LLVMTargetMachineEmit(T, M, OStream, codegen, ErrorMessage);
|
2013-04-16 23:12:56 +00:00
|
|
|
|
2015-04-09 17:16:25 +00:00
|
|
|
StringRef Data = OStream.str();
|
|
|
|
*OutMemBuf =
|
|
|
|
LLVMCreateMemoryBufferWithMemoryRangeCopy(Data.data(), Data.size(), "");
|
2013-04-16 23:12:56 +00:00
|
|
|
return Result;
|
|
|
|
}
|
2013-11-06 10:25:18 +00:00
|
|
|
|
|
|
|
char *LLVMGetDefaultTargetTriple(void) {
|
|
|
|
return strdup(sys::getDefaultTargetTriple().c_str());
|
|
|
|
}
|
2014-01-23 19:23:28 +00:00
|
|
|
|
2018-07-17 10:57:39 +00:00
|
|
|
char *LLVMNormalizeTargetTriple(const char* triple) {
|
|
|
|
return strdup(Triple::normalize(StringRef(triple)).c_str());
|
|
|
|
}
|
|
|
|
|
2018-04-11 22:40:42 +00:00
|
|
|
char *LLVMGetHostCPUName(void) {
|
|
|
|
return strdup(sys::getHostCPUName().data());
|
|
|
|
}
|
|
|
|
|
|
|
|
char *LLVMGetHostCPUFeatures(void) {
|
|
|
|
SubtargetFeatures Features;
|
2024-07-11 10:32:43 +01:00
|
|
|
for (const auto &[Feature, IsEnabled] : sys::getHostCPUFeatures())
|
|
|
|
Features.AddFeature(Feature, IsEnabled);
|
2018-04-11 22:40:42 +00:00
|
|
|
|
|
|
|
return strdup(Features.getString().c_str());
|
|
|
|
}
|
|
|
|
|
2014-01-23 19:23:28 +00:00
|
|
|
void LLVMAddAnalysisPasses(LLVMTargetMachineRef T, LLVMPassManagerRef PM) {
|
2015-02-01 12:26:09 +00:00
|
|
|
unwrap(PM)->add(
|
|
|
|
createTargetTransformInfoWrapperPass(unwrap(T)->getTargetIRAnalysis()));
|
2014-01-23 19:23:28 +00:00
|
|
|
}
|