summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@intel.com>2015-02-12 15:56:30 +0800
committerZhigang Gong <zhigang.gong@intel.com>2015-02-13 09:40:00 +0800
commit17b53e8868155003e8d0008763e84b5318100109 (patch)
tree4a3f5fb96e0779032a776ba2255c064301ee63aa
parentfd688f2187f105f00017207701de30e8916ebae5 (diff)
GBE: fix build error for LLVM 3.4/3.3.
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com> Reviewed-by: "Song, Ruiling" <ruiling.song@intel.com>
-rw-r--r--backend/src/llvm/ExpandLargeIntegers.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/src/llvm/ExpandLargeIntegers.cpp b/backend/src/llvm/ExpandLargeIntegers.cpp
index 194622cb..aa86dde8 100644
--- a/backend/src/llvm/ExpandLargeIntegers.cpp
+++ b/backend/src/llvm/ExpandLargeIntegers.cpp
@@ -90,7 +90,11 @@
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
+#if LLVM_VERSION_MINOR >= 5
#include "llvm/IR/CFG.h"
+#else
+#include "llvm/Support/CFG.h"
+#endif
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
@@ -104,7 +108,10 @@
using namespace llvm;
+#if LLVM_VERSION_MINOR >= 5
#define DEBUG_TYPE "nacl-expand-ints"
+#endif
+
#ifdef DEBUG
#undef DEBUG
#define DEBUG(...)
@@ -732,7 +739,11 @@ static void convertInstruction(Instruction *Inst, ConversionState &State,
bool ExpandLargeIntegers::runOnFunction(Function &F) {
// Don't support changing the function arguments. Illegal function arguments
// should not be generated by clang.
+#if LLVM_VERSION_MINOR >= 5
for (const Argument &Arg : F.args())
+#else
+ for (const Argument &Arg : F.getArgumentList())
+#endif
if (shouldConvert(&Arg))
report_fatal_error("Function " + F.getName() +
" has illegal integer argument");
@@ -751,8 +762,13 @@ bool ExpandLargeIntegers::runOnFunction(Function &F) {
// Only attempt to convert an instruction if its result or any of its
// operands are illegal.
bool ShouldConvert = shouldConvert(&I);
+#if LLVM_VERSION_MINOR >= 5
for (Value *Op : I.operands())
ShouldConvert |= shouldConvert(Op);
+#else
+ for (auto it = I.op_begin(); it != I.op_end(); it++)
+ ShouldConvert |= shouldConvert(*it);
+#endif
if (ShouldConvert) {
convertInstruction(&I, State, DL);
Modified = true;