This is an archive of the discontinued LLVM Phabricator instance.

Add NaCl target for Mips. Forbid indexed loads and stores if the target is NaCl.
ClosedPublic

Authored by sstankovic on Feb 4 2014, 12:07 PM.

Details

Summary

This patch adds NaCl target for Mips. It also forbids indexed loads and stores if the target is NaCl.

Diff Detail

Event Timeline

mseaborn added inline comments.Feb 4 2014, 1:55 PM
lib/Target/Mips/MipsInstrFPU.td
393 ↗(On Diff #6858)

It might be worth commenting why these instructions are disallowed under NaCl -- either in the code or at least in the commit message -- because I don't actually know why they are.

Are these inherently dangerous, or is it just that they haven't been added to the MIPS validator's whitelist yet?

lib/Target/Mips/MipsInstrInfo.td
190 ↗(On Diff #6858)

Nit: You don't actually use this yet, so you could leave it out

lib/Target/Mips/MipsSubtarget.h
212 ↗(On Diff #6858)

This one isn't used.

petarj added inline comments.Feb 4 2014, 2:15 PM
lib/Target/Mips/MipsInstrFPU.td
393 ↗(On Diff #6858)

Are these inherently dangerous, or is it just that they haven't been added to the MIPS validator's whitelist yet?

Similar to ARM, register-indexed addressing is not supported by design in MIPS NaCl.

mseaborn added inline comments.Feb 4 2014, 2:29 PM
lib/Target/Mips/MipsInstrFPU.td
393 ↗(On Diff #6858)

OK, I see. Is it the "x" in the instruction name that indicates this addressing mode? Which part of the tablegen definition indicates this addressing mode?

Maybe comment something like:
'"x" indicates a base register + offset register addressing mode which is disallowed under NaCl'

sstankovic added inline comments.Feb 5 2014, 5:09 AM
lib/Target/Mips/MipsInstrFPU.td
393 ↗(On Diff #6858)

Which part of the tablegen definition indicates this addressing mode?

All indexed loads and stores derive from tablegen classes LWXC1_FT and SWXC1_FT where base and offset are defined to have type PtrRC (or ptr_rc), which represents, if I understand correctly, a pointer value operand whose register class is resolved by using the TargetRegisterInfo::getPointerRegClass() hook at codegen time.

sstankovic updated this revision to Unknown Object (????).Feb 5 2014, 5:13 AM

Patch is updated.

LGTM, thanks

petarj closed this revision.Feb 5 2014, 9:25 AM

Closed by commit rL200855 (authored by @petarj).