Allowed LLVM optimisations to build against both LLVM 2.9 and LLVM 3.0.
parent
f6697e5f86
commit
34aa9f9455
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Compatibility header that wraps LLVM API breakage and lets us compile with
|
||||
* old and new versions of LLVM.
|
||||
*/
|
||||
|
||||
__attribute((unused)) static inline
|
||||
PHINode* CreatePHI(const Type *Ty,
|
||||
unsigned NumReservedValues,
|
||||
const Twine &NameStr="",
|
||||
Instruction *InsertBefore=0) {
|
||||
#if LLVM_MAJOR < 3
|
||||
PHINode *phi = PHINode::Create(Ty, NameStr, InsertBefore);
|
||||
phi->reserveOperandSpace(NumReservedValues);
|
||||
return phi;
|
||||
#else
|
||||
return PHINode::Create(Ty, NumReservedValues, NameStr, InsertBefore);
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute((unused)) static inline
|
||||
MDNode* CreateMDNode(LLVMContext &C,
|
||||
Value *V) {
|
||||
#if LLVM_MAJOR < 3
|
||||
return MDNode::get(C, &V, 1);
|
||||
#else
|
||||
ArrayRef<Value*> val(V);
|
||||
return MDNode::get(C, val);
|
||||
#endif
|
||||
}
|
||||
Loading…
Reference in New Issue