1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test
Adam Nemet adc8e63b0f [TableGen] Fully resolve class-instance values before defs in multiclasses
By class-instance values I mean 'Class<Arg>' in 'Class<Arg>.Field' or in
'Other<Class<Arg>>' (syntactically s SimpleValue).  This is to differentiate
from unnamed/anonymous record definitions (syntactically an ObjectBody) which
are not affected by this change.

Consider the testcase:

    class Struct<int i> {
      int I = !shl(i, 1);
      int J = !shl(I, 1);
    }

    class Class<Struct s> {
        int Class_J = s.J;
    }

    multiclass MultiClass<int i> {
      def Def : Class<Struct<i>>;
    }

    defm Defm : MultiClass<2>;

Before this fix, DefmDef.Class_J yields !shl(I, 1) instead of 8.

This is the sequence of events.  We start with this:

    multiclass MultiClass<int i> {
      def Def : Class<Struct<i>>;
    }

During ParseDef the anonymous object for the class-instance value is created:

    multiclass Multiclass<int i> {
      def anonymous_0 : Struct<i>;

      def Def : Class<NAME#anonymous_0>;
    }

Then class Struct<i> is added to anonymous_0.  Also Class<NAME#anonymous_0> is
added to Def:

    multiclass Multiclass<int i> {
      def anonymous_0 {
        int I = !shl(i, 1);
        int J = !shl(I, 1);
      }

      def Def {
        int Class_J = NAME#anonymous_0.J;
      }
    }

So far so good but then we move on to instantiating this in the defm
by substituting the template arg 'i'.

This is how the anonymous prototype looks after fully instantiating.

    defm Defm = {
      def Defmanonymous_0 {
         int I = 4;
         int J = !shl(I, 1);
      }

Note that we only resolved the reference to the template arg.  The
non-template-arg reference in 'J' has not been resolved yet.

Then we go on to instantiating the Def prototype:

      def DefmDef {
         int Class_J = NAME#anonymous_0.J;
      }

Which is resolved to Defmanonymous_0.J and then to !shl(I, 1).

When we fully resolve each record in a defm, Defmanonymous_0.J does get set
to 8 but that's too late for its use.

The patch adds a new attribute to the Record class that indicates that this
def is actually a class-instance value that may be *used* by other defs in a
multiclass.  (This is unlike regular defs which don't reference each other and
thus can be resolved indepedently.)  They are then fully resolved before the
other defs while the multiclass is instantiated.

I added vg_leak to the new test.  I am not sure if this is necessary but I
don't think I have a way to test it.  I can also check in without the XFAIL
and let the bots test this part.

Also tested that X86.td.expanded and AAarch64.td.expanded were unchange before
and after this change.  (This issue triggering this problem is a WIP patch.)

Part of <rdar://problem/17688758>

llvm-svn: 217886
2014-09-16 17:14:13 +00:00
..
Analysis AVX-512: added cost for some AVX-512 instructions 2014-09-16 07:57:37 +00:00
Assembler [inline asm] Add a check in InlineAsm::ConstraintInfo::Parse to make sure '{' 2014-09-05 22:30:32 +00:00
Bindings Restore the ability to check if LLVMCreateObjectFile was successful 2014-09-05 21:22:09 +00:00
Bitcode Teach llvm-bcanalyzer to use one stream's BLOCKINFO to read another stream. 2014-08-30 17:07:55 +00:00
BugPoint
CodeGen [FastISel][AArch64] Add vector support to argument lowering. 2014-09-16 00:25:30 +00:00
DebugInfo DebugInfo: Do not use DW_FORM_GNU_addr_index in skeleton CUs, GDB 7.8 errors on this. 2014-09-07 17:31:42 +00:00
ExecutionEngine [MCJIT] Make sure we test ARM BR24 relocations with both internal and external 2014-09-11 22:43:36 +00:00
Feature [AArch64] Update test case to pass with post-RA MI scheduler. 2014-09-13 03:23:23 +00:00
FileCheck FileCheck: Add a flag to allow checking empty input 2014-08-07 18:40:37 +00:00
Instrumentation [asan-assembly-instrumentation] Added CFI directives to the generated instrumentation code. 2014-09-10 09:45:49 +00:00
Integer
JitListener
Linker Merge alignment of common GlobalValue. 2014-09-09 17:48:18 +00:00
LTO
MC [mips] Improve the error messages given by MipsAsmParser. 2014-09-16 15:00:52 +00:00
Object Nuke MCAnalysis. 2014-09-02 22:32:20 +00:00
Other [lit] Parse all strings as UTF-8 rather than ASCII. 2014-09-12 16:46:05 +00:00
TableGen [TableGen] Fully resolve class-instance values before defs in multiclasses 2014-09-16 17:14:13 +00:00
tools tweak test case to help build bot 2014-09-16 04:51:38 +00:00
Transforms [InstCombine] Remove redundant test case. 2014-09-16 08:50:10 +00:00
Unit
Verifier Verifier: Don't reject varargs callee cleanup functions 2014-08-29 21:25:28 +00:00
YAMLParser
.clang-format
CMakeLists.txt Add LLVMgold target to test dependencies. 2014-09-10 22:20:49 +00:00
lit.cfg Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
lit.site.cfg.in Add missing Interpreter intrinsic lowering for sin, cos and ceil 2014-08-08 15:00:12 +00:00
Makefile Delete support for AuroraUX. 2014-08-14 15:15:09 +00:00
Makefile.tests
TestRunner.sh