Path: blob/main/contrib/llvm-project/llvm/lib/Target/AVR/AVRTargetMachine.h
35266 views
//===-- AVRTargetMachine.h - Define TargetMachine for AVR -------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file declares the AVR specific subclass of TargetMachine.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_AVR_TARGET_MACHINE_H13#define LLVM_AVR_TARGET_MACHINE_H1415#include "llvm/IR/DataLayout.h"16#include "llvm/Target/TargetMachine.h"1718#include "AVRFrameLowering.h"19#include "AVRISelLowering.h"20#include "AVRInstrInfo.h"21#include "AVRSelectionDAGInfo.h"22#include "AVRSubtarget.h"2324#include <optional>2526namespace llvm {2728/// A generic AVR implementation.29class AVRTargetMachine : public LLVMTargetMachine {30public:31AVRTargetMachine(const Target &T, const Triple &TT, StringRef CPU,32StringRef FS, const TargetOptions &Options,33std::optional<Reloc::Model> RM,34std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,35bool JIT);3637const AVRSubtarget *getSubtargetImpl() const;38const AVRSubtarget *getSubtargetImpl(const Function &) const override;3940TargetLoweringObjectFile *getObjFileLowering() const override {41return this->TLOF.get();42}4344TargetPassConfig *createPassConfig(PassManagerBase &PM) override;4546MachineFunctionInfo *47createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,48const TargetSubtargetInfo *STI) const override;4950bool isNoopAddrSpaceCast(unsigned SrcAs, unsigned DestAs) const override {51// While AVR has different address spaces, they are all represented by52// 16-bit pointers that can be freely casted between (of course, a pointer53// must be cast back to its original address space to be dereferenceable).54// To be safe, also check the pointer size in case we implement __memx55// pointers.56return getPointerSize(SrcAs) == getPointerSize(DestAs);57}5859private:60std::unique_ptr<TargetLoweringObjectFile> TLOF;61AVRSubtarget SubTarget;62};6364} // end namespace llvm6566#endif // LLVM_AVR_TARGET_MACHINE_H676869