DEBUG_WITH_TYPE("foo", errs() << "'foo' debug type\n"); DEBUG_WITH_TYPE("bar", errs() << "'bar' debug type\n")); DEBUG_WITH_TYPE("", errs() << "No debug type (2)\n"); 在clang调试时使能LLVM的DEBUG()宏 命令行选项为: -mllvm -debug -mllvm -debug-only=<DEBUG_TYPE>...
-DCMAKE_BUILD_TYPE=type Controls optimization level and debug information of the build. For more detailed information see CMAKE_BUILD_TYPE (https://llvm.org/docs/CMake.html)。Type的类型有:Release,Debug,RelWithDebInfo,MinSizeRel。Debug一般是为了开发,普通使用Release就行了。如果是Debug,请准备足够...
INITIALIZE_PASS(ARMAddSub,DEBUG_TYPE,"ARM Add a Sub Pass",false,false);// Pass处理具体逻辑的函数boolARMAddSub::runOnMachineFunction(MachineFunction&MF){boolChanged=false;// Pass核心逻辑returnChanged;}// 在ARM.h中声明,用于创建一个实例FunctionPass*llvm::createARMAddSubPass(){returnnewARMAddSub...
-DCMAKE_INSTALL_PREFIX=directory明确LLVM工具和库被安装的位置,默认在/usr/local下。 -DCMAKE_BUILD_TYPE=typeDebug选项,默认就是使用Debug。 -DLLVM_ENABLE_ASSERTIONS=On编译时开启断言检查(assertion),默认就是开启 要注意整个llvm和build的绝对路径中不要出现中文,否则会出问题。 最后使用make命令编译一下即可...
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="/utf-8" -DLLVM_ENABLE_PROJECTS="clang" ../llvm 可选的构建类型说明: Release: 生成优化后的构建,无断言和调试信息。适合用于发布。 Debug: 生成未优化的构建,包含断言和调试信息。适合用于调试。
cmake-G Ninja../llvm-7.0.1-DCMAKE_BUILD_TYPE=Debug-DLLVM_TARGET_ARCH=AArch64;ninja-j4;ninjainstall(可选) 完成后可以通过clang –v检查安装完成的版本(生成的工具链都会在llvm/build/bin中) 常用参数介绍: -G 指定编译工具,如Ninja,Makefiles ...
SetCurrentDebugLocation( DILocation::get(Scope->getContext(), AST->getLine(), AST->getCol(), Scope)); } 这既告诉主`IRBuilder‘我们所在的位置,也告诉我们所在的作用域。作用域可以是编译单元级别的,也可以是最接近的封闭词法block,比如当前函数。为了表示这一点,我们创建了一个作用域堆栈: 代码语言:...
1#defineDEBUG_TYPE "objdiv"2#include <string>3#include <sstream>45#include"llvm/ADT/Statistic.h"6#include"llvm/IR/Function.h"7#include"llvm/IR/Constants.h"8#include"llvm/IR/Module.h"9#include"llvm/IR/Value.h"10#include"llvm/Pass.h"11#include"llvm/Support/raw_ostream.h"12#include"ll...
DEBUG_WITH_TYPE("gen", errs() << "bcf: Altered basic block: ok\n"); 1. 2. 3. 4. // Jump to the original basic block if the condition is true or // to the altered block if false. BranchInst::Create(originalBB, alteredBB, (Value *)condition, basicBlock); ...