================
@@ -0,0 +1,333 @@
+//===-- InlineAsmPrepare - Prepare inline asm for code generation 
---------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+//
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/CodeGen/InlineAsmPrepare.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/CodeGen/Passes.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/InlineAsm.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Module.h"
+#include "llvm/InitializePasses.h"
+#include "llvm/Pass.h"
+#include <sstream>
+
+using namespace llvm;
+
+#define DEBUG_TYPE "inline-asm-prepare"
+
+namespace {
+
+class InlineAsmPrepare : public FunctionPass {
+  InlineAsmPrepare(InlineAsmPrepare &) = delete;
+
+public:
+  InlineAsmPrepare() : FunctionPass(ID) {}
+
+  void getAnalysisUsage(AnalysisUsage &AU) const override {}
+  bool runOnFunction(Function &F) override;
+
+  static char ID;
+};
+
+char InlineAsmPrepare::ID = 0;
+
+} // end anonymous namespace
+
+INITIALIZE_PASS(InlineAsmPrepare, DEBUG_TYPE,
+                "Convert inline asm \"rm\" insts for fast register allocation",
+                false, false)
+FunctionPass *llvm::createInlineAsmPass() { return new InlineAsmPrepare(); }
+
+// For each inline asm, the "rm" constraint needs to default to "m" for the
+// fast register allocator.
+static SmallVector<CallBase *, 4> findInlineAsms(Function &F) {
+  SmallVector<CallBase *, 4> InlineAsms;
+
+  for_each(F, [&](BasicBlock &BB) {
+    for_each(BB, [&](Instruction &I) {
----------------
bwendling wrote:

Done.

https://github.com/llvm/llvm-project/pull/92040
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to