support LLVM trunk after 203559 203213 and 203381 revisions

This commit is contained in:
Ilia Filippov
2014-03-12 12:58:50 +04:00
parent e1524891fc
commit ead5cc741d
3 changed files with 23 additions and 6 deletions

View File

@@ -1497,7 +1497,12 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp,
per_lane($1, <$1 x MASK> %mask, `
%cmp_LANE_ID = extractelement <$1 x $2> %cmp, i32 LANE
%val_LANE_ID = extractelement <$1 x $2> %val, i32 LANE
%r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst
ifelse(LLVM_VERSION,LLVM_3_5,`
%r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst
',`
%r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst
')
%rp_LANE_ID = getelementptr $2 * %rptr32, i32 LANE
store $2 %r_LANE_ID, $2 * %rp_LANE_ID')
@@ -1507,7 +1512,11 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp,
define $2 @__atomic_compare_exchange_uniform_$3_global($2* %ptr, $2 %cmp,
$2 %val) nounwind alwaysinline {
%r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst
ifelse(LLVM_VERSION,LLVM_3_5,`
%r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst
',`
%r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst
')
ret $2 %r
}
')

View File

@@ -464,7 +464,11 @@ namespace {
// Must not be used in inline asm, extractelement, or shufflevector.
if (I.hasOneUse()) {
#if defined(LLVM_3_5)
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.user_back());
#else
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.use_back());
#endif
if (isInlineAsm(User) || llvm::isa<llvm::ExtractElementInst>(User) ||
llvm::isa<llvm::ShuffleVectorInst>(User) || llvm::isa<llvm::AtomicRMWInst>(User) ||
llvm::isa<llvm::AtomicCmpXchgInst>(User))
@@ -472,7 +476,11 @@ namespace {
}
// Only inline instruction it if it's use is in the same BB as the inst.
#if defined(LLVM_3_5)
return I.getParent() == llvm::cast<llvm::Instruction>(I.user_back())->getParent();
#else
return I.getParent() == llvm::cast<llvm::Instruction>(I.use_back())->getParent();
#endif
}
// isDirectAlloca - Define fixed sized allocas in the entry block as direct

View File

@@ -2099,12 +2099,12 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre
}
}
#if defined(LLVM_3_1)
inst.getLangOpts().BCPLComment = 1;
#else
inst.getLangOpts().LineComment = 1;
#endif
#if defined(LLVM_3_5)
inst.createPreprocessor(clang::TU_Complete);
#else
inst.createPreprocessor();
#endif
diagPrinter->BeginSourceFile(inst.getLangOpts(), &inst.getPreprocessor());
clang::DoPrintPreprocessedInput(inst.getPreprocessor(),