【发布时间】:2014-12-23 08:00:33
【问题描述】:
我正在为 AVR 开发 Clang fork: https://github.com/4ntoine/clang/tree/avr-support
AVR 子目标在 AVR AVR.td 的 LLVM 后端分支中描述,LLVM TableGen 在 lib/Target/AVR/ 中生成 AVRSubtarget.h
我想从生成的AVRGenSubtargetInfo.inc 中使用AVRSubTypeKV in AVRTargetInfo.hasFeature() in Targets.cpp 来检查CPU(MCU)是否支持该功能:
// Sorted (by key) array of values for CPU subtype.
extern const llvm::SubtargetFeatureKV AVRSubTypeKV[] = {
{ "at43usb320", "Select the at43usb320 processor", AVR::FeatureAVR31, 0ULL },
{ "at43usb355", "Select the at43usb355 processor", AVR::FeatureAVR3, 0ULL },
{ "at76c711", "Select the at76c711 processor", AVR::FeatureAVR3, 0ULL },
{ "at86rf401", "Select the at86rf401 processor", AVR::FeatureRF401, 0ULL },
{ "at90c8534", "Select the at90c8534 processor", AVR::FeatureAVR2, 0ULL },
{ "at90can128", "Select the at90can128 processor", AVR::FeatureAVR51, 0ULL },
{ "at90can32", "Select the at90can32 processor", AVR::FeatureAVR5, 0ULL },
...
我尝试在Targets.cpp 中从LLVM 到#include <AVRSubtarget.h>,但找不到。
那么我如何在 Clang 中使用 LLVM TableGen 生成的文件?
【问题讨论】: