mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 06:06:06 +00:00

Fix several instances of macros being defined multiple times in several targets. Most of these are just simple duplication in a TargetInfo or OSTargetInfo of things already defined in InitializePredefinedMacros or InitializeStandardPredefinedMacros, but there are a few that aren't: * AArch64 defines a couple of feature macros for armv8.1a that are handled generically by getTargetDefines. * CSKY needs to take care when CPUName and ArchName are the same. * Many os/target combinations result in __ELF__ being defined twice. Instead define __ELF__ just once in InitPreprocessor based on the Triple, which already knows what the object format is based on os and target. These changes shouldn't change the final result of which macros are defined, with the exception of the changes to __ELF__ where if you explicitly specify the object type in the triple then this affects if __ELF__ is defined, e.g. --target=i686-windows-elf results in it being defined where it wasn't before, but this is more accurate as an ELF file is in fact generated. Differential Revision: https://reviews.llvm.org/D150966
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
//===--- MSP430.cpp - Implement MSP430 target feature support -------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements MSP430 TargetInfo objects.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "MSP430.h"
|
|
#include "clang/Basic/MacroBuilder.h"
|
|
|
|
using namespace clang;
|
|
using namespace clang::targets;
|
|
|
|
const char *const MSP430TargetInfo::GCCRegNames[] = {
|
|
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
|
|
};
|
|
|
|
ArrayRef<const char *> MSP430TargetInfo::getGCCRegNames() const {
|
|
return llvm::ArrayRef(GCCRegNames);
|
|
}
|
|
|
|
void MSP430TargetInfo::getTargetDefines(const LangOptions &Opts,
|
|
MacroBuilder &Builder) const {
|
|
Builder.defineMacro("MSP430");
|
|
Builder.defineMacro("__MSP430__");
|
|
// FIXME: defines for different 'flavours' of MCU
|
|
}
|