mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 21:29:41 +00:00
[NVPTXAsmPrinter] do not print .align on function headers
Summary: PTX does not allow .align directives on function headers. Fixes PR21551. Test Plan: test/Codegen/NVPTX/function-align.ll Reviewers: eliben, jholewinski Reviewed By: eliben, jholewinski Subscribers: llvm-commits, eliben, jpienaar, jholewinski Differential Revision: http://reviews.llvm.org/D8274 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232004 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b2d414391a
commit
3ea0adcdd5
@ -256,6 +256,10 @@ protected:
|
|||||||
/// argument and how it is interpreted. Defaults to NoAlignment.
|
/// argument and how it is interpreted. Defaults to NoAlignment.
|
||||||
LCOMM::LCOMMType LCOMMDirectiveAlignmentType;
|
LCOMM::LCOMMType LCOMMDirectiveAlignmentType;
|
||||||
|
|
||||||
|
// True if the target allows .align directives on funtions. This is true for
|
||||||
|
// most targets, so defaults to true.
|
||||||
|
bool HasFunctionAlignment;
|
||||||
|
|
||||||
/// True if the target has .type and .size directives, this is true for most
|
/// True if the target has .type and .size directives, this is true for most
|
||||||
/// ELF targets. Defaults to true.
|
/// ELF targets. Defaults to true.
|
||||||
bool HasDotTypeDotSizeDirective;
|
bool HasDotTypeDotSizeDirective;
|
||||||
@ -467,6 +471,7 @@ public:
|
|||||||
LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const {
|
LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const {
|
||||||
return LCOMMDirectiveAlignmentType;
|
return LCOMMDirectiveAlignmentType;
|
||||||
}
|
}
|
||||||
|
bool hasFunctionAlignment() const { return HasFunctionAlignment; }
|
||||||
bool hasDotTypeDotSizeDirective() const { return HasDotTypeDotSizeDirective; }
|
bool hasDotTypeDotSizeDirective() const { return HasDotTypeDotSizeDirective; }
|
||||||
bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
|
bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
|
||||||
bool hasIdentDirective() const { return HasIdentDirective; }
|
bool hasIdentDirective() const { return HasIdentDirective; }
|
||||||
|
@ -527,7 +527,8 @@ void AsmPrinter::EmitFunctionHeader() {
|
|||||||
EmitVisibility(CurrentFnSym, F->getVisibility());
|
EmitVisibility(CurrentFnSym, F->getVisibility());
|
||||||
|
|
||||||
EmitLinkage(F, CurrentFnSym);
|
EmitLinkage(F, CurrentFnSym);
|
||||||
EmitAlignment(MF->getAlignment(), F);
|
if (MAI->hasFunctionAlignment())
|
||||||
|
EmitAlignment(MF->getAlignment(), F);
|
||||||
|
|
||||||
if (MAI->hasDotTypeDotSizeDirective())
|
if (MAI->hasDotTypeDotSizeDirective())
|
||||||
OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
|
OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
|
||||||
|
@ -69,6 +69,7 @@ MCAsmInfo::MCAsmInfo() {
|
|||||||
HasAggressiveSymbolFolding = true;
|
HasAggressiveSymbolFolding = true;
|
||||||
COMMDirectiveAlignmentIsInBytes = true;
|
COMMDirectiveAlignmentIsInBytes = true;
|
||||||
LCOMMDirectiveAlignmentType = LCOMM::NoAlignment;
|
LCOMMDirectiveAlignmentType = LCOMM::NoAlignment;
|
||||||
|
HasFunctionAlignment = true;
|
||||||
HasDotTypeDotSizeDirective = true;
|
HasDotTypeDotSizeDirective = true;
|
||||||
HasSingleParameterDotFile = true;
|
HasSingleParameterDotFile = true;
|
||||||
HasIdentDirective = false;
|
HasIdentDirective = false;
|
||||||
|
@ -39,6 +39,8 @@ NVPTXMCAsmInfo::NVPTXMCAsmInfo(StringRef TT) {
|
|||||||
InlineAsmEnd = " inline asm";
|
InlineAsmEnd = " inline asm";
|
||||||
|
|
||||||
SupportsDebugInformation = CompileForDebugging;
|
SupportsDebugInformation = CompileForDebugging;
|
||||||
|
// PTX does not allow .align on functions.
|
||||||
|
HasFunctionAlignment = false;
|
||||||
HasDotTypeDotSizeDirective = false;
|
HasDotTypeDotSizeDirective = false;
|
||||||
|
|
||||||
Data8bitsDirective = " .b8 ";
|
Data8bitsDirective = " .b8 ";
|
||||||
|
7
test/CodeGen/NVPTX/function-align.ll
Normal file
7
test/CodeGen/NVPTX/function-align.ll
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
|
||||||
|
|
||||||
|
; CHECK-NOT: .align 2
|
||||||
|
define ptx_device void @foo() align 2 {
|
||||||
|
; CHECK-LABEL: .func foo
|
||||||
|
ret void
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user