llvm.org GIT mirror llvm / 9562add
Add functions to buld X86 specific constructs git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4714 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 17 years ago
1 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 //===-- X86InstrBuilder.h - Functions to aid building x86 insts -*- C++ -*-===//
1 //
2 // This file exposes functions that may be used with BuildMI from the
3 // MachineInstrBuilder.h file to handle X86'isms in a clean way.
4 //
5 // The BuildMem function may be used with the BuildMI function to add entire
6 // memory references in a single, typed, function call. X86 memory references
7 // can be very complex expressions (described in the README), so wrapping them
8 // up behind an easier to use interface makes sense. Descriptions of the
9 // functions are included below.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef X86INSTRBUILDER_H
14 #define X86INSTRBUILDER_H
15
16 #include "llvm/CodeGen/MachineInstrBuilder.h"
17
18 /// addDirectMem - This function is used to add a direct memory reference to the
19 /// current instruction. Because memory references are always represented with
20 /// four values, this adds: Reg, [1, NoReg, 0] to the instruction
21 ///
22 inline const MachineInstrBuilder &addDirectMem(const MachineInstrBuilder &MIB,
23 unsigned Reg) {
24 return MIB.addReg(Reg).addZImm(1).addMReg(0).addSImm(0);
25 }
26
27 #endif