[llvm] bbd7851 - ARC: Enforce function alignment at code emission time
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 18 14:47:44 PDT 2020
Author: Matt Arsenault
Date: 2020-06-18T17:40:49-04:00
New Revision: bbd78519f9a15669580563b93a3ab5d4cad1febc
URL: https://github.com/llvm/llvm-project/commit/bbd78519f9a15669580563b93a3ab5d4cad1febc
DIFF: https://github.com/llvm/llvm-project/commit/bbd78519f9a15669580563b93a3ab5d4cad1febc.diff
LOG: ARC: Enforce function alignment at code emission time
Don't do this in the MachineFunctionInfo constructor. Also, ensure the
alignment rather than overwriting it outright. I vaguely remember
there was another place to enforce the target minimum alignment, but I
couldn't find it (it's there for instructions).
Added:
Modified:
llvm/lib/Target/ARC/ARCAsmPrinter.cpp
llvm/lib/Target/ARC/ARCMachineFunctionInfo.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARC/ARCAsmPrinter.cpp b/llvm/lib/Target/ARC/ARCAsmPrinter.cpp
index cf511cd5ac0f..03024e0ea09c 100644
--- a/llvm/lib/Target/ARC/ARCAsmPrinter.cpp
+++ b/llvm/lib/Target/ARC/ARCAsmPrinter.cpp
@@ -42,6 +42,8 @@ class ARCAsmPrinter : public AsmPrinter {
StringRef getPassName() const override { return "ARC Assembly Printer"; }
void emitInstruction(const MachineInstr *MI) override;
+
+ bool runOnMachineFunction(MachineFunction &MF) override;
};
} // end anonymous namespace
@@ -61,6 +63,12 @@ void ARCAsmPrinter::emitInstruction(const MachineInstr *MI) {
EmitToStreamer(*OutStreamer, TmpInst);
}
+bool ARCAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
+ // Functions are 4-byte aligned.
+ MF.ensureAlignment(Align(4));
+ AsmPrinter::runOnMachineFunction(MF);
+}
+
// Force static initialization.
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCAsmPrinter() {
RegisterAsmPrinter<ARCAsmPrinter> X(getTheARCTarget());
diff --git a/llvm/lib/Target/ARC/ARCMachineFunctionInfo.h b/llvm/lib/Target/ARC/ARCMachineFunctionInfo.h
index d4dcf9bf285c..968c6b63f423 100644
--- a/llvm/lib/Target/ARC/ARCMachineFunctionInfo.h
+++ b/llvm/lib/Target/ARC/ARCMachineFunctionInfo.h
@@ -33,10 +33,7 @@ class ARCFunctionInfo : public MachineFunctionInfo {
explicit ARCFunctionInfo(MachineFunction &MF)
: ReturnStackOffsetSet(false), VarArgsFrameIndex(0),
- ReturnStackOffset(-1U), MaxCallStackReq(0) {
- // Functions are 4-byte aligned.
- MF.setAlignment(Align(4));
- }
+ ReturnStackOffset(-1U), MaxCallStackReq(0) {}
~ARCFunctionInfo() {}
More information about the llvm-commits
mailing list