diff --git a/include/remill/BC/Compat/CallSite.h b/include/remill/BC/Compat/CallSite.h index d8a7b2324..a5ffa47fa 100644 --- a/include/remill/BC/Compat/CallSite.h +++ b/include/remill/BC/Compat/CallSite.h @@ -48,6 +48,7 @@ namespace remill::compat::llvm { using parent::getCalledValue; using parent::getCalledFunction; using parent::setCalledFunction; + using parent::getInstruction; }; } // namespace remill::compat::llvm @@ -55,6 +56,8 @@ namespace remill::compat::llvm { #else #include +#include +#include namespace remill::compat::llvm { struct CallSite { @@ -83,7 +86,7 @@ namespace remill::compat::llvm { return cb->getCalledOperand(); } - ::llvm::Function *getCalledFunction() { + ::llvm::Function *getCalledFunction() const { if ( !*this) { return nullptr; } @@ -97,6 +100,10 @@ namespace remill::compat::llvm { operator bool() const { return cb; } + + ::llvm::CallBase *getInstruction() { + return cb; + } }; } // namespace remill::compat::llvm diff --git a/include/remill/BC/Compat/Cloning.h b/include/remill/BC/Compat/Cloning.h new file mode 100644 index 000000000..4f83b903e --- /dev/null +++ b/include/remill/BC/Compat/Cloning.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021 Trail of Bits, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "remill/BC/Version.h" + +/* This compatibility relates to the changes made in CallSite.h. + */ + +#if LLVM_VERSION_NUMBER >= LLVM_VERSION(11, 0) + +#include +#include +#include + +namespace llvm { + + inline static InlineResult InlineFunction(CallBase *CB, InlineFunctionInfo &IFI, + AAResults *CalleeAAR = nullptr, + bool InsertLifetime = true, + Function *ForwardVarArgsTo = nullptr) { + return InlineFunction(*CB, IFI, CalleeAAR, InsertLifetime, ForwardVarArgsTo); + } + +} // namespace llvm + +#endif