2003-09-30 18:37:50 +00:00
|
|
|
//===-- llvm/Instruction.def - File that describes Instructions -*- C++ -*-===//
|
2003-10-20 20:19:47 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 22:59:10 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2003-10-20 20:19:47 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2001-10-14 17:24:33 +00: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!
|
|
|
|
|
2006-11-08 06:47:33 +00:00
|
|
|
// Provide definitions of macros so that users of this file do not have to
|
|
|
|
// define everything to use it...
|
2001-10-14 17:24:33 +00:00
|
|
|
//
|
|
|
|
#ifndef FIRST_TERM_INST
|
|
|
|
#define FIRST_TERM_INST(num)
|
|
|
|
#endif
|
|
|
|
#ifndef HANDLE_TERM_INST
|
2002-03-19 05:51:18 +00: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 17:24:33 +00: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 05:51:18 +00:00
|
|
|
#ifndef HANDLE_INST
|
2001-10-14 17:24:33 +00:00
|
|
|
#define HANDLE_BINARY_INST(num, opcode, instclass)
|
2002-03-19 05:51:18 +00:00
|
|
|
#else
|
|
|
|
#define HANDLE_BINARY_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
|
|
|
|
#endif
|
2001-10-14 17:24:33 +00: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 05:51:18 +00: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 17:24:33 +00:00
|
|
|
#endif
|
|
|
|
#ifndef LAST_MEMORY_INST
|
|
|
|
#define LAST_MEMORY_INST(num)
|
|
|
|
#endif
|
|
|
|
|
2006-11-27 01:05:10 +00:00
|
|
|
#ifndef FIRST_CAST_INST
|
|
|
|
#define FIRST_CAST_INST(num)
|
|
|
|
#endif
|
|
|
|
#ifndef HANDLE_CAST_INST
|
|
|
|
#ifndef HANDLE_INST
|
|
|
|
#define HANDLE_CAST_INST(num, opcode, Class)
|
|
|
|
#else
|
|
|
|
#define HANDLE_CAST_INST(num, opcode, Class) HANDLE_INST(num, opcode, Class)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef LAST_CAST_INST
|
|
|
|
#define LAST_CAST_INST(num)
|
|
|
|
#endif
|
|
|
|
|
2001-10-14 17:24:33 +00:00
|
|
|
#ifndef FIRST_OTHER_INST
|
|
|
|
#define FIRST_OTHER_INST(num)
|
|
|
|
#endif
|
|
|
|
#ifndef HANDLE_OTHER_INST
|
2002-03-19 05:51:18 +00: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 17:24:33 +00: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 18:05:37 +00:00
|
|
|
HANDLE_TERM_INST ( 1, Ret , ReturnInst)
|
|
|
|
HANDLE_TERM_INST ( 2, Br , BranchInst)
|
|
|
|
HANDLE_TERM_INST ( 3, Switch , SwitchInst)
|
2009-10-28 00:19:10 +00:00
|
|
|
HANDLE_TERM_INST ( 4, IndirectBr , IndirectBrInst)
|
2009-10-27 19:13:16 +00:00
|
|
|
HANDLE_TERM_INST ( 5, Invoke , InvokeInst)
|
|
|
|
HANDLE_TERM_INST ( 6, Unwind , UnwindInst)
|
2011-07-31 06:30:59 +00:00
|
|
|
HANDLE_TERM_INST ( 7, Resume , ResumeInst)
|
|
|
|
HANDLE_TERM_INST ( 8, Unreachable, UnreachableInst)
|
|
|
|
LAST_TERM_INST ( 8)
|
2001-10-14 17:24:33 +00:00
|
|
|
|
|
|
|
// Standard binary operators...
|
2011-07-31 06:30:59 +00:00
|
|
|
FIRST_BINARY_INST( 9)
|
|
|
|
HANDLE_BINARY_INST( 9, Add , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(10, FAdd , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(11, Sub , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(12, FSub , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(13, Mul , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(14, FMul , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(15, UDiv , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(16, SDiv , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(17, FDiv , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(18, URem , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(19, SRem , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(20, FRem , BinaryOperator)
|
2001-10-14 17:24:33 +00:00
|
|
|
|
2007-02-02 02:16:23 +00:00
|
|
|
// Logical operators (integer operands)
|
2011-07-31 06:30:59 +00:00
|
|
|
HANDLE_BINARY_INST(21, Shl , BinaryOperator) // Shift left (logical)
|
|
|
|
HANDLE_BINARY_INST(22, LShr , BinaryOperator) // Shift right (logical)
|
|
|
|
HANDLE_BINARY_INST(23, AShr , BinaryOperator) // Shift right (arithmetic)
|
|
|
|
HANDLE_BINARY_INST(24, And , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(25, Or , BinaryOperator)
|
|
|
|
HANDLE_BINARY_INST(26, Xor , BinaryOperator)
|
|
|
|
LAST_BINARY_INST(26)
|
2001-10-14 17:24:33 +00:00
|
|
|
|
|
|
|
// Memory operators...
|
2011-07-31 06:30:59 +00:00
|
|
|
FIRST_MEMORY_INST(27)
|
|
|
|
HANDLE_MEMORY_INST(27, Alloca, AllocaInst) // Stack management
|
|
|
|
HANDLE_MEMORY_INST(28, Load , LoadInst ) // Memory manipulation instrs
|
|
|
|
HANDLE_MEMORY_INST(29, Store , StoreInst )
|
|
|
|
HANDLE_MEMORY_INST(30, GetElementPtr, GetElementPtrInst)
|
|
|
|
HANDLE_MEMORY_INST(31, Fence , FenceInst )
|
|
|
|
HANDLE_MEMORY_INST(32, AtomicCmpXchg , AtomicCmpXchgInst )
|
|
|
|
HANDLE_MEMORY_INST(33, AtomicRMW , AtomicRMWInst )
|
|
|
|
LAST_MEMORY_INST(33)
|
2001-10-14 17:24:33 +00:00
|
|
|
|
2006-11-27 01:05:10 +00:00
|
|
|
// Cast operators ...
|
|
|
|
// NOTE: The order matters here because CastInst::isEliminableCastPair
|
|
|
|
// NOTE: (see Instructions.cpp) encodes a table based on this ordering.
|
2011-07-31 06:30:59 +00:00
|
|
|
FIRST_CAST_INST(34)
|
|
|
|
HANDLE_CAST_INST(34, Trunc , TruncInst ) // Truncate integers
|
|
|
|
HANDLE_CAST_INST(35, ZExt , ZExtInst ) // Zero extend integers
|
|
|
|
HANDLE_CAST_INST(36, SExt , SExtInst ) // Sign extend integers
|
|
|
|
HANDLE_CAST_INST(37, FPToUI , FPToUIInst ) // floating point -> UInt
|
|
|
|
HANDLE_CAST_INST(38, FPToSI , FPToSIInst ) // floating point -> SInt
|
|
|
|
HANDLE_CAST_INST(39, UIToFP , UIToFPInst ) // UInt -> floating point
|
|
|
|
HANDLE_CAST_INST(40, SIToFP , SIToFPInst ) // SInt -> floating point
|
|
|
|
HANDLE_CAST_INST(41, FPTrunc , FPTruncInst ) // Truncate floating point
|
|
|
|
HANDLE_CAST_INST(42, FPExt , FPExtInst ) // Extend floating point
|
|
|
|
HANDLE_CAST_INST(43, PtrToInt, PtrToIntInst) // Pointer -> Integer
|
|
|
|
HANDLE_CAST_INST(44, IntToPtr, IntToPtrInst) // Integer -> Pointer
|
|
|
|
HANDLE_CAST_INST(45, BitCast , BitCastInst ) // Type cast
|
|
|
|
LAST_CAST_INST(45)
|
2006-11-27 01:05:10 +00:00
|
|
|
|
2001-10-14 17:24:33 +00:00
|
|
|
// Other operators...
|
2011-07-31 06:30:59 +00:00
|
|
|
FIRST_OTHER_INST(46)
|
|
|
|
HANDLE_OTHER_INST(46, ICmp , ICmpInst ) // Integer comparison instruction
|
|
|
|
HANDLE_OTHER_INST(47, FCmp , FCmpInst ) // Floating point comparison instr.
|
|
|
|
HANDLE_OTHER_INST(48, PHI , PHINode ) // PHI node instruction
|
|
|
|
HANDLE_OTHER_INST(49, Call , CallInst ) // Call a function
|
|
|
|
HANDLE_OTHER_INST(50, Select , SelectInst ) // select instruction
|
|
|
|
HANDLE_OTHER_INST(51, UserOp1, Instruction) // May be used internally in a pass
|
|
|
|
HANDLE_OTHER_INST(52, UserOp2, Instruction) // Internal to passes only
|
|
|
|
HANDLE_OTHER_INST(53, VAArg , VAArgInst ) // vaarg instruction
|
|
|
|
HANDLE_OTHER_INST(54, ExtractElement, ExtractElementInst)// extract from vector
|
|
|
|
HANDLE_OTHER_INST(55, InsertElement, InsertElementInst) // insert into vector
|
|
|
|
HANDLE_OTHER_INST(56, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
|
|
|
|
HANDLE_OTHER_INST(57, ExtractValue, ExtractValueInst)// extract from aggregate
|
|
|
|
HANDLE_OTHER_INST(58, InsertValue, InsertValueInst) // insert into aggregate
|
2011-08-12 20:24:12 +00:00
|
|
|
HANDLE_OTHER_INST(59, LandingPad, LandingPadInst) // Landing pad instruction.
|
|
|
|
LAST_OTHER_INST(59)
|
2001-10-14 17:24:33 +00: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
|
|
|
|
|
2006-11-27 01:05:10 +00:00
|
|
|
#undef FIRST_CAST_INST
|
|
|
|
#undef HANDLE_CAST_INST
|
|
|
|
#undef LAST_CAST_INST
|
|
|
|
|
2001-10-14 17:24:33 +00:00
|
|
|
#undef FIRST_OTHER_INST
|
|
|
|
#undef HANDLE_OTHER_INST
|
|
|
|
#undef LAST_OTHER_INST
|
|
|
|
|
2002-03-19 05:51:18 +00:00
|
|
|
#ifdef HANDLE_INST
|
|
|
|
#undef HANDLE_INST
|
|
|
|
#endif
|