[cfe-dev] [LLVMdev] [MIPS] How can I add a constraint to LLVM/Clang for MIPS BE?

Jack Carter Jack.Carter at imgtec.com
Thu Feb 28 10:52:23 PST 2013


Jia,

Try this in : lib/Basic/Targets.cpp ~line 4390

  virtual bool validateAsmConstraint(const char *&Name,
                                     TargetInfo::ConstraintInfo &Info) const {
    switch (*Name) {
    default:
      return false;

    case 'r': // CPU registers.
    case 'd': // Equivalent to "r" unless generating MIPS16 code.
    case 'y': // Equivalent to "r", backwards compatibility only.
    case 'f': // floating-point registers.
    case 'c': // $25 for indirect jumps
    case 'l': // lo register
    case 'x': // hilo register pair
      Info.setAllowsRegister();
      return true;
    case 'R': // An address tha can be sued in a non-macro load or store
      Info.setAllowsMemory();
      return true;
    }

Jack

On 02/28/2013 08:12 AM, Jia Liu wrote:> Hi all,
>
> I find clang-mips doesn't support constraint 'R' and I'm trying make
> LLVM/Clang support it.
> I did a little job, but Clang can not generate right code, it use the
> same register in inline asm,
> and the binary will segment fault in MIPS environment.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130228/95b8ad79/attachment.html>


More information about the cfe-dev mailing list