[Beignet] [PATCH] GBE: fix build error for LLVM 3.4/3.3.

Zhigang Gong zhigang.gong at intel.com
Thu Feb 12 01:37:27 PST 2015


Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 backend/src/llvm/ExpandLargeIntegers.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/backend/src/llvm/ExpandLargeIntegers.cpp b/backend/src/llvm/ExpandLargeIntegers.cpp
index 194622c..aa86dde 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;
-- 
1.8.3.2



More information about the Beignet mailing list