r372455 - [Clang Interpreter] Fixed Bug 43362, build failure on GCC

2019-09-20 Thread Nandor Licker via cfe-commits
Author: nand
Date: Fri Sep 20 22:29:18 2019
New Revision: 372455

URL: http://llvm.org/viewvc/llvm-project?rev=372455&view=rev
Log:
[Clang Interpreter] Fixed Bug 43362, build failure on GCC

free() was not directly included in InterpStack.cpp, added include now.

Modified:
cfe/trunk/lib/AST/Interp/InterpStack.cpp

Modified: cfe/trunk/lib/AST/Interp/InterpStack.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Interp/InterpStack.cpp?rev=372455&r1=372454&r2=372455&view=diff
==
--- cfe/trunk/lib/AST/Interp/InterpStack.cpp (original)
+++ cfe/trunk/lib/AST/Interp/InterpStack.cpp Fri Sep 20 22:29:18 2019
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include 
+#include 
 #include "InterpStack.h"
 
 using namespace clang;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] b3387d1 - [ConstExprPreter] Updated constant interpreter documentation

2020-04-15 Thread Nandor Licker via cfe-commits

Author: Nandor Licker
Date: 2020-04-15T11:25:23+01:00
New Revision: b3387d1c30ae7da28b34378fb5d9bc29a213e991

URL: 
https://github.com/llvm/llvm-project/commit/b3387d1c30ae7da28b34378fb5d9bc29a213e991
DIFF: 
https://github.com/llvm/llvm-project/commit/b3387d1c30ae7da28b34378fb5d9bc29a213e991.diff

LOG: [ConstExprPreter] Updated constant interpreter documentation

Summary:
Updated the documentation to better reflect features implemented on the
constexpr branch at https://github.com/nandor/llvm-project and extended
the TODO list with known missing features

Reviewers: rsmith, Bigcheese, dexonsmith, jfb

Subscribers: lebedev.ri, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75726

Added: 


Modified: 
clang/docs/ConstantInterpreter.rst

Removed: 




diff  --git a/clang/docs/ConstantInterpreter.rst 
b/clang/docs/ConstantInterpreter.rst
index a86161c8fa01..67a17c75607e 100644
--- a/clang/docs/ConstantInterpreter.rst
+++ b/clang/docs/ConstantInterpreter.rst
@@ -8,129 +8,256 @@ Constant Interpreter
 Introduction
 
 
-The constexpr interpreter aims to replace the existing tree evaluator in 
clang, improving performance on constructs which are executed inefficiently by 
the evaluator. The interpreter is activated using the following flags:
+The constexpr interpreter aims to replace the existing tree evaluator in
+clang, improving performance on constructs which are executed inefficiently
+by the evaluator. The interpreter is activated using the following flags:
 
-* ``-fexperimental-new-constant-interpreter`` enables the interpreter, 
emitting an error if an unsupported feature is encountered
+* ``-fexperimental-new-constant-interpreter`` enables the interpreter,
+emitting an error if an unsupported feature is encountered
 
 Bytecode Compilation
 
 
-Bytecode compilation is handled in ``ByteCodeStmtGen.h`` for statements and 
``ByteCodeExprGen.h`` for expressions. The compiler has two 
diff erent backends: one to generate bytecode for functions 
(``ByteCodeEmitter``) and one to directly evaluate expressions as they are 
compiled, without generating bytecode (``EvalEmitter``). All functions are 
compiled to bytecode, while toplevel expressions used in constant contexts are 
directly evaluated since the bytecode would never be reused. This mechanism 
aims to pave the way towards replacing the evaluator, improving its performance 
on functions and loops, while being just as fast on single-use toplevel 
expressions.
-
-The interpreter relies on stack-based, strongly-typed opcodes. The glue logic 
between the code generator, along with the enumeration and description of 
opcodes, can be found in ``Opcodes.td``. The opcodes are implemented as generic 
template methods in ``Interp.h`` and instantiated with the relevant primitive 
types by the interpreter loop or by the evaluating emitter.
+Bytecode compilation is handled in ``ByteCodeStmtGen.h`` for statements
+and ``ByteCodeExprGen.h`` for expressions. The compiler has two 
diff erent
+backends: one to generate bytecode for functions (``ByteCodeEmitter``) and
+one to directly evaluate expressions as they are compiled, without
+generating bytecode (``EvalEmitter``). All functions are compiled to
+bytecode, while toplevel expressions used in constant contexts are directly
+evaluated since the bytecode would never be reused. This mechanism aims to
+pave the way towards replacing the evaluator, improving its performance on
+functions and loops, while being just as fast on single-use toplevel
+expressions.
+
+The interpreter relies on stack-based, strongly-typed opcodes. The glue
+logic between the code generator, along with the enumeration and
+description of opcodes, can be found in ``Opcodes.td``. The opcodes are
+implemented as generic template methods in ``Interp.h`` and instantiated
+with the relevant primitive types by the interpreter loop or by the
+evaluating emitter.
 
 Primitive Types
 ---
 
 * ``PT_{U|S}int{8|16|32|64}``
 
-  Signed or unsigned integers of a specific bit width, implemented using the 
```Integral``` type.
+  Signed or unsigned integers of a specific bit width, implemented using
+  the ```Integral``` type.
 
 * ``PT_{U|S}intFP``
 
-  Signed or unsigned integers of an arbitrary, but fixed width used to 
implement
-  integral types which are required by the target, but are not supported by 
the host.
-  Under the hood, they rely on APValue. The ``Integral`` specialisation for 
these
-  types is required by opcodes to share an implementation with fixed integrals.
+  Signed or unsigned integers of an arbitrary, but fixed width used to
+  implement integral types which are required by the target, but are not
+  supported by the host. Under the hood, they rely on APValue. The
+  ``Integral`` specialisation for these types is required by opcodes to
+  share an implementation with fixed integ

r370412 - [NFC] Test commit - sorted headers.

2019-08-29 Thread Nandor Licker via cfe-commits
Author: nand
Date: Thu Aug 29 14:57:47 2019
New Revision: 370412

URL: http://llvm.org/viewvc/llvm-project?rev=370412&view=rev
Log:
[NFC] Test commit - sorted headers.

Modified:
cfe/trunk/lib/AST/ExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=370412&r1=370411&r2=370412&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Aug 29 14:57:47 2019
@@ -36,9 +36,9 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTDiagnostic.h"
 #include "clang/AST/ASTLambda.h"
+#include "clang/AST/CXXInheritance.h"
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/CurrentSourceLocExprScope.h"
-#include "clang/AST/CXXInheritance.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/OSLog.h"
 #include "clang/AST/RecordLayout.h"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r370481 - Revert [Clang Interpreter] Initial patch for the constexpr interpreter

2019-08-30 Thread Nandor Licker via cfe-commits
Author: nand
Date: Fri Aug 30 08:41:45 2019
New Revision: 370481

URL: http://llvm.org/viewvc/llvm-project?rev=370481&view=rev
Log:
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370476 (git commit a5590950549719d0d9ea69ed164b0c8c0f4e02e6)

Removed:
cfe/trunk/docs/ConstantInterpreter.rst
cfe/trunk/include/clang/Basic/OptionalDiagnostic.h
cfe/trunk/lib/AST/Interp/
cfe/trunk/test/AST/Interp/
cfe/trunk/utils/TableGen/ClangOpcodesEmitter.cpp
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/CMakeLists.txt
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp
cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp
cfe/trunk/test/SemaCXX/shift.cpp
cfe/trunk/utils/TableGen/CMakeLists.txt
cfe/trunk/utils/TableGen/TableGen.cpp
cfe/trunk/utils/TableGen/TableGenBackends.h

Removed: cfe/trunk/docs/ConstantInterpreter.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ConstantInterpreter.rst?rev=370480&view=auto
==
--- cfe/trunk/docs/ConstantInterpreter.rst (original)
+++ cfe/trunk/docs/ConstantInterpreter.rst (removed)
@@ -1,194 +0,0 @@
-
-Constant Interpreter
-
-
-.. contents::
-   :local:
-
-Introduction
-
-
-The constexpr interpreter aims to replace the existing tree evaluator in 
clang, improving performance on constructs which are executed inefficiently by 
the evaluator. The interpreter is activated using the following flags:
-
-* ``-fexperimental-new-constant-interpreter`` enables the interpreter, falling 
back to the evaluator for unsupported features
-* ``-fforce-experimental-new-constant-interpreter`` forces the use of the 
interpreter, bailing out if an unsupported feature is encountered
-
-Bytecode Compilation
-
-
-Bytecode compilation is handled in ``ByteCodeStmtGen.h`` for statements and 
``ByteCodeExprGen.h`` for expressions. The compiler has two different backends: 
one to generate bytecode for functions (``ByteCodeEmitter``) and one to 
directly evaluate expressions as they are compiled, without generating bytecode 
(``EvalEmitter``). All functions are compiled to bytecode, while toplevel 
expressions used in constant contexts are directly evaluated since the bytecode 
would never be reused. This mechanism aims to pave the way towards replacing 
the evaluator, improving its performance on functions and loops, while being 
just as fast on single-use toplevel expressions.
-
-The interpreter relies on stack-based, strongly-typed opcodes. The glue logic 
between the code generator, along with the enumeration and description of 
opcodes, can be found in ``Opcodes.td``. The opcodes are implemented as generic 
template methods in ``Interp.h`` and instantiated with the relevant primitive 
types by the interpreter loop or by the evaluating emitter.
-
-Primitive Types

-
-* ``PT_{U|S}int{8|16|32|64}``
-
-  Signed or unsigned integers of a specific bit width, implemented using the 
```Integral``` type.
-
-* ``PT_{U|S}intFP``
-
-  Signed or unsigned integers of an arbitrary, but fixed width used to 
implement
-  integral types which are required by the target, but are not supported by 
the host.
-  Under the hood, they rely on APValue. The ``Integral`` specialisation for 
these
-  types is required by opcodes to share an implementation with fixed integrals.
-
-* ``PT_Bool``
-
-  Representation for boolean types, essentially a 1-bit unsigned ``Integral``.
-
-* ``PT_RealFP``
-
-  Arbitrary, but fixed precision floating point numbers. Could be specialised 
in
-  the future similarly to integers in order to improve floating point 
performance.
-
-* ``PT_Ptr``
-
-  Pointer type, defined in ``"Pointer.h"``.
-
-* ``PT_FnPtr``
-
-  Function pointer type, can also be a null function pointer. Defined in 
``"Pointer.h"``.
-
-* ``PT_MemPtr``
-
-  Member pointer type, can also be a null member pointer. Defined in 
``"Pointer.h"``
-
-Composite types

-
-The interpreter distinguishes two kinds of composite types: arrays and 
records. Unions are represented as records, except a single field can be marked 
as active. The contents of inactive fields are kept until they
-are reactivated and overwritten.
-
-
-Bytecode Execution
-==
-
-Bytecode is executed using a stack-based interpreter. The execution context 
consists of an ``InterpStack``, along with a chain of ``InterpFrame`` objects 
storing the call frames. Frames are built by call instructions and destroyed by 
return instructions. They perform one alloc

r370535 - Revert [Clang Interpreter] Initial patch for the constexpr interpreter

2019-08-30 Thread Nandor Licker via cfe-commits
Author: nand
Date: Fri Aug 30 14:32:00 2019
New Revision: 370535

URL: http://llvm.org/viewvc/llvm-project?rev=370535&view=rev
Log:
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370531 (git commit d4c1002e0ab50f6891cdd2f5bd3a8f3a3584)

Removed:
cfe/trunk/docs/ConstantInterpreter.rst
cfe/trunk/include/clang/Basic/OptionalDiagnostic.h
cfe/trunk/lib/AST/Interp/
cfe/trunk/test/AST/Interp/
cfe/trunk/utils/TableGen/ClangOpcodesEmitter.cpp
Modified:
cfe/trunk/docs/index.rst
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/CMakeLists.txt
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp
cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp
cfe/trunk/test/SemaCXX/shift.cpp
cfe/trunk/utils/TableGen/CMakeLists.txt
cfe/trunk/utils/TableGen/TableGen.cpp
cfe/trunk/utils/TableGen/TableGenBackends.h

Removed: cfe/trunk/docs/ConstantInterpreter.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ConstantInterpreter.rst?rev=370534&view=auto
==
--- cfe/trunk/docs/ConstantInterpreter.rst (original)
+++ cfe/trunk/docs/ConstantInterpreter.rst (removed)
@@ -1,194 +0,0 @@
-
-Constant Interpreter
-
-
-.. contents::
-   :local:
-
-Introduction
-
-
-The constexpr interpreter aims to replace the existing tree evaluator in 
clang, improving performance on constructs which are executed inefficiently by 
the evaluator. The interpreter is activated using the following flags:
-
-* ``-fexperimental-new-constant-interpreter`` enables the interpreter, falling 
back to the evaluator for unsupported features
-* ``-fforce-experimental-new-constant-interpreter`` forces the use of the 
interpreter, bailing out if an unsupported feature is encountered
-
-Bytecode Compilation
-
-
-Bytecode compilation is handled in ``ByteCodeStmtGen.h`` for statements and 
``ByteCodeExprGen.h`` for expressions. The compiler has two different backends: 
one to generate bytecode for functions (``ByteCodeEmitter``) and one to 
directly evaluate expressions as they are compiled, without generating bytecode 
(``EvalEmitter``). All functions are compiled to bytecode, while toplevel 
expressions used in constant contexts are directly evaluated since the bytecode 
would never be reused. This mechanism aims to pave the way towards replacing 
the evaluator, improving its performance on functions and loops, while being 
just as fast on single-use toplevel expressions.
-
-The interpreter relies on stack-based, strongly-typed opcodes. The glue logic 
between the code generator, along with the enumeration and description of 
opcodes, can be found in ``Opcodes.td``. The opcodes are implemented as generic 
template methods in ``Interp.h`` and instantiated with the relevant primitive 
types by the interpreter loop or by the evaluating emitter.
-
-Primitive Types

-
-* ``PT_{U|S}int{8|16|32|64}``
-
-  Signed or unsigned integers of a specific bit width, implemented using the 
```Integral``` type.
-
-* ``PT_{U|S}intFP``
-
-  Signed or unsigned integers of an arbitrary, but fixed width used to 
implement
-  integral types which are required by the target, but are not supported by 
the host.
-  Under the hood, they rely on APValue. The ``Integral`` specialisation for 
these
-  types is required by opcodes to share an implementation with fixed integrals.
-
-* ``PT_Bool``
-
-  Representation for boolean types, essentially a 1-bit unsigned ``Integral``.
-
-* ``PT_RealFP``
-
-  Arbitrary, but fixed precision floating point numbers. Could be specialised 
in
-  the future similarly to integers in order to improve floating point 
performance.
-
-* ``PT_Ptr``
-
-  Pointer type, defined in ``"Pointer.h"``.
-
-* ``PT_FnPtr``
-
-  Function pointer type, can also be a null function pointer. Defined in 
``"Pointer.h"``.
-
-* ``PT_MemPtr``
-
-  Member pointer type, can also be a null member pointer. Defined in 
``"Pointer.h"``
-
-Composite types

-
-The interpreter distinguishes two kinds of composite types: arrays and 
records. Unions are represented as records, except a single field can be marked 
as active. The contents of inactive fields are kept until they
-are reactivated and overwritten.
-
-
-Bytecode Execution
-==
-
-Bytecode is executed using a stack-based interpreter. The execution context 
consists of an ``InterpStack``, along with a chain of ``InterpFrame`` objects 
storing the call frames. Frames are built by call instructions and destroyed by 
return instruc

r370588 - Revert [Clang Interpreter] Initial patch for the constexpr interpreter

2019-08-31 Thread Nandor Licker via cfe-commits
Author: nand
Date: Sat Aug 31 08:15:39 2019
New Revision: 370588

URL: http://llvm.org/viewvc/llvm-project?rev=370588&view=rev
Log:
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370584 (git commit afcb3de117265a69d21e5673356e925a454d7d02)

Removed:
cfe/trunk/docs/ConstantInterpreter.rst
cfe/trunk/include/clang/AST/OptionalDiagnostic.h
cfe/trunk/lib/AST/Interp/
cfe/trunk/test/AST/Interp/
cfe/trunk/utils/TableGen/ClangOpcodesEmitter.cpp
Modified:
cfe/trunk/docs/index.rst
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/CMakeLists.txt
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp
cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp
cfe/trunk/test/SemaCXX/shift.cpp
cfe/trunk/utils/TableGen/CMakeLists.txt
cfe/trunk/utils/TableGen/TableGen.cpp
cfe/trunk/utils/TableGen/TableGenBackends.h

Removed: cfe/trunk/docs/ConstantInterpreter.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ConstantInterpreter.rst?rev=370587&view=auto
==
--- cfe/trunk/docs/ConstantInterpreter.rst (original)
+++ cfe/trunk/docs/ConstantInterpreter.rst (removed)
@@ -1,194 +0,0 @@
-
-Constant Interpreter
-
-
-.. contents::
-   :local:
-
-Introduction
-
-
-The constexpr interpreter aims to replace the existing tree evaluator in 
clang, improving performance on constructs which are executed inefficiently by 
the evaluator. The interpreter is activated using the following flags:
-
-* ``-fexperimental-new-constant-interpreter`` enables the interpreter, falling 
back to the evaluator for unsupported features
-* ``-fforce-experimental-new-constant-interpreter`` forces the use of the 
interpreter, bailing out if an unsupported feature is encountered
-
-Bytecode Compilation
-
-
-Bytecode compilation is handled in ``ByteCodeStmtGen.h`` for statements and 
``ByteCodeExprGen.h`` for expressions. The compiler has two different backends: 
one to generate bytecode for functions (``ByteCodeEmitter``) and one to 
directly evaluate expressions as they are compiled, without generating bytecode 
(``EvalEmitter``). All functions are compiled to bytecode, while toplevel 
expressions used in constant contexts are directly evaluated since the bytecode 
would never be reused. This mechanism aims to pave the way towards replacing 
the evaluator, improving its performance on functions and loops, while being 
just as fast on single-use toplevel expressions.
-
-The interpreter relies on stack-based, strongly-typed opcodes. The glue logic 
between the code generator, along with the enumeration and description of 
opcodes, can be found in ``Opcodes.td``. The opcodes are implemented as generic 
template methods in ``Interp.h`` and instantiated with the relevant primitive 
types by the interpreter loop or by the evaluating emitter.
-
-Primitive Types

-
-* ``PT_{U|S}int{8|16|32|64}``
-
-  Signed or unsigned integers of a specific bit width, implemented using the 
```Integral``` type.
-
-* ``PT_{U|S}intFP``
-
-  Signed or unsigned integers of an arbitrary, but fixed width used to 
implement
-  integral types which are required by the target, but are not supported by 
the host.
-  Under the hood, they rely on APValue. The ``Integral`` specialisation for 
these
-  types is required by opcodes to share an implementation with fixed integrals.
-
-* ``PT_Bool``
-
-  Representation for boolean types, essentially a 1-bit unsigned ``Integral``.
-
-* ``PT_RealFP``
-
-  Arbitrary, but fixed precision floating point numbers. Could be specialised 
in
-  the future similarly to integers in order to improve floating point 
performance.
-
-* ``PT_Ptr``
-
-  Pointer type, defined in ``"Pointer.h"``.
-
-* ``PT_FnPtr``
-
-  Function pointer type, can also be a null function pointer. Defined in 
``"Pointer.h"``.
-
-* ``PT_MemPtr``
-
-  Member pointer type, can also be a null member pointer. Defined in 
``"Pointer.h"``
-
-Composite types

-
-The interpreter distinguishes two kinds of composite types: arrays and 
records. Unions are represented as records, except a single field can be marked 
as active. The contents of inactive fields are kept until they
-are reactivated and overwritten.
-
-
-Bytecode Execution
-==
-
-Bytecode is executed using a stack-based interpreter. The execution context 
consists of an ``InterpStack``, along with a chain of ``InterpFrame`` objects 
storing the call frames. Frames are built by call instructions and destroyed by 
return instructi

r370642 - Revert [Clang Interpreter] Initial patch for the constexpr interpreter

2019-09-02 Thread Nandor Licker via cfe-commits
Author: nand
Date: Mon Sep  2 04:34:47 2019
New Revision: 370642

URL: http://llvm.org/viewvc/llvm-project?rev=370642&view=rev
Log:
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370636 (git commit 8327fed9475a14c3376b4860c75370c730e08f33)

Removed:
cfe/trunk/docs/ConstantInterpreter.rst
cfe/trunk/include/clang/AST/OptionalDiagnostic.h
cfe/trunk/lib/AST/Interp/
cfe/trunk/test/AST/Interp/
cfe/trunk/utils/TableGen/ClangOpcodesEmitter.cpp
Modified:
cfe/trunk/docs/index.rst
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/CMakeLists.txt
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp
cfe/trunk/test/SemaCXX/constexpr-many-arguments.cpp
cfe/trunk/test/SemaCXX/shift.cpp
cfe/trunk/utils/TableGen/CMakeLists.txt
cfe/trunk/utils/TableGen/TableGen.cpp
cfe/trunk/utils/TableGen/TableGenBackends.h

Removed: cfe/trunk/docs/ConstantInterpreter.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ConstantInterpreter.rst?rev=370641&view=auto
==
--- cfe/trunk/docs/ConstantInterpreter.rst (original)
+++ cfe/trunk/docs/ConstantInterpreter.rst (removed)
@@ -1,194 +0,0 @@
-
-Constant Interpreter
-
-
-.. contents::
-   :local:
-
-Introduction
-
-
-The constexpr interpreter aims to replace the existing tree evaluator in 
clang, improving performance on constructs which are executed inefficiently by 
the evaluator. The interpreter is activated using the following flags:
-
-* ``-fexperimental-new-constant-interpreter`` enables the interpreter, falling 
back to the evaluator for unsupported features
-* ``-fforce-experimental-new-constant-interpreter`` forces the use of the 
interpreter, bailing out if an unsupported feature is encountered
-
-Bytecode Compilation
-
-
-Bytecode compilation is handled in ``ByteCodeStmtGen.h`` for statements and 
``ByteCodeExprGen.h`` for expressions. The compiler has two different backends: 
one to generate bytecode for functions (``ByteCodeEmitter``) and one to 
directly evaluate expressions as they are compiled, without generating bytecode 
(``EvalEmitter``). All functions are compiled to bytecode, while toplevel 
expressions used in constant contexts are directly evaluated since the bytecode 
would never be reused. This mechanism aims to pave the way towards replacing 
the evaluator, improving its performance on functions and loops, while being 
just as fast on single-use toplevel expressions.
-
-The interpreter relies on stack-based, strongly-typed opcodes. The glue logic 
between the code generator, along with the enumeration and description of 
opcodes, can be found in ``Opcodes.td``. The opcodes are implemented as generic 
template methods in ``Interp.h`` and instantiated with the relevant primitive 
types by the interpreter loop or by the evaluating emitter.
-
-Primitive Types

-
-* ``PT_{U|S}int{8|16|32|64}``
-
-  Signed or unsigned integers of a specific bit width, implemented using the 
```Integral``` type.
-
-* ``PT_{U|S}intFP``
-
-  Signed or unsigned integers of an arbitrary, but fixed width used to 
implement
-  integral types which are required by the target, but are not supported by 
the host.
-  Under the hood, they rely on APValue. The ``Integral`` specialisation for 
these
-  types is required by opcodes to share an implementation with fixed integrals.
-
-* ``PT_Bool``
-
-  Representation for boolean types, essentially a 1-bit unsigned ``Integral``.
-
-* ``PT_RealFP``
-
-  Arbitrary, but fixed precision floating point numbers. Could be specialised 
in
-  the future similarly to integers in order to improve floating point 
performance.
-
-* ``PT_Ptr``
-
-  Pointer type, defined in ``"Pointer.h"``.
-
-* ``PT_FnPtr``
-
-  Function pointer type, can also be a null function pointer. Defined in 
``"Pointer.h"``.
-
-* ``PT_MemPtr``
-
-  Member pointer type, can also be a null member pointer. Defined in 
``"Pointer.h"``
-
-Composite types

-
-The interpreter distinguishes two kinds of composite types: arrays and 
records. Unions are represented as records, except a single field can be marked 
as active. The contents of inactive fields are kept until they
-are reactivated and overwritten.
-
-
-Bytecode Execution
-==
-
-Bytecode is executed using a stack-based interpreter. The execution context 
consists of an ``InterpStack``, along with a chain of ``InterpFrame`` objects 
storing the call frames. Frames are built by call instructions and destroyed by 
return instructi

[clang] f584f04 - [ConstExprPreter] Removed the flag forcing the use of the interpreter

2019-11-27 Thread Nandor Licker via cfe-commits

Author: Nandor Licker
Date: 2019-11-27T20:07:19Z
New Revision: f584f04dab69ab15c8942753a145f0c6e7693bcc

URL: 
https://github.com/llvm/llvm-project/commit/f584f04dab69ab15c8942753a145f0c6e7693bcc
DIFF: 
https://github.com/llvm/llvm-project/commit/f584f04dab69ab15c8942753a145f0c6e7693bcc.diff

LOG: [ConstExprPreter] Removed the flag forcing the use of the interpreter

Summary:
Removed the ```-fforce-experimental-new-constant-interpreter flag```, leaving
only the ```-fexperimental-new-constant-interpreter``` one. The interpreter
now always emits an error on an unsupported feature.

Allowing the interpreter to bail out would require a mapping from APValue to
interpreter memory, which will not be necessary in the final version. It is
more sensible to always emit an error if the interpreter fails.

Reviewers: jfb, Bigcheese, rsmith, dexonsmith

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70071

Added: 


Modified: 
clang/docs/ConstantInterpreter.rst
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/lib/AST/ExprConstant.cpp
clang/lib/AST/Interp/Context.cpp
clang/lib/AST/Interp/Context.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/AST/Interp/cond.cpp

Removed: 




diff  --git a/clang/docs/ConstantInterpreter.rst 
b/clang/docs/ConstantInterpreter.rst
index d4fb8f6f34aa..a86161c8fa01 100644
--- a/clang/docs/ConstantInterpreter.rst
+++ b/clang/docs/ConstantInterpreter.rst
@@ -10,8 +10,7 @@ Introduction
 
 The constexpr interpreter aims to replace the existing tree evaluator in 
clang, improving performance on constructs which are executed inefficiently by 
the evaluator. The interpreter is activated using the following flags:
 
-* ``-fexperimental-new-constant-interpreter`` enables the interpreter, falling 
back to the evaluator for unsupported features
-* ``-fforce-experimental-new-constant-interpreter`` forces the use of the 
interpreter, bailing out if an unsupported feature is encountered
+* ``-fexperimental-new-constant-interpreter`` enables the interpreter, 
emitting an error if an unsupported feature is encountered
 
 Bytecode Compilation
 

diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index 82bf379af909..68d6ee1dce42 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -297,8 +297,6 @@ BENIGN_LANGOPT(ConstexprStepLimit, 32, 1048576,
"maximum constexpr evaluation steps")
 BENIGN_LANGOPT(EnableNewConstInterp, 1, 0,
"enable the experimental new constant interpreter")
-BENIGN_LANGOPT(ForceNewConstInterp, 1, 0,
-   "force the use of the experimental new constant interpreter")
 BENIGN_LANGOPT(BracketDepth, 32, 256,
"maximum bracket nesting depth")
 BENIGN_LANGOPT(NumLargeByValueCopy, 32, 0,

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 2d501c09c762..daba98a39dab 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -850,8 +850,6 @@ def fconstexpr_depth_EQ : Joined<["-"], 
"fconstexpr-depth=">, Group;
 def fconstexpr_steps_EQ : Joined<["-"], "fconstexpr-steps=">, Group;
 def fexperimental_new_constant_interpreter : Flag<["-"], 
"fexperimental-new-constant-interpreter">, Group,
   HelpText<"Enable the experimental new constant interpreter">, 
Flags<[CC1Option]>;
-def fforce_experimental_new_constant_interpreter : Flag<["-"], 
"fforce-experimental-new-constant-interpreter">, Group,
-  HelpText<"Force the use of the experimental new constant interpreter, 
failing on missing features">, Flags<[CC1Option]>;
 def fconstexpr_backtrace_limit_EQ : Joined<["-"], 
"fconstexpr-backtrace-limit=">,
 Group;
 def fno_crash_diagnostics : Flag<["-"], "fno-crash-diagnostics">, 
Group, Flags<[NoArgumentUnused, CoreOption]>,

diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index eec9bbdaef80..df80cb4f9440 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -763,11 +763,8 @@ namespace {
 /// we will evaluate.
 unsigned StepsLeft;
 
-/// Force the use of the experimental new constant interpreter, bailing out
-/// with an error if a feature is not supported.
-bool ForceNewConstInterp;
-
-/// Enable the experimental new constant interpreter.
+/// Enable the experimental new constant interpreter. If an expression is
+/// not supported by the interpreter, an error is triggered.
 bool EnableNewConstInterp;
 
 /// BottomFrame - The frame in which evaluation started. This must be
@@ -922,9 +919,7 @@ namespace {
 : Ctx(const_cast(C)), EvalStatus(S), 
CurrentCall(nullptr),

Re: [PATCH] D22419: [CFG] Fix crash in thread sanitizer.

2016-07-18 Thread Nandor Licker via cfe-commits
nandor updated this revision to Diff 64368.
nandor added a comment.

Fixed typo


https://reviews.llvm.org/D22419

Files:
  lib/Analysis/CFG.cpp
  test/SemaCXX/warn-thread-safety-analysis.cpp

Index: test/SemaCXX/warn-thread-safety-analysis.cpp
===
--- test/SemaCXX/warn-thread-safety-analysis.cpp
+++ test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -5160,6 +5160,21 @@
 }  // end namespace  GlobalAcquiredBeforeAfterTest
 
 
+namespace LifetimeExtensionTest {
+
+struct Holder {
+  virtual ~Holder() throw() {}
+  int i = 0;
+};
+
+void test() {
+  // Should not crash.
+  const auto &value = Holder().i;
+}
+
+} // end namespace LifetimeExtensionTest
+
+
 namespace LockableUnions {
 
 union LOCKABLE MutexUnion {
Index: lib/Analysis/CFG.cpp
===
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -3902,7 +3902,20 @@
 case CFGElement::AutomaticObjectDtor: {
   const VarDecl *var = castAs().getVarDecl();
   QualType ty = var->getType();
-  ty = ty.getNonReferenceType();
+
+  // FIXME: See CFGBuilder::addLocalScopeForVarDecl.
+  //
+  // Lifetime-extending constructs are handled here. This works for a 
single
+  // temporary in an initializer expression.
+  if (ty.getTypePtr()->isReferenceType()) {
+if (const Expr *Init = var->getInit()) {
+  if (const ExprWithCleanups *EWC = dyn_cast(Init))
+Init = EWC->getSubExpr();
+  if (isa(Init))
+ty = getReferenceInitTemporaryType(astContext, Init);
+}
+  }
+
   while (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
 ty = arrayType->getElementType();
   }


Index: test/SemaCXX/warn-thread-safety-analysis.cpp
===
--- test/SemaCXX/warn-thread-safety-analysis.cpp
+++ test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -5160,6 +5160,21 @@
 }  // end namespace  GlobalAcquiredBeforeAfterTest
 
 
+namespace LifetimeExtensionTest {
+
+struct Holder {
+  virtual ~Holder() throw() {}
+  int i = 0;
+};
+
+void test() {
+  // Should not crash.
+  const auto &value = Holder().i;
+}
+
+} // end namespace LifetimeExtensionTest
+
+
 namespace LockableUnions {
 
 union LOCKABLE MutexUnion {
Index: lib/Analysis/CFG.cpp
===
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -3902,7 +3902,20 @@
 case CFGElement::AutomaticObjectDtor: {
   const VarDecl *var = castAs().getVarDecl();
   QualType ty = var->getType();
-  ty = ty.getNonReferenceType();
+
+  // FIXME: See CFGBuilder::addLocalScopeForVarDecl.
+  //
+  // Lifetime-extending constructs are handled here. This works for a single
+  // temporary in an initializer expression.
+  if (ty.getTypePtr()->isReferenceType()) {
+if (const Expr *Init = var->getInit()) {
+  if (const ExprWithCleanups *EWC = dyn_cast(Init))
+Init = EWC->getSubExpr();
+  if (isa(Init))
+ty = getReferenceInitTemporaryType(astContext, Init);
+}
+  }
+
   while (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
 ty = arrayType->getElementType();
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22419: [CFG] Fix crash in thread sanitizer.

2016-07-25 Thread Nandor Licker via cfe-commits
nandor added a comment.

ping?


https://reviews.llvm.org/D22419



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


Re: [PATCH] D22419: [CFG] Fix crash in thread sanitizer.

2016-07-26 Thread Nandor Licker via cfe-commits
nandor updated this revision to Diff 65545.
nandor marked an inline comment as done.
nandor added a comment.

removed redundant checks


https://reviews.llvm.org/D22419

Files:
  lib/Analysis/CFG.cpp
  test/SemaCXX/warn-thread-safety-analysis.cpp

Index: test/SemaCXX/warn-thread-safety-analysis.cpp
===
--- test/SemaCXX/warn-thread-safety-analysis.cpp
+++ test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -5160,6 +5160,21 @@
 }  // end namespace  GlobalAcquiredBeforeAfterTest
 
 
+namespace LifetimeExtensionText {
+
+struct Holder {
+  virtual ~Holder() throw() {}
+  int i = 0;
+};
+
+void test() {
+  // Should not crash.
+  const auto &value = Holder().i;
+}
+
+} // end namespace LifetimeExtensionTest
+
+
 namespace LockableUnions {
 
 union LOCKABLE MutexUnion {
Index: lib/Analysis/CFG.cpp
===
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -3902,7 +3902,17 @@
 case CFGElement::AutomaticObjectDtor: {
   const VarDecl *var = castAs().getVarDecl();
   QualType ty = var->getType();
-  ty = ty.getNonReferenceType();
+
+  // FIXME: See CFGBuilder::addLocalScopeForVarDecl.
+  //
+  // Lifetime-extending constructs are handled here. This works for a 
single
+  // temporary in an initializer expression.
+  if (ty->isReferenceType()) {
+if (const Expr *Init = var->getInit()) {
+  ty = getReferenceInitTemporaryType(astContext, Init);
+}
+  }
+
   while (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
 ty = arrayType->getElementType();
   }


Index: test/SemaCXX/warn-thread-safety-analysis.cpp
===
--- test/SemaCXX/warn-thread-safety-analysis.cpp
+++ test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -5160,6 +5160,21 @@
 }  // end namespace  GlobalAcquiredBeforeAfterTest
 
 
+namespace LifetimeExtensionText {
+
+struct Holder {
+  virtual ~Holder() throw() {}
+  int i = 0;
+};
+
+void test() {
+  // Should not crash.
+  const auto &value = Holder().i;
+}
+
+} // end namespace LifetimeExtensionTest
+
+
 namespace LockableUnions {
 
 union LOCKABLE MutexUnion {
Index: lib/Analysis/CFG.cpp
===
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -3902,7 +3902,17 @@
 case CFGElement::AutomaticObjectDtor: {
   const VarDecl *var = castAs().getVarDecl();
   QualType ty = var->getType();
-  ty = ty.getNonReferenceType();
+
+  // FIXME: See CFGBuilder::addLocalScopeForVarDecl.
+  //
+  // Lifetime-extending constructs are handled here. This works for a single
+  // temporary in an initializer expression.
+  if (ty->isReferenceType()) {
+if (const Expr *Init = var->getInit()) {
+  ty = getReferenceInitTemporaryType(astContext, Init);
+}
+  }
+
   while (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
 ty = arrayType->getElementType();
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22419: [CFG] Fix crash in thread sanitizer.

2016-07-26 Thread Nandor Licker via cfe-commits
nandor added a comment.

I'm not an expert in temporaries either, I think for a proper fix a lot more 
work is required.

It seems that the problem is with locating destructors in destructor calls. I 
get the impression that currently a destructor node pointing to the declaration 
is added and the type that is actually destroyed is inferred from the 
expression every time it is needed. I think destructors should be able to point 
to specific temporary subexpressions that they destroy in order to deal with 
multiple temporaries from the same expression.

This fix only ensures that all scenarios which lead to a placement of such a 
destructor node are handled so no SIGSEV occurs due to a destructor being 
added, but not handled at all later on.



Comment at: lib/Analysis/CFG.cpp:3912-3914
@@ +3911,5 @@
+if (const Expr *Init = var->getInit()) {
+  if (const ExprWithCleanups *EWC = dyn_cast(Init))
+Init = EWC->getSubExpr();
+  if (isa(Init))
+ty = getReferenceInitTemporaryType(astContext, Init);

NoQ wrote:
> Is this sequence of checks certainly needed? All tests seem to pass without 
> it. Or maybe it's also needed in `addAutomaticObjectDtors()`? Perhaps just 
> nest these checks inside `getReferenceInitTemporaryType()`?
It seems like getReferenceInitTemporaryType includes these two statements, we 
can remove them from here.


https://reviews.llvm.org/D22419



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


Re: [PATCH] D22419: [CFG] Fix crash in thread sanitizer.

2016-08-02 Thread Nandor Licker via cfe-commits
nandor added a comment.

ping


https://reviews.llvm.org/D22419



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