static_inst.hh (12404:fe5af2331a48) static_inst.hh (12614:0bc465e1f5fb)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 *
29 * Authors: Steve Reinhardt
30 */
31
32#ifndef __CPU_STATIC_INST_HH__
33#define __CPU_STATIC_INST_HH__
34
35#include <bitset>
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 *
29 * Authors: Steve Reinhardt
30 */
31
32#ifndef __CPU_STATIC_INST_HH__
33#define __CPU_STATIC_INST_HH__
34
35#include <bitset>
36#include <memory>
36#include <string>
37
38#include "arch/registers.hh"
39#include "arch/types.hh"
40#include "base/logging.hh"
41#include "base/refcnt.hh"
42#include "base/types.hh"
43#include "config/the_isa.hh"
44#include "cpu/op_class.hh"
45#include "cpu/reg_class.hh"
46#include "cpu/reg_class_impl.hh"
47#include "cpu/static_inst_fwd.hh"
48#include "cpu/thread_context.hh"
49#include "enums/StaticInstFlags.hh"
37#include <string>
38
39#include "arch/registers.hh"
40#include "arch/types.hh"
41#include "base/logging.hh"
42#include "base/refcnt.hh"
43#include "base/types.hh"
44#include "config/the_isa.hh"
45#include "cpu/op_class.hh"
46#include "cpu/reg_class.hh"
47#include "cpu/reg_class_impl.hh"
48#include "cpu/static_inst_fwd.hh"
49#include "cpu/thread_context.hh"
50#include "enums/StaticInstFlags.hh"
51#include "sim/byteswap.hh"
50
51// forward declarations
52class Packet;
53
54class ExecContext;
55
56class SymbolTable;
57

--- 254 unchanged lines hidden (view full) ---

312 /**
313 * Print a separator separated list of this instruction's set flag
314 * names on the given stream.
315 */
316 void printFlags(std::ostream &outs, const std::string &separator) const;
317
318 /// Return name of machine instruction
319 std::string getName() { return mnemonic; }
52
53// forward declarations
54class Packet;
55
56class ExecContext;
57
58class SymbolTable;
59

--- 254 unchanged lines hidden (view full) ---

314 /**
315 * Print a separator separated list of this instruction's set flag
316 * names on the given stream.
317 */
318 void printFlags(std::ostream &outs, const std::string &separator) const;
319
320 /// Return name of machine instruction
321 std::string getName() { return mnemonic; }
322
323 protected:
324 template<typename T>
325 size_t
326 simpleAsBytes(void *buf, size_t max_size, const T &t)
327 {
328 size_t size = sizeof(T);
329 if (size <= max_size)
330 *reinterpret_cast<T *>(buf) = htole<T>(t);
331 return size;
332 }
333
334 public:
335 /**
336 * Instruction classes can override this function to return a
337 * a representation of themselves as a blob of bytes, generally assumed to
338 * be that instructions ExtMachInst.
339 *
340 * buf is a buffer to hold the bytes.
341 * max_size is the size allocated for that buffer by the caller.
342 * The return value is how much data was actually put into the buffer,
343 * zero if no data was put in the buffer, or the necessary size of the
344 * buffer if there wasn't enough space.
345 */
346 virtual size_t asBytes(void *buf, size_t max_size) { return 0; }
320};
321
322#endif // __CPU_STATIC_INST_HH__
347};
348
349#endif // __CPU_STATIC_INST_HH__