- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在按照以下说明构建循环传递:http://llvm.org/docs/WritingAnLLVMPass.html一切正常,我为函数传递做了很多次,但是在 runOnLoop
方法中,每当我调用作为参数传递的循环 L 的方法时,例如 L->begin()
,我收到以下错误:
opt: symbol lookup error: /home/giacomo/llvmcsfv/Debug+Asserts/lib/Acsl.so: undefined symbol: _ZNK4llvm8LoopBaseINS_10BasicBlockENS_4LoopEE5beginEv
其中 Acsl 是可加载模块的名称。如果我从 runOnPass
中删除了所有指令,但删除了调试打印,它工作正常(打印它),所以问题不在模块上。有人有什么想法吗?
这是转换密码:
//===- AcslDCEE.cpp - Acsl Dead Code Elimination -----------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure - CSFV Annotation Framework
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements a Dead Code Elimination that uses ACSL annotations
//
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "licm"
#include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AliasSetTracker.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Pass.h"
#include "llvm/IR/Function.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/SSAUpdater.h"
#include <algorithm>
using namespace llvm;
// STATISTIC(AcslNumSunk , "Number of instructions sunk out of loop");
// STATISTIC(AcslNumHoisted , "Number of instructions hoisted out of loop");
// STATISTIC(AcslNumMovedLoads, "Number of load insts hoisted or sunk");
// STATISTIC(AcslNumMovedCalls, "Number of call insts hoisted or sunk");
// STATISTIC(AcslNumPromoted , "Number of memory locations promoted to registers");
namespace {
struct AcslDCEE: public LoopPass {
static char ID; // Pass identification, replacement for typeid
AcslDCEE() :
LoopPass(ID) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesCFG();
AU.addRequired<DominatorTree>();
AU.addRequired<LoopInfo>();
AU.addRequiredID(LoopSimplifyID);
AU.addRequired<AliasAnalysis>();
AU.addPreserved<AliasAnalysis>();
AU.addPreserved("scalar-evolution");
AU.addPreservedID(LoopSimplifyID);
AU.addRequired<TargetLibraryInfo>();
}
/**
* The runOnFunction method must be implemented by your subclass to do the
* transformation or analysis work of your pass. As usual, a true value
* should be returned if the function is modified.
*/
virtual bool runOnLoop(Loop *L, LPPassManager &LPM){
bool Changed = false;
LI = &getAnalysis<LoopInfo>();
AA = &getAnalysis<AliasAnalysis>();
DT = &getAnalysis<DominatorTree>();
TD = getAnalysisIfAvailable<DataLayout>();
TLI = &getAnalysis<TargetLibraryInfo>();
errs() << "before!\n";
L->begin();
errs() << "after!\n";
return Changed;
}
/**
* The doInitialization method is designed to do simple initialization type
* of stuff that does not depend on the functions being processed.
* The doInitialization method call is not scheduled to overlap with any
* other pass executions.
*/
// virtual bool doInitialization(Loop *L, LPPassManager &LPM){
// errs() << "###Acsl DCEeeeea###\n";
// L->dump();
// errs() << "uhm...\n";
// return LoopPass::doInitialization(L,LPM);
// // return true;
// }
// /**
// * The doFinalization method is an infrequently used method that is called
// * when the pass framework has finished calling runOnFunction for every
// * function in the program being compiled.
// */
// virtual bool doFinalization(Module &M) {
// DEBUG(errs() << "\n");
// return LoopPass::doFinalization(M);
// }
// bool doFinalization() {
// DEBUG(errs() << "\n");
// return LoopPass::doFinalization();
// }
private:
AliasAnalysis *AA; // Current AliasAnalysis information
LoopInfo *LI; // Current LoopInfo
DominatorTree *DT; // Dominator Tree for the current Loop.
DataLayout *TD; // DataLayout for constant folding.
TargetLibraryInfo *TLI; // TargetLibraryInfo for constant folding.
// State that is updated as we process loops.
bool Changed; // Set to true when we change anything.
BasicBlock *Preheader; // The preheader block of the current loop...
Loop *CurLoop; // The current loop we are working on...
AliasSetTracker *CurAST; // AliasSet information for the current loop...
bool MayThrow; // The current loop contains an instruction which
// may throw, thus preventing code motion of
// instructions with side effects.
DenseMap<Loop*, AliasSetTracker*> LoopToAliasSetMap;
};
} //end of anonymous namespace
char AcslDCEE::ID = 0;
static RegisterPass<AcslDCEE> X("acsldcee", "acsl dead code elimination");
// INITIALIZE_PASS_BEGIN(AcslDCEE, "acsldcee", "Loop Invariant Code Motion", false, false)
// // INITIALIZE_PASS_DEPENDENCY(DominatorTree)
// INITIALIZE_PASS_DEPENDENCY(LoopInfo)
// // INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
// // INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfo)
// // INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
// INITIALIZE_PASS_END(AcslDCEE, "acsldcee", "Loop Invariant Code Motion", false, false)
最佳答案
begin() 函数的错误使用。该错误表明编译器找不到这样的函数。快速查看 Loop 类引用告诉我没有名为 begin 的成员函数。
关于c++ - LoopPass 可加载模块的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16311431/
我只是有一个更琐碎的问题。 为什么undefined == undefined 返回true,而undefined >= undefined 为false? undefined 等于 undefine
用PHP 7.2编写套接字服务器。根据Firefox 60中的“网络”选项卡,服务器的一些HTTP响应的第一行随机变为undefined undefined undefined。因此,我尝试记录套接字
在 JavaScript 中这是真的: undefined == undefined 但这是错误的: undefined <= undefined 起初我以为<=运算符包含第一个,但我猜它试图将其转换
在回答这个问题 (Difference between [Object, Object] and Array(2)) 时,我在 JavaScript 数组中遇到了一些我以前不知道的东西(具有讽刺意味的
来自https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/of , Note: thi
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
当我添加 到我的 PrimeFaces Mobile 页面,然后我在服务器日志中收到以下警告 WARNING: JSF1064: Unable to find or serve resource, u
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我是一名优秀的程序员,十分优秀!