[llvm] Overhaul the TargetMachine and LLVMTargetMachine Classes (PR #111234)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 10:36:30 PDT 2024
================
@@ -0,0 +1,92 @@
+//===-- CodeGenCommonTMImpl.h -----------------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file This file describes the CodeGenCommonTMImpl class, which
+/// implements a set of functionality used by \c TargetMachine classes in
+/// LLVM that make use of the target-independent code generator.
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CODEGEN_CODEGENCOMMONTMIMPL_H
+#define LLVM_CODEGEN_CODEGENCOMMONTMIMPL_H
+#include "llvm/Target/TargetMachine.h"
+
+namespace llvm {
+
+/// \brief implements a set of functionality in the \c TargetMachine class
+/// for targets that make use of the independent code generator (CodeGen)
+/// library. Must not be used directly in code unless to inherit its
+/// implementation.
+class CodeGenCommonTMImpl : public TargetMachine {
+protected: // Can only create subclasses.
+ CodeGenCommonTMImpl(const Target &T, StringRef DataLayoutString,
+ const Triple &TT, StringRef CPU, StringRef FS,
+ const TargetOptions &Options, Reloc::Model RM,
+ CodeModel::Model CM, CodeGenOptLevel OL);
+
+ void initAsmInfo();
+
+public:
+ /// Get a TargetTransformInfo implementation for the target.
+ ///
+ /// The TTI returned uses the common code generator to answer queries about
+ /// the IR.
+ TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
----------------
arsenm wrote:
TargetTransformInfo isn't really part of the CodeGen interface. This should probably move up to TargetMachine.
I see that TTI does make a little use of TM. Seems to be for managing subtarget instances, plus a few of the odd fields that really should come from the module
https://github.com/llvm/llvm-project/pull/111234
More information about the llvm-commits
mailing list