2003-09-30 20:37:50 +02:00
|
|
|
//===-- llvm/Instruction.def - File that describes Instructions -*- C++ -*-===//
|
2003-10-20 22:19:47 +02:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2001-10-14 19:24:33 +02:00
|
|
|
//
|
|
|
|
// This file contains descriptions of the various LLVM instructions. This is
|
|
|
|
// used as a central place for enumerating the different instructions and
|
|
|
|
// should eventually be the place to put comments about the instructions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// NOTE: NO INCLUDE GUARD DESIRED!
|
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
// Provide definitions of macros so that users of this file do not have to define
|
2001-10-14 19:24:33 +02:00
|
|
|
// everything to use it...
|
|
|
|
//
|
|
|
|
#ifndef FIRST_TERM_INST
|
|
|
|
#define FIRST_TERM_INST(num)
|
|
|
|
#endif
|
|
|
|
#ifndef HANDLE_TERM_INST
|
2002-03-19 06:51:18 +01:00
|
|
|
#ifndef HANDLE_INST
|
|
|
|
#define HANDLE_TERM_INST(num, opcode, Class)
|
|
|
|
#else
|
|
|
|
#define HANDLE_TERM_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
|
|
|
|
#endif
|
2001-10-14 19:24:33 +02:00
|
|
|
#endif
|
|
|
|
#ifndef LAST_TERM_INST
|
|
|
|
#define LAST_TERM_INST(num)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FIRST_BINARY_INST
|
|
|
|
#define FIRST_BINARY_INST(num)
|
|
|
|
#endif
|
|
|
|
#ifndef HANDLE_BINARY_INST
|
2002-03-19 06:51:18 +01:00
|
|
|
#ifndef HANDLE_INST
|
2001-10-14 19:24:33 +02:00
|
|
|
#define HANDLE_BINARY_INST(num, opcode, instclass)
|
2002-03-19 06:51:18 +01:00
|
|
|
#else
|
|
|
|
#define HANDLE_BINARY_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
|
|
|
|
#endif
|
2001-10-14 19:24:33 +02:00
|
|
|
#endif
|
|
|
|
#ifndef LAST_BINARY_INST
|
|
|
|
#define LAST_BINARY_INST(num)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FIRST_MEMORY_INST
|
|
|
|
#define FIRST_MEMORY_INST(num)
|
|
|
|
#endif
|
|
|
|
#ifndef HANDLE_MEMORY_INST
|
2002-03-19 06:51:18 +01:00
|
|
|
#ifndef HANDLE_INST
|
|
|
|
#define HANDLE_MEMORY_INST(num, opcode, Class)
|
|
|
|
#else
|
|
|
|
#define HANDLE_MEMORY_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
|
|
|
|
#endif
|
2001-10-14 19:24:33 +02:00
|
|
|
#endif
|
|
|
|
#ifndef LAST_MEMORY_INST
|
|
|
|
#define LAST_MEMORY_INST(num)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FIRST_OTHER_INST
|
|
|
|
#define FIRST_OTHER_INST(num)
|
|
|
|
#endif
|
|
|
|
#ifndef HANDLE_OTHER_INST
|
2002-03-19 06:51:18 +01:00
|
|
|
#ifndef HANDLE_INST
|
|
|
|
#define HANDLE_OTHER_INST(num, opcode, Class)
|
|
|
|
#else
|
|
|
|
#define HANDLE_OTHER_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
|
|
|
|
#endif
|
2001-10-14 19:24:33 +02:00
|
|
|
#endif
|
|
|
|
#ifndef LAST_OTHER_INST
|
|
|
|
#define LAST_OTHER_INST(num)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Terminator Instructions - These instructions are used to terminate a basic
|
|
|
|
// block of the program. Every basic block must end with one of these
|
|
|
|
// instructions for it to be a well formed basic block.
|
|
|
|
//
|
|
|
|
FIRST_TERM_INST ( 1)
|
2004-10-16 20:05:37 +02:00
|
|
|
HANDLE_TERM_INST ( 1, Ret , ReturnInst)
|
|
|
|
HANDLE_TERM_INST ( 2, Br , BranchInst)
|
|
|
|
HANDLE_TERM_INST ( 3, Switch , SwitchInst)
|
|
|
|
HANDLE_TERM_INST ( 4, Invoke , InvokeInst)
|
|
|
|
HANDLE_TERM_INST ( 5, Unwind , UnwindInst)
|
|
|
|
HANDLE_TERM_INST ( 6, Unreachable, UnreachableInst)
|
|
|
|
LAST_TERM_INST ( 6)
|
2001-10-14 19:24:33 +02:00
|
|
|
|
|
|
|
// Standard binary operators...
|
2004-10-16 20:05:37 +02:00
|
|
|
FIRST_BINARY_INST( 7)
|
|
|
|
HANDLE_BINARY_INST( 7, Add , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST( 8, Sub , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST( 9, Mul , BinaryOperator)
|
2006-10-26 08:15:43 +02:00
|
|
|
HANDLE_BINARY_INST(10, UDiv , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(11, SDiv , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(12, FDiv , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(13, Rem , BinaryOperator)
|
2001-10-14 19:24:33 +02:00
|
|
|
|
|
|
|
// Logical operators...
|
2006-10-26 08:15:43 +02:00
|
|
|
HANDLE_BINARY_INST(14, And , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(15, Or , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(16, Xor , BinaryOperator)
|
2001-10-14 19:24:33 +02:00
|
|
|
|
|
|
|
// Binary comparison operators...
|
2006-10-26 08:15:43 +02:00
|
|
|
HANDLE_BINARY_INST(17, SetEQ , SetCondInst)
|
|
|
|
HANDLE_BINARY_INST(18, SetNE , SetCondInst)
|
|
|
|
HANDLE_BINARY_INST(19, SetLE , SetCondInst)
|
|
|
|
HANDLE_BINARY_INST(20, SetGE , SetCondInst)
|
|
|
|
HANDLE_BINARY_INST(21, SetLT , SetCondInst)
|
|
|
|
HANDLE_BINARY_INST(22, SetGT , SetCondInst)
|
|
|
|
LAST_BINARY_INST(22)
|
2001-10-14 19:24:33 +02:00
|
|
|
|
|
|
|
// Memory operators...
|
2006-10-26 08:15:43 +02:00
|
|
|
FIRST_MEMORY_INST(23)
|
|
|
|
HANDLE_MEMORY_INST(23, Malloc, MallocInst) // Heap management instructions
|
|
|
|
HANDLE_MEMORY_INST(24, Free , FreeInst )
|
|
|
|
HANDLE_MEMORY_INST(25, Alloca, AllocaInst) // Stack management
|
|
|
|
HANDLE_MEMORY_INST(26, Load , LoadInst ) // Memory manipulation instrs
|
|
|
|
HANDLE_MEMORY_INST(27, Store , StoreInst )
|
|
|
|
HANDLE_MEMORY_INST(28, GetElementPtr, GetElementPtrInst)
|
|
|
|
LAST_MEMORY_INST(28)
|
2001-10-14 19:24:33 +02:00
|
|
|
|
|
|
|
// Other operators...
|
2006-10-26 08:15:43 +02:00
|
|
|
FIRST_OTHER_INST(29)
|
|
|
|
HANDLE_OTHER_INST(29, PHI , PHINode ) // PHI node instruction
|
|
|
|
HANDLE_OTHER_INST(30, Cast , CastInst ) // Type cast
|
|
|
|
HANDLE_OTHER_INST(31, Call , CallInst ) // Call a function
|
|
|
|
HANDLE_OTHER_INST(32, Shl , ShiftInst ) // Shift operations
|
|
|
|
HANDLE_OTHER_INST(33, Shr , ShiftInst )
|
2004-10-16 20:05:37 +02:00
|
|
|
HANDLE_OTHER_INST(34, Select , SelectInst ) // select instruction
|
|
|
|
HANDLE_OTHER_INST(35, UserOp1, Instruction) // May be used internally in a pass
|
|
|
|
HANDLE_OTHER_INST(36, UserOp2, Instruction)
|
2005-06-24 20:17:33 +02:00
|
|
|
HANDLE_OTHER_INST(37, VAArg , VAArgInst ) // vaarg instruction
|
2006-04-08 03:15:18 +02:00
|
|
|
HANDLE_OTHER_INST(38, ExtractElement, ExtractElementInst)// extract from vector.
|
|
|
|
HANDLE_OTHER_INST(39, InsertElement, InsertElementInst) // insert into vector
|
|
|
|
HANDLE_OTHER_INST(40, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
|
|
|
|
LAST_OTHER_INST(40)
|
2001-10-14 19:24:33 +02:00
|
|
|
|
|
|
|
#undef FIRST_TERM_INST
|
|
|
|
#undef HANDLE_TERM_INST
|
|
|
|
#undef LAST_TERM_INST
|
|
|
|
|
|
|
|
#undef FIRST_BINARY_INST
|
|
|
|
#undef HANDLE_BINARY_INST
|
|
|
|
#undef LAST_BINARY_INST
|
|
|
|
|
|
|
|
#undef FIRST_MEMORY_INST
|
|
|
|
#undef HANDLE_MEMORY_INST
|
|
|
|
#undef LAST_MEMORY_INST
|
|
|
|
|
|
|
|
#undef FIRST_OTHER_INST
|
|
|
|
#undef HANDLE_OTHER_INST
|
|
|
|
#undef LAST_OTHER_INST
|
|
|
|
|
2002-03-19 06:51:18 +01:00
|
|
|
#ifdef HANDLE_INST
|
|
|
|
#undef HANDLE_INST
|
|
|
|
#endif
|