|
LLVM 24.0.0git
|
Add prototypes to prototypes-less functions. More...
#include "WebAssembly.h"#include "llvm/IR/Analysis.h"#include "llvm/IR/Constants.h"#include "llvm/IR/Module.h"#include "llvm/IR/Operator.h"#include "llvm/IR/PassManager.h"#include "llvm/Pass.h"#include "llvm/Support/Debug.h"#include "llvm/Transforms/Utils/Local.h"#include "llvm/Transforms/Utils/ModuleUtils.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "wasm-add-missing-prototypes" |
Functions | |
| INITIALIZE_PASS (WebAssemblyAddMissingPrototypesLegacy, DEBUG_TYPE, "Add prototypes to prototypes-less functions", false, false) ModulePass *llvm | |
| static bool | addMissingPrototypes (Module &M) |
Add prototypes to prototypes-less functions.
WebAssembly has strict function prototype checking so we need functions declarations to match the call sites. Clang treats prototype-less functions as varargs (foo(...)) which happens to work on existing platforms but doesn't under WebAssembly. This pass will find all the call sites of each prototype-less function, ensure they agree, and then set the signature on the function declaration accordingly.
Definition in file WebAssemblyAddMissingPrototypes.cpp.
| #define DEBUG_TYPE "wasm-add-missing-prototypes" |
Definition at line 33 of file WebAssemblyAddMissingPrototypes.cpp.
Definition at line 62 of file WebAssemblyAddMissingPrototypes.cpp.
References llvm::Function::Create(), llvm::dbgs(), llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::Function::eraseFromParent(), llvm::errs(), F, llvm::FunctionType::get(), llvm::Value::getName(), llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(), llvm::GlobalValue::getType(), LLVM_DEBUG, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Function::removeFnAttr(), llvm::Value::replaceAllUsesWith(), llvm::report_fatal_error(), llvm::Function::setAttributes(), llvm::Value::setName(), and llvm::Value::users().
Referenced by llvm::WebAssemblyAddMissingPrototypesPass::run().
| INITIALIZE_PASS | ( | WebAssemblyAddMissingPrototypesLegacy | , |
| DEBUG_TYPE | , | ||
| "Add prototypes to prototypes-less functions" | , | ||
| false | , | ||
| false | ) |
Definition at line 55 of file WebAssemblyAddMissingPrototypes.cpp.
References llvm::createWebAssemblyAddMissingPrototypesLegacyPass(), and DEBUG_TYPE.