Skip to content

Commit 6bb6ba0

Browse files
authored
Fixed InstructionBuilder.Trap() to generate a trap instead of debugtrap and added some more clarifying docs on the intrinsic name matching (#53)
1 parent e4d63a9 commit 6bb6ba0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Llvm.NET/BitcodeModule.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,18 @@ public Function CreateFunction( string name
782782
/// <param name="name">Name of the intrinsic</param>
783783
/// <param name="args">Args for the intrinsic</param>
784784
/// <returns>Function declaration</returns>
785+
/// <remarks>
786+
/// This method will match overloaded intrinsics based on the parameter types. If an intrinsic
787+
/// has no overloads then an exact match is required. If the intrinsic has overloads than a prefix
788+
/// match is used.
789+
/// <note type="important">
790+
/// It is important to note that the prefix match requires the name provided to have a length greater
791+
/// than that of the name of the intrinsic and that the name starts with a matching overloaded intrinsic.
792+
/// for example: 'llvm.memset' would not match the overloaded memset intrinsic but 'llvm.memset.p.i' does.
793+
/// Thus, it is generally a good idea to use the signature from the LLVM documentation without the address
794+
/// space, or bit widths. That is instead of 'llvm.memset.p0i8.i32' use 'llvm.memset.p.i'.
795+
/// </note>
796+
/// </remarks>
785797
public Function GetIntrinsicDeclaration( string name, params ITypeRef[ ] args )
786798
{
787799
uint id = Intrinsic.LookupId( name );

src/Llvm.NET/Instructions/InstructionBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ public CallInstruction DebugTrap( )
12781278
public CallInstruction Trap( )
12791279
{
12801280
var module = GetModuleOrThrow( );
1281-
var func = module.GetIntrinsicDeclaration( "llvm.debugtrap" );
1281+
var func = module.GetIntrinsicDeclaration( "llvm.trap" );
12821282

12831283
return Call( func );
12841284
}

0 commit comments

Comments
 (0)