[llvm] Overhaul the TargetMachine and LLVMTargetMachine Classes (PR #111234)
Matin Raayai via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 23:27:07 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 {
----------------
matinraayai wrote:
Originally I named it `CodeGenTargetMachine`, but I picked an ugly name on purpose to remind people not to use this class directly in their code unless they are subclassing it for their targets.
Again, my goal was to remove the need to static cast every time you need a CodeGen-specific feature of the TargetMachine, it's already in the interface. The target of choice has the freedom to not use it and either a) start from scratch in order to use the target-indepndent code generator, or b) use its own code generation scheme.
https://github.com/llvm/llvm-project/pull/111234
More information about the llvm-commits
mailing list