88 Commits

Author SHA1 Message Date
Kazu Hirata
82d5dd28b4
[RISCV] Remove unused includes (NFC) (#115814)
Identified with misc-include-cleaner.
2024-11-11 22:54:54 -08:00
Sam Elliott
228f88fdc8
[RISCV] Inline Assembly: RVC constraint and N modifier (#112561)
This change implements support for the `cr` and `cf` register
constraints (which allocate a RVC GPR or RVC FPR respectively), and the
`N` modifier (which prints the raw encoding of a register rather than
the name).

The intention behind these additions is to make it easier to use inline
assembly when assembling raw instructions that are not supported by the
compiler, for instance when experimenting with new instructions or when
supporting proprietary extensions outside the toolchain.

These implement part of my proposal in riscv-non-isa/riscv-c-api-doc#92

As part of the implementation, I felt there was not enough coverage of
inline assembly and the "in X" floating-point extensions, so I have
added more regression tests around these configurations.
2024-10-18 10:40:38 +01:00
Craig Topper
c042d8f7b3
[RISCV] Use RISCVAsmPrinter::EmitToStreamer for EmitHwasanMemaccessSymbols. (#111792)
Add a MCSubtargetInfo& operand so we can control the subtarget for the
new calls. The old signature is kept as a wrapper to pass *STI to
maintain compatibility.

By using EmitToStreamer we are able to compress the instructions when
possible.
2024-10-10 08:43:30 -07:00
Craig Topper
f0fc1d376c
[RISCV] Use MCStreamer::emitInstruction instead of calling AsmPrinter::EmitToStreamer. NFC (#111714)
This allows us to pass the STI we already have cached instead of
AsmPrinter::EmitToStreamer looking it up from the MachineFunction again.

My plan is to make EmitHwasanMemaccessSymbols use
RISCVAsmPrinter::EmitToStreamer instead of calling
MCStreamer::emitInstruction. To do that I need control of the
MCSubtargetInfo.
2024-10-09 12:55:32 -07:00
Craig Topper
bb8df02dfb
[RISCV] Use the MCStreamer reference passed to RISCVAsmPrinter::EmitToStreamer. NFCI (#111607)
We passed a MCStreamer to the function but hardcoded *OutStreamer
instead of using it. It's very likely that OutStreamer is the only
streamer used, but lets not assume that without doing the audit.
2024-10-08 19:21:58 -07:00
Samuel Holland
1a193137e3
[RISC-V][HWASAN] Fix incorrect comments (#103728)
These comments were confusing because they do not match the code.
2024-10-08 16:00:45 -07:00
Jim Lin
fef84c56dc
[RISCV] Support the large code model. (#70308)
Implement large code model for GlobalAddressSDNode and ExternalSymbolSDNode.

See discussion on
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/388.

---------

Co-authored-by: Kuan-Lin Chen <rufus@andestech.com>
2024-09-09 09:15:07 +08:00
Nikita Popov
f006246299
[CodeGen] Add generic INIT_UNDEF pseudo (#106744)
The InitUndef pass currently uses target-specific pseudo instructions,
with one pseudo per register class.

Instead, add a generic pseudo instruction, which can be used by all
targets and register classes.
2024-09-05 09:34:39 +02:00
Anton Sidorenko
2f91e98120
[RISCV] Mark symbols used in inline asm for relocations as referenced (#104925)
Commit 5cd8d53cac00f taught RISCVMergeBaseOffset to handle inline asm,
however
there is at least one case uncovered for integrated as.

In the example below compiler generates pcrel relocation
(mcmodel=medany)
```
    volatile double double_val = 1.0;
    void foo() {
        asm volatile("fld f0, %0 \n\t" : : "m"(double_val) : "memory");
    }
```

And fails with the folliwng error
```
    error: could not find corresponding %pcrel_hi
          |       "fld f0, %0 \n\t"
    <inline asm>:1:2: note: instantiated into assembly here
          |         fld f0, %pcrel_lo(.Lpcrel_hi0)(a0)
```

After transformations MachineFunction contains inline asm instructions
with
'.Lpcrel_hi0' symbol that is not defined in inline asm, but referenced.
```
   ... = AUIPC ...(riscv-pcrel-hi) @double_val, pre-instr-symbol <mcsymbol .Lpcrel_hi0>
   INLINEASM &"fld f0, $0 \0A\09" ... target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi0>
```

So, when AsmParser processes 'fld', it has to create a new symbol as
'.Lpcrel_hi0' already exists but not known to be referenced in inline
asm.
AsmParser avoids conflicts by renaming referenced by 'fld' symbol with
'.Lpcrel_hi00' name which does not exist. Resulting erroneous asm
```
    .Lpcrel_hi0:
        auipc   a0, %pcrel_hi(double_val)
        #APP
        fld     ft0, %pcrel_lo(.Lpcrel_hi00)(a0)
```

This change adds symbols used in memory operands to the list of
referenced ones.

Godbolt link: https://godbolt.org/z/aqrrsWKoK -- on the left you can
find incorrect labels for the integrated-as and on the right an error
when compiling to the binary object.
2024-08-26 15:11:24 +03:00
Luke Lau
b1542afd0b
[RISCV] Rename merge operand -> passthru. NFC (#100330)
We sometimes call the first tied dest operand in vector pseudos the
merge operand, and other times the passthru.

Passthru seems to be more common, and it's what the C intrinsics call
it[^1], so this renames all usages of merge to passthru to be
consistent. It also helps prevent confusion with vmerge.vvm in some of
the peephole optimisations.

[^1]:
https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob/main/doc/rvv-intrinsic-spec.adoc#the-passthrough-vd-argument-in-the-intrinsics
2024-07-30 17:47:00 +08:00
Sergei Barannikov
7a2a36f952
[AsmPrinter] Don't EmitToStreamer instructions lowered by tblgenned code (#100803)
This allows lowering individual instructions in a bundle before a single
call to EmitToStreamer for VLIW targets.
2024-07-29 19:18:18 +03:00
Nikita Popov
4169338e75
[IR] Don't include Module.h in Analysis.h (NFC) (#97023)
Replace it with a forward declaration instead. Analysis.h is pulled in
by all passes, but not all passes need to access the module.
2024-06-28 14:30:47 +02:00
Craig Topper
733a87783c
[RISCV] Split code that tablegen needs out of RISCVISAInfo. (#89684)
This introduces a new file, RISCVISAUtils.cpp and moves the rest of
RISCVISAInfo to the TargetParser library.

This will allow us to generate part of RISCVISAInfo.cpp using tablegen.
2024-04-23 15:12:36 -07:00
Sacha Coppey
53003e36e9
[RISCV] Implement Statepoint and Patchpoint lowering to call instructions (#77337)
This patch adds stackmap support for RISC-V with call targets.

Based on patch from https://reviews.llvm.org/D129848.
2024-04-11 12:19:56 +08:00
Pengcheng Wang
8dc006ea40
[RISCV] Make EmitToStreamer return whether Inst is compressed
This is helpful to reduce calls of `RISCVRVC::compress` in #77337.

Reviewers: asb, lukel97, topperc

Reviewed By: topperc

Pull Request: https://github.com/llvm/llvm-project/pull/88120
2024-04-10 11:02:55 +08:00
Craig Topper
891172d9be
[RISCV] Use 'riscv-isa' module flag to set ELF flags and attributes. (#85155)
Walk all the ISA strings and set the subtarget bits for any extension we
find in any string.

This allows LTO output to have a ELF attributes from the union of all of
the files used to compile it.
2024-03-20 11:35:19 -07:00
Craig Topper
4607f385e0 [RISCV] Use hasStdExtCOrZca instead of FeatureStdExtC to determine NOP size in RISCVAsmPrinter.cpp.
Found while auditing places where we only check C and not Zca.
2024-02-06 12:39:04 -08:00
Paul Kirth
03a61d34eb
[RISCV] Support TLSDESC in the RISC-V backend (#66915)
This patch adds basic TLSDESC support in the RISC-V backend.

Specifically, we add new relocation types for TLSDESC, as prescribed in 
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/373, and add a
new pseudo instruction to simplify code generation.

This patch does not try to optimize the local dynamic case, which can be
improved in separate patches. 

Linker side changes will also be handled separately.

The current implementation is only enabled when passing the new
`-enable-tlsdesc` codegen flag.
2024-01-23 16:16:07 -08:00
Wang Pengcheng
5cd8d53cac
[RISCV] Teach RISCVMergeBaseOffset to handle inline asm (#78945)
For inline asm with memory operands, we can merge the offset into
the second operand of memory constraint operands.

Differential Revision: https://reviews.llvm.org/D158062
2024-01-22 17:36:32 +08:00
Fangrui Song
360996ac5a
[RISCV] Merge machine operand flag MO_PLT into MO_CALL (#77253)
Since #72467, `@plt` in assembly output "call foo@plt" is omitted. We
can trivially merge MO_PLT and MO_CALL without any functional change to
assembly/relocatable file output.

Earlier architectures use different call relocation types whether a PLT
is potentially needed: R_386_PLT32/R_386_PC32, R_68K_PLT32/R_68K_PC32,
R_SPARC_WDISP30/R_SPARC_WPLT320. However, as the PLT property is
per-symbol instead of per-call-site and linkers can optimize out a PLT,
the distinction has been confusing.

Arm made good names R_ARM_CALL/R_AARCH64_CALL. Let's use MO_CALL instead
of MO_PLT.

As follow-ups, we can merge fixup_riscv_call/fixup_riscv_call_plt and
VK_RISCV_CALL/VK_RISCV_CALL_PLT.
2024-01-07 12:43:39 -08:00
Craig Topper
0ebe97115d Revert "[RISCV] Refactor subreg indices. (#77173)"
This reverts commit b5de136ef3fd63c6a6aabaea16792e47be1eeeff.

Based on post commit feedback, I need to some other work before
this makes sense.
2024-01-06 18:51:15 -08:00
Craig Topper
b5de136ef3
[RISCV] Refactor subreg indices. (#77173)
-Rename sub_32_hi to sub_gpr_odd
-Add dedicated sub_gpr_even.
-Rename sub_32 and sub_16 to sub_fpr32 and sub_fpr16.
-Remove start offset from sub_gpr_odd. AArch64 doesn't use non-zero offset for GPR
tuples so I don't think we need to.

This is preparation for a RV64 GPRPair for Zacas.
2024-01-06 11:42:53 -08:00
Sacha Coppey
776889bc1c [RISCV] Add Stackmap/Statepoint/Patchpoint support without targets
This patch adds stackmap support for RISC-V without targets (i.e. the nop patchable forms).

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D123496
2023-10-11 09:18:55 +05:30
Wang Pengcheng
3017545e63
[RISCV] Fix inline asm error for block address (#66640)
After commit cedf2ea, `RISCVMergeBaseOffset` can handle `BlockAddress`
currently. But we didn't handle it in `PrintAsmMemoryOperand` so we
get `invalid operand in inline asm` error.

This patch fixes the error.
2023-09-19 11:46:43 +08:00
Piyou Chen
b83a1ed594 [RISCV] Only emit .option when extension is supported
It maybe emit the .option directive without any follow up. Only emit the .option push/pop when there are supported extension difference between function and module.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D159399
2023-09-18 00:30:13 -07:00
Nick Desaulniers
fc5306d128 Revert "[RISCV] Teach RISCVMergeBaseOffset to handle inline asm"
This reverts commit f281543a48905e58359c6b0f1b9c3b42bd67e315.

Sami Tolvanen reports that this breaks the Linux kernel's arch=RISCV
defconfig.

Link: https://github.com/ClangBuiltLinux/linux/issues/1928
2023-08-31 14:02:53 -07:00
wangpc
f281543a48 [RISCV] Teach RISCVMergeBaseOffset to handle inline asm
For inline asm with memory operands, we can merge the offset into
the second operand of memory constraint operands.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D158062
2023-08-31 15:39:12 +08:00
Craig Topper
b441fd60b2 [RISCV] Separate hasRoundModeOpNum into separate VXRM and FRM functions.
Preparation for developing a new rounding mode insertion algorithm
that is going to be different between them since VXRM doesn't need
to be save/restored.

This also unifies the FRM handling in RISCVISelLowering.cpp between
scalar and vector.

Fixes outdated comments in RISCVAsmPrinter and sorts the predicate
function by the reverse order of the operands being skipped.

Reviewed By: eopXD

Differential Revision: https://reviews.llvm.org/D158326
2023-08-21 10:00:23 -07:00
wangpc
dc60003ec8 [RISCV] Support global address as inline asm memory operand of m
In D146245, we have supported lowering inline asm `m` with offset
to `register+imm`, but we didn't handle the case that the offset
is the low part of global address.

This patch will emit `%lo(g)` when `g` is a global address.

Fixes #64656

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D157839
2023-08-21 18:59:52 +08:00
Piyou Chen
05041b78a7 [RISCV] emit .option directive for functions with target features which differ from module default
When function has different attributes from module, emit the .option <attribute> before the function body.  This allows non-integrated assemblers to properly assemble the functions (which may contain instructions dependent on the extra target features).

Reviewed By: craig.topper, reames

Differential Revision: https://reviews.llvm.org/D155155
2023-08-03 04:22:39 -07:00
Sami Tolvanen
83835e22c7 [RISCV] Implement KCFI operand bundle lowering
With `-fsanitize=kcfi` (Kernel Control-Flow Integrity), Clang emits
"kcfi" operand bundles to indirect call instructions. Similarly to
the target-specific lowering added in D119296, implement KCFI operand
bundle lowering for RISC-V.

This patch disables the generic KCFI pass for RISC-V in Clang, and
adds the KCFI machine function pass in `RISCVPassConfig::addPreSched`
to emit target-specific `KCFI_CHECK` pseudo instructions before calls
that have KCFI operand bundles. The machine function pass also bundles
the instructions to ensure we emit the checks immediately before the
calls, which is not possible with the generic pass.

`KCFI_CHECK` instructions are lowered in `RISCVAsmPrinter` to a
contiguous code sequence that traps if the expected hash in the
operand bundle doesn't match the hash before the target function
address. This patch emits an `ebreak` instruction for error handling
to match the Linux kernel's `BUG()` implementation. Just like for X86,
we also emit trap locations to a `.kcfi_traps` section to support
error handling, as we cannot embed additional information to the trap
instruction itself.

Relands commit 62fa708ceb027713b386c7e0efda994f8bdc27e2 with fixed
tests.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D148385
2023-06-23 22:57:56 +00:00
Sami Tolvanen
e809ebeb6c Revert "[RISCV] Implement KCFI operand bundle lowering"
This reverts commit 62fa708ceb027713b386c7e0efda994f8bdc27e2.

Reverting to investigate -verify-machineinstrs errors in MIR tests.
2023-06-23 21:42:57 +00:00
Sami Tolvanen
62fa708ceb [RISCV] Implement KCFI operand bundle lowering
With `-fsanitize=kcfi` (Kernel Control-Flow Integrity), Clang emits
"kcfi" operand bundles to indirect call instructions. Similarly to
the target-specific lowering added in D119296, implement KCFI operand
bundle lowering for RISC-V.

This patch disables the generic KCFI pass for RISC-V in Clang, and
adds the KCFI machine function pass in `RISCVPassConfig::addPreSched`
to emit target-specific `KCFI_CHECK` pseudo instructions before calls
that have KCFI operand bundles. The machine function pass also bundles
the instructions to ensure we emit the checks immediately before the
calls, which is not possible with the generic pass.

`KCFI_CHECK` instructions are lowered in `RISCVAsmPrinter` to a
contiguous code sequence that traps if the expected hash in the
operand bundle doesn't match the hash before the target function
address. This patch emits an `ebreak` instruction for error handling
to match the Linux kernel's `BUG()` implementation. Just like for X86,
we also emit trap locations to a `.kcfi_traps` section to support
error handling, as we cannot embed additional information to the trap
instruction itself.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D148385
2023-06-23 18:25:24 +00:00
eopXD
7c8365121a [2/3][RISCV][POC] Model vxrm in LLVM intrinsics and machine instructions for RVV fixed-point instructions
Depends on D151395.

This is the 2nd patch of the patch-set. For the cover letter of the
patch-set, please checkout D151395. This patch originates from
D121376.

This commit models vxrm by adding an immediate operand into intrinsics
and machine instructions of RVV fixed-point instruction `vaadd`,
`vaaddu`, `vasub`, and `vasubu`. This commit only covers intrinsics of
the four instructions, the proceeding patches of the patch-set will do
the same to other RVV fixed-point instructions.

The current naiive approach is to have a write to vxrm inserted before
every fixed-point instruction. This is done by the new added pass
`RISCVInsertReadWriteCSR`. The reason to name the pass in a more general
term is because we will also model rounding mode for the RVV floating-
point instructions. The approach will be improved in the future,
implementing partial redundancy elimination algorithms to it.

The original LLVM intrinsics and machine instructions, take `vaadd` as
an example, does not model the rounding mode is not removed in this
patch. That is, `int.riscv.vaadd.*` co-exists with
`int.riscv.vaadd.rm.*` after this patch. The next patch will add C
intrinsics of vaadd with an additional operand that models the control
of the rounding mode, in this patch, `int.riscv.vaadd.rm.*` will
replace `int.riscv.vaadd.*`.

Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Co-Authored-by: eop Chen <eop.chen@sifive.com>

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D151396
2023-06-20 11:07:01 -07:00
Craig Topper
894d047056 [RISCV] Remove RISCVII::hasMergeOp. NFC
We can mostly get this from the operand info in MCInstrDesc.
The exception is the _TIED pseudos so I've added a new flag for those.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D152313
2023-06-13 10:54:00 -07:00
Craig Topper
d170eff527 [RISCV] Begin removing hasDummyMask.
This was used to know if we need to insert a dummy operand during
MCInstLowering. We can use the operand info from MCInstrDesc to
figure this out without needing a separate flag.

I'll remove the tablegen bits if there is consensus this is a good
idea.

Differential Revision: https://reviews.llvm.org/D152050
2023-06-12 11:57:40 -07:00
Craig Topper
11e5a0d290 [RISCV] Merge RISCVMCInstLower.cpp into RISCVAsmPrinter.cpp.
The separation here doesn't make much sense. I think it's a
leftover from the creation of the MC layer that has been
replicated to new targets.

By merging them we can avoid passing the AsmPrinter to the
MCInstLowering functions. We can make them member functions instead.

I think we can still do more integration of lowerSymbolOperand
and lowerRISCVVMachineInstrToMCInst, but I wanted to get feedback
on the direction first.

Reviewed By: asb, barannikov88

Differential Revision: https://reviews.llvm.org/D152311
2023-06-12 09:36:57 -07:00
Yingwei Zheng
edd08f17c3
[RISCV][NFC] Fix typo in RISCVAsmPrinter::emitNTLHint 2023-06-11 16:43:15 +08:00
Craig Topper
13fe673301 [RISCV] Move NTLH hint emission into RISCVAsmPrinter.cpp.
Rather than having a separate pass to add the hint instructions,
emit them directly into the streamer during asm printing.

Reviewed By: BeMg, kito-cheng

Differential Revision: https://reviews.llvm.org/D149511
2023-05-01 12:05:18 -07:00
Craig Topper
328cfa840d [RISCV] Add an option to emit the Tag_RISCV_arch attribute based on the assembler's subtarget
This adds an option to emit the command line -mattr/-march into the
attributes of an object file. This can be useful to get objdump to
disassemble instructions that aren't in the base without forcing
users to add a .attribute to the assembly file.

The binutils assembler does this by default.

Similar option exists for ARM. I will wire it to a clang option in
another patch. Similar to https://reviews.llvm.org/D31813

Reviewed By: asb, kito-cheng

Differential Revision: https://reviews.llvm.org/D148782
2023-04-20 10:00:30 -07:00
Mikhail R. Gadelha
6217f472a6 [RISCV] Lower inline asm m with offset to register+imm.
As part of D145584, we noticed that llvm was generating suboptimal code
for constraint m when the operand can be be lowered to reg+imm form: it
was being selected as a single register rather than register+imm. This
caused an unnecessary 'addi' to be gen for each m constraint.

This patch changes llvm to select register+imm. This might generate code
that cannot be assembled, but matches gcc's behavior.

Reviewed By: craig.topper, kito-cheng

Differential Revision: https://reviews.llvm.org/D146245
2023-03-31 13:20:13 -03:00
Craig Topper
0f4c9c016c [RISCV] Replace RISCV->RISC-V in strings.
To be consistent with RISC-V branding guidelines
https://riscv.org/about/risc-v-branding-guidelines/
Think we should be using RISC-V where possible.

D146449 already updated comments. Strings may have more user impact.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D146451
2023-03-27 09:50:17 -07:00
Craig Topper
29463612d2 [RISCV] Replace RISCV -> RISC-V in comments. NFC
To be consistent with RISC-V branding guidelines
https://riscv.org/about/risc-v-branding-guidelines/
Think we should be using RISC-V where possible.

More patches will follow.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D146449
2023-03-27 09:50:17 -07:00
Alex Bradbury
7d10b47450 [RISCV][MC][NFC] Refactor RISCVAsmPrinter::PrintAsmMemoryOperand to use early return 2023-03-16 15:02:53 +00:00
Piyou Chen
3b8c0b342e [RISCV] Add new pass to transform undef to pseudo for vector values.
RISC-V vector instruction has register overlapping constraint for certain
instructions, and will cause illegal instruction trap if violated, we use
early clobber to model this constraint, but it can't prevent register allocator
allocated same or overlapped if the input register is undef value, so convert
IMPLICIT_DEF to temporary pseudo could prevent that happen, it's not best way
to resolve this. Ideally we should model the constraint right, but before we
model the constraint right, it's the approach to prevent that happen.

See also: https://github.com/llvm/llvm-project/issues/50157

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D129735
2023-02-22 04:03:22 -08:00
Fangrui Song
6f3e6a765a Revert D129735 "[RISCV] Add new pass to transform undef to pseudo for vector values."
This reverts commit f1c4241fb6e50c507adafbe14faf82a755ab92ca.

It causes use-after-poison asan failures for
CodeGen/RISCV/rvv/undef-earlyclobber-chain.ll and CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll
2023-02-15 11:51:08 -08:00
Piyou Chen
f1c4241fb6 [RISCV] Add new pass to transform undef to pseudo for vector values.
RISC-V vector instruction has register overlapping constraint for certain
instructions, and will cause illegal instruction trap if violated, we use
early clobber to model this constraint, but it can't prevent register allocator
allocated same or overlapped if the input register is undef value, so convert
IMPLICIT_DEF to temporary pseudo could prevent that happen, it's not best way
to resolve this. Ideally we should model the constraint right, but before we
model the constraint right, it's the approach to prevent that happen.

See also: https://github.com/llvm/llvm-project/issues/50157

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D129735
2023-02-14 19:42:44 -08:00
Craig Topper
97cb619117 [RISCV] Use canonical move instruction in RISCVAsmPrinter::EmitHwasanMemaccessSymbols.
We were using an OR with X0 which is the canonical move for AArch64.
The canonical move for RISC-V is ADDI reg1, reg2, 0.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D142044
2023-01-18 11:38:39 -08:00
Craig Topper
82fa51f74d [RISCV] Use TargetMachine MCSubtargetInfo in RISCVAsmPrinter::EmitHwasanMemaccessSymbols.
The STI object in the class is updated each time runOnMachineFunction
is called. That means STI will be based on the last function processed.
If that function has different attributes than the rest of the module
that could theoretically result in odd behavior.

Use the copy in TargetMachine instead. That will use the global
CPU and mattrs.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D142041
2023-01-18 11:38:17 -08:00
Craig Topper
9778802cb0 [RISCV] Make it explicit that attributes use the MCSubtargetInfo from TargetMachine. NFC
The MCSTI variable is initialized to TM.getMCSubtargetInfo(), but is
re-assigned in every call to runOnMachineFunction. emitAttributes is
called before any call to runOnMachineFunction, but it's not
immediately obvious.

This patch removes the MCSTI variable, and instead queries
TM.getMCSubtargetInfo() at the time emitAttributes is called.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D142037
2023-01-18 11:31:45 -08:00