llvm.org GIT mirror llvm / 0233715
reverts 195057 per request git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195152 91177308-0d34-0410-b5e6-96231b3b80d8 Jack Carter 5 years ago
9 changed file(s) with 83 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
192192
193193 bool isEvaluated(const MCExpr *Expr);
194194 bool parseDirectiveSet();
195 bool parseDirectiveMipsHackStocg();
196 bool parseDirectiveMipsHackELFFlags();
195197
196198 bool parseSetAtDirective();
197199 bool parseSetNoAtDirective();
23672369 return true;
23682370 }
23692371
2372 bool MipsAsmParser::parseDirectiveMipsHackStocg() {
2373 MCAsmParser &Parser = getParser();
2374 StringRef Name;
2375 if (Parser.parseIdentifier(Name))
2376 reportParseError("expected identifier");
2377
2378 MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
2379 if (getLexer().isNot(AsmToken::Comma))
2380 return TokError("unexpected token");
2381 Lex();
2382
2383 int64_t Flags = 0;
2384 if (Parser.parseAbsoluteExpression(Flags))
2385 return TokError("unexpected token");
2386
2387 getTargetStreamer().emitMipsHackSTOCG(Sym, Flags);
2388 return false;
2389 }
2390
2391 bool MipsAsmParser::parseDirectiveMipsHackELFFlags() {
2392 int64_t Flags = 0;
2393 if (Parser.parseAbsoluteExpression(Flags))
2394 return TokError("unexpected token");
2395
2396 getTargetStreamer().emitMipsHackELFFlags(Flags);
2397 return false;
2398 }
2399
23702400 /// parseDirectiveWord
23712401 /// ::= .word [ expression (, expression)* ]
23722402 bool MipsAsmParser::parseDirectiveWord(unsigned Size, SMLoc L) {
24572487 return false;
24582488 }
24592489
2490 if (IDVal == ".mips_hack_stocg")
2491 return parseDirectiveMipsHackStocg();
2492
2493 if (IDVal == ".mips_hack_elf_flags")
2494 return parseDirectiveMipsHackELFFlags();
2495
24602496 return true;
24612497 }
24622498
140140 bool isVerboseAsm, bool useLoc, bool useCFI,
141141 bool useDwarfDirectory, MCInstPrinter *InstPrint,
142142 MCCodeEmitter *CE, MCAsmBackend *TAB, bool ShowInst) {
143 MipsTargetAsmStreamer *S = new MipsTargetAsmStreamer();
143 MipsTargetAsmStreamer *S = new MipsTargetAsmStreamer(OS);
144144
145145 return llvm::createAsmStreamer(Ctx, S, OS, isVerboseAsm, useLoc, useCFI,
146146 useDwarfDirectory, InstPrint, CE, TAB,
1919
2020 using namespace llvm;
2121
22 static cl::opt PrintHackDirectives("print-hack-directives",
23 cl::init(false), cl::Hidden);
24
2225 // pin vtable to this file
2326 void MipsTargetStreamer::anchor() {}
2427
25 void MipsTargetAsmStreamer::emitMipsHackELFFlags(unsigned Flags) { return; }
26 void MipsTargetAsmStreamer::emitSymSTO(MCSymbol *Sym, unsigned Val) { return; }
28 MipsTargetAsmStreamer::MipsTargetAsmStreamer(formatted_raw_ostream &OS)
29 : OS(OS) {}
30
31 void MipsTargetAsmStreamer::emitMipsHackELFFlags(unsigned Flags) {
32 if (!PrintHackDirectives)
33 return;
34
35 OS << "\t.mips_hack_elf_flags 0x";
36 OS.write_hex(Flags);
37 OS << '\n';
38 }
39 void MipsTargetAsmStreamer::emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) {
40 if (!PrintHackDirectives)
41 return;
42
43 OS << "\t.mips_hack_stocg ";
44 OS << Sym->getName();
45 OS << ", ";
46 OS << Val;
47 OS << '\n';
48 }
2749
2850 MCELFStreamer &MipsTargetELFStreamer::getStreamer() {
2951 return static_cast(*Streamer);
3557 }
3658
3759 // Set a symbol's STO flags
38 void MipsTargetELFStreamer::emitSymSTO(MCSymbol *Sym, unsigned Val) {
60 void MipsTargetELFStreamer::emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) {
3961 MCSymbolData &Data = getStreamer().getOrCreateSymbolData(Sym);
4062 // The "other" values are stored in the last 6 bits of the second byte
4163 // The traditional defines for STO values assume the full byte and thus
275275 }
276276
277277 if (Subtarget->inMicroMipsMode())
278 getTargetStreamer().emitSymSTO(CurrentFnSym,
279 (unsigned)ELF::STO_MIPS_MICROMIPS);
278 getTargetStreamer().emitMipsHackSTOCG(CurrentFnSym,
279 (unsigned)ELF::STO_MIPS_MICROMIPS);
280280 OutStreamer.EmitLabel(CurrentFnSym);
281281 }
282282
1818
1919 public:
2020 virtual void emitMipsHackELFFlags(unsigned Flags) = 0;
21 virtual void emitSymSTO(MCSymbol *Sym, unsigned Val) = 0;
21 virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) = 0;
2222 };
2323
2424 // This part is for ascii assembly output
2525 class MipsTargetAsmStreamer : public MipsTargetStreamer {
26 formatted_raw_ostream &OS;
27
2628 public:
29 MipsTargetAsmStreamer(formatted_raw_ostream &OS);
2730 virtual void emitMipsHackELFFlags(unsigned Flags);
28 virtual void emitSymSTO(MCSymbol *Sym, unsigned Val);
31 virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val);
2932 };
3033
3134 // This part is for ELF object output
3336 public:
3437 MCELFStreamer &getStreamer();
3538 virtual void emitMipsHackELFFlags(unsigned Flags);
36 virtual void emitSymSTO(MCSymbol *Sym, unsigned Val);
39 virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val);
3740 };
3841 }
3942
None ; XFAIL: *
1
2 ; This tests ELF EFLAGS setting with direct object.
31 ; When the assembler is ready a .s file for it will
42 ; be created.
1715 ; Note that EF_MIPS_CPIC is set by -mabicalls which is the default on Linux
1816 ; TODO need to support -mno-abicalls
1917
20 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 -relocation-model=static %s -o - | FileCheck -check-prefix=CHECK-BE32 %s
21 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 %s -o - | FileCheck -check-prefix=CHECK-BE32_PIC %s
22 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -relocation-model=static %s -o - | FileCheck -check-prefix=CHECK-BE32R2 %s
23 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 %s -o - | FileCheck -check-prefix=CHECK-BE32R2_PIC %s
24 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -relocation-model=static %s -o - | FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS %s
25 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips %s -o - | FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS_PIC %s
18 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 -relocation-model=static %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE32 %s
19 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32_PIC %s
20 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -relocation-model=static %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE32R2 %s
21 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32R2_PIC %s
22 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -relocation-model=static -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS %s
23 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS_PIC %s
2624
27 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 -relocation-model=static %s -o - | FileCheck -check-prefix=CHECK-BE64 %s
28 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 %s -o - | FileCheck -check-prefix=CHECK-BE64_PIC %s
29 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 -relocation-model=static %s -o - | FileCheck -check-prefix=CHECK-BE64R2 %s
30 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 %s -o - | FileCheck -check-prefix=CHECK-BE64R2_PIC %s
25 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 -relocation-model=static %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE64 %s
26 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE64_PIC %s
27 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 -relocation-model=static -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE64R2 %s
28 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE64R2_PIC %s
3129
32 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+mips16 -relocation-model=pic %s -o - | FileCheck -check-prefix=CHECK-LE32R2-MIPS16 %s
30 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+mips16 -relocation-model=pic -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-LE32R2-MIPS16 %s
3331
3432 ; 32(R1) bit with NO_REORDER and static
3533 ; CHECK-BE32: .mips_hack_elf_flags 0x50001005
None ; XFAIL: *
1 // RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o -| llvm-readobj -h | FileCheck %s
21
2 .mips_hack_elf_flags 0x50001005
33
44 // CHECK: Flags [ (0x50001005)
None ; XFAIL: *
1
2 ; This tests value of ELF st_other field for function symbol table entries.
31 ; For microMIPS value should be equal to STO_MIPS_MICROMIPS.
42
5 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips %s -o - | FileCheck %s
3 ; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -print-hack-directives %s -o - | FileCheck %s
64
75 define i32 @main() nounwind {
86 entry:
None ; XFAIL: *
1
2 // RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o -| llvm-readobj -t | FileCheck %s
31
42 .text