Author: davide
Date: Fri Sep 14 11:55:31 2018
New Revision: 342262

URL: http://llvm.org/viewvc/llvm-project?rev=342262&view=rev
Log:
[IRInterpreter] Fall back to JIT with 128-bit values.

They're not that common, and falling back is definitely
better than throwing an error instead of the result. If we
feel motivated, we might end up implementing support for these,
but it's unclear whether it's worth the effort/complexity.

Fixes PR38925.

<rdar://problem/44436068>

Added:
    lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/
    
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Makefile
    
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
    
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/main.c
Modified:
    lldb/trunk/source/Expression/IRInterpreter.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Makefile?rev=342262&view=auto
==============================================================================
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Makefile
 Fri Sep 14 11:55:31 2018
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py?rev=342262&view=auto
==============================================================================
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
 Fri Sep 14 11:55:31 2018
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), None)

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/main.c?rev=342262&view=auto
==============================================================================
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/main.c
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/main.c
 Fri Sep 14 11:55:31 2018
@@ -0,0 +1,8 @@
+int main(void)
+{
+    __int128_t n = 1;
+    n = n + n;
+    return n; //%self.expect("p n", substrs=['(__int128_t) $0 = 2'])
+              //%self.expect("p n + 6", substrs=['(__int128) $1 = 8'])
+              //%self.expect("p n + n", substrs=['(__int128) $2 = 4'])
+}

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=342262&r1=342261&r2=342262&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Fri Sep 14 11:55:31 2018
@@ -613,6 +613,18 @@ bool IRInterpreter::CanInterpret(llvm::M
         }
         }
 
+        // The IR interpreter currently doesn't know about
+        // 128-bit integers. As they're not that frequent,
+        // we can just fall back to the JIT rather than
+        // choking.
+        if (operand_type->getPrimitiveSizeInBits() > 64) {
+          if (log)
+            log->Printf("Unsupported operand type: %s",
+                        PrintType(operand_type).c_str());
+          error.SetErrorString(unsupported_operand_error);
+          return false;
+        }
+
         if (Constant *constant = llvm::dyn_cast<Constant>(operand)) {
           if (!CanResolveConstant(constant)) {
             if (log)


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to