wiped out all LLVM 3.1 support
This commit is contained in:
140
cbackend.cpp
140
cbackend.cpp
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "llvmutil.h"
|
||||
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/CallingConv.h"
|
||||
@@ -50,20 +50,18 @@
|
||||
#endif
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#if !defined(LLVM_3_1)
|
||||
#if defined(LLVM_3_2)
|
||||
#include "llvm/TypeFinder.h"
|
||||
#else // LLVM_3_3 +
|
||||
#include "llvm/IR/TypeFinder.h"
|
||||
#endif
|
||||
#endif // LLVM_3_2 +
|
||||
#if defined(LLVM_3_2)
|
||||
#include "llvm/TypeFinder.h"
|
||||
#else // LLVM_3_3 +
|
||||
#include "llvm/IR/TypeFinder.h"
|
||||
#endif
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Analysis/ConstantsScanner.h"
|
||||
#include "llvm/Analysis/FindUsedTypes.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#if defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||
#include "llvm/IR/Verifier.h"
|
||||
#include <llvm/IR/IRPrintingPasses.h>
|
||||
#include "llvm/IR/CallSite.h"
|
||||
@@ -96,7 +94,7 @@
|
||||
#endif
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
#include "llvm/Support/InstVisitor.h"
|
||||
#elif defined (LLVM_3_3) || defined (LLVM_3_4)
|
||||
#include "llvm/InstVisitor.h"
|
||||
@@ -250,7 +248,8 @@ namespace {
|
||||
class CBEMCAsmInfo : public llvm::MCAsmInfo {
|
||||
public:
|
||||
CBEMCAsmInfo() {
|
||||
#if !defined(LLVM_3_5) && !defined(LLVM_3_6)
|
||||
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3) || defined(LLVM_3_4)
|
||||
GlobalPrefix = "";
|
||||
#endif
|
||||
PrivateGlobalPrefix = "";
|
||||
@@ -269,14 +268,11 @@ namespace {
|
||||
const llvm::MCRegisterInfo *MRI;
|
||||
const llvm::MCObjectFileInfo *MOFI;
|
||||
llvm::MCContext *TCtx;
|
||||
#if defined(LLVM_3_1)
|
||||
const llvm::TargetData* TD;
|
||||
#else
|
||||
|
||||
// FIXME: it's ugly to have the name be "TD" here, but it saves us
|
||||
// lots of ifdefs in the below since the new DataLayout and the old
|
||||
// TargetData have generally similar interfaces...
|
||||
const llvm::DataLayout* TD;
|
||||
#endif
|
||||
|
||||
std::map<const llvm::ConstantFP *, unsigned> FPConstantMap;
|
||||
std::map<const llvm::ConstantDataVector *, unsigned> VectorConstantMap;
|
||||
@@ -363,7 +359,7 @@ namespace {
|
||||
bool isSigned = false,
|
||||
const std::string &VariableName = "",
|
||||
bool IgnoreName = false,
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
const llvm::AttrListPtr &PAL = llvm::AttrListPtr()
|
||||
#else
|
||||
const llvm::AttributeSet &PAL = llvm::AttributeSet()
|
||||
@@ -374,7 +370,7 @@ namespace {
|
||||
const std::string &NameSoFar = "");
|
||||
|
||||
void printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
const llvm::AttrListPtr &PAL,
|
||||
#else
|
||||
const llvm::AttributeSet &PAL,
|
||||
@@ -465,7 +461,8 @@ namespace {
|
||||
|
||||
// Must not be used in inline asm, extractelement, or shufflevector.
|
||||
if (I.hasOneUse()) {
|
||||
#if defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.user_back());
|
||||
#else
|
||||
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.use_back());
|
||||
@@ -477,7 +474,7 @@ namespace {
|
||||
}
|
||||
|
||||
// Only inline instruction it if it's use is in the same BB as the inst.
|
||||
#if defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||
return I.getParent() == llvm::cast<llvm::Instruction>(I.user_back())->getParent();
|
||||
#else
|
||||
return I.getParent() == llvm::cast<llvm::Instruction>(I.use_back())->getParent();
|
||||
@@ -613,7 +610,7 @@ std::string CWriter::getArrayName(llvm::ArrayType *AT) {
|
||||
/// return type, except, instead of printing the type as void (*)(Struct*, ...)
|
||||
/// print it as "Struct (*)(...)", for struct return functions.
|
||||
void CWriter::printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
const llvm::AttrListPtr &PAL,
|
||||
#else
|
||||
const llvm::AttributeSet &PAL,
|
||||
@@ -632,9 +629,7 @@ void CWriter::printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
||||
if (PrintedType)
|
||||
FunctionInnards << ", ";
|
||||
llvm::Type *ArgTy = *I;
|
||||
#if defined(LLVM_3_1)
|
||||
if (PAL.paramHasAttr(Idx, llvm::Attribute::ByVal)) {
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
||||
#else
|
||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
||||
@@ -643,9 +638,7 @@ void CWriter::printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
||||
ArgTy = llvm::cast<llvm::PointerType>(ArgTy)->getElementType();
|
||||
}
|
||||
printType(FunctionInnards, ArgTy,
|
||||
#if defined(LLVM_3_1)
|
||||
/*isSigned=*/PAL.paramHasAttr(Idx, llvm::Attribute::SExt),
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt),
|
||||
#else
|
||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt),
|
||||
@@ -662,9 +655,7 @@ void CWriter::printStructReturnPointerFunctionType(llvm::raw_ostream &Out,
|
||||
}
|
||||
FunctionInnards << ')';
|
||||
printType(Out, RetTy,
|
||||
#if defined(LLVM_3_1)
|
||||
/*isSigned=*/PAL.paramHasAttr(0, llvm::Attribute::SExt),
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
PAL.getParamAttributes(0).hasAttribute(llvm::Attributes::SExt),
|
||||
#else
|
||||
PAL.getParamAttributes(0).hasAttribute(llvm::AttributeSet::ReturnIndex, llvm::Attribute::SExt),
|
||||
@@ -764,7 +755,7 @@ CWriter::printSimpleType(llvm::raw_ostream &Out, llvm::Type *Ty, bool isSigned,
|
||||
llvm::raw_ostream &CWriter::printType(llvm::raw_ostream &Out, llvm::Type *Ty,
|
||||
bool isSigned, const std::string &NameSoFar,
|
||||
bool IgnoreName,
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
const llvm::AttrListPtr &PAL
|
||||
#else
|
||||
const llvm::AttributeSet &PAL
|
||||
@@ -786,9 +777,7 @@ llvm::raw_ostream &CWriter::printType(llvm::raw_ostream &Out, llvm::Type *Ty,
|
||||
for (llvm::FunctionType::param_iterator I = FTy->param_begin(),
|
||||
E = FTy->param_end(); I != E; ++I) {
|
||||
llvm::Type *ArgTy = *I;
|
||||
#if defined(LLVM_3_1)
|
||||
if (PAL.paramHasAttr(Idx, llvm::Attribute::ByVal)) {
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
||||
#else
|
||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
||||
@@ -799,9 +788,7 @@ llvm::raw_ostream &CWriter::printType(llvm::raw_ostream &Out, llvm::Type *Ty,
|
||||
if (I != FTy->param_begin())
|
||||
FunctionInnards << ", ";
|
||||
printType(FunctionInnards, ArgTy,
|
||||
#if defined(LLVM_3_1)
|
||||
/*isSigned=*/PAL.paramHasAttr(Idx, llvm::Attribute::SExt),
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt),
|
||||
#else
|
||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt),
|
||||
@@ -818,9 +805,7 @@ llvm::raw_ostream &CWriter::printType(llvm::raw_ostream &Out, llvm::Type *Ty,
|
||||
}
|
||||
FunctionInnards << ')';
|
||||
printType(Out, FTy->getReturnType(),
|
||||
#if defined(LLVM_3_1)
|
||||
/*isSigned=*/PAL.paramHasAttr(0, llvm::Attribute::SExt),
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
PAL.getParamAttributes(0).hasAttribute(llvm::Attributes::SExt),
|
||||
#else
|
||||
PAL.getParamAttributes(0).hasAttribute(llvm::AttributeSet::ReturnIndex, llvm::Attribute::SExt),
|
||||
@@ -1770,7 +1755,7 @@ std::string CWriter::GetValueName(const llvm::Value *Operand) {
|
||||
|
||||
// Resolve potential alias.
|
||||
if (const llvm::GlobalAlias *GA = llvm::dyn_cast<llvm::GlobalAlias>(Operand)) {
|
||||
#if defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||
if (const llvm::Value *V = GA->getAliasee())
|
||||
#else
|
||||
if (const llvm::Value *V = GA->resolveAliasedGlobal(false))
|
||||
@@ -2003,11 +1988,7 @@ void CWriter::writeOperandWithCast(llvm::Value* Operand, const llvm::ICmpInst &C
|
||||
// directives to cater to specific compilers as need be.
|
||||
//
|
||||
static void generateCompilerSpecificCode(llvm::formatted_raw_ostream& Out,
|
||||
#if defined(LLVM_3_1)
|
||||
const llvm::TargetData *TD) {
|
||||
#else
|
||||
const llvm::DataLayout *TD) {
|
||||
#endif
|
||||
// We output GCC specific attributes to preserve 'linkonce'ness on globals.
|
||||
// If we aren't being compiled with GCC, just drop these attributes.
|
||||
Out << "#ifndef __GNUC__ /* Can only support \"linkonce\" vars with GCC */\n"
|
||||
@@ -2163,7 +2144,7 @@ static SpecialGlobalClass getGlobalVariableClass(const llvm::GlobalVariable *GV)
|
||||
|
||||
// Otherwise, if it is other metadata, don't print it. This catches things
|
||||
// like debug information.
|
||||
#if defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||
// Here we compare char *
|
||||
if (!strcmp(GV->getSection(), "llvm.metadata"))
|
||||
#else
|
||||
@@ -2206,11 +2187,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
||||
// Initialize
|
||||
TheModule = &M;
|
||||
|
||||
#if defined(LLVM_3_1)
|
||||
TD = new llvm::TargetData(&M);
|
||||
#else
|
||||
TD = new llvm::DataLayout(&M);
|
||||
#endif
|
||||
IL = new llvm::IntrinsicLowering(*TD);
|
||||
IL->AddPrototypes(M);
|
||||
|
||||
@@ -2225,7 +2202,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
||||
#endif
|
||||
TAsm = new CBEMCAsmInfo();
|
||||
MRI = new llvm::MCRegisterInfo();
|
||||
#if defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3)
|
||||
TCtx = new llvm::MCContext(TAsm, MRI, NULL);
|
||||
#else
|
||||
TCtx = new llvm::MCContext(*TAsm, *MRI, NULL);
|
||||
@@ -2349,7 +2326,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
||||
if (I->hasExternalLinkage() || I->hasExternalWeakLinkage() ||
|
||||
I->hasCommonLinkage())
|
||||
Out << "extern ";
|
||||
#if defined (LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||
else if (I->hasDLLImportStorageClass())
|
||||
#else
|
||||
else if (I->hasDLLImportLinkage())
|
||||
@@ -2525,7 +2502,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
||||
|
||||
if (I->hasLocalLinkage())
|
||||
Out << "static ";
|
||||
#if defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||
else if (I->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
|
||||
else if (I->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
|
||||
#else
|
||||
@@ -2699,15 +2676,11 @@ void CWriter::printModuleTypes() {
|
||||
|
||||
// Get all of the struct types used in the module.
|
||||
std::vector<llvm::StructType*> StructTypes;
|
||||
#if defined(LLVM_3_1)
|
||||
TheModule->findUsedStructTypes(StructTypes);
|
||||
#else
|
||||
llvm::TypeFinder typeFinder;
|
||||
typeFinder.run(*TheModule, false);
|
||||
for (llvm::TypeFinder::iterator iter = typeFinder.begin();
|
||||
iter != typeFinder.end(); ++iter)
|
||||
StructTypes.push_back(*iter);
|
||||
#endif
|
||||
|
||||
// Get all of the array types used in the module
|
||||
std::vector<llvm::ArrayType*> ArrayTypes;
|
||||
@@ -2810,7 +2783,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
||||
bool isStructReturn = F->hasStructRetAttr();
|
||||
|
||||
if (F->hasLocalLinkage()) Out << "static ";
|
||||
#if defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||
if (F->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
|
||||
if (F->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
|
||||
#else
|
||||
@@ -2833,7 +2806,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
||||
|
||||
// Loop over the arguments, printing them...
|
||||
llvm::FunctionType *FT = llvm::cast<llvm::FunctionType>(F->getFunctionType());
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
const llvm::AttrListPtr &PAL = F->getAttributes();
|
||||
#else
|
||||
const llvm::AttributeSet &PAL = F->getAttributes();
|
||||
@@ -2867,9 +2840,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
||||
else
|
||||
ArgName = "";
|
||||
llvm::Type *ArgTy = I->getType();
|
||||
#if defined(LLVM_3_1)
|
||||
if (PAL.paramHasAttr(Idx, llvm::Attribute::ByVal)) {
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
||||
#else
|
||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
||||
@@ -2878,9 +2849,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
||||
ByValParams.insert(I);
|
||||
}
|
||||
printType(FunctionInnards, ArgTy,
|
||||
#if defined(LLVM_3_1)
|
||||
/*isSigned=*/PAL.paramHasAttr(Idx, llvm::Attribute::SExt),
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt),
|
||||
#else
|
||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt),
|
||||
@@ -2906,9 +2875,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
||||
for (; I != E; ++I) {
|
||||
if (PrintedArg) FunctionInnards << ", ";
|
||||
llvm::Type *ArgTy = *I;
|
||||
#if defined(LLVM_3_1)
|
||||
if (PAL.paramHasAttr(Idx, llvm::Attribute::ByVal)) {
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::ByVal)) {
|
||||
#else
|
||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
||||
@@ -2917,9 +2884,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
||||
ArgTy = llvm::cast<llvm::PointerType>(ArgTy)->getElementType();
|
||||
}
|
||||
printType(FunctionInnards, ArgTy,
|
||||
#if defined(LLVM_3_1)
|
||||
/*isSigned=*/PAL.paramHasAttr(Idx, llvm::Attribute::SExt)
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::Attributes::SExt)
|
||||
#else
|
||||
PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt)
|
||||
@@ -2956,9 +2921,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
||||
|
||||
// Print out the return type and the signature built above.
|
||||
printType(Out, RetTy,
|
||||
#if defined(LLVM_3_1)
|
||||
/*isSigned=*/PAL.paramHasAttr(0, llvm::Attribute::SExt),
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
PAL.getParamAttributes(0).hasAttribute(llvm::Attributes::SExt),
|
||||
#else
|
||||
PAL.getParamAttributes(0).hasAttribute(llvm::AttributeSet::ReturnIndex, llvm::Attribute::SExt),
|
||||
@@ -3145,7 +3108,8 @@ void CWriter::visitSwitchInst(llvm::SwitchInst &SI) {
|
||||
Out << ":\n";
|
||||
printPHICopiesForSuccessor (SI.getParent(), Succ, 2);
|
||||
printBranchToBlock(SI.getParent(), Succ, 2);
|
||||
#if defined (LLVM_3_5) || defined(LLVM_3_6)
|
||||
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||
if (llvm::Function::iterator(Succ) == std::next(llvm::Function::iterator(SI.getParent())))
|
||||
#else
|
||||
if (llvm::Function::iterator(Succ) == llvm::next(llvm::Function::iterator(SI.getParent())))
|
||||
@@ -3170,7 +3134,7 @@ bool CWriter::isGotoCodeNecessary(llvm::BasicBlock *From, llvm::BasicBlock *To)
|
||||
/// FIXME: This should be reenabled, but loop reordering safe!!
|
||||
return true;
|
||||
|
||||
#if defined (LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) // LLVM 3.5+
|
||||
if (std::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
|
||||
#else
|
||||
if (llvm::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
|
||||
@@ -3775,7 +3739,7 @@ void CWriter::lowerIntrinsics(llvm::Function &F) {
|
||||
const char *BuiltinName = "";
|
||||
#define GET_GCC_BUILTIN_NAME
|
||||
#define Intrinsic llvm::Intrinsic
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
#include "llvm/Intrinsics.gen"
|
||||
#else
|
||||
#include "llvm/IR/Intrinsics.gen"
|
||||
@@ -3788,7 +3752,7 @@ void CWriter::lowerIntrinsics(llvm::Function &F) {
|
||||
// All other intrinsic calls we must lower.
|
||||
llvm::Instruction *Before = 0;
|
||||
if (CI != &BB->front())
|
||||
#if defined(LLVM_3_5) || defined(LLVM_3_6)
|
||||
#if !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4)
|
||||
Before = std::prev(llvm::BasicBlock::iterator(CI));
|
||||
#else
|
||||
Before = prior(llvm::BasicBlock::iterator(CI));
|
||||
@@ -3844,7 +3808,7 @@ void CWriter::visitCallInst(llvm::CallInst &I) {
|
||||
|
||||
// If this is a call to a struct-return function, assign to the first
|
||||
// parameter instead of passing it to the call.
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
const llvm::AttrListPtr &PAL = I.getAttributes();
|
||||
#else
|
||||
const llvm::AttributeSet &PAL = I.getAttributes();
|
||||
@@ -3932,9 +3896,7 @@ void CWriter::visitCallInst(llvm::CallInst &I) {
|
||||
(*AI)->getType() != FTy->getParamType(ArgNo)) {
|
||||
Out << '(';
|
||||
printType(Out, FTy->getParamType(ArgNo),
|
||||
#if defined(LLVM_3_1)
|
||||
/*isSigned=*/PAL.paramHasAttr(ArgNo+1, llvm::Attribute::SExt)
|
||||
#elif defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
PAL.getParamAttributes(ArgNo+1).hasAttribute(llvm::Attributes::SExt)
|
||||
#else
|
||||
PAL.getParamAttributes(ArgNo+1).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::SExt)
|
||||
@@ -3972,7 +3934,7 @@ bool CWriter::visitBuiltinCall(llvm::CallInst &I, llvm::Intrinsic::ID ID,
|
||||
const char *BuiltinName = "";
|
||||
#define GET_GCC_BUILTIN_NAME
|
||||
#define Intrinsic llvm::Intrinsic
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
#include "llvm/Intrinsics.gen"
|
||||
#else
|
||||
#include "llvm/IR/Intrinsics.gen"
|
||||
@@ -4625,13 +4587,8 @@ SmearCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
smearType, NULL);
|
||||
smearFunc = llvm::dyn_cast<llvm::Function>(sf);
|
||||
assert(smearFunc != NULL);
|
||||
#if defined(LLVM_3_1)
|
||||
smearFunc->setDoesNotThrow(true);
|
||||
smearFunc->setDoesNotAccessMemory(true);
|
||||
#else
|
||||
smearFunc->setDoesNotThrow();
|
||||
smearFunc->setDoesNotAccessMemory();
|
||||
#endif
|
||||
}
|
||||
|
||||
assert(smearFunc != NULL);
|
||||
@@ -4773,13 +4730,8 @@ AndCmpCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
LLVMTypes::MaskType, NULL);
|
||||
andCmpFunc = llvm::dyn_cast<llvm::Function>(acf);
|
||||
Assert(andCmpFunc != NULL);
|
||||
#if defined(LLVM_3_1)
|
||||
andCmpFunc->setDoesNotThrow(true);
|
||||
andCmpFunc->setDoesNotAccessMemory(true);
|
||||
#else
|
||||
andCmpFunc->setDoesNotThrow();
|
||||
andCmpFunc->setDoesNotAccessMemory();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Set up the function call to the *_and_mask function; the
|
||||
@@ -4984,7 +4936,7 @@ WriteCXXFile(llvm::Module *module, const char *fn, int vectorWidth,
|
||||
pm.add(new llvm::TargetData(module));
|
||||
#endif
|
||||
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2) || defined(LLVM_3_3)
|
||||
#if defined(LLVM_3_2) || defined(LLVM_3_3)
|
||||
int flags = 0;
|
||||
#else
|
||||
llvm::sys::fs::OpenFlags flags = llvm::sys::fs::F_None;
|
||||
@@ -5009,7 +4961,7 @@ WriteCXXFile(llvm::Module *module, const char *fn, int vectorWidth,
|
||||
pm.add(llvm::createDeadCodeEliminationPass()); // clean up after smear pass
|
||||
//CO pm.add(llvm::createPrintModulePass(&fos));
|
||||
pm.add(new CWriter(fos, includeName, vectorWidth));
|
||||
#if defined(LLVM_3_1) || defined(LLVM_3_2)
|
||||
#if defined(LLVM_3_2)
|
||||
// This interface is depricated for 3.3+
|
||||
pm.add(llvm::createGCInfoDeleter());
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user