28
28
#include " llvm/MC/MCRegisterInfo.h"
29
29
#include " llvm/MC/MCStreamer.h"
30
30
#include " llvm/MC/MCSubtargetInfo.h"
31
+ #include " llvm/MC/MCSymbolELF.h"
31
32
#include " llvm/MC/MCTargetAsmParser.h"
33
+ #include " llvm/Support/ELF.h"
32
34
#include " llvm/Support/SourceMgr.h"
33
35
#include " llvm/Support/TargetRegistry.h"
34
36
#include " llvm/Support/raw_ostream.h"
@@ -355,6 +357,7 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
355
357
bool ParseDirectiveAMDKernelCodeT ();
356
358
bool ParseSectionDirectiveHSAText ();
357
359
bool subtargetHasRegister (const MCRegisterInfo &MRI, unsigned RegNo) const ;
360
+ bool ParseDirectiveAMDGPUHsaKernel ();
358
361
359
362
public:
360
363
public:
@@ -942,6 +945,18 @@ bool AMDGPUAsmParser::ParseSectionDirectiveHSAText() {
942
945
return false ;
943
946
}
944
947
948
+ bool AMDGPUAsmParser::ParseDirectiveAMDGPUHsaKernel () {
949
+ if (getLexer ().isNot (AsmToken::Identifier))
950
+ return TokError (" expected symbol name" );
951
+
952
+ StringRef KernelName = Parser.getTok ().getString ();
953
+
954
+ getTargetStreamer ().EmitAMDGPUSymbolType (KernelName,
955
+ ELF::STT_AMDGPU_HSA_KERNEL);
956
+ Lex ();
957
+ return false ;
958
+ }
959
+
945
960
bool AMDGPUAsmParser::ParseDirective (AsmToken DirectiveID) {
946
961
StringRef IDVal = DirectiveID.getString ();
947
962
@@ -957,6 +972,9 @@ bool AMDGPUAsmParser::ParseDirective(AsmToken DirectiveID) {
957
972
if (IDVal == " .hsatext" || IDVal == " .text" )
958
973
return ParseSectionDirectiveHSAText ();
959
974
975
+ if (IDVal == " .amdgpu_hsa_kernel" )
976
+ return ParseDirectiveAMDGPUHsaKernel ();
977
+
960
978
return true ;
961
979
}
962
980
0 commit comments